Coder Social home page Coder Social logo

injectivelabs / injective-ts Goto Github PK

View Code? Open in Web Editor NEW
121.0 23.0 189.0 79.02 MB

Collection of TypeScript packages that consume and interact with the Injective Chain

License: Apache License 2.0

JavaScript 0.69% TypeScript 99.30% Shell 0.01%
injective injective-chain injective-protocol typescript monorepo

injective-ts's Introduction

🌟 Injective's TypeScript Monorepo

Documentation

Access Limitless DeFi Markets with Zero Barriers.

injective-ts is a TypeScript monorepo that contains packages which can be used to interact with Injective from a Node.js or browser environments and which provide simple abstractions over core data structures, serialization, key management, and API request generation, etc. The packages can be found in the packages folder and each package is a npm module that is published on the npm registry.

Learn more on our Docs


πŸ“œ Contribution

General contribution guidelines can be found on the Contributing page. There can be a package-specific contribution guides, please make sure you read them before you open a PR.


β›‘ Support

Reach out to us at one of the following places!


πŸ”“ License

Copyright Β© 2021 - 2022 Injective Labs Inc. (https://injectivelabs.org/)

Originally released by Injective Labs Inc. under:
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/

Β 

Powering the future of decentralized finance.

injective-ts's People

Contributors

1biest avatar achilleas-kal avatar afterburn avatar albertchon avatar antekm avatar bangjelkoski avatar blackwhalemoney avatar caotre avatar cmhchoi avatar dependabot[bot] avatar egrassy avatar gitbook-com[bot] avatar grinion avatar injectools avatar ivan-angjelkoski avatar jiukelo avatar kaisbaccour avatar kevccs avatar kevin-222 avatar kuraassh avatar proofofvirtue avatar punksdao avatar shane-moore avatar sunny0529 avatar therealjosephdev avatar thomasralee avatar tombeynon avatar unl1k3ly avatar ursulafe avatar xlab avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

injective-ts's Issues

Reading isBuffer issue

Hello,

Tried executing a deposit message even from my frontend running on vite..but i keep getting this error:
WebProvider.tsx:219 TypeError: Cannot read properties of undefined (reading 'isBuffer')
at toBuffer2 (chunk-EP2DLMQ2.js:5858:20)
at keccak2569 (chunk-EP2DLMQ2.js:5854:15)
at createTransactionWithSigners (chunk-EP2DLMQ2.js:372438:44)
at createTransaction (chunk-EP2DLMQ2.js:372454:10)
at MsgBroadcaster.broadcastWeb3 (MsgBroadcaster.ts:220:23)
at async deposit (WebProvider.tsx:215:7)

The code:
`
async function deposit(amount: number) {
try {
if (!injectiveAddress) return Promise.reject();

  const msg = MsgExecuteContract.fromJSON({
    sender: injectiveAddress,
    contractAddress,
    msg: {
      deposit: {},
    },
    funds: [
      {
        denom: "inj",
        amount: new BigNumberInBase(amount).toWei().toFixed(),
      },
    ],
  });

  await msgBroadcastClient.broadcast({ msgs: msg, injectiveAddress });

  return Promise.resolve();
} catch (e) {
  console.error(e);

  return Promise.reject();
}

}
`

Thanks

NextJS 14.0.3

Hi,

in my next app (ts) i use your sdk to retrieve staking and bank balances. Works great in dev mode, but compiling doesent work due to following error:

Failed to compile.

./node_modules/@injectivelabs/token-metadata/dist/esm/index.js + 22 modules
Cannot get final name for export 'isIbcTokenCanonical' of ./node_modules/@injectivelabs/token-metadata/dist/esm/ibc/index.js

here a yarn info:

❯ yarn info @injectivelabs/sdk-ts
└─ @injectivelabs/sdk-ts@npm:1.14.4
β”œβ”€ Version: 1.14.4
β”‚
└─ Dependencies
β”œβ”€ @cosmjs/amino@npm:^0.30.1 β†’ npm:0.30.1
β”œβ”€ @cosmjs/proto-signing@npm:^0.30.1 β†’ npm:0.30.1
β”œβ”€ @cosmjs/stargate@npm:^0.30.1 β†’ npm:0.30.1
β”œβ”€ @ensdomains/ens-validation@npm:^0.1.0 β†’ npm:0.1.0
β”œβ”€ @ensdomains/eth-ens-namehash@npm:^2.0.15 β†’ npm:2.0.15
β”œβ”€ @ethersproject/bytes@npm:^5.7.0 β†’ npm:5.7.0
β”œβ”€ @injectivelabs/core-proto-ts@npm:^0.0.18 β†’ npm:0.0.18
β”œβ”€ @injectivelabs/dmm-proto-ts@npm:1.0.19 β†’ npm:1.0.19
β”œβ”€ @injectivelabs/exceptions@npm:^1.14.4 β†’ npm:1.14.4
β”œβ”€ @injectivelabs/indexer-proto-ts@npm:1.11.22 β†’ npm:1.11.22
β”œβ”€ @injectivelabs/mito-proto-ts@npm:1.0.52 β†’ npm:1.0.52
β”œβ”€ @injectivelabs/networks@npm:^1.14.4 β†’ npm:1.14.4
β”œβ”€ @injectivelabs/test-utils@npm:^1.14.3 β†’ npm:1.14.3
β”œβ”€ @injectivelabs/token-metadata@npm:^1.14.4 β†’ npm:1.14.4
β”œβ”€ @injectivelabs/ts-types@npm:^1.14.4 β†’ npm:1.14.4
β”œβ”€ @injectivelabs/utils@npm:^1.14.4 β†’ npm:1.14.4
β”œβ”€ @metamask/eth-sig-util@npm:^4.0.0 β†’ npm:4.0.1
β”œβ”€ axios@npm:^0.27.2 β†’ npm:0.27.2
β”œβ”€ bech32@npm:^2.0.0 β†’ npm:2.0.0
β”œβ”€ bip39@npm:^3.0.4 β†’ npm:3.1.0
β”œβ”€ cosmjs-types@npm:^0.7.1 β†’ npm:0.7.2
β”œβ”€ ethereumjs-util@npm:^7.1.4 β†’ npm:7.1.5
β”œβ”€ ethers@npm:^5.7.2 β†’ npm:5.7.2
β”œβ”€ google-protobuf@npm:^3.21.0 β†’ npm:3.21.2
β”œβ”€ graphql@npm:^16.3.0 β†’ npm:16.8.1
β”œβ”€ http-status-codes@npm:^2.2.0 β†’ npm:2.3.0
β”œβ”€ js-sha3@npm:^0.8.0 β†’ npm:0.8.0
β”œβ”€ jscrypto@npm:^1.0.3 β†’ npm:1.0.3
β”œβ”€ keccak256@npm:^1.0.6 β†’ npm:1.0.6
β”œβ”€ link-module-alias@npm:^1.2.0 β†’ npm:1.2.0
β”œβ”€ rxjs@npm:^7.8.0 β†’ npm:7.8.1
β”œβ”€ secp256k1@npm:^4.0.3 β†’ npm:4.0.3
β”œβ”€ shx@npm:^0.3.2 β†’ npm:0.3.4
β”œβ”€ snakecase-keys@npm:^5.4.1 β†’ npm:5.5.0
β”œβ”€ @apollo/client@npm:^3.5.8 β†’ npm:3.8.8 [0991c]
β”œβ”€ @injectivelabs/grpc-web-node-http-transport@npm:^0.0.2 β†’ npm:0.0.2 [0991c]
β”œβ”€ @injectivelabs/grpc-web-react-native-transport@npm:^0.0.2 β†’ npm:0.0.2 [0991c]
└─ @injectivelabs/grpc-web@npm:^0.0.1 β†’ npm:0.0.1 [8d826]

i apreciate any help.

edit:

using the beta release shows this:

Failed to compile.

./node_modules/@injectivelabs/token-metadata/dist/esm/index.js + 23 modules
Cannot get final name for export 'devnetTokens' of ./node_modules/@injectivelabs/token-metadata/dist/esm/tokens/tokens/index.js

edit:

this appears to only be a problem when using the sdk-ts in server components. I will investigate further with vercel next.

Breaking change introduced in recent sdk update (engine constrain)

Hi,
After the recent update of the sdk I can no longer install it, I receive this warning message, and sdk is not installed anymore

npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '@injectivelabs/[email protected]',
npm WARN EBADENGINE   required: { node: '>=16.0.0 <17.0.0' },
npm WARN EBADENGINE   current: { node: 'v20.9.0', npm: '10.1.0' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '@injectivelabs/[email protected]',
npm WARN EBADENGINE   required: { node: '>=16.0.0 <17.0.0' },
npm WARN EBADENGINE   current: { node: 'v20.9.0', npm: '10.1.0' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '@injectivelabs/[email protected]',
npm WARN EBADENGINE   required: { node: '>=16.0.0 <17.0.0' },
npm WARN EBADENGINE   current: { node: 'v20.9.0', npm: '10.1.0' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '@injectivelabs/[email protected]',
npm WARN EBADENGINE   required: { node: '>=16.0.0 <17.0.0' },
npm WARN EBADENGINE   current: { node: 'v20.9.0', npm: '10.1.0' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '@injectivelabs/[email protected]',
npm WARN EBADENGINE   required: { node: '>=16.0.0 <17.0.0' },
npm WARN EBADENGINE   current: { node: 'v20.9.0', npm: '10.1.0' }
npm WARN EBADENGINE }

effectively i run node v20.9.0 that are the LTS version
my environment use node features introduced in recent node version and it's not possible for me to dump node version to < v17 as expected by the new constrain
I have tried to dump the version of the sdk-ts (to a know working version in the past: 1.4.2, and older 1.4.1, 1.4.0) but the package.json use range version for the @InjectiveLabs dependencies and this resolve to the last minor/patch version that introduce the constrain on node version
why not use fixed versioning in place of range to prevent a released version from stopping working in a defined context following a change in one or more of its dependencies?

Luckily I had a older copy of the node_modules folder with a version which does not include this change which allowed me to restore my app environment, however this is not a viable solution.
From what I have been able to see it is closely linked to the axelar network sdk which apparently imposes this restriction and not least
Is this change temporary, is it here to stay?
How can I continue to benefit from SDK updates without breaking my entire environment with this kind of constrain?
Dumping node version is not an acceptable solution ;)

Thank's for your time

'process' has already been declared

Hey,

While Importing getPublicKey in frontend app I am getting Error: Identifier 'process' has already been declared

import { getPublicKey } from '@injectivelabs/sdk-ts'

image

Error: Unsupported type: '/injective.types.v1beta1.EthAccount

I encountered an error while trying to sign with the INJ using the Keplr wallet. Could you share how you resolved this?

I have a question to ask. I didn't encounter this error when creating a trading pair between JUNO and OSMO. However, when I tried creating a trading pair between OSMO and Injective, I encountered an error.
image

import { MsgExecuteContractEncodeObject } from '@cosmjs/cosmwasm-stargate';
import { toUtf8 } from '@cosmjs/encoding';
import { Coin } from '@cosmjs/stargate';
import { MsgExecuteContract } from 'cosmjs-types/cosmwasm/wasm/v1/tx';

type CreateExecuteMessageArgs = {
  senderAddress: string;
  message: any;
  contractAddress: string;
  funds?: Array<Coin>;
};

export const createExecuteMessage = ({
  senderAddress,
  contractAddress,
  message,
  funds,
}: CreateExecuteMessageArgs): MsgExecuteContractEncodeObject => ({
  typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract',
  value: MsgExecuteContract.fromPartial({
    sender: senderAddress,
    contract: contractAddress,
    msg: toUtf8(JSON.stringify(message)),
    funds: funds || [],
  }),
});

grpc-web: Importing as ESModule in Node

/@InjectiveLabs[email protected][email protected]/node_modules/@injectivelabs/sdk-ts/dist/esm/client/BaseGrpcConsumer.js:1

import { grpc } from '@injectivelabs/grpc-web';
^^^^
SyntaxError: Named export 'grpc' not found. The requested module '@injectivelabs/grpc-web' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from '@injectivelabs/grpc-web';
const { grpc } = pkg;

sdk-ts: running in nodejs

Unable to run @injectivelabs/sdk-ts in a nodejs environment.

I've an example using PrivateKey from the sdk package to generate a wallet, which uses bip34 under the hood to generate a private key. When used in nodejs either cjs or esm version works, unable to use generate function from bip34 package import from transplied js code.

If there is example of using @injectivelabs/sdk-ts in nodejs environment that would be great

TypeError: Cannot read properties of undefined (reading 'generateMnemonic')
// Example of the cjs code:
class PrivateKey {
    constructor(wallet) {
        this.wallet = wallet;
    }
    /**
     * Generate new private key with random mnemonic phrase
     * @returns { privateKey: PrivateKey, mnemonic: string }
     */
    static generate() {
        const mnemonic = bip39_1.default.generateMnemonic();
        const privateKey = PrivateKey.fromMnemonic(mnemonic);
        return {
            privateKey,
            mnemonic,
        };
    }
// .. rest of the code

Stackblitz example

Run:

npm run start:js
# or npm run start:ts

export 'InjectiveStargate' (imported as 'InjectiveStargate') was not found in '@injectivelabs/sdk-ts' (module has no exports)

After importing InjectiveStargate like

import { InjectiveStargate } from '@injectivelabs/sdk-ts';

i my code i get lot's of error like

Module not found: Error: Can't resolve './core' in '/../../cypher/groot/node_modules/@injectivelabs/sdk-ts/dist/esm'
Did you mean 'index.js'?
BREAKING CHANGE: The request './core' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '.mjs' file, or a '.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.

Can anybody help me resolve it

sdk-ts 1.0.150 is unusable

If you import the latest version of @injectivelabs/sdk-ts, version 1.0.150, it throws

Error: Cannot find module '@injectivelabs/indexer-api/injective_explorer_rpc_pb'

here is a minimal reproducer, it:

  • creates a folder
  • initializes an npm project
  • installs @injectivelabs/sdk-ts version 1.0.150
  • adds a "start" script to package.json that invokes index.js
  • imports @injectivelabs/sdk-ts into index.js
  • runs the index.js

tested with
node v16.17.0
npm 8.15.0

mkdir package-fails && cd package-fails && \
npm init -y && \
npm i @injectivelabs/[email protected] -S && \
npm set-script start "node index.js" && \
echo "const sdk = require('@injectivelabs/sdk-ts'); console.log('hello world from index.js');" > index.js && \
npm run start

Here is a minimal reproducer of a previous version (1.0.75) working:

mkdir package-works && cd package-works && \
npm init -y && \
npm i @injectivelabs/[email protected] @injectivelabs/[email protected] -S --save-exact && \
npm set-script start "node index.js" && \
echo "const sdk = require('@injectivelabs/sdk-ts'); console.log('hello world from index.js');" > index.js && \
npm run start

It seems that because your packages have carrots (^) on the dependencies, and you only increment the PATCH part of semver, npm will always pull the latest version of everything and always pickup breaking changes.

"injective-ts error":Uncaught ( in promise ) Typeerror : Cannot read properties of undefined ( reading ' length' )

I referenced the documentation to write the code, and all the fields are there, but I've encountered an error. I've tried many methods to resolve it, but without success. Could you help me take a look? Thank you.

const msgs = MsgExecuteContractInjective.fromJSON({
    sender: accounts[0].address,
    contractAddress: getWasmChainIDContractAddress(
      remoteChain.chainID
    ) as string,
    // msg: toUtf8(JSON.stringify(takePoolMessages)),
    msg: takePoolMessages,
    funds,
  });

  // const msgs = MsgSend.fromJSON({
  //   amount,
  //   srcInjectiveAddress: accounts[0].address,
  //   dstInjectiveAddress: accounts[0].address,
  // });

  /** Get the PubKey of the Signer from the Wallet/Private Key */
  const pubKey = accounts[0].pubkey;

  console.log(remoteChain.chainID, 'remoteChain.chainID');
  console.log(msgs, 'msgs_____');
  console.log(pubKey, 'pubKey____');
  console.log(DEFAULT_STD_FEE, 'fee');
  console.log(accountDetails.sequence, 'accountDetails.sequence');
  console.log(accountDetails.accountNumber, 'accountDetails.accountNumber');

  /** Prepare the Transaction **/
  const { txRaw, signDoc } = createTransaction({
    chainId: remoteChain.chainID,
    message: msgs,
    memo: '',
    pubKey,
    fee: DEFAULT_STD_FEE,
    sequence: accountDetails.sequence,
    accountNumber: accountDetails.accountNumber,
    timeoutHeight: 100,
  });

  console.log(txRaw, 'txRaw______');

  const directSignResponse = await offlineSigner.signDirect(
    remoteAddress,
    signDoc
  );
  const txRawHx = getTxRawFromTxRawOrDirectSignResponse(directSignResponse);
  const txHash = await broadcastTx(remoteChain.chainID, txRawHx);
  const response = await new TxRestClient(remoteChain.rpcUrl).fetchTxPoll(
    txHash
  );

  console.log(response, 'response____');

image
image
image
image
image
Could not load content for http://127.0.0.1:5173/node_modules/@injectivelabs/sdk-ts/src/core/modules/tx/tx.ts (HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE)

Build failed because of lack of `wallet-ts` dependency.

Hey team,

The next.js project in which we use the wallet-ts package always fails to build with the error saying Module not found: Can't resolve '@trezor/connect-common/src/messageChannel/abstract'. Please check the detailed msg below:

β—‹ Compiling / ...
 β¨― ../../node_modules/@injectivelabs/wallet-ts/node_modules/@trezor/connect-web/lib/channels/serviceworker-window.js:4:19
Module not found: Can't resolve '@trezor/connect-common/src/messageChannel/abstract'
https://nextjs.org/docs/messages/module-not-found
Import trace for requested module:
../../node_modules/@injectivelabs/wallet-ts/node_modules/@trezor/connect-web/lib/popup/index.js
../../node_modules/@injectivelabs/wallet-ts/node_modules/@trezor/connect-web/lib/index.js
../../node_modules/@injectivelabs/wallet-ts/dist/esm/strategies/wallet-strategy/strategies/Trezor/index.js
../../node_modules/@injectivelabs/wallet-ts/dist/esm/strategies/wallet-strategy/WalletStrategy.js
../../node_modules/@injectivelabs/wallet-ts/dist/esm/strategies/wallet-strategy/index.js
../../node_modules/@injectivelabs/wallet-ts/dist/esm/strategies/index.js
../../node_modules/@injectivelabs/wallet-ts/dist/esm/index.js
./src/context/wallet/WalletProvider.tsx
./src/app/page.tsx
<w> [webpack.cache.PackFileCacheStrategy] Restoring pack failed from /Users/macbookpro4eric/Projects/notifi/notifi-sdk-ts/packages/notifi-dapp-example/.next/cache/webpack/client-development-fallback.pack.gz: Error: incorrect data check
<w> [webpack.cache.PackFileCacheStrategy] Restoring pack failed from /Users/macbookpro4eric/Projects/notifi/notifi-sdk-ts/packages/notifi-dapp-example/.next/cache/webpack/client-development-fallback.pack.gz: Error: incorrect data check
 β¨― ../../node_modules/@injectivelabs/wallet-ts/node_modules/@trezor/connect-web/lib/channels/serviceworker-window.js:4:19

Might I know if it is something package dependency issue. Or did I miss anything?

My env FYI:

  • node: v18.18.2
  • nextjs: 14.1.0

package.json dependency list FYI:

{
  "name": "injective-wallet",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  },
  "dependencies": {
    "react": "^18",
    "react-dom": "^18",
    "next": "14.1.2",
    "@injectivelabs/sdk-ts": "^1.14.6",
    "@injectivelabs/ts-types": "^1.14.6",
    "@injectivelabs/networks": "^1.14.6",
    "@injectivelabs/utils": "^1.14.6",
    "@injectivelabs/wallet-ts": "^1.14.6"
  },
  "devDependencies": {
    "typescript": "^5",
    "@types/node": "^20",
    "@types/react": "^18",
    "@types/react-dom": "^18",
    "autoprefixer": "^10.0.1",
    "postcss": "^8",
    "tailwindcss": "^3.3.0"
  }
}

I created a new nextjs project to replicate this situation. It is a plain create-next-app with some injective package (above).
You will be able to replicate this issue by

git clone [email protected]:eric-notifi/injective-wallet.git
npm install
npm run dev

Then we will be able to see below window when accessing localhost:3000.

Screenshot 2024-03-05 at 12 33 10

Unable to build due to downstream packages

yarn run v1.22.21
$ next build
Failed to compile.

./node_modules/@keystonehq/bc-ur-registry/dist/Decoder/index.js
Module not found: Can't resolve '@ngraveio/bc-ur'

https://nextjs.org/docs/messages/module-not-found

Import trace for requested module:
./node_modules/@keystonehq/bc-ur-registry/dist/index.js
./node_modules/@keystonehq/sol-keyring/dist/sol-keyring.cjs.production.min.js
./node_modules/@keystonehq/sol-keyring/dist/index.js
./node_modules/@solana/wallet-adapter-keystone/lib/cjs/adapter.js
./node_modules/@solana/wallet-adapter-keystone/lib/cjs/index.js
./node_modules/@solana/wallet-adapter-wallets/lib/cjs/index.js
./node_modules/@injectivelabs/wallet-ts/dist/cjs/utils/wallets/phantom/PhantomWallet.js
./node_modules/@injectivelabs/wallet-ts/dist/cjs/utils/wallets/phantom/index.js
./node_modules/@injectivelabs/wallet-ts/dist/cjs/utils/wallets/index.js
./node_modules/@injectivelabs/wallet-ts/dist/cjs/utils/index.js
./node_modules/@injectivelabs/wallet-ts/dist/cjs/index.js
./src/context/wallet.tsx

Caused by downstream issue anza-xyz/wallet-adapter#909

Can't fetch some tokens in fetchDenomMetadata

Hi, is fetchDenomMetadata method broken? Some denoms can not be fetched by this request.

Tried:

  • inj
  • uinj
  • factory-inj1xtel2knkt8hmc9dnzpjz6kdmacgcfmlv5f308w-ninja

And I get:

{
  type: 'grpc-unary-request',
  code: -1,
  originalMessage: 'client metadata for denom inj',
  name: 'GrpcUnaryRequestException',
  errorClass: 'GrpcUnaryRequestException',
  context: 'DenomMetadata',
  contextModule: 'chain-bank'
}

I can only get some tokens metadata from the hardcoded option that is using DenomClient, but this does not seems right...

Invalid string. Length must be a multiple of 4

use sendTokens and result get this error:
Error: Invalid string. Length must be a multiple of 4 at getLens (/Users/suanjie/Documents/Projects/NodeJS/Cosmos/injmint/node_modules/base64-js/index.js:26:11) at Object.toByteArray (/Users/suanjie/Documents/Projects/NodeJS/Cosmos/injmint/node_modules/base64-js/index.js:55:14) at fromBase64 (/Users/suanjie/Documents/Projects/NodeJS/Cosmos/injmint/node_modules/@injectivelabs/sdk-ts/node_modules/@cosmjs/encoding/build/base64.js:36:21) at decodeAttribute (/Users/suanjie/Documents/Projects/NodeJS/Cosmos/injmint/node_modules/@injectivelabs/sdk-ts/node_modules/@cosmjs/tendermint-rpc/build/tendermint34/adaptor/responses.js:43:40) at Array.map (<anonymous>) at decodeAttributes (/Users/suanjie/Documents/Projects/NodeJS/Cosmos/injmint/node_modules/@injectivelabs/sdk-ts/node_modules/@cosmjs/tendermint-rpc/build/tendermint34/adaptor/responses.js:48:53) at decodeEvent (/Users/suanjie/Documents/Projects/NodeJS/Cosmos/injmint/node_modules/@injectivelabs/sdk-ts/node_modules/@cosmjs/tendermint-rpc/build/tendermint34/adaptor/responses.js:53:40) at Array.map (<anonymous>) at decodeEvents (/Users/suanjie/Documents/Projects/NodeJS/Cosmos/injmint/node_modules/@injectivelabs/sdk-ts/node_modules/@cosmjs/tendermint-rpc/build/tendermint34/adaptor/responses.js:58:49) at decodeTxData (/Users/suanjie/Documents/Projects/NodeJS/Cosmos/injmint/node_modules/@injectivelabs/sdk-ts/node_modules/@cosmjs/tendermint-rpc/build/tendermint34/adaptor/responses.js:66:31)

mint

{
"p": "GRC20",
"op": "mint",
"tick": "GitHub",
"amt": "2000"
}

Possible wrong injective address derived from pubkey?

Hey,

I'm wondering why the derived injective address derived with the PublicKey class is different than the injective address onchain.

Example:

const inj_address = 'inj19ndrue0wkh8pdxtnfmz7kg0p3pr7qm95rwwujl';
const rest_endpoint = getNetworkEndpoints(Network.MainnetSentry).rest;
const chain_rest_auth_api = new ChainRestAuthApi(rest_endpoint);
const account_details_response = await chain_rest_auth_api.fetchCosmosAccount(inj_address);
const base_account = BaseAccount.fromRestCosmosApi(account_details_response);

const pubkey = PublicKey.fromBase64(base_account.pubKey.key);
const derived_inj_address = pubkey.toAddress().toAccountAddress(); // inj19gpyz7tdwddehxhjlj8y8q09cnu0sg0xav3uvg

So I'm expecting derived_inj_address to be inj19ndrue0wkh8pdxtnfmz7kg0p3pr7qm95rwwujl but I'm getting inj19gpyz7tdwddehxhjlj8y8q09cnu0sg0xav3uvg

Could there be an issue in the PublicKey class?

TypeError: Cannot redefine property: stack

Running a simple gRPC call using the TS SDK which errors results in the following error:

/home/services/injective/node_modules/@injectivelabs/exceptions/dist/cjs/exception.js:68
        super.stack = stack;
                    ^

TypeError: Cannot redefine property: stack
    at GrpcUnaryRequestException.setStack (/home/services/injective/node_modules/@injectivelabs/exceptions/dist/cjs/exception.js:68:21)
    at GrpcUnaryRequestException.parseError (/home/services/injective/node_modules/@injectivelabs/exceptions/dist/cjs/exception.js:39:14)
    at new ConcreteException (/home/services/injective/node_modules/@injectivelabs/exceptions/dist/cjs/exception.js:30:14)
    at new GrpcUnaryRequestException (/home/services/injective/node_modules/@injectivelabs/exceptions/dist/cjs/exceptions/GrpcUnaryRequestException.js:8:9)
    at IndexerGrpcDerivativesApi.<anonymous> (/home/services/injective/node_modules/@injectivelabs/sdk-ts/dist/cjs/client/indexer/grpc/IndexerGrpcDerivativesApi.js:200:23)
    at Generator.throw (<anonymous>)
    at rejected (/home/services/injective/node_modules/@injectivelabs/sdk-ts/dist/cjs/client/indexer/grpc/IndexerGrpcDerivativesApi.js:6:65)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Occurs due to Error.stack not being overwritable.

Makes the TS SDK unusable without modifying the source.

Node v21.2.0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.