diff --git a/.gitbook/README.md b/.gitbook/README.md index 0335017be..97cf030de 100644 --- a/.gitbook/README.md +++ b/.gitbook/README.md @@ -1,8 +1,15 @@ # Getting Started +**Stable Package Version** + +![Stable Package (all) versions](https://img.shields.io/npm/v/%40injectivelabs/sdk-ts/latest?label=%40injectivelabs%2Fsdk-ts) +![Supported Node Version](http://img.shields.io/badge/node-16.x-brightgreen.svg) + **Latest Package Versions:** -![](https://img.shields.io/npm/v/%40injectivelabs/sdk-ts/next?label=%40injectivelabs%2Fsdk-ts)![](https://img.shields.io/npm/v/%40injectivelabs/wallet-ts/next?label=%40injectivelabs%2Fwallet-ts)![](https://img.shields.io/npm/v/%40injectivelabs/sdk-ui-ts/next?label=%40injectivelabs%2Fsdk-ui-ts)![](https://img.shields.io/npm/v/%40injectivelabs/utils/next?label=%40injectivelabs%2Futils)![](https://img.shields.io/npm/v/%40injectivelabs/token-metadata/next?label=%40injectivelabs%2Ftoken-metadata)![](https://img.shields.io/npm/v/%40injectivelabs/networks/next?label=%40injectivelabs%2Fnetworks) +![](https://img.shields.io/npm/v/%40injectivelabs/sdk-ts/next?label=%40injectivelabs%2Fsdk-ts)![](https://img.shields.io/npm/v/%40injectivelabs/wallet-ts/next?label=%40injectivelabs%2Fwallet-ts)![](https://img.shields.io/npm/v/%40injectivelabs/sdk-ui-ts/next?label=%40injectivelabs%2Fsdk-ui-ts) + +![](https://img.shields.io/npm/v/%40injectivelabs/utils/next?label=%40injectivelabs%2Futils)![](https://img.shields.io/npm/v/%40injectivelabs/token-metadata/next?label=%40injectivelabs%2Ftoken-metadata)![](https://img.shields.io/npm/v/%40injectivelabs/networks/next?label=%40injectivelabs%2Fnetworks) _**Note:** The latest versions are published using the `next` tag. For stable versions use the `latest` tag or check npm registry for the latest stable version._ @@ -10,15 +17,15 @@ The purpose of this Wiki is to help developers build decentralized applications _Note: Reading the Technical Concepts section after reading the overview below is highly recommended. There are some concepts that can have a bit steeper learning curve than others, so we recommend going through them to understand a bit more about Injective._ -* [Wallets](wallet/) - In this section, we are going to explain (in technical terms) how Accounts are derived on Injective, how you can connect your wallet straight from the dApp itself, and finally have a look at the **WalletStrategy** - a package built by the InjectiveLabs team which offers out of the box solution for providing multiple wallet solutions to the user to connect and interact with your dApp. -* [Querying](querying/) - In this section we are going to explore different ways to obtain data from different data sources needed to build your dApps. First, we are going to see how to query the chain directly and then we are going to explore the Indexer API - an indexer solution for easier data access/streaming including historical data. -* [Transaction](transactions/) - In this section, we are going to explore different ways to make transactions on Injective. First, we are going to explain (in technical terms) how Transactions work on Injective and some technical concepts around them and then we are going to have a look at how to prepare, sign, and broadcast transactions on Injective in several ways. There are a couple of ways to do this. +- [Wallets](wallet/) - In this section, we are going to explain (in technical terms) how Accounts are derived on Injective, how you can connect your wallet straight from the dApp itself, and finally have a look at the **WalletStrategy** - a package built by the InjectiveLabs team which offers out of the box solution for providing multiple wallet solutions to the user to connect and interact with your dApp. +- [Querying](querying/) - In this section we are going to explore different ways to obtain data from different data sources needed to build your dApps. First, we are going to see how to query the chain directly and then we are going to explore the Indexer API - an indexer solution for easier data access/streaming including historical data. +- [Transaction](transactions/) - In this section, we are going to explore different ways to make transactions on Injective. First, we are going to explain (in technical terms) how Transactions work on Injective and some technical concepts around them and then we are going to have a look at how to prepare, sign, and broadcast transactions on Injective in several ways. There are a couple of ways to do this. 1. Using the Cosmos native approach in creating a transaction, sign it using a **Cosmos native wallet** and broadcast it to Injective, 2. Using the Ethereum native approach in creating a transaction using EIP712 typed data, sign it using an **Ethereum native wallet** and broadcast it to Injective, 3. Using the Ethereum native approach in creating a transaction using EIP712 typed data, sign it using a **Ledger device** and broadcast it to Injective, 4. Using the Cosmos native approach in creating a transaction, sign it using a **raw PrivateKey** and broadcast it to Injective, 5. Using the Web3Gateway microservice - an API that provides fee delegation services. -* [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. +- [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 f9fb2de00..039e1b903 100644 --- a/.gitbook/SUMMARY.md +++ b/.gitbook/SUMMARY.md @@ -8,6 +8,7 @@ * [Denom Client](readme/token-metadata/denom-client.md) * [Networks](readme/networks.md) * [CosmJs Support](readme/getting-started-cosmjs.md) + * [Running examples](readme/running-examples.md) * [Wallet](wallet/README.md) * [Accounts](wallet/wallet-accounts.md) * [Wallet Connections](wallet/wallet-connections.md) @@ -50,9 +51,11 @@ * [Tendermint](querying/querying-chain/querying-chain-tendermint.md) * [Wasm](querying/querying-chain/querying-chain-wasm.md) * [WasmX](querying/querying-chain/querying-chain-wasmx.md) + * [Token Factory](querying/querying-chain/token-factory.md) * [Ethereum (GraphQL)](querying/querying-ethereum.md) * [Transactions](transactions/README.md) - * [Cosmos](transactions/transactions-cosmos.md) + * [Cosmos](transactions/transactions-cosmos/README.md) + * [Ledger through Keplr Wallet](transactions/transactions-cosmos/ledger-through-keplr-wallet.md) * [Ethereum](transactions/ethereum.md) * [Ethereum Ledger](transactions/ethereum-ledger.md) * [MsgBroadcaster](transactions/msgbroadcaster.md) @@ -86,3 +89,5 @@ * [DEX](building-dapps/dex.md) * [Bridge](building-dapps/bridge.md) * [Calculations](calculations/README.md) + * [Min Price Tick Size](calculations/min-price-tick-size.md) + * [Min Quantity Tick Size](calculations/min-quantity-tick-size.md) diff --git a/.gitbook/bridge/ethereum.md b/.gitbook/bridge/ethereum.md index 19d803cc1..f8147fa27 100644 --- a/.gitbook/bridge/ethereum.md +++ b/.gitbook/bridge/ethereum.md @@ -51,7 +51,7 @@ const contract = new PeggyContract({ }) ``` -* The snippet below instantiates a PeggyContract instance which can easily `estimateGas` and `sendTransaction` using the `web3` we provide to the contract’s constructor. It’s implementation can be found [here](https://github.com/InjectiveLabs/injective-ts/blob/master/packages/contracts/src/contracts/Peggy.ts). Obviously, this is just an example and you can use the web3 package directly + the ABI of the contract to instantiate the contract, and then handle the logic of signing and broadcasting the transaction using some web3 provider. +* The snippet below instantiates a PeggyContract instance which can easily `estimateGas` and `sendTransaction` using the `web3` we provide to the contract’s constructor. Its implementation can be found [here](https://github.com/InjectiveLabs/injective-ts/blob/master/packages/contracts/src/contracts/Peggy.ts). Obviously, this is just an example and you can use the web3 package directly + the ABI of the contract to instantiate the contract, and then handle the logic of signing and broadcasting the transaction using some web3 provider. ### From Injective to Ethereum @@ -61,7 +61,7 @@ If you are not familiar with how Transactions (and Messages) work on Cosmos you When `MsgSendToEth` is called on the chain, some of the validators will pick up the transaction, batch multiple `MsgSendToEth` requests into one and: burn the assets being withdrawn on Injective, unlock these funds on the Peggy Smart Contract on Ethereum and send them to the respective address. -There is a bridgeFee included in these transactions to incentivise Validators to pick up and process your withdrawal requests faster. The bridgeFee is in the asset the user wants to withdraw to Ethereum (if you withdraw INJ you have to pay the bridgeFee in INJ as well). +There is a bridgeFee included in these transactions to incentivize Validators to pick up and process your withdrawal requests faster. The bridgeFee is in the asset the user wants to withdraw to Ethereum (if you withdraw INJ you have to pay the bridgeFee in INJ as well). Here is an example implementation that prepares the transaction, uses a privateKey to sign it and finally, broadcasts it to Injective: diff --git a/.gitbook/building-dapps/configuring-nuxt.md b/.gitbook/building-dapps/configuring-nuxt.md index 2cf63a81a..4bd927422 100644 --- a/.gitbook/building-dapps/configuring-nuxt.md +++ b/.gitbook/building-dapps/configuring-nuxt.md @@ -30,7 +30,8 @@ $ yarn add @bangjelkoski/node-stdlib-browser $ yarn add -D @bangjelkoski/vite-plugin-node-polyfills ``` -Make sure you are using the `vue-tsc@^1.2.0`, `nuxt@^3.3.3`, `typescript@^4.9.5` versions. +Make sure you are using the `vue-tsc@1.8.8 +`, `nuxt@^3.8.1`, `typescript@^5.0.4` versions. **Buffer** @@ -55,7 +56,7 @@ export default defineNuxtPlugin(() => { If you are going to use `pinia` as state management, add it to your packages: ```bash -$ yarn add pinia @pinia/nuxt +$ yarn add @pinia/nuxt@^0.4.9 ``` ### 5. Using `vueuse` @@ -88,11 +89,12 @@ Then, we need to configure the `tsconfig.json` if you are using TypeScript (reco ### 6. nuxt.config.ts / packages.json -Before we boot our application, we need to set everything up in the `nuxt.config.ts`, the main configuration point for every Nuxt 3 application. Let's see a reference `nuxt.config.ts` and explain every line using comments so its easier for developers to understand. +Before we boot our application, we need to set everything up in the `nuxt.config.ts`, the main configuration point for every Nuxt 3 application. Let's see a reference `nuxt.config.ts` and explain every line using comments so it's easier for developers to understand. ```ts // filename - nuxt.config.ts import { nodePolyfills } from "@bangjelkoski/vite-plugin-node-polyfills"; +import tsconfigPaths from 'vite-tsconfig-paths' export default defineNuxtConfig({ ssr: false, // whether to pre-render your application @@ -120,10 +122,10 @@ export default defineNuxtConfig({ // We generate only sitemaps for the client side as we don't need a server // Note: there is a problem with sitemaps for Vite + Nuxt3 - // as usually is that it takes to much time/memory to generate + // as usual is that it takes too much time/memory to generate // sitemaps and the build process can fail // on Github Actions/Netlify/Vercel/etc so we have to use another - // strategy like generating them locally and them pushing them to services like + // strategy like generating them locally and pushing them to services like // busgnag sourcemap: { server: false, @@ -137,7 +139,8 @@ export default defineNuxtConfig({ "process.env.DEBUG": JSON.stringify(process.env.DEBUG), }, - plugins: [ // setting up node + crypto polyfils + plugins: [ // setting up node + crypto polyfils + vite TS path resolution + tsconfigPaths(), nodePolyfills({ protocolImports: false }) ], diff --git a/.gitbook/building-dapps/configuring-react.md b/.gitbook/building-dapps/configuring-react.md index 405232ead..360cd2719 100644 --- a/.gitbook/building-dapps/configuring-react.md +++ b/.gitbook/building-dapps/configuring-react.md @@ -35,7 +35,7 @@ $ yarn add @bangjelkoski/vite-plugin-node-polyfills ### 4. Using a state management -React has a lot of different state managers, pick the one you are going to use and install it. You can use the build in `Context API` for state management without the need to install a third-party solution. The preffered third-party state managers are `Redux` and `Zustand`. +React has a lot of different state managers, pick the one you are going to use and install it. You can use the build in `Context API` for state management without the need to install a third-party solution. The preferred third-party state managers are `Redux` and `Zustand`. ```bash $ yarn add zustand diff --git a/.gitbook/building-dapps/smart-contract.md b/.gitbook/building-dapps/smart-contract.md index 80bc3a541..570ebf8ae 100644 --- a/.gitbook/building-dapps/smart-contract.md +++ b/.gitbook/building-dapps/smart-contract.md @@ -1,6 +1,6 @@ # Smart Contract -Within these short series we are going to showcase how easy it is to build a dApp on top of Injective. There is an open-sourced [dApp](https://github.com/InjectiveLabs/injective-simple-sc-counter-ui) which everyone can reference and use to build on top of Injective.There are examples for Next, Nuxt and Vanilla Js. For those who want to start from scratch, this is the right place to start. +Within these short series we are going to showcase how easy it is to build a dApp on top of Injective. There is an open-sourced [dApp](https://github.com/InjectiveLabs/injective-simple-sc-counter-ui) which everyone can reference and use to build on top of Injective. There are examples for Next, Nuxt and Vanilla Js. For those who want to start from scratch, this is the right place to start. In this example we will implement the connection and interact with an example Smart Contract deployed on the Injective Chain using the injective-ts module. @@ -10,7 +10,7 @@ The series will include: - Connecting to the Chain and the Indexer API, - Connect to a user wallet and get their address, - Querying the smart contract ( in this case fetching the current count of the smart contract ), -- Modifying the state of the contract ( in this case incrementing the count by 1, or setting it to a speciffic value), +- Modifying the state of the contract ( in this case incrementing the count by 1, or setting it to a specific value), ### Setup @@ -167,7 +167,7 @@ const msg = MsgExecuteContractCompat.fromJSON({ contractAddress: COUNTER_CONTRACT_ADDRESS, sender: injectiveAddress, msg: { - increment: {}, // we pass an empty object if the method doesnt have parameters + increment: {}, // we pass an empty object if the method doesn't have parameters }, }) @@ -181,7 +181,7 @@ const response = await msgBroadcastClient.broadcast({ console.log(response) ``` -Now, lets see an example of how to se the counter to a specific value. Note that in this Smart Contract the count can be set to specific value only by the creator of the Smart Contract. +Now, lets see an example of how to set the counter to a specific value. Note that in this Smart Contract the count can be set to specific value only by the creator of the Smart Contract. ```js // Preparing the message @@ -191,7 +191,7 @@ const msg = MsgExecuteContractCompat.fromJSON({ sender: injectiveAddress, msg: { reset: { - count: parseInt(number, 10), // we are parseing the number variable here because usualy it comes from an input which always gives a string, and we need to pass a number instead. + count: parseInt(number, 10), // we are parsing the number variable here because usually it comes from an input which always gives a string, and we need to pass a number instead. }, }, }) diff --git a/.gitbook/calculations/README.md b/.gitbook/calculations/README.md index bebe608d5..b9367329b 100644 --- a/.gitbook/calculations/README.md +++ b/.gitbook/calculations/README.md @@ -1,10 +1,10 @@ # Calculations -Here are some formula formatting values between the chain and UI human-readable. +In this page we are going to look through some calculations and formatting to understand better about how numbers are represented on the chain vs how we are showing them on the UI. -### Bridges Supported +### Tick Sizes -| 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 | +| Topic | Description | +| ---------------------------------------------------------- | --------------------------------------- | +| [Market min price tick size](min-price-tick-size.md) | Minimum market order price tick size | +| [Market min quantity tick size](min-quantity-tick-size.md) | Minimum market order quantity tick size | diff --git a/.gitbook/calculations/minPriceTickSize.md b/.gitbook/calculations/min-price-tick-size.md similarity index 100% rename from .gitbook/calculations/minPriceTickSize.md rename to .gitbook/calculations/min-price-tick-size.md diff --git a/.gitbook/calculations/minQuantityTickSize.md b/.gitbook/calculations/min-quantity-tick-size.md similarity index 100% rename from .gitbook/calculations/minQuantityTickSize.md rename to .gitbook/calculations/min-quantity-tick-size.md diff --git a/.gitbook/contracts/injective-name-service.md b/.gitbook/contracts/injective-name-service.md index 7d042afd4..83550b407 100644 --- a/.gitbook/contracts/injective-name-service.md +++ b/.gitbook/contracts/injective-name-service.md @@ -100,7 +100,7 @@ console.log(injectiveAddress) ### Reverse Resolution -* Get primary name for injective address. +* Get the primary name for injective address. ```ts import { getNetworkEndpoints, Network } from '@injectivelabs/networks' diff --git a/.gitbook/core-modules/auction.md b/.gitbook/core-modules/auction.md index 8a6b14445..965e3c02a 100644 --- a/.gitbook/core-modules/auction.md +++ b/.gitbook/core-modules/auction.md @@ -1,6 +1,6 @@ # Auction -The `auction` module is heart of the `buy-back-and-burn` on chain mechanism, where 60% of the weekly trading fees are colleted and auctioned off to the highest INJ bidder where the submitted INJ of the highest bidder are burned in the process. +The `auction` module is heart of the `buy-back-and-burn` on chain mechanism, where 60% of the weekly trading fees are collected and auctioned off to the highest INJ bidder where the submitted INJ of the highest bidder are burned in the process. ### MsgBid @@ -60,18 +60,21 @@ console.log(txHash); 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). +* 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/). +* If you have existing non-default subaccounts, you'll want to do a [MsgDeposit](broken-reference) 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](broken-reference) to a new default subaccountId, which would be done via importing `getSubaccountId` from `sdk-ts` and setting the `subaccountId` field in [MsgDeposit](broken-reference) 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 { diff --git a/.gitbook/core-modules/distribution.md b/.gitbook/core-modules/distribution.md index b9f60c029..163cc7aff 100644 --- a/.gitbook/core-modules/distribution.md +++ b/.gitbook/core-modules/distribution.md @@ -39,7 +39,7 @@ console.log(txHash); ### MsgWithdrawValidatorCommission -This message is used to by the validator to withdraw the commission earned. +This message is used by the validator to withdraw the commission earned. ```ts import { diff --git a/.gitbook/core-modules/peggy.md b/.gitbook/core-modules/peggy.md index 6004d60a4..ade9c4a49 100644 --- a/.gitbook/core-modules/peggy.md +++ b/.gitbook/core-modules/peggy.md @@ -1,6 +1,6 @@ # Peggy -The `peggy` module is heart of the injective <> ethereum bridge, where deposited funds will be locked on the ethereum [peggy contract](https://etherscan.io/address/0xF955C57f9EA9Dc8781965FEaE0b6A2acE2BAD6f3#code) and minted on the Injective chain. Similarly withdrawal funds will be burned on the injective chain and unlocked on the ethereum peggy contract. +The `peggy` module is the heart of the injective <> ethereum bridge, where deposited funds will be locked on the ethereum [peggy contract](https://etherscan.io/address/0xF955C57f9EA9Dc8781965FEaE0b6A2acE2BAD6f3#code) and minted on the Injective chain. Similarly withdrawal funds will be burned on the injective chain and unlocked on the ethereum peggy contract. ### MsgSendToEth diff --git a/.gitbook/core-modules/staking.md b/.gitbook/core-modules/staking.md index b9137ec3d..0e8eae2dd 100644 --- a/.gitbook/core-modules/staking.md +++ b/.gitbook/core-modules/staking.md @@ -78,34 +78,36 @@ const txHash = await new MsgBroadcasterWithPk({ console.log(txHash); ``` -### MsgDelegate +### MsgCancelUnbondingDelegation -This Message is used to Delegate INJ to a validator. +This message is used to cancel unbonding from a validator, reset the bonding period, and delegate back to the previous validator. ```ts -import { MsgUndelegate, MsgBroadcasterWithPk } from "@injectivelabs/sdk-ts"; +import { MsgCancelUnbondingDelegation, MsgBroadcasterWithPk } from "@injectivelabs/sdk-ts"; import { BigNumberInBase } from "@injectivelabs/utils"; import { Network } from "@injectivelabs/networks"; -const injectiveAddress = "inj1..."; +const delegatorAddress = "inj1..."; const privateKey = "0x..."; const amount = new BigNumberInBase(5); const validatorAddress = "inj1..."; +const creationHeight = "123456"; // the height at which the unbonding was initiated -const msg = MsgUndelegate.fromJSON({ - injectiveAddress, +const msg = MsgCancelUnbondingDelegation.fromJSON({ + delegatorAddress, validatorAddress, amount: { denom: INJ_DENOM, amount: amount.toWei().toFixed(), }, + creationHeight, }); const txHash = await new MsgBroadcasterWithPk({ - privateKey, - network: Network.Testnet +privateKey, +network: Network.Testnet }).broadcast({ - msgs: msg +msgs: msg }); console.log(txHash); diff --git a/.gitbook/core-modules/token-factory.md b/.gitbook/core-modules/token-factory.md index 67858b309..db25b4c88 100644 --- a/.gitbook/core-modules/token-factory.md +++ b/.gitbook/core-modules/token-factory.md @@ -6,6 +6,8 @@ This `tokenfactory` module allows any account to create a new token with the nam _Note: If you want your denom to be visible on products like Helix, Hub, Explorer, etc, it's important to add token metadata information using the `MsgSetDenomMetadata` message as explained below._ +_Note #2: It's recommended to change your admin to the zero address for safety and preventing supply manipulation._ + #### Messages Let's explore (and provide examples) the Messages that the TokenFactory module exports and we can use to interact with the Injective chain. @@ -14,6 +16,8 @@ Let's explore (and provide examples) the Messages that the TokenFactory module e Creates a denom of `factory/{creator address}/{subdenom}` given the denom creator address and the subdenom. Subdenoms can contain \[a-zA-Z0-9./]. Keep in mind that there is a `creation fee` which you need to cover when creating a new token. +Keep in mind that that the `admin` of the token can change the supply (mint or burn new tokens). Its recommended that the `admin` is unset using the `MsgChangeAdmin`, as explained below. + ```ts import { MsgCreateDenom, @@ -170,6 +174,36 @@ const txHash = await new MsgBroadcasterWithPk({ console.log(txHash); ``` +#### MsgChangeAdmin + +The admin of the denom can mint new supply or burn existing one. It's recommended to change the admin to the zero address as to not allow changing the token's supply. + +```ts +import { MsgChangeAdmin } from '@injectivelabs/sdk-ts' +import { BigNumberInBase } from '@injectivelabs/utils' +import { Network } from '@injectivelabs/networks' + +const injectiveAddress = 'inj1...' +const privateKey = '0x...' +const subdenom = 'inj-test' +const denom = `factory/${injectiveAddress}/${subdenom}` + +const msg = MsgChangeAdmin.fromJSON({ + denom, + sender: injectiveAddress, + newAdmin: 'inj1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqe2hm49' /** SET TO ZERO ADDRESS */, +}) + +const txHash = await new MsgBroadcasterWithPk({ + privateKey, + network: Network.Testnet, +}).broadcast({ + msgs: msg, +}) + +console.log(txHash) +``` + #### Full Example Here is a full example on how to create a new token, mint new tokens and set token metadata on Injective. @@ -198,6 +232,11 @@ const msgMint = MsgMint.fromJSON({ amount: amount } }); +const msgChangeAdmin = MsgChangeAdmin.fromJSON({ + denom: `factory/${injectiveAddress}/${subdenom}`, + sender: injectiveAddress, + newAdmin: 'inj1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqe2hm49' /** SET TO ZERO ADDRESS */ +}); const msgSetDenomMetadata = MsgSetDenomMetadata.fromJSON({ sender: injectiveAddress, metadata: { @@ -226,7 +265,7 @@ const txHash = await new MsgBroadcasterWithPk({ privateKey, network: Network.Testnet }).broadcast({ - msgs: [msgCreateDenom, msgMint, msgSetDenomMetadata] + msgs: [msgCreateDenom, msgMint, msgSetDenomMetadata, msgChangeAdmin] }); console.log(txHash); diff --git a/.gitbook/core-modules/tokenfactory.md b/.gitbook/core-modules/tokenfactory.md index 0b77e733f..0fe6124cd 100644 --- a/.gitbook/core-modules/tokenfactory.md +++ b/.gitbook/core-modules/tokenfactory.md @@ -12,30 +12,30 @@ Let's explore (and provide examples) the Messages that the TokenFactory module e Creates a denom of `factory/{creator address}/{subdenom}` given the denom creator address and the subdenom. Subdenoms can contain [a-zA-Z0-9./]. Keep in mind that there is a `creation fee` which you need to cover when creating a new token. +Keep in mind that that the `admin` of the token can change the supply (mint or burn new tokens). Its recommended that the `admin` is unset using the `MsgChangeAdmin`, as explained [below](#msgchangeadmin). + ```ts -import { - MsgCreateDenom, -} from "@injectivelabs/sdk-ts"; -import { BigNumberInBase } from "@injectivelabs/utils"; -import { Network } from "@injectivelabs/networks"; +import { MsgCreateDenom } from '@injectivelabs/sdk-ts' +import { BigNumberInBase } from '@injectivelabs/utils' +import { Network } from '@injectivelabs/networks' -const injectiveAddress = "inj1..."; -const privateKey = "0x..."; -const subdenom = "inj-test"; +const injectiveAddress = 'inj1...' +const privateKey = '0x...' +const subdenom = 'inj-test' const msg = MsgCreateDenom.fromJSON({ subdenom, sender: injectiveAddress, -}); +}) const txHash = await new MsgBroadcasterWithPk({ privateKey, - network: Network.Testnet + network: Network.Testnet, }).broadcast({ - msgs: msg -}); + msgs: msg, +}) -console.log(txHash); +console.log(txHash) ``` ### MsgMint @@ -43,33 +43,31 @@ console.log(txHash); Minting of a specific denom is only allowed for the current admin. Note, the current admin is defaulted to the creator of the denom. ```ts -import { - MsgMint, -} from "@injectivelabs/sdk-ts"; -import { BigNumberInBase } from "@injectivelabs/utils"; -import { Network } from "@injectivelabs/networks"; +import { MsgMint } from '@injectivelabs/sdk-ts' +import { BigNumberInBase } from '@injectivelabs/utils' +import { Network } from '@injectivelabs/networks' -const injectiveAddress = "inj1..."; -const privateKey = "0x..."; -const subdenom = "inj-test"; +const injectiveAddress = 'inj1...' +const privateKey = '0x...' +const subdenom = 'inj-test' const amountToMint = 1_000_000_000 const msg = MsgMint.fromJSON({ sender: injectiveAddress, amount: { denom: `factory/${injectiveAddress}/${subdenom}`, - amount: amountToMint - } -}); + amount: amountToMint, + }, +}) const txHash = await new MsgBroadcasterWithPk({ privateKey, - network: Network.Testnet + network: Network.Testnet, }).broadcast({ msgs: msg, -}); +}) -console.log(txHash); +console.log(txHash) ``` ### MsgBurn @@ -77,40 +75,37 @@ console.log(txHash); Burning of a specific denom is only allowed for the current admin. Note, the current admin is defaulted to the creator of the denom. ```ts -import { - MsgBurn, -} from "@injectivelabs/sdk-ts"; -import { BigNumberInBase } from "@injectivelabs/utils"; -import { Network } from "@injectivelabs/networks"; +import { MsgBurn } from '@injectivelabs/sdk-ts' +import { BigNumberInBase } from '@injectivelabs/utils' +import { Network } from '@injectivelabs/networks' -const injectiveAddress = "inj1..."; -const privateKey = "0x..."; -const subdenom = "inj-test"; +const injectiveAddress = 'inj1...' +const privateKey = '0x...' +const subdenom = 'inj-test' const amountToBurn = 1_000_000_000 const msg = MsgBurn.fromJSON({ sender: injectiveAddress, amount: { denom: `factory/${injectiveAddress}/${subdenom}`, - amount: amountToBurn - } -}); + amount: amountToBurn, + }, +}) const txHash = await new MsgBroadcasterWithPk({ privateKey, - network: Network.Testnet + network: Network.Testnet, }).broadcast({ - msgs: msg -}); + msgs: msg, +}) -console.log(txHash); +console.log(txHash) ``` ### MsgSetDenomMetadata Setting of metadata for a specific denom is only allowed for the admin of the denom. It allows the overwriting of the denom metadata in the bank module. - ```ts import { MsgSetDenomMetadata, @@ -122,7 +117,6 @@ const injectiveAddress = "inj1..."; const privateKey = "0x..."; const subdenom = 'inj-test' const denom = `factory/${injectiveAddress}/${subdenom}`; -const amountToBurn = 1_000_000_000 const denomUnitsIfTokenHas0Decimals = [ { @@ -166,3 +160,33 @@ const txHash = await new MsgBroadcasterWithPk({ console.log(txHash); ``` + +### MsgChangeAdmin + +The admin of the denom has the ability to mint new supply or burn existing one. It's recommended to change the admin to an empty string as to not allow manipulating with the token's supply. + +```ts +import { MsgChangeAdmin } from '@injectivelabs/sdk-ts' +import { BigNumberInBase } from '@injectivelabs/utils' +import { Network } from '@injectivelabs/networks' + +const injectiveAddress = 'inj1...' +const privateKey = '0x...' +const subdenom = 'inj-test' +const denom = `factory/${injectiveAddress}/${subdenom}` + +const msg = MsgChangeAdmin.fromJSON({ + denom, + sender: injectiveAddress, + newAdmin: '' /** SET TO BLANK STRING */, +}) + +const txHash = await new MsgBroadcasterWithPk({ + privateKey, + network: Network.Testnet, +}).broadcast({ + msgs: msg, +}) + +console.log(txHash) +``` diff --git a/.gitbook/core-modules/wasm.md b/.gitbook/core-modules/wasm.md index 1f085d820..a257716e7 100644 --- a/.gitbook/core-modules/wasm.md +++ b/.gitbook/core-modules/wasm.md @@ -1,6 +1,6 @@ # Wasm -The `wasm` module is heart of interacting with the wasm smart contracts deployed on the injective chain, here you can find a list of [smart contracts](https://explorer.injective.network/contracts/) that are deployed on the Injective chain. +The `wasm` module is the heart of interacting with the wasm smart contracts deployed on the injective chain, here you can find a list of [smart contracts](https://explorer.injective.network/contracts/) that are deployed on the Injective chain. ### MsgExecuteContract (Transfer) diff --git a/.gitbook/querying/querying-api/querying-indexer-account.md b/.gitbook/querying/querying-api/querying-indexer-account.md index 347f32f76..591af8de0 100644 --- a/.gitbook/querying/querying-api/querying-indexer-account.md +++ b/.gitbook/querying/querying-api/querying-indexer-account.md @@ -4,7 +4,7 @@ Example code snippets to query the indexer for subaccount related data. ### Using gRPC -- Get the user's portfolio details, such as their available balance, unrealized Pnl, or their portfolio value. +* Get the user's portfolio details, such as their available balance, unrealized Pnl, or their portfolio value (deprecated -> use [Portfolio](querying-indexer-portfolio.md#using-grpc) instead) ```ts import { IndexerGrpcAccountApi } from '@injectivelabs/sdk-ts' @@ -20,7 +20,7 @@ const portfolio = await indexerGrpcAccountApi.fetchPortfolio(injectiveAddress) console.log(portfolio) ``` -- Get the user's trading rewards per epoch +* Get the user's trading rewards per epoch ```ts import { IndexerGrpcAccountApi } from '@injectivelabs/sdk-ts' @@ -40,7 +40,7 @@ const tradingRewards = await indexerGrpcAccountApi.fetchRewards({ console.log(tradingRewards) ``` -- Get a list of subaccounts associated with an injective address +* Get a list of subaccounts associated with an injective address ```ts import { IndexerGrpcAccountApi } from '@injectivelabs/sdk-ts' @@ -58,7 +58,7 @@ const subaccountsList = await indexerGrpcAccountApi.fetchSubaccountsList( console.log(subaccountsList) ``` -- Get the balance of a subaccount for a specific denom +* Get the balance of a subaccount for a specific denom ```ts import { IndexerGrpcAccountApi } from '@injectivelabs/sdk-ts' @@ -78,7 +78,7 @@ const subaccountBalance = await indexerGrpcAccountApi.fetchSubaccountBalance( console.log(subaccountBalance) ``` -- Get a list of balances for a subaccount +* Get a list of balances for a subaccount ```ts import { IndexerGrpcAccountApi } from '@injectivelabs/sdk-ts' @@ -95,7 +95,7 @@ const subaccountBalanceList = console.log(subaccountBalanceList) ``` -- Get the history of a subaccount +* Get the history of a subaccount ```ts import { PaginationOption, IndexerGrpcAccountApi } from '@injectivelabs/sdk-ts' @@ -117,7 +117,7 @@ const subaccountHistory = await indexerGrpcAccountApi.fetchSubaccountHistory({ console.log(subaccountHistory) ``` -- Get a summary of a subaccount's orders +* Get a summary of a subaccount's orders ```ts import { IndexerGrpcAccountApi } from '@injectivelabs/sdk-ts' @@ -139,7 +139,7 @@ const orderSummary = await indexerGrpcAccountApi.fetchSubaccountOrderSummary({ console.log(orderSummary) ``` -- Get states of a list of spot and/or derivatives orders +* Get states of a list of spot and/or derivatives orders ```ts import { IndexerGrpcAccountApi } from '@injectivelabs/sdk-ts' diff --git a/.gitbook/querying/querying-api/querying-indexer-oracle.md b/.gitbook/querying/querying-api/querying-indexer-oracle.md index 1f1451950..79419c01b 100644 --- a/.gitbook/querying/querying-api/querying-indexer-oracle.md +++ b/.gitbook/querying/querying-api/querying-indexer-oracle.md @@ -4,7 +4,7 @@ Example code snippets to query the indexer for oracle module related data. ### Using gRPC -- Get a list of oracles +* Get a list of oracles ```ts import { IndexerGrpcOracleApi } from '@injectivelabs/sdk-ts' @@ -18,18 +18,25 @@ const oracleList = await indexerGrpcOracleApi.fetchOracleList() console.log(oracleList) ``` -- Get price from oracle +* Get price from the oracle + +Base and Quote oracle symbols are always fetched from the market itself. They can be in a different representation than plain symbols (i.e hashes for `pyth` oracle). ```ts -import { IndexerGrpcOracleApi } from '@injectivelabs/sdk-ts' +import { IndexerGrpcOracleApi, IndexerGrpcDerivativeApi } from '@injectivelabs/sdk-ts' import { getNetworkEndpoints, Network } from '@injectivelabs/networks' const endpoints = getNetworkEndpoints(Network.Testnet) +const markets = new IndexerGrpcDerivativeApi(endpoints.indexer) const indexerGrpcOracleApi = new IndexerGrpcOracleApi(endpoints.indexer) -const baseSymbol = 'INJ' -const quoteSymbol = 'USDT' -const oracleType = 'bandibc' // primary oracle we use +const market = markets.find(market => market.ticker === 'INJ/USDT PERP') + +// These values are a part of the market object +// fetched from the chain i.e `oracle_base` and `oracle_quote` +const baseSymbol = market.oracle_base +const quoteSymbol = market.oracle_quote +const oracleType = market.oracle_type const oraclePrice = await indexerGrpcOracleApi.fetchOraclePriceNoThrow({ baseSymbol, diff --git a/.gitbook/querying/querying-api/querying-indexer-portfolio.md b/.gitbook/querying/querying-api/querying-indexer-portfolio.md index a3defb4e0..992f262fd 100644 --- a/.gitbook/querying/querying-api/querying-indexer-portfolio.md +++ b/.gitbook/querying/querying-api/querying-indexer-portfolio.md @@ -4,11 +4,10 @@ Example code snippets to query the indexer for portfolio module related data. ### Using gRPC -- Get a portfolio based off injective address, such as bank balances and subaccount balances +* Get a portfolio based on injective address, such as bank balances and subaccount balances -```ts -import { IndexerGrpcAccountPortfolioApi } from '@injectivelabs/sdk-ts' -import { getNetworkEndpoints, Network } from '@injectivelabs/networks' +
import { IndexerGrpcAccountPortfolioApi } from '@injectivelabs/sdk-ts'
+import { getNetworkEndpoints, Network } from '@injectivelabs/networks'
 
 const endpoints = getNetworkEndpoints(Network.Testnet)
 const indexerGrpcAccountPortfolioApi = new IndexerGrpcAccountPortfolioApi(
@@ -17,9 +16,9 @@ const indexerGrpcAccountPortfolioApi = new IndexerGrpcAccountPortfolioApi(
 
 const injectiveAddress = 'inj...'
 
-const portfolio = await indexerGrpcAccountPortfolioApi.fetchAccountPortfolio(
+const portfolio = await indexerGrpcAccountPortfolioApi.fetchAccountPortfolioBalances(
   injectiveAddress,
 )
 
 console.log(portfolio)
-```
+
diff --git a/.gitbook/querying/querying-api/streaming/README.md b/.gitbook/querying/querying-api/streaming/README.md index d73271352..952eb2dfc 100644 --- a/.gitbook/querying/querying-api/streaming/README.md +++ b/.gitbook/querying/querying-api/streaming/README.md @@ -9,7 +9,7 @@ | Account Module | Streaming data from the account module | | Auction Module | Streaming data from the auction module | | Derivatives Module | Stream data from the derivatives module | -| Explorer Module | Stream data from the the explorer module | -| Oracle Module | Stream data from the the oracle | -| Portfolio Module | Stream data from the the portfolio module | +| Explorer Module | Stream data from the explorer module | +| Oracle Module | Stream data from the oracle | +| Portfolio Module | Stream data from the portfolio module | | Spot Module | Stream data from the spot module | diff --git a/.gitbook/querying/querying-chain/README.md b/.gitbook/querying/querying-chain/README.md index 46d167930..37b04f896 100644 --- a/.gitbook/querying/querying-chain/README.md +++ b/.gitbook/querying/querying-chain/README.md @@ -21,4 +21,6 @@ | [Wasm](querying-chain-wasm.md) | Query data from the wasm module | | [WasmX](querying-chain-wasmx.md) | Query data from the wasmX module | | [Tendermint](querying-chain-tendermint.md) | Query data related to the tendermint api | +| [Token Factory](token-factory.md) | Query data from the token factory module | +*** diff --git a/.gitbook/querying/querying-chain/querying-chain-bank-module.md b/.gitbook/querying/querying-chain/querying-chain-bank-module.md index a6f1def36..640080e90 100644 --- a/.gitbook/querying/querying-chain/querying-chain-bank-module.md +++ b/.gitbook/querying/querying-chain/querying-chain-bank-module.md @@ -1,14 +1,13 @@ -# Querying Chain: Bank Module +# Bank Example code snippets to query the chain for bank module related data. ### Using gRPC -- Get bank module params +* Get bank module params -```ts -import { ChainGrpcBankApi } from '@injectivelabs/sdk-ts' -import { getNetworkEndpoints, Network } from '@injectivelabs/networks' +
import { ChainGrpcBankApi } from '@injectivelabs/sdk-ts'
+import { getNetworkEndpoints, Network } from '@injectivelabs/networks'
 
 const endpoints = getNetworkEndpoints(Network.Testnet)
 const chainGrpcBankApi = new ChainGrpcBankApi(endpoints.grpc)
@@ -16,9 +15,9 @@ const chainGrpcBankApi = new ChainGrpcBankApi(endpoints.grpc)
 const moduleParams = await chainGrpcBankApi.fetchModuleParams()
 
 console.log(moduleParams)
-```
+
-- Fetching injective address's balances +* Fetching injective address's balances ```ts import { ChainGrpcBankApi } from '@injectivelabs/sdk-ts' @@ -34,7 +33,7 @@ const balances = await chainGrpcBankApi.fetchBalances(injectiveAddress) console.log(balances) ``` -- Fetching cosmos address' balances per base denom +* Fetching cosmos address' balances per base denom ```ts import { ChainGrpcBankApi } from '@injectivelabs/sdk-ts' @@ -54,7 +53,7 @@ const balance = await chainGrpcBankApi.fetchBalance({ console.log(balance) ``` -- Fetching total supply on chain +* Fetching total supply on chain ```ts import { PaginationOption, ChainGrpcBankApi } from '@injectivelabs/sdk-ts' @@ -74,7 +73,7 @@ console.log(totalSupply) ### Using HTTP REST -- Fetching address's balances +* Fetching address's balances ```ts import { ChainRestBankApi } from '@injectivelabs/sdk-ts' @@ -90,7 +89,7 @@ const balances = await chainGrpcBankApi.fetchBalances(injectiveAddress) console.log(balances) ``` -- Fetching cosmos address' balances per base denom +* Fetching cosmos address' balances per base denom ```ts import { ChainRestBankApi } from '@injectivelabs/sdk-ts' diff --git a/.gitbook/querying/querying-chain/querying-chain-wasm.md b/.gitbook/querying/querying-chain/querying-chain-wasm.md index 5295bf6aa..27ac78a2c 100644 --- a/.gitbook/querying/querying-chain/querying-chain-wasm.md +++ b/.gitbook/querying/querying-chain/querying-chain-wasm.md @@ -1,10 +1,10 @@ -# Querying Chain: Wasm +# Wasm Example code snippets to query the wasm module on chain ### Using gRPC -- Get a contacts' account balance Note that pagination parameters can be passed to obtain additional accounts. +* Get a contacts' account balance Note that pagination parameters can be passed to obtain additional accounts. ```ts import { ChainGrpcWasmApi, PaginationOption } from '@injectivelabs/sdk-ts' @@ -24,7 +24,7 @@ const contractAccountsBalance = await chainGrpcWasmApi.fetchContractAccountsBala console.log(contractAccountsBalance) ``` -- Get info related to a contract +* Get info related to a contract ```ts import { ChainGrpcWasmApi } from '@injectivelabs/sdk-ts' @@ -40,7 +40,7 @@ const contractInfo = await chainGrpcWasmApi.fetchContractInfo(contractAddress) console.log(contractInfo) ``` -- Get contract history +* Get contract history ```ts import { ChainGrpcWasmApi } from '@injectivelabs/sdk-ts' @@ -58,10 +58,10 @@ const contractHistory = await chainGrpcWasmApi.fetchContractHistory( console.log(contractHistory) ``` -- Get the state of a smart contract +* Get the state of a smart contract ```ts -import { ChainGrpcWasmApi } from '@injectivelabs/sdk-ts' +import { ChainGrpcWasmApi, toBase64 } from '@injectivelabs/sdk-ts' import { getNetworkEndpoints, Network } from '@injectivelabs/networks' const endpoints = getNetworkEndpoints(Network.Testnet) @@ -69,16 +69,17 @@ const chainGrpcWasmApi = new ChainGrpcWasmApi(endpoints.grpc) const contractAddress = 'inj...' const query = '...' +const queryFromObject = toBase64({ get_coin: {} }) const contractState = await chainGrpcWasmApi.fetchSmartContractState({ contractAddress, - query /* optional string query - HAS to be in base64 */, + query /* optional string query - HAS to be in base64 or use queryFromObject */, }) console.log(contractState) ``` -- Get the raw state of a smart contract +* Get the raw state of a smart contract ```ts import { ChainGrpcWasmApi } from '@injectivelabs/sdk-ts' @@ -89,16 +90,17 @@ const chainGrpcWasmApi = new ChainGrpcWasmApi(endpoints.grpc) const contractAddress = 'inj...' const query = '...' +const queryFromObject = toBase64({ get_coin: {} }) const rawContractState = await chainGrpcWasmApi.fetchRawContractState({ contractAddress, - query /* optional string query - HAS to be in base64 */, + query /* optional string query - HAS to be in base64 or use queryFromObject */, }) console.log(rawContractState) ``` -- Get the codes associated with a contract +* Get the codes associated with a contract ```ts import { PaginationOption, ChainGrpcWasmApi } from '@injectivelabs/sdk-ts' @@ -117,7 +119,7 @@ pagination /* optional pagination options */ console.log(rawContractState) ``` -- Get info associated with a contract code +* Get info associated with a contract code ```ts import { ChainGrpcWasmApi } from '@injectivelabs/sdk-ts' @@ -133,7 +135,7 @@ const codeDetails = await chainGrpcWasmApi.fetchContractCode(codeId) console.log(codeDetails) ``` -- Get the contracts associated with a code +* Get the contracts associated with a code ```ts import { PaginationOption, ChainGrpcWasmApi } from '@injectivelabs/sdk-ts' diff --git a/.gitbook/querying/querying-chain/token-factory.md b/.gitbook/querying/querying-chain/token-factory.md new file mode 100644 index 000000000..517a40632 --- /dev/null +++ b/.gitbook/querying/querying-chain/token-factory.md @@ -0,0 +1,35 @@ +# Token Factory + +Example code snippets to query the chain for token factory module related data. + +### Using gRPC + +* Fetch all denoms created by _creator_ + +
import { ChainGrpcTokenFactoryApi } from '@injectivelabs/sdk-ts'
+import { getNetworkEndpoints, Network } from '@injectivelabs/networks'
+
+const endpoints = getNetworkEndpoints(Network.Testnet)
+const chainGrpcTokenFactoryApi = new ChainGrpcTokenFactoryApi(endpoints.grpc)
+
+const creator = 'inj...'
+const denoms = await chainGrpcTokenFactoryApi.fetchDenomsFromCreator(creator)
+
+console.log(denoms)
+
+ +* Fetch denom authority metadata (i.e fetch admin of a token) + +```ts +import { ChainGrpcTokenFactoryApi } from '@injectivelabs/sdk-ts' +import { getNetworkEndpoints, Network } from '@injectivelabs/networks' + +const endpoints = getNetworkEndpoints(Network.Testnet) +const chainGrpcTokenFactoryApi = new ChainGrpcTokenFactoryApi(endpoints.grpc) + +const creator = 'inj...' +const subdenom = 'NINJA' +const metadata = await chainGrpcTokenFactoryApi.fetchDenomAuthorityMetadata(creator, subdenom) + +console.log(metadata) +``` diff --git a/.gitbook/readme/application-concepts.md b/.gitbook/readme/application-concepts.md index f5f67cc37..defff8ec0 100644 --- a/.gitbook/readme/application-concepts.md +++ b/.gitbook/readme/application-concepts.md @@ -6,7 +6,7 @@ In this section we are going to explain some application (Injective) specific co The Token Factory module on Injective which allows users and contracts to create new native tokens and swap native tokens with CW20 tokens using the Mint + Burn model. This is an important feature to have on chain because representing assets from different sources to a native bank denom is crucial to allow users to access the rest of the on-chain modules like exchange, auction, insurance funds, etc. The token factory denoms are in the following format `factory/{creator address}/{subdenom}`. -Combined with the `CW20AdapterContract` which acts as an creator, we allow CW20 assets to be natively represented on Injective as Token Factory denoms. The way it works is that CW20 assets are held by the `CW20AdapterContract` and minted as a factory denom for the injective address and when we want to redeem them back to CW20, they are burned from the bank module and unlocked from the `CW20AdapterContract` back to the owner address. +Combined with the `CW20AdapterContract` which acts as a creator, we allow CW20 assets to be natively represented on Injective as Token Factory denoms. The way it works is that CW20 assets are held by the `CW20AdapterContract` and minted as a factory denom for the injective address and when we want to redeem them back to CW20, they are burned from the bank module and unlocked from the `CW20AdapterContract` back to the owner address. Example on how to redeem a factory denom to CW20: diff --git a/.gitbook/readme/denoms-(tokens)/README.md b/.gitbook/readme/denoms-(tokens)/README.md index fb99b555d..69617444c 100644 --- a/.gitbook/readme/denoms-(tokens)/README.md +++ b/.gitbook/readme/denoms-(tokens)/README.md @@ -17,7 +17,7 @@ Token is simply a denom on the Injective chain with some meta information. The m # Token Metadata -Assets on Injective are represented as denoms. Denoms (and the amounts) are not human readable and this is why we need to have a way to "attach" token metadata information for a particular denom. This is achievable using the `@injectivelabs/token-metadata` package. +Assets on Injective are represented as denoms. Denoms (and the amounts) are not humanly readable and this is why we need to have a way to "attach" token metadata information for a particular denom. This is achievable using the `@injectivelabs/token-metadata` package. Let's recap the types of denoms we have in the Getting Started section: diff --git a/.gitbook/readme/getting-started-cosmjs.md b/.gitbook/readme/getting-started-cosmjs.md index 8309051ad..d795bfe9a 100644 --- a/.gitbook/readme/getting-started-cosmjs.md +++ b/.gitbook/readme/getting-started-cosmjs.md @@ -1,8 +1,10 @@ -# Getting Started - Cosmjs +# CosmJs Support Injective is not natively supported on the `@cosmjs` packages. It's highly recommended to use our `@injectivelabs` packages to interact with Injective. -If you are familiar with the `@cosmjs` packages we are exporting similar interfaces/classes that work exactly the same as the classes on `@cosmjs` but have support for Injective as well. +If you are familiar with the `@cosmjs` packages we are exporting similar interfaces/classes that work the same as the classes on `@cosmjs` but have support for Injective as well. + +Again, keep in mind that the recommended approach is to use the Injective's standard approach, which you can learn more about [here](../transactions/transactions-cosmos/). ### Usage using Keplr @@ -66,7 +68,9 @@ import { assertIsBroadcastTxSuccess } from '@cosmjs/stargate' ### Usage in a CLI/Node environment -Here is an example on how to use the `@injectivelabs` alternatives from the `@cosmjs` packages in a node or CLI environment: +Here is an example on how to use the `@injectivelabs` alternatives from the `@cosmjs` packages in a node or CLI environment. + +Again, keep in mind that the recommended approach is to use the [MsgBroadcasterWithPk](../transactions/private-key.md#example-with-msgbroadcasterwithpk) abstraction to follow the Injective's standard approach. ```ts import { diff --git a/.gitbook/readme/running-examples.md b/.gitbook/readme/running-examples.md new file mode 100644 index 000000000..c487f0917 --- /dev/null +++ b/.gitbook/readme/running-examples.md @@ -0,0 +1,9 @@ +--- +description: Each of these examples can be run in a simple TypeScript environment. +--- + +# Running examples + +You can clone this open-sourced repository [https://github.com/InjectiveLabs/injective-ts-examples](https://github.com/InjectiveLabs/injective-ts-examples) and follow the steps in **📚 Getting Started** to get started with your examples! + +You can check the two examples in the repository to make everything work out of the box in a Node environment, querying and sending a transaction. diff --git a/.gitbook/readme/token-metadata/README.md b/.gitbook/readme/token-metadata/README.md index 9ed1b4671..ff9b6e507 100644 --- a/.gitbook/readme/token-metadata/README.md +++ b/.gitbook/readme/token-metadata/README.md @@ -1,4 +1,4 @@ -# Token Metadata +# Assets (Token Metadata) ## Denom @@ -51,3 +51,12 @@ export interface Token { ``` There are other ways to define a token metadata for a denom on Injective and we'll explain more in the next page. + +### Token Verification + +Verifying your token's metadata can be done in a couple of ways. Here are the verification levels and what they mean: + +* **Verified** -> Your asset metadata has been added to the `@injectivelabs/token-metadata` package. You can find a tutorial on how to add your token's metadata to the package [here](../../../packages/token-metadata/CONTRIBUTING.md). +* **Internal** -> Your asset's metadata has been verified on-chain using the `MsgSetDenomMetadata` message, as explained [here](https://docs.ts.injective.network/core-modules/token-factory#msgsetdenommetadata). +* **External** -> Your asset's metadata has been verified on some external source like from Ethereum's contract details, etc. +* **Unverified** -> Your asset's metadata has not been provided anywhere. diff --git a/.gitbook/readme/token-metadata/creating-tokens.md b/.gitbook/readme/token-metadata/creating-tokens.md index 016ff789a..87d614329 100644 --- a/.gitbook/readme/token-metadata/creating-tokens.md +++ b/.gitbook/readme/token-metadata/creating-tokens.md @@ -7,7 +7,7 @@ A single account can create multiple denoms, by providing a unique subdenom for * Mint their denom to any account * Burn their denom from any account * Create a transfer of their denom between any two accounts -* 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. +* 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 the zero address `inj1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqe2hm49`, 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. diff --git a/.gitbook/transactions/README.md b/.gitbook/transactions/README.md index 8c3da9e2f..e3da6f9fa 100644 --- a/.gitbook/transactions/README.md +++ b/.gitbook/transactions/README.md @@ -33,13 +33,13 @@ Every transaction we want to broadcast to Injective has the same flow. The flow ### Topics -| Topic | Description | -| --------------------------------------------------- | ---------------------------------------------------------- | -| [Using the Ethereum approach](ethereum.md) | Prepare/Sign EIP712 typed data then broadcast | -| [Using the Cosmos approach](transactions-cosmos.md) | Prepare/Sign/Broadcast Cosmos transactions | -| [Using a Private Key](private-key.md) | Prepare/Sign/Broadcast Cosmos transaction with private key | -| [Web3Gateway Microservice](web3-gateway.md) | A microservice for supporting fee Delegation | -| [Msg Broadcaster](msgbroadcaster.md) | Abstraction for broadcasting messages | +| Topic | Description | +| ------------------------------------------------- | ---------------------------------------------------------- | +| [Using the Ethereum approach](ethereum.md) | Prepare/Sign EIP712 typed data then broadcast | +| [Using the Cosmos approach](transactions-cosmos/) | Prepare/Sign/Broadcast Cosmos transactions | +| [Using a Private Key](private-key.md) | Prepare/Sign/Broadcast Cosmos transaction with private key | +| [Web3Gateway Microservice](web3-gateway.md) | A microservice for supporting fee Delegation | +| [Msg Broadcaster](msgbroadcaster.md) | Abstraction for broadcasting messages | diff --git a/.gitbook/transactions/ethereum.md b/.gitbook/transactions/ethereum.md index fa415f959..0176a5380 100644 --- a/.gitbook/transactions/ethereum.md +++ b/.gitbook/transactions/ethereum.md @@ -150,47 +150,56 @@ import { ChainRestAuthApi, ChainRestTendermintApi, BaseAccount, - DEFAULT_STD_FEE, getEip712TypedData, -} from '@injectivelabs/sdk-ts' + getEthereumAddress, + recoverTypedSignaturePubKey, + hexToBase64, + createTransaction, + SIGN_AMINO, + createWeb3Extension, + createTxRawEIP712, + TxRestClient, +} from "@injectivelabs/sdk-ts"; import { + BigNumberInBase, 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 */ +} from "@injectivelabs/utils"; +import { ChainId } from "@injectivelabs/ts-types"; +import { Network, getNetworkEndpoints } from "@injectivelabs/networks"; + +const injectiveAddress = "inj1"; +const ethereumAddress = getEthereumAddress(injectiveAddress) +const chainId = "injective-1"; /* ChainId.Mainnet */ +const ethereumChainId = 1; /* ChainId.EthereumMainnet */ +const restEndpoint = getNetworkEndpoints(Network.MainnetSentry).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, -) -const baseAccount = BaseAccount.fromRestApi(accountDetailsResponse) -const accountDetails = baseAccount.toAccountDetails() + injectiveAddress +); +const baseAccount = BaseAccount.fromRestApi(accountDetailsResponse); +const accountDetails = baseAccount.toAccountDetails(); /** Block Details */ -const chainRestTendermintApi = new ChainRestTendermintApi(restEndpoint) -const latestBlock = await chainRestTendermintApi.fetchLatestBlock() -const latestHeight = latestBlock.header.height +const chainRestTendermintApi = new ChainRestTendermintApi(restEndpoint); +const latestBlock = await chainRestTendermintApi.fetchLatestBlock(); +const latestHeight = latestBlock.header.height; const timeoutHeight = new BigNumberInBase(latestHeight).plus( - DEFAULT_BLOCK_TIMEOUT_HEIGHT, -) + DEFAULT_BLOCK_TIMEOUT_HEIGHT +); /** Preparing the transaction */ const msg = MsgSend.fromJSON({ amount, srcInjectiveAddress: injectiveAddress, dstInjectiveAddress: injectiveAddress, -}) +}); /** EIP712 for signing on Ethereum wallets */ const eip712TypedData = getEip712TypedData({ @@ -202,21 +211,22 @@ const eip712TypedData = getEip712TypedData({ chainId: chainId, }, ethereumChainId: ethereumChainId, -}) +}); /** Use your preferred approach to sign EIP712 TypedData, example with Metamask */ const signature = await window.ethereum.request({ - method: 'eth_signTypedData_v4', + method: "eth_signTypedData_v4", params: [ethereumAddress, JSON.stringify(eip712TypedData)], -}) +}); /** Get Public Key of the signer */ -const publicKeyHex = recoverTypedSignaturePubKey(eip712TypedData, signature) -const publicKeyBase64 = hexToBase64(publicKeyHex) +const publicKeyHex = recoverTypedSignaturePubKey(eip712TypedData, signature); +const publicKeyBase64 = hexToBase64(publicKeyHex); +const signatureBuff = Buffer.from(signature.replace('0x', ''), "hex"); const { txRaw } = createTransaction({ - message: msgs, - memo: memo, + message: [msg], + memo: '', signMode: SIGN_AMINO, fee: DEFAULT_STD_FEE, pubKey: publicKeyBase64, @@ -224,20 +234,20 @@ const { txRaw } = createTransaction({ timeoutHeight: timeoutHeight.toNumber(), accountNumber: baseAccount.accountNumber, chainId: chainId, -}) +}); const web3Extension = createWeb3Extension({ ethereumChainId, -}) -const txRawEip712 = createTxRawEIP712(txRaw, web3Extension) +}); +const txRawEip712 = createTxRawEIP712(txRaw, web3Extension); /** Append Signatures */ -txRawEip712.signatures = [signatureBuff] +txRawEip712.signatures = [signatureBuff]; /** Broadcast the Transaction */ -const txRestClient = new TxRestClient(restEndpoint) +const txRestClient = new TxRestClient(restEndpoint); -const txHash = await txRestClient.broadcast(txRawEip712) -const response = await txRestClient.fetchTxPoll(txHash) +const txResponse = await txRestClient.broadcast(txRawEip712); +const response = await txRestClient.fetchTxPoll(txResponse.txHash); ``` ### Example with WalletStrategy (Prepare + Sign + Broadcast) diff --git a/.gitbook/transactions/private-key.md b/.gitbook/transactions/private-key.md index 888432219..6ec2af05b 100644 --- a/.gitbook/transactions/private-key.md +++ b/.gitbook/transactions/private-key.md @@ -1,5 +1,7 @@ # Private Key +In this document, we are going to show you how to use a PrivateKey to sign transactions on Injective. + Every transaction on Injective follows the same flow. The flow consists of three steps: preparing, signing and broadcasting the transaction. Let's dive into each step separately and explain the process in-depth (including examples) so we can understand the whole transaction flow. ### Preparing a transaction @@ -220,7 +222,9 @@ import { BigNumberInBase, DEFAULT_STD_FEE } from '@injectivelabs/utils' ### Example with MsgBroadcasterWithPk -You can use the `MsgBroadcasterWithPk` class from the `@injectivelabs/sdk-ts` package which abstracts away most of the logic written above into a single class. +You can use the `MsgBroadcasterWithPk` class from the `@injectivelabs/sdk-ts` package which abstracts away most of the logic written above into a single class. + +**This abstraction allows you to sign transactions in a Node/CLI environment.** ```ts import { MsgSend, MsgBroadcasterWithPk } from '@injectivelabs/sdk-ts' @@ -231,7 +235,7 @@ const privateKey = '0x...' const injectiveAddress = 'inj1...' const amount = { denom: 'inj', - amount: new BigNumberInBase(1).toWei(), + amount: new BigNumberInBase(1).toWei().toFixed(), } const msg = MsgSend.fromJSON({ amount, diff --git a/.gitbook/transactions/transactions-cosmos.md b/.gitbook/transactions/transactions-cosmos/README.md similarity index 96% rename from .gitbook/transactions/transactions-cosmos.md rename to .gitbook/transactions/transactions-cosmos/README.md index f5e96c69c..1d7a2fad8 100644 --- a/.gitbook/transactions/transactions-cosmos.md +++ b/.gitbook/transactions/transactions-cosmos/README.md @@ -108,7 +108,12 @@ Once we have the signature ready, we need to broadcast the transaction to the In ```ts import { ChainId } from '@injectivelabs/ts-types' -import { CosmosTxV1Beta1Tx, getTxRawFromTxRawOrDirectSignResponse, TxRestClient } from '@injectivelabs/sdk-ts' +import { + BroadcastModeKeplr, + CosmosTxV1Beta1Tx, + getTxRawFromTxRawOrDirectSignResponse, + TxRestClient +} from '@injectivelabs/sdk-ts' import { Network, getNetworkEndpoints } from '@injectivelabs/networks' /** @@ -137,7 +142,7 @@ const broadcastTx = async (chainId, txRaw) => { const result = await keplr.sendTx( chainId, CosmosTxV1Beta1Tx.TxRaw.encode(txRaw).finish(), - BroadcastMode.Sync, + BroadcastModeKeplr.Sync, ) if (!result || result.length === 0) { @@ -177,6 +182,7 @@ import { ChainRestAuthApi, createTransaction, CosmosTxV1Beta1Tx, + BroadcastModeKeplr, ChainRestTendermintApi, } from '@injectivelabs/sdk-ts' import { @@ -201,7 +207,7 @@ const broadcastTx = async (chainId, txRaw) => { const result = await keplr.sendTx( chainId, CosmosTxV1Beta1Tx.TxRaw.encode(txRaw).finish(), - BroadcastMode.Sync, + BroadcastModeKeplr.Sync, ) if (!result || result.length === 0) { @@ -214,8 +220,10 @@ const broadcastTx = async (chainId, txRaw) => { return Buffer.from(result).toString('hex') } -const injectiveAddress = 'inj1' const chainId = 'injective-1' /* ChainId.Mainnet */ +const { key } = await getKeplr(chainId) +const pubKey = Buffer.from(key.pubKey).toString('base64') +const injectiveAddress = key.bech32Address const restEndpoint = 'https://lcd.injective.network' /* getNetworkEndpoints(Network.Mainnet).rest */ const amount = { @@ -246,9 +254,6 @@ const msg = MsgSend.fromJSON({ dstInjectiveAddress: injectiveAddress, }) -/** Get the PubKey of the Signer from the Wallet/Private Key */ -const pubKey = await getPubKey() - /** Prepare the Transaction **/ const { txRaw, signDoc } = createTransaction({ pubKey, diff --git a/.gitbook/transactions/transactions-cosmos/ledger-through-keplr-wallet.md b/.gitbook/transactions/transactions-cosmos/ledger-through-keplr-wallet.md new file mode 100644 index 000000000..5ebcd4f63 --- /dev/null +++ b/.gitbook/transactions/transactions-cosmos/ledger-through-keplr-wallet.md @@ -0,0 +1,233 @@ +# Ledger through Keplr Wallet + +On this page, we are going to have a look at the implementation for Injective when your users are using a Ledger device through the Keplr wallet. + +As explained before, Injective uses a different derivation curve from the rest of the Cosmos chains which means that the users have to use the Ethereum app (for now) to interact with Injective. + +The easiest way all of the edge cases covered and a full out-of-the-box solution for all of the supported wallets on Injective I suggest you have a look at the [MsgBroadcaster + WalletStrategy ](../msgbroadcaster.md#msgbroadcaster-+-wallet-strategy)abstraction. If you want to do your own implementation, let's go through the code example together. + +### Overview + +Keplr exposes a `experimentalSignEIP712CosmosTx_v0` method which can be utilized to sign EIP712 typed data (automatically generated on the Keplr side by passing a Cosmos StdSignDoc to the method above) and allow EVM-compatible chains to get proper signatures when we have Ledger devices connected through Keplr. + +Here is the function's signature: + +```typescript +/** + * Sign the sign doc with ethermint's EIP-712 format. + * The difference from signEthereum(..., EthSignType.EIP712) is that this api returns a new sign doc changed by the user's fee setting and the signature for that sign doc. + * Encoding tx to EIP-712 format should be done on the side using this api. + * Not compatible with cosmjs. + * The returned signature is (r | s | v) format which used in ethereum. + * v should be 27 or 28 which is used in the ethereum mainnet regardless of chain. + * @param chainId + * @param signer + * @param eip712 + * @param signDoc + * @param signOptions + */ +experimentalSignEIP712CosmosTx_v0(chainId: string, signer: string, eip712: { + types: Record; + domain: Record; + primaryType: string; +}, signDoc: StdSignDoc, signOptions?: KeplrSignOptions): Promise; + + +``` + +What we need to do now is generate the `eip712` and the `signDoc`, pass them to this function and Keplr will ask the user to sign the transaction using the Ethereum app on their Ledger device. + +### Example Implementation + +Based on the overview above, let's now showcase a full example of how to implement signing transactions on Injective using Ledger + Keplr. Keep in mind that the example below takes into consideration that you are using the [Msgs](https://github.com/InjectiveLabs/injective-ts/blob/master/packages/sdk-ts/src/core/modules/msgs.ts#L60) interface exported from the `@injectivelabs/sdk-ts` package. + +````typescript +import { + ChainRestAuthApi, + BaseAccount, + createTransaction, + createWeb3Extension, + SIGN_AMINO, + TxGrpcApi, + createTxRawEIP712, + ChainRestTendermintApi, + getGasPriceBasedOnMessage, + getEip712TypedData +} from '@injectivelabs/sdk-ts' +import { getNetworkEndpoints, NetworkEndpoints, Network } from '@injectivelabs/networks' +import { GeneralException, TransactionException } from '@injectivelabs/exceptions' +import { BigNumberInBase, getStdFee } from '@injectivelabs/utils' + +export interface Options { + ethereumChainId: number /* 1 for Injective mainnet, 5 for Injective testnet */ + chainId: string; /* Injective chain id */ + endpoints: NetworkEndpoints /* can be fetched from @injectivelabs/networks based on the Network */ +} + +export interface Transaction { + memo?: string + injectiveAddress?: string + msgs: Msgs | Msgs[] + + // In case we manually want to set gas options + gas?: { + gasPrice?: string + gas?: number /** gas limit */ + feePayer?: string + granter?: string + } +} + +/** Converting EIP712 tx details to Cosmos Std Sign Doc */ +export const createEip712StdSignDoc = ({ + memo, + chainId, + accountNumber, + timeoutHeight, + sequence, + gas, + msgs, +}: { + memo?: string + chainId: ChainId + timeoutHeight?: string + accountNumber: number + sequence: number + gas?: string + msgs: Msgs[] +}) => ({ + chain_id: chainId, + timeout_height: timeoutHeight || '', + account_number: accountNumber.toString(), + sequence: sequence.toString(), + fee: getStdFee({ gas }), + msgs: msgs.map((m) => m.toEip712()), + memo: memo || '', +}) + +``` + +/** + * We use this method only when we want to broadcast a transaction using Ledger on Keplr for Injective + * + * Note: Gas estimation not available + * @param tx the transaction that needs to be broadcasted + */ +export const experimentalBroadcastKeplrWithLedger = async ( + tx: Transaction, + options: Options +) => { + const { endpoints, chainId, ethereumChainId } = options + const msgs = Array.isArray(tx.msgs) ? tx.msgs : [tx.msgs] + const DEFAULT_BLOCK_TIMEOUT_HEIGHT = 60 + + /** + * You choose to perform a check if + * the user is indeed connected with Ledger + Keplr + */ + if (/* your condition here */) { + throw new GeneralException( + new Error( + 'This method can only be used when Keplr is connected with Ledger', + ), + ) + } + + /** Account Details * */ + const chainRestAuthApi = new ChainRestAuthApi(endpoints.rest) + const accountDetailsResponse = await chainRestAuthApi.fetchAccount( + tx.injectiveAddress, + ) + const baseAccount = BaseAccount.fromRestApi(accountDetailsResponse) + const accountDetails = baseAccount.toAccountDetails() + + /** 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 key = await window.keplr.getKey(chainId) + const pubKey = Buffer.from(key.pubKey).toString('base64') + const gas = (tx.gas?.gas || getGasPriceBasedOnMessage(msgs)).toString() + + /** EIP712 for signing on Ethereum wallets */ + const eip712TypedData = getEip712TypedData({ + msgs, + fee: getStdFee({ ...tx.gas, gas }), + tx: { + memo: tx.memo, + accountNumber: accountDetails.accountNumber.toString(), + sequence: accountDetails.sequence.toString(), + timeoutHeight: timeoutHeight.toFixed(), + chainId, + }, + ethereumChainId, + }) + + const aminoSignResponse = await window.keplr.experimentalSignEIP712CosmosTx_v0( + chainId, + tx.injectiveAddress, + eip712TypedData, + createEip712StdSignDoc({ + ...tx, + ...baseAccount, + msgs, + chainId, + gas: gas || tx.gas?.gas?.toString(), + timeoutHeight: timeoutHeight.toFixed(), + } + ) + + /** + * Create TxRaw from the signed tx that we + * get as a response in case the user changed the fee/memo + * on the Keplr popup + */ + const { txRaw } = createTransaction({ + pubKey, + message: msgs, + memo: aminoSignResponse.signed.memo, + signMode: SIGN_AMINO, + fee: aminoSignResponse.signed.fee, + sequence: parseInt(aminoSignResponse.signed.sequence, 10), + timeoutHeight: parseInt( + (aminoSignResponse.signed as any).timeout_height, + 10, + ), + accountNumber: parseInt(aminoSignResponse.signed.account_number, 10), + chainId, + }) + + /** Preparing the transaction for client broadcasting */ + const web3Extension = createWeb3Extension({ + ethereumChainId, + }) + const txRawEip712 = createTxRawEIP712(txRaw, web3Extension) + + /** Append Signatures */ + const signatureBuff = Buffer.from( + aminoSignResponse.signature.signature, + 'base64', + ) + txRawEip712.signatures = [signatureBuff] + + /** Broadcast the transaction */ + const response = await new TxGrpcApi(endpoints.grpc).broadcast(txRawEip712) + + if (response.code !== 0) { + throw new TransactionException(new Error(response.rawLog), { + code: UnspecifiedErrorCode, + contextCode: response.code, + contextModule: response.codespace, + }) + } + + return response +} +```` diff --git a/.gitbook/wallet/README.md b/.gitbook/wallet/README.md index b299543ad..2a43104ea 100644 --- a/.gitbook/wallet/README.md +++ b/.gitbook/wallet/README.md @@ -4,7 +4,18 @@ Injective defines its own custom `Account` type that uses Ethereum's ECDSA secp2 Injective is built on top of the CosmosSDK. This means that (with some modifications, since Cosmos uses different curve for keys) users can also use Cosmos native wallets to interact with Injective. +### Technical Explanation +Let's briefly explain how the accounts (wallets) work on Injective and in crypto in general. + +* Everything starts from a **SeedPhase** (or mnemonic). A **SeedPhrase** is a list of 12 or 24 common words in a particular order. +* From the **SeedPhase** you can have an **infinite** number of **PrivateKeys** derived using indexing (the first private key starts at index 0). This is why you can add multiple accounts on Metamask, Keplr, or any other popular wallet without generating a new **SeedPhase** _(the derivation itself is a bit complicated for this brief explanation so we are going to omit it for now)._ +* After a **PrivateKey** has been derived from your **seed phase**, you can use this **PrivateKey** to derive your **PublicKey**. **One PrivateKey always corresponds to one PublicKey!** +* Once you have your P**ublicKey** you can derive your **PublicAddress**. These public addresses can be derived using different derivation schemes and representations (_base64_, _hex_, _bech32_, etc). + +With the explanation above, we can understand that once you have your **PublicKey** you can derive both your Ethereum address (represented in a hex format, `0x...`) and your Injective address (represented in a bech32 format, `inj1...`). + +*** ### Topics diff --git a/.gitbook/wallet/wallet-connections.md b/.gitbook/wallet/wallet-connections.md index 0a76bf647..a0b2dd182 100644 --- a/.gitbook/wallet/wallet-connections.md +++ b/.gitbook/wallet/wallet-connections.md @@ -70,4 +70,4 @@ Keplr is an Cosmos native wallet and can be used to connect and interact with yo * **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). +An example of how to prepare + sign + broadcast a transaction on Injective using Keplr can be found [here](../transactions/transactions-cosmos/). diff --git a/README.md b/README.md index f1b05baa6..817da1c35 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ # 🌟 Injective's TypeScript Monorepo -[![Wiki](https://img.shields.io/static/v1?label=Wiki&message=Documentation&color=blue)](https://github.com/InjectiveLabs/injective-ts/wiki) +[![Documentation](https://img.shields.io/static/v1?label=Documentation&message=Documentation&color=blue)](https://docs.ts.injective.network/) _Access Limitless DeFi Markets with Zero Barriers._ `injective-ts` is a TypeScript monorepo that contains packages which can be used to interact with Injective from a Node.js or browser environments and which provide simple abstractions over core data structures, serialization, key management, and API request generation, etc. The packages can be found in the `packages` folder and each package is a `npm` module that is published on the `npm` registry. -Learn more on our [Wiki](https://github.com/InjectiveLabs/injective-ts/wiki) +Learn more on our [Docs](https://docs.ts.injective.network/) --- diff --git a/docs/interfaces/_injectivelabs_sdk_ts.internal.QueryValidatorResponse.html b/docs/interfaces/_injectivelabs_sdk_ts.internal.QueryValidatorResponse.html index 0e700f517..fa0ecf614 100644 --- a/docs/interfaces/_injectivelabs_sdk_ts.internal.QueryValidatorResponse.html +++ b/docs/interfaces/_injectivelabs_sdk_ts.internal.QueryValidatorResponse.html @@ -1,5 +1,5 @@ QueryValidatorResponse | API Reference | Injective - Powering the future of decentralized finance.
Options
All
  • Public
  • Public/Protected
  • All
Menu

QueryValidatorResponse is response type for the Query/Validator RPC method

Hierarchy

  • QueryValidatorResponse

Index

Properties

Properties

validator: undefined | Validator
-

validator defines the the validator info.

-

Legend

  • Namespace
  • Variable
  • Function
  • Function with type parameter
  • Type alias
  • Type alias with type parameter
  • Interface
  • Interface with type parameter
  • Enumeration
  • Class

Settings

Theme

Generated using TypeDoc

\ No newline at end of file +

validator defines the validator info.

+

Legend

  • Namespace
  • Variable
  • Function
  • Function with type parameter
  • Type alias
  • Type alias with type parameter
  • Interface
  • Interface with type parameter
  • Enumeration
  • Class

Settings

Theme

Generated using TypeDoc

diff --git a/docs/interfaces/_injectivelabs_wallet_ts.ConcreteCosmosWalletStrategy.html b/docs/interfaces/_injectivelabs_wallet_ts.ConcreteCosmosWalletStrategy.html index 41317bae3..f7b63f987 100644 --- a/docs/interfaces/_injectivelabs_wallet_ts.ConcreteCosmosWalletStrategy.html +++ b/docs/interfaces/_injectivelabs_wallet_ts.ConcreteCosmosWalletStrategy.html @@ -1,5 +1,5 @@ ConcreteCosmosWalletStrategy | API Reference | Injective - Powering the future of decentralized finance.
Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • ConcreteCosmosWalletStrategy

Index

Methods

  • getAddresses(): Promise<string[]>
  • getPubKey(): Promise<string>
  • signAminoTransaction(transaction: { address: string; stdSignDoc: StdSignDoc }): Promise<AminoSignResponse>
  • signTransaction(transaction: { accountNumber: number; address: string; chainId: string; txRaw: TxRaw }): Promise<DirectSignResponse>

Legend

  • Namespace
  • Variable
  • Function
  • Function with type parameter
  • Type alias
  • Type alias with type parameter
  • Interface
  • Interface with type parameter
  • Method
  • Enumeration
  • Class

Settings

Theme

Generated using TypeDoc

\ No newline at end of file +

Returns Promise<TxResponse>

  • signAminoTransaction(transaction: { address: string; stdSignDoc: StdSignDoc }): Promise<AminoSignResponse>
  • signTransaction(transaction: { accountNumber: number; address: string; chainId: string; txRaw: TxRaw }): Promise<DirectSignResponse>

Legend

  • Namespace
  • Variable
  • Function
  • Function with type parameter
  • Type alias
  • Type alias with type parameter
  • Interface
  • Interface with type parameter
  • Method
  • Enumeration
  • Class

Settings

Theme

Generated using TypeDoc

diff --git a/docs/interfaces/_injectivelabs_wallet_ts.ConcreteWalletStrategy.html b/docs/interfaces/_injectivelabs_wallet_ts.ConcreteWalletStrategy.html index 33d8c3f38..8fe1da5e0 100644 --- a/docs/interfaces/_injectivelabs_wallet_ts.ConcreteWalletStrategy.html +++ b/docs/interfaces/_injectivelabs_wallet_ts.ConcreteWalletStrategy.html @@ -3,7 +3,7 @@

Parameters

  • address: string

    address

Returns Promise<string>

  • disconnect(): Promise<void>
  • getAddresses(): Promise<string[]>
  • getEthereumChainId(): Promise<string>
  • getEthereumTransactionReceipt(txHash: string): void
  • getPubKey(): Promise<string>

Returns Promise<string>

  • signTransaction(data: string | { accountNumber: number; chainId: string; txRaw: TxRaw }, address: string): Promise<string | DirectSignResponse>

Legend

  • Namespace
  • Variable
  • Function
  • Function with type parameter
  • Type alias
  • Type alias with type parameter
  • Interface
  • Interface with type parameter
  • Method
  • Enumeration
  • Class

Settings

Theme

Generated using TypeDoc

\ No newline at end of file +

Parameters

  • data: string | { accountNumber: number; chainId: string; txRaw: TxRaw }
  • address: string

Returns Promise<string | DirectSignResponse>

Legend

  • Namespace
  • Variable
  • Function
  • Function with type parameter
  • Type alias
  • Type alias with type parameter
  • Interface
  • Interface with type parameter
  • Method
  • Enumeration
  • Class

Settings

Theme

Generated using TypeDoc

diff --git a/package.json b/package.json index a3b373d9e..b86257e92 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,7 @@ "test:sdk-ts:core": "jest ./packages/sdk-ts/src/core", "test:bridge-ts": "jest ./packages/bridge-ts/src", "test:sdk-ui-ts": "jest ./packages/sdk-ui-ts/src", + "test:token-metadata": "jest ./packages/token-metadata/test", "test:ci": "jest --coverage --ci --reporters='jest-junit'", "coverage": "jest --coverage", "coverage:unit": "yarn test:unit --coverage", diff --git a/packages/bridge-ts/CHANGELOG.md b/packages/bridge-ts/CHANGELOG.md index 11b044a52..e03fe770c 100644 --- a/packages/bridge-ts/CHANGELOG.md +++ b/packages/bridge-ts/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.5](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/bridge-ts@1.14.5-beta.69...@injectivelabs/bridge-ts@1.14.5) (2024-01-11) + +**Note:** Version bump only for package @injectivelabs/bridge-ts + + + + + +## [1.14.4](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/bridge-ts@1.14.4-beta.3...@injectivelabs/bridge-ts@1.14.4) (2023-11-20) + +**Note:** Version bump only for package @injectivelabs/bridge-ts + + + + + +## [1.14.3](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/bridge-ts@1.14.3-beta.23...@injectivelabs/bridge-ts@1.14.3) (2023-11-17) + +**Note:** Version bump only for package @injectivelabs/bridge-ts + + + + + +## [1.14.2](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/bridge-ts@1.14.2-beta.13...@injectivelabs/bridge-ts@1.14.2) (2023-11-07) + +**Note:** Version bump only for package @injectivelabs/bridge-ts + + + + + ## [1.14.1](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/bridge-ts@1.14.1-beta.24...@injectivelabs/bridge-ts@1.14.1) (2023-10-27) **Note:** Version bump only for package @injectivelabs/bridge-ts diff --git a/packages/bridge-ts/package.json b/packages/bridge-ts/package.json index 81828741c..c989c088f 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.14.2-beta.14", + "version": "1.14.5", "sideEffects": false, "author": { "name": "Bojan Angjelkoski", @@ -31,12 +31,12 @@ "start": "node dist/index.js" }, "dependencies": { - "@axelar-network/axelarjs-sdk": "^0.11.7", - "@injectivelabs/exceptions": "^1.14.2-beta.2", - "@injectivelabs/networks": "^1.14.2-beta.3", - "@injectivelabs/sdk-ts": "^1.14.2-beta.14", - "@injectivelabs/ts-types": "^1.14.2-beta.0", - "@injectivelabs/utils": "^1.14.2-beta.2", + "@axelar-network/axelarjs-sdk": "0.13.6", + "@injectivelabs/exceptions": "^1.14.5", + "@injectivelabs/networks": "^1.14.5", + "@injectivelabs/sdk-ts": "^1.14.5", + "@injectivelabs/ts-types": "^1.14.5", + "@injectivelabs/utils": "^1.14.5", "@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/bridge-ts/src/wormhole/WormholeClient.ts b/packages/bridge-ts/src/wormhole/WormholeClient.ts index 1a5287a1f..8174c3a8b 100644 --- a/packages/bridge-ts/src/wormhole/WormholeClient.ts +++ b/packages/bridge-ts/src/wormhole/WormholeClient.ts @@ -1,25 +1,32 @@ import { Network } from '@injectivelabs/networks' +import { GeneralException } from '@injectivelabs/exceptions' import { parseVaa, parseTransferPayload, tryHexToNativeString, ChainId, } from '@injectivelabs/wormhole-sdk' +import { getSignedVAAFromRest, getSignedVAAWithRetryFromRest } from './vaa' export class BaseWormholeClient { public network: Network public wormholeRpcUrl?: string + public wormholeRestUrl?: string + constructor({ network, + wormholeRestUrl, wormholeRpcUrl, }: { network: Network solanaHostUrl?: string + wormholeRestUrl?: string wormholeRpcUrl?: string }) { this.network = network + this.wormholeRestUrl = wormholeRestUrl this.wormholeRpcUrl = wormholeRpcUrl } @@ -42,4 +49,50 @@ export class BaseWormholeClient { amount: parsedTransferPayload.amount.toString(), } } + + async getSignedVAARest(txHash: string) { + const { wormholeRestUrl } = this + + if (!wormholeRestUrl) { + throw new GeneralException(new Error(`Please provide wormholeRestUrl`)) + } + + try { + const response = (await getSignedVAAWithRetryFromRest( + txHash, + wormholeRestUrl, + )) as string + + return response + } catch (e) { + throw new GeneralException( + new Error( + `Could not get the signed VAA. Is the transaction confirmed?`, + ), + ) + } + } + + async getSignedVAARestNoRetry(txHash: string) { + const { wormholeRestUrl } = this + + if (!wormholeRestUrl) { + throw new GeneralException(new Error(`Please provide wormholeRestUrl`)) + } + + try { + const response = (await getSignedVAAFromRest( + txHash, + wormholeRestUrl, + )) as string + + return response + } catch (e) { + throw new GeneralException( + new Error( + `Could not get the signed VAA. Is the transaction confirmed?`, + ), + ) + } + } } diff --git a/packages/bridge-ts/src/wormhole/clients/EvmWormholeClient.ts b/packages/bridge-ts/src/wormhole/clients/EvmWormholeClient.ts index 0fe799080..16b0a5a4f 100644 --- a/packages/bridge-ts/src/wormhole/clients/EvmWormholeClient.ts +++ b/packages/bridge-ts/src/wormhole/clients/EvmWormholeClient.ts @@ -52,15 +52,17 @@ export class EvmWormholeClient constructor({ network, wormholeRpcUrl, + wormholeRestUrl, wormholeSource, provider, }: { network: Network wormholeSource: WormholeSource wormholeRpcUrl?: string + wormholeRestUrl?: string provider: Provider }) { - super({ network, wormholeRpcUrl }) + super({ network, wormholeRpcUrl, wormholeRestUrl }) this.wormholeSource = wormholeSource this.provider = provider } @@ -371,11 +373,13 @@ export class EvmWormholeClient } private async transferToken(args: TransferMsgArgs) { - const { network, wormholeRpcUrl, wormholeSource } = this + const { network, wormholeRpcUrl, wormholeRestUrl, wormholeSource } = this const { amount, recipient, tokenAddress } = args - if (!wormholeRpcUrl) { - throw new GeneralException(new Error(`Please provide wormholeRpcUrl`)) + if (!wormholeRpcUrl && !wormholeRestUrl) { + throw new GeneralException( + new Error(`Please provide wormholeRpcUrl | wormholeRestUrl`), + ) } if (!tokenAddress) { @@ -432,11 +436,13 @@ export class EvmWormholeClient } private async transferNative(args: TransferMsgArgs) { - const { network, wormholeRpcUrl, wormholeSource } = this + const { network, wormholeRpcUrl, wormholeRestUrl, wormholeSource } = this const { amount, recipient } = args - if (!wormholeRpcUrl) { - throw new GeneralException(new Error(`Please provide wormholeRpcUrl`)) + if (!wormholeRpcUrl && !wormholeRestUrl) { + throw new GeneralException( + new Error(`Please provide wormholeRpcUrl | wormholeRestUrl`), + ) } if (!recipient) { diff --git a/packages/bridge-ts/src/wormhole/clients/InjectiveWormholeClient.ts b/packages/bridge-ts/src/wormhole/clients/InjectiveWormholeClient.ts index 2906d2c48..62c99dce3 100644 --- a/packages/bridge-ts/src/wormhole/clients/InjectiveWormholeClient.ts +++ b/packages/bridge-ts/src/wormhole/clients/InjectiveWormholeClient.ts @@ -57,13 +57,15 @@ export class InjectiveWormholeClient constructor({ network, wormholeRpcUrl, + wormholeRestUrl, provider, }: { network: Network provider: Provider wormholeRpcUrl?: string + wormholeRestUrl?: string }) { - super({ network, wormholeRpcUrl }) + super({ network, wormholeRpcUrl, wormholeRestUrl }) this.provider = provider } @@ -107,7 +109,7 @@ export class InjectiveWormholeClient destination?: WormholeSource }, ) { - const { network, wormholeRpcUrl, provider } = this + const { network, wormholeRpcUrl, wormholeRestUrl, provider } = this const { amount, signer, @@ -123,8 +125,10 @@ export class InjectiveWormholeClient throw new GeneralException(new Error(`Please provide tokenAddress`)) } - if (!wormholeRpcUrl) { - throw new GeneralException(new Error(`Please provide wormholeRpcUrl`)) + if (!wormholeRpcUrl && !wormholeRestUrl) { + throw new GeneralException( + new Error(`Please provide wormholeRpcUrl | wormholeRestUrl`), + ) } if (!recipient) { diff --git a/packages/bridge-ts/src/wormhole/clients/SolanaWormholeClient.ts b/packages/bridge-ts/src/wormhole/clients/SolanaWormholeClient.ts index b7758de6e..a3cae9b75 100644 --- a/packages/bridge-ts/src/wormhole/clients/SolanaWormholeClient.ts +++ b/packages/bridge-ts/src/wormhole/clients/SolanaWormholeClient.ts @@ -59,13 +59,15 @@ export class SolanaWormholeClient provider, solanaHostUrl, wormholeRpcUrl, + wormholeRestUrl, }: { network: Network provider: PhantomWalletAdapter solanaHostUrl: string wormholeRpcUrl?: string + wormholeRestUrl?: string }) { - super({ network, wormholeRpcUrl }) + super({ network, wormholeRestUrl, wormholeRpcUrl }) this.solanaHostUrl = solanaHostUrl this.provider = provider } @@ -81,22 +83,9 @@ export class SolanaWormholeClient } async getBalance(address: string | PublicKey, tokenAddress?: string) { - if (tokenAddress) { - throw new GeneralException(new Error(`SPL tokens not supported yet`)) - } - - try { - const { solanaHostUrl } = this - const connection = new Connection(solanaHostUrl || '') - - const balance = ( - await connection.getBalance(new PublicKey(address)) - ).toString() - - return balance - } catch (e) { - return '0' - } + return tokenAddress + ? this.getSplTokenBalance(address, tokenAddress) + : this.getNativeTokenBalance(address) } async transfer(args: TransferMsgArgs) { @@ -138,9 +127,10 @@ export class SolanaWormholeClient const { network, wormholeRpcUrl } = this if (!wormholeRpcUrl) { - throw new GeneralException(new Error(`Please provide wormholeRpcUrl`)) + throw new GeneralException( + new Error(`Please provide wormholeRpcUrl`), + ) } - const { associatedChainContractAddresses } = getContractAddresses(network) const sequence = parseSequenceFromLogSolana( @@ -176,9 +166,10 @@ export class SolanaWormholeClient const { network, wormholeRpcUrl } = this if (!wormholeRpcUrl) { - throw new GeneralException(new Error(`Please provide wormholeRpcUrl`)) + throw new GeneralException( + new Error(`Please provide wormholeRpcUrl`), + ) } - const { associatedChainContractAddresses } = getContractAddresses(network) const sequence = parseSequenceFromLogSolana( @@ -435,8 +426,51 @@ export class SolanaWormholeClient } } + private async getNativeTokenBalance(address: string | PublicKey) { + const { solanaHostUrl } = this + const connection = new Connection(solanaHostUrl || '') + + try { + const balance = ( + await connection.getBalance(new PublicKey(address)) + ).toString() + + return balance + } catch (e) { + return '0' + } + } + + private async getSplTokenBalance( + address: string | PublicKey, + tokenAddress: string, + ) { + const { solanaHostUrl } = this + const connection = new Connection(solanaHostUrl || '') + + try { + const tokenAddressPubKey = new PublicKey(tokenAddress) + const tokenAccount = await connection.getTokenAccountsByOwner( + new PublicKey(address), + { mint: tokenAddressPubKey }, + ) + + if (!tokenAccount || (tokenAccount && tokenAccount.value.length === 0)) { + return '0' + } + + const balance = ( + await connection.getTokenAccountBalance(tokenAccount.value[0].pubkey) + ).value.amount + + return balance + } catch (e) { + return '0' + } + } + private async transferToken(args: TransferMsgArgs) { - const { network, solanaHostUrl, wormholeRpcUrl } = this + const { network, solanaHostUrl, wormholeRestUrl, wormholeRpcUrl } = this const { amount, recipient, signer } = args const endpoints = getNetworkEndpoints(network) @@ -447,10 +481,11 @@ export class SolanaWormholeClient throw new GeneralException(new Error(`Please provide solanaHostUrl`)) } - if (!wormholeRpcUrl) { - throw new GeneralException(new Error(`Please provide wormholeRpcUrl`)) + if (!wormholeRpcUrl && !wormholeRestUrl) { + throw new GeneralException( + new Error(`Please provide wormholeRpcUrl | wormholeRestUrl`), + ) } - if (!args.tokenAddress) { throw new GeneralException(new Error(`Please provide tokenAddress`)) } @@ -518,7 +553,7 @@ export class SolanaWormholeClient } private async transferNative(args: TransferMsgArgs) { - const { network, solanaHostUrl, wormholeRpcUrl } = this + const { network, solanaHostUrl, wormholeRestUrl, wormholeRpcUrl } = this const { amount, recipient, signer } = args const provider = await this.getProvider() @@ -532,10 +567,11 @@ export class SolanaWormholeClient throw new GeneralException(new Error(`Please provide signerPubKey`)) } - if (!wormholeRpcUrl) { - throw new GeneralException(new Error(`Please provide wormholeRpcUrl`)) + if (!wormholeRpcUrl && !wormholeRestUrl) { + throw new GeneralException( + new Error(`Please provide wormholeRpcUrl | wormholeRestUrl`), + ) } - const { associatedChainContractAddresses } = getContractAddresses(network) const connection = new Connection(solanaHostUrl, 'confirmed') diff --git a/packages/bridge-ts/src/wormhole/strategy/EvmWormholeClientStrategy.ts b/packages/bridge-ts/src/wormhole/strategy/EvmWormholeClientStrategy.ts index 89fab298d..dfaf4fc5e 100644 --- a/packages/bridge-ts/src/wormhole/strategy/EvmWormholeClientStrategy.ts +++ b/packages/bridge-ts/src/wormhole/strategy/EvmWormholeClientStrategy.ts @@ -21,6 +21,7 @@ export class EvmWormholeClientStrategy constructor(args: { network: Network wormholeRpcUrl?: string + wormholeRestUrl?: string provider: Provider wormholeSource?: WormholeSource }) { @@ -83,6 +84,14 @@ export class EvmWormholeClientStrategy return this.strategy.getSignedVAANoRetry(txResponse) } + async getSignedVAARest(txHash: string) { + return this.strategy.getSignedVAARest(txHash) + } + + async getSignedVAANoRetryRest(txHash: string) { + return this.strategy.getSignedVAARestNoRetry(txHash) + } + async getIsTransferCompleted(signedVAA: string /* in base 64 */) { return this.strategy.getIsTransferCompleted(signedVAA) } diff --git a/packages/bridge-ts/src/wormhole/vaa.spec.ts b/packages/bridge-ts/src/wormhole/vaa.spec.ts new file mode 100644 index 000000000..1edf3f51d --- /dev/null +++ b/packages/bridge-ts/src/wormhole/vaa.spec.ts @@ -0,0 +1,21 @@ +import { getSignedVAAWithRetryFromRest } from './vaa' + +describe('Wormhole API', () => { + test('getSignedVAAWithRetryFromRest success', async () => { + console.log( + await getSignedVAAWithRetryFromRest( + '4v46ixpJHUXrKoDSXRaHh6NmBSiL5K4FgWAAipuoPzAj7ZKjLkgDgQ5AxfSxAw5YcuDomMyLq1z9kW38FtuQPUEe', + 'https://api.wormholescan.io/api/v1', + ), + ) + }) + + test('getSignedVAAWithRetryFromRest error', async () => { + console.log( + await getSignedVAAWithRetryFromRest( + '4v46ixpJHUXrKoDSXRaHh6NmBSiL5K4FgWAAipuoPzAj7ZKjLkgDgQ5AxfSxAw5YcuDomMyLq1z9kW38FtuQPUE4', + 'https://api.wormholescan.io/api/v1', + ), + ) + }) +}) diff --git a/packages/bridge-ts/src/wormhole/vaa.ts b/packages/bridge-ts/src/wormhole/vaa.ts new file mode 100644 index 000000000..58a0d3b6a --- /dev/null +++ b/packages/bridge-ts/src/wormhole/vaa.ts @@ -0,0 +1,63 @@ +import { HttpClient } from '@injectivelabs/utils' +import { GeneralException } from '@injectivelabs/exceptions' + +export const getSignedVAAFromRest = async ( + txHash: string, + endpoint: string, +) => { + try { + const response = (await new HttpClient(endpoint).get('vaas', { + txHash, + parsedPayload: true, + })) as { + data: { + data: [ + { + vaa: string + }, + ] + } + } + + const vaa = response.data?.data[0]?.vaa + + if (!vaa) { + throw new GeneralException(new Error("Vaa can't be found")) + } + + return response.data?.data[0]?.vaa + } catch (e: any) { + if (e instanceof GeneralException) { + throw e + } + + throw new GeneralException(new Error("Vaa can't be found")) + } +} + +export const getSignedVAAWithRetryFromRest = async ( + txHash: string, + endpoint: string, +) => { + const TOTAL_RETRIES = 50 + const DELAY_BETWEEN_CALLS = 5000 + + const retryHttpCall = async (attempt = 1): Promise => { + try { + return await getSignedVAAFromRest(txHash, endpoint) + } catch (e: any) { + if (attempt >= TOTAL_RETRIES) { + throw e + } + + return new Promise((resolve) => + setTimeout( + () => resolve(retryHttpCall(attempt + 1)), + DELAY_BETWEEN_CALLS * attempt, + ), + ) + } + } + + return retryHttpCall() +} diff --git a/packages/contracts/CHANGELOG.md b/packages/contracts/CHANGELOG.md index def2f7193..4ea736a2c 100644 --- a/packages/contracts/CHANGELOG.md +++ b/packages/contracts/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.5](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/contracts@1.14.5-beta.9...@injectivelabs/contracts@1.14.5) (2024-01-11) + +**Note:** Version bump only for package @injectivelabs/contracts + + + + + +## [1.14.4](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/contracts@1.14.4-beta.0...@injectivelabs/contracts@1.14.4) (2023-11-20) + +**Note:** Version bump only for package @injectivelabs/contracts + + + + + +## [1.14.3](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/contracts@1.14.3-beta.4...@injectivelabs/contracts@1.14.3) (2023-11-17) + +**Note:** Version bump only for package @injectivelabs/contracts + + + + + +## [1.14.2](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/contracts@1.14.2-beta.2...@injectivelabs/contracts@1.14.2) (2023-11-07) + +**Note:** Version bump only for package @injectivelabs/contracts + + + + + ## [1.14.1](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/contracts@1.14.1-beta.8...@injectivelabs/contracts@1.14.1) (2023-10-27) **Note:** Version bump only for package @injectivelabs/contracts diff --git a/packages/contracts/package.json b/packages/contracts/package.json index 3517e5305..4aa36d857 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.14.2-beta.3", + "version": "1.14.5", "sideEffects": false, "license": "Apache-2.0", "main": "dist/cjs/index.js", @@ -31,10 +31,10 @@ "start": "node dist/index.js" }, "dependencies": { - "@injectivelabs/exceptions": "^1.14.2-beta.2", - "@injectivelabs/networks": "^1.14.2-beta.3", - "@injectivelabs/ts-types": "^1.14.2-beta.0", - "@injectivelabs/utils": "^1.14.2-beta.2", + "@injectivelabs/exceptions": "^1.14.5", + "@injectivelabs/networks": "^1.14.5", + "@injectivelabs/ts-types": "^1.14.5", + "@injectivelabs/utils": "^1.14.5", "ethers": "^5.7.2", "link-module-alias": "^1.2.0", "shx": "^0.3.3" diff --git a/packages/exceptions/CHANGELOG.md b/packages/exceptions/CHANGELOG.md index 70e08ace6..72099665c 100644 --- a/packages/exceptions/CHANGELOG.md +++ b/packages/exceptions/CHANGELOG.md @@ -3,6 +3,41 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.14.5](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/exceptions@1.14.5-beta.6...@injectivelabs/exceptions@1.14.5) (2024-01-11) + +**Note:** Version bump only for package @injectivelabs/exceptions + + + + + +## [1.14.4](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/exceptions@1.14.4-beta.0...@injectivelabs/exceptions@1.14.4) (2023-11-20) + +**Note:** Version bump only for package @injectivelabs/exceptions + + + + + +## [1.14.3](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/exceptions@1.14.3-beta.4...@injectivelabs/exceptions@1.14.3) (2023-11-17) + +**Note:** Version bump only for package @injectivelabs/exceptions + + + + + +## [1.14.2](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/exceptions@1.14.2-beta.1...@injectivelabs/exceptions@1.14.2) (2023-11-07) + + +### Reverts + +* faulty version ([6e25b3f](https://github.com/InjectiveLabs/injective-ts/commit/6e25b3f156d964666db8bc7885df653166aac523)) + + + + + ## [1.14.1](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/exceptions@1.14.1-beta.7...@injectivelabs/exceptions@1.14.1) (2023-10-27) **Note:** Version bump only for package @injectivelabs/exceptions diff --git a/packages/exceptions/package.json b/packages/exceptions/package.json index 08cf39c6d..cf4f6b1a0 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.14.2-beta.2", + "version": "1.14.5", "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.14.2-beta.0", + "@injectivelabs/ts-types": "^1.14.5", "http-status-codes": "^2.2.0", "link-module-alias": "^1.2.0", "shx": "^0.3.2" diff --git a/packages/exceptions/src/exceptions/GrpcUnaryRequestException.ts b/packages/exceptions/src/exceptions/GrpcUnaryRequestException.ts index 28850305c..abefb09aa 100644 --- a/packages/exceptions/src/exceptions/GrpcUnaryRequestException.ts +++ b/packages/exceptions/src/exceptions/GrpcUnaryRequestException.ts @@ -9,4 +9,17 @@ export class GrpcUnaryRequestException extends ConcreteException { this.type = ErrorType.GrpcUnaryRequest } + + public parse(): void { + const { message } = this + + if (message.toLowerCase().includes('response closed without headers')) { + this.setMessage( + 'Product is under heavy load, refresh the page in a few seconds.', + ) + this.setOriginalMessage( + `The product is experiencing higher than usual demand. Hang tight, engineers are doing their best to improve the performance and efficiency.`, + ) + } + } } diff --git a/packages/exceptions/src/exceptions/LedgerCosmosException.ts b/packages/exceptions/src/exceptions/LedgerCosmosException.ts new file mode 100644 index 000000000..dbb21de7e --- /dev/null +++ b/packages/exceptions/src/exceptions/LedgerCosmosException.ts @@ -0,0 +1,58 @@ +import { ConcreteException } from '../exception' +import { ErrorContext, ErrorType } from '../types' +import { isCommonLockedError } from '../utils/helpers' + +export class LedgerCosmosException extends ConcreteException { + public errorClass: string = 'LedgerCosmosException' + + constructor(error: Error, context?: ErrorContext) { + super(error, context) + + this.type = ErrorType.WalletError + } + + public parse(): void { + const { message } = this + + if (isCommonLockedError(message)) { + this.setMessage( + 'Please ensure your Ledger is connected, unlocked and your Cosmos app is open.', + ) + } + + if (message.includes('No device selected.')) { + this.setMessage( + 'Please make sure your Ledger device is connected, unlocked and your Cosmos app is open', + ) + } + + if (message.includes('Unable to set device configuration.')) { + this.setMessage( + 'Please restart your Ledger device and try connecting again', + ) + } + + if (message.includes('Cannot read properties of undefined')) { + this.setMessage('Please make sure your Ledger device is connected') + } + + if (message.toLowerCase().includes('locked')) { + this.setMessage( + 'Please make sure your Ledger device is connected, unlocked and your Cosmos app is open', + ) + } + + if ( + message.includes('Condition of use not satisfied') || + message.includes('0x6985') + ) { + this.setMessage('The request has been rejected') + } + + if (message.includes('U2F browser support is needed for Ledger.')) { + this.setMessage( + 'Please use the latest Chrome/Firefox browser versions to connect with your Ledger device', + ) + } + } +} diff --git a/packages/exceptions/src/exceptions/LedgerException.ts b/packages/exceptions/src/exceptions/LedgerException.ts index be32280e9..82d09b04d 100644 --- a/packages/exceptions/src/exceptions/LedgerException.ts +++ b/packages/exceptions/src/exceptions/LedgerException.ts @@ -1,27 +1,6 @@ import { ConcreteException } from '../exception' import { ErrorContext, ErrorType } from '../types' - -const isCommonLockedError = (error: string) => { - const commonMessages = [ - 'Ledger device: Incorrect length', - 'Ledger device: INS_NOT_SUPPORTED', - 'Ledger device: CLA_NOT_SUPPORTED', - 'CLA_NOT_SUPPORTED', - 'CLA', - 'Locked', - 'Failed to open the device', - 'Failed to open the device', - 'Ledger Device is busy', - 'UNKNOWN_ERROR', - ] - - return ( - commonMessages.some((m) => m.includes(error)) || - commonMessages - .map((m) => m.toLowerCase()) - .some((m) => m.includes(error.toLowerCase())) - ) -} +import { isCommonLockedError } from '../utils/helpers' export class LedgerException extends ConcreteException { public errorClass: string = 'LedgerException' @@ -32,7 +11,7 @@ export class LedgerException extends ConcreteException { this.type = ErrorType.WalletError } - public parseMessage(): void { + public parse(): void { const { message } = this if (isCommonLockedError(message)) { @@ -57,6 +36,12 @@ export class LedgerException extends ConcreteException { this.setMessage('Please make sure your Ledger device is connected') } + if (message.toLowerCase().includes('locked')) { + this.setMessage( + 'Please make sure your Ledger device is connected, unlocked and your Ethereum app is open', + ) + } + if ( message.includes('Condition of use not satisfied') || message.includes('0x6985') diff --git a/packages/exceptions/src/exceptions/MetamaskException.ts b/packages/exceptions/src/exceptions/MetamaskException.ts index eb13df9ae..99c38ccab 100644 --- a/packages/exceptions/src/exceptions/MetamaskException.ts +++ b/packages/exceptions/src/exceptions/MetamaskException.ts @@ -17,7 +17,7 @@ export class MetamaskException extends ConcreteException { this.type = ErrorType.WalletError } - public parseMessage(): void { + public parse(): void { const { message } = this this.setMessage(mapMetamaskMessage(removeMetamaskFromErrorString(message))) diff --git a/packages/exceptions/src/exceptions/TransactionException.ts b/packages/exceptions/src/exceptions/TransactionException.ts index 6a0597379..2455b791e 100644 --- a/packages/exceptions/src/exceptions/TransactionException.ts +++ b/packages/exceptions/src/exceptions/TransactionException.ts @@ -16,8 +16,8 @@ export class TransactionException extends ConcreteException { const { code, - contextModule: parsedContextModule, message: parsedMessage, + contextModule: parsedContextModule, } = mapFailedTransactionMessage(message, { contextCode, contextModule }) this.setMessage(parsedMessage) diff --git a/packages/exceptions/src/exceptions/TrustWalletException.ts b/packages/exceptions/src/exceptions/TrustWalletException.ts index b843ca1ba..4e05107d8 100644 --- a/packages/exceptions/src/exceptions/TrustWalletException.ts +++ b/packages/exceptions/src/exceptions/TrustWalletException.ts @@ -19,7 +19,7 @@ export class TrustWalletException extends ConcreteException { this.type = ErrorType.WalletError } - public parseMessage(): void { + public parse(): void { const { message } = this this.setMessage( diff --git a/packages/exceptions/src/exceptions/index.ts b/packages/exceptions/src/exceptions/index.ts index 1356059dc..c9ded5d2d 100644 --- a/packages/exceptions/src/exceptions/index.ts +++ b/packages/exceptions/src/exceptions/index.ts @@ -3,6 +3,7 @@ import { HttpRequestException } from './HttpRequestException' import { Web3Exception } from './Web3Exception' import { GeneralException } from './GeneralException' import { LedgerException } from './LedgerException' +import { LedgerCosmosException } from './LedgerCosmosException' import { MetamaskException } from './MetamaskException' import { TrustWalletException } from './TrustWalletException' import { TrezorException } from './TrezorException' @@ -24,6 +25,7 @@ export type ThrownException = | CosmosWalletException | TransactionException | WalletException + | LedgerCosmosException export const isThrownException = (exception: Error | Exception): boolean => { if (exception instanceof ConcreteException) { @@ -37,6 +39,7 @@ export const isThrownException = (exception: Error | Exception): boolean => { 'Web3Exception', 'GeneralException', 'LedgerException', + 'LedgerCosmosException', 'MetamaskException', 'TrezorException', 'CosmosWalletException', @@ -52,15 +55,16 @@ export const isThrownException = (exception: Error | Exception): boolean => { } export { - GrpcUnaryRequestException, - HttpRequestException, Web3Exception, - GeneralException, LedgerException, - MetamaskException, TrezorException, + WalletException, + GeneralException, + MetamaskException, + TransactionException, TrustWalletException, + HttpRequestException, + LedgerCosmosException, CosmosWalletException, - TransactionException, - WalletException, + GrpcUnaryRequestException, } diff --git a/packages/exceptions/src/messages.ts b/packages/exceptions/src/messages.ts index 8b125674a..4ec9d0b76 100644 --- a/packages/exceptions/src/messages.ts +++ b/packages/exceptions/src/messages.ts @@ -278,6 +278,15 @@ const exchangeErrorMap = { 'The current feature has been disabled', [ChainExchangeModuleErrorCode.ErrTooMuchOrderMargin]: 'Order has too much margin', + [ChainExchangeModuleErrorCode.ErrBadSubaccountNonce]: + 'Subaccount nonce is invalid', + [ChainExchangeModuleErrorCode.ErrInsufficientFunds]: 'Insufficient funds', + [ChainExchangeModuleErrorCode.ErrPostOnlyMode]: + 'Only post-only actions available for approximately 30 minutes after a chain upgrade.', + [ChainExchangeModuleErrorCode.ErrClientOrderIdAlreadyExists]: + 'Client order id already exists', + [ChainExchangeModuleErrorCode.ErrInvalidCid]: + 'Client order id is invalid. Max length is 36 chars', } const insuranceErrorMap = { @@ -572,7 +581,7 @@ const wasmErrorMap = { [ChainWasmErrorCodes.ErrAccountExists]: 'contract account already exists', [ChainWasmErrorCodes.ErrInstantiateFailed]: 'instantiate wasm contract failed', - [ChainWasmErrorCodes.ErrExecuteFailed]: 'execute wasm contract failed', + [ChainWasmErrorCodes.ErrExecuteFailed]: 'Contract execution failed', [ChainWasmErrorCodes.ErrGasLimit]: 'insufficient gas', [ChainWasmErrorCodes.ErrInvalidGenesis]: 'invalid genesis', [ChainWasmErrorCodes.ErrNotFound]: 'not found', @@ -1941,7 +1950,7 @@ export const chainErrorMessagesMap: Record< }, 'execute wasm contract failed': { code: ChainWasmErrorCodes.ErrExecuteFailed, - message: 'execute wasm contract failed', + message: 'Contract execution failed', module: TransactionChainErrorModule.Wasm, }, 'insufficient gas': { diff --git a/packages/exceptions/src/types/codes.ts b/packages/exceptions/src/types/codes.ts index a5b0f6f62..f2733f3e7 100644 --- a/packages/exceptions/src/types/codes.ts +++ b/packages/exceptions/src/types/codes.ts @@ -289,6 +289,15 @@ export enum ChainExchangeModuleErrorCode { ErrFeatureDisabled = 92, // Order has too much margin ErrTooMuchOrderMargin = 93, + // Order has too much margin + ErrBadSubaccountNonce = 94, + ErrInsufficientFunds = 95, + // Exchange is in post-only mode + ErrPostOnlyMode = 96, + // client order id already exists + ErrClientOrderIdAlreadyExists = 97, + // client order id is invalid. Max length is 36 chars + ErrInvalidCid = 98, } export enum ChainAuctionErrorCodes { diff --git a/packages/exceptions/src/utils/helpers.ts b/packages/exceptions/src/utils/helpers.ts new file mode 100644 index 000000000..b460bf405 --- /dev/null +++ b/packages/exceptions/src/utils/helpers.ts @@ -0,0 +1,20 @@ +export const isCommonLockedError = (error: string) => { + const commonMessages = [ + 'Ledger device: Incorrect length', + 'Ledger device: INS_NOT_SUPPORTED', + 'Ledger device: CLA_NOT_SUPPORTED', + 'CLA_NOT_SUPPORTED', + 'CLA', + 'Locked', + 'Failed to open the device', + 'Failed to open the device', + 'Ledger Device is busy', + 'UNKNOWN_ERROR', + ] + + return ( + commonMessages.some((m) => m.includes(error)) || + commonMessages.some((m) => error.toLowerCase().includes(m)) || + commonMessages.some((m) => m.toLowerCase().includes(error.toLowerCase())) + ) +} diff --git a/packages/exceptions/src/utils/maps.ts b/packages/exceptions/src/utils/maps.ts index 12724fb1d..a6805724b 100644 --- a/packages/exceptions/src/utils/maps.ts +++ b/packages/exceptions/src/utils/maps.ts @@ -80,15 +80,28 @@ export const mapFailedTransactionMessage = ( } const getReason = (message: string): string | undefined => { - const reason = /\[reason:"(.*?)"/g + const ReasonPattern = /\[reason:"(.*?)"/g - const codespace = reason.exec(message) + const codespace = ReasonPattern.exec(message) if (!codespace || codespace.length < 2) { return } - return codespace[1] + const reason = codespace[1] + + if (reason === 'execute wasm contract failed') { + const SubReasonPattern = /(.*?)Generic error:(.*?): execute wasm/g + const subReason = SubReasonPattern.exec(message) + + if (!subReason) { + return reason + } + + return subReason[2] || reason + } + + return reason } const ABCICode = context && context.code ? context.code : getABCICode(message) @@ -128,5 +141,13 @@ export const mapMetamaskMessage = (message: string): string => { return 'The request has been rejected' } - return parsedMessage + if (parsedMessage.toLowerCase().includes('user denied'.toLowerCase())) { + return 'The request has been rejected' + } + + if (parsedMessage.toLowerCase().includes('provided chain'.toLowerCase())) { + return 'Your Metamask selected network is incorrect' + } + + return message } diff --git a/packages/networks/CHANGELOG.md b/packages/networks/CHANGELOG.md index d467348c5..56cf1ab3f 100644 --- a/packages/networks/CHANGELOG.md +++ b/packages/networks/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.5](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/networks@1.14.5-beta.9...@injectivelabs/networks@1.14.5) (2024-01-11) + +**Note:** Version bump only for package @injectivelabs/networks + + + + + +## [1.14.4](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/networks@1.14.4-beta.0...@injectivelabs/networks@1.14.4) (2023-11-20) + +**Note:** Version bump only for package @injectivelabs/networks + + + + + +## [1.14.3](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/networks@1.14.3-beta.4...@injectivelabs/networks@1.14.3) (2023-11-17) + +**Note:** Version bump only for package @injectivelabs/networks + + + + + +## [1.14.2](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/networks@1.14.2-beta.2...@injectivelabs/networks@1.14.2) (2023-11-07) + +**Note:** Version bump only for package @injectivelabs/networks + + + + + ## [1.14.1](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/networks@1.14.1-beta.8...@injectivelabs/networks@1.14.1) (2023-10-27) **Note:** Version bump only for package @injectivelabs/networks diff --git a/packages/networks/README.md b/packages/networks/README.md index 1103bdab0..2f023d5ae 100644 --- a/packages/networks/README.md +++ b/packages/networks/README.md @@ -18,7 +18,7 @@ yarn add @injectivelabs/networks ## 📖 Documentation -Read more and find example usages on our [Networks Wiki](https://github.com/InjectiveLabs/injective-ts/wiki/06Networks) +Read more and find example usages on our [Networks Docs](https://docs.ts.injective.network/readme/networks) --- @@ -44,7 +44,6 @@ Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/ -

 

Powering the future of decentralized finance. diff --git a/packages/networks/package.json b/packages/networks/package.json index 39fdc42c1..94631c188 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.14.2-beta.3", + "version": "1.14.5", "sideEffects": false, "license": "Apache-2.0", "author": { @@ -31,9 +31,9 @@ "start": "node dist/index.js" }, "dependencies": { - "@injectivelabs/exceptions": "^1.14.2-beta.2", - "@injectivelabs/ts-types": "^1.14.2-beta.0", - "@injectivelabs/utils": "^1.14.2-beta.2", + "@injectivelabs/exceptions": "^1.14.5", + "@injectivelabs/ts-types": "^1.14.5", + "@injectivelabs/utils": "^1.14.5", "link-module-alias": "^1.2.0", "shx": "^0.3.2" }, diff --git a/packages/networks/src/constants.ts b/packages/networks/src/constants.ts new file mode 100644 index 000000000..657ced2ee --- /dev/null +++ b/packages/networks/src/constants.ts @@ -0,0 +1,153 @@ +import { Network } from './types' + +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', + [Network.Testnet]: 'inj1hdvy6tl89llqy3ze8lv6mz5qh66sx9enn0jxg6', + [Network.TestnetK8s]: 'inj1hdvy6tl89llqy3ze8lv6mz5qh66sx9enn0jxg6', + [Network.TestnetSentry]: 'inj1hdvy6tl89llqy3ze8lv6mz5qh66sx9enn0jxg6', + [Network.TestnetOld]: 'inj1hdvy6tl89llqy3ze8lv6mz5qh66sx9enn0jxg6', + [Network.Devnet]: 'inj1hdvy6tl89llqy3ze8lv6mz5qh66sx9enn0jxg6', + [Network.Devnet1]: 'inj1hdvy6tl89llqy3ze8lv6mz5qh66sx9enn0jxg6', + [Network.Devnet2]: 'inj1hdvy6tl89llqy3ze8lv6mz5qh66sx9enn0jxg6', + [Network.Local]: 'inj1hdvy6tl89llqy3ze8lv6mz5qh66sx9enn0jxg6', +} + +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', + [Network.Testnet]: 'inj14d7h5j6ddq6pqppl65z24w7xrtmpcrqjxj8d43', + [Network.TestnetK8s]: 'inj14d7h5j6ddq6pqppl65z24w7xrtmpcrqjxj8d43', + [Network.TestnetSentry]: 'inj14d7h5j6ddq6pqppl65z24w7xrtmpcrqjxj8d43', + [Network.TestnetOld]: 'inj14d7h5j6ddq6pqppl65z24w7xrtmpcrqjxj8d43', + [Network.Devnet]: 'inj177yh38g3ctu7cemxpa3c2kvwh2yslfxfmfa66h', + [Network.Devnet1]: 'inj177yh38g3ctu7cemxpa3c2kvwh2yslfxfmfa66h', + [Network.Devnet2]: 'inj177yh38g3ctu7cemxpa3c2kvwh2yslfxfmfa66h', + [Network.Local]: 'inj177yh38g3ctu7cemxpa3c2kvwh2yslfxfmfa66h', +} + +export const INCENTIVES_CONTRACT_BY_NETWORK = { + [Network.Mainnet]: '', + [Network.MainnetLB]: '', + [Network.MainnetK8s]: '', + [Network.MainnetSentry]: '', + [Network.Public]: '', + [Network.Staging]: '', + [Network.Internal]: '', + [Network.Testnet]: 'inj16twru668nsl7tqzahxd9q033swhr6a5xuslpkt', + [Network.TestnetK8s]: 'inj16twru668nsl7tqzahxd9q033swhr6a5xuslpkt', + [Network.TestnetSentry]: 'inj16twru668nsl7tqzahxd9q033swhr6a5xuslpkt', + [Network.TestnetOld]: 'inj16twru668nsl7tqzahxd9q033swhr6a5xuslpkt', + [Network.Devnet]: '', + [Network.Devnet1]: '', + [Network.Devnet2]: '', + [Network.Local]: '', +} + +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', + [Network.Testnet]: 'inj1aw59rkpd9afp2ws6rx23nz5mrvq8dlckeslwfa', + [Network.TestnetK8s]: 'inj1aw59rkpd9afp2ws6rx23nz5mrvq8dlckeslwfa', + [Network.TestnetSentry]: 'inj1aw59rkpd9afp2ws6rx23nz5mrvq8dlckeslwfa', + [Network.TestnetOld]: 'inj1aw59rkpd9afp2ws6rx23nz5mrvq8dlckeslwfa', + [Network.Devnet]: 'inj1aw59rkpd9afp2ws6rx23nz5mrvq8dlckeslwfa', + [Network.Devnet1]: 'inj1aw59rkpd9afp2ws6rx23nz5mrvq8dlckeslwfa', + [Network.Devnet2]: 'inj1aw59rkpd9afp2ws6rx23nz5mrvq8dlckeslwfa', + [Network.Local]: 'inj1aw59rkpd9afp2ws6rx23nz5mrvq8dlckeslwfa', +} + +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', + [Network.Testnet]: 'inj1knf6puyscuuqqhgqglskfc0k99d4885qw5uv7v', + [Network.TestnetK8s]: 'inj1knf6puyscuuqqhgqglskfc0k99d4885qw5uv7v', + [Network.TestnetSentry]: 'inj1knf6puyscuuqqhgqglskfc0k99d4885qw5uv7v', + [Network.TestnetOld]: 'inj1knf6puyscuuqqhgqglskfc0k99d4885qw5uv7v', + [Network.Devnet]: 'inj1knf6puyscuuqqhgqglskfc0k99d4885qw5uv7v', + [Network.Devnet1]: 'inj1knf6puyscuuqqhgqglskfc0k99d4885qw5uv7v', + [Network.Devnet2]: 'inj1knf6puyscuuqqhgqglskfc0k99d4885qw5uv7v', + [Network.Local]: 'inj1knf6puyscuuqqhgqglskfc0k99d4885qw5uv7v', +} + +export const PEGGY_GRAPH_URL_BY_NETWORK = { + [Network.Mainnet]: + 'https://api.thegraph.com/subgraphs/name/injectivelabs/injective-peggo-mainnet', + [Network.MainnetLB]: + 'https://api.thegraph.com/subgraphs/name/injectivelabs/injective-peggo-mainnet', + [Network.MainnetK8s]: + 'https://api.thegraph.com/subgraphs/name/injectivelabs/injective-peggo-mainnet', + [Network.MainnetSentry]: + 'https://api.thegraph.com/subgraphs/name/injectivelabs/injective-peggo-mainnet', + [Network.Public]: + 'https://api.thegraph.com/subgraphs/name/injectivelabs/injective-peggo-mainnet', + [Network.Staging]: + 'https://api.thegraph.com/subgraphs/name/injectivelabs/injective-peggo-mainnet', + [Network.Internal]: + 'https://api.thegraph.com/subgraphs/name/injectivelabs/injective-peggo-mainnet', + [Network.Testnet]: + 'https://api.thegraph.com/subgraphs/name/injectivelabs/injective-peggo-goerli', + [Network.TestnetK8s]: + 'https://api.thegraph.com/subgraphs/name/injectivelabs/injective-peggo-goerli', + [Network.TestnetSentry]: + 'https://api.thegraph.com/subgraphs/name/injectivelabs/injective-peggo-goerli', + [Network.TestnetOld]: + 'https://api.thegraph.com/subgraphs/name/injectivelabs/injective-peggo-goerli', + [Network.Devnet]: + 'https://api.thegraph.com/subgraphs/name/injectivelabsdev/injective-peggo-devnet', + [Network.Devnet1]: + 'https://api.thegraph.com/subgraphs/name/injectivelabsdev/injective-peggo-devnet', + [Network.Devnet2]: + 'https://api.thegraph.com/subgraphs/name/injectivelabsdev/injective-peggo-devnet', + [Network.Local]: + 'https://api.thegraph.com/subgraphs/name/injectivelabsdev/injective-peggo-devnet', +} + +export const ASSET_PRICE_URL_BY_NETWORK = { + [Network.Mainnet]: + 'https://k8s.mainnet.asset.injective.network/asset-price/v1', + [Network.MainnetLB]: + 'https://k8s.mainnet.asset.injective.network/asset-price/v1', + [Network.MainnetK8s]: + 'https://k8s.mainnet.asset.injective.network/asset-price/v1', + [Network.MainnetSentry]: + 'https://k8s.mainnet.asset.injective.network/asset-price/v1', + [Network.Public]: + 'https://k8s.mainnet.asset.injective.network/asset-price/v1', + [Network.Staging]: + 'https://k8s.mainnet.asset.injective.network/asset-price/v1', + [Network.Internal]: + 'https://k8s.mainnet.asset.injective.network/asset-price/v1', + [Network.Testnet]: + 'https://k8s.testnet.asset.injective.network/asset-price/v1', + [Network.TestnetK8s]: + 'https://k8s.testnet.asset.injective.network/asset-price/v1', + [Network.TestnetSentry]: + 'https://k8s.testnet.asset.injective.network/asset-price/v1', + [Network.TestnetOld]: + 'https://k8s.testnet.asset.injective.network/asset-price/v1', + [Network.Devnet]: 'https://devnet.api.injective.dev/asset-price/v1', + [Network.Devnet1]: 'https://devnet.api.injective.dev/asset-price/v1', + [Network.Devnet2]: 'https://devnet.api.injective.dev/asset-price/v1', + [Network.Local]: 'https://devnet.api.injective.dev/asset-price/v1', +} diff --git a/packages/networks/src/endpoints.ts b/packages/networks/src/endpoints.ts index 274f70c23..7c676ce4e 100644 --- a/packages/networks/src/endpoints.ts +++ b/packages/networks/src/endpoints.ts @@ -7,7 +7,8 @@ export const endpointsMainnetSentry: NetworkEndpoints = { 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', + cache: 'https://staging.gateway.grpc-web.injective.network', + web3gw: 'https://sentry.exchange.grpc-web.injective.network', } export const endpointsMainnetK8s: NetworkEndpoints = { @@ -15,9 +16,10 @@ export const endpointsMainnetK8s: NetworkEndpoints = { grpc: 'https://k8s.mainnet.chain.grpc-web.injective.network', rpc: 'https://k8s.mainnet.tm.injective.network', rest: 'https://k8s.mainnet.lcd.injective.network', - chronos: 'https://k8s.mainnet.chronos.grpc-web.injective.network', - explorer: 'https://k8s.mainnet.explorer.grpc-web.injective.network', - cache: 'https://k8s.testnet.gateway.grpc-web.injective.network', + chronos: 'https://k8s.mainnet.exchange.grpc-web.injective.network', + explorer: 'https://k8s.mainnet.exchange.grpc-web.injective.network', + cache: 'https://k8s.mainnet.exchange.grpc-web.injective.network', + web3gw: 'https://k8s.mainnet.exchange.grpc-web.injective.network', } export const endpointsMainnetLB: NetworkEndpoints = { @@ -25,8 +27,10 @@ export const endpointsMainnetLB: NetworkEndpoints = { grpc: 'https://k8s.global.mainnet.chain.grpc-web.injective.network', rpc: 'https://k8s.global.mainnet.tm.injective.network', rest: 'https://k8s.global.mainnet.lcd.injective.network', - chronos: 'https://k8s.global.mainnet.chronos.grpc-web.injective.network', - explorer: 'https://k8s.global.mainnet.explorer.grpc-web.injective.network', + chronos: 'https://k8s.global.mainnet.exchange.grpc-web.injective.network', + explorer: 'https://k8s.global.mainnet.exchange.grpc-web.injective.network', + cache: 'https://k8s.global.mainnet.exchange.grpc-web.injective.network', + web3gw: 'https://k8s.global.mainnet.exchange.grpc-web.injective.network', } export const endpointsMainnet: NetworkEndpoints = { @@ -36,6 +40,8 @@ export const endpointsMainnet: NetworkEndpoints = { rest: 'https://lcd.injective.network', chronos: 'https://api.injective.network', explorer: 'https://api.injective.network', + cache: 'https://api.injective.network', + web3gw: 'https://api.injective.network', } export const endpointsStaging: NetworkEndpoints = { @@ -45,6 +51,8 @@ export const endpointsStaging: NetworkEndpoints = { rest: 'https://staging.lcd.injective.network', chronos: 'https://staging.api.injective.network', explorer: 'https://staging.api.injective.network', + cache: 'https://staging.api.injective.network', + web3gw: 'https://staging.api.injective.network', } export const endpointsPublic: NetworkEndpoints = { @@ -56,8 +64,10 @@ export const endpointsInternal: NetworkEndpoints = { grpc: 'https://products.chain.grpc-web.injective.network', rpc: 'https://products.tm.injective.network', rest: 'https://products.lcd.injective.network', - chronos: 'https://products.exchange.grpc-web.injective.network', - explorer: 'https://products.exchange.grpc-web.injective.network', + chronos: 'https://products.chronos.grpc-web.injective.network', + explorer: 'https://products.explorer.grpc-web.injective.network', + cache: 'https://staging.gateway.grpc-web.injective.network', + web3gw: 'https://products.web3-gateway.injective.network', } export const endpointsTestnetSentry: NetworkEndpoints = { @@ -67,6 +77,8 @@ export const endpointsTestnetSentry: NetworkEndpoints = { rest: 'https://testnet.sentry.lcd.injective.network', chronos: 'https://testnet.sentry.exchange.grpc-web.injective.network', explorer: 'https://testnet.sentry.exchange.grpc-web.injective.network', + cache: 'https://testnet.sentry.exchange.grpc-web.injective.network', + web3gw: 'https://testnet.sentry.exchange.grpc-web.injective.network', } export const endpointsTestnetK8s: NetworkEndpoints = { @@ -77,6 +89,7 @@ export const endpointsTestnetK8s: NetworkEndpoints = { chronos: 'https://k8s.testnet.exchange.grpc-web.injective.network', explorer: 'https://k8s.testnet.explorer.grpc-web.injective.network', cache: 'https://k8s.testnet.gateway.grpc-web.injective.network', + web3gw: 'https://k8s.testnet.exchange.grpc-web.injective.network', } export const endpointsTestnet: NetworkEndpoints = { @@ -86,6 +99,8 @@ export const endpointsTestnet: NetworkEndpoints = { rest: 'https://testnet.lcd.injective.network', chronos: 'https://testnet.exchange.grpc-web.injective.network', explorer: 'https://testnet.exchange.grpc-web.injective.network', + web3gw: 'https://testnet.exchange.grpc-web.injective.network', + cache: 'https://testnet.exchange.grpc-web.injective.network', } export const endpointsTestnetOld: NetworkEndpoints = { @@ -95,6 +110,8 @@ export const endpointsTestnetOld: NetworkEndpoints = { rest: 'https://testnet.lcd.injective.dev', chronos: 'https://testnet.exchange.grpc-web.injective.dev', explorer: 'https://testnet.exchange.grpc-web.injective.dev', + cache: 'https://testnet.exchange.grpc-web.injective.dev', + web3gw: 'https://testnet.exchange.grpc-web.injective.dev', } export const endpointsDevnet: NetworkEndpoints = { @@ -104,6 +121,8 @@ export const endpointsDevnet: NetworkEndpoints = { rest: 'https://devnet.lcd.injective.dev', chronos: 'https://devnet.api.injective.dev', explorer: 'https://devnet.api.injective.dev', + cache: 'https://devnet.api.injective.dev', + web3gw: 'https://devnet.api.injective.dev', } export const endpointsDevnet1: NetworkEndpoints = { @@ -113,6 +132,8 @@ export const endpointsDevnet1: NetworkEndpoints = { rest: 'https://devnet-1.lcd.injective.dev', chronos: 'https://devnet-1.api.injective.dev', explorer: 'https://devnet-1.api.injective.dev', + cache: 'https://devnet-1.api.injective.dev', + web3gw: 'https://devnet-1.api.injective.dev', } export const endpointsDevnet2: NetworkEndpoints = { @@ -122,6 +143,8 @@ export const endpointsDevnet2: NetworkEndpoints = { rest: 'https://devnet-2.lcd.injective.dev', chronos: 'https://devnet-2.api.injective.dev', explorer: 'https://devnet-2.api.injective.dev', + cache: 'https://devnet-2.api.injective.dev', + web3gw: 'https://devnet-2.api.injective.dev', } export const endpointsLocal: NetworkEndpoints = { @@ -131,4 +154,6 @@ export const endpointsLocal: NetworkEndpoints = { rest: 'http://localhost:9091', chronos: 'https://localhost:4445', explorer: 'https://localhost:4446', + cache: 'https://localhost:4444', + web3gw: 'https://localhost:4444', } diff --git a/packages/networks/src/index.ts b/packages/networks/src/index.ts index 02dc26896..ee21dd99b 100644 --- a/packages/networks/src/index.ts +++ b/packages/networks/src/index.ts @@ -1,2 +1,4 @@ export * from './network' export * from './types' +export * from './utils' +export * from './constants' diff --git a/packages/networks/src/types.ts b/packages/networks/src/types.ts index d5af6719b..619c7979f 100644 --- a/packages/networks/src/types.ts +++ b/packages/networks/src/types.ts @@ -20,12 +20,13 @@ export enum Network { export type NetworkEndpoints = { indexer: string // Indexer API - chronos: string - explorer: string grpc: string // Sentry gRPC rest: string // LCD rpc?: string // Tendermint cache?: string // Cache Service + chronos?: string // Chronos Service + web3gw?: string // Web3Gateway Service + explorer?: string // Explorer Service } export type UrlEndpoints = NetworkEndpoints /** Deprecated */ diff --git a/packages/networks/src/utils.ts b/packages/networks/src/utils.ts new file mode 100644 index 000000000..ac58a403a --- /dev/null +++ b/packages/networks/src/utils.ts @@ -0,0 +1,73 @@ +import { + ASSET_PRICE_URL_BY_NETWORK, + PEGGY_GRAPH_URL_BY_NETWORK, + CW20_SWAP_CONTRACT_BY_NETWORK, + INCENTIVES_CONTRACT_BY_NETWORK, + CW20_ADAPTER_CONTRACT_BY_NETWORK, + INJ_NAME_REGISTRY_CONTRACT_BY_NETWORK, + INJ_NAME_REVERSE_RESOLVER_CONTRACT_BY_NETWORK, +} from './constants' +import { isTestnet } from './network' +import { Network } from './types' + +export const CW20_CODE_IDS_BY_NETWORK = ( + network: Network = Network.Mainnet, +) => { + if (isTestnet(network)) { + return ['25'] + } + + return ['28', '5', '42'] +} + +export const getCw20AdapterContractForNetwork = ( + network: Network = Network.Mainnet, +) => { + return CW20_ADAPTER_CONTRACT_BY_NETWORK[network] !== undefined + ? CW20_ADAPTER_CONTRACT_BY_NETWORK[network] + : CW20_ADAPTER_CONTRACT_BY_NETWORK[Network.Mainnet] +} + +export const getCw20SwapContractForNetwork = ( + network: Network = Network.Mainnet, +) => { + return CW20_SWAP_CONTRACT_BY_NETWORK[network] !== undefined + ? CW20_SWAP_CONTRACT_BY_NETWORK[network] + : CW20_SWAP_CONTRACT_BY_NETWORK[Network.Mainnet] +} + +export const getIncentivesContractForNetwork = ( + network: Network = Network.Mainnet, +) => { + return INCENTIVES_CONTRACT_BY_NETWORK[network] !== undefined + ? INCENTIVES_CONTRACT_BY_NETWORK[network] + : INCENTIVES_CONTRACT_BY_NETWORK[Network.Mainnet] +} + +export const getInjNameRegistryContractForNetwork = ( + network: Network = Network.Mainnet, +) => { + return INJ_NAME_REGISTRY_CONTRACT_BY_NETWORK[network] !== undefined + ? INJ_NAME_REGISTRY_CONTRACT_BY_NETWORK[network] + : INJ_NAME_REGISTRY_CONTRACT_BY_NETWORK[Network.Mainnet] +} + +export const getInjNameReverseResolverContractForNetwork = ( + network: Network = Network.Mainnet, +) => { + return INJ_NAME_REVERSE_RESOLVER_CONTRACT_BY_NETWORK[network] !== undefined + ? INJ_NAME_REVERSE_RESOLVER_CONTRACT_BY_NETWORK[network] + : INJ_NAME_REVERSE_RESOLVER_CONTRACT_BY_NETWORK[Network.Mainnet] +} + +export const getPeggyGraphQlEndpointForNetwork = (network: Network): string => { + return PEGGY_GRAPH_URL_BY_NETWORK[network] !== undefined + ? PEGGY_GRAPH_URL_BY_NETWORK[network] + : PEGGY_GRAPH_URL_BY_NETWORK[Network.Mainnet] +} + +export const getAssetPriceServiceForNetwork = (network: Network): string => { + return ASSET_PRICE_URL_BY_NETWORK[network] !== undefined + ? ASSET_PRICE_URL_BY_NETWORK[network] + : ASSET_PRICE_URL_BY_NETWORK[Network.Mainnet] +} diff --git a/packages/sdk-ts/CHANGELOG.md b/packages/sdk-ts/CHANGELOG.md index 2add3935d..cbf723ef3 100644 --- a/packages/sdk-ts/CHANGELOG.md +++ b/packages/sdk-ts/CHANGELOG.md @@ -3,6 +3,44 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.14.5](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/sdk-ts@1.14.5-beta.67...@injectivelabs/sdk-ts@1.14.5) (2024-01-11) + + +### Features + +* cid ([b286316](https://github.com/InjectiveLabs/injective-ts/commit/b286316549a80ba64af9ba946d9166e1cd638fd7)) + + + + + +## [1.14.4](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/sdk-ts@1.14.4-beta.3...@injectivelabs/sdk-ts@1.14.4) (2023-11-20) + +**Note:** Version bump only for package @injectivelabs/sdk-ts + + + + + +## [1.14.3](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/sdk-ts@1.14.3-beta.22...@injectivelabs/sdk-ts@1.14.3) (2023-11-17) + +**Note:** Version bump only for package @injectivelabs/sdk-ts + + + + + +## [1.14.2](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/sdk-ts@1.14.2-beta.13...@injectivelabs/sdk-ts@1.14.2) (2023-11-07) + + +### Reverts + +* faulty version ([6e25b3f](https://github.com/InjectiveLabs/injective-ts/commit/6e25b3f156d964666db8bc7885df653166aac523)) + + + + + ## [1.14.1](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/sdk-ts@1.14.1-beta.24...@injectivelabs/sdk-ts@1.14.1) (2023-10-27) **Note:** Version bump only for package @injectivelabs/sdk-ts diff --git a/packages/sdk-ts/README.md b/packages/sdk-ts/README.md index 1bfff4ef6..7e45bfb6d 100644 --- a/packages/sdk-ts/README.md +++ b/packages/sdk-ts/README.md @@ -6,18 +6,18 @@ _Accessing decentralized finance through TypeScript (for Web, Node and React Native environment)_ -`@injectivelabs/sdk-ts` is a TypeScript SDK for writing applications on top of the Injective chain in both a Node.js, browser and react native environment. +`@injectivelabs/sdk-ts` is a TypeScript SDK for writing applications on top of the Injective chain in both a Node.js, browser and react native environment.

- Documentation + Documentation · - Examples + Examples · API Reference · NPM Package · - GitHub + GitHub

### ✨ Features @@ -30,7 +30,6 @@ _Accessing decentralized finance through TypeScript (for Web, Node and React Nat We highly suggest using the `@injectivelabs/sdk-ts` with TypeScript, or JavaScript in a code editor that has support for type declarations, so you can take advantage of the helpful type hints that are included with the package. - ### 📚 Installation ```bash @@ -41,9 +40,8 @@ yarn add @injectivelabs/sdk-ts ## 📖 Documentation -- Read more and find example usages on our [Querying Wiki](https://github.com/InjectiveLabs/injective-ts/wiki/02Querying) -- Read more and find example usages on our [Transactions Wiki](https://github.com/InjectiveLabs/injective-ts/wiki/03Transactions) - +- Read more and find example usages on our [Querying Docs](https://docs.ts.injective.network/querying) +- Read more and find example usages on our [Transactions Docs](https://docs.ts.injective.network/transactions) --- @@ -69,7 +67,6 @@ Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/ -

 

Powering the future of decentralized finance. diff --git a/packages/sdk-ts/package.json b/packages/sdk-ts/package.json index 8ed53b5e0..b76493925 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.14.2-beta.14", + "version": "1.14.5", "sideEffects": false, "license": "Apache-2.0", "author": { @@ -32,25 +32,25 @@ }, "dependencies": { "@apollo/client": "^3.5.8", - "@cosmjs/amino": "^0.30.1", - "@cosmjs/proto-signing": "^0.30.1", - "@cosmjs/stargate": "^0.30.1", + "@cosmjs/amino": "^0.31.3", + "@cosmjs/proto-signing": "^0.31.3", + "@cosmjs/stargate": "^0.31.3", "@ensdomains/ens-validation": "^0.1.0", "@ensdomains/eth-ens-namehash": "^2.0.15", "@ethersproject/bytes": "^5.7.0", - "@injectivelabs/core-proto-ts": "^0.0.18", - "@injectivelabs/dmm-proto-ts": "1.0.16", - "@injectivelabs/exceptions": "^1.14.2-beta.2", + "@injectivelabs/core-proto-ts": "^0.0.21", + "@injectivelabs/dmm-proto-ts": "1.0.19", + "@injectivelabs/exceptions": "^1.14.5", "@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.11", - "@injectivelabs/mito-proto-ts": "1.0.50", - "@injectivelabs/networks": "^1.14.2-beta.3", - "@injectivelabs/test-utils": "^1.14.1", - "@injectivelabs/token-metadata": "^1.14.2-beta.10", - "@injectivelabs/ts-types": "^1.14.2-beta.0", - "@injectivelabs/utils": "^1.14.2-beta.2", + "@injectivelabs/indexer-proto-ts": "1.11.32", + "@injectivelabs/mito-proto-ts": "1.0.55", + "@injectivelabs/networks": "^1.14.5", + "@injectivelabs/test-utils": "^1.14.3", + "@injectivelabs/token-metadata": "^1.14.5", + "@injectivelabs/ts-types": "^1.14.5", + "@injectivelabs/utils": "^1.14.5", "@metamask/eth-sig-util": "^4.0.0", "axios": "^0.27.2", "bech32": "^2.0.0", @@ -65,7 +65,6 @@ "jscrypto": "^1.0.3", "keccak256": "^1.0.6", "link-module-alias": "^1.2.0", - "rxjs": "^7.8.0", "secp256k1": "^4.0.3", "shx": "^0.3.2", "snakecase-keys": "^5.4.1" diff --git a/packages/sdk-ts/src/client/BaseGrpcWebConsumer.ts b/packages/sdk-ts/src/client/BaseGrpcWebConsumer.ts deleted file mode 100644 index 1a5f6434a..000000000 --- a/packages/sdk-ts/src/client/BaseGrpcWebConsumer.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { grpc } from '@injectivelabs/grpc-web' -import { isBrowser } from '../utils/helpers' -import { getGrpcTransport } from '../utils/grpc' -import { TendermintAbciTypes } from '@injectivelabs/core-proto-ts' - -if (!isBrowser()) { - grpc.setDefaultTransport(getGrpcTransport() as grpc.TransportFactory) -} - -/** - * @hidden - */ -export default class BaseGrpcWebConsumer extends TendermintAbciTypes.GrpcWebImpl { - protected module: string = '' - - constructor(endpoint: string) { - super(endpoint, { transport: getGrpcTransport() }) - } -} - -export const getGrpcWebImpl = (endpoint: string) => - new BaseGrpcWebConsumer(endpoint) diff --git a/packages/sdk-ts/src/client/BaseIndexerGrpcWebConsumer.ts b/packages/sdk-ts/src/client/BaseIndexerGrpcWebConsumer.ts deleted file mode 100644 index d0106a53f..000000000 --- a/packages/sdk-ts/src/client/BaseIndexerGrpcWebConsumer.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { grpc } from '@injectivelabs/grpc-web' -import { isBrowser } from '../utils/helpers' -import { getGrpcTransport } from '../utils/grpc' -import { InjectiveAccountRpc } from '@injectivelabs/indexer-proto-ts' - -if (!isBrowser()) { - grpc.setDefaultTransport(getGrpcTransport() as grpc.TransportFactory) -} - -/** - * @hidden - */ -export default class BaseIndexerGrpcWebConsumer extends InjectiveAccountRpc.GrpcWebImpl { - protected module: string = '' - - constructor(endpoint: string) { - super(endpoint, { transport: getGrpcTransport() }) - } -} - -export const getGrpcIndexerWebImpl = (endpoint: string) => - new BaseIndexerGrpcWebConsumer(endpoint) diff --git a/packages/sdk-ts/src/client/BaseGrpcConsumer.ts b/packages/sdk-ts/src/client/base/BaseGrpcConsumer.ts similarity index 61% rename from packages/sdk-ts/src/client/BaseGrpcConsumer.ts rename to packages/sdk-ts/src/client/base/BaseGrpcConsumer.ts index db8ae3513..1ccc80750 100644 --- a/packages/sdk-ts/src/client/BaseGrpcConsumer.ts +++ b/packages/sdk-ts/src/client/base/BaseGrpcConsumer.ts @@ -1,17 +1,13 @@ -import { grpc } from '@injectivelabs/grpc-web' -import { isBrowser } from '../utils/helpers' -import { getGrpcTransport } from '../utils/grpc' -import { InjectiveAccountRpc } from '@injectivelabs/indexer-proto-ts' +import { getGrpcTransport } from '../../utils/grpc' +import { GrpcWebImpl } from './GrpcWebImpl' -if (!isBrowser()) { - grpc.setDefaultTransport(getGrpcTransport() as grpc.TransportFactory) -} - -export default class BaseGrpcConsumer extends InjectiveAccountRpc.GrpcWebImpl { +export default class BaseGrpcConsumer extends GrpcWebImpl { protected module: string = '' constructor(endpoint: string) { - super(endpoint, { transport: getGrpcTransport() }) + super(endpoint, { + transport: getGrpcTransport(), + }) } public getGrpcWebImpl(endpoint: string) { diff --git a/packages/sdk-ts/src/client/base/BaseGrpcWebConsumer.ts b/packages/sdk-ts/src/client/base/BaseGrpcWebConsumer.ts new file mode 100644 index 000000000..12b1f978f --- /dev/null +++ b/packages/sdk-ts/src/client/base/BaseGrpcWebConsumer.ts @@ -0,0 +1,19 @@ +import { getGrpcTransport } from '../../utils/grpc' +import { GrpcWebImpl } from './GrpcWebImpl' + +/** + * @hidden + */ +export default class BaseGrpcWebConsumer extends GrpcWebImpl { + protected module: string = '' + + constructor(endpoint: string) { + super(endpoint, { + transport: getGrpcTransport(), + setCookieMetadata: true + }) + } + + static getGrpcWebImpl = (endpoint: string) => + new BaseGrpcWebConsumer(endpoint) +} diff --git a/packages/sdk-ts/src/client/base/BaseIndexerGrpcConsumer.ts b/packages/sdk-ts/src/client/base/BaseIndexerGrpcConsumer.ts new file mode 100644 index 000000000..f025eaf78 --- /dev/null +++ b/packages/sdk-ts/src/client/base/BaseIndexerGrpcConsumer.ts @@ -0,0 +1,41 @@ +import { getGrpcTransport } from '../../utils/grpc' +import { GrpcWebImpl } from './IndexerGrpcWebImpl' + +export default class BaseIndexerGrpcConsumer extends GrpcWebImpl { + protected module: string = '' + + constructor(endpoint: string) { + super(endpoint, { + transport: getGrpcTransport(), + }) + } + + public getGrpcWebImpl(endpoint: string) { + return new BaseIndexerGrpcConsumer(endpoint) + } + + protected retry( + grpcCall: Function, + retries: number = 3, + delay: number = 1000, + ): Promise { + const retryGrpcCall = async (attempt = 1): Promise => { + try { + return await grpcCall() + } catch (e: any) { + if (attempt >= retries) { + throw e + } + + return new Promise((resolve) => + setTimeout( + () => resolve(retryGrpcCall(attempt + 1)), + delay * attempt, + ), + ) + } + } + + return retryGrpcCall() + } +} diff --git a/packages/sdk-ts/src/client/base/BaseIndexerGrpcWebConsumer.ts b/packages/sdk-ts/src/client/base/BaseIndexerGrpcWebConsumer.ts new file mode 100644 index 000000000..13c01f0d6 --- /dev/null +++ b/packages/sdk-ts/src/client/base/BaseIndexerGrpcWebConsumer.ts @@ -0,0 +1,16 @@ +import { getGrpcTransport } from '../../utils/grpc' +import { GrpcWebImpl } from './IndexerGrpcWebImpl' + +/** + * @hidden + */ +export default class BaseIndexerGrpcWebConsumer extends GrpcWebImpl { + protected module: string = '' + + constructor(endpoint: string) { + super(endpoint, { transport: getGrpcTransport() }) + } +} + +export const getGrpcIndexerWebImpl = (endpoint: string) => + new BaseIndexerGrpcWebConsumer(endpoint) diff --git a/packages/sdk-ts/src/client/BaseRestConsumer.ts b/packages/sdk-ts/src/client/base/BaseRestConsumer.ts similarity index 100% rename from packages/sdk-ts/src/client/BaseRestConsumer.ts rename to packages/sdk-ts/src/client/base/BaseRestConsumer.ts diff --git a/packages/sdk-ts/src/client/base/GrpcWebImpl.ts b/packages/sdk-ts/src/client/base/GrpcWebImpl.ts new file mode 100644 index 000000000..427246edd --- /dev/null +++ b/packages/sdk-ts/src/client/base/GrpcWebImpl.ts @@ -0,0 +1,87 @@ +import { grpc } from '@injectivelabs/grpc-web' +import { BrowserHeaders } from 'browser-headers' + +interface UnaryMethodDefinitionR extends grpc.UnaryMethodDefinition { + requestStream: any + responseStream: any +} + +type UnaryMethodDefinition = UnaryMethodDefinitionR + +export interface Rpc { + unary( + methodDesc: T, + request: any, + metadata: grpc.Metadata | undefined, + ): Promise +} + +export class GrpcWebError extends Error { + constructor( + message: string, + public code: grpc.Code, + public metadata: grpc.Metadata, + ) { + super(message) + } +} + +export class GrpcWebImpl { + private host: string + private options: { + transport?: grpc.TransportFactory + debug?: boolean + setCookieMetadata?: boolean + metadata?: grpc.Metadata + upStreamRetryCodes?: number[] + } + + constructor( + host: string, + options: { + transport?: grpc.TransportFactory + debug?: boolean + setCookieMetadata?: boolean + metadata?: grpc.Metadata + upStreamRetryCodes?: number[] + }, + ) { + this.host = host + this.options = options + } + + unary( + methodDesc: T, + _request: any, + metadata: grpc.Metadata | undefined, + ): Promise { + const request = { ..._request, ...methodDesc.requestType } + const actualMetadata = new BrowserHeaders({ + ...(metadata?.headersMap || {}), + ...(this.options?.metadata?.headersMap || {}), + }) + + return new Promise((resolve, reject) => { + grpc.unary(methodDesc, { + request, + host: this.host, + metadata: actualMetadata, + transport: this.options.transport, + debug: this.options.debug, + onEnd: (response) => { + if (response.status === grpc.Code.OK) { + return resolve(response.message!.toObject()) + } + + return reject( + new GrpcWebError( + response.statusMessage, + response.status, + response.trailers, + ), + ) + }, + }) + }) + } +} diff --git a/packages/sdk-ts/src/client/base/IndexerGrpcWebImpl.ts b/packages/sdk-ts/src/client/base/IndexerGrpcWebImpl.ts new file mode 100644 index 000000000..ca3b5c57b --- /dev/null +++ b/packages/sdk-ts/src/client/base/IndexerGrpcWebImpl.ts @@ -0,0 +1,139 @@ +import { grpc } from '@injectivelabs/grpc-web' +import { BrowserHeaders } from 'browser-headers' +import { Observable } from 'rxjs' +import { share } from 'rxjs/operators' + +interface UnaryMethodDefinitionR extends grpc.UnaryMethodDefinition { + requestStream: any + responseStream: any +} + +type UnaryMethodDefinition = UnaryMethodDefinitionR + +export interface Rpc { + unary( + methodDesc: T, + request: any, + metadata: grpc.Metadata | undefined, + ): Promise + invoke( + methodDesc: T, + request: any, + metadata: grpc.Metadata | undefined, + ): Observable +} + +export class GrpcWebError extends Error { + constructor( + message: string, + public code: grpc.Code, + public metadata: grpc.Metadata, + ) { + super(message) + } +} + +export class GrpcWebImpl { + private host: string + private options: { + transport?: grpc.TransportFactory + streamingTransport?: grpc.TransportFactory + debug?: boolean + metadata?: grpc.Metadata + upStreamRetryCodes?: number[] + } + + constructor( + host: string, + options: { + transport?: grpc.TransportFactory + streamingTransport?: grpc.TransportFactory + debug?: boolean + metadata?: grpc.Metadata + upStreamRetryCodes?: number[] + }, + ) { + this.host = host + this.options = options + } + + unary( + methodDesc: T, + _request: any, + metadata: grpc.Metadata | undefined, + ): Promise { + const request = { ..._request, ...methodDesc.requestType } + const metadataWithCookieMetadata = new BrowserHeaders({ + ...(metadata?.headersMap || {}), + ...(this.options?.metadata?.headersMap || {}), + }) + + return new Promise((resolve, reject) => { + grpc.unary(methodDesc, { + request, + host: this.host, + metadata: metadataWithCookieMetadata, + transport: this.options.transport, + debug: this.options.debug, + onEnd: (response) => { + if (response.status === grpc.Code.OK) { + return resolve(response.message!.toObject()) + } + + return reject( + new GrpcWebError( + response.statusMessage, + response.status, + response.trailers, + ), + ) + }, + }) + }) + } + + invoke( + methodDesc: T, + _request: any, + metadata: grpc.Metadata | undefined, + ): Observable { + const upStreamCodes = this.options.upStreamRetryCodes || [] + const DEFAULT_TIMEOUT_TIME: number = 3_000 + const request = { ..._request, ...methodDesc.requestType } + const actualMetadata = new BrowserHeaders({ + ...(metadata?.headersMap || {}), + ...(this.options?.metadata?.headersMap || {}), + }) + + return new Observable((observer) => { + const upStream = () => { + const client = grpc.invoke(methodDesc, { + host: this.host, + request, + transport: this.options.streamingTransport || this.options.transport, + metadata: actualMetadata, + debug: this.options.debug, + onMessage: (next) => observer.next(next), + onEnd: ( + code: grpc.Code, + message: string, + trailers: grpc.Metadata, + ) => { + if (code === 0) { + observer.complete() + } else if (upStreamCodes.includes(code)) { + setTimeout(upStream, DEFAULT_TIMEOUT_TIME) + } else { + const err = new Error(message) as any + err.code = code + err.metadata = trailers + observer.error(err) + } + }, + }) + observer.add(() => client.close()) + } + upStream() + }).pipe(share()) + } +} diff --git a/packages/sdk-ts/src/client/chain/grpc/ChainGrpcAuctionApi.ts b/packages/sdk-ts/src/client/chain/grpc/ChainGrpcAuctionApi.ts index d974b698b..9f730487e 100644 --- a/packages/sdk-ts/src/client/chain/grpc/ChainGrpcAuctionApi.ts +++ b/packages/sdk-ts/src/client/chain/grpc/ChainGrpcAuctionApi.ts @@ -3,7 +3,7 @@ import { UnspecifiedErrorCode, } from '@injectivelabs/exceptions' import { InjectiveAuctionV1Beta1Query } from '@injectivelabs/core-proto-ts' -import BaseGrpcConsumer from '../../BaseGrpcConsumer' +import BaseGrpcConsumer from '../../base/BaseGrpcConsumer' import { ChainModule } from '../types' import { ChainGrpcAuctionTransformer } from '../transformers' diff --git a/packages/sdk-ts/src/client/chain/grpc/ChainGrpcAuthApi.ts b/packages/sdk-ts/src/client/chain/grpc/ChainGrpcAuthApi.ts index 9f59e5898..fa52dee55 100644 --- a/packages/sdk-ts/src/client/chain/grpc/ChainGrpcAuthApi.ts +++ b/packages/sdk-ts/src/client/chain/grpc/ChainGrpcAuthApi.ts @@ -3,7 +3,7 @@ import { UnspecifiedErrorCode, } from '@injectivelabs/exceptions' import { CosmosAuthV1Beta1Query } from '@injectivelabs/core-proto-ts' -import BaseGrpcConsumer from '../../BaseGrpcConsumer' +import BaseGrpcConsumer from '../../base/BaseGrpcConsumer' import { ChainModule } from '../types' import { PaginationOption } from '../../../types/pagination' import { paginationRequestFromPagination } from '../../../utils/pagination' diff --git a/packages/sdk-ts/src/client/chain/grpc/ChainGrpcAuthZApi.ts b/packages/sdk-ts/src/client/chain/grpc/ChainGrpcAuthZApi.ts index 084ebd03c..6ff6f2ab8 100644 --- a/packages/sdk-ts/src/client/chain/grpc/ChainGrpcAuthZApi.ts +++ b/packages/sdk-ts/src/client/chain/grpc/ChainGrpcAuthZApi.ts @@ -3,7 +3,7 @@ import { GrpcUnaryRequestException, } from '@injectivelabs/exceptions' import { CosmosAuthzV1Beta1Query } from '@injectivelabs/core-proto-ts' -import BaseGrpcConsumer from '../../BaseGrpcConsumer' +import BaseGrpcConsumer from '../../base/BaseGrpcConsumer' import { ChainModule } from '../types' import { PaginationOption } from '../../../types/pagination' import { paginationRequestFromPagination } from '../../../utils/pagination' diff --git a/packages/sdk-ts/src/client/chain/grpc/ChainGrpcBankApi.ts b/packages/sdk-ts/src/client/chain/grpc/ChainGrpcBankApi.ts index 4f7460e60..5aec5c3ad 100644 --- a/packages/sdk-ts/src/client/chain/grpc/ChainGrpcBankApi.ts +++ b/packages/sdk-ts/src/client/chain/grpc/ChainGrpcBankApi.ts @@ -3,7 +3,7 @@ import { UnspecifiedErrorCode, } from '@injectivelabs/exceptions' import { CosmosBankV1Beta1Query } from '@injectivelabs/core-proto-ts' -import BaseGrpcConsumer from '../../BaseGrpcConsumer' +import BaseGrpcConsumer from '../../base/BaseGrpcConsumer' import { ChainModule } from '../types' import { ChainGrpcBankTransformer } from '../transformers' import { PaginationOption } from '../../../types/pagination' @@ -95,11 +95,17 @@ export class ChainGrpcBankApi extends BaseGrpcConsumer { } } - async fetchBalances(address: string) { + async fetchBalances(address: string, pagination?: PaginationOption) { const request = CosmosBankV1Beta1Query.QueryAllBalancesRequest.create() request.address = address + const paginationForRequest = paginationRequestFromPagination(pagination) + + if (paginationForRequest) { + request.pagination = paginationForRequest + } + try { const response = await this.retry(() => diff --git a/packages/sdk-ts/src/client/chain/grpc/ChainGrpcDistributionApi.ts b/packages/sdk-ts/src/client/chain/grpc/ChainGrpcDistributionApi.ts index 26a01ed18..8119f4cb2 100644 --- a/packages/sdk-ts/src/client/chain/grpc/ChainGrpcDistributionApi.ts +++ b/packages/sdk-ts/src/client/chain/grpc/ChainGrpcDistributionApi.ts @@ -4,7 +4,7 @@ import { } from '@injectivelabs/exceptions' import { Coin } from '@injectivelabs/ts-types' import { CosmosDistributionV1Beta1Query } from '@injectivelabs/core-proto-ts' -import BaseGrpcConsumer from '../../BaseGrpcConsumer' +import BaseGrpcConsumer from '../../base/BaseGrpcConsumer' import { ValidatorRewards, ChainModule } from '../types' import { ChainGrpcDistributionTransformer } from '../transformers' diff --git a/packages/sdk-ts/src/client/chain/grpc/ChainGrpcExchangeApi.ts b/packages/sdk-ts/src/client/chain/grpc/ChainGrpcExchangeApi.ts index c0d3bdd34..50da66fe1 100644 --- a/packages/sdk-ts/src/client/chain/grpc/ChainGrpcExchangeApi.ts +++ b/packages/sdk-ts/src/client/chain/grpc/ChainGrpcExchangeApi.ts @@ -3,7 +3,7 @@ import { UnspecifiedErrorCode, } from '@injectivelabs/exceptions' import { InjectiveExchangeV1Beta1Query } from '@injectivelabs/core-proto-ts' -import BaseGrpcConsumer from '../../BaseGrpcConsumer' +import BaseGrpcConsumer from '../../base/BaseGrpcConsumer' import { ChainModule } from '../types' import { ChainGrpcExchangeTransformer } from '../transformers' diff --git a/packages/sdk-ts/src/client/chain/grpc/ChainGrpcGovApi.ts b/packages/sdk-ts/src/client/chain/grpc/ChainGrpcGovApi.ts index 4c3914c76..ce175757c 100644 --- a/packages/sdk-ts/src/client/chain/grpc/ChainGrpcGovApi.ts +++ b/packages/sdk-ts/src/client/chain/grpc/ChainGrpcGovApi.ts @@ -3,7 +3,7 @@ import { UnspecifiedErrorCode, } from '@injectivelabs/exceptions' import { CosmosGovV1Gov, CosmosGovV1Query } from '@injectivelabs/core-proto-ts' -import BaseGrpcConsumer from '../../BaseGrpcConsumer' +import BaseGrpcConsumer from '../../base/BaseGrpcConsumer' import { ChainModule } from '../types' import { PaginationOption } from '../../../types/pagination' import { paginationRequestFromPagination } from '../../../utils/pagination' diff --git a/packages/sdk-ts/src/client/chain/grpc/ChainGrpcIbcApi.ts b/packages/sdk-ts/src/client/chain/grpc/ChainGrpcIbcApi.ts index b7f0af908..3dc64c4d6 100644 --- a/packages/sdk-ts/src/client/chain/grpc/ChainGrpcIbcApi.ts +++ b/packages/sdk-ts/src/client/chain/grpc/ChainGrpcIbcApi.ts @@ -3,8 +3,10 @@ import { UnspecifiedErrorCode, } from '@injectivelabs/exceptions' import { IbcApplicationsTransferV1Query } from '@injectivelabs/core-proto-ts' -import BaseGrpcConsumer from '../../BaseGrpcConsumer' +import BaseGrpcConsumer from '../../base/BaseGrpcConsumer' import { ChainModule } from '../types' +import { PaginationOption } from '../../../types/pagination' +import { paginationRequestFromPagination } from '../../../utils/pagination' /** * @category Chain Grpc API @@ -52,10 +54,16 @@ export class ChainGrpcIbcApi extends BaseGrpcConsumer { } } - async fetchDenomsTrace() { + async fetchDenomsTrace(pagination?: PaginationOption) { const request = IbcApplicationsTransferV1Query.QueryDenomTracesRequest.create() + const paginationForRequest = paginationRequestFromPagination(pagination) + + if (paginationForRequest) { + request.pagination = paginationForRequest + } + try { const response = await this.retry( diff --git a/packages/sdk-ts/src/client/chain/grpc/ChainGrpcInsuranceFundApi.ts b/packages/sdk-ts/src/client/chain/grpc/ChainGrpcInsuranceFundApi.ts index bf50b44bc..19fb99450 100644 --- a/packages/sdk-ts/src/client/chain/grpc/ChainGrpcInsuranceFundApi.ts +++ b/packages/sdk-ts/src/client/chain/grpc/ChainGrpcInsuranceFundApi.ts @@ -3,7 +3,7 @@ import { UnspecifiedErrorCode, } from '@injectivelabs/exceptions' import { InjectiveInsuranceV1Beta1Query } from '@injectivelabs/core-proto-ts' -import BaseGrpcConsumer from '../../BaseGrpcConsumer' +import BaseGrpcConsumer from '../../base/BaseGrpcConsumer' import { ChainModule } from '../types' import { ChainGrpcInsuranceFundTransformer } from '../transformers/ChainGrpcInsuranceFundTransformer' diff --git a/packages/sdk-ts/src/client/chain/grpc/ChainGrpcMintApi.ts b/packages/sdk-ts/src/client/chain/grpc/ChainGrpcMintApi.ts index 26fc28ead..2e3fbfb91 100644 --- a/packages/sdk-ts/src/client/chain/grpc/ChainGrpcMintApi.ts +++ b/packages/sdk-ts/src/client/chain/grpc/ChainGrpcMintApi.ts @@ -8,7 +8,7 @@ import { cosmosSdkDecToBigNumber, uint8ArrayToString } from '../../../utils' import { BigNumberInBase } from '@injectivelabs/utils' import { ChainGrpcMintTransformer } from './../transformers/ChainGrpcMintTransformer' import { ChainModule } from '../types' -import BaseGrpcConsumer from '../../BaseGrpcConsumer' +import BaseGrpcConsumer from '../../base/BaseGrpcConsumer' /** * @category Chain Grpc API diff --git a/packages/sdk-ts/src/client/chain/grpc/ChainGrpcOracleApi.ts b/packages/sdk-ts/src/client/chain/grpc/ChainGrpcOracleApi.ts index 5c8631747..dcd80c972 100644 --- a/packages/sdk-ts/src/client/chain/grpc/ChainGrpcOracleApi.ts +++ b/packages/sdk-ts/src/client/chain/grpc/ChainGrpcOracleApi.ts @@ -3,7 +3,7 @@ import { UnspecifiedErrorCode, } from '@injectivelabs/exceptions' import { InjectiveOracleV1Beta1Query } from '@injectivelabs/core-proto-ts' -import BaseGrpcConsumer from '../../BaseGrpcConsumer' +import BaseGrpcConsumer from '../../base/BaseGrpcConsumer' import { ChainModule, OracleModuleParams } from '../types' /** diff --git a/packages/sdk-ts/src/client/chain/grpc/ChainGrpcPeggyApi.ts b/packages/sdk-ts/src/client/chain/grpc/ChainGrpcPeggyApi.ts index e4bc7904e..43208810a 100644 --- a/packages/sdk-ts/src/client/chain/grpc/ChainGrpcPeggyApi.ts +++ b/packages/sdk-ts/src/client/chain/grpc/ChainGrpcPeggyApi.ts @@ -3,7 +3,7 @@ import { UnspecifiedErrorCode, } from '@injectivelabs/exceptions' import { InjectivePeggyV1Beta1Query } from '@injectivelabs/core-proto-ts' -import BaseGrpcConsumer from '../../BaseGrpcConsumer' +import BaseGrpcConsumer from '../../base/BaseGrpcConsumer' import { ChainModule } from '../types' import { ChainGrpcPeggyTransformer } from '../transformers' diff --git a/packages/sdk-ts/src/client/chain/grpc/ChainGrpcStakingApi.ts b/packages/sdk-ts/src/client/chain/grpc/ChainGrpcStakingApi.ts index 16cc97112..0ef2369c5 100644 --- a/packages/sdk-ts/src/client/chain/grpc/ChainGrpcStakingApi.ts +++ b/packages/sdk-ts/src/client/chain/grpc/ChainGrpcStakingApi.ts @@ -3,7 +3,7 @@ import { UnspecifiedErrorCode, } from '@injectivelabs/exceptions' import { CosmosStakingV1Beta1Query } from '@injectivelabs/core-proto-ts' -import BaseGrpcConsumer from '../../BaseGrpcConsumer' +import BaseGrpcConsumer from '../../base/BaseGrpcConsumer' import { ChainModule } from '../types' import { PaginationOption } from '../../../types/pagination' import { ChainGrpcStakingTransformer } from '../transformers' diff --git a/packages/sdk-ts/src/client/chain/grpc/ChainGrpcTendermintApi.ts b/packages/sdk-ts/src/client/chain/grpc/ChainGrpcTendermintApi.ts new file mode 100644 index 000000000..64b1c31cf --- /dev/null +++ b/packages/sdk-ts/src/client/chain/grpc/ChainGrpcTendermintApi.ts @@ -0,0 +1,51 @@ +import { CosmosBaseTendermintV1Beta1Query } from '@injectivelabs/core-proto-ts' +import BaseGrpcConsumer from '../../base/BaseGrpcConsumer' +import { ChainModule } from '../types' +import { + GrpcUnaryRequestException, + UnspecifiedErrorCode, +} from '@injectivelabs/exceptions' +/** + * @category Chain Grpc API + */ +export class ChainGrpcTendermintApi extends BaseGrpcConsumer { + protected module: string = ChainModule.Tendermint + + protected client: CosmosBaseTendermintV1Beta1Query.ServiceClientImpl + + constructor(endpoint: string) { + super(endpoint) + + this.client = new CosmosBaseTendermintV1Beta1Query.ServiceClientImpl( + this.getGrpcWebImpl(endpoint), + ) + } + + async fetchLatestBlock() { + const request = + CosmosBaseTendermintV1Beta1Query.GetLatestBlockRequest.create() + + try { + const response = + await this.retry( + () => this.client.GetLatestBlock(request), + ) + + return response.block || response.sdkBlock + } catch (e: unknown) { + if (e instanceof CosmosBaseTendermintV1Beta1Query.GrpcWebError) { + throw new GrpcUnaryRequestException(new Error(e.toString()), { + code: e.code, + context: 'TendermintApi.fetchLatestBlock', + contextModule: this.module, + }) + } + + throw new GrpcUnaryRequestException(e as Error, { + code: UnspecifiedErrorCode, + context: 'TendermintApi.fetchLatestBlock', + contextModule: this.module, + }) + } + } +} diff --git a/packages/sdk-ts/src/client/chain/grpc/ChainGrpcTokenFactoryApi.ts b/packages/sdk-ts/src/client/chain/grpc/ChainGrpcTokenFactoryApi.ts index 29d49c960..f62cb5663 100644 --- a/packages/sdk-ts/src/client/chain/grpc/ChainGrpcTokenFactoryApi.ts +++ b/packages/sdk-ts/src/client/chain/grpc/ChainGrpcTokenFactoryApi.ts @@ -3,7 +3,7 @@ import { UnspecifiedErrorCode, } from '@injectivelabs/exceptions' import { InjectiveTokenFactoryV1Beta1Query } from '@injectivelabs/core-proto-ts' -import BaseGrpcConsumer from '../../BaseGrpcConsumer' +import BaseGrpcConsumer from '../../base/BaseGrpcConsumer' import { ChainModule } from '../types' import { ChainGrpcTokenFactoryTransformer } from '..' diff --git a/packages/sdk-ts/src/client/chain/grpc/ChainGrpcWasmApi.ts b/packages/sdk-ts/src/client/chain/grpc/ChainGrpcWasmApi.ts index 134354c0a..3cd614907 100644 --- a/packages/sdk-ts/src/client/chain/grpc/ChainGrpcWasmApi.ts +++ b/packages/sdk-ts/src/client/chain/grpc/ChainGrpcWasmApi.ts @@ -3,11 +3,12 @@ import { UnspecifiedErrorCode, } from '@injectivelabs/exceptions' import { CosmwasmWasmV1Query } from '@injectivelabs/core-proto-ts' -import BaseGrpcConsumer from '../../BaseGrpcConsumer' +import BaseGrpcConsumer from '../../base/BaseGrpcConsumer' import { ChainModule } from '../types' import { ChainGrpcWasmTransformer } from '../transformers' import { PaginationOption } from '../../../types/pagination' import { paginationRequestFromPagination } from '../../../utils/pagination' +import { toBase64 } from '../../../utils/utf8' /** * @category Chain Grpc API @@ -179,13 +180,19 @@ export class ChainGrpcWasmApi extends BaseGrpcConsumer { } } - async fetchSmartContractState(contractAddress: string, query?: string) { + async fetchSmartContractState( + contractAddress: string, + query?: string | Record, + ) { const request = CosmwasmWasmV1Query.QuerySmartContractStateRequest.create() request.address = contractAddress if (query) { - request.queryData = Buffer.from(query, 'base64') + request.queryData = Buffer.from( + typeof query === 'string' ? query : toBase64(query), + 'base64', + ) } try { diff --git a/packages/sdk-ts/src/client/chain/grpc/ChainGrpcWasmXApi.ts b/packages/sdk-ts/src/client/chain/grpc/ChainGrpcWasmXApi.ts index bc08fa951..1464d0426 100644 --- a/packages/sdk-ts/src/client/chain/grpc/ChainGrpcWasmXApi.ts +++ b/packages/sdk-ts/src/client/chain/grpc/ChainGrpcWasmXApi.ts @@ -3,7 +3,7 @@ import { UnspecifiedErrorCode, } from '@injectivelabs/exceptions' import { InjectiveWasmxV1Beta1Query } from '@injectivelabs/core-proto-ts' -import BaseGrpcConsumer from '../../BaseGrpcConsumer' +import BaseGrpcConsumer from '../../base/BaseGrpcConsumer' import { ChainModule } from '../types' /** diff --git a/packages/sdk-ts/src/client/chain/grpc/index.ts b/packages/sdk-ts/src/client/chain/grpc/index.ts index 5ad799f93..30e0edb18 100644 --- a/packages/sdk-ts/src/client/chain/grpc/index.ts +++ b/packages/sdk-ts/src/client/chain/grpc/index.ts @@ -14,3 +14,4 @@ export { ChainGrpcStakingApi } from './ChainGrpcStakingApi' export { ChainGrpcTokenFactoryApi } from './ChainGrpcTokenFactoryApi' export { ChainGrpcWasmApi } from './ChainGrpcWasmApi' export { ChainGrpcWasmXApi } from './ChainGrpcWasmXApi' +export { ChainGrpcTendermintApi } from './ChainGrpcTendermintApi' diff --git a/packages/sdk-ts/src/client/chain/rest/ChainRestAuthApi.ts b/packages/sdk-ts/src/client/chain/rest/ChainRestAuthApi.ts index fc2a500e1..c95f5dd0f 100644 --- a/packages/sdk-ts/src/client/chain/rest/ChainRestAuthApi.ts +++ b/packages/sdk-ts/src/client/chain/rest/ChainRestAuthApi.ts @@ -2,7 +2,7 @@ import { HttpRequestException, UnspecifiedErrorCode, } from '@injectivelabs/exceptions' -import BaseRestConsumer from '../../BaseRestConsumer' +import BaseRestConsumer from '../../base/BaseRestConsumer' import { ChainModule, RestApiResponse } from '../types' import { AccountResponse, diff --git a/packages/sdk-ts/src/client/chain/rest/ChainRestBankApi.ts b/packages/sdk-ts/src/client/chain/rest/ChainRestBankApi.ts index fb98a40c8..e54e7a4ba 100644 --- a/packages/sdk-ts/src/client/chain/rest/ChainRestBankApi.ts +++ b/packages/sdk-ts/src/client/chain/rest/ChainRestBankApi.ts @@ -5,7 +5,7 @@ import { HttpRequestException, UnspecifiedErrorCode, } from '@injectivelabs/exceptions' -import BaseRestConsumer from '../../BaseRestConsumer' +import BaseRestConsumer from '../../base/BaseRestConsumer' import { ChainModule, RestApiResponse } from '../types' import { BalancesResponse, DenomBalance } from './../types/bank-rest' diff --git a/packages/sdk-ts/src/client/chain/rest/ChainRestTendermintApi.ts b/packages/sdk-ts/src/client/chain/rest/ChainRestTendermintApi.ts index 856ba048c..5261183ae 100644 --- a/packages/sdk-ts/src/client/chain/rest/ChainRestTendermintApi.ts +++ b/packages/sdk-ts/src/client/chain/rest/ChainRestTendermintApi.ts @@ -2,7 +2,7 @@ import { HttpRequestException, UnspecifiedErrorCode, } from '@injectivelabs/exceptions' -import BaseRestConsumer from '../../BaseRestConsumer' +import BaseRestConsumer from '../../base/BaseRestConsumer' import { ChainModule, RestApiResponse } from '../types' import { BlockLatestRestResponse, diff --git a/packages/sdk-ts/src/client/chain/types/index.ts b/packages/sdk-ts/src/client/chain/types/index.ts index 0216497fa..971dd41f2 100644 --- a/packages/sdk-ts/src/client/chain/types/index.ts +++ b/packages/sdk-ts/src/client/chain/types/index.ts @@ -1,21 +1,22 @@ import { ChainErrorModule } from '@injectivelabs/exceptions' +export * from './gov' export * from './auth' +export * from './bank' +export * from './mint' +export * from './wasm' export * from './authZ' +export * from './peggy' +export * from './oracle' export * from './auction' +export * from './staking' +export * from './exchange' export * from './auth-rest' export * from './bank-rest' -export * from './tendermint-rest' -export * from './bank' -export * from './distribution' -export * from './exchange' -export * from './gov' export * from './insurance' -export * from './mint' -export * from './oracle' -export * from './peggy' -export * from './staking' -export * from './wasm' +export * from './distribution' +export * from './tokenfactory' +export * from './tendermint-rest' export interface RestApiResponse { data: T diff --git a/packages/sdk-ts/src/client/chain/types/tokenfactory.ts b/packages/sdk-ts/src/client/chain/types/tokenfactory.ts index 51ce713d5..1b7747384 100644 --- a/packages/sdk-ts/src/client/chain/types/tokenfactory.ts +++ b/packages/sdk-ts/src/client/chain/types/tokenfactory.ts @@ -6,10 +6,10 @@ export interface TokenFactoryModuleParams { export interface TokenFactoryModuleState { denomCreationFee: Coin[] - factoryDenoms: Denom[] + factoryDenoms: FactoryDenomWithMetadata[] } -interface Denom { +export interface FactoryDenomWithMetadata { denom: string authorityMetadata: AuthorityMetadata } diff --git a/packages/sdk-ts/src/client/dmm/grpc/DMMGrpcApi.spec.ts b/packages/sdk-ts/src/client/dmm/grpc/DMMGrpcApi.spec.ts index b32955e28..451278771 100644 --- a/packages/sdk-ts/src/client/dmm/grpc/DMMGrpcApi.spec.ts +++ b/packages/sdk-ts/src/client/dmm/grpc/DMMGrpcApi.spec.ts @@ -137,29 +137,6 @@ describe('DmmGrpcApi', () => { } }) - test('fetchLiquiditySnapshots', async () => { - try { - const response = await dmmGrpcApi.fetchLiquiditySnapshots({ - epochId, - marketId, - accountAddress, - }) - - expect(response).toBeDefined() - expect(response).toEqual( - expect.objectContaining< - ReturnType< - typeof DmmGrpcTransformer.liquiditySnapshotsResponseToLiquiditySnapshots - > - >(response), - ) - } catch (e) { - console.error( - 'DmmGrpcApi.fetchLiquiditySnapshots => ' + (e as any).message, - ) - } - }) - test('fetchRewardsDistribution', async () => { try { const response = await dmmGrpcApi.fetchRewardsDistribution({ diff --git a/packages/sdk-ts/src/client/dmm/grpc/DmmGrpcApi.ts b/packages/sdk-ts/src/client/dmm/grpc/DmmGrpcApi.ts index 9872694ac..d7b6c7795 100644 --- a/packages/sdk-ts/src/client/dmm/grpc/DmmGrpcApi.ts +++ b/packages/sdk-ts/src/client/dmm/grpc/DmmGrpcApi.ts @@ -4,11 +4,12 @@ import { IndexerErrorModule, } from '@injectivelabs/exceptions' import { InjectiveDmmRpc } from '@injectivelabs/dmm-proto-ts' -import BaseGrpcConsumer from '../../BaseGrpcConsumer' +import BaseGrpcConsumer from '../../base/BaseGrpcConsumer' import { DmmGrpcTransformer } from './transformers' export class DmmGrpcApi extends BaseGrpcConsumer { protected module: string = IndexerErrorModule.Dmm + protected client: InjectiveDmmRpc.InjectiveDmmV2RPCClientImpl constructor(endpoint: string) { @@ -289,53 +290,6 @@ export class DmmGrpcApi extends BaseGrpcConsumer { } } - async fetchLiquiditySnapshots({ - epochId, - marketId, - accountAddress, - page, - }: { - epochId: string - marketId: string - accountAddress: string - page?: InjectiveDmmRpc.Pagination - }) { - const request = InjectiveDmmRpc.GetLiquiditySnapshotsRequest.create() - - request.epochId = epochId - request.marketId = marketId - request.accountAddress = accountAddress - - if (page) { - request.page = page - } - - try { - const response = - await this.retry(() => - this.client.GetLiquiditySnapshots(request), - ) - - return DmmGrpcTransformer.liquiditySnapshotsResponseToLiquiditySnapshots( - response, - ) - } catch (e: unknown) { - if (e instanceof InjectiveDmmRpc.GrpcWebError) { - throw new GrpcUnaryRequestException(new Error(e.toString()), { - code: e.code, - context: 'GetLiquiditySnapshots', - contextModule: this.module, - }) - } - - throw new GrpcUnaryRequestException(e as Error, { - code: UnspecifiedErrorCode, - context: 'GetLiquiditySnapshots', - contextModule: this.module, - }) - } - } - async fetchRewardsDistribution({ epochId, height, diff --git a/packages/sdk-ts/src/client/dmm/grpc/transformers/index.ts b/packages/sdk-ts/src/client/dmm/grpc/transformers/index.ts index e4a2b9d13..ccd56a765 100644 --- a/packages/sdk-ts/src/client/dmm/grpc/transformers/index.ts +++ b/packages/sdk-ts/src/client/dmm/grpc/transformers/index.ts @@ -16,9 +16,6 @@ import { GrpcEpochScore, EpochScore, TotalScoresHistory, - LiquidityScoreSnapshot, - LiquiditySnapshots, - GrpcLiquidityScoreSnapshot, GrpcRewardDistribution, RewardsDistribution, RewardDistribution, @@ -208,38 +205,6 @@ export class DmmGrpcTransformer { } } - static liquiditySnapshotsResponseToLiquiditySnapshots( - response: InjectiveDmmRpc.GetLiquiditySnapshotsResponse, - ): LiquiditySnapshots { - const snapshots = response.snapshots - - return { - next: response.next, - snapshots: snapshots.map( - DmmGrpcTransformer.grpcLiquiditySnapshotsToLiquiditySnapshots, - ), - } - } - - static grpcLiquiditySnapshotsToLiquiditySnapshots( - snapshot: GrpcLiquidityScoreSnapshot, - ): LiquidityScoreSnapshot { - return { - epochId: snapshot.epochId, - marketId: snapshot.marketId, - accountAddress: snapshot.accountAddress, - height: snapshot.height, - blockTime: snapshot.blockTime, - bid: snapshot.bid, - ask: snapshot.ask, - depth: snapshot.depth, - liquidityScore: snapshot.liquidityScore, - uptimeScore: snapshot.uptimeScore, - createdAt: snapshot.createdAt, - updatedAt: snapshot.updatedAt, - } - } - static rewardsDistributionResponseToRewardsDistribution( response: InjectiveDmmRpc.GetRewardsDistributionResponse, ): RewardsDistribution { @@ -299,6 +264,7 @@ export class DmmGrpcTransformer { dailyVolumePercentage: reward.dailyVolumePercentage, dailyMakerVolumePercentage: reward.dailyMakerVolumePercentage, dailyTakerVolumePercentage: reward.dailyTakerVolumePercentage, + dailyQualified: reward.dailyQualified, createdAt: reward.createdAt, updatedAt: reward.updatedAt, } diff --git a/packages/sdk-ts/src/client/dmm/grpc/types/index.ts b/packages/sdk-ts/src/client/dmm/grpc/types/index.ts index ab3c73255..c630c9d7a 100644 --- a/packages/sdk-ts/src/client/dmm/grpc/types/index.ts +++ b/packages/sdk-ts/src/client/dmm/grpc/types/index.ts @@ -11,11 +11,6 @@ export interface EpochsV2 { epochs: EpochV2[] } -export interface LiquiditySnapshots { - snapshots: LiquidityScoreSnapshot[] - next?: DmmPagination -} - export interface TotalScores { scores: TotalScore[] next?: DmmPagination @@ -96,20 +91,6 @@ export interface EpochConfigV2 { qualifyingVolumeThreshold: string } -export interface LiquidityScoreSnapshot { - epochId: string - marketId: string - accountAddress: string - height: string - blockTime?: Date - bid: string - ask: string - depth: string - liquidityScore: string - uptimeScore: string - createdAt?: Date - updatedAt?: Date -} export interface TotalScore { epochId: string marketId: string @@ -218,6 +199,7 @@ export interface AccountVolume { dailyVolumePercentage: string dailyMakerVolumePercentage: string dailyTakerVolumePercentage: string + dailyQualified: boolean createdAt?: Date updatedAt?: Date } @@ -251,11 +233,6 @@ export type GrpcTotalScore = InjectiveDmmRpc.TotalScore export type GrpcTotalScoresHistory = InjectiveDmmRpc.GetTotalScoresHistoryResponse -export type GrpcLiquiditySnapshots = - InjectiveDmmRpc.GetLiquiditySnapshotsResponse - -export type GrpcLiquidityScoreSnapshot = InjectiveDmmRpc.LiquidityScoreSnapshot - export type GrpcRewardsDistribution = InjectiveDmmRpc.GetRewardsDistributionResponse diff --git a/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcAccountApi.ts b/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcAccountApi.ts index e7145c2eb..2859957d9 100644 --- a/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcAccountApi.ts +++ b/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcAccountApi.ts @@ -4,7 +4,7 @@ import { GrpcUnaryRequestException, } from '@injectivelabs/exceptions' import { InjectiveAccountRpc } from '@injectivelabs/indexer-proto-ts' -import BaseGrpcConsumer from '../../BaseGrpcConsumer' +import BaseGrpcConsumer from '../../base/BaseIndexerGrpcConsumer' import { IndexerModule } from '../types' import { PaginationOption } from '../../../types/pagination' import { IndexerGrpcAccountTransformer } from '../transformers' diff --git a/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcAuctionApi.ts b/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcAuctionApi.ts index 3a2ac8703..6e02561ac 100644 --- a/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcAuctionApi.ts +++ b/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcAuctionApi.ts @@ -3,7 +3,7 @@ import { UnspecifiedErrorCode, } from '@injectivelabs/exceptions' import { InjectiveAuctionRpc } from '@injectivelabs/indexer-proto-ts' -import BaseGrpcConsumer from '../../BaseGrpcConsumer' +import BaseGrpcConsumer from '../../base/BaseIndexerGrpcConsumer' import { IndexerModule } from '../types' import { IndexerGrpcAuctionTransformer } from '../transformers' diff --git a/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcCampaignApi.spec.ts b/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcCampaignApi.spec.ts index 1c757eb41..5551a36ab 100644 --- a/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcCampaignApi.spec.ts +++ b/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcCampaignApi.spec.ts @@ -1,10 +1,13 @@ +import { mockFactory } from '@injectivelabs/test-utils' import { getNetworkEndpoints, Network } from '@injectivelabs/networks' import { IndexerCampaignTransformer } from '../transformers' import { IndexerGrpcCampaignApi } from './IndexerGrpcCampaignApi' +const injectiveAddress = mockFactory.injectiveAddress const CAMPAIGN_ID = 'spot-grid-inj-usdt-test' const MARKET_ID = '0xa508cb32923323679f29a032c70342c147c17d0145625922b0ef22e955c844c0' +const CAMPAIGN_CONTRACT = 'inj1yum4v0v5l92jkxn8xpn9mjg7wuldk784ysdn0w' const endpoints = getNetworkEndpoints(Network.MainnetSentry) const indexerGrpcCampaignApi = new IndexerGrpcCampaignApi(endpoints.indexer) @@ -30,4 +33,69 @@ describe('IndexerGrpcCampaignApi', () => { ) } }) + + test('fetchGuilds', async () => { + try { + const response = await indexerGrpcCampaignApi.fetchGuilds({ + sortBy: 'rank', + campaignContract: CAMPAIGN_CONTRACT, + }) + + expect(response).toBeDefined() + expect(response).toEqual( + expect.objectContaining< + ReturnType + >(response), + ) + } catch (e) { + console.error( + 'IndexerGrpcCampaignApi.fetchGuilds => ' + (e as any).message, + ) + } + }) + + test('fetchGuildMember', async () => { + try { + const response = await indexerGrpcCampaignApi.fetchGuildMember({ + address: injectiveAddress, + campaignContract: CAMPAIGN_CONTRACT, + }) + + expect(response).toBeDefined() + expect(response).toEqual( + expect.objectContaining< + ReturnType< + typeof IndexerCampaignTransformer.GuildMemberResponseToGuildMember + > + >(response), + ) + } catch (e) { + console.error( + 'IndexerGrpcCampaignApi.fetchGuildMember => ' + (e as any).message, + ) + } + }) + + test('fetchGuildMembers', async () => { + try { + const response = await indexerGrpcCampaignApi.fetchGuildMembers({ + guildId: '1', + includeGuildInfo: false, + campaignContract: CAMPAIGN_CONTRACT, + }) + + expect(response).toBeDefined() + expect(response).toEqual( + expect.objectContaining< + ReturnType< + typeof IndexerCampaignTransformer.GuildMembersResponseToGuildMembers + > + >(response), + ) + } catch (e) { + console.error( + 'IndexerGrpcCampaignApi.fetchGuildMembers => ' + (e as any).message, + ) + } + }) }) diff --git a/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcCampaignApi.ts b/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcCampaignApi.ts index e820d2cf4..77654fa75 100644 --- a/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcCampaignApi.ts +++ b/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcCampaignApi.ts @@ -4,7 +4,7 @@ import { } from '@injectivelabs/exceptions' import { InjectiveMetaRpc } from '@injectivelabs/indexer-proto-ts' import { InjectiveCampaignRpc } from '@injectivelabs/indexer-proto-ts' -import BaseGrpcConsumer from '../../BaseGrpcConsumer' +import BaseGrpcConsumer from '../../base/BaseIndexerGrpcConsumer' import { IndexerCampaignTransformer } from '../transformers' import { IndexerModule } from '../types' @@ -79,4 +79,189 @@ export class IndexerGrpcCampaignApi extends BaseGrpcConsumer { }) } } + + async fetchRound({ + roundId, + accountAddress, + }: { + roundId?: string + accountAddress?: string + }) { + const request = InjectiveCampaignRpc.CampaignsRequest.create() + + if (roundId) { + request.roundId = roundId + } + + if (accountAddress) { + request.accountAddress = accountAddress + } + + try { + const response = await this.retry( + () => this.client.Campaigns(request), + ) + + return response + } catch (e: unknown) { + if (e instanceof InjectiveCampaignRpc.GrpcWebError) { + throw new GrpcUnaryRequestException(new Error(e.toString()), { + code: e.code, + context: 'Campaigns', + contextModule: this.module, + }) + } + + throw new GrpcUnaryRequestException(e as Error, { + code: UnspecifiedErrorCode, + context: 'Campaigns', + contextModule: this.module, + }) + } + } + + async fetchGuilds({ + skip, + limit, + sortBy, + campaignContract, + }: { + skip?: number + limit?: number + sortBy: string + campaignContract: string + }) { + const request = InjectiveCampaignRpc.ListGuildsRequest.create() + + request.sortBy = sortBy + request.campaignContract = campaignContract + + if (skip) { + request.skip = skip + } + + if (limit) { + request.limit = limit + } + + try { + const response = + await this.retry(() => + this.client.ListGuilds(request), + ) + + return IndexerCampaignTransformer.GuildsResponseToGuilds(response) + } catch (e: unknown) { + if (e instanceof InjectiveMetaRpc.GrpcWebError) { + throw new GrpcUnaryRequestException(new Error(e.toString()), { + code: e.code, + context: 'FetchGuilds', + contextModule: this.module, + }) + } + + throw new GrpcUnaryRequestException(e as Error, { + code: UnspecifiedErrorCode, + context: 'FetchGuilds', + contextModule: this.module, + }) + } + } + + async fetchGuildMember({ + address, + campaignContract, + }: { + address: string + campaignContract: string + }) { + const request = InjectiveCampaignRpc.GetGuildMemberRequest.create() + + request.address = address + request.campaignContract = campaignContract + + try { + const response = + await this.retry(() => + this.client.GetGuildMember(request), + ) + + return IndexerCampaignTransformer.GuildMemberResponseToGuildMember( + response, + ) + } catch (e: unknown) { + if (e instanceof InjectiveMetaRpc.GrpcWebError) { + throw new GrpcUnaryRequestException(new Error(e.toString()), { + code: e.code, + context: 'FetchGuildMember', + contextModule: this.module, + }) + } + + throw new GrpcUnaryRequestException(e as Error, { + code: UnspecifiedErrorCode, + context: 'FetchGuildMember', + contextModule: this.module, + }) + } + } + + async fetchGuildMembers({ + skip, + limit, + sortBy, + guildId, + campaignContract, + includeGuildInfo, + }: { + skip?: number + limit?: number + sortBy?: string + guildId: string + campaignContract: string + includeGuildInfo: boolean + }) { + const request = InjectiveCampaignRpc.ListGuildMembersRequest.create() + + request.guildId = guildId + request.campaignContract = campaignContract + request.includeGuildInfo = includeGuildInfo + + if (sortBy) { + request.sortBy = sortBy + } + + if (skip) { + request.skip = skip + } + + if (limit) { + request.limit = limit + } + + try { + const response = + await this.retry(() => + this.client.ListGuildMembers(request), + ) + + return IndexerCampaignTransformer.GuildMembersResponseToGuildMembers( + response, + ) + } catch (e: unknown) { + if (e instanceof InjectiveMetaRpc.GrpcWebError) { + throw new GrpcUnaryRequestException(new Error(e.toString()), { + code: e.code, + context: 'FetchGuildMembers', + contextModule: this.module, + }) + } + + throw new GrpcUnaryRequestException(e as Error, { + code: UnspecifiedErrorCode, + context: 'FetchGuildMembers', + contextModule: this.module, + }) + } + } } diff --git a/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcDerivativesApi.ts b/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcDerivativesApi.ts index 88b710015..ec3871535 100644 --- a/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcDerivativesApi.ts +++ b/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcDerivativesApi.ts @@ -5,7 +5,7 @@ import { } from '@injectivelabs/exceptions' import { OrderSide, OrderState } from '@injectivelabs/ts-types' import { InjectiveDerivativeExchangeRpc } from '@injectivelabs/indexer-proto-ts' -import BaseGrpcConsumer from '../../BaseGrpcConsumer' +import BaseGrpcConsumer from '../../base/BaseIndexerGrpcConsumer' import { TradeDirection, TradeExecutionSide, @@ -32,8 +32,12 @@ export class IndexerGrpcDerivativesApi extends BaseGrpcConsumer { ) } - async fetchMarkets(params?: { marketStatus?: string; quoteDenom?: string }) { - const { marketStatus, quoteDenom } = params || {} + async fetchMarkets(params?: { + quoteDenom?: string + marketStatus?: string + marketStatuses?: string[] + }) { + const { marketStatus, quoteDenom, marketStatuses } = params || {} const request = InjectiveDerivativeExchangeRpc.MarketsRequest.create() @@ -41,6 +45,10 @@ export class IndexerGrpcDerivativesApi extends BaseGrpcConsumer { request.marketStatus = marketStatus } + if (marketStatuses) { + request.marketStatuses = marketStatuses + } + if (quoteDenom) { request.quoteDenom = quoteDenom } @@ -244,6 +252,10 @@ export class IndexerGrpcDerivativesApi extends BaseGrpcConsumer { if (pagination.endTime !== undefined) { request.endTime = pagination.endTime.toString() } + + if (pagination.startTime !== undefined) { + request.startTime = pagination.startTime.toString() + } } try { @@ -339,6 +351,10 @@ export class IndexerGrpcDerivativesApi extends BaseGrpcConsumer { if (pagination.endTime !== undefined) { request.endTime = pagination.endTime.toString() } + + if (pagination.startTime !== undefined) { + request.startTime = pagination.startTime.toString() + } } try { @@ -407,6 +423,10 @@ export class IndexerGrpcDerivativesApi extends BaseGrpcConsumer { if (pagination.endTime !== undefined) { request.endTime = pagination.endTime.toString() } + + if (pagination.startTime !== undefined) { + request.startTime = pagination.startTime.toString() + } } try { @@ -435,6 +455,89 @@ export class IndexerGrpcDerivativesApi extends BaseGrpcConsumer { } } + async fetchPositionsV2(params?: { + address?: string, + marketId?: string + marketIds?: string[] + subaccountId?: string + direction?: TradeDirection + pagination?: PaginationOption + }) { + const { + marketId, + marketIds, + subaccountId, + direction, + pagination, + address, + } = params || {} + + const request = InjectiveDerivativeExchangeRpc.PositionsV2Request.create() + + if (marketId) { + request.marketId = marketId + } + + if (address) { + request.accountAddress = address + } + + if (marketIds) { + request.marketIds = marketIds + } + + if (direction) { + request.direction = direction + } + + if (subaccountId) { + request.subaccountId = subaccountId + } + + if (pagination) { + if (pagination.skip !== undefined) { + request.skip = pagination.skip.toString() + } + + if (pagination.limit !== undefined) { + request.limit = pagination.limit + } + + if (pagination.endTime !== undefined) { + request.endTime = pagination.endTime.toString() + } + + if (pagination.startTime !== undefined) { + request.startTime = pagination.startTime.toString() + } + } + + try { + const response = + await this.retry( + () => this.client.PositionsV2(request), + ) + + return IndexerGrpcDerivativeTransformer.positionsV2ResponseToPositionsV2( + response, + ) + } catch (e: unknown) { + if (e instanceof InjectiveDerivativeExchangeRpc.GrpcWebError) { + throw new GrpcUnaryRequestException(new Error(e.toString()), { + code: e.code, + context: 'Positions', + contextModule: this.module, + }) + } + + throw new GrpcUnaryRequestException(e as Error, { + code: UnspecifiedErrorCode, + context: 'Positions', + contextModule: this.module, + }) + } + } + async fetchTrades(params?: { endTime?: number tradeId?: string @@ -516,6 +619,10 @@ export class IndexerGrpcDerivativesApi extends BaseGrpcConsumer { if (pagination.endTime !== undefined) { request.endTime = pagination.endTime.toString() } + + if (pagination.startTime !== undefined) { + request.startTime = pagination.startTime.toString() + } } try { diff --git a/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcExplorerApi.ts b/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcExplorerApi.ts index dfe581d90..c9bfee46d 100644 --- a/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcExplorerApi.ts +++ b/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcExplorerApi.ts @@ -3,7 +3,7 @@ import { UnspecifiedErrorCode, } from '@injectivelabs/exceptions' import { InjectiveExplorerRpc } from '@injectivelabs/indexer-proto-ts' -import BaseGrpcConsumer from '../../BaseGrpcConsumer' +import BaseGrpcConsumer from '../../base/BaseIndexerGrpcConsumer' import { IndexerModule } from '../types' import { IndexerGrpcExplorerTransformer } from '../transformers' @@ -59,6 +59,7 @@ export class IndexerGrpcExplorerApi extends BaseGrpcConsumer { type?: string }) { const request = InjectiveExplorerRpc.GetAccountTxsRequest.create() + request.address = address if (limit) { diff --git a/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcInsuranceFundApi.ts b/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcInsuranceFundApi.ts index f3cc521b7..8ab178a5e 100644 --- a/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcInsuranceFundApi.ts +++ b/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcInsuranceFundApi.ts @@ -3,7 +3,7 @@ import { UnspecifiedErrorCode, } from '@injectivelabs/exceptions' import { InjectiveInsuranceRpc } from '@injectivelabs/indexer-proto-ts' -import BaseGrpcConsumer from '../../BaseGrpcConsumer' +import BaseGrpcConsumer from '../../base/BaseIndexerGrpcConsumer' import { IndexerGrpcInsuranceFundTransformer } from '../transformers' import { IndexerModule } from '../types' diff --git a/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcMetaApi.ts b/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcMetaApi.ts index 9a28dd691..87bb63eb1 100644 --- a/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcMetaApi.ts +++ b/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcMetaApi.ts @@ -3,7 +3,7 @@ import { UnspecifiedErrorCode, } from '@injectivelabs/exceptions' import { InjectiveMetaRpc } from '@injectivelabs/indexer-proto-ts' -import BaseGrpcConsumer from '../../BaseGrpcConsumer' +import BaseGrpcConsumer from '../../base/BaseIndexerGrpcConsumer' import { IndexerModule } from '../types' /** diff --git a/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcMitoApi.ts b/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcMitoApi.ts index fc615225a..ab2fe923c 100644 --- a/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcMitoApi.ts +++ b/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcMitoApi.ts @@ -4,7 +4,7 @@ import { } from '@injectivelabs/exceptions' import { MitoApi } from '@injectivelabs/mito-proto-ts' import { InjectiveMetaRpc } from '@injectivelabs/indexer-proto-ts' -import BaseGrpcConsumer from '../../BaseGrpcConsumer' +import BaseGrpcConsumer from '../../base/BaseIndexerGrpcConsumer' import { IndexerModule } from '../types' import { IndexerGrpcMitoTransformer } from '../transformers' @@ -762,13 +762,15 @@ export class IndexerGrpcMitoApi extends BaseGrpcConsumer { } async fetchIDOSubscribers({ - contractAddress, - limit, skip, + limit, + sortBy, + contractAddress, }: { - contractAddress: string - limit?: number skip?: number + limit?: number + sortBy?: string + contractAddress: string }) { const request = MitoApi.GetIDOSubscribersRequest.create() @@ -782,6 +784,10 @@ export class IndexerGrpcMitoApi extends BaseGrpcConsumer { request.skip = skip } + if (sortBy) { + request.sortBy = sortBy + } + try { const response = await this.retry(() => this.client.GetIDOSubscribers(request), diff --git a/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcOracleApi.ts b/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcOracleApi.ts index edaacb793..35f020ecf 100644 --- a/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcOracleApi.ts +++ b/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcOracleApi.ts @@ -3,7 +3,7 @@ import { UnspecifiedErrorCode, } from '@injectivelabs/exceptions' import { InjectiveOracleRpc } from '@injectivelabs/indexer-proto-ts' -import BaseGrpcConsumer from '../../BaseGrpcConsumer' +import BaseGrpcConsumer from '../../base/BaseIndexerGrpcConsumer' import { IndexerModule } from '../types' import { IndexerGrpcOracleTransformer } from '../transformers/IndexerGrpcOracleTransformer' diff --git a/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcPortfolioApi.ts b/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcPortfolioApi.ts index 07191f466..7b532fb90 100644 --- a/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcPortfolioApi.ts +++ b/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcPortfolioApi.ts @@ -3,7 +3,7 @@ import { UnspecifiedErrorCode, } from '@injectivelabs/exceptions' import { InjectivePortfolioRpc } from '@injectivelabs/indexer-proto-ts' -import BaseGrpcConsumer from '../../BaseGrpcConsumer' +import BaseGrpcConsumer from '../../base/BaseIndexerGrpcConsumer' import { IndexerModule } from '../types' import { IndexerGrpcAccountPortfolioTransformer } from '../transformers' @@ -63,4 +63,45 @@ export class IndexerGrpcAccountPortfolioApi extends BaseGrpcConsumer { }) } } + + async fetchAccountPortfolioBalances(address: string) { + const request = + InjectivePortfolioRpc.AccountPortfolioBalancesRequest.create() + + request.accountAddress = address + + try { + const response = + await this.retry( + () => this.client.AccountPortfolioBalances(request), + ) + + return IndexerGrpcAccountPortfolioTransformer.accountPortfolioBalancesResponseToAccountPortfolioBalances( + response, + address, + ) + } catch (e: unknown) { + if ((e as any)?.message === 'account address not found') { + return { + accountAddress: address || '', + bankBalancesList: [], + subaccountsList: [], + } + } + + if (e instanceof InjectivePortfolioRpc.GrpcWebError) { + throw new GrpcUnaryRequestException(new Error(e.toString()), { + code: e.code, + context: 'AccountPortfolio', + contextModule: this.module, + }) + } + + throw new GrpcUnaryRequestException(e as Error, { + code: UnspecifiedErrorCode, + context: 'AccountPortfolio', + contextModule: this.module, + }) + } + } } diff --git a/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcSpotApi.ts b/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcSpotApi.ts index 2ab7304d6..cf63755c7 100644 --- a/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcSpotApi.ts +++ b/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcSpotApi.ts @@ -10,7 +10,7 @@ import { TradeDirection, TradeExecutionType, } from '../../../types/exchange' -import BaseGrpcConsumer from '../../BaseGrpcConsumer' +import BaseGrpcConsumer from '../../base/BaseIndexerGrpcConsumer' import { IndexerModule } from '../types' import { PaginationOption } from '../../../types/pagination' import { IndexerGrpcSpotTransformer } from '../transformers' @@ -35,8 +35,9 @@ export class IndexerGrpcSpotApi extends BaseGrpcConsumer { baseDenom?: string marketStatus?: string quoteDenom?: string + marketStatuses?: string[] }) { - const { baseDenom, marketStatus, quoteDenom } = params || {} + const { baseDenom, marketStatus, quoteDenom, marketStatuses } = params || {} const request = InjectiveSpotExchangeRpc.MarketsRequest.create() if (baseDenom) { @@ -47,6 +48,10 @@ export class IndexerGrpcSpotApi extends BaseGrpcConsumer { request.marketStatus = marketStatus } + if (marketStatuses) { + request.marketStatuses = marketStatuses + } + if (quoteDenom) { request.quoteDenom = quoteDenom } @@ -155,6 +160,10 @@ export class IndexerGrpcSpotApi extends BaseGrpcConsumer { if (pagination.endTime !== undefined) { request.endTime = pagination.endTime.toString() } + + if (pagination.startTime !== undefined) { + request.startTime = pagination.startTime.toString() + } } try { @@ -251,6 +260,10 @@ export class IndexerGrpcSpotApi extends BaseGrpcConsumer { if (pagination.endTime !== undefined) { request.endTime = pagination.endTime.toString() } + + if (pagination.startTime !== undefined) { + request.startTime = pagination.startTime.toString() + } } try { @@ -360,6 +373,10 @@ export class IndexerGrpcSpotApi extends BaseGrpcConsumer { if (pagination.endTime !== undefined) { request.endTime = pagination.endTime.toString() } + + if (pagination.startTime !== undefined) { + request.startTime = pagination.startTime.toString() + } } try { diff --git a/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcTradingApi.ts b/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcTradingApi.ts index 0a45f57b0..807ae5fed 100644 --- a/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcTradingApi.ts +++ b/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcTradingApi.ts @@ -3,7 +3,7 @@ import { UnspecifiedErrorCode, } from '@injectivelabs/exceptions' import { InjectiveTradingRpc } from '@injectivelabs/indexer-proto-ts' -import BaseGrpcConsumer from '../../BaseGrpcConsumer' +import BaseGrpcConsumer from '../../base/BaseIndexerGrpcConsumer' import { IndexerModule } from '../types' /** diff --git a/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcTransactionApi.ts b/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcTransactionApi.ts index 86620ee0a..550d571f8 100644 --- a/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcTransactionApi.ts +++ b/packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcTransactionApi.ts @@ -12,7 +12,7 @@ import { TransactionException, UnspecifiedErrorCode, } from '@injectivelabs/exceptions' -import { getGrpcIndexerWebImpl } from '../../BaseIndexerGrpcWebConsumer' +import { getGrpcIndexerWebImpl } from '../../base/BaseIndexerGrpcWebConsumer' import { InjectiveExchangeRpc } from '@injectivelabs/indexer-proto-ts' import { CosmosBaseV1Beta1Coin, diff --git a/packages/sdk-ts/src/client/indexer/grpc_stream/IndexerGrpcAccountPortfolioStream.ts b/packages/sdk-ts/src/client/indexer/grpc_stream/IndexerGrpcAccountPortfolioStream.ts index 7b2f37455..c0882bc4e 100644 --- a/packages/sdk-ts/src/client/indexer/grpc_stream/IndexerGrpcAccountPortfolioStream.ts +++ b/packages/sdk-ts/src/client/indexer/grpc_stream/IndexerGrpcAccountPortfolioStream.ts @@ -1,6 +1,6 @@ import { StreamStatusResponse } from '../types' import { IndexerAccountPortfolioStreamTransformer } from '../transformers' -import { getGrpcIndexerWebImpl } from '../../BaseIndexerGrpcWebConsumer' +import { getGrpcIndexerWebImpl } from '../../base/BaseIndexerGrpcWebConsumer' import { Subscription } from 'rxjs' import { InjectivePortfolioRpc } from '@injectivelabs/indexer-proto-ts' diff --git a/packages/sdk-ts/src/client/indexer/grpc_stream/IndexerGrpcAccountStream.ts b/packages/sdk-ts/src/client/indexer/grpc_stream/IndexerGrpcAccountStream.ts index e3ae97855..612a10231 100644 --- a/packages/sdk-ts/src/client/indexer/grpc_stream/IndexerGrpcAccountStream.ts +++ b/packages/sdk-ts/src/client/indexer/grpc_stream/IndexerGrpcAccountStream.ts @@ -1,6 +1,6 @@ import { StreamStatusResponse } from '../types' import { IndexerAccountStreamTransformer } from '../transformers' -import { getGrpcIndexerWebImpl } from '../../BaseIndexerGrpcWebConsumer' +import { getGrpcIndexerWebImpl } from '../../base/BaseIndexerGrpcWebConsumer' import { Subscription } from 'rxjs' import { InjectiveAccountRpc } from '@injectivelabs/indexer-proto-ts' diff --git a/packages/sdk-ts/src/client/indexer/grpc_stream/IndexerGrpcAuctionStream.ts b/packages/sdk-ts/src/client/indexer/grpc_stream/IndexerGrpcAuctionStream.ts index d519af4ca..854754b0a 100644 --- a/packages/sdk-ts/src/client/indexer/grpc_stream/IndexerGrpcAuctionStream.ts +++ b/packages/sdk-ts/src/client/indexer/grpc_stream/IndexerGrpcAuctionStream.ts @@ -1,6 +1,6 @@ import { StreamStatusResponse } from '../types' import { IndexerAuctionStreamTransformer } from '../transformers' -import { getGrpcIndexerWebImpl } from '../../BaseIndexerGrpcWebConsumer' +import { getGrpcIndexerWebImpl } from '../../base/BaseIndexerGrpcWebConsumer' import { Subscription } from 'rxjs' import { InjectiveAuctionRpc } from '@injectivelabs/indexer-proto-ts' diff --git a/packages/sdk-ts/src/client/indexer/grpc_stream/IndexerGrpcDerivativesStream.ts b/packages/sdk-ts/src/client/indexer/grpc_stream/IndexerGrpcDerivativesStream.ts index 6d5c354b6..42f327677 100644 --- a/packages/sdk-ts/src/client/indexer/grpc_stream/IndexerGrpcDerivativesStream.ts +++ b/packages/sdk-ts/src/client/indexer/grpc_stream/IndexerGrpcDerivativesStream.ts @@ -7,7 +7,7 @@ import { StreamStatusResponse } from '../types' import { PaginationOption } from '../../../types/pagination' import { OrderSide, OrderState } from '@injectivelabs/ts-types' import { IndexerDerivativeStreamTransformer } from '../transformers' -import { getGrpcIndexerWebImpl } from '../../BaseIndexerGrpcWebConsumer' +import { getGrpcIndexerWebImpl } from '../../base/BaseIndexerGrpcWebConsumer' import { Subscription } from 'rxjs' import { InjectiveDerivativeExchangeRpc } from '@injectivelabs/indexer-proto-ts' import { GeneralException } from '@injectivelabs/exceptions' @@ -284,10 +284,12 @@ export class IndexerGrpcDerivativesStream { marketId, subaccountId, callback, + address, onEndCallback, onStatusCallback, }: { marketId?: string + address?: string subaccountId?: string callback: PositionsStreamCallback onEndCallback?: (status?: StreamStatusResponse) => void @@ -300,6 +302,10 @@ export class IndexerGrpcDerivativesStream { request.marketId = marketId } + if (address) { + request.accountAddress = address + } + if (subaccountId) { request.subaccountId = subaccountId } diff --git a/packages/sdk-ts/src/client/indexer/grpc_stream/IndexerGrpcExplorerStream.ts b/packages/sdk-ts/src/client/indexer/grpc_stream/IndexerGrpcExplorerStream.ts index 9ccd2e7b6..33e650b45 100644 --- a/packages/sdk-ts/src/client/indexer/grpc_stream/IndexerGrpcExplorerStream.ts +++ b/packages/sdk-ts/src/client/indexer/grpc_stream/IndexerGrpcExplorerStream.ts @@ -1,6 +1,6 @@ import { StreamStatusResponse } from '../types' import { ExplorerStreamTransformer } from '../transformers' -import { getGrpcIndexerWebImpl } from '../../BaseIndexerGrpcWebConsumer' +import { getGrpcIndexerWebImpl } from '../../base/BaseIndexerGrpcWebConsumer' import { Subscription } from 'rxjs' import { InjectiveExplorerRpc } from '@injectivelabs/indexer-proto-ts' diff --git a/packages/sdk-ts/src/client/indexer/grpc_stream/IndexerGrpcMitoStream.ts b/packages/sdk-ts/src/client/indexer/grpc_stream/IndexerGrpcMitoStream.ts index b9c3650b5..ba23791ce 100644 --- a/packages/sdk-ts/src/client/indexer/grpc_stream/IndexerGrpcMitoStream.ts +++ b/packages/sdk-ts/src/client/indexer/grpc_stream/IndexerGrpcMitoStream.ts @@ -1,6 +1,6 @@ import { StreamStatusResponse } from '../types' import { IndexerGrpcMitoStreamTransformer } from '../transformers' -import { getGrpcIndexerWebImpl } from '../../BaseIndexerGrpcWebConsumer' +import { getGrpcIndexerWebImpl } from '../../base/BaseIndexerGrpcWebConsumer' import { Subscription } from 'rxjs' import { MitoApi } from '@injectivelabs/mito-proto-ts' diff --git a/packages/sdk-ts/src/client/indexer/grpc_stream/IndexerGrpcOracleStream.ts b/packages/sdk-ts/src/client/indexer/grpc_stream/IndexerGrpcOracleStream.ts index 7c5c8bb8d..1042cedb6 100644 --- a/packages/sdk-ts/src/client/indexer/grpc_stream/IndexerGrpcOracleStream.ts +++ b/packages/sdk-ts/src/client/indexer/grpc_stream/IndexerGrpcOracleStream.ts @@ -1,6 +1,6 @@ import { StreamStatusResponse } from '../types' import { IndexerOracleStreamTransformer } from '../transformers/IndexerOracleStreamTransformer' -import { getGrpcIndexerWebImpl } from '../../BaseIndexerGrpcWebConsumer' +import { getGrpcIndexerWebImpl } from '../../base/BaseIndexerGrpcWebConsumer' import { Subscription } from 'rxjs' import { InjectiveOracleRpc } from '@injectivelabs/indexer-proto-ts' diff --git a/packages/sdk-ts/src/client/indexer/grpc_stream/IndexerGrpcSpotStream.ts b/packages/sdk-ts/src/client/indexer/grpc_stream/IndexerGrpcSpotStream.ts index fa465a721..3117d1f4b 100644 --- a/packages/sdk-ts/src/client/indexer/grpc_stream/IndexerGrpcSpotStream.ts +++ b/packages/sdk-ts/src/client/indexer/grpc_stream/IndexerGrpcSpotStream.ts @@ -7,7 +7,7 @@ import { StreamStatusResponse } from '../types' import { PaginationOption } from '../../../types/pagination' import { OrderSide, OrderState } from '@injectivelabs/ts-types' import { IndexerSpotStreamTransformer } from '../transformers' -import { getGrpcIndexerWebImpl } from '../../BaseIndexerGrpcWebConsumer' +import { getGrpcIndexerWebImpl } from '../../base/BaseIndexerGrpcWebConsumer' import { Subscription } from 'rxjs' import { InjectiveSpotExchangeRpc } from '@injectivelabs/indexer-proto-ts' import { GeneralException } from '@injectivelabs/exceptions' diff --git a/packages/sdk-ts/src/client/indexer/rest/IndexerRestDerivativesChronosApi.ts b/packages/sdk-ts/src/client/indexer/rest/IndexerRestDerivativesChronosApi.ts index 5a6541cf9..6f7523ed8 100644 --- a/packages/sdk-ts/src/client/indexer/rest/IndexerRestDerivativesChronosApi.ts +++ b/packages/sdk-ts/src/client/indexer/rest/IndexerRestDerivativesChronosApi.ts @@ -2,7 +2,7 @@ import { ChronosDerivativeMarketSummaryResponse, AllDerivativeMarketSummaryResponse, } from '../types/derivatives-rest' -import BaseRestConsumer from '../../BaseRestConsumer' +import BaseRestConsumer from '../../base/BaseRestConsumer' import { HttpRequestException, HttpRequestMethod, diff --git a/packages/sdk-ts/src/client/indexer/rest/IndexerRestExplorerApi.ts b/packages/sdk-ts/src/client/indexer/rest/IndexerRestExplorerApi.ts index b1969c9fc..030ffa154 100644 --- a/packages/sdk-ts/src/client/indexer/rest/IndexerRestExplorerApi.ts +++ b/packages/sdk-ts/src/client/indexer/rest/IndexerRestExplorerApi.ts @@ -1,5 +1,5 @@ import { MsgStatus, MsgType } from '@injectivelabs/ts-types' -import BaseRestConsumer from '../../BaseRestConsumer' +import BaseRestConsumer from '../../base/BaseRestConsumer' import { Paging, ExplorerTransaction, @@ -162,16 +162,16 @@ export class IndexerRestExplorerApi extends BaseRestConsumer { try { const { - fromNumber, - before, + type, + skip, after, limit, - toNumber, + before, + status, endTime, - skip, + toNumber, startTime, - status, - type, + fromNumber, } = params || { limit: 12, } @@ -180,16 +180,16 @@ export class IndexerRestExplorerApi extends BaseRestConsumer { ExplorerApiResponseWithPagination >(() => this.get(endpoint, { + skip, limit, after, before, - from_number: fromNumber, - to_number: toNumber, - skip, status, - type: type ? type.join(',') : undefined, end_time: endTime, + to_number: toNumber, start_time: startTime, + from_number: fromNumber, + type: type ? type.join(',') : undefined, }), ) @@ -220,32 +220,34 @@ export class IndexerRestExplorerApi extends BaseRestConsumer { }: { account: string params?: { - fromNumber?: number + skip?: number limit?: number - before?: number after?: number + before?: number + type?: MsgType[] + status?: MsgStatus + endTime?: number toNumber?: number - skip?: number + fromNumber?: number startTime?: number - endTime?: number - status?: MsgStatus - type?: MsgType[] + withClaimId?: boolean } }): Promise<{ paging: Paging; transactions: ExplorerTransaction[] }> { const endpoint = `accountTxs/${account}` try { const { - fromNumber, - before, - after, - limit, + type, skip, - toNumber, + limit, + after, + before, + status, endTime, + toNumber, startTime, - status, - type, + fromNumber, + withClaimId, } = params || { limit: 12, } @@ -258,12 +260,13 @@ export class IndexerRestExplorerApi extends BaseRestConsumer { limit, after, before, - from_number: fromNumber, - to_number: toNumber, status, - type: type ? type.join(',') : undefined, end_time: endTime, + to_number: toNumber, start_time: startTime, + from_number: fromNumber, + type: type ? type.join(',') : undefined, + with_claim_id: withClaimId, }), ) @@ -398,6 +401,7 @@ export class IndexerRestExplorerApi extends BaseRestConsumer { async fetchContracts(params?: { assetsOnly?: boolean fromNumber?: number + codeId?: string | number limit?: number skip?: number label?: string @@ -408,7 +412,7 @@ export class IndexerRestExplorerApi extends BaseRestConsumer { const endpoint = `/wasm/contracts` try { - const { assetsOnly, fromNumber, limit, skip, label } = params || { + const { assetsOnly, fromNumber, limit, skip, label, codeId } = params || { limit: 12, } @@ -418,9 +422,10 @@ export class IndexerRestExplorerApi extends BaseRestConsumer { this.get(endpoint, { skip, limit, + label, + code_id: codeId?.toString(), assets_only: assetsOnly, from_number: fromNumber, - label, }), ) const { paging, data } = response.data diff --git a/packages/sdk-ts/src/client/indexer/rest/IndexerRestLeaderboardChronosApi.ts b/packages/sdk-ts/src/client/indexer/rest/IndexerRestLeaderboardChronosApi.ts index 0a00072c1..7b5137d55 100644 --- a/packages/sdk-ts/src/client/indexer/rest/IndexerRestLeaderboardChronosApi.ts +++ b/packages/sdk-ts/src/client/indexer/rest/IndexerRestLeaderboardChronosApi.ts @@ -1,5 +1,5 @@ import { ChronosLeaderboardResponse } from '../types/leaderboard-rest' -import BaseRestConsumer from '../../BaseRestConsumer' +import BaseRestConsumer from '../../base/BaseRestConsumer' import { HttpRequestException, HttpRequestMethod, diff --git a/packages/sdk-ts/src/client/indexer/rest/IndexerRestMarketChronosApi.ts b/packages/sdk-ts/src/client/indexer/rest/IndexerRestMarketChronosApi.ts index 7e723b640..d0f214faf 100644 --- a/packages/sdk-ts/src/client/indexer/rest/IndexerRestMarketChronosApi.ts +++ b/packages/sdk-ts/src/client/indexer/rest/IndexerRestMarketChronosApi.ts @@ -3,7 +3,7 @@ import { HttpRequestMethod, UnspecifiedErrorCode, } from '@injectivelabs/exceptions' -import BaseRestConsumer from '../../BaseRestConsumer' +import BaseRestConsumer from '../../base/BaseRestConsumer' import { IndexerModule } from '../types' import { ChronosMarketHistoryResponse } from '../types/markets-history-rest' diff --git a/packages/sdk-ts/src/client/indexer/rest/IndexerRestSpotChronosApi.ts b/packages/sdk-ts/src/client/indexer/rest/IndexerRestSpotChronosApi.ts index fd144dc00..779d849ad 100644 --- a/packages/sdk-ts/src/client/indexer/rest/IndexerRestSpotChronosApi.ts +++ b/packages/sdk-ts/src/client/indexer/rest/IndexerRestSpotChronosApi.ts @@ -7,7 +7,7 @@ import { ChronosSpotMarketSummaryResponse, AllSpotMarketSummaryResponse, } from '../types/spot-rest' -import BaseRestConsumer from '../../BaseRestConsumer' +import BaseRestConsumer from '../../base/BaseRestConsumer' import { IndexerModule } from '../types' /** diff --git a/packages/sdk-ts/src/client/indexer/transformers/IndexerAccountPortfolioTransformer.ts b/packages/sdk-ts/src/client/indexer/transformers/IndexerAccountPortfolioTransformer.ts index 80075c58a..149c96625 100644 --- a/packages/sdk-ts/src/client/indexer/transformers/IndexerAccountPortfolioTransformer.ts +++ b/packages/sdk-ts/src/client/indexer/transformers/IndexerAccountPortfolioTransformer.ts @@ -1,17 +1,17 @@ import { Coin } from '@injectivelabs/ts-types' import { GrpcCoin } from '../../../types' import { - PositionV2, - GrpcPositionV2, PositionsWithUPNL, AccountPortfolioV2, SubaccountDepositV2, GrpcPositionsWithUPNL, GrpcSubaccountDepositV2, + AccountPortfolioBalances, PortfolioSubaccountBalanceV2, GrpcPortfolioSubaccountBalanceV2, } from '../types/account-portfolio' import { InjectivePortfolioRpc } from '@injectivelabs/indexer-proto-ts' +import { IndexerGrpcDerivativeTransformer } from './IndexerGrpcDerivativeTransformer' export class IndexerGrpcAccountPortfolioTransformer { static accountPortfolioResponseToAccountPortfolio( @@ -46,6 +46,33 @@ export class IndexerGrpcAccountPortfolioTransformer { } } + static accountPortfolioBalancesResponseToAccountPortfolioBalances( + response: InjectivePortfolioRpc.AccountPortfolioBalancesResponse, + address: string, + ): AccountPortfolioBalances { + const portfolio = response.portfolio! + const bankBalancesList = portfolio?.bankBalances || [] + const subaccountList = portfolio?.subaccounts || [] + + if (!portfolio) { + return { + accountAddress: address || '', + bankBalancesList: [], + subaccountsList: [], + } + } + + return { + accountAddress: portfolio.accountAddress, + bankBalancesList: bankBalancesList.map( + IndexerGrpcAccountPortfolioTransformer.grpcCoinToCoin, + ), + subaccountsList: subaccountList.map( + IndexerGrpcAccountPortfolioTransformer.grpcSubaccountBalanceToSubaccountBalance, + ), + } + } + static grpcCoinToCoin(coin: GrpcCoin): Coin { return { amount: coin.amount, @@ -60,7 +87,7 @@ export class IndexerGrpcAccountPortfolioTransformer { return { position: grpcPosition - ? IndexerGrpcAccountPortfolioTransformer.grpcPositionToGrpcPosition( + ? IndexerGrpcDerivativeTransformer.grpcPositionToPosition( grpcPosition, ) : undefined, @@ -68,23 +95,6 @@ export class IndexerGrpcAccountPortfolioTransformer { } } - static grpcPositionToGrpcPosition(position: GrpcPositionV2): PositionV2 { - return { - ticker: position.ticker, - marketId: position.marketId, - subaccountId: position.subaccountId, - direction: position.direction, - quantity: position.quantity, - entryPrice: position.entryPrice, - margin: position.margin, - liquidationPrice: position.liquidationPrice, - markPrice: position.markPrice, - aggregateReduceOnlyQuantity: position.aggregateReduceOnlyQuantity, - updatedAt: parseInt(position.updatedAt, 10), - createdAt: parseInt(position.createdAt, 10), - } - } - static grpcSubaccountDepositToSubaccountDeposit( subaccountDeposit: GrpcSubaccountDepositV2, ): SubaccountDepositV2 { diff --git a/packages/sdk-ts/src/client/indexer/transformers/IndexerCampaignTransformer.ts b/packages/sdk-ts/src/client/indexer/transformers/IndexerCampaignTransformer.ts index f12171ddf..f6dc45262 100644 --- a/packages/sdk-ts/src/client/indexer/transformers/IndexerCampaignTransformer.ts +++ b/packages/sdk-ts/src/client/indexer/transformers/IndexerCampaignTransformer.ts @@ -1,8 +1,23 @@ +import { Coin } from '@injectivelabs/ts-types' import { InjectiveCampaignRpc } from '@injectivelabs/indexer-proto-ts' import { grpcPagingToPaging } from '../../..//utils/pagination' -import { Campaign, CampaignUser } from '../types/campaign' +import { + Guild, + Campaign, + GuildMember, + CampaignUser, + GuildCampaignSummary, +} from '../types/campaign' +import { GrpcCoin } from '../../../types' export class IndexerCampaignTransformer { + static GrpcCoinToCoin(coin: GrpcCoin): Coin { + return { + denom: coin.denom, + amount: coin.amount, + } + } + static GrpcCampaignUserToCampaignUser( campaignUser: InjectiveCampaignRpc.CampaignUser, ): CampaignUser { @@ -14,6 +29,8 @@ export class IndexerCampaignTransformer { contractUpdated: campaignUser.contractUpdated, blockHeight: campaignUser.blockHeight, blockTime: parseInt(campaignUser.blockTime, 10), + purchasedAmount: campaignUser.purchasedAmount, + galxeUpdated: campaignUser.galxeUpdated, } } @@ -31,6 +48,65 @@ export class IndexerCampaignTransformer { } } + static GrpcGuildToGuild(guild: InjectiveCampaignRpc.Guild): Guild { + return { + campaignContract: guild.campaignContract, + guildId: guild.guildId, + masterAddress: guild.masterAddress, + createdAt: parseInt(guild.createdAt, 10), + tvlScore: guild.tvlScore, + volumeScore: guild.volumeScore, + rankByVolume: guild.rankByVolume, + rankByTvl: guild.rankByTvl, + logo: guild.logo, + totalTvl: guild.totalTvl, + updatedAt: parseInt(guild.updatedAt, 10), + name: guild.name, + isActive: guild.isActive, + masterBalance: guild.masterBalance, + description: guild.description, + } + } + + static GrpcGuildMemberToGuildMember( + member: InjectiveCampaignRpc.GuildMember, + ): GuildMember { + return { + campaignContract: member.campaignContract, + guildId: member.guildId, + address: member.address, + joinedAt: parseInt(member.joinedAt, 10), + tvlScore: member.tvlScore, + volumeScore: member.volumeScore, + totalTvl: member.totalTvl, + volumeScorePercentage: member.volumeScorePercentage, + tvlScorePercentage: member.tvlScorePercentage, + tvlReward: member.tvlReward.map( + IndexerCampaignTransformer.GrpcCoinToCoin, + ), + volumeReward: member.volumeReward.map( + IndexerCampaignTransformer.GrpcCoinToCoin, + ), + } + } + + static GrpcGuildCampaignSummaryToGuildCampaignSummary( + campaignSummary: InjectiveCampaignRpc.CampaignSummary, + ): GuildCampaignSummary { + return { + campaignId: campaignSummary.campaignId, + campaignContract: campaignSummary.campaignContract, + totalGuildsCount: campaignSummary.totalGuildsCount, + totalTvl: campaignSummary.totalTvl, + totalAverageTvl: campaignSummary.totalAverageTvl, + totalVolume: campaignSummary.totalVolume, + updatedAt: parseInt(campaignSummary.updatedAt, 10), + totalMembersCount: campaignSummary.totalMembersCount, + startTime: parseInt(campaignSummary.startTime, 10), + endTime: parseInt(campaignSummary.endTime, 10), + } + } + static CampaignResponseToCampaign( response: InjectiveCampaignRpc.RankingResponse, ) { @@ -44,4 +120,43 @@ export class IndexerCampaignTransformer { paging: grpcPagingToPaging(response.paging), } } + + static GuildsResponseToGuilds( + response: InjectiveCampaignRpc.ListGuildsResponse, + ) { + return { + guilds: response.guilds.map(IndexerCampaignTransformer.GrpcGuildToGuild), + paging: grpcPagingToPaging(response.paging), + updatedAt: parseInt(response.updatedAt, 10), + summary: response.campaignSummary + ? IndexerCampaignTransformer.GrpcGuildCampaignSummaryToGuildCampaignSummary( + response.campaignSummary, + ) + : undefined, + } + } + + static GuildMemberResponseToGuildMember( + response: InjectiveCampaignRpc.GetGuildMemberResponse, + ) { + return { + info: response.info + ? IndexerCampaignTransformer.GrpcGuildMemberToGuildMember(response.info) + : undefined, + } + } + + static GuildMembersResponseToGuildMembers( + response: InjectiveCampaignRpc.ListGuildMembersResponse, + ) { + return { + members: response.members.map( + IndexerCampaignTransformer.GrpcGuildMemberToGuildMember, + ), + paging: grpcPagingToPaging(response.paging), + guildInfo: response.guildInfo + ? IndexerCampaignTransformer.GrpcGuildToGuild(response.guildInfo) + : undefined, + } + } } diff --git a/packages/sdk-ts/src/client/indexer/transformers/IndexerGrpcDerivativeTransformer.ts b/packages/sdk-ts/src/client/indexer/transformers/IndexerGrpcDerivativeTransformer.ts index d97206e5e..d6e356b90 100644 --- a/packages/sdk-ts/src/client/indexer/transformers/IndexerGrpcDerivativeTransformer.ts +++ b/packages/sdk-ts/src/client/indexer/transformers/IndexerGrpcDerivativeTransformer.ts @@ -31,6 +31,8 @@ import { BinaryOptionsMarket, GrpcDerivativeOrderHistory, DerivativeOrderHistory, + GrpcDerivativePositionV2, + PositionV2, } from '../types/derivatives' import { Orderbook, @@ -176,6 +178,21 @@ export class IndexerGrpcDerivativeTransformer { } } + static positionsV2ResponseToPositionsV2( + response: InjectiveDerivativeExchangeRpc.PositionsV2Response, + ) { + const positions = response.positions + const pagination = response.paging + + return { + positions: + IndexerGrpcDerivativeTransformer.grpcPositionsV2ToPositionsV2( + positions, + ), + pagination: grpcPagingToPaging(pagination), + } + } + static tradesResponseToTrades( response: InjectiveDerivativeExchangeRpc.TradesResponse, ) { @@ -510,7 +527,25 @@ export class IndexerGrpcDerivativeTransformer { quantity: position.quantity, entryPrice: position.entryPrice, margin: position.margin, + liquidationPrice: position.liquidationPrice, aggregateReduceOnlyQuantity: position.aggregateReduceOnlyQuantity, + markPrice: position.markPrice, + ticker: position.ticker, + updatedAt: parseInt(position.updatedAt, 10), + } + } + + static grpcPositionV2ToPositionV2( + position: GrpcDerivativePositionV2, + ): PositionV2 { + return { + marketId: position.marketId, + subaccountId: position.subaccountId, + direction: position.direction as TradeDirection, + quantity: position.quantity, + entryPrice: position.entryPrice, + margin: position.margin, + denom: position.denom, liquidationPrice: position.liquidationPrice, markPrice: position.markPrice, ticker: position.ticker, @@ -526,6 +561,14 @@ export class IndexerGrpcDerivativeTransformer { ) } + static grpcPositionsV2ToPositionsV2( + positions: GrpcDerivativePositionV2[], + ): PositionV2[] { + return positions.map((position) => + IndexerGrpcDerivativeTransformer.grpcPositionV2ToPositionV2(position), + ) + } + static grpcTradeToTrade(trade: GrpcDerivativeTrade): DerivativeTrade { const positionDelta = trade.positionDelta const mappedPositionDelta = positionDelta diff --git a/packages/sdk-ts/src/client/indexer/transformers/IndexerGrpcMitoTransformer.ts b/packages/sdk-ts/src/client/indexer/transformers/IndexerGrpcMitoTransformer.ts index bfeb92ae5..6bc8c22b9 100644 --- a/packages/sdk-ts/src/client/indexer/transformers/IndexerGrpcMitoTransformer.ts +++ b/packages/sdk-ts/src/client/indexer/transformers/IndexerGrpcMitoTransformer.ts @@ -147,13 +147,13 @@ export class IndexerGrpcMitoTransformer { return { pnl: portfolio.pnl, totalValue: portfolio.totalValue, + updatedAt: parseInt(portfolio.pnlUpdatedAt, 10), totalValueChartList: portfolio.totalValueChart.map( IndexerGrpcMitoTransformer.mitoPriceSnapshotToPriceSnapshot, ), pnlChartList: portfolio.pnlChart.map( IndexerGrpcMitoTransformer.mitoPriceSnapshotToPriceSnapshot, ), - updatedAt: parseInt(portfolio.pnlUpdatedAt, 10), } } @@ -337,9 +337,11 @@ export class IndexerGrpcMitoTransformer { name: IDO.name, owner: IDO.owner, status: IDO.status, + marketId: IDO.marketId, tokenPrice: IDO.tokenPrice, quoteDenom: IDO.quoteDenom, useWhitelist: IDO.useWhitelist, + vaultAddress: IDO.vaultAddress, capPerAddress: IDO.capPerAddress, contractAddress: IDO.contractAddress, subscribedAmount: IDO.subscribedAmount, @@ -391,6 +393,7 @@ export class IndexerGrpcMitoTransformer { IDOSubscriber.estimateTokenReceived, ) : undefined, + createdAt: parseInt(IDOSubscriber.createdAt, 10), } } @@ -399,6 +402,7 @@ export class IndexerGrpcMitoTransformer { ): MitoIDOSubscription { return { price: subscription.price, + marketId: subscription.marketId, quoteDenom: subscription.quoteDenom, stakedAmount: subscription.stakedAmount, rewardClaimed: subscription.rewardClaimed, @@ -407,6 +411,9 @@ export class IndexerGrpcMitoTransformer { claimableCoins: subscription.claimableCoins.map( IndexerGrpcMitoTransformer.grpcCoinToCoin, ), + ownerClaimableCoins: subscription.ownerClaimableCoins.map( + IndexerGrpcMitoTransformer.grpcCoinToCoin, + ), claimTxHash: subscription.claimTxHash, maxSubscriptionCoin: subscription.maxSubscriptionCoin ? IndexerGrpcMitoTransformer.grpcCoinToCoin( @@ -598,6 +605,8 @@ export class IndexerGrpcMitoTransformer { response: MitoApi.GetIDOSubscribersResponse, ) { return { + marketId: response.marketId, + quoteDenom: response.quoteDenom, subscribers: response.subscribers.map( IndexerGrpcMitoTransformer.mitoIDOSubscriberToIDOSubscriber, ), @@ -609,7 +618,6 @@ export class IndexerGrpcMitoTransformer { response.tokenInfo, ) : undefined, - quoteDenom: response.quoteDenom, } } diff --git a/packages/sdk-ts/src/client/indexer/transformers/IndexerRestExplorerTransformer.ts b/packages/sdk-ts/src/client/indexer/transformers/IndexerRestExplorerTransformer.ts index 36aafb7f5..5f23cb046 100644 --- a/packages/sdk-ts/src/client/indexer/transformers/IndexerRestExplorerTransformer.ts +++ b/packages/sdk-ts/src/client/indexer/transformers/IndexerRestExplorerTransformer.ts @@ -112,6 +112,7 @@ export class IndexerRestExplorerTransformer { })), logs: transaction.logs, errorLog: transaction.error_log, + claimIds: transaction.claim_id || [] } } @@ -205,6 +206,7 @@ export class IndexerRestExplorerTransformer { funds: contract.funds, codeId: contract.code_id, admin: contract.admin, + cw20_metadata: contract.cw20_metadata, initMessage: parseCW20Message(contract.init_message), currentMigrateMessage: parseCW20Message(contract.current_migrate_message), } diff --git a/packages/sdk-ts/src/client/indexer/types/account-portfolio.ts b/packages/sdk-ts/src/client/indexer/types/account-portfolio.ts index 0d4a75999..dc80eccaf 100644 --- a/packages/sdk-ts/src/client/indexer/types/account-portfolio.ts +++ b/packages/sdk-ts/src/client/indexer/types/account-portfolio.ts @@ -1,5 +1,6 @@ import { InjectivePortfolioRpc } from '@injectivelabs/indexer-proto-ts' import { Coin } from '@injectivelabs/ts-types' +import { Position } from './derivatives' export interface SubaccountDepositV2 { totalBalance: string @@ -12,23 +13,8 @@ export interface PortfolioSubaccountBalanceV2 { deposit?: SubaccountDepositV2 } -export interface PositionV2 { - ticker: string - marketId: string - subaccountId: string - direction: string - quantity: string - entryPrice: string - margin: string - liquidationPrice: string - markPrice: string - aggregateReduceOnlyQuantity: string - updatedAt: number - createdAt: number -} - export interface PositionsWithUPNL { - position?: PositionV2 + position?: Position unrealizedPnl: string } @@ -39,6 +25,12 @@ export interface AccountPortfolioV2 { positionsWithUpnlList: PositionsWithUPNL[] } +export interface AccountPortfolioBalances { + accountAddress: string + bankBalancesList: Coin[] + subaccountsList: PortfolioSubaccountBalanceV2[] +} + export type GrpcPositionV2 = InjectivePortfolioRpc.DerivativePosition export type GrpcAccountPortfolioV2 = InjectivePortfolioRpc.Portfolio export type GrpcSubaccountDepositV2 = InjectivePortfolioRpc.SubaccountDeposit diff --git a/packages/sdk-ts/src/client/indexer/types/campaign.ts b/packages/sdk-ts/src/client/indexer/types/campaign.ts index 643ec2581..488e0c734 100644 --- a/packages/sdk-ts/src/client/indexer/types/campaign.ts +++ b/packages/sdk-ts/src/client/indexer/types/campaign.ts @@ -1,3 +1,4 @@ +import { Coin } from '@injectivelabs/ts-types' import { InjectiveCampaignRpc } from '@injectivelabs/indexer-proto-ts' export interface Campaign { @@ -18,7 +19,56 @@ export interface CampaignUser { contractUpdated: boolean blockHeight: string blockTime: number + purchasedAmount: string + galxeUpdated: boolean } +export interface Guild { + campaignContract: string + guildId: string + masterAddress: string + createdAt: number + tvlScore: string + volumeScore: string + rankByVolume: number + rankByTvl: number + logo: string + totalTvl: string + updatedAt: number + name: string + isActive: boolean + description: string + masterBalance: string +} + +export interface GuildMember { + campaignContract: string + guildId: string + address: string + joinedAt: number + tvlScore: string + volumeScore: string + totalTvl: string + volumeScorePercentage: number + tvlScorePercentage: number + tvlReward: Coin[] + volumeReward: Coin[] +} + +export interface GuildCampaignSummary { + campaignId: string + campaignContract: string + totalGuildsCount: number + totalTvl: string + totalAverageTvl: string + totalVolume: string + updatedAt: number + totalMembersCount: number + startTime: number + endTime: number +} + +export type GrpcGuild = InjectiveCampaignRpc.Guild export type GrpcCampaign = InjectiveCampaignRpc.Campaign +export type GrpcGuildMember = InjectiveCampaignRpc.GuildMember export type GrpcCampaignUser = InjectiveCampaignRpc.CampaignUser diff --git a/packages/sdk-ts/src/client/indexer/types/derivatives.ts b/packages/sdk-ts/src/client/indexer/types/derivatives.ts index 4a23ffd07..e0f50dcb2 100644 --- a/packages/sdk-ts/src/client/indexer/types/derivatives.ts +++ b/packages/sdk-ts/src/client/indexer/types/derivatives.ts @@ -30,6 +30,11 @@ export interface Position { updatedAt: number } +export interface PositionV2 + extends Omit { + denom: string +} + export interface PerpetualMarketInfo { hourlyFundingRateCap: string hourlyInterestRate: string @@ -206,6 +211,8 @@ export type GrpcFundingPayment = InjectiveDerivativeExchangeRpc.FundingPayment export type GrpcDerivativeTrade = InjectiveDerivativeExchangeRpc.DerivativeTrade export type GrpcDerivativePosition = InjectiveDerivativeExchangeRpc.DerivativePosition +export type GrpcDerivativePositionV2 = + InjectiveDerivativeExchangeRpc.DerivativePositionV2 export type GrpcPerpetualMarketInfo = InjectiveDerivativeExchangeRpc.PerpetualMarketInfo export type GrpcDerivativeMarketInfo = diff --git a/packages/sdk-ts/src/client/indexer/types/explorer-rest.ts b/packages/sdk-ts/src/client/indexer/types/explorer-rest.ts index 3014893cb..c096680ea 100644 --- a/packages/sdk-ts/src/client/indexer/types/explorer-rest.ts +++ b/packages/sdk-ts/src/client/indexer/types/explorer-rest.ts @@ -81,6 +81,7 @@ export interface TransactionFromExplorerApiResponse { logs: EventLog[] messages: Array<{ value: any; type: string }> error_log?: string + claim_id?: number[] } export interface BlockFromExplorerApiResponse { @@ -117,6 +118,7 @@ export interface ExplorerTransaction extends Omit { parsedMessages?: Message[] errorLog?: string logs?: EventLog[] + claimIds?: number[] } export interface ExplorerBlockWithTxs extends Omit { @@ -177,6 +179,14 @@ export interface ContractExplorerApiResponse { code_id: number admin?: string current_migrate_message: string + cw20_metadata?: { + token_info?: { + name: string + symbol: string + decimals: number + total_supply: string + } + } } export interface ContractTransactionExplorerApiResponse { diff --git a/packages/sdk-ts/src/client/indexer/types/explorer.ts b/packages/sdk-ts/src/client/indexer/types/explorer.ts index 02a704d68..cd870a657 100644 --- a/packages/sdk-ts/src/client/indexer/types/explorer.ts +++ b/packages/sdk-ts/src/client/indexer/types/explorer.ts @@ -245,6 +245,14 @@ export interface Contract { admin?: string initMessage?: CW20Message currentMigrateMessage?: CW20Message + cw20_metadata?: { + token_info?: { + name: string + symbol: string + decimals: number + total_supply: string + } + } } export interface ContractTransaction { diff --git a/packages/sdk-ts/src/client/indexer/types/incentives.ts b/packages/sdk-ts/src/client/indexer/types/incentives.ts new file mode 100644 index 000000000..cb4db367c --- /dev/null +++ b/packages/sdk-ts/src/client/indexer/types/incentives.ts @@ -0,0 +1,22 @@ +import { Coin } from '@injectivelabs/ts-types' + +export interface IncentivesRound { + id: number + name: string + endDate: number + startDate: number + campaigns: string[] +} + +export interface IncentivesCampaign { + id: number + name: string + rewards: Coin[] + inRound: number + marketId: string + isFunded: boolean + description: string + totalRewards: string + isFinalized: boolean + subaccountIdSuffix: string +} diff --git a/packages/sdk-ts/src/client/indexer/types/index.ts b/packages/sdk-ts/src/client/indexer/types/index.ts index a899d327f..e19f2fc9d 100644 --- a/packages/sdk-ts/src/client/indexer/types/index.ts +++ b/packages/sdk-ts/src/client/indexer/types/index.ts @@ -11,6 +11,7 @@ export * from './exchange' export * from './explorer' export * from './campaign' export * from './spot-rest' +export * from './incentives' export * from './derivatives' export * from './explorer-rest' export * from './insurance-funds' diff --git a/packages/sdk-ts/src/client/indexer/types/mito.ts b/packages/sdk-ts/src/client/indexer/types/mito.ts index 3cd6937e6..4b6418930 100644 --- a/packages/sdk-ts/src/client/indexer/types/mito.ts +++ b/packages/sdk-ts/src/client/indexer/types/mito.ts @@ -208,6 +208,8 @@ export interface MitoIDO { quoteDenom: string stakeToSubscription: MitoStakeToSubscription[] useWhitelist: boolean + marketId: string + vaultAddress: string } export interface MitoIDOSubscriber { @@ -217,6 +219,7 @@ export interface MitoIDOSubscriber { estimateTokenReceived?: Coin estimateLpAmount?: Coin | undefined estimateRefundAmount?: Coin | undefined + createdAt: number } export interface MitoIDOSubscriptionActivity { @@ -238,6 +241,8 @@ export interface MitoIDOSubscription { updatedAt: number stakedAmount: string claimTxHash?: string + ownerClaimableCoins: Coin[] + marketId: string } export interface MitoWhitelistAccount { diff --git a/packages/sdk-ts/src/client/wasm/incentives/index.ts b/packages/sdk-ts/src/client/wasm/incentives/index.ts new file mode 100644 index 000000000..b31e7023e --- /dev/null +++ b/packages/sdk-ts/src/client/wasm/incentives/index.ts @@ -0,0 +1,3 @@ +export * from './types' +export * from './queries' +export * from './transformer' diff --git a/packages/sdk-ts/src/client/wasm/incentives/queries/QueryAllRounds.ts b/packages/sdk-ts/src/client/wasm/incentives/queries/QueryAllRounds.ts new file mode 100644 index 000000000..7dc270868 --- /dev/null +++ b/packages/sdk-ts/src/client/wasm/incentives/queries/QueryAllRounds.ts @@ -0,0 +1,26 @@ +import { BaseWasmQuery } from '../../BaseWasmQuery' +import { toBase64 } from '../../../../utils' + +export declare namespace QueryAllRoundsArg { + export interface Params { + startAfter?: string + limit?: number + } +} + +export class QueryAllRounds extends BaseWasmQuery { + toPayload() { + const payload = { + all_rounds: { + ...(this.params.limit ? { limit: this.params.limit } : {}), + ...(this.params.startAfter + ? { + start_after: this.params.startAfter, + } + : {}), + }, + } + + return toBase64(payload) + } +} diff --git a/packages/sdk-ts/src/client/wasm/incentives/queries/QueryGetCampaigns.ts b/packages/sdk-ts/src/client/wasm/incentives/queries/QueryGetCampaigns.ts new file mode 100644 index 000000000..10bf5cc36 --- /dev/null +++ b/packages/sdk-ts/src/client/wasm/incentives/queries/QueryGetCampaigns.ts @@ -0,0 +1,20 @@ +import { BaseWasmQuery } from '../../BaseWasmQuery' +import { toBase64 } from '../../../../utils' + +export declare namespace QueryGetCampaignsArg { + export interface Params { + campaigns: string[] + } +} + +export class QueryGetCampaigns extends BaseWasmQuery { + toPayload() { + const payload = { + get_campaigns: { + campaigns: this.params.campaigns, + }, + } + + return toBase64(payload) + } +} diff --git a/packages/sdk-ts/src/client/wasm/incentives/queries/index.ts b/packages/sdk-ts/src/client/wasm/incentives/queries/index.ts new file mode 100644 index 000000000..cf8b9124d --- /dev/null +++ b/packages/sdk-ts/src/client/wasm/incentives/queries/index.ts @@ -0,0 +1,2 @@ +export { QueryAllRounds } from './QueryAllRounds' +export { QueryGetCampaigns } from './QueryGetCampaigns' diff --git a/packages/sdk-ts/src/client/wasm/incentives/transformer.ts b/packages/sdk-ts/src/client/wasm/incentives/transformer.ts new file mode 100644 index 000000000..12bc6ff85 --- /dev/null +++ b/packages/sdk-ts/src/client/wasm/incentives/transformer.ts @@ -0,0 +1,38 @@ +import { QueryRoundResponse, QueryCampaignResponse } from './types' +import { WasmContractQueryResponse } from '../types' +import { toUtf8 } from '../../../utils' + +export class IncentivesQueryTransformer { + static contractRoundResponseToContractRound( + response: WasmContractQueryResponse, + ) { + const data = JSON.parse(toUtf8(response.data)) as QueryRoundResponse[] + + return data.map((round: QueryRoundResponse) => ({ + id: round.id, + name: round.name, + endDate: round.end_date, + campaigns: round.campaigns, + startDate: round.start_date, + })) + } + + static contractCampaignResponseToContractCampaign( + response: WasmContractQueryResponse, + ) { + const data = JSON.parse(toUtf8(response.data)) as QueryCampaignResponse[] + + return data.map((campaign: QueryCampaignResponse) => ({ + id: campaign.id, + name: campaign.name, + rewards: campaign.rewards, + inRound: campaign.in_round, + marketId: campaign.market_id, + isFunded: campaign.is_funded, + description: campaign.description, + isFinalized: campaign.is_finalized, + totalRewards: campaign.total_rewards, + subaccountIdSuffix: campaign.subaccount_id_suffix, + })) + } +} diff --git a/packages/sdk-ts/src/client/wasm/incentives/types.ts b/packages/sdk-ts/src/client/wasm/incentives/types.ts new file mode 100644 index 000000000..f4cfbe678 --- /dev/null +++ b/packages/sdk-ts/src/client/wasm/incentives/types.ts @@ -0,0 +1,22 @@ +import { Coin } from '@injectivelabs/ts-types' + +export interface QueryRoundResponse { + id: number + name: string + end_date: number + start_date: number + campaigns: string[] +} + +export interface QueryCampaignResponse { + id: number + name: string + rewards: Coin[] + in_round: number + market_id: string + is_funded: boolean + description: string + total_rewards: string + is_finalized: boolean + subaccount_id_suffix: string +} diff --git a/packages/sdk-ts/src/client/wasm/index.ts b/packages/sdk-ts/src/client/wasm/index.ts index 93c4cea8e..cedc2a149 100644 --- a/packages/sdk-ts/src/client/wasm/index.ts +++ b/packages/sdk-ts/src/client/wasm/index.ts @@ -1,3 +1,4 @@ export * from './swap' export * from './types' +export * from './incentives' export * from './nameservice' diff --git a/packages/sdk-ts/src/core/modules/exchange/msgs/MsgBatchCancelBinaryOptionsOrders.spec.ts b/packages/sdk-ts/src/core/modules/exchange/msgs/MsgBatchCancelBinaryOptionsOrders.spec.ts index e5e9f8c58..6e43a1eb5 100644 --- a/packages/sdk-ts/src/core/modules/exchange/msgs/MsgBatchCancelBinaryOptionsOrders.spec.ts +++ b/packages/sdk-ts/src/core/modules/exchange/msgs/MsgBatchCancelBinaryOptionsOrders.spec.ts @@ -9,11 +9,13 @@ const params: MsgBatchCancelDerivativeOrders['params'] = { marketId: mockFactory.injUsdtDerivativeMarket.marketId, orderHash: mockFactory.orderHash, subaccountId: mockFactory.subaccountId, + cid: '', }, { marketId: mockFactory.injUsdtDerivativeMarket.marketId, orderHash: mockFactory.orderHash2, subaccountId: mockFactory.subaccountId, + cid: '', }, ], } diff --git a/packages/sdk-ts/src/core/modules/exchange/msgs/MsgBatchCancelBinaryOptionsOrders.ts b/packages/sdk-ts/src/core/modules/exchange/msgs/MsgBatchCancelBinaryOptionsOrders.ts index 07936cbd6..386e544fb 100644 --- a/packages/sdk-ts/src/core/modules/exchange/msgs/MsgBatchCancelBinaryOptionsOrders.ts +++ b/packages/sdk-ts/src/core/modules/exchange/msgs/MsgBatchCancelBinaryOptionsOrders.ts @@ -13,6 +13,7 @@ export declare namespace MsgBatchCancelBinaryOptionsOrders { subaccountId: string orderHash: string orderMask?: InjectiveExchangeV1Beta1Exchange.OrderMask + cid?: string }[] } @@ -41,6 +42,7 @@ export default class MsgBatchCancelBinaryOptionsOrders extends MsgBase< orderData.marketId = order.marketId orderData.orderHash = order.orderHash orderData.subaccountId = order.subaccountId + orderData.cid = order.cid || '' // TODO: Send order.orderMask instead when chain handles order mask properly. orderData.orderMask = InjectiveExchangeV1Beta1Exchange.OrderMask.ANY diff --git a/packages/sdk-ts/src/core/modules/exchange/msgs/MsgBatchCancelDerivativeOrders.spec.ts b/packages/sdk-ts/src/core/modules/exchange/msgs/MsgBatchCancelDerivativeOrders.spec.ts index e5e9f8c58..6e43a1eb5 100644 --- a/packages/sdk-ts/src/core/modules/exchange/msgs/MsgBatchCancelDerivativeOrders.spec.ts +++ b/packages/sdk-ts/src/core/modules/exchange/msgs/MsgBatchCancelDerivativeOrders.spec.ts @@ -9,11 +9,13 @@ const params: MsgBatchCancelDerivativeOrders['params'] = { marketId: mockFactory.injUsdtDerivativeMarket.marketId, orderHash: mockFactory.orderHash, subaccountId: mockFactory.subaccountId, + cid: '', }, { marketId: mockFactory.injUsdtDerivativeMarket.marketId, orderHash: mockFactory.orderHash2, subaccountId: mockFactory.subaccountId, + cid: '', }, ], } diff --git a/packages/sdk-ts/src/core/modules/exchange/msgs/MsgBatchCancelDerivativeOrders.ts b/packages/sdk-ts/src/core/modules/exchange/msgs/MsgBatchCancelDerivativeOrders.ts index 1aa1cc357..fe6309bb8 100644 --- a/packages/sdk-ts/src/core/modules/exchange/msgs/MsgBatchCancelDerivativeOrders.ts +++ b/packages/sdk-ts/src/core/modules/exchange/msgs/MsgBatchCancelDerivativeOrders.ts @@ -13,6 +13,7 @@ export declare namespace MsgBatchCancelDerivativeOrders { subaccountId: string orderHash: string orderMask?: InjectiveExchangeV1Beta1Exchange.OrderMask + cid?: string }[] } @@ -40,6 +41,7 @@ export default class MsgBatchCancelDerivativeOrders extends MsgBase< orderData.marketId = order.marketId orderData.orderHash = order.orderHash orderData.subaccountId = order.subaccountId + orderData.cid = order.cid || '' // TODO: Send order.orderMask instead when chain handles order mask properly. orderData.orderMask = InjectiveExchangeV1Beta1Exchange.OrderMask.ANY diff --git a/packages/sdk-ts/src/core/modules/exchange/msgs/MsgBatchCancelSpotOrders.spec.ts b/packages/sdk-ts/src/core/modules/exchange/msgs/MsgBatchCancelSpotOrders.spec.ts index 56fae6eee..5c1e12681 100644 --- a/packages/sdk-ts/src/core/modules/exchange/msgs/MsgBatchCancelSpotOrders.spec.ts +++ b/packages/sdk-ts/src/core/modules/exchange/msgs/MsgBatchCancelSpotOrders.spec.ts @@ -9,11 +9,13 @@ const params: MsgBatchCancelSpotOrders['params'] = { marketId: mockFactory.injUsdtSpotMarket.marketId, orderHash: mockFactory.orderHash, subaccountId: mockFactory.subaccountId, + cid: '', }, { marketId: mockFactory.injUsdtSpotMarket.marketId, orderHash: mockFactory.orderHash2, subaccountId: mockFactory.subaccountId, + cid: '', }, ], } diff --git a/packages/sdk-ts/src/core/modules/exchange/msgs/MsgBatchCancelSpotOrders.ts b/packages/sdk-ts/src/core/modules/exchange/msgs/MsgBatchCancelSpotOrders.ts index 5bec98fff..947fd45b4 100644 --- a/packages/sdk-ts/src/core/modules/exchange/msgs/MsgBatchCancelSpotOrders.ts +++ b/packages/sdk-ts/src/core/modules/exchange/msgs/MsgBatchCancelSpotOrders.ts @@ -13,6 +13,7 @@ export declare namespace MsgBatchCancelSpotOrders { subaccountId: string orderHash: string orderMask?: InjectiveExchangeV1Beta1Exchange.OrderMask + cid?: string }[] } @@ -40,6 +41,7 @@ export default class MsgBatchCancelSpotOrders extends MsgBase< orderData.marketId = order.marketId orderData.orderHash = order.orderHash orderData.subaccountId = order.subaccountId + orderData.cid = order.cid || '' // TODO: Send order.orderMask instead when chain handles order mask properly. orderData.orderMask = InjectiveExchangeV1Beta1Exchange.OrderMask.ANY diff --git a/packages/sdk-ts/src/core/modules/exchange/msgs/MsgBatchUpdateOrders.ts b/packages/sdk-ts/src/core/modules/exchange/msgs/MsgBatchUpdateOrders.ts index 67152f663..b6b2a1622 100644 --- a/packages/sdk-ts/src/core/modules/exchange/msgs/MsgBatchUpdateOrders.ts +++ b/packages/sdk-ts/src/core/modules/exchange/msgs/MsgBatchUpdateOrders.ts @@ -16,16 +16,19 @@ export declare namespace MsgBatchUpdateOrders { marketId: string subaccountId: string orderHash: string + cid?: string }[] derivativeOrdersToCancel?: { marketId: string subaccountId: string orderHash: string + cid?: string }[] binaryOptionsOrdersToCancel?: { marketId: string subaccountId: string orderHash: string + cid?: string }[] spotOrdersToCreate?: { orderType: InjectiveExchangeV1Beta1Exchange.OrderType @@ -34,6 +37,7 @@ export declare namespace MsgBatchUpdateOrders { feeRecipient: string price: string quantity: string + cid?: string }[] derivativeOrdersToCreate?: { orderType: InjectiveExchangeV1Beta1Exchange.OrderType @@ -43,6 +47,7 @@ export declare namespace MsgBatchUpdateOrders { price: string margin: string quantity: string + cid?: string }[] binaryOptionsOrdersToCreate?: { orderType: InjectiveExchangeV1Beta1Exchange.OrderType @@ -52,6 +57,7 @@ export declare namespace MsgBatchUpdateOrders { price: string margin: string quantity: string + cid?: string }[] injectiveAddress: string } @@ -104,11 +110,12 @@ export default class MsgBatchUpdateOrders extends MsgBase< if (params.spotOrdersToCancel && params.spotOrdersToCancel.length > 0) { const orderData = params.spotOrdersToCancel.map( - ({ marketId, subaccountId, orderHash }) => { + ({ marketId, subaccountId, orderHash, cid }) => { const orderData = InjectiveExchangeV1Beta1Tx.OrderData.create() orderData.marketId = marketId orderData.subaccountId = subaccountId orderData.orderHash = orderHash + orderData.cid = cid || '' return orderData }, @@ -122,11 +129,12 @@ export default class MsgBatchUpdateOrders extends MsgBase< params.derivativeOrdersToCancel.length > 0 ) { const orderData = params.derivativeOrdersToCancel.map( - ({ marketId, subaccountId, orderHash }) => { + ({ marketId, subaccountId, orderHash, cid }) => { const orderData = InjectiveExchangeV1Beta1Tx.OrderData.create() orderData.marketId = marketId orderData.subaccountId = subaccountId orderData.orderHash = orderHash + orderData.cid = cid || '' return orderData }, @@ -139,11 +147,12 @@ export default class MsgBatchUpdateOrders extends MsgBase< params.binaryOptionsOrdersToCancel.length > 0 ) { const orderData = params.binaryOptionsOrdersToCancel.map( - ({ marketId, subaccountId, orderHash }) => { + ({ marketId, subaccountId, orderHash, cid }) => { const orderData = InjectiveExchangeV1Beta1Tx.OrderData.create() orderData.marketId = marketId orderData.subaccountId = subaccountId orderData.orderHash = orderHash + orderData.cid = cid || '' return orderData }, @@ -168,6 +177,7 @@ export default class MsgBatchUpdateOrders extends MsgBase< orderInfo.feeRecipient = paramsFromArgs.feeRecipient orderInfo.price = paramsFromArgs.price orderInfo.quantity = paramsFromArgs.quantity + orderInfo.cid = orderInfo.cid || '' const order = InjectiveExchangeV1Beta1Exchange.SpotOrder.create() order.marketId = paramsFromArgs.marketId @@ -204,6 +214,7 @@ export default class MsgBatchUpdateOrders extends MsgBase< orderInfo.feeRecipient = paramsFromArgs.feeRecipient orderInfo.price = paramsFromArgs.price orderInfo.quantity = paramsFromArgs.quantity + orderInfo.cid = orderInfo.cid || '' const order = InjectiveExchangeV1Beta1Exchange.DerivativeOrder.create() order.marketId = paramsFromArgs.marketId @@ -239,6 +250,7 @@ export default class MsgBatchUpdateOrders extends MsgBase< orderInfo.feeRecipient = paramsFromArgs.feeRecipient orderInfo.price = paramsFromArgs.price orderInfo.quantity = paramsFromArgs.quantity + orderInfo.cid = orderInfo.cid || '' const order = InjectiveExchangeV1Beta1Exchange.DerivativeOrder.create() order.marketId = paramsFromArgs.marketId diff --git a/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCancelBinaryOptionsOrder.spec.ts b/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCancelBinaryOptionsOrder.spec.ts index 9ef973129..4596ee182 100644 --- a/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCancelBinaryOptionsOrder.spec.ts +++ b/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCancelBinaryOptionsOrder.spec.ts @@ -7,6 +7,7 @@ const params: MsgCancelBinaryOptionsOrder['params'] = { marketId: mockFactory.injUsdtDerivativeMarket.marketId, orderHash: mockFactory.orderHash, subaccountId: mockFactory.subaccountId, + cid: '', } const protoType = '/injective.exchange.v1beta1.MsgCancelBinaryOptionsOrder' @@ -16,6 +17,7 @@ const protoParams = { marketId: params.marketId, orderHash: params.orderHash, subaccountId: params.subaccountId, + cid: params.cid, orderMask: 1, } const protoParamsAmino = snakecaseKeys(protoParams) diff --git a/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCancelBinaryOptionsOrder.ts b/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCancelBinaryOptionsOrder.ts index 61762663f..7182dffdd 100644 --- a/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCancelBinaryOptionsOrder.ts +++ b/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCancelBinaryOptionsOrder.ts @@ -12,6 +12,7 @@ export declare namespace MsgCancelBinaryOptionsOrder { injectiveAddress: string orderHash: string orderMask?: InjectiveExchangeV1Beta1Exchange.OrderMask + cid?: string } export type Proto = InjectiveExchangeV1Beta1Tx.MsgCancelBinaryOptionsOrder @@ -39,6 +40,7 @@ export default class MsgCancelBinaryOptionsOrder extends MsgBase< message.marketId = params.marketId message.orderHash = params.orderHash message.subaccountId = params.subaccountId + message.cid = params.cid || '' // TODO: Send order.orderMask instead when chain handles order mask properly. message.orderMask = InjectiveExchangeV1Beta1Exchange.OrderMask.ANY diff --git a/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCancelDerivativeOrder.spec.ts b/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCancelDerivativeOrder.spec.ts index c4b32522a..96b7d09b9 100644 --- a/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCancelDerivativeOrder.spec.ts +++ b/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCancelDerivativeOrder.spec.ts @@ -7,6 +7,7 @@ const params: MsgCancelDerivativeOrder['params'] = { marketId: mockFactory.injUsdtDerivativeMarket.marketId, orderHash: mockFactory.orderHash, subaccountId: mockFactory.subaccountId, + cid: '', } const protoType = '/injective.exchange.v1beta1.MsgCancelDerivativeOrder' @@ -17,6 +18,7 @@ const protoParams = { orderHash: params.orderHash, subaccountId: params.subaccountId, orderMask: 1, + cid: params.cid, } const protoParamsAmino = snakecaseKeys(protoParams) diff --git a/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCancelDerivativeOrder.ts b/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCancelDerivativeOrder.ts index d860699c3..3092ba310 100644 --- a/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCancelDerivativeOrder.ts +++ b/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCancelDerivativeOrder.ts @@ -12,6 +12,7 @@ export declare namespace MsgCancelDerivativeOrder { injectiveAddress: string orderHash: string orderMask?: InjectiveExchangeV1Beta1Exchange.OrderMask + cid?: string } export type Proto = InjectiveExchangeV1Beta1Tx.MsgCancelDerivativeOrder @@ -35,6 +36,7 @@ export default class MsgCancelDerivativeOrder extends MsgBase< message.marketId = params.marketId message.orderHash = params.orderHash message.subaccountId = params.subaccountId + message.cid = params.cid || '' // TODO: Send order.orderMask instead when chain handles order mask properly. message.orderMask = InjectiveExchangeV1Beta1Exchange.OrderMask.ANY diff --git a/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCancelSpotOrder.spec.ts b/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCancelSpotOrder.spec.ts index 0a65a8376..56c228f5a 100644 --- a/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCancelSpotOrder.spec.ts +++ b/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCancelSpotOrder.spec.ts @@ -7,6 +7,7 @@ const params: MsgCancelSpotOrder['params'] = { marketId: mockFactory.injUsdtSpotMarket.marketId, orderHash: mockFactory.orderHash, subaccountId: mockFactory.subaccountId, + cid: '', } const protoType = '/injective.exchange.v1beta1.MsgCancelSpotOrder' @@ -16,6 +17,7 @@ const protoParams = { marketId: params.marketId, orderHash: params.orderHash, subaccountId: params.subaccountId, + cid: params.cid, } const protoParamsAmino = snakecaseKeys(protoParams) diff --git a/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCancelSpotOrder.ts b/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCancelSpotOrder.ts index 5d72761a2..28aac2f58 100644 --- a/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCancelSpotOrder.ts +++ b/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCancelSpotOrder.ts @@ -8,6 +8,7 @@ export declare namespace MsgCancelSpotOrder { subaccountId: string injectiveAddress: string orderHash: string + cid?: string } export type Proto = InjectiveExchangeV1Beta1Tx.MsgCancelSpotOrder @@ -32,6 +33,7 @@ export default class MsgCancelSpotOrder extends MsgBase< message.marketId = params.marketId message.orderHash = params.orderHash message.subaccountId = params.subaccountId + message.cid = params.cid || '' // TODO: message.setOrderMask does not exist yet, enable this once it does. diff --git a/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCreateBinaryOptionsLimitOrder.spec.ts b/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCreateBinaryOptionsLimitOrder.spec.ts index 48dabfa72..c151f8447 100644 --- a/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCreateBinaryOptionsLimitOrder.spec.ts +++ b/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCreateBinaryOptionsLimitOrder.spec.ts @@ -12,6 +12,7 @@ const params: MsgCreateBinaryOptionsLimitOrder['params'] = { quantity: '100', subaccountId: mockFactory.subaccountId, triggerPrice: '0', + cid: '', } const protoType = '/injective.exchange.v1beta1.MsgCreateBinaryOptionsLimitOrder' @@ -25,6 +26,7 @@ const protoParams = { price: params.price, quantity: params.quantity, subaccountId: params.subaccountId, + cid: params.cid, }, orderType: params.orderType, margin: params.margin, diff --git a/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCreateBinaryOptionsLimitOrder.ts b/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCreateBinaryOptionsLimitOrder.ts index 8a01b64e1..775182e32 100644 --- a/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCreateBinaryOptionsLimitOrder.ts +++ b/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCreateBinaryOptionsLimitOrder.ts @@ -17,6 +17,7 @@ export declare namespace MsgCreateBinaryOptionsLimitOrder { price: string margin: string quantity: string + cid?: string } export type Proto = @@ -29,6 +30,7 @@ const createLimitOrder = (params: MsgCreateBinaryOptionsLimitOrder.Params) => { orderInfo.feeRecipient = params.feeRecipient orderInfo.price = params.price orderInfo.quantity = params.quantity + orderInfo.cid = params.cid || '' const derivativeOrder = InjectiveExchangeV1Beta1Exchange.DerivativeOrder.create() diff --git a/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCreateBinaryOptionsMarketOrder.spec.ts b/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCreateBinaryOptionsMarketOrder.spec.ts index 4bc321760..7fcc287c8 100644 --- a/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCreateBinaryOptionsMarketOrder.spec.ts +++ b/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCreateBinaryOptionsMarketOrder.spec.ts @@ -11,6 +11,7 @@ const params: MsgCreateBinaryOptionsMarketOrder['params'] = { price: '1765000', quantity: '100', subaccountId: mockFactory.subaccountId, + cid: '', triggerPrice: '0', } @@ -27,6 +28,7 @@ const protoParams = { price: params.price, quantity: params.quantity, subaccountId: params.subaccountId, + cid: params.cid, }, orderType: params.orderType, triggerPrice: params.triggerPrice, diff --git a/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCreateBinaryOptionsMarketOrder.ts b/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCreateBinaryOptionsMarketOrder.ts index f07c5365e..befd8fc1e 100644 --- a/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCreateBinaryOptionsMarketOrder.ts +++ b/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCreateBinaryOptionsMarketOrder.ts @@ -17,6 +17,7 @@ export declare namespace MsgCreateBinaryOptionsMarketOrder { price: string margin: string quantity: string + cid?: string } export type Proto = @@ -31,6 +32,7 @@ const createMarketOrder = ( orderInfo.feeRecipient = params.feeRecipient orderInfo.price = params.price orderInfo.quantity = params.quantity + orderInfo.cid = params.cid || '' const derivativeOrder = InjectiveExchangeV1Beta1Exchange.DerivativeOrder.create() diff --git a/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCreateDerivativeLimitOrder.spec.ts b/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCreateDerivativeLimitOrder.spec.ts index 9f63d77e4..e00f479d1 100644 --- a/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCreateDerivativeLimitOrder.spec.ts +++ b/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCreateDerivativeLimitOrder.spec.ts @@ -11,6 +11,7 @@ const params: MsgCreateDerivativeLimitOrder['params'] = { price: '1500000', quantity: '100', subaccountId: mockFactory.subaccountId, + cid: '', triggerPrice: '0', } @@ -25,6 +26,7 @@ const protoParams = { price: params.price, quantity: params.quantity, subaccountId: params.subaccountId, + cid: params.cid, }, orderType: params.orderType, margin: params.margin, diff --git a/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCreateDerivativeLimitOrder.ts b/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCreateDerivativeLimitOrder.ts index 7ffc9cfa9..dafc3acd0 100644 --- a/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCreateDerivativeLimitOrder.ts +++ b/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCreateDerivativeLimitOrder.ts @@ -17,6 +17,7 @@ export declare namespace MsgCreateDerivativeLimitOrder { price: string margin: string quantity: string + cid?: string } export type Proto = InjectiveExchangeV1Beta1Tx.MsgCreateDerivativeLimitOrder @@ -28,6 +29,7 @@ const createLimitOrder = (params: MsgCreateDerivativeLimitOrder.Params) => { orderInfo.feeRecipient = params.feeRecipient orderInfo.price = params.price orderInfo.quantity = params.quantity + orderInfo.cid = params.cid || '' const derivativeOrder = InjectiveExchangeV1Beta1Exchange.DerivativeOrder.create() diff --git a/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCreateDerivativeMarketOrder.spec.ts b/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCreateDerivativeMarketOrder.spec.ts index efe5dd913..20ced2326 100644 --- a/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCreateDerivativeMarketOrder.spec.ts +++ b/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCreateDerivativeMarketOrder.spec.ts @@ -11,6 +11,7 @@ const params: MsgCreateDerivativeMarketOrder['params'] = { price: '1765000', quantity: '100', subaccountId: mockFactory.subaccountId, + cid: '', triggerPrice: '0', } @@ -25,6 +26,7 @@ const protoParams = { price: params.price, quantity: params.quantity, subaccountId: params.subaccountId, + cid: params.cid, }, orderType: params.orderType, margin: params.margin, diff --git a/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCreateDerivativeMarketOrder.ts b/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCreateDerivativeMarketOrder.ts index 419bbff7c..abb101c3a 100644 --- a/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCreateDerivativeMarketOrder.ts +++ b/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCreateDerivativeMarketOrder.ts @@ -17,6 +17,7 @@ export declare namespace MsgCreateDerivativeMarketOrder { price: string margin: string quantity: string + cid?: string } export type Proto = InjectiveExchangeV1Beta1Tx.MsgCreateDerivativeMarketOrder @@ -28,6 +29,7 @@ const createMarketOrder = (params: MsgCreateDerivativeMarketOrder.Params) => { orderInfo.feeRecipient = params.feeRecipient orderInfo.price = params.price orderInfo.quantity = params.quantity + orderInfo.cid = params.cid || '' const derivativeOrder = InjectiveExchangeV1Beta1Exchange.DerivativeOrder.create() diff --git a/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCreateSpotLimitOrder.spec.ts b/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCreateSpotLimitOrder.spec.ts index 47edc3af6..b5556b480 100644 --- a/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCreateSpotLimitOrder.spec.ts +++ b/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCreateSpotLimitOrder.spec.ts @@ -10,6 +10,7 @@ const params: MsgCreateSpotLimitOrder['params'] = { price: '1500000', quantity: '100', subaccountId: mockFactory.subaccountId, + cid: '', triggerPrice: '0', } @@ -24,6 +25,7 @@ const protoParams = { price: params.price, quantity: params.quantity, subaccountId: params.subaccountId, + cid: params.cid, }, orderType: params.orderType, triggerPrice: params.triggerPrice, diff --git a/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCreateSpotLimitOrder.ts b/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCreateSpotLimitOrder.ts index efc9dd2b9..3c3bdfa3e 100644 --- a/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCreateSpotLimitOrder.ts +++ b/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCreateSpotLimitOrder.ts @@ -16,6 +16,7 @@ export declare namespace MsgCreateSpotLimitOrder { feeRecipient: string price: string quantity: string + cid?: string } export type Proto = InjectiveExchangeV1Beta1Tx.MsgCreateSpotLimitOrder @@ -27,6 +28,7 @@ const createLimitOrder = (params: MsgCreateSpotLimitOrder.Params) => { orderInfo.feeRecipient = params.feeRecipient orderInfo.price = params.price orderInfo.quantity = params.quantity + orderInfo.cid = params.cid || '' const spotOrder = InjectiveExchangeV1Beta1Exchange.SpotOrder.create() spotOrder.marketId = params.marketId diff --git a/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCreateSpotMarketOrder.spec.ts b/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCreateSpotMarketOrder.spec.ts index fc6ea5d72..00ef442d2 100644 --- a/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCreateSpotMarketOrder.spec.ts +++ b/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCreateSpotMarketOrder.spec.ts @@ -10,6 +10,7 @@ const params: MsgCreateSpotMarketOrder['params'] = { price: '1765000', quantity: '100', subaccountId: mockFactory.subaccountId, + cid: '', triggerPrice: '0', } @@ -24,6 +25,7 @@ const protoParams = { price: params.price, quantity: params.quantity, subaccountId: params.subaccountId, + cid: params.cid, }, orderType: params.orderType, triggerPrice: params.triggerPrice, diff --git a/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCreateSpotMarketOrder.ts b/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCreateSpotMarketOrder.ts index 7b4afd516..3069923c6 100644 --- a/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCreateSpotMarketOrder.ts +++ b/packages/sdk-ts/src/core/modules/exchange/msgs/MsgCreateSpotMarketOrder.ts @@ -16,6 +16,7 @@ export declare namespace MsgCreateSpotMarketOrder { feeRecipient: string price: string quantity: string + cid?: string } export type Proto = InjectiveExchangeV1Beta1Tx.MsgCreateSpotMarketOrder @@ -27,6 +28,7 @@ const createMarketOrder = (params: MsgCreateSpotMarketOrder.Params) => { orderInfo.feeRecipient = params.feeRecipient orderInfo.price = params.price orderInfo.quantity = params.quantity + orderInfo.cid = params.cid || '' const spotOrder = InjectiveExchangeV1Beta1Exchange.SpotOrder.create() spotOrder.marketId = params.marketId diff --git a/packages/sdk-ts/src/core/modules/feegrant/msgs/MsgGrantAllowance.ts b/packages/sdk-ts/src/core/modules/feegrant/msgs/MsgGrantAllowance.ts index 8c325b448..f00d40760 100644 --- a/packages/sdk-ts/src/core/modules/feegrant/msgs/MsgGrantAllowance.ts +++ b/packages/sdk-ts/src/core/modules/feegrant/msgs/MsgGrantAllowance.ts @@ -60,10 +60,6 @@ export default class MsgGrantAllowance extends MsgBase< message.grantee = params.grantee message.granter = params.granter message.allowance = allowance - console.log({ - message, - fromJSON: CosmosFeegrantV1Beta1Tx.MsgGrantAllowance.fromJSON(message), - }) return CosmosFeegrantV1Beta1Tx.MsgGrantAllowance.fromJSON(message) } diff --git a/packages/sdk-ts/src/core/modules/gov/ProposalContentDecomposer.ts b/packages/sdk-ts/src/core/modules/gov/ProposalContentDecomposer.ts index 86487c469..e29a5ee6f 100644 --- a/packages/sdk-ts/src/core/modules/gov/ProposalContentDecomposer.ts +++ b/packages/sdk-ts/src/core/modules/gov/ProposalContentDecomposer.ts @@ -3,7 +3,7 @@ import { CosmosGovV1Beta1Gov, CosmosParamsV1Beta1Params, CosmosUpgradeV1Beta1Upgrade, - InjectiveExchangeV1Beta1Tx, + InjectiveExchangeV1Beta1Proposal, InjectiveOracleV1Beta1Proposal, } from '@injectivelabs/core-proto-ts' @@ -45,49 +45,49 @@ export class ProposalDecomposer { } static spotMarketLaunch(content: Uint8Array) { - return InjectiveExchangeV1Beta1Tx.SpotMarketLaunchProposal.decode(content) + return InjectiveExchangeV1Beta1Proposal.SpotMarketLaunchProposal.decode(content) } static exchangeEnableProposal(content: Uint8Array) { - return InjectiveExchangeV1Beta1Tx.ExchangeEnableProposal.decode(content) + return InjectiveExchangeV1Beta1Proposal.ExchangeEnableProposal.decode(content) } static spotMarketUpdate(content: Uint8Array) { - return InjectiveExchangeV1Beta1Tx.SpotMarketParamUpdateProposal.decode( + return InjectiveExchangeV1Beta1Proposal.SpotMarketParamUpdateProposal.decode( content, ) } static perpetualMarketLaunch(content: Uint8Array) { - return InjectiveExchangeV1Beta1Tx.PerpetualMarketLaunchProposal.decode( + return InjectiveExchangeV1Beta1Proposal.PerpetualMarketLaunchProposal.decode( content, ) } static expiryFuturesMarketLaunch(content: Uint8Array) { - return InjectiveExchangeV1Beta1Tx.ExpiryFuturesMarketLaunchProposal.decode( + return InjectiveExchangeV1Beta1Proposal.ExpiryFuturesMarketLaunchProposal.decode( content, ) } static derivativeMarketUpdate(content: Uint8Array) { - return InjectiveExchangeV1Beta1Tx.DerivativeMarketParamUpdateProposal.decode( + return InjectiveExchangeV1Beta1Proposal.DerivativeMarketParamUpdateProposal.decode( content, ) } static FeeDiscount(content: Uint8Array) { - return InjectiveExchangeV1Beta1Tx.FeeDiscountProposal.decode(content) + return InjectiveExchangeV1Beta1Proposal.FeeDiscountProposal.decode(content) } static TradingRewardCampaignLaunch(content: Uint8Array) { - return InjectiveExchangeV1Beta1Tx.TradingRewardCampaignLaunchProposal.decode( + return InjectiveExchangeV1Beta1Proposal.TradingRewardCampaignLaunchProposal.decode( content, ) } static TradingRewardCampaignUpdate(content: Uint8Array) { - return InjectiveExchangeV1Beta1Tx.TradingRewardCampaignUpdateProposal.decode( + return InjectiveExchangeV1Beta1Proposal.TradingRewardCampaignUpdateProposal.decode( content, ) } diff --git a/packages/sdk-ts/src/core/modules/gov/msgs/MsgDeposit.spec.ts b/packages/sdk-ts/src/core/modules/gov/msgs/MsgDeposit.spec.ts index 6ec67a754..4f2b56484 100644 --- a/packages/sdk-ts/src/core/modules/gov/msgs/MsgDeposit.spec.ts +++ b/packages/sdk-ts/src/core/modules/gov/msgs/MsgDeposit.spec.ts @@ -13,7 +13,7 @@ const params: MsgDeposit['params'] = { } const protoType = '/cosmos.gov.v1beta1.MsgDeposit' -const protoTypeAmino = 'cosmos-sdk/v1/MsgDeposit' +const protoTypeAmino = 'cosmos-sdk/MsgDeposit' const protoParams = { proposalId: params.proposalId.toString(), depositor: params.depositor, diff --git a/packages/sdk-ts/src/core/modules/gov/msgs/MsgSubmitProposalExpiryFuturesMarketLaunch.ts b/packages/sdk-ts/src/core/modules/gov/msgs/MsgSubmitProposalExpiryFuturesMarketLaunch.ts index 982eb8bd4..214c7343d 100644 --- a/packages/sdk-ts/src/core/modules/gov/msgs/MsgSubmitProposalExpiryFuturesMarketLaunch.ts +++ b/packages/sdk-ts/src/core/modules/gov/msgs/MsgSubmitProposalExpiryFuturesMarketLaunch.ts @@ -3,7 +3,7 @@ import { GoogleProtobufAny, CosmosGovV1Beta1Tx, CosmosBaseV1Beta1Coin, - InjectiveExchangeV1Beta1Tx, + InjectiveExchangeV1Beta1Proposal, InjectiveOracleV1Beta1Oracle, } from '@injectivelabs/core-proto-ts' import { MsgBase } from '../../MsgBase' @@ -13,7 +13,7 @@ const createProposalExpiryFuturesMarketLaunch = ( params: MsgSubmitProposalExpiryFuturesMarketLaunch.Params, ) => { const content = - InjectiveExchangeV1Beta1Tx.ExpiryFuturesMarketLaunchProposal.create() + InjectiveExchangeV1Beta1Proposal.ExpiryFuturesMarketLaunchProposal.create() content.title = params.market.title content.description = params.market.description content.quoteDenom = params.market.quoteDenom @@ -30,7 +30,7 @@ const createProposalExpiryFuturesMarketLaunch = ( content.minPriceTickSize = params.market.minPriceTickSize content.minQuantityTickSize = params.market.minQuantityTickSize - return InjectiveExchangeV1Beta1Tx.ExpiryFuturesMarketLaunchProposal.fromPartial( + return InjectiveExchangeV1Beta1Proposal.ExpiryFuturesMarketLaunchProposal.fromPartial( content, ) } @@ -116,7 +116,7 @@ export default class MsgSubmitProposalExpiryFuturesMarketLaunch extends MsgBase< const contentAny = GoogleProtobufAny.Any.create() contentAny.value = - InjectiveExchangeV1Beta1Tx.ExpiryFuturesMarketLaunchProposal.encode( + InjectiveExchangeV1Beta1Proposal.ExpiryFuturesMarketLaunchProposal.encode( content, ).finish() contentAny.typeUrl = diff --git a/packages/sdk-ts/src/core/modules/gov/msgs/MsgSubmitProposalPerpetualMarketLaunch.ts b/packages/sdk-ts/src/core/modules/gov/msgs/MsgSubmitProposalPerpetualMarketLaunch.ts index 017af5698..3f4eb62fc 100644 --- a/packages/sdk-ts/src/core/modules/gov/msgs/MsgSubmitProposalPerpetualMarketLaunch.ts +++ b/packages/sdk-ts/src/core/modules/gov/msgs/MsgSubmitProposalPerpetualMarketLaunch.ts @@ -3,7 +3,7 @@ import { GoogleProtobufAny, CosmosGovV1Beta1Tx, CosmosBaseV1Beta1Coin, - InjectiveExchangeV1Beta1Tx, + InjectiveExchangeV1Beta1Proposal, InjectiveOracleV1Beta1Oracle, } from '@injectivelabs/core-proto-ts' import { MsgBase } from '../../MsgBase' @@ -48,7 +48,7 @@ const createPerpetualMarketLaunch = ( params: MsgSubmitProposalPerpetualMarketLaunch.Params, ) => { const content = - InjectiveExchangeV1Beta1Tx.PerpetualMarketLaunchProposal.create() + InjectiveExchangeV1Beta1Proposal.PerpetualMarketLaunchProposal.create() content.title = params.market.title content.description = params.market.description @@ -65,7 +65,7 @@ const createPerpetualMarketLaunch = ( content.minPriceTickSize = params.market.minPriceTickSize content.minQuantityTickSize = params.market.minQuantityTickSize - return InjectiveExchangeV1Beta1Tx.PerpetualMarketLaunchProposal.fromPartial( + return InjectiveExchangeV1Beta1Proposal.PerpetualMarketLaunchProposal.fromPartial( content, ) } @@ -115,7 +115,7 @@ export default class MsgSubmitProposalPerpetualMarketLaunch extends MsgBase< const contentAny = GoogleProtobufAny.Any.create() contentAny.value = - InjectiveExchangeV1Beta1Tx.PerpetualMarketLaunchProposal.encode( + InjectiveExchangeV1Beta1Proposal.PerpetualMarketLaunchProposal.encode( content, ).finish() contentAny.typeUrl = diff --git a/packages/sdk-ts/src/core/modules/gov/msgs/MsgSubmitProposalSpotMarketLaunch.ts b/packages/sdk-ts/src/core/modules/gov/msgs/MsgSubmitProposalSpotMarketLaunch.ts index 37821f98a..99260ad5a 100644 --- a/packages/sdk-ts/src/core/modules/gov/msgs/MsgSubmitProposalSpotMarketLaunch.ts +++ b/packages/sdk-ts/src/core/modules/gov/msgs/MsgSubmitProposalSpotMarketLaunch.ts @@ -3,7 +3,7 @@ import { GoogleProtobufAny, CosmosGovV1Beta1Tx, CosmosBaseV1Beta1Coin, - InjectiveExchangeV1Beta1Tx, + InjectiveExchangeV1Beta1Proposal, } from '@injectivelabs/core-proto-ts' import { MsgBase } from '../../MsgBase' import { amountToCosmosSdkDecAmount } from '../../../../utils/numbers' @@ -41,7 +41,7 @@ export declare namespace MsgSubmitProposalSpotMarketLaunch { const createSpotMarketLaunchContent = ( params: MsgSubmitProposalSpotMarketLaunch.Params, ) => { - const content = InjectiveExchangeV1Beta1Tx.SpotMarketLaunchProposal.create() + const content = InjectiveExchangeV1Beta1Proposal.SpotMarketLaunchProposal.create() content.title = params.market.title content.description = params.market.description @@ -53,7 +53,7 @@ const createSpotMarketLaunchContent = ( content.makerFeeRate = params.market.makerFeeRate content.takerFeeRate = params.market.makerFeeRate - return InjectiveExchangeV1Beta1Tx.SpotMarketLaunchProposal.fromPartial( + return InjectiveExchangeV1Beta1Proposal.SpotMarketLaunchProposal.fromPartial( content, ) } @@ -101,7 +101,7 @@ export default class MsgSubmitProposalSpotMarketLaunch extends MsgBase< const contentAny = GoogleProtobufAny.Any.create() contentAny.value = - InjectiveExchangeV1Beta1Tx.SpotMarketLaunchProposal.encode( + InjectiveExchangeV1Beta1Proposal.SpotMarketLaunchProposal.encode( content, ).finish() contentAny.typeUrl = proposalType diff --git a/packages/sdk-ts/src/core/modules/gov/msgs/MsgSubmitProposalSpotMarketParamUpdate.ts b/packages/sdk-ts/src/core/modules/gov/msgs/MsgSubmitProposalSpotMarketParamUpdate.ts index b4413f753..8cd37d9ec 100644 --- a/packages/sdk-ts/src/core/modules/gov/msgs/MsgSubmitProposalSpotMarketParamUpdate.ts +++ b/packages/sdk-ts/src/core/modules/gov/msgs/MsgSubmitProposalSpotMarketParamUpdate.ts @@ -3,7 +3,7 @@ import { GoogleProtobufAny, CosmosGovV1Beta1Tx, CosmosBaseV1Beta1Coin, - InjectiveExchangeV1Beta1Tx, + InjectiveExchangeV1Beta1Proposal, InjectiveExchangeV1Beta1Exchange, } from '@injectivelabs/core-proto-ts' import { MsgBase } from '../../MsgBase' @@ -13,7 +13,7 @@ const createSpotMarketParamUpdate = ( params: MsgSubmitProposalSpotMarketParamUpdate.Params, ) => { const content = - InjectiveExchangeV1Beta1Tx.SpotMarketParamUpdateProposal.create() + InjectiveExchangeV1Beta1Proposal.SpotMarketParamUpdateProposal.create() content.title = params.market.title content.description = params.market.description content.makerFeeRate = params.market.makerFeeRate @@ -24,7 +24,7 @@ const createSpotMarketParamUpdate = ( content.minPriceTickSize = params.market.minPriceTickSize content.minQuantityTickSize = params.market.minQuantityTickSize - return InjectiveExchangeV1Beta1Tx.SpotMarketParamUpdateProposal.fromPartial( + return InjectiveExchangeV1Beta1Proposal.SpotMarketParamUpdateProposal.fromPartial( content, ) } @@ -101,7 +101,7 @@ export default class MsgSubmitProposalSpotMarketParamUpdate extends MsgBase< const contentAny = GoogleProtobufAny.Any.create() contentAny.value = - InjectiveExchangeV1Beta1Tx.SpotMarketParamUpdateProposal.encode( + InjectiveExchangeV1Beta1Proposal.SpotMarketParamUpdateProposal.encode( content, ).finish() contentAny.typeUrl = diff --git a/packages/sdk-ts/src/core/modules/ibc/msgs/MsgTransferCosmjs.ts b/packages/sdk-ts/src/core/modules/ibc/msgs/MsgTransferCosmjs.ts index 53ff11d9a..c023066c7 100644 --- a/packages/sdk-ts/src/core/modules/ibc/msgs/MsgTransferCosmjs.ts +++ b/packages/sdk-ts/src/core/modules/ibc/msgs/MsgTransferCosmjs.ts @@ -23,6 +23,8 @@ export declare namespace MsgTransferCosmjs { /** * @category Messages + * + * @deprected use MsgTransfer with SIGN_DIRECT and a Cosmos wallet */ export default class MsgTransferCosmjs { params: MsgTransferCosmjs.Params diff --git a/packages/sdk-ts/src/core/modules/msgs.ts b/packages/sdk-ts/src/core/modules/msgs.ts index 6928dc4cd..3ce85b6ec 100644 --- a/packages/sdk-ts/src/core/modules/msgs.ts +++ b/packages/sdk-ts/src/core/modules/msgs.ts @@ -37,6 +37,7 @@ import MsgUndelegate from './staking/msgs/MsgUndelegate' import MsgEditValidator from './staking/msgs/MsgEditValidator' import MsgCreateValidator from './staking/msgs/MsgCreateValidator' import MsgBeginRedelegate from './staking/msgs/MsgBeginRedelegate' +import MsgCancelUnbondingDelegation from './staking/msgs/MsgCancelUnbondingDelegation' import MsgExecuteContract from './wasm/msgs/MsgExecuteContract' import MsgExecuteContractCompat from './wasm/msgs/MsgExecuteContractCompat' import MsgMigrateContract from './wasm/msgs/MsgMigrateContract' @@ -89,6 +90,7 @@ export type Msgs = | MsgDelegate | MsgUndelegate | MsgBeginRedelegate + | MsgCancelUnbondingDelegation | MsgExecuteContract | MsgExecuteContractCompat | MsgMigrateContract diff --git a/packages/sdk-ts/src/core/modules/staking/index.ts b/packages/sdk-ts/src/core/modules/staking/index.ts index bef235832..a850f745c 100644 --- a/packages/sdk-ts/src/core/modules/staking/index.ts +++ b/packages/sdk-ts/src/core/modules/staking/index.ts @@ -3,6 +3,7 @@ import MsgUndelegate from './msgs/MsgUndelegate' import MsgEditValidator from './msgs/MsgEditValidator' import MsgCreateValidator from './msgs/MsgCreateValidator' import MsgBeginRedelegate from './msgs/MsgBeginRedelegate' +import MsgCancelUnbondingDelegation from './msgs/MsgCancelUnbondingDelegation' export { MsgDelegate, @@ -10,4 +11,5 @@ export { MsgEditValidator, MsgCreateValidator, MsgBeginRedelegate, + MsgCancelUnbondingDelegation, } diff --git a/packages/sdk-ts/src/core/modules/staking/msgs/MsgCancelUnbondingDelegation.spec.ts b/packages/sdk-ts/src/core/modules/staking/msgs/MsgCancelUnbondingDelegation.spec.ts new file mode 100644 index 000000000..c31fcbe40 --- /dev/null +++ b/packages/sdk-ts/src/core/modules/staking/msgs/MsgCancelUnbondingDelegation.spec.ts @@ -0,0 +1,86 @@ +import { BigNumberInBase } from '@injectivelabs/utils' +import MsgCancelUnbondingDelegation from './MsgCancelUnbondingDelegation' +import { mockFactory } from '@injectivelabs/test-utils' +import snakecaseKeys from 'snakecase-keys' + +const params: MsgCancelUnbondingDelegation['params'] = { + validatorAddress: mockFactory.validatorAddress, + delegatorAddress: mockFactory.injectiveAddress, + amount: { + amount: new BigNumberInBase(1).toFixed(), + denom: 'inj', + }, + creationHeight: '123456', +} + +const protoType = '/cosmos.staking.v1beta1.MsgCancelUnbondingDelegation' +const protoTypeAmino = 'cosmos-sdk/MsgCancelUnbondingDelegation' +const protoParams = { + validatorAddress: params.validatorAddress, + delegatorAddress: params.delegatorAddress, + amount: params.amount, + creationHeight: params.creationHeight, +} +const protoParamsAmino = snakecaseKeys(protoParams) +const message = MsgCancelUnbondingDelegation.fromJSON(params) + +describe('MsgCancelUnbondingDelegation', () => { + 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: protoTypeAmino, + value: protoParamsAmino, + }) + }) + + it('generates proper Eip712 types', () => { + const eip712Types = message.toEip712Types() + + expect(Object.fromEntries(eip712Types)).toStrictEqual({ + TypeAmount: [ + { name: 'denom', type: 'string' }, + { name: 'amount', type: 'string' }, + ], + MsgValue: [ + { name: 'delegator_address', type: 'string' }, + { name: 'validator_address', type: 'string' }, + { name: 'amount', type: 'TypeAmount' }, + { name: 'creation_height', type: 'int64' }, + ], + }) + }) + + it('generates proper Eip712 values', () => { + const eip712 = message.toEip712() + + expect(eip712).toStrictEqual({ + type: protoTypeAmino, + value: protoParamsAmino, + }) + }) + + it('generates proper web3', () => { + const web3 = message.toWeb3() + + expect(web3).toStrictEqual({ + '@type': protoType, + ...protoParamsAmino, + }) + }) +}) diff --git a/packages/sdk-ts/src/core/modules/staking/msgs/MsgCancelUnbondingDelegation.ts b/packages/sdk-ts/src/core/modules/staking/msgs/MsgCancelUnbondingDelegation.ts new file mode 100644 index 000000000..eabe49cec --- /dev/null +++ b/packages/sdk-ts/src/core/modules/staking/msgs/MsgCancelUnbondingDelegation.ts @@ -0,0 +1,98 @@ +import { MsgBase } from '../../MsgBase' +import snakecaseKeys from 'snakecase-keys' +import { + CosmosBaseV1Beta1Coin, + CosmosStakingV1Beta1Tx, +} from '@injectivelabs/core-proto-ts' + +export declare namespace MsgCancelUnbondingDelegation { + export interface Params { + amount: { + denom: string + amount: string + } + validatorAddress: string + delegatorAddress: string + creationHeight: string + } + + export type Proto = CosmosStakingV1Beta1Tx.MsgCancelUnbondingDelegation +} + +/** + * @category Messages + */ +export default class MsgCancelUnbondingDelegation extends MsgBase< + MsgCancelUnbondingDelegation.Params, + MsgCancelUnbondingDelegation.Proto +> { + static fromJSON( + params: MsgCancelUnbondingDelegation.Params, + ): MsgCancelUnbondingDelegation { + return new MsgCancelUnbondingDelegation(params) + } + + public toProto() { + const { params } = this + + const coinAmount = CosmosBaseV1Beta1Coin.Coin.create() + coinAmount.denom = params.amount.denom + coinAmount.amount = params.amount.amount + + const message = CosmosStakingV1Beta1Tx.MsgCancelUnbondingDelegation.create() + message.amount = coinAmount + message.delegatorAddress = params.delegatorAddress + message.validatorAddress = params.validatorAddress + message.creationHeight = params.creationHeight + + return CosmosStakingV1Beta1Tx.MsgCancelUnbondingDelegation.fromPartial( + message, + ) + } + + public toData() { + const proto = this.toProto() + + return { + '@type': '/cosmos.staking.v1beta1.MsgCancelUnbondingDelegation', + ...proto, + } + } + + public toAmino() { + const proto = this.toProto() + const message = { + ...snakecaseKeys(proto), + } + + return { + type: 'cosmos-sdk/MsgCancelUnbondingDelegation', + value: message, + } + } + + public toWeb3() { + const amino = this.toAmino() + const { value } = amino + + return { + '@type': '/cosmos.staking.v1beta1.MsgCancelUnbondingDelegation', + ...value, + } + } + + public toDirectSign() { + const proto = this.toProto() + + return { + type: '/cosmos.staking.v1beta1.MsgCancelUnbondingDelegation', + message: proto, + } + } + + public toBinary(): Uint8Array { + return CosmosStakingV1Beta1Tx.MsgCancelUnbondingDelegation.encode( + this.toProto(), + ).finish() + } +} diff --git a/packages/sdk-ts/src/core/modules/tx/api/TxGrpcApi.ts b/packages/sdk-ts/src/core/modules/tx/api/TxGrpcApi.ts index 5369287fb..5ccd178bd 100644 --- a/packages/sdk-ts/src/core/modules/tx/api/TxGrpcApi.ts +++ b/packages/sdk-ts/src/core/modules/tx/api/TxGrpcApi.ts @@ -13,7 +13,7 @@ import { DEFAULT_BLOCK_TIME_IN_SECONDS, } from '@injectivelabs/utils' import { TxResponse } from '../types/tx' -import { getGrpcWebImpl } from '../../../../client/BaseGrpcWebConsumer' +import BaseGrpcWebConsumer from '../../../../client/base/BaseGrpcWebConsumer' import { CosmosTxV1Beta1Service, CosmosTxV1Beta1Tx, @@ -27,7 +27,7 @@ export class TxGrpcApi implements TxConcreteApi { constructor(endpoint: string) { this.endpoint = endpoint this.txService = new CosmosTxV1Beta1Service.ServiceClientImpl( - getGrpcWebImpl(endpoint), + BaseGrpcWebConsumer.getGrpcWebImpl(endpoint), ) } diff --git a/packages/sdk-ts/src/core/modules/tx/broadcaster/MsgBroadcasterLocal.ts b/packages/sdk-ts/src/core/modules/tx/broadcaster/MsgBroadcasterLocal.ts deleted file mode 100644 index cc737cf3a..000000000 --- a/packages/sdk-ts/src/core/modules/tx/broadcaster/MsgBroadcasterLocal.ts +++ /dev/null @@ -1,322 +0,0 @@ -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 fad28c62f..a48398bb8 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 @@ -31,7 +31,7 @@ describe('MsgBroadcasterWithPk', () => { expect(response.txHash).toBeDefined() }, 60000) - test('prepares, simulates, signs and broadcasts a transaction', async () => { + test.skip('prepares, simulates, signs and broadcasts a transaction with fee delegation', async () => { const privateKey = PrivateKey.fromHex( process.env.TEST_PRIVATE_KEY as string, ) 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 5a17a43ed..9a4b244e1 100644 --- a/packages/sdk-ts/src/core/modules/tx/broadcaster/MsgBroadcasterWithPk.ts +++ b/packages/sdk-ts/src/core/modules/tx/broadcaster/MsgBroadcasterWithPk.ts @@ -1,11 +1,11 @@ -import { BaseAccount, PrivateKey } from '../../../accounts' +import { PrivateKey } from '../../../accounts' import { Msgs } from '../../msgs' import { createTransaction } from '../tx' import { TxGrpcApi } from '../api/TxGrpcApi' import { - ChainRestAuthApi, - ChainRestTendermintApi, -} from '../../../../client/chain/rest' + ChainGrpcAuthApi, + ChainGrpcTendermintApi, +} from '../../../../client/chain/grpc' import { getStdFee, DEFAULT_STD_FEE, @@ -23,6 +23,8 @@ import { import { getGasPriceBasedOnMessage } from '../../../../utils/msgs' import { CreateTransactionArgs } from '../types' import { IndexerGrpcTransactionApi } from '../../../../client' +import { AccountDetails } from '../../../../types/auth' +import { CosmosTxV1Beta1Tx } from '@injectivelabs/core-proto-ts' interface MsgBroadcasterTxOptions { msgs: Msgs | Msgs[] @@ -50,6 +52,8 @@ interface MsgBroadcasterWithPkOptions { privateKey: string | PrivateKey /* hex or PrivateKey class */ ethereumChainId?: EthereumChainId simulateTx?: boolean + loggingEnabled?: boolean + gasBufferCoefficient?: number } /** @@ -71,10 +75,13 @@ export class MsgBroadcasterWithPk { public simulateTx: boolean = false + public gasBufferCoefficient: number = 1.1 + constructor(options: MsgBroadcasterWithPkOptions) { const networkInfo = getNetworkInfo(options.network) const endpoints = getNetworkEndpoints(options.network) + this.gasBufferCoefficient = options.gasBufferCoefficient || 1.1 this.simulateTx = options.simulateTx || false this.chainId = networkInfo.chainId this.ethereumChainId = @@ -93,67 +100,9 @@ export class MsgBroadcasterWithPk { * @returns {string} transaction hash */ async broadcast(transaction: MsgBroadcasterTxOptions) { - const { chainId, privateKey, endpoints } = this - const msgs = Array.isArray(transaction.msgs) - ? transaction.msgs - : [transaction.msgs] - - const tx = { - ...transaction, - msgs: msgs, - } as MsgBroadcasterTxOptions - - /** Account Details * */ - const publicKey = privateKey.toPublicKey() - const chainRestAuthApi = new ChainRestAuthApi(endpoints.rest) - const accountDetailsResponse = await chainRestAuthApi.fetchAccount( - privateKey.toBech32(), - ) - const baseAccount = BaseAccount.fromRestApi(accountDetailsResponse) - const accountDetails = baseAccount.toAccountDetails() - - /** 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, - 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) + const { txRaw } = await this.prepareTxForBroadcast(transaction) - if (txResponse.code !== 0) { - throw new GeneralException( - new Error( - `Transaction failed to be broadcasted - ${txResponse.rawLog}`, - ), - ) - } - - return txResponse + return await this.broadcastTxRaw(txRaw) } /** @@ -220,17 +169,16 @@ export class MsgBroadcasterWithPk { /** Account Details * */ const publicKey = privateKey.toPublicKey() - const chainRestAuthApi = new ChainRestAuthApi(endpoints.rest) - const accountDetailsResponse = await chainRestAuthApi.fetchAccount( - privateKey.toBech32(), - ) - const baseAccount = BaseAccount.fromRestApi(accountDetailsResponse) - const accountDetails = baseAccount.toAccountDetails() + const accountDetails = await new ChainGrpcAuthApi( + endpoints.grpc, + ).fetchAccount(publicKey.toBech32()) + const { baseAccount } = accountDetails /** Block Details */ - const chainRestTendermintApi = new ChainRestTendermintApi(endpoints.rest) - const latestBlock = await chainRestTendermintApi.fetchLatestBlock() - const latestHeight = latestBlock.header.height + const latestBlock = await new ChainGrpcTendermintApi( + endpoints.grpc, + ).fetchLatestBlock() + const latestHeight = latestBlock!.header!.height const timeoutHeight = new BigNumberInBase(latestHeight).plus( DEFAULT_BLOCK_TIMEOUT_HEIGHT, ) @@ -242,8 +190,8 @@ export class MsgBroadcasterWithPk { message: tx.msgs as Msgs[], timeoutHeight: timeoutHeight.toNumber(), pubKey: publicKey.toBase64(), - sequence: accountDetails.sequence, - accountNumber: accountDetails.accountNumber, + sequence: baseAccount.sequence, + accountNumber: baseAccount.accountNumber, chainId: chainId, }) @@ -264,10 +212,10 @@ export class MsgBroadcasterWithPk { * * 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) + * to be safe (factor of 1.1 (or user specified)) */ private async getTxWithStdFee(args: CreateTransactionArgs) { - const { simulateTx } = this + const { simulateTx, gasBufferCoefficient } = this if (!simulateTx) { return createTransaction(args) @@ -281,7 +229,9 @@ export class MsgBroadcasterWithPk { const stdGasFee = getStdFee({ ...args.fee, - gas: new BigNumberInBase(result.gasInfo.gasUsed).times(1.1).toFixed(), + gas: new BigNumberInBase(result.gasInfo.gasUsed) + .times(gasBufferCoefficient) + .toFixed(), }) return createTransaction({ ...args, fee: stdGasFee }) @@ -302,4 +252,84 @@ export class MsgBroadcasterWithPk { return simulationResponse } + + private async prepareTxForBroadcast( + transaction: MsgBroadcasterTxOptions, + accountDetails?: AccountDetails, + ) { + const { chainId, privateKey, endpoints } = this + const msgs = Array.isArray(transaction.msgs) + ? transaction.msgs + : [transaction.msgs] + + const tx = { + ...transaction, + msgs: msgs, + } as MsgBroadcasterTxOptions + + /** Account Details * */ + const publicKey = privateKey.toPublicKey() + const actualAccountDetails = await this.getAccountDetails(accountDetails) + + /** Block Details */ + const latestBlock = await new ChainGrpcTendermintApi( + endpoints.grpc, + ).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: actualAccountDetails.sequence, + accountNumber: actualAccountDetails.accountNumber, + chainId: chainId, + }) + + /** Sign transaction */ + const signature = await privateKey.sign(Buffer.from(signBytes)) + + /** Append Signatures */ + txRaw.signatures = [signature] + + return { txRaw, accountDetails: actualAccountDetails } + } + + private async getAccountDetails(accountDetails?: AccountDetails) { + if (accountDetails) { + return accountDetails + } + + const { privateKey, endpoints } = this + const accountDetailsResponse = await new ChainGrpcAuthApi( + endpoints.grpc, + ).fetchAccount(privateKey.toBech32()) + + return accountDetailsResponse.baseAccount + } + + private async broadcastTxRaw(txRaw: CosmosTxV1Beta1Tx.TxRaw) { + const { endpoints } = this + 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} - ${txResponse.txHash}`, + ), + ) + } + + return txResponse + } } 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 b45892473..49fe81b2f 100644 --- a/packages/sdk-ts/src/core/modules/tx/broadcaster/index.ts +++ b/packages/sdk-ts/src/core/modules/tx/broadcaster/index.ts @@ -1,2 +1 @@ export * from './MsgBroadcasterWithPk' -export * from './MsgBroadcasterLocal' diff --git a/packages/sdk-ts/src/core/modules/tx/eip712/eip712.spec.ts b/packages/sdk-ts/src/core/modules/tx/eip712/eip712.spec.ts new file mode 100644 index 000000000..d423a7023 --- /dev/null +++ b/packages/sdk-ts/src/core/modules/tx/eip712/eip712.spec.ts @@ -0,0 +1,93 @@ +import { mockFactory } from '@injectivelabs/test-utils' +import { BigNumberInBase, DEFAULT_STD_FEE } from '@injectivelabs/utils' +import { MsgSend } from '@injectivelabs/sdk-ts' +import { getEip712TypedDataV2 } from './eip712' + +describe('EIP712V2', () => { + test('generating proper EI712 v2', () => { + const amount = { + denom: 'inj', + amount: new BigNumberInBase(0.01).toWei().toFixed(), + } + + const msg = MsgSend.fromJSON({ + amount, + srcInjectiveAddress: mockFactory.injectiveAddress, + dstInjectiveAddress: mockFactory.injectiveAddress, + }) + const ethereumChainId = 5 + const chainId = 'injective-777' + const timeoutHeight = 1896 + const accountDetails = { + accountNumber: 11, + sequence: 88, + } + + const eip712TypedData = getEip712TypedDataV2({ + msgs: [msg], + fee: { + ...DEFAULT_STD_FEE, + feePayer: 'inj18j2myhaf2at75kwwaqxfstk4q28n4am45nlfg7', + }, + tx: { + memo: '', + accountNumber: accountDetails.accountNumber.toString(), + sequence: accountDetails.sequence.toString(), + timeoutHeight: timeoutHeight.toString(), + chainId, + }, + ethereumChainId, + }) + + const expectedEip712 = { + types: { + EIP712Domain: [ + { + name: 'name', + type: 'string', + }, + { + name: 'version', + type: 'string', + }, + { + name: 'chainId', + type: 'uint256', + }, + { + name: 'verifyingContract', + type: 'string', + }, + { + name: 'salt', + type: 'string', + }, + ], + Tx: [ + { + name: 'context', + type: 'string', + }, + { + name: 'msgs', + type: 'string', + }, + ], + }, + primaryType: 'Tx', + domain: { + name: 'Injective Web3', + version: '1.0.0', + chainId: '0x5', + verifyingContract: 'cosmos', + salt: '0', + }, + message: { + context: + '{"account_number":11,"chain_id":"injective-777","fee":{"amount":[{"denom":"inj","amount":"200000000000000"}],"gas":400000,"payer":"inj18j2myhaf2at75kwwaqxfstk4q28n4am45nlfg7"},"memo":"","sequence":88,"timeout_height":1896}', + msgs: `[{"@type":"/cosmos.bank.v1beta1.MsgSend","from_address":"${mockFactory.injectiveAddress}","to_address":"${mockFactory.injectiveAddress}","amount":[{"denom":"inj","amount":"10000000000000000"}]}]`, + }, + } + expect(eip712TypedData).toEqual(expectedEip712) + }) +}) diff --git a/packages/sdk-ts/src/core/modules/tx/eip712/eip712.ts b/packages/sdk-ts/src/core/modules/tx/eip712/eip712.ts index 6e2194f51..cf858133d 100644 --- a/packages/sdk-ts/src/core/modules/tx/eip712/eip712.ts +++ b/packages/sdk-ts/src/core/modules/tx/eip712/eip712.ts @@ -2,12 +2,15 @@ import { EthereumChainId } from '@injectivelabs/ts-types' import { Msgs } from '../../msgs' import { Eip712ConvertFeeArgs, Eip712ConvertTxArgs } from './types' import { - getDefaultEip712Types, - getEip712Domain, - getEipTxDetails, getEip712Fee, + getEipTxDetails, + getEip712Domain, + getEip712DomainV2, + getDefaultEip712Types, getTypesIncludingFeePayer, + getDefaultEip712TypesV2, } from './utils' +import { getEipTxContext } from './utils' export const getEip712TypedData = ({ msgs, @@ -37,8 +40,8 @@ export const getEip712TypedData = ({ }) return { - primaryType: 'Tx', ...typesWithFeePayer, + primaryType: 'Tx', ...getEip712Domain(ethereumChainId), message: { ...getEipTxDetails(tx), @@ -47,3 +50,30 @@ export const getEip712TypedData = ({ }, } } + +export const getEip712TypedDataV2 = ({ + msgs, + tx, + fee, + ethereumChainId, +}: { + msgs: Msgs | Msgs[] + tx: Eip712ConvertTxArgs + fee?: Eip712ConvertFeeArgs + ethereumChainId: EthereumChainId +}) => { + const messages = Array.isArray(msgs) ? msgs : [msgs] + const eip712Msgs = messages.map((m) => m.toWeb3()) + + const types = getDefaultEip712TypesV2() + + return { + ...types, + primaryType: 'Tx', + ...getEip712DomainV2(ethereumChainId), + message: { + context: JSON.stringify(getEipTxContext({ ...tx, fee })), + msgs: JSON.stringify(eip712Msgs), + }, + } +} 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 330f69325..9e517163c 100644 --- a/packages/sdk-ts/src/core/modules/tx/eip712/maps.ts +++ b/packages/sdk-ts/src/core/modules/tx/eip712/maps.ts @@ -28,6 +28,7 @@ export const objectKeysToEip712Types = ({ 'expiry', 'option', 'proposal_id', + 'creation_height', ] const output = new Map() const types = new Array() @@ -161,6 +162,8 @@ export const numberTypeToReflectionNumberType = (property?: string) => { return 'uint64' case 'expiry': return 'int64' + case 'creation_height': + return 'int64' case 'option': return 'int32' case 'proposal_id': diff --git a/packages/sdk-ts/src/core/modules/tx/eip712/utils.ts b/packages/sdk-ts/src/core/modules/tx/eip712/utils.ts index fad71eeec..f392ce981 100644 --- a/packages/sdk-ts/src/core/modules/tx/eip712/utils.ts +++ b/packages/sdk-ts/src/core/modules/tx/eip712/utils.ts @@ -18,6 +18,18 @@ export const getEip712Domain = (ethereumChainId: EthereumChainId) => { } } +export const getEip712DomainV2 = (ethereumChainId: EthereumChainId) => { + return { + domain: { + name: 'Injective Web3', + version: '1.0.0', + chainId: '0x' + new BigNumberInBase(ethereumChainId).toString(16), + verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', + salt: '0', + }, + } +} + export const getDefaultEip712Types = () => { return { types: { @@ -53,6 +65,24 @@ export const getDefaultEip712Types = () => { } } +export const getDefaultEip712TypesV2 = () => { + return { + types: { + EIP712Domain: [ + { name: 'name', type: 'string' }, + { name: 'version', type: 'string' }, + { name: 'chainId', type: 'uint256' }, + { name: 'verifyingContract', type: 'address' }, + { name: 'salt', type: 'string' }, + ], + Tx: [ + { name: 'context', type: 'string' }, + { name: 'msgs', type: 'string' }, + ], + }, + } +} + export const getEip712Fee = ( params?: Eip712ConvertFeeArgs, ): { @@ -83,6 +113,50 @@ export const getEip712Fee = ( } } +export const getEip712FeeV2 = ( + params?: Eip712ConvertFeeArgs, +): { + fee: { + amount: { denom: string; amount: string }[] + gas: number + payer?: string + } +} => { + if (!params) { + return { + fee: { + amount: [ + { + denom: DEFAULT_STD_FEE.amount[0].denom, + amount: DEFAULT_STD_FEE.amount[0].amount, + }, + ], + gas: Number(DEFAULT_STD_FEE.gas), + }, + } + } + + const amountFromParams = (params.amount || DEFAULT_STD_FEE.amount)[0] + const { amount, gas, payer } = { + amount: [ + { + denom: amountFromParams.denom, + amount: amountFromParams.amount, + }, + ], + gas: Number(params.gas || DEFAULT_GAS_LIMIT.toFixed()), + payer: params.feePayer, + } + + return { + fee: { + amount, + gas, + payer: payer, + }, + } +} + export const getTypesIncludingFeePayer = ({ fee, types, @@ -124,3 +198,28 @@ export const getEipTxDetails = ({ sequence, } } + +export const getEipTxContext = ({ + accountNumber, + sequence, + fee, + timeoutHeight, + chainId, + memo, +}: Eip712ConvertTxArgs & { fee?: Eip712ConvertFeeArgs }): { + account_number: number + chain_id: string + sequence: number + fee: Record + timeout_height: number + memo: string +} => { + return { + account_number: Number(accountNumber), + chain_id: chainId, + ...getEip712FeeV2(fee), + memo: memo || '', + sequence: Number(sequence), + timeout_height: Number(timeoutHeight), + } +} diff --git a/packages/sdk-ts/src/core/modules/tx/types/tx-rest-client.ts b/packages/sdk-ts/src/core/modules/tx/types/tx-rest-client.ts index 1796f7f38..5ffdad9cc 100644 --- a/packages/sdk-ts/src/core/modules/tx/types/tx-rest-client.ts +++ b/packages/sdk-ts/src/core/modules/tx/types/tx-rest-client.ts @@ -69,6 +69,12 @@ export enum BroadcastMode { Block = 'BROADCAST_MODE_BLOCK', } +export enum BroadcastModeKeplr { + Sync = 'sync', + Async = 'async', + Block = 'block', +} + export interface TxResultResponse { tx: RestTx tx_response: TxInfoResponse diff --git a/packages/sdk-ts/src/core/modules/tx/utils/constants.ts b/packages/sdk-ts/src/core/modules/tx/utils/constants.ts index 096beecc1..806dc6db6 100644 --- a/packages/sdk-ts/src/core/modules/tx/utils/constants.ts +++ b/packages/sdk-ts/src/core/modules/tx/utils/constants.ts @@ -4,3 +4,7 @@ export const SIGN_DIRECT = CosmosTxSigningV1Beta1Signing.SignMode.SIGN_MODE_DIRECT export const SIGN_AMINO = CosmosTxSigningV1Beta1Signing.SignMode.SIGN_MODE_LEGACY_AMINO_JSON +export const SIGN_EIP712 = + CosmosTxSigningV1Beta1Signing.SignMode.SIGN_MODE_LEGACY_AMINO_JSON +export const SIGN_EIP712_V2 = + CosmosTxSigningV1Beta1Signing.SignMode.SIGN_MODE_EIP712_V2 diff --git a/packages/sdk-ts/src/core/modules/tx/utils/tx.ts b/packages/sdk-ts/src/core/modules/tx/utils/tx.ts index a1d90f2a2..a0efe0236 100644 --- a/packages/sdk-ts/src/core/modules/tx/utils/tx.ts +++ b/packages/sdk-ts/src/core/modules/tx/utils/tx.ts @@ -1,5 +1,5 @@ import { createAny, createAnyMessage } from './helpers' -import { EthereumChainId } from '@injectivelabs/ts-types' +import { ChainId, EthereumChainId } from '@injectivelabs/ts-types' import { Msgs } from '../../msgs' import { GoogleProtobufAny, @@ -10,6 +10,7 @@ import { CosmosTxSigningV1Beta1Signing, } from '@injectivelabs/core-proto-ts' import { SignDoc } from 'cosmjs-types/cosmos/tx/v1beta1/tx' +import { getStdFee } from '@injectivelabs/utils'; export const getPublicKey = ({ chainId, @@ -265,3 +266,29 @@ export const getTransactionPartsFromTxRaw = ( signatures: txRaw.signatures, } } + +export const getAminoStdSignDoc = ({ + memo, + chainId, + accountNumber, + timeoutHeight, + sequence, + gas, + msgs, +}: { + memo?: string + chainId: ChainId + timeoutHeight?: string + accountNumber: number + sequence: number + gas?: string + msgs: Msgs[] +}) => ({ + chain_id: chainId, + timeout_height: timeoutHeight || '', + account_number: accountNumber.toString(), + sequence: sequence.toString(), + fee: getStdFee({ gas }), + msgs: msgs.map((m) => m.toAmino()), + memo: memo || '', +}) 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 38448dcb3..fb5335c29 100644 --- a/packages/sdk-ts/src/core/modules/wasm/exec-args.ts +++ b/packages/sdk-ts/src/core/modules/wasm/exec-args.ts @@ -1,8 +1,11 @@ import ExecArgCW20Send from './exec-args/ExecArgCW20Send' import ExecArgSubmitVaa from './exec-args/ExecArgSubmitVaa' +import ExecArgCreateRound from './exec-args/ExecArgCreateRound' import ExecArgCW20Transfer from './exec-args/ExecArgCW20Transfer' +import ExecArgFundCampaign from './exec-args/ExecArgFundCampaign' import ExecArgDepositTokens from './exec-args/ExecArgDepositTokens' import ExecArgSwapMinOutput from './exec-args/ExecArgSwapMinOutput' +import ExecArgCreateCampaign from './exec-args/ExecArgCreateCampaign' import ExecArgSwapExactOutput from './exec-args/ExecArgSwapExactOutput' import ExecArgInitiateTransfer from './exec-args/ExecArgInitiateTransfer' import ExecArgIncreaseAllowance from './exec-args/ExecArgIncreaseAllowance' @@ -19,14 +22,17 @@ import ExecPrivilegedArgOffChainVaultSubscribe from './exec-priv-args/ExecPrivil export type ExecArgs = | ExecArgCW20Send | ExecArgSubmitVaa + | ExecArgCreateRound | ExecArgCW20Transfer + | ExecArgFundCampaign | ExecArgSwapMinOutput | ExecArgDepositTokens - | ExecArgCreateSpotGridStrategy - | ExecArgRemoveGridStrategy + | ExecArgCreateCampaign | ExecArgSwapExactOutput | ExecArgInitiateTransfer | ExecArgIncreaseAllowance + | ExecArgRemoveGridStrategy + | ExecArgCreateSpotGridStrategy | ExecArgCW20AdapterRedeemAndTransfer export type ExecPrivilegedArgs = diff --git a/packages/sdk-ts/src/core/modules/wasm/exec-args/ExecArgCreateCampaign.ts b/packages/sdk-ts/src/core/modules/wasm/exec-args/ExecArgCreateCampaign.ts new file mode 100644 index 000000000..cee8f110f --- /dev/null +++ b/packages/sdk-ts/src/core/modules/wasm/exec-args/ExecArgCreateCampaign.ts @@ -0,0 +1,55 @@ +import { + dataToExecData, + ExecArgBase, + ExecDataRepresentation, +} from '../ExecArgBase' +import { Coin } from '@injectivelabs/ts-types' + +export declare namespace ExecArgCreateCampaign { + export interface Params { + name: string + rewards: Coin[] + inRound: number + marketId: string + description: string + subaccountIdSuffix: string + } + + export interface Data { + name: string + rewards: Coin[] + in_round: number + market_id: string + description: string + subaccount_id_suffix: string + } +} + +/** + * @category Contract Exec Arguments + */ +export default class ExecArgCreateCampaign extends ExecArgBase< + ExecArgCreateCampaign.Params, + ExecArgCreateCampaign.Data +> { + static fromJSON(params: ExecArgCreateCampaign.Params): ExecArgCreateCampaign { + return new ExecArgCreateCampaign(params) + } + + toData(): ExecArgCreateCampaign.Data { + const { params } = this + + return { + name: params.name, + rewards: params.rewards, + in_round: params.inRound, + market_id: params.marketId, + description: params.description, + subaccount_id_suffix: params.subaccountIdSuffix, + } + } + + toExecData(): ExecDataRepresentation { + return dataToExecData('create_campaign', this.toData()) + } +} diff --git a/packages/sdk-ts/src/core/modules/wasm/exec-args/ExecArgCreateRound.ts b/packages/sdk-ts/src/core/modules/wasm/exec-args/ExecArgCreateRound.ts new file mode 100644 index 000000000..978f8766c --- /dev/null +++ b/packages/sdk-ts/src/core/modules/wasm/exec-args/ExecArgCreateRound.ts @@ -0,0 +1,45 @@ +import { + dataToExecData, + ExecArgBase, + ExecDataRepresentation, +} from '../ExecArgBase' + +export declare namespace ExecArgCreateRound { + export interface Params { + name: string + endDate: number + startDate: number + } + + export interface Data { + name: string + end_date: number + start_date: number + } +} + +/** + * @category Contract Exec Arguments + */ +export default class ExecArgCreateRound extends ExecArgBase< + ExecArgCreateRound.Params, + ExecArgCreateRound.Data +> { + static fromJSON(params: ExecArgCreateRound.Params): ExecArgCreateRound { + return new ExecArgCreateRound(params) + } + + toData(): ExecArgCreateRound.Data { + const { params } = this + + return { + name: params.name, + start_date: params.startDate, + end_date: params.endDate, + } + } + + toExecData(): ExecDataRepresentation { + return dataToExecData('create_round', this.toData()) + } +} diff --git a/packages/sdk-ts/src/core/modules/wasm/exec-args/ExecArgFundCampaign.ts b/packages/sdk-ts/src/core/modules/wasm/exec-args/ExecArgFundCampaign.ts new file mode 100644 index 000000000..67889eb4a --- /dev/null +++ b/packages/sdk-ts/src/core/modules/wasm/exec-args/ExecArgFundCampaign.ts @@ -0,0 +1,39 @@ +import { + dataToExecData, + ExecArgBase, + ExecDataRepresentation, +} from '../ExecArgBase' + +export declare namespace ExecArgFundCampaign { + export interface Params { + campaignId: number + } + + export interface Data { + campaign_id: number + } +} + +/** + * @category Contract Exec Arguments + */ +export default class ExecArgFundCampaign extends ExecArgBase< + ExecArgFundCampaign.Params, + ExecArgFundCampaign.Data +> { + static fromJSON(params: ExecArgFundCampaign.Params): ExecArgFundCampaign { + return new ExecArgFundCampaign(params) + } + + toData(): ExecArgFundCampaign.Data { + const { params } = this + + return { + campaign_id: params.campaignId, + } + } + + toExecData(): ExecDataRepresentation { + return dataToExecData('fund_campaign', 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 9eeacc0a5..bc96f3422 100644 --- a/packages/sdk-ts/src/core/modules/wasm/index.ts +++ b/packages/sdk-ts/src/core/modules/wasm/index.ts @@ -1,8 +1,11 @@ import ExecArgCW20Send from './exec-args/ExecArgCW20Send' import ExecArgSubmitVaa from './exec-args/ExecArgSubmitVaa' +import ExecArgCreateRound from './exec-args/ExecArgCreateRound' +import ExecArgFundCampaign from './exec-args/ExecArgFundCampaign' import ExecArgCW20Transfer from './exec-args/ExecArgCW20Transfer' import ExecArgSwapMinOutput from './exec-args/ExecArgSwapMinOutput' import ExecArgDepositTokens from './exec-args/ExecArgDepositTokens' +import ExecArgCreateCampaign from './exec-args/ExecArgCreateCampaign' import ExecArgSwapExactOutput from './exec-args/ExecArgSwapExactOutput' import ExecArgInitiateTransfer from './exec-args/ExecArgInitiateTransfer' import ExecArgIncreaseAllowance from './exec-args/ExecArgIncreaseAllowance' @@ -28,9 +31,12 @@ export * from './exec-args' export { ExecArgCW20Send, ExecArgSubmitVaa, + ExecArgCreateRound, ExecArgCW20Transfer, + ExecArgFundCampaign, ExecArgSwapMinOutput, ExecArgDepositTokens, + ExecArgCreateCampaign, ExecArgSwapExactOutput, ExecArgInitiateTransfer, ExecArgIncreaseAllowance, diff --git a/packages/sdk-ts/src/types/pagination.ts b/packages/sdk-ts/src/types/pagination.ts index 8afd53a02..a44a77a5e 100644 --- a/packages/sdk-ts/src/types/pagination.ts +++ b/packages/sdk-ts/src/types/pagination.ts @@ -6,6 +6,7 @@ export interface PaginationOption { reverse?: boolean countTotal?: boolean endTime?: number + startTime?: number fromNumber?: number toNumber?: number } diff --git a/packages/sdk-ts/src/utils/address.ts b/packages/sdk-ts/src/utils/address.ts index 1cb2a011c..f5b459318 100644 --- a/packages/sdk-ts/src/utils/address.ts +++ b/packages/sdk-ts/src/utils/address.ts @@ -90,7 +90,7 @@ export const getChecksumAddress = (ethAddress: string) => { let checksumAddress = '0x' - for (var i = 0; i < lowercasedAddress.length; i++) { + for (let i = 0; i < lowercasedAddress.length; i++) { if (parseInt(addressHash[i], 16) > 7) { checksumAddress += lowercasedAddress[i].toUpperCase() } else { diff --git a/packages/sdk-ts/src/utils/constants.ts b/packages/sdk-ts/src/utils/constants.ts index 171cafaad..615e6473a 100644 --- a/packages/sdk-ts/src/utils/constants.ts +++ b/packages/sdk-ts/src/utils/constants.ts @@ -11,10 +11,7 @@ export const BECH32_ADDR_CONS_PREFIX = 'injvalcons' export const DEFAULT_DERIVATION_PATH = "m/44'/60'/0'/0/0" -export const DUST_AMOUNT = 0.0001 -export const PAGINATION_TOTAL_PAGE_LIMIT: number = 10000 -export const DEFAULT_PAGINATION_TOTAL_COUNT: number = 1000000 - +/** @deprecated - use the one in @injectivelabs/networks */ export const CW20_ADAPTER_CONTRACT_BY_NETWORK = { [Network.Mainnet]: 'inj14ejqjyq8um4p3xfqj74yld5waqljf88f9eneuk', [Network.MainnetLB]: 'inj14ejqjyq8um4p3xfqj74yld5waqljf88f9eneuk', @@ -33,6 +30,7 @@ export const CW20_ADAPTER_CONTRACT_BY_NETWORK = { [Network.Local]: 'inj1hdvy6tl89llqy3ze8lv6mz5qh66sx9enn0jxg6', } +/** @deprecated - use the one in @injectivelabs/networks */ export const CW20_SWAP_CONTRACT_BY_NETWORK = { [Network.Mainnet]: 'inj1psk3468yr9teahgz73amwvpfjehnhczvkrhhqx', [Network.MainnetLB]: 'inj1psk3468yr9teahgz73amwvpfjehnhczvkrhhqx', @@ -51,6 +49,26 @@ export const CW20_SWAP_CONTRACT_BY_NETWORK = { [Network.Local]: 'inj177yh38g3ctu7cemxpa3c2kvwh2yslfxfmfa66h', } +/** @deprecated - use the one in @injectivelabs/networks */ +export const INCENTIVES_CONTRACT_BY_NETWORK = { + [Network.Mainnet]: '', + [Network.MainnetLB]: '', + [Network.MainnetK8s]: '', + [Network.MainnetSentry]: '', + [Network.Public]: '', + [Network.Staging]: '', + [Network.Internal]: '', + [Network.Testnet]: 'inj16twru668nsl7tqzahxd9q033swhr6a5xuslpkt', + [Network.TestnetK8s]: 'inj16twru668nsl7tqzahxd9q033swhr6a5xuslpkt', + [Network.TestnetSentry]: 'inj16twru668nsl7tqzahxd9q033swhr6a5xuslpkt', + [Network.TestnetOld]: 'inj16twru668nsl7tqzahxd9q033swhr6a5xuslpkt', + [Network.Devnet]: '', + [Network.Devnet1]: '', + [Network.Devnet2]: '', + [Network.Local]: '', +} + +/** @deprecated - use the one in @injectivelabs/networks */ export const INJ_NAME_REGISTRY_CONTRACT_BY_NETWORK = { [Network.Mainnet]: 'inj1hm8vs8sr2h9nk0x66vctfs528wrp6k3gtgg275', [Network.MainnetLB]: 'inj1hm8vs8sr2h9nk0x66vctfs528wrp6k3gtgg275', @@ -69,6 +87,7 @@ export const INJ_NAME_REGISTRY_CONTRACT_BY_NETWORK = { [Network.Local]: 'inj1aw59rkpd9afp2ws6rx23nz5mrvq8dlckeslwfa', } +/** @deprecated - use the one in @injectivelabs/networks */ export const INJ_NAME_REVERSE_RESOLVER_CONTRACT_BY_NETWORK = { [Network.Mainnet]: 'inj1x9m0hceug9qylcyrrtwqtytslv2jrph433thgu', [Network.MainnetLB]: 'inj1x9m0hceug9qylcyrrtwqtytslv2jrph433thgu', diff --git a/packages/sdk-ts/src/utils/grpc.ts b/packages/sdk-ts/src/utils/grpc.ts index 3784f8790..0d593e687 100644 --- a/packages/sdk-ts/src/utils/grpc.ts +++ b/packages/sdk-ts/src/utils/grpc.ts @@ -3,7 +3,7 @@ import { NodeHttpTransport } from '@injectivelabs/grpc-web-node-http-transport' import { ReactNativeTransport } from '@injectivelabs/grpc-web-react-native-transport' import { isNode, isReactNative } from './helpers' -export const getGrpcTransport = (): grpc.TransportFactory | undefined => { +export const getGrpcTransport = (): grpc.TransportFactory => { if (isReactNative()) { return ReactNativeTransport({ withCredentials: true }) } @@ -12,5 +12,5 @@ export const getGrpcTransport = (): grpc.TransportFactory | undefined => { return NodeHttpTransport() } - return undefined + return grpc.CrossBrowserHttpTransport({ withCredentials: false }) } diff --git a/packages/sdk-ui-ts/CHANGELOG.md b/packages/sdk-ui-ts/CHANGELOG.md index 7c9f5a08b..d4a4746a3 100644 --- a/packages/sdk-ui-ts/CHANGELOG.md +++ b/packages/sdk-ui-ts/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.5](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/sdk-ui-ts@1.14.5-beta.76...@injectivelabs/sdk-ui-ts@1.14.5) (2024-01-11) + +**Note:** Version bump only for package @injectivelabs/sdk-ui-ts + + + + + +## [1.14.4](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/sdk-ui-ts@1.14.4-beta.3...@injectivelabs/sdk-ui-ts@1.14.4) (2023-11-20) + +**Note:** Version bump only for package @injectivelabs/sdk-ui-ts + + + + + +## [1.14.3](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/sdk-ui-ts@1.14.3-beta.29...@injectivelabs/sdk-ui-ts@1.14.3) (2023-11-17) + +**Note:** Version bump only for package @injectivelabs/sdk-ui-ts + + + + + +## [1.14.2](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/sdk-ui-ts@1.14.2-beta.16...@injectivelabs/sdk-ui-ts@1.14.2) (2023-11-07) + +**Note:** Version bump only for package @injectivelabs/sdk-ui-ts + + + + + ## [1.14.1](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/sdk-ui-ts@1.14.1-beta.25...@injectivelabs/sdk-ui-ts@1.14.1) (2023-10-27) **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 771cb3561..30036c611 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.14.2-beta.17", + "version": "1.14.5", "sideEffects": false, "license": "Apache-2.0", "author": { @@ -35,14 +35,14 @@ "get-ibc-tokens": "ts-node-dev ./src/services/ibc/tokens.ts" }, "dependencies": { - "@injectivelabs/contracts": "^1.14.2-beta.3", - "@injectivelabs/exceptions": "^1.14.2-beta.2", - "@injectivelabs/networks": "^1.14.2-beta.3", - "@injectivelabs/sdk-ts": "^1.14.2-beta.14", - "@injectivelabs/token-metadata": "^1.14.2-beta.10", - "@injectivelabs/token-utils": "^1.14.2-beta.2", - "@injectivelabs/ts-types": "^1.14.2-beta.0", - "@injectivelabs/utils": "^1.14.2-beta.2", + "@injectivelabs/contracts": "^1.14.5", + "@injectivelabs/exceptions": "^1.14.5", + "@injectivelabs/networks": "^1.14.5", + "@injectivelabs/sdk-ts": "^1.14.5", + "@injectivelabs/token-metadata": "^1.14.5", + "@injectivelabs/token-utils": "^1.14.5", + "@injectivelabs/ts-types": "^1.14.5", + "@injectivelabs/utils": "^1.14.5", "alchemy-sdk": "^2.6.3", "copyfiles": "^2.4.1", "link-module-alias": "^1.2.0", diff --git a/packages/sdk-ui-ts/src/client/transformers/UiBridgeTransformer.ts b/packages/sdk-ui-ts/src/client/transformers/UiBridgeTransformer.ts index 89cce8715..2f012a53b 100644 --- a/packages/sdk-ui-ts/src/client/transformers/UiBridgeTransformer.ts +++ b/packages/sdk-ui-ts/src/client/transformers/UiBridgeTransformer.ts @@ -233,11 +233,15 @@ export const convertIBCTransferTxToUiBridgeTransaction = async ({ const denom = transaction.denom.includes('transfer/channel') ? (transaction.denom.split('/').slice(2).join('/') as string) : transaction.denom - const bridgingNetwork = getNetworkFromAddress(transaction.receiver) + const destinationBridgingNetwork = getNetworkFromAddress(transaction.receiver) + const originBridgingNetwork = getNetworkFromAddress(transaction.sender) return { denom, - type: getBridgeTransactionType(BridgingNetwork.Injective, bridgingNetwork), + type: getBridgeTransactionType( + originBridgingNetwork, + destinationBridgingNetwork, + ), amount: transaction.amount, receiver: transaction.receiver, sender: transaction.sender, diff --git a/packages/sdk-ui-ts/src/client/transformers/UiDerivativesTransformer.ts b/packages/sdk-ui-ts/src/client/transformers/UiDerivativesTransformer.ts index 8d92bf5dc..b05c8eb26 100644 --- a/packages/sdk-ui-ts/src/client/transformers/UiDerivativesTransformer.ts +++ b/packages/sdk-ui-ts/src/client/transformers/UiDerivativesTransformer.ts @@ -1,4 +1,5 @@ import { BigNumber } from '@injectivelabs/utils' +import { Token } from '@injectivelabs/token-metadata' import { MarketType, Change } from '../types/common' import { getDerivativeMarketTensMultiplier, @@ -35,12 +36,12 @@ export class UiDerivativeTransformer { ...getDerivativeMarketDecimals({ minQuantityTickSize: market.minQuantityTickSize, minPriceTickSize: market.minPriceTickSize, - quoteDecimals: market.quoteToken.decimals, + quoteDecimals: (market.quoteToken as Token).decimals, }), ...getDerivativeMarketTensMultiplier({ minPriceTickSize: market.minPriceTickSize, minQuantityTickSize: market.minQuantityTickSize, - quoteDecimals: market.quoteToken.decimals, + quoteDecimals: (market.quoteToken as Token).decimals, }), } as unknown as R } diff --git a/packages/sdk-ui-ts/src/constants.ts b/packages/sdk-ui-ts/src/constants.ts index a52a2e3e6..b9daad7cd 100644 --- a/packages/sdk-ui-ts/src/constants.ts +++ b/packages/sdk-ui-ts/src/constants.ts @@ -32,6 +32,9 @@ export const DEFAULT_MAINNET_GAS_PRICE = new BigNumber(30).times(GWEI_IN_WEI) export const TIP_IN_GWEI: BigNumberInBase = new BigNumberInBase(2).times( GWEI_IN_WEI, ) +export const TIP_IN_GWEI_TESTNET: BigNumberInBase = new BigNumberInBase( + 1.5, +).times(GWEI_IN_WEI) export const BIG_NUMBER_ROUND_DOWN_MODE = BigNumberInBase.ROUND_DOWN export const BIG_NUMBER_ROUND_UP_MODE = BigNumberInBase.ROUND_UP @@ -57,6 +60,7 @@ export const PEGGY_DEVNET1_GRAPH_URL = export const PEGGY_DEVNET2_GRAPH_URL = 'https://api.thegraph.com/subgraphs/name/injectivelabsdev/injective-peggo-devnet' +/* @deprecated - use the one in @injectivelabs/networks */ export const peggyGraphQlEndpointForNetwork = (network: Network): string => { if (network === Network.Devnet) { return PEGGY_DEVNET_GRAPH_URL @@ -79,5 +83,7 @@ export const peggyGraphQlEndpointForNetwork = (network: Network): string => { export const ASSET_PRICE_SERVICE_URL = 'https://k8s.mainnet.asset.injective.network/asset-price/v1' +export const TESTNET_ASSET_PRICE_SERVICE_URL = + 'https://k8s.testnet.asset.injective.network/asset-price/v1' export const DEVNET_ASSET_PRICE_SERVICE_URL = 'https://devnet.api.injective.dev/asset-price/v1' diff --git a/packages/sdk-ui-ts/src/denom/DenomClientAsync.ts b/packages/sdk-ui-ts/src/denom/DenomClientAsync.ts index 725da0a99..71ff0fc99 100644 --- a/packages/sdk-ui-ts/src/denom/DenomClientAsync.ts +++ b/packages/sdk-ui-ts/src/denom/DenomClientAsync.ts @@ -2,10 +2,12 @@ import { Network, NetworkEndpoints, getNetworkEndpoints, + CW20_CODE_IDS_BY_NETWORK, } from '@injectivelabs/networks' import { sha256, Metadata, + Contract, fromUtf8, DenomClient, InsuranceFund, @@ -14,6 +16,7 @@ import { ChainGrpcWasmApi, isCw20ContractAddress, ChainGrpcInsuranceFundApi, + IndexerRestExplorerApi, } from '@injectivelabs/sdk-ts' import { Web3Client } from '../services/web3/Web3Client' import type { Token } from '@injectivelabs/token-metadata' @@ -24,7 +27,10 @@ import { getIbcTokenMetaFromDenomTrace, } from '@injectivelabs/token-metadata' import { getTokenFromAlchemyTokenMetaResponse } from '../utils/alchemy' -import { getTokenFromContractStateResponse } from '../utils/cw20' +import { + getTokenFromCw20ContractInfo, + getTokenFromContractStateResponse, +} from '../utils/cw20' import { getTokenFromDenomsMetadata } from '../utils/factory' import { getTokenFromInsuranceFund } from '../utils' import { IbcApplicationsTransferV1Transfer } from '@injectivelabs/core-proto-ts' @@ -38,6 +44,8 @@ const IGNORED_DENOMS = ['peggy0xB855dBC314C39BFa2583567E02a40CBB246CF82B'] export class DenomClientAsync { private denomClient: DenomClient + private network: Network + private web3Client: Web3Client | undefined private endpoints: NetworkEndpoints @@ -46,6 +54,8 @@ export class DenomClientAsync { private chainBankApi: ChainGrpcBankApi + private indexerExplorerApi: IndexerRestExplorerApi + private chainInsuranceApi: ChainGrpcInsuranceFundApi private metadatas: Metadata[] = [] @@ -59,18 +69,24 @@ export class DenomClientAsync { IbcApplicationsTransferV1Transfer.DenomTrace > = {} + private cachedSmartContractInfos: Record = {} + private cachedIbcTokens: Token[] = [] constructor( network: Network = Network.Mainnet, options: { endpoints?: NetworkEndpoints; alchemyRpcUrl?: string }, ) { + this.network = network this.endpoints = options.endpoints || getNetworkEndpoints(network) this.denomClient = new DenomClient(network) this.chainIbcApi = new ChainGrpcIbcApi(this.endpoints.grpc) this.chainWasmApi = new ChainGrpcWasmApi(this.endpoints.grpc) this.chainBankApi = new ChainGrpcBankApi(this.endpoints.grpc) this.chainInsuranceApi = new ChainGrpcInsuranceFundApi(this.endpoints.grpc) + this.indexerExplorerApi = new IndexerRestExplorerApi( + this.endpoints.explorer || this.endpoints.indexer, + ) this.web3Client = options.alchemyRpcUrl ? new Web3Client({ network, rpc: options.alchemyRpcUrl }) : undefined @@ -141,14 +157,7 @@ export class DenomClientAsync { // CW20 contract (ex: from Wormhole) if (isCw20ContractAddress(tokenFactoryAddress)) { - const response = await this.chainWasmApi.fetchContractState({ - contractAddress: tokenFactoryAddress, - pagination: { - reverse: true, - }, - }) - - return getTokenFromContractStateResponse(denom, response) + return await this.getCw20DenomToken(denom, tokenFactoryAddress) } // Custom Token Factory Denom @@ -315,8 +324,39 @@ export class DenomClientAsync { } } + /** + * Find token based on the hash and the base denom + * from the denom trace of the particular hash + */ + private async getCw20DenomToken( + denom: string, + cw20Contract: string, + ): Promise { + if (Object.keys(this.cachedSmartContractInfos).length === 0) { + await this.fetchAndCacheCw20Contracts() + } + + const cachedContractInfo = this.cachedSmartContractInfos[cw20Contract] + + if (cachedContractInfo && cachedContractInfo.cw20_metadata) { + return getTokenFromCw20ContractInfo( + denom, + cachedContractInfo as Contract & { cw20_metadata: { token_info: any } }, + ) + } + + const response = await this.chainWasmApi.fetchContractState({ + contractAddress: cw20Contract, + pagination: { + reverse: true, + }, + }) + + return getTokenFromContractStateResponse(denom, response) + } + private async fetchAndCacheDenomTraces() { - const denomTraces = await this.chainIbcApi.fetchDenomsTrace() + const denomTraces = await this.chainIbcApi.fetchDenomsTrace({ limit: 500 }) const denomHashes = denomTraces.map((trace) => { return { trace: trace, @@ -336,6 +376,44 @@ export class DenomClientAsync { ) } + private async fetchAndCacheCw20Contracts() { + const codeIds = CW20_CODE_IDS_BY_NETWORK(this.network) + const allContracts: Contract[] = [] + + for (const codeId of codeIds) { + let { paging, contracts: contractsFromResponse } = + await this.indexerExplorerApi.fetchContracts({ + codeId: codeId, + limit: 100, + }) + + while (paging.total > contractsFromResponse.length) { + const { paging: nextPaging, contracts: nextContractsFromResponse } = + await this.indexerExplorerApi.fetchContracts({ + codeId: codeId, + limit: 100, + skip: contractsFromResponse.length, + }) + + paging = nextPaging + contractsFromResponse.push(...nextContractsFromResponse) + } + + allContracts.push(...contractsFromResponse) + } + + const contracts = allContracts.reduce((contracts, contract) => { + return { + ...contracts, + [contract.address]: contract, + } + }, {}) + + this.cachedSmartContractInfos = { + ...contracts, + } + } + private async fetchAndCacheIbcTokens() { if (ibcTokenMetadata?.length === 0) { return @@ -348,6 +426,8 @@ export class DenomClientAsync { await this.getFactoryDenomMetadata('') await this.getInsuranceFund('') await this.fetchAndCacheDenomTraces() + await this.fetchAndCacheDenomTraces() await this.fetchAndCacheIbcTokens() + await this.fetchAndCacheCw20Contracts() } } diff --git a/packages/sdk-ui-ts/src/services/gas/estimator.ts b/packages/sdk-ui-ts/src/services/gas/estimator.ts index ab1111d18..4a5aa8dac 100644 --- a/packages/sdk-ui-ts/src/services/gas/estimator.ts +++ b/packages/sdk-ui-ts/src/services/gas/estimator.ts @@ -2,7 +2,7 @@ import { Alchemy, Network } from 'alchemy-sdk' import { Network as InjNetwork, isMainnet } from '@injectivelabs/networks' import { HttpClient } from '@injectivelabs/utils' -const HISTORICAL_BLOCKS = 20 +const HISTORICAL_BLOCKS = 4 const avg = (arr: any[]) => { const sum = arr.reduce((a, v) => a + v) @@ -11,16 +11,17 @@ const avg = (arr: any[]) => { } const formatFeeHistory = (result: any) => { - let blockNum = result.oldestBlock + const results = result.data.result + let blockNum = Number(results.oldestBlock) let index = 0 const blocks = [] - while (blockNum < result.oldestBlock + HISTORICAL_BLOCKS) { + while (blockNum < Number(results.oldestBlock) + HISTORICAL_BLOCKS) { blocks.push({ number: blockNum, - baseFeePerGas: Number(result.baseFeePerGas[index]), - gasUsedRatio: Number(result.gasUsedRatio[index]), - priorityFeePerGas: result.reward[index].map((x: string | number) => + baseFeePerGas: Number(results.baseFeePerGas[index]), + gasUsedRatio: Number(results.gasUsedRatio[index]), + priorityFeePerGas: results.reward[index].map((x: string | number) => Number(x), ), }) diff --git a/packages/sdk-ui-ts/src/services/ibc/ibcTokenMetadata.json b/packages/sdk-ui-ts/src/services/ibc/ibcTokenMetadata.json index 4592f83c2..79e1feec1 100644 --- a/packages/sdk-ui-ts/src/services/ibc/ibcTokenMetadata.json +++ b/packages/sdk-ui-ts/src/services/ibc/ibcTokenMetadata.json @@ -19,825 +19,825 @@ } }, { - "name": "Stride", - "denom": "ibc/3FDD002A3A4019B05A33D324B2F29748E77AF501BEA5C96D1F28B2D6755F9F25", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/stride/images/strd.png", - "symbol": "STRD", + "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": "3FDD002A3A4019B05A33D324B2F29748E77AF501BEA5C96D1F28B2D6755F9F25", + "hash": "factory/inj1cdwt8g7nxgtg2k4fn8sj363mh9ahkw2qt0vrnc/ampINJ", "path": "", "channelId": "", "decimals": 6, - "symbol": "STRD", - "baseDenom": "STRD", + "symbol": "ampINJ", + "baseDenom": "ampINJ", "isNative": false } }, { - "name": "stATOM", - "denom": "ibc/A8F39212ED30B6A8C2AC736665835720D3D7BE4A1D18D68566525EC25ECF1C9B", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/stride/images/statom.png", - "symbol": "stATOM", + "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": "A8F39212ED30B6A8C2AC736665835720D3D7BE4A1D18D68566525EC25ECF1C9B", + "hash": "92E0120F15D037353CFB73C14651FC8930ADC05B93100FD7754D3A689E53B333", "path": "", "channelId": "", "decimals": 6, - "symbol": "stATOM", - "baseDenom": "stATOM", + "symbol": "OSMO", + "baseDenom": "OSMO", "isNative": false } }, { - "name": "stSTARS", - "denom": "ibc/DD0F92D576A9A60487F17685A987AB6EDB359E661D281ED31F3AE560650ECFCB", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/stride/images/ststars.png", - "symbol": "stSTARS", + "name": "Ion DAO", + "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": "DD0F92D576A9A60487F17685A987AB6EDB359E661D281ED31F3AE560650ECFCB", + "hash": "1B2D7E4261A7E2130E8E3506058E3081D3154998413F0DB2F82B04035B3FE676", "path": "", "channelId": "", "decimals": 6, - "symbol": "stSTARS", - "baseDenom": "stSTARS", + "symbol": "ION", + "baseDenom": "ION", "isNative": false } }, { - "name": "stOSMO", - "denom": "ibc/6D821F3CFAE78E9EBD872FAEC61C400C0D9B72E77FA14614CF1B775A528854FD", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/stride/images/stosmo.png", - "symbol": "stOSMO", + "name": "IBC Index", + "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": "6D821F3CFAE78E9EBD872FAEC61C400C0D9B72E77FA14614CF1B775A528854FD", + "hash": "491C92BEEAFE513BABA355275C7AE3AC47AA7FD57285AC1D910CE874D2DC7CA0", "path": "", "channelId": "", "decimals": 6, - "symbol": "stOSMO", - "baseDenom": "stOSMO", + "symbol": "IBCX", + "baseDenom": "IBCX", "isNative": false } }, { - "name": "stJUNO", - "denom": "ibc/580E52A2C2DB126EE2160D1BDBBA33B5839D53B5E59D04D4FF438AE9BB7BFAAB", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/stride/images/stjuno.png", - "symbol": "stJUNO", + "name": "Staked IBCX", + "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": "580E52A2C2DB126EE2160D1BDBBA33B5839D53B5E59D04D4FF438AE9BB7BFAAB", + "hash": "0A6B424A8207047D9FD499F59177BABD8DB08BBC2316B29B702A403BFB414419", "path": "", "channelId": "", "decimals": 6, - "symbol": "stJUNO", - "baseDenom": "stJUNO", + "symbol": "stIBCX", + "baseDenom": "stIBCX", "isNative": false } }, { - "name": "stLUNA", - "denom": "ibc/E98796F283A8B56A221011C2EDF7079BB62D1EA3EEF3E7CF4C679E91C6D97D08", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/stride/images/stluna.png", - "symbol": "stLUNA", + "name": "ERIS Amplified OSMO", + "denom": "ibc/012D069D557C4DD59A670AA17E809CB7A790D778E364D0BC0A3248105DA6432D", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/osmosis/images/amposmo.png", + "symbol": "ampOSMO", "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "E98796F283A8B56A221011C2EDF7079BB62D1EA3EEF3E7CF4C679E91C6D97D08", + "hash": "012D069D557C4DD59A670AA17E809CB7A790D778E364D0BC0A3248105DA6432D", "path": "", "channelId": "", "decimals": 6, - "symbol": "stLUNA", - "baseDenom": "stLUNA", + "symbol": "ampOSMO", + "baseDenom": "ampOSMO", "isNative": false } }, { - "name": "stEVMOS", - "denom": "ibc/75F64E20A70C5059F8EA792F1C47260DC7C6CBAC69DBA60E151AD5416E93C34C", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/stride/images/stevmos.png", - "symbol": "stEVMOS", - "decimals": 18, + "name": "CDT Stablecoin", + "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": "75F64E20A70C5059F8EA792F1C47260DC7C6CBAC69DBA60E151AD5416E93C34C", + "hash": "25288BA0C7D146D37373657ECA719B9AADD49DA9E514B4172D08F7C88D56C9EF", "path": "", "channelId": "", - "decimals": 18, - "symbol": "stEVMOS", - "baseDenom": "stEVMOS", + "decimals": 6, + "symbol": "CDT", + "baseDenom": "CDT", "isNative": false } }, { - "name": "stINJ", - "denom": "ibc/AC87717EA002B0123B10A05063E69BCA274BA2C44D842AEEB41558D2856DCE93", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/stride/images/stinj.png", - "symbol": "stINJ", - "decimals": 18, + "name": "Membrane", + "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": "AC87717EA002B0123B10A05063E69BCA274BA2C44D842AEEB41558D2856DCE93", + "hash": "7AF90EDF6F5328C6C33B03DB7E33445708A46FF006932472D00D5076F5504B67", "path": "", "channelId": "", - "decimals": 18, - "symbol": "stINJ", - "baseDenom": "stINJ", + "decimals": 6, + "symbol": "MBRN", + "baseDenom": "MBRN", "isNative": false } }, { - "name": "stUMEE", - "denom": "ibc/FC8E98DF998AE88129183094E49383F94B3E5F1844C939D380AF18061FEF41EB", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/stride/images/stumee.png", - "symbol": "stUMEE", + "name": "OSMO Squared", + "denom": "ibc/AFCDF4348DBDF92BCF631B1D38628F75683F45A8A0DCE304FC9AAD4F31609916", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/osmosis/images/sqosmo.svg", + "symbol": "sqOSMO", "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "FC8E98DF998AE88129183094E49383F94B3E5F1844C939D380AF18061FEF41EB", + "hash": "AFCDF4348DBDF92BCF631B1D38628F75683F45A8A0DCE304FC9AAD4F31609916", "path": "", "channelId": "", "decimals": 6, - "symbol": "stUMEE", - "baseDenom": "stUMEE", + "symbol": "sqOSMO", + "baseDenom": "sqOSMO", "isNative": false } }, { - "name": "stCMDX", - "denom": "ibc/0CAB2CA45981598C95B6BE18252AEFE1E9E1691D8B4C661997AD7B836FD904D6", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/stride/images/stcmdx.png", - "symbol": "stCMDX", + "name": "BTC Squared", + "denom": "ibc/81C212661A115B9799C71173DD131B5077B14A3FBD26A8A9A0C669F76F434E23", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/osmosis/images/sqbtc.svg", + "symbol": "sqBTC", "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "0CAB2CA45981598C95B6BE18252AEFE1E9E1691D8B4C661997AD7B836FD904D6", + "hash": "81C212661A115B9799C71173DD131B5077B14A3FBD26A8A9A0C669F76F434E23", "path": "", "channelId": "", "decimals": 6, - "symbol": "stCMDX", - "baseDenom": "stCMDX", + "symbol": "sqBTC", + "baseDenom": "sqBTC", "isNative": false } }, { - "name": "Osmosis", - "denom": "ibc/92E0120F15D037353CFB73C14651FC8930ADC05B93100FD7754D3A689E53B333", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/osmosis/images/osmo.png", - "symbol": "OSMO", + "name": "ATOM Squared", + "denom": "ibc/C63E6285FA0EE014B89671A7A633E1CE7F62310312843B9AC7248910619143C6", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/osmosis/images/sqatom.svg", + "symbol": "sqATOM", "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "92E0120F15D037353CFB73C14651FC8930ADC05B93100FD7754D3A689E53B333", + "hash": "C63E6285FA0EE014B89671A7A633E1CE7F62310312843B9AC7248910619143C6", "path": "", "channelId": "", "decimals": 6, - "symbol": "OSMO", - "baseDenom": "OSMO", + "symbol": "sqATOM", + "baseDenom": "sqATOM", "isNative": false } }, { - "name": "Ion", - "denom": "ibc/1B2D7E4261A7E2130E8E3506058E3081D3154998413F0DB2F82B04035B3FE676", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/osmosis/images/ion.png", - "symbol": "ION", + "name": "Levana", + "denom": "ibc/4971C5E4786D5995EC7EF894FCFA9CF2E127E95D5D53A982F6A062F3F410EDB8", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/osmosis/images/levana.png", + "symbol": "LVN", "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "1B2D7E4261A7E2130E8E3506058E3081D3154998413F0DB2F82B04035B3FE676", + "hash": "4971C5E4786D5995EC7EF894FCFA9CF2E127E95D5D53A982F6A062F3F410EDB8", "path": "", "channelId": "", "decimals": 6, - "symbol": "ION", - "baseDenom": "ION", + "symbol": "LVN", + "baseDenom": "LVN", "isNative": false } }, { - "name": "IBCX Core ", - "denom": "ibc/491C92BEEAFE513BABA355275C7AE3AC47AA7FD57285AC1D910CE874D2DC7CA0", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/osmosis/images/ibcx.svg", - "symbol": "IBCX", + "name": "milkTIA", + "denom": "ibc/C2A70D6717D595F388B115200E789DC6E7EE409167B918B5F4E73838B8451A71", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/osmosis/images/milktia.png", + "symbol": "milkTIA", "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "491C92BEEAFE513BABA355275C7AE3AC47AA7FD57285AC1D910CE874D2DC7CA0", + "hash": "C2A70D6717D595F388B115200E789DC6E7EE409167B918B5F4E73838B8451A71", "path": "", "channelId": "", "decimals": 6, - "symbol": "IBCX", - "baseDenom": "IBCX", + "symbol": "milkTIA", + "baseDenom": "milkTIA", "isNative": false } }, { - "name": "stIBCX Core ", - "denom": "ibc/0A6B424A8207047D9FD499F59177BABD8DB08BBC2316B29B702A403BFB414419", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/osmosis/images/stibcx.png", - "symbol": "stIBCX", + "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": "0A6B424A8207047D9FD499F59177BABD8DB08BBC2316B29B702A403BFB414419", + "hash": "3FDD002A3A4019B05A33D324B2F29748E77AF501BEA5C96D1F28B2D6755F9F25", "path": "", "channelId": "", "decimals": 6, - "symbol": "stIBCX", - "baseDenom": "stIBCX", + "symbol": "STRD", + "baseDenom": "STRD", "isNative": false } }, { - "name": "Evmos", - "denom": "ibc/16618B7F7AC551F48C057A13F4CA5503693FBFF507719A85BC6876B8BD75F821", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/evmos/images/evmos.png", - "symbol": "EVMOS", - "decimals": 18, + "name": "Stride Staked ATOM", + "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": "16618B7F7AC551F48C057A13F4CA5503693FBFF507719A85BC6876B8BD75F821", + "hash": "A8F39212ED30B6A8C2AC736665835720D3D7BE4A1D18D68566525EC25ECF1C9B", "path": "", "channelId": "", - "decimals": 18, - "symbol": "EVMOS", - "baseDenom": "EVMOS", + "decimals": 6, + "symbol": "stATOM", + "baseDenom": "stATOM", "isNative": false } }, { - "name": "Kuji", - "denom": "ibc/9A115B56E769B92621FFF90567E2D60EFD146E86E867491DB69EEDA9ADC36204", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/kujira/images/kuji.png", - "symbol": "KUJI", + "name": "Stride Staked STARS", + "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": "9A115B56E769B92621FFF90567E2D60EFD146E86E867491DB69EEDA9ADC36204", + "hash": "DD0F92D576A9A60487F17685A987AB6EDB359E661D281ED31F3AE560650ECFCB", "path": "", "channelId": "", "decimals": 6, - "symbol": "KUJI", - "baseDenom": "KUJI", + "symbol": "stSTARS", + "baseDenom": "stSTARS", "isNative": false } }, { - "name": "USDC", - "denom": "ibc/2CBC2EA121AE42563B08028466F37B600F2D7D4282342DE938283CC3FB2BC00E", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/usdc.png", - "symbol": "USDC", + "name": "Stride Staked OSMO", + "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": "2CBC2EA121AE42563B08028466F37B600F2D7D4282342DE938283CC3FB2BC00E", + "hash": "6D821F3CFAE78E9EBD872FAEC61C400C0D9B72E77FA14614CF1B775A528854FD", "path": "", "channelId": "", "decimals": 6, - "symbol": "USDC", - "baseDenom": "USDC", + "symbol": "stOSMO", + "baseDenom": "stOSMO", "isNative": false } }, { - "name": "Frienzies", - "denom": "ibc/CDD7374B312BEF9723AAEBDE622206490E112CE2B5F49275683CCCD86C7D4BCE", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/noble/images/frnz.png", - "symbol": "FRNZ", + "name": "Stride Staked JUNO", + "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": "CDD7374B312BEF9723AAEBDE622206490E112CE2B5F49275683CCCD86C7D4BCE", + "hash": "580E52A2C2DB126EE2160D1BDBBA33B5839D53B5E59D04D4FF438AE9BB7BFAAB", "path": "", "channelId": "", "decimals": 6, - "symbol": "FRNZ", - "baseDenom": "FRNZ", + "symbol": "stJUNO", + "baseDenom": "stJUNO", "isNative": false } }, { - "name": "Axelar", - "denom": "ibc/B68C1D2682A8B69E20BB921E34C6A3A2B6D1E13E3E8C0092E373826F546DEE65", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/axl.png", - "symbol": "AXL", + "name": "Stride Staked LUNA", + "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": "B68C1D2682A8B69E20BB921E34C6A3A2B6D1E13E3E8C0092E373826F546DEE65", + "hash": "E98796F283A8B56A221011C2EDF7079BB62D1EA3EEF3E7CF4C679E91C6D97D08", "path": "", "channelId": "", "decimals": 6, - "symbol": "AXL", - "baseDenom": "AXL", + "symbol": "stLUNA", + "baseDenom": "stLUNA", "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, + "name": "Stride Staked EVMOS", + "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": "7E1AF94AD246BE522892751046F0C959B768642E5671CC3742264068D49553C0", + "hash": "75F64E20A70C5059F8EA792F1C47260DC7C6CBAC69DBA60E151AD5416E93C34C", "path": "", "channelId": "", - "decimals": 6, - "symbol": "USDC", - "baseDenom": "USDC", + "decimals": 18, + "symbol": "stEVMOS", + "baseDenom": "stEVMOS", "isNative": false } }, { - "name": "Frax", - "denom": "ibc/3E5504815B2D69DCC32B1FF54CDAC28D7DA2C445BD29C496A83732DC1D52DB90", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/_non-cosmos/ethereum/images/frax.svg", - "symbol": "FRAX", + "name": "Stride Staked INJ", + "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": "3E5504815B2D69DCC32B1FF54CDAC28D7DA2C445BD29C496A83732DC1D52DB90", + "hash": "AC87717EA002B0123B10A05063E69BCA274BA2C44D842AEEB41558D2856DCE93", "path": "", "channelId": "", "decimals": 18, - "symbol": "FRAX", - "baseDenom": "FRAX", + "symbol": "stINJ", + "baseDenom": "stINJ", "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, + "name": "Stride Staked UMEE", + "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": "265ABC4B9F767AF45CAC6FB76E930548D835EDA3E94BC56B70582A55A73D8C90", + "hash": "FC8E98DF998AE88129183094E49383F94B3E5F1844C939D380AF18061FEF41EB", "path": "", "channelId": "", - "decimals": 18, - "symbol": "DAI", - "baseDenom": "DAI", + "decimals": 6, + "symbol": "stUMEE", + "baseDenom": "stUMEE", "isNative": false } }, { - "name": "Tether USD", - "denom": "ibc/90C6F06139D663CFD7949223D257C5B5D241E72ED61EBD12FFDDA6F068715E47", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/usdt.png", - "symbol": "USDT", + "name": "Stride Staked CMDX", + "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": "90C6F06139D663CFD7949223D257C5B5D241E72ED61EBD12FFDDA6F068715E47", + "hash": "0CAB2CA45981598C95B6BE18252AEFE1E9E1691D8B4C661997AD7B836FD904D6", "path": "", "channelId": "", "decimals": 6, - "symbol": "USDT", - "baseDenom": "USDT", + "symbol": "stCMDX", + "baseDenom": "stCMDX", "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, + "name": "Stride Staked SOMM", + "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": "65A6973F7A4013335AE5FFE623FE019A78A1FEEE9B8982985099978837D764A7", + "hash": "9C234DA49B8DDAFB8F71F21BEB109F6255ECA146A32FD3A36CB9210647CBD037", "path": "", "channelId": "", - "decimals": 18, - "symbol": "WETH", - "baseDenom": "WETH", + "decimals": 6, + "symbol": "stSOMM", + "baseDenom": "stSOMM", "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, + "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": "4C8A332AE4FDE42709649B5F9A2A336192158C4465DF74B4513F5AD0C583EA6F", + "hash": "16618B7F7AC551F48C057A13F4CA5503693FBFF507719A85BC6876B8BD75F821", "path": "", "channelId": "", - "decimals": 8, - "symbol": "WBTC", - "baseDenom": "WBTC", + "decimals": 18, + "symbol": "EVMOS", + "baseDenom": "EVMOS", "isNative": false } }, { - "name": "Aave", - "denom": "ibc/49265FCAA6CC20B59652C0B45B2283A260BB19FC183DE95C29CCA8E01F8B004C", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/_non-cosmos/ethereum/images/aave.svg", - "symbol": "AAVE", + "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": "49265FCAA6CC20B59652C0B45B2283A260BB19FC183DE95C29CCA8E01F8B004C", + "hash": "F6CC233E5C0EA36B1F74AB1AF98471A2D6A80E2542856639703E908B4D93E7C4", "path": "", "channelId": "", "decimals": 18, - "symbol": "AAVE", - "baseDenom": "AAVE", + "symbol": "NEOK", + "baseDenom": "NEOK", "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, + "name": "Kujira", + "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": "8A13F5DA968B4D526E9DC5AE20B584FE62462E80AF06B9D0EA0B0DB35ABBBF27", + "hash": "9A115B56E769B92621FFF90567E2D60EFD146E86E867491DB69EEDA9ADC36204", "path": "", "channelId": "", - "decimals": 18, - "symbol": "APE", - "baseDenom": "APE", + "decimals": 6, + "symbol": "KUJI", + "baseDenom": "KUJI", "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, + "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": "EB519ECF709F0DB6BA1359F91BA2DDC5A07FB9869E1768D377EFEF9DF33DC4AB", + "hash": "58BC643F2EB5758C08D8B1569C7948A5DA796802576005F676BBFB7526E520EB", "path": "", "channelId": "", - "decimals": 18, - "symbol": "AXS", - "baseDenom": "AXS", + "decimals": 6, + "symbol": "USK", + "baseDenom": "USK", "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, + "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": "AC447F1D6EDAF817589C5FECECB6CD3B9E9EFFD33C7E16FE8820009F92A2F585", + "hash": "34E48C7C43383203519D996D1D93FE80ED50153E28FB6A9465DE463AEF2EC9EC", "path": "", "channelId": "", - "decimals": 18, - "symbol": "LINK", - "baseDenom": "LINK", + "decimals": 6, + "symbol": "ampKUJI", + "baseDenom": "ampKUJI", "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, + "name": "MantaDAO", + "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": "E8C65EFAB7804152191B8311F61877A36779277E316883D8812D3CBEFC79AE4F", + "hash": "A4495880A4A2E3C242F63C710F447BAE072E1A4C2A22F1851E0BB7ABDD26B43D", "path": "", "channelId": "", - "decimals": 18, - "symbol": "MKR", - "baseDenom": "MKR", + "decimals": 6, + "symbol": "MNTA", + "baseDenom": "MNTA", "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, + "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": "27817BAE3958FFB2BFBD8F4F6165153DFD230779994A7C42A91E0E45E8201768", + "hash": "325300CEF4149AD1BBFEB540FF07699CDEEFBB653401E872532030CFB31CD767", "path": "", "channelId": "", - "decimals": 18, - "symbol": "RAI", - "baseDenom": "RAI", + "decimals": 6, + "symbol": "WINK", + "baseDenom": "WINK", "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, + "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": "E68343A4DEF4AFBE7C5A9004D4C11888EE755A7B43B3F1AFA52F2C34C07990D5", + "hash": "45C0FE8ACE1C9C8BA38D3D6FDEBDE4F7198A434B6C63ADCEFC3D32D12443BB84", "path": "", "channelId": "", - "decimals": 18, - "symbol": "SHIB", - "baseDenom": "SHIB", + "decimals": 6, + "symbol": "BLEND", + "baseDenom": "BLEND", "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, + "name": "ERIS Amplified MNTA", + "denom": "ibc/A87178EAA371050DDFD80F78630AE622B176C7634160EE515C27CE62FCC8A0CC", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/kujira/images/ampmnta.png", + "symbol": "ampMNTA", + "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "FB1B967C690FEA7E9AD7CF76AE2255169D4EA2937D6694B2C0E61A370F76D9FB", + "hash": "A87178EAA371050DDFD80F78630AE622B176C7634160EE515C27CE62FCC8A0CC", "path": "", "channelId": "", - "decimals": 18, - "symbol": "stETH", - "baseDenom": "stETH", + "decimals": 6, + "symbol": "ampMNTA", + "baseDenom": "ampMNTA", "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, + "name": "qcKUJI", + "denom": "ibc/B7C8418ABE8CF56B42A37215F6A715097FDD82AC322FE560CA589833FEE8C50D", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/kujira/images/qckuji.svg", + "symbol": "qcKUJI", + "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "3E3A8A403AE81114F4341962A6D73162D586C9DF4CE3BE7C7B459108430675F7", + "hash": "B7C8418ABE8CF56B42A37215F6A715097FDD82AC322FE560CA589833FEE8C50D", "path": "", "channelId": "", - "decimals": 18, - "symbol": "UNI", - "baseDenom": "UNI", + "decimals": 6, + "symbol": "qcKUJI", + "baseDenom": "qcKUJI", "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, + "name": "qcMNTA", + "denom": "ibc/F770E830BC7E2992BC0DBECAC789432995B64BD6714C36EA092D877E28AA9493", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/kujira/images/qcmnta.svg", + "symbol": "qcMNTA", + "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "79D01DE88DFFC0610003439D38200E77A3D2A1CCCBE4B1958D685026ABB01814", + "hash": "F770E830BC7E2992BC0DBECAC789432995B64BD6714C36EA092D877E28AA9493", "path": "", "channelId": "", - "decimals": 18, - "symbol": "XCN", - "baseDenom": "XCN", + "decimals": 6, + "symbol": "qcMNTA", + "baseDenom": "qcMNTA", "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, + "name": "Fuzion", + "denom": "ibc/FE87E1E1BB401EC35CD02A57FE5DEF872FA309C018172C4E7DA07F194EAC6F19", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/kujira/images/fuzion.png", + "symbol": "FUZN", + "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "624BA9DD171915A2B9EA70F69638B2CEA179959850C1A586F6C485498F29EDD4", + "hash": "FE87E1E1BB401EC35CD02A57FE5DEF872FA309C018172C4E7DA07F194EAC6F19", "path": "", "channelId": "", - "decimals": 10, - "symbol": "DOT", - "baseDenom": "DOT", + "decimals": 6, + "symbol": "FUZN", + "baseDenom": "FUZN", "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, + "name": "Fuzion Receipt", + "denom": "ibc/F5FFC37BBF4B24F94D920BC7DAFCCE5B9403B2DB33DF759B8CED76EA8A6E3E24", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/kujira/images/fuzionr.png", + "symbol": "rFUZN", + "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "8FF72FB47F07B4AFA8649500A168683BEFCB9EE164BD331FA597D26224D51055", + "hash": "F5FFC37BBF4B24F94D920BC7DAFCCE5B9403B2DB33DF759B8CED76EA8A6E3E24", "path": "", "channelId": "", - "decimals": 18, - "symbol": "WGLMR", - "baseDenom": "WGLMR", + "decimals": 6, + "symbol": "rFUZN", + "baseDenom": "rFUZN", "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, + "name": "Unstake Fi", + "denom": "ibc/35366063B530778DC37A16AAED4DDC14C0DCA161FBF55B5B69F5171FEE19BF93", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/kujira/images/nstk.svg", + "symbol": "NSTK", + "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "7E23647941230DA0AB4ED10F599647D9BE34E1C991D0DA032B5A1522941EBA73", + "hash": "35366063B530778DC37A16AAED4DDC14C0DCA161FBF55B5B69F5171FEE19BF93", "path": "", "channelId": "", - "decimals": 18, - "symbol": "WMATIC", - "baseDenom": "WMATIC", + "decimals": 6, + "symbol": "NSTK", + "baseDenom": "NSTK", "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, + "name": "LOCAL", + "denom": "ibc/FECCDCFA89278B117C76A11A946A7991A68E5DD12DED6EB938ADC1B1286AC591", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/kujira/images/local.png", + "symbol": "LOCAL", + "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "B877B8EF095028B807370AB5C7790CA0C328777C9FF09AA7F5436BA7FAE4A86F", + "hash": "FECCDCFA89278B117C76A11A946A7991A68E5DD12DED6EB938ADC1B1286AC591", "path": "", "channelId": "", - "decimals": 18, - "symbol": "WBNB", - "baseDenom": "WBNB", + "decimals": 6, + "symbol": "LOCAL", + "baseDenom": "LOCAL", "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, + "name": "Fuzion Yield", + "denom": "ibc/71C297610507CCB7D42E49EA49AF2ECBBE2D4A83D139C4A441EB7A2693C0464A", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/kujira/images/fuziony.svg", + "symbol": "yFUZN", + "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "A62F794AAEC56B6828541224D91DA3E21423AB0DC4D21ECB05E4588A07BD934C", + "hash": "71C297610507CCB7D42E49EA49AF2ECBBE2D4A83D139C4A441EB7A2693C0464A", "path": "", "channelId": "", - "decimals": 18, - "symbol": "BUSD", - "baseDenom": "BUSD", + "decimals": 6, + "symbol": "yFUZN", + "baseDenom": "yFUZN", "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, + "name": "Umee", + "denom": "ibc/2FF3DC3A0265B9A220750E75E75E5D44ED2F716B8AC4EDC378A596CC958ABF6B", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/umee/images/umee.png", + "symbol": "UMEE", + "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "A4FF8E161D2835BA06A7522684E874EFC91004AD0CD14E038F37940562158D73", + "hash": "2FF3DC3A0265B9A220750E75E75E5D44ED2F716B8AC4EDC378A596CC958ABF6B", "path": "", "channelId": "", - "decimals": 18, - "symbol": "WAVAX", - "baseDenom": "WAVAX", + "decimals": 6, + "symbol": "UMEE", + "baseDenom": "UMEE", "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, + "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": "31E8DDA49D53535F358B29CFCBED1B9224DAAFE82788C0477930DCDE231DA878", + "hash": "C4CFF46FD6DE35CA4CF4CE031E643C8FDC9BA4B99AE598E9B0ED98FE3A2319F9", "path": "", "channelId": "", - "decimals": 18, - "symbol": "WFTM", - "baseDenom": "WFTM", + "decimals": 6, + "symbol": "ATOM", + "baseDenom": "ATOM", "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", + "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": "2E93E8914CA07B73A794657DA76170A016057D1C6B0DC42D969918D4F22D95A3", + "hash": "B68C1D2682A8B69E20BB921E34C6A3A2B6D1E13E3E8C0092E373826F546DEE65", "path": "", "channelId": "", "decimals": 6, - "symbol": "USDC", - "baseDenom": "USDC", + "symbol": "AXL", + "baseDenom": "AXL", "isNative": false } }, { - "name": "USD Coin from Avalanche", - "denom": "ibc/705E7E25F94467E363B2EB324A5A6FF4C683A4A6D20AAD2AEEABA2D9EB1B897F", + "name": "USD Coin", + "denom": "ibc/7E1AF94AD246BE522892751046F0C959B768642E5671CC3742264068D49553C0", "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/usdc.png", "symbol": "USDC", "decimals": 6, @@ -845,7 +845,7 @@ "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "705E7E25F94467E363B2EB324A5A6FF4C683A4A6D20AAD2AEEABA2D9EB1B897F", + "hash": "7E1AF94AD246BE522892751046F0C959B768642E5671CC3742264068D49553C0", "path": "", "channelId": "", "decimals": 6, @@ -855,553 +855,1579 @@ } }, { - "name": "Arbitrum", - "denom": "ibc/F28C5C931D2673B7A2F06FC74934F7BDC0D2906D2AF40D582ED27D1E5C48D475", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/_non-cosmos/arbitrum/images/arb.png", - "symbol": "ARB", + "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": "F28C5C931D2673B7A2F06FC74934F7BDC0D2906D2AF40D582ED27D1E5C48D475", + "hash": "3E5504815B2D69DCC32B1FF54CDAC28D7DA2C445BD29C496A83732DC1D52DB90", "path": "", "channelId": "", "decimals": 18, - "symbol": "ARB", - "baseDenom": "ARB", + "symbol": "FRAX", + "baseDenom": "FRAX", "isNative": false } }, { - "name": "Pepe", - "denom": "ibc/9144D78830C5ABD7B7D9E219EA7600E3A0E0AD5FC50C007668160595E94789AB", - "logo": "https://ibc.tfm.com/custom/tokens/pepe-wei.logo.svg", - "symbol": "PEPE", + "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": "9144D78830C5ABD7B7D9E219EA7600E3A0E0AD5FC50C007668160595E94789AB", + "hash": "265ABC4B9F767AF45CAC6FB76E930548D835EDA3E94BC56B70582A55A73D8C90", "path": "", "channelId": "", "decimals": 18, - "symbol": "PEPE", - "baseDenom": "PEPE", + "symbol": "DAI", + "baseDenom": "DAI", "isNative": false } }, { - "name": "Wrapped FIL from Filecoin", - "denom": "ibc/9D1889339AEC850B1D719CCF19BD813955C086BE1ED323ED68318A273922E40D", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/_non-cosmos/filecoin/images/wfil.png", - "symbol": "axlFIL", + "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": "9D1889339AEC850B1D719CCF19BD813955C086BE1ED323ED68318A273922E40D", + "hash": "65A6973F7A4013335AE5FFE623FE019A78A1FEEE9B8982985099978837D764A7", "path": "", "channelId": "", "decimals": 18, - "symbol": "axlFIL", - "baseDenom": "axlFIL", + "symbol": "WETH", + "baseDenom": "WETH", "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, + "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": "C4CFF46FD6DE35CA4CF4CE031E643C8FDC9BA4B99AE598E9B0ED98FE3A2319F9", + "hash": "4C8A332AE4FDE42709649B5F9A2A336192158C4465DF74B4513F5AD0C583EA6F", "path": "", "channelId": "", - "decimals": 6, - "symbol": "ATOM", - "baseDenom": "ATOM", + "decimals": 8, + "symbol": "WBTC", + "baseDenom": "WBTC", "isNative": false } }, { - "name": "Persistence", - "denom": "ibc/B786E7CBBF026F6F15A8DA248E0F18C62A0F7A70CB2DABD9239398C8B5150ABB", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/persistence/images/xprt.png", - "symbol": "XPRT", - "decimals": 6, + "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": "B786E7CBBF026F6F15A8DA248E0F18C62A0F7A70CB2DABD9239398C8B5150ABB", + "hash": "49265FCAA6CC20B59652C0B45B2283A260BB19FC183DE95C29CCA8E01F8B004C", "path": "", "channelId": "", - "decimals": 6, - "symbol": "XPRT", - "baseDenom": "XPRT", + "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/_non-cosmos/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://raw.githubusercontent.com/cosmos/chain-registry/master/_non-cosmos/ethereum/images/pepe.png", + "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": "https://raw.githubusercontent.com/cosmos/chain-registry/master/_non-cosmos/ethereum/images/cbeth.png", + "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": "https://raw.githubusercontent.com/cosmos/chain-registry/master/_non-cosmos/ethereum/images/reth.png", + "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": "https://raw.githubusercontent.com/cosmos/chain-registry/master/_non-cosmos/ethereum/images/sfrxeth.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": "https://raw.githubusercontent.com/cosmos/chain-registry/master/_non-cosmos/ethereum/images/wsteth.svg", + "symbol": "wstETH", + "decimals": 18, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "1E0FC59FB8495BF927B10E9D515661494B1BBEDAA15D80E52FE2BADA64656D16", + "path": "", + "channelId": "", + "decimals": 18, + "symbol": "wstETH", + "baseDenom": "wstETH", + "isNative": false + } + }, + { + "name": "Real Yield Eth", + "denom": "ibc/6B7E243C586784E1BE150B71F541A3880F0409E994365AF31FF63A2764B72556", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/_non-cosmos/ethereum/images/yieldeth.png", + "symbol": "YieldETH", + "decimals": 18, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "6B7E243C586784E1BE150B71F541A3880F0409E994365AF31FF63A2764B72556", + "path": "", + "channelId": "", + "decimals": 18, + "symbol": "YieldETH", + "baseDenom": "YieldETH", + "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": "PSTAKE staked OSMO", + "denom": "ibc/F60E1792296F6264E594B5F87C3B5CDE859A1D9B3421F203E986B7BA3C4E05F1", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/persistence/images/stkosmo.png", + "symbol": "stkOSMO", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "F60E1792296F6264E594B5F87C3B5CDE859A1D9B3421F203E986B7BA3C4E05F1", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "stkOSMO", + "baseDenom": "stkOSMO", + "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": "Kava 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": "Kava 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": "Kava 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/_non-cosmos/ethereum/images/usdt.svg", + "symbol": "USDT", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "4ABBEF4C8926DDDB320AE5188CFD63267ABBCEFC0583E4AE05D6E5AA2401DDAB", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "USDT", + "baseDenom": "USDT", + "isNative": false + } + }, + { + "name": "DAI", + "denom": "ibc/433133545CF68587777A01C3EFCF720EFE1B42F14AB2153D349DC4559984F2E8", + "logo": "unknown.png", + "symbol": "DAI", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "433133545CF68587777A01C3EFCF720EFE1B42F14AB2153D349DC4559984F2E8", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "DAI", + "baseDenom": "DAI", + "isNative": false + } + }, + { + "name": "axlWBTC", + "denom": "ibc/F57B53E102171E6DC254532ECC184228BB8E23B755AD55FA6FDCBD70464A9A54", + "logo": "unknown.png", + "symbol": "axlWBTC", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "F57B53E102171E6DC254532ECC184228BB8E23B755AD55FA6FDCBD70464A9A54", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "axlWBTC", + "baseDenom": "axlWBTC", + "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/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": "USDT", + "denom": "ibc/24E5D0825D3D71BF00C4A01CD8CA8F2D27B1DD32B7446CF633534AEA25379271", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/usdt.png", + "symbol": "USDT", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "24E5D0825D3D71BF00C4A01CD8CA8F2D27B1DD32B7446CF633534AEA25379271", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "USDT", + "baseDenom": "USDT", + "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": "Sommelier", + "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": "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": "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": "Luna", + "denom": "ibc/0DDC992F19041FC1D499CCA1486721479EBAA7270604E15EDDFABA89D1E772E5", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/terra2/images/luna.png", + "symbol": "LUNA", + "decimals": 6, + "coinGeckoId": "", + "tokenType": "ibc", + "tokenVerification": "external", + "ibc": { + "hash": "0DDC992F19041FC1D499CCA1486721479EBAA7270604E15EDDFABA89D1E772E5", + "path": "", + "channelId": "", + "decimals": 6, + "symbol": "LUNA", + "baseDenom": "LUNA", "isNative": false } }, { - "name": "PSTAKE staked ATOM", - "denom": "ibc/B8E30AECB0FB5BA1B02747BE003E55934A9E42488495412C7E9934FBEC06B201", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/persistence/images/stkatom.png", - "symbol": "stkATOM", + "name": "ERIS Alliance Staked ampWHALE", + "denom": "ibc/DF3225D7381562B58AA8BE107A87260DDDC7FA08E4B0898E3D795392CF844BBE", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/terra2/images/ampwhalet.svg", + "symbol": "ampWHALEt", "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "B8E30AECB0FB5BA1B02747BE003E55934A9E42488495412C7E9934FBEC06B201", + "hash": "DF3225D7381562B58AA8BE107A87260DDDC7FA08E4B0898E3D795392CF844BBE", "path": "", "channelId": "", "decimals": 6, - "symbol": "stkATOM", - "baseDenom": "stkATOM", + "symbol": "ampWHALEt", + "baseDenom": "ampWHALEt", "isNative": false } }, { - "name": "Whale", - "denom": "ibc/D6E6A20ABDD600742D22464340A7701558027759CE14D12590F8EA869CCCF445", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/migaloo/images/white-whale.png", - "symbol": "WHALE", + "name": "ERIS Alliance Staked boneWHALE", + "denom": "ibc/F993B2C44A70D8B97B09581F12CF1A68A38DF8BBCFBA9F82016984138C718A57", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/terra2/images/bonewhalet.svg", + "symbol": "boneWHALEt", "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "D6E6A20ABDD600742D22464340A7701558027759CE14D12590F8EA869CCCF445", + "hash": "F993B2C44A70D8B97B09581F12CF1A68A38DF8BBCFBA9F82016984138C718A57", "path": "", "channelId": "", "decimals": 6, - "symbol": "WHALE", - "baseDenom": "WHALE", + "symbol": "boneWHALEt", + "baseDenom": "boneWHALEt", "isNative": false } }, { - "name": "boneWHALE", - "denom": "ibc/ECB0AA28D6001EF985047558C410B65581FC85BD92D4E3CFCCA0D3D964C67CC2", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/migaloo/images/bWHALE.png", - "symbol": "bWHALE", + "name": "ERIS Amplified ROAR", + "denom": "ibc/7BE54594EAE77464217B9BB5171035946ED23DB309B030B5708E15C9455BB557", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/terra2/images/amproar.png", + "symbol": "ampROAR", "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "ECB0AA28D6001EF985047558C410B65581FC85BD92D4E3CFCCA0D3D964C67CC2", + "hash": "7BE54594EAE77464217B9BB5171035946ED23DB309B030B5708E15C9455BB557", "path": "", "channelId": "", "decimals": 6, - "symbol": "bWHALE", - "baseDenom": "bWHALE", + "symbol": "ampROAR", + "baseDenom": "ampROAR", "isNative": false } }, { - "name": "ampWHALE", - "denom": "ibc/168C3904C45C6FE3539AE85A8892DF87371D00EA7942515AFC50AA43C4BB0A32", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/migaloo/images/ampwhale.svg", - "symbol": "ampWHALE", + "name": "Celestia", + "denom": "ibc/F51BB221BAA275F2EBF654F70B005627D7E713AFFD6D86AFD1E43CAA886149F4", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/celestia/images/celestia.png", + "symbol": "TIA", "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "168C3904C45C6FE3539AE85A8892DF87371D00EA7942515AFC50AA43C4BB0A32", + "hash": "F51BB221BAA275F2EBF654F70B005627D7E713AFFD6D86AFD1E43CAA886149F4", "path": "", "channelId": "", "decimals": 6, - "symbol": "ampWHALE", - "baseDenom": "ampWHALE", + "symbol": "TIA", + "baseDenom": "TIA", "isNative": false } }, { - "name": "FABLE", - "denom": "ibc/5FE5E50EA0DF6D68C29EDFB7992EB81CD40B6780C33834A8AB3712FB148E1313", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/migaloo/images/fable.svg", - "symbol": "FABLE", + "name": "qcFUZN", + "denom": "ibc/5E44326A289ED1CA0536517BC958881B611D21CBB33EBE068F1E04A502A9F548", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/kujira/images/qcfuzn.svg", + "symbol": "qcFUZN", "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "5FE5E50EA0DF6D68C29EDFB7992EB81CD40B6780C33834A8AB3712FB148E1313", + "hash": "5E44326A289ED1CA0536517BC958881B611D21CBB33EBE068F1E04A502A9F548", "path": "", "channelId": "", "decimals": 6, - "symbol": "FABLE", - "baseDenom": "FABLE", + "symbol": "qcFUZN", + "baseDenom": "qcFUZN", "isNative": false } }, { - "name": "RAC", - "denom": "ibc/0F3A724673F682CF7812D0ED1A0C41D344C09E94C939E79D12712DC7C0676E80", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/migaloo/images/rac.png", - "symbol": "RAC", + "name": "Nois", + "denom": "ibc/DD9182E8E2B13C89D6B4707C7B43E8DB6193F9FF486AFA0E6CF86B427B0D231A", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/nois/images/nois.png", + "symbol": "NOIS", "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "0F3A724673F682CF7812D0ED1A0C41D344C09E94C939E79D12712DC7C0676E80", + "hash": "DD9182E8E2B13C89D6B4707C7B43E8DB6193F9FF486AFA0E6CF86B427B0D231A", "path": "", "channelId": "", "decimals": 6, - "symbol": "RAC", - "baseDenom": "RAC", + "symbol": "NOIS", + "baseDenom": "NOIS", "isNative": false } }, { - "name": "ASH", - "denom": "ibc/EED40547772504DF629EFEC08892E689CD14498B1C0AD766CD5075BBBEE3D808", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/migaloo/images/ash.svg", - "symbol": "ASH", - "decimals": 6, + "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": "EED40547772504DF629EFEC08892E689CD14498B1C0AD766CD5075BBBEE3D808", + "hash": "9C2212CB87241A8D038222CF66BBCFABDD08330DFA0AC9B451135287DCBDC7A8", "path": "", "channelId": "", - "decimals": 6, - "symbol": "ASH", - "baseDenom": "ASH", + "decimals": 12, + "symbol": "PICA", + "baseDenom": "PICA", "isNative": false } }, { - "name": "Somm", - "denom": "ibc/34346A60A95EB030D62D6F5BDD4B745BE18E8A693372A8A347D5D53DBBB1328B", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/sommelier/images/somm.png", - "symbol": "SOMM", + "name": "OSMO", + "denom": "ibc/C2025C1D34ED74CD6F9DF86CD650D92219AF645E9D0ADFFACF4E2CBECE649536", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/osmosis/images/osmo.png", + "symbol": "OSMO", "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "34346A60A95EB030D62D6F5BDD4B745BE18E8A693372A8A347D5D53DBBB1328B", + "hash": "C2025C1D34ED74CD6F9DF86CD650D92219AF645E9D0ADFFACF4E2CBECE649536", "path": "", "channelId": "", "decimals": 6, - "symbol": "SOMM", - "baseDenom": "SOMM", + "symbol": "OSMO", + "baseDenom": "OSMO", "isNative": false } }, { - "name": "Crescent", - "denom": "ibc/3A6DD3358D9F7ADD18CDE79BA10B400511A5DE4AE2C037D7C9639B52ADAF35C6", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/crescent/images/cre.png", - "symbol": "CRE", + "name": "STRD", + "denom": "ibc/02683677B1A58ECF74FFF25711E09735C44153FE9490BE5EF9FD21DE82BCB542", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/stride/images/strd.png", + "symbol": "STRD", "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "3A6DD3358D9F7ADD18CDE79BA10B400511A5DE4AE2C037D7C9639B52ADAF35C6", + "hash": "02683677B1A58ECF74FFF25711E09735C44153FE9490BE5EF9FD21DE82BCB542", "path": "", "channelId": "", "decimals": 6, - "symbol": "CRE", - "baseDenom": "CRE", + "symbol": "STRD", + "baseDenom": "STRD", "isNative": false } }, { - "name": "Bonded Crescent", - "denom": "ibc/D9E839DE6F40C036592B6CEDB73841EE9A18987BC099DD112762A46AFE72159B", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/crescent/images/bcre.png", - "symbol": "bCRE", + "name": "BLD", + "denom": "ibc/B7933C59879BFE059942C6F76CAF4B1609D441AD22D54D42DAC00CE7918CAF1F", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/agoric/images/bld.png", + "symbol": "BLD", "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "D9E839DE6F40C036592B6CEDB73841EE9A18987BC099DD112762A46AFE72159B", + "hash": "B7933C59879BFE059942C6F76CAF4B1609D441AD22D54D42DAC00CE7918CAF1F", "path": "", "channelId": "", "decimals": 6, - "symbol": "bCRE", - "baseDenom": "bCRE", + "symbol": "BLD", + "baseDenom": "BLD", "isNative": false } }, { - "name": "Secret Network", - "denom": "ibc/0954E1C28EB7AF5B72D24F3BC2B47BBB2FDF91BDDFD57B74B99E133AED40972A", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/secretnetwork/images/scrt.png", - "symbol": "SCRT", + "name": "stATOM", + "denom": "ibc/B024EC4AE846F690CB46C1CE886BE7DCE27CBBB6CE1E4EFBA4AA764E07B81A69", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/stride/images/statom.png", + "symbol": "stATOM", "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "0954E1C28EB7AF5B72D24F3BC2B47BBB2FDF91BDDFD57B74B99E133AED40972A", + "hash": "B024EC4AE846F690CB46C1CE886BE7DCE27CBBB6CE1E4EFBA4AA764E07B81A69", "path": "", "channelId": "", "decimals": 6, - "symbol": "SCRT", - "baseDenom": "SCRT", + "symbol": "stATOM", + "baseDenom": "stATOM", "isNative": false } }, { - "name": "Coinbase Wrapped Staked ETH", - "denom": "ibc/545E97C6EFB2633645720DEBCA78B2BE6F5382C4693EA7DEB2D4C456371EA4F0", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/_non-cosmos/ethereum/images/cbeth.png", - "symbol": "cbETH", - "decimals": 18, + "name": "NTRN", + "denom": "ibc/E8E84092B9063AAC97846712D43D6555928073B8A0BFFCC2549E55EE224F1610", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/neutron/images/ntrn.png", + "symbol": "NTRN", + "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "545E97C6EFB2633645720DEBCA78B2BE6F5382C4693EA7DEB2D4C456371EA4F0", + "hash": "E8E84092B9063AAC97846712D43D6555928073B8A0BFFCC2549E55EE224F1610", "path": "", "channelId": "", - "decimals": 18, - "symbol": "cbETH", - "baseDenom": "cbETH", + "decimals": 6, + "symbol": "NTRN", + "baseDenom": "NTRN", "isNative": false } }, { - "name": "Rocket Pool Ether", - "denom": "ibc/8906BF683A89D1ABE075A49EFA35A3128D7E9D809775B8E9D5AEEAA55D2889DD", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/_non-cosmos/ethereum/images/reth.png", - "symbol": "rETH", - "decimals": 18, + "name": "UMEE", + "denom": "ibc/221E9E20795E6E250532A6A871E7F6310FCEDFC69B681037BBA6561270360D86", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/umee/images/umee.png", + "symbol": "UMEE", + "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "8906BF683A89D1ABE075A49EFA35A3128D7E9D809775B8E9D5AEEAA55D2889DD", + "hash": "221E9E20795E6E250532A6A871E7F6310FCEDFC69B681037BBA6561270360D86", "path": "", "channelId": "", - "decimals": 18, - "symbol": "rETH", - "baseDenom": "rETH", + "decimals": 6, + "symbol": "UMEE", + "baseDenom": "UMEE", "isNative": false } }, { - "name": "Staked Frax Ether", - "denom": "ibc/E918585C09958BD328DD9E7215E4726623E7A9A94342FEA5BE126A2AAF920730", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/_non-cosmos/ethereum/images/sfrxeth.svg", - "symbol": "sfrxETH", - "decimals": 18, + "name": "CRE", + "denom": "ibc/DDE000907D85FB1F358B3FBB1143452BE13F68E0BEA0DFFD8787095B76EEE0A1", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/crescent/images/cre.png", + "symbol": "CRE", + "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "E918585C09958BD328DD9E7215E4726623E7A9A94342FEA5BE126A2AAF920730", + "hash": "DDE000907D85FB1F358B3FBB1143452BE13F68E0BEA0DFFD8787095B76EEE0A1", "path": "", "channelId": "", - "decimals": 18, - "symbol": "sfrxETH", - "baseDenom": "sfrxETH", + "decimals": 6, + "symbol": "CRE", + "baseDenom": "CRE", "isNative": false } }, { - "name": "Wrapped Lido Staked Ether", - "denom": "ibc/1E0FC59FB8495BF927B10E9D515661494B1BBEDAA15D80E52FE2BADA64656D16", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/_non-cosmos/ethereum/images/wsteth.svg", - "symbol": "wstETH", - "decimals": 18, + "name": "SCRT", + "denom": "ibc/7C4A4847D6898FA8744A8F2A4FC287E98CA5A95E05842B897B3FB301103C8AB6", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/secretnetwork/images/scrt.png", + "symbol": "SCRT", + "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "1E0FC59FB8495BF927B10E9D515661494B1BBEDAA15D80E52FE2BADA64656D16", + "hash": "7C4A4847D6898FA8744A8F2A4FC287E98CA5A95E05842B897B3FB301103C8AB6", "path": "", "channelId": "", - "decimals": 18, - "symbol": "wstETH", - "baseDenom": "wstETH", + "decimals": 6, + "symbol": "SCRT", + "baseDenom": "SCRT", "isNative": false } }, { - "name": "Real Yield Eth", - "denom": "ibc/6B7E243C586784E1BE150B71F541A3880F0409E994365AF31FF63A2764B72556", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/_non-cosmos/ethereum/images/yieldeth.png", - "symbol": "YieldETH", - "decimals": 18, + "name": "STARS", + "denom": "ibc/4D29F082A3C083C85C886B92A1EB438C3FC0632E5F9E4D875479BEB7B9511BD5", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/stargaze/images/stars.png", + "symbol": "STARS", + "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "6B7E243C586784E1BE150B71F541A3880F0409E994365AF31FF63A2764B72556", + "hash": "4D29F082A3C083C85C886B92A1EB438C3FC0632E5F9E4D875479BEB7B9511BD5", "path": "", "channelId": "", - "decimals": 18, - "symbol": "YieldETH", - "baseDenom": "YieldETH", + "decimals": 6, + "symbol": "STARS", + "baseDenom": "STARS", "isNative": false } }, { - "name": "Celestia", - "denom": "ibc/F51BB221BAA275F2EBF654F70B005627D7E713AFFD6D86AFD1E43CAA886149F4", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/celestia/images/celestia.png", - "symbol": "TIA", + "name": "bCRE", + "denom": "ibc/83D54420DD46764F2ED5EE511DAA63EC28012480A245D8E33AA1F7D1FB15D736", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/crescent/images/bcre.png", + "symbol": "bCRE", "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "F51BB221BAA275F2EBF654F70B005627D7E713AFFD6D86AFD1E43CAA886149F4", + "hash": "83D54420DD46764F2ED5EE511DAA63EC28012480A245D8E33AA1F7D1FB15D736", "path": "", "channelId": "", "decimals": 6, - "symbol": "TIA", - "baseDenom": "TIA", + "symbol": "bCRE", + "baseDenom": "bCRE", "isNative": false } - }, - { - "name": "Luna", - "denom": "ibc/0DDC992F19041FC1D499CCA1486721479EBAA7270604E15EDDFABA89D1E772E5", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/terra2/images/luna.png", - "symbol": "LUNA", + }, + { + "name": "HUAHUA", + "denom": "ibc/9D9B59CA222E54842555DBD81B22EEABE61796D4C6EC8AB47A97C388333AC340", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/chihuahua/images/huahua.png", + "symbol": "HUAHUA", "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "0DDC992F19041FC1D499CCA1486721479EBAA7270604E15EDDFABA89D1E772E5", + "hash": "9D9B59CA222E54842555DBD81B22EEABE61796D4C6EC8AB47A97C388333AC340", "path": "", "channelId": "", "decimals": 6, - "symbol": "LUNA", - "baseDenom": "LUNA", + "symbol": "HUAHUA", + "baseDenom": "HUAHUA", "isNative": false } }, { - "name": "ERIS Alliance Staked ampWHALE", - "denom": "ibc/DF3225D7381562B58AA8BE107A87260DDDC7FA08E4B0898E3D795392CF844BBE", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/terra2/images/ampwhalet.svg", - "symbol": "ampWHALEt", + "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": "DF3225D7381562B58AA8BE107A87260DDDC7FA08E4B0898E3D795392CF844BBE", + "hash": "377F82FD1E4F6408B1CB7C8BFF9134A1F2C5D5E5CC2760BAD972AF0F7F6D4675", "path": "", "channelId": "", "decimals": 6, - "symbol": "ampWHALEt", - "baseDenom": "ampWHALEt", + "symbol": "ATOM", + "baseDenom": "ATOM", "isNative": false } }, { - "name": "ERIS Alliance Staked boneWHALE", - "denom": "ibc/F993B2C44A70D8B97B09581F12CF1A68A38DF8BBCFBA9F82016984138C718A57", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/terra2/images/bonewhalet.svg", - "symbol": "boneWHALEt", + "name": "AtomEconomicZone69JaeKwonInu", + "denom": "ibc/AEE5A4EF1B28693C4FF12F046C17197E509030B18F70FE3D74F6C3542BB008AD", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/neutron/images/circus.png", + "symbol": "CIRCUS", "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "F993B2C44A70D8B97B09581F12CF1A68A38DF8BBCFBA9F82016984138C718A57", + "hash": "AEE5A4EF1B28693C4FF12F046C17197E509030B18F70FE3D74F6C3542BB008AD", "path": "", "channelId": "", "decimals": 6, - "symbol": "boneWHALEt", - "baseDenom": "boneWHALEt", + "symbol": "CIRCUS", + "baseDenom": "CIRCUS", "isNative": false } }, { - "name": "ERIS Amplified ROAR", - "denom": "ibc/7BE54594EAE77464217B9BB5171035946ED23DB309B030B5708E15C9455BB557", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/terra2/images/amproar.png", - "symbol": "ampROAR", + "name": "USDC", + "denom": "ibc/DF32F083238097AD2CA5444BFB8F338534C32865EFE0696C5AF89AFB3A0144D6", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/usdc.png", + "symbol": "USDC", "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "7BE54594EAE77464217B9BB5171035946ED23DB309B030B5708E15C9455BB557", + "hash": "DF32F083238097AD2CA5444BFB8F338534C32865EFE0696C5AF89AFB3A0144D6", "path": "", "channelId": "", "decimals": 6, - "symbol": "ampROAR", - "baseDenom": "ampROAR", + "symbol": "USDC", + "baseDenom": "USDC", "isNative": false } }, { - "name": "ERIS Amplified MNTA", - "denom": "ibc/A87178EAA371050DDFD80F78630AE622B176C7634160EE515C27CE62FCC8A0CC", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/kujira/images/ampmnta.png", - "symbol": "ampMNTA", + "name": "Multichain USDC", + "denom": "ibc/610D4A1B3F3198C35C09E9AF7C8FB81707912463357C9398B02C7F13049678A8", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/usdc.png", + "symbol": "USDC", "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "A87178EAA371050DDFD80F78630AE622B176C7634160EE515C27CE62FCC8A0CC", + "hash": "610D4A1B3F3198C35C09E9AF7C8FB81707912463357C9398B02C7F13049678A8", "path": "", "channelId": "", "decimals": 6, - "symbol": "ampMNTA", - "baseDenom": "ampMNTA", + "symbol": "USDC", + "baseDenom": "USDC", "isNative": false } }, { - "name": "Astroport", - "denom": "ibc/EBD5A24C554198EBAF44979C5B4D2C2D312E6EBAB71962C92F735499C7575839", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/terra/images/astro.png", - "symbol": "ASTRO", - "decimals": 6, + "name": "Dot", + "denom": "ibc/B0442E32E21ED4228301A2B1B247D3F3355B73BF288470F9643AAD0CA07DD593", + "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": "EBD5A24C554198EBAF44979C5B4D2C2D312E6EBAB71962C92F735499C7575839", + "hash": "B0442E32E21ED4228301A2B1B247D3F3355B73BF288470F9643AAD0CA07DD593", "path": "", "channelId": "", - "decimals": 6, - "symbol": "ASTRO", - "baseDenom": "ASTRO", + "decimals": 10, + "symbol": "DOT", + "baseDenom": "DOT", "isNative": false } }, { - "name": "ERIS Amplified LUNA", - "denom": "ibc/751CCECAF75D686B1DC8708BE62F8C7411B211750E6009C6AC4C93881F0543E8", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/terra2/images/ampluna.svg", - "symbol": "ampLUNA", + "name": "Plankton", + "denom": "ibc/020098CDEC3D7555210CBC1593A175A6B24253823B0B711D072EC95F76FA4D42", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/kujira/images/PLNK_drk.png", + "symbol": "PLNK", "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "751CCECAF75D686B1DC8708BE62F8C7411B211750E6009C6AC4C93881F0543E8", + "hash": "020098CDEC3D7555210CBC1593A175A6B24253823B0B711D072EC95F76FA4D42", "path": "", "channelId": "", "decimals": 6, - "symbol": "ampLUNA", - "baseDenom": "ampLUNA", + "symbol": "PLNK", + "baseDenom": "PLNK", "isNative": false } }, @@ -1425,21 +2451,21 @@ } }, { - "name": "boneLuna", - "denom": "ibc/C9D55B62C9D9CA84DD94DC019009B840DDFD861BF2F33F7CF2A8A74933797680", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/terra2/images/boneluna.png", - "symbol": "bLUNA", - "decimals": 6, + "name": "TheOnlyOne", + "denom": "ibc/C0B67C5C6E3D8ED32B5FEC0E5A4F4E5D0257C62B4FDE5E569AF425B6A0059CC4", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/terra2/images/xxx3.png", + "symbol": "xxx", + "decimals": 10, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "C9D55B62C9D9CA84DD94DC019009B840DDFD861BF2F33F7CF2A8A74933797680", + "hash": "C0B67C5C6E3D8ED32B5FEC0E5A4F4E5D0257C62B4FDE5E569AF425B6A0059CC4", "path": "", "channelId": "", - "decimals": 6, - "symbol": "bLUNA", - "baseDenom": "bLUNA", + "decimals": 10, + "symbol": "xxx", + "baseDenom": "xxx", "isNative": false } }, @@ -1462,6 +2488,25 @@ "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": "sayve", "denom": "ibc/DF2B99CF1FEA6B292E79617BD6F7EF735C0B47CEF09D7104E270956E96C38B12", @@ -1481,6 +2526,44 @@ "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": "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": "BLUE CUB DAO", "denom": "ibc/B692197280D4E62F8D9F8E5C0B697DC4C2C680ED6DE8FFF0368E0552C9215607", @@ -1501,332 +2584,332 @@ } }, { - "name": "Kava", - "denom": "ibc/57AA1A70A4BC9769C525EBF6386F7A21536E04A79D62E1981EFCEF9428EBB205", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/kava/images/kava.png", - "symbol": "KAVA", - "decimals": 6, + "name": "dinheiro", + "denom": "ibc/306269448B7ED8EC0DB6DC30BAEA279A9190E1D583572681749B9C0D44915DAB", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/terra2/images/Dinheiros.png", + "symbol": "DINHEIROS", + "decimals": 18, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "57AA1A70A4BC9769C525EBF6386F7A21536E04A79D62E1981EFCEF9428EBB205", + "hash": "306269448B7ED8EC0DB6DC30BAEA279A9190E1D583572681749B9C0D44915DAB", "path": "", "channelId": "", - "decimals": 6, - "symbol": "KAVA", - "baseDenom": "KAVA", + "decimals": 18, + "symbol": "DINHEIROS", + "baseDenom": "DINHEIROS", "isNative": false } }, { - "name": "Hard", - "denom": "ibc/D6C28E07F7343360AC41E15DDD44D79701DDCA2E0C2C41279739C8D4AE5264BC", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/kava/images/hard.png", - "symbol": "HARD", + "name": "real", + "denom": "ibc/444BCB7AC154587F5D4ABE36EF6D7D65369224509DCBCA2E27AD539519DD66BB", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/terra2/images/Reis.png", + "symbol": "REIS", "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "D6C28E07F7343360AC41E15DDD44D79701DDCA2E0C2C41279739C8D4AE5264BC", + "hash": "444BCB7AC154587F5D4ABE36EF6D7D65369224509DCBCA2E27AD539519DD66BB", "path": "", "channelId": "", "decimals": 6, - "symbol": "HARD", - "baseDenom": "HARD", + "symbol": "REIS", + "baseDenom": "REIS", "isNative": false } }, { - "name": "Swap", - "denom": "ibc/70CF1A54E23EA4E480DEDA9E12082D3FD5684C3483CBDCE190C5C807227688C5", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/kava/images/swp.png", - "symbol": "SWP", + "name": "escudo", + "denom": "ibc/D1546953F51A43131EDB1E80447C823FD0B562C928496808801A57F374357CE5", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/terra2/images/Escudos.png", + "symbol": "ESCUDOS", "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "70CF1A54E23EA4E480DEDA9E12082D3FD5684C3483CBDCE190C5C807227688C5", + "hash": "D1546953F51A43131EDB1E80447C823FD0B562C928496808801A57F374357CE5", "path": "", "channelId": "", "decimals": 6, - "symbol": "SWP", - "baseDenom": "SWP", + "symbol": "ESCUDOS", + "baseDenom": "ESCUDOS", "isNative": false } }, { - "name": "USDX", - "denom": "ibc/C78F65E1648A3DFE0BAEB6C4CDA69CC2A75437F1793C0E6386DFDA26393790AE", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/kava/images/usdx.png", - "symbol": "USDX", + "name": "alentejo.money", + "denom": "ibc/FE5CF6EA14A5A5EF61AFBD8294E7B245DF4523F6F3B38DE8CC65A916BCEA00B4", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/terra2/images/Alem.png", + "symbol": "ALEM", "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "C78F65E1648A3DFE0BAEB6C4CDA69CC2A75437F1793C0E6386DFDA26393790AE", + "hash": "FE5CF6EA14A5A5EF61AFBD8294E7B245DF4523F6F3B38DE8CC65A916BCEA00B4", "path": "", "channelId": "", "decimals": 6, - "symbol": "USDX", - "baseDenom": "USDX", + "symbol": "ALEM", + "baseDenom": "ALEM", "isNative": false } }, { - "name": "Umee", - "denom": "ibc/76ADAF7500FA7E048261145768030EB72392A488BFDEC353631B21EF15F0EE69", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/umee/images/umee.png", - "symbol": "UMEE", + "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": "76ADAF7500FA7E048261145768030EB72392A488BFDEC353631B21EF15F0EE69", + "hash": "8AE86084C0D921352F711EF42CCA7BA4C8238C244FE4CC3E4E995D9782FB0E2B", "path": "", "channelId": "", "decimals": 6, - "symbol": "UMEE", - "baseDenom": "UMEE", + "symbol": "GEM", + "baseDenom": "GEM", "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, + "name": "nico", + "denom": "ibc/EED3F204DCABACBEB858B0A56017070283098A81DEB49F1F9D6702309AA7F7DE", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/terra2/images/nicodao.png", + "symbol": "NICO", + "decimals": 18, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "4ABBEF4C8926DDDB320AE5188CFD63267ABBCEFC0583E4AE05D6E5AA2401DDAB", + "hash": "EED3F204DCABACBEB858B0A56017070283098A81DEB49F1F9D6702309AA7F7DE", "path": "", "channelId": "", - "decimals": 6, - "symbol": "USDT (Cosmos)", - "baseDenom": "USDT (Cosmos)", + "decimals": 18, + "symbol": "NICO", + "baseDenom": "NICO", "isNative": false } }, { - "name": "ampKUJI", - "denom": "ibc/34E48C7C43383203519D996D1D93FE80ED50153E28FB6A9465DE463AEF2EC9EC", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/kujira/images/ampkuji.png", - "symbol": "ampKUJI", + "name": "Sailing The SeaS DAO", + "denom": "ibc/FF5AC3E28E50C2C52063C18D0E2F742B3967BE5ACC6D7C8713118E54E1DEE4F6", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/terra2/images/SEAS.png", + "symbol": "SEAS", "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "34E48C7C43383203519D996D1D93FE80ED50153E28FB6A9465DE463AEF2EC9EC", + "hash": "FF5AC3E28E50C2C52063C18D0E2F742B3967BE5ACC6D7C8713118E54E1DEE4F6", "path": "", "channelId": "", "decimals": 6, - "symbol": "ampKUJI", - "baseDenom": "ampKUJI", + "symbol": "SEAS", + "baseDenom": "SEAS", "isNative": false } }, { - "name": "ERIS Amplified OSMO", - "denom": "ibc/012D069D557C4DD59A670AA17E809CB7A790D778E364D0BC0A3248105DA6432D", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/osmosis/images/amposmo.png", - "symbol": "ampOSMO", + "name": "BitzDAO", + "denom": "ibc/01A69EE21F6A76CAA8D0DB900AF2789BF665B5B67D89A7D69E7ECF7F513CD0CA", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/terra2/images/BITZ.png", + "symbol": "BITZ", "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "012D069D557C4DD59A670AA17E809CB7A790D778E364D0BC0A3248105DA6432D", + "hash": "01A69EE21F6A76CAA8D0DB900AF2789BF665B5B67D89A7D69E7ECF7F513CD0CA", "path": "", "channelId": "", "decimals": 6, - "symbol": "ampOSMO", - "baseDenom": "ampOSMO", + "symbol": "BITZ", + "baseDenom": "BITZ", "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, + "name": "seul", + "denom": "ibc/1C17C28AEA3C5E03F1A586575C6BE426A18B03B48C11859B82242EF32D372FDA", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/terra2/images/seul.png", + "symbol": "SEUL", + "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "F6CC233E5C0EA36B1F74AB1AF98471A2D6A80E2542856639703E908B4D93E7C4", + "hash": "1C17C28AEA3C5E03F1A586575C6BE426A18B03B48C11859B82242EF32D372FDA", "path": "", "channelId": "", - "decimals": 18, - "symbol": "NEOK", - "baseDenom": "NEOK", + "decimals": 6, + "symbol": "SEUL", + "baseDenom": "SEUL", "isNative": false } }, { - "name": "stSOMM", - "denom": "ibc/9C234DA49B8DDAFB8F71F21BEB109F6255ECA146A32FD3A36CB9210647CBD037", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/stride/images/stsomm.png", - "symbol": "stSOMM", + "name": "xseul", + "denom": "ibc/CC381CB977B79239696AC471777FEC12816B9EF7F601EE2DAF17C00F51C25F6F", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/terra2/images/xseul.png", + "symbol": "xSEUL", "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "9C234DA49B8DDAFB8F71F21BEB109F6255ECA146A32FD3A36CB9210647CBD037", + "hash": "CC381CB977B79239696AC471777FEC12816B9EF7F601EE2DAF17C00F51C25F6F", "path": "", "channelId": "", "decimals": 6, - "symbol": "stSOMM", - "baseDenom": "stSOMM", + "symbol": "xSEUL", + "baseDenom": "xSEUL", "isNative": false } }, { - "name": "USK", - "denom": "ibc/58BC643F2EB5758C08D8B1569C7948A5DA796802576005F676BBFB7526E520EB", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/kujira/images/usk.png", - "symbol": "USK", + "name": "$AUTISM exists to celebrate autism as a superior biological tech stack for a changing world", + "denom": "factory/inj14lf8xm6fcvlggpa7guxzjqwjmtr24gnvf56hvz/autism", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/injective/images/autism.png", + "symbol": "AUTISM", "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "58BC643F2EB5758C08D8B1569C7948A5DA796802576005F676BBFB7526E520EB", + "hash": "factory/inj14lf8xm6fcvlggpa7guxzjqwjmtr24gnvf56hvz/autism", "path": "", "channelId": "", "decimals": 6, - "symbol": "USK", - "baseDenom": "USK", + "symbol": "AUTISM", + "baseDenom": "AUTISM", "isNative": false } }, { - "name": "MNTA", - "denom": "ibc/A4495880A4A2E3C242F63C710F447BAE072E1A4C2A22F1851E0BB7ABDD26B43D", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/kujira/images/mnta.png", - "symbol": "MNTA", + "name": "GUPPY", + "denom": "ibc/F729B93A13133D7390455293338A0CEAAF876D0F180B7C154607989A1617DD45", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/migaloo/images/guppy.png", + "symbol": "GUPPY", "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "A4495880A4A2E3C242F63C710F447BAE072E1A4C2A22F1851E0BB7ABDD26B43D", + "hash": "F729B93A13133D7390455293338A0CEAAF876D0F180B7C154607989A1617DD45", "path": "", "channelId": "", "decimals": 6, - "symbol": "MNTA", - "baseDenom": "MNTA", + "symbol": "GUPPY", + "baseDenom": "GUPPY", "isNative": false } }, { - "name": "WINK", - "denom": "ibc/325300CEF4149AD1BBFEB540FF07699CDEEFBB653401E872532030CFB31CD767", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/kujira/images/wink.png", - "symbol": "WINK", + "name": "Neutron", + "denom": "ibc/6488808F32B07F6E8DCE7B700B92D9F7287D0FA1D0F76A25B11276E09DB0E626", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/neutron/images/ntrn.png", + "symbol": "NTRN", "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "325300CEF4149AD1BBFEB540FF07699CDEEFBB653401E872532030CFB31CD767", + "hash": "6488808F32B07F6E8DCE7B700B92D9F7287D0FA1D0F76A25B11276E09DB0E626", "path": "", "channelId": "", "decimals": 6, - "symbol": "WINK", - "baseDenom": "WINK", + "symbol": "NTRN", + "baseDenom": "NTRN", "isNative": false } }, { - "name": "Dot", - "denom": "ibc/B0442E32E21ED4228301A2B1B247D3F3355B73BF288470F9643AAD0CA07DD593", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/_non-cosmos/polkadot/images/dot.png", - "symbol": "DOT", - "decimals": 10, + "name": "wstETH", + "denom": "ibc/E4BDC3A9935959C715961FFC6C12159EAD8FA4A5955D069EE19D0423FF810C6E", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/_non-cosmos/ethereum/images/wsteth.svg", + "symbol": "wstETH", + "decimals": 18, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "B0442E32E21ED4228301A2B1B247D3F3355B73BF288470F9643AAD0CA07DD593", + "hash": "E4BDC3A9935959C715961FFC6C12159EAD8FA4A5955D069EE19D0423FF810C6E", "path": "", "channelId": "", - "decimals": 10, - "symbol": "DOT", - "baseDenom": "DOT", + "decimals": 18, + "symbol": "wstETH", + "baseDenom": "wstETH", "isNative": false } }, { - "name": "axlWBTC", - "denom": "ibc/F57B53E102171E6DC254532ECC184228BB8E23B755AD55FA6FDCBD70464A9A54", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/axlwbtc.png", - "symbol": "axlWBTC", + "name": "AstroPepe", + "denom": "ibc/03BC83F4E4972621EAE3144FC91AED13AF3541A90A51B690425C95D1E03850D9", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/neutron/images/astropepe.png", + "symbol": "ASTROPEPE", "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "F57B53E102171E6DC254532ECC184228BB8E23B755AD55FA6FDCBD70464A9A54", + "hash": "03BC83F4E4972621EAE3144FC91AED13AF3541A90A51B690425C95D1E03850D9", "path": "", "channelId": "", "decimals": 6, - "symbol": "axlWBTC", - "baseDenom": "axlWBTC", + "symbol": "ASTROPEPE", + "baseDenom": "ASTROPEPE", "isNative": false } }, { - "name": "DAI", - "denom": "ibc/433133545CF68587777A01C3EFCF720EFE1B42F14AB2153D349DC4559984F2E8", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/dai.png", - "symbol": "DAI", + "name": "Newt", + "denom": "ibc/B0A75E6F4606C844C05ED9E08335AFC50E814F210C03CABAD31562F606C69C46", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/neutron/images/newt.png", + "symbol": "NEWT", "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "433133545CF68587777A01C3EFCF720EFE1B42F14AB2153D349DC4559984F2E8", + "hash": "B0A75E6F4606C844C05ED9E08335AFC50E814F210C03CABAD31562F606C69C46", "path": "", "channelId": "", "decimals": 6, - "symbol": "DAI", - "baseDenom": "DAI", + "symbol": "NEWT", + "baseDenom": "NEWT", "isNative": false } }, { - "name": "USDT", - "denom": "ibc/24E5D0825D3D71BF00C4A01CD8CA8F2D27B1DD32B7446CF633534AEA25379271", - "logo": "untracked.svg", - "symbol": "USDT", + "name": "Baby Corgi", + "denom": "ibc/9AC0F8299A5157831C7DF1AE52F178EFBA8D5E1826D4DD539441E3827FFCB873", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/neutron/images/babycorgi.png", + "symbol": "CORGI", "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "24E5D0825D3D71BF00C4A01CD8CA8F2D27B1DD32B7446CF633534AEA25379271", + "hash": "9AC0F8299A5157831C7DF1AE52F178EFBA8D5E1826D4DD539441E3827FFCB873", "path": "", "channelId": "", "decimals": 6, - "symbol": "USDT", - "baseDenom": "USDT", + "symbol": "CORGI", + "baseDenom": "CORGI", "isNative": false } }, { - "name": "WBTC", + "name": "Wrapped Bitcoin", "denom": "ibc/64431EE79F3216B8F7773A630549ADA852EA8E4B545D22BD35B0BF56FD5D5201", - "logo": "untracked.svg", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/wbtc.png", "symbol": "WBTC", "decimals": 6, "coinGeckoId": "", @@ -1843,458 +2926,458 @@ } }, { - "name": "BLEND", - "denom": "ibc/45C0FE8ACE1C9C8BA38D3D6FDEBDE4F7198A434B6C63ADCEFC3D32D12443BB84", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/kujira/images/blend.svg", - "symbol": "BLEND", + "name": "OPHIR", + "denom": "ibc/19DEC3C890D19A782A3CD0C62EA8F2F8CC09D0C9AAA8045263F40526088FEEDB", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/migaloo/images/ophir.png", + "symbol": "OPHIR", "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "45C0FE8ACE1C9C8BA38D3D6FDEBDE4F7198A434B6C63ADCEFC3D32D12443BB84", + "hash": "19DEC3C890D19A782A3CD0C62EA8F2F8CC09D0C9AAA8045263F40526088FEEDB", "path": "", "channelId": "", "decimals": 6, - "symbol": "BLEND", - "baseDenom": "BLEND", + "symbol": "OPHIR", + "baseDenom": "OPHIR", "isNative": false } }, { - "name": "USDC", - "denom": "ibc/DF32F083238097AD2CA5444BFB8F338534C32865EFE0696C5AF89AFB3A0144D6", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/_non-cosmos/ethereum/images/usdc.svg", - "symbol": "USDC", - "decimals": 18, + "name": "ito", + "denom": "ibc/E7140919F6B70594F89401B574DC198D206D923964184A9F79B39074301EB04F", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/terra2/images/I.png", + "symbol": "ITO", + "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "DF32F083238097AD2CA5444BFB8F338534C32865EFE0696C5AF89AFB3A0144D6", + "hash": "E7140919F6B70594F89401B574DC198D206D923964184A9F79B39074301EB04F", "path": "", "channelId": "", - "decimals": 18, - "symbol": "USDC", - "baseDenom": "USDC", + "decimals": 6, + "symbol": "ITO", + "baseDenom": "ITO", "isNative": false } }, { - "name": "Multichain USDC", - "denom": "ibc/610D4A1B3F3198C35C09E9AF7C8FB81707912463357C9398B02C7F13049678A8", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/_non-cosmos/ethereum/images/usdc.svg", - "symbol": "USDC", + "name": "ARMANI", + "denom": "ibc/0C04597A68991F93CE8C9EF88EA795179CD020695041D00911E5CFF023D415CC", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/terra2/images/armani.png", + "symbol": "ARMANI", "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "610D4A1B3F3198C35C09E9AF7C8FB81707912463357C9398B02C7F13049678A8", + "hash": "0C04597A68991F93CE8C9EF88EA795179CD020695041D00911E5CFF023D415CC", "path": "", "channelId": "", "decimals": 6, - "symbol": "USDC", - "baseDenom": "USDC", + "symbol": "ARMANI", + "baseDenom": "ARMANI", "isNative": false } }, { - "name": "Umee", - "denom": "ibc/88F73B623463F9B9CB841F36B6586B5C4BADF8B1CFD1C75C1F385BE01A95AD23", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/umee/images/umee.png", - "symbol": "UMEE", + "name": "Dog wif nunchucks", + "denom": "factory/inj1xtel2knkt8hmc9dnzpjz6kdmacgcfmlv5f308w/ninja", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/injective/images/ninja.png", + "symbol": "NINJA", "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "88F73B623463F9B9CB841F36B6586B5C4BADF8B1CFD1C75C1F385BE01A95AD23", + "hash": "factory/inj1xtel2knkt8hmc9dnzpjz6kdmacgcfmlv5f308w/ninja", "path": "", "channelId": "", "decimals": 6, - "symbol": "UMEE", - "baseDenom": "UMEE", + "symbol": "NINJA", + "baseDenom": "NINJA", "isNative": false } }, { - "name": "Oraichain", - "denom": "ibc/C20C0A822BD22B2CEF0D067400FCCFB6FAEEE9E91D360B4E0725BD522302D565", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/oraichain/images/orai-white.png", - "symbol": "ORAI", + "name": "WGMI", + "denom": "factory/inj1rmjzj9fn47kdmfk4f3z39qr6czexxe0yjyc546/WGMI", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/injective/images/wgmi.png", + "symbol": "WGMI", "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "C20C0A822BD22B2CEF0D067400FCCFB6FAEEE9E91D360B4E0725BD522302D565", + "hash": "factory/inj1rmjzj9fn47kdmfk4f3z39qr6czexxe0yjyc546/WGMI", "path": "", "channelId": "", "decimals": 6, - "symbol": "ORAI", - "baseDenom": "ORAI", + "symbol": "WGMI", + "baseDenom": "WGMI", "isNative": false } }, { - "name": "Pica", - "denom": "ibc/9C2212CB87241A8D038222CF66BBCFABDD08330DFA0AC9B451135287DCBDC7A8", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/composable/images/pica.svg", - "symbol": "PICA", - "decimals": 12, + "name": "DROGO", + "denom": "ibc/565FE65B82C091F8BAD1379FA1B4560C036C07913355ED4BD8D156DA63F43712", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/terra2/images/drogo.png", + "symbol": "DROGO", + "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "9C2212CB87241A8D038222CF66BBCFABDD08330DFA0AC9B451135287DCBDC7A8", + "hash": "565FE65B82C091F8BAD1379FA1B4560C036C07913355ED4BD8D156DA63F43712", "path": "", "channelId": "", - "decimals": 12, - "symbol": "PICA", - "baseDenom": "PICA", + "decimals": 6, + "symbol": "DROGO", + "baseDenom": "DROGO", "isNative": false } }, { - "name": "OSMO", - "denom": "ibc/C2025C1D34ED74CD6F9DF86CD650D92219AF645E9D0ADFFACF4E2CBECE649536", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/osmosis/images/osmo.png", - "symbol": "OSMO", - "decimals": 18, + "name": "Sei", + "denom": "ibc/45C1BDD0F44EA61B79E6F07C61F6FBC601E496B281316C867B542D7964A4BD82", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/sei/images/sei.png", + "symbol": "SEI", + "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "C2025C1D34ED74CD6F9DF86CD650D92219AF645E9D0ADFFACF4E2CBECE649536", + "hash": "45C1BDD0F44EA61B79E6F07C61F6FBC601E496B281316C867B542D7964A4BD82", "path": "", "channelId": "", - "decimals": 18, - "symbol": "OSMO", - "baseDenom": "OSMO", + "decimals": 6, + "symbol": "SEI", + "baseDenom": "SEI", "isNative": false } }, { - "name": "STRD", - "denom": "ibc/02683677B1A58ECF74FFF25711E09735C44153FE9490BE5EF9FD21DE82BCB542", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/stride/images/strd.png", - "symbol": "STRD", - "decimals": 18, + "name": "OIN STORE OF VALUE", + "denom": "ibc/CDA55861E9E491479CB52D5C89F942F5EAF221F80B7CDDBBA8EE94D3658B03B4", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/sei/images/oin.png", + "symbol": "OIN", + "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "02683677B1A58ECF74FFF25711E09735C44153FE9490BE5EF9FD21DE82BCB542", + "hash": "CDA55861E9E491479CB52D5C89F942F5EAF221F80B7CDDBBA8EE94D3658B03B4", "path": "", "channelId": "", - "decimals": 18, - "symbol": "STRD", - "baseDenom": "STRD", + "decimals": 6, + "symbol": "OIN", + "baseDenom": "OIN", "isNative": false } }, { - "name": "BLD", - "denom": "ibc/B7933C59879BFE059942C6F76CAF4B1609D441AD22D54D42DAC00CE7918CAF1F", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/agoric/images/bld.png", - "symbol": "BLD", - "decimals": 18, + "name": "OIN STORE OF VALUE", + "denom": "ibc/64D95807CA13CD9EC5BEF9D3709138A14295DDBDFBC9EF58A9FFE34B911545E6", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/sei/images/oin.png", + "symbol": "OIN", + "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "B7933C59879BFE059942C6F76CAF4B1609D441AD22D54D42DAC00CE7918CAF1F", + "hash": "64D95807CA13CD9EC5BEF9D3709138A14295DDBDFBC9EF58A9FFE34B911545E6", "path": "", "channelId": "", - "decimals": 18, - "symbol": "BLD", - "baseDenom": "BLD", + "decimals": 6, + "symbol": "OIN", + "baseDenom": "OIN", "isNative": false } }, { - "name": "stATOM", - "denom": "ibc/B024EC4AE846F690CB46C1CE886BE7DCE27CBBB6CE1E4EFBA4AA764E07B81A69", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/stride/images/statom.png", - "symbol": "stATOM", - "decimals": 18, + "name": "ERIS Amplified SEI", + "denom": "ibc/6293B8AAE79F71B7DA3E8DEE00BEE0740D6D8495DB9BAED2342949B0A90152A5", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/sei/images/ampsei.svg", + "symbol": "ampSEI", + "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "B024EC4AE846F690CB46C1CE886BE7DCE27CBBB6CE1E4EFBA4AA764E07B81A69", + "hash": "6293B8AAE79F71B7DA3E8DEE00BEE0740D6D8495DB9BAED2342949B0A90152A5", "path": "", "channelId": "", - "decimals": 18, - "symbol": "stATOM", - "baseDenom": "stATOM", + "decimals": 6, + "symbol": "ampSEI", + "baseDenom": "ampSEI", "isNative": false } }, { - "name": "NTRN", - "denom": "ibc/E8E84092B9063AAC97846712D43D6555928073B8A0BFFCC2549E55EE224F1610", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/neutron/images/ntrn.png", - "symbol": "NTRN", - "decimals": 18, + "name": "Popeye", + "denom": "ibc/7E4EA08D14451712CC921456E2FBA57B54D4CA80AE9E471FAAF16610029B9145", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/sei/images/popeye.png", + "symbol": "POPEYE", + "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "E8E84092B9063AAC97846712D43D6555928073B8A0BFFCC2549E55EE224F1610", + "hash": "7E4EA08D14451712CC921456E2FBA57B54D4CA80AE9E471FAAF16610029B9145", "path": "", "channelId": "", - "decimals": 18, - "symbol": "NTRN", - "baseDenom": "NTRN", + "decimals": 6, + "symbol": "POPEYE", + "baseDenom": "POPEYE", "isNative": false } }, { - "name": "UMEE", - "denom": "ibc/221E9E20795E6E250532A6A871E7F6310FCEDFC69B681037BBA6561270360D86", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/umee/images/umee.png", - "symbol": "UMEE", - "decimals": 18, + "name": "Sei", + "denom": "ibc/0D0B98E80BA0158D325074100998A78FB6EC1BF394EFF632E570A5C890ED7CC2", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/sei/images/sei.png", + "symbol": "SEI", + "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "221E9E20795E6E250532A6A871E7F6310FCEDFC69B681037BBA6561270360D86", + "hash": "0D0B98E80BA0158D325074100998A78FB6EC1BF394EFF632E570A5C890ED7CC2", "path": "", "channelId": "", - "decimals": 18, - "symbol": "UMEE", - "baseDenom": "UMEE", + "decimals": 6, + "symbol": "SEI", + "baseDenom": "SEI", "isNative": false } }, { - "name": "CRE", - "denom": "ibc/DDE000907D85FB1F358B3FBB1143452BE13F68E0BEA0DFFD8787095B76EEE0A1", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/crescent/images/cre.png", - "symbol": "CRE", - "decimals": 18, + "name": "OIN STORE OF VALUE", + "denom": "ibc/CA0B808874A9890C171944FA44B35287E9701402C732FE5B2C6371BA8113462C", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/sei/images/oin.png", + "symbol": "OIN", + "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "DDE000907D85FB1F358B3FBB1143452BE13F68E0BEA0DFFD8787095B76EEE0A1", + "hash": "CA0B808874A9890C171944FA44B35287E9701402C732FE5B2C6371BA8113462C", "path": "", "channelId": "", - "decimals": 18, - "symbol": "CRE", - "baseDenom": "CRE", + "decimals": 6, + "symbol": "OIN", + "baseDenom": "OIN", "isNative": false } }, { - "name": "SCRT", - "denom": "ibc/7C4A4847D6898FA8744A8F2A4FC287E98CA5A95E05842B897B3FB301103C8AB6", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/secretnetwork/images/scrt.png", - "symbol": "SCRT", - "decimals": 18, + "name": "OIN STORE OF VALUE", + "denom": "ibc/09A596CF997F575F2D1E150DFECD7AAE4B44B119F4E45E0A2532EEBD1F8795FE", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/sei/images/oin.png", + "symbol": "OIN", + "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "7C4A4847D6898FA8744A8F2A4FC287E98CA5A95E05842B897B3FB301103C8AB6", + "hash": "09A596CF997F575F2D1E150DFECD7AAE4B44B119F4E45E0A2532EEBD1F8795FE", "path": "", "channelId": "", - "decimals": 18, - "symbol": "SCRT", - "baseDenom": "SCRT", + "decimals": 6, + "symbol": "OIN", + "baseDenom": "OIN", "isNative": false } }, { - "name": "STARS", - "denom": "ibc/4D29F082A3C083C85C886B92A1EB438C3FC0632E5F9E4D875479BEB7B9511BD5", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/stargaze/images/stars.png", - "symbol": "STARS", - "decimals": 18, + "name": "ERIS Amplified SEI", + "denom": "ibc/E175256127F32A27BB1FF863D15D8C4BB14968ED069B6A292723D485A33514A2", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/sei/images/ampsei.svg", + "symbol": "ampSEI", + "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "4D29F082A3C083C85C886B92A1EB438C3FC0632E5F9E4D875479BEB7B9511BD5", + "hash": "E175256127F32A27BB1FF863D15D8C4BB14968ED069B6A292723D485A33514A2", "path": "", "channelId": "", - "decimals": 18, - "symbol": "STARS", - "baseDenom": "STARS", + "decimals": 6, + "symbol": "ampSEI", + "baseDenom": "ampSEI", "isNative": false } }, { - "name": "bCRE", - "denom": "ibc/83D54420DD46764F2ED5EE511DAA63EC28012480A245D8E33AA1F7D1FB15D736", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/crescent/images/bcre.png", - "symbol": "bCRE", - "decimals": 18, + "name": "Popeye", + "denom": "ibc/833095AF2D530639121F8A07E24E5D02921CA19FF3192D082E9C80210515716C", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/sei/images/popeye.png", + "symbol": "POPEYE", + "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "83D54420DD46764F2ED5EE511DAA63EC28012480A245D8E33AA1F7D1FB15D736", + "hash": "833095AF2D530639121F8A07E24E5D02921CA19FF3192D082E9C80210515716C", "path": "", "channelId": "", - "decimals": 18, - "symbol": "bCRE", - "baseDenom": "bCRE", + "decimals": 6, + "symbol": "POPEYE", + "baseDenom": "POPEYE", "isNative": false } }, { - "name": "HUAHUA", - "denom": "ibc/9D9B59CA222E54842555DBD81B22EEABE61796D4C6EC8AB47A97C388333AC340", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/chihuahua/images/huahua.png", - "symbol": "HUAHUA", - "decimals": 18, + "name": "Sei", + "denom": "ibc/BCE43BA530FBE35282B62C1E1EA4AD1F51522C61D40FB761005E1A02F18E0E58", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/sei/images/sei.png", + "symbol": "SEI", + "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "9D9B59CA222E54842555DBD81B22EEABE61796D4C6EC8AB47A97C388333AC340", + "hash": "BCE43BA530FBE35282B62C1E1EA4AD1F51522C61D40FB761005E1A02F18E0E58", "path": "", "channelId": "", - "decimals": 18, - "symbol": "HUAHUA", - "baseDenom": "HUAHUA", + "decimals": 6, + "symbol": "SEI", + "baseDenom": "SEI", "isNative": false } }, { - "name": "USDT", - "denom": "ibc/7965483148018AFAA12DC569959897E7A5E474F4B41A87FFC5513B552C108DB5", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/_non-cosmos/ethereum/images/usdt.png", - "symbol": "USDT", + "name": "OIN STORE OF VALUE", + "denom": "ibc/486A0C3A5D9F8389FE01CF2656DF03DB119BC71C4164212F3541DD538A968B66", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/sei/images/oin.png", + "symbol": "OIN", "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "7965483148018AFAA12DC569959897E7A5E474F4B41A87FFC5513B552C108DB5", + "hash": "486A0C3A5D9F8389FE01CF2656DF03DB119BC71C4164212F3541DD538A968B66", "path": "", "channelId": "", "decimals": 6, - "symbol": "USDT", - "baseDenom": "USDT", + "symbol": "OIN", + "baseDenom": "OIN", "isNative": false } }, { - "name": "ATOM", - "denom": "ibc/377F82FD1E4F6408B1CB7C8BFF9134A1F2C5D5E5CC2760BAD972AF0F7F6D4675", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/cosmoshub/images/atom.png", - "symbol": "ATOM", + "name": "OIN STORE OF VALUE", + "denom": "ibc/ABF6109CA87727E3945C2DB5EA17D819D57041A91BFB0BC73320AFE097C230F5", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/sei/images/oin.png", + "symbol": "OIN", "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "377F82FD1E4F6408B1CB7C8BFF9134A1F2C5D5E5CC2760BAD972AF0F7F6D4675", + "hash": "ABF6109CA87727E3945C2DB5EA17D819D57041A91BFB0BC73320AFE097C230F5", "path": "", "channelId": "", "decimals": 6, - "symbol": "ATOM", - "baseDenom": "ATOM", + "symbol": "OIN", + "baseDenom": "OIN", "isNative": false } }, { - "name": "ATOM", - "denom": "ibc/8D311D92BCD4E87F145DEB9DDA339416DEF7E13571D92A3521CAB0BF62760FBE", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/cosmoshub/images/atom.png", - "symbol": "ATOM", + "name": "ERIS Amplified SEI", + "denom": "ibc/9774771543D917853B9A9D108885C223DFF03ABC7BD39AD2783CA4E1F58CDC6E", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/sei/images/ampsei.svg", + "symbol": "ampSEI", "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "8D311D92BCD4E87F145DEB9DDA339416DEF7E13571D92A3521CAB0BF62760FBE", + "hash": "9774771543D917853B9A9D108885C223DFF03ABC7BD39AD2783CA4E1F58CDC6E", "path": "", "channelId": "", "decimals": 6, - "symbol": "ATOM", - "baseDenom": "ATOM", + "symbol": "ampSEI", + "baseDenom": "ampSEI", "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", + "name": "Popeye", + "denom": "ibc/C35A94A42FEDA8E01903CD7A78FB33AE60B2064C0007BF2E4FD5A6368BDBC546", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/sei/images/popeye.png", + "symbol": "POPEYE", "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "factory/inj1cdwt8g7nxgtg2k4fn8sj363mh9ahkw2qt0vrnc/ampINJ", + "hash": "C35A94A42FEDA8E01903CD7A78FB33AE60B2064C0007BF2E4FD5A6368BDBC546", "path": "", "channelId": "", "decimals": 6, - "symbol": "ampINJ", - "baseDenom": "ampINJ", + "symbol": "POPEYE", + "baseDenom": "POPEYE", "isNative": false } }, { - "name": "CDT", - "denom": "ibc/25288BA0C7D146D37373657ECA719B9AADD49DA9E514B4172D08F7C88D56C9EF", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/osmosis/images/CDT.svg", - "symbol": "CDT", + "name": "jimmy", + "denom": "ibc/BE0CC03465ABE696C3AE57F6FE166721DF79405DFC4F4E3DC09B50FACABB8888", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/neutron/images/jimmy.png", + "symbol": "JIMMY", "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "25288BA0C7D146D37373657ECA719B9AADD49DA9E514B4172D08F7C88D56C9EF", + "hash": "BE0CC03465ABE696C3AE57F6FE166721DF79405DFC4F4E3DC09B50FACABB8888", "path": "", "channelId": "", "decimals": 6, - "symbol": "CDT", - "baseDenom": "CDT", + "symbol": "JIMMY", + "baseDenom": "JIMMY", "isNative": false } }, { - "name": "MBRN", - "denom": "ibc/7AF90EDF6F5328C6C33B03DB7E33445708A46FF006932472D00D5076F5504B67", - "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/osmosis/images/MBRN.svg", - "symbol": "MBRN", + "name": "Sensei Dog", + "denom": "ibc/12612A3EBAD01200A7FBD893D4B0D71F3AD65C41B2AEE5B42EE190672EBE57E9", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/sei/images/SenseiDog.png", + "symbol": "SENSEI", "decimals": 6, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "7AF90EDF6F5328C6C33B03DB7E33445708A46FF006932472D00D5076F5504B67", + "hash": "12612A3EBAD01200A7FBD893D4B0D71F3AD65C41B2AEE5B42EE190672EBE57E9", "path": "", "channelId": "", "decimals": 6, - "symbol": "MBRN", - "baseDenom": "MBRN", + "symbol": "SENSEI", + "baseDenom": "SENSEI", "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, + "name": "Dora Vota", + "denom": "ibc/BC3AD52E42C6E1D13D2BDCEB497CF5AB9FEE24D804F5563B9E7DCFB825246947", + "logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/doravota/images/dora.svg", + "symbol": "DORA", + "decimals": 18, "coinGeckoId": "", "tokenType": "ibc", "tokenVerification": "external", "ibc": { - "hash": "8AE86084C0D921352F711EF42CCA7BA4C8238C244FE4CC3E4E995D9782FB0E2B", + "hash": "BC3AD52E42C6E1D13D2BDCEB497CF5AB9FEE24D804F5563B9E7DCFB825246947", "path": "", "channelId": "", - "decimals": 6, - "symbol": "GEM", - "baseDenom": "GEM", + "decimals": 18, + "symbol": "DORA", + "baseDenom": "DORA", "isNative": false } } diff --git a/packages/sdk-ui-ts/src/services/ibc/tokens.ts b/packages/sdk-ui-ts/src/services/ibc/tokens.ts index 0adcfb85b..281233417 100644 --- a/packages/sdk-ui-ts/src/services/ibc/tokens.ts +++ b/packages/sdk-ui-ts/src/services/ibc/tokens.ts @@ -28,7 +28,7 @@ function ibcTokenMetadataToToken( return { name: token.name || 'Unknown', denom: token.contractAddr || '', - logo: token.imageUrl || 'untracked.svg', + logo: token.imageUrl || 'unknown.png', symbol: token.symbol || 'Unknown', decimals: token.decimals || 18, coinGeckoId: '', diff --git a/packages/sdk-ui-ts/src/services/web3/Web3Composer.ts b/packages/sdk-ui-ts/src/services/web3/Web3Composer.ts index bd36a6937..d45f2900e 100644 --- a/packages/sdk-ui-ts/src/services/web3/Web3Composer.ts +++ b/packages/sdk-ui-ts/src/services/web3/Web3Composer.ts @@ -6,10 +6,16 @@ import { PeggyContract, getContractAddressesForNetworkOrThrow, } from '@injectivelabs/contracts' -import { GAS_LIMIT_MULTIPLIER, INJ_DENOM, TIP_IN_GWEI } from '../../constants' +import { + INJ_DENOM, + TIP_IN_GWEI, + TIP_IN_GWEI_TESTNET, + GAS_LIMIT_MULTIPLIER, +} from '../../constants' import { getTransactionOptions, peggyDenomToContractAddress } from './utils' import { getKeyFromRpcUrl } from '../../utils/alchemy' import { Alchemy, Network as AlchemyNetwork } from 'alchemy-sdk' +import { isTestnet } from '@injectivelabs/networks' /** * Preparing and broadcasting @@ -73,6 +79,9 @@ export class Web3Composer { const gas = new BigNumberInWei( await setAllowanceOfContractFunction.estimateGasAsync(), ) + const maxPriorityFeePerGas = ( + isTestnet(network) ? TIP_IN_GWEI_TESTNET : TIP_IN_GWEI + ).toString(16) return { from: address, @@ -85,7 +94,7 @@ export class Web3Composer { .decimalPlaces(0) .toNumber() .toString(16), - maxPriorityFeePerGas: TIP_IN_GWEI.toString(16), + maxPriorityFeePerGas, data, } } @@ -139,6 +148,10 @@ export class Web3Composer { await depositForContractFunction.estimateGasAsync(), ) + const maxPriorityFeePerGas = ( + isTestnet(network) ? TIP_IN_GWEI_TESTNET : TIP_IN_GWEI + ).toString(16) + return { from: address, to: peggyContractAddress, @@ -150,7 +163,7 @@ export class Web3Composer { .decimalPlaces(0) .toNumber() .toString(16), - maxPriorityFeePerGas: TIP_IN_GWEI.toString(16), + maxPriorityFeePerGas, data: abiEncodedData, } } diff --git a/packages/sdk-ui-ts/src/token/TokenPrice.ts b/packages/sdk-ui-ts/src/token/TokenPrice.ts index d1e6e67e6..8f458bce4 100644 --- a/packages/sdk-ui-ts/src/token/TokenPrice.ts +++ b/packages/sdk-ui-ts/src/token/TokenPrice.ts @@ -1,4 +1,5 @@ import { CoinGeckoApi } from '@injectivelabs/token-utils' +import { Network, isDevnet, isTestnet } from '@injectivelabs/networks' import { sleep, splitArrayToChunks, @@ -6,9 +7,25 @@ import { HttpRestClient, } from '@injectivelabs/utils' import { HttpRequestException } from '@injectivelabs/exceptions' -import { ASSET_PRICE_SERVICE_URL } from '../constants' +import { + ASSET_PRICE_SERVICE_URL, + DEVNET_ASSET_PRICE_SERVICE_URL, + TESTNET_ASSET_PRICE_SERVICE_URL, +} from '../constants' import { CoinPriceFromInjectiveService } from '../types/token' +const getAssetMicroserviceEndpoint = (network: Network = Network.Mainnet) => { + if (isTestnet(network)) { + return TESTNET_ASSET_PRICE_SERVICE_URL + } + + if (isDevnet(network)) { + return DEVNET_ASSET_PRICE_SERVICE_URL + } + + return ASSET_PRICE_SERVICE_URL +} + export class TokenPrice { private coinGeckoApi: CoinGeckoApi | undefined @@ -16,8 +33,14 @@ export class TokenPrice { private cache: Record = {} // coinGeckoId -> priceInUsd - constructor(coinGeckoOptions?: { baseUrl: string; apiKey: string }) { - this.restClient = new HttpRestClient(ASSET_PRICE_SERVICE_URL) + constructor( + network?: Network, + coinGeckoOptions?: { + baseUrl: string + apiKey: string + }, + ) { + this.restClient = new HttpRestClient(getAssetMicroserviceEndpoint(network)) this.coinGeckoApi = coinGeckoOptions ? new CoinGeckoApi(coinGeckoOptions) : undefined @@ -59,9 +82,15 @@ export class TokenPrice { prices = { ...prices, ...pricesFromInjectiveService } - const coinIdsNotInCacheAndInjectiveService = coinIds.filter( - (coinId) => !Object.keys(prices).includes(coinId), - ) + const coinIdsNotInCacheAndInjectiveService = coinIds + .filter((coinId) => !Object.keys(prices).includes(coinId)) + .filter( + (coinId) => + !coinId.startsWith('factory/') && + !coinId.startsWith('ibc') && + !coinId.startsWith('share') && + !coinId.startsWith('peggy'), + ) if (coinIdsNotInCacheAndInjectiveService.length === 0) { return prices @@ -92,6 +121,56 @@ export class TokenPrice { return { ...prices, ...coinIdsWithoutPrice } } + async fetchUsdDenomsPrice(denoms: string[]) { + if (denoms.length === 0) { + return {} + } + + let prices: Record = {} + + const pricesFromCache = denoms.reduce((prices, coinId) => { + try { + const priceFromCache = this.cache[coinId] + + if (priceFromCache) { + return { ...prices, [coinId]: priceFromCache } + } + + return prices + } catch (e) { + return prices + } + }, {} as Record) + + prices = { ...prices, ...pricesFromCache } + + const denomsNotInCache = denoms.filter( + (denom) => !Object.keys(prices).includes(denom), + ) + + if (denomsNotInCache.length === 0) { + return prices + } + + const pricesFromInjectiveService = + await this.fetchUsdPricesFromInjectiveService() + + prices = { ...prices, ...pricesFromInjectiveService } + + const denomsNotInCacheAndInjectiveService = denoms.filter( + (denom) => !Object.keys(prices).includes(denom), + ) + + const denomsWithoutPrice = Object.keys( + denomsNotInCacheAndInjectiveService, + ).reduce( + (prices, key) => ({ ...prices, [key]: 0 }), + {} as Record, + ) + + return { ...prices, ...denomsWithoutPrice } + } + async fetchUsdTokenPrice(coinId: string) { if (!coinId) { return 0 diff --git a/packages/sdk-ui-ts/src/token/TokenService.ts b/packages/sdk-ui-ts/src/token/TokenService.ts index d7c10eecd..9fcfa94c3 100644 --- a/packages/sdk-ui-ts/src/token/TokenService.ts +++ b/packages/sdk-ui-ts/src/token/TokenService.ts @@ -255,8 +255,8 @@ export class TokenService { : market.ticker.replace('/', '') const baseToken = { denom: slug, - logo: 'injective-v3.svg', - icon: 'injective-v3.svg', + logo: 'injective-v3.png', + icon: 'injective-v3.png', symbol: baseTokenSymbol, name: baseTokenSymbol, decimals: 18, diff --git a/packages/sdk-ui-ts/src/types/bridge.ts b/packages/sdk-ui-ts/src/types/bridge.ts index fbd13bce9..5fb1f5a6e 100644 --- a/packages/sdk-ui-ts/src/types/bridge.ts +++ b/packages/sdk-ui-ts/src/types/bridge.ts @@ -33,6 +33,8 @@ export enum BridgingNetwork { Oraichain = 'oraichain', Noble = 'noble', Celestia = 'celestia', + Migaloo = 'migaloo', + Kujira = 'kujira', } export const MintScanExplorerUrl = { diff --git a/packages/sdk-ui-ts/src/utils/alchemy.ts b/packages/sdk-ui-ts/src/utils/alchemy.ts index 63766630b..d96b5234d 100644 --- a/packages/sdk-ui-ts/src/utils/alchemy.ts +++ b/packages/sdk-ui-ts/src/utils/alchemy.ts @@ -21,7 +21,7 @@ export const getTokenFromAlchemyTokenMetaResponse = ( name: response.name || 'Unknown', symbol: response.symbol || response.name || 'Unknown', decimals: response.decimals || 18, - logo: response.logo || 'untracked.svg', + logo: response.logo || 'unknown.png', coinGeckoId: '', tokenType: TokenType.Erc20, tokenVerification: TokenVerification.External, diff --git a/packages/sdk-ui-ts/src/utils/bridge.ts b/packages/sdk-ui-ts/src/utils/bridge.ts index 152e9c0e6..d2b9ac8b8 100644 --- a/packages/sdk-ui-ts/src/utils/bridge.ts +++ b/packages/sdk-ui-ts/src/utils/bridge.ts @@ -51,6 +51,8 @@ export const KeplrNetworks = [ BridgingNetwork.Oraichain, BridgingNetwork.Noble, BridgingNetwork.Celestia, + BridgingNetwork.Migaloo, + BridgingNetwork.Kujira, ] export const LeapNetworks = [ @@ -65,6 +67,8 @@ export const LeapNetworks = [ BridgingNetwork.Kava, BridgingNetwork.Noble, BridgingNetwork.Celestia, + BridgingNetwork.Migaloo, + BridgingNetwork.Kujira, ] export const CosmostationNetworks = [ @@ -83,6 +87,7 @@ export const CosmostationNetworks = [ BridgingNetwork.Kava, BridgingNetwork.Noble, BridgingNetwork.Celestia, + BridgingNetwork.Migaloo, ] export const CosmosNetworks = [ @@ -102,6 +107,8 @@ export const CosmosNetworks = [ BridgingNetwork.Oraichain, BridgingNetwork.Noble, BridgingNetwork.Celestia, + BridgingNetwork.Migaloo, + BridgingNetwork.Kujira, ] export const EvmWormholeNetworks = [ @@ -122,6 +129,7 @@ export const tokenSelectorDisabledNetworks = [ BridgingNetwork.Polygon, BridgingNetwork.Sui, BridgingNetwork.Klaytn, + BridgingNetwork.Migaloo, ] export const tokenDenomsPerNetwork = [ @@ -254,7 +262,7 @@ export const tokenDenomsPerNetwork = [ { network: BridgingNetwork.Solana, denoms: [], - symbols: ['SOL'], + symbols: ['SOL', 'PYTH'], }, { network: BridgingNetwork.EthereumWh, @@ -286,6 +294,21 @@ export const tokenDenomsPerNetwork = [ ], symbols: ['utia'], }, + { + network: BridgingNetwork.Migaloo, + denoms: [ + 'inj', + 'ibc/D6E6A20ABDD600742D22464340A7701558027759CE14D12590F8EA869CCCF445', + ], + symbols: ['inj', 'uwhale'], + }, + { + network: BridgingNetwork.Kujira, + denoms: [ + 'ibc/9A115B56E769B92621FFF90567E2D60EFD146E86E867491DB69EEDA9ADC36204', + ], + symbols: ['ukuji'], + }, ] as NetworkConfig[] export const cosmosChainTokenMetaMap = { @@ -445,8 +468,9 @@ export const cosmosChainTokenMetaMap = { }, ], [TestnetCosmosChainId.Cosmoshub]: { - ...tokenMetaUtils.getMetaBySymbol('UPHOTON'), + ...tokenMetaUtils.getMetaBySymbol('ATOM'), tokenType: TokenType.Ibc, + // TODO: change when IBC connection established denom: 'ibc/48BC9C6ACBDFC1EBA034F1859245D53EA4BF74147189D66F27C23BF966335DFB', }, @@ -467,6 +491,20 @@ export const cosmosChainTokenMetaMap = { denom: 'ibc/F51BB221BAA275F2EBF654F70B005627D7E713AFFD6D86AFD1E43CAA886149F4', }, + [CosmosChainId.Migaloo]: [ + { + ...tokenMetaUtils.getMetaBySymbol('WHALE'), + tokenType: TokenType.Ibc, + denom: + 'ibc/D6E6A20ABDD600742D22464340A7701558027759CE14D12590F8EA869CCCF445', + }, + ], + [CosmosChainId.Kujira]: { + ...tokenMetaUtils.getMetaBySymbol('KUJI'), + tokenType: TokenType.Ibc, + denom: + 'ibc/9A115B56E769B92621FFF90567E2D60EFD146E86E867491DB69EEDA9ADC36204', + }, } as Record export const ibcHashToNativeInjPerNetwork = { @@ -478,6 +516,8 @@ export const ibcHashToNativeInjPerNetwork = { 'ibc/D64E84758BCA42602C27E9ED2DB8F4EFDAE6A1E311CF404B516D45FEDF319D73', [BridgingNetwork.Stride]: 'ibc/A7454562FF29FE068F42F9DE4805ABEF54F599D1720B345D6518D9B5C64EA6D2', + [BridgingNetwork.Migaloo]: + 'ibc/1C2D8505A29823310B4484E4C63CFDCB08C0D3B57537A615A45F4E5D42CDC789', } as Partial> export const ibcHashToNativeInjPerCosmosChain = { @@ -489,6 +529,8 @@ export const ibcHashToNativeInjPerCosmosChain = { 'ibc/D64E84758BCA42602C27E9ED2DB8F4EFDAE6A1E311CF404B516D45FEDF319D73', [CosmosChainId.Stride]: 'ibc/A7454562FF29FE068F42F9DE4805ABEF54F599D1720B345D6518D9B5C64EA6D2', + [BridgingNetwork.Migaloo]: + 'ibc/1C2D8505A29823310B4484E4C63CFDCB08C0D3B57537A615A45F4E5D42CDC789', } as Partial> export const getExplorerUrl = (network: Network): string => { @@ -511,6 +553,10 @@ export const getCosmosExplorerUrl = ( return 'https://scan.orai.io/' } + if (bridgingNetwork === BridgingNetwork.Migaloo) { + return 'https://migaloo.explorers.guru/' + } + const mintScanNetworkUrl = MintScanExplorerUrl[bridgingNetwork] if (isDevnet(network)) { @@ -608,76 +654,92 @@ export const getPeggoGraphQlEndpoint = (network: Network): string => { return '' } -export const getNetworkFromAddress = (sender: string): BridgingNetwork => { - if (sender.startsWith('juno')) { +export const getNetworkFromAddress = (address: string): BridgingNetwork => { + if (address.startsWith('inj')) { + return BridgingNetwork.Injective + } + + if (address.startsWith('cosmos')) { + return BridgingNetwork.CosmosHub + } + + if (address.startsWith('juno')) { return BridgingNetwork.Juno } - if (sender.startsWith('terra')) { + if (address.startsWith('terra')) { return BridgingNetwork.Terra } - if (sender.startsWith('osmo')) { + if (address.startsWith('osmo')) { return BridgingNetwork.Osmosis } - if (sender.startsWith('chihuahua')) { + if (address.startsWith('chihuahua')) { return BridgingNetwork.Chihuahua } - if (sender.startsWith('axelar')) { + if (address.startsWith('axelar')) { return BridgingNetwork.Axelar } - if (sender.startsWith('evmos')) { + if (address.startsWith('evmos')) { return BridgingNetwork.Evmos } - if (sender.startsWith('persistence')) { + if (address.startsWith('persistence')) { return BridgingNetwork.Persistence } - if (sender.startsWith('secret')) { + if (address.startsWith('secret')) { return BridgingNetwork.Secret } - if (sender.startsWith('stride')) { + if (address.startsWith('stride')) { return BridgingNetwork.Stride } - if (sender.startsWith('cre')) { + if (address.startsWith('cre')) { return BridgingNetwork.Crescent } - if (sender.startsWith('somm')) { + if (address.startsWith('somm')) { return BridgingNetwork.Sommelier } - if (sender.startsWith('canto')) { + if (address.startsWith('canto')) { return BridgingNetwork.Canto } - if (sender.startsWith('kava')) { + if (address.startsWith('kava')) { return BridgingNetwork.Kava } - if (sender.startsWith('orai')) { + if (address.startsWith('orai')) { return BridgingNetwork.Oraichain } - if (sender.startsWith('0x')) { + if (address.startsWith('0x')) { return BridgingNetwork.Ethereum } - if (sender.startsWith('noble')) { + if (address.startsWith('noble')) { return BridgingNetwork.Noble } - if (sender.startsWith('celestia')) { + if (address.startsWith('celestia')) { return BridgingNetwork.Celestia } - return BridgingNetwork.CosmosHub + if (address.startsWith('migaloo')) { + return BridgingNetwork.Migaloo + } + + if (address.startsWith('kujira')) { + return BridgingNetwork.Kujira + } + + return BridgingNetwork.Injective } export const getBridgeTransactionType = ( diff --git a/packages/sdk-ui-ts/src/utils/cw20.ts b/packages/sdk-ui-ts/src/utils/cw20.ts index 14c7ec728..9448a61dc 100644 --- a/packages/sdk-ui-ts/src/utils/cw20.ts +++ b/packages/sdk-ui-ts/src/utils/cw20.ts @@ -1,4 +1,4 @@ -import { ContractStateWithPagination } from '@injectivelabs/sdk-ts' +import { Contract, ContractStateWithPagination } from '@injectivelabs/sdk-ts' import { TokenType, TokenVerification, @@ -19,7 +19,7 @@ export const getTokenFromContractStateResponse = ( name: tokenInfo.name || contractInfo.label || 'Unknown', symbol: tokenInfo.symbol || tokenInfo.name || 'Unknown', decimals: tokenInfo.decimals || 18, - logo: 'unknown.svg', + logo: 'unknown.png', coinGeckoId: '', tokenType: TokenType.Cw20, tokenVerification: TokenVerification.Internal, @@ -32,3 +32,36 @@ export const getTokenFromContractStateResponse = ( }, } as Token } + +export const getTokenFromCw20ContractInfo = ( + denom: string, + response: Contract & { cw20_metadata: { token_info: any } }, +): Token => { + const contractAddress = denom.startsWith('factory') + ? denom.split('/')[2] + : denom + + return { + denom, + name: response.cw20_metadata.token_info.name || response.label || 'Unknown', + symbol: + response.cw20_metadata.token_info.symbol || + response.cw20_metadata.token_info.name || + 'Unknown', + decimals: response.cw20_metadata.token_info.decimals || 18, + logo: 'unknown.png', + coinGeckoId: '', + tokenType: TokenType.Cw20, + tokenVerification: TokenVerification.Internal, + + cw20: { + decimals: response.cw20_metadata.token_info.decimals || 18, + address: contractAddress, + symbol: + response.cw20_metadata.token_info.symbol || + response.cw20_metadata.token_info.name || + 'Unknown', + tokenType: TokenType.Cw20, + }, + } as Token +} diff --git a/packages/sdk-ui-ts/src/utils/exchange.ts b/packages/sdk-ui-ts/src/utils/exchange.ts index 69c413f4d..6efe9572f 100644 --- a/packages/sdk-ui-ts/src/utils/exchange.ts +++ b/packages/sdk-ui-ts/src/utils/exchange.ts @@ -50,7 +50,7 @@ export const getTokenFromInsuranceFund = ( name: (response.marketTicker || denom) + ' Insurance Fund', symbol: denom, decimals: 18, - logo: 'injective-v3.svg', + logo: 'injective-v3.png', coinGeckoId: '', tokenType: TokenType.InsuranceFund, tokenVerification: TokenVerification.Verified, diff --git a/packages/sdk-ui-ts/src/utils/factory.ts b/packages/sdk-ui-ts/src/utils/factory.ts index 6d65a75d5..f357484bb 100644 --- a/packages/sdk-ui-ts/src/utils/factory.ts +++ b/packages/sdk-ui-ts/src/utils/factory.ts @@ -20,7 +20,7 @@ export const getTokenFromDenomsMetadata = ( description: response.description, symbol: response.symbol || response.name || 'Unknown', decimals: denomUnit.exponent || 0, - logo: response.uri || 'unknown.svg', + logo: response.uri || 'unknown.png', coinGeckoId: '', tokenType: TokenType.TokenFactory, tokenVerification: TokenVerification.Internal, diff --git a/packages/sdk-ui-ts/src/utils/helpers.ts b/packages/sdk-ui-ts/src/utils/helpers.ts index d59e2b71b..87509dad1 100644 --- a/packages/sdk-ui-ts/src/utils/helpers.ts +++ b/packages/sdk-ui-ts/src/utils/helpers.ts @@ -23,15 +23,15 @@ export const getTokenLogoWithVendorPathPrefix = (image: string) => { export const getTokenLogoFromTokenType = (tokenType: TokenType) => { switch (true) { case tokenType === TokenType.InsuranceFund: - return getTokenLogoWithVendorPathPrefix('insurance-fund.svg') + return getTokenLogoWithVendorPathPrefix('insurance-fund.png') case tokenType === TokenType.Native: - return getTokenLogoWithVendorPathPrefix('injective-black-fill.svg') + return getTokenLogoWithVendorPathPrefix('injective-black-fill.png') case tokenType === TokenType.Cw20: - return getTokenLogoWithVendorPathPrefix('cw20.svg') + return getTokenLogoWithVendorPathPrefix('cw20.png') case tokenType === TokenType.Ibc: - return getTokenLogoWithVendorPathPrefix('ibc.svg') + return getTokenLogoWithVendorPathPrefix('ibc.png') default: - return getTokenLogoWithVendorPathPrefix('injective-black-fill.svg') + return getTokenLogoWithVendorPathPrefix('injective-black-fill.png') } } @@ -51,6 +51,6 @@ export const getValidatorLogoWithVendorPathPrefix = ( 'vendor', '@injectivelabs', 'sdk-ui-ts', - validatorLogoPath ? validatorLogoPath : 'untracked.png', + validatorLogoPath ? validatorLogoPath : 'unknown.png', ) } diff --git a/packages/test-utils/CHANGELOG.md b/packages/test-utils/CHANGELOG.md index 2439af634..d2122ee38 100644 --- a/packages/test-utils/CHANGELOG.md +++ b/packages/test-utils/CHANGELOG.md @@ -3,6 +3,22 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.14.3](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/test-utils@1.14.3-beta.0...@injectivelabs/test-utils@1.14.3) (2023-11-20) + +**Note:** Version bump only for package @injectivelabs/test-utils + + + + + +## [1.14.2](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/test-utils@1.14.2-beta.0...@injectivelabs/test-utils@1.14.2) (2023-11-17) + +**Note:** Version bump only for package @injectivelabs/test-utils + + + + + ## [1.14.1](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/test-utils@1.14.1-beta.5...@injectivelabs/test-utils@1.14.1) (2023-10-27) **Note:** Version bump only for package @injectivelabs/test-utils diff --git a/packages/test-utils/package.json b/packages/test-utils/package.json index 6bedacefd..ef7e4e347 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.14.1", + "version": "1.14.3", "sideEffects": false, "author": { "name": "Bojan Angjelkoski", diff --git a/packages/token-metadata/CHANGELOG.md b/packages/token-metadata/CHANGELOG.md index c9c722e4d..519779419 100644 --- a/packages/token-metadata/CHANGELOG.md +++ b/packages/token-metadata/CHANGELOG.md @@ -3,6 +3,42 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.14.5](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/token-metadata@1.14.5-beta.46...@injectivelabs/token-metadata@1.14.5) (2024-01-11) + + +### Features + +* cid ([be5f93c](https://github.com/InjectiveLabs/injective-ts/commit/be5f93c4b59fc8dce07e4101b7790a645eef4edc)) +* cid ([b286316](https://github.com/InjectiveLabs/injective-ts/commit/b286316549a80ba64af9ba946d9166e1cd638fd7)) + + + + + +## [1.14.4](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/token-metadata@1.14.4-beta.3...@injectivelabs/token-metadata@1.14.4) (2023-11-20) + +**Note:** Version bump only for package @injectivelabs/token-metadata + + + + + +## [1.14.3](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/token-metadata@1.14.3-beta.6...@injectivelabs/token-metadata@1.14.3) (2023-11-17) + +**Note:** Version bump only for package @injectivelabs/token-metadata + + + + + +## [1.14.2](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/token-metadata@1.14.2-beta.9...@injectivelabs/token-metadata@1.14.2) (2023-11-07) + +**Note:** Version bump only for package @injectivelabs/token-metadata + + + + + ## [1.14.1](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/token-metadata@1.14.1-beta.15...@injectivelabs/token-metadata@1.14.1) (2023-10-27) **Note:** Version bump only for package @injectivelabs/token-metadata diff --git a/packages/token-metadata/README.md b/packages/token-metadata/README.md index 321d0edd8..a892c87a3 100644 --- a/packages/token-metadata/README.md +++ b/packages/token-metadata/README.md @@ -14,7 +14,7 @@ yarn add @injectivelabs/token-metadata ## 📖 Documentation -Read more and find example usages on our [TokenMetadata Wiki](https://github.com/InjectiveLabs/injective-ts/wiki/09TokenMetadata) +Read more and find example usages on our [TokenMetadata Docs](https://docs.ts.injective.network/readme/token-metadata) --- @@ -40,7 +40,6 @@ Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/ -

 

Powering the future of decentralized finance. diff --git a/packages/token-metadata/package.json b/packages/token-metadata/package.json index 3b517bac3..968d492be 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.14.2-beta.10", + "version": "1.14.5", "sideEffects": false, "license": "Apache-2.0", "author": { @@ -32,10 +32,10 @@ "start": "node dist/index.js" }, "dependencies": { - "@injectivelabs/exceptions": "^1.14.2-beta.2", - "@injectivelabs/networks": "^1.14.2-beta.3", - "@injectivelabs/ts-types": "^1.14.2-beta.0", - "@injectivelabs/utils": "^1.14.2-beta.2", + "@injectivelabs/exceptions": "^1.14.5", + "@injectivelabs/networks": "^1.14.5", + "@injectivelabs/ts-types": "^1.14.5", + "@injectivelabs/utils": "^1.14.5", "@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 91da45444..664d61bf1 100644 --- a/packages/token-metadata/src/TokenFactory.ts +++ b/packages/token-metadata/src/TokenFactory.ts @@ -20,24 +20,37 @@ export class TokenFactory { this.tokenMetaUtils = tokenMetaUtils } - static make(network: Network = Network.Mainnet): TokenFactory { + static make( + network: Network = Network.Mainnet, + registry: Record = {}, + ): TokenFactory { if (isTestnet(network)) { - return new TokenFactory(new TokenMetaUtils(getTokensBySymbolForTestnet())) + return new TokenFactory( + new TokenMetaUtils({ ...getTokensBySymbolForTestnet(), ...registry }), + ) } if (network === Network.Devnet) { - return new TokenFactory(new TokenMetaUtils(getTokensBySymbolForDevnet())) + return new TokenFactory( + new TokenMetaUtils({ ...getTokensBySymbolForDevnet(), ...registry }), + ) } if (network === Network.Devnet1) { - return new TokenFactory(new TokenMetaUtils(getTokensBySymbolForDevnet1())) + return new TokenFactory( + new TokenMetaUtils({ ...getTokensBySymbolForDevnet1(), ...registry }), + ) } if (network === Network.Devnet2) { - return new TokenFactory(new TokenMetaUtils(getTokensBySymbolForDevnet2())) + return new TokenFactory( + new TokenMetaUtils({ ...getTokensBySymbolForDevnet2(), ...registry }), + ) } - return new TokenFactory(new TokenMetaUtils(tokensBySymbol)) + return new TokenFactory( + new TokenMetaUtils({ ...tokensBySymbol, ...registry }), + ) } toToken(denom: string): Token | undefined { @@ -151,8 +164,12 @@ export class TokenFactory { ) } + let tokenMeta = + this.tokenMetaUtils.getMetaBySymbol(address) || + this.tokenMetaUtils.getMetaByName(address) + if (isCw20ContractAddress(address)) { - const tokenMeta = this.tokenMetaUtils.getMetaByAddress(address) + tokenMeta = this.tokenMetaUtils.getMetaByAddress(address) || tokenMeta return tokenMeta ? { @@ -162,9 +179,14 @@ export class TokenFactory { : undefined } - const tokenMeta = - this.tokenMetaUtils.getMetaBySymbol(address) || - this.tokenMetaUtils.getMetaByName(address) + /** + * We have to prevent factory token denoms to be identified as + * normal tokens by using only the symbol, i.e + * factory/inj..../sol !== SOL token + */ + if (tokenMeta?.tokenType !== TokenType.TokenFactory) { + return undefined + } return tokenMeta ? { diff --git a/packages/token-metadata/src/ibc/channels.ts b/packages/token-metadata/src/ibc/channels.ts index 5de6656af..a504b150b 100644 --- a/packages/token-metadata/src/ibc/channels.ts +++ b/packages/token-metadata/src/ibc/channels.ts @@ -12,10 +12,12 @@ export enum CanonicalChannelToDestinationChannel { Crescent = 'channel-90', Sommelier = 'channel-93', Migaloo = 'channel-102', + Nois = 'channel-138', Kava = 'channel-143', Oraichain = 'channel-147', Noble = 'channel-148', Celestia = 'channel-152', + Kujira = 'channel-98', } /** @@ -88,6 +90,7 @@ export const canonicalChannelsToChainList = [ { channelId: 'channel-146', chainA: 'Oraichain', chainB: 'Injective' }, { channelId: 'channel-31', chainA: 'Noble', chainB: 'Injective' }, { channelId: 'channel-7', chainA: 'Celestia', chainB: 'Injective' }, + { channelId: 'channel-54', chainA: 'Kujira', chainB: 'Injective' }, { channelId: 'channel-1', chainA: 'Injective', chainB: 'CosmosHub' }, { channelId: 'channel-83', chainA: 'Injective', chainB: 'Evmos' }, { channelId: 'channel-8', chainA: 'Injective', chainB: 'Osmosis' }, @@ -101,14 +104,18 @@ export const canonicalChannelsToChainList = [ { channelId: 'channel-23', chainA: 'Injective', chainB: 'Crescent' }, { channelId: 'channel-13', chainA: 'Injective', chainB: '' }, { channelId: 'channel-93', chainA: 'Injective', chainB: 'Sommelier' }, + { channelId: 'channel-98', chainA: 'Injective', chainB: 'Kujira' }, { channelId: 'channel-99', chainA: 'Injective', chainB: 'Canto' }, { channelId: 'channel-102', chainA: 'Injective', chainB: 'Migaloo' }, { channelId: 'channel-104', chainA: 'Injective', chainB: 'Terra2' }, { channelId: 'channel-105', chainA: 'Injective', chainB: 'Terra2' }, + { channelId: 'channel-138', chainA: 'Injective', chainB: 'Nois' }, + { channelId: 'channel-140', chainA: 'Injective', chainB: 'Nois' }, { channelId: 'channel-143', chainA: 'Injective', chainB: 'Kava' }, { channelId: 'channel-147', chainA: 'Injective', chainB: 'Oraichain' }, { channelId: 'channel-148', chainA: 'Injective', chainB: 'Noble' }, { channelId: 'channel-152', chainA: 'Injective', chainB: 'Celestia' }, + ] export default legacyCanonicalChannels @@ -134,10 +141,13 @@ export const canonicalChannelIds = [ 'channel-102', 'channel-104', 'channel-105', + 'channel-138', + 'channel-140', 'channel-143', 'channel-147', 'channel-148', 'channel-152', + 'channel-98', ] export const channelIbcDenomToBaseDenomMap = { diff --git a/packages/token-metadata/src/images/AAVE.png b/packages/token-metadata/src/images/AAVE.png new file mode 100644 index 000000000..2c620efeb Binary files /dev/null and b/packages/token-metadata/src/images/AAVE.png differ diff --git a/packages/token-metadata/src/images/AAVE.svg b/packages/token-metadata/src/images/AAVE.svg deleted file mode 100644 index d784fbe0a..000000000 --- a/packages/token-metadata/src/images/AAVE.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/packages/token-metadata/src/images/DGNZ.png b/packages/token-metadata/src/images/DGNZ.png new file mode 100644 index 000000000..ee66e473b Binary files /dev/null and b/packages/token-metadata/src/images/DGNZ.png differ diff --git a/packages/token-metadata/src/images/DREAM.png b/packages/token-metadata/src/images/DREAM.png new file mode 100644 index 000000000..e61d3f4da Binary files /dev/null and b/packages/token-metadata/src/images/DREAM.png differ diff --git a/packages/token-metadata/src/images/INJECT.png b/packages/token-metadata/src/images/INJECT.png new file mode 100644 index 000000000..06ed7a99b Binary files /dev/null and b/packages/token-metadata/src/images/INJECT.png differ diff --git a/packages/token-metadata/src/images/INJINEER.png b/packages/token-metadata/src/images/INJINEER.png new file mode 100644 index 000000000..fb1359acb Binary files /dev/null and b/packages/token-metadata/src/images/INJINEER.png differ diff --git a/packages/token-metadata/src/images/PUNK.png b/packages/token-metadata/src/images/PUNK.png new file mode 100644 index 000000000..7f5effff1 Binary files /dev/null and b/packages/token-metadata/src/images/PUNK.png differ diff --git a/packages/token-metadata/src/images/aoi.webp b/packages/token-metadata/src/images/aoi.webp new file mode 100644 index 000000000..d2628f45c Binary files /dev/null and b/packages/token-metadata/src/images/aoi.webp differ diff --git a/packages/token-metadata/src/images/app.jpeg b/packages/token-metadata/src/images/app.jpeg new file mode 100644 index 000000000..f065a043b Binary files /dev/null and b/packages/token-metadata/src/images/app.jpeg differ diff --git a/packages/token-metadata/src/images/arb-circle.png b/packages/token-metadata/src/images/arb-circle.png new file mode 100644 index 000000000..bc71fad4b Binary files /dev/null and b/packages/token-metadata/src/images/arb-circle.png differ diff --git a/packages/token-metadata/src/images/arb.png b/packages/token-metadata/src/images/arb.png index 54bbf1bd3..f9ef8c936 100644 Binary files a/packages/token-metadata/src/images/arb.png and b/packages/token-metadata/src/images/arb.png differ diff --git a/packages/token-metadata/src/images/astar.png b/packages/token-metadata/src/images/astar.png new file mode 100644 index 000000000..de300fe70 Binary files /dev/null and b/packages/token-metadata/src/images/astar.png differ diff --git a/packages/token-metadata/src/images/astar.svg b/packages/token-metadata/src/images/astar.svg deleted file mode 100644 index 70f1ebb26..000000000 --- a/packages/token-metadata/src/images/astar.svg +++ /dev/null @@ -1,189 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/packages/token-metadata/src/images/atom.png b/packages/token-metadata/src/images/atom.png new file mode 100644 index 000000000..949413411 Binary files /dev/null and b/packages/token-metadata/src/images/atom.png differ diff --git a/packages/token-metadata/src/images/atom.svg b/packages/token-metadata/src/images/atom.svg deleted file mode 100644 index f957f2ce0..000000000 --- a/packages/token-metadata/src/images/atom.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/packages/token-metadata/src/images/autism.png b/packages/token-metadata/src/images/autism.png new file mode 100644 index 000000000..e4cfee1cd Binary files /dev/null and b/packages/token-metadata/src/images/autism.png differ diff --git a/packages/token-metadata/src/images/axelar.png b/packages/token-metadata/src/images/axelar.png new file mode 100644 index 000000000..32f81ab09 Binary files /dev/null and b/packages/token-metadata/src/images/axelar.png differ diff --git a/packages/token-metadata/src/images/axelar.svg b/packages/token-metadata/src/images/axelar.svg deleted file mode 100644 index d0d937a78..000000000 --- a/packages/token-metadata/src/images/axelar.svg +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/packages/token-metadata/src/images/axs.png b/packages/token-metadata/src/images/axs.png index 3586b2090..ace605759 100644 Binary files a/packages/token-metadata/src/images/axs.png and b/packages/token-metadata/src/images/axs.png differ diff --git a/packages/token-metadata/src/images/axs.svg b/packages/token-metadata/src/images/axs.svg deleted file mode 100644 index 6d35ef157..000000000 --- a/packages/token-metadata/src/images/axs.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/packages/token-metadata/src/images/babykira.png b/packages/token-metadata/src/images/babykira.png new file mode 100644 index 000000000..37cd33608 Binary files /dev/null and b/packages/token-metadata/src/images/babykira.png differ diff --git a/packages/token-metadata/src/images/babyninja.png b/packages/token-metadata/src/images/babyninja.png new file mode 100644 index 000000000..9575e4704 Binary files /dev/null and b/packages/token-metadata/src/images/babyninja.png differ diff --git a/packages/token-metadata/src/images/bayc.png b/packages/token-metadata/src/images/bayc.png new file mode 100644 index 000000000..22bbce0e8 Binary files /dev/null and b/packages/token-metadata/src/images/bayc.png differ diff --git a/packages/token-metadata/src/images/bayc.svg b/packages/token-metadata/src/images/bayc.svg deleted file mode 100644 index 595832098..000000000 --- a/packages/token-metadata/src/images/bayc.svg +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/packages/token-metadata/src/images/bird.png b/packages/token-metadata/src/images/bird.png new file mode 100644 index 000000000..5aefb1aaa Binary files /dev/null and b/packages/token-metadata/src/images/bird.png differ diff --git a/packages/token-metadata/src/images/bitcoin.png b/packages/token-metadata/src/images/bitcoin.png new file mode 100644 index 000000000..9e9aea69b Binary files /dev/null and b/packages/token-metadata/src/images/bitcoin.png differ diff --git a/packages/token-metadata/src/images/bitcoin.svg b/packages/token-metadata/src/images/bitcoin.svg deleted file mode 100644 index eca66c262..000000000 --- a/packages/token-metadata/src/images/bitcoin.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/packages/token-metadata/src/images/bnb.png b/packages/token-metadata/src/images/bnb.png new file mode 100644 index 000000000..f1a687194 Binary files /dev/null and b/packages/token-metadata/src/images/bnb.png differ diff --git a/packages/token-metadata/src/images/bnb.svg b/packages/token-metadata/src/images/bnb.svg deleted file mode 100644 index 03aa7e622..000000000 --- a/packages/token-metadata/src/images/bnb.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/packages/token-metadata/src/images/brett.jpeg b/packages/token-metadata/src/images/brett.jpeg new file mode 100644 index 000000000..a340c527f Binary files /dev/null and b/packages/token-metadata/src/images/brett.jpeg differ diff --git a/packages/token-metadata/src/images/bulls.png b/packages/token-metadata/src/images/bulls.png new file mode 100644 index 000000000..93d6dcc39 Binary files /dev/null and b/packages/token-metadata/src/images/bulls.png differ diff --git a/packages/token-metadata/src/images/chainlink.png b/packages/token-metadata/src/images/chainlink.png new file mode 100644 index 000000000..7effe7f4a Binary files /dev/null and b/packages/token-metadata/src/images/chainlink.png differ diff --git a/packages/token-metadata/src/images/chainlink.svg b/packages/token-metadata/src/images/chainlink.svg deleted file mode 100644 index a36a9ac6e..000000000 --- a/packages/token-metadata/src/images/chainlink.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/packages/token-metadata/src/images/cock.png b/packages/token-metadata/src/images/cock.png new file mode 100644 index 000000000..0eda013e7 Binary files /dev/null and b/packages/token-metadata/src/images/cock.png differ diff --git a/packages/token-metadata/src/images/comp.png b/packages/token-metadata/src/images/comp.png new file mode 100644 index 000000000..a177f45f6 Binary files /dev/null and b/packages/token-metadata/src/images/comp.png differ diff --git a/packages/token-metadata/src/images/comp.svg b/packages/token-metadata/src/images/comp.svg deleted file mode 100644 index 71a607053..000000000 --- a/packages/token-metadata/src/images/comp.svg +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/packages/token-metadata/src/images/cw20.png b/packages/token-metadata/src/images/cw20.png new file mode 100644 index 000000000..218ca7178 Binary files /dev/null and b/packages/token-metadata/src/images/cw20.png differ diff --git a/packages/token-metadata/src/images/cw20.svg b/packages/token-metadata/src/images/cw20.svg deleted file mode 100644 index 82b39117d..000000000 --- a/packages/token-metadata/src/images/cw20.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/packages/token-metadata/src/images/dai.png b/packages/token-metadata/src/images/dai.png new file mode 100644 index 000000000..9eaaeedf7 Binary files /dev/null and b/packages/token-metadata/src/images/dai.png differ diff --git a/packages/token-metadata/src/images/dai.svg b/packages/token-metadata/src/images/dai.svg deleted file mode 100644 index 2cec854e7..000000000 --- a/packages/token-metadata/src/images/dai.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/packages/token-metadata/src/images/derivativeVault.png b/packages/token-metadata/src/images/derivativeVault.png new file mode 100644 index 000000000..589d05d31 Binary files /dev/null and b/packages/token-metadata/src/images/derivativeVault.png differ diff --git a/packages/token-metadata/src/images/derivativeVault.svg b/packages/token-metadata/src/images/derivativeVault.svg deleted file mode 100644 index f0853f13b..000000000 --- a/packages/token-metadata/src/images/derivativeVault.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/packages/token-metadata/src/images/doj.png b/packages/token-metadata/src/images/doj.png new file mode 100644 index 000000000..86678bb67 Binary files /dev/null and b/packages/token-metadata/src/images/doj.png differ diff --git a/packages/token-metadata/src/images/dojo.png b/packages/token-metadata/src/images/dojo.png new file mode 100644 index 000000000..53b9d9815 Binary files /dev/null and b/packages/token-metadata/src/images/dojo.png differ diff --git a/packages/token-metadata/src/images/dude.png b/packages/token-metadata/src/images/dude.png new file mode 100644 index 000000000..3351022a4 Binary files /dev/null and b/packages/token-metadata/src/images/dude.png differ diff --git a/packages/token-metadata/src/images/eric.png b/packages/token-metadata/src/images/eric.png new file mode 100644 index 000000000..4c4ec49b4 Binary files /dev/null and b/packages/token-metadata/src/images/eric.png differ diff --git a/packages/token-metadata/src/images/ethbtctrend.png b/packages/token-metadata/src/images/ethbtctrend.png new file mode 100644 index 000000000..f558bfa7b Binary files /dev/null and b/packages/token-metadata/src/images/ethbtctrend.png differ diff --git a/packages/token-metadata/src/images/ethbtctrend.svg b/packages/token-metadata/src/images/ethbtctrend.svg deleted file mode 100644 index defc81c86..000000000 --- a/packages/token-metadata/src/images/ethbtctrend.svg +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - diff --git a/packages/token-metadata/src/images/ethereum.png b/packages/token-metadata/src/images/ethereum.png new file mode 100644 index 000000000..38608adbd Binary files /dev/null and b/packages/token-metadata/src/images/ethereum.png differ diff --git a/packages/token-metadata/src/images/ethereum.svg b/packages/token-metadata/src/images/ethereum.svg deleted file mode 100644 index bc0c279c7..000000000 --- a/packages/token-metadata/src/images/ethereum.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/packages/token-metadata/src/images/eur.png b/packages/token-metadata/src/images/eur.png new file mode 100644 index 000000000..34301ddd6 Binary files /dev/null and b/packages/token-metadata/src/images/eur.png differ diff --git a/packages/token-metadata/src/images/eur.svg b/packages/token-metadata/src/images/eur.svg deleted file mode 100644 index 7fd565032..000000000 --- a/packages/token-metadata/src/images/eur.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/packages/token-metadata/src/images/euro.svg b/packages/token-metadata/src/images/euro.svg deleted file mode 100644 index 11e65ea17..000000000 --- a/packages/token-metadata/src/images/euro.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/packages/token-metadata/src/images/evmos.png b/packages/token-metadata/src/images/evmos.png new file mode 100644 index 000000000..fce89c0f8 Binary files /dev/null and b/packages/token-metadata/src/images/evmos.png differ diff --git a/packages/token-metadata/src/images/evmos.svg b/packages/token-metadata/src/images/evmos.svg deleted file mode 100644 index d343f3524..000000000 --- a/packages/token-metadata/src/images/evmos.svg +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/packages/token-metadata/src/images/extravirginoliveinu.png b/packages/token-metadata/src/images/extravirginoliveinu.png new file mode 100644 index 000000000..5d9d9600d Binary files /dev/null and b/packages/token-metadata/src/images/extravirginoliveinu.png differ diff --git a/packages/token-metadata/src/images/flux.png b/packages/token-metadata/src/images/flux.png new file mode 100644 index 000000000..3541f8d27 Binary files /dev/null and b/packages/token-metadata/src/images/flux.png differ diff --git a/packages/token-metadata/src/images/galaxy.webp b/packages/token-metadata/src/images/galaxy.webp new file mode 100644 index 000000000..d64320130 Binary files /dev/null and b/packages/token-metadata/src/images/galaxy.webp differ diff --git a/packages/token-metadata/src/images/ginger.png b/packages/token-metadata/src/images/ginger.png new file mode 100644 index 000000000..5f3ab3611 Binary files /dev/null and b/packages/token-metadata/src/images/ginger.png differ diff --git a/packages/token-metadata/src/images/gold.png b/packages/token-metadata/src/images/gold.png new file mode 100644 index 000000000..df0fc1403 Binary files /dev/null and b/packages/token-metadata/src/images/gold.png differ diff --git a/packages/token-metadata/src/images/gold.svg b/packages/token-metadata/src/images/gold.svg deleted file mode 100644 index a33439e03..000000000 --- a/packages/token-metadata/src/images/gold.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/packages/token-metadata/src/images/gpb.png b/packages/token-metadata/src/images/gpb.png new file mode 100644 index 000000000..5f6d3892a Binary files /dev/null and b/packages/token-metadata/src/images/gpb.png differ diff --git a/packages/token-metadata/src/images/gpb.svg b/packages/token-metadata/src/images/gpb.svg deleted file mode 100644 index d8e0d5d24..000000000 --- a/packages/token-metadata/src/images/gpb.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/packages/token-metadata/src/images/graphToken.png b/packages/token-metadata/src/images/graphToken.png new file mode 100644 index 000000000..fe76e9d46 Binary files /dev/null and b/packages/token-metadata/src/images/graphToken.png differ diff --git a/packages/token-metadata/src/images/graphToken.svg b/packages/token-metadata/src/images/graphToken.svg deleted file mode 100644 index 9f6a49a35..000000000 --- a/packages/token-metadata/src/images/graphToken.svg +++ /dev/null @@ -1,45 +0,0 @@ - - - GRT - 12 / The Graph Token - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/packages/token-metadata/src/images/grok.png b/packages/token-metadata/src/images/grok.png new file mode 100644 index 000000000..ccaf09d14 Binary files /dev/null and b/packages/token-metadata/src/images/grok.png differ diff --git a/packages/token-metadata/src/images/ibc.png b/packages/token-metadata/src/images/ibc.png new file mode 100644 index 000000000..734e7cbc4 Binary files /dev/null and b/packages/token-metadata/src/images/ibc.png differ diff --git a/packages/token-metadata/src/images/ibc.svg b/packages/token-metadata/src/images/ibc.svg deleted file mode 100644 index eb0b522a1..000000000 --- a/packages/token-metadata/src/images/ibc.svg +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/packages/token-metadata/src/images/incel.png b/packages/token-metadata/src/images/incel.png new file mode 100644 index 000000000..deef0a6a5 Binary files /dev/null and b/packages/token-metadata/src/images/incel.png differ diff --git a/packages/token-metadata/src/images/injective-black-fill.png b/packages/token-metadata/src/images/injective-black-fill.png new file mode 100644 index 000000000..878cfc6f9 Binary files /dev/null and b/packages/token-metadata/src/images/injective-black-fill.png differ diff --git a/packages/token-metadata/src/images/injective-black-fill.svg b/packages/token-metadata/src/images/injective-black-fill.svg deleted file mode 100644 index c4f62de73..000000000 --- a/packages/token-metadata/src/images/injective-black-fill.svg +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/packages/token-metadata/src/images/injective-v3.png b/packages/token-metadata/src/images/injective-v3.png new file mode 100644 index 000000000..810f9302c Binary files /dev/null and b/packages/token-metadata/src/images/injective-v3.png differ diff --git a/packages/token-metadata/src/images/injective-v3.svg b/packages/token-metadata/src/images/injective-v3.svg deleted file mode 100644 index d01adbe32..000000000 --- a/packages/token-metadata/src/images/injective-v3.svg +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - diff --git a/packages/token-metadata/src/images/injective.svg b/packages/token-metadata/src/images/injective.svg deleted file mode 100644 index da0938c78..000000000 --- a/packages/token-metadata/src/images/injective.svg +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/packages/token-metadata/src/images/injex.png b/packages/token-metadata/src/images/injex.png new file mode 100644 index 000000000..d6207f780 Binary files /dev/null and b/packages/token-metadata/src/images/injex.png differ diff --git a/packages/token-metadata/src/images/injinu.png b/packages/token-metadata/src/images/injinu.png new file mode 100644 index 000000000..d5a5762d4 Binary files /dev/null and b/packages/token-metadata/src/images/injinu.png differ diff --git a/packages/token-metadata/src/images/insurance-fund.png b/packages/token-metadata/src/images/insurance-fund.png new file mode 100644 index 000000000..ccb64b98c Binary files /dev/null and b/packages/token-metadata/src/images/insurance-fund.png differ diff --git a/packages/token-metadata/src/images/insurance-fund.svg b/packages/token-metadata/src/images/insurance-fund.svg deleted file mode 100644 index ca14e2c74..000000000 --- a/packages/token-metadata/src/images/insurance-fund.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/packages/token-metadata/src/images/ipdai.png b/packages/token-metadata/src/images/ipdai.png new file mode 100644 index 000000000..bd526087c Binary files /dev/null and b/packages/token-metadata/src/images/ipdai.png differ diff --git a/packages/token-metadata/src/images/jpy.png b/packages/token-metadata/src/images/jpy.png new file mode 100644 index 000000000..db491214f Binary files /dev/null and b/packages/token-metadata/src/images/jpy.png differ diff --git a/packages/token-metadata/src/images/jpy.svg b/packages/token-metadata/src/images/jpy.svg deleted file mode 100644 index 74dcee81a..000000000 --- a/packages/token-metadata/src/images/jpy.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/packages/token-metadata/src/images/karate.jpg b/packages/token-metadata/src/images/karate.jpg new file mode 100644 index 000000000..267d78446 Binary files /dev/null and b/packages/token-metadata/src/images/karate.jpg differ diff --git a/packages/token-metadata/src/images/karma.png b/packages/token-metadata/src/images/karma.png new file mode 100644 index 000000000..02c2a2ca8 Binary files /dev/null and b/packages/token-metadata/src/images/karma.png differ diff --git a/packages/token-metadata/src/images/katana.webp b/packages/token-metadata/src/images/katana.webp new file mode 100644 index 000000000..f71021a00 Binary files /dev/null and b/packages/token-metadata/src/images/katana.webp differ diff --git a/packages/token-metadata/src/images/kinja.png b/packages/token-metadata/src/images/kinja.png new file mode 100644 index 000000000..2bd0f0d57 Binary files /dev/null and b/packages/token-metadata/src/images/kinja.png differ diff --git a/packages/token-metadata/src/images/kira.jpeg b/packages/token-metadata/src/images/kira.jpeg new file mode 100644 index 000000000..7fac08bd3 Binary files /dev/null and b/packages/token-metadata/src/images/kira.jpeg differ diff --git a/packages/token-metadata/src/images/kuji.webp b/packages/token-metadata/src/images/kuji.webp new file mode 100644 index 000000000..f066a3de0 Binary files /dev/null and b/packages/token-metadata/src/images/kuji.webp differ diff --git a/packages/token-metadata/src/images/lama.webp b/packages/token-metadata/src/images/lama.webp new file mode 100644 index 000000000..c9d940d3b Binary files /dev/null and b/packages/token-metadata/src/images/lama.webp differ diff --git a/packages/token-metadata/src/images/lior.png b/packages/token-metadata/src/images/lior.png new file mode 100644 index 000000000..1da9b8fcf Binary files /dev/null and b/packages/token-metadata/src/images/lior.png differ diff --git a/packages/token-metadata/src/images/luna.png b/packages/token-metadata/src/images/luna.png index 33376c1ea..5a5c67684 100644 Binary files a/packages/token-metadata/src/images/luna.png and b/packages/token-metadata/src/images/luna.png differ diff --git a/packages/token-metadata/src/images/luna.svg b/packages/token-metadata/src/images/luna.svg deleted file mode 100644 index ed8383bd2..000000000 --- a/packages/token-metadata/src/images/luna.svg +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - diff --git a/packages/token-metadata/src/images/lvn.png b/packages/token-metadata/src/images/lvn.png new file mode 100644 index 000000000..de84b4e24 Binary files /dev/null and b/packages/token-metadata/src/images/lvn.png differ diff --git a/packages/token-metadata/src/images/maga.png b/packages/token-metadata/src/images/maga.png new file mode 100644 index 000000000..2e8c95f1a Binary files /dev/null and b/packages/token-metadata/src/images/maga.png differ diff --git a/packages/token-metadata/src/images/matic.png b/packages/token-metadata/src/images/matic.png new file mode 100644 index 000000000..833e4e232 Binary files /dev/null and b/packages/token-metadata/src/images/matic.png differ diff --git a/packages/token-metadata/src/images/matic.svg b/packages/token-metadata/src/images/matic.svg deleted file mode 100644 index f28dcc324..000000000 --- a/packages/token-metadata/src/images/matic.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/packages/token-metadata/src/images/meme.png b/packages/token-metadata/src/images/meme.png new file mode 100644 index 000000000..0d64ba42c Binary files /dev/null and b/packages/token-metadata/src/images/meme.png differ diff --git a/packages/token-metadata/src/images/mila.png b/packages/token-metadata/src/images/mila.png new file mode 100644 index 000000000..27ebb91d2 Binary files /dev/null and b/packages/token-metadata/src/images/mila.png differ diff --git a/packages/token-metadata/src/images/milk.png b/packages/token-metadata/src/images/milk.png new file mode 100644 index 000000000..f0b144265 Binary files /dev/null and b/packages/token-metadata/src/images/milk.png differ diff --git a/packages/token-metadata/src/images/mito-atom-boost-lp.png b/packages/token-metadata/src/images/mito-atom-boost-lp.png new file mode 100644 index 000000000..1eda2b456 Binary files /dev/null and b/packages/token-metadata/src/images/mito-atom-boost-lp.png differ diff --git a/packages/token-metadata/src/images/mito-atom-boost-lp.svg b/packages/token-metadata/src/images/mito-atom-boost-lp.svg deleted file mode 100644 index c3f8bb3aa..000000000 --- a/packages/token-metadata/src/images/mito-atom-boost-lp.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/packages/token-metadata/src/images/mito-atom-master-lp.png b/packages/token-metadata/src/images/mito-atom-master-lp.png new file mode 100644 index 000000000..b3ab16125 Binary files /dev/null and b/packages/token-metadata/src/images/mito-atom-master-lp.png differ diff --git a/packages/token-metadata/src/images/mito-atom-master-lp.svg b/packages/token-metadata/src/images/mito-atom-master-lp.svg deleted file mode 100644 index d6452caa5..000000000 --- a/packages/token-metadata/src/images/mito-atom-master-lp.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/packages/token-metadata/src/images/mito-eth-boost-lp.png b/packages/token-metadata/src/images/mito-eth-boost-lp.png new file mode 100644 index 000000000..c81bc6778 Binary files /dev/null and b/packages/token-metadata/src/images/mito-eth-boost-lp.png differ diff --git a/packages/token-metadata/src/images/mito-eth-boost-lp.svg b/packages/token-metadata/src/images/mito-eth-boost-lp.svg deleted file mode 100644 index cca55a9b9..000000000 --- a/packages/token-metadata/src/images/mito-eth-boost-lp.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/packages/token-metadata/src/images/mito-eur-master-lp.png b/packages/token-metadata/src/images/mito-eur-master-lp.png new file mode 100644 index 000000000..5721cad79 Binary files /dev/null and b/packages/token-metadata/src/images/mito-eur-master-lp.png differ diff --git a/packages/token-metadata/src/images/mito-eur-master-lp.svg b/packages/token-metadata/src/images/mito-eur-master-lp.svg deleted file mode 100644 index a9b05ea50..000000000 --- a/packages/token-metadata/src/images/mito-eur-master-lp.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/packages/token-metadata/src/images/mito-gbp-master-lp.png b/packages/token-metadata/src/images/mito-gbp-master-lp.png new file mode 100644 index 000000000..0fa1945a2 Binary files /dev/null and b/packages/token-metadata/src/images/mito-gbp-master-lp.png differ diff --git a/packages/token-metadata/src/images/mito-gbp-master-lp.svg b/packages/token-metadata/src/images/mito-gbp-master-lp.svg deleted file mode 100644 index 8447c0e0e..000000000 --- a/packages/token-metadata/src/images/mito-gbp-master-lp.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - diff --git a/packages/token-metadata/src/images/mito-inj-boost-lp.png b/packages/token-metadata/src/images/mito-inj-boost-lp.png new file mode 100644 index 000000000..8be7ed883 Binary files /dev/null and b/packages/token-metadata/src/images/mito-inj-boost-lp.png differ diff --git a/packages/token-metadata/src/images/mito-inj-boost-lp.svg b/packages/token-metadata/src/images/mito-inj-boost-lp.svg deleted file mode 100644 index 1309f46e1..000000000 --- a/packages/token-metadata/src/images/mito-inj-boost-lp.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/packages/token-metadata/src/images/mito-inj-master-lp.png b/packages/token-metadata/src/images/mito-inj-master-lp.png new file mode 100644 index 000000000..3dade5b0e Binary files /dev/null and b/packages/token-metadata/src/images/mito-inj-master-lp.png differ diff --git a/packages/token-metadata/src/images/mito-inj-master-lp.svg b/packages/token-metadata/src/images/mito-inj-master-lp.svg deleted file mode 100644 index e4023fe7f..000000000 --- a/packages/token-metadata/src/images/mito-inj-master-lp.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/packages/token-metadata/src/images/mito-proj-master-lp.png b/packages/token-metadata/src/images/mito-proj-master-lp.png new file mode 100644 index 000000000..171e0782b Binary files /dev/null and b/packages/token-metadata/src/images/mito-proj-master-lp.png differ diff --git a/packages/token-metadata/src/images/mito-proj-master-lp.svg b/packages/token-metadata/src/images/mito-proj-master-lp.svg deleted file mode 100644 index 9dcb3d37a..000000000 --- a/packages/token-metadata/src/images/mito-proj-master-lp.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/packages/token-metadata/src/images/mito-stInj-boost-lp.png b/packages/token-metadata/src/images/mito-stInj-boost-lp.png new file mode 100644 index 000000000..26cd4f7cf Binary files /dev/null and b/packages/token-metadata/src/images/mito-stInj-boost-lp.png differ diff --git a/packages/token-metadata/src/images/mito-stInj-boost-lp.svg b/packages/token-metadata/src/images/mito-stInj-boost-lp.svg deleted file mode 100644 index 178c3a717..000000000 --- a/packages/token-metadata/src/images/mito-stInj-boost-lp.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/packages/token-metadata/src/images/mito-usdc-master-lp.png b/packages/token-metadata/src/images/mito-usdc-master-lp.png new file mode 100644 index 000000000..4677c4bb2 Binary files /dev/null and b/packages/token-metadata/src/images/mito-usdc-master-lp.png differ diff --git a/packages/token-metadata/src/images/mito-usdc-master-lp.svg b/packages/token-metadata/src/images/mito-usdc-master-lp.svg deleted file mode 100644 index f555ee8e8..000000000 --- a/packages/token-metadata/src/images/mito-usdc-master-lp.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/packages/token-metadata/src/images/mito-weth-master-lp.png b/packages/token-metadata/src/images/mito-weth-master-lp.png new file mode 100644 index 000000000..ed8923166 Binary files /dev/null and b/packages/token-metadata/src/images/mito-weth-master-lp.png differ diff --git a/packages/token-metadata/src/images/mito-weth-master-lp.svg b/packages/token-metadata/src/images/mito-weth-master-lp.svg deleted file mode 100644 index 1a4dbada1..000000000 --- a/packages/token-metadata/src/images/mito-weth-master-lp.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/packages/token-metadata/src/images/mito-xau-boost-lp.png b/packages/token-metadata/src/images/mito-xau-boost-lp.png new file mode 100644 index 000000000..5436154ca Binary files /dev/null and b/packages/token-metadata/src/images/mito-xau-boost-lp.png differ diff --git a/packages/token-metadata/src/images/mito-xau-boost-lp.svg b/packages/token-metadata/src/images/mito-xau-boost-lp.svg deleted file mode 100644 index 7e8190935..000000000 --- a/packages/token-metadata/src/images/mito-xau-boost-lp.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/packages/token-metadata/src/images/mito_2.png b/packages/token-metadata/src/images/mito_2.png new file mode 100644 index 000000000..cfa4bd84b Binary files /dev/null and b/packages/token-metadata/src/images/mito_2.png differ diff --git a/packages/token-metadata/src/images/mito_2.svg b/packages/token-metadata/src/images/mito_2.svg deleted file mode 100644 index 374e15cf2..000000000 --- a/packages/token-metadata/src/images/mito_2.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/packages/token-metadata/src/images/mito_4.png b/packages/token-metadata/src/images/mito_4.png new file mode 100644 index 000000000..c2a62ce20 Binary files /dev/null and b/packages/token-metadata/src/images/mito_4.png differ diff --git a/packages/token-metadata/src/images/mito_4.svg b/packages/token-metadata/src/images/mito_4.svg deleted file mode 100644 index c64885a7f..000000000 --- a/packages/token-metadata/src/images/mito_4.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/packages/token-metadata/src/images/mito_5.png b/packages/token-metadata/src/images/mito_5.png new file mode 100644 index 000000000..4fb33383f Binary files /dev/null and b/packages/token-metadata/src/images/mito_5.png differ diff --git a/packages/token-metadata/src/images/mito_5.svg b/packages/token-metadata/src/images/mito_5.svg deleted file mode 100644 index ae35a9881..000000000 --- a/packages/token-metadata/src/images/mito_5.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/packages/token-metadata/src/images/mito_6.png b/packages/token-metadata/src/images/mito_6.png new file mode 100644 index 000000000..37b700b4a Binary files /dev/null and b/packages/token-metadata/src/images/mito_6.png differ diff --git a/packages/token-metadata/src/images/mito_6.svg b/packages/token-metadata/src/images/mito_6.svg deleted file mode 100644 index c820fa88e..000000000 --- a/packages/token-metadata/src/images/mito_6.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/packages/token-metadata/src/images/mito_7.png b/packages/token-metadata/src/images/mito_7.png new file mode 100644 index 000000000..eadf0e8f0 Binary files /dev/null and b/packages/token-metadata/src/images/mito_7.png differ diff --git a/packages/token-metadata/src/images/mito_7.svg b/packages/token-metadata/src/images/mito_7.svg deleted file mode 100644 index b000009b4..000000000 --- a/packages/token-metadata/src/images/mito_7.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/packages/token-metadata/src/images/mito_8.png b/packages/token-metadata/src/images/mito_8.png new file mode 100644 index 000000000..a873c4181 Binary files /dev/null and b/packages/token-metadata/src/images/mito_8.png differ diff --git a/packages/token-metadata/src/images/mito_8.svg b/packages/token-metadata/src/images/mito_8.svg deleted file mode 100644 index 77f93b254..000000000 --- a/packages/token-metadata/src/images/mito_8.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/packages/token-metadata/src/images/moonify.png b/packages/token-metadata/src/images/moonify.png new file mode 100644 index 000000000..a828ec25b Binary files /dev/null and b/packages/token-metadata/src/images/moonify.png differ diff --git a/packages/token-metadata/src/images/neok.png b/packages/token-metadata/src/images/neok.png new file mode 100644 index 000000000..d19d55eab Binary files /dev/null and b/packages/token-metadata/src/images/neok.png differ diff --git a/packages/token-metadata/src/images/neok.svg b/packages/token-metadata/src/images/neok.svg deleted file mode 100644 index f331b8f87..000000000 --- a/packages/token-metadata/src/images/neok.svg +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/packages/token-metadata/src/images/ninj.png b/packages/token-metadata/src/images/ninj.png new file mode 100644 index 000000000..df7558c2c Binary files /dev/null and b/packages/token-metadata/src/images/ninj.png differ diff --git a/packages/token-metadata/src/images/ninja.png b/packages/token-metadata/src/images/ninja.png new file mode 100644 index 000000000..11dc4a703 Binary files /dev/null and b/packages/token-metadata/src/images/ninja.png differ diff --git a/packages/token-metadata/src/images/ninjb.png b/packages/token-metadata/src/images/ninjb.png new file mode 100644 index 000000000..92c2b9727 Binary files /dev/null and b/packages/token-metadata/src/images/ninjb.png differ diff --git a/packages/token-metadata/src/images/nobi.jpeg b/packages/token-metadata/src/images/nobi.jpeg new file mode 100644 index 000000000..014c79821 Binary files /dev/null and b/packages/token-metadata/src/images/nobi.jpeg differ diff --git a/packages/token-metadata/src/images/nobi.webp b/packages/token-metadata/src/images/nobi.webp new file mode 100644 index 000000000..bef9544d1 Binary files /dev/null and b/packages/token-metadata/src/images/nobi.webp differ diff --git a/packages/token-metadata/src/images/nois.png b/packages/token-metadata/src/images/nois.png new file mode 100644 index 000000000..1b3929457 Binary files /dev/null and b/packages/token-metadata/src/images/nois.png differ diff --git a/packages/token-metadata/src/images/none.webp b/packages/token-metadata/src/images/none.webp new file mode 100644 index 000000000..5160518eb Binary files /dev/null and b/packages/token-metadata/src/images/none.webp differ diff --git a/packages/token-metadata/src/images/npepe.png b/packages/token-metadata/src/images/npepe.png new file mode 100644 index 000000000..8e01019d7 Binary files /dev/null and b/packages/token-metadata/src/images/npepe.png differ diff --git a/packages/token-metadata/src/images/omi.png b/packages/token-metadata/src/images/omi.png new file mode 100644 index 000000000..9703c32f2 Binary files /dev/null and b/packages/token-metadata/src/images/omi.png differ diff --git a/packages/token-metadata/src/images/orai.png b/packages/token-metadata/src/images/orai.png new file mode 100644 index 000000000..84e3ee109 Binary files /dev/null and b/packages/token-metadata/src/images/orai.png differ diff --git a/packages/token-metadata/src/images/orai.svg b/packages/token-metadata/src/images/orai.svg deleted file mode 100644 index cdc92a402..000000000 --- a/packages/token-metadata/src/images/orai.svg +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/packages/token-metadata/src/images/osmo.svg b/packages/token-metadata/src/images/osmo.svg deleted file mode 100644 index cecfbce10..000000000 --- a/packages/token-metadata/src/images/osmo.svg +++ /dev/null @@ -1,125 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/packages/token-metadata/src/images/ox.png b/packages/token-metadata/src/images/ox.png new file mode 100644 index 000000000..32e331d45 Binary files /dev/null and b/packages/token-metadata/src/images/ox.png differ diff --git a/packages/token-metadata/src/images/panda.png b/packages/token-metadata/src/images/panda.png new file mode 100644 index 000000000..3089b4903 Binary files /dev/null and b/packages/token-metadata/src/images/panda.png differ diff --git a/packages/token-metadata/src/images/pikachu.png b/packages/token-metadata/src/images/pikachu.png new file mode 100644 index 000000000..8ef6d1c75 Binary files /dev/null and b/packages/token-metadata/src/images/pikachu.png differ diff --git a/packages/token-metadata/src/images/point.png b/packages/token-metadata/src/images/point.png new file mode 100644 index 000000000..707645904 Binary files /dev/null and b/packages/token-metadata/src/images/point.png differ diff --git a/packages/token-metadata/src/images/point.svg b/packages/token-metadata/src/images/point.svg deleted file mode 100644 index 5686be21a..000000000 --- a/packages/token-metadata/src/images/point.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/packages/token-metadata/src/images/proj.png b/packages/token-metadata/src/images/proj.png new file mode 100644 index 000000000..ac9d9d363 Binary files /dev/null and b/packages/token-metadata/src/images/proj.png differ diff --git a/packages/token-metadata/src/images/projx.png b/packages/token-metadata/src/images/projx.png index ac9d9d363..c0239ebb8 100644 Binary files a/packages/token-metadata/src/images/projx.png and b/packages/token-metadata/src/images/projx.png differ diff --git a/packages/token-metadata/src/images/pyth.png b/packages/token-metadata/src/images/pyth.png new file mode 100644 index 000000000..58b9b9f5f Binary files /dev/null and b/packages/token-metadata/src/images/pyth.png differ diff --git a/packages/token-metadata/src/images/sdex.png b/packages/token-metadata/src/images/sdex.png new file mode 100644 index 000000000..0c87e203e Binary files /dev/null and b/packages/token-metadata/src/images/sdex.png differ diff --git a/packages/token-metadata/src/images/shiba.webp b/packages/token-metadata/src/images/shiba.webp new file mode 100644 index 000000000..e0497ab7b Binary files /dev/null and b/packages/token-metadata/src/images/shiba.webp differ diff --git a/packages/token-metadata/src/images/shuriken.jpeg b/packages/token-metadata/src/images/shuriken.jpeg new file mode 100644 index 000000000..0ccbca5f3 Binary files /dev/null and b/packages/token-metadata/src/images/shuriken.jpeg differ diff --git a/packages/token-metadata/src/images/skibidi.jpeg b/packages/token-metadata/src/images/skibidi.jpeg new file mode 100644 index 000000000..1534174c1 Binary files /dev/null and b/packages/token-metadata/src/images/skibidi.jpeg differ diff --git a/packages/token-metadata/src/images/snowy.png b/packages/token-metadata/src/images/snowy.png new file mode 100644 index 000000000..4f91154c6 Binary files /dev/null and b/packages/token-metadata/src/images/snowy.png differ diff --git a/packages/token-metadata/src/images/solana.png b/packages/token-metadata/src/images/solana.png new file mode 100644 index 000000000..4cf07f9e3 Binary files /dev/null and b/packages/token-metadata/src/images/solana.png differ diff --git a/packages/token-metadata/src/images/solana.svg b/packages/token-metadata/src/images/solana.svg deleted file mode 100644 index 5027e4e7b..000000000 --- a/packages/token-metadata/src/images/solana.svg +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/packages/token-metadata/src/images/spotVault.png b/packages/token-metadata/src/images/spotVault.png new file mode 100644 index 000000000..e144fa8af Binary files /dev/null and b/packages/token-metadata/src/images/spotVault.png differ diff --git a/packages/token-metadata/src/images/spotVault.svg b/packages/token-metadata/src/images/spotVault.svg deleted file mode 100644 index 1348b35af..000000000 --- a/packages/token-metadata/src/images/spotVault.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/packages/token-metadata/src/images/steadybtc.png b/packages/token-metadata/src/images/steadybtc.png new file mode 100644 index 000000000..3fa44226c Binary files /dev/null and b/packages/token-metadata/src/images/steadybtc.png differ diff --git a/packages/token-metadata/src/images/steadybtc.svg b/packages/token-metadata/src/images/steadybtc.svg deleted file mode 100644 index cdefe6d95..000000000 --- a/packages/token-metadata/src/images/steadybtc.svg +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - diff --git a/packages/token-metadata/src/images/steadyeth.png b/packages/token-metadata/src/images/steadyeth.png new file mode 100644 index 000000000..60deee37f Binary files /dev/null and b/packages/token-metadata/src/images/steadyeth.png differ diff --git a/packages/token-metadata/src/images/steadyeth.svg b/packages/token-metadata/src/images/steadyeth.svg deleted file mode 100644 index 73ebcf62b..000000000 --- a/packages/token-metadata/src/images/steadyeth.svg +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - diff --git a/packages/token-metadata/src/images/sushi.png b/packages/token-metadata/src/images/sushi.png new file mode 100644 index 000000000..d06d9d875 Binary files /dev/null and b/packages/token-metadata/src/images/sushi.png differ diff --git a/packages/token-metadata/src/images/sushi.svg b/packages/token-metadata/src/images/sushi.svg deleted file mode 100644 index 5ce4ef32d..000000000 --- a/packages/token-metadata/src/images/sushi.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/packages/token-metadata/src/images/synthetix.png b/packages/token-metadata/src/images/synthetix.png new file mode 100644 index 000000000..a22fba8df Binary files /dev/null and b/packages/token-metadata/src/images/synthetix.png differ diff --git a/packages/token-metadata/src/images/synthetix.svg b/packages/token-metadata/src/images/synthetix.svg deleted file mode 100644 index 99f2a08d5..000000000 --- a/packages/token-metadata/src/images/synthetix.svg +++ /dev/null @@ -1,16 +0,0 @@ - - - - SNX master - Created with Sketch. - - - - - - - - - - - \ No newline at end of file diff --git a/packages/token-metadata/src/images/talis.svg b/packages/token-metadata/src/images/talis.svg deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/token-metadata/src/images/tix.png b/packages/token-metadata/src/images/tix.png new file mode 100644 index 000000000..9f84fa400 Binary files /dev/null and b/packages/token-metadata/src/images/tix.png differ diff --git a/packages/token-metadata/src/images/truEVINDEX.png b/packages/token-metadata/src/images/truEVINDEX.png new file mode 100644 index 000000000..bc5ab080c Binary files /dev/null and b/packages/token-metadata/src/images/truEVINDEX.png differ diff --git a/packages/token-metadata/src/images/truEVINDEX.svg b/packages/token-metadata/src/images/truEVINDEX.svg deleted file mode 100644 index 67d83a6f6..000000000 --- a/packages/token-metadata/src/images/truEVINDEX.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/packages/token-metadata/src/images/truflation.png b/packages/token-metadata/src/images/truflation.png new file mode 100644 index 000000000..41a189177 Binary files /dev/null and b/packages/token-metadata/src/images/truflation.png differ diff --git a/packages/token-metadata/src/images/truflation.svg b/packages/token-metadata/src/images/truflation.svg deleted file mode 100644 index 308ef3d79..000000000 --- a/packages/token-metadata/src/images/truflation.svg +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/packages/token-metadata/src/images/uni.png b/packages/token-metadata/src/images/uni.png new file mode 100644 index 000000000..f03b76b02 Binary files /dev/null and b/packages/token-metadata/src/images/uni.png differ diff --git a/packages/token-metadata/src/images/uni.svg b/packages/token-metadata/src/images/uni.svg deleted file mode 100644 index 5f057ba00..000000000 --- a/packages/token-metadata/src/images/uni.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/packages/token-metadata/src/images/unknown.png b/packages/token-metadata/src/images/unknown.png new file mode 100644 index 000000000..7f18be176 Binary files /dev/null and b/packages/token-metadata/src/images/unknown.png differ diff --git a/packages/token-metadata/src/images/unknown.svg b/packages/token-metadata/src/images/unknown.svg deleted file mode 100644 index bf60cbff4..000000000 --- a/packages/token-metadata/src/images/unknown.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/packages/token-metadata/src/images/untracked.png b/packages/token-metadata/src/images/untracked.png new file mode 100644 index 000000000..7f18be176 Binary files /dev/null and b/packages/token-metadata/src/images/untracked.png differ diff --git a/packages/token-metadata/src/images/untracked.svg b/packages/token-metadata/src/images/untracked.svg deleted file mode 100644 index bf60cbff4..000000000 --- a/packages/token-metadata/src/images/untracked.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/packages/token-metadata/src/images/usdc-mpl.jpeg b/packages/token-metadata/src/images/usdc-mpl.jpeg new file mode 100644 index 000000000..c3ba5a5c8 Binary files /dev/null and b/packages/token-metadata/src/images/usdc-mpl.jpeg differ diff --git a/packages/token-metadata/src/images/usdc.png b/packages/token-metadata/src/images/usdc.png new file mode 100644 index 000000000..9af0ef9c0 Binary files /dev/null and b/packages/token-metadata/src/images/usdc.png differ diff --git a/packages/token-metadata/src/images/usdc.svg b/packages/token-metadata/src/images/usdc.svg deleted file mode 100644 index d21cde447..000000000 --- a/packages/token-metadata/src/images/usdc.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/packages/token-metadata/src/images/usdt.png b/packages/token-metadata/src/images/usdt.png new file mode 100644 index 000000000..09c1ed917 Binary files /dev/null and b/packages/token-metadata/src/images/usdt.png differ diff --git a/packages/token-metadata/src/images/usdt.svg b/packages/token-metadata/src/images/usdt.svg deleted file mode 100644 index 948711f73..000000000 --- a/packages/token-metadata/src/images/usdt.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/packages/token-metadata/src/images/vrd.png b/packages/token-metadata/src/images/vrd.png new file mode 100644 index 000000000..ba497d03a Binary files /dev/null and b/packages/token-metadata/src/images/vrd.png differ diff --git a/packages/token-metadata/src/images/wagmi.png b/packages/token-metadata/src/images/wagmi.png new file mode 100644 index 000000000..d792a2353 Binary files /dev/null and b/packages/token-metadata/src/images/wagmi.png differ diff --git a/packages/token-metadata/src/images/waifu-logo.png b/packages/token-metadata/src/images/waifu-logo.png new file mode 100644 index 000000000..aed6260d3 Binary files /dev/null and b/packages/token-metadata/src/images/waifu-logo.png differ diff --git a/packages/token-metadata/src/images/wbtc.png b/packages/token-metadata/src/images/wbtc.png new file mode 100644 index 000000000..4cdd6bde1 Binary files /dev/null and b/packages/token-metadata/src/images/wbtc.png differ diff --git a/packages/token-metadata/src/images/wbtc.svg b/packages/token-metadata/src/images/wbtc.svg deleted file mode 100644 index 12b8cb6df..000000000 --- a/packages/token-metadata/src/images/wbtc.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/packages/token-metadata/src/images/wgmi.png b/packages/token-metadata/src/images/wgmi.png new file mode 100644 index 000000000..12237663f Binary files /dev/null and b/packages/token-metadata/src/images/wgmi.png differ diff --git a/packages/token-metadata/src/images/whale.png b/packages/token-metadata/src/images/whale.png new file mode 100644 index 000000000..8118c694e Binary files /dev/null and b/packages/token-metadata/src/images/whale.png differ diff --git a/packages/token-metadata/src/images/whale.svg b/packages/token-metadata/src/images/whale.svg deleted file mode 100644 index 8d23f7a79..000000000 --- a/packages/token-metadata/src/images/whale.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/packages/token-metadata/src/images/wizz.jpeg b/packages/token-metadata/src/images/wizz.jpeg new file mode 100644 index 000000000..7ff131805 Binary files /dev/null and b/packages/token-metadata/src/images/wizz.jpeg differ diff --git a/packages/token-metadata/src/images/xpla.png b/packages/token-metadata/src/images/xpla.png new file mode 100644 index 000000000..d92a3c1da Binary files /dev/null and b/packages/token-metadata/src/images/xpla.png differ diff --git a/packages/token-metadata/src/images/xpla.svg b/packages/token-metadata/src/images/xpla.svg deleted file mode 100644 index e7c40461a..000000000 --- a/packages/token-metadata/src/images/xpla.svg +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - diff --git a/packages/token-metadata/src/images/xprt.png b/packages/token-metadata/src/images/xprt.png new file mode 100644 index 000000000..a6b1939bc Binary files /dev/null and b/packages/token-metadata/src/images/xprt.png differ diff --git a/packages/token-metadata/src/images/xprt.svg b/packages/token-metadata/src/images/xprt.svg deleted file mode 100644 index 232cdc7d8..000000000 --- a/packages/token-metadata/src/images/xprt.svg +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/packages/token-metadata/src/images/yfi.png b/packages/token-metadata/src/images/yfi.png new file mode 100644 index 000000000..9b8fd27cc Binary files /dev/null and b/packages/token-metadata/src/images/yfi.png differ diff --git a/packages/token-metadata/src/images/yfi.svg b/packages/token-metadata/src/images/yfi.svg deleted file mode 100644 index b6399e5bb..000000000 --- a/packages/token-metadata/src/images/yfi.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/packages/token-metadata/src/images/yuki.png b/packages/token-metadata/src/images/yuki.png new file mode 100644 index 000000000..3012f3ba4 Binary files /dev/null and b/packages/token-metadata/src/images/yuki.png differ diff --git a/packages/token-metadata/src/images/zen.svg b/packages/token-metadata/src/images/zen.svg new file mode 100644 index 000000000..97eff7c7e --- /dev/null +++ b/packages/token-metadata/src/images/zen.svg @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/token-metadata/src/images/zigg.jpeg b/packages/token-metadata/src/images/zigg.jpeg new file mode 100644 index 000000000..2cd8fc362 Binary files /dev/null and b/packages/token-metadata/src/images/zigg.jpeg differ diff --git a/packages/token-metadata/src/images/zrx.png b/packages/token-metadata/src/images/zrx.png new file mode 100644 index 000000000..d7942e96b Binary files /dev/null and b/packages/token-metadata/src/images/zrx.png differ diff --git a/packages/token-metadata/src/images/zrx.svg b/packages/token-metadata/src/images/zrx.svg deleted file mode 100644 index 16ba70ac5..000000000 --- a/packages/token-metadata/src/images/zrx.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/packages/token-metadata/src/index.ts b/packages/token-metadata/src/index.ts index 5b4c9da81..8bcf161d6 100644 --- a/packages/token-metadata/src/index.ts +++ b/packages/token-metadata/src/index.ts @@ -6,6 +6,7 @@ import { TokenInfo } from './TokenInfo' export * from './ibc' export * from './types' export * from './utils' +export * from './tokens/canonical' export const tokenMetaUtils = TokenMetaUtilsFactory.make() export const tokenFactory = TokenFactory.make() diff --git a/packages/token-metadata/src/tokens/canonical.ts b/packages/token-metadata/src/tokens/canonical.ts new file mode 100644 index 000000000..bd689eff0 --- /dev/null +++ b/packages/token-metadata/src/tokens/canonical.ts @@ -0,0 +1,33 @@ +import { Token, TokenType, TokenSource } from '../types' + +export const SYMBOLS_WITH_MULTIPLE_VARIATIONS = ['INJ', 'USDT', 'USDC'] + +export const checkAndGetCanonical = ( + token: Token, +): { tokenType: TokenType; source: TokenSource } | undefined => { + const symbol = token.symbol.toUpperCase() + + if (!SYMBOLS_WITH_MULTIPLE_VARIATIONS.some((s) => s.includes(symbol))) { + return + } + + if (symbol.includes('INJ') && token.tokenType !== TokenType.Native) { + return { tokenType: TokenType.Erc20, source: TokenSource.Ethereum } + } + + if ( + symbol.includes('USDT') && + ![TokenType.Erc20, TokenType.Ibc].includes(token.tokenType) + ) { + return { tokenType: TokenType.Erc20, source: TokenSource.Ethereum } + } + + if ( + symbol.includes('USDC') && + ![TokenType.Erc20, TokenType.Ibc].includes(token.tokenType) + ) { + return { tokenType: TokenType.Erc20, source: TokenSource.Ethereum } + } + + return +} diff --git a/packages/token-metadata/src/tokens/tokens/cw20-tokens.ts b/packages/token-metadata/src/tokens/tokens/cw20-tokens.ts index 7a13130b4..b78eadcd7 100644 --- a/packages/token-metadata/src/tokens/tokens/cw20-tokens.ts +++ b/packages/token-metadata/src/tokens/tokens/cw20-tokens.ts @@ -3,7 +3,7 @@ import { TokenMeta, TokenType } from '../../types' export default { 'INJ-MASTER': { name: 'INJ Master', - logo: 'mito-inj-master-lp.svg', + logo: 'mito-inj-master-lp.png', symbol: 'INJ-MASTER-LP', decimals: 18, coinGeckoId: '', @@ -16,7 +16,7 @@ export default { }, 'INJ-BOOST': { name: 'INJ Boost', - logo: 'mito-inj-boost-lp.svg', + logo: 'mito-inj-boost-lp.png', symbol: 'INJ-BOOST-LP', decimals: 18, coinGeckoId: '', @@ -29,7 +29,7 @@ export default { }, 'XAU-BOOST': { name: 'XAU Boost', - logo: 'mito-xau-boost-lp.svg', + logo: 'mito-xau-boost-lp.png', symbol: 'XAU-BOOST-LP', decimals: 18, coinGeckoId: '', @@ -42,7 +42,7 @@ export default { }, 'WETH-MASTER': { name: 'WETH Master', - logo: 'mito-weth-master-lp.svg', + logo: 'mito-weth-master-lp.png', symbol: 'WETH-MASTER-LP', decimals: 18, coinGeckoId: '', @@ -55,7 +55,7 @@ export default { }, 'ETH-BOOST': { name: 'ETH Boost', - logo: 'mito-eth-boost-lp.svg', + logo: 'mito-eth-boost-lp.png', symbol: 'ETH-boost-LP', decimals: 18, coinGeckoId: '', @@ -68,7 +68,7 @@ export default { }, 'ATOM-MASTER': { name: 'ATOM Master', - logo: 'mito-atom-master-lp.svg', + logo: 'mito-atom-master-lp.png', symbol: 'ATOM-MASTER-LP', decimals: 18, coinGeckoId: '', @@ -81,7 +81,7 @@ export default { }, 'ATOM-BOOST': { name: 'ATOM Boost', - logo: 'mito-atom-boost-lp.svg', + logo: 'mito-atom-boost-lp.png', symbol: 'ATOM-BOOST-LP', decimals: 18, coinGeckoId: '', @@ -94,7 +94,7 @@ export default { }, 'USDC-MASTER': { name: 'USDC Master', - logo: 'mito-usdc-master-lp.svg', + logo: 'mito-usdc-master-lp.png', symbol: 'USDC-MASTER-LP', decimals: 18, coinGeckoId: '', @@ -107,7 +107,7 @@ export default { }, 'PROJ-MASTER': { name: 'PROJ Master', - logo: 'mito-proj-master-lp.svg', + logo: 'mito-proj-master-lp.png', symbol: 'PROJ-MASTER-LP', decimals: 18, coinGeckoId: '', @@ -120,7 +120,7 @@ export default { }, 'GBP-MASTER': { name: 'GBP Master', - logo: 'mito-gbp-master-lp.svg', + logo: 'mito-gbp-master-lp.png', symbol: 'GBP-MASTER-LP', decimals: 18, coinGeckoId: '', @@ -133,7 +133,7 @@ export default { }, 'EUR-MASTER': { name: 'EUR Master', - logo: 'mito-eur-master-lp.svg', + logo: 'mito-eur-master-lp.png', symbol: 'EUR-MASTER-LP', decimals: 18, coinGeckoId: '', @@ -146,7 +146,7 @@ export default { }, 'STINJ-BOOST': { name: 'stINJ Boost', - logo: 'mito-stInj-boost-lp.svg', + logo: 'mito-stInj-boost-lp.png', symbol: 'stINJ-BOOST-LP', decimals: 18, coinGeckoId: '', diff --git a/packages/token-metadata/src/tokens/tokens/devnet-tokens.ts b/packages/token-metadata/src/tokens/tokens/devnet-tokens.ts index 176a2053c..f67f177f2 100644 --- a/packages/token-metadata/src/tokens/tokens/devnet-tokens.ts +++ b/packages/token-metadata/src/tokens/tokens/devnet-tokens.ts @@ -2,7 +2,7 @@ import tokens from './tokens' import { TokenMeta, TokenType, - Cw20TokenSource, + TokenSource, Cw20TokenMetaWithSource, } from '../../types' @@ -47,7 +47,7 @@ export const devnetTokens = () => { decimals: 6, symbol: 'USDCet', - source: Cw20TokenSource.EthereumWh, + source: TokenSource.EthereumWh, address: 'inj12sqy9uzzl3h3vqxam7sz9f0yvmhampcgesh3qw', tokenType: TokenType.Cw20, }, diff --git a/packages/token-metadata/src/tokens/tokens/testnet-tokens.ts b/packages/token-metadata/src/tokens/tokens/testnet-tokens.ts index c508d6f92..2cff00cfa 100644 --- a/packages/token-metadata/src/tokens/tokens/testnet-tokens.ts +++ b/packages/token-metadata/src/tokens/tokens/testnet-tokens.ts @@ -2,7 +2,7 @@ import tokens from './tokens' import { TokenMeta, TokenType, - Cw20TokenSource, + TokenSource, Cw20TokenMetaWithSource, } from '../../types' @@ -37,7 +37,7 @@ export const testnetTokens = () => { decimals: 8, symbol: 'wBTC', - source: Cw20TokenSource.Cosmos, + source: TokenSource.Cosmos, address: 'wbtc', tokenType: TokenType.Cw20, }, @@ -53,7 +53,7 @@ export const testnetTokens = () => { decimals: 8, symbol: 'ATOM', - source: Cw20TokenSource.Cosmos, + source: TokenSource.Cosmos, address: 'atom', tokenType: TokenType.Cw20, }, @@ -95,7 +95,7 @@ export const testnetTokens = () => { decimals: 8, symbol: 'wETH', - source: Cw20TokenSource.EthereumWh, + source: TokenSource.EthereumWh, address: 'weth', tokenType: TokenType.Cw20, }, @@ -132,7 +132,7 @@ export const testnetTokens = () => { decimals: 6, symbol: 'USDCet', - source: Cw20TokenSource.EthereumWh, + source: TokenSource.EthereumWh, address: 'inj12sqy9uzzl3h3vqxam7sz9f0yvmhampcgesh3qw', tokenType: TokenType.Cw20, }, @@ -141,7 +141,7 @@ export const testnetTokens = () => { decimals: 6, symbol: 'USDC', - source: Cw20TokenSource.Cosmos, + source: TokenSource.Cosmos, address: 'usdc', tokenType: TokenType.Cw20, }, @@ -162,7 +162,7 @@ export const testnetTokens = () => { decimals: 18, symbol: 'MT1', - source: Cw20TokenSource.EthereumWh, + source: TokenSource.EthereumWh, address: 'mitotest1', tokenType: TokenType.Cw20, }, diff --git a/packages/token-metadata/src/tokens/tokens/tokens.ts b/packages/token-metadata/src/tokens/tokens/tokens.ts index c82279b44..54b9690cc 100644 --- a/packages/token-metadata/src/tokens/tokens/tokens.ts +++ b/packages/token-metadata/src/tokens/tokens/tokens.ts @@ -1,12 +1,13 @@ -import { TokenMeta, Cw20TokenSource, TokenType } from '../../types' +import { TokenMeta, TokenSource, TokenType } from '../../types' export default { BTC: { name: 'Bitcoin', symbol: 'BTC', decimals: 8, - logo: 'bitcoin.svg', + logo: 'bitcoin.png', coinGeckoId: 'bitcoin', + tokenType: TokenType.Erc20, erc20: { decimals: 8, @@ -19,8 +20,9 @@ export default { name: 'Wrapped Bitcoin', symbol: 'wBTC', decimals: 8, - logo: 'wbtc.svg', + logo: 'wbtc.png', coinGeckoId: 'wrapped-bitcoin', + tokenType: TokenType.Erc20, erc20: { decimals: 8, @@ -32,7 +34,7 @@ export default { { decimals: 18, symbol: 'wBTC', - source: Cw20TokenSource.Cosmos, + source: TokenSource.Cosmos, address: 'inj14au322k9munkmx5wrchz9q30juf5wjgz2cfqku', tokenType: TokenType.Cw20, }, @@ -43,8 +45,9 @@ export default { name: 'Ethereum', symbol: 'ETH', decimals: 18, - logo: 'ethereum.svg', + logo: 'ethereum.png', coinGeckoId: 'ethereum', + tokenType: TokenType.Erc20, erc20: { decimals: 18, @@ -58,36 +61,73 @@ export default { name: 'Wrapped Ethereum', symbol: 'wETH', decimals: 18, - logo: 'ethereum.svg', + logo: 'ethereum.png', coinGeckoId: 'ethereum', + tokenType: TokenType.Erc20, erc20: { decimals: 18, address: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', tokenType: TokenType.Erc20, }, + + cw20s: [ + { + symbol: 'wETH', + decimals: 8, + address: 'inj1plsk58sxqjw9828aqzeskmc8xy9eu5kppw3jg4', + tokenType: TokenType.Cw20, + source: TokenSource.Arbitrum, + }, + { + symbol: 'wETH', + decimals: 8, + address: 'inj1k9r62py07wydch6sj5sfvun93e4qe0lg7jyatc', + tokenType: TokenType.Cw20, + source: TokenSource.EthereumWh, + }, + ], }, INJ: { name: 'Injective', symbol: 'INJ', decimals: 18, - logo: 'injective-v3.svg', + logo: 'injective-v3.png', coinGeckoId: 'injective-protocol', + tokenType: TokenType.Native, erc20: { decimals: 18, address: '0xe28b3B32B6c345A34Ff64674606124Dd5Aceca30', tokenType: TokenType.Erc20, }, + + cw20s: [ + { + decimals: 8, + symbol: 'INJbsc', + source: TokenSource.BinanceSmartChain, + address: 'inj1xcgprh58szttp0vqtztvcfy34tkpupr563ua40', + tokenType: TokenType.Cw20, + }, + { + decimals: 8, + symbol: 'INJet', + source: TokenSource.EthereumWh, + address: 'inj1v8gg4wzfauwf9l7895t0eyrrkwe65vh5n7dqmw', + tokenType: TokenType.Cw20, + }, + ], }, USDT: { name: 'Tether', symbol: 'USDT', decimals: 6, - logo: 'usdt.svg', + logo: 'usdt.png', coinGeckoId: 'tether', + tokenType: TokenType.Erc20, erc20: { decimals: 6, @@ -105,14 +145,53 @@ export default { hash: '4ABBEF4C8926DDDB320AE5188CFD63267ABBCEFC0583E4AE05D6E5AA2401DDAB', tokenType: TokenType.Ibc, }, + + cw20s: [ + { + decimals: 6, + symbol: 'USDTbsc', + source: TokenSource.BinanceSmartChain, + address: 'inj1l9eyrnv3ret8da3qh8j5aytp6q4f73crd505lj', + tokenType: TokenType.Cw20, + }, + { + decimals: 6, + symbol: 'USDTso', + source: TokenSource.Solana, + address: 'inj18zykysxw9pcvtyr9ylhe0p5s7yzf6pzdagune8', + tokenType: TokenType.Cw20, + }, + { + decimals: 6, + symbol: 'USDTso', + source: TokenSource.Solana, + address: 'inj12pwnhtv7yat2s30xuf4gdk9qm85v4j3e60dgvu', + tokenType: TokenType.Cw20, + }, + { + decimals: 6, + symbol: 'USDTap', + source: TokenSource.Aptos, + address: 'inj13yrhllhe40sd3nj0lde9azlwfkyrf2t9r78dx5', + tokenType: TokenType.Cw20, + }, + { + decimals: 6, + symbol: 'USDTso', + source: TokenSource.Solana, + address: 'inj1qjn06jt7zjhdqxgud07nylkpgnaurq6xc5c4fd', + tokenType: TokenType.Cw20, + }, + ], }, USDC: { symbol: 'USDC', name: 'USD Coin', decimals: 6, - logo: 'usdc.svg', + logo: 'usdc.png', coinGeckoId: 'usd-coin', + tokenType: TokenType.Erc20, erc20: { decimals: 6, @@ -125,18 +204,38 @@ export default { { decimals: 6, symbol: 'USDCet', - source: Cw20TokenSource.EthereumWh, + source: TokenSource.EthereumWh, address: 'inj1q6zlut7gtkzknkk773jecujwsdkgq882akqksk', tokenType: TokenType.Cw20, }, - { decimals: 6, symbol: 'USDCso', - source: Cw20TokenSource.Solana, + source: TokenSource.Solana, address: 'inj12pwnhtv7yat2s30xuf4gdk9qm85v4j3e60dgvu', tokenType: TokenType.Cw20, }, + { + decimals: 6, + symbol: 'USDCarb', + source: TokenSource.Arbitrum, + address: 'inj1lmcfftadjkt4gt3lcvmz6qn4dhx59dv2m7yv8r', + tokenType: TokenType.Cw20, + }, + { + decimals: 6, + symbol: 'USDCbsc', + source: TokenSource.BinanceSmartChain, + address: 'inj1dngqzz6wphf07fkdam7dn55t8t3r6qenewy9zu', + tokenType: TokenType.Cw20, + }, + { + decimals: 6, + symbol: 'USDCpoly', + source: TokenSource.Polygon, + address: 'inj19s2r64ghfqq3py7f5dr0ynk8yj0nmngca3yvy3', + tokenType: TokenType.Cw20, + }, ], ibc: { @@ -149,14 +248,23 @@ export default { hash: '2CBC2EA121AE42563B08028466F37B600F2D7D4282342DE938283CC3FB2BC00E', tokenType: TokenType.Ibc, }, + + spl: { + decimals: 6, + symbol: 'USDCso', + isNative: false, + address: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v', + tokenType: TokenType.Spl, + }, }, GRT: { name: 'Graph Token', symbol: 'GRT', decimals: 18, - logo: 'graphToken.svg', + logo: 'graphToken.png', coinGeckoId: 'the-graph', + tokenType: TokenType.Erc20, erc20: { decimals: 18, @@ -169,8 +277,9 @@ export default { name: 'Synthetix Network Token', symbol: 'SNX', decimals: 18, - logo: 'synthetix.svg', + logo: 'synthetix.png', coinGeckoId: 'havven', + tokenType: TokenType.Erc20, erc20: { decimals: 18, @@ -183,8 +292,9 @@ export default { name: 'Binance Coin', symbol: 'BNB', decimals: 18, - logo: 'bnb.svg', + logo: 'bnb.png', coinGeckoId: 'binancecoin', + tokenType: TokenType.Erc20, erc20: { decimals: 18, @@ -197,8 +307,9 @@ export default { name: 'Aave', symbol: 'AAVE', decimals: 18, - logo: 'AAVE.svg', + logo: 'AAVE.png', coinGeckoId: 'aave', + tokenType: TokenType.Erc20, erc20: { decimals: 18, @@ -210,9 +321,10 @@ export default { YFI: { name: 'yearn.finance', symbol: 'YFI', - logo: 'yfi.svg', + logo: 'yfi.png', decimals: 18, coinGeckoId: 'yearn-finance', + tokenType: TokenType.Erc20, erc20: { decimals: 18, @@ -225,8 +337,9 @@ export default { name: 'Compound', symbol: 'COMP', decimals: 18, - logo: 'comp.svg', + logo: 'comp.png', coinGeckoId: 'compound-coin', + tokenType: TokenType.Erc20, erc20: { decimals: 18, @@ -239,8 +352,9 @@ export default { name: '0x', symbol: 'ZRX', decimals: 18, - logo: 'zrx.svg', + logo: 'zrx.png', coinGeckoId: '0x', + tokenType: TokenType.Erc20, erc20: { decimals: 18, @@ -255,6 +369,7 @@ export default { symbol: 'MATIC', decimals: 18, coinGeckoId: 'matic-network', + tokenType: TokenType.Erc20, erc20: { decimals: 18, @@ -266,9 +381,10 @@ export default { UNI: { name: 'Uniswap', symbol: 'UNI', - logo: 'uni.svg', + logo: 'uni.png', decimals: 18, coinGeckoId: 'uniswap', + tokenType: TokenType.Erc20, erc20: { decimals: 18, @@ -281,8 +397,9 @@ export default { name: 'Dai', symbol: 'DAI', decimals: 18, - logo: 'dai.svg', + logo: 'dai.png', coinGeckoId: 'dai', + tokenType: TokenType.Erc20, erc20: { decimals: 18, @@ -295,8 +412,9 @@ export default { name: 'Chainlink', symbol: 'LINK', decimals: 18, - logo: 'chainlink.svg', + logo: 'chainlink.png', coinGeckoId: 'chainlink', + tokenType: TokenType.Erc20, erc20: { decimals: 18, @@ -309,8 +427,9 @@ export default { name: 'SushiSwap', symbol: 'SUSHI', decimals: 18, - logo: 'sushi.svg', + logo: 'sushi.png', coinGeckoId: 'sushi', + tokenType: TokenType.Erc20, erc20: { decimals: 18, @@ -325,6 +444,7 @@ export default { decimals: 18, logo: 'axs.png', coinGeckoId: 'axie-infinity', + tokenType: TokenType.Erc20, erc20: { decimals: 18, @@ -339,6 +459,7 @@ export default { decimals: 18, logo: '1inch.png', coinGeckoId: '1inch', + tokenType: TokenType.Erc20, erc20: { decimals: 18, @@ -353,6 +474,7 @@ export default { decimals: 18, logo: 'bat.png', coinGeckoId: 'basic-attention-token', + tokenType: TokenType.Erc20, erc20: { decimals: 18, @@ -367,6 +489,7 @@ export default { decimals: 18, logo: 'busd.png', coinGeckoId: 'binance-usd', + tokenType: TokenType.Erc20, erc20: { decimals: 18, @@ -381,6 +504,7 @@ export default { decimals: 4, logo: 'cel.png', coinGeckoId: 'celsius-degree-token', + tokenType: TokenType.Erc20, erc20: { decimals: 4, @@ -395,6 +519,7 @@ export default { decimals: 18, logo: 'cell.png', coinGeckoId: 'cellframe', + tokenType: TokenType.Erc20, erc20: { decimals: 18, @@ -409,6 +534,7 @@ export default { decimals: 18, logo: 'defi5.png', coinGeckoId: 'defi-top-5-tokens-index', + tokenType: TokenType.Erc20, erc20: { decimals: 18, @@ -423,6 +549,7 @@ export default { decimals: 18, logo: 'enj.png', coinGeckoId: 'enjincoin', + tokenType: TokenType.Erc20, erc20: { decimals: 18, @@ -437,6 +564,7 @@ export default { decimals: 8, logo: 'evai.png', coinGeckoId: 'evai', + tokenType: TokenType.Erc20, erc20: { decimals: 8, @@ -451,6 +579,7 @@ export default { decimals: 18, logo: 'ftm.png', coinGeckoId: 'fantom', + tokenType: TokenType.Erc20, erc20: { decimals: 18, @@ -465,6 +594,7 @@ export default { decimals: 18, logo: 'ht.png', coinGeckoId: 'huobi-token', + tokenType: TokenType.Erc20, erc20: { decimals: 18, @@ -479,6 +609,7 @@ export default { decimals: 18, logo: 'nexo.png', coinGeckoId: 'nexo', + tokenType: TokenType.Erc20, erc20: { decimals: 18, @@ -493,6 +624,7 @@ export default { decimals: 18, logo: 'noia.png', coinGeckoId: 'noia-network', + tokenType: TokenType.Erc20, erc20: { decimals: 18, @@ -507,6 +639,7 @@ export default { decimals: 18, logo: 'ocean.png', coinGeckoId: 'ocean-protocol', + tokenType: TokenType.Erc20, erc20: { decimals: 18, @@ -521,6 +654,7 @@ export default { decimals: 18, logo: 'paxg.png', coinGeckoId: 'pax-gold', + tokenType: TokenType.Erc20, erc20: { decimals: 18, @@ -535,6 +669,7 @@ export default { decimals: 18, logo: 'pool.png', coinGeckoId: 'pooltogether', + tokenType: TokenType.Erc20, erc20: { decimals: 18, @@ -549,6 +684,7 @@ export default { decimals: 18, logo: 'rune.png', coinGeckoId: 'thorchain-erc20', + tokenType: TokenType.Erc20, erc20: { decimals: 18, @@ -563,6 +699,7 @@ export default { decimals: 18, logo: 'shib.png', coinGeckoId: 'shiba-inu', + tokenType: TokenType.Erc20, erc20: { decimals: 18, @@ -577,6 +714,7 @@ export default { decimals: 18, logo: 'stars.png', coinGeckoId: 'mogul-productions', + tokenType: TokenType.Erc20, erc20: { decimals: 18, @@ -591,6 +729,7 @@ export default { decimals: 18, logo: 'scatter.webp', coinGeckoId: 'scatter-cx', + tokenType: TokenType.Erc20, erc20: { decimals: 18, @@ -605,6 +744,7 @@ export default { decimals: 18, logo: 'trustswap.png', coinGeckoId: 'trustswap', + tokenType: TokenType.Erc20, erc20: { decimals: 18, @@ -619,6 +759,7 @@ export default { decimals: 18, coinGeckoId: 'uma', logo: 'uma.png', + tokenType: TokenType.Erc20, erc20: { decimals: 18, @@ -633,6 +774,7 @@ export default { decimals: 18, logo: 'utk.png', coinGeckoId: 'utrust', + tokenType: TokenType.Erc20, erc20: { decimals: 18, @@ -645,8 +787,9 @@ export default { name: 'Cosmos', symbol: 'ATOM', decimals: 6, - logo: 'atom.svg', + logo: 'atom.png', coinGeckoId: 'cosmos', + tokenType: TokenType.Ibc, erc20: { decimals: 6, @@ -669,8 +812,9 @@ export default { name: 'Cosmos Testnet', symbol: 'UPHOTON', decimals: 6, - logo: 'atom.svg', + logo: 'atom.png', coinGeckoId: 'cosmos', + tokenType: TokenType.Ibc, erc20: { decimals: 6, @@ -695,6 +839,7 @@ export default { decimals: 6, logo: 'luna.png', coinGeckoId: 'terra-luna', + tokenType: TokenType.Ibc, erc20: { decimals: 6, @@ -720,6 +865,7 @@ export default { logo: 'ust.png', decimals: 18, coinGeckoId: 'terrausd', + tokenType: TokenType.Ibc, erc20: { decimals: 18, @@ -744,6 +890,7 @@ export default { decimals: 18, logo: 'gf.png', coinGeckoId: 'guildfi', + tokenType: TokenType.Erc20, erc20: { decimals: 18, @@ -758,6 +905,7 @@ export default { decimals: 18, logo: 'xbx.png', coinGeckoId: '', + tokenType: TokenType.Erc20, erc20: { decimals: 18, @@ -772,6 +920,7 @@ export default { decimals: 6, coinGeckoId: 'osmosis', logo: 'osmo.png', + tokenType: TokenType.Ibc, ibc: { decimals: 6, @@ -786,10 +935,11 @@ export default { TAB: { name: 'Injective', - logo: 'injective-v3.svg', + logo: 'injective-v3.png', symbol: 'TAB', decimals: 18, coinGeckoId: 'injective-protocol', + tokenType: TokenType.Erc20, erc20: { decimals: 18, @@ -804,6 +954,7 @@ export default { decimals: 6, logo: 'chihuahua.jpeg', coinGeckoId: 'chihuahua-token', + tokenType: TokenType.Ibc, ibc: { decimals: 6, @@ -822,6 +973,7 @@ export default { decimals: 6, logo: 'juno.jpeg', coinGeckoId: 'juno-network', + tokenType: TokenType.Ibc, ibc: { decimals: 6, @@ -838,8 +990,9 @@ export default { name: 'White Whale', symbol: 'WHALE', decimals: 6, - logo: 'whale.svg', + logo: 'whale.png', coinGeckoId: 'white-whale', + tokenType: TokenType.Ibc, ibc: { decimals: 6, @@ -852,12 +1005,31 @@ export default { }, }, + NOIS: { + name: 'Nois', + symbol: 'NOIS', + decimals: 6, + coinGeckoId: 'nois', + logo: 'nois.png', + + ibc: { + decimals: 6, + isNative: true, + baseDenom: 'unois', + path: 'transfer/channel-138', + channelId: 'channel-138', + hash: 'DD9182E8E2B13C89D6B4707C7B43E8DB6193F9FF486AFA0E6CF86B427B0D231A', + tokenType: TokenType.Ibc, + }, + }, + AXL: { name: 'Axelar', - logo: 'axelar.svg', + logo: 'axelar.png', symbol: 'AXL', decimals: 6, coinGeckoId: 'axelar', + tokenType: TokenType.Ibc, erc20: { decimals: 6, @@ -879,9 +1051,10 @@ export default { BAYC: { name: 'Bored Ape Yacht Club', symbol: 'BAYC', - logo: 'bayc.svg', + logo: 'bayc.png', decimals: 18, coinGeckoId: '', + tokenType: TokenType.Unknown, }, APE: { @@ -890,6 +1063,7 @@ export default { decimals: 18, logo: 'ape.png', coinGeckoId: 'apecoin', + tokenType: TokenType.Erc20, erc20: { decimals: 18, @@ -904,6 +1078,7 @@ export default { decimals: 6, logo: 'scrt.png', coinGeckoId: 'secret', + tokenType: TokenType.Ibc, ibc: { decimals: 6, @@ -920,8 +1095,9 @@ export default { name: 'Persistence', symbol: 'XPRT', decimals: 6, - logo: 'xprt.svg', + logo: 'xprt.png', coinGeckoId: 'persistence', + tokenType: TokenType.Ibc, ibc: { decimals: 6, @@ -938,8 +1114,9 @@ export default { name: 'Evmos', symbol: 'EVMOS', decimals: 18, - logo: 'evmos.svg', + logo: 'evmos.png', coinGeckoId: 'evmos', + tokenType: TokenType.Ibc, ibc: { decimals: 18, @@ -958,6 +1135,7 @@ export default { decimals: 6, logo: 'stacks.png', coinGeckoId: 'blockstack', + tokenType: TokenType.Unknown, }, DOT: { @@ -966,6 +1144,7 @@ export default { decimals: 10, logo: 'dot.jpeg', coinGeckoId: 'polkadot', + tokenType: TokenType.Ibc, erc20: { decimals: 10, @@ -996,6 +1175,7 @@ export default { decimals: 10, logo: 'dot.jpeg', coinGeckoId: 'polkadot', + tokenType: TokenType.Erc20, erc20: { decimals: 10, @@ -1010,6 +1190,7 @@ export default { decimals: 6, logo: 'stride.png', coinGeckoId: 'stride', + tokenType: TokenType.Ibc, ibc: { decimals: 6, @@ -1021,12 +1202,14 @@ export default { tokenType: TokenType.Ibc, }, }, + CRE: { name: 'Crescent', symbol: 'CRE', decimals: 6, logo: 'crescent.jpeg', coinGeckoId: 'crescent-network', + tokenType: TokenType.Ibc, ibc: { decimals: 6, @@ -1039,20 +1222,58 @@ export default { }, }, + ZEN: { + name: 'ZEN', + logo: 'zen.svg', + symbol: 'ZEN', + decimals: 18, + coinGeckoId: '', + tokenType: TokenType.TokenFactory, + + cw20: { + decimals: 18, + address: 'uzen', + tokenType: TokenType.Cw20, + }, + }, + PROJ: { name: 'PROJ', - logo: 'projx.png', + logo: 'proj.png', symbol: 'PROJ', decimals: 18, coinGeckoId: '', + tokenType: TokenType.TokenFactory, + + cw20: { + decimals: 18, + address: 'proj', + tokenType: TokenType.Cw20, + }, + }, + + PUNK: { + name: 'Punk DAO Token', + logo: 'PUNK.png', + symbol: 'PUNK', + decimals: 6, + coinGeckoId: '', + tokenType: TokenType.TokenFactory, }, - MITOTEST1: { - name: 'MT1', - symbol: 'MT1', - decimals: 18, + PROJX: { + name: 'PROJX', logo: 'projx.png', + symbol: 'PROJX', + decimals: 18, coinGeckoId: '', + tokenType: TokenType.TokenFactory, + + cw20: { + decimals: 18, + address: 'projx', + tokenType: TokenType.Cw20, + }, }, ASTRO: { @@ -1061,6 +1282,7 @@ export default { decimals: 6, logo: 'astroport.png', coinGeckoId: 'astroport-fi', + tokenType: TokenType.Ibc, ibc: { decimals: 6, @@ -1078,8 +1300,9 @@ export default { name: 'Solana', symbol: 'SOL', decimals: 8, - logo: 'solana.svg', + logo: 'solana.png', coinGeckoId: 'solana', + tokenType: TokenType.Cw20, spl: { decimals: 9, @@ -1101,6 +1324,7 @@ export default { decimals: 6, logo: 'sommelier.png', coinGeckoId: 'sommelier', + tokenType: TokenType.Ibc, erc20: { decimals: 6, @@ -1123,8 +1347,9 @@ export default { name: 'ETHBTC Trend', symbol: 'ETHBTCTrend', decimals: 18, - logo: 'ethbtctrend.svg', + logo: 'ethbtctrend.png', coinGeckoId: '', + tokenType: TokenType.Erc20, erc20: { decimals: 18, @@ -1137,8 +1362,9 @@ export default { name: 'SteadyETH', symbol: 'SteadyETH', decimals: 18, - logo: 'steadyeth.svg', + logo: 'steadyeth.png', coinGeckoId: '', + tokenType: TokenType.Erc20, erc20: { decimals: 18, @@ -1151,8 +1377,9 @@ export default { name: 'SteadyBTC', symbol: 'SteadyBTC', decimals: 18, - logo: 'steadybtc.svg', + logo: 'steadybtc.png', coinGeckoId: '', + tokenType: TokenType.Erc20, erc20: { decimals: 18, @@ -1165,8 +1392,9 @@ export default { name: 'XPLA', symbol: 'XPLA', decimals: 8, - logo: 'xpla.svg', + logo: 'xpla.png', coinGeckoId: 'xpla', + tokenType: TokenType.Cw20, cw20: { decimals: 8, @@ -1181,6 +1409,7 @@ export default { decimals: 8, logo: 'avax.webp', coinGeckoId: 'avalanche-2', + tokenType: TokenType.Cw20, cw20: { decimals: 8, @@ -1195,6 +1424,7 @@ export default { decimals: 5, logo: 'bonk.jpeg', coinGeckoId: 'bonk', + type: TokenType.TokenFactory, }, CHZ: { @@ -1203,6 +1433,7 @@ export default { decimals: 18, logo: 'chz.png', coinGeckoId: 'chiliz', + tokenType: TokenType.Cw20, erc20: { decimals: 18, @@ -1223,6 +1454,7 @@ export default { decimals: 18, logo: 'canto.webp', coinGeckoId: 'canto', + tokenType: TokenType.Ibc, ibc: { decimals: 18, @@ -1239,8 +1471,9 @@ export default { name: 'Test QAT', symbol: 'QAT', decimals: 18, - logo: 'injective-v3.svg', + logo: 'injective-v3.png', coinGeckoId: 'injective-protocol', + tokenType: TokenType.Erc20, erc20: { decimals: 18, @@ -1261,6 +1494,7 @@ export default { decimals: 18, logo: 'puggo.jpg', coinGeckoId: '', + tokenType: TokenType.Erc20, erc20: { decimals: 18, @@ -1275,6 +1509,7 @@ export default { decimals: 18, logo: 'lido-dao.webp', coinGeckoId: 'lido-dao', + tokenType: TokenType.Cw20, erc20: { decimals: 18, @@ -1289,26 +1524,13 @@ export default { }, }, - USDCfr: { - name: 'USDC Frontrunner', - symbol: 'USDCfr', - decimals: 6, - logo: 'usdc.svg', - coinGeckoId: 'usd-coin', - - erc20: { - decimals: 6, - address: '0xf9152067989BDc8783fF586624124C05A529A5D1', - tokenType: TokenType.Erc20, - }, - }, - ARB: { name: 'Arbitrum', symbol: 'ARB', decimals: 18, - logo: 'arb.png', + logo: 'arb-circle.png', coinGeckoId: 'arbitrum', + tokenType: TokenType.Cw20, evm: { decimals: 18, @@ -1325,7 +1547,7 @@ export default { cw20: { decimals: 8, address: 'inj1d5vz0uzwlpfvgwrwulxg6syy82axa58y4fuszd', - source: Cw20TokenSource.Arbitrum, + source: TokenSource.Arbitrum, tokenType: TokenType.Cw20, }, }, @@ -1334,24 +1556,27 @@ export default { name: 'Euro', symbol: 'EUR', decimals: 6, - logo: 'eur.svg', + logo: 'eur.png', coinGeckoId: '', + tokenType: TokenType.Unknown, }, GBP: { name: 'British Pound', symbol: 'GBP', decimals: 6, - logo: 'gpb.svg', + logo: 'gpb.png', coinGeckoId: '', + tokenType: TokenType.Unknown, }, JPY: { name: 'Japanese Yen', symbol: 'JPY', decimals: 6, - logo: 'jpy.svg', + logo: 'jpy.png', coinGeckoId: '', + tokenType: TokenType.Unknown, }, BRZ: { @@ -1360,6 +1585,7 @@ export default { decimals: 4, logo: 'brz.png', coinGeckoId: 'brz', + tokenType: TokenType.Cw20, erc20: { decimals: 4, @@ -1378,8 +1604,9 @@ export default { name: 'Astar', symbol: 'ASTR', decimals: 18, - logo: 'astar.svg', + logo: 'astar.png', coinGeckoId: 'astar', + tokenType: TokenType.Cw20, cw20: { decimals: 18, @@ -1392,8 +1619,9 @@ export default { name: 'Gold', symbol: 'XAU', decimals: 6, - logo: 'gold.svg', + logo: 'gold.png', coinGeckoId: '', + tokenType: TokenType.Unknown, }, ALPHA: { @@ -1402,6 +1630,7 @@ export default { decimals: 18, logo: 'alpha.png', coinGeckoId: 'alphacoin', + tokenType: TokenType.Cw20, erc20: { decimals: 18, @@ -1422,6 +1651,7 @@ export default { decimals: 18, logo: 'polygon.png', coinGeckoId: 'wmatic', + tokenType: TokenType.Cw20, evm: { decimals: 18, @@ -1433,7 +1663,7 @@ export default { cw20: { decimals: 8, address: 'inj1dxv423h8ygzgxmxnvrf33ws3k94aedfdevxd8h', - source: Cw20TokenSource.Polygon, + source: TokenSource.Polygon, tokenType: TokenType.Cw20, }, }, @@ -1444,6 +1674,7 @@ export default { decimals: 18, logo: 'pepe.jpeg', coinGeckoId: 'pepe', + tokenType: TokenType.Erc20, erc20: { decimals: 18, @@ -1458,6 +1689,7 @@ export default { decimals: 18, logo: 'pepe.jpeg', coinGeckoId: 'pepe', + tokenType: TokenType.Erc20, erc20: { decimals: 18, @@ -1472,6 +1704,7 @@ export default { decimals: 18, logo: 'pepe.jpeg', coinGeckoId: 'pepe', + tokenType: TokenType.Erc20, erc20: { decimals: 18, @@ -1486,6 +1719,7 @@ export default { decimals: 18, logo: 'wassie.jpeg', coinGeckoId: 'wassie', + tokenType: TokenType.Erc20, erc20: { decimals: 18, @@ -1500,6 +1734,7 @@ export default { decimals: 18, logo: 'ribbit.jpeg', coinGeckoId: 'ribbit-meme', + tokenType: TokenType.Erc20, erc20: { decimals: 18, @@ -1514,6 +1749,7 @@ export default { decimals: 18, logo: 'lambo.jpeg', coinGeckoId: 'lambo-0fcbf0f7-1a8f-470d-ba09-797d5e95d836', + tokenType: TokenType.Erc20, erc20: { decimals: 18, @@ -1528,6 +1764,7 @@ export default { decimals: 18, logo: 'stinj.png', coinGeckoId: 'stride-staked-injective', + tokenType: TokenType.Ibc, ibc: { decimals: 18, @@ -1544,25 +1781,22 @@ export default { name: 'Ripple', symbol: 'XRP', decimals: 18, - address: '0x1d2f0da169ceb9fc7b3144628db156f3f6c60dbe', logo: 'xrp.png', coinGeckoId: 'ripple', - }, + tokenType: TokenType.Erc20, - FRCOIN: { - name: 'Frontrunner Coin', - symbol: 'FRCoin', - decimals: 6, - logo: 'frcoin.png', - coinGeckoId: '', - tokenType: TokenType.TokenFactory, + erc20: { + decimals: 18, + address: '0x1d2f0da169ceb9fc7b3144628db156f3f6c60dbe', + tokenType: TokenType.Erc20, + }, }, DEMO: { name: 'Demo Coin', symbol: 'DEMO', decimals: 6, - logo: 'injective-v3.svg', + logo: 'injective-v3.png', coinGeckoId: '', tokenType: TokenType.TokenFactory, }, @@ -1573,6 +1807,7 @@ export default { decimals: 18, logo: 'rai.png', coinGeckoId: 'rai', + tokenType: TokenType.Erc20, erc20: { decimals: 18, @@ -1587,6 +1822,7 @@ export default { decimals: 18, logo: 'btsg.png', coinGeckoId: 'bitsong', + tokenType: TokenType.Erc20, erc20: { decimals: 18, @@ -1601,6 +1837,7 @@ export default { decimals: 18, logo: 'cvr.png', coinGeckoId: 'covercompared', + tokenType: TokenType.Erc20, erc20: { decimals: 18, @@ -1615,6 +1852,7 @@ export default { decimals: 18, logo: 'qnt.png', coinGeckoId: 'quant-network', + tokenType: TokenType.Erc20, erc20: { decimals: 18, @@ -1629,6 +1867,7 @@ export default { decimals: 18, logo: 'wsteth.png', coinGeckoId: 'wrapped-steth', + tokenType: TokenType.Erc20, erc20: { decimals: 18, @@ -1643,6 +1882,7 @@ export default { decimals: 18, logo: 'dydx.png', coinGeckoId: 'dydx', + tokenType: TokenType.Erc20, erc20: { decimals: 18, @@ -1657,6 +1897,7 @@ export default { decimals: 8, logo: 'xac.png', coinGeckoId: '', + tokenType: TokenType.Erc20, erc20: { decimals: 8, @@ -1671,6 +1912,7 @@ export default { decimals: 18, logo: 'steth.png', coinGeckoId: 'staked-ether', + tokenType: TokenType.Erc20, erc20: { decimals: 18, @@ -1685,6 +1927,7 @@ export default { decimals: 18, logo: 'lympo.png', coinGeckoId: 'lympo', + tokenType: TokenType.Erc20, erc20: { decimals: 18, @@ -1697,8 +1940,9 @@ export default { name: 'ECOMI', symbol: 'OMI', decimals: 18, - logo: 'ecomi.png', + logo: 'omi.png', coinGeckoId: 'ecomi', + tokenType: TokenType.Erc20, erc20: { decimals: 18, @@ -1711,7 +1955,7 @@ export default { name: 'Reward Point Token', symbol: 'POINT', decimals: 0, - logo: 'point.svg', + logo: 'point.png', coinGeckoId: '', tokenType: TokenType.TokenFactory, }, @@ -1722,6 +1966,7 @@ export default { decimals: 6, logo: 'kava.webp', coinGeckoId: 'kava', + tokenType: TokenType.Ibc, ibc: { decimals: 6, @@ -1740,6 +1985,7 @@ export default { decimals: 6, logo: 'sei.webp', coinGeckoId: 'sei-network', + tokenType: TokenType.Unknown, }, VATRENI: { @@ -1748,6 +1994,7 @@ export default { decimals: 18, logo: 'vatreni.jpeg', coinGeckoId: 'croatian-ff-fan-token', + tokenType: TokenType.Cw20, evm: { decimals: 18, @@ -1759,7 +2006,7 @@ export default { cw20: { decimals: 8, address: 'inj1tn457ed2gg5vj2cur5khjjw63w73y3xhyhtaay', - source: Cw20TokenSource.Polygon, + source: TokenSource.Polygon, tokenType: TokenType.Cw20, }, }, @@ -1770,6 +2017,7 @@ export default { decimals: 6, logo: 'nebula.png', coinGeckoId: '', + tokenType: TokenType.TokenFactory, }, WKLAY: { @@ -1778,6 +2026,7 @@ export default { decimals: 8, logo: 'klaytn.webp', coinGeckoId: 'klay-token', + tokenType: TokenType.Cw20, cw20: { decimals: 8, @@ -1790,8 +2039,9 @@ export default { name: 'NEOKingdom DAO', symbol: 'NEOK', decimals: 18, - logo: 'neok.svg', + logo: 'neok.png', coinGeckoId: '', + tokenType: TokenType.Ibc, ibc: { decimals: 18, @@ -1808,8 +2058,9 @@ export default { name: 'Oraichain', symbol: 'ORAI', decimals: 6, - logo: 'orai.svg', + logo: 'orai.png', coinGeckoId: 'oraichain-token', + tokenType: TokenType.Ibc, ibc: { decimals: 6, @@ -1826,24 +2077,27 @@ export default { name: 'GOLD', symbol: 'GOLD', decimals: 18, - logo: 'gold.svg', + logo: 'gold.png', coinGeckoId: '', + tokenType: TokenType.Unknown, }, EVINDEX: { name: 'EVIINDEX', symbol: 'EVIINDEX', decimals: 18, - logo: 'truEVINDEX.svg', + logo: 'truEVINDEX.png', coinGeckoId: '', + tokenType: TokenType.Unknown, }, TRUCPI: { name: 'TRUCPI', symbol: 'TRUCPI', decimals: 18, - logo: 'truflation.svg', + logo: 'truflation.png', coinGeckoId: '', + tokenType: TokenType.Unknown, }, TIA: { @@ -1852,6 +2106,7 @@ export default { decimals: 6, logo: 'tia.webp', coinGeckoId: 'celestia', + tokenType: TokenType.Ibc, ibc: { decimals: 6, @@ -1869,6 +2124,15 @@ export default { symbol: 'TALIS', decimals: 6, logo: 'talis.webp', + coinGeckoId: 'talis-protocol', + tokenType: TokenType.TokenFactory, + }, + + KIRA: { + name: 'KIRA', + symbol: 'KIRA', + decimals: 6, + logo: 'kira.jpeg', coinGeckoId: '', tokenType: TokenType.TokenFactory, }, @@ -1878,7 +2142,8 @@ export default { symbol: 'USDY', decimals: 18, logo: 'usdy.webp', - coinGeckoId: '', + coinGeckoId: 'ondo-us-dollar-yield', + tokenType: TokenType.Erc20, erc20: { decimals: 18, @@ -1886,4 +2151,700 @@ export default { tokenType: TokenType.Erc20, }, }, + + KUJI: { + name: 'Kujira', + symbol: 'KUJI', + decimals: 6, + logo: 'kuji.webp', + coinGeckoId: 'kujira', + tokenType: TokenType.Ibc, + + ibc: { + decimals: 6, + isNative: true, + baseDenom: 'ukuji', + path: 'transfer/channel-98', + channelId: 'channel-98', + hash: '9A115B56E769B92621FFF90567E2D60EFD146E86E867491DB69EEDA9ADC36204', + tokenType: TokenType.Ibc, + }, + }, + + 'USDC-MPL': { + name: 'USDC Maple', + symbol: 'USDC-MPL', + decimals: 6, + logo: 'usdc-mpl.jpeg', + coinGeckoId: '', + tokenType: TokenType.Erc20, + + erc20: { + decimals: 6, + address: '0xf875aef00C4E21E9Ab4A335eB36A1175Ab00424A', + tokenType: TokenType.Erc20, + }, + }, + + PYTH: { + name: 'Pyth Network', + symbol: 'PYTH', + decimals: 6, + logo: 'pyth.png', + coinGeckoId: 'pyth-network', + tokenType: TokenType.Cw20, + + spl: { + decimals: 6, + symbol: 'PYTH', + isNative: false, + address: 'HZ1JovNiVvGrGNiiYvEozEVgZ58xaU3RKwX8eACQBCt3', + tokenType: TokenType.Spl, + }, + + cw20: { + decimals: 6, + symbol: 'PYTH', + source: TokenSource.Solana, + address: 'inj1tjcf9497fwmrnk22jfu5hsdq82qshga54ajvzy', + tokenType: TokenType.Cw20, + }, + }, + + TIX: { + name: 'Timeworx.io', + symbol: 'TIX', + decimals: 6, + logo: 'tix.png', + coinGeckoId: '', + tokenType: TokenType.TokenFactory, + }, + + NINJ: { + name: 'Gryphon Staked Injective', + symbol: 'nINJ', + decimals: 18, + logo: 'ninj.png', + coinGeckoId: '', + tokenType: TokenType.Cw20, + + cw20: { + decimals: 18, + symbol: 'nINJ', + address: 'inj13xlpypcwl5fuc84uhqzzqumnrcfpptyl6w3vrf', + tokenType: TokenType.Cw20, + }, + }, + + BINJ: { + name: 'Bird INJ', + symbol: 'BINJ', + decimals: 6, + logo: 'bird.png', + coinGeckoId: '', + tokenType: TokenType.TokenFactory, + }, + + NINJA: { + name: 'Dog Wif Nunchucks', + symbol: 'NINJA', + decimals: 6, + logo: 'ninja.png', + coinGeckoId: '', + tokenType: TokenType.TokenFactory, + }, + + KATANA: { + name: 'Dog Wif Katana', + symbol: 'KATANA', + decimals: 6, + logo: 'katana.webp', + coinGeckoId: '', + tokenType: TokenType.TokenFactory, + }, + + GALAXY: { + name: 'GALAXY', + symbol: 'GALAXY', + decimals: 6, + logo: 'galaxy.webp', + coinGeckoId: '', + tokenType: TokenType.TokenFactory, + }, + + AOI: { + name: 'Alien Token', + symbol: '$AOI', + decimals: 6, + logo: 'aoi.webp', + coinGeckoId: '', + tokenType: TokenType.TokenFactory, + }, + + NOBI: { + name: 'Shinobi', + symbol: 'NOBI', + decimals: 6, + logo: 'nobi.webp', + coinGeckoId: '', + tokenType: TokenType.TokenFactory, + }, + + YUKI: { + name: 'Yuki Dog', + symbol: 'YUKI', + decimals: 6, + logo: 'yuki.png', + coinGeckoId: '', + tokenType: TokenType.TokenFactory, + }, + + WAGMI: { + name: 'Wagmi Coin', + symbol: 'WAGMI', + decimals: 9, + logo: 'wagmi.png', + coinGeckoId: '', + tokenType: TokenType.TokenFactory, + }, + + BAMBOO: { + name: 'Injective Panda', + symbol: 'BAMBOO', + decimals: 6, + logo: 'panda.png', + coinGeckoId: '', + tokenType: TokenType.TokenFactory, + }, + + SHURIKEN: { + name: 'Shuriken Token', + symbol: 'SHURIKEN', + decimals: 6, + logo: 'shuriken.jpeg', + coinGeckoId: '', + tokenType: TokenType.TokenFactory, + }, + + BRETT: { + name: 'BluePepe', + symbol: 'BRETT', + decimals: 6, + logo: 'brett.jpeg', + coinGeckoId: '', + tokenType: TokenType.TokenFactory, + }, + + ZIG: { + name: 'ZigCoin', + symbol: 'ZIG', + decimals: 18, + logo: 'zigg.jpeg', + coinGeckoId: 'zignaly', + tokenType: TokenType.Erc20, + + erc20: { + decimals: 18, + address: '0xb2617246d0c6c0087f18703d576831899ca94f01', + tokenType: TokenType.Erc20, + }, + }, + + DOJ: { + name: 'DOJcoin', + symbol: 'DOJ', + decimals: 6, + logo: 'doj.png', + coinGeckoId: '', + tokenType: TokenType.TokenFactory, + }, + + SKIPBIDIDOBDOBDOBYESYESYESYES: { + name: 'SKIPBIDIDOBDOBDOBYESYESYESYES', + symbol: 'SKIPBIDIDOBDOBDOBYESYESYESYES', + decimals: 9, + logo: 'skibidi.jpeg', + coinGeckoId: '', + + erc20: { + decimals: 9, + address: '0x5085202d0A4D8E4724Aa98C42856441c3b97Bc6d', + tokenType: TokenType.Erc20, + }, + }, + + GINGER: { + name: 'GINGER', + symbol: 'GINGER', + decimals: 6, + logo: 'ginger.png', + coinGeckoId: '', + tokenType: TokenType.TokenFactory, + }, + + ERIC: { + name: 'TheJanitor', + symbol: 'ERIC', + decimals: 6, + logo: 'eric.png', + coinGeckoId: '', + tokenType: TokenType.TokenFactory, + }, + + INJINU: { + name: 'INJINU', + symbol: 'INJINU', + decimals: 6, + logo: 'injinu.png', + coinGeckoId: '', + tokenType: TokenType.TokenFactory, + }, + + Babykira: { + name: 'Babykira', + symbol: '$Babykira', + decimals: 6, + logo: 'babykira.png', + coinGeckoId: '', + tokenType: TokenType.TokenFactory, + }, + + LIOR: { + name: 'LIOR', + symbol: 'LIOR', + decimals: 6, + logo: 'lior.png', + coinGeckoId: '', + tokenType: TokenType.TokenFactory, + }, + + INJINEER: { + name: 'INJINEER', + symbol: 'INJER', + decimals: 6, + logo: 'INJINEER.png', + coinGeckoId: '', + tokenType: TokenType.TokenFactory, + }, + + SHIBA: { + name: 'Shiba', + symbol: 'shibainj', + decimals: 6, + logo: 'shiba.webp', + coinGeckoId: '', + tokenType: TokenType.TokenFactory, + }, + + GROK: { + name: 'GROK', + symbol: 'GROK', + decimals: 6, + logo: 'grok.png', + coinGeckoId: '', + tokenType: TokenType.TokenFactory, + }, + + SNOWY: { + name: 'Injective Snowy', + symbol: 'SNOWY', + decimals: 6, + logo: 'snowy.png', + coinGeckoId: '', + tokenType: TokenType.TokenFactory, + }, + + BULLS: { + name: 'BULLS', + symbol: 'BULLS', + decimals: 6, + logo: 'bulls.png', + coinGeckoId: '', + tokenType: TokenType.TokenFactory, + }, + + LVN: { + name: 'Levana', + symbol: 'LVN', + decimals: 6, + coinGeckoId: 'levana-protocol', + logo: 'lvn.png', + tokenType: TokenType.Ibc, + + ibc: { + decimals: 6, + isNative: true, + baseDenom: 'ulvn', + path: 'transfer/channel-8', + channelId: 'channel-8', + hash: '4971C5E4786D5995EC7EF894FCFA9CF2E127E95D5D53A982F6A062F3F410EDB8', + tokenType: TokenType.Ibc, + }, + }, + + KINJA: { + name: 'Kinja', + symbol: 'KINJA', + decimals: 6, + logo: 'kinja.png', + coinGeckoId: '', + tokenType: TokenType.TokenFactory, + }, + + LAMA: { + name: 'LAMA', + symbol: 'LAMA', + decimals: 6, + logo: 'lama.webp', + coinGeckoId: '', + tokenType: TokenType.TokenFactory, + }, + + INJEX: { + name: 'Internet Explorer', + symbol: 'INJEX', + decimals: 6, + logo: 'injex.png', + coinGeckoId: '', + tokenType: TokenType.TokenFactory, + }, + + NINJB: { + name: 'NINJB', + symbol: 'NINJB', + decimals: 6, + logo: 'ninjb.png', + coinGeckoId: '', + tokenType: TokenType.TokenFactory, + }, + + KARATE: { + name: 'Doge Wif Karate', + symbol: 'KARATE', + decimals: 6, + logo: 'karate.jpg', + coinGeckoId: '', + tokenType: TokenType.TokenFactory, + }, + + NPEPE: { + name: 'NinjaPepe', + symbol: 'NPEPE', + decimals: 6, + logo: 'NPEPE.png', + coinGeckoId: '', + tokenType: TokenType.TokenFactory, + }, + + MILK: { + name: 'MILK', + symbol: 'MILK', + decimals: 6, + logo: 'milk.png', + coinGeckoId: '', + tokenType: TokenType.TokenFactory, + }, + + INCEL: { + name: 'InjectiveCelestiaNoFapLadyBoy420Inu', + symbol: 'INCEL', + decimals: 6, + logo: 'incel.png', + coinGeckoId: '', + tokenType: TokenType.TokenFactory, + }, + + PIKACHU: { + name: 'Pikachu', + symbol: 'PIKA', + decimals: 6, + logo: 'pikachu.png', + coinGeckoId: '', + tokenType: TokenType.TokenFactory, + }, + + WGMI: { + name: 'WGMI', + symbol: 'WGMI', + decimals: 6, + logo: 'wgmi.png', + coinGeckoId: '', + tokenType: TokenType.TokenFactory, + }, + + WIZZ: { + name: 'WIZZ', + symbol: 'WIZZ', + decimals: 6, + logo: 'wizz.jpeg', + coinGeckoId: '', + tokenType: TokenType.TokenFactory, + }, + + MEMEME: { + name: 'Mememe', + symbol: 'MEMEME', + decimals: 18, + logo: 'meme.png', + coinGeckoId: 'mememe', + tokenType: TokenType.Erc20, + + erc20: { + decimals: 18, + address: '0x1A963Df363D01EEBB2816b366d61C917F20e1EbE', + tokenType: TokenType.Erc20, + }, + }, + + MAGA: { + name: 'Trump', + symbol: 'MAGA', + decimals: 9, + logo: 'maga.png', + coinGeckoId: 'maga', + tokenType: TokenType.Erc20, + + erc20: { + decimals: 9, + address: '0x576e2BeD8F7b46D34016198911Cdf9886f78bea7', + tokenType: TokenType.Erc20, + }, + }, + + SDEX: { + name: 'SmarDex', + symbol: 'SDEX', + decimals: 18, + logo: 'maga.png', + coinGeckoId: 'smardex', + tokenType: TokenType.Erc20, + + erc20: { + decimals: 18, + address: '0x5DE8ab7E27f6E7A1fFf3E5B337584Aa43961BEeF', + tokenType: TokenType.Erc20, + }, + }, + + OX: { + name: 'Open Exchange Token', + symbol: 'OX', + decimals: 18, + logo: 'ox.png', + coinGeckoId: 'open-exchange-token', + tokenType: TokenType.Erc20, + + erc20: { + decimals: 18, + address: '0x78a0A62Fba6Fb21A83FE8a3433d44C73a4017A6f', + tokenType: TokenType.Erc20, + }, + }, + + FUSDT: { + name: 'Flux USDT', + symbol: 'fUSDT', + decimals: 8, + logo: 'flux.png', + coinGeckoId: 'flux-usdt', + tokenType: TokenType.Erc20, + + erc20: { + decimals: 8, + address: '0x81994b9607e06ab3d5cF3AffF9a67374f05F27d7', + tokenType: TokenType.Erc20, + }, + }, + + PVP: { + name: 'PVP', + symbol: 'PVP', + decimals: 8, + logo: 'unknown.png', + coinGeckoId: '', + tokenType: TokenType.Erc20, + + erc20: { + decimals: 8, + address: '0x9B44793a0177C84DD01AD81137db696531902871', + tokenType: TokenType.Erc20, + }, + }, + + POOR: { + name: 'Proof Of Officially Rugged', + symbol: 'POOR', + decimals: 8, + logo: 'unknown.png', + coinGeckoId: '', + tokenType: TokenType.Erc20, + + erc20: { + decimals: 8, + address: '0x9D433Fa992C5933D6843f8669019Da6D512fd5e9', + tokenType: TokenType.Erc20, + }, + }, + + VRD: { + name: 'Viridis Network', + symbol: 'VRD', + decimals: 18, + logo: 'vrd.png', + coinGeckoId: 'viridis-network', + tokenType: TokenType.Erc20, + + erc20: { + decimals: 18, + address: '0xf25304e75026E6a35FEDcA3B0889aE5c4D3C55D8', + tokenType: TokenType.Erc20, + }, + }, + + NONE: { + name: 'None Trading', + symbol: 'NONE', + decimals: 18, + logo: 'none.webp', + coinGeckoId: 'none-trading', + tokenType: TokenType.Erc20, + + erc20: { + decimals: 18, + address: '0x903ff0ba636E32De1767A4B5eEb55c155763D8B7', + tokenType: TokenType.Erc20, + }, + }, + + DUDE: { + name: 'DUDE', + symbol: 'DUDE', + decimals: 6, + logo: 'dude.png', + coinGeckoId: '', + tokenType: TokenType.TokenFactory, + }, + + AUTISM: { + name: 'AUTISM', + symbol: 'AUTISM', + decimals: 6, + logo: 'autism.png', + coinGeckoId: 'autism', + tokenType: TokenType.TokenFactory, + }, + + NOBITCHES: { + name: 'Extra Virgin Olive Inu', + symbol: 'NOBITCHES', + decimals: 6, + logo: 'extravirginoliveinu.png', + coinGeckoId: '', + tokenType: TokenType.TokenFactory, + }, + + MILA: { + name: 'MILA', + symbol: 'MILA', + decimals: 6, + logo: 'mila.png', + coinGeckoId: '', + tokenType: TokenType.TokenFactory, + }, + + DOJO: { + name: 'Dojo Bot', + symbol: 'DOJO', + decimals: 6, + logo: 'dojo.png', + coinGeckoId: '', + tokenType: TokenType.TokenFactory, + }, + + IPANDAAI: { + name: 'Injective Panda AI', + symbol: 'IPandaAI', + decimals: 6, + logo: 'ipdai.png', + coinGeckoId: '', + tokenType: TokenType.TokenFactory, + }, + + COCK: { + name: 'ROOSTER NINJA', + symbol: 'COCK', + decimals: 6, + logo: 'cock.png', + coinGeckoId: '', + tokenType: TokenType.TokenFactory, + }, + + MOONIFY: { + name: 'Moonify', + symbol: 'MOONIFY', + decimals: 6, + logo: 'moonify.png', + coinGeckoId: '', + tokenType: TokenType.TokenFactory, + }, + + KARMA: { + name: 'Karma', + symbol: 'KARMA', + decimals: 6, + logo: 'karma.png', + coinGeckoId: '', + tokenType: TokenType.TokenFactory, + }, + + DREAM: { + name: 'DREAM', + symbol: 'DREAM', + decimals: 6, + logo: 'DREAM.png', + coinGeckoId: '', + tokenType: TokenType.TokenFactory, + }, + + DGNZ: { + name: 'Injective Degens', + symbol: 'DGNZ', + decimals: 6, + logo: 'DGNZ.png', + coinGeckoId: '', + tokenType: TokenType.TokenFactory, + }, + + INJECT: { + name: 'Injectools', + symbol: 'INJECT', + decimals: 6, + logo: 'INJECT.png', + coinGeckoId: '', + tokenType: TokenType.TokenFactory, + }, + + WAIFU: { + name: 'Waifu', + symbol: 'WAIFU', + decimals: 6, + logo: 'waifu-logo.png', + coinGeckoId: '', + tokenType: TokenType.TokenFactory, + }, + + APP: { + name: 'Moon App', + symbol: 'APP', + decimals: 18, + logo: 'app.jpeg', + coinGeckoId: '', + tokenType: TokenType.Erc20, + + erc20: { + decimals: 18, + address: '0xC5d27F27F08D1FD1E3EbBAa50b3442e6c0D50439', + tokenType: TokenType.Erc20, + }, + }, } as Record diff --git a/packages/token-metadata/src/types.ts b/packages/token-metadata/src/types.ts index edf277fb2..119892441 100644 --- a/packages/token-metadata/src/types.ts +++ b/packages/token-metadata/src/types.ts @@ -17,7 +17,8 @@ export enum TokenVerification { Unverified = 'unverified' /** unverified on any source */, } -export enum Cw20TokenSource { +export enum TokenSource { + Aptos = 'aptos', Solana = 'solana', Cosmos = 'cosmos', Ethereum = 'ethereum', @@ -26,6 +27,8 @@ export enum Cw20TokenSource { Klaytn = 'klaytn', Arbitrum = 'arbitrum', Sui = 'sui', + Ibc = 'ibc', + BinanceSmartChain = 'binance-smart-chain', } export interface IbcTokenMeta { @@ -67,7 +70,7 @@ export interface Cw20TokenMeta { export interface Cw20TokenMetaWithSource extends Cw20TokenMeta { symbol: string - source: Cw20TokenSource + source: TokenSource } export interface TokenMeta { diff --git a/packages/token-metadata/src/utils.ts b/packages/token-metadata/src/utils.ts index 47869110b..8af135f81 100644 --- a/packages/token-metadata/src/utils.ts +++ b/packages/token-metadata/src/utils.ts @@ -3,15 +3,20 @@ import { Token, TokenMeta, TokenType, + TokenSource, IbcTokenMeta, Cw20TokenMeta, Cw20TokenSingle, - Cw20TokenSource, TokenVerification, Cw20TokenMetaWithSource, } from './types' import { ibcBaseDenoms } from './tokens/tokens' import { getChannelIdFromPath } from './ibc' +import { + Network, + getCw20AdapterContractForNetwork, +} from '@injectivelabs/networks' +import { TokenMetaUtilsFactory } from './TokenMetaUtilsFactory' const getCw20Meta = ( token: Token, @@ -152,7 +157,7 @@ export const getTokenAddress = (token: Token) => { */ export const getCw20TokenSingle = ( token: Token | TokenMeta, - source?: Cw20TokenSource, + source?: TokenSource, ): Cw20TokenSingle | undefined => { const { cw20, cw20s } = token const denom = (token as Token).denom || '' @@ -171,12 +176,8 @@ export const getCw20TokenSingle = ( } if (cw20s) { - if (denom) { - const [cw20Address] = denom.startsWith('inj') - ? [denom] - : denom.split('/').reverse() - - const cw20 = cw20s.find((cw20) => cw20.address === cw20Address) + if (source) { + const cw20 = cw20s.find((cw20) => cw20.source === source) return cw20 ? { @@ -189,8 +190,12 @@ export const getCw20TokenSingle = ( : undefined } - if (source) { - const cw20 = cw20s.find((cw20) => cw20.source === source) + if (denom) { + const [cw20Address] = denom.startsWith('inj') + ? [denom] + : denom.split('/').reverse() + + const cw20 = cw20s.find((cw20) => cw20.address === cw20Address) return cw20 ? { @@ -269,7 +274,7 @@ export const getUnknownToken = (denom: string): Token => { name: denom, symbol: denom, decimals: 18, - logo: 'untracked.svg', + logo: 'unknown.png', coinGeckoId: '', tokenType: TokenType.Unknown, tokenVerification: TokenVerification.Unverified, @@ -280,9 +285,9 @@ export const getUnknownTokenWithSymbol = (denom: string): Token => { return { denom, name: denom, - symbol: 'UNTRACKED', + symbol: 'UNKNOWN', decimals: 0, - logo: 'untracked.svg', + logo: 'unknown.png', coinGeckoId: '', tokenType: TokenType.Unknown, tokenVerification: TokenVerification.Unverified, @@ -291,3 +296,92 @@ export const getUnknownTokenWithSymbol = (denom: string): Token => { export const isCw20ContractAddress = (address: string) => address.length === 42 && address.startsWith('inj') + +/** + * Token factory denoms created by the adapter contract + */ +export const getTokenFactoryDenomByAdapter = ( + cw20address: string, + network: Network = Network.Mainnet, +) => { + return `factory/${getCw20AdapterContractForNetwork(network)}/${cw20address}` +} + +export const getPeggyDenomFromSymbolOrName = ( + symbolOrName: string, + network: Network = Network.Mainnet, +) => { + const tokenMetaUtils = TokenMetaUtilsFactory.make(network) + const metaFromSymbol = tokenMetaUtils.getMetaBySymbol(symbolOrName) + const metaFromName = tokenMetaUtils.getMetaByName(symbolOrName) + + if (!metaFromSymbol && !metaFromName) { + return + } + + if (!metaFromSymbol?.erc20 && !metaFromName?.erc20) { + return + } + + return `peggy${(metaFromSymbol || metaFromName)?.erc20?.address}` +} + +export const getIbcDenomFromSymbolOrName = ( + symbolOrName: string, + network: Network = Network.Mainnet, +) => { + const tokenMetaUtils = TokenMetaUtilsFactory.make(network) + const metaFromName = tokenMetaUtils.getMetaBySymbol(symbolOrName) + const metaFromSymbol = tokenMetaUtils.getMetaByName(symbolOrName) + + if (!metaFromSymbol && !metaFromName) { + return + } + + if (!metaFromSymbol?.ibc && !metaFromName?.ibc) { + return + } + + return `ibc/${(metaFromSymbol || metaFromName)?.ibc?.hash}` +} + +export const getCw20FromSymbolOrName = ( + symbolOrName: string, + network: Network = Network.Mainnet, + source?: TokenSource, +) => { + const tokenMetaUtils = TokenMetaUtilsFactory.make(network) + const metaFromName = tokenMetaUtils.getMetaBySymbol(symbolOrName) + const metaFromSymbol = tokenMetaUtils.getMetaByName(symbolOrName) + + if (!metaFromSymbol && !metaFromName) { + return + } + + if ( + !metaFromSymbol?.cw20 && + !metaFromName?.cw20 && + !metaFromSymbol?.cw20s && + !metaFromName?.cw20s + ) { + return + } + + const meta = (metaFromName || metaFromSymbol)! + + if (meta.cw20) { + return getTokenFactoryDenomByAdapter(meta.cw20.address, network) + } + + if (source) { + const cw20 = meta?.cw20s?.find((cw20) => cw20.source === source) + + return cw20 + ? getTokenFactoryDenomByAdapter(cw20.address, network) + : undefined + } + + const [cw20] = meta.cw20s || [] + + return getTokenFactoryDenomByAdapter(cw20.address, network) +} diff --git a/packages/token-metadata/test/unit/cw20.spec.ts b/packages/token-metadata/test/unit/cw20.spec.ts index 043406b40..5f53a3b00 100644 --- a/packages/token-metadata/test/unit/cw20.spec.ts +++ b/packages/token-metadata/test/unit/cw20.spec.ts @@ -39,6 +39,36 @@ describe('TokenMetadata', () => { }) }) + describe('SOL Token', () => { + test('fetches undefined for fake factory denom', () => { + const tokenMeta = tokenFactory.toToken('factory/inj1/sol') + + expect(tokenMeta).toBe(undefined) + }) + + test('fetches token meta for symbol', () => { + const tokenMeta = tokenFactory.toToken('SOL') + + expect(tokenMeta).toBeDefined() + }) + + test('fetches token meta for factory denom with cw20 address', () => { + const tokenMeta = tokenFactory.toToken( + 'factory/inj1/inj1sthrn5ep8ls5vzz8f9gp89khhmedahhdkqa8z3', + ) + + expect(tokenMeta).toBeDefined() + }) + + test('fetches token meta for cw20 address', () => { + const tokenMeta = tokenFactory.toToken( + 'inj1sthrn5ep8ls5vzz8f9gp89khhmedahhdkqa8z3', + ) + + expect(tokenMeta).toBeDefined() + }) + }) + describe('USDC token', () => { const USDCetFactoryDenom = 'factory/inj14ejqjyq8um4p3xfqj74yld5waqljf88f9eneuk/inj1q6zlut7gtkzknkk773jecujwsdkgq882akqksk' diff --git a/packages/token-metadata/test/unit/images.spec.ts b/packages/token-metadata/test/unit/images.spec.ts new file mode 100644 index 000000000..011fb4004 --- /dev/null +++ b/packages/token-metadata/test/unit/images.spec.ts @@ -0,0 +1,23 @@ +import tokensBySymbol from '../../src/tokens/tokens' +import fs from 'fs' +import path from 'path' + +describe('TokenMetadataImages', () => { + for (const symbol in tokensBySymbol) { + const tokenMetadata = tokensBySymbol[symbol] + + if (!tokenMetadata.logo) { + return + } + + test(`logo exists for ${symbol}`, () => { + const logoPath = path.resolve( + './packages/token-metadata/src/images', + tokenMetadata.logo, + ) + + expect(tokenMetadata.logo).toBeDefined() + expect(fs.existsSync(logoPath)).toEqual(true) + }) + } +}) diff --git a/packages/token-utils/CHANGELOG.md b/packages/token-utils/CHANGELOG.md index 120cf5517..caa8a2f9b 100644 --- a/packages/token-utils/CHANGELOG.md +++ b/packages/token-utils/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.5](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/token-utils@1.14.5-beta.6...@injectivelabs/token-utils@1.14.5) (2024-01-11) + +**Note:** Version bump only for package @injectivelabs/token-utils + + + + + +## [1.14.4](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/token-utils@1.14.4-beta.0...@injectivelabs/token-utils@1.14.4) (2023-11-20) + +**Note:** Version bump only for package @injectivelabs/token-utils + + + + + +## [1.14.3](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/token-utils@1.14.3-beta.4...@injectivelabs/token-utils@1.14.3) (2023-11-17) + +**Note:** Version bump only for package @injectivelabs/token-utils + + + + + +## [1.14.2](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/token-utils@1.14.2-beta.1...@injectivelabs/token-utils@1.14.2) (2023-11-07) + +**Note:** Version bump only for package @injectivelabs/token-utils + + + + + ## [1.14.1](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/token-utils@1.14.1-beta.7...@injectivelabs/token-utils@1.14.1) (2023-10-27) **Note:** Version bump only for package @injectivelabs/token-utils diff --git a/packages/token-utils/package.json b/packages/token-utils/package.json index 0d77f75c1..2d20d3ee5 100644 --- a/packages/token-utils/package.json +++ b/packages/token-utils/package.json @@ -1,6 +1,6 @@ { "name": "@injectivelabs/token-utils", - "version": "1.14.2-beta.2", + "version": "1.14.5", "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.14.2-beta.2", - "@injectivelabs/utils": "^1.14.2-beta.2", + "@injectivelabs/exceptions": "^1.14.5", + "@injectivelabs/utils": "^1.14.5", "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 933acd703..d072d9355 100644 --- a/packages/ts-types/CHANGELOG.md +++ b/packages/ts-types/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.5](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/ts-types@1.14.5-beta.0...@injectivelabs/ts-types@1.14.5) (2024-01-11) + +**Note:** Version bump only for package @injectivelabs/ts-types + + + + + +## [1.14.4](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/ts-types@1.14.4-beta.0...@injectivelabs/ts-types@1.14.4) (2023-11-20) + +**Note:** Version bump only for package @injectivelabs/ts-types + + + + + +## [1.14.3](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/ts-types@1.14.3-beta.3...@injectivelabs/ts-types@1.14.3) (2023-11-17) + +**Note:** Version bump only for package @injectivelabs/ts-types + + + + + +## [1.14.2](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/ts-types@1.14.2-beta.0...@injectivelabs/ts-types@1.14.2) (2023-11-07) + +**Note:** Version bump only for package @injectivelabs/ts-types + + + + + ## [1.14.1](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/ts-types@1.14.1-beta.7...@injectivelabs/ts-types@1.14.1) (2023-10-27) **Note:** Version bump only for package @injectivelabs/ts-types diff --git a/packages/ts-types/package.json b/packages/ts-types/package.json index 8987094f0..a4b5712e9 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.14.2-beta.0", + "version": "1.14.5", "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 4d2d1245e..20d9873dd 100644 --- a/packages/ts-types/src/cosmos.ts +++ b/packages/ts-types/src/cosmos.ts @@ -23,11 +23,13 @@ export enum CosmosChainId { Oraichain = 'Oraichain', Noble = 'noble-1', Celestia = 'celestia', + Migaloo = 'migaloo-1', + Kujira = 'kaiyo-1', } export enum TestnetCosmosChainId { Injective = 'injective-888', - Cosmoshub = 'cosmoshub-testnet', + Cosmoshub = 'theta-testnet-001', } export enum DevnetCosmosChainId { diff --git a/packages/ts-types/src/enums.ts b/packages/ts-types/src/enums.ts index e7a4bc341..b6104cb72 100644 --- a/packages/ts-types/src/enums.ts +++ b/packages/ts-types/src/enums.ts @@ -32,6 +32,7 @@ export enum MsgType { MsgDelegate = 'cosmos.staking.v1beta1.MsgDelegate', MsgEditValidator = 'cosmos.staking.v1beta1.MsgEditValidator', MsgUndelegate = 'cosmos.staking.v1beta1.MsgUndelegate', + MsgCancelUnbondingDelegation = 'cosmos.staking.v1beta1.MsgCancelUnbondingDelegation', MsgExecuteContract = 'cosmwasm.wasm.v1.MsgExecuteContract', MsgInstantiateContract = 'cosmwasm.wasm.v1.MsgInstantiateContract', MsgInstantiateContract2 = 'cosmwasm.wasm.v1.MsgInstantiateContract2', diff --git a/packages/utils/CHANGELOG.md b/packages/utils/CHANGELOG.md index 1e4012481..5acec933b 100644 --- a/packages/utils/CHANGELOG.md +++ b/packages/utils/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.5](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/utils@1.14.5-beta.6...@injectivelabs/utils@1.14.5) (2024-01-11) + +**Note:** Version bump only for package @injectivelabs/utils + + + + + +## [1.14.4](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/utils@1.14.4-beta.0...@injectivelabs/utils@1.14.4) (2023-11-20) + +**Note:** Version bump only for package @injectivelabs/utils + + + + + +## [1.14.3](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/utils@1.14.3-beta.4...@injectivelabs/utils@1.14.3) (2023-11-17) + +**Note:** Version bump only for package @injectivelabs/utils + + + + + +## [1.14.2](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/utils@1.14.2-beta.1...@injectivelabs/utils@1.14.2) (2023-11-07) + +**Note:** Version bump only for package @injectivelabs/utils + + + + + ## [1.14.1](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/utils@1.14.1-beta.6...@injectivelabs/utils@1.14.1) (2023-10-27) **Note:** Version bump only for package @injectivelabs/utils diff --git a/packages/utils/package.json b/packages/utils/package.json index e81caa542..0f62628ec 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.14.2-beta.2", + "version": "1.14.5", "sideEffects": false, "author": { "name": "Bojan Angjelkoski", @@ -31,8 +31,8 @@ "start": "node dist/index.js" }, "dependencies": { - "@injectivelabs/exceptions": "^1.14.2-beta.2", - "@injectivelabs/ts-types": "^1.14.2-beta.0", + "@injectivelabs/exceptions": "^1.14.5", + "@injectivelabs/ts-types": "^1.14.5", "axios": "^0.21.1", "bignumber.js": "^9.0.1", "http-status-codes": "^2.2.0", diff --git a/packages/utils/src/constants.ts b/packages/utils/src/constants.ts index d8c273a35..407a96e7b 100644 --- a/packages/utils/src/constants.ts +++ b/packages/utils/src/constants.ts @@ -8,11 +8,11 @@ export const INJECTIVE_DENOM = 'inj' export const DEFAULT_FEE_DENOM = 'inj' export const DEFAULT_GAS_LIMIT = 400000 export const DEFAULT_IBC_GAS_LIMIT = 300000 -export const DEFAULT_GAS_PRICE = 500000000 +export const DEFAULT_GAS_PRICE = 160000000 export const DEFAULT_EXCHANGE_LIMIT = 200000 export const DEFAULT_BRIDGE_FEE_DENOM = 'inj' -export const DEFAULT_BRIDGE_FEE_PRICE = '500000000' +export const DEFAULT_BRIDGE_FEE_PRICE = '160000000' export const DEFAULT_BRIDGE_FEE_AMOUNT = '200000000000000' export const DEFAULT_BLOCK_TIMEOUT_HEIGHT = 90 diff --git a/packages/wallet-ts/CHANGELOG.md b/packages/wallet-ts/CHANGELOG.md index 90dc5e6a2..acea590bb 100644 --- a/packages/wallet-ts/CHANGELOG.md +++ b/packages/wallet-ts/CHANGELOG.md @@ -3,6 +3,41 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.14.5](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/wallet-ts@1.14.5-beta.73...@injectivelabs/wallet-ts@1.14.5) (2024-01-11) + +**Note:** Version bump only for package @injectivelabs/wallet-ts + + + + + +## [1.14.4](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/wallet-ts@1.14.4-beta.3...@injectivelabs/wallet-ts@1.14.4) (2023-11-20) + +**Note:** Version bump only for package @injectivelabs/wallet-ts + + + + + +## [1.14.3](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/wallet-ts@1.14.3-beta.27...@injectivelabs/wallet-ts@1.14.3) (2023-11-17) + +**Note:** Version bump only for package @injectivelabs/wallet-ts + + + + + +## [1.14.2](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/wallet-ts@1.14.2-beta.15...@injectivelabs/wallet-ts@1.14.2) (2023-11-07) + + +### Reverts + +* faulty version ([6e25b3f](https://github.com/InjectiveLabs/injective-ts/commit/6e25b3f156d964666db8bc7885df653166aac523)) + + + + + ## [1.14.1](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/wallet-ts@1.14.1-beta.25...@injectivelabs/wallet-ts@1.14.1) (2023-10-27) **Note:** Version bump only for package @injectivelabs/wallet-ts diff --git a/packages/wallet-ts/README.md b/packages/wallet-ts/README.md index 7a977285b..02c1a6960 100644 --- a/packages/wallet-ts/README.md +++ b/packages/wallet-ts/README.md @@ -18,7 +18,7 @@ yarn add @injectivelabs/wallet-ts ## 📖 Documentation -Read more and find example usages on our [WalletStrategy Wiki](https://github.com/InjectiveLabs/injective-ts/wiki/01WalletStrategy) +Read more and find example usages on our [WalletStrategy Docs](https://docs.ts.injective.network/wallet/wallet-wallet-strategy) --- @@ -50,7 +50,6 @@ Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/ -

 

Powering the future of decentralized finance. diff --git a/packages/wallet-ts/package.json b/packages/wallet-ts/package.json index 51b5c32d0..dcd43fd00 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.14.2-beta.16", + "version": "1.14.5", "sideEffects": false, "author": { "name": "Bojan Angjelkoski", @@ -32,18 +32,19 @@ }, "dependencies": { "@cosmjs/launchpad": "0.27.1", - "@cosmjs/proto-signing": "0.30.1", - "@cosmjs/stargate": "^0.30.1", + "@cosmjs/proto-signing": "0.31.3", + "@cosmjs/stargate": "^0.31.3", "@cosmostation/extension-client": "^0.1.15", "@ethereumjs/common": "^3.1.1", "@ethereumjs/tx": "^4.1.1", - "@injectivelabs/exceptions": "^1.14.2-beta.2", - "@injectivelabs/networks": "^1.14.2-beta.3", - "@injectivelabs/sdk-ts": "^1.14.2-beta.14", - "@injectivelabs/ts-types": "^1.14.2-beta.0", - "@injectivelabs/utils": "^1.14.2-beta.2", + "@injectivelabs/exceptions": "^1.14.5", + "@injectivelabs/networks": "^1.14.5", + "@injectivelabs/sdk-ts": "^1.14.5", + "@injectivelabs/ts-types": "^1.14.5", + "@injectivelabs/utils": "^1.14.5", "@keplr-wallet/cosmos": "^0.11.58", "@keplr-wallet/types": "^0.11.58", + "@ledgerhq/hw-app-cosmos": "^6.29.0", "@ledgerhq/hw-app-eth": "6.33.2", "@ledgerhq/hw-transport": "6.28.3", "@ledgerhq/hw-transport-webhid": "6.27.14", diff --git a/packages/wallet-ts/src/broadcaster/MsgBroadcaster.ts b/packages/wallet-ts/src/broadcaster/MsgBroadcaster.ts index cbc0c9e9d..f6a527ecb 100644 --- a/packages/wallet-ts/src/broadcaster/MsgBroadcaster.ts +++ b/packages/wallet-ts/src/broadcaster/MsgBroadcaster.ts @@ -3,15 +3,16 @@ import { hexToBuff, PublicKey, SIGN_AMINO, + SIGN_DIRECT, hexToBase64, - BaseAccount, - ChainRestAuthApi, + ChainGrpcAuthApi, CosmosTxV1Beta1Tx, createTxRawEIP712, createTransaction, + getAminoStdSignDoc, getEip712TypedData, createWeb3Extension, - ChainRestTendermintApi, + ChainGrpcTendermintApi, createTransactionWithSigners, createTxRawFromSigResponse, IndexerGrpcTransactionApi, @@ -32,8 +33,8 @@ import { } from '@injectivelabs/exceptions' import { getNetworkInfo, - getNetworkEndpoints, NetworkEndpoints, + getNetworkEndpoints, } from '@injectivelabs/networks' import { ChainId, EthereumChainId } from '@injectivelabs/ts-types' import { @@ -45,9 +46,10 @@ import { MsgBroadcasterTxOptions, MsgBroadcasterTxOptionsWithAddresses, } from './types' -import { isCosmosWallet } from '../utils/wallets/cosmos' +import { isCosmosWallet } from '../strategies/wallet-strategy/utils' import { Wallet, WalletDeviceType } from '../types' import { createEip712StdSignDoc, KeplrWallet } from '../utils/wallets/keplr' +import { isCosmosAminoOnlyWallet } from '../utils' /** * This class is used to broadcast transactions @@ -173,17 +175,16 @@ export class MsgBroadcaster { } /** Account Details * */ - const chainRestAuthApi = new ChainRestAuthApi(endpoints.rest) - const accountDetailsResponse = await chainRestAuthApi.fetchAccount( - tx.injectiveAddress, - ) - const baseAccount = BaseAccount.fromRestApi(accountDetailsResponse) - const accountDetails = baseAccount.toAccountDetails() + const accountDetails = await new ChainGrpcAuthApi( + endpoints.grpc, + ).fetchAccount(tx.injectiveAddress) + const { baseAccount } = accountDetails /** Block Details */ - const chainRestTendermintApi = new ChainRestTendermintApi(endpoints.rest) - const latestBlock = await chainRestTendermintApi.fetchLatestBlock() - const latestHeight = latestBlock.header.height + const latestBlock = await new ChainGrpcTendermintApi( + endpoints.grpc, + ).fetchLatestBlock() + const latestHeight = latestBlock!.header!.height const timeoutHeight = new BigNumberInBase(latestHeight).plus( DEFAULT_BLOCK_TIMEOUT_HEIGHT, ) @@ -196,8 +197,8 @@ export class MsgBroadcaster { fee: getStdFee({ ...tx.gas, gas }), tx: { memo: tx.memo, - accountNumber: accountDetails.accountNumber.toString(), - sequence: accountDetails.sequence.toString(), + accountNumber: baseAccount.accountNumber.toString(), + sequence: baseAccount.sequence.toString(), timeoutHeight: timeoutHeight.toFixed(), chainId, }, @@ -266,7 +267,9 @@ export class MsgBroadcaster { throw new GeneralException(new Error('Please provide ethereumChainId')) } - const transactionApi = new IndexerGrpcTransactionApi(endpoints.indexer) + const transactionApi = new IndexerGrpcTransactionApi( + endpoints.web3gw || endpoints.indexer, + ) const txResponse = await transactionApi.prepareTxRequest({ memo: tx.memo, message: web3Msgs, @@ -318,43 +321,75 @@ export class MsgBroadcaster { } /** Account Details * */ - const chainRestAuthApi = new ChainRestAuthApi(endpoints.rest) - const accountDetailsResponse = await chainRestAuthApi.fetchAccount( - tx.injectiveAddress, - ) - const baseAccount = BaseAccount.fromRestApi(accountDetailsResponse) - const accountDetails = baseAccount.toAccountDetails() + const accountDetails = await new ChainGrpcAuthApi( + endpoints.grpc, + ).fetchAccount(tx.injectiveAddress) + const { baseAccount } = accountDetails /** Block Details */ - const chainRestTendermintApi = new ChainRestTendermintApi(endpoints.rest) - const latestBlock = await chainRestTendermintApi.fetchLatestBlock() - const latestHeight = latestBlock.header.height + const latestBlock = await new ChainGrpcTendermintApi( + endpoints.grpc, + ).fetchLatestBlock() + const latestHeight = latestBlock!.header!.height const timeoutHeight = new BigNumberInBase(latestHeight).plus( DEFAULT_BLOCK_TIMEOUT_HEIGHT, ) - const pubKey = await walletStrategy.getPubKey() + const signMode = isCosmosAminoOnlyWallet(walletStrategy.wallet) + ? SIGN_AMINO + : SIGN_DIRECT + const pubKey = await walletStrategy.getPubKey(tx.injectiveAddress) const gas = (tx.gas?.gas || getGasPriceBasedOnMessage(msgs)).toString() /** Prepare the Transaction * */ const { txRaw } = await this.getTxWithSignersAndStdFee({ chainId, + signMode, memo: tx.memo, message: msgs, timeoutHeight: timeoutHeight.toNumber(), signers: { pubKey, - accountNumber: accountDetails.accountNumber, - sequence: accountDetails.sequence, + accountNumber: baseAccount.accountNumber, + sequence: baseAccount.sequence, }, fee: getStdFee({ ...tx.gas, gas }), }) + /** Ledger using Cosmos app only allows signing amino docs */ + if (isCosmosAminoOnlyWallet(walletStrategy.wallet)) { + const aminoSignDoc = getAminoStdSignDoc({ + ...tx, + ...baseAccount, + msgs, + chainId, + gas: gas || tx.gas?.gas?.toString(), + timeoutHeight: timeoutHeight.toFixed(), + }) + + const signature = (await walletStrategy.signAminoCosmosTransaction({ + signDoc: aminoSignDoc, + chainId, + address: tx.injectiveAddress, + accountNumber: baseAccount.accountNumber, + })) as string + + console.log({ signature, signMode, aminoSignDoc }) + + txRaw.signatures = [Buffer.from(signature, 'base64')] + + return walletStrategy.sendTransaction(txRaw, { + chainId, + endpoints, + address: tx.injectiveAddress, + }) + } + const directSignResponse = (await walletStrategy.signCosmosTransaction({ txRaw, chainId, address: tx.injectiveAddress, - accountNumber: accountDetails.accountNumber, + accountNumber: baseAccount.accountNumber, })) as DirectSignResponse return walletStrategy.sendTransaction(directSignResponse, { @@ -403,18 +438,18 @@ export class MsgBroadcaster { rest: endpoints.rest, rpc: endpoints.rpc, }) + /** Account Details * */ - const chainRestAuthApi = new ChainRestAuthApi(endpoints.rest) - const accountDetailsResponse = await chainRestAuthApi.fetchAccount( - tx.injectiveAddress, - ) - const baseAccount = BaseAccount.fromRestApi(accountDetailsResponse) - const accountDetails = baseAccount.toAccountDetails() + const accountDetails = await new ChainGrpcAuthApi( + endpoints.grpc, + ).fetchAccount(tx.injectiveAddress) + const { baseAccount } = accountDetails /** Block Details */ - const chainRestTendermintApi = new ChainRestTendermintApi(endpoints.rest) - const latestBlock = await chainRestTendermintApi.fetchLatestBlock() - const latestHeight = latestBlock.header.height + const latestBlock = await new ChainGrpcTendermintApi( + endpoints.grpc, + ).fetchLatestBlock() + const latestHeight = latestBlock!.header!.height const timeoutHeight = new BigNumberInBase(latestHeight).plus( DEFAULT_BLOCK_TIMEOUT_HEIGHT, ) @@ -428,8 +463,8 @@ export class MsgBroadcaster { fee: getStdFee({ ...tx.gas, gas }), tx: { memo: tx.memo, - accountNumber: accountDetails.accountNumber.toString(), - sequence: accountDetails.sequence.toString(), + accountNumber: baseAccount.accountNumber.toString(), + sequence: baseAccount.sequence.toString(), timeoutHeight: timeoutHeight.toFixed(), chainId, }, @@ -538,26 +573,20 @@ export class MsgBroadcaster { const feePayer = feePayerPublicKey.toAddress().address /** Account Details * */ - const chainRestAuthApi = new ChainRestAuthApi(endpoints.rest) - const accountDetailsResponse = await chainRestAuthApi.fetchAccount( + const chainGrpcAuthApi = new ChainGrpcAuthApi(endpoints.grpc) + const accountDetails = await chainGrpcAuthApi.fetchAccount( tx.injectiveAddress, ) - const baseAccount = BaseAccount.fromRestApi(accountDetailsResponse) - const accountDetails = baseAccount.toAccountDetails() + const feePayerAccountDetails = await chainGrpcAuthApi.fetchAccount(feePayer) - /** Fee Payer Account Details */ - const feePayerAccountDetailsResponse = await chainRestAuthApi.fetchAccount( - feePayer, - ) - const feePayerBaseAccount = BaseAccount.fromRestApi( - feePayerAccountDetailsResponse, - ) - const feePayerAccountDetails = feePayerBaseAccount.toAccountDetails() + const { baseAccount } = accountDetails + const { baseAccount: feePayerBaseAccount } = feePayerAccountDetails /** Block Details */ - const chainRestTendermintApi = new ChainRestTendermintApi(endpoints.rest) - const latestBlock = await chainRestTendermintApi.fetchLatestBlock() - const latestHeight = latestBlock.header.height + const latestBlock = await new ChainGrpcTendermintApi( + endpoints.grpc, + ).fetchLatestBlock() + const latestHeight = latestBlock!.header!.height const timeoutHeight = new BigNumberInBase(latestHeight).plus( DEFAULT_BLOCK_TIMEOUT_HEIGHT, ) @@ -574,13 +603,13 @@ export class MsgBroadcaster { signers: [ { pubKey, - accountNumber: accountDetails.accountNumber, - sequence: accountDetails.sequence, + accountNumber: baseAccount.accountNumber, + sequence: baseAccount.sequence, }, { pubKey: feePayerPublicKey.toBase64(), - accountNumber: feePayerAccountDetails.accountNumber, - sequence: feePayerAccountDetails.sequence, + accountNumber: feePayerBaseAccount.accountNumber, + sequence: feePayerBaseAccount.sequence, }, ], fee: getStdFee({ ...tx.gas, gas, payer: feePayer }), @@ -595,10 +624,12 @@ export class MsgBroadcaster { txRaw, chainId, address: tx.injectiveAddress, - accountNumber: accountDetails.accountNumber, + accountNumber: baseAccount.accountNumber, })) as DirectSignResponse - const transactionApi = new IndexerGrpcTransactionApi(endpoints.indexer) + const transactionApi = new IndexerGrpcTransactionApi( + endpoints.web3gw || endpoints.indexer, + ) const response = await transactionApi.broadcastCosmosTxRequest({ address: tx.injectiveAddress, txRaw: createTxRawFromSigResponse(directSignResponse), @@ -626,7 +657,9 @@ export class MsgBroadcaster { const { endpoints } = this - const transactionApi = new IndexerGrpcTransactionApi(endpoints.indexer) + const transactionApi = new IndexerGrpcTransactionApi( + endpoints.web3gw || endpoints.indexer, + ) const response = await transactionApi.fetchFeePayer() if (!response.feePayerPubKey) { diff --git a/packages/wallet-ts/src/strategies/cosmos-wallet-strategy/CosmosWalletStrategy.ts b/packages/wallet-ts/src/strategies/cosmos-wallet-strategy/CosmosWalletStrategy.ts index f55e57325..a61a4308a 100644 --- a/packages/wallet-ts/src/strategies/cosmos-wallet-strategy/CosmosWalletStrategy.ts +++ b/packages/wallet-ts/src/strategies/cosmos-wallet-strategy/CosmosWalletStrategy.ts @@ -1,4 +1,4 @@ -import { AccountAddress, CosmosChainId } from '@injectivelabs/ts-types' +import { AccountAddress } from '@injectivelabs/ts-types' import { DirectSignResponse } from '@cosmjs/proto-signing' import { GeneralException } from '@injectivelabs/exceptions' import { TxResponse, TxRaw } from '@injectivelabs/sdk-ts' @@ -7,13 +7,20 @@ import { Wallet, WalletDeviceType } from '../../types/enums' import Keplr from './strategies/Keplr' import Leap from './strategies/Leap' import Cosmostation from './strategies/Cosmostation' +import Ninji from './strategies/Ninji' import { ConcreteCosmosWalletStrategy, CosmosWalletStrategyArguments, } from '../types/strategy' -import { isCosmosWallet } from '../../utils/wallets/cosmos/utils' +import {} from '../../utils/utils' +import { isCosmosWallet } from '../wallet-strategy/utils' -export const cosmosWallets = [Wallet.Keplr, Wallet.Leap, Wallet.Cosmostation] +export const cosmosWallets = [ + Wallet.Keplr, + Wallet.Leap, + Wallet.Cosmostation, + Wallet.Ninji, +] const createWallet = ({ wallet, @@ -29,6 +36,8 @@ const createWallet = ({ return new Leap({ ...args }) case Wallet.Cosmostation: return new Cosmostation({ ...args }) + case Wallet.Ninji: + return new Ninji({ ...args }) default: throw new GeneralException( new Error(`The ${wallet} concrete wallet strategy is not supported`), @@ -83,12 +92,18 @@ export default class CosmosWalletStrategy { return this.getStrategy().getPubKey() } + public enable(): Promise { + return this.getStrategy().enable() + } + public getAddresses(): Promise { return this.getStrategy().getAddresses() } - public isChainIdSupported(chainId?: CosmosChainId): Promise { - return this.getStrategy().isChainIdSupported(chainId) + public async enableAndGetAddresses(): Promise { + await this.getStrategy().enable() + + return await this.getStrategy().getAddresses() } public async sendTransaction( diff --git a/packages/wallet-ts/src/strategies/cosmos-wallet-strategy/strategies/Cosmostation.ts b/packages/wallet-ts/src/strategies/cosmos-wallet-strategy/strategies/Cosmostation.ts index fde14f602..0220351ed 100644 --- a/packages/wallet-ts/src/strategies/cosmos-wallet-strategy/strategies/Cosmostation.ts +++ b/packages/wallet-ts/src/strategies/cosmos-wallet-strategy/strategies/Cosmostation.ts @@ -12,10 +12,11 @@ import { createSignDocFromTransaction, } from '@injectivelabs/sdk-ts' import { DirectSignResponse, makeSignDoc } from '@cosmjs/proto-signing' -import { cosmos, InstallError, Cosmos } from '@cosmostation/extension-client' +import { InstallError, Cosmos } from '@cosmostation/extension-client' import { SEND_TRANSACTION_MODE } from '@cosmostation/extension-client/cosmos' import { AminoSignResponse, StdSignDoc } from '@keplr-wallet/types' import { ConcreteCosmosWalletStrategy } from '../../types/strategy' +import { CosmostationWallet } from './../../../utils/wallets/cosmostation' import { WalletAction, WalletDeviceType } from '../../../types/enums' import { CosmosTxV1Beta1Tx } from '@injectivelabs/sdk-ts' @@ -40,7 +41,7 @@ const getChainNameFromChainId = (chainId: CosmosChainId) => { export default class Cosmostation implements ConcreteCosmosWalletStrategy { public chainName: string - public provider?: Cosmos + public cosmostationWallet?: Cosmos public chainId: CosmosChainId @@ -53,23 +54,16 @@ export default class Cosmostation implements ConcreteCosmosWalletStrategy { return Promise.resolve(WalletDeviceType.Browser) } - async isChainIdSupported(chainId?: CosmosChainId): Promise { - const actualChainId = chainId || this.chainId - const provider = await this.getProvider() - - const supportedChainIds = await provider.getSupportedChainIds() - - return !!supportedChainIds.official.find( - (chainId) => chainId === actualChainId, - ) + async enable() { + return await CosmostationWallet.isChainIdSupported(this.chainId) } async getAddresses(): Promise { const { chainName } = this - const provider = await this.getProvider() + const cosmostationWallet = await this.getCosmostationWallet() try { - const accounts = await provider.requestAccount(chainName) + const accounts = await cosmostationWallet.requestAccount(chainName) return [accounts.address] } catch (e: unknown) { @@ -83,6 +77,10 @@ export default class Cosmostation implements ConcreteCosmosWalletStrategy { ) } + if (e instanceof CosmosWalletException) { + throw e + } + throw new CosmosWalletException(new Error((e as any).message), { code: UnspecifiedErrorCode, context: WalletAction.GetAccounts, @@ -94,11 +92,11 @@ export default class Cosmostation implements ConcreteCosmosWalletStrategy { transaction: DirectSignResponse | CosmosTxV1Beta1Tx.TxRaw, ): Promise { const { chainName } = this - const provider = await this.getProvider() + const cosmostationWallet = await this.getCosmostationWallet() const txRaw = createTxRawFromSigResponse(transaction) try { - const response = await provider.sendTransaction( + const response = await cosmostationWallet.sendTransaction( chainName, CosmosTxV1Beta1Tx.TxRaw.encode(txRaw).finish(), SEND_TRANSACTION_MODE.ASYNC, @@ -133,12 +131,12 @@ export default class Cosmostation implements ConcreteCosmosWalletStrategy { chainId: string }) { const { chainName, chainId } = this - const provider = await this.getProvider() + const cosmostationWallet = await this.getCosmostationWallet() const signDoc = createSignDocFromTransaction(transaction) try { /* Sign the transaction */ - const signDirectResponse = await provider.signDirect( + const signDirectResponse = await cosmostationWallet.signDirect( chainName, { chain_id: chainId, @@ -179,10 +177,10 @@ export default class Cosmostation implements ConcreteCosmosWalletStrategy { async getPubKey(): Promise { const { chainName } = this - const provider = await this.getProvider() + const cosmostationWallet = await this.getCosmostationWallet() try { - const account = await provider.requestAccount(chainName) + const account = await cosmostationWallet.requestAccount(chainName) return Buffer.from(account.publicKey).toString('base64') } catch (e: unknown) { @@ -203,15 +201,17 @@ export default class Cosmostation implements ConcreteCosmosWalletStrategy { } } - private async getProvider(): Promise { - if (this.provider) { - return this.provider + private async getCosmostationWallet(): Promise { + if (this.cosmostationWallet) { + return this.cosmostationWallet } + const cosmostationWallet = new CosmostationWallet(this.chainId) + try { - const provider = await cosmos() + const provider = await cosmostationWallet.getCosmostationWallet() - this.provider = provider + this.cosmostationWallet = provider return provider } catch (e) { diff --git a/packages/wallet-ts/src/strategies/cosmos-wallet-strategy/strategies/Keplr.ts b/packages/wallet-ts/src/strategies/cosmos-wallet-strategy/strategies/Keplr.ts index 032e6d655..81d653abc 100644 --- a/packages/wallet-ts/src/strategies/cosmos-wallet-strategy/strategies/Keplr.ts +++ b/packages/wallet-ts/src/strategies/cosmos-wallet-strategy/strategies/Keplr.ts @@ -38,26 +38,22 @@ export default class Keplr implements ConcreteCosmosWalletStrategy { : Promise.resolve(WalletDeviceType.Browser) } - async isChainIdSupported(chainId?: CosmosChainId): Promise { - const keplrWallet = chainId - ? new KeplrWallet(chainId) - : this.getKeplrWallet() - - return keplrWallet.checkChainIdSupport() + async enable() { + return await KeplrWallet.isChainIdSupported(this.chainId) } async getAddresses(): Promise { const keplrWallet = this.getKeplrWallet() try { - if (!(await keplrWallet.checkChainIdSupport())) { - await keplrWallet.experimentalSuggestChain() - } - const accounts = await keplrWallet.getAccounts() return accounts.map((account) => account.address) } catch (e: unknown) { + if (e instanceof CosmosWalletException) { + throw e + } + throw new CosmosWalletException(new Error((e as any).message), { code: UnspecifiedErrorCode, context: WalletAction.GetAccounts, diff --git a/packages/wallet-ts/src/strategies/cosmos-wallet-strategy/strategies/Leap.ts b/packages/wallet-ts/src/strategies/cosmos-wallet-strategy/strategies/Leap.ts index 365fffacf..31f8fd0d6 100644 --- a/packages/wallet-ts/src/strategies/cosmos-wallet-strategy/strategies/Leap.ts +++ b/packages/wallet-ts/src/strategies/cosmos-wallet-strategy/strategies/Leap.ts @@ -34,28 +34,22 @@ export default class Leap implements ConcreteCosmosWalletStrategy { return Promise.resolve(WalletDeviceType.Browser) } - async isChainIdSupported(chainId?: CosmosChainId): Promise { - const leapWallet = chainId ? new LeapWallet(chainId) : this.getLeapWallet() - - return leapWallet.checkChainIdSupport() + async enable() { + return await LeapWallet.isChainIdSupported(this.chainId) } async getAddresses(): Promise { - const { chainId } = this const leapWallet = this.getLeapWallet() try { - if (!(await leapWallet.checkChainIdSupport())) { - throw new CosmosWalletException( - new Error(`The ${chainId} is not supported on Leap.`), - { type: ErrorType.WalletError }, - ) - } - const accounts = await leapWallet.getAccounts() return accounts.map((account) => account.address) } catch (e: unknown) { + if (e instanceof CosmosWalletException) { + throw e + } + throw new CosmosWalletException(new Error((e as any).message), { code: UnspecifiedErrorCode, context: WalletAction.GetAccounts, diff --git a/packages/wallet-ts/src/strategies/cosmos-wallet-strategy/strategies/Ninji.ts b/packages/wallet-ts/src/strategies/cosmos-wallet-strategy/strategies/Ninji.ts new file mode 100644 index 000000000..2b768eb32 --- /dev/null +++ b/packages/wallet-ts/src/strategies/cosmos-wallet-strategy/strategies/Ninji.ts @@ -0,0 +1,145 @@ +/* eslint-disable class-methods-use-this */ +import { CosmosChainId } from '@injectivelabs/ts-types' +import { + ErrorType, + UnspecifiedErrorCode, + CosmosWalletException, + TransactionException, +} from '@injectivelabs/exceptions' +import { + TxRaw, + TxResponse, + createTxRawFromSigResponse, + createCosmosSignDocFromSignDoc, + createSignDocFromTransaction, +} from '@injectivelabs/sdk-ts' +import type { DirectSignResponse } from '@cosmjs/proto-signing' +import { StdSignDoc } from '@keplr-wallet/types' +import { AminoSignResponse } from '@cosmjs/launchpad' +import { NinjiWallet } from '../../../utils/wallets/ninji' +import { WalletAction, WalletDeviceType } from '../../../types/enums' +import { ConcreteCosmosWalletStrategy } from '../../types/strategy' + +export default class Ninji implements ConcreteCosmosWalletStrategy { + public chainId: CosmosChainId + + private ninjiWallet: NinjiWallet + + constructor(args: { chainId: CosmosChainId }) { + this.chainId = args.chainId || CosmosChainId.Injective + this.ninjiWallet = new NinjiWallet(args.chainId) + } + + async getWalletDeviceType(): Promise { + return Promise.resolve(WalletDeviceType.Browser) + } + + async enable() { + return await NinjiWallet.isChainIdSupported(this.chainId) + } + + async getAddresses(): Promise { + const ninjiWallet = this.getNinjiWallet() + + try { + const accounts = await ninjiWallet.getAccounts() + + return accounts.map((account) => account.address) + } catch (e: unknown) { + if (e instanceof CosmosWalletException) { + throw e + } + + throw new CosmosWalletException(new Error((e as any).message), { + code: UnspecifiedErrorCode, + context: WalletAction.GetAccounts, + }) + } + } + + async sendTransaction( + transaction: DirectSignResponse | TxRaw, + ): Promise { + const { ninjiWallet } = this + const txRaw = createTxRawFromSigResponse(transaction) + + try { + return await ninjiWallet.waitTxBroadcasted( + await ninjiWallet.broadcastTx(txRaw), + ) + } catch (e: unknown) { + throw new TransactionException(new Error((e as any).message), { + code: UnspecifiedErrorCode, + context: WalletAction.SendTransaction, + }) + } + } + + async signTransaction(transaction: { + txRaw: TxRaw + chainId: string + accountNumber: number + address: string + }) { + const ninjiWallet = this.getNinjiWallet() + const signer = await ninjiWallet.getOfflineSigner() + const signDoc = createSignDocFromTransaction(transaction) + + try { + return signer.signDirect( + transaction.address, + createCosmosSignDocFromSignDoc(signDoc), + ) + } catch (e: unknown) { + if (e instanceof TransactionException) { + throw e + } + + throw new CosmosWalletException(new Error((e as any).message), { + code: UnspecifiedErrorCode, + context: WalletAction.SendTransaction, + }) + } + } + + async signAminoTransaction(_transaction: { + address: string + stdSignDoc: StdSignDoc + }): Promise { + throw new CosmosWalletException( + new Error('signAminoTransaction not supported on Ninji'), + ) + } + + async getPubKey(): Promise { + const ninjiWallet = this.getNinjiWallet() + + try { + const key = await ninjiWallet.getKey() + + return Buffer.from(key.pubKey).toString('base64') + } catch (e) { + throw new CosmosWalletException(new Error((e as any).message), { + code: UnspecifiedErrorCode, + context: WalletAction.GetAccounts, + }) + } + } + + private getNinjiWallet(): NinjiWallet { + const { ninjiWallet } = this + + if (!ninjiWallet) { + throw new CosmosWalletException( + new Error('Please install the Ninji wallet extension'), + { + code: UnspecifiedErrorCode, + type: ErrorType.WalletNotInstalledError, + context: WalletAction.SignTransaction, + }, + ) + } + + return ninjiWallet + } +} diff --git a/packages/wallet-ts/src/strategies/types/strategy.ts b/packages/wallet-ts/src/strategies/types/strategy.ts index 63139a214..2ffd0f65e 100644 --- a/packages/wallet-ts/src/strategies/types/strategy.ts +++ b/packages/wallet-ts/src/strategies/types/strategy.ts @@ -23,7 +23,7 @@ export interface EthereumWalletStrategyArgs { export interface ConcreteCosmosWalletStrategy { /** - * The the accounts from the wallet (addresses) + * The accounts from the wallet (addresses) */ getAddresses(): Promise @@ -37,7 +37,13 @@ export interface ConcreteCosmosWalletStrategy { * Get the PubKey from the wallet * in base64 for Cosmos native wallets */ - getPubKey(): Promise + getPubKey(address?: string): Promise + + /** + * Perform validations and checks + * for the wallet (if the chain is supported, etc) + */ + enable(): Promise /** * Sends Cosmos transaction. Returns a transaction hash @@ -46,8 +52,6 @@ export interface ConcreteCosmosWalletStrategy { */ sendTransaction(transaction: DirectSignResponse | TxRaw): Promise - isChainIdSupported(chainId?: CosmosChainId): Promise - signTransaction(transaction: { txRaw: TxRaw chainId: string @@ -138,6 +142,19 @@ export interface ConcreteWalletStrategy address: string }): Promise + /** + * Sign an amino sign doc using the wallet provider + * + * @param transaction + * @param address - injective address + */ + signAminoCosmosTransaction(transaction: { + signDoc: any + accountNumber: number + chainId: string + address: string + }): Promise + /** * Sign EIP712 TypedData using the wallet provider * @param eip712TypedData @@ -161,5 +178,5 @@ export interface ConcreteWalletStrategy cancelAllEvents?(): void - disconnect?(): Promise + disconnect?(): Promise | void } diff --git a/packages/wallet-ts/src/strategies/wallet-strategy/WalletStrategy.ts b/packages/wallet-ts/src/strategies/wallet-strategy/WalletStrategy.ts index 43781d33c..4e7c866aa 100644 --- a/packages/wallet-ts/src/strategies/wallet-strategy/WalletStrategy.ts +++ b/packages/wallet-ts/src/strategies/wallet-strategy/WalletStrategy.ts @@ -18,14 +18,16 @@ import { } from '../types' import Keplr from './strategies/Keplr' import Leap from './strategies/Leap' +import Ninji from './strategies/Ninji' import Trezor from './strategies/Trezor' import LedgerLive from './strategies/Ledger/LedgerLive' import LedgerLegacy from './strategies/Ledger/LedgerLegacy' import Torus from './strategies/Torus' +import Phantom from './strategies/Phantom' import Cosmostation from './strategies/Cosmostation' +import LedgerCosmos from './strategies/LedgerCosmos' import { Wallet, WalletDeviceType } from '../../types/enums' -import { isEthWallet } from './utils' -import { isCosmosWallet } from '../../utils/wallets/cosmos' +import { isEthWallet, isCosmosWallet } from './utils' const getInitialWallet = (args: WalletStrategyArguments): Wallet => { if (args.wallet) { @@ -90,12 +92,18 @@ const createStrategy = ({ return new Trezor(ethWalletArgs) case Wallet.Torus: return new Torus(ethWalletArgs) + case Wallet.Phantom: + return new Phantom(ethWalletArgs) case Wallet.Keplr: return new Keplr({ ...args }) case Wallet.Cosmostation: return new Cosmostation({ ...args }) + case Wallet.LedgerCosmos: + return new LedgerCosmos({ ...args }) case Wallet.Leap: return new Leap({ ...args }) + case Wallet.Ninji: + return new Ninji({ ...args }) default: return undefined } @@ -128,6 +136,7 @@ export default class WalletStrategy { } public setWallet(wallet: Wallet) { + this.disconnect() this.wallet = wallet } @@ -149,8 +158,18 @@ export default class WalletStrategy { return this.getStrategy().getWalletDeviceType() } - public getPubKey(): Promise { - return this.getStrategy().getPubKey() + public getPubKey(address?: string): Promise { + return this.getStrategy().getPubKey(address) + } + + public enable(): Promise { + return this.getStrategy().enable() + } + + public async enableAndGetAddresses(): Promise { + await this.getStrategy().enable() + + return this.getStrategy().getAddresses() } public getEthereumChainId(): Promise { @@ -165,16 +184,6 @@ export default class WalletStrategy { return this.getStrategy().confirm(address) } - public async disconnectWallet() { - const strategy = this.getStrategy() - - if (strategy.disconnect !== undefined) { - await strategy.disconnect() - } - - this.wallet = Wallet.Metamask - } - public async sendTransaction( tx: DirectSignResponse | TxRaw, options: { @@ -223,6 +232,21 @@ export default class WalletStrategy { return this.getStrategy().signEip712TypedData(eip712TypedData, address) } + public async signAminoCosmosTransaction(transaction: { + signDoc: any + accountNumber: number + chainId: string + address: string + }): Promise { + if (isEthWallet(this.wallet)) { + throw new WalletException( + new Error(`You can't sign Cosmos Transaction using ${this.wallet}`), + ) + } + + return this.getStrategy().signAminoCosmosTransaction(transaction) + } + public async signCosmosTransaction(transaction: { txRaw: TxRaw accountNumber: number @@ -276,4 +300,10 @@ export default class WalletStrategy { return this.getStrategy().cancelOnAccountChange!() } } + + public disconnect() { + if (this.getStrategy().disconnect) { + this.getStrategy().disconnect!() + } + } } diff --git a/packages/wallet-ts/src/strategies/wallet-strategy/index.ts b/packages/wallet-ts/src/strategies/wallet-strategy/index.ts index 0097c4c2e..31abd4a5a 100644 --- a/packages/wallet-ts/src/strategies/wallet-strategy/index.ts +++ b/packages/wallet-ts/src/strategies/wallet-strategy/index.ts @@ -2,4 +2,5 @@ import WalletStrategy from './WalletStrategy' export * from './types' export * from './utils' + export { WalletStrategy } diff --git a/packages/wallet-ts/src/strategies/wallet-strategy/strategies/Cosmostation.ts b/packages/wallet-ts/src/strategies/wallet-strategy/strategies/Cosmostation.ts index ea5520e4e..71584a133 100644 --- a/packages/wallet-ts/src/strategies/wallet-strategy/strategies/Cosmostation.ts +++ b/packages/wallet-ts/src/strategies/wallet-strategy/strategies/Cosmostation.ts @@ -18,12 +18,13 @@ import { toUtf8, } from '@injectivelabs/sdk-ts' import { DirectSignResponse, makeSignDoc } from '@cosmjs/proto-signing' -import { cosmos, InstallError, Cosmos } from '@cosmostation/extension-client' +import { InstallError, Cosmos } from '@cosmostation/extension-client' import { SEND_TRANSACTION_MODE } from '@cosmostation/extension-client/cosmos' import { ConcreteWalletStrategy } from '../../types' import BaseConcreteStrategy from './Base' import { WalletAction, WalletDeviceType } from '../../../types/enums' import { CosmosTxV1Beta1Tx } from '@injectivelabs/sdk-ts' +import { CosmostationWallet } from './../../../utils/wallets/cosmostation' const INJECTIVE_CHAIN_NAME = 'injective' @@ -31,7 +32,7 @@ export default class Cosmostation extends BaseConcreteStrategy implements ConcreteWalletStrategy { - private provider?: Cosmos + private cosmostationWallet?: Cosmos constructor(args: { chainId: ChainId }) { super(args) @@ -42,11 +43,17 @@ export default class Cosmostation return Promise.resolve(WalletDeviceType.Browser) } + async enable(): Promise { + return Promise.resolve(true) + } + async getAddresses(): Promise { - const provider = await this.getProvider() + const cosmostationWallet = await this.getCosmostationWallet() try { - const accounts = await provider.requestAccount(INJECTIVE_CHAIN_NAME) + const accounts = await cosmostationWallet.requestAccount( + INJECTIVE_CHAIN_NAME, + ) return [accounts.address] } catch (e: unknown) { @@ -95,11 +102,11 @@ export default class Cosmostation transaction: DirectSignResponse | CosmosTxV1Beta1Tx.TxRaw, _options: { address: AccountAddress; chainId: ChainId }, ): Promise { - const provider = await this.getProvider() + const cosmostationWallet = await this.getCosmostationWallet() const txRaw = createTxRawFromSigResponse(transaction) try { - const response = await provider.sendTransaction( + const response = await cosmostationWallet.sendTransaction( INJECTIVE_CHAIN_NAME, CosmosTxV1Beta1Tx.TxRaw.encode(txRaw).finish(), SEND_TRANSACTION_MODE.SYNC, @@ -140,6 +147,21 @@ export default class Cosmostation return this.signCosmosTransaction({ ...transaction, address }) } + async signAminoCosmosTransaction(_transaction: { + signDoc: any + accountNumber: number + chainId: string + address: string + }): Promise { + throw new CosmosWalletException( + new Error('This wallet does not support signing using amino'), + { + code: UnspecifiedErrorCode, + context: WalletAction.SendTransaction, + }, + ) + } + async signCosmosTransaction(transaction: { txRaw: CosmosTxV1Beta1Tx.TxRaw chainId: string @@ -147,12 +169,12 @@ export default class Cosmostation accountNumber: number }) { const { chainId } = this - const provider = await this.getProvider() + const cosmostationWallet = await this.getCosmostationWallet() const signDoc = createSignDocFromTransaction(transaction) try { /* Sign the transaction */ - const signDirectResponse = await provider.signDirect( + const signDirectResponse = await cosmostationWallet.signDirect( INJECTIVE_CHAIN_NAME, { chain_id: chainId, @@ -183,10 +205,12 @@ export default class Cosmostation } async getPubKey(): Promise { - const provider = await this.getProvider() + const cosmostationWallet = await this.getCosmostationWallet() try { - const account = await provider.requestAccount(INJECTIVE_CHAIN_NAME) + const account = await cosmostationWallet.requestAccount( + INJECTIVE_CHAIN_NAME, + ) return Buffer.from(account.publicKey).toString('base64') } catch (e: unknown) { @@ -225,9 +249,9 @@ export default class Cosmostation data: string | Uint8Array, ): Promise { try { - const provider = await this.getProvider() + const cosmostationWallet = await this.getCosmostationWallet() - const signature = await provider.signMessage( + const signature = await cosmostationWallet.signMessage( INJECTIVE_CHAIN_NAME, signer, toUtf8(data), @@ -265,15 +289,17 @@ export default class Cosmostation ) } - private async getProvider(): Promise { - if (this.provider) { - return this.provider + private async getCosmostationWallet(): Promise { + if (this.cosmostationWallet) { + return this.cosmostationWallet } + const cosmostationWallet = new CosmostationWallet(this.chainId) + try { - const provider = await cosmos() + const provider = await cosmostationWallet.getCosmostationWallet() - this.provider = provider + this.cosmostationWallet = provider return provider } catch (e) { @@ -289,7 +315,6 @@ export default class Cosmostation throw new CosmosWalletException(new Error((e as any).message), { code: UnspecifiedErrorCode, - type: ErrorType.WalletError, }) } } diff --git a/packages/wallet-ts/src/strategies/wallet-strategy/strategies/Keplr.ts b/packages/wallet-ts/src/strategies/wallet-strategy/strategies/Keplr.ts index b6b4ac2c4..7ed74e698 100644 --- a/packages/wallet-ts/src/strategies/wallet-strategy/strategies/Keplr.ts +++ b/packages/wallet-ts/src/strategies/wallet-strategy/strategies/Keplr.ts @@ -48,14 +48,16 @@ export default class Keplr : Promise.resolve(WalletDeviceType.Browser) } + async enable(): Promise { + const keplrWallet = this.getKeplrWallet() + + return await keplrWallet.checkChainIdSupport() + } + async getAddresses(): Promise { const keplrWallet = this.getKeplrWallet() try { - if (!(await keplrWallet.checkChainIdSupport())) { - await keplrWallet.experimentalSuggestChain() - } - const accounts = await keplrWallet.getAccounts() return accounts.map((account) => account.address) @@ -96,7 +98,7 @@ export default class Keplr options: { address: AccountAddress chainId: ChainId - endpoints?: { rest: string } + endpoints?: { grpc: string } }, ): Promise { const { keplrWallet } = this @@ -105,7 +107,7 @@ export default class Keplr try { return await keplrWallet.waitTxBroadcasted( await keplrWallet.broadcastTx(txRaw), - options.endpoints?.rest, + options.endpoints?.grpc, ) } catch (e: unknown) { if (e instanceof TransactionException) { @@ -130,6 +132,21 @@ export default class Keplr }) } + async signAminoCosmosTransaction(_transaction: { + signDoc: any + accountNumber: number + chainId: string + address: string + }): Promise { + throw new CosmosWalletException( + new Error('This wallet does not support signing using amino'), + { + code: UnspecifiedErrorCode, + context: WalletAction.SendTransaction, + }, + ) + } + async signCosmosTransaction(transaction: { txRaw: TxRaw accountNumber: number diff --git a/packages/wallet-ts/src/strategies/wallet-strategy/strategies/Leap.ts b/packages/wallet-ts/src/strategies/wallet-strategy/strategies/Leap.ts index dd5b2cc08..c0a260e9a 100644 --- a/packages/wallet-ts/src/strategies/wallet-strategy/strategies/Leap.ts +++ b/packages/wallet-ts/src/strategies/wallet-strategy/strategies/Leap.ts @@ -24,10 +24,7 @@ import { ConcreteWalletStrategy } from '../../types' import BaseConcreteStrategy from './Base' import { WalletAction, WalletDeviceType } from '../../../types/enums' -export default class Leap - extends BaseConcreteStrategy - implements ConcreteWalletStrategy -{ +export default class Leap extends BaseConcreteStrategy implements ConcreteWalletStrategy { private leapWallet: LeapWallet constructor(args: { @@ -43,18 +40,16 @@ export default class Leap return Promise.resolve(WalletDeviceType.Browser) } + async enable(): Promise { + const leapWallet = this.getLeapWallet() + + return await leapWallet.checkChainIdSupport() + } + async getAddresses(): Promise { - const { chainId } = this const leapWallet = this.getLeapWallet() try { - if (!(await leapWallet.checkChainIdSupport())) { - throw new CosmosWalletException( - new Error(`The ${chainId} is not supported on Leap.`), - { type: ErrorType.WalletError }, - ) - } - const accounts = await leapWallet.getAccounts() return accounts.map((account) => account.address) @@ -95,7 +90,7 @@ export default class Leap options: { address: AccountAddress chainId: ChainId - endpoints?: { rest: string } + endpoints?: { grpc: string } }, ): Promise { const { leapWallet } = this @@ -104,7 +99,7 @@ export default class Leap try { return await leapWallet.waitTxBroadcasted( await leapWallet.broadcastTx(txRaw), - options.endpoints?.rest, + options.endpoints?.grpc, ) } catch (e: unknown) { if (e instanceof TransactionException) { @@ -129,6 +124,21 @@ export default class Leap }) } + async signAminoCosmosTransaction(_transaction: { + signDoc: any + accountNumber: number + chainId: string + address: string + }): Promise { + throw new CosmosWalletException( + new Error('This wallet does not support signing using amino'), + { + code: UnspecifiedErrorCode, + context: WalletAction.SendTransaction, + }, + ) + } + async signCosmosTransaction(transaction: { txRaw: TxRaw accountNumber: number diff --git a/packages/wallet-ts/src/strategies/wallet-strategy/strategies/Ledger/Base.ts b/packages/wallet-ts/src/strategies/wallet-strategy/strategies/Ledger/Base.ts index 5a406e35e..0d3255750 100644 --- a/packages/wallet-ts/src/strategies/wallet-strategy/strategies/Ledger/Base.ts +++ b/packages/wallet-ts/src/strategies/wallet-strategy/strategies/Ledger/Base.ts @@ -79,6 +79,14 @@ export default class LedgerBase return Promise.resolve(WalletDeviceType.Hardware) } + async enable(): Promise { + return Promise.resolve(true) + } + + public async disconnect() { + this.ledger = await this.ledger.refresh() + } + public async getAddresses(): Promise { const { baseDerivationPath, derivationPathType } = this @@ -205,6 +213,22 @@ export default class LedgerBase } } + async signAminoCosmosTransaction(_transaction: { + signDoc: any + accountNumber: number + chainId: string + address: string + }): Promise { + throw new WalletException( + new Error('This wallet does not support signing Cosmos transactions'), + { + code: UnspecifiedErrorCode, + type: ErrorType.WalletError, + contextModule: WalletAction.SendTransaction, + }, + ) + } + // eslint-disable-next-line class-methods-use-this async signCosmosTransaction(_transaction: { txRaw: TxRaw @@ -334,28 +358,39 @@ export default class LedgerBase private async getWalletForAddress( address: string, ): Promise { - const { baseDerivationPath, derivationPathType } = this - const accountManager = await this.ledger.getAccountManager() - - if (!accountManager.hasWalletForAddress(address)) { - for ( - let i = 0; - i < DEFAULT_ADDRESS_SEARCH_LIMIT / DEFAULT_NUM_ADDRESSES_TO_FETCH; - i += 1 - ) { - await accountManager.getWallets(baseDerivationPath, derivationPathType) - - if (accountManager.hasWalletForAddress(address)) { - return (await accountManager.getWalletForAddress( - address, - )) as LedgerWalletInfo + try { + const { baseDerivationPath, derivationPathType } = this + const accountManager = await this.ledger.getAccountManager() + + if (!accountManager.hasWalletForAddress(address)) { + for ( + let i = 0; + i < DEFAULT_ADDRESS_SEARCH_LIMIT / DEFAULT_NUM_ADDRESSES_TO_FETCH; + i += 1 + ) { + await accountManager.getWallets( + baseDerivationPath, + derivationPathType, + ) + + if (accountManager.hasWalletForAddress(address)) { + return (await accountManager.getWalletForAddress( + address, + )) as LedgerWalletInfo + } } } - } - return (await accountManager.getWalletForAddress( - address, - )) as LedgerWalletInfo + return (await accountManager.getWalletForAddress( + address, + )) as LedgerWalletInfo + } catch (e) { + throw new LedgerException(new Error((e as any).message), { + code: UnspecifiedErrorCode, + type: ErrorType.WalletError, + contextModule: WalletAction.GetAccounts, + }) + } } private async getAlchemy() { diff --git a/packages/wallet-ts/src/strategies/wallet-strategy/strategies/Ledger/hw/AccountManager.ts b/packages/wallet-ts/src/strategies/wallet-strategy/strategies/Ledger/hw/AccountManager.ts index fa4e47e39..72beb3f23 100644 --- a/packages/wallet-ts/src/strategies/wallet-strategy/strategies/Ledger/hw/AccountManager.ts +++ b/packages/wallet-ts/src/strategies/wallet-strategy/strategies/Ledger/hw/AccountManager.ts @@ -132,4 +132,8 @@ export default class AccountManager { (wallet) => wallet.address.toLowerCase() === address.toLowerCase(), ) } + + reset() { + this.wallets = [] + } } diff --git a/packages/wallet-ts/src/strategies/wallet-strategy/strategies/Ledger/hw/index.ts b/packages/wallet-ts/src/strategies/wallet-strategy/strategies/Ledger/hw/index.ts index 4ec9d3177..4fdd2d278 100644 --- a/packages/wallet-ts/src/strategies/wallet-strategy/strategies/Ledger/hw/index.ts +++ b/packages/wallet-ts/src/strategies/wallet-strategy/strategies/Ledger/hw/index.ts @@ -67,4 +67,14 @@ export default class LedgerTransport { return this.accountManager } + + async refresh() { + if (!this.ledger) { + return new LedgerTransport() + } + + this.ledger.transport.close() + + return new LedgerTransport() + } } diff --git a/packages/wallet-ts/src/strategies/wallet-strategy/strategies/LedgerCosmos/hw/AccountManager.ts b/packages/wallet-ts/src/strategies/wallet-strategy/strategies/LedgerCosmos/hw/AccountManager.ts new file mode 100644 index 000000000..6c100cc36 --- /dev/null +++ b/packages/wallet-ts/src/strategies/wallet-strategy/strategies/LedgerCosmos/hw/AccountManager.ts @@ -0,0 +1,107 @@ +import { AccountAddress } from '@injectivelabs/ts-types' +import type CosmosApp from '@ledgerhq/hw-app-cosmos' +import { LedgerWalletInfo } from '../../../types' +import { DEFAULT_NUM_ADDRESSES_TO_FETCH } from '../../../constants' + +export default class AccountManager { + private wallets: LedgerWalletInfo[] = [] + + private ledger: CosmosApp + + constructor(ledger: CosmosApp) { + this.ledger = ledger + this.wallets = [] + } + + async getWallets(baseDerivationPath: string): Promise { + const { start, end } = this.getOffset() + + /** + * 1. Wallets are not yet fetched at all, + * 2. Wallets are not yet fetched for that offset + */ + if (!this.hasWallets() || !this.hasWalletsInOffset(start)) { + await this.getWalletsBasedOnIndex({ + start, + end, + baseDerivationPath, + }) + } + + return this.wallets.slice(start, end) + } + + getLedgerDerivationPathBasedOnType = ({ + fullBaseDerivationPath, + index, + }: { + fullBaseDerivationPath: string + index: number + }): string => { + return `${fullBaseDerivationPath}/${index}'/0/0` + } + + private async getWalletsBasedOnIndex({ + start, + end, + baseDerivationPath, + }: { + start: number + end: number + baseDerivationPath: string + }) { + for (let index = start; index < end; index += 1) { + const path = this.getLedgerDerivationPathBasedOnType({ + fullBaseDerivationPath: baseDerivationPath, + index, + }) + const { address, publicKey } = await this.ledger.getAddress(path, 'inj') + + this.wallets.push({ + publicKey, + baseDerivationPath, + address: address.toLowerCase(), + derivationPath: path, + }) + } + } + + private hasWallets(): boolean { + return this.wallets.length > 0 + } + + private hasWalletsInOffset(offset: number): boolean { + return this.wallets.length > offset + } + + private getOffset(): { start: number; end: number } { + const totalWallets = this.wallets.length + const nextBatchStart = totalWallets + const nextBatchEnd = totalWallets + DEFAULT_NUM_ADDRESSES_TO_FETCH + + return { + start: nextBatchStart, + end: nextBatchEnd, + } + } + + hasWalletForAddress(address: AccountAddress): boolean { + return ( + this.wallets.find( + (wallet) => wallet.address.toLowerCase() === address.toLowerCase(), + ) !== undefined + ) + } + + async getWalletForAddress( + address: AccountAddress, + ): Promise { + return this.wallets.find( + (wallet) => wallet.address.toLowerCase() === address.toLowerCase(), + ) + } + + reset() { + this.wallets = [] + } +} diff --git a/packages/wallet-ts/src/strategies/wallet-strategy/strategies/LedgerCosmos/hw/index.ts b/packages/wallet-ts/src/strategies/wallet-strategy/strategies/LedgerCosmos/hw/index.ts new file mode 100644 index 000000000..d39b8e01c --- /dev/null +++ b/packages/wallet-ts/src/strategies/wallet-strategy/strategies/LedgerCosmos/hw/index.ts @@ -0,0 +1,54 @@ +import TransportWebUSB from '@ledgerhq/hw-transport-webusb' +import TransportWebHID from '@ledgerhq/hw-transport-webhid' +import CosmosApp from '@ledgerhq/hw-app-cosmos' +import type Transport from '@ledgerhq/hw-transport' +import { LedgerCosmosException } from '@injectivelabs/exceptions' +import AccountManager from './AccountManager' + +export default class LedgerTransport { + private ledger: CosmosApp | null = null + + private accountManager: AccountManager | null = null + + protected static async getTransport(): Promise { + try { + if (await TransportWebHID.isSupported()) { + return await TransportWebHID.create() + } + + if (await TransportWebUSB.isSupported()) { + return await TransportWebHID.create() + } + } catch (e: unknown) { + throw new LedgerCosmosException(new Error((e as any).message)) + } + + return await TransportWebHID.create() + } + + async getInstance(): Promise { + if (!this.ledger) { + this.ledger = new CosmosApp((await LedgerTransport.getTransport()) as any) + } + + return this.ledger + } + + async getAccountManager(): Promise { + if (!this.accountManager) { + this.accountManager = new AccountManager(await this.getInstance()) + } + + return this.accountManager + } + + async refresh() { + if (!this.ledger) { + return new LedgerTransport() + } + + this.ledger.transport.close() + + return new LedgerTransport() + } +} diff --git a/packages/wallet-ts/src/strategies/wallet-strategy/strategies/LedgerCosmos/index.ts b/packages/wallet-ts/src/strategies/wallet-strategy/strategies/LedgerCosmos/index.ts new file mode 100644 index 000000000..26a10f5ac --- /dev/null +++ b/packages/wallet-ts/src/strategies/wallet-strategy/strategies/LedgerCosmos/index.ts @@ -0,0 +1,294 @@ +/* eslint-disable class-methods-use-this */ +import { + ChainId, + AccountAddress, + EthereumChainId, +} from '@injectivelabs/ts-types' +import { + ErrorType, + LedgerCosmosException, + TransactionException, + UnspecifiedErrorCode, + WalletException, +} from '@injectivelabs/exceptions' +import { + TxRaw, + toUtf8, + TxGrpcApi, + TxResponse, + DirectSignResponse, + sortObjectByKeys, +} from '@injectivelabs/sdk-ts' +import { ConcreteWalletStrategy } from '../../../types' +import { LedgerWalletInfo } from '../../types' +import BaseConcreteStrategy from '../Base' +import { + DEFAULT_BASE_DERIVATION_PATH, + DEFAULT_ADDRESS_SEARCH_LIMIT, + DEFAULT_NUM_ADDRESSES_TO_FETCH, +} from '../../constants' +import LedgerHW from './hw' +import { WalletAction, WalletDeviceType } from '../../../../types/enums' +import { CosmosWalletException } from '@injectivelabs/exceptions' + +export default class LedgerCosmos + extends BaseConcreteStrategy + implements ConcreteWalletStrategy +{ + private baseDerivationPath: string + + private ledger: LedgerHW + + constructor(args: { chainId: ChainId }) { + super(args) + + this.baseDerivationPath = DEFAULT_BASE_DERIVATION_PATH + this.ledger = new LedgerHW() + } + + async getWalletDeviceType(): Promise { + return Promise.resolve(WalletDeviceType.Hardware) + } + + async enable(): Promise { + return Promise.resolve(true) + } + + public async disconnect() { + this.ledger = await this.ledger.refresh() + } + + public async getAddresses(): Promise { + const { baseDerivationPath } = this + + try { + const accountManager = await this.ledger.getAccountManager() + const wallets = await accountManager.getWallets(baseDerivationPath) + + return wallets.map((k) => k.address) + } catch (e: unknown) { + throw new LedgerCosmosException(new Error((e as any).message), { + code: UnspecifiedErrorCode, + type: ErrorType.WalletError, + contextModule: WalletAction.GetAccounts, + }) + } + } + + async confirm(address: AccountAddress): Promise { + return Promise.resolve( + `0x${Buffer.from( + `Confirmation for ${address} at time: ${Date.now()}`, + ).toString('hex')}`, + ) + } + + async sendEthereumTransaction( + _txData: any, + _options: { + address: string + ethereumChainId: EthereumChainId + }, + ): Promise { + throw new CosmosWalletException( + new Error( + 'sendEthereumTransaction is not supported. LedgerCosmos only supports sending cosmos transactions', + ), + { + code: UnspecifiedErrorCode, + context: WalletAction.SendEthereumTransaction, + }, + ) + } + + async sendTransaction( + transaction: TxRaw, + options: { + address: AccountAddress + chainId: ChainId + endpoints?: { + rest: string + grpc: string + tm?: string + } + }, + ): Promise { + const { endpoints } = options + + if (!endpoints) { + throw new WalletException( + new Error( + 'You have to pass endpoints.grpc within the options for using LedgerCosmos wallet', + ), + ) + } + + const txApi = new TxGrpcApi(endpoints.grpc) + const response = await txApi.broadcast(transaction) + + if (response.code !== 0) { + throw new TransactionException(new Error(response.rawLog), { + code: UnspecifiedErrorCode, + contextCode: response.code, + contextModule: response.codespace, + }) + } + + return response + } + + /** @deprecated */ + async signTransaction( + transaction: { txRaw: TxRaw; accountNumber: number; chainId: string }, + injectiveAddress: AccountAddress, + ): Promise { + return this.signCosmosTransaction({ + ...transaction, + address: injectiveAddress, + }) + } + + async signAminoCosmosTransaction(transaction: { + signDoc: any + accountNumber: number + chainId: string + address: string + }): Promise { + try { + const { derivationPath } = await this.getWalletForAddress( + transaction.address, + ) + const ledger = await this.ledger.getInstance() + + const result = await ledger.sign( + derivationPath, + JSON.stringify(sortObjectByKeys(transaction.signDoc)), + ) + + return Buffer.from(result.signature!).toString('base64') + } catch (e: unknown) { + throw new LedgerCosmosException(new Error((e as any).message), { + code: UnspecifiedErrorCode, + type: ErrorType.WalletError, + contextModule: WalletAction.SignTransaction, + }) + } + } + + async signCosmosTransaction(_transaction: { + txRaw: TxRaw + accountNumber: number + chainId: string + address: string + }): Promise { + throw new CosmosWalletException( + new Error('This wallet does not support signing using direct sign'), + { + code: UnspecifiedErrorCode, + context: WalletAction.SendTransaction, + }, + ) + } + + async signEip712TypedData( + _eip712Json: string, + _address: AccountAddress, + ): Promise { + throw new CosmosWalletException( + new Error('This wallet does not support signing Ethereum transactions'), + { + code: UnspecifiedErrorCode, + context: WalletAction.SendTransaction, + }, + ) + } + + async signArbitrary( + signer: AccountAddress, + data: string | Uint8Array, + ): Promise { + try { + const { derivationPath } = await this.getWalletForAddress(signer) + + const ledger = await this.ledger.getInstance() + const result = await ledger.sign(derivationPath, toUtf8(data)) + + return Buffer.from(result.signature!).toString('base64') + } catch (e: unknown) { + throw new LedgerCosmosException(new Error((e as any).message), { + code: UnspecifiedErrorCode, + type: ErrorType.WalletError, + contextModule: WalletAction.SignTransaction, + }) + } + } + + async getEthereumChainId(): Promise { + throw new CosmosWalletException( + new Error('getEthereumChainId is not supported on Keplr'), + { + code: UnspecifiedErrorCode, + context: WalletAction.GetChainId, + }, + ) + } + + async getEthereumTransactionReceipt(_txHash: string): Promise { + throw new CosmosWalletException( + new Error('getEthereumTransactionReceipt is not supported on Keplr'), + { + code: UnspecifiedErrorCode, + context: WalletAction.GetEthereumTransactionReceipt, + }, + ) + } + + async getPubKey(address?: string): Promise { + if (!address) { + throw new WalletException( + new Error('You can only fetch PubKey corresponding to an address'), + ) + } + + const ledgerWalletInfo = await this.getWalletForAddress(address) + + return Buffer.from(ledgerWalletInfo.publicKey || '', 'hex').toString( + 'base64', + ) + } + + private async getWalletForAddress( + address: string, + ): Promise { + try { + const { baseDerivationPath } = this + const accountManager = await this.ledger.getAccountManager() + + if (!accountManager.hasWalletForAddress(address)) { + for ( + let i = 0; + i < DEFAULT_ADDRESS_SEARCH_LIMIT / DEFAULT_NUM_ADDRESSES_TO_FETCH; + i += 1 + ) { + await accountManager.getWallets(baseDerivationPath) + + if (accountManager.hasWalletForAddress(address)) { + return (await accountManager.getWalletForAddress( + address, + )) as LedgerWalletInfo + } + } + } + + return (await accountManager.getWalletForAddress( + address, + )) as LedgerWalletInfo + } catch (e) { + throw new LedgerCosmosException(new Error((e as any).message), { + code: UnspecifiedErrorCode, + type: ErrorType.WalletError, + contextModule: WalletAction.GetAccounts, + }) + } + } +} diff --git a/packages/wallet-ts/src/strategies/wallet-strategy/strategies/Metamask/index.ts b/packages/wallet-ts/src/strategies/wallet-strategy/strategies/Metamask/index.ts index 3e0c14f97..453f6f8e5 100644 --- a/packages/wallet-ts/src/strategies/wallet-strategy/strategies/Metamask/index.ts +++ b/packages/wallet-ts/src/strategies/wallet-strategy/strategies/Metamask/index.ts @@ -23,10 +23,7 @@ import BaseConcreteStrategy from '../Base' import { WalletAction, WalletDeviceType } from '../../../../types/enums' import { getMetamaskProvider } from './utils' -export default class Metamask - extends BaseConcreteStrategy - implements ConcreteWalletStrategy -{ +export default class Metamask extends BaseConcreteStrategy implements ConcreteWalletStrategy { constructor(args: EthereumWalletStrategyArgs) { super(args) } @@ -35,6 +32,10 @@ export default class Metamask return Promise.resolve(WalletDeviceType.Browser) } + async enable(): Promise { + return Promise.resolve(true) + } + async getAddresses(): Promise { const ethereum = await this.getEthereum() @@ -144,6 +145,22 @@ export default class Metamask } } + async signAminoCosmosTransaction(_transaction: { + signDoc: any + accountNumber: number + chainId: string + address: string + }): Promise { + throw new WalletException( + new Error('This wallet does not support signing Cosmos transactions'), + { + code: UnspecifiedErrorCode, + type: ErrorType.WalletError, + contextModule: WalletAction.SendTransaction, + }, + ) + } + // eslint-disable-next-line class-methods-use-this async signCosmosTransaction(_transaction: { txRaw: TxRaw diff --git a/packages/wallet-ts/src/strategies/wallet-strategy/strategies/Ninji.ts b/packages/wallet-ts/src/strategies/wallet-strategy/strategies/Ninji.ts new file mode 100644 index 000000000..03067df09 --- /dev/null +++ b/packages/wallet-ts/src/strategies/wallet-strategy/strategies/Ninji.ts @@ -0,0 +1,240 @@ +/* eslint-disable class-methods-use-this */ +import { + ChainId, + CosmosChainId, + AccountAddress, + EthereumChainId, +} from '@injectivelabs/ts-types' +import { + ErrorType, + UnspecifiedErrorCode, + CosmosWalletException, + TransactionException, +} from '@injectivelabs/exceptions' +import { + TxRaw, + TxResponse, + createTxRawFromSigResponse, + createCosmosSignDocFromSignDoc, + createSignDocFromTransaction, +} from '@injectivelabs/sdk-ts' +import type { DirectSignResponse } from '@cosmjs/proto-signing' +import { NinjiWallet } from '../../../utils/wallets/ninji' +import { ConcreteWalletStrategy } from '../../types' +import BaseConcreteStrategy from './Base' +import { WalletAction, WalletDeviceType } from '../../../types/enums' + +export default class Ninji extends BaseConcreteStrategy implements ConcreteWalletStrategy { + private ninjiWallet: NinjiWallet + + constructor(args: { + chainId: ChainId + endpoints?: { rest: string; rpc: string } + }) { + super(args) + this.chainId = args.chainId || CosmosChainId.Injective + this.ninjiWallet = new NinjiWallet(args.chainId, args.endpoints) + } + + async getWalletDeviceType(): Promise { + return Promise.resolve(WalletDeviceType.Browser) + } + + async enable(): Promise { + const ninjiWallet = this.getNinjiWallet() + + return await ninjiWallet.checkChainIdSupport() + } + + async getAddresses(): Promise { + const ninjiWallet = this.getNinjiWallet() + + try { + const accounts = await ninjiWallet.getAccounts() + + return accounts.map((account) => account.address) + } catch (e: unknown) { + throw new CosmosWalletException(new Error((e as any).message), { + code: UnspecifiedErrorCode, + context: WalletAction.GetAccounts, + }) + } + } + + async confirm(address: AccountAddress): Promise { + return Promise.resolve( + `0x${Buffer.from( + `Confirmation for ${address} at time: ${Date.now()}`, + ).toString('hex')}`, + ) + } + + // eslint-disable-next-line class-methods-use-this + async sendEthereumTransaction( + _transaction: unknown, + _options: { address: AccountAddress; ethereumChainId: EthereumChainId }, + ): Promise { + throw new CosmosWalletException( + new Error( + 'sendEthereumTransaction is not supported. Ninji only supports sending cosmos transactions', + ), + { + code: UnspecifiedErrorCode, + context: WalletAction.SendEthereumTransaction, + }, + ) + } + + async sendTransaction( + transaction: DirectSignResponse | TxRaw, + options: { + address: AccountAddress + chainId: ChainId + endpoints?: { grpc: string } + }, + ): Promise { + const { ninjiWallet } = this + const txRaw = createTxRawFromSigResponse(transaction) + + try { + return await ninjiWallet.waitTxBroadcasted( + await ninjiWallet.broadcastTx(txRaw), + options.endpoints?.grpc, + ) + } catch (e: unknown) { + if (e instanceof TransactionException) { + throw e + } + + throw new TransactionException(new Error((e as any).message), { + code: UnspecifiedErrorCode, + context: WalletAction.SendTransaction, + }) + } + } + + /** @deprecated */ + async signTransaction( + transaction: { txRaw: TxRaw; accountNumber: number; chainId: string }, + injectiveAddress: AccountAddress, + ) { + return this.signCosmosTransaction({ + ...transaction, + address: injectiveAddress, + }) + } + + async signAminoCosmosTransaction(_transaction: { + signDoc: any + accountNumber: number + chainId: string + address: string + }): Promise { + throw new CosmosWalletException( + new Error('This wallet does not support signing using amino'), + { + code: UnspecifiedErrorCode, + context: WalletAction.SendTransaction, + }, + ) + } + + async signCosmosTransaction(transaction: { + txRaw: TxRaw + accountNumber: number + chainId: string + address: AccountAddress + }) { + const ninjiWallet = this.getNinjiWallet() + const signer = await ninjiWallet.getOfflineSigner() + const signDoc = createSignDocFromTransaction(transaction) + + try { + return await signer.signDirect( + transaction.address, + createCosmosSignDocFromSignDoc(signDoc), + ) + } catch (e: unknown) { + throw new CosmosWalletException(new Error((e as any).message), { + code: UnspecifiedErrorCode, + context: WalletAction.SendTransaction, + }) + } + } + + async signArbitrary( + signer: string, + data: string | Uint8Array, + ): Promise { + const ninjiWallet = this.getNinjiWallet() + const ninji = await ninjiWallet.getNinjiWallet() + + try { + const signature = await ninji.signArbitrary(this.chainId, signer, data) + + return signature.signature + } catch (e: unknown) { + throw new CosmosWalletException(new Error((e as any).message), { + code: UnspecifiedErrorCode, + context: WalletAction.SignArbitrary, + }) + } + } + + async signEip712TypedData( + _eip712TypedData: string, + _address: AccountAddress, + ): Promise { + throw new CosmosWalletException( + new Error('This wallet does not support signing Ethereum transactions'), + { + code: UnspecifiedErrorCode, + context: WalletAction.SendTransaction, + }, + ) + } + + async getEthereumChainId(): Promise { + throw new CosmosWalletException( + new Error('getEthereumChainId is not supported on Ninji'), + { + code: UnspecifiedErrorCode, + context: WalletAction.GetChainId, + }, + ) + } + + async getEthereumTransactionReceipt(_txHash: string): Promise { + throw new CosmosWalletException( + new Error('getEthereumTransactionReceipt is not supported on Ninji'), + { + code: UnspecifiedErrorCode, + context: WalletAction.GetEthereumTransactionReceipt, + }, + ) + } + + async getPubKey(): Promise { + const keplrWallet = this.getNinjiWallet() + const key = await keplrWallet.getKey() + + return Buffer.from(key.pubKey).toString('base64') + } + + private getNinjiWallet(): NinjiWallet { + const { ninjiWallet } = this + + if (!ninjiWallet) { + throw new CosmosWalletException( + new Error('Please install the Ninji wallet extension'), + { + code: UnspecifiedErrorCode, + type: ErrorType.WalletNotInstalledError, + context: WalletAction.SignTransaction, + }, + ) + } + + return ninjiWallet + } +} diff --git a/packages/wallet-ts/src/strategies/wallet-strategy/strategies/Phantom/index.ts b/packages/wallet-ts/src/strategies/wallet-strategy/strategies/Phantom/index.ts new file mode 100644 index 000000000..5c30abd0b --- /dev/null +++ b/packages/wallet-ts/src/strategies/wallet-strategy/strategies/Phantom/index.ts @@ -0,0 +1,292 @@ +/* eslint-disable class-methods-use-this */ +import { sleep } from '@injectivelabs/utils' +import { + ChainId, + AccountAddress, + EthereumChainId, +} from '@injectivelabs/ts-types' +import { + ErrorType, + WalletException, + MetamaskException, + UnspecifiedErrorCode, + TransactionException, +} from '@injectivelabs/exceptions' +import { DirectSignResponse } from '@cosmjs/proto-signing' +import { TxRaw, toUtf8, TxGrpcApi, TxResponse } from '@injectivelabs/sdk-ts' +import { + ConcreteWalletStrategy, + EthereumWalletStrategyArgs, +} from '../../../types' +import { BrowserEip1993Provider } from '../../types' +import BaseConcreteStrategy from '../Base' +import { WalletAction, WalletDeviceType } from '../../../../types/enums' +import { getPhantomProvider } from './utils' + +export default class Phantom + extends BaseConcreteStrategy + implements ConcreteWalletStrategy +{ + constructor(args: EthereumWalletStrategyArgs) { + super(args) + } + + async getWalletDeviceType(): Promise { + return Promise.resolve(WalletDeviceType.Browser) + } + + async enable(): Promise { + return Promise.resolve(true) + } + + async getAddresses(): Promise { + const ethereum = await this.getEthereum() + + try { + return await ethereum.request({ + method: 'eth_requestAccounts', + }) + } catch (e: unknown) { + throw new MetamaskException(new Error((e as any).message), { + code: UnspecifiedErrorCode, + type: ErrorType.WalletError, + contextModule: WalletAction.GetAccounts, + }) + } + } + + // eslint-disable-next-line class-methods-use-this + async confirm(address: AccountAddress): Promise { + return Promise.resolve( + `0x${Buffer.from( + `Confirmation for ${address} at time: ${Date.now()}`, + ).toString('hex')}`, + ) + } + + async sendEthereumTransaction( + transaction: unknown, + _options: { address: AccountAddress; ethereumChainId: EthereumChainId }, + ): Promise { + const ethereum = await this.getEthereum() + + try { + return await ethereum.request({ + method: 'eth_sendTransaction', + params: [transaction], + }) + } catch (e: unknown) { + throw new MetamaskException(new Error((e as any).message), { + code: UnspecifiedErrorCode, + type: ErrorType.WalletError, + contextModule: WalletAction.SendEthereumTransaction, + }) + } + } + + async sendTransaction( + transaction: TxRaw, + options: { + address: AccountAddress + chainId: ChainId + endpoints?: { + rest: string + grpc: string + tm?: string + } + }, + ): Promise { + const { endpoints } = options + + if (!endpoints) { + throw new WalletException( + new Error( + 'You have to pass endpoints within the options for using Ethereum native wallets', + ), + ) + } + + const txApi = new TxGrpcApi(endpoints.grpc) + const response = await txApi.broadcast(transaction) + + if (response.code !== 0) { + throw new TransactionException(new Error(response.rawLog), { + code: UnspecifiedErrorCode, + contextCode: response.code, + contextModule: response.codespace, + }) + } + + return response + } + + /** @deprecated */ + async signTransaction( + eip712json: string, + address: AccountAddress, + ): Promise { + return this.signEip712TypedData(eip712json, address) + } + + async signEip712TypedData( + eip712json: string, + address: AccountAddress, + ): Promise { + const ethereum = await this.getEthereum() + + try { + return await ethereum.request({ + method: 'eth_signTypedData_v4', + params: [address.toUpperCase(), eip712json], + }) + } catch (e: unknown) { + throw new MetamaskException(new Error((e as any).message), { + code: UnspecifiedErrorCode, + type: ErrorType.WalletError, + contextModule: WalletAction.SignTransaction, + }) + } + } + + async signAminoCosmosTransaction(_transaction: { + signDoc: any + accountNumber: number + chainId: string + address: string + }): Promise { + throw new WalletException( + new Error('This wallet does not support signing Cosmos transactions'), + { + code: UnspecifiedErrorCode, + type: ErrorType.WalletError, + contextModule: WalletAction.SendTransaction, + }, + ) + } + + // eslint-disable-next-line class-methods-use-this + async signCosmosTransaction(_transaction: { + txRaw: TxRaw + accountNumber: number + chainId: string + address: string + }): Promise { + throw new WalletException( + new Error('This wallet does not support signing Cosmos transactions'), + { + code: UnspecifiedErrorCode, + type: ErrorType.WalletError, + contextModule: WalletAction.SendTransaction, + }, + ) + } + + async signArbitrary( + signer: AccountAddress, + data: string | Uint8Array, + ): Promise { + const ethereum = await this.getEthereum() + + try { + const signature = await ethereum.request({ + method: 'personal_sign', + params: [toUtf8(data), signer], + }) + + return signature + } catch (e: unknown) { + throw new MetamaskException(new Error((e as any).message), { + code: UnspecifiedErrorCode, + type: ErrorType.WalletError, + contextModule: WalletAction.SignArbitrary, + }) + } + } + + async getEthereumChainId(): Promise { + const ethereum = await this.getEthereum() + + try { + return ethereum.request({ method: 'eth_chainId' }) + } catch (e: unknown) { + throw new MetamaskException(new Error((e as any).message), { + code: UnspecifiedErrorCode, + type: ErrorType.WalletError, + contextModule: WalletAction.GetChainId, + }) + } + } + + async getEthereumTransactionReceipt(txHash: string): Promise { + const ethereum = await this.getEthereum() + + const interval = 1000 + const transactionReceiptRetry = async () => { + const receipt = await ethereum.request({ + method: 'eth_getTransactionReceipt', + params: [txHash], + }) + + if (!receipt) { + await sleep(interval) + await transactionReceiptRetry() + } + + return receipt + } + + try { + return await transactionReceiptRetry() + } catch (e: unknown) { + throw new MetamaskException(new Error((e as any).message), { + code: UnspecifiedErrorCode, + type: ErrorType.WalletError, + contextModule: WalletAction.GetEthereumTransactionReceipt, + }) + } + } + + // eslint-disable-next-line class-methods-use-this + async getPubKey(): Promise { + throw new WalletException( + new Error('You can only fetch PubKey from Cosmos native wallets'), + ) + } + + onChainIdChanged(_callback: () => void): void { + // + } + + onAccountChange(_callback: (account: AccountAddress) => void): void { + // + } + + cancelOnChainIdChange(): void { + // + } + + cancelOnAccountChange(): void { + // + } + + cancelAllEvents(): void { + // + } + + private async getEthereum(): Promise { + const provider = await getPhantomProvider() + + if (!provider) { + throw new MetamaskException( + new Error('Please install the Phantom wallet extension.'), + { + code: UnspecifiedErrorCode, + type: ErrorType.WalletNotInstalledError, + contextModule: WalletAction.GetAccounts, + }, + ) + } + + return provider + } +} diff --git a/packages/wallet-ts/src/strategies/wallet-strategy/strategies/Phantom/utils.ts b/packages/wallet-ts/src/strategies/wallet-strategy/strategies/Phantom/utils.ts new file mode 100644 index 000000000..dbd7b66ef --- /dev/null +++ b/packages/wallet-ts/src/strategies/wallet-strategy/strategies/Phantom/utils.ts @@ -0,0 +1,60 @@ +import { isServerSide } from '@injectivelabs/sdk-ts' +import { BrowserEip1993Provider, WindowWithEip1193Provider } from '../../types' + +const $window = (isServerSide() + ? {} + : window) as unknown as WindowWithEip1193Provider + +export async function getPhantomProvider({ timeout } = { timeout: 3000 }) { + const provider = getPhantomFromWindow() + + if (provider) { + return provider + } + + return listenForPhantomInitialized({ + timeout, + }) as Promise +} + +async function listenForPhantomInitialized({ timeout } = { timeout: 3000 }) { + return new Promise((resolve) => { + const handleInitialization = () => { + resolve(getPhantomFromWindow()) + } + + $window.addEventListener('ethereum#initialized', handleInitialization, { + once: true, + }) + + setTimeout(() => { + $window.removeEventListener('ethereum#initialized', handleInitialization) + resolve(null) + }, timeout) + }) +} + +function getPhantomFromWindow() { + const injectedProviderExist = + typeof window !== 'undefined' && + typeof $window.phantom?.ethereum !== 'undefined' + + // No injected providers exist. + if (!injectedProviderExist) { + return + } + + if ($window.phantom?.ethereum) { + return $window.phantom.ethereum + } + + if ($window.ethereum.isPhantom) { + return $window.ethereum + } + + if ($window.providers) { + return $window.providers.find((p) => p.isPhantom) + } + + return +} diff --git a/packages/wallet-ts/src/strategies/wallet-strategy/strategies/Torus.ts b/packages/wallet-ts/src/strategies/wallet-strategy/strategies/Torus.ts index 3d22ff439..e53dd9afd 100644 --- a/packages/wallet-ts/src/strategies/wallet-strategy/strategies/Torus.ts +++ b/packages/wallet-ts/src/strategies/wallet-strategy/strategies/Torus.ts @@ -42,10 +42,7 @@ export const getNetworkFromChainId = ( } } -export default class Torus - extends BaseConcreteStrategy - implements ConcreteWalletStrategy -{ +export default class Torus extends BaseConcreteStrategy implements ConcreteWalletStrategy { private torus: TorusWallet private connected = false @@ -59,6 +56,10 @@ export default class Torus return Promise.resolve(WalletDeviceType.Browser) } + async enable(): Promise { + return Promise.resolve(true) + } + async connect(): Promise { const { connected, torus, ethereumChainId } = this @@ -227,6 +228,22 @@ export default class Torus } } + async signAminoCosmosTransaction(_transaction: { + signDoc: any + accountNumber: number + chainId: string + address: string + }): Promise { + throw new WalletException( + new Error('This wallet does not support signing Cosmos transactions'), + { + code: UnspecifiedErrorCode, + type: ErrorType.WalletError, + contextModule: WalletAction.SendTransaction, + }, + ) + } + // eslint-disable-next-line class-methods-use-this async signCosmosTransaction(_transaction: { txRaw: TxRaw diff --git a/packages/wallet-ts/src/strategies/wallet-strategy/strategies/Trezor/hw/AccountManager.ts b/packages/wallet-ts/src/strategies/wallet-strategy/strategies/Trezor/hw/AccountManager.ts index ff44ef44c..1492fd4ea 100644 --- a/packages/wallet-ts/src/strategies/wallet-strategy/strategies/Trezor/hw/AccountManager.ts +++ b/packages/wallet-ts/src/strategies/wallet-strategy/strategies/Trezor/hw/AccountManager.ts @@ -101,4 +101,8 @@ export default class AccountManager { (wallet) => wallet.address.toLowerCase() === address.toLowerCase(), ) } + + reset() { + this.wallets = [] + } } diff --git a/packages/wallet-ts/src/strategies/wallet-strategy/strategies/Trezor/index.ts b/packages/wallet-ts/src/strategies/wallet-strategy/strategies/Trezor/index.ts index 1c13dcfc2..f2207a6f0 100644 --- a/packages/wallet-ts/src/strategies/wallet-strategy/strategies/Trezor/index.ts +++ b/packages/wallet-ts/src/strategies/wallet-strategy/strategies/Trezor/index.ts @@ -81,6 +81,14 @@ export default class Trezor return Promise.resolve(WalletDeviceType.Hardware) } + async enable(): Promise { + return Promise.resolve(true) + } + + public async disconnect() { + this.trezor = new TrezorHW() + } + public async getAddresses(): Promise { try { await this.trezor.connect() @@ -230,6 +238,22 @@ export default class Trezor } } + async signAminoCosmosTransaction(_transaction: { + signDoc: any + accountNumber: number + chainId: string + address: string + }): Promise { + throw new WalletException( + new Error('This wallet does not support signing Cosmos transactions'), + { + code: UnspecifiedErrorCode, + type: ErrorType.WalletError, + contextModule: WalletAction.SendTransaction, + }, + ) + } + // eslint-disable-next-line class-methods-use-this async signCosmosTransaction(_transaction: { txRaw: TxRaw diff --git a/packages/wallet-ts/src/strategies/wallet-strategy/strategies/TrustWallet/index.ts b/packages/wallet-ts/src/strategies/wallet-strategy/strategies/TrustWallet/index.ts index 983662f18..d49fe2075 100644 --- a/packages/wallet-ts/src/strategies/wallet-strategy/strategies/TrustWallet/index.ts +++ b/packages/wallet-ts/src/strategies/wallet-strategy/strategies/TrustWallet/index.ts @@ -35,6 +35,10 @@ export default class TrustWallet return Promise.resolve(WalletDeviceType.Browser) } + async enable(): Promise { + return Promise.resolve(true) + } + async getAddresses(): Promise { const ethereum = await this.getEthereum() @@ -144,6 +148,22 @@ export default class TrustWallet } } + async signAminoCosmosTransaction(_transaction: { + signDoc: any + accountNumber: number + chainId: string + address: string + }): Promise { + throw new WalletException( + new Error('This wallet does not support signing Cosmos transactions'), + { + code: UnspecifiedErrorCode, + type: ErrorType.WalletError, + contextModule: WalletAction.SendTransaction, + }, + ) + } + // eslint-disable-next-line class-methods-use-this async signCosmosTransaction(_transaction: { txRaw: TxRaw diff --git a/packages/wallet-ts/src/strategies/wallet-strategy/types.ts b/packages/wallet-ts/src/strategies/wallet-strategy/types.ts index 3c8aeaf8c..89da6d042 100644 --- a/packages/wallet-ts/src/strategies/wallet-strategy/types.ts +++ b/packages/wallet-ts/src/strategies/wallet-strategy/types.ts @@ -5,12 +5,14 @@ export interface BrowserEip1993Provider extends Eip1993Provider { removeAllListeners(): void isMetaMask: boolean isTrust: boolean + isPhantom: boolean } export interface WindowWithEip1193Provider extends Window { ethereum: BrowserEip1993Provider providers: BrowserEip1993Provider[] trustWallet?: BrowserEip1993Provider + phantom?: { ethereum?: BrowserEip1993Provider } } export interface WindowWithLedgerSupport extends Window { @@ -21,7 +23,8 @@ export interface LedgerWalletInfo { address: string baseDerivationPath: string derivationPath: string - hdKey: HDNode + hdKey?: HDNode + publicKey?: string } export interface TrezorWalletInfo { diff --git a/packages/wallet-ts/src/strategies/wallet-strategy/utils.ts b/packages/wallet-ts/src/strategies/wallet-strategy/utils.ts index 74f39cd52..8f55cc256 100644 --- a/packages/wallet-ts/src/strategies/wallet-strategy/utils.ts +++ b/packages/wallet-ts/src/strategies/wallet-strategy/utils.ts @@ -6,6 +6,10 @@ export const isEthWallet = (wallet: Wallet): boolean => Wallet.Torus, Wallet.Ledger, Wallet.Metamask, + Wallet.Phantom, + Wallet.LedgerLegacy, Wallet.TrustWallet, Wallet.CosmostationEth, ].includes(wallet) + +export const isCosmosWallet = (wallet: Wallet): boolean => !isEthWallet(wallet) diff --git a/packages/wallet-ts/src/types/enums.ts b/packages/wallet-ts/src/types/enums.ts index ed80364fb..06d02ecab 100644 --- a/packages/wallet-ts/src/types/enums.ts +++ b/packages/wallet-ts/src/types/enums.ts @@ -3,9 +3,11 @@ import { WalletErrorActionModule } from '@injectivelabs/exceptions' export enum Wallet { Leap = 'leap', Keplr = 'keplr', + Ninji = 'ninji', Torus = 'torus', Ledger = 'ledger', Trezor = 'trezor', + Phantom = 'phantom', Metamask = 'metamask', TrustWallet = 'trust-wallet', Cosmostation = 'cosmostation', diff --git a/packages/wallet-ts/src/utils/wallets/cosmos/endpoints.ts b/packages/wallet-ts/src/utils/wallets/cosmos/endpoints.ts index 57f2ebd51..53cae5a6f 100644 --- a/packages/wallet-ts/src/utils/wallets/cosmos/endpoints.ts +++ b/packages/wallet-ts/src/utils/wallets/cosmos/endpoints.ts @@ -108,8 +108,8 @@ export const getEndpointsFromChainId = ( } case TestnetCosmosChainId.Cosmoshub: return { - rpc: 'https://testnet.tm.cosmos.injective.dev', - rest: 'https://testnet.lcd.cosmos.injective.dev', + rpc: 'https://rpc.sentry-01.theta-testnet.polypore.xyz', + rest: 'https://rest.sentry-01.theta-testnet.polypore.xyz', } case CosmosChainId.Noble: return { @@ -121,6 +121,16 @@ export const getEndpointsFromChainId = ( rpc: 'https://rpc.cosmos.directory/celestia', rest: 'https://rest.cosmos.directory/celestia', } + case CosmosChainId.Migaloo: + return { + rpc: 'https://rpc.cosmos.directory/migaloo', + rest: 'https://rest.cosmos.directory/migaloo', + } + case CosmosChainId.Kujira: + return { + rpc: 'https://rpc.cosmos.directory/kujira', + rest: 'https://rest.cosmos.directory/kujira', + } default: throw new GeneralException( new Error(`Endpoints for ${chainId} not found`), diff --git a/packages/wallet-ts/src/utils/wallets/cosmos/utils.ts b/packages/wallet-ts/src/utils/wallets/cosmos/utils.ts index 1dacb4fa0..3bbd45e87 100644 --- a/packages/wallet-ts/src/utils/wallets/cosmos/utils.ts +++ b/packages/wallet-ts/src/utils/wallets/cosmos/utils.ts @@ -25,19 +25,27 @@ export const makeTimeoutTimestampInNs = ( timeoutInMs: number = DEFAULT_TIMESTAMP_TIMEOUT_MS, ) => makeTimeoutTimestamp(timeoutInMs) * 1e6 -export const isCosmosWallet = (wallet: Wallet): boolean => - [Wallet.Cosmostation, Wallet.Leap, Wallet.Keplr].includes(wallet) +export const isCosmosBrowserWallet = (wallet: Wallet): boolean => + [Wallet.Leap, Wallet.Ninji, Wallet.Keplr, Wallet.Cosmostation].includes( + wallet, + ) + +export const isCosmosAminoOnlyWallet = (wallet: Wallet): boolean => + [Wallet.LedgerCosmos].includes(wallet) export const isCosmosWalletInstalled = (wallet: Wallet) => { const $window = (typeof window !== 'undefined' ? window : {}) as Window & { leap?: Keplr keplr?: Keplr + ninji?: Keplr cosmostation?: Cosmos } switch (wallet) { case Wallet.Keplr: return $window.keplr !== undefined + case Wallet.Ninji: + return $window.ninji !== undefined case Wallet.Cosmostation: return $window.cosmostation !== undefined case Wallet.Leap: diff --git a/packages/wallet-ts/src/utils/wallets/cosmostation/CosmostationWallet.ts b/packages/wallet-ts/src/utils/wallets/cosmostation/CosmostationWallet.ts new file mode 100644 index 000000000..2a1d48280 --- /dev/null +++ b/packages/wallet-ts/src/utils/wallets/cosmostation/CosmostationWallet.ts @@ -0,0 +1,67 @@ +import { cosmos, InstallError } from '@cosmostation/extension-client' +import { + ErrorType, + UnspecifiedErrorCode, + CosmosWalletException, +} from '@injectivelabs/exceptions' +import { + ChainId, + CosmosChainId, + TestnetCosmosChainId, +} from '@injectivelabs/ts-types' + +export class CosmostationWallet { + private chainId: CosmosChainId | TestnetCosmosChainId | ChainId + + constructor(chainId: CosmosChainId | TestnetCosmosChainId | ChainId) { + this.chainId = chainId + } + + static async isChainIdSupported(chainId: CosmosChainId): Promise { + return new CosmostationWallet(chainId).checkChainIdSupport() + } + + public async checkChainIdSupport() { + const { chainId: actualChainId } = this + const provider = await this.getCosmostationWallet() + const chainName = actualChainId.split('-') + + try { + const supportedChainIds = await provider.getSupportedChainIds() + + return !!supportedChainIds.official.find( + (chainId) => chainId === actualChainId, + ) + } catch (e) { + throw new CosmosWalletException( + new Error( + `Cosmostation doesn't support ${ + chainName[0] || actualChainId + } network. Please use another Cosmos wallet`, + ), + ) + } + } + + async getCosmostationWallet() { + try { + const provider = await cosmos() + + return provider + } catch (e) { + if (e instanceof InstallError) { + throw new CosmosWalletException( + new Error('Please install the Cosmostation extension'), + { + code: UnspecifiedErrorCode, + type: ErrorType.WalletNotInstalledError, + }, + ) + } + + throw new CosmosWalletException(new Error((e as any).message), { + code: UnspecifiedErrorCode, + }) + } + } +} diff --git a/packages/wallet-ts/src/utils/wallets/cosmostation/index.ts b/packages/wallet-ts/src/utils/wallets/cosmostation/index.ts new file mode 100644 index 000000000..97e2661ea --- /dev/null +++ b/packages/wallet-ts/src/utils/wallets/cosmostation/index.ts @@ -0,0 +1 @@ +export * from './CosmostationWallet' diff --git a/packages/wallet-ts/src/utils/wallets/index.ts b/packages/wallet-ts/src/utils/wallets/index.ts index 0676838f1..735517bfc 100644 --- a/packages/wallet-ts/src/utils/wallets/index.ts +++ b/packages/wallet-ts/src/utils/wallets/index.ts @@ -1,5 +1,7 @@ export * from './keplr' +export * from './cosmostation' export * from './leap' export * from './phantom' export * from './metamask' +export * from './ninji' export * from './trust-wallet' diff --git a/packages/wallet-ts/src/utils/wallets/keplr/KeplrWallet.ts b/packages/wallet-ts/src/utils/wallets/keplr/KeplrWallet.ts index ac915dab7..e06b4c15d 100644 --- a/packages/wallet-ts/src/utils/wallets/keplr/KeplrWallet.ts +++ b/packages/wallet-ts/src/utils/wallets/keplr/KeplrWallet.ts @@ -14,7 +14,7 @@ import { CosmosChainId, TestnetCosmosChainId, } from '@injectivelabs/ts-types' -import { TxRestApi, TxResponse } from '@injectivelabs/sdk-ts' +import { TxRestApi, TxGrpcApi, TxResponse } from '@injectivelabs/sdk-ts' import { ErrorType, CosmosWalletException, @@ -23,7 +23,6 @@ import { WalletErrorActionModule, GeneralException, } from '@injectivelabs/exceptions' -import { getExperimentalChainConfigBasedOnChainId } from './utils' import { getEndpointsFromChainId } from '../cosmos/endpoints' import { CosmosTxV1Beta1Tx } from '@injectivelabs/sdk-ts' @@ -42,19 +41,8 @@ export class KeplrWallet { this.endpoints = endpoints || getEndpointsFromChainId(chainId) } - public static async experimentalSuggestChainWithChainData(chainData: any) { - if (!$window || ($window && !$window.keplr)) { - throw new CosmosWalletException( - new Error('Please install Keplr extension'), - { code: UnspecifiedErrorCode, type: ErrorType.WalletNotInstalledError }, - ) - } - - try { - await $window.keplr!.experimentalSuggestChain(chainData) - } catch (e: unknown) { - throw new CosmosWalletException(new Error((e as any).message)) - } + static async isChainIdSupported(chainId: CosmosChainId): Promise { + return new KeplrWallet(chainId).checkChainIdSupport() } public async getKeplrWallet() { @@ -70,25 +58,17 @@ export class KeplrWallet { } } - public async experimentalSuggestChain() { + public async chainNotSupported() { const { chainId } = this - const keplr = this.getKeplr() - - const chainData = getExperimentalChainConfigBasedOnChainId(chainId) - - if (!chainData) { - throw new CosmosWalletException( - new Error( - `Keplr doesn't support ${chainId} chainId. Please use another wallet`, - ), - ) - } - - try { - await keplr.experimentalSuggestChain(chainData) - } catch (e: unknown) { - throw new CosmosWalletException(new Error((e as any).message)) - } + const chainName = chainId.split('-') + + throw new CosmosWalletException( + new Error( + `Keplr doesn't support ${ + chainName[0] || chainId + } network. Please use another Cosmos wallet`, + ), + ) } public async getAccounts() { @@ -234,7 +214,9 @@ export class KeplrWallet { txHash: string, endpoint?: string, ): Promise { - return new TxRestApi(endpoint || this.endpoints.rest).fetchTxPoll(txHash) + return endpoint + ? new TxGrpcApi(endpoint).fetchTxPoll(txHash) + : new TxRestApi(this.endpoints.rest).fetchTxPoll(txHash) } public async signAndBroadcastAminoUsingCosmjs( @@ -293,14 +275,18 @@ export class KeplrWallet { public async checkChainIdSupport() { const { chainId } = this const keplr = this.getKeplr() + const chainName = chainId.split('-') try { - await keplr.getKey(chainId) - - // Chain exists already on Keplr - return true + return !!(await keplr.getKey(chainId)) } catch (e) { - return false + throw new CosmosWalletException( + new Error( + `Keplr doesn't support ${ + chainName[0] || chainId + } network. Please use another Cosmos wallet`, + ), + ) } } diff --git a/packages/wallet-ts/src/utils/wallets/keplr/utils/experimental-chains.ts b/packages/wallet-ts/src/utils/wallets/keplr/utils/experimental-chains.ts deleted file mode 100644 index d269d13f2..000000000 --- a/packages/wallet-ts/src/utils/wallets/keplr/utils/experimental-chains.ts +++ /dev/null @@ -1,244 +0,0 @@ -import { Bech32Address } from '@keplr-wallet/cosmos' -import { - TestnetCosmosChainId, - DevnetCosmosChainId, - CosmosChainId, -} from '@injectivelabs/ts-types' -import { getEndpointsFromChainId } from '../../cosmos/endpoints' - -export const experimentalChainsConfig = { - [CosmosChainId.Injective]: { - ...getEndpointsFromChainId(CosmosChainId.Injective), - rpcConfig: undefined, - restConfig: undefined, - chainId: 'injective-1', - chainName: 'Injective v1.1', - stakeCurrency: { - coinDenom: 'INJ', - coinMinimalDenom: 'inj', - coinDecimals: 18, - coinGeckoId: 'injective-protocol', - }, - walletUrl: 'https://hub.injective.network/', - walletUrlForStaking: 'https://hub.injective.network/', - bip44: { - coinType: 60, - }, - bech32Config: Bech32Address.defaultBech32Config('inj'), - currencies: [ - { - coinDenom: 'INJ', - coinMinimalDenom: 'inj', - coinDecimals: 18, - coinGeckoId: 'injective-protocol', - }, - ], - feeCurrencies: [ - { - coinDenom: 'INJ', - coinMinimalDenom: 'inj', - coinDecimals: 18, - coinGeckoId: 'injective-protocol', - gasPriceStep: { - low: 5000000000, - average: 25000000000, - high: 50000000000, - }, - }, - ], - features: ['ibc-transfer', 'ibc-go', 'eth-address-gen', 'eth-key-sign'], - beta: true, - }, - [TestnetCosmosChainId.Cosmoshub]: { - ...getEndpointsFromChainId(TestnetCosmosChainId.Cosmoshub), - rpcConfig: undefined, - restConfig: undefined, - chainId: 'cosmoshub-testnet', - chainName: 'Cosmos Testnet', - stakeCurrency: { - coinDenom: 'UPHOTON', - coinMinimalDenom: 'uphoton', - coinDecimals: 6, - coinGeckoId: 'cosmos', - }, - walletUrl: 'https://wallet.keplr.app/#/cosmoshub/stake', - walletUrlForStaking: 'https://wallet.keplr.app/#/cosmoshub/stake', - bip44: { - coinType: 118, - }, - bech32Config: Bech32Address.defaultBech32Config('cosmos'), - currencies: [ - { - coinDenom: 'UPHOTON', - coinMinimalDenom: 'uphoton', - coinDecimals: 6, - coinGeckoId: 'cosmos', - }, - ], - feeCurrencies: [ - { - coinDenom: 'UPHOTON', - coinMinimalDenom: 'uphoton', - coinDecimals: 6, - coinGeckoId: 'cosmos', - }, - ], - coinType: 118, - features: ['ibc-transfer'], - }, - [TestnetCosmosChainId.Injective]: { - ...getEndpointsFromChainId(TestnetCosmosChainId.Injective), - rpcConfig: undefined, - restConfig: undefined, - chainId: 'injective-888', - chainName: 'Injective Testnet', - stakeCurrency: { - coinDenom: 'INJ', - coinMinimalDenom: 'inj', - coinDecimals: 18, - coinGeckoId: 'injective-protocol', - }, - walletUrl: 'https://hub.injective.dev/', - walletUrlForStaking: 'https://hub.injective.dev/', - bip44: { - coinType: 60, - }, - bech32Config: Bech32Address.defaultBech32Config('inj'), - currencies: [ - { - coinDenom: 'INJ', - coinMinimalDenom: 'inj', - coinDecimals: 18, - coinGeckoId: 'injective-protocol', - }, - ], - feeCurrencies: [ - { - coinDenom: 'INJ', - coinMinimalDenom: 'inj', - coinDecimals: 18, - coinGeckoId: 'injective-protocol', - gasPriceStep: { - low: 5000000000, - average: 25000000000, - high: 40000000000, - }, - }, - ], - coinType: 60, - features: ['ibc-transfer', 'ibc-go', 'eth-address-gen', 'eth-key-sign'], - }, - [DevnetCosmosChainId.Injective]: { - ...getEndpointsFromChainId(DevnetCosmosChainId.Injective), - rpcConfig: undefined, - restConfig: undefined, - chainId: 'injective-777', - chainName: 'Injective - Devnet', - stakeCurrency: { - coinDenom: 'INJ', - coinMinimalDenom: 'inj', - coinDecimals: 18, - coinGeckoId: 'injective-protocol', - }, - walletUrl: 'https://hub.injective.dev/', - walletUrlForStaking: 'https://hub.injective.dev/', - bip44: { - coinType: 60, - }, - bech32Config: Bech32Address.defaultBech32Config('inj'), - currencies: [ - { - coinDenom: 'INJ', - coinMinimalDenom: 'inj', - coinDecimals: 18, - coinGeckoId: 'injective-protocol', - }, - ], - feeCurrencies: [ - { - coinDenom: 'INJ', - coinMinimalDenom: 'inj', - coinDecimals: 18, - coinGeckoId: 'injective-protocol', - gasPriceStep: { - low: 5000000000, - average: 25000000000, - high: 40000000000, - }, - }, - ], - coinType: 60, - features: ['ibc-transfer', 'ibc-go', 'eth-address-gen', 'eth-key-sign'], - }, - [CosmosChainId.Oraichain]: { - ...getEndpointsFromChainId(CosmosChainId.Oraichain), - chainId: 'Oraichain', - chainName: 'Oraichain', - stakeCurrency: { - coinDenom: 'ORAI', - coinMinimalDenom: 'orai', - coinDecimals: 6, - coinGeckoId: 'oraichain-token', - coinImageUrl: - 'https://s2.coinmarketcap.com/static/img/coins/64x64/7533.png', - }, - bip44: { - coinType: 118, - }, - bech32Config: { - bech32PrefixAccAddr: 'orai', - bech32PrefixAccPub: 'oraipub', - bech32PrefixValAddr: 'oraivaloper', - bech32PrefixValPub: 'oraivaloperpub', - bech32PrefixConsAddr: 'oraivalcons', - bech32PrefixConsPub: 'oraivalconspub', - }, - currencies: [ - { - coinDenom: 'ORAI', - coinMinimalDenom: 'orai', - coinDecimals: 6, - coinGeckoId: 'oraichain-token', - coinImageUrl: - 'https://s2.coinmarketcap.com/static/img/coins/64x64/7533.png', - }, - { - coinDenom: 'AIRI', - coinMinimalDenom: - 'cw20:orai10ldgzued6zjp0mkqwsv2mux3ml50l97c74x8sg:aiRight Token', - coinDecimals: 6, - coinGeckoId: 'airight', - coinImageUrl: - 'https://s2.coinmarketcap.com/static/img/coins/64x64/11563.png', - }, - ], - feeCurrencies: [ - { - coinDenom: 'ORAI', - coinMinimalDenom: 'orai', - coinDecimals: 6, - coinGeckoId: 'oraichain-token', - coinImageUrl: - 'https://s2.coinmarketcap.com/static/img/coins/64x64/7533.png', - gasPriceStep: { - low: 0.003, - average: 0.005, - high: 0.007, - }, - }, - ], - walletUrlForStaking: 'https://scan.orai.io/validators', - features: [ - 'stargate', - 'no-legacy-stdTx', - 'ibc-transfer', - 'cosmwasm', - 'wasmd_0.24+', - ], - beta: true, - }, -} as Record - -export const getExperimentalChainConfigBasedOnChainId = ( - chainId: string, -): any | undefined => experimentalChainsConfig[chainId] diff --git a/packages/wallet-ts/src/utils/wallets/keplr/utils/index.ts b/packages/wallet-ts/src/utils/wallets/keplr/utils/index.ts index e7c739a93..b2a4c7512 100644 --- a/packages/wallet-ts/src/utils/wallets/keplr/utils/index.ts +++ b/packages/wallet-ts/src/utils/wallets/keplr/utils/index.ts @@ -1,2 +1 @@ -export * from './experimental-chains' export * from './helpers' diff --git a/packages/wallet-ts/src/utils/wallets/leap/LeapWallet.ts b/packages/wallet-ts/src/utils/wallets/leap/LeapWallet.ts index 2ae88ecd7..495be6002 100644 --- a/packages/wallet-ts/src/utils/wallets/leap/LeapWallet.ts +++ b/packages/wallet-ts/src/utils/wallets/leap/LeapWallet.ts @@ -7,7 +7,7 @@ import { CosmosChainId, TestnetCosmosChainId, } from '@injectivelabs/ts-types' -import { TxRestApi, TxResponse } from '@injectivelabs/sdk-ts' +import { TxGrpcApi, TxRestApi, TxResponse } from '@injectivelabs/sdk-ts' import { ErrorType, CosmosWalletException, @@ -35,6 +35,10 @@ export class LeapWallet { this.endpoints = endpoints || getEndpointsFromChainId(chainId) } + static async isChainIdSupported(chainId: CosmosChainId): Promise { + return new LeapWallet(chainId).checkChainIdSupport() + } + async getLeapWallet() { const { chainId } = this const leap = this.getLeap() @@ -173,20 +177,26 @@ export class LeapWallet { txHash: string, endpoint?: string, ): Promise { - return new TxRestApi(endpoint || this.endpoints.rest).fetchTxPoll(txHash) + return endpoint + ? new TxGrpcApi(endpoint).fetchTxPoll(txHash) + : new TxRestApi(this.endpoints.rest).fetchTxPoll(txHash) } - public checkChainIdSupport = async () => { + public async checkChainIdSupport() { const { chainId } = this const leap = this.getLeap() + const chainName = chainId.split('-') try { - await leap.getKey(chainId) - - // Chain exists already on Leap - return true + return !!(await leap.getKey(chainId)) } catch (e) { - return false + throw new CosmosWalletException( + new Error( + `Leap doesn't support ${ + chainName[0] || chainId + } network. Please use another Cosmos wallet`, + ), + ) } } diff --git a/packages/wallet-ts/src/utils/wallets/ninji/NinjiWallet.ts b/packages/wallet-ts/src/utils/wallets/ninji/NinjiWallet.ts new file mode 100644 index 000000000..8df7b45f2 --- /dev/null +++ b/packages/wallet-ts/src/utils/wallets/ninji/NinjiWallet.ts @@ -0,0 +1,228 @@ +/* eslint-disable class-methods-use-this */ +import type { Keplr as Ninji } from '@keplr-wallet/types' +import type { OfflineDirectSigner } from '@cosmjs/proto-signing' +import { BroadcastMode } from '@cosmjs/launchpad' +import { + ChainId, + CosmosChainId, + TestnetCosmosChainId, +} from '@injectivelabs/ts-types' +import { TxGrpcApi, TxRestApi, TxResponse } from '@injectivelabs/sdk-ts' +import { + ErrorType, + CosmosWalletException, + TransactionException, + UnspecifiedErrorCode, + WalletErrorActionModule, +} from '@injectivelabs/exceptions' +import { getEndpointsFromChainId } from '../cosmos/endpoints' +import { CosmosTxV1Beta1Tx } from '@injectivelabs/sdk-ts' + +const $window = (typeof window !== 'undefined' ? window : {}) as Window & { + ninji?: Ninji +} + +export class NinjiWallet { + private chainId: CosmosChainId | TestnetCosmosChainId | ChainId + + private endpoints: { rest: string; rpc?: string } + + constructor( + chainId: CosmosChainId | TestnetCosmosChainId | ChainId, + endpoints?: { rest: string; rpc?: string }, + ) { + this.chainId = chainId + this.endpoints = endpoints || getEndpointsFromChainId(chainId) + } + + static async isChainIdSupported(chainId: CosmosChainId): Promise { + return new NinjiWallet(chainId).checkChainIdSupport() + } + + async getNinjiWallet() { + const { chainId } = this + const ninji = this.getNinji() + + try { + await ninji.enable(chainId) + + return ninji as Ninji + } catch (e: unknown) { + throw new CosmosWalletException(new Error((e as any).message)) + } + } + + async getAccounts() { + const { chainId } = this + const ninji = this.getNinji() + + try { + return ninji.getOfflineSigner(chainId).getAccounts() + } catch (e: unknown) { + throw new CosmosWalletException(new Error((e as any).message), { + contextModule: WalletErrorActionModule.GetAccounts, + }) + } + } + + async getKey(): Promise<{ + name: string + algo: string + pubKey: Uint8Array + address: Uint8Array + bech32Address: string + }> { + const ninji = await this.getNinjiWallet() + + try { + return ninji.getKey(this.chainId) + } catch (e: unknown) { + throw new CosmosWalletException(new Error((e as any).message), { + contextModule: 'Ninji', + }) + } + } + + async getOfflineSigner(): Promise { + const { chainId } = this + const ninji = await this.getNinjiWallet() + + try { + return ninji.getOfflineSigner(chainId) as unknown as OfflineDirectSigner + } catch (e: unknown) { + throw new CosmosWalletException(new Error((e as any).message), { + contextModule: 'Ninji', + }) + } + } + + /** + * This method is used to broadcast a transaction to the network. + * Since it uses the `Sync` mode, it will not wait for the transaction to be included in a block, + * so we have to make sure the transaction is included in a block after its broadcasted + * + * @param txRaw - raw transaction to broadcast + * @returns tx hash + */ + async broadcastTx(txRaw: CosmosTxV1Beta1Tx.TxRaw): Promise { + const { chainId } = this + const ninji = await this.getNinjiWallet() + + try { + const result = await ninji.sendTx( + chainId, + CosmosTxV1Beta1Tx.TxRaw.encode(txRaw).finish(), + BroadcastMode.Sync, + ) + + if (!result || result.length === 0) { + throw new TransactionException( + new Error('Transaction failed to be broadcasted'), + { contextModule: 'Ninji' }, + ) + } + + return Buffer.from(result).toString('hex') + } catch (e) { + if (e instanceof TransactionException) { + throw e + } + + throw new CosmosWalletException(new Error((e as any).message), { + context: 'broadcast-tx', + contextModule: 'Ninji', + }) + } + } + + /** + * This method is used to broadcast a transaction to the network. + * Since it uses the `Block` mode, and it will wait for the transaction to be included in a block, + * + * @param txRaw - raw transaction to broadcast + * @returns tx hash + */ + async broadcastTxBlock(txRaw: CosmosTxV1Beta1Tx.TxRaw): Promise { + const { chainId } = this + const ninji = await this.getNinjiWallet() + + try { + const result = await ninji.sendTx( + chainId, + CosmosTxV1Beta1Tx.TxRaw.encode(txRaw).finish(), + BroadcastMode.Block, + ) + + if (!result || result.length === 0) { + throw new TransactionException( + new Error('Transaction failed to be broadcasted'), + { contextModule: 'Ninji' }, + ) + } + + return Buffer.from(result).toString('hex') + } catch (e) { + if (e instanceof TransactionException) { + throw e + } + + throw new CosmosWalletException(new Error((e as any).message), { + context: 'broadcast-tx', + contextModule: 'Ninji', + }) + } + } + + async waitTxBroadcasted( + txHash: string, + endpoint?: string, + ): Promise { + return endpoint + ? new TxGrpcApi(endpoint).fetchTxPoll(txHash) + : new TxRestApi(this.endpoints.rest).fetchTxPoll(txHash) + } + + public async checkChainIdSupport() { + const { chainId } = this + const ninji = this.getNinji() + const chainName = chainId.split('-') + + try { + return !!(await ninji.getKey(chainId)) + } catch (e) { + throw new CosmosWalletException( + new Error( + `Leap doesn't support ${ + chainName[0] || chainId + } network. Please use another Cosmos wallet`, + ), + ) + } + } + + private getNinji() { + if (!$window) { + throw new CosmosWalletException( + new Error('Please install Ninji extension'), + { + code: UnspecifiedErrorCode, + type: ErrorType.WalletNotInstalledError, + contextModule: 'Ninji', + }, + ) + } + + if (!$window.ninji) { + throw new CosmosWalletException( + new Error('Please install Ninji extension'), + { + code: UnspecifiedErrorCode, + type: ErrorType.WalletNotInstalledError, + contextModule: 'Ninji', + }, + ) + } + + return $window.ninji! as Ninji + } +} diff --git a/packages/wallet-ts/src/utils/wallets/ninji/index.ts b/packages/wallet-ts/src/utils/wallets/ninji/index.ts new file mode 100644 index 000000000..ba8360771 --- /dev/null +++ b/packages/wallet-ts/src/utils/wallets/ninji/index.ts @@ -0,0 +1 @@ +export * from './NinjiWallet' diff --git a/packages/wallet-ts/src/utils/wallets/ninji/leap.d.ts b/packages/wallet-ts/src/utils/wallets/ninji/leap.d.ts new file mode 100644 index 000000000..7f70fec47 --- /dev/null +++ b/packages/wallet-ts/src/utils/wallets/ninji/leap.d.ts @@ -0,0 +1,8 @@ +import type { Window as KeplrWindow } from '@keplr-wallet/types' + +declare global { + // eslint-disable-next-line @typescript-eslint/no-empty-interface + interface Window extends KeplrWindow { + ninji: KeplrWindow['ninji'] + } +} diff --git a/packages/wallet-ts/src/utils/wallets/phantom/index.ts b/packages/wallet-ts/src/utils/wallets/phantom/index.ts index 240c571fb..1fefb8c8e 100644 --- a/packages/wallet-ts/src/utils/wallets/phantom/index.ts +++ b/packages/wallet-ts/src/utils/wallets/phantom/index.ts @@ -1 +1,2 @@ export * from './PhantomWallet' +export * from './../../../strategies/wallet-strategy/strategies/Phantom/utils' diff --git a/yarn.lock b/yarn.lock index 404059d33..7a230a08f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -34,36 +34,41 @@ tslib "^2.3.0" zen-observable-ts "^1.2.5" -"@axelar-network/axelar-cgp-solidity@^4.3.0": - version "4.3.1" - resolved "https://registry.npmjs.org/@axelar-network/axelar-cgp-solidity/-/axelar-cgp-solidity-4.3.1.tgz#49877b2599083fdd4bda92d3eb0ccdfcfeff3785" - integrity sha512-efJsTvoGITUPr50PQc8fCwzT9JOJMnchW+WnXAivXaEm/mw2bcEAYX6dCcZn4j6tgFTAVZnYqrABItQwDaStag== - -"@axelar-network/axelarjs-sdk@^0.11.7": - version "0.11.8" - resolved "https://registry.npmjs.org/@axelar-network/axelarjs-sdk/-/axelarjs-sdk-0.11.8.tgz#870312ad5edcb81f0ffebe9fe143e14028b1ea53" - integrity sha512-KVORyvO0i8dH7I0BmmNumopDls/f0fgsCVKRUAvR+izcPGHOG/8u4RDkUOeBHaPWBRSJUHIXdeQSm7MIYvpwUw== - dependencies: - "@axelar-network/axelar-cgp-solidity" "^4.3.0" - "@axelar-network/axelarjs-types" "^0.24.0" - "@cosmjs/stargate" "^0.28.4" +"@axelar-network/axelar-cgp-solidity@^4.5.0": + version "4.5.0" + resolved "https://registry.npmjs.org/@axelar-network/axelar-cgp-solidity/-/axelar-cgp-solidity-4.5.0.tgz#f0456a2a6665302613a4d5243282ce1b18842348" + integrity sha512-4F4rmHei0cmzeUR7/mW4Bap5rc/KlPV2crD9HA7HTRfl15mVcN6/3z8p+pAm9We6bOrQplNW9KBZ3HJFP3C1Gw== + +"@axelar-network/axelarjs-sdk@0.13.6": + version "0.13.6" + resolved "https://registry.npmjs.org/@axelar-network/axelarjs-sdk/-/axelarjs-sdk-0.13.6.tgz#8e1e9f2e69de69d3e4c76e042489d9e42738cf32" + integrity sha512-IQBQozUzJTRxcbfTurQ7lADq1zYgns/SMPHIX0lMILfYf4DTIyDVSCmzqZVQvO5l/rR4on9ftZ8jyIaV/AqQzg== + dependencies: + "@axelar-network/axelar-cgp-solidity" "^4.5.0" + "@axelar-network/axelarjs-types" "^0.33.0" + "@cosmjs/json-rpc" "^0.30.1" + "@cosmjs/stargate" "0.31.0-alpha.1" + "@ethersproject/abstract-provider" "^5.7.0" + "@ethersproject/networks" "^5.7.1" + "@ethersproject/providers" "^5.7.2" "@types/uuid" "^8.3.1" bech32 "^2.0.0" clone-deep "^4.0.1" cross-fetch "^3.1.5" - ethers "^5.4.7" - socket.io-client "^4.2.0" + ethers "^5.7.2" + socket.io-client "^4.6.1" standard-http-error "^2.0.1" string-similarity-js "^2.1.4" uuid "^8.3.2" + ws "^8.13.0" -"@axelar-network/axelarjs-types@^0.24.0": - version "0.24.0" - resolved "https://registry.npmjs.org/@axelar-network/axelarjs-types/-/axelarjs-types-0.24.0.tgz#ab9cc52690206a36475a1e026aefc74d578ea229" - integrity sha512-L353tkWLnujTcaEc3hMK51aiqY7DzEPfBNU9mluvtZIN9WsAbW2F3Rpj3UceSDLG0F98233HDhpPxWiGjIpiFg== +"@axelar-network/axelarjs-types@^0.33.0": + version "0.33.0" + resolved "https://registry.npmjs.org/@axelar-network/axelarjs-types/-/axelarjs-types-0.33.0.tgz#070ffbaec6be57259b64a41ee14f98804907732e" + integrity sha512-aCbX/5G+tgWPjr9tl3dQfJftWwRMkILz61ytach7dKqxtO9G9jlxpNvELJQ6gKVOodUtSY8qBCO/fWU19v4hdQ== dependencies: - long "^4.0.0" - protobufjs "~6.11.2" + long "^5.2.0" + protobufjs "^7.0.0" "@babel/code-frame@7.12.11": version "7.12.11" @@ -1355,25 +1360,15 @@ "@cosmjs/math" "0.27.1" "@cosmjs/utils" "0.27.1" -"@cosmjs/amino@0.28.13": - version "0.28.13" - resolved "https://registry.npmjs.org/@cosmjs/amino/-/amino-0.28.13.tgz#b51417a23c1ff8ef8b85a6862eba8492c6c44f38" - integrity sha512-IHnH2zGwaY69qT4mVAavr/pfzx6YE+ud1NHJbvVePlbGiz68CXTi5LHR+K0lrKB5mQ7E+ZErWz2mw5U/x+V1wQ== +"@cosmjs/amino@^0.31.0-alpha.1", "@cosmjs/amino@^0.31.3": + version "0.31.3" + resolved "https://registry.npmjs.org/@cosmjs/amino/-/amino-0.31.3.tgz#0f4aa6bd68331c71bd51b187fa64f00eb075db0a" + integrity sha512-36emtUq895sPRX8PTSOnG+lhJDCVyIcE0Tr5ct59sUbgQiI14y43vj/4WAlJ/utSOxy+Zhj9wxcs4AZfu0BHsw== dependencies: - "@cosmjs/crypto" "0.28.13" - "@cosmjs/encoding" "0.28.13" - "@cosmjs/math" "0.28.13" - "@cosmjs/utils" "0.28.13" - -"@cosmjs/amino@^0.30.1": - version "0.30.1" - resolved "https://registry.yarnpkg.com/@cosmjs/amino/-/amino-0.30.1.tgz#7c18c14627361ba6c88e3495700ceea1f76baace" - integrity sha512-yNHnzmvAlkETDYIpeCTdVqgvrdt1qgkOXwuRVi8s27UKI5hfqyE9fJ/fuunXE6ZZPnKkjIecDznmuUOMrMvw4w== - dependencies: - "@cosmjs/crypto" "^0.30.1" - "@cosmjs/encoding" "^0.30.1" - "@cosmjs/math" "^0.30.1" - "@cosmjs/utils" "^0.30.1" + "@cosmjs/crypto" "^0.31.3" + "@cosmjs/encoding" "^0.31.3" + "@cosmjs/math" "^0.31.3" + "@cosmjs/utils" "^0.31.3" "@cosmjs/crypto@0.27.1": version "0.27.1" @@ -1391,31 +1386,18 @@ ripemd160 "^2.0.2" sha.js "^2.4.11" -"@cosmjs/crypto@0.28.13": - version "0.28.13" - resolved "https://registry.npmjs.org/@cosmjs/crypto/-/crypto-0.28.13.tgz#541b6a36f616b2da5a568ead46d4e83841ceb412" - integrity sha512-ynKfM0q/tMBQMHJby6ad8lR3gkgBKaelQhIsCZTjClsnuC7oYT9y3ThSZCUWr7Pa9h0J8ahU2YV2oFWFVWJQzQ== - dependencies: - "@cosmjs/encoding" "0.28.13" - "@cosmjs/math" "0.28.13" - "@cosmjs/utils" "0.28.13" - "@noble/hashes" "^1" - bn.js "^5.2.0" - elliptic "^6.5.3" - libsodium-wrappers "^0.7.6" - -"@cosmjs/crypto@^0.30.1": - version "0.30.1" - resolved "https://registry.yarnpkg.com/@cosmjs/crypto/-/crypto-0.30.1.tgz#21e94d5ca8f8ded16eee1389d2639cb5c43c3eb5" - integrity sha512-rAljUlake3MSXs9xAm87mu34GfBLN0h/1uPPV6jEwClWjNkAMotzjC0ab9MARy5FFAvYHL3lWb57bhkbt2GtzQ== +"@cosmjs/crypto@^0.31.3": + version "0.31.3" + resolved "https://registry.npmjs.org/@cosmjs/crypto/-/crypto-0.31.3.tgz#c752cb6d682fdc735dcb45a2519f89c56ba16c26" + integrity sha512-vRbvM9ZKR2017TO73dtJ50KxoGcFzKtKI7C8iO302BQ5p+DuB+AirUg1952UpSoLfv5ki9O416MFANNg8UN/EQ== dependencies: - "@cosmjs/encoding" "^0.30.1" - "@cosmjs/math" "^0.30.1" - "@cosmjs/utils" "^0.30.1" + "@cosmjs/encoding" "^0.31.3" + "@cosmjs/math" "^0.31.3" + "@cosmjs/utils" "^0.31.3" "@noble/hashes" "^1" bn.js "^5.2.0" elliptic "^6.5.4" - libsodium-wrappers "^0.7.6" + libsodium-wrappers-sumo "^0.7.11" "@cosmjs/encoding@0.27.1": version "0.27.1" @@ -1426,32 +1408,15 @@ bech32 "^1.1.4" readonly-date "^1.0.0" -"@cosmjs/encoding@0.28.13": - version "0.28.13" - resolved "https://registry.npmjs.org/@cosmjs/encoding/-/encoding-0.28.13.tgz#7994e8e2c435beaf0690296ffb0f7f3eaec8150b" - integrity sha512-jtXbAYtV77rLHxoIrjGFsvgGjeTKttuHRv6cvuy3toCZzY7JzTclKH5O2g36IIE4lXwD9xwuhGJ2aa6A3dhNkA== +"@cosmjs/encoding@^0.31.0-alpha.1", "@cosmjs/encoding@^0.31.3": + version "0.31.3" + resolved "https://registry.npmjs.org/@cosmjs/encoding/-/encoding-0.31.3.tgz#2519d9c9ae48368424971f253775c4580b54c5aa" + integrity sha512-6IRtG0fiVYwyP7n+8e54uTx2pLYijO48V3t9TLiROERm5aUAIzIlz6Wp0NYaI5he9nh1lcEGJ1lkquVKFw3sUg== dependencies: base64-js "^1.3.0" bech32 "^1.1.4" readonly-date "^1.0.0" -"@cosmjs/encoding@^0.30.1": - version "0.30.1" - resolved "https://registry.yarnpkg.com/@cosmjs/encoding/-/encoding-0.30.1.tgz#b5c4e0ef7ceb1f2753688eb96400ed70f35c6058" - integrity sha512-rXmrTbgqwihORwJ3xYhIgQFfMSrwLu1s43RIK9I8EBudPx3KmnmyAKzMOVsRDo9edLFNuZ9GIvysUCwQfq3WlQ== - dependencies: - base64-js "^1.3.0" - bech32 "^1.1.4" - readonly-date "^1.0.0" - -"@cosmjs/json-rpc@0.28.13": - version "0.28.13" - resolved "https://registry.npmjs.org/@cosmjs/json-rpc/-/json-rpc-0.28.13.tgz#ff3f0c4a2f363b1a2c6779f8624a897e217fe297" - integrity sha512-fInSvg7x9P6p+GWqet+TMhrMTM3OWWdLJOGS5w2ryubMjgpR1rLiAx77MdTNkArW+/6sUwku0sN4veM4ENQu6A== - dependencies: - "@cosmjs/stream" "0.28.13" - xstream "^11.14.0" - "@cosmjs/json-rpc@^0.30.1": version "0.30.1" resolved "https://registry.yarnpkg.com/@cosmjs/json-rpc/-/json-rpc-0.30.1.tgz#16f21305fc167598c8a23a45549b85106b2372bc" @@ -1460,6 +1425,14 @@ "@cosmjs/stream" "^0.30.1" xstream "^11.14.0" +"@cosmjs/json-rpc@^0.31.3": + version "0.31.3" + resolved "https://registry.npmjs.org/@cosmjs/json-rpc/-/json-rpc-0.31.3.tgz#11e5cf0f6d9ab426dff470bb8d68d5d31cd6ab13" + integrity sha512-7LVYerXjnm69qqYR3uA6LGCrBW2EO5/F7lfJxAmY+iII2C7xO3a0vAjMSt5zBBh29PXrJVS6c2qRP22W1Le2Wg== + dependencies: + "@cosmjs/stream" "^0.31.3" + xstream "^11.14.0" + "@cosmjs/launchpad@0.27.1": version "0.27.1" resolved "https://registry.npmjs.org/@cosmjs/launchpad/-/launchpad-0.27.1.tgz#b6f1995748be96560f5f01e84d3ff907477dda77" @@ -1480,109 +1453,72 @@ dependencies: bn.js "^5.2.0" -"@cosmjs/math@0.28.13": - version "0.28.13" - resolved "https://registry.npmjs.org/@cosmjs/math/-/math-0.28.13.tgz#50c05bc67007a04216f7f5e0c93f57270f8cc077" - integrity sha512-PDpL8W/kbyeWi0mQ2OruyqE8ZUAdxPs1xCbDX3WXJwy2oU+X2UTbkuweJHVpS9CIqmZulBoWQAmlf6t6zr1N/g== - dependencies: - bn.js "^5.2.0" - -"@cosmjs/math@^0.30.1": - version "0.30.1" - resolved "https://registry.yarnpkg.com/@cosmjs/math/-/math-0.30.1.tgz#8b816ef4de5d3afa66cb9fdfb5df2357a7845b8a" - integrity sha512-yaoeI23pin9ZiPHIisa6qqLngfnBR/25tSaWpkTm8Cy10MX70UF5oN4+/t1heLaM6SSmRrhk3psRkV4+7mH51Q== +"@cosmjs/math@^0.31.0-alpha.1", "@cosmjs/math@^0.31.3": + version "0.31.3" + resolved "https://registry.npmjs.org/@cosmjs/math/-/math-0.31.3.tgz#767f7263d12ba1b9ed2f01f68d857597839fd957" + integrity sha512-kZ2C6glA5HDb9hLz1WrftAjqdTBb3fWQsRR+Us2HsjAYdeE6M3VdXMsYCP5M3yiihal1WDwAY2U7HmfJw7Uh4A== dependencies: bn.js "^5.2.0" -"@cosmjs/proto-signing@0.28.13": - version "0.28.13" - resolved "https://registry.npmjs.org/@cosmjs/proto-signing/-/proto-signing-0.28.13.tgz#95ac12f0da0f0814f348f5ae996c3e96d015df61" - integrity sha512-nSl/2ZLsUJYz3Ad0RY3ihZUgRHIow2OnYqKsESMu+3RA/jTi9bDYhiBu8mNMHI0xrEJry918B2CyI56pOUHdPQ== - dependencies: - "@cosmjs/amino" "0.28.13" - "@cosmjs/crypto" "0.28.13" - "@cosmjs/encoding" "0.28.13" - "@cosmjs/math" "0.28.13" - "@cosmjs/utils" "0.28.13" - cosmjs-types "^0.4.0" +"@cosmjs/proto-signing@0.31.3", "@cosmjs/proto-signing@^0.31.0-alpha.1", "@cosmjs/proto-signing@^0.31.3": + version "0.31.3" + resolved "https://registry.npmjs.org/@cosmjs/proto-signing/-/proto-signing-0.31.3.tgz#20440b7b96fb2cd924256a10e656fd8d4481cdcd" + integrity sha512-24+10/cGl6lLS4VCrGTCJeDRPQTn1K5JfknzXzDIHOx8THR31JxA7/HV5eWGHqWgAbudA7ccdSvEK08lEHHtLA== + dependencies: + "@cosmjs/amino" "^0.31.3" + "@cosmjs/crypto" "^0.31.3" + "@cosmjs/encoding" "^0.31.3" + "@cosmjs/math" "^0.31.3" + "@cosmjs/utils" "^0.31.3" + cosmjs-types "^0.8.0" long "^4.0.0" -"@cosmjs/proto-signing@0.30.1", "@cosmjs/proto-signing@^0.30.1": - version "0.30.1" - resolved "https://registry.yarnpkg.com/@cosmjs/proto-signing/-/proto-signing-0.30.1.tgz#f0dda372488df9cd2677150b89b3e9c72b3cb713" - integrity sha512-tXh8pPYXV4aiJVhTKHGyeZekjj+K9s2KKojMB93Gcob2DxUjfKapFYBMJSgfKPuWUPEmyr8Q9km2hplI38ILgQ== - dependencies: - "@cosmjs/amino" "^0.30.1" - "@cosmjs/crypto" "^0.30.1" - "@cosmjs/encoding" "^0.30.1" - "@cosmjs/math" "^0.30.1" - "@cosmjs/utils" "^0.30.1" - cosmjs-types "^0.7.1" - long "^4.0.0" - -"@cosmjs/socket@0.28.13": - version "0.28.13" - resolved "https://registry.npmjs.org/@cosmjs/socket/-/socket-0.28.13.tgz#d8443ad6e91d080fc6b80a7e9cf297a56b1f6833" - integrity sha512-lavwGxQ5VdeltyhpFtwCRVfxeWjH5D5mmN7jgx9nuCf3XSFbTcOYxrk2pQ4usenu1Q1KZdL4Yl5RCNrJuHD9Ug== +"@cosmjs/socket@^0.31.3": + version "0.31.3" + resolved "https://registry.npmjs.org/@cosmjs/socket/-/socket-0.31.3.tgz#52086380f4de2fc3514b90b0484b4b1c4c50e39e" + integrity sha512-aqrDGGi7os/hsz5p++avI4L0ZushJ+ItnzbqA7C6hamFSCJwgOkXaOUs+K9hXZdX4rhY7rXO4PH9IH8q09JkTw== dependencies: - "@cosmjs/stream" "0.28.13" + "@cosmjs/stream" "^0.31.3" isomorphic-ws "^4.0.1" ws "^7" xstream "^11.14.0" -"@cosmjs/socket@^0.30.1": - version "0.30.1" - resolved "https://registry.yarnpkg.com/@cosmjs/socket/-/socket-0.30.1.tgz#00b22f4b5e2ab01f4d82ccdb7b2e59536bfe5ce0" - integrity sha512-r6MpDL+9N+qOS/D5VaxnPaMJ3flwQ36G+vPvYJsXArj93BjgyFB7BwWwXCQDzZ+23cfChPUfhbINOenr8N2Kow== - dependencies: - "@cosmjs/stream" "^0.30.1" - isomorphic-ws "^4.0.1" - ws "^7" - xstream "^11.14.0" - -"@cosmjs/stargate@^0.28.4": - version "0.28.13" - resolved "https://registry.npmjs.org/@cosmjs/stargate/-/stargate-0.28.13.tgz#a73d837a46ee8944e6eafe162f2ff6943c14350e" - integrity sha512-dVBMazDz8/eActHsRcZjDHHptOBMqvibj5CFgEtZBp22gP6ASzoAUXTlkSVk5FBf4sfuUHoff6st134/+PGMAg== +"@cosmjs/stargate@0.31.0-alpha.1": + version "0.31.0-alpha.1" + resolved "https://registry.npmjs.org/@cosmjs/stargate/-/stargate-0.31.0-alpha.1.tgz#85b9d41cd5e73c3b8db73115aa1c9cd6eb5914fd" + integrity sha512-kCTUT3niB2hvcHjhlxpM8cNw1KOVmgZROdJUQaO8Ts4j22OyRZRFdwRPrOIuAKpqhVW2I1vI2HQL9Bg7pk9Glw== dependencies: "@confio/ics23" "^0.6.8" - "@cosmjs/amino" "0.28.13" - "@cosmjs/encoding" "0.28.13" - "@cosmjs/math" "0.28.13" - "@cosmjs/proto-signing" "0.28.13" - "@cosmjs/stream" "0.28.13" - "@cosmjs/tendermint-rpc" "0.28.13" - "@cosmjs/utils" "0.28.13" - cosmjs-types "^0.4.0" + "@cosmjs/amino" "^0.31.0-alpha.1" + "@cosmjs/encoding" "^0.31.0-alpha.1" + "@cosmjs/math" "^0.31.0-alpha.1" + "@cosmjs/proto-signing" "^0.31.0-alpha.1" + "@cosmjs/stream" "^0.31.0-alpha.1" + "@cosmjs/tendermint-rpc" "^0.31.0-alpha.1" + "@cosmjs/utils" "^0.31.0-alpha.1" + cosmjs-types "^0.8.0" long "^4.0.0" protobufjs "~6.11.3" xstream "^11.14.0" -"@cosmjs/stargate@^0.30.1": - version "0.30.1" - resolved "https://registry.yarnpkg.com/@cosmjs/stargate/-/stargate-0.30.1.tgz#e1b22e1226cffc6e93914a410755f1f61057ba04" - integrity sha512-RdbYKZCGOH8gWebO7r6WvNnQMxHrNXInY/gPHPzMjbQF6UatA6fNM2G2tdgS5j5u7FTqlCI10stNXrknaNdzog== +"@cosmjs/stargate@^0.31.3": + version "0.31.3" + resolved "https://registry.npmjs.org/@cosmjs/stargate/-/stargate-0.31.3.tgz#a2b38e398097a00f897dbd8f02d4d347d8fed818" + integrity sha512-53NxnzmB9FfXpG4KjOUAYAvWLYKdEmZKsutcat/u2BrDXNZ7BN8jim/ENcpwXfs9/Og0K24lEIdvA4gsq3JDQw== dependencies: "@confio/ics23" "^0.6.8" - "@cosmjs/amino" "^0.30.1" - "@cosmjs/encoding" "^0.30.1" - "@cosmjs/math" "^0.30.1" - "@cosmjs/proto-signing" "^0.30.1" - "@cosmjs/stream" "^0.30.1" - "@cosmjs/tendermint-rpc" "^0.30.1" - "@cosmjs/utils" "^0.30.1" - cosmjs-types "^0.7.1" + "@cosmjs/amino" "^0.31.3" + "@cosmjs/encoding" "^0.31.3" + "@cosmjs/math" "^0.31.3" + "@cosmjs/proto-signing" "^0.31.3" + "@cosmjs/stream" "^0.31.3" + "@cosmjs/tendermint-rpc" "^0.31.3" + "@cosmjs/utils" "^0.31.3" + cosmjs-types "^0.8.0" long "^4.0.0" protobufjs "~6.11.3" xstream "^11.14.0" -"@cosmjs/stream@0.28.13": - version "0.28.13" - resolved "https://registry.npmjs.org/@cosmjs/stream/-/stream-0.28.13.tgz#1e79d1116fda1e63e5ecddbd9d803d403942b1fa" - integrity sha512-AnjtfwT8NwPPkd3lhZhjOlOzT0Kn9bgEu2IPOZjQ1nmG2bplsr6TJmnwn0dJxHT7UGtex17h6whKB5N4wU37Wg== - dependencies: - xstream "^11.14.0" - "@cosmjs/stream@^0.30.1": version "0.30.1" resolved "https://registry.yarnpkg.com/@cosmjs/stream/-/stream-0.30.1.tgz#ba038a2aaf41343696b1e6e759d8e03a9516ec1a" @@ -1590,34 +1526,25 @@ dependencies: xstream "^11.14.0" -"@cosmjs/tendermint-rpc@0.28.13": - version "0.28.13" - resolved "https://registry.npmjs.org/@cosmjs/tendermint-rpc/-/tendermint-rpc-0.28.13.tgz#0bf587ae66fa3f88319edbd258492d28e73f9f29" - integrity sha512-GB+ZmfuJIGQm0hsRtLYjeR3lOxF7Z6XyCBR0cX5AAYOZzSEBJjevPgUHD6tLn8zIhvzxaW3/VKnMB+WmlxdH4w== - dependencies: - "@cosmjs/crypto" "0.28.13" - "@cosmjs/encoding" "0.28.13" - "@cosmjs/json-rpc" "0.28.13" - "@cosmjs/math" "0.28.13" - "@cosmjs/socket" "0.28.13" - "@cosmjs/stream" "0.28.13" - "@cosmjs/utils" "0.28.13" - axios "^0.21.2" - readonly-date "^1.0.0" +"@cosmjs/stream@^0.31.0-alpha.1", "@cosmjs/stream@^0.31.3": + version "0.31.3" + resolved "https://registry.npmjs.org/@cosmjs/stream/-/stream-0.31.3.tgz#53428fd62487ec08fc3886a50a3feeb8b2af2e66" + integrity sha512-8keYyI7X0RjsLyVcZuBeNjSv5FA4IHwbFKx7H60NHFXszN8/MvXL6aZbNIvxtcIHHsW7K9QSQos26eoEWlAd+w== + dependencies: xstream "^11.14.0" -"@cosmjs/tendermint-rpc@^0.30.1": - version "0.30.1" - resolved "https://registry.yarnpkg.com/@cosmjs/tendermint-rpc/-/tendermint-rpc-0.30.1.tgz#c16378892ba1ac63f72803fdf7567eab9d4f0aa0" - integrity sha512-Z3nCwhXSbPZJ++v85zHObeUggrEHVfm1u18ZRwXxFE9ZMl5mXTybnwYhczuYOl7KRskgwlB+rID0WYACxj4wdQ== - dependencies: - "@cosmjs/crypto" "^0.30.1" - "@cosmjs/encoding" "^0.30.1" - "@cosmjs/json-rpc" "^0.30.1" - "@cosmjs/math" "^0.30.1" - "@cosmjs/socket" "^0.30.1" - "@cosmjs/stream" "^0.30.1" - "@cosmjs/utils" "^0.30.1" +"@cosmjs/tendermint-rpc@^0.31.0-alpha.1", "@cosmjs/tendermint-rpc@^0.31.3": + version "0.31.3" + resolved "https://registry.npmjs.org/@cosmjs/tendermint-rpc/-/tendermint-rpc-0.31.3.tgz#d1a2bc5b3c98743631c9b55888589d352403c9b3" + integrity sha512-s3TiWkPCW4QceTQjpYqn4xttUJH36mTPqplMl+qyocdqk5+X5mergzExU/pHZRWQ4pbby8bnR7kMvG4OC1aZ8g== + dependencies: + "@cosmjs/crypto" "^0.31.3" + "@cosmjs/encoding" "^0.31.3" + "@cosmjs/json-rpc" "^0.31.3" + "@cosmjs/math" "^0.31.3" + "@cosmjs/socket" "^0.31.3" + "@cosmjs/stream" "^0.31.3" + "@cosmjs/utils" "^0.31.3" axios "^0.21.2" readonly-date "^1.0.0" xstream "^11.14.0" @@ -1627,15 +1554,10 @@ resolved "https://registry.npmjs.org/@cosmjs/utils/-/utils-0.27.1.tgz#1c8efde17256346ef142a3bd15158ee4055470e2" integrity sha512-VG7QPDiMUzVPxRdJahDV8PXxVdnuAHiIuG56hldV4yPnOz/si/DLNd7VAUUA5923b6jS1Hhev0Hr6AhEkcxBMg== -"@cosmjs/utils@0.28.13": - version "0.28.13" - resolved "https://registry.npmjs.org/@cosmjs/utils/-/utils-0.28.13.tgz#2fd2844ec832d7833811e2ae1691305d09791a08" - integrity sha512-dVeMBiyg+46x7XBZEfJK8yTihphbCFpjVYmLJVqmTsHfJwymQ65cpyW/C+V/LgWARGK8hWQ/aX9HM5Ao8QmMSg== - -"@cosmjs/utils@^0.30.1": - version "0.30.1" - resolved "https://registry.yarnpkg.com/@cosmjs/utils/-/utils-0.30.1.tgz#6d92582341be3c2ec8d82090253cfa4b7f959edb" - integrity sha512-KvvX58MGMWh7xA+N+deCfunkA/ZNDvFLw4YbOmX3f/XBIkqrVY7qlotfy2aNb1kgp6h4B6Yc8YawJPDTfvWX7g== +"@cosmjs/utils@^0.31.0-alpha.1", "@cosmjs/utils@^0.31.3": + version "0.31.3" + resolved "https://registry.npmjs.org/@cosmjs/utils/-/utils-0.31.3.tgz#f97bbfda35ad69e80cd5c7fe0a270cbda16db1ed" + integrity sha512-VBhAgzrrYdIe0O5IbKRqwszbQa7ZyQLx9nEQuHQ3HUplQW7P44COG/ye2n6AzCudtqxmwdX7nyX8ta1J07GoqA== "@cosmostation/extension-client@^0.1.15": version "0.1.15" @@ -1887,7 +1809,7 @@ resolved "https://registry.npmjs.org/@ethersproject/logger/-/logger-5.7.0.tgz#6ce9ae168e74fecf287be17062b590852c311892" integrity sha512-0odtFdXu/XHtjQXJYA3u9G0G8btm0ND5Cu8M7i5vhEcE8/HmF4Lbdqanwyv4uQTr2tx6b7fQRmgLrsnpQlmnig== -"@ethersproject/networks@5.7.1", "@ethersproject/networks@^5.7.0": +"@ethersproject/networks@5.7.1", "@ethersproject/networks@^5.7.0", "@ethersproject/networks@^5.7.1": version "5.7.1" resolved "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.7.1.tgz#118e1a981d757d45ccea6bb58d9fd3d9db14ead6" integrity sha512-n/MufjFYv3yFcUyfhnXotyDlNdFb7onmkSy8aQERi2PjNcnWQ66xXxa3XlS8nCcA8aJKJjIIMNJTC7tu80GwpQ== @@ -2122,20 +2044,20 @@ dependencies: browser-headers "^0.4.1" -"@injectivelabs/core-proto-ts@^0.0.18": - version "0.0.18" - resolved "https://registry.yarnpkg.com/@injectivelabs/core-proto-ts/-/core-proto-ts-0.0.18.tgz#aa60ffde2b52cbbf80a18ba77833ecad605d8fd6" - integrity sha512-WSZS7SQ+I/m8jdc7fhzkMTUhA7i5nVTeKbN6QGqKmOwQ/F+PqM75vDHD9Y9NbLPx9P+m7hyUzSHz4zmajth5jw== +"@injectivelabs/core-proto-ts@^0.0.21": + version "0.0.21" + resolved "https://registry.npmjs.org/@injectivelabs/core-proto-ts/-/core-proto-ts-0.0.21.tgz#b52d4bee7556ce57c7c7e2c1ec7f6b920b4c2ffd" + integrity sha512-RBxSkRBCty60R/l55/D1jsSW0Aof5dyGFhCFdN3A010KjMv/SzZGGr+6DZPY/hflyFeaJzDv/VTopCymKNRBvQ== dependencies: "@injectivelabs/grpc-web" "^0.0.1" google-protobuf "^3.14.0" protobufjs "^7.0.0" rxjs "^7.4.0" -"@injectivelabs/dmm-proto-ts@1.0.16": - version "1.0.16" - resolved "https://registry.yarnpkg.com/@injectivelabs/dmm-proto-ts/-/dmm-proto-ts-1.0.16.tgz#7e2d6652cf31700524c1933d40ffa54c213302c5" - integrity sha512-2D1gDJ0eMveTuLjOH+dDvDSjoIbCbaQxnRmVCg3an0kPRot54tNTdx1DC3LyBQEOJ7VeVJFbhDjoAmgpNPBY8A== +"@injectivelabs/dmm-proto-ts@1.0.19": + version "1.0.19" + resolved "https://registry.yarnpkg.com/@injectivelabs/dmm-proto-ts/-/dmm-proto-ts-1.0.19.tgz#fbb3432df9a3a6465a19fe68f3ebbfeb532fbd56" + integrity sha512-2FCzCziy1RhzmnkAVIU+Asby/GXAVQqKt5/o1s52j0LJXfJMpiCrV6soLfnjTebj61T+1WvJBPFoZCCiVYBpcw== dependencies: "@injectivelabs/grpc-web" "^0.0.1" google-protobuf "^3.14.0" @@ -2159,20 +2081,20 @@ dependencies: browser-headers "^0.4.1" -"@injectivelabs/indexer-proto-ts@1.11.11": - version "1.11.11" - resolved "https://registry.yarnpkg.com/@injectivelabs/indexer-proto-ts/-/indexer-proto-ts-1.11.11.tgz#faee76f81f0bc5566a295fa4a069312f17810804" - integrity sha512-1zDIhF83fld/FNrQ43rX7fLFoY7zXneqqufXWMKh2ekFOAnXdyyPc832keNG7hczCbxG4trw/Tgpos0C9J7ndg== +"@injectivelabs/indexer-proto-ts@1.11.32": + version "1.11.32" + resolved "https://registry.yarnpkg.com/@injectivelabs/indexer-proto-ts/-/indexer-proto-ts-1.11.32.tgz#a91d9368ca9a3a782bbe9722762f8d7d754ebafd" + integrity sha512-gCkbMlBq34MY2xZcauDEsCP0h5l/FgKMwCgJ8aWGaTkh27XBWpl1zvlreuWg/IpSvTPJZBoADW9KqixqyoBdJw== 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.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== +"@injectivelabs/mito-proto-ts@1.0.55": + version "1.0.55" + resolved "https://registry.yarnpkg.com/@injectivelabs/mito-proto-ts/-/mito-proto-ts-1.0.55.tgz#78cc7a11ea4a433f3897ec5acc48d62ccf42cad6" + integrity sha512-clFKpU/LCYvYiPg5PRjhVJFTxKcfJHzaj5saJHuL32LaOaB3Rd8L3CqP9qUrg78L7eKjjXjyG97U3NdRdZBlWg== dependencies: "@injectivelabs/grpc-web" "^0.0.1" google-protobuf "^3.14.0" @@ -2658,6 +2580,16 @@ rxjs "6" semver "^7.3.5" +"@ledgerhq/devices@^8.1.0": + version "8.1.0" + resolved "https://registry.npmjs.org/@ledgerhq/devices/-/devices-8.1.0.tgz#39b12feabe1c7a99b86667bedf2eafbd125cf217" + integrity sha512-Vsdv84Nwzee0qhObdwVzhkxW1+h2cFoD1AWuU8N1V/2OJKiVS35A1qloSCF0oHapg+KTJvim8tr5rRvlkCYyzQ== + dependencies: + "@ledgerhq/errors" "^6.16.0" + "@ledgerhq/logs" "^6.12.0" + rxjs "^7.8.1" + semver "^7.3.5" + "@ledgerhq/domain-service@^1.1.0": version "1.1.0" resolved "https://registry.yarnpkg.com/@ledgerhq/domain-service/-/domain-service-1.1.0.tgz#97b00fe01b77688a6f2b04f2ad52f533c1e33595" @@ -2682,6 +2614,20 @@ resolved "https://registry.yarnpkg.com/@ledgerhq/errors/-/errors-6.12.5.tgz#f112b548ab3c4f21bb7fbe77e6cb62998a050992" integrity sha512-wQlDyKD2lG4hiFmSPvWfuzhbH8wxWG4ugesM17HdZgxUt8g0SluwaBfFJ7Nx0Ym44VIhbsGMUzyBp0hHyCkVqA== +"@ledgerhq/errors@^6.16.0": + version "6.16.0" + resolved "https://registry.npmjs.org/@ledgerhq/errors/-/errors-6.16.0.tgz#0aaf16bbf649a3b43867746781b2e3adebf7fe3a" + integrity sha512-vnew6lf4jN6E+WI0DFhD4WY0uM8LYL8HCumtUr86hNwvmEfebi7LxxpJGmYfVQD5TgEC7NibYnQ+2q9XWAc02A== + +"@ledgerhq/hw-app-cosmos@^6.29.0": + version "6.29.0" + resolved "https://registry.npmjs.org/@ledgerhq/hw-app-cosmos/-/hw-app-cosmos-6.29.0.tgz#49fe3e2bffbbac6f7c5ee449d15ec1a25518e69e" + integrity sha512-liINySbc57zpLziqNTqTnivp44sjDAH06H52FJGoYRb2v9oi+PaJrPGj/kdv26FYm8LTvRQZcUBdWrRZQ6asRQ== + dependencies: + "@ledgerhq/errors" "^6.16.0" + "@ledgerhq/hw-transport" "^6.30.0" + bip32-path "^0.4.2" + "@ledgerhq/hw-app-eth@6.33.2": version "6.33.2" resolved "https://registry.yarnpkg.com/@ledgerhq/hw-app-eth/-/hw-app-eth-6.33.2.tgz#86bc5de1f8ddd25d3621a4eca0604a287ec4469a" @@ -2764,11 +2710,26 @@ "@ledgerhq/errors" "^6.12.2" events "^3.3.0" +"@ledgerhq/hw-transport@^6.30.0": + version "6.30.0" + resolved "https://registry.npmjs.org/@ledgerhq/hw-transport/-/hw-transport-6.30.0.tgz#9c8a8f2c8281fbc4a3db1d1f3ac44a456b38281a" + integrity sha512-wrAwn/wCAaGP2Yuy78cLyqmQNzbuDvUv4gJYF/UO4djvUz0jjvD2w5kxRWxF/W93vyKT+/RplRtFk3CJzD3e3A== + dependencies: + "@ledgerhq/devices" "^8.1.0" + "@ledgerhq/errors" "^6.16.0" + "@ledgerhq/logs" "^6.12.0" + events "^3.3.0" + "@ledgerhq/logs@^6.10.0", "@ledgerhq/logs@^6.10.1": version "6.10.1" resolved "https://registry.npmjs.org/@ledgerhq/logs/-/logs-6.10.1.tgz#5bd16082261d7364eabb511c788f00937dac588d" integrity sha512-z+ILK8Q3y+nfUl43ctCPuR4Y2bIxk/ooCQFwZxhtci1EhAtMDzMAx2W25qx8G1PPL9UUOdnUax19+F0OjXoj4w== +"@ledgerhq/logs@^6.12.0": + version "6.12.0" + resolved "https://registry.npmjs.org/@ledgerhq/logs/-/logs-6.12.0.tgz#ad903528bf3687a44da435d7b2479d724d374f5d" + integrity sha512-ExDoj1QV5eC6TEbMdLUMMk9cfvNKhhv5gXol4SmULRVCx/3iyCPhJ74nsb3S0Vb+/f+XujBEj3vQn5+cwS0fNA== + "@ledgerhq/types-live@^6.33.0": version "6.33.0" resolved "https://registry.yarnpkg.com/@ledgerhq/types-live/-/types-live-6.33.0.tgz#676babc4a3b42059937321545d74f26856506379" @@ -5940,6 +5901,11 @@ bindings@^1.2.1, bindings@^1.3.0, bindings@^1.5.0: dependencies: file-uri-to-path "1.0.0" +bip32-path@^0.4.2: + version "0.4.2" + resolved "https://registry.npmjs.org/bip32-path/-/bip32-path-0.4.2.tgz#5db0416ad6822712f077836e2557b8697c0c7c99" + integrity sha512-ZBMCELjJfcNMkz5bDuJ1WrYvjlhEF5k6mQ8vUr4N7MbVRsXei7ZOg8VhhwMfNiW68NWmLkgkc6WvTickrLGprQ== + bip32@^2.0.6: version "2.0.6" resolved "https://registry.npmjs.org/bip32/-/bip32-2.0.6.tgz#6a81d9f98c4cd57d05150c60d8f9e75121635134" @@ -7048,14 +7014,6 @@ cosmiconfig@^8.0.0: parse-json "^5.0.0" path-type "^4.0.0" -cosmjs-types@^0.4.0: - version "0.4.1" - resolved "https://registry.npmjs.org/cosmjs-types/-/cosmjs-types-0.4.1.tgz#3b2a53ba60d33159dd075596ce8267cfa7027063" - integrity sha512-I7E/cHkIgoJzMNQdFF0YVqPlaTqrqKHrskuSTIqlEyxfB5Lf3WKCajSXVK2yHOfOFfSux/RxEdpMzw/eO4DIog== - dependencies: - long "^4.0.0" - protobufjs "~6.11.2" - cosmjs-types@^0.7.1: version "0.7.1" resolved "https://registry.yarnpkg.com/cosmjs-types/-/cosmjs-types-0.7.1.tgz#7ad355f63206fb829b565ed3463791d33b10c3d7" @@ -7064,6 +7022,14 @@ cosmjs-types@^0.7.1: long "^4.0.0" protobufjs "~6.11.2" +cosmjs-types@^0.8.0: + version "0.8.0" + resolved "https://registry.npmjs.org/cosmjs-types/-/cosmjs-types-0.8.0.tgz#2ed78f3e990f770229726f95f3ef5bf9e2b6859b" + integrity sha512-Q2Mj95Fl0PYMWEhA2LuGEIhipF7mQwd9gTQ85DdP9jjjopeoGaDxvmPa5nakNzsq7FnO1DMTatXTAx6bxMH7Lg== + dependencies: + long "^4.0.0" + protobufjs "~6.11.2" + crc-32@^1.2.0: version "1.2.2" resolved "https://registry.npmjs.org/crc-32/-/crc-32-1.2.2.tgz#3cad35a934b8bf71f25ca524b6da51fb7eace2ff" @@ -7632,11 +7598,27 @@ engine.io-client@~6.2.3: ws "~8.2.3" xmlhttprequest-ssl "~2.0.0" +engine.io-client@~6.5.2: + version "6.5.3" + resolved "https://registry.npmjs.org/engine.io-client/-/engine.io-client-6.5.3.tgz#4cf6fa24845029b238f83c628916d9149c399bc5" + integrity sha512-9Z0qLB0NIisTRt1DZ/8U2k12RJn8yls/nXMZLn+/N8hANT3TcYjKFKcwbw5zFQiN4NTde3TSY9zb79e1ij6j9Q== + dependencies: + "@socket.io/component-emitter" "~3.1.0" + debug "~4.3.1" + engine.io-parser "~5.2.1" + ws "~8.11.0" + xmlhttprequest-ssl "~2.0.0" + engine.io-parser@~5.0.3: version "5.0.4" resolved "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-5.0.4.tgz#0b13f704fa9271b3ec4f33112410d8f3f41d0fc0" integrity sha512-+nVFp+5z1E3HcToEnO7ZIj3g+3k9389DvWtvJZz0T6/eOCPIyyxehFcedoYrZQrp0LgQbD9pPXhpMBKMd5QURg== +engine.io-parser@~5.2.1: + version "5.2.1" + resolved "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-5.2.1.tgz#9f213c77512ff1a6cc0c7a86108a7ffceb16fcfb" + integrity sha512-9JktcM3u18nU9N2Lz3bWeBgxVgOKpw7yhRaoxQA3FUDZzzw+9WlA6p4G4u0RixNkg14fH7EfEc/RhpurtiROTQ== + enquirer@^2.3.5, enquirer@^2.3.6, enquirer@~2.3.6: version "2.3.6" resolved "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz#2a7fe5dd634a1e4125a975ec994ff5456dc3734d" @@ -8123,7 +8105,7 @@ ethereumjs-util@^6.0.0, ethereumjs-util@^6.2.1: ethjs-util "0.1.6" rlp "^2.2.3" -ethers@^5.4.7, ethers@^5.7.2: +ethers@^5.7.2: version "5.7.2" resolved "https://registry.npmjs.org/ethers/-/ethers-5.7.2.tgz#3a7deeabbb8c030d4126b24f84e525466145872e" integrity sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg== @@ -10839,6 +10821,18 @@ libnpmpublish@6.0.4: semver "^7.3.7" ssri "^9.0.0" +libsodium-sumo@^0.7.13: + version "0.7.13" + resolved "https://registry.npmjs.org/libsodium-sumo/-/libsodium-sumo-0.7.13.tgz#533b97d2be44b1277e59c1f9f60805978ac5542d" + integrity sha512-zTGdLu4b9zSNLfovImpBCbdAA4xkpkZbMnSQjP8HShyOutnGjRHmSOKlsylh1okao6QhLiz7nG98EGn+04cZjQ== + +libsodium-wrappers-sumo@^0.7.11: + version "0.7.13" + resolved "https://registry.npmjs.org/libsodium-wrappers-sumo/-/libsodium-wrappers-sumo-0.7.13.tgz#a33aea845a0bb56db067548f04feba28c730ab8e" + integrity sha512-lz4YdplzDRh6AhnLGF2Dj2IUj94xRN6Bh8T0HLNwzYGwPehQJX6c7iYVrFUPZ3QqxE0bqC+K0IIqqZJYWumwSQ== + dependencies: + libsodium-sumo "^0.7.13" + libsodium-wrappers@^0.7.6, "libsodium-wrappers@npm:@bangjelkoski/noop", "libsodium@npm:@bangjelkoski/noop": version "0.0.1" resolved "https://registry.yarnpkg.com/@bangjelkoski/noop/-/noop-0.0.1.tgz#172235ce00dd4269258c420f01464f07eb9801ed" @@ -11089,6 +11083,11 @@ long@^5.0.0, long@^5.2.1: resolved "https://registry.yarnpkg.com/long/-/long-5.2.1.tgz#e27595d0083d103d2fa2c20c7699f8e0c92b897f" integrity sha512-GKSNGeNAtw8IryjjkhZxuKB3JzlcLTwjtiQCHKvqQet81I93kXslhDQruGI/QsddO83mcDToBVy7GqGS/zYf/A== +long@^5.2.0: + version "5.2.3" + resolved "https://registry.npmjs.org/long/-/long-5.2.3.tgz#a3ba97f3877cf1d778eccbcb048525ebb77499e1" + integrity sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q== + long@~3: version "3.2.0" resolved "https://registry.yarnpkg.com/long/-/long-3.2.0.tgz#d821b7138ca1cb581c172990ef14db200b5c474b" @@ -13728,13 +13727,20 @@ rxjs@6, rxjs@^6.6.3: dependencies: tslib "^1.9.0" -rxjs@^7.4.0, rxjs@^7.5.1, rxjs@^7.5.5, rxjs@^7.5.6, rxjs@^7.8.0: +rxjs@^7.4.0, rxjs@^7.5.1, rxjs@^7.5.5, rxjs@^7.5.6: version "7.8.0" resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-7.8.0.tgz#90a938862a82888ff4c7359811a595e14e1e09a4" integrity sha512-F2+gxDshqmIub1KdvZkaEfGDwLNpPvk9Fs6LD/MyQxNgMds/WH9OdDDXOmxUZpME+iSK3rQCctkL0DYyytUqMg== dependencies: tslib "^2.1.0" +rxjs@^7.8.1: + version "7.8.1" + resolved "https://registry.npmjs.org/rxjs/-/rxjs-7.8.1.tgz#6f6f3d99ea8044291efd92e7c7fcf562c4057543" + integrity sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg== + dependencies: + tslib "^2.1.0" + safe-buffer@5.1.2, safe-buffer@~5.1.0, safe-buffer@~5.1.1: version "5.1.2" resolved "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" @@ -14142,7 +14148,7 @@ snapdragon@^0.8.1: source-map-resolve "^0.5.0" use "^3.1.0" -socket.io-client@^4.2.0, socket.io-client@^4.5.3: +socket.io-client@^4.5.3: version "4.5.4" resolved "https://registry.npmjs.org/socket.io-client/-/socket.io-client-4.5.4.tgz#d3cde8a06a6250041ba7390f08d2468ccebc5ac9" integrity sha512-ZpKteoA06RzkD32IbqILZ+Cnst4xewU7ZYK12aS1mzHftFFjpoMz69IuhP/nL25pJfao/amoPI527KnuhFm01g== @@ -14152,6 +14158,16 @@ socket.io-client@^4.2.0, socket.io-client@^4.5.3: engine.io-client "~6.2.3" socket.io-parser "~4.2.1" +socket.io-client@^4.6.1: + version "4.7.2" + resolved "https://registry.npmjs.org/socket.io-client/-/socket.io-client-4.7.2.tgz#f2f13f68058bd4e40f94f2a1541f275157ff2c08" + integrity sha512-vtA0uD4ibrYD793SOIAwlo8cj6haOeMHrGvwPxJsxH7CeIksqJ+3Zc06RvWTIFgiSqx4A3sOnTXpfAEE2Zyz6w== + dependencies: + "@socket.io/component-emitter" "~3.1.0" + debug "~4.3.2" + engine.io-client "~6.5.2" + socket.io-parser "~4.2.4" + socket.io-parser@~4.2.1: version "4.2.1" resolved "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.2.1.tgz#01c96efa11ded938dcb21cbe590c26af5eff65e5" @@ -14160,6 +14176,14 @@ socket.io-parser@~4.2.1: "@socket.io/component-emitter" "~3.1.0" debug "~4.3.1" +socket.io-parser@~4.2.4: + version "4.2.4" + resolved "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.2.4.tgz#c806966cf7270601e47469ddeec30fbdfda44c83" + integrity sha512-/GbIKmo8ioc+NIWIhwdecY0ge+qVBSMdgxGygevmdHj24bsfgtCmcUUcQ5ZzcylGFHsN3k4HB4Cgkl96KVnuew== + dependencies: + "@socket.io/component-emitter" "~3.1.0" + debug "~4.3.1" + socks-proxy-agent@6.1.1: version "6.1.1" resolved "https://registry.yarnpkg.com/socks-proxy-agent/-/socks-proxy-agent-6.1.1.tgz#e664e8f1aaf4e1fb3df945f09e3d94f911137f87" @@ -15698,7 +15722,12 @@ ws@^7, ws@^7.2.0, ws@^7.4.0, ws@^7.4.5, ws@^7.5.1, ws@^7.5.8, ws@^7.5.9: resolved "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz#54fa7db29f4c7cec68b1ddd3a89de099942bb591" integrity sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q== -ws@^8.5.0: +ws@^8.13.0: + version "8.14.2" + resolved "https://registry.npmjs.org/ws/-/ws-8.14.2.tgz#6c249a806eb2db7a20d26d51e7709eab7b2e6c7f" + integrity sha512-wEBG1ftX4jcglPxgFCMJmZ2PLtSbJ2Peg6TmpJFTbe9GZYOQCDPdMYu/Tm0/bGZkw8paZnJY45J4K2PZrLYq8g== + +ws@^8.5.0, ws@~8.11.0: version "8.11.0" resolved "https://registry.npmjs.org/ws/-/ws-8.11.0.tgz#6a0d36b8edfd9f96d8b25683db2f8d7de6e8e143" integrity sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==