sei-protocol / sei-js Goto Github PK
View Code? Open in Web Editor NEWSeiJS is a monorepo that contains multiple NPM libraries for writing applications that interact with the Sei network.
SeiJS is a monorepo that contains multiple NPM libraries for writing applications that interact with the Sei network.
Seid version
build time error (next.js):
../../node_modules/@sei-js/cosmjs/dist/esm/utils/serialize.js:9:10
Module not found: Package path ./types/cosmos/tx/v1beta1/tx is not exported from package /../node_modules/@sei-js/proto (see exports field in /../node_modules/@sei-js/proto/package.json)
the line is:
var _tx = require('@sei-js/proto/types/cosmos/tx/v1beta1/tx');
and the @sei-js/proto/package.json
:
"exports": {
".": {
"import": "./dist/esm/index.js",
"require": "./dist/cjs/index.js",
"types": "./dist/types/index.d.ts"
}
}
It only export top level index.*
module. So bundlers cannot build this.
SeiJS package & version
@sei-js/[email protected]
@sei-js/[email protected]
Seid version
N/A
SeiJS package & version
3.1.1
Chain ID
atlantic-2
Describe the bug
(await getQueryClient("https://rest.atlantic-2.seinetwork.io/")).cosmos.tx.v1beta1.getTxsEvent
is always doomed to fail due to the events
not being encoded in a manner the endpoint expects.
To Reproduce
const queryClient = await getQueryClient("https://rest.atlantic-2.seinetwork.io/");
const searchResults = await queryClient.cosmos.tx.v1beta1.getTxsEvent({
events: [
"message.action='/cosmwasm.wasm.v1.MsgExecuteContract'"
],
orderBy: 1 // ORDER_BY_ASC
});
console.log({searchResults});
Throws an error with the response of the endpoint being:
rpc error: code = InvalidArgument desc = invalid event; event should be of the format: {eventType}.{eventAttribute}={value}: invalid request
Expected behavior
The search to succeed.
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
There's no standard on how to decode arrays with querystrings. Some server-side frameworks accept myarray[]=val1&myarray[]=val2
, while others do myarray=val1&myarray=val2
. The version of axios
which @osmonauts/lcd
(As well as @cosmology/lcd
) seemingly depends on serializes arrays as the former while the endpoint expects the latter.
From SyncLinear.com | SEI-6102
Hi @SeiTeam
I wrapped app with SeiWalletProvider and pass "compass" for autoConnect wallet. so it would be connected compass wallet automatically.
But I have available multiple wallets on dapp. so I need to change wallet to leap one. even I changed leap wallet, when I try to submit transaction, it uses "compass" walllet.
import { SUPPORTED_WALLETS } from "@sei-js/core";
import { SeiWalletProvider } from "@sei-js/react";
...
<SeiWalletProvider
chainConfiguration={{
chainId: chainId,
restUrl: restUrl,
rpcUrl: customRpcUrl,
}}
wallets={SUPPORTED_WALLETS}
autoConnect="compass"
>
{children}
</SeiWalletProvider>
How can I change wallet?
const { connectedWallet } = useWallet();
if I console connectedWallet, it shows still "compass" wallet cause I passed "compass" for autoConnect param.
Here are chainId, restUrl and rpcUrl:
const chainId="atlantic-2"
const restUrl="https://rest.atlantic-2.seinetwork.io/"
const rpcUrl="https://rpc.atlantic-2.seinetwork.io/"
What's the solution? Thanks in advance!
SeiJS package & version
"@sei-js/core": "^3.1.2"
Chain ID
pacific-1
Describe the bug
When I try to send executeMultiple, the following message returns: BroadcastTxError: Broadcasting transaction failed with code 13 (codespace: sdk). Log:
. Log is empty...
To Reproduce
Steps to reproduce the behavior:
const wallet = await restoreWallet(SEED_PHRASE)
const addr = (await burnWallet.getAccounts())[0].address
const signingClient = await getSigningCosmWasmClient(RPC_URL, wallet, { gasPrice: GasPrice.fromString("0.01usei"), });
signingClient.executeMultiple(addr, [msgs], "auto")
, msg is: {contractAddress: "", msg: {}}Expected behavior
Execute multiple sends.
Additional context
signingClient.simulate using typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract" work propertly
Error trace:
execute error BroadcastTxError: Broadcasting transaction failed with code 13 (codespace: sdk). Log: at SigningCosmWasmClient.broadcastTx (E:\DEV\Coders 85\testSei\node_modules\@cosmjs\cosmwasm-stargate\build\cosmwasmclient.js:177:35) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async SigningCosmWasmClient.executeMultiple (E:\DEV\Coders 85\testSei\node_modules\@cosmjs\cosmwasm-stargate\build\signingcosmwasmclient.js:215:24) { code: 13, codespace: 'sdk', log: '' }
From SyncLinear.com | SEI-6283
SeiJS package & version
@sei-js/cosmjs: 1.0.5
@sei-js/proto: 4.0.5
@cosmjs/stargate: 0.32.3
Chain ID
testnet
Describe the bug
While running calculate fee like this while trying to get max value to send
const fee = calculateFee(balance, "0.1usei");
It calculates amount for example 4500 usei, balance was 45000usei
then I am sending it, after substracting 45000 usei from balance and sendAmount there is 40500 usei
then i calculate fee once again with balance = 40500 in sendAmount
const send = await signingClient.sendTokens(
activeAccount.address,
receiver,
[sendAmount],
fee,
);
but after this I got this error Log: out of gas in location: ReadPerByte; gasWanted: 45000, gasUsed: 45019: out of gas]
To Reproduce
Described up
Expected behavior
Calculate correct amount of fee and let me send transaction
I simply installed this package and tried to interact with RPC url but got this issue.
PATH/node_modules/@sei-js/core/dist/index.js:58
Object.assign(self, {
^
ReferenceError: self is not defined
Here are my code base
"@sei-js/core": "^3.0.2",
import { getCosmWasmClient } from "@sei-js/core";
async function main() {
const client = await getCosmWasmClient("https://rpc.atlantic-2.seinetwork.io/");
}
main().catch((error) => {
console.error("An error occurred:", error);
})
test
Hello, I installed the @sei-js/[email protected]
package in my React application. When I built an optimized production version, I noticed the bundle size grow by about 4MB even though I only imported getQueryClient
. So I ran webpack-bundle-analyzer on the bundle and noticed that @sei-js/core
and @sei-js/proto
are both built with "module": "commonjs"
in the tsconfig.json
(implicit in the proto packge). Webpack recommends building with ES module support so tree-shaking can work properly (see: https://webpack.js.org/guides/tree-shaking/#conclusion). Would it be possible to build the packages with both commonjs
and es6
module support? This way tree-shaking in Webpack would work properly and reduce integrators' bundle sizes.
Describe the bug
Inheritted issue cosmos/cosmjs#1429
import { generateWallet } from "@sei-js/core";
async function test(){
const wallet = await generateWallet();
await wallet.serialize("password")
}
Iibsodium_wrappers_1.default.crypto_pwhash is undefined
Proposed Solution
Hello teams, I'm following this Guide to build my frontend page, but it's show this:
Seid version
Show us output of seid version --long | head
SeiJS package & version
Check your package.json
for version number and package (core/react/proto)
My package.json file:
"name": "my-next-app",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"@sei-js/core": "^3.1.1",
"@sei-js/react": "^3.1.1",
"next": "14.0.1",
"react": "^18",
"react-dom": "^18"
},
"devDependencies": {
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"autoprefixer": "^10.0.1",
"eslint": "^8",
"eslint-config-next": "14.0.1",
"postcss": "^8",
"tailwindcss": "^3.3.0",
"typescript": "^5"
}
}
This is the same one after initializing a Next.js project with npx create-next-app my-next-app
Chain ID
Which chain are you running into issues with?
chainId: 'atlantic-2'
Describe the bug
A clear and concise description of what the bug is.
The bug seems to be related to the compatibility between the Next.js and the @sei-js package. When I tried to update the following code to _app.tsx, and run:
npm run build
I got the error:
(node:12637) [DEP_WEBPACK_MODULE_ISSUER] DeprecationWarning: Module.issuer: Use new ModuleGraph API
(Use `node --trace-deprecation ...` to show where the warning was created)
Failed to compile.
./node_modules/@sei-js/react/dist/esm/lib/components/WalletConnectButton/styles.css
Global CSS cannot be imported from within node_modules.
Read more: https://nextjs.org/docs/messages/css-npm
Location: node_modules/@sei-js/react/dist/esm/lib/components/WalletConnectButton/WalletConnectButton.js
Import trace for requested module:
./node_modules/@sei-js/react/dist/esm/lib/components/WalletConnectButton/styles.css
./node_modules/@sei-js/react/dist/esm/lib/components/WalletConnectButton/WalletConnectButton.js
./node_modules/@sei-js/react/dist/esm/lib/components/WalletConnectButton/index.js
./node_modules/@sei-js/react/dist/esm/lib/components/index.js
./node_modules/@sei-js/react/dist/esm/lib/index.js
./node_modules/@sei-js/react/dist/esm/index.js
and
./node_modules/@sei-js/react/dist/esm/lib/components/WalletSelectModal/styles.css
Global CSS cannot be imported from within node_modules.
Read more: https://nextjs.org/docs/messages/css-npm
Location: node_modules/@sei-js/react/dist/esm/lib/components/WalletSelectModal/WalletSelectModal.js
Import trace for requested module:
./node_modules/@sei-js/react/dist/esm/lib/components/WalletSelectModal/styles.css
./node_modules/@sei-js/react/dist/esm/lib/components/WalletSelectModal/WalletSelectModal.js
./node_modules/@sei-js/react/dist/esm/lib/components/WalletSelectModal/index.js
./node_modules/@sei-js/react/dist/esm/lib/components/index.js
./node_modules/@sei-js/react/dist/esm/lib/index.js
./node_modules/@sei-js/react/dist/esm/index.js
I did some search only and found that possibly it is because Next.js does not allow CSS import within node_modules but it seems like @sei-js has some internal node_modules imports in e.g. ./node_modules/@sei-js/react/dist/esm/lib/components/WalletSelectModal/WalletSelectModal.js
.
I tried to copy and paste the .css files to the ./styles
folder and failed. I also tried using next-transpile-modules
to change the Next.js's behaviour of CSS import but doesn't seem to work, neither.
Wondering could you provide some insights or solution on how to fix it? Thanks!
To Reproduce
Steps to reproduce the behavior:
npx create-next-app my-next-app
to create a Next.js project. Using the following options:npm install && npm install @sei-js/core @sei-js/react
./pages/_app.tsx
to this:import '@/styles/globals.css'
// import '@/styles/base.css';
import type { AppProps } from 'next/app'
import { SeiWalletProvider } from '@sei-js/react';
import { Inter } from 'next/font/google';
const inter = Inter({
variable: '--font-inter',
subsets: ['latin'],
});
export default function App({ Component, pageProps }: AppProps) {
return (
<SeiWalletProvider
chainConfiguration={{
chainId: 'atlantic-2',
restUrl: 'https://rest.atlantic-2.seinetwork.io',
rpcUrl: 'https://rpc.atlantic-2.seinetwork.io'
}}
wallets={['compass', 'fin']}>
<main className={inter.variable}>
<Component {...pageProps} />
</main>
</SeiWalletProvider>
)
}
npm run build
and the error should occurExpected behavior
I tested the same script with React.js template and works smoothly so I suspect this is a Next.js-related issue.
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.
From SyncLinear.com | SEI-5972
From SyncLinear.com | SEI-6278
Hey all! We'd love to be able to interact with SEI using python protobuffer bindings.
Would you mind creating sei-py and generating protobuffer bindings for python as well?
Warm regards
Marco
@sei-js/[email protected]
packages/core/src/lib/utils/Hash.ts
line: 3
import { Buffer } from 'buffer/';
Error: Cannot find module 'buffer/'
The characters /
is redundant ?
SeiJS package & version
"@sei-js/core": "^3.1.2",
"@sei-js/proto": "^3.1.0",
"@sei-js/react": "^3.2.0",
Describe the bug
According to the first step of Javascript Reference, an error is reported
npm install core/react/proto
ERROR in ./node_modules/@cosmjs/crypto/build/pbkdf2.js 50:67-84
Module not found: Error: Can't resolve 'crypto' in '/Users/ahao/WebstormProjects/sei-react/node_modules/@cosmjs/crypto/build'
I'm having issues with dependencies and modules, here is what I see:
⨯ ../../node_modules/@sei-js/cosmjs/dist/esm/utils/serialize.js:2:0
Module not found: Can't resolve '@sei-js/proto/types/cosmos/tx/v1beta1/tx'
https://nextjs.org/docs/messages/module-not-found
Import trace for requested module:
../../node_modules/@sei-js/cosmjs/dist/esm/utils/index.js
../../node_modules/@sei-js/cosmjs/dist/esm/index.js
./app/components/layout/Header.tsx
./app/components/mint/MintProvider.tsx
⨯ ../../node_modules/@sei-js/cosmjs/dist/esm/utils/serialize.js:2:0
Module not found: Can't resolve '@sei-js/proto/types/cosmos/tx/v1beta1/tx'
Here are my dependencies in package.json
"dependencies": {
"@sei-js/cosmjs": "^1.0.2",
"@sei-js/evm": "^1.0.2",
"@sei-js/proto": "^4.0.3",
"@sei-js/react": "^3.2.0",
}
SeiJS package & version
"@sei-js/cosmjs": "^1.0.5"
, "@sei-js/evm": "^1.0.3"
Describe the bug
I am trying to parse EVM logs that remain in the CosmWasm Log using the Proto library, but I am unable to find the following logic and wonder if it is not supported:
import { seiprotocol } from "@sei-js/proto";
seiprotocol.seichain.evm.MsgEVMTransaction.decode(tx.body.messages[0].value)
Since the upgrade to @sei-js/core v1.3.0 there is an error when I try to enter orders:
Error: Unregistered type url: /seiprotocol.seichain.dex.MsgPlaceOrders
The signing client was created like this:
const { accounts, offlineSigner } = await connect('keplr', 'atlantic-2', seiTestnetRest, seiTestnetRPC);
const signingStargateClient = await getSigningClient(
seiTestnetRPC,
offlineSigner
);
// registry.types doesn't contain any sei type urls
console.log({registry: signingStargateClient.registry})
It looks like the sei types aren't registered. Has the API changed or is there an issue with this version?
@sei-js/core
has a number of cosmjs
dependencies. However, in its current form, for us to make anything... functional... including creating our own helper functions or abstractions which take types that originally come from cosmjs
, we have to import that directly. The main issue with this is that @sei-js/core
specifies an exact version for its cosmjs
dependencies, which means I also have to specify an exact version for cosmjs
dependencies, and hope things don't break with a minor or patch change to @sei-js/core
.
SeiJS package & version
"@sei-js/core": "^3.1.3",
"@sei-js/react": "^3.2.0",
Describe the bug
SeiWalletProvider from @sei-js/react with a Typescript bug
Additional context
its an empty project created now, im starting now developer to sei, it has been created with vite with react and typescript template also using SWC option
Hello, SEI team!
Thank you for your dedicated efforts and amazing work!
I am a newbie on SEI network and I am building SEI dApp now and integrate all avaialbe SEI wallets to dApp using @sei-js/react
.
But when I wrap my app with SeiWalletProvider
, I get unexpected token errors. here is the screenshot to showcase errors.
Will u give me some ideas to solve this issue?
Thanks in advance!
sei-js/packages/proto/src/codegen/cosmos/staking/v1beta1/query.lcd.ts
The URL in the method delegation is missing a character "/"
now is blow:
async delegation(params: QueryDelegationRequest): Promise {
const endpoint = cosmos/staking/v1beta1/validators/${params.validatorAddr}delegations/${params.delegatorAddr}
;
return await this.req.get(endpoint);
}
maybe it should be :
async delegation(params: QueryDelegationRequest): Promise {
const endpoint = cosmos/staking/v1beta1/validators/${params.validatorAddr}/delegations/${params.delegatorAddr}
;
return await this.req.get(endpoint);
}
Property 'wallets' is missing in type '{ children: Element; chainConfiguration: ChainConfiguration; }' but required in type 'SeiWalletProviderProps'.ts(2741)
types.d.ts(40, 5): 'wallets' is declared here.
whats the format to add the wallets, it isnt in any of your guys guides
Hi. I'm having a bit of trouble getting things to work. The assetList is returning an empty array and I'm getting no price for SEIYAN. What am I doing wrong?
const queryClient = await getQueryClient(
"https://api-sei-ia.cosmosia.notional.ventures/"
);
const assets = await queryClient.seiprotocol.seichain.dex.assetList();
console.log(assets);
/*
{ assetList: [] }
*/
const params = {
contractAddr:
"sei13cvz5gvdmt294xxxj2harre9fl35s0rzhsvpwaylzekw5vlvvy5q66czcm", // SEIYAN
lookbackInSeconds: 300,
assetDenom:
"sei1hrndqntlvtmx2kepr0zsfgr7nzjptcc72cr4ppk4yav58vvy7v3s4er8ed",
priceDenom: "usei",
};
// Getting the market summary from the Sei dex module
const dexMarketSummary =
await queryClient.seiprotocol.seichain.dex.getMarketSummary(params);
console.log(dexMarketSummary);
/*
{ totalVolume: '0.000000000000000000',
totalVolumeNotional: '0.000000000000000000',
highPrice: '0.000000000000000000',
lowPrice: '0.000000000000000000',
lastPrice: '0.000000000000000000' }
*/
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.