diff --git a/.gitbook/README.md b/.gitbook/README.md index 22a8c72d9..0335017be 100644 --- a/.gitbook/README.md +++ b/.gitbook/README.md @@ -21,3 +21,4 @@ _Note: Reading the Technical Concepts section after reading the overview below i * [Core Modules](core-modules/) - In this section we are going to have a quick summary of the core modules on Injective and show examples of how to create some Messages (+ pack them into a transaction, sign them using a private key, and broadcast them on Injective) within these core modules. * [Bridge](bridge/) - In this section, we are going to have a look at Injective's interoperability and explain how developers can utilize the Peggy bridge and the IBC bridge to bridge assets over to Injective. * [Networks](readme/networks.md) - In this section, we will look at different (pre-defined) available Networks for developers to utilize while building dApps on top of Injective, allowing them to start building without the need to make their own infrastructure. +* [Calculations](calculations/) - In this section, we will look at different calculations formula converting values between UI human-readable and chain format. diff --git a/.gitbook/SUMMARY.md b/.gitbook/SUMMARY.md index f2719e3af..f9fb2de00 100644 --- a/.gitbook/SUMMARY.md +++ b/.gitbook/SUMMARY.md @@ -3,15 +3,15 @@ * [Getting Started](README.md) * [Technical Concepts](readme/technical-concepts.md) * [Application Concepts](readme/application-concepts.md) - * [Token Metadata](readme/token-metadata/README.md) + * [Assets (Token Metadata)](readme/token-metadata/README.md) * [Creating Tokens](readme/token-metadata/creating-tokens.md) * [Denom Client](readme/token-metadata/denom-client.md) * [Networks](readme/networks.md) * [CosmJs Support](readme/getting-started-cosmjs.md) * [Wallet](wallet/README.md) * [Accounts](wallet/wallet-accounts.md) - * [Wallet Strategy](wallet/wallet-wallet-strategy.md) * [Wallet Connections](wallet/wallet-connections.md) + * [Wallet Strategy](wallet/wallet-wallet-strategy.md) * [Querying](querying/README.md) * [Indexer](querying/querying-api/README.md) * [Account](querying/querying-api/querying-indexer-account.md) @@ -61,6 +61,7 @@ * [Core Modules](core-modules/README.md) * [Auction](core-modules/auction.md) * [AuthZ](core-modules/authz.md) + * [Feegrant](core-modules/feegrant.md) * [Bank](core-modules/bank.md) * [Distribution](core-modules/distribution.md) * [Exchange](core-modules/exchange.md) @@ -75,7 +76,8 @@ * [Ethereum](bridge/ethereum.md) * [IBC](bridge/ibc.md) * [Wormhole](bridge/wormhole.md) -* [Contracts](contracts.md) +* [Contracts](contracts/README.md) + * [Injective Name Service](contracts/injective-name-service.md) * [Building dApps](building-dapps/README.md) * [Configuring Nuxt](building-dapps/configuring-nuxt.md) * [Configuring React](building-dapps/configuring-react.md) @@ -83,3 +85,4 @@ * [Smart Contract](building-dapps/smart-contract.md) * [DEX](building-dapps/dex.md) * [Bridge](building-dapps/bridge.md) +* [Calculations](calculations/README.md) diff --git a/.gitbook/building-dapps/README.md b/.gitbook/building-dapps/README.md index 574623606..f61e2611f 100644 --- a/.gitbook/building-dapps/README.md +++ b/.gitbook/building-dapps/README.md @@ -6,7 +6,15 @@ Injective is natively interoperable with several well-known blockchain networks, Within this section we are going to explore configuring different UI frameworks to work with the `@injectivelabs` packages so you can start building decentralized applications on top of Injective. We are also going to showcase example (simple) dApps built on top of Injective. +*** +### Create Injective dApp CLI tool + +The simplest way to start your journey on Injective is using our CLI tool. To do this, simply write this command and follow the instructions in your terminal! + +```bash +$ npx @injectivelabs/create-injective-app +``` ### Configuration @@ -15,7 +23,7 @@ Within this section we are going to explore configuring different UI frameworks | [Configuring Nuxt](configuring-nuxt.md) | Configuring Nuxt 3.x + Vite | | [Configuring React](configuring-react.md) | Configuring React 18 + Vite | - +*** ### Dapps diff --git a/.gitbook/calculations/README.md b/.gitbook/calculations/README.md new file mode 100644 index 000000000..bebe608d5 --- /dev/null +++ b/.gitbook/calculations/README.md @@ -0,0 +1,10 @@ +# Calculations + +Here are some formula formatting values between the chain and UI human-readable. + +### Bridges Supported + +| Topic | Description | +| ------------------------------------------------------- | --------------------------------------- | +| [Market min price tick size](minPriceTickSize.md) | Minimum market order price tick size | +| [Market min quantity tick size](minQuantityTickSzie.md) | Minimum market order quantity tick size | diff --git a/.gitbook/calculations/minPriceTickSize.md b/.gitbook/calculations/minPriceTickSize.md new file mode 100644 index 000000000..babc86b99 --- /dev/null +++ b/.gitbook/calculations/minPriceTickSize.md @@ -0,0 +1,47 @@ +# Market min price tick size + +The min market price tick size for an order price - if a market has an minPriceTickSick of `0.001` and order submission with the price of `0.0011` will be rejected. + +Note that calculating the formula for calculating a spot and quote market price tick size are different. + +### Spot market + +1. UI human readable to chain format: + Using INJ/USDT market which has 18 base decimals and 6 quote decimals as an example, here's how we convert the value to the chain format: + +```js +const chainFormat = new BigNumberInBase(10) + .pow(quoteDecimal - baseDecimal) + .times(value) + .toFixed() +``` + +1. Chain format to UI human readable format: + Using INJ/USDT market which has 18 base decimals and 6 quote decimals as an example, here's how we convert the value to the UI human readable format: + +```js +const humanReadableFormat = new BigNumber(value) + .shiftedBy(baseDecimals - quoteDecimals) + .toFixed() +``` + +### Derivative market + +1. UI human readable to chain format: + Using INJ/USDT perp market which has 6 quote decimals as an example, here's how we convert the value to the chain format: + +```js +const chainFormat = new BigNumberInBase(10) + .pow(-quoteDecimal) + .times(value) + .toFixed() +``` + +1. Chain format to UI human readable format: + Using INJ/USDT perp market which has 6 quote decimals as an example, here's how we convert the value to the UI human readable format: + +```js +const humanReadableFormat = new BigNumber(value) + .shiftedBy(-quoteDecimals) + .toFixed() +``` diff --git a/.gitbook/calculations/minQuantityTickSize.md b/.gitbook/calculations/minQuantityTickSize.md new file mode 100644 index 000000000..a5d16506a --- /dev/null +++ b/.gitbook/calculations/minQuantityTickSize.md @@ -0,0 +1,23 @@ +# Market min quantity tick size + +The min market quantity tick size for an order price - if a market has an minQuantityTickSize of `0.001` and order submission with the quantity of `0.0011` will be rejected. + +Note that derivate markets shares the same format for minQuantityTickSize between UI and the chain, so no formatting is required. + +### Spot market + +1. UI human readable to chain format: + Using on a INJ/USDT market which has 18 base decimals and 6 quote decimals as an example, here's how we convert the value to the chain format: + +```js +const chainFormat = new BigNumberInWei(value).toBase(baseDecimals) +``` + +1. Chain format to UI human readable format: + Using INJ/USDT market which has 18 base decimals and 6 quote decimals as an example, here's how we convert the value to the UI human readable format: + +```js +const humanReadableFormat = new BigNumber(minQuantityTickSize) + .shiftedBy(-baseDecimals) + .toFixed() +``` diff --git a/.gitbook/contracts.md b/.gitbook/contracts.md deleted file mode 100644 index 39387df11..000000000 --- a/.gitbook/contracts.md +++ /dev/null @@ -1,6 +0,0 @@ -# Contracts - -### What is CosmWasm?[​](https://docs.injective.network/develop/guides/cosmwasm-dapps/#what-is-cosmwasm) - -CosmWasm is a novel smart contracting platform built for the Cosmos ecosystem. You can learn more about CosmWasm [here](https://docs.cosmwasm.com/docs/), or see the [CosmWasm Book](https://book.cosmwasm.com/index.html) for a guide on creating CosmWasm smart contracts. - diff --git a/.gitbook/contracts/README.md b/.gitbook/contracts/README.md index 6ab29fd7a..293ca8678 100644 --- a/.gitbook/contracts/README.md +++ b/.gitbook/contracts/README.md @@ -1,10 +1,10 @@ # Contracts -### What is CosmWasm?[​](https://docs.injective.network/develop/guides/cosmwasm-dapps/#what-is-cosmwasm) +#### [What is CosmWasm?](./#what-is-cosmwasm-)[​](https://docs.injective.network/develop/guides/cosmwasm-dapps/#what-is-cosmwasm) CosmWasm is a novel smart contracting platform built for the Cosmos ecosystem. You can learn more about CosmWasm [here](https://docs.cosmwasm.com/docs/), or see the [CosmWasm Book](https://book.cosmwasm.com/index.html) for a guide on creating CosmWasm smart contracts. -### Specific Cosmwasm Contracts +#### Specific Cosmwasm Contracts | Topic | Description | | --------------------------------------------------- | ---------------------- | diff --git a/.gitbook/contracts/injective-name-service.md b/.gitbook/contracts/injective-name-service.md index 0e93a62ab..7d042afd4 100644 --- a/.gitbook/contracts/injective-name-service.md +++ b/.gitbook/contracts/injective-name-service.md @@ -1,14 +1,31 @@ # Injective Name Service -Within this section we are going to have a look how to query the Injective name service contracts. +Within this section, we will look at how to query the Injective name service contracts. -## Querying +## Abstraction Service + +You can use our `InjNameService` [abstraction](../../packages/sdk-ui-ts/src/services/nameservice/InjNameService.ts) to query the smart contracts with a single method call. Below this example, you can also find the raw implementation on how to query the smart contracts in case you need more flexibility. + +
import { getNetworkEndpoints, Network } from '@injectivelabs/network'
+import { InjNameService } from '@injectivelabs/sdk-ui-ts'
+
+const injNameService = new InjNameService(Network.Testnet)
+const name = 'ninja.inj'
+
+// Fetch the address for the particular name
+const addressForName = await injNameService.fetchInjAddress(name) 
+
+// Fetch the name for the particular address
+const nameFromAddress = await injNameService.fetchInjName(addressForName)
+
+ +## Raw Smart Contract Querying Example code snippets to resolve .inj domain name. ### Domain Resolution -- Get resolver address +* Get resolver address ```ts import { getNetworkEndpoints, Network } from '@injectivelabs/networks' @@ -41,7 +58,7 @@ const resolverAddress = InjNameServiceQueryTransformer.resolverAddressResponseTo console.log(resolverAddress) ``` -- Get address for .inj domain name. +* Get address for .inj domain name. ```ts import { getNetworkEndpoints, Network } from '@injectivelabs/networks' @@ -83,7 +100,7 @@ console.log(injectiveAddress) ### Reverse Resolution -- Get primary name for injective address. +* Get primary name for injective address. ```ts import { getNetworkEndpoints, Network } from '@injectivelabs/networks' diff --git a/.gitbook/core-modules/README.md b/.gitbook/core-modules/README.md index 65f95d10a..f7968321b 100644 --- a/.gitbook/core-modules/README.md +++ b/.gitbook/core-modules/README.md @@ -10,6 +10,7 @@ Within this section, we are going to explore the core modules of the Injective c | ------------------------------- | ------------------------------------------------ | | [Auction](auction.md) | Use for the buy-back-and-burn on chain mechanism | | [AuthZ](authz.md) | Used for granting account priveledges | +| [Feegrant](feegrant.md) | Used for granting fee allowance priveledges | | [Bank](bank.md) | Used for managing users assets (funds) | | [Exchange](exchange.md) | Used for the exchange primitives | | [Distribution](distribution.md) | Used for on-chain distribution/minting | diff --git a/.gitbook/core-modules/auction.md b/.gitbook/core-modules/auction.md index 550dfc240..8a6b14445 100644 --- a/.gitbook/core-modules/auction.md +++ b/.gitbook/core-modules/auction.md @@ -23,7 +23,7 @@ const auctionApi = new ChainGrpcAuctionApi(endpointsForNetwork.grpc); const injectiveAddress = "inj1..."; /* format amount for bid, note that bid amount has to be higher than the current highest bid */ const amount = { - denom: INJ, + denom: INJ_DENOM, amount: new BigNumberInBase(1).toWei(), }; @@ -38,20 +38,83 @@ const latestRound = uiLatestAuctionModuleState.auctionRound; const msg = MsgBid.fromJSON({ amount, injectiveAddress, - round: latestRound, + round: latestRound }); const privateKey = "0x..."; /* broadcast transaction */ const txHash = await new MsgBroadcasterWithPk({ - privateKey, - chainId: ChainId.Mainnet, - endpoints: endpointsForNetwork, +network: Network.Mainnet, +privateKey, }).broadcast({ - msgs: msg, - injectiveAddress, -}); +msgs: msg +}) + console.log(txHash); ``` + +### Burn Auction Deposit via MsgExternalTransfer + +If you would like to grow the burn auction's pool size, you can directly send funds to the Auction subaccount. + +Notes: + - You will need to send funds to the pool's subaccount `0x1111111111111111111111111111111111111111111111111111111111111111`. + - Be aware that any funds you send will be reflected in the next auction, not the current one. + - You cannot transfer from your default subaccountId since that balance is now associated with your Injective address in the bank module. Therefore, in order for `MsgExternalTransfer` to work, you will need to transfer from a non-default subaccountId. + + How to find the subaccountId that you will be transferring from: + - you can query your existing subaccountIds via the [account portfolio api](../querying/querying-api/querying-indexer-portfolio.md). + +How to use funds that are currently associated with your Injective Address in bank module: + - If you have existing non-default subaccounts, you'll want to do a [MsgDeposit](./exchange.md#MsgDeposit) to one of your existing non-default subaccountIds and use that subaccountId as the `srcSubaccountId` below. + - If you don't have existing non-default subaccounts, you can do a [MsgDeposit](./exchange.md#MsgDeposit) to a new default subaccountId, which would be done via importing `getSubaccountId` from `sdk-ts` and setting the `subaccountId` field in [MsgDeposit](./exchange.md#MsgDeposit) to `getSubaccountId(injectiveAddress, 1)`. + +For more info, check out the [burn auction pool docs](https://docs.injective.network/develop/tech-concepts/auction_pool/). + +```ts +import { + DenomClient, + MsgExternalTransfer, + MsgBroadcasterWithPk, +} from '@injectivelabs/sdk-ts' +import { BigNumberInBase } from '@injectivelabs/utils' +import { Network } from '@injectivelabs/networks' + +const denomClient = new DenomClient(Network.Mainnet); + +const injectiveAddress = 'inj1...' +const srcSubaccountId = '0x...' +const POOL_SUBACCOUNT_ID = `0x1111111111111111111111111111111111111111111111111111111111111111` +const USDT_TOKEN_SYMBOL='USDT' +const tokenMeta = denomClient.getTokenMetaDataBySymbol(USDT_TOKEN_SYMBOL); +const tokenDenom = `peggy${tokenMeta.erc20.address}`; + +/* format amount to add to the burn auction pool */ +const amount = { + denom: tokenDenom, + amount: new BigNumberInBase(1).toWei(tokenMeta.decimals).toFixed() +} + +/* create message in proto format */ +const msg = MsgExternalTransfer.fromJSON({ + amount, + srcSubaccountId, + injectiveAddress, + dstSubaccountId: POOL_SUBACCOUNT_ID +}) + +const privateKey = '0x...' + +/* broadcast transaction */ +const txHash = await new MsgBroadcasterWithPk({ +network: Network.Mainnet, +privateKey +}).broadcast({ +msgs: msg +}) + + +console.log(txHash) +``` diff --git a/.gitbook/core-modules/authz.md b/.gitbook/core-modules/authz.md index 62cc30721..d589565fd 100644 --- a/.gitbook/core-modules/authz.md +++ b/.gitbook/core-modules/authz.md @@ -31,7 +31,7 @@ Per [cosmos sdk docs](https://docs.cosmos.network/main/modules/authz), "Authoriz ```ts import { MsgGrant, MsgBroadcasterWithPk } from '@injectivelabs/sdk-ts' -import { Network, getNetworkEndpoints } from '@injectivelabs/networks' +import { Network } from '@injectivelabs/networks' const privateKeyOfGranter = '0x...' const grantee = 'inj...' @@ -46,11 +46,9 @@ const msg = MsgGrant.fromJSON({ const txHash = await new MsgBroadcasterWithPk({ privateKey: privateKeyOfGranter, - network: Network.Testnet, - endpoints: getNetworkEndpoints(Network.Testnet) + network: Network.Testnet }).broadcast({ - msgs: msg, - injectiveAddress: granter, + msgs: msg }) console.log(txHash) @@ -63,7 +61,7 @@ When a grantee wants to execute a transaction on behalf of a granter, they must ```ts import { MsgExec, MsgSend, MsgBroadcasterWithPk } from '@injectivelabs/sdk-ts' import { BigNumberInBase } from '@injectivelabs/utils' -import { Network, getNetworkEndpoints } from '@injectivelabs/networks' +import { Network } from '@injectivelabs/networks' const privateKeyOfGrantee = '0x...' const grantee = 'inj...' @@ -85,11 +83,9 @@ const msg = MsgExec.fromJSON({ const txHash = await new MsgBroadcasterWithPk({ privateKey: privateKeyOfGrantee, - network: Network.Testnet, - endpoints: getNetworkEndpoints(Network.Testnet) + network: Network.Testnet }).broadcast({ - msgs: msg, - injectiveAddress: grantee, + msgs: msg }) console.log(txHash) @@ -101,7 +97,7 @@ A grant can be removed with the MsgRevoke message. ```ts import { MsgRevoke, MsgBroadcasterWithPk, getEthereumAddress } from '@injectivelabs/sdk-ts' -import { Network, getNetworkEndpoints } from '@injectivelabs/networks' +import { Network } from '@injectivelabs/networks' const privateKeyOfGranter = '0x...' const grantee = 'inj...' @@ -116,11 +112,9 @@ const msg = MsgRevoke.fromJSON({ const txHash = await new MsgBroadcasterWithPk({ privateKey: privateKeyOfGranter, - network: Network.Testnet, - endpoints: getNetworkEndpoints(Network.Testnet) + network: Network.Testnet }).broadcast({ - msgs: msg, - injectiveAddress: granter, + msgs: msg }) console.log(txHash) diff --git a/.gitbook/core-modules/bank.md b/.gitbook/core-modules/bank.md index 16848b2e2..e3ccdaf91 100644 --- a/.gitbook/core-modules/bank.md +++ b/.gitbook/core-modules/bank.md @@ -15,8 +15,7 @@ This Message is used to send coins from one address to another. ```ts import { MsgSend, MsgBroadcasterWithPk } from '@injectivelabs/sdk-ts' import { BigNumberInBase } from '@injectivelabs/utils' -import { ChainId } from '@injectivelabs/ts-types' -import { Network, getNetworkEndpoints } from '@injectivelabs/networks' +import { Network } from '@injectivelabs/networks' const privateKey = '0x...' const injectiveAddress = 'inj1...' @@ -27,16 +26,14 @@ const amount = { const msg = MsgSend.fromJSON({ amount, srcInjectiveAddress: injectiveAddress, - dstInjectiveAddress: injectiveAddress, + dstInjectiveAddress: injectiveAddress }); const txHash = await new MsgBroadcasterWithPk({ privateKey, - chainId: ChainId.Testnet, - endpoints: getNetworkEndpoints(Network.Testnet) + network: Network.Testnet }).broadcast({ - msgs: msg, - injectiveAddress, + msgs: msg }) console.log(txHash) diff --git a/.gitbook/core-modules/distribution.md b/.gitbook/core-modules/distribution.md index f2f38b9d3..b9f60c029 100644 --- a/.gitbook/core-modules/distribution.md +++ b/.gitbook/core-modules/distribution.md @@ -13,10 +13,7 @@ import { MsgBroadcasterWithPk, MsgWithdrawDelegatorReward, } from "@injectivelabs/sdk-ts"; -import { ChainId } from "@injectivelabs/ts-types"; -import { getNetworkEndpoints, Network } from "@injectivelabs/networks"; - -const endpointsForNetwork = getNetworkEndpoints(Network.Mainnet); +import { Network } from "@injectivelabs/networks"; const injectiveAddress = "inj1..."; const validatorAddress = "inj1..."; @@ -32,11 +29,9 @@ const privateKey = "0x..."; /* broadcast transaction */ const txHash = await new MsgBroadcasterWithPk({ privateKey, - chainId: ChainId.Mainnet, - endpoints: endpointsForNetwork, + network: Network.Mainnet }).broadcast({ - msgs: msg, - injectiveAddress, + msgs: msg }); console.log(txHash); @@ -51,10 +46,7 @@ import { MsgBroadcasterWithPk, MsgWithdrawValidatorCommission, } from "@injectivelabs/sdk-ts"; -import { ChainId } from "@injectivelabs/ts-types"; -import { getNetworkEndpoints, Network } from "@injectivelabs/networks"; - -const endpointsForNetwork = getNetworkEndpoints(Network.Mainnet); +import { Network } from "@injectivelabs/networks"; const injectiveAddress = "inj1..."; const validatorAddress = "inj1..."; @@ -69,11 +61,9 @@ const privateKey = "0x..."; /* broadcast transaction */ const txHash = await new MsgBroadcasterWithPk({ privateKey, - chainId: ChainId.Mainnet, - endpoints: endpointsForNetwork, + network: Network.Testnet }).broadcast({ - msgs: msg, - injectiveAddress, + msgs: msg }); console.log(txHash); diff --git a/.gitbook/core-modules/exchange.md b/.gitbook/core-modules/exchange.md index 45e53ea2d..552e813dc 100644 --- a/.gitbook/core-modules/exchange.md +++ b/.gitbook/core-modules/exchange.md @@ -15,7 +15,7 @@ This Message is used to send coins from the Bank module to a wallet's subaccount ```ts import { MsgDeposit, MsgBroadcasterWithPk, getEthereumAddress } from '@injectivelabs/sdk-ts' import { BigNumberInBase } from '@injectivelabs/utils' -import { Network, getNetworkEndpoints } from '@injectivelabs/networks' +import { Network } from '@injectivelabs/networks' const privateKey = '0x...' const injectiveAddress = 'inj1...' @@ -33,16 +33,14 @@ const subaccountId = ethereumAddress + suffix const msg = MsgDeposit.fromJSON({ amount, subaccountId, - injectiveAddress, + injectiveAddress }); const txHash = await new MsgBroadcasterWithPk({ privateKey, - network: Network.Testnet, - endpoints: getNetworkEndpoints(Network.Testnet) + network: Network.Testnet }).broadcast({ - msgs: msg, - injectiveAddress, + msgs: msg }) console.log(txHash) @@ -55,7 +53,7 @@ This Message is used to send coins from the wallet's subaccount back to the user ```ts import { MsgWithdraw, MsgBroadcasterWithPk, getEthereumAddress } from '@injectivelabs/sdk-ts' import { BigNumberInBase } from '@injectivelabs/utils' -import { Network, getNetworkEndpoints } from '@injectivelabs/networks' +import { Network } from '@injectivelabs/networks' const privateKey = '0x...' const injectiveAddress = 'inj1...' @@ -73,16 +71,14 @@ const subaccountId = ethereumAddress + suffix const msg = MsgWithdraw.fromJSON({ amount, subaccountId, - injectiveAddress, + injectiveAddress }); const txHash = await new MsgBroadcasterWithPk({ privateKey, - network: Network.Testnet, - endpoints: getNetworkEndpoints(Network.Testnet) + network: Network.Testnet }).broadcast({ - msgs: msg, - injectiveAddress, + msgs: msg }) console.log(txHash) @@ -97,10 +93,10 @@ import { MsgCreateSpotLimitOrder, MsgBroadcasterWithPk, getEthereumAddress, - getDerivativeMarketTensMultiplier + getSpotMarketTensMultiplier } from '@injectivelabs/sdk-ts' import { BigNumberInBase, spotPriceToChainPriceToFixed, spotQuantityToChainQuantityToFixed } from '@injectivelabs/utils' -import { Network, getNetworkEndpoints } from '@injectivelabs/networks' +import { Network } from '@injectivelabs/networks' const privateKey = '0x...' const injectiveAddress = 'inj1...' @@ -111,8 +107,8 @@ const market = { quoteDecimals: 6, minPriceTickSize: '', /* fetched from the chain */ minQuantityTickSize: '', /* fetched from the chain */ - priceTensMultiplier: '', /** can be fetched from getDerivativeMarketTensMultiplier */ - quantityTensMultiplier: '', /** can be fetched from getDerivativeMarketTensMultiplier */ + priceTensMultiplier: '', /** can be fetched from getSpotMarketTensMultiplier */ + quantityTensMultiplier: '', /** can be fetched from getSpotMarketTensMultiplier */ } const order = { @@ -141,16 +137,14 @@ const msg = MsgCreateSpotLimitOrder.fromJSON({ baseDecimals: market.baseDecimals }), marketId: market.marketId, - feeRecipient: feeRecipient, + feeRecipient: feeRecipient }) const txHash = await new MsgBroadcasterWithPk({ privateKey, - network: Network.Testnet, - endpoints: getNetworkEndpoints(Network.Testnet) + network: Network.Testnet }).broadcast({ - msgs: msg, - injectiveAddress, + msgs: msg }) console.log(txHash) @@ -165,10 +159,10 @@ import { MsgCreateSpotMarketOrder, MsgBroadcasterWithPk, getEthereumAddress, - getDerivativeMarketTensMultiplier + getSpotMarketTensMultiplier } from '@injectivelabs/sdk-ts' import { BigNumberInBase, spotPriceToChainPriceToFixed, spotQuantityToChainQuantityToFixed } from '@injectivelabs/utils' -import { Network, getNetworkEndpoints } from '@injectivelabs/networks' +import { Network } from '@injectivelabs/networks' const privateKey = '0x...' const injectiveAddress = 'inj1...' @@ -179,8 +173,8 @@ const market = { quoteDecimals: 6, minPriceTickSize: '', /* fetched from the chain */ minQuantityTickSize: '', /* fetched from the chain */ - priceTensMultiplier: '', /** can be fetched from getDerivativeMarketTensMultiplier */ - quantityTensMultiplier: '', /** can be fetched from getDerivativeMarketTensMultiplier */ + priceTensMultiplier: '', /** can be fetched from getSpotMarketTensMultiplier */ + quantityTensMultiplier: '', /** can be fetched from getSpotMarketTensMultiplier */ } const order = { price: 10, @@ -213,11 +207,9 @@ const msg = MsgCreateSpotMarketOrder.fromJSON({ const txHash = await new MsgBroadcasterWithPk({ privateKey, - network: Network.Testnet, - endpoints: getNetworkEndpoints(Network.Testnet) + network: Network.Testnet }).broadcast({ - msgs: msg, - injectiveAddress, + msgs: msg }) console.log(txHash) @@ -240,7 +232,7 @@ import { derivativeQuantityToChainQuantityToFixed, derivativeMarginToChainMarginToFixed } from '@injectivelabs/utils' -import { Network, getNetworkEndpoints } from '@injectivelabs/networks' +import { Network } from '@injectivelabs/networks' const privateKey = '0x...' const injectiveAddress = 'inj1...' @@ -285,11 +277,9 @@ const msg = MsgCreateDerivativeLimitOrder.fromJSON( const txHash = await new MsgBroadcasterWithPk({ privateKey, - network: Network.Testnet, - endpoints: getNetworkEndpoints(Network.Testnet) + network: Network.Testnet }).broadcast({ - msgs: msg, - injectiveAddress, + msgs: msg }) console.log(txHash) @@ -312,7 +302,7 @@ import { derivativeQuantityToChainQuantityToFixed, derivativeMarginToChainMarginToFixed } from '@injectivelabs/utils' -import { Network, getNetworkEndpoints } from '@injectivelabs/networks' +import { Network } from '@injectivelabs/networks' const privateKey = '0x...' const injectiveAddress = 'inj1...' @@ -362,11 +352,9 @@ const msg = MsgCreateDerivativeMarketOrder.fromJSON( const txHash = await new MsgBroadcasterWithPk({ privateKey, - network: Network.Testnet, - endpoints: getNetworkEndpoints(Network.Testnet) + network: Network.Testnet }).broadcast({ - msgs: msg, - injectiveAddress, + msgs: msg }) console.log(txHash) @@ -389,7 +377,7 @@ import { derivativeQuantityToChainQuantityToFixed, derivativeMarginToChainMarginToFixed } from '@injectivelabs/utils' -import { Network, getNetworkEndpoints } from '@injectivelabs/networks' +import { Network } from '@injectivelabs/networks' const privateKey = '0x...' const injectiveAddress = 'inj1...' @@ -469,11 +457,9 @@ const msg = MsgBatchUpdateOrders.fromJSON({ const txHash = await new MsgBroadcasterWithPk({ privateKey, - network: Network.Testnet, - endpoints: getNetworkEndpoints(Network.Testnet) + network: Network.Testnet }).broadcast({ - msgs: msg, - injectiveAddress, + msgs: msg }) console.log(txHash) @@ -485,22 +471,19 @@ This Message is used to batch cancel spot orders on the chain ```ts import { MsgBatchCancelSpotOrders, MsgBroadcasterWithPk } from '@injectivelabs/sdk-ts' -import { Network, getNetworkEndpoints } from '@injectivelabs/networks' +import { Network } from '@injectivelabs/networks' const privateKey = '0x...' const injectiveAddress = 'inj1...' -const orders = [ - { +const orders = [{ marketId: '0x...', subaccountId: '0x...', orderHash: '0x...' - }, - { + },{ marketId: '0x...', subaccountId: '0x...', orderHash: '0x...' - } -] +}] const messages = orders.map((order) => MsgBatchCancelSpotOrders.fromJSON({ @@ -517,11 +500,9 @@ const messages = orders.map((order) => const txHash = await new MsgBroadcasterWithPk({ privateKey, - network: Network.Testnet, - endpoints: getNetworkEndpoints(Network.Testnet) + network: Network.Testnet }).broadcast({ - msgs: messages, - injectiveAddress, + msgs: messages }) console.log(txHash) @@ -533,22 +514,19 @@ This Message is used to batch cancel spot orders on the chain ```ts import { MsgBatchCancelDerivativeOrders, MsgBroadcasterWithPk } from '@injectivelabs/sdk-ts' -import { Network, getNetworkEndpoints } from '@injectivelabs/networks' +import { Network } from '@injectivelabs/networks' const privateKey = '0x...' const injectiveAddress = 'inj1...' -const orders = [ - { +const orders = [{ marketId: '0x...', subaccountId: '0x...', orderHash: '0x...' - }, - { + },{ marketId: '0x...', subaccountId: '0x...', orderHash: '0x...' - } -] +}] const messages = orders.map((order) => MsgBatchCancelDerivativeOrders.fromJSON({ @@ -565,11 +543,9 @@ const messages = orders.map((order) => const txHash = await new MsgBroadcasterWithPk({ privateKey, - network: Network.Testnet, - endpoints: getNetworkEndpoints(Network.Testnet) + network: Network.Testnet }).broadcast({ - msgs: messages, - injectiveAddress, + msgs: messages }) console.log(txHash) @@ -584,7 +560,7 @@ import { MsgRewardsOptOut, MsgBroadcasterWithPk, } from '@injectivelabs/sdk-ts' -import { Network, getNetworkEndpoints } from '@injectivelabs/networks' +import { Network } from '@injectivelabs/networks' const privateKey = '0x...' const injectiveAddress = 'inj...' @@ -594,12 +570,72 @@ const msg = MsgRewardsOptOut.fromJSON( const txHash = await new MsgBroadcasterWithPk({ privateKey, - network: Network.Testnet, - endpoints: getNetworkEndpoints(Network.Testnet) + network: Network.Testnet }).broadcast({ - msgs: msg, + msgs: msg +}) + +console.log(txHash) +``` + +### MsgExternalTransfer + +This message is used to transfer balance from one subaccount to another subaccount. + +Note: + +* You cannot transfer from your default subaccountId since that balance is now associated with your Injective address in the bank module. Therefore, in order for `MsgExternalTransfer` to work, you will need to transfer from a non-default subaccountId. + +How to find the subaccountId that you will be transferring from: + +* you can query your existing subaccountIds via the [account portfolio api](../querying/querying-api/querying-indexer-portfolio.md). + +How to use funds that are currently associated with your Injective Address in bank module: + +* If you have existing non-default subaccounts, you'll want to do a [MsgDeposit](exchange.md#MsgDeposit) to one of your existing non-default subaccountIds and use that subaccountId as the `srcSubaccountId` below. +* If you don't have existing non-default subaccounts, you can do a [MsgDeposit](exchange.md#MsgDeposit) to a new default subaccountId, which would be done via importing `getSubaccountId` from `sdk-ts` and setting the `subaccountId` field in [MsgDeposit](exchange.md#MsgDeposit) to `getSubaccountId(injectiveAddress, 1)`. + +```ts +import { + DenomClient, + MsgExternalTransfer, + MsgBroadcasterWithPk, +} from '@injectivelabs/sdk-ts' +import { BigNumberInBase } from '@injectivelabs/utils' +import { Network } from '@injectivelabs/networks' + +const denomClient = new DenomClient(Network.Testnet) + +const injectiveAddress = 'inj...' +const srcSubaccountId = '0x...' +const dstSubaccountId = `0x...` +const INJ_TOKEN_SYMBOL = 'INJ' +const tokenMeta = denomClient.getTokenMetaDataBySymbol(INJ_TOKEN_SYMBOL) +const tokenDenom = `inj` + +/* format amount to add to the burn auction pool */ +const amount = { + denom: tokenDenom, + amount: new BigNumberInBase(1).toWei(tokenMeta.decimals).toFixed(), +} + +/* create message in proto format */ +const msg = MsgExternalTransfer.fromJSON({ + amount, + dstSubaccountId, + srcSubaccountId, injectiveAddress, }) +const privateKey = '0x...' + +/* broadcast transaction */ +const txHash = await new MsgBroadcasterWithPk({ + network: Network.Testnet, + privateKey, +}).broadcast({ + msgs: msg +}) + console.log(txHash) ``` diff --git a/.gitbook/core-modules/feegrant.md b/.gitbook/core-modules/feegrant.md new file mode 100644 index 000000000..c052621d6 --- /dev/null +++ b/.gitbook/core-modules/feegrant.md @@ -0,0 +1,75 @@ +# Fee Grant + +The `feegrant` module allows accounts (granters) to grant fee allowances to other accounts (grantees). This allows the grantee to use the granter's funds to pay for transaction fees. + +## Messages + +### MsgGrantAllowance + +A fee allowance grant is created using the `MsgGrantAllowance` message. If there is already a grant for the (granter, grantee) pair, then the new grant will overwrite the previous one. + +```ts +import { MsgGrantAllowance, MsgBroadcasterWithPk } from '@injectivelabs/sdk-ts' +import { Network } from '@injectivelabs/networks' + + +const privateKeyOfGranter = '0x...' + +const date = new Date('2023-10-02T00:00:00Z') +const expiration = date.getTime() / 1000 +const granter = 'inj...' +const grantee = 'inj...' +const allowance = { + spendLimit: [ + { + denom: 'inj', + amount: '10000', + }, + ], + expiration +} + +const msg = MsgGrantAllowance.fromJSON({ + granter, + grantee, + allowance, +}) + +const txHash = await new MsgBroadcasterWithPk({ +privateKey: privateKeyOfGranter, +network: Network.Testnet, +}).broadcast({ +msgs: msg, +}) + +console.log(txHash) + +``` + +### MsgRevokeAllowance +A grant can be removed using the MsgRevokeAllowance message. The grantee will no longer be able to use the granter's funds to pay for transaction fees. + +```ts +import { MsgRevokeAllowance, MsgBroadcasterWithPk } from '@injectivelabs/sdk-ts' +import { Network } from '@injectivelabs/networks' + +const privateKey= "0x..." +const granteeAddress = 'inj...' +const granterAddress = 'inj...' + +const params = { +grantee: granteeAddress, +granter: granterAddress, +} + +const msg = MsgRevokeAllowance.fromJSON(params); + +const txHash = await new MsgBroadcasterWithPk({ +privateKey, +network: Network.Testnet, +}).broadcast({ +msgs: msg, +}) + +console.log(txHash) +``` diff --git a/.gitbook/core-modules/governance.md b/.gitbook/core-modules/governance.md index 81d7734bc..5f113fc08 100644 --- a/.gitbook/core-modules/governance.md +++ b/.gitbook/core-modules/governance.md @@ -18,8 +18,7 @@ import { MsgBroadcasterWithPk, } from "@injectivelabs/sdk-ts"; import { BigNumberInBase } from "@injectivelabs/utils"; -import { getNetworkEndpoints, Network } from "@injectivelabs/networks"; -import { ChainId } from "@injectivelabs/ts-types"; +import { Network } from "@injectivelabs/networks"; const INJ_DENOM = 'inj' const amount = new BigNumberInBase(1).toWei().toFixed() @@ -39,11 +38,9 @@ const message = MsgGovDeposit.fromJSON({ /* broadcast transaction */ const txHash = await new MsgBroadcasterWithPk({ privateKey, - chainId: ChainId.Testnet, - endpoints: getNetworkEndpoints(Network.Testnet), + network: Network.Testnet }).broadcast({ - msgs: message, - injectiveAddress, + msgs: message }); ``` @@ -56,8 +53,7 @@ import { MsgVote, MsgBroadcasterWithPk } from "@injectivelabs/sdk-ts"; -import { getNetworkEndpoints, Network } from "@injectivelabs/networks"; -import { ChainId } from "@injectivelabs/ts-types"; +import { Network } from "@injectivelabs/networks"; import { VoteOption } from '@injectivelabs/sdk-ts'; const injectiveAddress = "inj..."; @@ -73,11 +69,9 @@ const message = MsgVote.fromJSON({ const txHash = await new MsgBroadcasterWithPk({ privateKey, - chainId: ChainId.Testnet, - endpoints: getNetworkEndpoints(Network.Testnet), + network: Network.Testnet }).broadcast({ - msgs: message, - injectiveAddress, + msgs: message }); ``` @@ -90,8 +84,7 @@ import { MsgSubmitTextProposal, MsgBroadcasterWithPk } from "@injectivelabs/sdk-ts"; -import { getNetworkEndpoints, Network } from "@injectivelabs/networks"; -import { ChainId } from "@injectivelabs/ts-types"; +import { Network } from "@injectivelabs/networks"; import { BigNumberInBase } from "@injectivelabs/utils"; const injectiveAddress = "inj..."; @@ -111,11 +104,9 @@ const message = MsgSubmitTextProposal.fromJSON({ const txHash = await new MsgBroadcasterWithPk({ privateKey, - chainId: ChainId.Testnet, - endpoints: getNetworkEndpoints(Network.Testnet), + network: Network.Testnet }).broadcast({ - msgs: message, - injectiveAddress, + msgs: message }); ``` @@ -125,13 +116,12 @@ This message allows you to propose a new spot market. Ensure that the ticker is ```ts import { - DenomClient, + DenomClientAsync, MsgBroadcasterWithPk, MsgSubmitProposalSpotMarketLaunch } from "@injectivelabs/sdk-ts"; import { BigNumberInBase, BigNumberInWei } from "@injectivelabs/utils"; import { getNetworkEndpoints, Network } from "@injectivelabs/networks"; -import { ChainId } from "@injectivelabs/ts-types"; const injectiveAddress = "inj..."; const privateKey = "0x..."; @@ -150,7 +140,8 @@ const market = { minQuantityTickSize: '0.001' } -const denomClient = new DenomClient( +const denomClient = new DenomClientAsync +( NETWORK.Testnet, { endpoints: getNetworkEndpoints(Network.Testnet) } ) @@ -191,11 +182,9 @@ const message = MsgSubmitProposalSpotMarketLaunch.fromJSON({ const txHash = await new MsgBroadcasterWithPk({ privateKey, - chainId: ChainId.Testnet, - endpoints: getNetworkEndpoints(Network.Testnet), + network: Network.Testnet }).broadcast({ - msgs: message, - injectiveAddress + msgs: message }); ``` @@ -205,13 +194,12 @@ This message allows you to propose a new perpetual market. perpetual futures con ```ts import { - DenomClient, + DenomClientAsync, MsgBroadcasterWithPk, MsgSubmitProposalPerpetualMarketLaunch } from "@injectivelabs/sdk-ts"; import { BigNumberInBase } from "@injectivelabs/utils"; import { getNetworkEndpoints, Network } from "@injectivelabs/networks"; -import { ChainId } from "@injectivelabs/ts-types"; const injectiveAddress = "inj..."; const privateKey = "0x..."; @@ -235,7 +223,7 @@ const market = { minQuantityTickSize: '0.01' } -const denomClient = new DenomClient( +const denomClient = new DenomClientAsync( NETWORK.Testnet, { endpoints: getNetworkEndpoints(Network.Testnet) } ) @@ -266,11 +254,9 @@ const message = MsgSubmitProposalPerpetualMarketLaunch.fromJSON({ const txHash = await new MsgBroadcasterWithPk({ privateKey, - chainId: ChainId.Testnet, - endpoints: getNetworkEndpoints(Network.Testnet), + network: Network.Testnet }).broadcast({ - msgs: message, - injectiveAddress + msgs: message }); ``` @@ -280,13 +266,12 @@ An expiry futures contract is an agreement between two counterparties to buy and ```ts import { - DenomClient, + DenomClientAsync, MsgBroadcasterWithPk, MsgSubmitProposalExpiryFuturesMarketLaunch } from "@injectivelabs/sdk-ts"; import { BigNumberInBase } from "@injectivelabs/utils"; import { getNetworkEndpoints, Network } from "@injectivelabs/networks"; -import { ChainId } from "@injectivelabs/ts-types"; const injectiveAddress = "inj..."; const privateKey = "0x..."; @@ -311,7 +296,7 @@ const market = { minQuantityTickSize: '0.01' } -const denomClient = new DenomClient( +const denomClient = new DenomClientAsync( NETWORK.Testnet, { endpoints: getNetworkEndpoints(Network.Testnet) } ) @@ -342,11 +327,9 @@ const message = MsgSubmitProposalExpiryFuturesMarketLaunch.fromJSON({ const txHash = await new MsgBroadcasterWithPk({ privateKey, - chainId: ChainId.Testnet, - endpoints: getNetworkEndpoints(Network.Testnet), + network: Network.Testnet }).broadcast({ - msgs: message, - injectiveAddress + msgs: message }); ``` @@ -360,8 +343,7 @@ import { MsgSubmitProposalSpotMarketParamUpdate } from "@injectivelabs/sdk-ts"; import { BigNumberInBase } from "@injectivelabs/utils"; -import { getNetworkEndpoints, Network } from "@injectivelabs/networks"; -import { ChainId } from "@injectivelabs/ts-types"; +import { Network } from "@injectivelabs/networks"; import { MarketStatusMap } from '@injectivelabs/chain-api'; const injectiveAddress = "inj..."; @@ -392,10 +374,8 @@ const message = MsgSubmitProposalSpotMarketParamUpdate.fromJSON({ const txHash = await new MsgBroadcasterWithPk({ privateKey, - chainId: ChainId.Testnet, - endpoints: getNetworkEndpoints(Network.Testnet), + network: Network.Testnet }).broadcast({ - msgs: message, - injectiveAddress + msgs: message }); ``` diff --git a/.gitbook/core-modules/ibc.md b/.gitbook/core-modules/ibc.md index 800353a86..1ab09d1de 100644 --- a/.gitbook/core-modules/ibc.md +++ b/.gitbook/core-modules/ibc.md @@ -17,9 +17,9 @@ import { MsgTransfer, } from '@injectivelabs/sdk-ts' import { - cosmosNativeDenomsFromChainId, TokenService, UiBankTransformer, + cosmosChainTokenMetaMap, } from '@injectivelabs/sdk-ui-ts' import { BigNumberInBase } from '@injectivelabs/utils' import { ChainId, CosmosChainId } from '@injectivelabs/ts-types' @@ -46,7 +46,7 @@ const ibcSupplyWithToken = (await tokenService.getIbcSupplyWithToken( /* get metadata for canonical denoms available for transfer between chains */ const cosmosHubBaseDenom = 'uatom' -const tokenMeta = cosmosNativeDenomsFromChainId[destinationChainId] +const tokenMeta = cosmosChainTokenMetaMap[destinationChainId] const atomToken = ( Array.isArray(tokenMeta) ? tokenMeta.find((token) => token.denom === cosmosHubBaseDenom) @@ -105,11 +105,9 @@ const privateKey = '0x...' /* broadcast transaction */ const txHash = await new MsgBroadcasterWithPk({ privateKey, - chainId: ChainId.Mainnet, - endpoints: endpointsForNetwork, + network: Network.Mainnet, }).broadcast({ msgs: msg, - injectiveAddress, }) console.log(txHash) diff --git a/.gitbook/core-modules/insurance.md b/.gitbook/core-modules/insurance.md index 0abca6db8..478622cf3 100644 --- a/.gitbook/core-modules/insurance.md +++ b/.gitbook/core-modules/insurance.md @@ -16,8 +16,7 @@ import { MsgBroadcasterWithPk, } from "@injectivelabs/sdk-ts"; import { BigNumberInBase } from "@injectivelabs/utils"; -import { ChainId } from "@injectivelabs/ts-types"; -import { Network, getNetworkEndpoints } from "@injectivelabs/networks"; +import { Network } from "@injectivelabs/networks"; const injectiveAddress = "inj1..."; const privateKey = "0x..."; @@ -41,11 +40,9 @@ const msg = MsgCreateInsuranceFund.fromJSON({ const txHash = await new MsgBroadcasterWithPk({ privateKey, - chainId: ChainId.Testnet, - endpoints: getNetworkEndpoints(Network.Testnet), + network: Network.Testnet }).broadcast({ - msgs: msg, - injectiveAddress, + msgs: msg }); console.log(txHash); @@ -61,8 +58,7 @@ import { MsgBroadcasterWithPk, } from "@injectivelabs/sdk-ts"; import { BigNumberInBase } from "@injectivelabs/utils"; -import { ChainId } from "@injectivelabs/ts-types"; -import { Network, getNetworkEndpoints } from "@injectivelabs/networks"; +import { Network } from "@injectivelabs/networks"; const injectiveAddress = "inj1..."; const privateKey = "0x..."; @@ -81,11 +77,9 @@ const msg = MsgRequestRedemption.fromJSON({ const txHash = await new MsgBroadcasterWithPk({ privateKey, - chainId: ChainId.Testnet, - endpoints: getNetworkEndpoints(Network.Testnet), + network: Network.Testnet }).broadcast({ - msgs: msg, - injectiveAddress, + msgs: msg }); console.log(txHash); @@ -98,8 +92,7 @@ This Message is used to underwrite to an insurance fund. ```ts import { MsgUnderwrite, MsgBroadcasterWithPk } from "@injectivelabs/sdk-ts"; import { BigNumberInBase } from "@injectivelabs/utils"; -import { ChainId } from "@injectivelabs/ts-types"; -import { Network, getNetworkEndpoints } from "@injectivelabs/networks"; +import { Network } from "@injectivelabs/networks"; const injectiveAddress = "inj1..."; const privateKey = "0x..."; @@ -118,11 +111,9 @@ const msg = MsgUnderwrite.fromJSON({ const txHash = await new MsgBroadcasterWithPk({ privateKey, - chainId: ChainId.Testnet, - endpoints: getNetworkEndpoints(Network.Testnet), + network: Network.Testnet }).broadcast({ - msgs: msg, - injectiveAddress, + msgs: msg }); console.log(txHash); diff --git a/.gitbook/core-modules/peggy.md b/.gitbook/core-modules/peggy.md index 06163bca5..6004d60a4 100644 --- a/.gitbook/core-modules/peggy.md +++ b/.gitbook/core-modules/peggy.md @@ -10,7 +10,7 @@ Note that a $10 USD bridge fee will be charged for this transaction to cover for ```ts import { - DenomClient, + DenomClientAsync, MsgSendToEth, MsgBroadcasterWithPk, } from "@injectivelabs/sdk-ts"; @@ -27,7 +27,7 @@ const tokenService = new TokenService({ const ETH_BRIDGE_FEE_IN_USD = 10; const endpointsForNetwork = getNetworkEndpoints(Network.Mainnet); -const denomClient = new DenomClient(Network.Mainnet, { +const denomClient = new DenomClientAsync(Network.Mainnet, { endpoints: endpointsForNetwork, }); @@ -39,13 +39,15 @@ const injectiveAddress = "inj1..."; const destinationAddress = "0x..."; // ethereum address const tokenDenom = `peggy${tokenMeta.erc20.address}`; -if (!tokenDenom) { +if (!tokenMeta) { return; } -const tokenUsdPrice = tokenService.fetchUsdTokenPrice(tokenDenom.coinGeckoId); +const tokenUsdPrice = tokenService.fetchUsdTokenPrice(tokenMeta +.coinGeckoId); const amountToFixed = new BigNumberInBase(amount) - .toWei(tokenDenom.decimals) + .toWei(tokenMeta +.decimals) .toFixed(); const bridgeFeeInToken = new BigNumberInBase(ETH_BRIDGE_FEE_IN_USD) .dividedBy(tokenUsdPrice) @@ -66,10 +68,8 @@ const msg = MsgSendToEth.fromJSON({ const txHash = await new MsgBroadcasterWithPk({ privateKey, - chainId: ChainId.Mainnet, - endpoints: endpointsForNetwork, + network: Network.Mainnet }).broadcast({ - msgs: msg, - injectiveAddress, + msgs: msg }); ``` diff --git a/.gitbook/core-modules/staking.md b/.gitbook/core-modules/staking.md index e8613638c..b9137ec3d 100644 --- a/.gitbook/core-modules/staking.md +++ b/.gitbook/core-modules/staking.md @@ -16,8 +16,7 @@ import { MsgBroadcasterWithPk } from "@injectivelabs/sdk-ts"; import { BigNumberInBase } from "@injectivelabs/utils"; -import { ChainId } from "@injectivelabs/ts-types"; -import { Network, getNetworkEndpoints } from "@injectivelabs/networks"; +import { Network } from "@injectivelabs/networks"; const injectiveAddress = "inj1..."; const privateKey = "0x..."; @@ -38,11 +37,9 @@ const msg = MsgBeginRedelegate.fromJSON({ const txHash = await new MsgBroadcasterWithPk({ privateKey, - chainId: ChainId.Testnet, - endpoints: getNetworkEndpoints(Network.Testnet), + network: Network.Testnet }).broadcast({ - msgs: msg, - injectiveAddress, + msgs: msg }); console.log(txHash); @@ -55,8 +52,7 @@ This Message is used to Delegate INJ to a validator. ```ts import { MsgDelegate, MsgBroadcasterWithPk } from "@injectivelabs/sdk-ts"; import { BigNumberInBase } from "@injectivelabs/utils"; -import { ChainId } from "@injectivelabs/ts-types"; -import { Network, getNetworkEndpoints } from "@injectivelabs/networks"; +import { Network } from "@injectivelabs/networks"; const injectiveAddress = "inj1..."; const privateKey = "0x..."; @@ -74,11 +70,9 @@ const msg = MsgDelegate.fromJSON({ const txHash = await new MsgBroadcasterWithPk({ privateKey, - chainId: ChainId.Testnet, - endpoints: getNetworkEndpoints(Network.Testnet), + network: Network.Testnet }).broadcast({ - msgs: msg, - injectiveAddress, + msgs: msg }); console.log(txHash); @@ -91,8 +85,7 @@ This Message is used to Delegate INJ to a validator. ```ts import { MsgUndelegate, MsgBroadcasterWithPk } from "@injectivelabs/sdk-ts"; import { BigNumberInBase } from "@injectivelabs/utils"; -import { ChainId } from "@injectivelabs/ts-types"; -import { Network, getNetworkEndpoints } from "@injectivelabs/networks"; +import { Network } from "@injectivelabs/networks"; const injectiveAddress = "inj1..."; const privateKey = "0x..."; @@ -110,11 +103,9 @@ const msg = MsgUndelegate.fromJSON({ const txHash = await new MsgBroadcasterWithPk({ privateKey, - chainId: ChainId.Testnet, - endpoints: getNetworkEndpoints(Network.Testnet), + network: Network.Testnet }).broadcast({ - msgs: msg, - injectiveAddress, + msgs: msg }); console.log(txHash); diff --git a/.gitbook/core-modules/token-factory.md b/.gitbook/core-modules/token-factory.md index 636a2dc69..67858b309 100644 --- a/.gitbook/core-modules/token-factory.md +++ b/.gitbook/core-modules/token-factory.md @@ -19,8 +19,7 @@ import { MsgCreateDenom, } from "@injectivelabs/sdk-ts"; import { BigNumberInBase } from "@injectivelabs/utils"; -import { ChainId } from "@injectivelabs/ts-types"; -import { Network, getNetworkEndpoints } from "@injectivelabs/networks"; +import { Network } from "@injectivelabs/networks"; const injectiveAddress = "inj1..."; const privateKey = "0x..."; @@ -33,11 +32,9 @@ const msg = MsgCreateDenom.fromJSON({ const txHash = await new MsgBroadcasterWithPk({ privateKey, - chainId: ChainId.Testnet, - endpoints: getNetworkEndpoints(Network.Testnet), + network: Network.Testnet }).broadcast({ - msgs: msg, - injectiveAddress, + msgs: msg }); console.log(txHash); @@ -52,8 +49,7 @@ import { MsgMint, } from "@injectivelabs/sdk-ts"; import { BigNumberInBase } from "@injectivelabs/utils"; -import { ChainId } from "@injectivelabs/ts-types"; -import { Network, getNetworkEndpoints } from "@injectivelabs/networks"; +import { Network } from "@injectivelabs/networks"; const injectiveAddress = "inj1..."; const privateKey = "0x..."; @@ -70,11 +66,9 @@ const msg = MsgMint.fromJSON({ const txHash = await new MsgBroadcasterWithPk({ privateKey, - chainId: ChainId.Testnet, - endpoints: getNetworkEndpoints(Network.Testnet), + network: Network.Testnet }).broadcast({ - msgs: msg, - injectiveAddress, + msgs: msg }); console.log(txHash); @@ -89,8 +83,7 @@ import { MsgBurn, } from "@injectivelabs/sdk-ts"; import { BigNumberInBase } from "@injectivelabs/utils"; -import { ChainId } from "@injectivelabs/ts-types"; -import { Network, getNetworkEndpoints } from "@injectivelabs/networks"; +import { Network } from "@injectivelabs/networks"; const injectiveAddress = "inj1..."; const privateKey = "0x..."; @@ -107,11 +100,9 @@ const msg = MsgBurn.fromJSON({ const txHash = await new MsgBroadcasterWithPk({ privateKey, - chainId: ChainId.Testnet, - endpoints: getNetworkEndpoints(Network.Testnet), + network: Network.Testnet }).broadcast({ - msgs: msg, - injectiveAddress, + msgs: msg }); console.log(txHash); @@ -126,8 +117,7 @@ import { MsgSetDenomMetadata, } from "@injectivelabs/sdk-ts"; import { BigNumberInBase } from "@injectivelabs/utils"; -import { ChainId } from "@injectivelabs/ts-types"; -import { Network, getNetworkEndpoints } from "@injectivelabs/networks"; +import { Network } from "@injectivelabs/networks"; const injectiveAddress = "inj1..."; const privateKey = "0x..."; @@ -155,7 +145,7 @@ const denomUnitsIfTokenHas6Decimals = [ }, ] const displayIfTokenHas6Decimals = subdenom -const displayIfTokenHas0Decimals = +const displayIfTokenHas0Decimals = const msg = MsgSetDenomMetadata.fromJSON({ sender: injectiveAddress, @@ -172,11 +162,9 @@ const msg = MsgSetDenomMetadata.fromJSON({ const txHash = await new MsgBroadcasterWithPk({ privateKey, - chainId: ChainId.Testnet, - endpoints: getNetworkEndpoints(Network.Testnet), + network: Network.Testnet }).broadcast({ - msgs: msg, - injectiveAddress, + msgs: msg }); console.log(txHash); @@ -191,8 +179,7 @@ import { MsgSetDenomMetadata, } from "@injectivelabs/sdk-ts"; import { BigNumberInBase } from "@injectivelabs/utils"; -import { ChainId } from "@injectivelabs/ts-types"; -import { Network, getNetworkEndpoints } from "@injectivelabs/networks"; +import { Network } from "@injectivelabs/networks"; const injectiveAddress = "inj1..."; const privateKey = "0x..."; @@ -237,11 +224,9 @@ const msgSetDenomMetadata = MsgSetDenomMetadata.fromJSON({ const txHash = await new MsgBroadcasterWithPk({ privateKey, - chainId: ChainId.Testnet, - endpoints: getNetworkEndpoints(Network.Testnet), + network: Network.Testnet }).broadcast({ - msgs: [msgCreateDenom, msgMint, msgSetDenomMetadata], - injectiveAddress, + msgs: [msgCreateDenom, msgMint, msgSetDenomMetadata] }); console.log(txHash); diff --git a/.gitbook/core-modules/tokenfactory.md b/.gitbook/core-modules/tokenfactory.md index 684f44376..0b77e733f 100644 --- a/.gitbook/core-modules/tokenfactory.md +++ b/.gitbook/core-modules/tokenfactory.md @@ -17,8 +17,7 @@ import { MsgCreateDenom, } from "@injectivelabs/sdk-ts"; import { BigNumberInBase } from "@injectivelabs/utils"; -import { ChainId } from "@injectivelabs/ts-types"; -import { Network, getNetworkEndpoints } from "@injectivelabs/networks"; +import { Network } from "@injectivelabs/networks"; const injectiveAddress = "inj1..."; const privateKey = "0x..."; @@ -31,11 +30,9 @@ const msg = MsgCreateDenom.fromJSON({ const txHash = await new MsgBroadcasterWithPk({ privateKey, - chainId: ChainId.Testnet, - endpoints: getNetworkEndpoints(Network.Testnet), + network: Network.Testnet }).broadcast({ - msgs: msg, - injectiveAddress, + msgs: msg }); console.log(txHash); @@ -50,8 +47,7 @@ import { MsgMint, } from "@injectivelabs/sdk-ts"; import { BigNumberInBase } from "@injectivelabs/utils"; -import { ChainId } from "@injectivelabs/ts-types"; -import { Network, getNetworkEndpoints } from "@injectivelabs/networks"; +import { Network } from "@injectivelabs/networks"; const injectiveAddress = "inj1..."; const privateKey = "0x..."; @@ -68,11 +64,9 @@ const msg = MsgMint.fromJSON({ const txHash = await new MsgBroadcasterWithPk({ privateKey, - chainId: ChainId.Testnet, - endpoints: getNetworkEndpoints(Network.Testnet), + network: Network.Testnet }).broadcast({ msgs: msg, - injectiveAddress, }); console.log(txHash); @@ -87,8 +81,7 @@ import { MsgBurn, } from "@injectivelabs/sdk-ts"; import { BigNumberInBase } from "@injectivelabs/utils"; -import { ChainId } from "@injectivelabs/ts-types"; -import { Network, getNetworkEndpoints } from "@injectivelabs/networks"; +import { Network } from "@injectivelabs/networks"; const injectiveAddress = "inj1..."; const privateKey = "0x..."; @@ -105,11 +98,9 @@ const msg = MsgBurn.fromJSON({ const txHash = await new MsgBroadcasterWithPk({ privateKey, - chainId: ChainId.Testnet, - endpoints: getNetworkEndpoints(Network.Testnet), + network: Network.Testnet }).broadcast({ - msgs: msg, - injectiveAddress, + msgs: msg }); console.log(txHash); @@ -125,8 +116,7 @@ import { MsgSetDenomMetadata, } from "@injectivelabs/sdk-ts"; import { BigNumberInBase } from "@injectivelabs/utils"; -import { ChainId } from "@injectivelabs/ts-types"; -import { Network, getNetworkEndpoints } from "@injectivelabs/networks"; +import { Network } from "@injectivelabs/networks"; const injectiveAddress = "inj1..."; const privateKey = "0x..."; @@ -169,11 +159,9 @@ const msg = MsgSetDenomMetadata.fromJSON({ const txHash = await new MsgBroadcasterWithPk({ privateKey, - chainId: ChainId.Testnet, - endpoints: getNetworkEndpoints(Network.Testnet), + network: Network.Testnet }).broadcast({ - msgs: msg, - injectiveAddress, + msgs: msg }); console.log(txHash); diff --git a/.gitbook/core-modules/wasm.md b/.gitbook/core-modules/wasm.md index ae2b4d9f2..1f085d820 100644 --- a/.gitbook/core-modules/wasm.md +++ b/.gitbook/core-modules/wasm.md @@ -11,8 +11,7 @@ import { MsgExecuteContract, MsgBroadcasterWithPk, } from "@injectivelabs/sdk-ts"; -import { ChainId } from "@injectivelabs/ts-types"; -import { getNetworkEndpoints, Network } from "@injectivelabs/networks"; +import { Network } from "@injectivelabs/networks"; const injectiveAddress = "inj1..."; const recipientAddress = "inj2..."; @@ -32,11 +31,9 @@ const msg = MsgExecuteContract.fromJSON({ const txHash = await new MsgBroadcasterWithPk({ privateKey, - chainId: ChainId.Mainnet, - endpoints: endpointsForNetwork, + network: Network.Mainnet }).broadcast({ - msgs: msg, - injectiveAddress, + msgs: msg }); console.log(txHash); @@ -44,9 +41,9 @@ console.log(txHash); ### MsgExecuteContract (funds example) -In some scenario, depending on the smart contract's function we have to transfer tokens to the smart contract, following cosmwasm convention we use the funds field to transfer tokens to the smart contract from the user's bank module. +In some scenarios, depending on the smart contract's function we have to transfer tokens to the smart contract, following cosmwasm convention, we use the funds field to transfer tokens to the smart contract from the user's bank module. -Below is an example of how we can send the MsgExecuteContract using an `test` contract function. +Below is an example of how we can send the `MsgExecuteContract` using an `test` contract function. ```ts import { @@ -54,8 +51,7 @@ import { MsgBroadcasterWithPk, } from "@injectivelabs/sdk-ts"; import { INJ_DENOM } from "@injectivelabs/sdk-ui-ts"; -import { ChainId } from "@injectivelabs/ts-types"; -import { getNetworkEndpoints, Network } from "@injectivelabs/networks"; +import { Network } from "@injectivelabs/networks"; const injectiveAddress = "inj1..."; const contractAddress = "cw..."; @@ -76,11 +72,9 @@ const msg = MsgExecuteContract.fromJSON({ const txHash = await new MsgBroadcasterWithPk({ privateKey, - chainId: ChainId.Mainnet, - endpoints: endpointsForNetwork, + network: Network.Mainnet }).broadcast({ - msgs: msg, - injectiveAddress, + msgs: msg }); console.log(txHash); @@ -88,30 +82,11 @@ console.log(txHash); ### MsgExecuteContractCompact -There are some compatibility issue parsing the funds array in the previous example with EIP712, hence we introduced MsgExecuteContractCompact which converts the funds into a string +There are some compatibility issues parsing the `funds` array and `msgs` object in the previous example with EIP712. Since `MsgExecuteContract` can't be properly converted to EIP712 and then signed by Ethereum wallets, we introduced `MsgExecuteContractCompact` which is fully compatible with EIP712. -An array of funds: +_**Note:**_ _`MsgExecuteContract` and `MsgExecuteContractCompat` underlying messages are the same. `MsgExecuteContractCompat` is just EIP712 compatible._ -```ts -const funds = [ - { - denom: denom1, - amount: new BigNumberInBase(1).toWei().toFixed(), - }, - { - denom: denom2, - amount: new BigNumberInBase(1).toWei().toFixed(), - }, -]; -``` - -will be presented as a string like this: - -```ts -const funds = "100000000000000000 denom1, 100000000000000000 denom2"; -``` - -Below is an example of how we can send the MsgExecuteContractCompact using an `test` contract function. +Below is an example of how we can send the `MsgExecuteContractCompact` using an `test` contract function. ```ts import { @@ -119,8 +94,7 @@ import { MsgExecuteContractCompact, } from "@injectivelabs/sdk-ts"; import { INJ_DENOM } from "@injectivelabs/sdk-ui-ts"; -import { ChainId } from "@injectivelabs/ts-types"; -import { getNetworkEndpoints, Network } from "@injectivelabs/networks"; +import { Network } from "@injectivelabs/networks"; const injectiveAddress = "inj1..."; const contractAddress = "cw..."; @@ -141,11 +115,9 @@ const msg = MsgExecuteContractCompact.fromJSON({ const txHash = await new MsgBroadcasterWithPk({ privateKey, - chainId: ChainId.Mainnet, - endpoints: endpointsForNetwork, + network: Network.Mainnet }).broadcast({ - msgs: msg, - injectiveAddress, + msgs: msg }); console.log(txHash); diff --git a/.gitbook/readme/token-metadata/creating-tokens.md b/.gitbook/readme/token-metadata/creating-tokens.md index a74e9c2aa..016ff789a 100644 --- a/.gitbook/readme/token-metadata/creating-tokens.md +++ b/.gitbook/readme/token-metadata/creating-tokens.md @@ -10,4 +10,4 @@ A single account can create multiple denoms, by providing a unique subdenom for * Change the admin. In the future, more admin capabilities may be added. Admins can choose to share admin privileges with other accounts using the authz module. The ChangeAdmin functionality allows changing the master admin account, or even setting it to "", meaning no account has admin privileges over the asset. * Set their token metadata on chain -To start creating your denoms, head to our [TokenFactory Core Module page](../../core-modules/token-factory.md) to see examples. +To start creating your denoms, head to our [TokenFactory Core Module page ](../../core-modules/token-factory.md)to see examples. diff --git a/.gitbook/transactions/ethereum.md b/.gitbook/transactions/ethereum.md index 843cc3e04..fa415f959 100644 --- a/.gitbook/transactions/ethereum.md +++ b/.gitbook/transactions/ethereum.md @@ -9,7 +9,7 @@ First of, we need to prepare the transaction for signing. To use Ethereum native Using our custom abstraction for the Messages which allows the developer to get EIP712 TypedData straight from the proto file of the particular message. ```ts -import { +import { MsgSend, ChainRestAuthApi, ChainRestTendermintApi, @@ -17,22 +17,24 @@ import { DEFAULT_STD_FEE, getEip712TypedData, } from '@injectivelabs/sdk-ts' -import { DEFAULT_STD_FEE, DEFAULT_BLOCK_TIMEOUT_HEIGHT } from '@injectivelabs/utils' +import { + DEFAULT_STD_FEE, + DEFAULT_BLOCK_TIMEOUT_HEIGHT, +} from '@injectivelabs/utils' import { ChainId } from '@injectivelabs/ts-types' import { Network, getNetworkEndpoints } from '@injectivelabs/networks' const injectiveAddress = 'inj1' const chainId = 'injective-1' /* ChainId.Mainnet */ -const restEndpoint = 'https://lcd.injective.network' /* getNetworkEndpoints(Network.Mainnet).rest */ +const restEndpoint = + 'https://lcd.injective.network' /* getNetworkEndpoints(Network.Mainnet).rest */ const amount = { amount: new BigNumberInBase(0.01).toWei().toFixed(), - denom: "inj", -}; + denom: 'inj', +} /** Account Details **/ -const chainRestAuthApi = new ChainRestAuthApi( - restEndpoint, -) +const chainRestAuthApi = new ChainRestAuthApi(restEndpoint) const accountDetailsResponse = await chainRestAuthApi.fetchAccount( injectiveAddress, ) @@ -40,9 +42,7 @@ const baseAccount = BaseAccount.fromRestApi(accountDetailsResponse) const accountDetails = baseAccount.toAccountDetails() /** Block Details */ -const chainRestTendermintApi = new ChainRestTendermintApi( - restEndpoint, -) +const chainRestTendermintApi = new ChainRestTendermintApi(restEndpoint) const latestBlock = await chainRestTendermintApi.fetchLatestBlock() const latestHeight = latestBlock.header.height const timeoutHeight = new BigNumberInBase(latestHeight).plus( @@ -54,7 +54,7 @@ const msg = MsgSend.fromJSON({ amount, srcInjectiveAddress: injectiveAddress, dstInjectiveAddress: injectiveAddress, -}); +}) /** EIP712 for signing on Ethereum wallets */ const eip712TypedData = getEip712TypedData({ @@ -77,14 +77,14 @@ Once we have prepared the EIP712 typed data, we proceed to signing. /** Use your preferred approach to sign EIP712 TypedData, example with Metamask */ const signature = await window.ethereum.request({ method: 'eth_signTypedData_v4', - params: [ethereumAddress, JSON.stringify(eip712TypedData /* from previous step */)], + params: [ + ethereumAddress, + JSON.stringify(eip712TypedData /* from previous step */), + ], }) /** Get Public Key of the signer */ -const publicKeyHex = recoverTypedSignaturePubKey( - eip712TypedData, - signature, -) +const publicKeyHex = recoverTypedSignaturePubKey(eip712TypedData, signature) const publicKeyBase64 = hexToBase64(publicKeyHex) ``` @@ -97,7 +97,11 @@ Once we have the signature ready, we need to broadcast the transaction to the In ```ts import { ChainId } from '@injectivelabs/ts-types' import { createTransaction, TxRestClient } from '@injectivelabs/sdk-ts' -import { SIGN_AMINO, Network, getNetworkEndpoints } from '@injectivelabs/networks' +import { + SIGN_AMINO, + Network, + getNetworkEndpoints, +} from '@injectivelabs/networks' const { txRaw } = createTransaction({ message: msgs, @@ -119,19 +123,20 @@ const txRawEip712 = createTxRawEIP712(txRaw, web3Extension) txRawEip712.signatures = [signatureBuff /* From previous step */] /** Broadcast the Transaction */ -const restEndpoint = 'https://lcd.injective.network' /* getNetworkEndpoints(Network.Mainnet).rest */ +const restEndpoint = + 'https://lcd.injective.network' /* getNetworkEndpoints(Network.Mainnet).rest */ const txRestClient = new TxRestClient(restEndpoint) const txHash = await txRestClient.broadcast(txRawEip712) -/** - * Once we get the txHash, because we use the Sync mode we - * are not sure that the transaction is included in the block, - * it can happen that it's still in the mempool so we need to query +/** + * Once we get the txHash, because we use the Sync mode we + * are not sure that the transaction is included in the block, + * it can happen that it's still in the mempool so we need to query * the chain to see when the transaction will be included */ - /** This will poll querying the transaction and await for it's inclusion in the block */ +/** This will poll querying the transaction and await for it's inclusion in the block */ const response = await txRestClient.fetchTxPoll(txHash) ``` @@ -140,7 +145,7 @@ const response = await txRestClient.fetchTxPoll(txHash) Let's have a look at the whole flow (using Metamask as a signing wallet) ```ts -import { +import { MsgSend, ChainRestAuthApi, ChainRestTendermintApi, @@ -148,22 +153,24 @@ import { DEFAULT_STD_FEE, getEip712TypedData, } from '@injectivelabs/sdk-ts' -import { DEFAULT_STD_FEE, DEFAULT_BLOCK_TIMEOUT_HEIGHT } from '@injectivelabs/utils' +import { + DEFAULT_STD_FEE, + DEFAULT_BLOCK_TIMEOUT_HEIGHT, +} from '@injectivelabs/utils' import { ChainId } from '@injectivelabs/ts-types' import { Network, getNetworkEndpoints } from '@injectivelabs/networks' const injectiveAddress = 'inj1' const chainId = 'injective-1' /* ChainId.Mainnet */ -const restEndpoint = 'https://lcd.injective.network' /* getNetworkEndpoints(Network.Mainnet).rest */ +const restEndpoint = + 'https://lcd.injective.network' /* getNetworkEndpoints(Network.Mainnet).rest */ const amount = { amount: new BigNumberInBase(0.01).toWei().toFixed(), - denom: "inj", -}; + denom: 'inj', +} /** Account Details **/ -const chainRestAuthApi = new ChainRestAuthApi( - restEndpoint, -) +const chainRestAuthApi = new ChainRestAuthApi(restEndpoint) const accountDetailsResponse = await chainRestAuthApi.fetchAccount( injectiveAddress, ) @@ -171,9 +178,7 @@ const baseAccount = BaseAccount.fromRestApi(accountDetailsResponse) const accountDetails = baseAccount.toAccountDetails() /** Block Details */ -const chainRestTendermintApi = new ChainRestTendermintApi( - restEndpoint, -) +const chainRestTendermintApi = new ChainRestTendermintApi(restEndpoint) const latestBlock = await chainRestTendermintApi.fetchLatestBlock() const latestHeight = latestBlock.header.height const timeoutHeight = new BigNumberInBase(latestHeight).plus( @@ -185,7 +190,7 @@ const msg = MsgSend.fromJSON({ amount, srcInjectiveAddress: injectiveAddress, dstInjectiveAddress: injectiveAddress, -}); +}) /** EIP712 for signing on Ethereum wallets */ const eip712TypedData = getEip712TypedData({ @@ -206,10 +211,7 @@ const signature = await window.ethereum.request({ }) /** Get Public Key of the signer */ -const publicKeyHex = recoverTypedSignaturePubKey( - eip712TypedData, - signature, -) +const publicKeyHex = recoverTypedSignaturePubKey(eip712TypedData, signature) const publicKeyBase64 = hexToBase64(publicKeyHex) const { txRaw } = createTransaction({ @@ -240,8 +242,4 @@ const response = await txRestClient.fetchTxPoll(txHash) ### Example with WalletStrategy (Prepare + Sign + Broadcast) -🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 - -This part is currently under work in progress. - -🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 +Example can be found [here](https://github.com/InjectiveLabs/injective-ts/blob/862e7c30d96120947b056abffbd01b4f378984a1/packages/wallet-ts/src/broadcaster/MsgBroadcaster.ts#L166-L248). diff --git a/.gitbook/transactions/private-key.md b/.gitbook/transactions/private-key.md index bca0508fa..888432219 100644 --- a/.gitbook/transactions/private-key.md +++ b/.gitbook/transactions/private-key.md @@ -225,8 +225,7 @@ You can use the `MsgBroadcasterWithPk` class from the `@injectivelabs/sdk-ts` pa ```ts import { MsgSend, MsgBroadcasterWithPk } from '@injectivelabs/sdk-ts' import { BigNumberInBase } from '@injectivelabs/utils' -import { ChainId } from '@injectivelabs/ts-types' -import { Network, getNetworkEndpoints } from '@injectivelabs/networks' +import { Network } from '@injectivelabs/networks' const privateKey = '0x...' const injectiveAddress = 'inj1...' @@ -242,11 +241,9 @@ const msg = MsgSend.fromJSON({ const txHash = await new MsgBroadcasterWithPk({ privateKey, - chainId: ChainId.Testnet, - endpoints: getNetworkEndpoints(Network.Testnet), + network: Network.Testnet }).broadcast({ - msgs: msg, - injectiveAddress, + msgs: msg }) console.log(txHash) diff --git a/.gitbook/transactions/transactions-cosmos.md b/.gitbook/transactions/transactions-cosmos.md index 3846e6124..f5e96c69c 100644 --- a/.gitbook/transactions/transactions-cosmos.md +++ b/.gitbook/transactions/transactions-cosmos.md @@ -10,31 +10,35 @@ At this point you **can't** use some online abstractions that provide a quick wa To resolve this, we have provided functions which can prepare the `txRaw` transaction within out `@injectivelabs/sdk-ts` package. `txRaw` is the transaction interface used in Cosmos that contains details about the transaction and the signer itself. +Getting a private key from cosmos wallets is usually done by taking the current key for the chainId and accessing the pubKey from there (ex: `const key = await window.keplr.getKey(chainId)` => `const pubKey = key.publicKey`). + ```ts -import { +import { MsgSend, - ChainRestAuthApi, - ChainRestTendermintApi, BaseAccount, DEFAULT_STD_FEE, + ChainRestAuthApi, createTransaction, + ChainRestTendermintApi, } from '@injectivelabs/sdk-ts' -import { DEFAULT_STD_FEE, DEFAULT_BLOCK_TIMEOUT_HEIGHT } from '@injectivelabs/utils' +import { + DEFAULT_STD_FEE, + DEFAULT_BLOCK_TIMEOUT_HEIGHT, +} from '@injectivelabs/utils' import { ChainId } from '@injectivelabs/ts-types' import { Network, getNetworkEndpoints } from '@injectivelabs/networks' const injectiveAddress = 'inj1' const chainId = 'injective-1' /* ChainId.Mainnet */ -const restEndpoint = 'https://lcd.injective.network' /* getNetworkEndpoints(Network.Mainnet).rest */ +const restEndpoint = + 'https://lcd.injective.network' /* getNetworkEndpoints(Network.Mainnet).rest */ const amount = { amount: new BigNumberInBase(0.01).toWei().toFixed(), - denom: "inj", -}; + denom: 'inj', +} /** Account Details **/ -const chainRestAuthApi = new ChainRestAuthApi( - restEndpoint, -) +const chainRestAuthApi = new ChainRestAuthApi(restEndpoint) const accountDetailsResponse = await chainRestAuthApi.fetchAccount( injectiveAddress, ) @@ -42,9 +46,7 @@ const baseAccount = BaseAccount.fromRestApi(accountDetailsResponse) const accountDetails = baseAccount.toAccountDetails() /** Block Details */ -const chainRestTendermintApi = new ChainRestTendermintApi( - restEndpoint, -) +const chainRestTendermintApi = new ChainRestTendermintApi(restEndpoint) const latestBlock = await chainRestTendermintApi.fetchLatestBlock() const latestHeight = latestBlock.header.height const timeoutHeight = new BigNumberInBase(latestHeight).plus( @@ -56,7 +58,7 @@ const msg = MsgSend.fromJSON({ amount, srcInjectiveAddress: injectiveAddress, dstInjectiveAddress: injectiveAddress, -}); +}) /** Get the PubKey of the Signer from the Wallet/Private Key */ const pubKey = await getPubKey() @@ -82,7 +84,7 @@ import { ChainId } from '@injectivelabs/ts-types' const getKeplr = async (chainId) => { await window.keplr.enable(chainId); - + const offlineSigner = window.keplr.getOfflineSigner(chainId); const accounts = await offlineSigner.getAccounts(); const key = await window.keplr.getKey(chainId); @@ -106,22 +108,22 @@ Once we have the signature ready, we need to broadcast the transaction to the In ```ts import { ChainId } from '@injectivelabs/ts-types' -import { getTxRawFromTxRawOrDirectSignResponse, TxRestClient } from '@injectivelabs/sdk-ts' +import { CosmosTxV1Beta1Tx, getTxRawFromTxRawOrDirectSignResponse, TxRestClient } from '@injectivelabs/sdk-ts' import { Network, getNetworkEndpoints } from '@injectivelabs/networks' -/** - * IMPORTANT NOTE: - * If we use Keplr/Leap wallets - * after signing the transaction we get a `directSignResponse`, +/** + * IMPORTANT NOTE: + * If we use Keplr/Leap wallets + * after signing the transaction we get a `directSignResponse`, * and instead of adding the signature to the `txRaw` we create - * using the `createTransaction` function we need to append the - * signature from the `directSignResponse` to the transaction that - * got actually signed (i.e `directSignResponse.signed`) and + * using the `createTransaction` function we need to append the + * signature from the `directSignResponse` to the transaction that + * got actually signed (i.e `directSignResponse.signed`) and * the reason why is that the user can make some changes on the original - * transaction (i.e change gas limit or gas prices) and the transaction + * transaction (i.e change gas limit or gas prices) and the transaction * that get's signed and the one that gets broadcasted are not the same. */ -const directSignResponse = /* From the second step above */ +const directSignResponse = /* From the second step above */ const txRaw = getTxRawFromTxRawOrDirectSignResponse(directSignResponse) const broadcastTx = async (chainId, txRaw) => { @@ -134,7 +136,7 @@ const broadcastTx = async (chainId, txRaw) => { const keplr = await getKeplr(ChainId.Mainnet) const result = await keplr.sendTx( chainId, - txRaw.serializeBinary(), + CosmosTxV1Beta1Tx.TxRaw.encode(txRaw).finish(), BroadcastMode.Sync, ) @@ -150,10 +152,10 @@ const broadcastTx = async (chainId, txRaw) => { const txHash = await broadcastTx(ChainId.Mainnet, txRaw) -/** - * Once we get the txHash, because we use the Sync mode we - * are not sure that the transaction is included in the block, - * it can happen that it's still in the mempool so we need to query +/** + * Once we get the txHash, because we use the Sync mode we + * are not sure that the transaction is included in the block, + * it can happen that it's still in the mempool so we need to query * the chain to see when the transaction will be included */ const restEndpoint = 'https://lcd.injective.network' /* getNetworkEndpoints(Network.Mainnet).rest */ @@ -168,24 +170,28 @@ const response = await txRestClient.fetchTxPoll(txHash) Let's have a look at the whole flow (using Keplr as a signing wallet) ```ts -import { +import { MsgSend, - ChainRestAuthApi, - ChainRestTendermintApi, BaseAccount, DEFAULT_STD_FEE, + ChainRestAuthApi, createTransaction, + CosmosTxV1Beta1Tx, + ChainRestTendermintApi, } from '@injectivelabs/sdk-ts' -import { DEFAULT_STD_FEE, DEFAULT_BLOCK_TIMEOUT_HEIGHT } from '@injectivelabs/utils' +import { + DEFAULT_STD_FEE, + DEFAULT_BLOCK_TIMEOUT_HEIGHT, +} from '@injectivelabs/utils' import { ChainId } from '@injectivelabs/ts-types' import { Network, getNetworkEndpoints } from '@injectivelabs/networks' const getKeplr = async (chainId) => { - await window.keplr.enable(chainId); - - const offlineSigner = window.keplr.getOfflineSigner(chainId); - const accounts = await offlineSigner.getAccounts(); - const key = await window.keplr.getKey(chainId); + await window.keplr.enable(chainId) + + const offlineSigner = window.keplr.getOfflineSigner(chainId) + const accounts = await offlineSigner.getAccounts() + const key = await window.keplr.getKey(chainId) return { offlineSigner, accounts, key } } @@ -194,7 +200,7 @@ const broadcastTx = async (chainId, txRaw) => { const keplr = await getKeplr(ChainId.Mainnet) const result = await keplr.sendTx( chainId, - txRaw.serializeBinary(), + CosmosTxV1Beta1Tx.TxRaw.encode(txRaw).finish(), BroadcastMode.Sync, ) @@ -210,16 +216,15 @@ const broadcastTx = async (chainId, txRaw) => { const injectiveAddress = 'inj1' const chainId = 'injective-1' /* ChainId.Mainnet */ -const restEndpoint = 'https://lcd.injective.network' /* getNetworkEndpoints(Network.Mainnet).rest */ +const restEndpoint = + 'https://lcd.injective.network' /* getNetworkEndpoints(Network.Mainnet).rest */ const amount = { amount: new BigNumberInBase(0.01).toWei().toFixed(), - denom: "inj", -}; + denom: 'inj', +} /** Account Details **/ -const chainRestAuthApi = new ChainRestAuthApi( - restEndpoint, -) +const chainRestAuthApi = new ChainRestAuthApi(restEndpoint) const accountDetailsResponse = await chainRestAuthApi.fetchAccount( injectiveAddress, ) @@ -227,9 +232,7 @@ const baseAccount = BaseAccount.fromRestApi(accountDetailsResponse) const accountDetails = baseAccount.toAccountDetails() /** Block Details */ -const chainRestTendermintApi = new ChainRestTendermintApi( - restEndpoint, -) +const chainRestTendermintApi = new ChainRestTendermintApi(restEndpoint) const latestBlock = await chainRestTendermintApi.fetchLatestBlock() const latestHeight = latestBlock.header.height const timeoutHeight = new BigNumberInBase(latestHeight).plus( @@ -241,7 +244,7 @@ const msg = MsgSend.fromJSON({ amount, srcInjectiveAddress: injectiveAddress, dstInjectiveAddress: injectiveAddress, -}); +}) /** Get the PubKey of the Signer from the Wallet/Private Key */ const pubKey = await getPubKey() @@ -257,7 +260,10 @@ const { txRaw, signDoc } = createTransaction({ accountNumber: baseAccount.accountNumber, }) -const directSignResponse = await offlineSigner.signDirect(injectiveAddress, signDoc) +const directSignResponse = await offlineSigner.signDirect( + injectiveAddress, + signDoc, +) const txRaw = getTxRawFromTxRawOrDirectSignResponse(directSignResponse) const txHash = await broadcastTx(ChainId.Mainnet, txRaw) const response = await new TxRestClient(restEndpoint).fetchTxPoll(txHash) @@ -265,8 +271,4 @@ const response = await new TxRestClient(restEndpoint).fetchTxPoll(txHash) ### Example with WalletStrategy (Prepare + Sign + Broadcast) -🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 - -This part is currently under work in progress. - -🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 +Example can be found [here](https://github.com/InjectiveLabs/injective-ts/blob/862e7c30d96120947b056abffbd01b4f378984a1/packages/wallet-ts/src/broadcaster/MsgBroadcaster.ts#L301-L365). diff --git a/.gitbook/wallet/wallet-connections.md b/.gitbook/wallet/wallet-connections.md index 4a802f182..0a76bf647 100644 --- a/.gitbook/wallet/wallet-connections.md +++ b/.gitbook/wallet/wallet-connections.md @@ -1,7 +1,73 @@ # Wallet Connections -🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 +Injective supports both Ethereum and Cosmos native wallets. You can use popular wallets like Metamask, Ledger, Keplr, Leap, etc. to sign transactions on Injective. -This wiki page is currently under work in progress. +### Wallet Strategy -🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 +The recommended way to have support for all of these wallets out of the box is to use the [WalletStrategy](wallet-wallet-strategy.md) abstraction we've built. This approach will enable your dApp users to connect and interact with different wallets. + +Combining it with the [MsgBroadcaster](../transactions/msgbroadcaster.md) abstraction allows you to sign transactions using one function call. This is what's being used on all products like Helix, Hub, Explorer, etc., and we strongly recommend using this approach in your dApp. + +In case you still want to use some wallet natively (without the WalletStrategy class), we are going to provide examples of how to connect to a dApp built on Injective via Metamask and Keplr in this doc. + +### Metamask + +Metamask is an Ethereum native wallet and can be used to connect and interact with your dApp built on Injective. + +* **Get Injective addresses from Metamask** + +

+import { getInjectiveAddress } from '@injectivelabs/sdk-ts'
+
+const getEthereum = () => {
+  if (!window.ethereum) {
+    throw new Error('Metamask extension not installed')
+  }
+  
+  return window.ethereum
+}
+
+const ethereum = getEthereum()
+const addresses = await ethereum.request({
+  method: 'eth_requestAccounts',
+}) /** these are evm addresses */
+
+const injectiveAddresses = addresses.map(getInjectiveAddress)
+console.log(injectiveAddresses)
+
+ +* **Sign transactions using Metamask** + +An example of how to prepare + sign + broadcast a transaction on Injective using Metamask can be found [here](../transactions/ethereum.md). + +### Keplr + +Keplr is an Cosmos native wallet and can be used to connect and interact with your dApp built on Injective. + +* **Get Injective addresses from Keplr** + +

+import { getInjectiveAddress } from '@injectivelabs/sdk-ts'
+import { ChainId } from '@injectivelabs/ts-types'
+
+const getKeplr = () => {
+  if (!window.keplr) {
+    throw new Error('Keplr extension not installed')
+  }
+  
+  return window.keplr
+}
+
+(async() => {
+  const keplr = getKeplr()
+  const chainId = ChainId.Mainnet
+  await keplr.enable(chainId)
+  const injectiveAddresses = await keplr.getOfflineSigner(chainId).getAccounts()
+
+  console.log(injectiveAddresses)
+})()
+
+ +* **Sign transactions using Keplr** + +An example of how to prepare + sign + broadcast a transaction on Injective using Keplr can be found [here](../transactions/transactions-cosmos.md). diff --git a/.github/workflows/canary.yml b/.github/workflows/canary.yml index 2bcdbc957..25d3fa81b 100644 --- a/.github/workflows/canary.yml +++ b/.github/workflows/canary.yml @@ -24,6 +24,11 @@ jobs: - name: 'Setup lerna@6.6.1' run: yarn global add lerna@6.6.1 --ignore-engines + - name: Set up Git user + run: | + git config user.name "${{ github.actor }}" + git config user.email "${{ github.actor }}@users.noreply.github.com" + - name: Build dependencies run: | node etc/bootstrapEnv @@ -35,14 +40,15 @@ jobs: env: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + - name: 'Commit ibcTokenMetadata.json if changed' + run: | + git diff --exit-code -- packages/sdk-ui-ts/src/services/ibc/ibcTokenMetadata.json || (git add packages/sdk-ui-ts/src/services/ibc/ibcTokenMetadata.json && git commit -m "Automatically update ibcTokenMetadata.json") + - name: Version and publish env: GH_TOKEN: ${{ secrets.GH_TOKEN }} run: | - git config user.name "${{ github.actor }}" - git config user.email "${{ github.actor}}@users.noreply.github.com" - - lerna version --conventional-commits --conventional-prerelease --preid dev --force-git-tag --yes + lerna version prerelease --preid dev --force-git-tag --no-changelog --yes lerna publish from-git --force-git-tag --dist-tag dev --yes --summary-file - name: 'Broadcast published versions on Slack' diff --git a/.github/workflows/dev.yaml b/.github/workflows/dev.yaml index 68d466ae7..2e1a6d374 100644 --- a/.github/workflows/dev.yaml +++ b/.github/workflows/dev.yaml @@ -24,6 +24,11 @@ jobs: - name: 'Setup lerna@6.6.1' run: yarn global add lerna@6.6.1 --ignore-engines + - name: Set up Git user + run: | + git config user.name "${{ github.actor }}" + git config user.email "${{ github.actor }}@users.noreply.github.com" + - name: Build dependencies run: | node etc/bootstrapEnv @@ -35,14 +40,15 @@ jobs: env: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + - name: 'Commit ibcTokenMetadata.json if changed' + run: | + git diff --exit-code -- packages/sdk-ui-ts/src/services/ibc/ibcTokenMetadata.json || (git add packages/sdk-ui-ts/src/services/ibc/ibcTokenMetadata.json && git commit -m "Automatically update ibcTokenMetadata.json") + - name: Version and publish env: GH_TOKEN: ${{ secrets.GH_TOKEN }} run: | - git config user.name "${{ github.actor }}" - git config user.email "${{ github.actor}}@users.noreply.github.com" - - lerna version --conventional-commits --conventional-prerelease --preid beta --force-git-tag --yes + lerna version prerelease --preid beta --force-git-tag --no-changelog --yes lerna publish from-git --force-git-tag --dist-tag next --yes --summary-file - name: 'Broadcast published versions on Slack' diff --git a/.github/workflows/stable.yaml b/.github/workflows/stable.yaml index a5f44060f..ecb295400 100644 --- a/.github/workflows/stable.yaml +++ b/.github/workflows/stable.yaml @@ -25,6 +25,11 @@ jobs: - name: 'Setup lerna@6.6.1' run: yarn global add lerna@6.6.1 --ignore-engines + - name: Set up Git user + run: | + git config user.name "${{ github.actor }}" + git config user.email "${{ github.actor }}@users.noreply.github.com" + - name: Build dependencies run: | node etc/bootstrapEnv @@ -36,14 +41,15 @@ jobs: env: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + - name: 'Commit ibcTokenMetadata.json if changed' + run: | + git diff --exit-code -- packages/sdk-ui-ts/src/services/ibc/ibcTokenMetadata.json || (git add packages/sdk-ui-ts/src/services/ibc/ibcTokenMetadata.json && git commit -m "Automatically update ibcTokenMetadata.json") + - name: Version and publish env: GH_TOKEN: ${{ secrets.GH_TOKEN }} run: | - git config user.name "${{ github.actor }}" - git config user.email "${{ github.actor}}@users.noreply.github.com" - - lerna version --conventional-commits --conventional-graduate --force-git-tag --yes + lerna version patch --conventional-commits --conventional-graduate --force-git-tag --yes lerna publish from-git --force-git-tag --dist-tag latest --yes --summary-file - name: 'Broadcast published versions on Slack' diff --git a/packages/bridge-ts/CHANGELOG.md b/packages/bridge-ts/CHANGELOG.md index ddb08aaf2..20328089a 100644 --- a/packages/bridge-ts/CHANGELOG.md +++ b/packages/bridge-ts/CHANGELOG.md @@ -3,6 +3,46 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.14.1-beta.2](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/bridge-ts@1.14.1-beta.1...@injectivelabs/bridge-ts@1.14.1-beta.2) (2023-09-24) + +**Note:** Version bump only for package @injectivelabs/bridge-ts + +## [1.14.1-beta.1](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/bridge-ts@1.14.1-beta.0...@injectivelabs/bridge-ts@1.14.1-beta.1) (2023-09-24) + +**Note:** Version bump only for package @injectivelabs/bridge-ts + +## [1.14.1-beta.0](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/bridge-ts@1.14.0-beta.1...@injectivelabs/bridge-ts@1.14.1-beta.0) (2023-09-23) + +**Note:** Version bump only for package @injectivelabs/bridge-ts + +# [1.14.0](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/bridge-ts@1.14.0-beta.1...@injectivelabs/bridge-ts@1.14.0) (2023-09-22) + +**Note:** Version bump only for package @injectivelabs/bridge-ts + +# [1.14.0-beta.1](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/bridge-ts@1.13.1-beta.3...@injectivelabs/bridge-ts@1.14.0-beta.1) (2023-09-22) + +**Note:** Version bump only for package @injectivelabs/bridge-ts + +## [1.13.1-beta.3](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/bridge-ts@1.13.1-beta.2...@injectivelabs/bridge-ts@1.13.1-beta.3) (2023-09-22) + +**Note:** Version bump only for package @injectivelabs/bridge-ts + +## [1.13.1-beta.2](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/bridge-ts@1.13.1-beta.1...@injectivelabs/bridge-ts@1.13.1-beta.2) (2023-09-22) + +**Note:** Version bump only for package @injectivelabs/bridge-ts + +## [1.13.1-beta.1](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/bridge-ts@1.13.1-beta.0...@injectivelabs/bridge-ts@1.13.1-beta.1) (2023-09-22) + +**Note:** Version bump only for package @injectivelabs/bridge-ts + +## [1.13.1-beta.0](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/bridge-ts@1.13.0...@injectivelabs/bridge-ts@1.13.1-beta.0) (2023-09-22) + +**Note:** Version bump only for package @injectivelabs/bridge-ts + +# [1.13.0](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/bridge-ts@1.12.2-beta.19...@injectivelabs/bridge-ts@1.13.0) (2023-09-22) + +**Note:** Version bump only for package @injectivelabs/bridge-ts + ## [1.12.2-beta.19](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/bridge-ts@1.12.2-beta.18...@injectivelabs/bridge-ts@1.12.2-beta.19) (2023-09-22) **Note:** Version bump only for package @injectivelabs/bridge-ts diff --git a/packages/bridge-ts/package.json b/packages/bridge-ts/package.json index 3f77261b9..c557e81db 100644 --- a/packages/bridge-ts/package.json +++ b/packages/bridge-ts/package.json @@ -1,7 +1,7 @@ { "name": "@injectivelabs/bridge-ts", "description": "Bridge utilities and abstractions in TypeScript to be used in Injective products", - "version": "1.12.2-beta.19", + "version": "1.14.1-beta.24", "sideEffects": false, "author": { "name": "Bojan Angjelkoski", @@ -32,11 +32,11 @@ }, "dependencies": { "@axelar-network/axelarjs-sdk": "^0.11.7", - "@injectivelabs/exceptions": "^1.12.2-beta.1", - "@injectivelabs/networks": "^1.12.2-beta.4", - "@injectivelabs/sdk-ts": "^1.13.0-beta.3", - "@injectivelabs/ts-types": "^1.12.2-beta.1", - "@injectivelabs/utils": "^1.12.2-beta.2", + "@injectivelabs/exceptions": "^1.14.1-beta.7", + "@injectivelabs/networks": "^1.14.1-beta.8", + "@injectivelabs/sdk-ts": "^1.14.1-beta.24", + "@injectivelabs/ts-types": "^1.14.1-beta.7", + "@injectivelabs/utils": "^1.14.1-beta.6", "@injectivelabs/wormhole-sdk": "^1.12.0-beta.0", "@solana/spl-token": "^0.3.6", "@solana/wallet-adapter-base": "^0.9.18", diff --git a/packages/contracts/CHANGELOG.md b/packages/contracts/CHANGELOG.md index 64fa37048..82098e4f3 100644 --- a/packages/contracts/CHANGELOG.md +++ b/packages/contracts/CHANGELOG.md @@ -3,6 +3,26 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.14.1-beta.0](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/contracts@1.14.0-beta.1...@injectivelabs/contracts@1.14.1-beta.0) (2023-09-23) + +**Note:** Version bump only for package @injectivelabs/contracts + +# [1.14.0](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/contracts@1.14.0-beta.1...@injectivelabs/contracts@1.14.0) (2023-09-22) + +**Note:** Version bump only for package @injectivelabs/contracts + +# [1.14.0-beta.1](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/contracts@1.13.1-beta.1...@injectivelabs/contracts@1.14.0-beta.1) (2023-09-22) + +**Note:** Version bump only for package @injectivelabs/contracts + +## [1.13.1-beta.1](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/contracts@1.13.0...@injectivelabs/contracts@1.13.1-beta.1) (2023-09-22) + +**Note:** Version bump only for package @injectivelabs/contracts + +# [1.13.0](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/contracts@1.12.2-beta.4...@injectivelabs/contracts@1.13.0) (2023-09-22) + +**Note:** Version bump only for package @injectivelabs/contracts + ## [1.12.2-beta.4](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/contracts@1.12.2-beta.3...@injectivelabs/contracts@1.12.2-beta.4) (2023-09-12) **Note:** Version bump only for package @injectivelabs/contracts diff --git a/packages/contracts/package.json b/packages/contracts/package.json index df6ccbf34..cbace7abb 100644 --- a/packages/contracts/package.json +++ b/packages/contracts/package.json @@ -1,7 +1,7 @@ { "name": "@injectivelabs/contracts", "description": "Contracts wrapper that can be reused throughout Injective's projects.", - "version": "1.12.2-beta.4", + "version": "1.14.1-beta.8", "sideEffects": false, "license": "Apache-2.0", "main": "dist/cjs/index.js", @@ -31,10 +31,10 @@ "start": "node dist/index.js" }, "dependencies": { - "@injectivelabs/exceptions": "^1.12.2-beta.1", - "@injectivelabs/networks": "^1.12.2-beta.4", - "@injectivelabs/ts-types": "^1.12.2-beta.1", - "@injectivelabs/utils": "^1.12.2-beta.2", + "@injectivelabs/exceptions": "^1.14.1-beta.7", + "@injectivelabs/networks": "^1.14.1-beta.8", + "@injectivelabs/ts-types": "^1.14.1-beta.7", + "@injectivelabs/utils": "^1.14.1-beta.6", "ethers": "^5.7.2", "link-module-alias": "^1.2.0", "shx": "^0.3.3" diff --git a/packages/contracts/src/addresses.ts b/packages/contracts/src/addresses.ts index eca6d5c6d..1f377ff3b 100644 --- a/packages/contracts/src/addresses.ts +++ b/packages/contracts/src/addresses.ts @@ -56,6 +56,10 @@ export const contractAddressesByNetwork: ContractAddressesForNetwork = { peggy: '0xF955C57f9EA9Dc8781965FEaE0b6A2acE2BAD6f3', injective: '0xe28b3B32B6c345A34Ff64674606124Dd5Aceca30', }, + [Network.MainnetSentry]: { + peggy: '0xF955C57f9EA9Dc8781965FEaE0b6A2acE2BAD6f3', + injective: '0xe28b3B32B6c345A34Ff64674606124Dd5Aceca30', + }, [Network.Public]: { peggy: '0xF955C57f9EA9Dc8781965FEaE0b6A2acE2BAD6f3', injective: '0xe28b3B32B6c345A34Ff64674606124Dd5Aceca30', diff --git a/packages/exceptions/CHANGELOG.md b/packages/exceptions/CHANGELOG.md index e24efec33..b64757f03 100644 --- a/packages/exceptions/CHANGELOG.md +++ b/packages/exceptions/CHANGELOG.md @@ -3,6 +3,26 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.14.1-beta.0](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/exceptions@1.14.0-beta.1...@injectivelabs/exceptions@1.14.1-beta.0) (2023-09-23) + +**Note:** Version bump only for package @injectivelabs/exceptions + +# [1.14.0](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/exceptions@1.14.0-beta.1...@injectivelabs/exceptions@1.14.0) (2023-09-22) + +**Note:** Version bump only for package @injectivelabs/exceptions + +# [1.14.0-beta.1](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/exceptions@1.13.1-beta.1...@injectivelabs/exceptions@1.14.0-beta.1) (2023-09-22) + +**Note:** Version bump only for package @injectivelabs/exceptions + +## [1.13.1-beta.1](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/exceptions@1.13.0...@injectivelabs/exceptions@1.13.1-beta.1) (2023-09-22) + +**Note:** Version bump only for package @injectivelabs/exceptions + +# [1.13.0](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/exceptions@1.12.2-beta.1...@injectivelabs/exceptions@1.13.0) (2023-09-22) + +**Note:** Version bump only for package @injectivelabs/exceptions + ## [1.12.2-beta.1](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/exceptions@1.12.2-beta.0...@injectivelabs/exceptions@1.12.2-beta.1) (2023-09-12) **Note:** Version bump only for package @injectivelabs/exceptions diff --git a/packages/exceptions/package.json b/packages/exceptions/package.json index 65f1976d1..4d56f22b6 100644 --- a/packages/exceptions/package.json +++ b/packages/exceptions/package.json @@ -1,7 +1,7 @@ { "name": "@injectivelabs/exceptions", "description": "List of exceptions that can be reused throughout Injective's projects.", - "version": "1.12.2-beta.1", + "version": "1.14.1-beta.7", "sideEffects": false, "license": "Apache-2.0", "main": "dist/cjs/index.js", @@ -32,7 +32,7 @@ }, "dependencies": { "@injectivelabs/grpc-web": "^0.0.1", - "@injectivelabs/ts-types": "^1.12.2-beta.1", + "@injectivelabs/ts-types": "^1.14.1-beta.7", "http-status-codes": "^2.2.0", "link-module-alias": "^1.2.0", "shx": "^0.3.2" diff --git a/packages/networks/CHANGELOG.md b/packages/networks/CHANGELOG.md index bac6a407c..3b9996430 100644 --- a/packages/networks/CHANGELOG.md +++ b/packages/networks/CHANGELOG.md @@ -3,6 +3,26 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.14.1-beta.0](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/networks@1.14.0-beta.1...@injectivelabs/networks@1.14.1-beta.0) (2023-09-23) + +**Note:** Version bump only for package @injectivelabs/networks + +# [1.14.0](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/networks@1.14.0-beta.1...@injectivelabs/networks@1.14.0) (2023-09-22) + +**Note:** Version bump only for package @injectivelabs/networks + +# [1.14.0-beta.1](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/networks@1.13.1-beta.1...@injectivelabs/networks@1.14.0-beta.1) (2023-09-22) + +**Note:** Version bump only for package @injectivelabs/networks + +## [1.13.1-beta.1](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/networks@1.13.0...@injectivelabs/networks@1.13.1-beta.1) (2023-09-22) + +**Note:** Version bump only for package @injectivelabs/networks + +# [1.13.0](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/networks@1.12.2-beta.4...@injectivelabs/networks@1.13.0) (2023-09-22) + +**Note:** Version bump only for package @injectivelabs/networks + ## [1.12.2-beta.4](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/networks@1.12.2-beta.3...@injectivelabs/networks@1.12.2-beta.4) (2023-09-12) **Note:** Version bump only for package @injectivelabs/networks diff --git a/packages/networks/package.json b/packages/networks/package.json index b2615c47d..69ff16673 100644 --- a/packages/networks/package.json +++ b/packages/networks/package.json @@ -1,7 +1,7 @@ { "name": "@injectivelabs/networks", "description": "Endpoints, networks, etc. Can be reused throughout Injective's projects.", - "version": "1.12.2-beta.4", + "version": "1.14.1-beta.8", "sideEffects": false, "license": "Apache-2.0", "author": { @@ -31,9 +31,9 @@ "start": "node dist/index.js" }, "dependencies": { - "@injectivelabs/exceptions": "^1.12.2-beta.1", - "@injectivelabs/ts-types": "^1.12.2-beta.1", - "@injectivelabs/utils": "^1.12.2-beta.2", + "@injectivelabs/exceptions": "^1.14.1-beta.7", + "@injectivelabs/ts-types": "^1.14.1-beta.7", + "@injectivelabs/utils": "^1.14.1-beta.6", "link-module-alias": "^1.2.0", "shx": "^0.3.2" }, diff --git a/packages/networks/src/endpoints.ts b/packages/networks/src/endpoints.ts index 0af16f58d..6f44fe60d 100644 --- a/packages/networks/src/endpoints.ts +++ b/packages/networks/src/endpoints.ts @@ -1,5 +1,15 @@ import { NetworkEndpoints } from './types' +export const endpointsMainnetSentry: NetworkEndpoints = { + indexer: 'https://sentry.exchange.grpc-web.injective.network/', + grpc: 'https://sentry.chain.grpc-web.injective.network/', + rpc: 'https://sentry.tm.injective.network/', + rest: 'https://sentry.lcd.injective.network/', + chronos: 'https://sentry.exchange.grpc-web.injective.network/', + explorer: 'https://sentry.exchange.grpc-web.injective.network/', + cache: 'https://sentry.exchange.grpc-web.injective.network/' +} + export const endpointsMainnetK8s: NetworkEndpoints = { indexer: 'https://k8s.mainnet.exchange.grpc-web.injective.network', grpc: 'https://k8s.mainnet.chain.grpc-web.injective.network', diff --git a/packages/networks/src/network.ts b/packages/networks/src/network.ts index 6a4f49904..7d4a3fc34 100644 --- a/packages/networks/src/network.ts +++ b/packages/networks/src/network.ts @@ -18,6 +18,7 @@ import { endpointsTestnetK8s, endpointsTestnetOld, endpointsMainnetK8s, + endpointsMainnetSentry, endpointsTestnetSentry, } from './endpoints' import { Network, ChainInfo, NetworkEndpoints } from './types' @@ -25,6 +26,7 @@ import { Network, ChainInfo, NetworkEndpoints } from './types' export const networkEndpoints: Record = { [Network.MainnetLB]: endpointsMainnetLB, [Network.MainnetK8s]: endpointsMainnetK8s, + [Network.MainnetSentry]: endpointsMainnetSentry, [Network.Staging]: endpointsStaging, [Network.Mainnet]: endpointsMainnet, [Network.Public]: endpointsPublic, @@ -42,6 +44,7 @@ export const networkEndpoints: Record = { export const chainInfos: Record = { [Network.MainnetLB]: mainnetChainInfo, [Network.MainnetK8s]: mainnetChainInfo, + [Network.MainnetSentry]: mainnetChainInfo, [Network.Staging]: mainnetChainInfo, [Network.Mainnet]: mainnetChainInfo, [Network.Public]: mainnetChainInfo, @@ -83,6 +86,7 @@ export const isMainnet = (network: Network) => Network.Staging, Network.Mainnet, Network.MainnetK8s, + Network.MainnetSentry, Network.Internal, Network.MainnetLB, ].includes(network) diff --git a/packages/networks/src/types.ts b/packages/networks/src/types.ts index c9fc6f93d..d5af6719b 100644 --- a/packages/networks/src/types.ts +++ b/packages/networks/src/types.ts @@ -4,6 +4,7 @@ export enum Network { MainnetK8s = 'mainnetK8s', MainnetLB = 'mainnetLB', Mainnet = 'mainnet', + MainnetSentry = 'mainnetSentry', Staging = 'staging', Public = 'public', Internal = 'internal', // @deprecated diff --git a/packages/sdk-ts/CHANGELOG.md b/packages/sdk-ts/CHANGELOG.md index e41393492..69ca52006 100644 --- a/packages/sdk-ts/CHANGELOG.md +++ b/packages/sdk-ts/CHANGELOG.md @@ -3,6 +3,50 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.14.1-beta.2](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/sdk-ts@1.14.1-beta.1...@injectivelabs/sdk-ts@1.14.1-beta.2) (2023-09-24) + +**Note:** Version bump only for package @injectivelabs/sdk-ts + +## [1.14.1-beta.1](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/sdk-ts@1.14.1-beta.0...@injectivelabs/sdk-ts@1.14.1-beta.1) (2023-09-24) + +**Note:** Version bump only for package @injectivelabs/sdk-ts + +## [1.14.1-beta.0](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/sdk-ts@1.14.0-beta.1...@injectivelabs/sdk-ts@1.14.1-beta.0) (2023-09-23) + +**Note:** Version bump only for package @injectivelabs/sdk-ts + +# [1.14.0](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/sdk-ts@1.14.0-beta.1...@injectivelabs/sdk-ts@1.14.0) (2023-09-22) + +**Note:** Version bump only for package @injectivelabs/sdk-ts + +# [1.14.0-beta.1](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/sdk-ts@1.14.0-beta.0...@injectivelabs/sdk-ts@1.14.0-beta.1) (2023-09-22) + +**Note:** Version bump only for package @injectivelabs/sdk-ts + +# [1.14.0-beta.0](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/sdk-ts@1.13.1-beta.2...@injectivelabs/sdk-ts@1.14.0-beta.0) (2023-09-22) + +### Features + +- cw20 addr validation ([c4332e0](https://github.com/InjectiveLabs/injective-ts/commit/c4332e05cc63f0f5b3bc36797970571cf0347643)) + +## [1.13.1-beta.2](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/sdk-ts@1.13.1-beta.1...@injectivelabs/sdk-ts@1.13.1-beta.2) (2023-09-22) + +**Note:** Version bump only for package @injectivelabs/sdk-ts + +## [1.13.1-beta.1](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/sdk-ts@1.13.1-beta.0...@injectivelabs/sdk-ts@1.13.1-beta.1) (2023-09-22) + +**Note:** Version bump only for package @injectivelabs/sdk-ts + +## [1.13.1-beta.0](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/sdk-ts@1.13.0...@injectivelabs/sdk-ts@1.13.1-beta.0) (2023-09-22) + +### Bug Fixes + +- bind ([f18ae29](https://github.com/InjectiveLabs/injective-ts/commit/f18ae29b91cd23f63171760d59fa5eadf440f895)) + +# [1.13.0](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/sdk-ts@1.13.0-beta.3...@injectivelabs/sdk-ts@1.13.0) (2023-09-22) + +**Note:** Version bump only for package @injectivelabs/sdk-ts + # [1.13.0-beta.3](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/sdk-ts@1.13.0-beta.2...@injectivelabs/sdk-ts@1.13.0-beta.3) (2023-09-22) ### Features diff --git a/packages/sdk-ts/package.json b/packages/sdk-ts/package.json index 8520b633b..2055eda61 100644 --- a/packages/sdk-ts/package.json +++ b/packages/sdk-ts/package.json @@ -1,7 +1,7 @@ { "name": "@injectivelabs/sdk-ts", "description": "SDK in TypeScript for building Injective applications in a browser, node, and react native environment.", - "version": "1.13.0-beta.3", + "version": "1.14.1-beta.24", "sideEffects": false, "license": "Apache-2.0", "author": { @@ -40,17 +40,17 @@ "@ethersproject/bytes": "^5.7.0", "@injectivelabs/core-proto-ts": "^0.0.18", "@injectivelabs/dmm-proto-ts": "1.0.16", - "@injectivelabs/exceptions": "^1.12.2-beta.1", + "@injectivelabs/exceptions": "^1.14.1-beta.7", "@injectivelabs/grpc-web": "^0.0.1", "@injectivelabs/grpc-web-node-http-transport": "^0.0.2", "@injectivelabs/grpc-web-react-native-transport": "^0.0.2", - "@injectivelabs/indexer-proto-ts": "1.11.9", - "@injectivelabs/mito-proto-ts": "1.0.46", - "@injectivelabs/networks": "^1.12.2-beta.4", - "@injectivelabs/test-utils": "^1.12.1", - "@injectivelabs/token-metadata": "^1.12.2-beta.13", - "@injectivelabs/ts-types": "^1.12.2-beta.1", - "@injectivelabs/utils": "^1.12.2-beta.2", + "@injectivelabs/indexer-proto-ts": "1.11.10", + "@injectivelabs/mito-proto-ts": "1.0.50", + "@injectivelabs/networks": "^1.14.1-beta.8", + "@injectivelabs/test-utils": "^1.14.1-beta.5", + "@injectivelabs/token-metadata": "^1.14.1-beta.15", + "@injectivelabs/ts-types": "^1.14.1-beta.7", + "@injectivelabs/utils": "^1.14.1-beta.6", "@metamask/eth-sig-util": "^4.0.0", "axios": "^0.27.2", "bech32": "^2.0.0", diff --git a/packages/sdk-ts/src/client/chain/grpc/ChainGrpcAuctionApi.spec.ts b/packages/sdk-ts/src/client/chain/grpc/ChainGrpcAuctionApi.spec.ts index 7258292b0..1c70d10cb 100644 --- a/packages/sdk-ts/src/client/chain/grpc/ChainGrpcAuctionApi.spec.ts +++ b/packages/sdk-ts/src/client/chain/grpc/ChainGrpcAuctionApi.spec.ts @@ -2,7 +2,7 @@ import { getNetworkEndpoints, Network } from '@injectivelabs/networks' import { ChainGrpcAuctionTransformer } from '../transformers' import { ChainGrpcAuctionApi } from './ChainGrpcAuctionApi' -const endpoints = getNetworkEndpoints(Network.MainnetK8s) +const endpoints = getNetworkEndpoints(Network.MainnetSentry) const chainGrpcAuctionApi = new ChainGrpcAuctionApi(endpoints.grpc) describe('ChainGrpcAuctionApi', () => { diff --git a/packages/sdk-ts/src/client/chain/grpc/ChainGrpcAuthApi.spec.ts b/packages/sdk-ts/src/client/chain/grpc/ChainGrpcAuthApi.spec.ts index c02ef24a0..fa220b9d3 100644 --- a/packages/sdk-ts/src/client/chain/grpc/ChainGrpcAuthApi.spec.ts +++ b/packages/sdk-ts/src/client/chain/grpc/ChainGrpcAuthApi.spec.ts @@ -4,7 +4,7 @@ import { mockFactory } from '@injectivelabs/test-utils' import { ChainGrpcAuthTransformer } from '../transformers/ChainGrpcAuthTransformer' const injectiveAddress = mockFactory.injectiveAddress -const endpoints = getNetworkEndpoints(Network.MainnetK8s) +const endpoints = getNetworkEndpoints(Network.MainnetSentry) const chainGrpcAuthApi = new ChainGrpcAuthApi(endpoints.grpc) describe('ChainGrpcAuthApi', () => { diff --git a/packages/sdk-ts/src/client/chain/grpc/ChainGrpcBankApi.spec.ts b/packages/sdk-ts/src/client/chain/grpc/ChainGrpcBankApi.spec.ts index 559043738..c0c0ded60 100644 --- a/packages/sdk-ts/src/client/chain/grpc/ChainGrpcBankApi.spec.ts +++ b/packages/sdk-ts/src/client/chain/grpc/ChainGrpcBankApi.spec.ts @@ -5,7 +5,7 @@ import { ChainGrpcBankTransformer } from '../transformers' import { CosmosBaseV1Beta1Coin } from '@injectivelabs/core-proto-ts' const injectiveAddress = mockFactory.injectiveAddress -const endpoints = getNetworkEndpoints(Network.MainnetK8s) +const endpoints = getNetworkEndpoints(Network.MainnetSentry) const chainGrpcBankApi = new ChainGrpcBankApi(endpoints.grpc) describe('ChainGrpcBankApi', () => { diff --git a/packages/sdk-ts/src/client/chain/grpc/ChainGrpcBankApi.ts b/packages/sdk-ts/src/client/chain/grpc/ChainGrpcBankApi.ts index 5a00c44cd..4f7460e60 100644 --- a/packages/sdk-ts/src/client/chain/grpc/ChainGrpcBankApi.ts +++ b/packages/sdk-ts/src/client/chain/grpc/ChainGrpcBankApi.ts @@ -160,7 +160,7 @@ export class ChainGrpcBankApi extends BaseGrpcConsumer { async fetchAllTotalSupply( pagination: PaginationOption = { limit: MAX_LIMIT_FOR_SUPPLY }, ) { - return fetchAllWithPagination(pagination, this.fetchTotalSupply) + return fetchAllWithPagination(pagination, this.fetchTotalSupply.bind(this)) } async fetchSupplyOf(denom: string) { diff --git a/packages/sdk-ts/src/client/chain/grpc/ChainGrpcDistributionApi.spec.ts b/packages/sdk-ts/src/client/chain/grpc/ChainGrpcDistributionApi.spec.ts index f66a527e6..4aa35b967 100644 --- a/packages/sdk-ts/src/client/chain/grpc/ChainGrpcDistributionApi.spec.ts +++ b/packages/sdk-ts/src/client/chain/grpc/ChainGrpcDistributionApi.spec.ts @@ -4,7 +4,7 @@ import { ChainGrpcStakingApi } from './ChainGrpcStakingApi' import { ChainGrpcDistributionTransformer } from '../transformers' import { Delegation, Validator } from '../types' -const endpoints = getNetworkEndpoints(Network.MainnetK8s) +const endpoints = getNetworkEndpoints(Network.MainnetSentry) const chainGrpcDistributionApi = new ChainGrpcDistributionApi(endpoints.grpc) describe('ChainGrpcDistributionApi', () => { diff --git a/packages/sdk-ts/src/client/chain/grpc/ChainGrpcExchangeApi.spec.ts b/packages/sdk-ts/src/client/chain/grpc/ChainGrpcExchangeApi.spec.ts index bd696b1e2..f20971cfd 100644 --- a/packages/sdk-ts/src/client/chain/grpc/ChainGrpcExchangeApi.spec.ts +++ b/packages/sdk-ts/src/client/chain/grpc/ChainGrpcExchangeApi.spec.ts @@ -6,7 +6,7 @@ import { InjectiveExchangeV1Beta1Query } from '@injectivelabs/core-proto-ts' const injectiveAddress = mockFactory.injectiveAddress const subaccountId = mockFactory.subaccountId -const endpoints = getNetworkEndpoints(Network.MainnetK8s) +const endpoints = getNetworkEndpoints(Network.MainnetSentry) const chainGrpcExchangeApi = new ChainGrpcExchangeApi(endpoints.grpc) describe('ChainGrpcExchangeApi', () => { diff --git a/packages/sdk-ts/src/client/chain/grpc/ChainGrpcGovApi.spec.ts b/packages/sdk-ts/src/client/chain/grpc/ChainGrpcGovApi.spec.ts index 28a9256b1..1641506ee 100644 --- a/packages/sdk-ts/src/client/chain/grpc/ChainGrpcGovApi.spec.ts +++ b/packages/sdk-ts/src/client/chain/grpc/ChainGrpcGovApi.spec.ts @@ -4,7 +4,7 @@ import { ChainGrpcGovApi } from './ChainGrpcGovApi' import { ChainGrpcGovTransformer } from '../transformers' import { CosmosGovV1Gov } from '@injectivelabs/core-proto-ts' -const endpoints = getNetworkEndpoints(Network.MainnetK8s) +const endpoints = getNetworkEndpoints(Network.MainnetSentry) const chainGrpcGovApi = new ChainGrpcGovApi(endpoints.grpc) const proposalId = 1 diff --git a/packages/sdk-ts/src/client/chain/grpc/ChainGrpcIbcApi.spec.ts b/packages/sdk-ts/src/client/chain/grpc/ChainGrpcIbcApi.spec.ts index 1629d0e86..b618bb6dd 100644 --- a/packages/sdk-ts/src/client/chain/grpc/ChainGrpcIbcApi.spec.ts +++ b/packages/sdk-ts/src/client/chain/grpc/ChainGrpcIbcApi.spec.ts @@ -4,7 +4,7 @@ import { sha256 } from '../../../utils/crypto' import { fromUtf8 } from '../../../utils/utf8' import { IbcApplicationsTransferV1Transfer } from '@injectivelabs/core-proto-ts' -const endpoints = getNetworkEndpoints(Network.MainnetK8s) +const endpoints = getNetworkEndpoints(Network.MainnetSentry) const chainGrpcIbcApi = new ChainGrpcIbcApi(endpoints.grpc) describe('ChainGrpcIbcApi', () => { diff --git a/packages/sdk-ts/src/client/chain/grpc/ChainGrpcInsuranceFundApi.spec.ts b/packages/sdk-ts/src/client/chain/grpc/ChainGrpcInsuranceFundApi.spec.ts index e9c6b11fe..97d948f3e 100644 --- a/packages/sdk-ts/src/client/chain/grpc/ChainGrpcInsuranceFundApi.spec.ts +++ b/packages/sdk-ts/src/client/chain/grpc/ChainGrpcInsuranceFundApi.spec.ts @@ -4,7 +4,7 @@ import { ChainGrpcInsuranceFundTransformer } from '../transformers' import { mockFactory } from '@injectivelabs/test-utils' import { IndexerGrpcDerivativesApi } from '../../indexer' -const endpoints = getNetworkEndpoints(Network.MainnetK8s) +const endpoints = getNetworkEndpoints(Network.MainnetSentry) const chainGrpcIbcApi = new ChainGrpcInsuranceFundApi(endpoints.grpc) const injectiveAddress = mockFactory.injectiveAddress const derivativeMarketId = mockFactory.derivativeMarketId diff --git a/packages/sdk-ts/src/client/chain/grpc/ChainGrpcMintApi.spec.ts b/packages/sdk-ts/src/client/chain/grpc/ChainGrpcMintApi.spec.ts index 3ee3a6139..b886df16b 100644 --- a/packages/sdk-ts/src/client/chain/grpc/ChainGrpcMintApi.spec.ts +++ b/packages/sdk-ts/src/client/chain/grpc/ChainGrpcMintApi.spec.ts @@ -2,7 +2,7 @@ import { getNetworkEndpoints, Network } from '@injectivelabs/networks' import { ChainGrpcMintApi } from './ChainGrpcMintApi' import { ChainGrpcMintTransformer } from '../transformers' -const endpoints = getNetworkEndpoints(Network.MainnetK8s) +const endpoints = getNetworkEndpoints(Network.MainnetSentry) const chainGrpcMintApi = new ChainGrpcMintApi(endpoints.grpc) describe('ChainGrpcMintApi', () => { diff --git a/packages/sdk-ts/src/client/chain/grpc/ChainGrpcOracleApi.spec.ts b/packages/sdk-ts/src/client/chain/grpc/ChainGrpcOracleApi.spec.ts index 114d7cb6c..033922d7b 100644 --- a/packages/sdk-ts/src/client/chain/grpc/ChainGrpcOracleApi.spec.ts +++ b/packages/sdk-ts/src/client/chain/grpc/ChainGrpcOracleApi.spec.ts @@ -2,7 +2,7 @@ import { getNetworkEndpoints, Network } from '@injectivelabs/networks' import { ChainGrpcOracleApi } from './ChainGrpcOracleApi' import { OracleModuleParams } from '../types' -const endpoints = getNetworkEndpoints(Network.MainnetK8s) +const endpoints = getNetworkEndpoints(Network.MainnetSentry) const chainGrpcOracleApi = new ChainGrpcOracleApi(endpoints.grpc) describe('ChainGrpcOracleApi', () => { diff --git a/packages/sdk-ts/src/client/chain/grpc/ChainGrpcPeggyApi.spec.ts b/packages/sdk-ts/src/client/chain/grpc/ChainGrpcPeggyApi.spec.ts index 0f69defd9..86f914762 100644 --- a/packages/sdk-ts/src/client/chain/grpc/ChainGrpcPeggyApi.spec.ts +++ b/packages/sdk-ts/src/client/chain/grpc/ChainGrpcPeggyApi.spec.ts @@ -2,7 +2,7 @@ import { getNetworkEndpoints, Network } from '@injectivelabs/networks' import { ChainGrpcPeggyApi } from './ChainGrpcPeggyApi' import { ChainGrpcPeggyTransformer } from '../transformers' -const endpoints = getNetworkEndpoints(Network.MainnetK8s) +const endpoints = getNetworkEndpoints(Network.MainnetSentry) const chainGrpcPeggyApi = new ChainGrpcPeggyApi(endpoints.grpc) describe('ChainGrpcPeggyApi', () => { diff --git a/packages/sdk-ts/src/client/chain/grpc/ChainGrpcStakingApi.spec.ts b/packages/sdk-ts/src/client/chain/grpc/ChainGrpcStakingApi.spec.ts index 9c40aebe8..2c912d7e1 100644 --- a/packages/sdk-ts/src/client/chain/grpc/ChainGrpcStakingApi.spec.ts +++ b/packages/sdk-ts/src/client/chain/grpc/ChainGrpcStakingApi.spec.ts @@ -5,7 +5,7 @@ import { ChainGrpcStakingTransformer } from '../transformers' import { Delegation, Validator } from '../types' const injectiveAddress = mockFactory.injectiveAddress -const endpoints = getNetworkEndpoints(Network.MainnetK8s) +const endpoints = getNetworkEndpoints(Network.MainnetSentry) const chainGrpcStakingApi = new ChainGrpcStakingApi(endpoints.grpc) describe('ChainGrpcStakingApi', () => { diff --git a/packages/sdk-ts/src/client/chain/grpc/ChainGrpcTokenFactoryApi.spec.ts b/packages/sdk-ts/src/client/chain/grpc/ChainGrpcTokenFactoryApi.spec.ts index 8bb48a937..cb6e3f345 100644 --- a/packages/sdk-ts/src/client/chain/grpc/ChainGrpcTokenFactoryApi.spec.ts +++ b/packages/sdk-ts/src/client/chain/grpc/ChainGrpcTokenFactoryApi.spec.ts @@ -2,7 +2,7 @@ import { getNetworkEndpoints, Network } from '@injectivelabs/networks' import { ChainGrpcTokenFactoryApi } from './ChainGrpcTokenFactoryApi' import { ChainGrpcTokenFactoryTransformer } from '../transformers' -const endpoints = getNetworkEndpoints(Network.MainnetK8s) +const endpoints = getNetworkEndpoints(Network.MainnetSentry) const chainGrpcTokenFactoryApi = new ChainGrpcTokenFactoryApi(endpoints.grpc) describe('ChainTokenFactoryApi.spec', () => { diff --git a/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcAccountApi.spec.ts b/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcAccountApi.spec.ts index f89b82c62..1167894b2 100644 --- a/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcAccountApi.spec.ts +++ b/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcAccountApi.spec.ts @@ -7,7 +7,7 @@ import { IndexerGrpcAccountApi } from './IndexerGrpcAccountApi' const injectiveAddress = mockFactory.injectiveAddress const subaccountId = getDefaultSubaccountId(injectiveAddress) -const endpoints = getNetworkEndpoints(Network.MainnetK8s) +const endpoints = getNetworkEndpoints(Network.MainnetSentry) const indexerGrpcAccountApi = new IndexerGrpcAccountApi(endpoints.indexer) describe('IndexerGrpcAccountApi', () => { diff --git a/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcAuctionApi.spec.ts b/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcAuctionApi.spec.ts index acaea5eac..02fc6cb5d 100644 --- a/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcAuctionApi.spec.ts +++ b/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcAuctionApi.spec.ts @@ -2,7 +2,7 @@ import { getNetworkEndpoints, Network } from '@injectivelabs/networks' import { IndexerGrpcAuctionTransformer } from '../transformers' import { IndexerGrpcAuctionApi } from './IndexerGrpcAuctionApi' -const endpoints = getNetworkEndpoints(Network.MainnetK8s) +const endpoints = getNetworkEndpoints(Network.MainnetSentry) const indexerGrpcAuctionApi = new IndexerGrpcAuctionApi(endpoints.indexer) describe('IndexerGrpcAuctionApi', () => { diff --git a/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcDerivativesApi.spec.ts b/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcDerivativesApi.spec.ts index 588d13566..bcbba974c 100644 --- a/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcDerivativesApi.spec.ts +++ b/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcDerivativesApi.spec.ts @@ -6,7 +6,7 @@ import { DerivativeMarket } from '../types' import { IndexerGrpcDerivativesApi } from './IndexerGrpcDerivativesApi' const injectiveAddress = mockFactory.injectiveAddress -const endpoints = getNetworkEndpoints(Network.MainnetK8s) +const endpoints = getNetworkEndpoints(Network.MainnetSentry) const indexerGrpcDerivativesApi = new IndexerGrpcDerivativesApi( endpoints.indexer, ) diff --git a/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcExplorerApi.spec.ts b/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcExplorerApi.spec.ts index 964bcf8c8..91e14d10e 100644 --- a/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcExplorerApi.spec.ts +++ b/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcExplorerApi.spec.ts @@ -6,7 +6,7 @@ import { ExplorerValidator } from '../types' import { IndexerGrpcExplorerApi } from './IndexerGrpcExplorerApi' const injectiveAddress = mockFactory.injectiveAddress -const endpoints = getNetworkEndpoints(Network.MainnetK8s) +const endpoints = getNetworkEndpoints(Network.MainnetSentry) const indexerGrpcExplorerApi = new IndexerGrpcExplorerApi(endpoints.indexer) describe('IndexerGrpcExplorerApi', () => { diff --git a/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcInsuranceFundApi.spec.ts b/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcInsuranceFundApi.spec.ts index 75b069a14..f501e069b 100644 --- a/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcInsuranceFundApi.spec.ts +++ b/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcInsuranceFundApi.spec.ts @@ -4,7 +4,7 @@ import { IndexerGrpcInsuranceFundTransformer } from '../transformers' import { IndexerGrpcInsuranceFundApi } from './IndexerGrpcInsuranceFundApi' const injectiveAddress = mockFactory.injectiveAddress -const endpoints = getNetworkEndpoints(Network.MainnetK8s) +const endpoints = getNetworkEndpoints(Network.MainnetSentry) const indexerGrpcInsuranceFundApi = new IndexerGrpcInsuranceFundApi( endpoints.indexer, ) diff --git a/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcMetaApi.spec.ts b/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcMetaApi.spec.ts index d2f2caf3f..f8cc6b5d9 100644 --- a/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcMetaApi.spec.ts +++ b/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcMetaApi.spec.ts @@ -1,7 +1,7 @@ import { getNetworkEndpoints, Network } from '@injectivelabs/networks' import { IndexerGrpcMetaApi } from './IndexerGrpcMetaApi' -const endpoints = getNetworkEndpoints(Network.MainnetK8s) +const endpoints = getNetworkEndpoints(Network.MainnetSentry) const indexerGrpcMetaApi = new IndexerGrpcMetaApi(endpoints.indexer) describe('IndexerGrpcMetaApi', () => { diff --git a/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcMitoApi.spec.ts b/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcMitoApi.spec.ts index 208f51748..98c103414 100644 --- a/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcMitoApi.spec.ts +++ b/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcMitoApi.spec.ts @@ -106,7 +106,7 @@ describe('IndexerGrpcMitoApi', () => { holderAddress: injectiveAddress, }) - if (response.length === 0) { + if (response.subscriptions.length === 0) { console.warn('fetchVaultsByHolderAddress.responseIsEmptyArray') } @@ -133,7 +133,7 @@ describe('IndexerGrpcMitoApi', () => { stakingContractAddress, }) - if (response.length === 0) { + if (response.holders.length === 0) { console.warn('fetchLPHolders.responseIsEmptyArray') } @@ -154,9 +154,10 @@ describe('IndexerGrpcMitoApi', () => { test('fetchHolderPortfolio', async () => { try { - const response = await indexerGrpcMitoApi.fetchHolderPortfolio( - injectiveAddress, - ) + const response = await indexerGrpcMitoApi.fetchHolderPortfolio({ + stakingContractAddress, + holderAddress: injectiveAddress, + }) if (!response) { console.warn('fetchHolderPortfolio.portfolioNotFound') diff --git a/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcMitoApi.ts b/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcMitoApi.ts index 38a628953..fc615225a 100644 --- a/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcMitoApi.ts +++ b/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcMitoApi.ts @@ -201,13 +201,13 @@ export class IndexerGrpcMitoApi extends BaseGrpcConsumer { } async fetchVaultsByHolderAddress({ + skip, limit, - pageIndex, holderAddress, vaultAddress, }: { + skip?: number limit?: number - pageIndex?: number holderAddress: string vaultAddress?: string }) { @@ -219,12 +219,12 @@ export class IndexerGrpcMitoApi extends BaseGrpcConsumer { request.vaultAddress = vaultAddress } - if (limit) { - request.limit = limit + if (skip) { + request.skip = skip } - if (pageIndex) { - request.pageIndex = pageIndex + if (limit) { + request.limit = limit } try { @@ -253,13 +253,13 @@ export class IndexerGrpcMitoApi extends BaseGrpcConsumer { } async fetchLPHolders({ + skip, limit, - pageIndex, vaultAddress, stakingContractAddress, }: { + skip?: number limit?: number - pageIndex?: number vaultAddress: string stakingContractAddress: string }) { @@ -268,12 +268,12 @@ export class IndexerGrpcMitoApi extends BaseGrpcConsumer { request.vaultAddress = vaultAddress request.stakingContractAddress = stakingContractAddress - if (limit) { - request.limit = limit + if (skip) { + request.skip = skip } - if (pageIndex) { - request.pageIndex = pageIndex + if (limit) { + request.limit = limit } try { @@ -299,10 +299,17 @@ export class IndexerGrpcMitoApi extends BaseGrpcConsumer { } } - async fetchHolderPortfolio(holderAddress: string) { + async fetchHolderPortfolio({ + holderAddress, + stakingContractAddress, + }: { + holderAddress: string + stakingContractAddress: string + }) { const request = MitoApi.PortfolioRequest.create() request.holderAddress = holderAddress + request.stakingContractAddress = stakingContractAddress try { const response = await this.retry(() => diff --git a/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcOracleApi.spec.ts b/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcOracleApi.spec.ts index e7dd5da3f..a19daa060 100644 --- a/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcOracleApi.spec.ts +++ b/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcOracleApi.spec.ts @@ -1,7 +1,7 @@ import { getNetworkEndpoints, Network } from '@injectivelabs/networks' import { IndexerGrpcOracleApi } from './IndexerGrpcOracleApi' -const endpoints = getNetworkEndpoints(Network.MainnetK8s) +const endpoints = getNetworkEndpoints(Network.MainnetSentry) const indexerGrpcOracleApi = new IndexerGrpcOracleApi(endpoints.indexer) describe('IndexerGrpcOracleApi', () => { diff --git a/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcPortfolioApi.spec.ts b/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcPortfolioApi.spec.ts index 1b5f668a3..17dad7a41 100644 --- a/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcPortfolioApi.spec.ts +++ b/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcPortfolioApi.spec.ts @@ -4,7 +4,7 @@ import { IndexerGrpcAccountPortfolioTransformer } from '../transformers' import { IndexerGrpcAccountPortfolioApi } from './IndexerGrpcPortfolioApi' const injectiveAddress = mockFactory.injectiveAddress -const endpoints = getNetworkEndpoints(Network.MainnetK8s) +const endpoints = getNetworkEndpoints(Network.MainnetSentry) const indexerGrpcPortfolioApi = new IndexerGrpcAccountPortfolioApi( endpoints.indexer, ) diff --git a/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcSpotApi.spec.ts b/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcSpotApi.spec.ts index f5fd49dc8..2cb136efc 100644 --- a/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcSpotApi.spec.ts +++ b/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcSpotApi.spec.ts @@ -6,7 +6,7 @@ import { SpotMarket } from '../types' import { IndexerGrpcSpotApi } from './IndexerGrpcSpotApi' const injectiveAddress = mockFactory.injectiveAddress -const endpoints = getNetworkEndpoints(Network.MainnetK8s) +const endpoints = getNetworkEndpoints(Network.MainnetSentry) const indexerGrpcSpotApi = new IndexerGrpcSpotApi(endpoints.indexer) describe('IndexerGrpcSpotApi', () => { diff --git a/packages/sdk-ts/src/client/indexer/transformers/IndexerGrpcMitoTransformer.ts b/packages/sdk-ts/src/client/indexer/transformers/IndexerGrpcMitoTransformer.ts index d5ce175b5..bfeb92ae5 100644 --- a/packages/sdk-ts/src/client/indexer/transformers/IndexerGrpcMitoTransformer.ts +++ b/packages/sdk-ts/src/client/indexer/transformers/IndexerGrpcMitoTransformer.ts @@ -153,6 +153,7 @@ export class IndexerGrpcMitoTransformer { pnlChartList: portfolio.pnlChart.map( IndexerGrpcMitoTransformer.mitoPriceSnapshotToPriceSnapshot, ), + updatedAt: parseInt(portfolio.pnlUpdatedAt, 10), } } @@ -265,7 +266,9 @@ export class IndexerGrpcMitoTransformer { } } - static mitoSubscriptionToSubscription(subscription: MitoApi.Subscription) { + static mitoSubscriptionToSubscription( + subscription: MitoApi.Subscription, + ): MitoSubscription { const vaultInfo = subscription.vaultInfo ? IndexerGrpcMitoTransformer.mitoVaultToVault(subscription.vaultInfo) : undefined @@ -471,18 +474,26 @@ export class IndexerGrpcMitoTransformer { static vaultsByHolderAddressResponseToVaultsByHolderAddress( response: MitoApi.VaultsByHolderAddressResponse, - ): MitoSubscription[] { - return response.subscriptions.map( - IndexerGrpcMitoTransformer.mitoSubscriptionToSubscription, - ) + ) { + return { + subscriptions: response.subscriptions.map( + IndexerGrpcMitoTransformer.mitoSubscriptionToSubscription, + ), + pagination: IndexerGrpcMitoTransformer.mitoPaginationToPagination( + response.pagination, + ), + } } - static lpHoldersResponseToLPHolders( - response: MitoApi.LPHoldersResponse, - ): MitoHolders[] { - return response.holders.map( - IndexerGrpcMitoTransformer.mitoLpHolderToLPHolder, - ) + static lpHoldersResponseToLPHolders(response: MitoApi.LPHoldersResponse) { + return { + holders: response.holders.map( + IndexerGrpcMitoTransformer.mitoLpHolderToLPHolder, + ), + pagination: IndexerGrpcMitoTransformer.mitoPaginationToPagination( + response.pagination, + ), + } } static transferHistoryResponseToTransfer( diff --git a/packages/sdk-ts/src/client/indexer/types/mito.ts b/packages/sdk-ts/src/client/indexer/types/mito.ts index 909d18925..3cd6937e6 100644 --- a/packages/sdk-ts/src/client/indexer/types/mito.ts +++ b/packages/sdk-ts/src/client/indexer/types/mito.ts @@ -73,6 +73,7 @@ export interface MitoPortfolio { pnl: number totalValueChartList: MitoPriceSnapshot[] pnlChartList: MitoPriceSnapshot[] + updatedAt: number } export interface MitoLeaderboardEntry { diff --git a/packages/sdk-ts/src/client/wasm/index.ts b/packages/sdk-ts/src/client/wasm/index.ts index 8b9b44bcf..93c4cea8e 100644 --- a/packages/sdk-ts/src/client/wasm/index.ts +++ b/packages/sdk-ts/src/client/wasm/index.ts @@ -1,4 +1,3 @@ -export * from './mito' export * from './swap' -export * from './nameservice' export * from './types' +export * from './nameservice' diff --git a/packages/sdk-ts/src/client/wasm/mito/index.ts b/packages/sdk-ts/src/client/wasm/mito/index.ts deleted file mode 100644 index 2b6403383..000000000 --- a/packages/sdk-ts/src/client/wasm/mito/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './queries' -export * from './transformer' -export * from './types' diff --git a/packages/sdk-ts/src/client/wasm/mito/queries/QueryContractAllowance.ts b/packages/sdk-ts/src/client/wasm/mito/queries/QueryContractAllowance.ts deleted file mode 100644 index edc0a601e..000000000 --- a/packages/sdk-ts/src/client/wasm/mito/queries/QueryContractAllowance.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { BaseWasmQuery } from '../../BaseWasmQuery' -import { toBase64 } from '../../../../utils' - -export declare namespace QueryContractAllowanceArg { - export interface Params { - owner: string - spender: string - } -} - -export class QueryContractAllowance extends BaseWasmQuery { - toPayload() { - return toBase64({ - allowance: { - owner: this.params.owner, - spender: this.params.spender, - }, - }) - } -} diff --git a/packages/sdk-ts/src/client/wasm/mito/queries/QueryContractBaseConfig.ts b/packages/sdk-ts/src/client/wasm/mito/queries/QueryContractBaseConfig.ts deleted file mode 100644 index ce71a9de4..000000000 --- a/packages/sdk-ts/src/client/wasm/mito/queries/QueryContractBaseConfig.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { BaseWasmQuery } from '../../BaseWasmQuery' -import { toBase64 } from '../../../../utils' - -export declare namespace QueryContractConfigArg { - export interface Params {} -} - -export class QueryContractBaseConfig extends BaseWasmQuery { - toPayload() { - return toBase64({ base: { config: {} } }) - } -} diff --git a/packages/sdk-ts/src/client/wasm/mito/queries/QueryContractConfig.ts b/packages/sdk-ts/src/client/wasm/mito/queries/QueryContractConfig.ts deleted file mode 100644 index 1f2af121f..000000000 --- a/packages/sdk-ts/src/client/wasm/mito/queries/QueryContractConfig.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { BaseWasmQuery } from '../../BaseWasmQuery' -import { toBase64 } from '../../../../utils' - -export declare namespace QueryContractConfigArg { - export interface Params {} -} - -export class QueryContractConfig extends BaseWasmQuery { - toPayload() { - return toBase64({ config: {} }) - } -} diff --git a/packages/sdk-ts/src/client/wasm/mito/queries/QueryContractMarketingInfo.ts b/packages/sdk-ts/src/client/wasm/mito/queries/QueryContractMarketingInfo.ts deleted file mode 100644 index 75f00be2e..000000000 --- a/packages/sdk-ts/src/client/wasm/mito/queries/QueryContractMarketingInfo.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { BaseWasmQuery } from '../../BaseWasmQuery' -import { toBase64 } from '../../../../utils' - -export declare namespace QueryContractMarketingInfoArg { - export interface Params {} -} - -export class QueryContractMarketingInfo extends BaseWasmQuery { - toPayload() { - return toBase64({ marketing_info: {} }) - } -} diff --git a/packages/sdk-ts/src/client/wasm/mito/queries/QueryLockedLpFunds.ts b/packages/sdk-ts/src/client/wasm/mito/queries/QueryLockedLpFunds.ts deleted file mode 100644 index bc175dd50..000000000 --- a/packages/sdk-ts/src/client/wasm/mito/queries/QueryLockedLpFunds.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { BaseWasmQuery } from '../../BaseWasmQuery' -import { toBase64 } from '../../../../utils' - -export declare namespace QueryLockedLpFundsArg { - export interface Params { - subaccountId: string - userAddress: string - } -} - -export class QueryLockedLpFunds extends BaseWasmQuery { - toPayload() { - return toBase64({ - get_locked_l_p_funds: { - subaccount_id: this.params.subaccountId, - user_address: this.params.userAddress, - }, - }) - } -} diff --git a/packages/sdk-ts/src/client/wasm/mito/queries/QueryRegisteredVault.ts b/packages/sdk-ts/src/client/wasm/mito/queries/QueryRegisteredVault.ts deleted file mode 100644 index 02a61e70a..000000000 --- a/packages/sdk-ts/src/client/wasm/mito/queries/QueryRegisteredVault.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { BaseWasmQuery } from '../../BaseWasmQuery' -import { toBase64 } from '../../../../utils' - -export declare namespace QueryRegisteredVaultsArg { - export interface Params {} -} -export class QueryRegisteredVaults extends BaseWasmQuery { - toPayload() { - return toBase64({ get_registered_vaults: {} }) - } -} diff --git a/packages/sdk-ts/src/client/wasm/mito/queries/QueryVaultMarketId.ts b/packages/sdk-ts/src/client/wasm/mito/queries/QueryVaultMarketId.ts deleted file mode 100644 index 1e595d832..000000000 --- a/packages/sdk-ts/src/client/wasm/mito/queries/QueryVaultMarketId.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { BaseWasmQuery } from '../../BaseWasmQuery' -import { toBase64 } from '../../../../utils' - -export declare namespace QueryVaultMarketIdArg { - export interface Params { - subaccountId: string - } -} - -export class QueryVaultMarketId extends BaseWasmQuery { - toPayload() { - return toBase64({ - get_market_id: { - subaccount_id: this.params.subaccountId, - }, - }) - } -} diff --git a/packages/sdk-ts/src/client/wasm/mito/queries/QueryVaultTotalLpSupply.ts b/packages/sdk-ts/src/client/wasm/mito/queries/QueryVaultTotalLpSupply.ts deleted file mode 100644 index 7e2f9dcf0..000000000 --- a/packages/sdk-ts/src/client/wasm/mito/queries/QueryVaultTotalLpSupply.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { BaseWasmQuery } from '../../BaseWasmQuery' -import { toBase64 } from '../../../../utils' - -export declare namespace QueryVaultTotalLpSupplyArg { - export interface Params { - subaccountId: string - } -} - -export class QueryVaultTotalLpSupply extends BaseWasmQuery { - toPayload() { - return toBase64({ - get_total_lp_supply: { - subaccount_id: this.params.subaccountId, - }, - }) - } -} diff --git a/packages/sdk-ts/src/client/wasm/mito/queries/index.ts b/packages/sdk-ts/src/client/wasm/mito/queries/index.ts deleted file mode 100644 index 81cce1d6a..000000000 --- a/packages/sdk-ts/src/client/wasm/mito/queries/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -export { QueryVaultMarketId } from './QueryVaultMarketId' -export { QueryLockedLpFunds } from './QueryLockedLpFunds' -export { QueryContractConfig } from './QueryContractConfig' -export { QueryContractBaseConfig } from './QueryContractBaseConfig' -export { QueryRegisteredVaults } from './QueryRegisteredVault' -export { QueryContractAllowance } from './QueryContractAllowance' -export { QueryVaultTotalLpSupply } from './QueryVaultTotalLpSupply' -export { QueryContractMarketingInfo } from './QueryContractMarketingInfo' diff --git a/packages/sdk-ts/src/client/wasm/mito/transformer.ts b/packages/sdk-ts/src/client/wasm/mito/transformer.ts deleted file mode 100644 index 386a1f3de..000000000 --- a/packages/sdk-ts/src/client/wasm/mito/transformer.ts +++ /dev/null @@ -1,345 +0,0 @@ -import { toUtf8 } from '../../../utils' -import { WasmContractQueryResponse } from '../types' -import { - VaultAMMConfig, - VaultBaseConfig, - VaultSpotConfig, - VaultDerivativeConfig, - VaultMarketMakingConfig, - OffChainVaultSpotConfig, - OffChainVaultDerivativeConfig, - QueryOffChainVaultResponse, - QueryStakingConfigResponse, - QueryVaultMarketIdResponse, - QueryLockedLpFundsResponse, - QueryAllocatorConfigResponse, - QueryRegisteredVaultResponse, - QueryVaultContractBaseConfig, - QueryOffChainVaultSpotResponse, - QueryVaultContractMarketMaking, - QueryContractTokenInfoResponse, - QueryMastContractConfigResponse, - QueryVaultTotalLpSupplyResponse, - QueryVaultUserLpBalanceResponse, - QueryContractMarketingInfoResponse, - QueryVaultContractAMMConfigResponse, - QueryOffChainVaultDerivativeResponse, - QueryVaultContractSpotConfigResponse, - QueryVaultUserLpContractAllowanceResponse, - QueryVaultContractDerivativeConfigResponse, -} from './types' - -/** - * @hidden - */ - -const formatToString = (value?: string | number) => - value ? value.toString() : '' -export class MitoQueryTransformer { - static contractMarketingInfoResponseToContractMarketingInfo( - response: WasmContractQueryResponse, - ) { - const data = JSON.parse( - toUtf8(response.data), - ) as QueryContractMarketingInfoResponse - - return { - project: data.project, - description: data.description, - logo: data.logo, - marketing: data.marketing, - } - } - - static contractTokenInfoResponseToContractTokenInfo( - response: WasmContractQueryResponse, - ) { - const data = JSON.parse( - toUtf8(response.data), - ) as QueryContractTokenInfoResponse - - return { - name: data.name, - symbol: data.symbol, - decimals: data.decimals, - totalSupply: data.total_supply, - } - } - - static masterContractConfigResponseToMasterContractConfig( - response: WasmContractQueryResponse, - ) { - const data = JSON.parse( - toUtf8(response.data), - ) as QueryMastContractConfigResponse - - return { - distributionContract: data.distribution_contract, - ninjaToken: data.ninja_token, - owner: data.owner, - } - } - - static vaultContractBaseConfigResponseToBaseConfig( - config: QueryVaultContractBaseConfig, - ): VaultBaseConfig { - return { - owner: formatToString(config.owner), - marketId: formatToString(config.market_id), - subaccountId: formatToString(config.subaccount_id), - feeRecipient: formatToString(config.fee_recipient), - masterAddress: formatToString(config.master_address), - orderDensity: Number(config.order_density), - notionalValueCap: formatToString(config.notional_value_cap), - } - } - - static vaultContractMarketMakingResponseToMarketMaking( - config: QueryVaultContractMarketMaking, - ): VaultMarketMakingConfig { - return { - reservationPriceSensitivityRatio: formatToString( - config.reservation_price_sensitivity_ratio, - ), - reservationSpreadSensitivityRatio: formatToString( - config.reservation_spread_sensitivity_ratio, - ), - maxActiveCapitalUtilizationRatio: formatToString( - config.max_active_capital_utilization_ratio, - ), - headChangeToleranceRatio: formatToString( - config.head_change_tolerance_ratio, - ), - headToTailDeviationRatio: formatToString( - config.head_to_tail_deviation_ratio, - ), - signedMinHeadToFairPriceDeviationRatio: formatToString( - config.signed_min_head_to_fair_price_deviation_ratio, - ), - signedMinHeadToTobDeviationRatio: formatToString( - config.signed_min_head_to_tob_deviation_ratio, - ), - defaultMidPriceVolatilityRatio: formatToString( - config.default_mid_price_volatility_ratio, - ), - minOracleVolatilitySampleSize: Number( - config.min_oracle_volatility_sample_size, - ), - oracleVolatilityMaxAge: Number(config.oracle_volatility_max_age), - emergencyOracleVolatilitySampleSize: Number( - config.emergency_oracle_volatility_sample_size, - ), - lastValidMarkPrice: formatToString(config.last_valid_mark_price), - minVolatilityRatio: formatToString(config.min_volatility_ratio), - oracleStaleTime: Number(config.oracle_stale_time), - } - } - - static vaultContractConfigResponseToAMMVaultConfig( - response: WasmContractQueryResponse, - ): VaultAMMConfig { - const { config } = JSON.parse( - toUtf8(response.data), - ) as QueryVaultContractAMMConfigResponse - - return { - base: MitoQueryTransformer.vaultContractBaseConfigResponseToBaseConfig( - config.base, - ), - priceTickSize: formatToString(config.price_tick_size), - maxInvariantSensitivity: formatToString(config.max_invariant_sensitivity), - baseDecimals: Number(config.base_decimals), - quoteDecimals: Number(config.quote_decimals), - } - } - - static vaultContractConfigResponseToDerivativeVaultConfig( - response: WasmContractQueryResponse, - ): VaultDerivativeConfig { - const { config } = JSON.parse( - toUtf8(response.data), - ) as QueryVaultContractDerivativeConfigResponse - - return { - base: MitoQueryTransformer.vaultContractBaseConfigResponseToBaseConfig( - config.base, - ), - marketMaking: - MitoQueryTransformer.vaultContractMarketMakingResponseToMarketMaking( - config.market_making, - ), - leverage: formatToString(config.leverage), - minProximityToLiquidation: formatToString( - config.min_proximity_to_liquidation, - ), - allowedRedemptionTypes: Number(config.allowed_redemption_types), - positionPnlPenalty: formatToString(config.position_pnl_penalty), - } - } - - static vaultContractConfigResponseToSpotVaultContractConfig( - response: WasmContractQueryResponse, - ): VaultSpotConfig { - const { config } = JSON.parse( - toUtf8(response.data), - ) as QueryVaultContractSpotConfigResponse - - return { - base: MitoQueryTransformer.vaultContractBaseConfigResponseToBaseConfig( - config.base, - ), - marketMaking: - MitoQueryTransformer.vaultContractMarketMakingResponseToMarketMaking( - config.market_making, - ), - oracleType: Number(config.oracle_type), - targetBaseWeight: formatToString(config.target_base_weight), - allowedRedemptionTypes: Number(config.allowed_redemption_types), - baseDecimals: Number(config.base_decimals), - quoteDecimals: Number(config.quote_decimals), - baseOracleSymbol: formatToString(config.base_oracle_symbol), - quoteOracleSymbol: formatToString(config.quote_oracle_symbol), - } - } - - static offChainVaultContractConfigResponseToOffChainVaultConfig( - response: WasmContractQueryResponse, - ): OffChainVaultSpotConfig | OffChainVaultDerivativeConfig { - const data = JSON.parse(toUtf8(response.data)) as QueryOffChainVaultResponse - - const isDerivativeVault = - (data.vault_type as QueryOffChainVaultDerivativeResponse).Derivative !== - undefined - const derivativeConfig = ( - data.vault_type as QueryOffChainVaultDerivativeResponse - ).Derivative - const spotConfig = (data.vault_type as QueryOffChainVaultSpotResponse).Spot - - return { - base: { - admin: formatToString(data.admin), - marketId: formatToString(data.market_id), - vaultSubaccountId: formatToString(data.vault_subaccount_id), - oracleStaleTime: Number(data.oracle_stale_time), - notionalValueCap: formatToString(data.notional_value_cap), - }, - ...(isDerivativeVault - ? { - positionPnlPenalty: formatToString( - derivativeConfig.position_pnl_penalty, - ), - allowedDerivativeRedemptionTypes: Number( - derivativeConfig.allowed_derivative_redemption_types, - ), - } - : { - oracleType: Number(spotConfig.oracle_type), - baseOracleSymbol: formatToString(spotConfig.base_oracle_symbol), - quoteOracleSymbol: formatToString(spotConfig.quote_oracle_symbol), - baseDecimals: Number(spotConfig.base_decimals), - quoteDecimals: Number(spotConfig.quote_decimals), - }), - } - } - - static vaultUserLpAllowanceResponseToVaultUserLpAllowance( - response: WasmContractQueryResponse, - ) { - const data = JSON.parse( - toUtf8(response.data), - ) as QueryVaultUserLpContractAllowanceResponse - - return { - allowance: data.allowance, - } - } - - static vaultMarketIdResponseToVaultMarketId( - response: WasmContractQueryResponse, - ) { - const data = JSON.parse(toUtf8(response.data)) as QueryVaultMarketIdResponse - - return { marketId: data.market_id } - } - - static vaultTotalLpSupplyResponseToVaultTotalLpSupply( - response: WasmContractQueryResponse, - ) { - const data = JSON.parse( - toUtf8(response.data), - ) as QueryVaultTotalLpSupplyResponse - - return { totalSupply: data.total_supply } - } - - static vaultUserLpBalanceResponseToVaultUserLpBalance( - response: WasmContractQueryResponse, - ) { - const data = JSON.parse( - toUtf8(response.data), - ) as QueryVaultUserLpBalanceResponse - - return { balance: data.balance } - } - - static vaultUserLockedLpFundsResponseToVaultUserLockedLpFunds( - response: WasmContractQueryResponse, - ) { - const data = JSON.parse(toUtf8(response.data)) as QueryLockedLpFundsResponse - - return { amount: data.amount, lockTime: data.lock_time } - } - - static registeredVaultsResponseToRegisteredVaults( - response: WasmContractQueryResponse, - ) { - const data = JSON.parse( - toUtf8(response.data), - ) as QueryRegisteredVaultResponse - - return data.registered_vaults.map((payload) => ({ - isDerivative: payload.vault.derivative !== undefined, - masterSubaccountId: payload.master_subaccount_id, - vaultAddress: - payload.vault.derivative?.address || payload.vault.spot?.address, - })) - } - - static allocatorConfigResponseToAllocatorConfig( - response: WasmContractQueryResponse, - ) { - const data = JSON.parse( - toUtf8(response.data), - ) as QueryAllocatorConfigResponse - - return { - owner: formatToString(data.owner), - stakingContractAddress: formatToString(data.staking_contract_address), - maxRewardDenomsPerGauge: data.max_reward_denoms_per_gauge - ? Number(data.max_reward_denoms_per_gauge) - : undefined, - minGaugeDurationInSeconds: data.min_gauge_duration_in_seconds - ? Number(data.min_gauge_duration_in_seconds) - : undefined, - maxActiveGaugesPerLpToken: data.max_active_gauges_per_lp_token - ? Number(data.max_active_gauges_per_lp_token) - : undefined, - gaugeAllocationFeeDenom: formatToString(data.gauge_allocation_fee?.denom), - gaugeAllocationFeeAmount: formatToString( - data.gauge_allocation_fee?.amount, - ), - } - } - - static stakingConfigResponseToAllocatorConfig( - response: WasmContractQueryResponse, - ) { - const data = JSON.parse(toUtf8(response.data)) as QueryStakingConfigResponse - - return { - owner: formatToString(data.owner), - lockupPeriod: Number(data.lockup_period || 0), - allocatorContractAddress: formatToString(data.allocator_contract_address), - } - } -} diff --git a/packages/sdk-ts/src/client/wasm/mito/types.ts b/packages/sdk-ts/src/client/wasm/mito/types.ts deleted file mode 100644 index c27e6ed88..000000000 --- a/packages/sdk-ts/src/client/wasm/mito/types.ts +++ /dev/null @@ -1,259 +0,0 @@ -export interface QueryContractTokenInfoResponse { - name: string - symbol: string - decimals: number - total_supply: string -} - -export interface QueryContractMarketingInfoResponse { - project: string - description: string - logo: string - marketing: string -} - -export interface QueryMastContractConfigResponse { - distribution_contract: string - ninja_token: string - owner: string -} - -export interface QueryVaultContractBaseConfig { - owner: string - market_id: string - subaccount_id: string - fee_recipient: string - master_address: string - order_density: number - notional_value_cap: string -} - -export interface QueryVaultContractMarketMaking { - reservation_price_sensitivity_ratio: string - reservation_spread_sensitivity_ratio: string - max_active_capital_utilization_ratio: string - head_change_tolerance_ratio: string - head_to_tail_deviation_ratio: string - signed_min_head_to_fair_price_deviation_ratio: string - signed_min_head_to_tob_deviation_ratio: string - default_mid_price_volatility_ratio: string - min_volatility_ratio: string - min_oracle_volatility_sample_size: number - oracle_volatility_max_age: number - emergency_oracle_volatility_sample_size: number - last_valid_mark_price: string - oracle_stale_time: number -} - -export interface QueryVaultContractDerivativeConfigResponse { - config: { - base: QueryVaultContractBaseConfig - market_making: QueryVaultContractMarketMaking - leverage: string - min_proximity_to_liquidation: string - allowed_redemption_types: number - position_pnl_penalty: string - } -} - -export interface QueryVaultContractSpotConfigResponse { - config: { - base: QueryVaultContractBaseConfig - market_making: QueryVaultContractMarketMaking - oracle_type: number - target_base_weight: string - allowed_redemption_types: number - base_decimals: number - quote_decimals: number - base_oracle_symbol: string - quote_oracle_symbol: string - } -} - -export interface QueryVaultContractAMMConfigResponse { - config: { - base: QueryVaultContractBaseConfig - price_tick_size: string - max_invariant_sensitivity: string - base_decimals: number - quote_decimals: number - } -} - -export interface QueryVaultUserLpContractAllowanceResponse { - allowance: string - expires: { - never: {} - } -} - -export interface QueryVaultMarketIdResponse { - market_id: string -} - -export interface QueryVaultTotalLpSupplyResponse { - total_supply: string -} - -export interface QueryVaultUserLpBalanceResponse { - balance: string -} - -export interface QueryLockedLpFundsResponse { - amount: string - lock_time: string -} - -export interface QueryRegisteredVaultResponse { - registered_vaults: { - master_subaccount_id: string - vault: { - spot?: { - address: string - } - derivative?: { - address: string - } - } - }[] -} - -export interface QueryOffChainVaultSpotResponse { - Spot: { - oracle_type: number - base_oracle_symbol: string - quote_oracle_symbol: string - base_decimals: number - quote_decimals: number - } -} -export interface QueryOffChainVaultDerivativeResponse { - Derivative: { - position_pnl_penalty: string - allowed_derivative_redemption_types: number - } -} - -export interface QueryOffChainVaultResponse { - admin: string - market_id: string - vault_subaccount_id: string - oracle_stale_time: string - notional_value_cap: string - vault_type: - | QueryOffChainVaultSpotResponse - | QueryOffChainVaultDerivativeResponse -} - -export type VaultBaseConfig = { - owner: string - marketId: string - subaccountId: string - feeRecipient: string - masterAddress: string - orderDensity: number - notionalValueCap: string -} - -export type VaultMarketMakingConfig = { - reservationPriceSensitivityRatio: string - reservationSpreadSensitivityRatio: string - maxActiveCapitalUtilizationRatio: string - headChangeToleranceRatio: string - headToTailDeviationRatio: string - signedMinHeadToFairPriceDeviationRatio: string - signedMinHeadToTobDeviationRatio: string - defaultMidPriceVolatilityRatio: string - minVolatilityRatio: string - minOracleVolatilitySampleSize: number - oracleVolatilityMaxAge: number - emergencyOracleVolatilitySampleSize: number - lastValidMarkPrice: string - oracleStaleTime: number -} - -export type VaultAMMConfig = { - base: VaultBaseConfig - priceTickSize: string - maxInvariantSensitivity: string - baseDecimals: number - quoteDecimals: number -} - -export type VaultDerivativeConfig = { - base: VaultBaseConfig - marketMaking: VaultMarketMakingConfig - leverage: string - minProximityToLiquidation: string - allowedRedemptionTypes: number - positionPnlPenalty: string -} - -export type VaultSpotConfig = { - base: VaultBaseConfig - marketMaking: VaultMarketMakingConfig - oracleType: number - targetBaseWeight: string - allowedRedemptionTypes: number - baseDecimals: number - quoteDecimals: number - baseOracleSymbol: string - quoteOracleSymbol: string -} - -export type OffChainVaultBaseConfig = { - admin: string - marketId: string - vaultSubaccountId: string - oracleStaleTime: number - notionalValueCap: string -} - -export type OffChainVaultSpotConfig = { - base: OffChainVaultBaseConfig - oracleType: number - baseOracleSymbol: string - quoteOracleSymbol: string - baseDecimals: number - quoteDecimals: number -} - -export type OffChainVaultDerivativeConfig = { - base: OffChainVaultBaseConfig - positionPnlPenalty: string - allowedDerivativeRedemptionTypes: number -} - -export type QueryStakingConfigResponse = { - owner?: string - lockup_period?: number - allocator_contract_address?: string -} - -export type QueryAllocatorConfigResponse = { - owner?: string - staking_contract_address?: string - max_reward_denoms_per_gauge?: number - min_gauge_duration_in_seconds?: number - max_active_gauges_per_lp_token?: number - gauge_allocation_fee?: { - denom: string - amount: string - } -} - -export type StakingConfig = { - owner?: string - lockupPeriod?: number - allocatorContractAddress?: string -} - -export type AllocatorConfig = { - owner?: string - stakingContractAddress?: string - maxRewardDenomsPerGauge?: number - minGaugeDurationInSeconds?: number - maxActiveGaugesPerLpToken?: number - gaugeAllocationFeeDenom?: string - gaugeAllocationFeeAmount?: string -} diff --git a/packages/sdk-ts/src/client/wasm/nameservice/utils.ts b/packages/sdk-ts/src/client/wasm/nameservice/utils.ts index 2ab1a0784..387ca8dc7 100644 --- a/packages/sdk-ts/src/client/wasm/nameservice/utils.ts +++ b/packages/sdk-ts/src/client/wasm/nameservice/utils.ts @@ -28,7 +28,9 @@ const nameToNode = (name: string) => { if (!name) { return [] } + const hash = nameHash(name) + return Array.from(Buffer.from(hash.slice(2), 'hex')) } diff --git a/packages/sdk-ts/src/core/accounts/BaseAccount.ts b/packages/sdk-ts/src/core/accounts/BaseAccount.ts index 56520bb55..271f968ff 100644 --- a/packages/sdk-ts/src/core/accounts/BaseAccount.ts +++ b/packages/sdk-ts/src/core/accounts/BaseAccount.ts @@ -79,14 +79,16 @@ export class BaseAccount extends Address { public incrementSequence() { this.sequence += 1 + + return this } public toAccountDetails(): AccountDetails { return { - address: this.bech32Address, pubKey: this.pubKey, - accountNumber: this.accountNumber, sequence: this.sequence, + address: this.bech32Address, + accountNumber: this.accountNumber, } } } diff --git a/packages/sdk-ts/src/core/modules/feegrant/index.ts b/packages/sdk-ts/src/core/modules/feegrant/index.ts new file mode 100644 index 000000000..be0443536 --- /dev/null +++ b/packages/sdk-ts/src/core/modules/feegrant/index.ts @@ -0,0 +1,4 @@ +import MsgGrantAllowance from './msgs/MsgGrantAllowance' +import MsgRevokeAllowance from './msgs/MsgRevokeAllowance' + +export { MsgGrantAllowance, MsgRevokeAllowance } diff --git a/packages/sdk-ts/src/core/modules/feegrant/msgs/MsgGrantAllowance.spec.ts b/packages/sdk-ts/src/core/modules/feegrant/msgs/MsgGrantAllowance.spec.ts new file mode 100644 index 000000000..15b6808eb --- /dev/null +++ b/packages/sdk-ts/src/core/modules/feegrant/msgs/MsgGrantAllowance.spec.ts @@ -0,0 +1,151 @@ +import MsgGrantAllowance from './MsgGrantAllowance' +import { mockFactory } from '@injectivelabs/test-utils' +import { CosmosFeegrantV1Beta1Feegrant } from '@injectivelabs/core-proto-ts' +import snakecaseKeys from 'snakecase-keys' + +const { injectiveAddress, injectiveAddress2 } = mockFactory + +const params: MsgGrantAllowance['params'] = { + grantee: injectiveAddress, + granter: injectiveAddress2, + allowance: { + spendLimit: [ + { + denom: 'inj', + amount: '1000', + }, + ], + expiration: 1679416772, + }, +} + +const protoType = '/cosmos.feegrant.v1beta1.MsgGrantAllowance' +const protoTypeShort = 'cosmos-sdk/MsgGrantAllowance' +const protoParams = { + grantee: params.grantee, + granter: params.granter, + allowance: { + typeUrl: '/cosmos.feegrant.v1beta1.BasicAllowance', + value: Uint8Array.from( + CosmosFeegrantV1Beta1Feegrant.BasicAllowance.encode({ + spendLimit: params.allowance.spendLimit, + expiration: new Date(params.allowance.expiration! * 1000), + }).finish(), + ), + }, +} + +const protoParamsAmino = snakecaseKeys({ + grantee: params.grantee, + granter: params.granter, + allowance: { + type: 'cosmos-sdk/BasicAllowance', + value: { + spendLimit: params.allowance.spendLimit, + expiration: new Date(params.allowance.expiration! * 1000), + }, + }, +}) + +const protoParamsWeb3 = { + grantee: params.grantee, + granter: params.granter, + allowance: { + '@type': '/cosmos.feegrant.v1beta1.BasicAllowance', + spendLimit: params.allowance.spendLimit, + expiration: new Date(params.allowance.expiration! * 1000), + }, +} +const message = MsgGrantAllowance.fromJSON(params) + +describe('MsgGrantAllowance', () => { + it('generates proper proto', () => { + const message = MsgGrantAllowance.fromJSON(params) + const proto = message.toProto() + + expect(proto).toStrictEqual({ + ...protoParams, + }) + }) + + it('generates proper data', () => { + const data = message.toData() + + expect(data).toStrictEqual({ + '@type': protoType, + ...protoParams, + }) + }) + + it('generates proper amino', () => { + const amino = message.toAmino() + + expect(amino).toStrictEqual({ + type: protoTypeShort, + value: protoParamsAmino, + }) + }) + + it('generates proper Eip712 types', () => { + const eip712Types = message.toEip712Types() + + expect(Object.fromEntries(eip712Types)).toStrictEqual({ + TypeAllowance: [ + { name: 'type', type: 'string' }, + { name: 'value', type: 'TypeAllowanceValue' }, + ], + TypeAllowanceValue: [ + { name: 'spend_limit', type: 'TypeAllowanceValueSpendLimit[]' }, + { name: 'expiration', type: 'string' }, + ], + TypeAllowanceValueSpendLimit: [ + { name: 'denom', type: 'string' }, + { name: 'amount', type: 'string' }, + ], + MsgValue: [ + { name: 'granter', type: 'string' }, + { name: 'grantee', type: 'string' }, + { name: 'allowance', type: 'TypeAllowance' }, + ], + }) + }) + + it('generates proper Eip712 values', () => { + const eip712 = message.toEip712() + + expect(eip712).toStrictEqual({ + type: protoTypeShort, + value: snakecaseKeys({ + ...protoParamsAmino, + allowance: { + ...protoParamsAmino.allowance, + value: { + ...protoParamsAmino.allowance.value, + expiration: + protoParamsAmino.allowance.value.expiration + .toJSON() + .split('.')[0] + 'Z', + }, + }, + }), + }) + }) + + it('generates proper direct sign', () => { + const directSign = message.toDirectSign() + + expect(directSign).toStrictEqual({ + type: protoType, + message: protoParams, + }) + }) + + it('generates proper web3', () => { + const web3 = message.toWeb3() + + expect(web3).toStrictEqual({ + '@type': protoType, + ...protoParamsWeb3, + }) + }) +}) diff --git a/packages/sdk-ts/src/core/modules/feegrant/msgs/MsgGrantAllowance.ts b/packages/sdk-ts/src/core/modules/feegrant/msgs/MsgGrantAllowance.ts new file mode 100644 index 000000000..8c325b448 --- /dev/null +++ b/packages/sdk-ts/src/core/modules/feegrant/msgs/MsgGrantAllowance.ts @@ -0,0 +1,166 @@ +import snakecaseKeys from 'snakecase-keys' +import { MsgBase } from '../../MsgBase' +import { + CosmosFeegrantV1Beta1Tx, + CosmosFeegrantV1Beta1Feegrant, + GoogleProtobufTimestamp, + GoogleProtobufAny, +} from '@injectivelabs/core-proto-ts' +import { Coin } from '@injectivelabs/ts-types' + +const basicAllowanceType = '/cosmos.feegrant.v1beta1.BasicAllowance' +export declare namespace MsgGrantAllowance { + export interface Params { + granter: string + grantee: string + allowance: { + spendLimit: Coin[] + expiration: number | undefined + } + } + + export type Proto = CosmosFeegrantV1Beta1Tx.MsgGrantAllowance + + export type Object = Omit< + CosmosFeegrantV1Beta1Tx.MsgGrantAllowance, + 'allowance' + > & { + allowance: any + } +} + +/** + * @category Messages + */ +export default class MsgGrantAllowance extends MsgBase< + MsgGrantAllowance.Params, + MsgGrantAllowance.Proto +> { + static fromJSON(params: MsgGrantAllowance.Params): MsgGrantAllowance { + return new MsgGrantAllowance(params) + } + + public toProto() { + const { params } = this + + const timestamp = this.getTimestamp() + const basicAllowance = CosmosFeegrantV1Beta1Feegrant.BasicAllowance.create() + basicAllowance.spendLimit = params.allowance.spendLimit + basicAllowance.expiration = new Date(Number(timestamp.seconds) * 1000) + + const allowance = GoogleProtobufAny.Any.create() + allowance.typeUrl = basicAllowanceType + allowance.value = Buffer.from( + CosmosFeegrantV1Beta1Feegrant.BasicAllowance.encode( + basicAllowance, + ).finish(), + ) + + const message = CosmosFeegrantV1Beta1Tx.MsgGrantAllowance.create() + message.grantee = params.grantee + message.granter = params.granter + message.allowance = allowance + console.log({ + message, + fromJSON: CosmosFeegrantV1Beta1Tx.MsgGrantAllowance.fromJSON(message), + }) + + return CosmosFeegrantV1Beta1Tx.MsgGrantAllowance.fromJSON(message) + } + + public toData() { + const proto = this.toProto() + + return { + '@type': '/cosmos.feegrant.v1beta1.MsgGrantAllowance', + ...proto, + } + } + + public toAmino() { + const { params } = this + + const proto = this.toProto() + const timestamp = this.getTimestamp() + const message = proto + + const messageWithAllowance = snakecaseKeys({ + ...message, + allowance: { + type: 'cosmos-sdk/BasicAllowance', + value: { + spendLimit: params.allowance.spendLimit, + expiration: new Date(Number(timestamp.seconds) * 1000), + }, + }, + }) + + return { + type: 'cosmos-sdk/MsgGrantAllowance', + value: messageWithAllowance as unknown as MsgGrantAllowance.Object, + } + } + + public toDirectSign() { + const proto = this.toProto() + + return { + type: '/cosmos.feegrant.v1beta1.MsgGrantAllowance', + message: proto, + } + } + + public toWeb3() { + const { params } = this + const amino = this.toAmino() + const timestamp = this.getTimestamp() + + const messageWithAllowance = { + granter: amino.value.granter, + grantee: amino.value.grantee, + allowance: { + '@type': basicAllowanceType, + spendLimit: params.allowance.spendLimit, + expiration: new Date(Number(timestamp.seconds) * 1000), + }, + } + + return { + '@type': '/cosmos.feegrant.v1beta1.MsgGrantAllowance', + ...messageWithAllowance, + } + } + + private getTimestamp() { + const { params } = this + + if (params.allowance.expiration) { + const timestamp = GoogleProtobufTimestamp.Timestamp.create() + + timestamp.seconds = params.allowance.expiration.toString() + + return timestamp + } + + const defaultExpiryYears = 5 + const dateNow = new Date() + const expiration = new Date( + dateNow.getFullYear() + defaultExpiryYears, + dateNow.getMonth(), + dateNow.getDate(), + ) + + const timestamp = GoogleProtobufTimestamp.Timestamp.create() + const timestampInSeconds = (expiration.getTime() / 1000).toString() + + timestamp.seconds = timestampInSeconds + + return timestamp + } + + public toBinary(): Uint8Array { + return CosmosFeegrantV1Beta1Tx.MsgGrantAllowance.encode( + this.toProto(), + ).finish() + } +} diff --git a/packages/sdk-ts/src/core/modules/feegrant/msgs/MsgRevokeAllowance.spec.ts b/packages/sdk-ts/src/core/modules/feegrant/msgs/MsgRevokeAllowance.spec.ts new file mode 100644 index 000000000..89ee5a3bc --- /dev/null +++ b/packages/sdk-ts/src/core/modules/feegrant/msgs/MsgRevokeAllowance.spec.ts @@ -0,0 +1,79 @@ +import MsgRevokeAllowance from './MsgRevokeAllowance' +import { mockFactory } from '@injectivelabs/test-utils' +import snakecaseKeys from 'snakecase-keys' + +const { injectiveAddress, injectiveAddress2 } = mockFactory + +const params: MsgRevokeAllowance['params'] = { + grantee: injectiveAddress, + granter: injectiveAddress2, +} + +const protoType = '/cosmos.feegrant.v1beta1.MsgRevokeAllowance' +const protoTypeShort = 'cosmos-sdk/MsgRevokeAllowance' +const protoParams = { + grantee: params.grantee, + granter: params.granter, +} + +const protoParamsAmino = snakecaseKeys(protoParams) +const message = MsgRevokeAllowance.fromJSON(params) + +describe('MsgRevokeAllowance', () => { + it('generates proper proto', () => { + const proto = message.toProto() + + expect(proto).toStrictEqual({ + ...protoParams, + }) + }) + + it('generates proper data', () => { + const data = message.toData() + + expect(data).toStrictEqual({ + '@type': protoType, + ...protoParams, + }) + }) + + it('generates proper amino', () => { + const amino = message.toAmino() + + expect(amino).toStrictEqual({ + type: protoTypeShort, + value: protoParamsAmino, + }) + }) + + it('generates proper Eip712 types', () => { + const eip712Types = message.toEip712Types() + + expect(Object.fromEntries(eip712Types)).toStrictEqual({ + MsgValue: [ + { name: 'granter', type: 'string' }, + { name: 'grantee', type: 'string' }, + ], + }) + }) + + it('generates proper Eip712 values', () => { + const eip712 = message.toEip712() + + expect(eip712).toStrictEqual({ + type: protoTypeShort, + value: snakecaseKeys({ + ...protoParamsAmino, + }), + }) + }) + + it('generates proper web3', () => { + const web3 = message.toWeb3() + + expect(web3).toStrictEqual({ + '@type': protoType, + ...protoParamsAmino, + }) + }) +}) diff --git a/packages/sdk-ts/src/core/modules/feegrant/msgs/MsgRevokeAllowance.ts b/packages/sdk-ts/src/core/modules/feegrant/msgs/MsgRevokeAllowance.ts new file mode 100644 index 000000000..1dd2599dd --- /dev/null +++ b/packages/sdk-ts/src/core/modules/feegrant/msgs/MsgRevokeAllowance.ts @@ -0,0 +1,80 @@ +import { MsgBase } from '../../MsgBase' +import snakecaseKeys, { SnakeCaseKeys } from 'snakecase-keys' +import { CosmosFeegrantV1Beta1Tx } from '@injectivelabs/core-proto-ts' + +export declare namespace MsgRevokeAllowance { + export interface Params { + granter: string + grantee: string + } + + export type Proto = CosmosFeegrantV1Beta1Tx.MsgRevokeAllowance +} + +/** + * @category Messages + */ +export default class MsgRevokeAllowance extends MsgBase< + MsgRevokeAllowance.Params, + MsgRevokeAllowance.Proto +> { + static fromJSON(params: MsgRevokeAllowance.Params): MsgRevokeAllowance { + return new MsgRevokeAllowance(params) + } + + public toProto() { + const { params } = this + + const message = CosmosFeegrantV1Beta1Tx.MsgRevokeAllowance.create() + message.grantee = params.grantee + message.granter = params.granter + + return CosmosFeegrantV1Beta1Tx.MsgRevokeAllowance.fromPartial(message) + } + + public toData() { + const proto = this.toProto() + + return { + '@type': '/cosmos.feegrant.v1beta1.MsgRevokeAllowance', + ...proto, + } + } + + public toAmino() { + const proto = this.toProto() + const message = { + ...snakecaseKeys(proto), + } + + return { + type: 'cosmos-sdk/MsgRevokeAllowance', + value: message as unknown as SnakeCaseKeys, + } + } + + public toWeb3() { + const amino = this.toAmino() + const { value } = amino + + return { + '@type': '/cosmos.feegrant.v1beta1.MsgRevokeAllowance', + ...value, + } + } + + public toDirectSign() { + const proto = this.toProto() + + return { + type: '/cosmos.feegrant.v1beta1.MsgRevokeAllowance', + message: proto, + } + } + + public toBinary(): Uint8Array { + return CosmosFeegrantV1Beta1Tx.MsgRevokeAllowance.encode( + this.toProto(), + ).finish() + } +} diff --git a/packages/sdk-ts/src/core/modules/feegrant/utils/allowance.ts b/packages/sdk-ts/src/core/modules/feegrant/utils/allowance.ts new file mode 100644 index 000000000..7e50a0e83 --- /dev/null +++ b/packages/sdk-ts/src/core/modules/feegrant/utils/allowance.ts @@ -0,0 +1,140 @@ +import { + GoogleProtobufAny, + CosmosFeegrantV1Beta1Feegrant, +} from '@injectivelabs/core-proto-ts' +import { GeneralException } from '@injectivelabs/exceptions' + +export type AllowedMsgAllowance = Omit< + CosmosFeegrantV1Beta1Feegrant.AllowedMsgAllowance, + 'allowance' +> & { + allowance: + | CosmosFeegrantV1Beta1Feegrant.BasicAllowance + | CosmosFeegrantV1Beta1Feegrant.PeriodicAllowance +} + +export type Allowance = + | CosmosFeegrantV1Beta1Feegrant.BasicAllowance + | CosmosFeegrantV1Beta1Feegrant.PeriodicAllowance + | AllowedMsgAllowance + | undefined + +export enum AllowanceTypes { + BasicAllowance = 'spendLimit', + PeriodicAllowance = 'periodSpendLimit', + AllowedMsgAllowance = 'allowedMessages', +} + +function isBasicAllowance( + allowance: Allowance, +): allowance is CosmosFeegrantV1Beta1Feegrant.BasicAllowance { + if (!allowance) { + return false + } + + return AllowanceTypes.BasicAllowance in allowance +} + +function isPeriodicAllowance( + allowance: Allowance, +): allowance is CosmosFeegrantV1Beta1Feegrant.PeriodicAllowance { + if (!allowance) { + return false + } + + return AllowanceTypes.PeriodicAllowance in allowance +} + +function isAllowedMsgAllowance( + allowance: Allowance, +): allowance is AllowedMsgAllowance { + if (!allowance) { + return false + } + + return AllowanceTypes.AllowedMsgAllowance in allowance +} + +function encodeBasicAllowance( + allowance: CosmosFeegrantV1Beta1Feegrant.BasicAllowance, +): GoogleProtobufAny.Any { + return { + typeUrl: '/cosmos.feegrant.v1beta1.BasicAllowance', + value: Buffer.from( + CosmosFeegrantV1Beta1Feegrant.BasicAllowance.encode(allowance).finish(), + ), + } +} + +function encodePeriodicAllowance( + allowance: CosmosFeegrantV1Beta1Feegrant.PeriodicAllowance, +): GoogleProtobufAny.Any { + return { + typeUrl: '/cosmos.feegrant.v1beta1.PeriodicAllowance', + value: Buffer.from( + CosmosFeegrantV1Beta1Feegrant.PeriodicAllowance.encode( + allowance, + ).finish(), + ), + } +} + +function encodeAllowedMsgAllowance( + allowance: AllowedMsgAllowance, +): GoogleProtobufAny.Any | undefined { + let internalAllowance: GoogleProtobufAny.Any + + if (isBasicAllowance(allowance.allowance as Allowance)) { + internalAllowance = encodeBasicAllowance( + allowance.allowance as unknown as CosmosFeegrantV1Beta1Feegrant.BasicAllowance, + ) + } else if (isPeriodicAllowance(allowance.allowance as Allowance)) { + internalAllowance = encodePeriodicAllowance( + allowance.allowance as unknown as CosmosFeegrantV1Beta1Feegrant.PeriodicAllowance, + ) + } else { + throw new Error( + `AllowedMsgAllowance: Cannot cast allowance into 'BasicAllowance' or 'PeriodicAllowance': ${JSON.stringify( + allowance.allowance, + )}`, + ) + } + + return { + typeUrl: '/cosmos.feegrant.v1beta1.AllowedMsgAllowance', + value: Buffer.from( + CosmosFeegrantV1Beta1Feegrant.AllowedMsgAllowance.encode({ + allowedMessages: allowance.allowedMessages, + allowance: internalAllowance, + }).finish(), + ), + } +} + +export function encodeAllowance( + allowance: Allowance, +): GoogleProtobufAny.Any | undefined { + if (isBasicAllowance(allowance)) { + return encodeBasicAllowance( + allowance as CosmosFeegrantV1Beta1Feegrant.BasicAllowance, + ) + } + + if (isPeriodicAllowance(allowance)) { + return encodePeriodicAllowance( + allowance as CosmosFeegrantV1Beta1Feegrant.PeriodicAllowance, + ) + } + + if (isAllowedMsgAllowance(allowance)) { + return encodeAllowedMsgAllowance(allowance as AllowedMsgAllowance) + } + + throw new GeneralException( + new Error( + `Cannot cast allowance into 'BasicAllowance', 'PeriodicAllowance' or 'AllowedMsgAllowance': ${JSON.stringify( + allowance, + )}`, + ), + ) +} diff --git a/packages/sdk-ts/src/core/modules/feegrant/utils/index.ts b/packages/sdk-ts/src/core/modules/feegrant/utils/index.ts new file mode 100644 index 000000000..48a402756 --- /dev/null +++ b/packages/sdk-ts/src/core/modules/feegrant/utils/index.ts @@ -0,0 +1 @@ +export * from './allowance' diff --git a/packages/sdk-ts/src/core/modules/index.ts b/packages/sdk-ts/src/core/modules/index.ts index b88650c8e..e108a6fb6 100644 --- a/packages/sdk-ts/src/core/modules/index.ts +++ b/packages/sdk-ts/src/core/modules/index.ts @@ -12,3 +12,4 @@ export * from './tokenfactory' export * from './wasm' export * from './tx' export * from './msgs' +export * from './feegrant' diff --git a/packages/sdk-ts/src/core/modules/msgs.ts b/packages/sdk-ts/src/core/modules/msgs.ts index f61caccde..6928dc4cd 100644 --- a/packages/sdk-ts/src/core/modules/msgs.ts +++ b/packages/sdk-ts/src/core/modules/msgs.ts @@ -4,6 +4,8 @@ import MsgRevoke from './authz/msgs/MsgRevoke' import MsgAuthzExec from './authz/msgs/MsgExec' import MsgSend from './bank/msgs/MsgSend' import MsgMultiSend from './bank/msgs/MsgMultiSend' +import MsgGrantAllowance from './feegrant/msgs/MsgGrantAllowance' +import MsgRevokeAllowance from './feegrant/msgs/MsgRevokeAllowance' import MsgWithdrawDelegatorReward from './distribution/msgs/MsgWithdrawDelegatorReward' import MsgWithdrawValidatorCommission from './distribution/msgs/MsgWithdrawValidatorCommission' import MsgBatchCancelDerivativeOrders from './exchange/msgs/MsgBatchCancelDerivativeOrders' @@ -109,6 +111,8 @@ export type Msgs = | MsgChangeAdmin | MsgCreateDenom | MsgSetDenomMetadata + | MsgGrantAllowance + | MsgRevokeAllowance /** * @category Messages diff --git a/packages/sdk-ts/src/core/modules/tx/broadcaster/MsgBroadcasterLocal.ts b/packages/sdk-ts/src/core/modules/tx/broadcaster/MsgBroadcasterLocal.ts new file mode 100644 index 000000000..cc737cf3a --- /dev/null +++ b/packages/sdk-ts/src/core/modules/tx/broadcaster/MsgBroadcasterLocal.ts @@ -0,0 +1,322 @@ +import { BaseAccount, PrivateKey } from '../../../accounts' +import { Msgs } from '../../msgs' +import { createTransaction } from '../tx' +import { TxGrpcApi } from '../api/TxGrpcApi' +import { + ChainRestAuthApi, + ChainRestTendermintApi, +} from '../../../../client/chain/rest' +import { + getStdFee, + DEFAULT_STD_FEE, + BigNumberInBase, + DEFAULT_BLOCK_TIMEOUT_HEIGHT, +} from '@injectivelabs/utils' +import { GeneralException } from '@injectivelabs/exceptions' +import { ChainId, EthereumChainId } from '@injectivelabs/ts-types' +import { + Network, + getNetworkInfo, + getNetworkEndpoints, + NetworkEndpoints, +} from '@injectivelabs/networks' +import { getGasPriceBasedOnMessage } from '../../../../utils/msgs' +import { CreateTransactionArgs } from '../types' +import { IndexerGrpcTransactionApi } from '../../../../client' + +interface MsgBroadcasterTxOptions { + msgs: Msgs | Msgs[] + memo?: string + gas?: { + gasPrice?: string + gas?: number /** gas limit */ + feePayer?: string + granter?: string + } +} + +interface MsgBroadcasterLocalOptions { + network: Network + + /** + * Only used if we want to override the default + * endpoints taken from the network param + */ + endpoints?: { + indexer: string + grpc: string + rest: string + } + privateKey: string | PrivateKey /* hex or PrivateKey class */ + ethereumChainId?: EthereumChainId + simulateTx?: boolean +} + +/** + * This class is used to broadcast transactions + * using a privateKey as a signer + * for the transactions and broadcasting + * the transactions directly to the node + * + * Mainly used for working in a Node Environment + */ +export class MsgBroadcasterLocal { + public endpoints: NetworkEndpoints + + public chainId: ChainId + + public ethereumChainId?: EthereumChainId + + public privateKey: PrivateKey + + public simulateTx: boolean = false + + public baseAccount: BaseAccount | undefined = undefined + + public txCount: number = 0 + + constructor(options: MsgBroadcasterLocalOptions) { + const networkInfo = getNetworkInfo(options.network) + const endpoints = getNetworkEndpoints(options.network) + + this.simulateTx = options.simulateTx || false + this.chainId = networkInfo.chainId + this.ethereumChainId = + options.ethereumChainId || networkInfo.ethereumChainId + this.endpoints = { ...endpoints, ...(options.endpoints || {}) } + this.privateKey = + options.privateKey instanceof PrivateKey + ? options.privateKey + : PrivateKey.fromHex(options.privateKey) + } + + /** + * Broadcasting the transaction using the client + * + * @param tx + * @returns {string} transaction hash + */ + async broadcast(transaction: MsgBroadcasterTxOptions) { + const { chainId, privateKey, endpoints, txCount } = this + const msgs = Array.isArray(transaction.msgs) + ? transaction.msgs + : [transaction.msgs] + + const tx = { + ...transaction, + msgs, + } as MsgBroadcasterTxOptions + + /** Account Details * */ + const publicKey = privateKey.toPublicKey() + const accountDetails = await this.getAccountDetails() + + /** Block Details */ + const chainRestTendermintApi = new ChainRestTendermintApi(endpoints.rest) + const latestBlock = await chainRestTendermintApi.fetchLatestBlock() + const latestHeight = latestBlock.header.height + const timeoutHeight = new BigNumberInBase(latestHeight).plus( + DEFAULT_BLOCK_TIMEOUT_HEIGHT, + ) + + const gas = ( + transaction.gas?.gas || getGasPriceBasedOnMessage(msgs) + ).toString() + + /** Prepare the Transaction * */ + const { signBytes, txRaw } = await this.getTxWithStdFee({ + memo: tx.memo || '', + message: msgs, + fee: getStdFee({ ...tx.gas, gas }), + timeoutHeight: timeoutHeight.toNumber(), + pubKey: publicKey.toBase64(), + sequence: accountDetails.sequence + txCount, + accountNumber: accountDetails.accountNumber, + chainId: chainId, + }) + + /** Sign transaction */ + const signature = await privateKey.sign(Buffer.from(signBytes)) + + /** Append Signatures */ + txRaw.signatures = [signature] + + /** Broadcast transaction */ + const txResponse = await new TxGrpcApi(endpoints.grpc).broadcast(txRaw) + + if (txResponse.code !== 0) { + throw new GeneralException( + new Error( + `Transaction failed to be broadcasted - ${txResponse.rawLog}`, + ), + ) + } + + this.incrementTxCount() + + return txResponse + } + + /** + * Broadcasting the transaction with fee delegation services + * + * @param tx + * @returns {string} transaction hash + */ + async broadcastWithFeeDelegation(transaction: MsgBroadcasterTxOptions) { + const { simulateTx, privateKey, ethereumChainId, endpoints } = this + const msgs = Array.isArray(transaction.msgs) + ? transaction.msgs + : [transaction.msgs] + + const tx = { + ...transaction, + msgs, + } as MsgBroadcasterTxOptions & { ethereumAddress: string } + + const web3Msgs = msgs.map((msg) => msg.toWeb3()) + + if (!ethereumChainId) { + throw new GeneralException(new Error('Please provide ethereumChainId')) + } + + const transactionApi = new IndexerGrpcTransactionApi(endpoints.indexer) + const txResponse = await transactionApi.prepareTxRequest({ + memo: tx.memo, + message: web3Msgs, + address: tx.ethereumAddress, + chainId: ethereumChainId, + gasLimit: getGasPriceBasedOnMessage(msgs), + estimateGas: simulateTx || false, + }) + + const signature = await privateKey.signTypedData( + JSON.parse(txResponse.data), + ) + + const response = await transactionApi.broadcastTxRequest({ + txResponse, + message: web3Msgs, + chainId: ethereumChainId, + signature: `0x${Buffer.from(signature).toString('hex')}`, + }) + + return await new TxGrpcApi(endpoints.grpc).fetchTxPoll(response.txHash) + } + + /** + * Broadcasting the transaction using the client + * + * @param tx + * @returns {string} transaction hash + */ + async simulate(transaction: MsgBroadcasterTxOptions) { + const { privateKey, endpoints, chainId, txCount } = this + const msgs = Array.isArray(transaction.msgs) + ? transaction.msgs + : [transaction.msgs] + + const tx = { + ...transaction, + msgs, + } as MsgBroadcasterTxOptions + + /** Account Details * */ + const publicKey = privateKey.toPublicKey() + const accountDetails = await this.getAccountDetails() + + /** Block Details */ + const chainRestTendermintApi = new ChainRestTendermintApi(endpoints.rest) + const latestBlock = await chainRestTendermintApi.fetchLatestBlock() + const latestHeight = latestBlock.header.height + const timeoutHeight = new BigNumberInBase(latestHeight).plus( + DEFAULT_BLOCK_TIMEOUT_HEIGHT, + ) + + /** Prepare the Transaction * */ + const { txRaw } = createTransaction({ + memo: tx.memo || '', + fee: DEFAULT_STD_FEE, + message: tx.msgs as Msgs[], + timeoutHeight: timeoutHeight.toNumber(), + pubKey: publicKey.toBase64(), + sequence: accountDetails.sequence + txCount, + accountNumber: accountDetails.accountNumber, + chainId: chainId, + }) + + /** Append Blank Signatures */ + txRaw.signatures = [new Uint8Array(0)] + + /** Simulate transaction */ + const simulationResponse = await new TxGrpcApi(endpoints.grpc).simulate( + txRaw, + ) + + return simulationResponse + } + + /** + * In case we don't want to simulate the transaction + * we get the gas limit based on the message type. + * + * If we want to simulate the transaction we set the + * gas limit based on the simulation and add a small multiplier + * to be safe (factor of 1.1) + */ + private async getTxWithStdFee(args: CreateTransactionArgs) { + const { simulateTx } = this + + if (!simulateTx) { + return createTransaction(args) + } + + const result = await this.simulateTxRaw(args) + + if (!result.gasInfo?.gasUsed) { + return createTransaction(args) + } + + const stdGasFee = getStdFee({ + ...args.fee, + gas: new BigNumberInBase(result.gasInfo.gasUsed).times(1.1).toFixed(), + }) + + return createTransaction({ ...args, fee: stdGasFee }) + } + + /** + * Create TxRaw and simulate it + */ + private async simulateTxRaw(args: CreateTransactionArgs) { + const { endpoints } = this + const { txRaw } = createTransaction(args) + + txRaw.signatures = [new Uint8Array(0)] + + const simulationResponse = await new TxGrpcApi(endpoints.grpc).simulate( + txRaw, + ) + + return simulationResponse + } + + private async getAccountDetails() { + if (this.baseAccount) { + return this.baseAccount.toAccountDetails() + } + + const chainRestAuthApi = new ChainRestAuthApi(this.endpoints.rest) + const accountDetailsResponse = await chainRestAuthApi.fetchAccount( + this.privateKey.toBech32(), + ) + + this.baseAccount = BaseAccount.fromRestApi(accountDetailsResponse) + + return this.baseAccount.toAccountDetails() + } + + private async incrementTxCount() { + this.txCount += 1 + } +} diff --git a/packages/sdk-ts/src/core/modules/tx/broadcaster/MsgBroadcasterWithPk.spec.ts b/packages/sdk-ts/src/core/modules/tx/broadcaster/MsgBroadcasterWithPk.spec.ts index dd936db4e..fad28c62f 100644 --- a/packages/sdk-ts/src/core/modules/tx/broadcaster/MsgBroadcasterWithPk.spec.ts +++ b/packages/sdk-ts/src/core/modules/tx/broadcaster/MsgBroadcasterWithPk.spec.ts @@ -26,7 +26,7 @@ describe('MsgBroadcasterWithPk', () => { network, privateKey, simulateTx: true, - }).broadcast({ msgs: message, injectiveAddress }) + }).broadcast({ msgs: message }) expect(response.txHash).toBeDefined() }, 60000) @@ -53,7 +53,7 @@ describe('MsgBroadcasterWithPk', () => { privateKey, simulateTx: true, ethereumChainId: EthereumChainId.Goerli, - }).broadcastWithFeeDelegation({ msgs: message, injectiveAddress }) + }).broadcastWithFeeDelegation({ msgs: message }) expect(response.txHash).toBeDefined() }, 60000) diff --git a/packages/sdk-ts/src/core/modules/tx/broadcaster/MsgBroadcasterWithPk.ts b/packages/sdk-ts/src/core/modules/tx/broadcaster/MsgBroadcasterWithPk.ts index 3984b32fb..5a17a43ed 100644 --- a/packages/sdk-ts/src/core/modules/tx/broadcaster/MsgBroadcasterWithPk.ts +++ b/packages/sdk-ts/src/core/modules/tx/broadcaster/MsgBroadcasterWithPk.ts @@ -13,10 +13,6 @@ import { DEFAULT_BLOCK_TIMEOUT_HEIGHT, } from '@injectivelabs/utils' import { GeneralException } from '@injectivelabs/exceptions' -import { - getEthereumSignerAddress, - getInjectiveSignerAddress, -} from '../utils/helpers' import { ChainId, EthereumChainId } from '@injectivelabs/ts-types' import { Network, @@ -30,8 +26,6 @@ import { IndexerGrpcTransactionApi } from '../../../../client' interface MsgBroadcasterTxOptions { msgs: Msgs | Msgs[] - injectiveAddress: string - ethereumAddress?: string memo?: string gas?: { gasPrice?: string @@ -41,7 +35,7 @@ interface MsgBroadcasterTxOptions { } } -interface MsgBroadcasterOptionsWithPk { +interface MsgBroadcasterWithPkOptions { network: Network /** @@ -77,7 +71,7 @@ export class MsgBroadcasterWithPk { public simulateTx: boolean = false - constructor(options: MsgBroadcasterOptionsWithPk) { + constructor(options: MsgBroadcasterWithPkOptions) { const networkInfo = getNetworkInfo(options.network) const endpoints = getNetworkEndpoints(options.network) @@ -107,15 +101,13 @@ export class MsgBroadcasterWithPk { const tx = { ...transaction, msgs: msgs, - ethereumAddress: getEthereumSignerAddress(transaction.injectiveAddress), - injectiveAddress: getInjectiveSignerAddress(transaction.injectiveAddress), } as MsgBroadcasterTxOptions /** Account Details * */ const publicKey = privateKey.toPublicKey() const chainRestAuthApi = new ChainRestAuthApi(endpoints.rest) const accountDetailsResponse = await chainRestAuthApi.fetchAccount( - tx.injectiveAddress, + privateKey.toBech32(), ) const baseAccount = BaseAccount.fromRestApi(accountDetailsResponse) const accountDetails = baseAccount.toAccountDetails() @@ -179,8 +171,6 @@ export class MsgBroadcasterWithPk { const tx = { ...transaction, msgs: msgs, - ethereumAddress: getEthereumSignerAddress(transaction.injectiveAddress), - injectiveAddress: getInjectiveSignerAddress(transaction.injectiveAddress), } as MsgBroadcasterTxOptions & { ethereumAddress: string } const web3Msgs = msgs.map((msg) => msg.toWeb3()) @@ -226,15 +216,13 @@ export class MsgBroadcasterWithPk { msgs: Array.isArray(transaction.msgs) ? transaction.msgs : [transaction.msgs], - ethereumAddress: getEthereumSignerAddress(transaction.injectiveAddress), - injectiveAddress: getInjectiveSignerAddress(transaction.injectiveAddress), } as MsgBroadcasterTxOptions /** Account Details * */ const publicKey = privateKey.toPublicKey() const chainRestAuthApi = new ChainRestAuthApi(endpoints.rest) const accountDetailsResponse = await chainRestAuthApi.fetchAccount( - tx.injectiveAddress, + privateKey.toBech32(), ) const baseAccount = BaseAccount.fromRestApi(accountDetailsResponse) const accountDetails = baseAccount.toAccountDetails() diff --git a/packages/sdk-ts/src/core/modules/tx/broadcaster/index.ts b/packages/sdk-ts/src/core/modules/tx/broadcaster/index.ts index 49fe81b2f..b45892473 100644 --- a/packages/sdk-ts/src/core/modules/tx/broadcaster/index.ts +++ b/packages/sdk-ts/src/core/modules/tx/broadcaster/index.ts @@ -1 +1,2 @@ export * from './MsgBroadcasterWithPk' +export * from './MsgBroadcasterLocal' diff --git a/packages/sdk-ts/src/core/modules/tx/eip712/maps.ts b/packages/sdk-ts/src/core/modules/tx/eip712/maps.ts index 65a86b0d7..330f69325 100644 --- a/packages/sdk-ts/src/core/modules/tx/eip712/maps.ts +++ b/packages/sdk-ts/src/core/modules/tx/eip712/maps.ts @@ -629,6 +629,12 @@ export const protoTypeToAminoType = (type: string): string => { case 'ibc.applications.transfer.v1.MsgTransfer': return 'cosmos-sdk/MsgTransfer' + // feegrant + case 'cosmos.feegrant.v1beta1.MsgGrantAllowance': + return 'cosmos-sdk/MsgGrantAllowance' + case 'cosmos.feegrant.v1beta1.MsgRevokeAllowance': + return 'cosmos-sdk/MsgRevokeAllowance' + default: throw new GeneralException(new Error('Unknown message type: ' + type)) } diff --git a/packages/sdk-ts/src/core/modules/wasm/exec-args.ts b/packages/sdk-ts/src/core/modules/wasm/exec-args.ts index d7edd8659..38448dcb3 100644 --- a/packages/sdk-ts/src/core/modules/wasm/exec-args.ts +++ b/packages/sdk-ts/src/core/modules/wasm/exec-args.ts @@ -1,26 +1,15 @@ -import ExecArgUnStake from './exec-args/ExecArgUnstake' -import ExecArgGeneric from './exec-args/ExecArgGeneric' import ExecArgCW20Send from './exec-args/ExecArgCW20Send' import ExecArgSubmitVaa from './exec-args/ExecArgSubmitVaa' -import ExecArgClaimStake from './exec-args/ExecArgClaimStake' -import ExecArgClaimRewards from './exec-args/ExecArgClaimRewards' import ExecArgCW20Transfer from './exec-args/ExecArgCW20Transfer' import ExecArgDepositTokens from './exec-args/ExecArgDepositTokens' -import ExecArgRegisterVault from './exec-args/ExecArgRegisterVault' import ExecArgSwapMinOutput from './exec-args/ExecArgSwapMinOutput' import ExecArgSwapExactOutput from './exec-args/ExecArgSwapExactOutput' import ExecArgInitiateTransfer from './exec-args/ExecArgInitiateTransfer' import ExecArgIncreaseAllowance from './exec-args/ExecArgIncreaseAllowance' import ExecArgRemoveGridStrategy from './exec-args/ExecArgRemoveGridStrategy' -import ExecArgUpdateAMMVaultConfig from './exec-args/ExecArgUpdateAMMVaultConfig' -import ExecArgUpdateSpotVaultConfig from './exec-args/ExecArgUpdateSpotVaultConfig' import ExecArgCreateSpotGridStrategy from './exec-args/ExecArgCreateSpotGridStrategy' -import ExecArgUpdateOffChainVaultConfig from './exec-args/ExecArgUpdateOffChainVaultConfig' -import ExecArgUpdateDerivativeVaultConfig from './exec-args/ExecArgUpdateDerivativeVaultConfig' -import ExecArgUpdateStakingContractConfig from './exec-args/ExecArgUpdateStakingContractConfig' import ExecArgCW20AdapterRedeemAndTransfer from './exec-args/ExecArgCW20AdapterRedeemAndTransfer' -import ExecArgUpdateAllocatorContractConfig from './exec-args/ExecArgUpdateAllocatorContractConfig' import ExecPrivilegedArgVaultRedeem from './exec-priv-args/ExecPrivilegedArgVaultRedeem' import ExecPrivilegedArgVaultSubscribe from './exec-priv-args/ExecPrivilegedArgVaultSubscribe' @@ -28,28 +17,17 @@ import ExecPrivilegedArgOffChainVaultRedeem from './exec-priv-args/ExecPrivilege import ExecPrivilegedArgOffChainVaultSubscribe from './exec-priv-args/ExecPrivilegedArgOffChainVaultSubscribe' export type ExecArgs = - | ExecArgGeneric - | ExecArgUnStake | ExecArgCW20Send | ExecArgSubmitVaa - | ExecArgClaimStake - | ExecArgClaimRewards | ExecArgCW20Transfer | ExecArgSwapMinOutput | ExecArgDepositTokens - | ExecArgRegisterVault | ExecArgCreateSpotGridStrategy | ExecArgRemoveGridStrategy | ExecArgSwapExactOutput | ExecArgInitiateTransfer | ExecArgIncreaseAllowance - | ExecArgUpdateAMMVaultConfig - | ExecArgUpdateSpotVaultConfig - | ExecArgUpdateOffChainVaultConfig - | ExecArgUpdateDerivativeVaultConfig - | ExecArgUpdateStakingContractConfig | ExecArgCW20AdapterRedeemAndTransfer - | ExecArgUpdateAllocatorContractConfig export type ExecPrivilegedArgs = | ExecPrivilegedArgVaultRedeem diff --git a/packages/sdk-ts/src/core/modules/wasm/exec-args/ExecArgClaimRewards.ts b/packages/sdk-ts/src/core/modules/wasm/exec-args/ExecArgClaimRewards.ts deleted file mode 100644 index 5d38737a6..000000000 --- a/packages/sdk-ts/src/core/modules/wasm/exec-args/ExecArgClaimRewards.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { - dataToExecData, - ExecArgBase, - ExecDataRepresentation, -} from '../ExecArgBase' - -export declare namespace ExecArgClaimRewards { - export interface Params { - lpToken: string - } - - export interface Data { - lp_token: string - } -} - -/** - * @category Contract Exec Arguments - */ -export default class ExecArgClaimRewards extends ExecArgBase< - ExecArgClaimRewards.Params, - ExecArgClaimRewards.Data -> { - static fromJSON(params: ExecArgClaimRewards.Params): ExecArgClaimRewards { - return new ExecArgClaimRewards(params) - } - - toData(): ExecArgClaimRewards.Data { - const { params } = this - - return { - lp_token: params.lpToken, - } - } - - toExecData(): ExecDataRepresentation { - return dataToExecData('claim_rewards', this.toData()) - } -} diff --git a/packages/sdk-ts/src/core/modules/wasm/exec-args/ExecArgClaimStake.ts b/packages/sdk-ts/src/core/modules/wasm/exec-args/ExecArgClaimStake.ts deleted file mode 100644 index 1e3bcce4a..000000000 --- a/packages/sdk-ts/src/core/modules/wasm/exec-args/ExecArgClaimStake.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { - dataToExecData, - ExecArgBase, - ExecDataRepresentation, -} from '../ExecArgBase' - -export declare namespace ExecArgClaimStake { - export interface Params { - lpToken: string - } - - export interface Data { - lp_token: string - } -} - -/** - * @category Contract Exec Arguments - */ -export default class ExecArgClaimStake extends ExecArgBase< - ExecArgClaimStake.Params, - ExecArgClaimStake.Data -> { - static fromJSON(params: ExecArgClaimStake.Params): ExecArgClaimStake { - return new ExecArgClaimStake(params) - } - - toData(): ExecArgClaimStake.Data { - const { params } = this - - return { - lp_token: params.lpToken, - } - } - - toExecData(): ExecDataRepresentation { - return dataToExecData('claim_stake', this.toData()) - } -} diff --git a/packages/sdk-ts/src/core/modules/wasm/exec-args/ExecArgGeneric.ts b/packages/sdk-ts/src/core/modules/wasm/exec-args/ExecArgGeneric.ts deleted file mode 100644 index 832b819a6..000000000 --- a/packages/sdk-ts/src/core/modules/wasm/exec-args/ExecArgGeneric.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { - dataToExecData, - ExecArgBase, - ExecDataRepresentation, -} from '../ExecArgBase' - -/** - * @category Contract Exec Arguments for messages that do not require any additional params - */ -export declare namespace ExecArgGeneric { - export interface Params { - name: string - } - - export interface Data {} -} - -export default class ExecArgGeneric extends ExecArgBase< - ExecArgGeneric.Params, - ExecArgGeneric.Data -> { - static fromJSON(params: ExecArgGeneric.Params): ExecArgGeneric { - return new ExecArgGeneric(params) - } - - toData(): ExecArgGeneric.Data { - return {} - } - - toExecData(): ExecDataRepresentation { - const { params } = this - - return dataToExecData(params.name, this.toData()) - } -} diff --git a/packages/sdk-ts/src/core/modules/wasm/exec-args/ExecArgRegisterVault.ts b/packages/sdk-ts/src/core/modules/wasm/exec-args/ExecArgRegisterVault.ts deleted file mode 100644 index ce5d3662b..000000000 --- a/packages/sdk-ts/src/core/modules/wasm/exec-args/ExecArgRegisterVault.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { - dataToExecData, - ExecArgBase, - ExecDataRepresentation, -} from '../ExecArgBase' - -export declare namespace ExecArgRegisterVault { - export interface Params { - vaultCodeId: number - vaultLabel: string - instantiateVaultMsg: Record - } - - export interface Data { - vault_code_id: number - vault_label: string - instantiate_vault_msg: Record - } -} - -/** - * @category Contract Exec Arguments - */ -export default class ExecArgRegisterVault extends ExecArgBase< - ExecArgRegisterVault.Params, - ExecArgRegisterVault.Data -> { - static fromJSON(params: ExecArgRegisterVault.Params): ExecArgRegisterVault { - return new ExecArgRegisterVault(params) - } - - toData(): ExecArgRegisterVault.Data { - const { params } = this - - return { - vault_code_id: params.vaultCodeId, - vault_label: params.vaultLabel, - instantiate_vault_msg: params.instantiateVaultMsg, - } - } - - toExecData(): ExecDataRepresentation { - return dataToExecData('register_vault', this.toData()) - } -} diff --git a/packages/sdk-ts/src/core/modules/wasm/exec-args/ExecArgUnstake.ts b/packages/sdk-ts/src/core/modules/wasm/exec-args/ExecArgUnstake.ts deleted file mode 100644 index a81f2f678..000000000 --- a/packages/sdk-ts/src/core/modules/wasm/exec-args/ExecArgUnstake.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { - dataToExecData, - ExecArgBase, - ExecDataRepresentation, -} from '../ExecArgBase' - -export declare namespace ExecArgUnStake { - export interface Params { - denom: string - amount: string - } - - export interface Data { - coin: { - denom: string - amount: string - } - } -} - -/** - * @category Contract Exec Arguments - */ -export default class ExecArgUnStake extends ExecArgBase< - ExecArgUnStake.Params, - ExecArgUnStake.Data -> { - static fromJSON(params: ExecArgUnStake.Params): ExecArgUnStake { - return new ExecArgUnStake(params) - } - - toData(): ExecArgUnStake.Data { - const { params } = this - - return { - coin: { - denom: params.denom, - amount: params.amount, - }, - } - } - - toExecData(): ExecDataRepresentation { - return dataToExecData('unstake', this.toData()) - } -} diff --git a/packages/sdk-ts/src/core/modules/wasm/exec-args/ExecArgUpdateAMMVaultConfig.ts b/packages/sdk-ts/src/core/modules/wasm/exec-args/ExecArgUpdateAMMVaultConfig.ts deleted file mode 100644 index 799842cd6..000000000 --- a/packages/sdk-ts/src/core/modules/wasm/exec-args/ExecArgUpdateAMMVaultConfig.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { - dataToExecData, - ExecArgBase, - ExecDataRepresentation, -} from '../ExecArgBase' - -export declare namespace ExecArgUpdateAMMVaultConfig { - export interface Params { - marketId: string - orderDensity: number - maxInvariantSensitivity: string - priceTickSize: string - notionalValueCap: string - } - - export interface Data { - market_id: string - order_density: number - max_invariant_sensitivity: string - price_tick_size: string - notional_value_cap: string - } -} - -/** - * @category Contract Exec Arguments - */ -export default class ExecArgUpdateAMMVaultConfig extends ExecArgBase< - ExecArgUpdateAMMVaultConfig.Params, - ExecArgUpdateAMMVaultConfig.Data -> { - static fromJSON( - params: ExecArgUpdateAMMVaultConfig.Params, - ): ExecArgUpdateAMMVaultConfig { - return new ExecArgUpdateAMMVaultConfig(params) - } - - toData(): ExecArgUpdateAMMVaultConfig.Data { - const { params } = this - - return { - market_id: params.marketId, - order_density: params.orderDensity, - max_invariant_sensitivity: params.maxInvariantSensitivity, - price_tick_size: params.priceTickSize, - notional_value_cap: params.notionalValueCap, - } - } - - toExecData(): ExecDataRepresentation { - return dataToExecData('update_vault_config', this.toData()) - } -} diff --git a/packages/sdk-ts/src/core/modules/wasm/exec-args/ExecArgUpdateAllocatorContractConfig.ts b/packages/sdk-ts/src/core/modules/wasm/exec-args/ExecArgUpdateAllocatorContractConfig.ts deleted file mode 100644 index d493907fa..000000000 --- a/packages/sdk-ts/src/core/modules/wasm/exec-args/ExecArgUpdateAllocatorContractConfig.ts +++ /dev/null @@ -1,62 +0,0 @@ -import { - dataToExecData, - ExecArgBase, - ExecDataRepresentation, -} from '../ExecArgBase' - -export declare namespace ExecArgUpdateAllocatorContractConfig { - export interface Params { - owner?: string - stakingContractAddress?: string - maxRewardDenomsPerGauge?: string - minGaugeDurationInSeconds?: string - maxActiveGaugesPerLpToken?: string - gaugeAllocationFee?: { - denom: string - amount: string - } - } - - export interface Data { - owner?: string - staking_contract_address?: string - max_reward_denoms_per_gauge?: string - min_gauge_duration_in_seconds?: string - max_active_gauges_per_lp_token?: string - gauge_allocation_fee?: { - denom: string - amount: string - } - } -} - -/** - * @category Contract Exec Arguments - */ -export default class ExecArgUpdateAllocatorContractConfig extends ExecArgBase< - ExecArgUpdateAllocatorContractConfig.Params, - ExecArgUpdateAllocatorContractConfig.Data -> { - static fromJSON( - params: ExecArgUpdateAllocatorContractConfig.Params, - ): ExecArgUpdateAllocatorContractConfig { - return new ExecArgUpdateAllocatorContractConfig(params) - } - - toData(): ExecArgUpdateAllocatorContractConfig.Data { - const { params } = this - - return { - owner: params.owner, - staking_contract_address: params.stakingContractAddress, - max_reward_denoms_per_gauge: params.maxRewardDenomsPerGauge, - min_gauge_duration_in_seconds: params.minGaugeDurationInSeconds, - max_active_gauges_per_lp_token: params.maxActiveGaugesPerLpToken, - gauge_allocation_fee: params.gaugeAllocationFee, - } - } - - toExecData(): ExecDataRepresentation { - return dataToExecData('update_config', this.toData()) - } -} diff --git a/packages/sdk-ts/src/core/modules/wasm/exec-args/ExecArgUpdateDerivativeVaultConfig.ts b/packages/sdk-ts/src/core/modules/wasm/exec-args/ExecArgUpdateDerivativeVaultConfig.ts deleted file mode 100644 index 4dc0cdbe0..000000000 --- a/packages/sdk-ts/src/core/modules/wasm/exec-args/ExecArgUpdateDerivativeVaultConfig.ts +++ /dev/null @@ -1,104 +0,0 @@ -import { - dataToExecData, - ExecArgBase, - ExecDataRepresentation, -} from '../ExecArgBase' - -export declare namespace ExecArgUpdateDerivativeVaultConfig { - export interface Params { - marketId: string - leverage: string - orderDensity: number - signedMinHeadToFairPriceDeviationRatio: string - signedMinHeadToTobDeviationRatio: string - reservationPriceSensitivityRatio: string - reservationSpreadSensitivityRatio: string - maxActiveCapitalUtilizationRatio: string - headChangeToleranceRatio: string - headToTailDeviationRatio: string - minProximityToLiquidation: string - minOracleVolatilitySampleSize: number - emergencyOracleVolatilitySampleSize: number - defaultMidPriceVolatilityRatio: string - minVolatilityRatio: string - lastValidMarkPrice: string - allowedRedemptionTypes: number - notionalValueCap: string - oracleStaleTime: number - oracleVolatilityMaxAge: number - } - - export interface Data { - market_id: string - leverage: string - order_density: number - signed_min_head_to_fair_price_deviation_ratio: string - signed_min_head_to_tob_deviation_ratio: string - reservation_price_sensitivity_ratio: string - reservation_spread_sensitivity_ratio: string - max_active_capital_utilization_ratio: string - head_change_tolerance_ratio: string - head_to_tail_deviation_ratio: string - min_proximity_to_liquidation: string - min_oracle_volatility_sample_size: number - emergency_oracle_volatility_sample_size: number - default_mid_price_volatility_ratio: string - min_volatility_ratio: string - last_valid_mark_price: string - allowed_redemption_types: number - notional_value_cap: string - oracle_stale_time: number - oracle_volatility_max_age: number - } -} - -/** - * @category Contract Exec Arguments - */ -export default class ExecArgUpdateDerivativeVaultConfig extends ExecArgBase< - ExecArgUpdateDerivativeVaultConfig.Params, - ExecArgUpdateDerivativeVaultConfig.Data -> { - static fromJSON( - params: ExecArgUpdateDerivativeVaultConfig.Params, - ): ExecArgUpdateDerivativeVaultConfig { - return new ExecArgUpdateDerivativeVaultConfig(params) - } - - toData(): ExecArgUpdateDerivativeVaultConfig.Data { - const { params } = this - - return { - market_id: params.marketId, - leverage: params.leverage, - order_density: params.orderDensity, - signed_min_head_to_fair_price_deviation_ratio: - params.signedMinHeadToFairPriceDeviationRatio, - signed_min_head_to_tob_deviation_ratio: - params.signedMinHeadToTobDeviationRatio, - reservation_price_sensitivity_ratio: - params.reservationPriceSensitivityRatio, - reservation_spread_sensitivity_ratio: - params.reservationSpreadSensitivityRatio, - max_active_capital_utilization_ratio: - params.maxActiveCapitalUtilizationRatio, - head_change_tolerance_ratio: params.headChangeToleranceRatio, - head_to_tail_deviation_ratio: params.headToTailDeviationRatio, - min_proximity_to_liquidation: params.minProximityToLiquidation, - min_oracle_volatility_sample_size: params.minOracleVolatilitySampleSize, - emergency_oracle_volatility_sample_size: - params.emergencyOracleVolatilitySampleSize, - default_mid_price_volatility_ratio: params.defaultMidPriceVolatilityRatio, - min_volatility_ratio: params.minVolatilityRatio, - last_valid_mark_price: params.lastValidMarkPrice, - allowed_redemption_types: params.allowedRedemptionTypes, - notional_value_cap: params.notionalValueCap, - oracle_stale_time: params.oracleStaleTime, - oracle_volatility_max_age: params.oracleVolatilityMaxAge, - } - } - - toExecData(): ExecDataRepresentation { - return dataToExecData('update_vault_config', this.toData()) - } -} diff --git a/packages/sdk-ts/src/core/modules/wasm/exec-args/ExecArgUpdateOffChainVaultConfig.ts b/packages/sdk-ts/src/core/modules/wasm/exec-args/ExecArgUpdateOffChainVaultConfig.ts deleted file mode 100644 index 58b4f6ab4..000000000 --- a/packages/sdk-ts/src/core/modules/wasm/exec-args/ExecArgUpdateOffChainVaultConfig.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { - dataToExecData, - ExecArgBase, - ExecDataRepresentation, -} from '../ExecArgBase' - -export declare namespace ExecArgUpdateOffChainVaultConfig { - export interface Params { - oracleStaleTime: number - notionalValueCap: string - vaultType: Record - } - - export interface Data { - oracle_stale_time: number - notional_value_cap: string - vault_type: Record - } -} - -/** - * @category Contract Exec Arguments - */ -export default class ExecArgUpdateOffChainVaultConfig extends ExecArgBase< - ExecArgUpdateOffChainVaultConfig.Params, - ExecArgUpdateOffChainVaultConfig.Data -> { - static fromJSON( - params: ExecArgUpdateOffChainVaultConfig.Params, - ): ExecArgUpdateOffChainVaultConfig { - return new ExecArgUpdateOffChainVaultConfig(params) - } - - toData(): ExecArgUpdateOffChainVaultConfig.Data { - const { params } = this - - return { - oracle_stale_time: params.oracleStaleTime, - notional_value_cap: params.notionalValueCap, - vault_type: params.vaultType, - } - } - - toExecData(): ExecDataRepresentation { - return dataToExecData('update_vault_config', this.toData()) - } -} diff --git a/packages/sdk-ts/src/core/modules/wasm/exec-args/ExecArgUpdateSpotVaultConfig.ts b/packages/sdk-ts/src/core/modules/wasm/exec-args/ExecArgUpdateSpotVaultConfig.ts deleted file mode 100644 index 1b6f8b7f5..000000000 --- a/packages/sdk-ts/src/core/modules/wasm/exec-args/ExecArgUpdateSpotVaultConfig.ts +++ /dev/null @@ -1,104 +0,0 @@ -import { - dataToExecData, - ExecArgBase, - ExecDataRepresentation, -} from '../ExecArgBase' - -export declare namespace ExecArgUpdateSpotVaultConfig { - export interface Params { - marketId: string - orderDensity: number - reservationPriceSensitivityRatio: string - reservationSpreadSensitivityRatio: string - maxActiveCapitalUtilizationRatio: string - headChangeToleranceRatio: string - headToTailDeviationRatio: string - signedMinHeadToFairPriceDeviationRatio: string - signedMinHeadToTobDeviationRatio: string - targetBaseWeight: string - oracleType: number - defaultMidPriceVolatilityRatio: string - allowedRedemptionTypes: number - notionalValueCap: string - oracleStaleTime: number - lastValidMarkPrice: string - minOracleVolatilitySampleSize: number - emergencyOracleVolatilitySampleSize: number - minVolatilityRatio: string - oracleVolatilityMaxAge: number - } - - export interface Data { - market_id: string - order_density: number - reservation_price_sensitivity_ratio: string - reservation_spread_sensitivity_ratio: string - max_active_capital_utilization_ratio: string - head_change_tolerance_ratio: string - head_to_tail_deviation_ratio: string - signed_min_head_to_fair_price_deviation_ratio: string - signed_min_head_to_tob_deviation_ratio: string - target_base_weight: string - oracle_type: number - default_mid_price_volatility_ratio: string - allowed_redemption_types: number - notional_value_cap: string - oracle_stale_time: number - last_valid_mark_price: string - min_oracle_volatility_sample_size: number - emergency_oracle_volatility_sample_size: number - min_volatility_ratio: string - oracle_volatility_max_age: number - } -} - -/** - * @category Contract Exec Arguments - */ -export default class ExecArgUpdateSpotVaultConfig extends ExecArgBase< - ExecArgUpdateSpotVaultConfig.Params, - ExecArgUpdateSpotVaultConfig.Data -> { - static fromJSON( - params: ExecArgUpdateSpotVaultConfig.Params, - ): ExecArgUpdateSpotVaultConfig { - return new ExecArgUpdateSpotVaultConfig(params) - } - - toData(): ExecArgUpdateSpotVaultConfig.Data { - const { params } = this - - return { - market_id: params.marketId, - order_density: params.orderDensity, - reservation_price_sensitivity_ratio: - params.reservationPriceSensitivityRatio, - reservation_spread_sensitivity_ratio: - params.reservationSpreadSensitivityRatio, - max_active_capital_utilization_ratio: - params.maxActiveCapitalUtilizationRatio, - head_change_tolerance_ratio: params.headChangeToleranceRatio, - head_to_tail_deviation_ratio: params.headToTailDeviationRatio, - signed_min_head_to_fair_price_deviation_ratio: - params.signedMinHeadToFairPriceDeviationRatio, - signed_min_head_to_tob_deviation_ratio: - params.signedMinHeadToTobDeviationRatio, - target_base_weight: params.targetBaseWeight, - oracle_type: params.oracleType, - default_mid_price_volatility_ratio: params.defaultMidPriceVolatilityRatio, - allowed_redemption_types: params.allowedRedemptionTypes, - notional_value_cap: params.notionalValueCap, - oracle_stale_time: params.oracleStaleTime, - last_valid_mark_price: params.lastValidMarkPrice, - min_oracle_volatility_sample_size: params.minOracleVolatilitySampleSize, - emergency_oracle_volatility_sample_size: - params.emergencyOracleVolatilitySampleSize, - min_volatility_ratio: params.minVolatilityRatio, - oracle_volatility_max_age: params.oracleVolatilityMaxAge, - } - } - - toExecData(): ExecDataRepresentation { - return dataToExecData('update_vault_config', this.toData()) - } -} diff --git a/packages/sdk-ts/src/core/modules/wasm/exec-args/ExecArgUpdateStakingContractConfig.ts b/packages/sdk-ts/src/core/modules/wasm/exec-args/ExecArgUpdateStakingContractConfig.ts deleted file mode 100644 index b74314aa0..000000000 --- a/packages/sdk-ts/src/core/modules/wasm/exec-args/ExecArgUpdateStakingContractConfig.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { - dataToExecData, - ExecArgBase, - ExecDataRepresentation, -} from '../ExecArgBase' - -export declare namespace ExecArgUpdateStakingContractConfig { - export interface Params { - owner: string - lockupPeriod?: string - allocatorContractAddress: string - } - - export interface Data { - owner: string - lockup_period?: string - allocator_contract_address: string - } -} - -/** - * @category Contract Exec Arguments - */ -export default class ExecArgUpdateStakingContractConfig extends ExecArgBase< - ExecArgUpdateStakingContractConfig.Params, - ExecArgUpdateStakingContractConfig.Data -> { - static fromJSON( - params: ExecArgUpdateStakingContractConfig.Params, - ): ExecArgUpdateStakingContractConfig { - return new ExecArgUpdateStakingContractConfig(params) - } - - toData(): ExecArgUpdateStakingContractConfig.Data { - const { params } = this - - return { - owner: params.owner, - lockup_period: params.lockupPeriod, - allocator_contract_address: params.allocatorContractAddress, - } - } - - toExecData(): ExecDataRepresentation { - return dataToExecData('update_config', this.toData()) - } -} diff --git a/packages/sdk-ts/src/core/modules/wasm/index.ts b/packages/sdk-ts/src/core/modules/wasm/index.ts index f76aef96e..9eeacc0a5 100644 --- a/packages/sdk-ts/src/core/modules/wasm/index.ts +++ b/packages/sdk-ts/src/core/modules/wasm/index.ts @@ -1,25 +1,14 @@ -import ExecArgGeneric from './exec-args/ExecArgGeneric' -import ExecArgUnStake from './exec-args/ExecArgUnstake' import ExecArgCW20Send from './exec-args/ExecArgCW20Send' import ExecArgSubmitVaa from './exec-args/ExecArgSubmitVaa' -import ExecArgClaimStake from './exec-args/ExecArgClaimStake' -import ExecArgClaimRewards from './exec-args/ExecArgClaimRewards' import ExecArgCW20Transfer from './exec-args/ExecArgCW20Transfer' import ExecArgSwapMinOutput from './exec-args/ExecArgSwapMinOutput' import ExecArgDepositTokens from './exec-args/ExecArgDepositTokens' -import ExecArgRegisterVault from './exec-args/ExecArgRegisterVault' import ExecArgSwapExactOutput from './exec-args/ExecArgSwapExactOutput' import ExecArgInitiateTransfer from './exec-args/ExecArgInitiateTransfer' import ExecArgIncreaseAllowance from './exec-args/ExecArgIncreaseAllowance' import ExecArgRemoveGridStrategy from './exec-args/ExecArgRemoveGridStrategy' -import ExecArgUpdateAMMVaultConfig from './exec-args/ExecArgUpdateAMMVaultConfig' -import ExecArgUpdateSpotVaultConfig from './exec-args/ExecArgUpdateSpotVaultConfig' import ExecArgCreateSpotGridStrategy from './exec-args/ExecArgCreateSpotGridStrategy' -import ExecArgUpdateOffChainVaultConfig from './exec-args/ExecArgUpdateOffChainVaultConfig' -import ExecArgUpdateDerivativeVaultConfig from './exec-args/ExecArgUpdateDerivativeVaultConfig' -import ExecArgUpdateStakingContractConfig from './exec-args/ExecArgUpdateStakingContractConfig' import ExecArgCW20AdapterRedeemAndTransfer from './exec-args/ExecArgCW20AdapterRedeemAndTransfer' -import ExecArgUpdateAllocatorContractConfig from './exec-args/ExecArgUpdateAllocatorContractConfig' import MsgStoreCode from './msgs/MsgStoreCode' import MsgUpdateAdmin from './msgs/MsgUpdateAdmin' @@ -37,28 +26,17 @@ import ExecPrivilegedArgOffChainVaultSubscribe from './exec-priv-args/ExecPrivil export * from './exec-args' export { - ExecArgGeneric, - ExecArgUnStake, ExecArgCW20Send, ExecArgSubmitVaa, - ExecArgClaimStake, - ExecArgClaimRewards, ExecArgCW20Transfer, ExecArgSwapMinOutput, ExecArgDepositTokens, - ExecArgRegisterVault, ExecArgSwapExactOutput, ExecArgInitiateTransfer, ExecArgIncreaseAllowance, ExecArgRemoveGridStrategy, - ExecArgUpdateAMMVaultConfig, - ExecArgUpdateSpotVaultConfig, ExecArgCreateSpotGridStrategy, - ExecArgUpdateOffChainVaultConfig, - ExecArgUpdateDerivativeVaultConfig, - ExecArgUpdateStakingContractConfig, ExecArgCW20AdapterRedeemAndTransfer, - ExecArgUpdateAllocatorContractConfig, // MsgStoreCode, MsgUpdateAdmin, diff --git a/packages/sdk-ts/src/core/modules/wasm/msgs/MsgExecuteContractCompat.ts b/packages/sdk-ts/src/core/modules/wasm/msgs/MsgExecuteContractCompat.ts index 24d059c8b..e2208e6fa 100644 --- a/packages/sdk-ts/src/core/modules/wasm/msgs/MsgExecuteContractCompat.ts +++ b/packages/sdk-ts/src/core/modules/wasm/msgs/MsgExecuteContractCompat.ts @@ -18,20 +18,38 @@ export declare namespace MsgExecuteContractCompat { }[] sender: string contractAddress: string + /* Used to provide type safety for execution messages */ execArgs?: ExecArgs - /* Pass any arbitrary message object to execute */ + /* + * Pass any arbitrary message object to execute + * example: + exec: { + action: "transfer", + msg: { + recipient: recipientAddress, + amount: 100000, + }, + }, + */ exec?: { - msg: object + msg: Record action: string } + /** * Same as exec but you don't pass * the action as a separate property * but as a whole object + * example: + msg: { + reset: { + count: 10 + }, + }, */ - msg?: object + msg?: Record } export type Proto = InjectiveWasmxV1Beta1Tx.MsgExecuteContractCompat diff --git a/packages/sdk-ts/src/utils/address.ts b/packages/sdk-ts/src/utils/address.ts index c036ee9d8..1cb2a011c 100644 --- a/packages/sdk-ts/src/utils/address.ts +++ b/packages/sdk-ts/src/utils/address.ts @@ -100,3 +100,6 @@ export const getChecksumAddress = (ethAddress: string) => { return checksumAddress } + +export const isCw20ContractAddress = (address: string) => + address.length === 42 && address.startsWith('inj') diff --git a/packages/sdk-ts/src/utils/constants.ts b/packages/sdk-ts/src/utils/constants.ts index aa8c1c284..171cafaad 100644 --- a/packages/sdk-ts/src/utils/constants.ts +++ b/packages/sdk-ts/src/utils/constants.ts @@ -19,6 +19,7 @@ export const CW20_ADAPTER_CONTRACT_BY_NETWORK = { [Network.Mainnet]: 'inj14ejqjyq8um4p3xfqj74yld5waqljf88f9eneuk', [Network.MainnetLB]: 'inj14ejqjyq8um4p3xfqj74yld5waqljf88f9eneuk', [Network.MainnetK8s]: 'inj14ejqjyq8um4p3xfqj74yld5waqljf88f9eneuk', + [Network.MainnetSentry]: 'inj14ejqjyq8um4p3xfqj74yld5waqljf88f9eneuk', [Network.Public]: 'inj14ejqjyq8um4p3xfqj74yld5waqljf88f9eneuk', [Network.Staging]: 'inj14ejqjyq8um4p3xfqj74yld5waqljf88f9eneuk', [Network.Internal]: 'inj14ejqjyq8um4p3xfqj74yld5waqljf88f9eneuk', @@ -36,6 +37,7 @@ export const CW20_SWAP_CONTRACT_BY_NETWORK = { [Network.Mainnet]: 'inj1psk3468yr9teahgz73amwvpfjehnhczvkrhhqx', [Network.MainnetLB]: 'inj1psk3468yr9teahgz73amwvpfjehnhczvkrhhqx', [Network.MainnetK8s]: 'inj1psk3468yr9teahgz73amwvpfjehnhczvkrhhqx', + [Network.MainnetSentry]: 'inj1psk3468yr9teahgz73amwvpfjehnhczvkrhhqx', [Network.Public]: 'inj1psk3468yr9teahgz73amwvpfjehnhczvkrhhqx', [Network.Staging]: 'inj1psk3468yr9teahgz73amwvpfjehnhczvkrhhqx', [Network.Internal]: 'inj1psk3468yr9teahgz73amwvpfjehnhczvkrhhqx', @@ -53,6 +55,7 @@ export const INJ_NAME_REGISTRY_CONTRACT_BY_NETWORK = { [Network.Mainnet]: 'inj1hm8vs8sr2h9nk0x66vctfs528wrp6k3gtgg275', [Network.MainnetLB]: 'inj1hm8vs8sr2h9nk0x66vctfs528wrp6k3gtgg275', [Network.MainnetK8s]: 'inj1hm8vs8sr2h9nk0x66vctfs528wrp6k3gtgg275', + [Network.MainnetSentry]: 'inj1hm8vs8sr2h9nk0x66vctfs528wrp6k3gtgg275', [Network.Public]: 'inj1hm8vs8sr2h9nk0x66vctfs528wrp6k3gtgg275', [Network.Staging]: 'inj1hm8vs8sr2h9nk0x66vctfs528wrp6k3gtgg275', [Network.Internal]: 'inj1hm8vs8sr2h9nk0x66vctfs528wrp6k3gtgg275', @@ -70,6 +73,7 @@ export const INJ_NAME_REVERSE_RESOLVER_CONTRACT_BY_NETWORK = { [Network.Mainnet]: 'inj1x9m0hceug9qylcyrrtwqtytslv2jrph433thgu', [Network.MainnetLB]: 'inj1x9m0hceug9qylcyrrtwqtytslv2jrph433thgu', [Network.MainnetK8s]: 'inj1x9m0hceug9qylcyrrtwqtytslv2jrph433thgu', + [Network.MainnetSentry]: 'inj1x9m0hceug9qylcyrrtwqtytslv2jrph433thgu', [Network.Public]: 'inj1x9m0hceug9qylcyrrtwqtytslv2jrph433thgu', [Network.Staging]: 'inj1x9m0hceug9qylcyrrtwqtytslv2jrph433thgu', [Network.Internal]: 'inj1x9m0hceug9qylcyrrtwqtytslv2jrph433thgu', diff --git a/packages/sdk-ui-ts/CHANGELOG.md b/packages/sdk-ui-ts/CHANGELOG.md index 413c13952..2bfb6e20d 100644 --- a/packages/sdk-ui-ts/CHANGELOG.md +++ b/packages/sdk-ui-ts/CHANGELOG.md @@ -3,6 +3,48 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.14.1-beta.2](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/sdk-ui-ts@1.14.1-beta.1...@injectivelabs/sdk-ui-ts@1.14.1-beta.2) (2023-09-24) + +**Note:** Version bump only for package @injectivelabs/sdk-ui-ts + +## [1.14.1-beta.1](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/sdk-ui-ts@1.14.1-beta.0...@injectivelabs/sdk-ui-ts@1.14.1-beta.1) (2023-09-24) + +**Note:** Version bump only for package @injectivelabs/sdk-ui-ts + +## [1.14.1-beta.0](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/sdk-ui-ts@1.14.0-beta.1...@injectivelabs/sdk-ui-ts@1.14.1-beta.0) (2023-09-23) + +**Note:** Version bump only for package @injectivelabs/sdk-ui-ts + +# [1.14.0](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/sdk-ui-ts@1.14.0-beta.1...@injectivelabs/sdk-ui-ts@1.14.0) (2023-09-22) + +**Note:** Version bump only for package @injectivelabs/sdk-ui-ts + +# [1.14.0-beta.1](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/sdk-ui-ts@1.14.0-beta.0...@injectivelabs/sdk-ui-ts@1.14.0-beta.1) (2023-09-22) + +**Note:** Version bump only for package @injectivelabs/sdk-ui-ts + +# [1.14.0-beta.0](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/sdk-ui-ts@1.13.1-beta.2...@injectivelabs/sdk-ui-ts@1.14.0-beta.0) (2023-09-22) + +### Features + +- cw20 addr validation ([c4332e0](https://github.com/InjectiveLabs/injective-ts/commit/c4332e05cc63f0f5b3bc36797970571cf0347643)) + +## [1.13.1-beta.2](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/sdk-ui-ts@1.13.1-beta.1...@injectivelabs/sdk-ui-ts@1.13.1-beta.2) (2023-09-22) + +**Note:** Version bump only for package @injectivelabs/sdk-ui-ts + +## [1.13.1-beta.1](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/sdk-ui-ts@1.13.1-beta.0...@injectivelabs/sdk-ui-ts@1.13.1-beta.1) (2023-09-22) + +**Note:** Version bump only for package @injectivelabs/sdk-ui-ts + +## [1.13.1-beta.0](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/sdk-ui-ts@1.13.0...@injectivelabs/sdk-ui-ts@1.13.1-beta.0) (2023-09-22) + +**Note:** Version bump only for package @injectivelabs/sdk-ui-ts + +# [1.13.0](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/sdk-ui-ts@1.13.0-beta.3...@injectivelabs/sdk-ui-ts@1.13.0) (2023-09-22) + +**Note:** Version bump only for package @injectivelabs/sdk-ui-ts + # [1.13.0-beta.3](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/sdk-ui-ts@1.13.0-beta.2...@injectivelabs/sdk-ui-ts@1.13.0-beta.3) (2023-09-22) **Note:** Version bump only for package @injectivelabs/sdk-ui-ts diff --git a/packages/sdk-ui-ts/package.json b/packages/sdk-ui-ts/package.json index 2dee0370f..9b89e098a 100644 --- a/packages/sdk-ui-ts/package.json +++ b/packages/sdk-ui-ts/package.json @@ -1,7 +1,7 @@ { "name": "@injectivelabs/sdk-ui-ts", "description": "SDK in TypeScript for building Injective UI applications in a browser environment.", - "version": "1.13.0-beta.3", + "version": "1.14.1-beta.25", "sideEffects": false, "license": "Apache-2.0", "author": { @@ -18,7 +18,7 @@ }, "scripts": { "postinstall": "link-module-alias", - "build": "tsc --build tsconfig.build.json && tsc --build tsconfig.build.esm.json && yarn build:post && link-module-alias && yarn copy-files", + "build": "tsc --build tsconfig.build.json && tsc --build tsconfig.build.esm.json && yarn build:post && link-module-alias && yarn copy-files && yarn get-ibc-tokens", "build:watch": "tsc --build -w tsconfig.build.json && tsc -w --build tsconfig.build.esm.json && yarn build:post && link-module-alias", "build:post": "shx cp ../../etc/stub/package.json.stub dist/cjs/package.json && shx cp ../../etc/stub/package.esm.json.stub dist/esm/package.json", "clean": "tsc --build tsconfig.build.json --clean && tsc --build tsconfig.build.esm.json --clean && shx rm -rf coverage *.log junit.xml dist && jest --clearCache && shx mkdir -p dist", @@ -31,17 +31,18 @@ "dev": "ts-node-dev -r tsconfig-paths/register src/index.ts", "start": "node dist/index.js", "validators-logo": "ts-node-dev --ignore-watch=validators-logo ./src/validators-logo && yarn copy-files", - "validators-logo:update-all": "ts-node-dev --ignore-watch=validators-logo ./src/validators-logo --update:all && yarn copy-files" + "validators-logo:update-all": "ts-node-dev --ignore-watch=validators-logo ./src/validators-logo --update:all && yarn copy-files", + "get-ibc-tokens": "ts-node-dev ./src/services/ibc/tokens.ts" }, "dependencies": { - "@injectivelabs/contracts": "^1.12.2-beta.4", - "@injectivelabs/exceptions": "^1.12.2-beta.1", - "@injectivelabs/networks": "^1.12.2-beta.4", - "@injectivelabs/sdk-ts": "^1.13.0-beta.3", - "@injectivelabs/token-metadata": "^1.12.2-beta.13", - "@injectivelabs/token-utils": "^1.12.2-beta.2", - "@injectivelabs/ts-types": "^1.12.2-beta.1", - "@injectivelabs/utils": "^1.12.2-beta.2", + "@injectivelabs/contracts": "^1.14.1-beta.8", + "@injectivelabs/exceptions": "^1.14.1-beta.7", + "@injectivelabs/networks": "^1.14.1-beta.8", + "@injectivelabs/sdk-ts": "^1.14.1-beta.24", + "@injectivelabs/token-metadata": "^1.14.1-beta.15", + "@injectivelabs/token-utils": "^1.14.1-beta.7", + "@injectivelabs/ts-types": "^1.14.1-beta.7", + "@injectivelabs/utils": "^1.14.1-beta.6", "alchemy-sdk": "^2.6.3", "copyfiles": "^2.4.1", "link-module-alias": "^1.2.0", diff --git a/packages/sdk-ui-ts/src/denom/DenomClientAsync.ts b/packages/sdk-ui-ts/src/denom/DenomClientAsync.ts index 7f624f53c..725da0a99 100644 --- a/packages/sdk-ui-ts/src/denom/DenomClientAsync.ts +++ b/packages/sdk-ui-ts/src/denom/DenomClientAsync.ts @@ -9,10 +9,11 @@ import { fromUtf8, DenomClient, InsuranceFund, + ChainGrpcIbcApi, ChainGrpcBankApi, ChainGrpcWasmApi, + isCw20ContractAddress, ChainGrpcInsuranceFundApi, - ChainGrpcIbcApi, } from '@injectivelabs/sdk-ts' import { Web3Client } from '../services/web3/Web3Client' import type { Token } from '@injectivelabs/token-metadata' @@ -29,6 +30,8 @@ import { getTokenFromInsuranceFund } from '../utils' import { IbcApplicationsTransferV1Transfer } from '@injectivelabs/core-proto-ts' import { ErrorType, GeneralException } from '@injectivelabs/exceptions' import { awaitForAll } from '@injectivelabs/utils' +// @ts-ignore +import ibcTokenMetadata from '../services/ibc/ibcTokenMetadata.json' const IGNORED_DENOMS = ['peggy0xB855dBC314C39BFa2583567E02a40CBB246CF82B'] @@ -56,6 +59,8 @@ export class DenomClientAsync { IbcApplicationsTransferV1Transfer.DenomTrace > = {} + private cachedIbcTokens: Token[] = [] + constructor( network: Network = Network.Mainnet, options: { endpoints?: NetworkEndpoints; alchemyRpcUrl?: string }, @@ -116,9 +121,7 @@ export class DenomClientAsync { return getTokenFromAlchemyTokenMetaResponse(denom, response) } - const isCW20 = denom.startsWith('inj') - - if (isCW20) { + if (isCw20ContractAddress(denom)) { const contractAddress = denom const response = await this.chainWasmApi.fetchContractState({ @@ -137,7 +140,7 @@ export class DenomClientAsync { const tokenFactoryAddress = denom.split('/')[2] // CW20 contract (ex: from Wormhole) - if (tokenFactoryAddress.startsWith('inj')) { + if (isCw20ContractAddress(tokenFactoryAddress)) { const response = await this.chainWasmApi.fetchContractState({ contractAddress: tokenFactoryAddress, pagination: { @@ -218,7 +221,9 @@ export class DenomClientAsync { return this.metadatas.find((metadata) => metadata.base === denom) } - const { metadatas } = await this.chainBankApi.fetchDenomsMetadata({ limit: 1000 }) + const { metadatas } = await this.chainBankApi.fetchDenomsMetadata({ + limit: 1000, + }) this.metadatas = metadatas @@ -252,10 +257,19 @@ export class DenomClientAsync { await this.fetchAndCacheDenomTraces() } + if (this.cachedIbcTokens.length === 0) { + await this.fetchAndCacheIbcTokens() + } + const cachedDenomTrace = this.cachedDenomTraces[hash] + const cachedIbcToken = this.cachedIbcTokens.find( + (token) => token?.denom === denom, + ) if (cachedDenomTrace) { - const token = this.denomClient.getDenomToken(cachedDenomTrace.baseDenom) + const token = + this.denomClient.getDenomToken(cachedDenomTrace.baseDenom) || + cachedIbcToken if (!token) { return undefined @@ -275,7 +289,8 @@ export class DenomClientAsync { try { const denomTrace = await this.chainIbcApi.fetchDenomTrace(hash) - const token = this.denomClient.getDenomToken(denomTrace.baseDenom) + const token = + this.denomClient.getDenomToken(denomTrace.baseDenom) || cachedIbcToken if (!token) { return undefined @@ -321,9 +336,18 @@ export class DenomClientAsync { ) } + private async fetchAndCacheIbcTokens() { + if (ibcTokenMetadata?.length === 0) { + return + } + + this.cachedIbcTokens = ibcTokenMetadata as Token[] + } + public async preloadMetadata() { await this.getFactoryDenomMetadata('') await this.getInsuranceFund('') await this.fetchAndCacheDenomTraces() + await this.fetchAndCacheIbcTokens() } } diff --git a/packages/sdk-ui-ts/src/services/ibc/ibcTokenMetadata.json b/packages/sdk-ui-ts/src/services/ibc/ibcTokenMetadata.json new file mode 100644 index 000000000..c2a44c69c --- /dev/null +++ b/packages/sdk-ui-ts/src/services/ibc/ibcTokenMetadata.json @@ -0,0 +1,2149 @@ +[ + { + "name": "Injective", + "denom": "inj", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/injective/images/inj.png", + "symbol": "INJ", + "decimals": 18, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "inj", + "path": "", + "channelId": "", + "decimals": 18, + "symbol": "INJ", + "baseDenom": "INJ", + "isNative": false + } + }, + { + "name": "Stride", + "denom": "ibc/3FDD002A3A4019B05A33D324B2F29748E77AF501BEA5C96D1F28B2D6755F9F25", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/stride/images/strd.png", + "symbol": "STRD", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "3FDD002A3A4019B05A33D324B2F29748E77AF501BEA5C96D1F28B2D6755F9F25", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "STRD", + "baseDenom": "STRD", + "isNative": false + } + }, + { + "name": "stATOM", + "denom": "ibc/A8F39212ED30B6A8C2AC736665835720D3D7BE4A1D18D68566525EC25ECF1C9B", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/stride/images/statom.png", + "symbol": "stATOM", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "A8F39212ED30B6A8C2AC736665835720D3D7BE4A1D18D68566525EC25ECF1C9B", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "stATOM", + "baseDenom": "stATOM", + "isNative": false + } + }, + { + "name": "stSTARS", + "denom": "ibc/DD0F92D576A9A60487F17685A987AB6EDB359E661D281ED31F3AE560650ECFCB", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/stride/images/ststars.png", + "symbol": "stSTARS", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "DD0F92D576A9A60487F17685A987AB6EDB359E661D281ED31F3AE560650ECFCB", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "stSTARS", + "baseDenom": "stSTARS", + "isNative": false + } + }, + { + "name": "stOSMO", + "denom": "ibc/6D821F3CFAE78E9EBD872FAEC61C400C0D9B72E77FA14614CF1B775A528854FD", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/stride/images/stosmo.png", + "symbol": "stOSMO", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "6D821F3CFAE78E9EBD872FAEC61C400C0D9B72E77FA14614CF1B775A528854FD", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "stOSMO", + "baseDenom": "stOSMO", + "isNative": false + } + }, + { + "name": "stJUNO", + "denom": "ibc/580E52A2C2DB126EE2160D1BDBBA33B5839D53B5E59D04D4FF438AE9BB7BFAAB", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/stride/images/stjuno.png", + "symbol": "stJUNO", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "580E52A2C2DB126EE2160D1BDBBA33B5839D53B5E59D04D4FF438AE9BB7BFAAB", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "stJUNO", + "baseDenom": "stJUNO", + "isNative": false + } + }, + { + "name": "stLUNA", + "denom": "ibc/E98796F283A8B56A221011C2EDF7079BB62D1EA3EEF3E7CF4C679E91C6D97D08", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/stride/images/stluna.png", + "symbol": "stLUNA", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "E98796F283A8B56A221011C2EDF7079BB62D1EA3EEF3E7CF4C679E91C6D97D08", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "stLUNA", + "baseDenom": "stLUNA", + "isNative": false + } + }, + { + "name": "stEVMOS", + "denom": "ibc/75F64E20A70C5059F8EA792F1C47260DC7C6CBAC69DBA60E151AD5416E93C34C", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/stride/images/stevmos.png", + "symbol": "stEVMOS", + "decimals": 18, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "75F64E20A70C5059F8EA792F1C47260DC7C6CBAC69DBA60E151AD5416E93C34C", + "path": "", + "channelId": "", + "decimals": 18, + "symbol": "stEVMOS", + "baseDenom": "stEVMOS", + "isNative": false + } + }, + { + "name": "stINJ", + "denom": "ibc/AC87717EA002B0123B10A05063E69BCA274BA2C44D842AEEB41558D2856DCE93", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/stride/images/stinj.png", + "symbol": "stINJ", + "decimals": 18, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "AC87717EA002B0123B10A05063E69BCA274BA2C44D842AEEB41558D2856DCE93", + "path": "", + "channelId": "", + "decimals": 18, + "symbol": "stINJ", + "baseDenom": "stINJ", + "isNative": false + } + }, + { + "name": "stUMEE", + "denom": "ibc/FC8E98DF998AE88129183094E49383F94B3E5F1844C939D380AF18061FEF41EB", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/stride/images/stumee.png", + "symbol": "stUMEE", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "FC8E98DF998AE88129183094E49383F94B3E5F1844C939D380AF18061FEF41EB", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "stUMEE", + "baseDenom": "stUMEE", + "isNative": false + } + }, + { + "name": "stCMDX", + "denom": "ibc/0CAB2CA45981598C95B6BE18252AEFE1E9E1691D8B4C661997AD7B836FD904D6", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/stride/images/stcmdx.png", + "symbol": "stCMDX", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "0CAB2CA45981598C95B6BE18252AEFE1E9E1691D8B4C661997AD7B836FD904D6", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "stCMDX", + "baseDenom": "stCMDX", + "isNative": false + } + }, + { + "name": "Osmosis", + "denom": "ibc/92E0120F15D037353CFB73C14651FC8930ADC05B93100FD7754D3A689E53B333", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/osmosis/images/osmo.png", + "symbol": "OSMO", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "92E0120F15D037353CFB73C14651FC8930ADC05B93100FD7754D3A689E53B333", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "OSMO", + "baseDenom": "OSMO", + "isNative": false + } + }, + { + "name": "Ion", + "denom": "ibc/1B2D7E4261A7E2130E8E3506058E3081D3154998413F0DB2F82B04035B3FE676", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/osmosis/images/ion.png", + "symbol": "ION", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "1B2D7E4261A7E2130E8E3506058E3081D3154998413F0DB2F82B04035B3FE676", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "ION", + "baseDenom": "ION", + "isNative": false + } + }, + { + "name": "IBCX Core ", + "denom": "ibc/491C92BEEAFE513BABA355275C7AE3AC47AA7FD57285AC1D910CE874D2DC7CA0", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/osmosis/images/ibcx.svg", + "symbol": "IBCX", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "491C92BEEAFE513BABA355275C7AE3AC47AA7FD57285AC1D910CE874D2DC7CA0", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "IBCX", + "baseDenom": "IBCX", + "isNative": false + } + }, + { + "name": "stIBCX Core ", + "denom": "ibc/0A6B424A8207047D9FD499F59177BABD8DB08BBC2316B29B702A403BFB414419", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/osmosis/images/stibcx.png", + "symbol": "stIBCX", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "0A6B424A8207047D9FD499F59177BABD8DB08BBC2316B29B702A403BFB414419", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "stIBCX", + "baseDenom": "stIBCX", + "isNative": false + } + }, + { + "name": "ERIS Amplified OSMO", + "denom": "ibc/012D069D557C4DD59A670AA17E809CB7A790D778E364D0BC0A3248105DA6432D", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/osmosis/images/amp.osmo.png", + "symbol": "ampOSMO", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "012D069D557C4DD59A670AA17E809CB7A790D778E364D0BC0A3248105DA6432D", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "ampOSMO", + "baseDenom": "ampOSMO", + "isNative": false + } + }, + { + "name": "Evmos", + "denom": "ibc/16618B7F7AC551F48C057A13F4CA5503693FBFF507719A85BC6876B8BD75F821", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/evmos/images/evmos.png", + "symbol": "EVMOS", + "decimals": 18, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "16618B7F7AC551F48C057A13F4CA5503693FBFF507719A85BC6876B8BD75F821", + "path": "", + "channelId": "", + "decimals": 18, + "symbol": "EVMOS", + "baseDenom": "EVMOS", + "isNative": false + } + }, + { + "name": "Kuji", + "denom": "ibc/9A115B56E769B92621FFF90567E2D60EFD146E86E867491DB69EEDA9ADC36204", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/kujira/images/kuji.png", + "symbol": "KUJI", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "9A115B56E769B92621FFF90567E2D60EFD146E86E867491DB69EEDA9ADC36204", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "KUJI", + "baseDenom": "KUJI", + "isNative": false + } + }, + { + "name": "USDC", + "denom": "ibc/2CBC2EA121AE42563B08028466F37B600F2D7D4282342DE938283CC3FB2BC00E", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/usdc.png", + "symbol": "USDC", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "2CBC2EA121AE42563B08028466F37B600F2D7D4282342DE938283CC3FB2BC00E", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "USDC", + "baseDenom": "USDC", + "isNative": false + } + }, + { + "name": "Frienzies", + "denom": "ibc/CDD7374B312BEF9723AAEBDE622206490E112CE2B5F49275683CCCD86C7D4BCE", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/noble/images/frnz.png", + "symbol": "FRNZ", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "CDD7374B312BEF9723AAEBDE622206490E112CE2B5F49275683CCCD86C7D4BCE", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "FRNZ", + "baseDenom": "FRNZ", + "isNative": false + } + }, + { + "name": "Axelar", + "denom": "ibc/B68C1D2682A8B69E20BB921E34C6A3A2B6D1E13E3E8C0092E373826F546DEE65", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/axl.png", + "symbol": "AXL", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "B68C1D2682A8B69E20BB921E34C6A3A2B6D1E13E3E8C0092E373826F546DEE65", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "AXL", + "baseDenom": "AXL", + "isNative": false + } + }, + { + "name": "USD Coin", + "denom": "ibc/7E1AF94AD246BE522892751046F0C959B768642E5671CC3742264068D49553C0", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/usdc.png", + "symbol": "USDC", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "7E1AF94AD246BE522892751046F0C959B768642E5671CC3742264068D49553C0", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "USDC", + "baseDenom": "USDC", + "isNative": false + } + }, + { + "name": "Frax", + "denom": "ibc/3E5504815B2D69DCC32B1FF54CDAC28D7DA2C445BD29C496A83732DC1D52DB90", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/_non-cosmos/ethereum/images/frax.svg", + "symbol": "FRAX", + "decimals": 18, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "3E5504815B2D69DCC32B1FF54CDAC28D7DA2C445BD29C496A83732DC1D52DB90", + "path": "", + "channelId": "", + "decimals": 18, + "symbol": "FRAX", + "baseDenom": "FRAX", + "isNative": false + } + }, + { + "name": "Dai Stablecoin", + "denom": "ibc/265ABC4B9F767AF45CAC6FB76E930548D835EDA3E94BC56B70582A55A73D8C90", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/dai.png", + "symbol": "DAI", + "decimals": 18, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "265ABC4B9F767AF45CAC6FB76E930548D835EDA3E94BC56B70582A55A73D8C90", + "path": "", + "channelId": "", + "decimals": 18, + "symbol": "DAI", + "baseDenom": "DAI", + "isNative": false + } + }, + { + "name": "Tether USD", + "denom": "ibc/90C6F06139D663CFD7949223D257C5B5D241E72ED61EBD12FFDDA6F068715E47", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/usdt.png", + "symbol": "USDT", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "90C6F06139D663CFD7949223D257C5B5D241E72ED61EBD12FFDDA6F068715E47", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "USDT", + "baseDenom": "USDT", + "isNative": false + } + }, + { + "name": "Wrapped Ether", + "denom": "ibc/65A6973F7A4013335AE5FFE623FE019A78A1FEEE9B8982985099978837D764A7", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/weth.png", + "symbol": "WETH", + "decimals": 18, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "65A6973F7A4013335AE5FFE623FE019A78A1FEEE9B8982985099978837D764A7", + "path": "", + "channelId": "", + "decimals": 18, + "symbol": "WETH", + "baseDenom": "WETH", + "isNative": false + } + }, + { + "name": "Wrapped Bitcoin", + "denom": "ibc/4C8A332AE4FDE42709649B5F9A2A336192158C4465DF74B4513F5AD0C583EA6F", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/wbtc.png", + "symbol": "WBTC", + "decimals": 8, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "4C8A332AE4FDE42709649B5F9A2A336192158C4465DF74B4513F5AD0C583EA6F", + "path": "", + "channelId": "", + "decimals": 8, + "symbol": "WBTC", + "baseDenom": "WBTC", + "isNative": false + } + }, + { + "name": "Aave", + "denom": "ibc/49265FCAA6CC20B59652C0B45B2283A260BB19FC183DE95C29CCA8E01F8B004C", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/_non-cosmos/ethereum/images/aave.svg", + "symbol": "AAVE", + "decimals": 18, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "49265FCAA6CC20B59652C0B45B2283A260BB19FC183DE95C29CCA8E01F8B004C", + "path": "", + "channelId": "", + "decimals": 18, + "symbol": "AAVE", + "baseDenom": "AAVE", + "isNative": false + } + }, + { + "name": "ApeCoin", + "denom": "ibc/8A13F5DA968B4D526E9DC5AE20B584FE62462E80AF06B9D0EA0B0DB35ABBBF27", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/_non-cosmos/ethereum/images/ape.svg", + "symbol": "APE", + "decimals": 18, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "8A13F5DA968B4D526E9DC5AE20B584FE62462E80AF06B9D0EA0B0DB35ABBBF27", + "path": "", + "channelId": "", + "decimals": 18, + "symbol": "APE", + "baseDenom": "APE", + "isNative": false + } + }, + { + "name": "Axie Infinity Shard", + "denom": "ibc/EB519ECF709F0DB6BA1359F91BA2DDC5A07FB9869E1768D377EFEF9DF33DC4AB", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/_non-cosmos/ethereum/images/axs.svg", + "symbol": "AXS", + "decimals": 18, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "EB519ECF709F0DB6BA1359F91BA2DDC5A07FB9869E1768D377EFEF9DF33DC4AB", + "path": "", + "channelId": "", + "decimals": 18, + "symbol": "AXS", + "baseDenom": "AXS", + "isNative": false + } + }, + { + "name": "Chainlink", + "denom": "ibc/AC447F1D6EDAF817589C5FECECB6CD3B9E9EFFD33C7E16FE8820009F92A2F585", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/_non-cosmos/ethereum/images/link.png", + "symbol": "LINK", + "decimals": 18, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "AC447F1D6EDAF817589C5FECECB6CD3B9E9EFFD33C7E16FE8820009F92A2F585", + "path": "", + "channelId": "", + "decimals": 18, + "symbol": "LINK", + "baseDenom": "LINK", + "isNative": false + } + }, + { + "name": "Maker", + "denom": "ibc/E8C65EFAB7804152191B8311F61877A36779277E316883D8812D3CBEFC79AE4F", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/_non-cosmos/ethereum/images/mkr.svg", + "symbol": "MKR", + "decimals": 18, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "E8C65EFAB7804152191B8311F61877A36779277E316883D8812D3CBEFC79AE4F", + "path": "", + "channelId": "", + "decimals": 18, + "symbol": "MKR", + "baseDenom": "MKR", + "isNative": false + } + }, + { + "name": "Rai Reflex Index", + "denom": "ibc/27817BAE3958FFB2BFBD8F4F6165153DFD230779994A7C42A91E0E45E8201768", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/_non-cosmos/ethereum/images/rai.svg", + "symbol": "RAI", + "decimals": 18, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "27817BAE3958FFB2BFBD8F4F6165153DFD230779994A7C42A91E0E45E8201768", + "path": "", + "channelId": "", + "decimals": 18, + "symbol": "RAI", + "baseDenom": "RAI", + "isNative": false + } + }, + { + "name": "Shiba Inu", + "denom": "ibc/E68343A4DEF4AFBE7C5A9004D4C11888EE755A7B43B3F1AFA52F2C34C07990D5", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/_non-cosmos/ethereum/images/shib.svg", + "symbol": "SHIB", + "decimals": 18, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "E68343A4DEF4AFBE7C5A9004D4C11888EE755A7B43B3F1AFA52F2C34C07990D5", + "path": "", + "channelId": "", + "decimals": 18, + "symbol": "SHIB", + "baseDenom": "SHIB", + "isNative": false + } + }, + { + "name": "Lido Staked Ether", + "denom": "ibc/FB1B967C690FEA7E9AD7CF76AE2255169D4EA2937D6694B2C0E61A370F76D9FB", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/_non-cosmos/ethereum/images/steth.svg", + "symbol": "stETH", + "decimals": 18, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "FB1B967C690FEA7E9AD7CF76AE2255169D4EA2937D6694B2C0E61A370F76D9FB", + "path": "", + "channelId": "", + "decimals": 18, + "symbol": "stETH", + "baseDenom": "stETH", + "isNative": false + } + }, + { + "name": "Uniswap", + "denom": "ibc/3E3A8A403AE81114F4341962A6D73162D586C9DF4CE3BE7C7B459108430675F7", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/_non-cosmos/ethereum/images/uni.svg", + "symbol": "UNI", + "decimals": 18, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "3E3A8A403AE81114F4341962A6D73162D586C9DF4CE3BE7C7B459108430675F7", + "path": "", + "channelId": "", + "decimals": 18, + "symbol": "UNI", + "baseDenom": "UNI", + "isNative": false + } + }, + { + "name": "Chain", + "denom": "ibc/79D01DE88DFFC0610003439D38200E77A3D2A1CCCBE4B1958D685026ABB01814", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/_non-cosmos/ethereum/images/xcn.svg", + "symbol": "XCN", + "decimals": 18, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "79D01DE88DFFC0610003439D38200E77A3D2A1CCCBE4B1958D685026ABB01814", + "path": "", + "channelId": "", + "decimals": 18, + "symbol": "XCN", + "baseDenom": "XCN", + "isNative": false + } + }, + { + "name": "Wrapped Polkadot", + "denom": "ibc/624BA9DD171915A2B9EA70F69638B2CEA179959850C1A586F6C485498F29EDD4", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/_non-cosmos/polkadot/images/dot.png", + "symbol": "DOT", + "decimals": 10, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "624BA9DD171915A2B9EA70F69638B2CEA179959850C1A586F6C485498F29EDD4", + "path": "", + "channelId": "", + "decimals": 10, + "symbol": "DOT", + "baseDenom": "DOT", + "isNative": false + } + }, + { + "name": "Wrapped Moonbeam", + "denom": "ibc/8FF72FB47F07B4AFA8649500A168683BEFCB9EE164BD331FA597D26224D51055", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/_non-cosmos/moonbeam/images/glmr.png", + "symbol": "WGLMR", + "decimals": 18, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "8FF72FB47F07B4AFA8649500A168683BEFCB9EE164BD331FA597D26224D51055", + "path": "", + "channelId": "", + "decimals": 18, + "symbol": "WGLMR", + "baseDenom": "WGLMR", + "isNative": false + } + }, + { + "name": "Wrapped Matic", + "denom": "ibc/7E23647941230DA0AB4ED10F599647D9BE34E1C991D0DA032B5A1522941EBA73", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/_non-cosmos/polygon/images/wmatic.png", + "symbol": "WMATIC", + "decimals": 18, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "7E23647941230DA0AB4ED10F599647D9BE34E1C991D0DA032B5A1522941EBA73", + "path": "", + "channelId": "", + "decimals": 18, + "symbol": "WMATIC", + "baseDenom": "WMATIC", + "isNative": false + } + }, + { + "name": "Wrapped BNB", + "denom": "ibc/B877B8EF095028B807370AB5C7790CA0C328777C9FF09AA7F5436BA7FAE4A86F", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/_non-cosmos/binancesmartchain/images/wbnb.png", + "symbol": "WBNB", + "decimals": 18, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "B877B8EF095028B807370AB5C7790CA0C328777C9FF09AA7F5436BA7FAE4A86F", + "path": "", + "channelId": "", + "decimals": 18, + "symbol": "WBNB", + "baseDenom": "WBNB", + "isNative": false + } + }, + { + "name": "Binance USD", + "denom": "ibc/A62F794AAEC56B6828541224D91DA3E21423AB0DC4D21ECB05E4588A07BD934C", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/_non-cosmos/ethereum/images/busd.png", + "symbol": "BUSD", + "decimals": 18, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "A62F794AAEC56B6828541224D91DA3E21423AB0DC4D21ECB05E4588A07BD934C", + "path": "", + "channelId": "", + "decimals": 18, + "symbol": "BUSD", + "baseDenom": "BUSD", + "isNative": false + } + }, + { + "name": "Wrapped AVAX", + "denom": "ibc/A4FF8E161D2835BA06A7522684E874EFC91004AD0CD14E038F37940562158D73", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/_non-cosmos/avalanche/images/wavax.svg", + "symbol": "WAVAX", + "decimals": 18, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "A4FF8E161D2835BA06A7522684E874EFC91004AD0CD14E038F37940562158D73", + "path": "", + "channelId": "", + "decimals": 18, + "symbol": "WAVAX", + "baseDenom": "WAVAX", + "isNative": false + } + }, + { + "name": "Wrapped FTM", + "denom": "ibc/31E8DDA49D53535F358B29CFCBED1B9224DAAFE82788C0477930DCDE231DA878", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/_non-cosmos/fantom/images/ftm.png", + "symbol": "WFTM", + "decimals": 18, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "31E8DDA49D53535F358B29CFCBED1B9224DAAFE82788C0477930DCDE231DA878", + "path": "", + "channelId": "", + "decimals": 18, + "symbol": "WFTM", + "baseDenom": "WFTM", + "isNative": false + } + }, + { + "name": "USD Coin from Polygon", + "denom": "ibc/2E93E8914CA07B73A794657DA76170A016057D1C6B0DC42D969918D4F22D95A3", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/usdc.png", + "symbol": "USDC", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "2E93E8914CA07B73A794657DA76170A016057D1C6B0DC42D969918D4F22D95A3", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "USDC", + "baseDenom": "USDC", + "isNative": false + } + }, + { + "name": "USD Coin from Avalanche", + "denom": "ibc/705E7E25F94467E363B2EB324A5A6FF4C683A4A6D20AAD2AEEABA2D9EB1B897F", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/usdc.png", + "symbol": "USDC", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "705E7E25F94467E363B2EB324A5A6FF4C683A4A6D20AAD2AEEABA2D9EB1B897F", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "USDC", + "baseDenom": "USDC", + "isNative": false + } + }, + { + "name": "Wrapped FIL from Filecoin", + "denom": "ibc/9D1889339AEC850B1D719CCF19BD813955C086BE1ED323ED68318A273922E40D", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/filecoin/images/wfil.png", + "symbol": "axlFIL", + "decimals": 18, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "9D1889339AEC850B1D719CCF19BD813955C086BE1ED323ED68318A273922E40D", + "path": "", + "channelId": "", + "decimals": 18, + "symbol": "axlFIL", + "baseDenom": "axlFIL", + "isNative": false + } + }, + { + "name": "Arbitrum", + "denom": "ibc/F28C5C931D2673B7A2F06FC74934F7BDC0D2906D2AF40D582ED27D1E5C48D475", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/_non-cosmos/arbitrum/images/arb.png", + "symbol": "ARB", + "decimals": 18, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "F28C5C931D2673B7A2F06FC74934F7BDC0D2906D2AF40D582ED27D1E5C48D475", + "path": "", + "channelId": "", + "decimals": 18, + "symbol": "ARB", + "baseDenom": "ARB", + "isNative": false + } + }, + { + "name": "Pepe", + "denom": "ibc/9144D78830C5ABD7B7D9E219EA7600E3A0E0AD5FC50C007668160595E94789AB", + "logo": "https://ibc.tfm.com/custom/tokens/pepe-wei.logo.svg", + "symbol": "PEPE", + "decimals": 18, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "9144D78830C5ABD7B7D9E219EA7600E3A0E0AD5FC50C007668160595E94789AB", + "path": "", + "channelId": "", + "decimals": 18, + "symbol": "PEPE", + "baseDenom": "PEPE", + "isNative": false + } + }, + { + "name": "Coinbase Wrapped Staked ETH", + "denom": "ibc/545E97C6EFB2633645720DEBCA78B2BE6F5382C4693EA7DEB2D4C456371EA4F0", + "logo": "untracked.svg", + "symbol": "cbETH", + "decimals": 18, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "545E97C6EFB2633645720DEBCA78B2BE6F5382C4693EA7DEB2D4C456371EA4F0", + "path": "", + "channelId": "", + "decimals": 18, + "symbol": "cbETH", + "baseDenom": "cbETH", + "isNative": false + } + }, + { + "name": "Rocket Pool Ether", + "denom": "ibc/8906BF683A89D1ABE075A49EFA35A3128D7E9D809775B8E9D5AEEAA55D2889DD", + "logo": "untracked.svg", + "symbol": "rETH", + "decimals": 18, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "8906BF683A89D1ABE075A49EFA35A3128D7E9D809775B8E9D5AEEAA55D2889DD", + "path": "", + "channelId": "", + "decimals": 18, + "symbol": "rETH", + "baseDenom": "rETH", + "isNative": false + } + }, + { + "name": "Staked Frax Ether", + "denom": "ibc/E918585C09958BD328DD9E7215E4726623E7A9A94342FEA5BE126A2AAF920730", + "logo": "untracked.svg", + "symbol": "sfrxETH", + "decimals": 18, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "E918585C09958BD328DD9E7215E4726623E7A9A94342FEA5BE126A2AAF920730", + "path": "", + "channelId": "", + "decimals": 18, + "symbol": "sfrxETH", + "baseDenom": "sfrxETH", + "isNative": false + } + }, + { + "name": "Wrapped Lido Staked Ether", + "denom": "ibc/1E0FC59FB8495BF927B10E9D515661494B1BBEDAA15D80E52FE2BADA64656D16", + "logo": "untracked.svg", + "symbol": "wstETH", + "decimals": 18, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "1E0FC59FB8495BF927B10E9D515661494B1BBEDAA15D80E52FE2BADA64656D16", + "path": "", + "channelId": "", + "decimals": 18, + "symbol": "wstETH", + "baseDenom": "wstETH", + "isNative": false + } + }, + { + "name": "Cosmos Hub Atom", + "denom": "ibc/C4CFF46FD6DE35CA4CF4CE031E643C8FDC9BA4B99AE598E9B0ED98FE3A2319F9", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/cosmoshub/images/atom.png", + "symbol": "ATOM", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "C4CFF46FD6DE35CA4CF4CE031E643C8FDC9BA4B99AE598E9B0ED98FE3A2319F9", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "ATOM", + "baseDenom": "ATOM", + "isNative": false + } + }, + { + "name": "Persistence", + "denom": "ibc/B786E7CBBF026F6F15A8DA248E0F18C62A0F7A70CB2DABD9239398C8B5150ABB", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/persistence/images/xprt.png", + "symbol": "XPRT", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "B786E7CBBF026F6F15A8DA248E0F18C62A0F7A70CB2DABD9239398C8B5150ABB", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "XPRT", + "baseDenom": "XPRT", + "isNative": false + } + }, + { + "name": "PSTAKE staked ATOM", + "denom": "ibc/B8E30AECB0FB5BA1B02747BE003E55934A9E42488495412C7E9934FBEC06B201", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/persistence/images/stkatom.png", + "symbol": "stkATOM", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "B8E30AECB0FB5BA1B02747BE003E55934A9E42488495412C7E9934FBEC06B201", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "stkATOM", + "baseDenom": "stkATOM", + "isNative": false + } + }, + { + "name": "Whale", + "denom": "ibc/D6E6A20ABDD600742D22464340A7701558027759CE14D12590F8EA869CCCF445", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/migaloo/images/white-whale.png", + "symbol": "WHALE", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "D6E6A20ABDD600742D22464340A7701558027759CE14D12590F8EA869CCCF445", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "WHALE", + "baseDenom": "WHALE", + "isNative": false + } + }, + { + "name": "ampWHALE", + "denom": "ibc/168C3904C45C6FE3539AE85A8892DF87371D00EA7942515AFC50AA43C4BB0A32", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/migaloo/images/ampWhale.svg", + "symbol": "ampWHALE", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "168C3904C45C6FE3539AE85A8892DF87371D00EA7942515AFC50AA43C4BB0A32", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "ampWHALE", + "baseDenom": "ampWHALE", + "isNative": false + } + }, + { + "name": "boneWHALE", + "denom": "ibc/ECB0AA28D6001EF985047558C410B65581FC85BD92D4E3CFCCA0D3D964C67CC2", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/migaloo/images/bWHALE.png", + "symbol": "bWHALE", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "ECB0AA28D6001EF985047558C410B65581FC85BD92D4E3CFCCA0D3D964C67CC2", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "bWHALE", + "baseDenom": "bWHALE", + "isNative": false + } + }, + { + "name": "FABLE", + "denom": "ibc/5FE5E50EA0DF6D68C29EDFB7992EB81CD40B6780C33834A8AB3712FB148E1313", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/migaloo/images/fable.svg", + "symbol": "FABLE", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "5FE5E50EA0DF6D68C29EDFB7992EB81CD40B6780C33834A8AB3712FB148E1313", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "FABLE", + "baseDenom": "FABLE", + "isNative": false + } + }, + { + "name": "RAC", + "denom": "ibc/0F3A724673F682CF7812D0ED1A0C41D344C09E94C939E79D12712DC7C0676E80", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/migaloo/images/rac.png", + "symbol": "RAC", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "0F3A724673F682CF7812D0ED1A0C41D344C09E94C939E79D12712DC7C0676E80", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "RAC", + "baseDenom": "RAC", + "isNative": false + } + }, + { + "name": "ASH", + "denom": "ibc/EED40547772504DF629EFEC08892E689CD14498B1C0AD766CD5075BBBEE3D808", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/migaloo/images/ash.svg", + "symbol": "ASH", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "EED40547772504DF629EFEC08892E689CD14498B1C0AD766CD5075BBBEE3D808", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "ASH", + "baseDenom": "ASH", + "isNative": false + } + }, + { + "name": "Somm", + "denom": "ibc/34346A60A95EB030D62D6F5BDD4B745BE18E8A693372A8A347D5D53DBBB1328B", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/sommelier/images/somm.png", + "symbol": "SOMM", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "34346A60A95EB030D62D6F5BDD4B745BE18E8A693372A8A347D5D53DBBB1328B", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "SOMM", + "baseDenom": "SOMM", + "isNative": false + } + }, + { + "name": "Crescent", + "denom": "ibc/3A6DD3358D9F7ADD18CDE79BA10B400511A5DE4AE2C037D7C9639B52ADAF35C6", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/crescent/images/cre.png", + "symbol": "CRE", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "3A6DD3358D9F7ADD18CDE79BA10B400511A5DE4AE2C037D7C9639B52ADAF35C6", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "CRE", + "baseDenom": "CRE", + "isNative": false + } + }, + { + "name": "Bonded Crescent", + "denom": "ibc/D9E839DE6F40C036592B6CEDB73841EE9A18987BC099DD112762A46AFE72159B", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/crescent/images/bcre.png", + "symbol": "bCRE", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "D9E839DE6F40C036592B6CEDB73841EE9A18987BC099DD112762A46AFE72159B", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "bCRE", + "baseDenom": "bCRE", + "isNative": false + } + }, + { + "name": "Secret Network", + "denom": "ibc/0954E1C28EB7AF5B72D24F3BC2B47BBB2FDF91BDDFD57B74B99E133AED40972A", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/secretnetwork/images/scrt.png", + "symbol": "SCRT", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "0954E1C28EB7AF5B72D24F3BC2B47BBB2FDF91BDDFD57B74B99E133AED40972A", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "SCRT", + "baseDenom": "SCRT", + "isNative": false + } + }, + { + "name": "Real Yield Eth", + "denom": "ibc/6B7E243C586784E1BE150B71F541A3880F0409E994365AF31FF63A2764B72556", + "logo": "untracked.svg", + "symbol": "YieldETH", + "decimals": 18, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "6B7E243C586784E1BE150B71F541A3880F0409E994365AF31FF63A2764B72556", + "path": "", + "channelId": "", + "decimals": 18, + "symbol": "YieldETH", + "baseDenom": "YieldETH", + "isNative": false + } + }, + { + "name": "Astroport", + "denom": "ibc/EBD5A24C554198EBAF44979C5B4D2C2D312E6EBAB71962C92F735499C7575839", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/terra/images/astro.png", + "symbol": "ASTRO", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "EBD5A24C554198EBAF44979C5B4D2C2D312E6EBAB71962C92F735499C7575839", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "ASTRO", + "baseDenom": "ASTRO", + "isNative": false + } + }, + { + "name": "ERIS Amplified LUNA", + "denom": "ibc/751CCECAF75D686B1DC8708BE62F8C7411B211750E6009C6AC4C93881F0543E8", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/terra2/images/ampluna.svg", + "symbol": "ampLUNA", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "751CCECAF75D686B1DC8708BE62F8C7411B211750E6009C6AC4C93881F0543E8", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "ampLUNA", + "baseDenom": "ampLUNA", + "isNative": false + } + }, + { + "name": "Lion DAO", + "denom": "ibc/E6CFB0AC1D339A8CBA3353DF0D7E080B4B14D026D1C90F63F666C223B04D548C", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/terra2/images/roar.png", + "symbol": "ROAR", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "E6CFB0AC1D339A8CBA3353DF0D7E080B4B14D026D1C90F63F666C223B04D548C", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "ROAR", + "baseDenom": "ROAR", + "isNative": false + } + }, + { + "name": "boneLuna", + "denom": "ibc/C9D55B62C9D9CA84DD94DC019009B840DDFD861BF2F33F7CF2A8A74933797680", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/terra2/images/boneluna.png", + "symbol": "bLUNA", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "C9D55B62C9D9CA84DD94DC019009B840DDFD861BF2F33F7CF2A8A74933797680", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "bLUNA", + "baseDenom": "bLUNA", + "isNative": false + } + }, + { + "name": "Lion Cub DAO", + "denom": "ibc/5CB35B165F689DD57F836C6C5ED3AB268493AA5A810740446C4F2141664714F4", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/terra2/images/cub.png", + "symbol": "CUB", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "5CB35B165F689DD57F836C6C5ED3AB268493AA5A810740446C4F2141664714F4", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "CUB", + "baseDenom": "CUB", + "isNative": false + } + }, + { + "name": "sayve", + "denom": "ibc/DF2B99CF1FEA6B292E79617BD6F7EF735C0B47CEF09D7104E270956E96C38B12", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/terra2/images/sayve.png", + "symbol": "SAYVE", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "DF2B99CF1FEA6B292E79617BD6F7EF735C0B47CEF09D7104E270956E96C38B12", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "SAYVE", + "baseDenom": "SAYVE", + "isNative": false + } + }, + { + "name": "BLUE CUB DAO", + "denom": "ibc/B692197280D4E62F8D9F8E5C0B697DC4C2C680ED6DE8FFF0368E0552C9215607", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/terra2/images/blue.png", + "symbol": "BLUE", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "B692197280D4E62F8D9F8E5C0B697DC4C2C680ED6DE8FFF0368E0552C9215607", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "BLUE", + "baseDenom": "BLUE", + "isNative": false + } + }, + { + "name": "Kava", + "denom": "ibc/57AA1A70A4BC9769C525EBF6386F7A21536E04A79D62E1981EFCEF9428EBB205", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/kava/images/kava.png", + "symbol": "KAVA", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "57AA1A70A4BC9769C525EBF6386F7A21536E04A79D62E1981EFCEF9428EBB205", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "KAVA", + "baseDenom": "KAVA", + "isNative": false + } + }, + { + "name": "Hard", + "denom": "ibc/D6C28E07F7343360AC41E15DDD44D79701DDCA2E0C2C41279739C8D4AE5264BC", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/kava/images/hard.png", + "symbol": "HARD", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "D6C28E07F7343360AC41E15DDD44D79701DDCA2E0C2C41279739C8D4AE5264BC", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "HARD", + "baseDenom": "HARD", + "isNative": false + } + }, + { + "name": "Swap", + "denom": "ibc/70CF1A54E23EA4E480DEDA9E12082D3FD5684C3483CBDCE190C5C807227688C5", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/kava/images/swp.png", + "symbol": "SWP", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "70CF1A54E23EA4E480DEDA9E12082D3FD5684C3483CBDCE190C5C807227688C5", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "SWP", + "baseDenom": "SWP", + "isNative": false + } + }, + { + "name": "USDX", + "denom": "ibc/C78F65E1648A3DFE0BAEB6C4CDA69CC2A75437F1793C0E6386DFDA26393790AE", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/kava/images/usdx.png", + "symbol": "USDX", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "C78F65E1648A3DFE0BAEB6C4CDA69CC2A75437F1793C0E6386DFDA26393790AE", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "USDX", + "baseDenom": "USDX", + "isNative": false + } + }, + { + "name": "Tether USD", + "denom": "ibc/4ABBEF4C8926DDDB320AE5188CFD63267ABBCEFC0583E4AE05D6E5AA2401DDAB", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/usdt.png", + "symbol": "USDT (Cosmos)", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "4ABBEF4C8926DDDB320AE5188CFD63267ABBCEFC0583E4AE05D6E5AA2401DDAB", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "USDT (Cosmos)", + "baseDenom": "USDT (Cosmos)", + "isNative": false + } + }, + { + "name": "Neokingdom DAO", + "denom": "ibc/F6CC233E5C0EA36B1F74AB1AF98471A2D6A80E2542856639703E908B4D93E7C4", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/evmos/images/neok.png", + "symbol": "NEOK", + "decimals": 18, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "F6CC233E5C0EA36B1F74AB1AF98471A2D6A80E2542856639703E908B4D93E7C4", + "path": "", + "channelId": "", + "decimals": 18, + "symbol": "NEOK", + "baseDenom": "NEOK", + "isNative": false + } + }, + { + "name": "stSOMM", + "denom": "ibc/9C234DA49B8DDAFB8F71F21BEB109F6255ECA146A32FD3A36CB9210647CBD037", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/stride/images/stsomm.png", + "symbol": "stSOMM", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "9C234DA49B8DDAFB8F71F21BEB109F6255ECA146A32FD3A36CB9210647CBD037", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "stSOMM", + "baseDenom": "stSOMM", + "isNative": false + } + }, + { + "name": "USK", + "denom": "ibc/58BC643F2EB5758C08D8B1569C7948A5DA796802576005F676BBFB7526E520EB", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/kujira/images/usk.png", + "symbol": "USK", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "58BC643F2EB5758C08D8B1569C7948A5DA796802576005F676BBFB7526E520EB", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "USK", + "baseDenom": "USK", + "isNative": false + } + }, + { + "name": "ampKUJI", + "denom": "ibc/34E48C7C43383203519D996D1D93FE80ED50153E28FB6A9465DE463AEF2EC9EC", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/kujira/images/ampKUJI.png", + "symbol": "ampKUJI", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "34E48C7C43383203519D996D1D93FE80ED50153E28FB6A9465DE463AEF2EC9EC", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "ampKUJI", + "baseDenom": "ampKUJI", + "isNative": false + } + }, + { + "name": "MNTA", + "denom": "ibc/A4495880A4A2E3C242F63C710F447BAE072E1A4C2A22F1851E0BB7ABDD26B43D", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/kujira/images/mnta.png", + "symbol": "MNTA", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "A4495880A4A2E3C242F63C710F447BAE072E1A4C2A22F1851E0BB7ABDD26B43D", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "MNTA", + "baseDenom": "MNTA", + "isNative": false + } + }, + { + "name": "WINK", + "denom": "ibc/325300CEF4149AD1BBFEB540FF07699CDEEFBB653401E872532030CFB31CD767", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/kujira/images/wink.png", + "symbol": "WINK", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "325300CEF4149AD1BBFEB540FF07699CDEEFBB653401E872532030CFB31CD767", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "WINK", + "baseDenom": "WINK", + "isNative": false + } + }, + { + "name": "USDC", + "denom": "ibc/DF32F083238097AD2CA5444BFB8F338534C32865EFE0696C5AF89AFB3A0144D6", + "logo": "untracked.svg", + "symbol": "USDC", + "decimals": 18, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "DF32F083238097AD2CA5444BFB8F338534C32865EFE0696C5AF89AFB3A0144D6", + "path": "", + "channelId": "", + "decimals": 18, + "symbol": "USDC", + "baseDenom": "USDC", + "isNative": false + } + }, + { + "name": "Multichain USDC", + "denom": "ibc/610D4A1B3F3198C35C09E9AF7C8FB81707912463357C9398B02C7F13049678A8", + "logo": "untracked.svg", + "symbol": "USDC", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "610D4A1B3F3198C35C09E9AF7C8FB81707912463357C9398B02C7F13049678A8", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "USDC", + "baseDenom": "USDC", + "isNative": false + } + }, + { + "name": "USDT", + "denom": "ibc/24E5D0825D3D71BF00C4A01CD8CA8F2D27B1DD32B7446CF633534AEA25379271", + "logo": "untracked.svg", + "symbol": "USDT", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "24E5D0825D3D71BF00C4A01CD8CA8F2D27B1DD32B7446CF633534AEA25379271", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "USDT", + "baseDenom": "USDT", + "isNative": false + } + }, + { + "name": "DAI", + "denom": "ibc/433133545CF68587777A01C3EFCF720EFE1B42F14AB2153D349DC4559984F2E8", + "logo": "untracked.svg", + "symbol": "DAI", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "433133545CF68587777A01C3EFCF720EFE1B42F14AB2153D349DC4559984F2E8", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "DAI", + "baseDenom": "DAI", + "isNative": false + } + }, + { + "name": "WBTC", + "denom": "ibc/64431EE79F3216B8F7773A630549ADA852EA8E4B545D22BD35B0BF56FD5D5201", + "logo": "untracked.svg", + "symbol": "WBTC", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "64431EE79F3216B8F7773A630549ADA852EA8E4B545D22BD35B0BF56FD5D5201", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "WBTC", + "baseDenom": "WBTC", + "isNative": false + } + }, + { + "name": "axlWBTC", + "denom": "ibc/F57B53E102171E6DC254532ECC184228BB8E23B755AD55FA6FDCBD70464A9A54", + "logo": "untracked.svg", + "symbol": "axlWBTC", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "F57B53E102171E6DC254532ECC184228BB8E23B755AD55FA6FDCBD70464A9A54", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "axlWBTC", + "baseDenom": "axlWBTC", + "isNative": false + } + }, + { + "name": "BLEND", + "denom": "ibc/45C0FE8ACE1C9C8BA38D3D6FDEBDE4F7198A434B6C63ADCEFC3D32D12443BB84", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/kujira/images/blend.svg", + "symbol": "BLEND", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "45C0FE8ACE1C9C8BA38D3D6FDEBDE4F7198A434B6C63ADCEFC3D32D12443BB84", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "BLEND", + "baseDenom": "BLEND", + "isNative": false + } + }, + { + "name": "Oraichain", + "denom": "ibc/C20C0A822BD22B2CEF0D067400FCCFB6FAEEE9E91D360B4E0725BD522302D565", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/oraichain/images/orai-white.png", + "symbol": "ORAI", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "C20C0A822BD22B2CEF0D067400FCCFB6FAEEE9E91D360B4E0725BD522302D565", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "ORAI", + "baseDenom": "ORAI", + "isNative": false + } + }, + { + "name": "Pica", + "denom": "ibc/9C2212CB87241A8D038222CF66BBCFABDD08330DFA0AC9B451135287DCBDC7A8", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/composable/images/pica.svg", + "symbol": "PICA", + "decimals": 12, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "9C2212CB87241A8D038222CF66BBCFABDD08330DFA0AC9B451135287DCBDC7A8", + "path": "", + "channelId": "", + "decimals": 12, + "symbol": "PICA", + "baseDenom": "PICA", + "isNative": false + } + }, + { + "name": "OSMO", + "denom": "ibc/C2025C1D34ED74CD6F9DF86CD650D92219AF645E9D0ADFFACF4E2CBECE649536", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/osmosis/images/osmo.png", + "symbol": "OSMO", + "decimals": 18, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "C2025C1D34ED74CD6F9DF86CD650D92219AF645E9D0ADFFACF4E2CBECE649536", + "path": "", + "channelId": "", + "decimals": 18, + "symbol": "OSMO", + "baseDenom": "OSMO", + "isNative": false + } + }, + { + "name": "STRD", + "denom": "ibc/02683677B1A58ECF74FFF25711E09735C44153FE9490BE5EF9FD21DE82BCB542", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/stride/images/strd.png", + "symbol": "STRD", + "decimals": 18, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "02683677B1A58ECF74FFF25711E09735C44153FE9490BE5EF9FD21DE82BCB542", + "path": "", + "channelId": "", + "decimals": 18, + "symbol": "STRD", + "baseDenom": "STRD", + "isNative": false + } + }, + { + "name": "BLD", + "denom": "ibc/B7933C59879BFE059942C6F76CAF4B1609D441AD22D54D42DAC00CE7918CAF1F", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/agoric/images/bld.png", + "symbol": "BLD", + "decimals": 18, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "B7933C59879BFE059942C6F76CAF4B1609D441AD22D54D42DAC00CE7918CAF1F", + "path": "", + "channelId": "", + "decimals": 18, + "symbol": "BLD", + "baseDenom": "BLD", + "isNative": false + } + }, + { + "name": "stATOM", + "denom": "ibc/B024EC4AE846F690CB46C1CE886BE7DCE27CBBB6CE1E4EFBA4AA764E07B81A69", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/stride/images/statom.png", + "symbol": "stATOM", + "decimals": 18, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "B024EC4AE846F690CB46C1CE886BE7DCE27CBBB6CE1E4EFBA4AA764E07B81A69", + "path": "", + "channelId": "", + "decimals": 18, + "symbol": "stATOM", + "baseDenom": "stATOM", + "isNative": false + } + }, + { + "name": "NTRN", + "denom": "ibc/E8E84092B9063AAC97846712D43D6555928073B8A0BFFCC2549E55EE224F1610", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/neutron/images/ntrn.png", + "symbol": "NTRN", + "decimals": 18, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "E8E84092B9063AAC97846712D43D6555928073B8A0BFFCC2549E55EE224F1610", + "path": "", + "channelId": "", + "decimals": 18, + "symbol": "NTRN", + "baseDenom": "NTRN", + "isNative": false + } + }, + { + "name": "UMEE", + "denom": "ibc/221E9E20795E6E250532A6A871E7F6310FCEDFC69B681037BBA6561270360D86", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/umee/images/umee.png", + "symbol": "UMEE", + "decimals": 18, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "221E9E20795E6E250532A6A871E7F6310FCEDFC69B681037BBA6561270360D86", + "path": "", + "channelId": "", + "decimals": 18, + "symbol": "UMEE", + "baseDenom": "UMEE", + "isNative": false + } + }, + { + "name": "CRE", + "denom": "ibc/DDE000907D85FB1F358B3FBB1143452BE13F68E0BEA0DFFD8787095B76EEE0A1", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/crescent/images/cre.png", + "symbol": "CRE", + "decimals": 18, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "DDE000907D85FB1F358B3FBB1143452BE13F68E0BEA0DFFD8787095B76EEE0A1", + "path": "", + "channelId": "", + "decimals": 18, + "symbol": "CRE", + "baseDenom": "CRE", + "isNative": false + } + }, + { + "name": "SCRT", + "denom": "ibc/7C4A4847D6898FA8744A8F2A4FC287E98CA5A95E05842B897B3FB301103C8AB6", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/secretnetwork/images/scrt.png", + "symbol": "SCRT", + "decimals": 18, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "7C4A4847D6898FA8744A8F2A4FC287E98CA5A95E05842B897B3FB301103C8AB6", + "path": "", + "channelId": "", + "decimals": 18, + "symbol": "SCRT", + "baseDenom": "SCRT", + "isNative": false + } + }, + { + "name": "STARS", + "denom": "ibc/4D29F082A3C083C85C886B92A1EB438C3FC0632E5F9E4D875479BEB7B9511BD5", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/stargaze/images/stars.png", + "symbol": "STARS", + "decimals": 18, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "4D29F082A3C083C85C886B92A1EB438C3FC0632E5F9E4D875479BEB7B9511BD5", + "path": "", + "channelId": "", + "decimals": 18, + "symbol": "STARS", + "baseDenom": "STARS", + "isNative": false + } + }, + { + "name": "bCRE", + "denom": "ibc/83D54420DD46764F2ED5EE511DAA63EC28012480A245D8E33AA1F7D1FB15D736", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/crescent/images/bcre.png", + "symbol": "bCRE", + "decimals": 18, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "83D54420DD46764F2ED5EE511DAA63EC28012480A245D8E33AA1F7D1FB15D736", + "path": "", + "channelId": "", + "decimals": 18, + "symbol": "bCRE", + "baseDenom": "bCRE", + "isNative": false + } + }, + { + "name": "HUAHUA", + "denom": "ibc/9D9B59CA222E54842555DBD81B22EEABE61796D4C6EC8AB47A97C388333AC340", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/chihuahua/images/huahua.png", + "symbol": "HUAHUA", + "decimals": 18, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "9D9B59CA222E54842555DBD81B22EEABE61796D4C6EC8AB47A97C388333AC340", + "path": "", + "channelId": "", + "decimals": 18, + "symbol": "HUAHUA", + "baseDenom": "HUAHUA", + "isNative": false + } + }, + { + "name": "USDT", + "denom": "ibc/7965483148018AFAA12DC569959897E7A5E474F4B41A87FFC5513B552C108DB5", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/_non-cosmos/ethereum/images/usdt.png", + "symbol": "USDT", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "7965483148018AFAA12DC569959897E7A5E474F4B41A87FFC5513B552C108DB5", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "USDT", + "baseDenom": "USDT", + "isNative": false + } + }, + { + "name": "ATOM", + "denom": "ibc/377F82FD1E4F6408B1CB7C8BFF9134A1F2C5D5E5CC2760BAD972AF0F7F6D4675", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/cosmoshub/images/atom.png", + "symbol": "ATOM", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "377F82FD1E4F6408B1CB7C8BFF9134A1F2C5D5E5CC2760BAD972AF0F7F6D4675", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "ATOM", + "baseDenom": "ATOM", + "isNative": false + } + }, + { + "name": "Dot", + "denom": "ibc/B0442E32E21ED4228301A2B1B247D3F3355B73BF288470F9643AAD0CA07DD593", + "logo": "untracked.svg", + "symbol": "DOT", + "decimals": 10, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "B0442E32E21ED4228301A2B1B247D3F3355B73BF288470F9643AAD0CA07DD593", + "path": "", + "channelId": "", + "decimals": 10, + "symbol": "DOT", + "baseDenom": "DOT", + "isNative": false + } + }, + { + "name": "ATOM", + "denom": "ibc/8D311D92BCD4E87F145DEB9DDA339416DEF7E13571D92A3521CAB0BF62760FBE", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/cosmoshub/images/atom.png", + "symbol": "ATOM", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "8D311D92BCD4E87F145DEB9DDA339416DEF7E13571D92A3521CAB0BF62760FBE", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "ATOM", + "baseDenom": "ATOM", + "isNative": false + } + }, + { + "name": "ERIS Amplified INJ", + "denom": "factory/inj1cdwt8g7nxgtg2k4fn8sj363mh9ahkw2qt0vrnc/ampINJ", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/injective/images/ampinj.png", + "symbol": "ampINJ", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "factory/inj1cdwt8g7nxgtg2k4fn8sj363mh9ahkw2qt0vrnc/ampINJ", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "ampINJ", + "baseDenom": "ampINJ", + "isNative": false + } + }, + { + "name": "CDT", + "denom": "ibc/25288BA0C7D146D37373657ECA719B9AADD49DA9E514B4172D08F7C88D56C9EF", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/osmosis/images/CDT.svg", + "symbol": "CDT", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "25288BA0C7D146D37373657ECA719B9AADD49DA9E514B4172D08F7C88D56C9EF", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "CDT", + "baseDenom": "CDT", + "isNative": false + } + }, + { + "name": "MBRN", + "denom": "ibc/7AF90EDF6F5328C6C33B03DB7E33445708A46FF006932472D00D5076F5504B67", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/osmosis/images/MBRN.svg", + "symbol": "MBRN", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "7AF90EDF6F5328C6C33B03DB7E33445708A46FF006932472D00D5076F5504B67", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "MBRN", + "baseDenom": "MBRN", + "isNative": false + } + }, + { + "name": "GEM DAO", + "denom": "ibc/8AE86084C0D921352F711EF42CCA7BA4C8238C244FE4CC3E4E995D9782FB0E2B", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/terra2/images/gem.png", + "symbol": "GEM", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "8AE86084C0D921352F711EF42CCA7BA4C8238C244FE4CC3E4E995D9782FB0E2B", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "GEM", + "baseDenom": "GEM", + "isNative": false + } + } +] \ No newline at end of file diff --git a/packages/sdk-ui-ts/src/services/ibc/tokens.ts b/packages/sdk-ui-ts/src/services/ibc/tokens.ts new file mode 100644 index 000000000..0adcfb85b --- /dev/null +++ b/packages/sdk-ui-ts/src/services/ibc/tokens.ts @@ -0,0 +1,71 @@ +import { HttpRestClient } from '@injectivelabs/utils' +import path from 'path' +import fs from 'fs' +import { + Token, + TokenType, + TokenVerification, +} from '@injectivelabs/token-metadata' + +type IbcTokenMetadata = { + name: string + symbol: string + contractAddr: string + decimals: number + numberOfPools: number + imageUrl: string + isTrading: boolean +} + +const ibcTokenMetadataApi = new HttpRestClient('https://api.tfm.com/api/v1/') + +const TOKEN_METADATA_PATH = 'ibc/chain/injective-1/tokens' + +function ibcTokenMetadataToToken( + ibcTokenMetadata: IbcTokenMetadata[], +): Token[] { + return ibcTokenMetadata.map((token) => { + return { + name: token.name || 'Unknown', + denom: token.contractAddr || '', + logo: token.imageUrl || 'untracked.svg', + symbol: token.symbol || 'Unknown', + decimals: token.decimals || 18, + coinGeckoId: '', + tokenType: TokenType.Ibc, + tokenVerification: TokenVerification.External, + ibc: { + hash: (token.contractAddr || '').replace('ibc/', ''), + path: '', + channelId: '', + decimals: token.decimals || 18, + symbol: token.symbol || 'Unknown', + baseDenom: token.symbol || 'Unknown', + isNative: false, + }, + } + }) +} + +;(async () => { + try { + const response = (await ibcTokenMetadataApi.get(TOKEN_METADATA_PATH)) as { + data: IbcTokenMetadata[] + } + + if (!response.data || !Array.isArray(response.data)) { + return + } + + const ibcTokens = ibcTokenMetadataToToken(response.data) + const outputPath = path.resolve( + `${process.cwd()}/src/services/ibc/ibcTokenMetadata.json`, + ) + + fs.writeFileSync(outputPath, JSON.stringify(ibcTokens, null, 2)) + } catch (e) { + console.log(e) + + return + } +})() diff --git a/packages/sdk-ui-ts/src/types/bridge.ts b/packages/sdk-ui-ts/src/types/bridge.ts index bad8b07d7..b35abb330 100644 --- a/packages/sdk-ui-ts/src/types/bridge.ts +++ b/packages/sdk-ui-ts/src/types/bridge.ts @@ -31,6 +31,7 @@ export enum BridgingNetwork { Sui = 'sui', Kava = 'kava', Oraichain = 'oraichain', + Noble = 'noble', } export const MintScanExplorerUrl = { @@ -46,6 +47,7 @@ export const MintScanExplorerUrl = { [BridgingNetwork.Sommelier]: 'sommelier', [BridgingNetwork.Canto]: 'canto', [BridgingNetwork.Kava]: 'kava', + [BridgingNetwork.Noble]: 'noble', } as Record export enum BridgeTransactionState { diff --git a/packages/sdk-ui-ts/src/utils/bridge.ts b/packages/sdk-ui-ts/src/utils/bridge.ts index e30f99863..b3cc4cdba 100644 --- a/packages/sdk-ui-ts/src/utils/bridge.ts +++ b/packages/sdk-ui-ts/src/utils/bridge.ts @@ -49,6 +49,7 @@ export const KeplrNetworks = [ BridgingNetwork.Sommelier, BridgingNetwork.Kava, BridgingNetwork.Oraichain, + BridgingNetwork.Noble, ] export const LeapNetworks = [ @@ -61,6 +62,7 @@ export const LeapNetworks = [ BridgingNetwork.Sommelier, BridgingNetwork.Canto, BridgingNetwork.Kava, + BridgingNetwork.Noble, ] export const CosmostationNetworks = [ @@ -77,6 +79,7 @@ export const CosmostationNetworks = [ BridgingNetwork.Sommelier, BridgingNetwork.Canto, BridgingNetwork.Kava, + BridgingNetwork.Noble, ] export const CosmosNetworks = [ @@ -94,6 +97,7 @@ export const CosmosNetworks = [ BridgingNetwork.Canto, BridgingNetwork.Kava, BridgingNetwork.Oraichain, + BridgingNetwork.Noble, ] export const EvmWormholeNetworks = [ @@ -263,9 +267,17 @@ export const tokenDenomsPerNetwork = [ denoms: [], symbols: ['WMATIC'], }, + + { + network: BridgingNetwork.Noble, + denoms: [ + 'ibc/2CBC2EA121AE42563B08028466F37B600F2D7D4282342DE938283CC3FB2BC00E', + ], + symbols: ['usdcnb'], + }, ] as NetworkConfig[] -export const cosmosNativeDenomsFromChainId = { +export const cosmosChainTokenMetaMap = { [CosmosChainId.Cosmoshub]: { ...tokenMetaUtils.getMetaBySymbol('ATOM'), tokenType: TokenType.Ibc, @@ -432,6 +444,12 @@ export const cosmosNativeDenomsFromChainId = { tokenType: TokenType.Ibc, denom: 'inj', }, + [CosmosChainId.Noble]: { + ...tokenMetaUtils.getMetaBySymbol('USDCnb'), + tokenType: TokenType.Ibc, + denom: + 'ibc/2CBC2EA121AE42563B08028466F37B600F2D7D4282342DE938283CC3FB2BC00E', + }, } as Record export const ibcHashToNativeInjPerNetwork = { @@ -634,6 +652,10 @@ export const getNetworkFromAddress = (sender: string): BridgingNetwork => { return BridgingNetwork.Ethereum } + if (sender.startsWith('noble')) { + return BridgingNetwork.Noble + } + return BridgingNetwork.CosmosHub } diff --git a/packages/sdk-ui-ts/src/validators-logo/index.ts b/packages/sdk-ui-ts/src/validators-logo/index.ts index c78cdb611..24dd98bd1 100644 --- a/packages/sdk-ui-ts/src/validators-logo/index.ts +++ b/packages/sdk-ui-ts/src/validators-logo/index.ts @@ -10,7 +10,7 @@ export interface ValidatorMap { [validatorAddress: string]: string | undefined } -const endpoints = getNetworkEndpoints(Network.MainnetK8s) +const endpoints = getNetworkEndpoints(Network.MainnetSentry) const chainGrpcStakingApi = new ChainGrpcStakingApi(endpoints.grpc) const keybaseApi = new HttpRestClient('https://keybase.io/_/api/1.0/') diff --git a/packages/test-utils/CHANGELOG.md b/packages/test-utils/CHANGELOG.md index 314e8f484..d59ce99c2 100644 --- a/packages/test-utils/CHANGELOG.md +++ b/packages/test-utils/CHANGELOG.md @@ -3,6 +3,26 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.14.1-beta.0](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/test-utils@1.14.0-beta.1...@injectivelabs/test-utils@1.14.1-beta.0) (2023-09-23) + +**Note:** Version bump only for package @injectivelabs/test-utils + +# [1.14.0](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/test-utils@1.14.0-beta.1...@injectivelabs/test-utils@1.14.0) (2023-09-22) + +**Note:** Version bump only for package @injectivelabs/test-utils + +# [1.14.0-beta.1](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/test-utils@1.13.1-beta.1...@injectivelabs/test-utils@1.14.0-beta.1) (2023-09-22) + +**Note:** Version bump only for package @injectivelabs/test-utils + +## [1.13.1-beta.1](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/test-utils@1.13.0...@injectivelabs/test-utils@1.13.1-beta.1) (2023-09-22) + +**Note:** Version bump only for package @injectivelabs/test-utils + +# [1.13.0](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/test-utils@1.12.1...@injectivelabs/test-utils@1.13.0) (2023-09-22) + +**Note:** Version bump only for package @injectivelabs/test-utils + ## [1.12.1](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/test-utils@1.12.0...@injectivelabs/test-utils@1.12.1) (2023-08-31) **Note:** Version bump only for package @injectivelabs/test-utils diff --git a/packages/test-utils/package.json b/packages/test-utils/package.json index a932ffaac..7585b7392 100644 --- a/packages/test-utils/package.json +++ b/packages/test-utils/package.json @@ -1,7 +1,7 @@ { "name": "@injectivelabs/test-utils", "description": "List of test-utils and helper functions that can be reused throughout Injective's projects.", - "version": "1.12.1", + "version": "1.14.1-beta.5", "sideEffects": false, "author": { "name": "Bojan Angjelkoski", diff --git a/packages/token-metadata/CHANGELOG.md b/packages/token-metadata/CHANGELOG.md index 8890db59c..2f27dc739 100644 --- a/packages/token-metadata/CHANGELOG.md +++ b/packages/token-metadata/CHANGELOG.md @@ -3,6 +3,38 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.14.1-beta.0](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/token-metadata@1.14.0-beta.1...@injectivelabs/token-metadata@1.14.1-beta.0) (2023-09-23) + +**Note:** Version bump only for package @injectivelabs/token-metadata + +# [1.14.0](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/token-metadata@1.14.0-beta.1...@injectivelabs/token-metadata@1.14.0) (2023-09-22) + +**Note:** Version bump only for package @injectivelabs/token-metadata + +# [1.14.0-beta.1](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/token-metadata@1.14.0-beta.0...@injectivelabs/token-metadata@1.14.0-beta.1) (2023-09-22) + +**Note:** Version bump only for package @injectivelabs/token-metadata + +# [1.14.0-beta.0](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/token-metadata@1.13.1-beta.2...@injectivelabs/token-metadata@1.14.0-beta.0) (2023-09-22) + +### Features + +- cw20 addr validation ([c4332e0](https://github.com/InjectiveLabs/injective-ts/commit/c4332e05cc63f0f5b3bc36797970571cf0347643)) + +## [1.13.1-beta.2](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/token-metadata@1.13.1-beta.1...@injectivelabs/token-metadata@1.13.1-beta.2) (2023-09-22) + +### Bug Fixes + +- minor inj address check ([a89c95f](https://github.com/InjectiveLabs/injective-ts/commit/a89c95f58b1857a18e1f8ce581d51432c326d7b4)) + +## [1.13.1-beta.1](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/token-metadata@1.13.0...@injectivelabs/token-metadata@1.13.1-beta.1) (2023-09-22) + +**Note:** Version bump only for package @injectivelabs/token-metadata + +# [1.13.0](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/token-metadata@1.12.2-beta.13...@injectivelabs/token-metadata@1.13.0) (2023-09-22) + +**Note:** Version bump only for package @injectivelabs/token-metadata + ## [1.12.2-beta.13](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/token-metadata@1.12.2-beta.12...@injectivelabs/token-metadata@1.12.2-beta.13) (2023-09-21) **Note:** Version bump only for package @injectivelabs/token-metadata diff --git a/packages/token-metadata/package.json b/packages/token-metadata/package.json index ecbcefb1c..01a9415f5 100644 --- a/packages/token-metadata/package.json +++ b/packages/token-metadata/package.json @@ -1,7 +1,7 @@ { "name": "@injectivelabs/token-metadata", "description": "ERC20 token metadata. Name, symbol, decimals, etc.", - "version": "1.12.2-beta.13", + "version": "1.14.1-beta.15", "sideEffects": false, "license": "Apache-2.0", "author": { @@ -32,10 +32,10 @@ "start": "node dist/index.js" }, "dependencies": { - "@injectivelabs/exceptions": "^1.12.2-beta.1", - "@injectivelabs/networks": "^1.12.2-beta.4", - "@injectivelabs/ts-types": "^1.12.2-beta.1", - "@injectivelabs/utils": "^1.12.2-beta.2", + "@injectivelabs/exceptions": "^1.14.1-beta.7", + "@injectivelabs/networks": "^1.14.1-beta.8", + "@injectivelabs/ts-types": "^1.14.1-beta.7", + "@injectivelabs/utils": "^1.14.1-beta.6", "@types/lodash.values": "^4.3.6", "copyfiles": "^2.4.1", "jsonschema": "^1.4.0", diff --git a/packages/token-metadata/src/TokenFactory.ts b/packages/token-metadata/src/TokenFactory.ts index 640cb3990..91da45444 100644 --- a/packages/token-metadata/src/TokenFactory.ts +++ b/packages/token-metadata/src/TokenFactory.ts @@ -11,7 +11,7 @@ import { } from './tokens/network' import { Token, TokenMeta, TokenType } from './types' import tokensBySymbol from './tokens/tokens' -import { getTokenFromMeta } from './utils' +import { getTokenFromMeta, isCw20ContractAddress } from './utils' export class TokenFactory { public tokenMetaUtils: TokenMetaUtils @@ -129,7 +129,7 @@ export class TokenFactory { } getCw20DenomTokenMeta(address: string): TokenMeta | undefined { - if (!address.startsWith('inj')) { + if (!isCw20ContractAddress(address)) { throw new GeneralException( new Error(`The address ${address} is not a valid CW20 address`), ) @@ -151,7 +151,7 @@ export class TokenFactory { ) } - if (address.startsWith('inj')) { + if (isCw20ContractAddress(address)) { const tokenMeta = this.tokenMetaUtils.getMetaByAddress(address) return tokenMeta diff --git a/packages/token-metadata/src/ibc/channels.ts b/packages/token-metadata/src/ibc/channels.ts index 0f8db3796..95bc21ea8 100644 --- a/packages/token-metadata/src/ibc/channels.ts +++ b/packages/token-metadata/src/ibc/channels.ts @@ -14,6 +14,7 @@ export enum CanonicalChannelToDestinationChannel { Migaloo = 'channel-102', Kava = 'channel-143', Oraichain = 'channel-147', + Noble = 'channel-148', } /** @@ -84,6 +85,7 @@ export const canonicalChannelsToChainList = [ { channelId: 'channel-3', chainA: 'Migaloo', chainB: 'Injective' }, { channelId: 'channel-122', chainA: 'Kava', chainB: 'Injective' }, { channelId: 'channel-146', chainA: 'Oraichain', chainB: 'Injective' }, + { channelId: 'channel-31', chainA: 'Noble', chainB: 'Injective' }, { channelId: 'channel-1', chainA: 'Injective', chainB: 'CosmosHub' }, { channelId: 'channel-83', chainA: 'Injective', chainB: 'Evmos' }, { channelId: 'channel-8', chainA: 'Injective', chainB: 'Osmosis' }, @@ -103,6 +105,7 @@ export const canonicalChannelsToChainList = [ { channelId: 'channel-105', chainA: 'Injective', chainB: 'Terra2' }, { channelId: 'channel-143', chainA: 'Injective', chainB: 'Kava' }, { channelId: 'channel-147', chainA: 'Injective', chainB: 'Oraichain' }, + { channelId: 'channel-148', chainA: 'Injective', chainB: 'Noble' }, ] export default legacyCanonicalChannels @@ -130,6 +133,7 @@ export const canonicalChannelIds = [ 'channel-105', 'channel-143', 'channel-147', + 'channel-148', ] export const channelIbcDenomToBaseDenomMap = { diff --git a/packages/token-metadata/src/images/axelar.jpeg b/packages/token-metadata/src/images/axelar.jpeg deleted file mode 100644 index 770fe7f27..000000000 Binary files a/packages/token-metadata/src/images/axelar.jpeg and /dev/null differ diff --git a/packages/token-metadata/src/images/axelar.svg b/packages/token-metadata/src/images/axelar.svg new file mode 100644 index 000000000..d0d937a78 --- /dev/null +++ b/packages/token-metadata/src/images/axelar.svg @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/packages/token-metadata/src/images/tia.webp b/packages/token-metadata/src/images/tia.webp new file mode 100644 index 000000000..957a90ba3 Binary files /dev/null and b/packages/token-metadata/src/images/tia.webp differ diff --git a/packages/token-metadata/src/images/truEVINDEX.svg b/packages/token-metadata/src/images/truEVINDEX.svg new file mode 100644 index 000000000..67d83a6f6 --- /dev/null +++ b/packages/token-metadata/src/images/truEVINDEX.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/packages/token-metadata/src/images/truflation.svg b/packages/token-metadata/src/images/truflation.svg new file mode 100644 index 000000000..308ef3d79 --- /dev/null +++ b/packages/token-metadata/src/images/truflation.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/packages/token-metadata/src/tokens/mappings/mapBySymbol.ts b/packages/token-metadata/src/tokens/mappings/mapBySymbol.ts index 403bfbdaf..8868aad08 100644 --- a/packages/token-metadata/src/tokens/mappings/mapBySymbol.ts +++ b/packages/token-metadata/src/tokens/mappings/mapBySymbol.ts @@ -8,35 +8,18 @@ export const getMappedTokensBySymbol = (tokens: Record) => const symbol = tokenMeta.symbol.toUpperCase() const symbolDiffs = symbol !== symbolKey + let ibcResults = {} + let cw20Results = {} + let splResults = {} + let evmResults = {} + let erc20Results = {} + let cw20sResults = {} + if (tokenMeta.ibc && tokenMeta.ibc.baseDenom) { - return { - ...result, + ibcResults = { [tokenMeta.ibc.baseDenom.toUpperCase()]: tokenMeta, - [symbol.toUpperCase()]: tokenMeta, - ...(symbolDiffs && { - [symbolKey.toUpperCase()]: tokenMeta, - }), - } - } - - if (tokenMeta.cw20 && tokenMeta.cw20.address) { - return { - ...result, - [tokenMeta.cw20.address.toUpperCase()]: tokenMeta, - [symbol.toUpperCase()]: tokenMeta, - ...(symbolDiffs && { - [symbolKey.toUpperCase()]: tokenMeta, - }), - } - } - - if (tokenMeta.spl && tokenMeta.spl.address) { - return { - ...result, - [tokenMeta.spl.address.toUpperCase()]: tokenMeta, - [symbol.toUpperCase()]: tokenMeta, - ...(symbolDiffs && { - [symbolKey.toUpperCase()]: tokenMeta, + ...(tokenMeta.ibc.symbol && { + [tokenMeta.ibc.symbol.toUpperCase()]: tokenMeta, }), } } @@ -50,18 +33,32 @@ export const getMappedTokensBySymbol = (tokens: Record) => {} as Record, ) - return { - ...result, + cw20sResults = { ...cw20Maps, [symbol.toUpperCase()]: tokenMeta, - ...(symbolDiffs && { - [symbolKey.toUpperCase()]: tokenMeta, - }), + } + } + + if (tokenMeta.evm && tokenMeta.evm.symbol) { + evmResults = { + [tokenMeta.evm.symbol.toUpperCase()]: tokenMeta, + } + } + + if (tokenMeta.erc20 && tokenMeta.erc20.symbol) { + erc20Results = { + [tokenMeta.erc20.symbol.toUpperCase()]: tokenMeta, } } return { ...result, + ...splResults, + ...evmResults, + ...ibcResults, + ...cw20Results, + ...cw20sResults, + ...erc20Results, [symbol.toUpperCase()]: tokenMeta, ...(symbolDiffs && { [symbolKey.toUpperCase()]: tokenMeta, diff --git a/packages/token-metadata/src/tokens/tokens/tokens.ts b/packages/token-metadata/src/tokens/tokens/tokens.ts index fb308b580..ad5b08c3c 100644 --- a/packages/token-metadata/src/tokens/tokens/tokens.ts +++ b/packages/token-metadata/src/tokens/tokens/tokens.ts @@ -94,6 +94,17 @@ export default { address: '0xdAC17F958D2ee523a2206206994597C13D831ec7', tokenType: TokenType.Erc20, }, + + ibc: { + decimals: 6, + symbol: 'USDTkv', + isNative: true, + baseDenom: 'erc20/tether/usdt', + path: 'transfer/channel-143', + channelId: 'channel-143', + hash: '4ABBEF4C8926DDDB320AE5188CFD63267ABBCEFC0583E4AE05D6E5AA2401DDAB', + tokenType: TokenType.Ibc, + }, }, USDC: { @@ -118,6 +129,7 @@ export default { address: 'inj1q6zlut7gtkzknkk773jecujwsdkgq882akqksk', tokenType: TokenType.Cw20, }, + { decimals: 6, symbol: 'USDCso', @@ -126,6 +138,17 @@ export default { tokenType: TokenType.Cw20, }, ], + + ibc: { + decimals: 6, + symbol: 'USDCnb', + baseDenom: 'uusdc', + isNative: true, + channelId: 'channel-148', + path: 'transfer/channel-148', + hash: '2CBC2EA121AE42563B08028466F37B600F2D7D4282342DE938283CC3FB2BC00E', + tokenType: TokenType.Ibc, + }, }, GRT: { @@ -831,7 +854,7 @@ export default { AXL: { name: 'Axelar', - logo: 'axelar.jpeg', + logo: 'axelar.svg', symbol: 'AXL', decimals: 6, coinGeckoId: 'axelar', @@ -1020,7 +1043,7 @@ export default { name: 'PROJ', logo: 'projx.png', symbol: 'PROJ', - decimals: 6, + decimals: 18, coinGeckoId: '', }, @@ -1711,24 +1734,6 @@ export default { }, }, - USDTkv: { - name: 'Tether', - symbol: 'USDTkv', - decimals: 6, - logo: 'usdt.svg', - coinGeckoId: 'tether', - - ibc: { - decimals: 6, - isNative: true, - baseDenom: 'erc20/tether/usdt', - path: 'transfer/channel-143', - channelId: 'channel-143', - hash: '4ABBEF4C8926DDDB320AE5188CFD63267ABBCEFC0583E4AE05D6E5AA2401DDAB', - tokenType: TokenType.Ibc, - }, - }, - SEI: { name: 'SEI', symbol: 'SEI', @@ -1816,4 +1821,36 @@ export default { tokenType: TokenType.Ibc, }, }, + + GOLD: { + name: 'GOLD', + symbol: 'GOLD', + decimals: 18, + logo: 'gold.svg', + coinGeckoId: '', + }, + + EVINDEX: { + name: 'EVIINDEX', + symbol: 'EVIINDEX', + decimals: 18, + logo: 'truEVINDEX.svg', + coinGeckoId: '', + }, + + TRUCPI: { + name: 'TRUCPI', + symbol: 'TRUCPI', + decimals: 18, + logo: 'truflation.svg', + coinGeckoId: '', + }, + + TIA: { + name: 'Celestia', + symbol: 'TIA', + decimals: 6, + logo: 'tia.webp', + coinGeckoId: '', + }, } as Record diff --git a/packages/token-metadata/src/utils.ts b/packages/token-metadata/src/utils.ts index 1e8202ced..47869110b 100644 --- a/packages/token-metadata/src/utils.ts +++ b/packages/token-metadata/src/utils.ts @@ -48,7 +48,7 @@ export const getTokenTypeFromDenom = (denom: string) => { return TokenType.Native } - if (denom.startsWith('inj')) { + if (isCw20ContractAddress(denom)) { return TokenType.Cw20 } @@ -94,7 +94,7 @@ export const getTokenDecimals = (token: Token) => { return token.decimals } - if (token.denom.startsWith('inj')) { + if (isCw20ContractAddress(token.denom)) { return token.cw20?.decimals || token.decimals } @@ -288,3 +288,6 @@ export const getUnknownTokenWithSymbol = (denom: string): Token => { tokenVerification: TokenVerification.Unverified, } as Token } + +export const isCw20ContractAddress = (address: string) => + address.length === 42 && address.startsWith('inj') diff --git a/packages/token-utils/CHANGELOG.md b/packages/token-utils/CHANGELOG.md index edfebbfed..499f150bf 100644 --- a/packages/token-utils/CHANGELOG.md +++ b/packages/token-utils/CHANGELOG.md @@ -3,6 +3,26 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.14.1-beta.0](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/token-utils@1.14.0-beta.1...@injectivelabs/token-utils@1.14.1-beta.0) (2023-09-23) + +**Note:** Version bump only for package @injectivelabs/token-utils + +# [1.14.0](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/token-utils@1.14.0-beta.1...@injectivelabs/token-utils@1.14.0) (2023-09-22) + +**Note:** Version bump only for package @injectivelabs/token-utils + +# [1.14.0-beta.1](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/token-utils@1.13.1-beta.1...@injectivelabs/token-utils@1.14.0-beta.1) (2023-09-22) + +**Note:** Version bump only for package @injectivelabs/token-utils + +## [1.13.1-beta.1](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/token-utils@1.13.0...@injectivelabs/token-utils@1.13.1-beta.1) (2023-09-22) + +**Note:** Version bump only for package @injectivelabs/token-utils + +# [1.13.0](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/token-utils@1.12.2-beta.2...@injectivelabs/token-utils@1.13.0) (2023-09-22) + +**Note:** Version bump only for package @injectivelabs/token-utils + ## [1.12.2-beta.2](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/token-utils@1.12.2-beta.1...@injectivelabs/token-utils@1.12.2-beta.2) (2023-09-12) **Note:** Version bump only for package @injectivelabs/token-utils diff --git a/packages/token-utils/package.json b/packages/token-utils/package.json index 5bf2fd86a..c4b47079e 100644 --- a/packages/token-utils/package.json +++ b/packages/token-utils/package.json @@ -1,6 +1,6 @@ { "name": "@injectivelabs/token-utils", - "version": "1.12.2-beta.2", + "version": "1.14.1-beta.7", "description": "Token Utils is a package for querying different data about tokens", "sideEffects": false, "author": { @@ -30,8 +30,8 @@ "start": "node dist/index.js" }, "dependencies": { - "@injectivelabs/exceptions": "^1.12.2-beta.1", - "@injectivelabs/utils": "^1.12.2-beta.2", + "@injectivelabs/exceptions": "^1.14.1-beta.7", + "@injectivelabs/utils": "^1.14.1-beta.6", "link-module-alias": "^1.2.0", "shx": "^0.3.2" }, diff --git a/packages/ts-types/CHANGELOG.md b/packages/ts-types/CHANGELOG.md index 75e4fe113..a68e544ae 100644 --- a/packages/ts-types/CHANGELOG.md +++ b/packages/ts-types/CHANGELOG.md @@ -3,6 +3,26 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.14.1-beta.0](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/ts-types@1.14.0-beta.1...@injectivelabs/ts-types@1.14.1-beta.0) (2023-09-23) + +**Note:** Version bump only for package @injectivelabs/ts-types + +# [1.14.0](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/ts-types@1.14.0-beta.1...@injectivelabs/ts-types@1.14.0) (2023-09-22) + +**Note:** Version bump only for package @injectivelabs/ts-types + +# [1.14.0-beta.1](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/ts-types@1.13.1-beta.1...@injectivelabs/ts-types@1.14.0-beta.1) (2023-09-22) + +**Note:** Version bump only for package @injectivelabs/ts-types + +## [1.13.1-beta.1](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/ts-types@1.13.0...@injectivelabs/ts-types@1.13.1-beta.1) (2023-09-22) + +**Note:** Version bump only for package @injectivelabs/ts-types + +# [1.13.0](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/ts-types@1.12.2-beta.1...@injectivelabs/ts-types@1.13.0) (2023-09-22) + +**Note:** Version bump only for package @injectivelabs/ts-types + ## [1.12.2-beta.1](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/ts-types@1.12.2-beta.0...@injectivelabs/ts-types@1.12.2-beta.1) (2023-09-12) **Note:** Version bump only for package @injectivelabs/ts-types diff --git a/packages/ts-types/package.json b/packages/ts-types/package.json index 14a5f1304..0fdb0e9f4 100644 --- a/packages/ts-types/package.json +++ b/packages/ts-types/package.json @@ -1,7 +1,7 @@ { "name": "@injectivelabs/ts-types", "description": "List of types that can be reused throughout Injective's projects.", - "version": "1.12.2-beta.1", + "version": "1.14.1-beta.7", "sideEffects": false, "license": "Apache-2.0", "main": "dist/cjs/index.js", diff --git a/packages/ts-types/src/cosmos.ts b/packages/ts-types/src/cosmos.ts index d1642e74b..2966e0977 100644 --- a/packages/ts-types/src/cosmos.ts +++ b/packages/ts-types/src/cosmos.ts @@ -21,6 +21,7 @@ export enum CosmosChainId { Canto = 'canto_7700-1', Kava = 'kava_2222-10', Oraichain = 'Oraichain', + Noble = 'noble-1', } export enum TestnetCosmosChainId { diff --git a/packages/ts-types/src/enums.ts b/packages/ts-types/src/enums.ts index 2e01dac6d..e7a4bc341 100644 --- a/packages/ts-types/src/enums.ts +++ b/packages/ts-types/src/enums.ts @@ -18,9 +18,11 @@ export enum ChainId { export enum MsgType { MsgExec = 'cosmos.authz.v1beta1.MsgExec', MsgGrant = 'cosmos.authz.v1beta1.MsgGrant', + MsgRevoke = 'cosmos.authz.v1beta1.MsgRevoke', MsgSend = 'cosmos.bank.v1beta1.MsgSend', MsgWithdrawDelegatorReward = 'cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward', MsgGrantAllowance = 'cosmos.feegrant.v1beta1.MsgGrantAllowance', + MsgRevokeAllowance = 'cosmos.feegrant.v1beta1.MsgRevokeAllowance', MsgDepositCosmos = 'cosmos.gov.v1beta1.MsgDeposit', MsgSubmitProposal = 'cosmos.gov.v1beta1.MsgSubmitProposal', MsgVote = 'cosmos.gov.v1beta1.MsgVote', diff --git a/packages/utils/CHANGELOG.md b/packages/utils/CHANGELOG.md index 54b97d971..1ef512287 100644 --- a/packages/utils/CHANGELOG.md +++ b/packages/utils/CHANGELOG.md @@ -3,6 +3,26 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.14.1-beta.0](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/utils@1.14.0-beta.1...@injectivelabs/utils@1.14.1-beta.0) (2023-09-23) + +**Note:** Version bump only for package @injectivelabs/utils + +# [1.14.0](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/utils@1.14.0-beta.1...@injectivelabs/utils@1.14.0) (2023-09-22) + +**Note:** Version bump only for package @injectivelabs/utils + +# [1.14.0-beta.1](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/utils@1.13.1-beta.1...@injectivelabs/utils@1.14.0-beta.1) (2023-09-22) + +**Note:** Version bump only for package @injectivelabs/utils + +## [1.13.1-beta.1](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/utils@1.13.0...@injectivelabs/utils@1.13.1-beta.1) (2023-09-22) + +**Note:** Version bump only for package @injectivelabs/utils + +# [1.13.0](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/utils@1.12.2-beta.2...@injectivelabs/utils@1.13.0) (2023-09-22) + +**Note:** Version bump only for package @injectivelabs/utils + ## [1.12.2-beta.2](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/utils@1.12.2-beta.1...@injectivelabs/utils@1.12.2-beta.2) (2023-09-12) **Note:** Version bump only for package @injectivelabs/utils diff --git a/packages/utils/package.json b/packages/utils/package.json index cc37b6fd8..cf13d2800 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -1,7 +1,7 @@ { "name": "@injectivelabs/utils", "description": "List of utils and helper functions that can be reused throughout Injective's projects.", - "version": "1.12.2-beta.2", + "version": "1.14.1-beta.6", "sideEffects": false, "author": { "name": "Bojan Angjelkoski", @@ -31,8 +31,8 @@ "start": "node dist/index.js" }, "dependencies": { - "@injectivelabs/exceptions": "^1.12.2-beta.1", - "@injectivelabs/ts-types": "^1.12.2-beta.1", + "@injectivelabs/exceptions": "^1.14.1-beta.7", + "@injectivelabs/ts-types": "^1.14.1-beta.7", "axios": "^0.21.1", "bignumber.js": "^9.0.1", "http-status-codes": "^2.2.0", diff --git a/packages/wallet-ts/CHANGELOG.md b/packages/wallet-ts/CHANGELOG.md index b8d40d8dd..d9772091d 100644 --- a/packages/wallet-ts/CHANGELOG.md +++ b/packages/wallet-ts/CHANGELOG.md @@ -3,6 +3,46 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.14.1-beta.2](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/wallet-ts@1.14.1-beta.1...@injectivelabs/wallet-ts@1.14.1-beta.2) (2023-09-24) + +**Note:** Version bump only for package @injectivelabs/wallet-ts + +## [1.14.1-beta.1](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/wallet-ts@1.14.1-beta.0...@injectivelabs/wallet-ts@1.14.1-beta.1) (2023-09-24) + +**Note:** Version bump only for package @injectivelabs/wallet-ts + +## [1.14.1-beta.0](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/wallet-ts@1.14.0-beta.1...@injectivelabs/wallet-ts@1.14.1-beta.0) (2023-09-23) + +**Note:** Version bump only for package @injectivelabs/wallet-ts + +# [1.14.0](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/wallet-ts@1.14.0-beta.1...@injectivelabs/wallet-ts@1.14.0) (2023-09-22) + +**Note:** Version bump only for package @injectivelabs/wallet-ts + +# [1.14.0-beta.1](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/wallet-ts@1.13.1-beta.3...@injectivelabs/wallet-ts@1.14.0-beta.1) (2023-09-22) + +**Note:** Version bump only for package @injectivelabs/wallet-ts + +## [1.13.1-beta.3](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/wallet-ts@1.13.1-beta.2...@injectivelabs/wallet-ts@1.13.1-beta.3) (2023-09-22) + +**Note:** Version bump only for package @injectivelabs/wallet-ts + +## [1.13.1-beta.2](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/wallet-ts@1.13.1-beta.1...@injectivelabs/wallet-ts@1.13.1-beta.2) (2023-09-22) + +**Note:** Version bump only for package @injectivelabs/wallet-ts + +## [1.13.1-beta.1](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/wallet-ts@1.13.1-beta.0...@injectivelabs/wallet-ts@1.13.1-beta.1) (2023-09-22) + +**Note:** Version bump only for package @injectivelabs/wallet-ts + +## [1.13.1-beta.0](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/wallet-ts@1.13.0...@injectivelabs/wallet-ts@1.13.1-beta.0) (2023-09-22) + +**Note:** Version bump only for package @injectivelabs/wallet-ts + +# [1.13.0](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/wallet-ts@1.12.2-beta.21...@injectivelabs/wallet-ts@1.13.0) (2023-09-22) + +**Note:** Version bump only for package @injectivelabs/wallet-ts + ## [1.12.2-beta.21](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/wallet-ts@1.12.2-beta.20...@injectivelabs/wallet-ts@1.12.2-beta.21) (2023-09-22) **Note:** Version bump only for package @injectivelabs/wallet-ts diff --git a/packages/wallet-ts/package.json b/packages/wallet-ts/package.json index e2664c53f..439b07df9 100644 --- a/packages/wallet-ts/package.json +++ b/packages/wallet-ts/package.json @@ -1,7 +1,7 @@ { "name": "@injectivelabs/wallet-ts", "description": "A convenient way to use and interact with different types of wallets on Injective.", - "version": "1.12.2-beta.21", + "version": "1.14.1-beta.25", "sideEffects": false, "author": { "name": "Bojan Angjelkoski", @@ -37,11 +37,11 @@ "@cosmostation/extension-client": "^0.1.15", "@ethereumjs/common": "^3.1.1", "@ethereumjs/tx": "^4.1.1", - "@injectivelabs/exceptions": "^1.12.2-beta.1", - "@injectivelabs/networks": "^1.12.2-beta.4", - "@injectivelabs/sdk-ts": "^1.13.0-beta.3", - "@injectivelabs/ts-types": "^1.12.2-beta.1", - "@injectivelabs/utils": "^1.12.2-beta.2", + "@injectivelabs/exceptions": "^1.14.1-beta.7", + "@injectivelabs/networks": "^1.14.1-beta.8", + "@injectivelabs/sdk-ts": "^1.14.1-beta.24", + "@injectivelabs/ts-types": "^1.14.1-beta.7", + "@injectivelabs/utils": "^1.14.1-beta.6", "@keplr-wallet/cosmos": "^0.11.58", "@keplr-wallet/types": "^0.11.58", "@ledgerhq/hw-app-eth": "6.33.2", diff --git a/packages/wallet-ts/src/strategies/wallet-strategy/WalletStrategy.ts b/packages/wallet-ts/src/strategies/wallet-strategy/WalletStrategy.ts index 9eee90430..43781d33c 100644 --- a/packages/wallet-ts/src/strategies/wallet-strategy/WalletStrategy.ts +++ b/packages/wallet-ts/src/strategies/wallet-strategy/WalletStrategy.ts @@ -42,16 +42,12 @@ const ethereumWalletsDisabled = (args: WalletStrategyArguments) => { return true } - const { rpcUrl, ethereumChainId } = ethereumOptions + const { ethereumChainId } = ethereumOptions if (!ethereumChainId) { return true } - if (!rpcUrl) { - return true - } - return false } diff --git a/packages/wallet-ts/src/types/enums.ts b/packages/wallet-ts/src/types/enums.ts index 68a5ea661..ed80364fb 100644 --- a/packages/wallet-ts/src/types/enums.ts +++ b/packages/wallet-ts/src/types/enums.ts @@ -9,6 +9,7 @@ export enum Wallet { Metamask = 'metamask', TrustWallet = 'trust-wallet', Cosmostation = 'cosmostation', + LedgerCosmos = 'ledger-cosmos', LedgerLegacy = 'ledger-legacy', WalletConnect = 'wallet-connect', CosmostationEth = 'cosmostation-eth', diff --git a/packages/wallet-ts/src/utils/wallets/cosmos/endpoints.ts b/packages/wallet-ts/src/utils/wallets/cosmos/endpoints.ts index 6096a2cac..455fff24a 100644 --- a/packages/wallet-ts/src/utils/wallets/cosmos/endpoints.ts +++ b/packages/wallet-ts/src/utils/wallets/cosmos/endpoints.ts @@ -111,6 +111,11 @@ export const getEndpointsFromChainId = ( rpc: 'https://testnet.tm.cosmos.injective.dev', rest: 'https://testnet.lcd.cosmos.injective.dev', } + case CosmosChainId.Noble: + return { + rpc: 'https://rpc.cosmos.directory/noble', + rest: 'https://rest.cosmos.directory/noble', + } default: throw new GeneralException( new Error(`Endpoints for ${chainId} not found`), diff --git a/yarn.lock b/yarn.lock index b048e307a..31fedaa98 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2166,20 +2166,20 @@ dependencies: browser-headers "^0.4.1" -"@injectivelabs/indexer-proto-ts@1.11.9": - version "1.11.9" - resolved "https://registry.yarnpkg.com/@injectivelabs/indexer-proto-ts/-/indexer-proto-ts-1.11.9.tgz#19910f44382da50d16c0e7a58114c06b5b66214d" - integrity sha512-hUlZbSpii+amvqqefH/oV16igRJSx4mCM/Zi0xMZLHyqGkaX7PHVvjQcfX04hwx2MdSsAoDghJXuUrAJ7q9I2A== +"@injectivelabs/indexer-proto-ts@1.11.10": + version "1.11.10" + resolved "https://registry.yarnpkg.com/@injectivelabs/indexer-proto-ts/-/indexer-proto-ts-1.11.10.tgz#91649b2634d31a003ba2e928eba4f2de821dc9a3" + integrity sha512-KpGrXYePUhIZfr/ApD6dw0l3bv222yTfVoqqbAWGtmoefeT18Lu490ots9qMsJWfokTsJeWBb1M9ce5JvaSA3Q== dependencies: "@injectivelabs/grpc-web" "^0.0.1" google-protobuf "^3.14.0" protobufjs "^7.0.0" rxjs "^7.4.0" -"@injectivelabs/mito-proto-ts@1.0.46": - version "1.0.46" - resolved "https://registry.yarnpkg.com/@injectivelabs/mito-proto-ts/-/mito-proto-ts-1.0.46.tgz#d0e31c4ca2f76940771621b2fe88f9bc40c7a891" - integrity sha512-K1g5udssQd4pDNzMteUQiI3PLHsuBhCKT6wli2h05ImB0NFQcGbLQlk3lpzsdfE9Usx2hCmZiQNUfUouRrTBpQ== +"@injectivelabs/mito-proto-ts@1.0.50": + version "1.0.50" + resolved "https://registry.yarnpkg.com/@injectivelabs/mito-proto-ts/-/mito-proto-ts-1.0.50.tgz#23ad82b24eafc56906126c064fc39547de239aa0" + integrity sha512-OMMfrGAgibB+NIbaeLN1b25WvdV+FfFW0WBXp7zbrgXXOkPLXZHMzg6oBtI6eUxqg9j4qH+hDQn22os6eW2ZcA== dependencies: "@injectivelabs/grpc-web" "^0.0.1" google-protobuf "^3.14.0"