From c27ff214831a79a2db06237d17933875f16c4dad Mon Sep 17 00:00:00 2001 From: trung2891 Date: Tue, 23 Jan 2024 10:29:57 +0700 Subject: [PATCH 01/24] chore: add wbnb is middleware in route trade --- src/connectors/pancakeswap/pancakeswap.ts | 38 +++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/src/connectors/pancakeswap/pancakeswap.ts b/src/connectors/pancakeswap/pancakeswap.ts index 5f384ec081..7d4d25f7fa 100644 --- a/src/connectors/pancakeswap/pancakeswap.ts +++ b/src/connectors/pancakeswap/pancakeswap.ts @@ -213,6 +213,25 @@ export class PancakeSwap implements Uniswapish { throw new UniswapishPriceError( `priceSwapOut: no trade pair found for ${baseToken.address} to ${quoteToken.address}.`, ); + const pair2: Pair = await Fetcher.fetchPairData( + wbnb, + baseToken, + this.bsc.provider + ); + + trades = Trade.bestTradeExactOut( + [pair1, pair2], + quoteToken, + nativeTokenAmount, + { + maxHops: 2, + } + ); + if (!trades || trades.length === 0) { + throw new UniswapishPriceError( + `priceSwapOut: no trade pair found for ${quoteToken.address} to ${baseToken.address}.` + ); + } } logger.info( `Best trade for ${baseToken.address}-${quoteToken.address}: ` + @@ -261,6 +280,25 @@ export class PancakeSwap implements Uniswapish { throw new UniswapishPriceError( `priceSwapIn: no trade pair found for ${baseToken.address} to ${quoteToken.address}.`, ); + const pair2: Pair = await Fetcher.fetchPairData( + wbnb, + baseToken, + this.bsc.provider + ); + + trades = Trade.bestTradeExactIn( + [pair1, pair2], + nativeTokenAmount, + quoteToken, + { + maxHops: 2, + } + ); + if (!trades || trades.length === 0) { + throw new UniswapishPriceError( + `priceSwapIn: no trade pair found for ${baseToken} to ${quoteToken}.` + ); + } } logger.info( `Best trade for ${baseToken.address}-${quoteToken.address}: ` + From de05e4432a55d37647bc573fb98f6dc1923b063d Mon Sep 17 00:00:00 2001 From: trung2891 Date: Tue, 23 Jan 2024 11:24:51 +0700 Subject: [PATCH 02/24] chore: add orai token on bsc --- src/templates/lists/bep20_tokens_mainnet.json | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/templates/lists/bep20_tokens_mainnet.json b/src/templates/lists/bep20_tokens_mainnet.json index 4bc7e21992..534f27c7d0 100755 --- a/src/templates/lists/bep20_tokens_mainnet.json +++ b/src/templates/lists/bep20_tokens_mainnet.json @@ -7,10 +7,7 @@ "patch": 139 }, "logoURI": "https://pancakeswap.finance/logo.png", - "keywords": [ - "pancakeswap", - "extended" - ], + "keywords": ["pancakeswap", "extended"], "tokens": [ { "name": "PancakeSwap Token", @@ -2707,6 +2704,14 @@ "chainId": 56, "decimals": 18, "logoURI": "https://tokens.pancakeswap.finance/images/0x1D229B958D5DDFca92146585a8711aECbE56F095.png" + }, + { + "name": "Oraichain", + "symbol": "ORAI", + "address": "0xA325Ad6D9c92B55A3Fc5aD7e412B1518F96441C0", + "chainId": 56, + "decimals": 18, + "logoURI": "" } ] -} \ No newline at end of file +} From 4730a8c0586472cd17338d1b57a1a7330eac13ea Mon Sep 17 00:00:00 2001 From: trung2891 Date: Tue, 23 Jan 2024 14:11:12 +0700 Subject: [PATCH 03/24] chore: add oraichain config --- src/services/schema/oraichain-schema.json | 34 +++++++++++++++++++++++ src/templates/lists/oraichain.json | 13 +++++++++ src/templates/oraichain.yml | 22 +++++++++++++++ src/templates/root.yml | 4 +++ 4 files changed, 73 insertions(+) create mode 100644 src/services/schema/oraichain-schema.json create mode 100644 src/templates/lists/oraichain.json create mode 100644 src/templates/oraichain.yml diff --git a/src/services/schema/oraichain-schema.json b/src/services/schema/oraichain-schema.json new file mode 100644 index 0000000000..e6bbf364ee --- /dev/null +++ b/src/services/schema/oraichain-schema.json @@ -0,0 +1,34 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "networks": { + "type": "object", + "patternProperties": { + "^\\w+$": { + "type": "object", + "properties": { + "chainId": { "type": "string" }, + "nodeURL": { "type": "string" }, + "tokenListType": { + "type": "string" + }, + "tokenListSource": { + "type": "string" + } + }, + "required": ["chainId", "nodeURL"], + "additionalProperties": false + } + }, + "additionalProperties": false + }, + "nativeCurrencySymbol": { "type": "string" }, + "gasLimitEstimate": { "type": "number" }, + "prefix": { "type": "string" }, + "gasPrice": { "type": "number" }, + "gasPriceSuffix": { "type": "string" } + }, + "additionalProperties": false, + "required": ["nativeCurrencySymbol"] +} diff --git a/src/templates/lists/oraichain.json b/src/templates/lists/oraichain.json new file mode 100644 index 0000000000..e518834336 --- /dev/null +++ b/src/templates/lists/oraichain.json @@ -0,0 +1,13 @@ +{ + "name": "Oraichain token list", + "URI": "", + "tokens": [ + { + "name": "USDT token", + "symbol": "USDT", + "address": "orai12hzjxfh77wl572gdzct2fxv2arxcwh6gykc7qh", + "decimals": 6, + "chainId": "Oraichain" + } + ] +} diff --git a/src/templates/oraichain.yml b/src/templates/oraichain.yml new file mode 100644 index 0000000000..42ebd5dd18 --- /dev/null +++ b/src/templates/oraichain.yml @@ -0,0 +1,22 @@ +networks: + mainnet: + chainId: mainnet + nodeURL: https://rpc.orai.io + tokenListType: FILE + tokenListSource: /home/gateway/conf/lists/oraichain.json + testnet: + chainId: testnet + nodeURL: https://testnet.rpc.orai.io + tokenListType: FILE + tokenListSource: /home/gateway/conf/lists/oraichain.json + simulate: + chainId: simulate + nodeURL: simulate + tokenListType: FILE + tokenListSource: /home/gateway/conf/lists/oraichain.json + +prefix: "orai" +gasPrice: 0.001 +gasPriceSuffix: 'orai' +nativeCurrencySymbol: ORAI +gasLimitEstimate: 500000 diff --git a/src/templates/root.yml b/src/templates/root.yml index 748ec134b2..f7dda42108 100644 --- a/src/templates/root.yml +++ b/src/templates/root.yml @@ -131,3 +131,7 @@ configurations: $namespace carbon: configurationPath: carbon.yml schemaPath: carbon-schema.json + + $namespace oraichain: + configurationPath: oraichain.yml + schemaPath: oraichain-schema.json From 34c4fedcb753a44226fdc73f34415b841008c883 Mon Sep 17 00:00:00 2001 From: trung2891 Date: Wed, 24 Jan 2024 13:59:37 +0700 Subject: [PATCH 04/24] feat: add oraichain to chainlist --- src/chains/oraichain/oraichain.config.ts | 39 ++++++++++ src/chains/oraichain/oraichain.ts | 95 ++++++++++++++++++++++++ src/templates/oraichain.yml | 1 + 3 files changed, 135 insertions(+) create mode 100644 src/chains/oraichain/oraichain.config.ts create mode 100644 src/chains/oraichain/oraichain.ts diff --git a/src/chains/oraichain/oraichain.config.ts b/src/chains/oraichain/oraichain.config.ts new file mode 100644 index 0000000000..9193c272b1 --- /dev/null +++ b/src/chains/oraichain/oraichain.config.ts @@ -0,0 +1,39 @@ +import { TokenListType } from '../../services/base'; +import { ConfigManagerV2 } from '../../services/config-manager-v2'; +export interface NetworkConfig { + name: string; + rpcURL: string; + tokenListType: TokenListType; + tokenListSource: string; +} + +export interface Config { + network: NetworkConfig; + nativeCurrencySymbol: string; + manualGasPrice: number; +} + +export namespace OraichainConfig { + export const config: Config = getOraichainConfig('oraichain'); +} + +export function getOraichainConfig(chainName: string): Config { + const configManager = ConfigManagerV2.getInstance(); + const network = configManager.get(chainName + '.network'); + return { + network: { + name: network, + rpcURL: configManager.get(chainName + '.networks.' + network + '.rpcURL'), + tokenListType: configManager.get( + chainName + '.networks.' + network + '.tokenListType' + ), + tokenListSource: configManager.get( + chainName + '.networks.' + network + '.tokenListSource' + ), + }, + nativeCurrencySymbol: configManager.get( + chainName + '.nativeCurrencySymbol' + ), + manualGasPrice: configManager.get(chainName + '.manualGasPrice'), + }; +} diff --git a/src/chains/oraichain/oraichain.ts b/src/chains/oraichain/oraichain.ts new file mode 100644 index 0000000000..4ea954c8fc --- /dev/null +++ b/src/chains/oraichain/oraichain.ts @@ -0,0 +1,95 @@ +import { Cosmosish } from '../../services/common-interfaces'; +import { CosmosBase } from '../cosmos/cosmos-base'; +import { getOraichainConfig } from './oraichain.config'; +import { logger } from '../../services/logger'; +import { CosmosController } from '../cosmos/cosmos.controllers'; + +export class Oraichain extends CosmosBase implements Cosmosish { + private static _instances: { [name: string]: Oraichain }; + private _gasPrice: number; + private _nativeTokenSymbol: string; + private _chain: string; + private _requestCount: number; + private _metricsLogInterval: number; + private _metricTimer; + public controller; + + private constructor(network: string) { + const config = getOraichainConfig('oraichain'); + super( + 'cosmos', + config.network.rpcURL, + config.network.tokenListSource, + config.network.tokenListType, + config.manualGasPrice + ); + this._chain = network; + this._nativeTokenSymbol = config.nativeCurrencySymbol; + + this._gasPrice = config.manualGasPrice; + + this._requestCount = 0; + this._metricsLogInterval = 300000; // 5 minutes + + this._metricTimer = setInterval( + this.metricLogger.bind(this), + this.metricsLogInterval + ); + this.controller = CosmosController; + } + + public static getInstance(network: string): Oraichain { + if (Oraichain._instances === undefined) { + Oraichain._instances = {}; + } + if (!(network in Oraichain._instances)) { + Oraichain._instances[network] = new Oraichain(network); + } + return Oraichain._instances[network]; + } + + public static getConnectedInstances(): { [name: string]: Oraichain } { + return Oraichain._instances; + } + + public requestCounter(msg: any): void { + if (msg.action === 'request') this._requestCount += 1; + } + + public metricLogger(): void { + logger.info( + this.requestCount + + ' request(s) sent in last ' + + this.metricsLogInterval / 1000 + + ' seconds.' + ); + this._requestCount = 0; // reset + } + + public get gasPrice(): number { + return this._gasPrice; + } + + public get chain(): string { + return this._chain; + } + + public get nativeTokenSymbol(): string { + return this._nativeTokenSymbol; + } + + public get requestCount(): number { + return this._requestCount; + } + + public get metricsLogInterval(): number { + return this._metricsLogInterval; + } + + async close() { + clearInterval(this._metricTimer); + if (this._chain in Oraichain._instances) { + delete Oraichain._instances[this._chain]; + } + } +} diff --git a/src/templates/oraichain.yml b/src/templates/oraichain.yml index 42ebd5dd18..cb3a767ccb 100644 --- a/src/templates/oraichain.yml +++ b/src/templates/oraichain.yml @@ -20,3 +20,4 @@ gasPrice: 0.001 gasPriceSuffix: 'orai' nativeCurrencySymbol: ORAI gasLimitEstimate: 500000 +manualGasPrice: 110 From a7b5647d85e4f10756f1db2d38e7e9b3ff0b2d36 Mon Sep 17 00:00:00 2001 From: trung2891 Date: Thu, 25 Jan 2024 01:21:33 +0700 Subject: [PATCH 05/24] feat: impl CLOBish for Oraidex --- package.json | 1 + src/connectors/connectors.routes.ts | 7 ++ src/connectors/oraidex/oraidex.config.ts | 29 ++++++ src/connectors/oraidex/oraidex.model.ts | 1 + src/connectors/oraidex/oraidex.ts | 113 +++++++++++++++++++++++ src/connectors/oraidex/oraidex.types.ts | 54 +++++++++++ src/services/connection-manager.ts | 3 + src/templates/lists/oraichain.json | 9 ++ 8 files changed, 217 insertions(+) create mode 100644 src/connectors/oraidex/oraidex.config.ts create mode 100644 src/connectors/oraidex/oraidex.model.ts create mode 100644 src/connectors/oraidex/oraidex.ts create mode 100644 src/connectors/oraidex/oraidex.types.ts diff --git a/package.json b/package.json index ef6c88127c..70f04fc333 100644 --- a/package.json +++ b/package.json @@ -42,6 +42,7 @@ "@osmonauts/math": "^1.11.3", "@pancakeswap/sdk": "^4.0.0", "@pancakeswap/smart-router": "^4.2.1", + "@oraichain/oraidex-contracts-sdk": "^1.0.31", "@pancakeswap/swap-sdk-core": "^1.0.0", "@pancakeswap/tokens": "^0.1.6", "@pancakeswap/v3-core": "^1.0.2", diff --git a/src/connectors/connectors.routes.ts b/src/connectors/connectors.routes.ts index d9ac0b63f9..f44f303882 100644 --- a/src/connectors/connectors.routes.ts +++ b/src/connectors/connectors.routes.ts @@ -24,6 +24,7 @@ import { KujiraConfig } from './kujira/kujira.config'; import { QuipuswapConfig } from './quipuswap/quipuswap.config'; import { OsmosisConfig } from '../chains/osmosis/osmosis.config'; import { CarbonConfig } from './carbon/carbon.config'; +import { OraidexConfig } from './oraidex/oraidex.config'; export namespace ConnectorsRoutes { export const router = Router(); @@ -183,6 +184,12 @@ export namespace ConnectorsRoutes { chain_type: CarbonConfig.config.chainType, available_networks: CarbonConfig.config.availableNetworks, }, + { + name: 'oraidex', + trading_type: OraidexConfig.config.tradingTypes, + chain_type: OraidexConfig.config.chainType, + available_networks: OraidexConfig.config.availableNetworks, + }, ], }); }) diff --git a/src/connectors/oraidex/oraidex.config.ts b/src/connectors/oraidex/oraidex.config.ts new file mode 100644 index 0000000000..88bb6b20bf --- /dev/null +++ b/src/connectors/oraidex/oraidex.config.ts @@ -0,0 +1,29 @@ +// import { BigNumber } from 'bignumber.js'; +import { ConfigManagerV2 } from '../../services/config-manager-v2'; + +const configManager = ConfigManagerV2.getInstance(); + +export interface NetworkConfig { + name: string; + nodeURL: string | null; + chainId: string; + tokenListType: string; + tokenListSource: string; +} + +export namespace OraidexConfig { + export const config = { + chainType: 'cosmos', + tradingTypes: ['CLOB_SPOT'], + chain: 'oraichain', + networks: new Map( + Object.entries(configManager.get(`oraichain.networks`)) + ), + availableNetworks: [ + { + chain: 'oraichain', + networks: Object.keys(configManager.get(`oraichain.networks`)), + }, + ], + }; +} diff --git a/src/connectors/oraidex/oraidex.model.ts b/src/connectors/oraidex/oraidex.model.ts new file mode 100644 index 0000000000..36986fb99c --- /dev/null +++ b/src/connectors/oraidex/oraidex.model.ts @@ -0,0 +1 @@ +export class OraidexModel {} diff --git a/src/connectors/oraidex/oraidex.ts b/src/connectors/oraidex/oraidex.ts new file mode 100644 index 0000000000..bc3a041070 --- /dev/null +++ b/src/connectors/oraidex/oraidex.ts @@ -0,0 +1,113 @@ +import { + ClobDeleteOrderRequest, + ClobGetOrderRequest, + ClobGetOrderResponse, + ClobMarketsRequest, + ClobOrderbookRequest, + ClobPostOrderRequest, + ClobTickerRequest, +} from '../../clob/clob.requests'; +import { + CLOBish, + MarketInfo, + NetworkSelectionRequest, + Orderbook, +} from '../../services/common-interfaces'; + +export class OraidexCLOB implements CLOBish { + chain: string; + + network: string; + + public parsedMarkets: MarketInfo = {}; + + private _ready: boolean = false; + private static _instances: { [name: string]: OraidexCLOB }; + + private constructor(chain: string, network: string) { + this.chain = chain; + this.network = network; + } + + public static getInstance(chain: string, network: string): OraidexCLOB { + if (OraidexCLOB._instances === undefined) { + OraidexCLOB._instances = {}; + } + + const key = `${chain}:${network}`; + + if (!(key in OraidexCLOB._instances)) { + OraidexCLOB._instances[key] = new OraidexCLOB(chain, network); + } + + return OraidexCLOB._instances[key]; + } + + public static getConnectedInstances(): { [key: string]: OraidexCLOB } { + return OraidexCLOB._instances; + } + + async init() { + // this.kujira = await KujiraModel.getInstance(this.chain, this.network); + // await this.kujira.init(); + // await this.loadMarkets(); + this._ready = true; + } + + ready(): boolean { + return this._ready; + } + + public async loadMarkets() { + // const rawMarkets = await this.fetchMarkets(); + // for (const market of rawMarkets) { + // this.parsedMarkets[market.marketId] = market; + // } + } + + async markets(_req: ClobMarketsRequest): Promise<{ markets: MarketInfo }> { + return { markets: this.parsedMarkets }; + } + + public async orderBook(_req: ClobOrderbookRequest): Promise { + const buys: any = []; + const sells: any = []; + return { buys, sells }; + } + + public async ticker( + _req: ClobTickerRequest + ): Promise<{ markets: MarketInfo }> { + return { markets: {} }; + } + + public async orders( + _req: ClobGetOrderRequest + ): Promise<{ orders: ClobGetOrderResponse['orders'] }> { + return { orders: [] }; + } + + async postOrder( + _req: ClobPostOrderRequest + ): Promise<{ txHash: string; id?: string }> { + return { txHash: '' }; + } + + async deleteOrder(_req: ClobDeleteOrderRequest): Promise<{ txHash: string }> { + return { txHash: '' }; + } + + estimateGas(_req: NetworkSelectionRequest): { + gasPrice: number; + gasPriceToken: string; + gasLimit: number; + gasCost: number; + } { + return { + gasCost: 0, + gasLimit: 0, + gasPrice: 0, + gasPriceToken: 'orai', + }; + } +} diff --git a/src/connectors/oraidex/oraidex.types.ts b/src/connectors/oraidex/oraidex.types.ts new file mode 100644 index 0000000000..5300e00a35 --- /dev/null +++ b/src/connectors/oraidex/oraidex.types.ts @@ -0,0 +1,54 @@ +import { AssetInfo } from '@oraichain/oraidex-contracts-sdk'; +import { BigNumber } from 'bignumber.js'; + +// +// Types and Constants +// + +export type Fee = BigNumber; + +export type FeeMaker = Fee; +export type FeeTaker = Fee; +export type FeeServiceProvider = Fee; + +// +// Enums +// +export enum OrderDirection { + BUY = 'BUY', + SELL = 'SELL', +} + +export enum OrderStatus { + OPEN = 'OPEN', + CANCELLED = 'CANCELLED', + PARTIALLY_FILLED = 'PARTIALLY_FILLED', + FILLED = 'FILLED', + CREATION_PENDING = 'CREATION_PENDING', + CANCELLATION_PENDING = 'CANCELLATION_PENDING', + UNKNOWN = 'UNKNOWN', +} + +export enum OrderType { + MARKET = 'MARKET', + LIMIT = 'LIMIT', + IOC = 'IOC', // Immediate or Cancel +} + +// +// Interfaces +// +export interface Market { + marketId: string; + baseToken: AssetInfo; + quoteToken: AssetInfo; + min_quote_coin_amount: string; + spread: string; // Also called tickSize + fees: MarketFee; +} + +export interface MarketFee { + maker: FeeMaker; + taker: FeeTaker; + serviceProvider: FeeServiceProvider; +} diff --git a/src/services/connection-manager.ts b/src/services/connection-manager.ts index e2bd6d4866..e653cbe1b1 100644 --- a/src/services/connection-manager.ts +++ b/src/services/connection-manager.ts @@ -45,6 +45,7 @@ import { PancakeswapLP } from '../connectors/pancakeswap/pancakeswap.lp'; import { XRPLCLOB } from '../connectors/xrpl/xrpl'; import { QuipuSwap } from '../connectors/quipuswap/quipuswap'; import { Carbonamm } from '../connectors/carbon/carbonAMM'; +import { OraidexCLOB } from '../connectors/oraidex/oraidex'; export type ChainUnion = | Algorand @@ -249,6 +250,8 @@ export async function getConnector( connectorInstance = QuipuSwap.getInstance(network); } else if (chain === 'ethereum' && connector === 'carbonamm') { connectorInstance = Carbonamm.getInstance(chain, network); + } else if (chain === 'oraichain' && connector === 'oraidex') { + connectorInstance = OraidexCLOB.getInstance(chain, network); } else { throw new Error('unsupported chain or connector'); } diff --git a/src/templates/lists/oraichain.json b/src/templates/lists/oraichain.json index e518834336..a2c534efc9 100644 --- a/src/templates/lists/oraichain.json +++ b/src/templates/lists/oraichain.json @@ -2,10 +2,19 @@ "name": "Oraichain token list", "URI": "", "tokens": [ + { + "name": "Oraichain token", + "symbol": "ORAI", + "address": "", + "denom": "orai", + "decimals": 6, + "chainId": "Oraichain" + }, { "name": "USDT token", "symbol": "USDT", "address": "orai12hzjxfh77wl572gdzct2fxv2arxcwh6gykc7qh", + "denom": "", "decimals": 6, "chainId": "Oraichain" } From 9c8fd50e359f2f59376734d27599b657af00e9e5 Mon Sep 17 00:00:00 2001 From: trung2891 Date: Thu, 25 Jan 2024 18:22:21 +0700 Subject: [PATCH 06/24] chore: add getTokens() & markets() on Oraichain --- src/chains/oraichain/oraichain.config.ts | 26 ++++++-- src/chains/oraichain/oraichain.controller.ts | 42 ++++++++++++ src/chains/oraichain/oraichain.ts | 68 ++++++++++++++++++-- src/chains/oraichain/oraichain.validators.ts | 8 +++ src/clob/clob.controllers.ts | 2 +- src/connectors/oraidex/oraidex.model.ts | 59 ++++++++++++++++- src/connectors/oraidex/oraidex.ts | 27 +++++++- src/services/connection-manager.ts | 10 ++- src/services/schema/oraichain-schema.json | 9 ++- src/templates/lists/oraichain.json | 4 +- src/templates/lists/oraidex_markets.json | 16 +++++ src/templates/oraichain.yml | 10 ++- 12 files changed, 257 insertions(+), 24 deletions(-) create mode 100644 src/chains/oraichain/oraichain.controller.ts create mode 100644 src/chains/oraichain/oraichain.validators.ts create mode 100644 src/templates/lists/oraidex_markets.json diff --git a/src/chains/oraichain/oraichain.config.ts b/src/chains/oraichain/oraichain.config.ts index 9193c272b1..b9f98ba5c4 100644 --- a/src/chains/oraichain/oraichain.config.ts +++ b/src/chains/oraichain/oraichain.config.ts @@ -5,6 +5,8 @@ export interface NetworkConfig { rpcURL: string; tokenListType: TokenListType; tokenListSource: string; + marketListType: string; + marketListSource: string; } export interface Config { @@ -14,21 +16,31 @@ export interface Config { } export namespace OraichainConfig { - export const config: Config = getOraichainConfig('oraichain'); + export const config: Config = getOraichainConfig('oraichain', 'mainnet'); } -export function getOraichainConfig(chainName: string): Config { +export function getOraichainConfig( + chainName: string, + networkName: string +): Config { const configManager = ConfigManagerV2.getInstance(); - const network = configManager.get(chainName + '.network'); return { network: { - name: network, - rpcURL: configManager.get(chainName + '.networks.' + network + '.rpcURL'), + name: networkName, + rpcURL: configManager.get( + chainName + '.networks.' + networkName + '.nodeURL' + ), tokenListType: configManager.get( - chainName + '.networks.' + network + '.tokenListType' + chainName + '.networks.' + networkName + '.tokenListType' ), tokenListSource: configManager.get( - chainName + '.networks.' + network + '.tokenListSource' + chainName + '.networks.' + networkName + '.tokenListSource' + ), + marketListType: configManager.get( + chainName + '.networks.' + networkName + '.marketListType' + ), + marketListSource: configManager.get( + chainName + '.networks.' + networkName + '.marketListSource' ), }, nativeCurrencySymbol: configManager.get( diff --git a/src/chains/oraichain/oraichain.controller.ts b/src/chains/oraichain/oraichain.controller.ts new file mode 100644 index 0000000000..ea0c002629 --- /dev/null +++ b/src/chains/oraichain/oraichain.controller.ts @@ -0,0 +1,42 @@ +import { TokensRequest } from '../../network/network.requests'; +import { TokenInfo } from '../../services/base'; +import { CosmosController } from '../cosmos/cosmos.controllers'; +import { Token } from '../cosmos/cosmos-base'; +import { Oraichain } from './oraichain'; +import { validateGetTokensRequest } from './oraichain.validators'; + +export class OraichainController extends CosmosController { + static async getTokens( + oraichainLish: Oraichain, + req: TokensRequest + ): Promise<{ tokens: TokenInfo[] }> { + validateGetTokensRequest(req); + + let tokens: Token[] = []; + if (!req.tokenSymbols) { + tokens = oraichainLish.storedTokenList; + } else { + for (const t of req.tokenSymbols as []) { + const token = oraichainLish.getTokenForSymbol(t); + if (token != undefined) { + tokens.push(token); + } + } + } + + // convert token into TokenINfo + const tokensInfo: TokenInfo[] = []; + tokens.map((token) => { + const tokenInfo: TokenInfo = { + address: token.address, + chainId: 0, + decimals: token.decimals, + name: token.name, + symbol: token.symbol, + }; + tokensInfo.push(tokenInfo); + }); + + return { tokens: tokensInfo }; + } +} diff --git a/src/chains/oraichain/oraichain.ts b/src/chains/oraichain/oraichain.ts index 4ea954c8fc..7cfab49e5b 100644 --- a/src/chains/oraichain/oraichain.ts +++ b/src/chains/oraichain/oraichain.ts @@ -2,7 +2,17 @@ import { Cosmosish } from '../../services/common-interfaces'; import { CosmosBase } from '../cosmos/cosmos-base'; import { getOraichainConfig } from './oraichain.config'; import { logger } from '../../services/logger'; -import { CosmosController } from '../cosmos/cosmos.controllers'; +import { MarketListType, TokenInfo } from '../../services/base'; +import axios from 'axios'; +import { promises as fs } from 'fs'; +import { OraichainController } from './oraichain.controller'; + +export type MarketInfo = { + id: number; + marketId: string; + base: TokenInfo; + quote: TokenInfo; +}; export class Oraichain extends CosmosBase implements Cosmosish { private static _instances: { [name: string]: Oraichain }; @@ -12,12 +22,19 @@ export class Oraichain extends CosmosBase implements Cosmosish { private _requestCount: number; private _metricsLogInterval: number; private _metricTimer; + private _marketListSource: string; + private _marketListType: MarketListType; + public controller; + protected marketList: MarketInfo[] = []; + private _marketMap: Record = {}; + private constructor(network: string) { - const config = getOraichainConfig('oraichain'); + const config = getOraichainConfig('oraichain', network); + console.log(config); super( - 'cosmos', + 'oraichain', config.network.rpcURL, config.network.tokenListSource, config.network.tokenListType, @@ -25,6 +42,8 @@ export class Oraichain extends CosmosBase implements Cosmosish { ); this._chain = network; this._nativeTokenSymbol = config.nativeCurrencySymbol; + this._marketListSource = config.network.marketListSource; + this._marketListType = config.network.marketListType; this._gasPrice = config.manualGasPrice; @@ -35,7 +54,7 @@ export class Oraichain extends CosmosBase implements Cosmosish { this.metricLogger.bind(this), this.metricsLogInterval ); - this.controller = CosmosController; + this.controller = OraichainController; } public static getInstance(network: string): Oraichain { @@ -48,6 +67,47 @@ export class Oraichain extends CosmosBase implements Cosmosish { return Oraichain._instances[network]; } + async init(): Promise { + if (!this.ready()) { + await super.init(); + await this.loadMarkets(this._marketListSource, this._marketListType); + } + } + + async loadMarkets( + marketListSource: string, + marketListType: MarketListType + ): Promise { + console.log(marketListSource, marketListType); + this.marketList = await this.getMarketList( + marketListSource, + marketListType + ); + if (this.marketList) { + this.marketList.forEach((market: MarketInfo) => { + if (!this._marketMap[market.marketId]) { + this._marketMap[market.marketId] = []; + } + + this._marketMap[market.marketId].push(market); + }); + } + } + + async getMarketList( + marketListSource: string, + marketListType: MarketListType + ): Promise { + let markets; + if (marketListType === 'URL') { + const resp = await axios.get(marketListSource); + markets = resp.data.tokens; + } else { + markets = JSON.parse(await fs.readFile(marketListSource, 'utf8')); + } + return markets; + } + public static getConnectedInstances(): { [name: string]: Oraichain } { return Oraichain._instances; } diff --git a/src/chains/oraichain/oraichain.validators.ts b/src/chains/oraichain/oraichain.validators.ts new file mode 100644 index 0000000000..08f92d1671 --- /dev/null +++ b/src/chains/oraichain/oraichain.validators.ts @@ -0,0 +1,8 @@ +import { + RequestValidator, + mkRequestValidator, +} from '../../services/validators'; + +export const validateGetTokensRequest: RequestValidator = mkRequestValidator( + [] +); diff --git a/src/clob/clob.controllers.ts b/src/clob/clob.controllers.ts index 42ce7624d3..4543121255 100644 --- a/src/clob/clob.controllers.ts +++ b/src/clob/clob.controllers.ts @@ -43,7 +43,7 @@ import { PerpClobGetLastTradePriceRequest, PerpClobGetLastTradePriceResponse, PerpClobBatchUpdateRequest, - PerpClobBatchUpdateResponse + PerpClobBatchUpdateResponse, } from './clob.requests'; import { HttpException, diff --git a/src/connectors/oraidex/oraidex.model.ts b/src/connectors/oraidex/oraidex.model.ts index 36986fb99c..a35ea52b7e 100644 --- a/src/connectors/oraidex/oraidex.model.ts +++ b/src/connectors/oraidex/oraidex.model.ts @@ -1 +1,58 @@ -export class OraidexModel {} +import { Oraichain } from '../../chains/oraichain/oraichain'; + +export class OraidexModel { + /** + * + * @private + */ + oraichainNetwork: Oraichain; + /** + * + */ + chain: string; + + /** + * + */ + network: string; + + /** + * + * @private + */ + private static _instances: { [name: string]: OraidexModel }; + + /** + * Get the Kujira instance for the given chain and network. + * + * @param chain + * @param network + */ + public static getInstance(chain: string, network: string): OraidexModel { + if (OraidexModel._instances === undefined) { + OraidexModel._instances = {}; + } + + const key = `${chain}:${network}`; + + if (!(key in OraidexModel._instances)) { + OraidexModel._instances[key] = new OraidexModel(chain, network); + } + + return OraidexModel._instances[key]; + } + + /** + * Creates a new instance of Oraichain. + * + * @param chain + * @param network + * @private + */ + private constructor(chain: string, network: string) { + this.chain = chain; + this.network = network; + + this.oraichainNetwork = Oraichain.getInstance(network); + } +} diff --git a/src/connectors/oraidex/oraidex.ts b/src/connectors/oraidex/oraidex.ts index bc3a041070..3ae2e73442 100644 --- a/src/connectors/oraidex/oraidex.ts +++ b/src/connectors/oraidex/oraidex.ts @@ -13,6 +13,8 @@ import { NetworkSelectionRequest, Orderbook, } from '../../services/common-interfaces'; +import { OraidexModel } from './oraidex.model'; +// import { Market } from './oraidex.types'; export class OraidexCLOB implements CLOBish { chain: string; @@ -21,12 +23,17 @@ export class OraidexCLOB implements CLOBish { public parsedMarkets: MarketInfo = {}; + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore + private oraidex: OraidexModel; + private _ready: boolean = false; private static _instances: { [name: string]: OraidexCLOB }; private constructor(chain: string, network: string) { this.chain = chain; this.network = network; + this.oraidex = OraidexModel.getInstance(chain, network); } public static getInstance(chain: string, network: string): OraidexCLOB { @@ -48,9 +55,9 @@ export class OraidexCLOB implements CLOBish { } async init() { - // this.kujira = await KujiraModel.getInstance(this.chain, this.network); - // await this.kujira.init(); - // await this.loadMarkets(); + this.oraidex = await OraidexModel.getInstance(this.chain, this.network); + await this.oraidex.oraichainNetwork.init(); + await this.loadMarkets(); this._ready = true; } @@ -69,6 +76,20 @@ export class OraidexCLOB implements CLOBish { return { markets: this.parsedMarkets }; } + // Utility methods: + // async fetchMarkets(): Promise { + // const loadedMarkets: Market[] = []; + // const markets = this._xrpl.storedMarketList; + // const getMarket = async (market: MarketInfo): Promise => { + // const processedMarket = await this.getMarket(market); + // loadedMarkets.push(processedMarket); + // }; + + // // await promiseAllInBatches(getMarket, markets, 1, 1); + + // return loadedMarkets; + // } + public async orderBook(_req: ClobOrderbookRequest): Promise { const buys: any = []; const sells: any = []; diff --git a/src/services/connection-manager.ts b/src/services/connection-manager.ts index e653cbe1b1..4c58f231bc 100644 --- a/src/services/connection-manager.ts +++ b/src/services/connection-manager.ts @@ -46,6 +46,7 @@ import { XRPLCLOB } from '../connectors/xrpl/xrpl'; import { QuipuSwap } from '../connectors/quipuswap/quipuswap'; import { Carbonamm } from '../connectors/carbon/carbonAMM'; import { OraidexCLOB } from '../connectors/oraidex/oraidex'; +import { Oraichain } from '../chains/oraichain/oraichain'; export type ChainUnion = | Algorand @@ -56,7 +57,8 @@ export type ChainUnion = | Tezosish | XRPLish | Kujira - | Osmosis; + | Osmosis + | Oraichain; export type Chain = T extends Algorand ? Algorand @@ -76,7 +78,9 @@ export type Chain = T extends Algorand ? KujiraCLOB : T extends Osmosis ? Osmosis - : never; + : T extends OraidexCLOB + ? OraidexCLOB + : never; export class UnsupportedChainException extends Error { constructor(message?: string) { @@ -141,6 +145,8 @@ export async function getChainInstance( connection = XRPL.getInstance(network); } else if (chain === 'kujira') { connection = Kujira.getInstance(network); + } else if (chain === 'oraichain') { + connection = Oraichain.getInstance(network); } else { connection = undefined; } diff --git a/src/services/schema/oraichain-schema.json b/src/services/schema/oraichain-schema.json index e6bbf364ee..290bcfd8c2 100644 --- a/src/services/schema/oraichain-schema.json +++ b/src/services/schema/oraichain-schema.json @@ -15,6 +15,12 @@ }, "tokenListSource": { "type": "string" + }, + "marketListType": { + "type": "string" + }, + "marketListSource": { + "type": "string" } }, "required": ["chainId", "nodeURL"], @@ -27,7 +33,8 @@ "gasLimitEstimate": { "type": "number" }, "prefix": { "type": "string" }, "gasPrice": { "type": "number" }, - "gasPriceSuffix": { "type": "string" } + "gasPriceSuffix": { "type": "string" }, + "manualGasPrice": { "type": "number" } }, "additionalProperties": false, "required": ["nativeCurrencySymbol"] diff --git a/src/templates/lists/oraichain.json b/src/templates/lists/oraichain.json index a2c534efc9..22852bc062 100644 --- a/src/templates/lists/oraichain.json +++ b/src/templates/lists/oraichain.json @@ -4,8 +4,7 @@ "tokens": [ { "name": "Oraichain token", - "symbol": "ORAI", - "address": "", + "address": "orai", "denom": "orai", "decimals": 6, "chainId": "Oraichain" @@ -14,7 +13,6 @@ "name": "USDT token", "symbol": "USDT", "address": "orai12hzjxfh77wl572gdzct2fxv2arxcwh6gykc7qh", - "denom": "", "decimals": 6, "chainId": "Oraichain" } diff --git a/src/templates/lists/oraidex_markets.json b/src/templates/lists/oraidex_markets.json new file mode 100644 index 0000000000..d0b73e0717 --- /dev/null +++ b/src/templates/lists/oraidex_markets.json @@ -0,0 +1,16 @@ +[ + { + "id": "1", + "marketId": "ORAI-USDT", + "base": { + "denom": "orai", + "contractAddr": "", + "decimals": 6 + }, + "quote": { + "denom": "", + "contractAddr": "orai12hzjxfh77wl572gdzct2fxv2arxcwh6gykc7qh", + "decimals": "6" + } + } +] diff --git a/src/templates/oraichain.yml b/src/templates/oraichain.yml index cb3a767ccb..e6bdd38aff 100644 --- a/src/templates/oraichain.yml +++ b/src/templates/oraichain.yml @@ -1,19 +1,25 @@ networks: mainnet: - chainId: mainnet + chainId: Oraichain nodeURL: https://rpc.orai.io tokenListType: FILE tokenListSource: /home/gateway/conf/lists/oraichain.json + marketListType: FILE + marketListSource: /home/gateway/conf/lists/oraidex_markets.json testnet: - chainId: testnet + chainId: Oraichain-testnet nodeURL: https://testnet.rpc.orai.io tokenListType: FILE tokenListSource: /home/gateway/conf/lists/oraichain.json + marketListType: FILE + marketListSource: /home/gateway/conf/lists/oraidex_markets.json simulate: chainId: simulate nodeURL: simulate tokenListType: FILE tokenListSource: /home/gateway/conf/lists/oraichain.json + marketListType: FILE + marketListSource: /home/gateway/conf/lists/oraidex_markets.json prefix: "orai" gasPrice: 0.001 From 004485d921330fa616aafeeed5f4ad9ec51daf73 Mon Sep 17 00:00:00 2001 From: trung2891 Date: Tue, 30 Jan 2024 01:54:29 +0700 Subject: [PATCH 07/24] feat: impl function of CLOBish --- src/chains/oraichain/oraichain.ts | 40 ++++- src/connectors/oraidex/oraidex.config.ts | 3 + src/connectors/oraidex/oraidex.helper.ts | 45 ++++++ src/connectors/oraidex/oraidex.ts | 191 ++++++++++++++++++++--- src/connectors/oraidex/oraidex.types.ts | 17 +- src/services/schema/oraidex-schema.json | 22 +++ src/services/wallet/wallet.validators.ts | 5 + src/templates/lists/oraidex_markets.json | 12 +- src/templates/oraidex.yml | 6 + src/templates/root.yml | 4 + 10 files changed, 312 insertions(+), 33 deletions(-) create mode 100644 src/connectors/oraidex/oraidex.helper.ts create mode 100644 src/services/schema/oraidex-schema.json create mode 100644 src/templates/oraidex.yml diff --git a/src/chains/oraichain/oraichain.ts b/src/chains/oraichain/oraichain.ts index 7cfab49e5b..31b1abad3f 100644 --- a/src/chains/oraichain/oraichain.ts +++ b/src/chains/oraichain/oraichain.ts @@ -6,6 +6,12 @@ import { MarketListType, TokenInfo } from '../../services/base'; import axios from 'axios'; import { promises as fs } from 'fs'; import { OraichainController } from './oraichain.controller'; +import { + JsonObject, + CosmWasmClient, + SigningCosmWasmClient, +} from '@cosmjs/cosmwasm-stargate'; +import * as cosmwasm from '@cosmjs/cosmwasm-stargate'; export type MarketInfo = { id: number; @@ -16,6 +22,7 @@ export type MarketInfo = { export class Oraichain extends CosmosBase implements Cosmosish { private static _instances: { [name: string]: Oraichain }; + private _rpcUrl: string; private _gasPrice: number; private _nativeTokenSymbol: string; private _chain: string; @@ -25,6 +32,14 @@ export class Oraichain extends CosmosBase implements Cosmosish { private _marketListSource: string; private _marketListType: MarketListType; + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore + private _cosmwasmClient: CosmWasmClient; + + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore + private _signCosmwasmClient: SigningCosmWasmClient; + public controller; protected marketList: MarketInfo[] = []; @@ -32,7 +47,7 @@ export class Oraichain extends CosmosBase implements Cosmosish { private constructor(network: string) { const config = getOraichainConfig('oraichain', network); - console.log(config); + super( 'oraichain', config.network.rpcURL, @@ -40,6 +55,7 @@ export class Oraichain extends CosmosBase implements Cosmosish { config.network.tokenListType, config.manualGasPrice ); + this._rpcUrl = config.network.rpcURL; this._chain = network; this._nativeTokenSymbol = config.nativeCurrencySymbol; this._marketListSource = config.network.marketListSource; @@ -71,6 +87,10 @@ export class Oraichain extends CosmosBase implements Cosmosish { if (!this.ready()) { await super.init(); await this.loadMarkets(this._marketListSource, this._marketListType); + //init cosmwasm client + this._cosmwasmClient = await cosmwasm.SigningCosmWasmClient.connect( + this._rpcUrl + ); } } @@ -126,6 +146,13 @@ export class Oraichain extends CosmosBase implements Cosmosish { this._requestCount = 0; // reset } + public async queryContractSmart( + address: string, + query: JsonObject + ): Promise { + return await this._cosmwasmClient.queryContractSmart(address, query); + } + public get gasPrice(): number { return this._gasPrice; } @@ -146,6 +173,17 @@ export class Oraichain extends CosmosBase implements Cosmosish { return this._metricsLogInterval; } + public get storedMarketList(): MarketInfo[] { + return this.marketList; + } + + public get cosmwasmClient(): CosmWasmClient { + return this._cosmwasmClient; + } + public get signCosmwasmClient(): SigningCosmWasmClient { + return this._signCosmwasmClient; + } + async close() { clearInterval(this._metricTimer); if (this._chain in Oraichain._instances) { diff --git a/src/connectors/oraidex/oraidex.config.ts b/src/connectors/oraidex/oraidex.config.ts index 88bb6b20bf..e1edfde3a3 100644 --- a/src/connectors/oraidex/oraidex.config.ts +++ b/src/connectors/oraidex/oraidex.config.ts @@ -25,5 +25,8 @@ export namespace OraidexConfig { networks: Object.keys(configManager.get(`oraichain.networks`)), }, ], + swapLimitOrder: configManager.get( + 'oraidex.contractAddresses.mainnet.swapLimitOrder' + ), }; } diff --git a/src/connectors/oraidex/oraidex.helper.ts b/src/connectors/oraidex/oraidex.helper.ts new file mode 100644 index 0000000000..94ac5c71bf --- /dev/null +++ b/src/connectors/oraidex/oraidex.helper.ts @@ -0,0 +1,45 @@ +import { AssetInfo } from '@oraichain/oraidex-contracts-sdk'; + +/** + * + * @param value + * @param errorMessage + */ +export const getNotNullOrThrowError = ( + value?: any, + errorMessage: string = 'Value is null or undefined' +): R => { + if (value === undefined || value === null) throw new Error(errorMessage); + + return value as R; +}; + +/** + * + * @param milliseconds + */ +export const sleep = (milliseconds: number) => + new Promise((callback) => setTimeout(callback, milliseconds)); + +/** + * + * @param address native denom or contract address + * @returns return asset info + */ +export const parseToAssetInfo = (address: string): AssetInfo => { + const lowercaseAddress = address.toLocaleLowerCase(); + + if (lowercaseAddress === 'orai' || lowercaseAddress.startsWith('ibc/')) { + return { + native_token: { + denom: address, + }, + }; + } + + return { + token: { + contract_addr: address, + }, + }; +}; diff --git a/src/connectors/oraidex/oraidex.ts b/src/connectors/oraidex/oraidex.ts index 3ae2e73442..322711519f 100644 --- a/src/connectors/oraidex/oraidex.ts +++ b/src/connectors/oraidex/oraidex.ts @@ -1,4 +1,6 @@ +import { MarketInfo } from '../../chains/oraichain/oraichain'; import { + CLOBMarkets, ClobDeleteOrderRequest, ClobGetOrderRequest, ClobGetOrderResponse, @@ -9,28 +11,41 @@ import { } from '../../clob/clob.requests'; import { CLOBish, - MarketInfo, NetworkSelectionRequest, Orderbook, } from '../../services/common-interfaces'; +import { getNotNullOrThrowError, parseToAssetInfo } from './oraidex.helper'; import { OraidexModel } from './oraidex.model'; -// import { Market } from './oraidex.types'; +import { Market, MarketNotFoundError } from './oraidex.types'; +import { BigNumber } from 'bignumber.js'; +import { OraiswapLimitOrderQueryClient } from '@oraichain/oraidex-contracts-sdk'; +import { OraidexConfig } from './oraidex.config'; +import { JsonObject } from '@cosmjs/cosmwasm-stargate'; +const ORDERBOOK_LIMIT = 100; export class OraidexCLOB implements CLOBish { chain: string; network: string; - public parsedMarkets: MarketInfo = {}; + public parsedMarkets: CLOBMarkets = {}; + private _swapLimitOrder: string; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore private oraidex: OraidexModel; + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore + private orderbookQueryClient: OraiswapLimitOrderQueryClient; + private _ready: boolean = false; private static _instances: { [name: string]: OraidexCLOB }; private constructor(chain: string, network: string) { + let config = OraidexConfig.config; + + this._swapLimitOrder = config.swapLimitOrder; this.chain = chain; this.network = network; this.oraidex = OraidexModel.getInstance(chain, network); @@ -58,6 +73,10 @@ export class OraidexCLOB implements CLOBish { this.oraidex = await OraidexModel.getInstance(this.chain, this.network); await this.oraidex.oraichainNetwork.init(); await this.loadMarkets(); + this.orderbookQueryClient = new OraiswapLimitOrderQueryClient( + this.oraidex.oraichainNetwork.cosmwasmClient, + this._swapLimitOrder + ); this._ready = true; } @@ -66,46 +85,168 @@ export class OraidexCLOB implements CLOBish { } public async loadMarkets() { - // const rawMarkets = await this.fetchMarkets(); - // for (const market of rawMarkets) { - // this.parsedMarkets[market.marketId] = market; - // } + const rawMarkets = await this.fetchMarkets(); + for (const market of rawMarkets) { + this.parsedMarkets[market.marketId] = market; + } } - async markets(_req: ClobMarketsRequest): Promise<{ markets: MarketInfo }> { + async markets(_req: ClobMarketsRequest): Promise<{ markets: CLOBMarkets }> { return { markets: this.parsedMarkets }; } - // Utility methods: - // async fetchMarkets(): Promise { - // const loadedMarkets: Market[] = []; - // const markets = this._xrpl.storedMarketList; - // const getMarket = async (market: MarketInfo): Promise => { - // const processedMarket = await this.getMarket(market); - // loadedMarkets.push(processedMarket); - // }; + async fetchMarkets(): Promise { + const loadedMarkets: Market[] = []; + const markets = this.oraidex.oraichainNetwork.storedMarketList; + + markets.forEach(async (market) => { + const processedMarket = await this.getMarket(market); + + loadedMarkets.push(processedMarket); + }); + + return loadedMarkets; + } + + async getMarket(market: MarketInfo): Promise { + if (!market) throw new MarketNotFoundError(`No market informed.`); - // // await promiseAllInBatches(getMarket, markets, 1, 1); + // hotfix: hardcode market info + return { + marketId: market.marketId, + baseToken: parseToAssetInfo(market.base.address), + quoteToken: parseToAssetInfo(market.quote.address), + min_quote_coin_amount: '0', + spread: '0', + fees: { + maker: new BigNumber('0.1'), + taker: new BigNumber('0.1'), + }, + }; + } - // return loadedMarkets; - // } + public async orderBook(req: ClobOrderbookRequest): Promise { + return await this.getOrderBook(this.parsedMarkets[req.market]); + } - public async orderBook(_req: ClobOrderbookRequest): Promise { + async getOrderBook( + market: Market, + limit: number = ORDERBOOK_LIMIT + ): Promise { const buys: any = []; const sells: any = []; + + let res = await this.orderbookQueryClient.orders({ + assetInfos: [market.baseToken, market.quoteToken], + filter: 'none', + limit, + }); + + res.orders.forEach((order) => { + if (order.direction == 'buy') { + let price = ( + parseFloat(order.offer_asset.amount) / + parseFloat(order.ask_asset.amount) + ).toString(); + let quantity = ( + Number(order.ask_asset.amount) - Number(order.filled_ask_amount) + ).toString(); + + buys.push({ + price, + quantity, + timestamp: Date.now(), + }); + } else { + let price = ( + parseFloat(order.ask_asset.amount) / + parseFloat(order.offer_asset.amount) + ).toString(); + let quantity = ( + Number(order.offer_asset.amount) - Number(order.filled_offer_amount) + ).toString(); + + sells.push({ + price, + quantity, + timestamp: Date.now(), + }); + } + }); return { buys, sells }; } public async ticker( - _req: ClobTickerRequest - ): Promise<{ markets: MarketInfo }> { - return { markets: {} }; + req: ClobTickerRequest + ): Promise<{ markets: CLOBMarkets }> { + const requestMarket = getNotNullOrThrowError(req.market); + const midPrice = await this.getMidPriceForMarket( + this.parsedMarkets[requestMarket] + ); + return { + markets: { + market: this.parsedMarkets[requestMarket], + price: midPrice, + timestamp: Date.now(), + }, + }; + } + + private async getMidPriceForMarket(market: Market) { + const midPrice = await this.orderbookQueryClient.midPrice({ + assetInfos: [market.baseToken, market.quoteToken], + }); + + return midPrice; } public async orders( - _req: ClobGetOrderRequest + req: ClobGetOrderRequest ): Promise<{ orders: ClobGetOrderResponse['orders'] }> { - return { orders: [] }; + const requestMarket = getNotNullOrThrowError(req.market); + const market = this.parsedMarkets[requestMarket]; + let originalOrders; + + if (req.address) { + originalOrders = ( + await this.getAllOrders( + market, + getNotNullOrThrowError(req.address) + ) + ).orders; + } else { + const originalOrder = await this.orderbookQueryClient.order({ + orderId: Number(req.orderId), + assetInfos: [market.baseToken, market.quoteToken], + }); + originalOrders = [originalOrder]; + } + return { orders: originalOrders }; + } + + public async getAllOrders(market: Market, owner: string) { + const response: JsonObject = { orders: [] }; + let partialResponse: JsonObject; + + while ( + !partialResponse || + partialResponse.orders.length >= ORDERBOOK_LIMIT + ) { + partialResponse = await this.orderbookQueryClient.orders({ + assetInfos: [market.baseToken, market.quoteToken], + filter: { + bidder: owner, + }, + limit: ORDERBOOK_LIMIT, + startAfter: partialResponse + ? partialResponse.orders[partialResponse.orders.length - 1].order_id + : null, + }); + + response.orders = [...response.orders, ...partialResponse.orders]; + } + + return response; } async postOrder( diff --git a/src/connectors/oraidex/oraidex.types.ts b/src/connectors/oraidex/oraidex.types.ts index 5300e00a35..622532c9e2 100644 --- a/src/connectors/oraidex/oraidex.types.ts +++ b/src/connectors/oraidex/oraidex.types.ts @@ -1,12 +1,20 @@ import { AssetInfo } from '@oraichain/oraidex-contracts-sdk'; import { BigNumber } from 'bignumber.js'; +import { Map as ImmutableMap, Set as ImmutableSet } from 'immutable'; // // Types and Constants // -export type Fee = BigNumber; +export type IMap = ImmutableMap; +export const IMap = ImmutableMap; +export type ISet = ImmutableSet; +export const ISet = ImmutableSet; +export type Address = string; +export type OwnerAddress = Address; +export type OrderId = string; +export type Fee = BigNumber; export type FeeMaker = Fee; export type FeeTaker = Fee; export type FeeServiceProvider = Fee; @@ -50,5 +58,10 @@ export interface Market { export interface MarketFee { maker: FeeMaker; taker: FeeTaker; - serviceProvider: FeeServiceProvider; } + +// +// Errors +// +export class CLOBishError extends Error {} +export class MarketNotFoundError extends CLOBishError {} diff --git a/src/services/schema/oraidex-schema.json b/src/services/schema/oraidex-schema.json new file mode 100644 index 0000000000..593f00621d --- /dev/null +++ b/src/services/schema/oraidex-schema.json @@ -0,0 +1,22 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "contractAddresses": { + "type": "object", + "patternProperties": { + "^\\w+$": { + "type": "object", + "properties": { + "swapLimitOrder": { "type": "string" } + }, + "required": ["swapLimitOrder"], + "additionalProperties": false + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false, + "required": ["contractAddresses"] +} diff --git a/src/services/wallet/wallet.validators.ts b/src/services/wallet/wallet.validators.ts index d58a0db605..57250e581f 100644 --- a/src/services/wallet/wallet.validators.ts +++ b/src/services/wallet/wallet.validators.ts @@ -143,6 +143,11 @@ export const validatePrivateKey: Validator = mkSelectingValidator( invalidKujiraPrivateKeyError, (val) => typeof val === 'string' && isKujiraPrivateKey(val) ), + oraichain: mkValidator( + 'privateKey', + invalidCosmosPrivateKeyError, + (val) => typeof val === 'string' && isCosmosPrivateKey(val) + ), } ); diff --git a/src/templates/lists/oraidex_markets.json b/src/templates/lists/oraidex_markets.json index d0b73e0717..5f5cb398f4 100644 --- a/src/templates/lists/oraidex_markets.json +++ b/src/templates/lists/oraidex_markets.json @@ -3,14 +3,16 @@ "id": "1", "marketId": "ORAI-USDT", "base": { - "denom": "orai", - "contractAddr": "", + "name": "Oraichain token", + "symbol": "ORAI", + "address": "orai", "decimals": 6 }, "quote": { - "denom": "", - "contractAddr": "orai12hzjxfh77wl572gdzct2fxv2arxcwh6gykc7qh", - "decimals": "6" + "name": "USDT token", + "symbol": "USDT", + "address": "orai12hzjxfh77wl572gdzct2fxv2arxcwh6gykc7qh", + "decimals": 6 } } ] diff --git a/src/templates/oraidex.yml b/src/templates/oraidex.yml new file mode 100644 index 0000000000..c637386ff6 --- /dev/null +++ b/src/templates/oraidex.yml @@ -0,0 +1,6 @@ +contractAddresses: + mainnet: + swapLimitOrder: 'orai1nt58gcu4e63v7k55phnr3gaym9tvk3q4apqzqccjuwppgjuyjy6sxk8yzp' + testnet: + swapLimitOrder: 'orai1nt58gcu4e63v7k55phnr3gaym9tvk3q4apqzqccjuwppgjuyjy6sxk8yzp' + \ No newline at end of file diff --git a/src/templates/root.yml b/src/templates/root.yml index f7dda42108..8172365e3e 100644 --- a/src/templates/root.yml +++ b/src/templates/root.yml @@ -135,3 +135,7 @@ configurations: $namespace oraichain: configurationPath: oraichain.yml schemaPath: oraichain-schema.json + + $namespace oraidex: + configurationPath: oraidex.yml + schemaPath: oraidex-schema.json From 0595db1ec6f2ee807eabe5a2bdf74517866f5ffb Mon Sep 17 00:00:00 2001 From: trung2891 Date: Tue, 30 Jan 2024 02:15:43 +0700 Subject: [PATCH 08/24] feat: add oraichain into wallet router --- src/services/wallet/wallet.controllers.ts | 11 +++++++++++ src/services/wallet/wallet.validators.ts | 3 ++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/services/wallet/wallet.controllers.ts b/src/services/wallet/wallet.controllers.ts index e6c23dbfe0..5e76ada3df 100644 --- a/src/services/wallet/wallet.controllers.ts +++ b/src/services/wallet/wallet.controllers.ts @@ -35,6 +35,7 @@ import { import { Ethereumish, Tezosish } from '../common-interfaces'; import { Algorand } from '../../chains/algorand/algorand'; import { Osmosis } from '../../chains/osmosis/osmosis'; +import { Oraichain } from '../../chains/oraichain/oraichain'; export function convertXdcAddressToEthAddress(publicKey: string): string { return publicKey.length === 43 && publicKey.slice(0, 3) === 'xdc' @@ -157,6 +158,16 @@ export async function addWallet( req.privateKey, passphrase ); + } else if (connection instanceof Oraichain) { + const wallet = await (connection as Oraichain).getAccountsfromPrivateKey( + req.privateKey, + 'orai' + ); + address = wallet.address; + encryptedPrivateKey = await (connection as Oraichain).encrypt( + req.privateKey, + passphrase + ); } if (address === undefined || encryptedPrivateKey === undefined) { diff --git a/src/services/wallet/wallet.validators.ts b/src/services/wallet/wallet.validators.ts index 57250e581f..85bbefdcd4 100644 --- a/src/services/wallet/wallet.validators.ts +++ b/src/services/wallet/wallet.validators.ts @@ -182,7 +182,8 @@ export const validateChain: Validator = mkValidator( val === 'binance-smart-chain' || val === 'tezos' || val === 'xrpl' || - val === 'kujira') + val === 'kujira' || + val === 'oraichain') ); export const validateNetwork: Validator = mkValidator( From 82d7a3d744c1429942c88242bbfd10ee7bc260bf Mon Sep 17 00:00:00 2001 From: trung2891 Date: Tue, 30 Jan 2024 15:29:20 +0700 Subject: [PATCH 09/24] feat: create & delete order --- src/chains/oraichain/oraichain.ts | 36 ++++++++ src/clob/clob.validators.ts | 10 +- src/connectors/oraidex/oraidex.helper.ts | 4 + src/connectors/oraidex/oraidex.ts | 111 ++++++++++++++++++++++- 4 files changed, 152 insertions(+), 9 deletions(-) diff --git a/src/chains/oraichain/oraichain.ts b/src/chains/oraichain/oraichain.ts index 31b1abad3f..86a7fe367f 100644 --- a/src/chains/oraichain/oraichain.ts +++ b/src/chains/oraichain/oraichain.ts @@ -12,6 +12,9 @@ import { SigningCosmWasmClient, } from '@cosmjs/cosmwasm-stargate'; import * as cosmwasm from '@cosmjs/cosmwasm-stargate'; +import { DirectSecp256k1Wallet } from '@cosmjs/proto-signing'; +import { GasPrice } from '@cosmjs/stargate'; +import { Decimal } from '@cosmjs/math'; export type MarketInfo = { id: number; @@ -153,6 +156,39 @@ export class Oraichain extends CosmosBase implements Cosmosish { return await this._cosmwasmClient.queryContractSmart(address, query); } + public async executeContract( + sender: string, + contractAddress: string, + msg: JsonObject, + funds: any + ): Promise { + let walletCommon: any = await this.getWallet(sender, 'orai'); + + const wallet = await DirectSecp256k1Wallet.fromKey( + walletCommon.privkey, + 'orai' + ); + + const client = await cosmwasm.SigningCosmWasmClient.connectWithSigner( + this._rpcUrl, + wallet, + { + gasPrice: new GasPrice(Decimal.fromUserInput('0.001', 6), 'orai'), + } + ); + + let res = await client.execute( + sender, + contractAddress, + msg, + 'auto', + undefined, + funds + ); + + return res; + } + public get gasPrice(): number { return this._gasPrice; } diff --git a/src/clob/clob.validators.ts b/src/clob/clob.validators.ts index 2604927be8..9a2141ea85 100644 --- a/src/clob/clob.validators.ts +++ b/src/clob/clob.validators.ts @@ -20,6 +20,7 @@ import { validateSide, } from '../amm/amm.validators'; import { isValidKujiraPublicKey } from '../connectors/kujira/kujira.helpers'; +import { isValidCosmosAddress } from '../chains/cosmos/cosmos.validators'; export const invalidMarketError: string = 'The market param is not a valid market. Market should be in {base}-{quote} format.'; @@ -99,10 +100,11 @@ export const validateWallet: Validator = mkValidator( invalidWalletError, (val) => { return ( - typeof val === 'string' && - (isAddress(val.slice(0, 42)) || - isValidKujiraPublicKey(val) || - isXRPLAddress(val)) + (typeof val === 'string' && + (isAddress(val.slice(0, 42)) || + isValidKujiraPublicKey(val) || + isXRPLAddress(val))) || + isValidCosmosAddress(val) ); } ); diff --git a/src/connectors/oraidex/oraidex.helper.ts b/src/connectors/oraidex/oraidex.helper.ts index 94ac5c71bf..22ca077128 100644 --- a/src/connectors/oraidex/oraidex.helper.ts +++ b/src/connectors/oraidex/oraidex.helper.ts @@ -43,3 +43,7 @@ export const parseToAssetInfo = (address: string): AssetInfo => { }, }; }; + +export const isNativeDenom = (token: AssetInfo): boolean => { + return 'native_token' in token; +}; diff --git a/src/connectors/oraidex/oraidex.ts b/src/connectors/oraidex/oraidex.ts index 322711519f..e83264ff47 100644 --- a/src/connectors/oraidex/oraidex.ts +++ b/src/connectors/oraidex/oraidex.ts @@ -14,7 +14,11 @@ import { NetworkSelectionRequest, Orderbook, } from '../../services/common-interfaces'; -import { getNotNullOrThrowError, parseToAssetInfo } from './oraidex.helper'; +import { + getNotNullOrThrowError, + isNativeDenom, + parseToAssetInfo, +} from './oraidex.helper'; import { OraidexModel } from './oraidex.model'; import { Market, MarketNotFoundError } from './oraidex.types'; import { BigNumber } from 'bignumber.js'; @@ -250,13 +254,110 @@ export class OraidexCLOB implements CLOBish { } async postOrder( - _req: ClobPostOrderRequest + req: ClobPostOrderRequest ): Promise<{ txHash: string; id?: string }> { - return { txHash: '' }; + const market = this.parsedMarkets[req.market] as Market; + const baseToken = market.baseToken; + const quoteToken = market.quoteToken; + const quoteAmount = parseFloat(req.price) * parseFloat(req.amount); + + const assets = [ + { info: baseToken, amount: req.amount.toString() }, + { info: quoteToken, amount: quoteAmount.toString() }, + ]; + + const submitOrderMsg = { + submit_order: { + assets, + direction: req.side.toLowerCase(), + }, + }; + + let res; + if (req.side == 'BUY') { + if (isNativeDenom(quoteToken)) { + res = await this.oraidex.oraichainNetwork.executeContract( + req.address, + this._swapLimitOrder, + submitOrderMsg, + [ + { + denom: getNotNullOrThrowError( + (quoteToken as any).native_token.denom + ), + amount: quoteAmount.toString(), + }, + ] + ); + } else { + res = await this.oraidex.oraichainNetwork.executeContract( + req.address, + (quoteToken as any).token.contract_addr, + { + send: { + contract: this._swapLimitOrder, + amount: quoteAmount.toString(), + msg: Buffer.from(JSON.stringify(submitOrderMsg)).toString( + 'base64' + ), + }, + }, + [] + ); + } + } else { + if (isNativeDenom(baseToken)) { + res = await this.oraidex.oraichainNetwork.executeContract( + req.address, + this._swapLimitOrder, + submitOrderMsg, + [ + { + denom: getNotNullOrThrowError( + (baseToken as any).native_token.denom + ), + amount: req.amount.toString(), + }, + ] + ); + } else { + res = await this.oraidex.oraichainNetwork.executeContract( + req.address, + (baseToken as any).token.contract_addr, + { + send: { + contract: this._swapLimitOrder, + amount: req.amount.toString(), + msg: Buffer.from(JSON.stringify(submitOrderMsg)).toString( + 'base64' + ), + }, + }, + [] + ); + } + } + + return { txHash: res.transactionHash }; } - async deleteOrder(_req: ClobDeleteOrderRequest): Promise<{ txHash: string }> { - return { txHash: '' }; + async deleteOrder(req: ClobDeleteOrderRequest): Promise<{ txHash: string }> { + const market = this.parsedMarkets[req.market] as Market; + const baseToken = market.baseToken; + const quoteToken = market.quoteToken; + + let res = await this.oraidex.oraichainNetwork.executeContract( + req.address, + this._swapLimitOrder, + { + cancel_order: { + asset_infos: [baseToken, quoteToken], + order_id: Number(req.orderId), + }, + }, + [] + ); + return { txHash: res.transactionHash }; } estimateGas(_req: NetworkSelectionRequest): { From c2bfafc12654567c9c5449b5c8d001355dd715b3 Mon Sep 17 00:00:00 2001 From: trung2891 Date: Tue, 30 Jan 2024 16:03:59 +0700 Subject: [PATCH 10/24] feat: impl controller for oraichain --- src/chains/oraichain/oraichain.controller.ts | 64 +++++++++++++++++++- 1 file changed, 62 insertions(+), 2 deletions(-) diff --git a/src/chains/oraichain/oraichain.controller.ts b/src/chains/oraichain/oraichain.controller.ts index ea0c002629..717ff86970 100644 --- a/src/chains/oraichain/oraichain.controller.ts +++ b/src/chains/oraichain/oraichain.controller.ts @@ -1,11 +1,28 @@ import { TokensRequest } from '../../network/network.requests'; import { TokenInfo } from '../../services/base'; -import { CosmosController } from '../cosmos/cosmos.controllers'; +import { + // CosmosController, + toCosmosBalances, +} from '../cosmos/cosmos.controllers'; import { Token } from '../cosmos/cosmos-base'; import { Oraichain } from './oraichain'; import { validateGetTokensRequest } from './oraichain.validators'; +import { + validateCosmosBalanceRequest, + validateCosmosPollRequest, +} from '../cosmos/cosmos.validators'; +import { + CosmosBalanceRequest, + CosmosPollRequest, +} from '../cosmos/cosmos.requests'; +import { + HttpException, + TOKEN_NOT_SUPPORTED_ERROR_CODE, + TOKEN_NOT_SUPPORTED_ERROR_MESSAGE, +} from '../../services/error-handler'; +import { decodeTxRaw } from '@cosmjs/proto-signing'; -export class OraichainController extends CosmosController { +export class OraichainController { static async getTokens( oraichainLish: Oraichain, req: TokensRequest @@ -39,4 +56,47 @@ export class OraichainController extends CosmosController { return { tokens: tokensInfo }; } + + static async balances(cosmosish: Oraichain, req: CosmosBalanceRequest) { + validateCosmosBalanceRequest(req); + + const wallet = await cosmosish.getWallet(req.address, 'orai'); + + const { tokenSymbols } = req; + + tokenSymbols.forEach((symbol: string) => { + const token = cosmosish.getTokenForSymbol(symbol); + + if (!token) { + throw new HttpException( + 500, + TOKEN_NOT_SUPPORTED_ERROR_MESSAGE + symbol, + TOKEN_NOT_SUPPORTED_ERROR_CODE + ); + } + }); + + const balances = await cosmosish.getBalances(wallet); + const filteredBalances = toCosmosBalances(balances, tokenSymbols); + + return { + balances: filteredBalances, + }; + } + + static async poll(cosmos: Oraichain, req: CosmosPollRequest) { + validateCosmosPollRequest(req); + + const transaction = await cosmos.getTransaction(req.txHash); + const currentBlock = await cosmos.getCurrentBlockNumber(); + + return { + txHash: req.txHash, + currentBlock, + txBlock: transaction.height, + gasUsed: transaction.gasUsed, + gasWanted: transaction.gasWanted, + txData: decodeTxRaw(transaction.tx), + }; + } } From 402415078accc0f725a1589dab06d2fb55a42eed Mon Sep 17 00:00:00 2001 From: trung2891 Date: Tue, 30 Jan 2024 17:36:00 +0700 Subject: [PATCH 11/24] fix: get tokens balance on Oraichain --- src/chains/cosmos/cosmos-base.ts | 7 +- src/chains/oraichain/oraichain.controller.ts | 74 ++++++++++++++++++-- src/chains/oraichain/oraichain.ts | 1 - src/templates/lists/oraichain.json | 8 ++- 4 files changed, 75 insertions(+), 15 deletions(-) diff --git a/src/chains/cosmos/cosmos-base.ts b/src/chains/cosmos/cosmos-base.ts index 0b16e31c37..9af79f75ca 100644 --- a/src/chains/cosmos/cosmos-base.ts +++ b/src/chains/cosmos/cosmos-base.ts @@ -206,7 +206,7 @@ export class CosmosBase { // If we're not ready, this._initialized will be a Promise that resolves after init() completes this._initialized = (async () => { try { - await this.loadTokens(this.tokenListSource, this.tokenListType) + await this.loadTokens(this.tokenListSource, this.tokenListType); return true; } catch (e) { logger.error(`Failed to initialize ${this.chainName} chain: ${e}`); @@ -421,7 +421,8 @@ export class CosmosBase { } getTokenDecimals(token: any): number { - return token ? token.denom_units[token.denom_units.length - 1].exponent : 6; // Last denom unit has the decimal amount we need from our list + return token ? token.decimals : 6; + // return token ? token.denom_units[token.denom_units.length - 1].exponent : 6; // Last denom unit has the decimal amount we need from our list } async getBalances(wallet: CosmosWallet): Promise> { @@ -447,10 +448,8 @@ export class CosmosBase { const { denomTrace } = await setupIbcExtension( await provider.queryClient ).ibc.transfer.denomTrace(ibcHash); - if (denomTrace) { const { baseDenom } = denomTrace; - token = this.getTokenByBase(baseDenom); } } diff --git a/src/chains/oraichain/oraichain.controller.ts b/src/chains/oraichain/oraichain.controller.ts index 717ff86970..c3ac5b8a63 100644 --- a/src/chains/oraichain/oraichain.controller.ts +++ b/src/chains/oraichain/oraichain.controller.ts @@ -1,9 +1,5 @@ import { TokensRequest } from '../../network/network.requests'; -import { TokenInfo } from '../../services/base'; -import { - // CosmosController, - toCosmosBalances, -} from '../cosmos/cosmos.controllers'; +import { TokenInfo, TokenValue, tokenValueToString } from '../../services/base'; import { Token } from '../cosmos/cosmos-base'; import { Oraichain } from './oraichain'; import { validateGetTokensRequest } from './oraichain.validators'; @@ -21,6 +17,25 @@ import { TOKEN_NOT_SUPPORTED_ERROR_MESSAGE, } from '../../services/error-handler'; import { decodeTxRaw } from '@cosmjs/proto-signing'; +import { BigNumber } from 'ethers'; + +export const toOraichainBalances = ( + balances: Record, + tokenSymbols: Array +): Record => { + const walletBalances: Record = {}; + + tokenSymbols.forEach((symbol) => { + let balance = '0.0'; + if (balances[symbol]) { + balance = tokenValueToString(balances[symbol]); + } + + walletBalances[symbol] = balance; + }); + + return walletBalances; +}; export class OraichainController { static async getTokens( @@ -64,6 +79,8 @@ export class OraichainController { const { tokenSymbols } = req; + let cw20Tokens: Token[] = []; + tokenSymbols.forEach((symbol: string) => { const token = cosmosish.getTokenForSymbol(symbol); @@ -73,17 +90,60 @@ export class OraichainController { TOKEN_NOT_SUPPORTED_ERROR_MESSAGE + symbol, TOKEN_NOT_SUPPORTED_ERROR_CODE ); + } else { + if (token.address != 'orai' && !token.address.startsWith('ibc/')) { + cw20Tokens.push(token); + } } }); - const balances = await cosmosish.getBalances(wallet); - const filteredBalances = toCosmosBalances(balances, tokenSymbols); + const cw20Balances = await this.getTokensBalance( + cosmosish, + req.address, + cw20Tokens + ); + const denomBalances = await cosmosish.getBalances(wallet); + const filteredBalances = toOraichainBalances( + { ...denomBalances, ...cw20Balances }, + tokenSymbols + ); return { balances: filteredBalances, }; } + static async getTokensBalance( + cosmosish: Oraichain, + address: string, + tokens: Token[] + ): Promise> { + const balances: Record = {}; + + await Promise.all( + tokens.map(async (token: Token) => { + try { + let balance = await cosmosish.queryContractSmart(token.address, { + balance: { + address, + }, + }); + balances[token.symbol] = { + value: BigNumber.from(parseInt(balance.balance, 10)), + decimals: cosmosish.getTokenDecimals(token), + }; + } catch (err) { + balances[token.symbol] = { + value: BigNumber.from(parseInt('0', 10)), + decimals: cosmosish.getTokenDecimals(token), + }; + } + }) + ); + + return balances; + } + static async poll(cosmos: Oraichain, req: CosmosPollRequest) { validateCosmosPollRequest(req); diff --git a/src/chains/oraichain/oraichain.ts b/src/chains/oraichain/oraichain.ts index 86a7fe367f..79d274ae56 100644 --- a/src/chains/oraichain/oraichain.ts +++ b/src/chains/oraichain/oraichain.ts @@ -101,7 +101,6 @@ export class Oraichain extends CosmosBase implements Cosmosish { marketListSource: string, marketListType: MarketListType ): Promise { - console.log(marketListSource, marketListType); this.marketList = await this.getMarketList( marketListSource, marketListType diff --git a/src/templates/lists/oraichain.json b/src/templates/lists/oraichain.json index 22852bc062..cc4daf78f4 100644 --- a/src/templates/lists/oraichain.json +++ b/src/templates/lists/oraichain.json @@ -4,17 +4,19 @@ "tokens": [ { "name": "Oraichain token", + "symbol": "ORAI", "address": "orai", - "denom": "orai", "decimals": 6, - "chainId": "Oraichain" + "chainId": "Oraichain", + "base": "orai" }, { "name": "USDT token", "symbol": "USDT", "address": "orai12hzjxfh77wl572gdzct2fxv2arxcwh6gykc7qh", "decimals": 6, - "chainId": "Oraichain" + "chainId": "Oraichain", + "base": "" } ] } From f007c4e5304dfcae5b64c4c8471559736c6ce2b5 Mon Sep 17 00:00:00 2001 From: trung2891 Date: Wed, 31 Jan 2024 14:13:15 +0700 Subject: [PATCH 12/24] feat: execute batch orders --- src/chains/oraichain/oraichain.ts | 24 +++ src/connectors/oraidex/oraidex.model.ts | 116 ++++++------ src/connectors/oraidex/oraidex.ts | 242 +++++++++++++++--------- src/connectors/oraidex/oraidex.types.ts | 14 ++ 4 files changed, 253 insertions(+), 143 deletions(-) diff --git a/src/chains/oraichain/oraichain.ts b/src/chains/oraichain/oraichain.ts index 79d274ae56..4dd3df3a3a 100644 --- a/src/chains/oraichain/oraichain.ts +++ b/src/chains/oraichain/oraichain.ts @@ -10,6 +10,7 @@ import { JsonObject, CosmWasmClient, SigningCosmWasmClient, + ExecuteInstruction, } from '@cosmjs/cosmwasm-stargate'; import * as cosmwasm from '@cosmjs/cosmwasm-stargate'; import { DirectSecp256k1Wallet } from '@cosmjs/proto-signing'; @@ -187,6 +188,29 @@ export class Oraichain extends CosmosBase implements Cosmosish { return res; } + public async executeContractMultiple( + sender: string, + instructions: ExecuteInstruction[] + ): Promise { + let walletCommon: any = await this.getWallet(sender, 'orai'); + + const wallet = await DirectSecp256k1Wallet.fromKey( + walletCommon.privkey, + 'orai' + ); + + const client = await cosmwasm.SigningCosmWasmClient.connectWithSigner( + this._rpcUrl, + wallet, + { + gasPrice: new GasPrice(Decimal.fromUserInput('0.001', 6), 'orai'), + } + ); + + let res = await client.executeMultiple(sender, instructions, 'auto'); + + return res; + } public get gasPrice(): number { return this._gasPrice; diff --git a/src/connectors/oraidex/oraidex.model.ts b/src/connectors/oraidex/oraidex.model.ts index a35ea52b7e..e79ec2a4ac 100644 --- a/src/connectors/oraidex/oraidex.model.ts +++ b/src/connectors/oraidex/oraidex.model.ts @@ -1,58 +1,58 @@ -import { Oraichain } from '../../chains/oraichain/oraichain'; - -export class OraidexModel { - /** - * - * @private - */ - oraichainNetwork: Oraichain; - /** - * - */ - chain: string; - - /** - * - */ - network: string; - - /** - * - * @private - */ - private static _instances: { [name: string]: OraidexModel }; - - /** - * Get the Kujira instance for the given chain and network. - * - * @param chain - * @param network - */ - public static getInstance(chain: string, network: string): OraidexModel { - if (OraidexModel._instances === undefined) { - OraidexModel._instances = {}; - } - - const key = `${chain}:${network}`; - - if (!(key in OraidexModel._instances)) { - OraidexModel._instances[key] = new OraidexModel(chain, network); - } - - return OraidexModel._instances[key]; - } - - /** - * Creates a new instance of Oraichain. - * - * @param chain - * @param network - * @private - */ - private constructor(chain: string, network: string) { - this.chain = chain; - this.network = network; - - this.oraichainNetwork = Oraichain.getInstance(network); - } -} +// import { Oraichain } from '../../chains/oraichain/oraichain'; + +// export class OraidexModel { +// /** +// * +// * @private +// */ +// oraichainNetwork: Oraichain; +// /** +// * +// */ +// chain: string; + +// /** +// * +// */ +// network: string; + +// /** +// * +// * @private +// */ +// private static _instances: { [name: string]: OraidexModel }; + +// /** +// * Get the Kujira instance for the given chain and network. +// * +// * @param chain +// * @param network +// */ +// public static getInstance(chain: string, network: string): OraidexModel { +// if (OraidexModel._instances === undefined) { +// OraidexModel._instances = {}; +// } + +// const key = `${chain}:${network}`; + +// if (!(key in OraidexModel._instances)) { +// OraidexModel._instances[key] = new OraidexModel(chain, network); +// } + +// return OraidexModel._instances[key]; +// } + +// /** +// * Creates a new instance of Oraichain. +// * +// * @param chain +// * @param network +// * @private +// */ +// private constructor(chain: string, network: string) { +// this.chain = chain; +// this.network = network; + +// this.oraichainNetwork = Oraichain.getInstance(network); +// } +// } diff --git a/src/connectors/oraidex/oraidex.ts b/src/connectors/oraidex/oraidex.ts index e83264ff47..9a25ef8fe0 100644 --- a/src/connectors/oraidex/oraidex.ts +++ b/src/connectors/oraidex/oraidex.ts @@ -1,6 +1,7 @@ -import { MarketInfo } from '../../chains/oraichain/oraichain'; +import { MarketInfo, Oraichain } from '../../chains/oraichain/oraichain'; import { CLOBMarkets, + ClobBatchUpdateRequest, ClobDeleteOrderRequest, ClobGetOrderRequest, ClobGetOrderResponse, @@ -19,12 +20,17 @@ import { isNativeDenom, parseToAssetInfo, } from './oraidex.helper'; -import { OraidexModel } from './oraidex.model'; -import { Market, MarketNotFoundError } from './oraidex.types'; + +import { + CancelOrdersRequest, + Market, + MarketNotFoundError, + PlaceOrdersRequest, +} from './oraidex.types'; import { BigNumber } from 'bignumber.js'; import { OraiswapLimitOrderQueryClient } from '@oraichain/oraidex-contracts-sdk'; import { OraidexConfig } from './oraidex.config'; -import { JsonObject } from '@cosmjs/cosmwasm-stargate'; +import { JsonObject, ExecuteInstruction } from '@cosmjs/cosmwasm-stargate'; const ORDERBOOK_LIMIT = 100; export class OraidexCLOB implements CLOBish { @@ -37,7 +43,7 @@ export class OraidexCLOB implements CLOBish { private _swapLimitOrder: string; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore - private oraidex: OraidexModel; + private oraichainNetwork: Oraichain; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore @@ -52,7 +58,7 @@ export class OraidexCLOB implements CLOBish { this._swapLimitOrder = config.swapLimitOrder; this.chain = chain; this.network = network; - this.oraidex = OraidexModel.getInstance(chain, network); + this.oraichainNetwork = Oraichain.getInstance(network); } public static getInstance(chain: string, network: string): OraidexCLOB { @@ -74,11 +80,11 @@ export class OraidexCLOB implements CLOBish { } async init() { - this.oraidex = await OraidexModel.getInstance(this.chain, this.network); - await this.oraidex.oraichainNetwork.init(); + this.oraichainNetwork = await Oraichain.getInstance(this.network); + await this.oraichainNetwork.init(); await this.loadMarkets(); this.orderbookQueryClient = new OraiswapLimitOrderQueryClient( - this.oraidex.oraichainNetwork.cosmwasmClient, + this.oraichainNetwork.cosmwasmClient, this._swapLimitOrder ); this._ready = true; @@ -101,7 +107,7 @@ export class OraidexCLOB implements CLOBish { async fetchMarkets(): Promise { const loadedMarkets: Market[] = []; - const markets = this.oraidex.oraichainNetwork.storedMarketList; + const markets = this.oraichainNetwork.storedMarketList; markets.forEach(async (market) => { const processedMarket = await this.getMarket(market); @@ -256,89 +262,126 @@ export class OraidexCLOB implements CLOBish { async postOrder( req: ClobPostOrderRequest ): Promise<{ txHash: string; id?: string }> { - const market = this.parsedMarkets[req.market] as Market; - const baseToken = market.baseToken; - const quoteToken = market.quoteToken; - const quoteAmount = parseFloat(req.price) * parseFloat(req.amount); - - const assets = [ - { info: baseToken, amount: req.amount.toString() }, - { info: quoteToken, amount: quoteAmount.toString() }, - ]; - - const submitOrderMsg = { - submit_order: { - assets, - direction: req.side.toLowerCase(), - }, + const convertedReq = { + ownerAddress: req.address, + orders: [req], }; - let res; - if (req.side == 'BUY') { - if (isNativeDenom(quoteToken)) { - res = await this.oraidex.oraichainNetwork.executeContract( - req.address, - this._swapLimitOrder, - submitOrderMsg, - [ - { - denom: getNotNullOrThrowError( - (quoteToken as any).native_token.denom - ), - amount: quoteAmount.toString(), - }, - ] - ); - } else { - res = await this.oraidex.oraichainNetwork.executeContract( - req.address, - (quoteToken as any).token.contract_addr, - { - send: { - contract: this._swapLimitOrder, - amount: quoteAmount.toString(), - msg: Buffer.from(JSON.stringify(submitOrderMsg)).toString( - 'base64' - ), - }, - }, - [] - ); + return { txHash: await this.placeOrders(convertedReq) }; + } + + public async batchOrders(req: ClobBatchUpdateRequest): Promise { + try { + if (req.createOrderParams || req.cancelOrderParams) { + if (req.createOrderParams) { + const convertedReq = { + ownerAddress: req.address, + orders: req.createOrderParams, + }; + return { txHash: await this.placeOrders(convertedReq) }; + } else if (req.cancelOrderParams) { + const convertedReq = { + ownerAddress: req.address, + orders: req.cancelOrderParams, + }; + return { txHash: await this.cancelOrders(convertedReq) }; + } } - } else { - if (isNativeDenom(baseToken)) { - res = await this.oraidex.oraichainNetwork.executeContract( - req.address, - this._swapLimitOrder, - submitOrderMsg, - [ - { - denom: getNotNullOrThrowError( - (baseToken as any).native_token.denom - ), - amount: req.amount.toString(), + + return {}; + } catch (err) { + console.error(err); + } + } + + async placeOrders(options: PlaceOrdersRequest) { + const instructions: ExecuteInstruction[] = []; + const sender = options.ownerAddress; + + for (const order of options.orders) { + const market = this.parsedMarkets[order.market] as Market; + const baseToken = market.baseToken; + const quoteToken = market.quoteToken; + const quoteAmount = parseFloat(order.price) * parseFloat(order.amount); + + const assets = [ + { info: baseToken, amount: order.amount.toString() }, + { info: quoteToken, amount: quoteAmount.toString() }, + ]; + const submitOrderMsg = { + submit_order: { + assets, + direction: order.side.toLowerCase(), + }, + }; + + if (order.side == 'BUY') { + if (isNativeDenom(quoteToken)) { + instructions.push({ + contractAddress: this._swapLimitOrder, + msg: submitOrderMsg, + funds: [ + { + denom: getNotNullOrThrowError( + (quoteToken as any).native_token.denom + ), + amount: quoteAmount.toString(), + }, + ], + }); + } else { + instructions.push({ + contractAddress: (quoteToken as any).token.contract_addr, + msg: { + send: { + contract: this._swapLimitOrder, + amount: quoteAmount.toString(), + msg: Buffer.from(JSON.stringify(submitOrderMsg)).toString( + 'base64' + ), + }, }, - ] - ); + funds: [], + }); + } } else { - res = await this.oraidex.oraichainNetwork.executeContract( - req.address, - (baseToken as any).token.contract_addr, - { - send: { - contract: this._swapLimitOrder, - amount: req.amount.toString(), - msg: Buffer.from(JSON.stringify(submitOrderMsg)).toString( - 'base64' - ), + if (isNativeDenom(baseToken)) { + instructions.push({ + contractAddress: this._swapLimitOrder, + msg: submitOrderMsg, + funds: [ + { + denom: getNotNullOrThrowError( + (baseToken as any).native_token.denom + ), + amount: order.amount.toString(), + }, + ], + }); + } else { + instructions.push({ + contractAddress: (baseToken as any).token.contract_addr, + msg: { + send: { + contract: this._swapLimitOrder, + amount: order.amount.toString(), + msg: Buffer.from(JSON.stringify(submitOrderMsg)).toString( + 'base64' + ), + }, }, - }, - [] - ); + funds: [], + }); + } } } - return { txHash: res.transactionHash }; + let res = await this.oraichainNetwork.executeContractMultiple( + sender, + instructions + ); + + return res.transactionHash; } async deleteOrder(req: ClobDeleteOrderRequest): Promise<{ txHash: string }> { @@ -346,7 +389,7 @@ export class OraidexCLOB implements CLOBish { const baseToken = market.baseToken; const quoteToken = market.quoteToken; - let res = await this.oraidex.oraichainNetwork.executeContract( + let res = await this.oraichainNetwork.executeContract( req.address, this._swapLimitOrder, { @@ -360,6 +403,35 @@ export class OraidexCLOB implements CLOBish { return { txHash: res.transactionHash }; } + async cancelOrders(options: CancelOrdersRequest) { + const instructions: ExecuteInstruction[] = []; + const sender = options.ownerAddress; + + for (const order of options.orders) { + const market = this.parsedMarkets[order.market] as Market; + const baseToken = market.baseToken; + const quoteToken = market.quoteToken; + + instructions.push({ + contractAddress: this._swapLimitOrder, + msg: { + cancel_order: { + asset_infos: [baseToken, quoteToken], + order_id: Number(order.orderId), + }, + }, + funds: [], + }); + } + + let res = await this.oraichainNetwork.executeContractMultiple( + sender, + instructions + ); + + return res.transactionHash; + } + estimateGas(_req: NetworkSelectionRequest): { gasPrice: number; gasPriceToken: string; diff --git a/src/connectors/oraidex/oraidex.types.ts b/src/connectors/oraidex/oraidex.types.ts index 622532c9e2..fbe3c869ba 100644 --- a/src/connectors/oraidex/oraidex.types.ts +++ b/src/connectors/oraidex/oraidex.types.ts @@ -1,6 +1,10 @@ import { AssetInfo } from '@oraichain/oraidex-contracts-sdk'; import { BigNumber } from 'bignumber.js'; import { Map as ImmutableMap, Set as ImmutableSet } from 'immutable'; +import { + ClobDeleteOrderRequestExtract, + CreateOrderParam, +} from '../../clob/clob.requests'; // // Types and Constants @@ -60,6 +64,16 @@ export interface MarketFee { taker: FeeTaker; } +export interface PlaceOrdersRequest { + ownerAddress: string; + orders: CreateOrderParam[]; +} + +export interface CancelOrdersRequest { + ownerAddress: string; + orders: ClobDeleteOrderRequestExtract[]; +} + // // Errors // From 63c17cad9385b686228dc2ff87fb1ecf7c231d29 Mon Sep 17 00:00:00 2001 From: trung2891 Date: Sun, 4 Feb 2024 21:41:02 +0700 Subject: [PATCH 13/24] feat: add trading rule --- src/chains/oraichain/oraichain.controller.ts | 1 + src/connectors/oraidex/oraidex.converters.ts | 18 +++++++++++++ src/connectors/oraidex/oraidex.ts | 27 +++++++++++++++----- src/connectors/oraidex/oraidex.types.ts | 4 +++ 4 files changed, 43 insertions(+), 7 deletions(-) create mode 100644 src/connectors/oraidex/oraidex.converters.ts diff --git a/src/chains/oraichain/oraichain.controller.ts b/src/chains/oraichain/oraichain.controller.ts index c3ac5b8a63..f39da6d37c 100644 --- a/src/chains/oraichain/oraichain.controller.ts +++ b/src/chains/oraichain/oraichain.controller.ts @@ -157,6 +157,7 @@ export class OraichainController { gasUsed: transaction.gasUsed, gasWanted: transaction.gasWanted, txData: decodeTxRaw(transaction.tx), + events: transaction.events, }; } } diff --git a/src/connectors/oraidex/oraidex.converters.ts b/src/connectors/oraidex/oraidex.converters.ts new file mode 100644 index 0000000000..888403a049 --- /dev/null +++ b/src/connectors/oraidex/oraidex.converters.ts @@ -0,0 +1,18 @@ +import { IMap } from './oraidex.types'; + +export const convertRawLogEventsToMapOfEvents = ( + eventsLog: Array +): IMap => { + const output = IMap().asMutable(); + for (const eventLog of eventsLog) { + const bundleIndex = eventLog['msg_index']; + const events = eventLog['events']; + for (const event of events) { + for (const attribute of event.attributes) { + output.setIn([bundleIndex, event.type, attribute.key], attribute.value); + } + } + } + + return output; +}; diff --git a/src/connectors/oraidex/oraidex.ts b/src/connectors/oraidex/oraidex.ts index 9a25ef8fe0..5174e3b687 100644 --- a/src/connectors/oraidex/oraidex.ts +++ b/src/connectors/oraidex/oraidex.ts @@ -31,6 +31,7 @@ import { BigNumber } from 'bignumber.js'; import { OraiswapLimitOrderQueryClient } from '@oraichain/oraidex-contracts-sdk'; import { OraidexConfig } from './oraidex.config'; import { JsonObject, ExecuteInstruction } from '@cosmjs/cosmwasm-stargate'; +// import { convertRawLogEventsToMapOfEvents } from './oraidex.converters'; const ORDERBOOK_LIMIT = 100; export class OraidexCLOB implements CLOBish { @@ -132,6 +133,10 @@ export class OraidexCLOB implements CLOBish { maker: new BigNumber('0.1'), taker: new BigNumber('0.1'), }, + minimumOrderSize: '0.001', + minimumPriceIncrement: '0.001', + minimumBaseAmountIncrement: '0.001', + minimumQuoteAmountIncrement: '0.001', }; } @@ -157,7 +162,7 @@ export class OraidexCLOB implements CLOBish { let price = ( parseFloat(order.offer_asset.amount) / parseFloat(order.ask_asset.amount) - ).toString(); + ).toFixed(4); let quantity = ( Number(order.ask_asset.amount) - Number(order.filled_ask_amount) ).toString(); @@ -171,7 +176,7 @@ export class OraidexCLOB implements CLOBish { let price = ( parseFloat(order.ask_asset.amount) / parseFloat(order.offer_asset.amount) - ).toString(); + ).toFixed(4); let quantity = ( Number(order.offer_asset.amount) - Number(order.filled_offer_amount) ).toString(); @@ -207,7 +212,7 @@ export class OraidexCLOB implements CLOBish { assetInfos: [market.baseToken, market.quoteToken], }); - return midPrice; + return Number(midPrice).toFixed(3); } public async orders( @@ -298,14 +303,20 @@ export class OraidexCLOB implements CLOBish { const instructions: ExecuteInstruction[] = []; const sender = options.ownerAddress; + // hardcode: + const decimals = 1000000; + for (const order of options.orders) { const market = this.parsedMarkets[order.market] as Market; + const baseAmount = Math.round(Number(order.amount) * decimals); const baseToken = market.baseToken; const quoteToken = market.quoteToken; - const quoteAmount = parseFloat(order.price) * parseFloat(order.amount); + const quoteAmount = Math.round( + decimals * parseFloat(order.price) * parseFloat(order.amount) + ); const assets = [ - { info: baseToken, amount: order.amount.toString() }, + { info: baseToken, amount: baseAmount.toString() }, { info: quoteToken, amount: quoteAmount.toString() }, ]; const submitOrderMsg = { @@ -354,7 +365,7 @@ export class OraidexCLOB implements CLOBish { denom: getNotNullOrThrowError( (baseToken as any).native_token.denom ), - amount: order.amount.toString(), + amount: baseAmount.toString(), }, ], }); @@ -364,7 +375,7 @@ export class OraidexCLOB implements CLOBish { msg: { send: { contract: this._swapLimitOrder, - amount: order.amount.toString(), + amount: baseAmount.toString(), msg: Buffer.from(JSON.stringify(submitOrderMsg)).toString( 'base64' ), @@ -381,6 +392,8 @@ export class OraidexCLOB implements CLOBish { instructions ); + // let rawLogs = convertRawLogEventsToMapOfEvents(res.logs); + return res.transactionHash; } diff --git a/src/connectors/oraidex/oraidex.types.ts b/src/connectors/oraidex/oraidex.types.ts index fbe3c869ba..228d421de3 100644 --- a/src/connectors/oraidex/oraidex.types.ts +++ b/src/connectors/oraidex/oraidex.types.ts @@ -57,6 +57,10 @@ export interface Market { min_quote_coin_amount: string; spread: string; // Also called tickSize fees: MarketFee; + minimumOrderSize: String; + minimumPriceIncrement: String; // Also called tickSize + minimumBaseAmountIncrement: String; + minimumQuoteAmountIncrement: String; } export interface MarketFee { From bb63551f45e9002aaa9f1d64a93a6bd59b33864c Mon Sep 17 00:00:00 2001 From: vuonghuuhung Date: Fri, 10 May 2024 18:06:00 +0700 Subject: [PATCH 14/24] (update) get market info from contracts --- package.json | 2 + src/connectors/oraidex/oraidex.helper.ts | 48 +++- src/connectors/oraidex/oraidex.ts | 124 ++++++----- src/connectors/oraidex/oraidex.types.ts | 12 +- yarn.lock | 271 ++++++++++++++++++----- 5 files changed, 345 insertions(+), 112 deletions(-) diff --git a/package.json b/package.json index 70f04fc333..d817a511f9 100644 --- a/package.json +++ b/package.json @@ -42,6 +42,8 @@ "@osmonauts/math": "^1.11.3", "@pancakeswap/sdk": "^4.0.0", "@pancakeswap/smart-router": "^4.2.1", + "@oraichain/common-contracts-sdk": "^1.0.31", + "@oraichain/oraidex-common": "^1.0.86", "@oraichain/oraidex-contracts-sdk": "^1.0.31", "@pancakeswap/swap-sdk-core": "^1.0.0", "@pancakeswap/tokens": "^0.1.6", diff --git a/src/connectors/oraidex/oraidex.helper.ts b/src/connectors/oraidex/oraidex.helper.ts index 22ca077128..622034bcc6 100644 --- a/src/connectors/oraidex/oraidex.helper.ts +++ b/src/connectors/oraidex/oraidex.helper.ts @@ -1,4 +1,7 @@ import { AssetInfo } from '@oraichain/oraidex-contracts-sdk'; +import { Token } from './oraidex.types'; +import { CosmWasmClient, Cw20BaseQueryClient } from '@oraichain/common-contracts-sdk'; +import * as constant from '@oraichain/oraidex-common/build/constant'; /** * @@ -7,7 +10,7 @@ import { AssetInfo } from '@oraichain/oraidex-contracts-sdk'; */ export const getNotNullOrThrowError = ( value?: any, - errorMessage: string = 'Value is null or undefined' + errorMessage: string = 'Value is null or undefined', ): R => { if (value === undefined || value === null) throw new Error(errorMessage); @@ -44,6 +47,49 @@ export const parseToAssetInfo = (address: string): AssetInfo => { }; }; +export const parseToToken = async (asset: AssetInfo, client: CosmWasmClient): Promise => { + let token: Token; + let cw20BaseQueryClient: Cw20BaseQueryClient; + + // @ts-ignore + if (asset.token != undefined) { + // @ts-ignore + const tokenAddress = asset.token.contract_addr; + cw20BaseQueryClient = new Cw20BaseQueryClient( + client, + tokenAddress, + ); + const info = await cw20BaseQueryClient.tokenInfo(); + token = { + decimals: info.decimals, + name: info.name, + symbol: info.symbol, + token: { + contract_addr: tokenAddress, + }, + }; + } else { + // @ts-ignore + const tokenDenom = asset.native_token.denom; + let symbol = tokenDenom; + if (symbol.startsWith('ibc/')) { + // @ts-ignore + symbol = Object.keys(constant).find((key) => constant[key] === symbol)?.split('_')[0]; + } + token = { + // hardcode decinmal of native token + decimals: 6, + name: symbol.toUpperCase(), + symbol: symbol.toUpperCase(), + native_token: { + denom: tokenDenom, + }, + }; + } + + return token; +}; + export const isNativeDenom = (token: AssetInfo): boolean => { return 'native_token' in token; }; diff --git a/src/connectors/oraidex/oraidex.ts b/src/connectors/oraidex/oraidex.ts index 5174e3b687..b83218e88d 100644 --- a/src/connectors/oraidex/oraidex.ts +++ b/src/connectors/oraidex/oraidex.ts @@ -1,4 +1,4 @@ -import { MarketInfo, Oraichain } from '../../chains/oraichain/oraichain'; +import { Oraichain } from '../../chains/oraichain/oraichain'; import { CLOBMarkets, ClobBatchUpdateRequest, @@ -18,22 +18,20 @@ import { import { getNotNullOrThrowError, isNativeDenom, - parseToAssetInfo, + parseToToken, } from './oraidex.helper'; import { CancelOrdersRequest, Market, - MarketNotFoundError, PlaceOrdersRequest, } from './oraidex.types'; import { BigNumber } from 'bignumber.js'; import { OraiswapLimitOrderQueryClient } from '@oraichain/oraidex-contracts-sdk'; import { OraidexConfig } from './oraidex.config'; import { JsonObject, ExecuteInstruction } from '@cosmjs/cosmwasm-stargate'; -// import { convertRawLogEventsToMapOfEvents } from './oraidex.converters'; -const ORDERBOOK_LIMIT = 100; +const ORDERBOOK_LIMIT = 100; //? export class OraidexCLOB implements CLOBish { chain: string; @@ -80,14 +78,17 @@ export class OraidexCLOB implements CLOBish { return OraidexCLOB._instances; } + /** + * Initialize Oraidex connector. + */ async init() { this.oraichainNetwork = await Oraichain.getInstance(this.network); await this.oraichainNetwork.init(); - await this.loadMarkets(); this.orderbookQueryClient = new OraiswapLimitOrderQueryClient( this.oraichainNetwork.cosmwasmClient, - this._swapLimitOrder + this._swapLimitOrder, ); + await this.loadMarkets(); this._ready = true; } @@ -96,48 +97,63 @@ export class OraidexCLOB implements CLOBish { } public async loadMarkets() { - const rawMarkets = await this.fetchMarkets(); + const rawMarkets = await this.getAllMarkets(); for (const market of rawMarkets) { this.parsedMarkets[market.marketId] = market; } } - async markets(_req: ClobMarketsRequest): Promise<{ markets: CLOBMarkets }> { + async markets(req: ClobMarketsRequest): Promise<{ markets: CLOBMarkets }> { + if (req.market && req.market.split('-').length === 2) { + const resp: CLOBMarkets = {}; + resp[req.market] = this.parsedMarkets[req.market]; + + return { markets: resp }; + } return { markets: this.parsedMarkets }; } - async fetchMarkets(): Promise { - const loadedMarkets: Market[] = []; - const markets = this.oraichainNetwork.storedMarketList; - - markets.forEach(async (market) => { - const processedMarket = await this.getMarket(market); - - loadedMarkets.push(processedMarket); - }); - - return loadedMarkets; - } + async getAllMarkets(): Promise { + const orderBooks = await this.orderbookQueryClient.orderBooks({}); - async getMarket(market: MarketInfo): Promise { - if (!market) throw new MarketNotFoundError(`No market informed.`); + try { + const loadedMarkets: Market[] = await Promise.all( + orderBooks.order_books.map(async (pair) => { + const baseToken = await parseToToken( + pair.base_coin_info, + this.oraichainNetwork.cosmwasmClient, + // ibcTokens, + ); + const quoteToken = await parseToToken( + pair.quote_coin_info, + this.oraichainNetwork.cosmwasmClient, + // ibcTokens, + ); + + return { + marketId: `${baseToken.symbol}-${quoteToken.symbol}`, + baseToken: baseToken, + quoteToken: quoteToken, + min_quote_coin_amount: pair.min_quote_coin_amount, + spread: pair.spread ? pair.spread : '0', + // hardcode fee cause in contract, fee is hardcoded + fees: { + maker: new BigNumber('0.1'), + taker: new BigNumber('0.1'), + }, + minimumOrderSize: '0.000001', + minimumPriceIncrement: '0.000001', + minimumBaseAmountIncrement: '0.000001', + minimumQuoteAmountIncrement: '0.000001', + }; + }), + ); - // hotfix: hardcode market info - return { - marketId: market.marketId, - baseToken: parseToAssetInfo(market.base.address), - quoteToken: parseToAssetInfo(market.quote.address), - min_quote_coin_amount: '0', - spread: '0', - fees: { - maker: new BigNumber('0.1'), - taker: new BigNumber('0.1'), - }, - minimumOrderSize: '0.001', - minimumPriceIncrement: '0.001', - minimumBaseAmountIncrement: '0.001', - minimumQuoteAmountIncrement: '0.001', - }; + return loadedMarkets; + } catch (err) { + console.error(err); + return []; + } } public async orderBook(req: ClobOrderbookRequest): Promise { @@ -146,7 +162,7 @@ export class OraidexCLOB implements CLOBish { async getOrderBook( market: Market, - limit: number = ORDERBOOK_LIMIT + limit: number = ORDERBOOK_LIMIT, ): Promise { const buys: any = []; const sells: any = []; @@ -192,11 +208,11 @@ export class OraidexCLOB implements CLOBish { } public async ticker( - req: ClobTickerRequest + req: ClobTickerRequest, ): Promise<{ markets: CLOBMarkets }> { const requestMarket = getNotNullOrThrowError(req.market); const midPrice = await this.getMidPriceForMarket( - this.parsedMarkets[requestMarket] + this.parsedMarkets[requestMarket], ); return { markets: { @@ -216,7 +232,7 @@ export class OraidexCLOB implements CLOBish { } public async orders( - req: ClobGetOrderRequest + req: ClobGetOrderRequest, ): Promise<{ orders: ClobGetOrderResponse['orders'] }> { const requestMarket = getNotNullOrThrowError(req.market); const market = this.parsedMarkets[requestMarket]; @@ -226,7 +242,7 @@ export class OraidexCLOB implements CLOBish { originalOrders = ( await this.getAllOrders( market, - getNotNullOrThrowError(req.address) + getNotNullOrThrowError(req.address), ) ).orders; } else { @@ -265,7 +281,7 @@ export class OraidexCLOB implements CLOBish { } async postOrder( - req: ClobPostOrderRequest + req: ClobPostOrderRequest, ): Promise<{ txHash: string; id?: string }> { const convertedReq = { ownerAddress: req.address, @@ -303,7 +319,7 @@ export class OraidexCLOB implements CLOBish { const instructions: ExecuteInstruction[] = []; const sender = options.ownerAddress; - // hardcode: + // TODO: hardcode const decimals = 1000000; for (const order of options.orders) { @@ -312,7 +328,7 @@ export class OraidexCLOB implements CLOBish { const baseToken = market.baseToken; const quoteToken = market.quoteToken; const quoteAmount = Math.round( - decimals * parseFloat(order.price) * parseFloat(order.amount) + decimals * parseFloat(order.price) * parseFloat(order.amount), ); const assets = [ @@ -334,7 +350,7 @@ export class OraidexCLOB implements CLOBish { funds: [ { denom: getNotNullOrThrowError( - (quoteToken as any).native_token.denom + (quoteToken as any).native_token.denom, ), amount: quoteAmount.toString(), }, @@ -348,7 +364,7 @@ export class OraidexCLOB implements CLOBish { contract: this._swapLimitOrder, amount: quoteAmount.toString(), msg: Buffer.from(JSON.stringify(submitOrderMsg)).toString( - 'base64' + 'base64', ), }, }, @@ -363,7 +379,7 @@ export class OraidexCLOB implements CLOBish { funds: [ { denom: getNotNullOrThrowError( - (baseToken as any).native_token.denom + (baseToken as any).native_token.denom, ), amount: baseAmount.toString(), }, @@ -377,7 +393,7 @@ export class OraidexCLOB implements CLOBish { contract: this._swapLimitOrder, amount: baseAmount.toString(), msg: Buffer.from(JSON.stringify(submitOrderMsg)).toString( - 'base64' + 'base64', ), }, }, @@ -389,7 +405,7 @@ export class OraidexCLOB implements CLOBish { let res = await this.oraichainNetwork.executeContractMultiple( sender, - instructions + instructions, ); // let rawLogs = convertRawLogEventsToMapOfEvents(res.logs); @@ -411,7 +427,7 @@ export class OraidexCLOB implements CLOBish { order_id: Number(req.orderId), }, }, - [] + [], ); return { txHash: res.transactionHash }; } @@ -439,7 +455,7 @@ export class OraidexCLOB implements CLOBish { let res = await this.oraichainNetwork.executeContractMultiple( sender, - instructions + instructions, ); return res.transactionHash; diff --git a/src/connectors/oraidex/oraidex.types.ts b/src/connectors/oraidex/oraidex.types.ts index 228d421de3..aba5cb261f 100644 --- a/src/connectors/oraidex/oraidex.types.ts +++ b/src/connectors/oraidex/oraidex.types.ts @@ -23,6 +23,14 @@ export type FeeMaker = Fee; export type FeeTaker = Fee; export type FeeServiceProvider = Fee; +export type MarketId = Address; + +export type Token = AssetInfo & { + name: string; + symbol: string; + decimals: number; +} + // // Enums // @@ -52,8 +60,8 @@ export enum OrderType { // export interface Market { marketId: string; - baseToken: AssetInfo; - quoteToken: AssetInfo; + baseToken: Token; + quoteToken: Token; min_quote_coin_amount: string; spread: string; // Also called tickSize fees: MarketFee; diff --git a/yarn.lock b/yarn.lock index be94faef31..691306c603 100644 --- a/yarn.lock +++ b/yarn.lock @@ -801,17 +801,7 @@ "@cosmjs/math" "^0.30.1" "@cosmjs/utils" "^0.30.1" -"@cosmjs/amino@^0.31.3": - version "0.31.3" - resolved "https://registry.yarnpkg.com/@cosmjs/amino/-/amino-0.31.3.tgz#0f4aa6bd68331c71bd51b187fa64f00eb075db0a" - integrity sha512-36emtUq895sPRX8PTSOnG+lhJDCVyIcE0Tr5ct59sUbgQiI14y43vj/4WAlJ/utSOxy+Zhj9wxcs4AZfu0BHsw== - dependencies: - "@cosmjs/crypto" "^0.31.3" - "@cosmjs/encoding" "^0.31.3" - "@cosmjs/math" "^0.31.3" - "@cosmjs/utils" "^0.31.3" - -"@cosmjs/cosmwasm-stargate@^0.31.1": +"@cosmjs/cosmwasm-stargate@0.31.3", "@cosmjs/cosmwasm-stargate@^0.31.1": version "0.31.3" resolved "https://registry.yarnpkg.com/@cosmjs/cosmwasm-stargate/-/cosmwasm-stargate-0.31.3.tgz#13066822f111832d57c2c5acc9e697ed389713f8" integrity sha512-Uv9TmCn3650gdFeZm7SEfUZF3uX3lfJfFhXOk6I2ZLr/FrKximnlb+vwAfZaZnWYvlA7qrKtHIjeRNHvT23zcw== @@ -1271,22 +1261,6 @@ readonly-date "^1.0.0" xstream "^11.14.0" -"@cosmjs/tendermint-rpc@^0.31.3": - version "0.31.3" - resolved "https://registry.yarnpkg.com/@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" - "@cosmjs/utils@0.27.1": version "0.27.1" resolved "https://registry.yarnpkg.com/@cosmjs/utils/-/utils-0.27.1.tgz#1c8efde17256346ef142a3bd15158ee4055470e2" @@ -2361,6 +2335,16 @@ 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== + dependencies: + "@injectivelabs/grpc-web" "^0.0.1" + google-protobuf "^3.14.0" + protobufjs "^7.0.0" + rxjs "^7.4.0" + "@injectivelabs/exceptions@^1.10.6": version "1.10.6" resolved "https://registry.yarnpkg.com/@injectivelabs/exceptions/-/exceptions-1.10.6.tgz#7d3e23d1123148afe050064e8524be1e58e55f0f" @@ -2372,6 +2356,17 @@ link-module-alias "^1.2.0" shx "^0.3.2" +"@injectivelabs/exceptions@^1.12.1", "@injectivelabs/exceptions@^1.14.6": + version "1.14.6" + resolved "https://registry.yarnpkg.com/@injectivelabs/exceptions/-/exceptions-1.14.6.tgz#86f93815eb6bc60902c43072b8e212146d78614e" + integrity sha512-A+URJwygeDjFPhulGMNVw70z738NtpIiCr0W8q4Kr4Ggg30i+AaVAjViYLm56pSMXXpomu9CYJ/sY6ijQn48IQ== + dependencies: + "@injectivelabs/grpc-web" "^0.0.1" + "@injectivelabs/ts-types" "^1.14.6" + http-status-codes "^2.2.0" + link-module-alias "^1.2.0" + shx "^0.3.2" + "@injectivelabs/grpc-web-node-http-transport@^0.0.2": version "0.0.2" resolved "https://registry.yarnpkg.com/@injectivelabs/grpc-web-node-http-transport/-/grpc-web-node-http-transport-0.0.2.tgz#87c9bbd4db1f70cf18d6a55b54b2cf17d3cf30c0" @@ -2399,6 +2394,26 @@ protobufjs "^7.0.0" rxjs "^7.4.0" +"@injectivelabs/indexer-proto-ts@1.11.9": + version "1.11.9" + resolved "https://registry.yarnpkg.com/@injectivelabs/indexer-proto-ts/-/indexer-proto-ts-1.11.9.tgz#19910f44382da50d16c0e7a58114c06b5b66214d" + integrity sha512-hUlZbSpii+amvqqefH/oV16igRJSx4mCM/Zi0xMZLHyqGkaX7PHVvjQcfX04hwx2MdSsAoDghJXuUrAJ7q9I2A== + 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.43": + version "1.0.43" + resolved "https://registry.yarnpkg.com/@injectivelabs/mito-proto-ts/-/mito-proto-ts-1.0.43.tgz#2dab228c4ef7cb40d2a7562afddc898592116fd9" + integrity sha512-w2FRECf0KmqhyID6iwKoQj366mSy1URjoWlf3sueM2s4xXee/J2fzYT4JOjt1wK8taLQ/gbIWP8FMTtUvh/+2w== + 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.9": version "1.0.9" resolved "https://registry.yarnpkg.com/@injectivelabs/mito-proto-ts/-/mito-proto-ts-1.0.9.tgz#ad04165ad63f52a9f67082318e0620cccc4986f2" @@ -2420,6 +2435,60 @@ link-module-alias "^1.2.0" shx "^0.3.2" +"@injectivelabs/networks@^1.12.1", "@injectivelabs/networks@^1.14.6": + version "1.14.6" + resolved "https://registry.yarnpkg.com/@injectivelabs/networks/-/networks-1.14.6.tgz#29be5e81e60d725a0eef2db2c9b6ba0b4588141b" + integrity sha512-O1IkPFJl8ThNL6N+k/9OimrgCYsSWQ8A1FtVMXSQge+0QRZsDKSpRmQRwE601otXXauO31nOUct5AaiWPffXVQ== + dependencies: + "@injectivelabs/exceptions" "^1.14.6" + "@injectivelabs/ts-types" "^1.14.6" + "@injectivelabs/utils" "^1.14.6" + link-module-alias "^1.2.0" + shx "^0.3.2" + +"@injectivelabs/sdk-ts@1.12.1": + version "1.12.1" + resolved "https://registry.yarnpkg.com/@injectivelabs/sdk-ts/-/sdk-ts-1.12.1.tgz#759bc79ed348d25e99a665f5539891ae639e241e" + integrity sha512-OEbFb4W5D5tvC+sRkmb/+kbhD8hJ8GS8XiJPBV2k8DoNHmm+nHfHao/8sMTuvHDm2S+vZu3RrV7IBMRgZC64rw== + dependencies: + "@apollo/client" "^3.5.8" + "@cosmjs/amino" "^0.30.1" + "@cosmjs/proto-signing" "^0.30.1" + "@cosmjs/stargate" "^0.30.1" + "@ethersproject/bytes" "^5.7.0" + "@injectivelabs/core-proto-ts" "^0.0.18" + "@injectivelabs/dmm-proto-ts" "1.0.16" + "@injectivelabs/exceptions" "^1.12.1" + "@injectivelabs/grpc-web" "^0.0.1" + "@injectivelabs/grpc-web-node-http-transport" "^0.0.2" + "@injectivelabs/grpc-web-react-native-transport" "^0.0.2" + "@injectivelabs/indexer-proto-ts" "1.11.9" + "@injectivelabs/mito-proto-ts" "1.0.43" + "@injectivelabs/networks" "^1.12.1" + "@injectivelabs/test-utils" "^1.12.1" + "@injectivelabs/token-metadata" "^1.12.1" + "@injectivelabs/ts-types" "^1.12.1" + "@injectivelabs/utils" "^1.12.1" + "@metamask/eth-sig-util" "^4.0.0" + axios "^0.27.2" + bech32 "^2.0.0" + bip39 "^3.0.4" + cosmjs-types "^0.7.1" + eth-crypto "^2.6.0" + ethereumjs-util "^7.1.4" + ethers "^5.7.2" + google-protobuf "^3.21.0" + graphql "^16.3.0" + http-status-codes "^2.2.0" + js-sha3 "^0.8.0" + 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" + "@injectivelabs/sdk-ts@^1.10.58": version "1.10.58" resolved "https://registry.yarnpkg.com/@injectivelabs/sdk-ts/-/sdk-ts-1.10.58.tgz#fd452c3919ccb70ae0c3102a410b7334d2013704" @@ -2474,6 +2543,18 @@ snakecase-keys "^5.1.2" store2 "^2.12.0" +"@injectivelabs/test-utils@^1.12.1": + version "1.14.4" + resolved "https://registry.yarnpkg.com/@injectivelabs/test-utils/-/test-utils-1.14.4.tgz#bf5b8c069eabac875e0c235589132b6166a5d08b" + integrity sha512-M7UoB5CIVVN7BtdmU26GwZsWKp0BQg9qV5a+YvcdhlwlSIkvt3gKVKBMq/vKClCakOu2AjhCVGDMZVnagIBogg== + dependencies: + axios "^0.21.1" + bignumber.js "^9.0.1" + link-module-alias "^1.2.0" + shx "^0.3.2" + snakecase-keys "^5.1.2" + store2 "^2.12.0" + "@injectivelabs/token-metadata@^1.10.31": version "1.10.31" resolved "https://registry.yarnpkg.com/@injectivelabs/token-metadata/-/token-metadata-1.10.31.tgz#a61b8488fffd843c18bad8c43490af8eeda764a4" @@ -2491,6 +2572,23 @@ lodash.values "^4.3.0" shx "^0.3.2" +"@injectivelabs/token-metadata@^1.12.1": + version "1.14.7" + resolved "https://registry.yarnpkg.com/@injectivelabs/token-metadata/-/token-metadata-1.14.7.tgz#0adba14e76e8882dc13a6a488ced0762fd888ae3" + integrity sha512-RRRuyirzoThwQ5P8D3STH2YOavGsdnetQy6ZPQ8yA7VUavt00KBB26M92zSLbiUz5VrxhPHDCEEkuJVWx+xtmw== + dependencies: + "@injectivelabs/exceptions" "^1.14.6" + "@injectivelabs/networks" "^1.14.6" + "@injectivelabs/ts-types" "^1.14.6" + "@injectivelabs/utils" "^1.14.6" + "@types/lodash.values" "^4.3.6" + copyfiles "^2.4.1" + jsonschema "^1.4.0" + link-module-alias "^1.2.0" + lodash "^4.17.21" + lodash.values "^4.3.0" + shx "^0.3.2" + "@injectivelabs/ts-types@^1.10.5": version "1.10.5" resolved "https://registry.yarnpkg.com/@injectivelabs/ts-types/-/ts-types-1.10.5.tgz#c8672fe6b1394162ec1828590051c92062799ac8" @@ -2499,6 +2597,14 @@ link-module-alias "^1.2.0" shx "^0.3.2" +"@injectivelabs/ts-types@^1.12.1", "@injectivelabs/ts-types@^1.14.6": + version "1.14.6" + resolved "https://registry.yarnpkg.com/@injectivelabs/ts-types/-/ts-types-1.14.6.tgz#917a14c8fed81c683bc7dece3ec254388123a10e" + integrity sha512-/Ax5eCSfE9OhcyUc9wZk/LFKTYhIY9RJIaNT/n92rbHjXSfXRLSX+Bvk62vC9Ej+SEBPp77WYngtrePPA1HEgw== + dependencies: + link-module-alias "^1.2.0" + shx "^0.3.2" + "@injectivelabs/utils@^1.10.6": version "1.10.6" resolved "https://registry.yarnpkg.com/@injectivelabs/utils/-/utils-1.10.6.tgz#d01360a458edc552bd8668776bb137b34b0a6b01" @@ -2514,6 +2620,21 @@ snakecase-keys "^5.1.2" store2 "^2.12.0" +"@injectivelabs/utils@^1.12.1", "@injectivelabs/utils@^1.14.6": + version "1.14.6" + resolved "https://registry.yarnpkg.com/@injectivelabs/utils/-/utils-1.14.6.tgz#1e5c60973f9b2bb1a0334a0cd5b3f56377904472" + integrity sha512-5I0h4GiLB5PPTl+g2lpevRP+WScvEbntdkoUQVtAdHewl4kutd5p1Kcnoi1Nvpq+sz5N/e9qtBIRuyxG38akOg== + dependencies: + "@injectivelabs/exceptions" "^1.14.6" + "@injectivelabs/ts-types" "^1.14.6" + axios "^0.21.1" + bignumber.js "^9.0.1" + http-status-codes "^2.2.0" + link-module-alias "^1.2.0" + shx "^0.3.2" + snakecase-keys "^5.1.2" + store2 "^2.12.0" + "@istanbuljs/load-nyc-config@^1.0.0": version "1.1.0" resolved "https://registry.yarnpkg.com/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz#fd3db1d59ecf7cf121e80650bb86712f9b55eced" @@ -2837,6 +2958,14 @@ axios "^0.27.2" long "^4.0.0" +"@keplr-wallet/types@^0.11.38": + version "0.11.64" + resolved "https://registry.yarnpkg.com/@keplr-wallet/types/-/types-0.11.64.tgz#5a308c8c019b4e18f894e0f35f0904b60134d605" + integrity sha512-GgzeLDHHfZFyne3O7UIfFHj/uYqVbxAZI31RbBwt460OBbvwQzjrlZwvJW3vieWRAgxKSITjzEDBl2WneFTQdQ== + dependencies: + axios "^0.27.2" + long "^4.0.0" + "@metamask/eth-sig-util@^4.0.0": version "4.0.1" resolved "https://registry.yarnpkg.com/@metamask/eth-sig-util/-/eth-sig-util-4.0.1.tgz#3ad61f6ea9ad73ba5b19db780d40d9aae5157088" @@ -3145,6 +3274,11 @@ decimal.js-light "^2.5.1" osmojs "^16.8.3" +"@oraichain/oraidex-contracts-sdk@latest": + version "1.0.44" + resolved "https://registry.yarnpkg.com/@oraichain/oraidex-contracts-sdk/-/oraidex-contracts-sdk-1.0.44.tgz#9ff41ec388dd92ba112c2eef545d11fd6e18c684" + integrity sha512-fMY/QOzO/afPlAVkLGH1bcpJTs6V/URrJju2r4UoE9f5HUWC/6OC6+H5dWuIgq26frp8wjH23mNCQAlmHzji8g== + "@pancakeswap-libs/pancake-swap-core@^0.1.0": version "0.1.0" resolved "https://registry.yarnpkg.com/@pancakeswap-libs/pancake-swap-core/-/pancake-swap-core-0.1.0.tgz#6957f1fa02170531a2ffbf95f2c0e145e9d21bc2" @@ -4664,6 +4798,11 @@ resolved "https://registry.yarnpkg.com/@types/lru-cache/-/lru-cache-5.1.1.tgz#c48c2e27b65d2a153b19bfc1a317e30872e01eef" integrity sha512-ssE3Vlrys7sdIzs5LOxCzTVMsU7i9oa/IaW92wF32JFb3CVczqOkru2xspuKczHEbG3nvmPY7IFqVmGGHdNbYw== +"@types/lru-cache@^4.1.1": + version "4.1.3" + resolved "https://registry.yarnpkg.com/@types/lru-cache/-/lru-cache-4.1.3.tgz#ec5eb6dd818b7a06336cfb7368723164b195f818" + integrity sha512-QjCOmf5kYwekcsfEKhcEHMK8/SvgnneuSDXFERBuC/DPca2KJIO/gpChTsVb35BoWLBpEAJWz1GFVEArSdtKtw== + "@types/mathjs@^9.4.2": version "9.4.2" resolved "https://registry.yarnpkg.com/@types/mathjs/-/mathjs-9.4.2.tgz#beec20340d768171fed8331b08fb321d218ec6e1" @@ -5777,6 +5916,16 @@ aws4@^1.8.0: resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.12.0.tgz#ce1c9d143389679e253b314241ea9aa5cec980d3" integrity sha512-NmWvPnx0F1SfrQbYwOi7OeaNGokp9XhzNioJ/CSBs8Qa4vxug81mhJEAVZwxXuBmYB5KDRfMq/F3RR0BIU7sWg== +axios-extensions@3.1.3: + version "3.1.3" + resolved "https://registry.yarnpkg.com/axios-extensions/-/axios-extensions-3.1.3.tgz#cd745bb7dc899743f85a2b5a291c7f36d9f41e12" + integrity sha512-/OB9OcJLNOIx9pdW4m4/hFRvNo12wlX5BaprIzqpMaLR02I88Mr98/wW4QN9rhx0/yg9rM7i6Af/RpV4MyxXjA== + dependencies: + "@types/lru-cache" "^4.1.1" + lru-cache "^5.1.1" + tslib "^1.9.0" + util "^0.11.1" + axios@0.26.0: version "0.26.0" resolved "https://registry.yarnpkg.com/axios/-/axios-0.26.0.tgz#9a318f1c69ec108f8cd5f3c3d390366635e13928" @@ -7457,13 +7606,6 @@ doctrine@^2.1.0: dependencies: esutils "^2.0.2" -doctrine@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-3.0.0.tgz#addebead72a6574db783639dc87a121773973961" - integrity sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w== - dependencies: - esutils "^2.0.2" - dom-walk@^0.1.0: version "0.1.2" resolved "https://registry.yarnpkg.com/dom-walk/-/dom-walk-0.1.2.tgz#0c548bef048f4d1f2a97249002236060daa3fd84" @@ -8233,7 +8375,7 @@ ethers@4.0.0-beta.3: uuid "2.0.1" xmlhttprequest "1.8.0" -ethers@5.7.2, ethers@^5.0.19, ethers@^5.6.1, ethers@^5.6.2, ethers@^5.7.0, ethers@^5.7.2: +ethers@5.7.2, ethers@^5.0.15, ethers@^5.0.19, ethers@^5.6.1, ethers@^5.6.2, ethers@^5.7.0, ethers@^5.7.2: version "5.7.2" resolved "https://registry.yarnpkg.com/ethers/-/ethers-5.7.2.tgz#3a7deeabbb8c030d4126b24f84e525466145872e" integrity sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg== @@ -8606,12 +8748,12 @@ fetch-cookie@0.11.0: dependencies: tough-cookie "^2.3.3 || ^3.0.1 || ^4.0.0" -file-entry-cache@^6.0.1: - version "6.0.1" - resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-6.0.1.tgz#211b2dd9659cb0394b073e7323ac3c933d522027" - integrity sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg== +file-entry-cache@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-8.0.0.tgz#7787bddcf1131bffb92636c69457bbc0edd6d81f" + integrity sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ== dependencies: - flat-cache "^3.0.4" + flat-cache "^4.0.0" file-stream-rotator@^0.6.1: version "0.6.1" @@ -8700,23 +8842,23 @@ find-up@^4.0.0, find-up@^4.1.0: locate-path "^5.0.0" path-exists "^4.0.0" -flat-cache@^3.0.4: - version "3.0.4" - resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-3.0.4.tgz#61b0338302b2fe9f957dcc32fc2a87f1c3048b11" - integrity sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg== +flat-cache@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-4.0.1.tgz#0ece39fcb14ee012f4b0410bd33dd9c1f011127c" + integrity sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw== dependencies: - flatted "^3.1.0" - rimraf "^3.0.2" + flatted "^3.2.9" + keyv "^4.5.4" flat@^5.0.2: version "5.0.2" resolved "https://registry.yarnpkg.com/flat/-/flat-5.0.2.tgz#8ca6fe332069ffa9d324c327198c598259ceb241" integrity sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ== -flatted@^3.1.0: - version "3.2.7" - resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.7.tgz#609f39207cb614b89d0765b477cb2d437fbf9787" - integrity sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ== +flatted@^3.2.9: + version "3.3.1" + resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.3.1.tgz#21db470729a6734d4997002f439cb308987f567a" + integrity sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw== fn.name@1.x.x: version "1.1.0" @@ -9729,6 +9871,11 @@ inherits@2, inherits@2.0.4, inherits@^2.0.1, inherits@^2.0.3, inherits@^2.0.4, i resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== +inherits@2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" + integrity sha512-x00IRNXNy63jwGkJmzPigoySHbaqpNuzKbBOmzK+g2OdZpQ9w+sxCN+VSB3ja7IAge2OP2qpfxTjeNcyjmW1uw== + internal-slot@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/internal-slot/-/internal-slot-1.0.5.tgz#f2a2ee21f668f8627a4667f309dc0f4fb6674986" @@ -10924,6 +11071,13 @@ keyv@^4.0.0: dependencies: json-buffer "3.0.1" +keyv@^4.5.4: + version "4.5.4" + resolved "https://registry.yarnpkg.com/keyv/-/keyv-4.5.4.tgz#a879a99e29452f942439f2a405e3af8b31d4de93" + integrity sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw== + dependencies: + json-buffer "3.0.1" + kind-of@^3.0.2, kind-of@^3.0.3, kind-of@^3.2.0: version "3.2.2" resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64" @@ -13824,6 +13978,11 @@ semver@^7.5.3, semver@^7.5.4: dependencies: lru-cache "^6.0.0" +semver@^7.6.0: + version "7.6.1" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.1.tgz#60bfe090bf907a25aa8119a72b9f90ef7ca281b2" + integrity sha512-f/vbBsu+fOiYt+lmwZV0rVwJScl46HppnOA1ZvIuBWKOTlllpyJ3bfVax76/OrhCH38dyxoDIA8K7uB963IYgA== + semver@~7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/semver/-/semver-7.0.0.tgz#5f3ca35761e47e05b206c6daff2cf814f0316b8e" @@ -14951,11 +15110,6 @@ type-detect@4.0.8: resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c" integrity sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g== -type-fest@^0.20.2: - version "0.20.2" - resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.20.2.tgz#1bf207f4b28f91583666cb5fbd327887301cd5f4" - integrity sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ== - type-fest@^0.21.3: version "0.21.3" resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.21.3.tgz#d260a24b0198436e133fa26a524a6d65fa3b2e37" @@ -15253,6 +15407,13 @@ util-deprecate@^1.0.1, util-deprecate@~1.0.1: resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw== +util@^0.11.1: + version "0.11.1" + resolved "https://registry.yarnpkg.com/util/-/util-0.11.1.tgz#3236733720ec64bb27f6e26f421aaa2e1b588d61" + integrity sha512-HShAsny+zS2TZfaXxD9tYj4HQGlBezXZMZuM/S5PKLLoZkShZiGk9o5CzukI1LVHZvjdvZ2Sj1aW/Ndn2NB/HQ== + dependencies: + inherits "2.0.3" + util@^0.12.5: version "0.12.5" resolved "https://registry.yarnpkg.com/util/-/util-0.12.5.tgz#5f17a6059b73db61a875668781a1c2b136bd6fbc" From d0a72384c5e7ceabd91fc8b86f845e37a1363b50 Mon Sep 17 00:00:00 2001 From: vuonghuuhung Date: Mon, 13 May 2024 12:02:35 +0700 Subject: [PATCH 15/24] (update) get decimal from token info & get all orders when order id is -1 --- src/connectors/oraidex/oraidex.helper.ts | 12 ++++--- src/connectors/oraidex/oraidex.ts | 42 +++++++++++++++--------- src/connectors/oraidex/oraidex.types.ts | 3 +- 3 files changed, 37 insertions(+), 20 deletions(-) diff --git a/src/connectors/oraidex/oraidex.helper.ts b/src/connectors/oraidex/oraidex.helper.ts index 622034bcc6..73d0315c66 100644 --- a/src/connectors/oraidex/oraidex.helper.ts +++ b/src/connectors/oraidex/oraidex.helper.ts @@ -64,8 +64,10 @@ export const parseToToken = async (asset: AssetInfo, client: CosmWasmClient): Pr decimals: info.decimals, name: info.name, symbol: info.symbol, - token: { - contract_addr: tokenAddress, + assetInfo: { + token: { + contract_addr: tokenAddress, + } }, }; } else { @@ -81,8 +83,10 @@ export const parseToToken = async (asset: AssetInfo, client: CosmWasmClient): Pr decimals: 6, name: symbol.toUpperCase(), symbol: symbol.toUpperCase(), - native_token: { - denom: tokenDenom, + assetInfo: { + native_token: { + denom: tokenDenom, + } }, }; } diff --git a/src/connectors/oraidex/oraidex.ts b/src/connectors/oraidex/oraidex.ts index b83218e88d..cc98adadc8 100644 --- a/src/connectors/oraidex/oraidex.ts +++ b/src/connectors/oraidex/oraidex.ts @@ -168,7 +168,7 @@ export class OraidexCLOB implements CLOBish { const sells: any = []; let res = await this.orderbookQueryClient.orders({ - assetInfos: [market.baseToken, market.quoteToken], + assetInfos: [market.baseToken.assetInfo, market.quoteToken.assetInfo], filter: 'none', limit, }); @@ -225,7 +225,7 @@ export class OraidexCLOB implements CLOBish { private async getMidPriceForMarket(market: Market) { const midPrice = await this.orderbookQueryClient.midPrice({ - assetInfos: [market.baseToken, market.quoteToken], + assetInfos: [market.baseToken.assetInfo, market.quoteToken.assetInfo], }); return Number(midPrice).toFixed(3); @@ -245,10 +245,18 @@ export class OraidexCLOB implements CLOBish { getNotNullOrThrowError(req.address), ) ).orders; + + console.log({ originalOrders }); + + if (req.orderId != "-1") { + originalOrders = originalOrders.filter( + (order: any) => order.order_id == req.orderId, + ); + } } else { const originalOrder = await this.orderbookQueryClient.order({ orderId: Number(req.orderId), - assetInfos: [market.baseToken, market.quoteToken], + assetInfos: [market.baseToken.assetInfo, market.quoteToken.assetInfo], }); originalOrders = [originalOrder]; } @@ -264,7 +272,7 @@ export class OraidexCLOB implements CLOBish { partialResponse.orders.length >= ORDERBOOK_LIMIT ) { partialResponse = await this.orderbookQueryClient.orders({ - assetInfos: [market.baseToken, market.quoteToken], + assetInfos: [market.baseToken.assetInfo, market.quoteToken.assetInfo], filter: { bidder: owner, }, @@ -319,16 +327,21 @@ export class OraidexCLOB implements CLOBish { const instructions: ExecuteInstruction[] = []; const sender = options.ownerAddress; - // TODO: hardcode - const decimals = 1000000; + let baseDecimal: number; + let quoteDecimal: number; for (const order of options.orders) { + const market = this.parsedMarkets[order.market] as Market; - const baseAmount = Math.round(Number(order.amount) * decimals); - const baseToken = market.baseToken; - const quoteToken = market.quoteToken; + quoteDecimal = 10 ** market.quoteToken.decimals; + baseDecimal = 10 ** market.baseToken.decimals; + + console.log({ quoteDecimal, baseDecimal }); + const baseAmount = Math.round(Number(order.amount) * baseDecimal); + const baseToken = market.baseToken.assetInfo; + const quoteToken = market.quoteToken.assetInfo; const quoteAmount = Math.round( - decimals * parseFloat(order.price) * parseFloat(order.amount), + quoteDecimal * parseFloat(order.price) * parseFloat(order.amount), ); const assets = [ @@ -415,8 +428,8 @@ export class OraidexCLOB implements CLOBish { async deleteOrder(req: ClobDeleteOrderRequest): Promise<{ txHash: string }> { const market = this.parsedMarkets[req.market] as Market; - const baseToken = market.baseToken; - const quoteToken = market.quoteToken; + const baseToken = market.baseToken.assetInfo; + const quoteToken = market.quoteToken.assetInfo; let res = await this.oraichainNetwork.executeContract( req.address, @@ -438,9 +451,8 @@ export class OraidexCLOB implements CLOBish { for (const order of options.orders) { const market = this.parsedMarkets[order.market] as Market; - const baseToken = market.baseToken; - const quoteToken = market.quoteToken; - + const baseToken = market.baseToken.assetInfo; + const quoteToken = market.quoteToken.assetInfo; instructions.push({ contractAddress: this._swapLimitOrder, msg: { diff --git a/src/connectors/oraidex/oraidex.types.ts b/src/connectors/oraidex/oraidex.types.ts index aba5cb261f..97a2a81336 100644 --- a/src/connectors/oraidex/oraidex.types.ts +++ b/src/connectors/oraidex/oraidex.types.ts @@ -25,10 +25,11 @@ export type FeeServiceProvider = Fee; export type MarketId = Address; -export type Token = AssetInfo & { +export type Token = { name: string; symbol: string; decimals: number; + assetInfo: AssetInfo; } // From 8ec783c574236c7c9be6687a539ecc44d62f508e Mon Sep 17 00:00:00 2001 From: vuonghuuhung Date: Mon, 13 May 2024 14:03:43 +0700 Subject: [PATCH 16/24] (add) gas limit and gas price --- src/chains/oraichain/oraichain.config.ts | 2 ++ src/chains/oraichain/oraichain.ts | 6 ++++++ src/connectors/oraidex/oraidex.ts | 4 ++-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/chains/oraichain/oraichain.config.ts b/src/chains/oraichain/oraichain.config.ts index b9f98ba5c4..17a69ce749 100644 --- a/src/chains/oraichain/oraichain.config.ts +++ b/src/chains/oraichain/oraichain.config.ts @@ -13,6 +13,7 @@ export interface Config { network: NetworkConfig; nativeCurrencySymbol: string; manualGasPrice: number; + gasLimit: number; } export namespace OraichainConfig { @@ -47,5 +48,6 @@ export function getOraichainConfig( chainName + '.nativeCurrencySymbol' ), manualGasPrice: configManager.get(chainName + '.manualGasPrice'), + gasLimit: configManager.get(chainName + '.gasLimit'), }; } diff --git a/src/chains/oraichain/oraichain.ts b/src/chains/oraichain/oraichain.ts index 4dd3df3a3a..373181c515 100644 --- a/src/chains/oraichain/oraichain.ts +++ b/src/chains/oraichain/oraichain.ts @@ -28,6 +28,7 @@ export class Oraichain extends CosmosBase implements Cosmosish { private static _instances: { [name: string]: Oraichain }; private _rpcUrl: string; private _gasPrice: number; + private _gasLimit: number; private _nativeTokenSymbol: string; private _chain: string; private _requestCount: number; @@ -66,6 +67,7 @@ export class Oraichain extends CosmosBase implements Cosmosish { this._marketListType = config.network.marketListType; this._gasPrice = config.manualGasPrice; + this._gasLimit = config.gasLimit; this._requestCount = 0; this._metricsLogInterval = 300000; // 5 minutes @@ -216,6 +218,10 @@ export class Oraichain extends CosmosBase implements Cosmosish { return this._gasPrice; } + public get gasLimit(): number { + return this._gasLimit; + } + public get chain(): string { return this._chain; } diff --git a/src/connectors/oraidex/oraidex.ts b/src/connectors/oraidex/oraidex.ts index cc98adadc8..c4d68f8506 100644 --- a/src/connectors/oraidex/oraidex.ts +++ b/src/connectors/oraidex/oraidex.ts @@ -481,8 +481,8 @@ export class OraidexCLOB implements CLOBish { } { return { gasCost: 0, - gasLimit: 0, - gasPrice: 0, + gasLimit: this.oraichainNetwork.gasLimit, + gasPrice: this.oraichainNetwork.gasPrice, gasPriceToken: 'orai', }; } From cc794aef88d714633fc20ac9a8aed8494629f836 Mon Sep 17 00:00:00 2001 From: vuonghuuhung Date: Fri, 17 May 2024 15:36:26 +0700 Subject: [PATCH 17/24] (update+add) get all orderbook & add xoch token --- Dockerfile | 3 +- src/chains/oraichain/oraichain.ts | 2 +- src/connectors/oraidex/oraidex.ts | 100 +++++++++++++++++++---------- src/templates/lists/oraichain.json | 8 +++ 4 files changed, 77 insertions(+), 36 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1a56f2c1f3..e88a3a4309 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Set the base image -FROM node:18.10.0 +FROM node:18.18.0 # WORKDIR /usr/src/app/ WORKDIR /home/gateway @@ -25,6 +25,7 @@ ENV INSTALLATION_TYPE=docker RUN mkdir -p /home/gateway/conf /home/gateway/logs /home/gateway/db /home/gateway/certs # Install dependencies and compile +RUN yarn global add node-gyp RUN yarn install --frozen-lockfile RUN yarn build diff --git a/src/chains/oraichain/oraichain.ts b/src/chains/oraichain/oraichain.ts index 373181c515..7f817bc366 100644 --- a/src/chains/oraichain/oraichain.ts +++ b/src/chains/oraichain/oraichain.ts @@ -255,4 +255,4 @@ export class Oraichain extends CosmosBase implements Cosmosish { delete Oraichain._instances[this._chain]; } } -} +} \ No newline at end of file diff --git a/src/connectors/oraidex/oraidex.ts b/src/connectors/oraidex/oraidex.ts index c4d68f8506..e5b4f5e99a 100644 --- a/src/connectors/oraidex/oraidex.ts +++ b/src/connectors/oraidex/oraidex.ts @@ -31,7 +31,7 @@ import { OraiswapLimitOrderQueryClient } from '@oraichain/oraidex-contracts-sdk' import { OraidexConfig } from './oraidex.config'; import { JsonObject, ExecuteInstruction } from '@cosmjs/cosmwasm-stargate'; -const ORDERBOOK_LIMIT = 100; //? +const ORDERBOOK_LIMIT = 100; export class OraidexCLOB implements CLOBish { chain: string; @@ -39,6 +39,8 @@ export class OraidexCLOB implements CLOBish { public parsedMarkets: CLOBMarkets = {}; + private static _isExecuting: boolean = false; + private _swapLimitOrder: string; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore @@ -167,13 +169,26 @@ export class OraidexCLOB implements CLOBish { const buys: any = []; const sells: any = []; - let res = await this.orderbookQueryClient.orders({ - assetInfos: [market.baseToken.assetInfo, market.quoteToken.assetInfo], - filter: 'none', - limit, - }); + const res: JsonObject = { orders: [] }; + let partialResponse: JsonObject; - res.orders.forEach((order) => { + while ( + !partialResponse || + partialResponse.orders.length >= limit + ) { + partialResponse = await this.orderbookQueryClient.orders({ + assetInfos: [market.baseToken.assetInfo, market.quoteToken.assetInfo], + filter: 'none', + limit: limit, + startAfter: partialResponse + ? partialResponse.orders[partialResponse.orders.length - 1].order_id + : null, + }); + + res.orders = [...res.orders, ...partialResponse.orders]; + } + + res.orders.forEach((order: any) => { if (order.direction == 'buy') { let price = ( parseFloat(order.offer_asset.amount) / @@ -246,9 +261,7 @@ export class OraidexCLOB implements CLOBish { ) ).orders; - console.log({ originalOrders }); - - if (req.orderId != "-1") { + if (req.orderId != 'None') { originalOrders = originalOrders.filter( (order: any) => order.order_id == req.orderId, ); @@ -290,7 +303,7 @@ export class OraidexCLOB implements CLOBish { async postOrder( req: ClobPostOrderRequest, - ): Promise<{ txHash: string; id?: string }> { + ): Promise<{ txHash: any; id?: string }> { const convertedReq = { ownerAddress: req.address, orders: [req], @@ -331,12 +344,10 @@ export class OraidexCLOB implements CLOBish { let quoteDecimal: number; for (const order of options.orders) { - const market = this.parsedMarkets[order.market] as Market; quoteDecimal = 10 ** market.quoteToken.decimals; baseDecimal = 10 ** market.baseToken.decimals; - console.log({ quoteDecimal, baseDecimal }); const baseAmount = Math.round(Number(order.amount) * baseDecimal); const baseToken = market.baseToken.assetInfo; const quoteToken = market.quoteToken.assetInfo; @@ -416,32 +427,51 @@ export class OraidexCLOB implements CLOBish { } } - let res = await this.oraichainNetwork.executeContractMultiple( - sender, - instructions, - ); - - // let rawLogs = convertRawLogEventsToMapOfEvents(res.logs); + let res = await this.processingOrders(async () => { + return await this.oraichainNetwork.executeContractMultiple( + sender, + instructions, + ); + }); + OraidexCLOB._isExecuting = false; return res.transactionHash; } + async processingOrders(callback: any) { + if (OraidexCLOB._isExecuting) { + while (true) { + await new Promise((resolve) => setTimeout(resolve, 250)); + if (!OraidexCLOB._isExecuting) { + OraidexCLOB._isExecuting = true; + return (await callback()); + } + } + } + + OraidexCLOB._isExecuting = true; + return (await callback()); + } + async deleteOrder(req: ClobDeleteOrderRequest): Promise<{ txHash: string }> { const market = this.parsedMarkets[req.market] as Market; const baseToken = market.baseToken.assetInfo; const quoteToken = market.quoteToken.assetInfo; - let res = await this.oraichainNetwork.executeContract( - req.address, - this._swapLimitOrder, - { - cancel_order: { - asset_infos: [baseToken, quoteToken], - order_id: Number(req.orderId), + let res = await this.processingOrders(async () => { + return await this.oraichainNetwork.executeContract( + req.address, + this._swapLimitOrder, + { + cancel_order: { + asset_infos: [baseToken, quoteToken], + order_id: Number(req.orderId), + }, }, - }, - [], - ); + [], + ); + }); + OraidexCLOB._isExecuting = false; return { txHash: res.transactionHash }; } @@ -465,11 +495,13 @@ export class OraidexCLOB implements CLOBish { }); } - let res = await this.oraichainNetwork.executeContractMultiple( - sender, - instructions, - ); - + let res = await this.processingOrders(async () => { + return await this.oraichainNetwork.executeContractMultiple( + sender, + instructions, + ); + }); + OraidexCLOB._isExecuting = false; return res.transactionHash; } diff --git a/src/templates/lists/oraichain.json b/src/templates/lists/oraichain.json index cc4daf78f4..a3f172871f 100644 --- a/src/templates/lists/oraichain.json +++ b/src/templates/lists/oraichain.json @@ -17,6 +17,14 @@ "decimals": 6, "chainId": "Oraichain", "base": "" + }, + { + "name": "xOCH token", + "symbol": "xOCH", + "address": "orai1lplapmgqnelqn253stz6kmvm3ulgdaytn89a8mz9y85xq8wd684s6xl3lt", + "decimals": 6, + "chainId": "Oraichain", + "base": "" } ] } From 9bc766c061c648d5b23f7b02a838b722581ec400 Mon Sep 17 00:00:00 2001 From: vuonghuuhung Date: Fri, 17 May 2024 18:27:23 +0700 Subject: [PATCH 18/24] (update) init signing client when start --- src/chains/oraichain/oraichain.ts | 84 +++++----- src/connectors/dexalot/dexalot.ts | 2 +- src/connectors/oraidex/oraidex.helper.ts | 15 ++ src/connectors/oraidex/oraidex.ts | 185 +++++++++++++++++------ 4 files changed, 201 insertions(+), 85 deletions(-) diff --git a/src/chains/oraichain/oraichain.ts b/src/chains/oraichain/oraichain.ts index 7f817bc366..2d9afbcc95 100644 --- a/src/chains/oraichain/oraichain.ts +++ b/src/chains/oraichain/oraichain.ts @@ -5,6 +5,7 @@ import { logger } from '../../services/logger'; import { MarketListType, TokenInfo } from '../../services/base'; import axios from 'axios'; import { promises as fs } from 'fs'; +import fse from 'fs-extra'; import { OraichainController } from './oraichain.controller'; import { JsonObject, @@ -36,6 +37,7 @@ export class Oraichain extends CosmosBase implements Cosmosish { private _metricTimer; private _marketListSource: string; private _marketListType: MarketListType; + private _signers: Map = new Map(); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore @@ -58,7 +60,7 @@ export class Oraichain extends CosmosBase implements Cosmosish { config.network.rpcURL, config.network.tokenListSource, config.network.tokenListType, - config.manualGasPrice + config.manualGasPrice, ); this._rpcUrl = config.network.rpcURL; this._chain = network; @@ -74,7 +76,7 @@ export class Oraichain extends CosmosBase implements Cosmosish { this._metricTimer = setInterval( this.metricLogger.bind(this), - this.metricsLogInterval + this.metricsLogInterval, ); this.controller = OraichainController; } @@ -92,21 +94,22 @@ export class Oraichain extends CosmosBase implements Cosmosish { async init(): Promise { if (!this.ready()) { await super.init(); + await this.initSigningCosmWasmClient(); await this.loadMarkets(this._marketListSource, this._marketListType); //init cosmwasm client this._cosmwasmClient = await cosmwasm.SigningCosmWasmClient.connect( - this._rpcUrl + this._rpcUrl, ); } } async loadMarkets( marketListSource: string, - marketListType: MarketListType + marketListType: MarketListType, ): Promise { this.marketList = await this.getMarketList( marketListSource, - marketListType + marketListType, ); if (this.marketList) { this.marketList.forEach((market: MarketInfo) => { @@ -121,7 +124,7 @@ export class Oraichain extends CosmosBase implements Cosmosish { async getMarketList( marketListSource: string, - marketListType: MarketListType + marketListType: MarketListType, ): Promise { let markets; if (marketListType === 'URL') { @@ -146,38 +149,59 @@ export class Oraichain extends CosmosBase implements Cosmosish { this.requestCount + ' request(s) sent in last ' + this.metricsLogInterval / 1000 + - ' seconds.' + ' seconds.', ); this._requestCount = 0; // reset } public async queryContractSmart( address: string, - query: JsonObject + query: JsonObject, ): Promise { return await this._cosmwasmClient.queryContractSmart(address, query); } - public async executeContract( - sender: string, - contractAddress: string, - msg: JsonObject, - funds: any - ): Promise { - let walletCommon: any = await this.getWallet(sender, 'orai'); + public async initSigningCosmWasmClient(): Promise { + fse.readdirSync('conf/wallets/oraichain').forEach(async (file) => { + const address = file.split('.')[0]; + const client = await this.createSigningCosmWasmClient(file.split('.')[0]); + + this._signers.set(address, client); + }); + } + + private async createSigningCosmWasmClient( + address: string, + ): Promise { + const walletCommon: any = await this.getWallet(address, 'orai'); const wallet = await DirectSecp256k1Wallet.fromKey( walletCommon.privkey, - 'orai' + 'orai', ); - const client = await cosmwasm.SigningCosmWasmClient.connectWithSigner( + return await cosmwasm.SigningCosmWasmClient.connectWithSigner( this._rpcUrl, wallet, { gasPrice: new GasPrice(Decimal.fromUserInput('0.001', 6), 'orai'), - } + broadcastPollIntervalMs: 500, + }, ); + } + + public async executeContract( + sender: string, + contractAddress: string, + msg: JsonObject, + funds: any, + ): Promise { + let client = this._signers.get(sender); + + if (!client) { + client = await this.createSigningCosmWasmClient(sender); + this._signers.set(sender, client); + } let res = await client.execute( sender, @@ -185,29 +209,21 @@ export class Oraichain extends CosmosBase implements Cosmosish { msg, 'auto', undefined, - funds + funds, ); return res; } public async executeContractMultiple( sender: string, - instructions: ExecuteInstruction[] + instructions: ExecuteInstruction[], ): Promise { - let walletCommon: any = await this.getWallet(sender, 'orai'); - - const wallet = await DirectSecp256k1Wallet.fromKey( - walletCommon.privkey, - 'orai' - ); + let client = this._signers.get(sender); - const client = await cosmwasm.SigningCosmWasmClient.connectWithSigner( - this._rpcUrl, - wallet, - { - gasPrice: new GasPrice(Decimal.fromUserInput('0.001', 6), 'orai'), - } - ); + if (!client) { + client = await this.createSigningCosmWasmClient(sender); + this._signers.set(sender, client); + } let res = await client.executeMultiple(sender, instructions, 'auto'); @@ -255,4 +271,4 @@ export class Oraichain extends CosmosBase implements Cosmosish { delete Oraichain._instances[this._chain]; } } -} \ No newline at end of file +} diff --git a/src/connectors/dexalot/dexalot.ts b/src/connectors/dexalot/dexalot.ts index 31c43e2c04..2ae480f580 100644 --- a/src/connectors/dexalot/dexalot.ts +++ b/src/connectors/dexalot/dexalot.ts @@ -255,7 +255,7 @@ export class DexalotCLOB implements CLOBish { const clientOrderID = req.clientOrderID || (await this.getClientOrderId(req.address)); - const txData = await this.tradePairsContract.populateTransaction.addOrder( + const txData = await this.tradePairsContract.populateTransaction.addxOrder( req.address, clientOrderID, this.getDexalotTradingPair(req.market), diff --git a/src/connectors/oraidex/oraidex.helper.ts b/src/connectors/oraidex/oraidex.helper.ts index 73d0315c66..92bca3e633 100644 --- a/src/connectors/oraidex/oraidex.helper.ts +++ b/src/connectors/oraidex/oraidex.helper.ts @@ -2,6 +2,7 @@ import { AssetInfo } from '@oraichain/oraidex-contracts-sdk'; import { Token } from './oraidex.types'; import { CosmWasmClient, Cw20BaseQueryClient } from '@oraichain/common-contracts-sdk'; import * as constant from '@oraichain/oraidex-common/build/constant'; +import { IndexedTx } from '@cosmjs/stargate'; /** * @@ -47,6 +48,20 @@ export const parseToAssetInfo = (address: string): AssetInfo => { }; }; +export const getOrderIdsFromTxData = (txData: IndexedTx): string[] => { + const orderIds: string[] = []; + + txData.events.forEach((event) => { + event.attributes.forEach((attribute) => { + if (attribute.key === 'order_id') { + orderIds.push(attribute.value); + } + }) + }) + + return orderIds; +} + export const parseToToken = async (asset: AssetInfo, client: CosmWasmClient): Promise => { let token: Token; let cw20BaseQueryClient: Cw20BaseQueryClient; diff --git a/src/connectors/oraidex/oraidex.ts b/src/connectors/oraidex/oraidex.ts index e5b4f5e99a..782acf26fd 100644 --- a/src/connectors/oraidex/oraidex.ts +++ b/src/connectors/oraidex/oraidex.ts @@ -17,6 +17,7 @@ import { } from '../../services/common-interfaces'; import { getNotNullOrThrowError, + getOrderIdsFromTxData, isNativeDenom, parseToToken, } from './oraidex.helper'; @@ -39,8 +40,6 @@ export class OraidexCLOB implements CLOBish { public parsedMarkets: CLOBMarkets = {}; - private static _isExecuting: boolean = false; - private _swapLimitOrder: string; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore @@ -172,10 +171,7 @@ export class OraidexCLOB implements CLOBish { const res: JsonObject = { orders: [] }; let partialResponse: JsonObject; - while ( - !partialResponse || - partialResponse.orders.length >= limit - ) { + while (!partialResponse || partialResponse.orders.length >= limit) { partialResponse = await this.orderbookQueryClient.orders({ assetInfos: [market.baseToken.assetInfo, market.quoteToken.assetInfo], filter: 'none', @@ -309,7 +305,9 @@ export class OraidexCLOB implements CLOBish { orders: [req], }; - return { txHash: await this.placeOrders(convertedReq) }; + const { txHash, orderIds } = await this.placeOrder(convertedReq); + + return { txHash, id: orderIds[0] }; } public async batchOrders(req: ClobBatchUpdateRequest): Promise { @@ -320,7 +318,8 @@ export class OraidexCLOB implements CLOBish { ownerAddress: req.address, orders: req.createOrderParams, }; - return { txHash: await this.placeOrders(convertedReq) }; + const { txHash, orderIds } = await this.placeOrders(convertedReq); + return { txHash, orderIds }; } else if (req.cancelOrderParams) { const convertedReq = { ownerAddress: req.address, @@ -336,6 +335,112 @@ export class OraidexCLOB implements CLOBish { } } + async placeOrder(options: PlaceOrdersRequest) { + const sender = options.ownerAddress; + + let baseDecimal: number; + let quoteDecimal: number; + + const order = options.orders[0]; + + const market = this.parsedMarkets[order.market] as Market; + quoteDecimal = 10 ** market.quoteToken.decimals; + baseDecimal = 10 ** market.baseToken.decimals; + + const baseAmount = Math.round(Number(order.amount) * baseDecimal); + const baseToken = market.baseToken.assetInfo; + const quoteToken = market.quoteToken.assetInfo; + const quoteAmount = Math.round( + quoteDecimal * parseFloat(order.price) * parseFloat(order.amount), + ); + + const assets = [ + { info: baseToken, amount: baseAmount.toString() }, + { info: quoteToken, amount: quoteAmount.toString() }, + ]; + const submitOrderMsg = { + submit_order: { + assets, + direction: order.side.toLowerCase(), + }, + }; + + let instruction: ExecuteInstruction; + + if (order.side == 'BUY') { + if (isNativeDenom(quoteToken)) { + instruction ={ + contractAddress: this._swapLimitOrder, + msg: submitOrderMsg, + funds: [ + { + denom: getNotNullOrThrowError( + (quoteToken as any).native_token.denom, + ), + amount: quoteAmount.toString(), + }, + ], + }; + } else { + instruction = { + contractAddress: (quoteToken as any).token.contract_addr, + msg: { + send: { + contract: this._swapLimitOrder, + amount: quoteAmount.toString(), + msg: Buffer.from(JSON.stringify(submitOrderMsg)).toString( + 'base64', + ), + }, + }, + funds: [], + }; + } + } else { + if (isNativeDenom(baseToken)) { + instruction = { + contractAddress: this._swapLimitOrder, + msg: submitOrderMsg, + funds: [ + { + denom: getNotNullOrThrowError( + (baseToken as any).native_token.denom, + ), + amount: baseAmount.toString(), + }, + ], + }; + } else { + instruction = { + contractAddress: (baseToken as any).token.contract_addr, + msg: { + send: { + contract: this._swapLimitOrder, + amount: baseAmount.toString(), + msg: Buffer.from(JSON.stringify(submitOrderMsg)).toString( + 'base64', + ), + }, + }, + funds: [], + }; + } + } + + const res = await this.oraichainNetwork.executeContract( + sender, + instruction.contractAddress, + instruction.msg, + instruction.funds, + ); + + const txData = await this.oraichainNetwork.cosmwasmClient.getTx(res.transactionHash); + if (!txData) throw new Error('Transaction not found'); + const orderIds = getOrderIdsFromTxData(txData); + + return { txHash: res.transactionHash, orderIds }; + } + async placeOrders(options: PlaceOrdersRequest) { const instructions: ExecuteInstruction[] = []; const sender = options.ownerAddress; @@ -427,30 +532,16 @@ export class OraidexCLOB implements CLOBish { } } - let res = await this.processingOrders(async () => { - return await this.oraichainNetwork.executeContractMultiple( - sender, - instructions, - ); - }); - OraidexCLOB._isExecuting = false; - - return res.transactionHash; - } + const res = await this.oraichainNetwork.executeContractMultiple( + sender, + instructions, + ); - async processingOrders(callback: any) { - if (OraidexCLOB._isExecuting) { - while (true) { - await new Promise((resolve) => setTimeout(resolve, 250)); - if (!OraidexCLOB._isExecuting) { - OraidexCLOB._isExecuting = true; - return (await callback()); - } - } - } + const txData = await this.oraichainNetwork.cosmwasmClient.getTx(res.transactionHash); + if (!txData) throw new Error('Transaction not found'); + const orderIds = getOrderIdsFromTxData(txData); - OraidexCLOB._isExecuting = true; - return (await callback()); + return { txHash: res.transactionHash, orderIds }; } async deleteOrder(req: ClobDeleteOrderRequest): Promise<{ txHash: string }> { @@ -458,20 +549,17 @@ export class OraidexCLOB implements CLOBish { const baseToken = market.baseToken.assetInfo; const quoteToken = market.quoteToken.assetInfo; - let res = await this.processingOrders(async () => { - return await this.oraichainNetwork.executeContract( - req.address, - this._swapLimitOrder, - { - cancel_order: { - asset_infos: [baseToken, quoteToken], - order_id: Number(req.orderId), - }, + const res = await this.oraichainNetwork.executeContract( + req.address, + this._swapLimitOrder, + { + cancel_order: { + asset_infos: [baseToken, quoteToken], + order_id: Number(req.orderId), }, - [], - ); - }); - OraidexCLOB._isExecuting = false; + }, + [], + ); return { txHash: res.transactionHash }; } @@ -495,13 +583,10 @@ export class OraidexCLOB implements CLOBish { }); } - let res = await this.processingOrders(async () => { - return await this.oraichainNetwork.executeContractMultiple( - sender, - instructions, - ); - }); - OraidexCLOB._isExecuting = false; + const res = await this.oraichainNetwork.executeContractMultiple( + sender, + instructions, + ); return res.transactionHash; } From 47168ff7ca6eb66fdf666c951bdb43bd0421e040 Mon Sep 17 00:00:00 2001 From: vuonghuuhung Date: Sun, 19 May 2024 10:39:35 +0700 Subject: [PATCH 19/24] (fix) check path exist to init signer --- src/chains/oraichain/oraichain.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/chains/oraichain/oraichain.ts b/src/chains/oraichain/oraichain.ts index 2d9afbcc95..12981bd2bc 100644 --- a/src/chains/oraichain/oraichain.ts +++ b/src/chains/oraichain/oraichain.ts @@ -162,6 +162,10 @@ export class Oraichain extends CosmosBase implements Cosmosish { } public async initSigningCosmWasmClient(): Promise { + if (!fse.pathExistsSync('conf/wallets/oraichain')) { + return; + } + fse.readdirSync('conf/wallets/oraichain').forEach(async (file) => { const address = file.split('.')[0]; const client = await this.createSigningCosmWasmClient(file.split('.')[0]); From b64b8dad875f223bb2cddc252525f189e9d11e65 Mon Sep 17 00:00:00 2001 From: vuonghuuhung Date: Mon, 20 May 2024 17:04:18 +0700 Subject: [PATCH 20/24] (add) test case for oraichain --- src/chains/oraichain/oraichain.controller.ts | 5 +- src/chains/oraichain/oraichain.ts | 129 +++++++------- src/connectors/oraidex/oraidex.model.ts | 58 ------ src/connectors/oraidex/oraidex.ts | 2 +- src/templates/lists/oraichain.json | 16 ++ src/templates/oraichain.yml | 1 - .../chains/oraichain/oraichain.routes.test.ts | 166 ++++++++++++++++++ test/chains/oraichain/oraichain.test.ts | 102 +++++++++++ 8 files changed, 346 insertions(+), 133 deletions(-) delete mode 100644 src/connectors/oraidex/oraidex.model.ts create mode 100644 test/chains/oraichain/oraichain.routes.test.ts create mode 100644 test/chains/oraichain/oraichain.test.ts diff --git a/src/chains/oraichain/oraichain.controller.ts b/src/chains/oraichain/oraichain.controller.ts index f39da6d37c..9d1ca002e9 100644 --- a/src/chains/oraichain/oraichain.controller.ts +++ b/src/chains/oraichain/oraichain.controller.ts @@ -49,6 +49,7 @@ export class OraichainController { tokens = oraichainLish.storedTokenList; } else { for (const t of req.tokenSymbols as []) { + console.log('t', t); const token = oraichainLish.getTokenForSymbol(t); if (token != undefined) { tokens.push(token); @@ -75,8 +76,6 @@ export class OraichainController { static async balances(cosmosish: Oraichain, req: CosmosBalanceRequest) { validateCosmosBalanceRequest(req); - const wallet = await cosmosish.getWallet(req.address, 'orai'); - const { tokenSymbols } = req; let cw20Tokens: Token[] = []; @@ -102,7 +101,7 @@ export class OraichainController { req.address, cw20Tokens ); - const denomBalances = await cosmosish.getBalances(wallet); + const denomBalances = await cosmosish.getBalance(req.address); const filteredBalances = toOraichainBalances( { ...denomBalances, ...cw20Balances }, tokenSymbols diff --git a/src/chains/oraichain/oraichain.ts b/src/chains/oraichain/oraichain.ts index 12981bd2bc..6e483d381e 100644 --- a/src/chains/oraichain/oraichain.ts +++ b/src/chains/oraichain/oraichain.ts @@ -2,9 +2,7 @@ import { Cosmosish } from '../../services/common-interfaces'; import { CosmosBase } from '../cosmos/cosmos-base'; import { getOraichainConfig } from './oraichain.config'; import { logger } from '../../services/logger'; -import { MarketListType, TokenInfo } from '../../services/base'; -import axios from 'axios'; -import { promises as fs } from 'fs'; +import { TokenInfo, TokenValue } from '../../services/base'; import fse from 'fs-extra'; import { OraichainController } from './oraichain.controller'; import { @@ -15,8 +13,9 @@ import { } from '@cosmjs/cosmwasm-stargate'; import * as cosmwasm from '@cosmjs/cosmwasm-stargate'; import { DirectSecp256k1Wallet } from '@cosmjs/proto-signing'; -import { GasPrice } from '@cosmjs/stargate'; +import { GasPrice, StargateClient, setupIbcExtension } from '@cosmjs/stargate'; import { Decimal } from '@cosmjs/math'; +import { BigNumber } from 'ethers'; export type MarketInfo = { id: number; @@ -29,28 +28,20 @@ export class Oraichain extends CosmosBase implements Cosmosish { private static _instances: { [name: string]: Oraichain }; private _rpcUrl: string; private _gasPrice: number; - private _gasLimit: number; private _nativeTokenSymbol: string; private _chain: string; private _requestCount: number; private _metricsLogInterval: number; private _metricTimer; - private _marketListSource: string; - private _marketListType: MarketListType; private _signers: Map = new Map(); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore private _cosmwasmClient: CosmWasmClient; - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - private _signCosmwasmClient: SigningCosmWasmClient; - public controller; protected marketList: MarketInfo[] = []; - private _marketMap: Record = {}; private constructor(network: string) { const config = getOraichainConfig('oraichain', network); @@ -65,11 +56,8 @@ export class Oraichain extends CosmosBase implements Cosmosish { this._rpcUrl = config.network.rpcURL; this._chain = network; this._nativeTokenSymbol = config.nativeCurrencySymbol; - this._marketListSource = config.network.marketListSource; - this._marketListType = config.network.marketListType; this._gasPrice = config.manualGasPrice; - this._gasLimit = config.gasLimit; this._requestCount = 0; this._metricsLogInterval = 300000; // 5 minutes @@ -95,7 +83,6 @@ export class Oraichain extends CosmosBase implements Cosmosish { if (!this.ready()) { await super.init(); await this.initSigningCosmWasmClient(); - await this.loadMarkets(this._marketListSource, this._marketListType); //init cosmwasm client this._cosmwasmClient = await cosmwasm.SigningCosmWasmClient.connect( this._rpcUrl, @@ -103,39 +90,6 @@ export class Oraichain extends CosmosBase implements Cosmosish { } } - async loadMarkets( - marketListSource: string, - marketListType: MarketListType, - ): Promise { - this.marketList = await this.getMarketList( - marketListSource, - marketListType, - ); - if (this.marketList) { - this.marketList.forEach((market: MarketInfo) => { - if (!this._marketMap[market.marketId]) { - this._marketMap[market.marketId] = []; - } - - this._marketMap[market.marketId].push(market); - }); - } - } - - async getMarketList( - marketListSource: string, - marketListType: MarketListType, - ): Promise { - let markets; - if (marketListType === 'URL') { - const resp = await axios.get(marketListSource); - markets = resp.data.tokens; - } else { - markets = JSON.parse(await fs.readFile(marketListSource, 'utf8')); - } - return markets; - } - public static getConnectedInstances(): { [name: string]: Oraichain } { return Oraichain._instances; } @@ -174,7 +128,7 @@ export class Oraichain extends CosmosBase implements Cosmosish { }); } - private async createSigningCosmWasmClient( + public async createSigningCosmWasmClient( address: string, ): Promise { const walletCommon: any = await this.getWallet(address, 'orai'); @@ -194,18 +148,23 @@ export class Oraichain extends CosmosBase implements Cosmosish { ); } + public async getSigningClient(address: string): Promise { + let client = this._signers.get(address); + + if (!client) { + client = await this.createSigningCosmWasmClient(address); + this._signers.set(address, client); + } + return client; + } + public async executeContract( sender: string, contractAddress: string, msg: JsonObject, funds: any, ): Promise { - let client = this._signers.get(sender); - - if (!client) { - client = await this.createSigningCosmWasmClient(sender); - this._signers.set(sender, client); - } + const client = await this.getSigningClient(sender); let res = await client.execute( sender, @@ -215,33 +174,66 @@ export class Oraichain extends CosmosBase implements Cosmosish { undefined, funds, ); + + // console.dir(res, { depth: null }); return res; } + public async executeContractMultiple( sender: string, instructions: ExecuteInstruction[], ): Promise { - let client = this._signers.get(sender); - - if (!client) { - client = await this.createSigningCosmWasmClient(sender); - this._signers.set(sender, client); - } + const client = await this.getSigningClient(sender); let res = await client.executeMultiple(sender, instructions, 'auto'); + // console.dir(res, { depth: null }); + return res; } - public get gasPrice(): number { - return this._gasPrice; - } + async getBalance(address: string): Promise> { + const provider = await StargateClient.connect(this._rpcUrl); + + const balances: Record = {}; + + const allTokens = await provider.getAllBalances(address); + + await Promise.all( + allTokens.map(async (t: { denom: string; amount: string }) => { + let token = this.getTokenByBase(t.denom); + + if (!token && t.denom.startsWith('ibc/')) { + const ibcHash: string = t.denom.replace('ibc/', ''); + + // Get base denom by IBC hash + if (ibcHash) { + const { denomTrace } = await setupIbcExtension( + await (provider as any).queryClient, + ).ibc.transfer.denomTrace(ibcHash); + if (denomTrace) { + const { baseDenom } = denomTrace; + token = this.getTokenByBase(baseDenom); + } + } + } + + // Not all tokens are added in the registry so we use the denom if the token doesn't exist + balances[token ? token.symbol : t.denom] = { + value: BigNumber.from(parseInt(t.amount, 10)), + decimals: this.getTokenDecimals(token), + }; + }), + ); - public get gasLimit(): number { - return this._gasLimit; + return balances; } + public get gasPrice(): number { + return this._gasPrice; + } + public get chain(): string { return this._chain; } @@ -265,9 +257,6 @@ export class Oraichain extends CosmosBase implements Cosmosish { public get cosmwasmClient(): CosmWasmClient { return this._cosmwasmClient; } - public get signCosmwasmClient(): SigningCosmWasmClient { - return this._signCosmwasmClient; - } async close() { clearInterval(this._metricTimer); diff --git a/src/connectors/oraidex/oraidex.model.ts b/src/connectors/oraidex/oraidex.model.ts deleted file mode 100644 index e79ec2a4ac..0000000000 --- a/src/connectors/oraidex/oraidex.model.ts +++ /dev/null @@ -1,58 +0,0 @@ -// import { Oraichain } from '../../chains/oraichain/oraichain'; - -// export class OraidexModel { -// /** -// * -// * @private -// */ -// oraichainNetwork: Oraichain; -// /** -// * -// */ -// chain: string; - -// /** -// * -// */ -// network: string; - -// /** -// * -// * @private -// */ -// private static _instances: { [name: string]: OraidexModel }; - -// /** -// * Get the Kujira instance for the given chain and network. -// * -// * @param chain -// * @param network -// */ -// public static getInstance(chain: string, network: string): OraidexModel { -// if (OraidexModel._instances === undefined) { -// OraidexModel._instances = {}; -// } - -// const key = `${chain}:${network}`; - -// if (!(key in OraidexModel._instances)) { -// OraidexModel._instances[key] = new OraidexModel(chain, network); -// } - -// return OraidexModel._instances[key]; -// } - -// /** -// * Creates a new instance of Oraichain. -// * -// * @param chain -// * @param network -// * @private -// */ -// private constructor(chain: string, network: string) { -// this.chain = chain; -// this.network = network; - -// this.oraichainNetwork = Oraichain.getInstance(network); -// } -// } diff --git a/src/connectors/oraidex/oraidex.ts b/src/connectors/oraidex/oraidex.ts index 782acf26fd..6787ff03c3 100644 --- a/src/connectors/oraidex/oraidex.ts +++ b/src/connectors/oraidex/oraidex.ts @@ -598,7 +598,7 @@ export class OraidexCLOB implements CLOBish { } { return { gasCost: 0, - gasLimit: this.oraichainNetwork.gasLimit, + gasLimit: 500000, gasPrice: this.oraichainNetwork.gasPrice, gasPriceToken: 'orai', }; diff --git a/src/templates/lists/oraichain.json b/src/templates/lists/oraichain.json index a3f172871f..e0ea46c4c5 100644 --- a/src/templates/lists/oraichain.json +++ b/src/templates/lists/oraichain.json @@ -25,6 +25,22 @@ "decimals": 6, "chainId": "Oraichain", "base": "" + }, + { + "name": "BTC token", + "symbol": "BTC", + "address": "orai10g6frpysmdgw5tdqke47als6f97aqmr8s3cljsvjce4n5enjftcqtamzsd", + "decimals": 6, + "chainId": "Oraichain", + "base": "" + }, + { + "name": "ATOM token", + "symbol": "ATOM", + "address": "ibc/A2E2EEC9057A4A1C2C0A6A4C78B0239118DF5F278830F50B4A6BDD7A66506B78", + "decimals": 6, + "chainId": "Oraichain", + "base": "ibc/A2E2EEC9057A4A1C2C0A6A4C78B0239118DF5F278830F50B4A6BDD7A66506B78" } ] } diff --git a/src/templates/oraichain.yml b/src/templates/oraichain.yml index e6bdd38aff..c6c8d89388 100644 --- a/src/templates/oraichain.yml +++ b/src/templates/oraichain.yml @@ -25,5 +25,4 @@ prefix: "orai" gasPrice: 0.001 gasPriceSuffix: 'orai' nativeCurrencySymbol: ORAI -gasLimitEstimate: 500000 manualGasPrice: 110 diff --git a/test/chains/oraichain/oraichain.routes.test.ts b/test/chains/oraichain/oraichain.routes.test.ts new file mode 100644 index 0000000000..5698219506 --- /dev/null +++ b/test/chains/oraichain/oraichain.routes.test.ts @@ -0,0 +1,166 @@ +import request from 'supertest'; +import { Oraichain } from '../../../src/chains/oraichain/oraichain'; +import { gatewayApp } from '../../../src/app'; + +let oraichain: Oraichain; + +beforeAll(async () => { + oraichain = Oraichain.getInstance('mainnet'); + oraichain.initSigningCosmWasmClient = jest.fn(); + + await oraichain.init(); +}); + +afterAll(async () => { + await oraichain.close(); +}); + +describe('POST /chain/balances', () => { + it('should return 200 asking for supported tokens', async () => { + await request(gatewayApp) + .post('/chain/balances') + .send({ + chain: 'oraichain', + network: 'mainnet', + address: 'orai1swus8mwu8xjulawqxdwh8hvg4gknh2c64tuc0k', + tokenSymbols: ['USDT', 'xOCH'], + }) + .set('Accept', 'application/json') + .expect('Content-Type', /json/) + .expect(200) + .then((response) => { + expect(response.body).toHaveProperty('balances'); + expect(response.body.balances).toHaveProperty('USDT'); + expect(response.body.balances).toHaveProperty('xOCH'); + }); + }); + + it('should return 200 asking for native token', async () => { + await request(gatewayApp) + .post('/chain/balances') + .send({ + chain: 'oraichain', + network: 'mainnet', + address: 'orai1swus8mwu8xjulawqxdwh8hvg4gknh2c64tuc0k', + tokenSymbols: ['ORAI'], + }) + .set('Accept', 'application/json') + .expect('Content-Type', /json/) + .expect(200) + .then((response) => { + expect(response.body).toHaveProperty('balances'); + expect(response.body.balances).toHaveProperty('ORAI'); + }); + }); + + it('should return 200 asking for IBC token', async () => { + await request(gatewayApp) + .post('/chain/balances') + .send({ + chain: 'oraichain', + network: 'mainnet', + address: 'orai1swus8mwu8xjulawqxdwh8hvg4gknh2c64tuc0k', + tokenSymbols: ['ATOM'], + }) + .set('Accept', 'application/json') + .expect('Content-Type', /json/) + .expect(200) + .then((response) => { + expect(response.body).toHaveProperty('balances'); + expect(response.body.balances).toHaveProperty('ATOM'); + }); + }); + + it('should return 500 asking for unsupported token', async () => { + await request(gatewayApp) + .post('/chain/balances') + .send({ + chain: 'oraichain', + network: 'mainnet', + address: 'orai1swus8mwu8xjulawqxdwh8hvg4gknh2c64tuc0k', + tokenSymbols: ['USDT', 'xOCH', 'ETH'], + }) + .set('Accept', 'application/json') + .expect('Content-Type', /json/) + .expect(500); + }); + + it('should return 404 when parameters are invalid', async () => { + await request(gatewayApp) + .post('/chain/balances') + .send({ + chain: 'oraichain', + network: 'mainnet', + address: 'hello', + tokenSymbols: ['USDT', 'xOCH'], + }) + .set('Accept', 'application/json') + .expect('Content-Type', /json/) + .expect(404); + }); +}); + +describe('POST /chain/poll', () => { + it('should return 200 asking for transaction data with valid txHash', async () => { + await request(gatewayApp) + .post('/chain/poll') + .send({ + chain: 'oraichain', + network: 'mainnet', + txHash: + 'E104B6C37821552EC553CFAE2B84473861E3621F57310B67E3BDA1EAB536F5D2', + }) + .set('Accept', 'application/json') + .expect('Content-Type', /json/) + .then((response) => { + expect(response.body).toHaveProperty('txHash'); + expect(response.body).toHaveProperty('currentBlock'); + }); + }); + + it('should return 503 when parameters are invalid', async () => { + await request(gatewayApp) + .post('/chain/poll') + .send({ + chain: 'oraichain', + network: 'mainnet', + txHash: 'hello', + }) + .set('Accept', 'application/json') + .expect('Content-Type', /json/) + .expect(503); + }); +}); + +describe('GET /chain/tokens', () => { + it('should return 200 asking for supported tokens', async () => { + await request(gatewayApp) + .get('/chain/tokens') + .query({ + chain: 'oraichain', + network: 'mainnet', + }) + .set('Accept', 'application/json') + .expect('Content-Type', /json/) + .expect(200) + .then((response) => { + expect(response.body).toHaveProperty('tokens'); + }); + }); + + it('should return 200 with query tokens', async () => { + await request(gatewayApp) + .get('/chain/tokens') + .query({ + chain: 'oraichain', + network: 'mainnet', + tokenSymbols: ['USDT', 'xOCH'], + }) + .set('Accept', 'application/json') + .expect('Content-Type', /json/) + .expect(200) + .then((response) => { + expect(response.body).toHaveProperty('tokens'); + }); + }); +}); diff --git a/test/chains/oraichain/oraichain.test.ts b/test/chains/oraichain/oraichain.test.ts new file mode 100644 index 0000000000..341ee807ca --- /dev/null +++ b/test/chains/oraichain/oraichain.test.ts @@ -0,0 +1,102 @@ +import { AccountData, makeCosmoshubPath } from '@cosmjs/proto-signing'; +import { Oraichain } from '../../../src/chains/oraichain/oraichain'; +import { Bip39, EnglishMnemonic, Slip10, Slip10Curve } from '@cosmjs/crypto'; +import { toHex } from '@cosmjs/encoding'; + +const testContract = 'orai12hzjxfh77wl572gdzct2fxv2arxcwh6gykc7qh'; +let oraichain: Oraichain; +let account: AccountData; +// let client: SigningCosmWasmClient; + +beforeAll(async () => { + oraichain = Oraichain.getInstance('mainnet'); + + // random account + const mnemonic = new EnglishMnemonic( + 'enlist hip relief stomach skate base shallow young switch frequent cry park', + ); + const hdPath = makeCosmoshubPath(0); + const seed = await Bip39.mnemonicToSeed(mnemonic); + const masterKey = Slip10.derivePath(Slip10Curve.Secp256k1, seed, hdPath); + const privateKeyTest = masterKey.privkey; + + const wallet = await oraichain.getWalletFromPrivateKey( + toHex(privateKeyTest), + 'orai', + ); + account = (await wallet.getAccounts())[0]; + oraichain.initSigningCosmWasmClient = jest.fn(); + oraichain.getWallet = jest.fn().mockReturnValue(wallet); + const client = await oraichain.getSigningClient(account.address); + client.execute = jest.fn().mockReturnValue({}); + client.executeMultiple = jest.fn().mockReturnValue({}); + await oraichain.init(); +}); + +afterAll(async () => { + await oraichain.close(); +}); + +describe('Getter', () => { + it('getConnectedInstances', async () => { + const instances = Oraichain.getConnectedInstances(); + expect(instances).toBeDefined(); + }); + + it('getGasPrice', async () => { + const gasPrice = oraichain.gasPrice; + expect(gasPrice).toBeDefined(); + }); + + it('getChain', async () => { + const chain = oraichain.chain; + expect(chain).toBeDefined(); + }); + + it('getNativeTokenSymbol', async () => { + const symbol = oraichain.nativeTokenSymbol; + expect(symbol).toBeDefined(); + }); + + it('getRequestCount', async () => { + const requestCount = oraichain.requestCount; + oraichain.requestCounter({ action: 'request' }); + const newRequestCount = oraichain.requestCount; + expect(requestCount).toEqual(newRequestCount - 1); + oraichain.metricLogger(); + expect(requestCount).toEqual(0); + }); + + it('getMetricsLogInterval', async () => { + const interval = oraichain.metricsLogInterval; + expect(interval).toBeDefined(); + }); + + it('getStoredMarketList', async () => { + const list = oraichain.storedMarketList; + expect(list).toBeDefined(); + }); + + it('getCosmWasmClient', async () => { + const client = oraichain.cosmwasmClient; + expect(client).toBeDefined(); + }); +}); + +describe('Signing client', () => { + it('should create a signing client', async () => { + const client = await oraichain.createSigningCosmWasmClient(account.address); + expect(client).toBeDefined(); + }); + + it('should execute single transaction', async () => { + const res = await oraichain.executeContract(account.address, testContract, {}, {}); + expect(res).toBeDefined(); + }); + + it('should execute multiple transaction', async () => { + const res = await oraichain.executeContractMultiple(account.address, []); + expect(res).toBeDefined(); + }); +}); + From 430898dcef75ef4a6c05c633c366a8ff0b5ece6d Mon Sep 17 00:00:00 2001 From: vuonghuuhung Date: Tue, 21 May 2024 17:29:55 +0700 Subject: [PATCH 21/24] (add) test case for oraidex --- src/connectors/oraidex/oraidex.ts | 1 + test/connectors/oraidex/oraidex.test.ts | 514 ++++++++++++++++++++++++ 2 files changed, 515 insertions(+) create mode 100644 test/connectors/oraidex/oraidex.test.ts diff --git a/src/connectors/oraidex/oraidex.ts b/src/connectors/oraidex/oraidex.ts index 6787ff03c3..86d45ae3cd 100644 --- a/src/connectors/oraidex/oraidex.ts +++ b/src/connectors/oraidex/oraidex.ts @@ -435,6 +435,7 @@ export class OraidexCLOB implements CLOBish { ); const txData = await this.oraichainNetwork.cosmwasmClient.getTx(res.transactionHash); + console.dir(txData, { depth: null }); if (!txData) throw new Error('Transaction not found'); const orderIds = getOrderIdsFromTxData(txData); diff --git a/test/connectors/oraidex/oraidex.test.ts b/test/connectors/oraidex/oraidex.test.ts new file mode 100644 index 0000000000..db448a58e8 --- /dev/null +++ b/test/connectors/oraidex/oraidex.test.ts @@ -0,0 +1,514 @@ +import { Oraichain } from '../../../src/chains/oraichain/oraichain'; +import { OraidexCLOB } from '../../../src/connectors/oraidex/oraidex'; +import { gatewayApp } from '../../../src/app'; +import request from 'supertest'; + +let oraichain: Oraichain; +let oraiDex: OraidexCLOB; +const address = 'orai1swus8mwu8xjulawqxdwh8hvg4gknh2c64tuc0k'; + +const TX_HASH = + 'AB4256ED72AFDE0EBB42E2204108D87A87D4E68EB974C5B80A1EBC41F5BE3394'; + +const INVALID_REQUEST = { + chain: 'unknown', + network: 'mainnet', +}; + +const TX_DATA = { + height: 21620440, + txIndex: 0, + hash: 'AB4256ED72AFDE0EBB42E2204108D87A87D4E68EB974C5B80A1EBC41F5BE3394', + code: 0, + events: [ + { + type: 'coin_spent', + attributes: [ + { + key: 'spender', + value: 'orai1swus8mwu8xjulawqxdwh8hvg4gknh2c64tuc0k' + }, + { key: 'amount', value: '142orai' } + ] + }, + { + type: 'coin_received', + attributes: [ + { + key: 'receiver', + value: 'orai17xpfvakm2amg962yls6f84z3kell8c5lr24r2w' + }, + { key: 'amount', value: '142orai' } + ] + }, + { + type: 'transfer', + attributes: [ + { + key: 'recipient', + value: 'orai17xpfvakm2amg962yls6f84z3kell8c5lr24r2w' + }, + { + key: 'sender', + value: 'orai1swus8mwu8xjulawqxdwh8hvg4gknh2c64tuc0k' + }, + { key: 'amount', value: '142orai' } + ] + }, + { + type: 'message', + attributes: [ + { + key: 'sender', + value: 'orai1swus8mwu8xjulawqxdwh8hvg4gknh2c64tuc0k' + } + ] + }, + { + type: 'tx', + attributes: [ + { key: 'fee', value: '142orai' }, + { + key: 'fee_payer', + value: 'orai1swus8mwu8xjulawqxdwh8hvg4gknh2c64tuc0k' + } + ] + }, + { + type: 'tx', + attributes: [ + { + key: 'acc_seq', + value: 'orai1swus8mwu8xjulawqxdwh8hvg4gknh2c64tuc0k/603' + } + ] + }, + { + type: 'tx', + attributes: [ + { + key: 'signature', + value: '6nxCFp3PiVa62DvMY/xWgYnEBHDW0AhWOhJyWWRKallz5KTfNviOJV37vzPENY44enIrftIont/QyuIk8MB01A==' + } + ] + }, + { + type: 'message', + attributes: [ + { + key: 'action', + value: '/cosmwasm.wasm.v1.MsgExecuteContract' + } + ] + }, + { + type: 'message', + attributes: [ + { key: 'module', value: 'wasm' }, + { + key: 'sender', + value: 'orai1swus8mwu8xjulawqxdwh8hvg4gknh2c64tuc0k' + } + ] + }, + { + type: 'coin_spent', + attributes: [ + { + key: 'spender', + value: 'orai1swus8mwu8xjulawqxdwh8hvg4gknh2c64tuc0k' + }, + { key: 'amount', value: '10000orai' } + ] + }, + { + type: 'coin_received', + attributes: [ + { + key: 'receiver', + value: 'orai1nt58gcu4e63v7k55phnr3gaym9tvk3q4apqzqccjuwppgjuyjy6sxk8yzp' + }, + { key: 'amount', value: '10000orai' } + ] + }, + { + type: 'transfer', + attributes: [ + { + key: 'recipient', + value: 'orai1nt58gcu4e63v7k55phnr3gaym9tvk3q4apqzqccjuwppgjuyjy6sxk8yzp' + }, + { + key: 'sender', + value: 'orai1swus8mwu8xjulawqxdwh8hvg4gknh2c64tuc0k' + }, + { key: 'amount', value: '10000orai' } + ] + }, + { + type: 'execute', + attributes: [ + { + key: '_contract_address', + value: 'orai1nt58gcu4e63v7k55phnr3gaym9tvk3q4apqzqccjuwppgjuyjy6sxk8yzp' + } + ] + }, + { + type: 'wasm', + attributes: [ + { + key: '_contract_address', + value: 'orai1nt58gcu4e63v7k55phnr3gaym9tvk3q4apqzqccjuwppgjuyjy6sxk8yzp' + }, + { key: 'action', value: 'submit_order' }, + { key: 'order_type', value: 'limit' }, + { + key: 'pair', + value: 'orai - orai12hzjxfh77wl572gdzct2fxv2arxcwh6gykc7qh' + }, + { key: 'order_id', value: '4214202' }, + { key: 'status', value: 'Open' }, + { key: 'direction', value: 'Sell' }, + { + key: 'bidder_addr', + value: 'orai1swus8mwu8xjulawqxdwh8hvg4gknh2c64tuc0k' + }, + { key: 'offer_asset', value: '10000 orai' }, + { + key: 'ask_asset', + value: '200000 orai12hzjxfh77wl572gdzct2fxv2arxcwh6gykc7qh' + } + ] + } + ], + rawLog: '[{"events":[{"type":"coin_received","attributes":[{"key":"receiver","value":"orai1nt58gcu4e63v7k55phnr3gaym9tvk3q4apqzqccjuwppgjuyjy6sxk8yzp"},{"key":"amount","value":"10000orai"}]},{"type":"coin_spent","attributes":[{"key":"spender","value":"orai1swus8mwu8xjulawqxdwh8hvg4gknh2c64tuc0k"},{"key":"amount","value":"10000orai"}]},{"type":"execute","attributes":[{"key":"_contract_address","value":"orai1nt58gcu4e63v7k55phnr3gaym9tvk3q4apqzqccjuwppgjuyjy6sxk8yzp"}]},{"type":"message","attributes":[{"key":"action","value":"/cosmwasm.wasm.v1.MsgExecuteContract"},{"key":"module","value":"wasm"},{"key":"sender","value":"orai1swus8mwu8xjulawqxdwh8hvg4gknh2c64tuc0k"}]},{"type":"transfer","attributes":[{"key":"recipient","value":"orai1nt58gcu4e63v7k55phnr3gaym9tvk3q4apqzqccjuwppgjuyjy6sxk8yzp"},{"key":"sender","value":"orai1swus8mwu8xjulawqxdwh8hvg4gknh2c64tuc0k"},{"key":"amount","value":"10000orai"}]},{"type":"wasm","attributes":[{"key":"_contract_address","value":"orai1nt58gcu4e63v7k55phnr3gaym9tvk3q4apqzqccjuwppgjuyjy6sxk8yzp"},{"key":"action","value":"submit_order"},{"key":"order_type","value":"limit"},{"key":"pair","value":"orai - orai12hzjxfh77wl572gdzct2fxv2arxcwh6gykc7qh"},{"key":"order_id","value":"4214202"},{"key":"status","value":"Open"},{"key":"direction","value":"Sell"},{"key":"bidder_addr","value":"orai1swus8mwu8xjulawqxdwh8hvg4gknh2c64tuc0k"},{"key":"offer_asset","value":"10000 orai"},{"key":"ask_asset","value":"200000 orai12hzjxfh77wl572gdzct2fxv2arxcwh6gykc7qh"}]}]}]', + tx: new Uint8Array(4)[1], + msgResponses: [], + gasUsed: 115207, + gasWanted: 141511 + } + +beforeAll(async () => { + oraichain = Oraichain.getInstance('mainnet'); + oraichain.initSigningCosmWasmClient = jest.fn(); + await oraichain.init(); + oraiDex = OraidexCLOB.getInstance('oraichain', 'mainnet'); + await oraiDex.init(); +}); + +afterAll(async () => { + await oraichain.close(); +}); + +describe('GET /clob/markets', () => { + it('return 200', async () => { + await request(gatewayApp) + .get('/clob/markets') + .query({ + chain: 'oraichain', + network: 'mainnet', + connector: 'oraidex', + }) + .set('Accept', 'application/json') + .expect(200) + .expect((res) => expect(res.body).toHaveProperty('markets')); + }); + + it('should return 404 when parameters are invalid', async () => { + await request(gatewayApp) + .get(`/clob/markets`) + .query(INVALID_REQUEST) + .expect(404); + }); +}); + +describe('GET /clob/orderBook', () => { + it('should return 200 with proper request', async () => { + await request(gatewayApp) + .get(`/clob/orderBook`) + .query({ + chain: 'oraichain', + network: 'mainnet', + connector: 'oraidex', + market: 'ORAI-USDT', + }) + .set('Accept', 'application/json') + .expect('Content-Type', /json/) + .expect(200) + .expect((res) => expect(res.body).toHaveProperty('buys')) + .expect((res) => expect(res.body).toHaveProperty('sells')); + }); + + it('should return 404 when parameters are invalid', async () => { + await request(gatewayApp) + .get(`/clob/orderBook`) + .query(INVALID_REQUEST) + .expect(404); + }); +}); + +describe('GET /clob/ticker', () => { + it('should return 200 with proper request', async () => { + await request(gatewayApp) + .get(`/clob/ticker`) + .query({ + chain: 'oraichain', + network: 'mainnet', + connector: 'oraidex', + market: 'ORAI-USDT', + }) + .set('Accept', 'application/json') + .expect('Content-Type', /json/) + .expect(200) + .expect((res) => expect(res.body.markets).toHaveProperty('price')); + }); + + it('should return 404 when parameters are invalid', async () => { + await request(gatewayApp) + .get(`/clob/ticker`) + .query(INVALID_REQUEST) + .expect(404); + }); +}); + +describe('GET /clob/orders', () => { + it('should return 200 with proper request', async () => { + await request(gatewayApp) + .get(`/clob/orders`) + .query({ + chain: 'oraichain', + network: 'mainnet', + connector: 'oraidex', + address: address, + market: 'ORAI-USDT', + orderId: 'None', + }) + .set('Accept', 'application/json') + .expect('Content-Type', /json/) + .expect(200) + .expect((res) => expect(res.body).toHaveProperty('orders')); + }); + + it('should return 200', async () => { + oraiDex.getAllOrders = jest.fn().mockReturnValue({ + orders: [ + { + order_id: '123456' + } + ] + }); + await request(gatewayApp) + .get(`/clob/orders`) + .query({ + chain: 'oraichain', + network: 'mainnet', + connector: 'oraidex', + address: address, + market: 'ORAI-USDT', + orderId: '123456', + }) + .set('Accept', 'application/json') + .expect('Content-Type', /json/) + .expect(200) + .expect((res) => expect(res.body).toHaveProperty('orders')); + }); + + it('should return 404 when parameters are invalid', async () => { + await request(gatewayApp) + .get(`/clob/orders`) + .query(INVALID_REQUEST) + .expect(404); + }); +}); + +describe('POST /clob/orders', () => { + it('should return 200 with proper request', async () => { + oraichain.executeContract = jest.fn().mockResolvedValue({ transactionHash: TX_HASH }); + oraichain.cosmwasmClient.getTx = jest.fn().mockResolvedValue(TX_DATA); + await request(gatewayApp) + .post(`/clob/orders`) + .send({ + connector: 'oraidex', + chain: 'oraichain', + network: 'mainnet', + market: 'ORAI-USDT', + address: 'orai1swus8mwu8xjulawqxdwh8hvg4gknh2c64tuc0k', + side: 'SELL', + orderType: 'LIMIT', + price: '16.0', + amount: '0.010000', + clientOrderID: 'SOIUT61865c7bbdea1d13518c84198b5e0e42a146814036da3', + }) + .set('Accept', 'application/json') + .expect('Content-Type', /json/) + .expect(200) + .expect((res) => expect(res.body.txHash).toEqual(TX_HASH)); + }); + + it('should return 200 with proper request', async () => { + oraichain.executeContract = jest.fn().mockResolvedValue({ transactionHash: TX_HASH }); + oraichain.cosmwasmClient.getTx = jest.fn().mockResolvedValue(TX_DATA); + await request(gatewayApp) + .post(`/clob/orders`) + .send({ + connector: 'oraidex', + chain: 'oraichain', + network: 'mainnet', + market: 'ORAI-USDT', + address: 'orai1swus8mwu8xjulawqxdwh8hvg4gknh2c64tuc0k', + side: 'BUY', + orderType: 'LIMIT', + price: '16.0', + amount: '0.010000', + clientOrderID: 'SOIUT61865c7bbdea1d13518c84198b5e0e42a146814036da3', + }) + .set('Accept', 'application/json') + .expect('Content-Type', /json/) + .expect(200) + .expect((res) => expect(res.body.txHash).toEqual(TX_HASH)); + }); + + it('should return 404 when parameters are invalid', async () => { + await request(gatewayApp) + .post(`/clob/orders`) + .send(INVALID_REQUEST) + .expect(404); + }); +}); + +describe('DELETE /clob/orders', () => { + it('should return 200 with proper request', async () => { + oraichain.executeContract = jest.fn().mockResolvedValue({ transactionHash: TX_HASH }); + await request(gatewayApp) + .delete(`/clob/orders`) + .send({ + chain: 'oraichain', + connector: 'oraidex', + network: 'mainnet', + address: 'orai1swus8mwu8xjulawqxdwh8hvg4gknh2c64tuc0k', + market: 'xOCH-USDT', + orderId: '4191398', + }) + .set('Accept', 'application/json') + .expect('Content-Type', /json/) + .expect(200) + .expect((res) => expect(res.body.txHash).toEqual(TX_HASH)); + }); + + it('should return 404 when parameters are invalid', async () => { + await request(gatewayApp) + .delete(`/clob/orders`) + .send(INVALID_REQUEST) + .expect(404); + }); +}); + +describe('POST /clob/batchOrders', () => { + it('should return 200 with proper request to create batch orders', async () => { + oraichain.executeContractMultiple = jest.fn().mockResolvedValue({ transactionHash: TX_HASH }); + oraichain.cosmwasmClient.getTx = jest.fn().mockResolvedValue(TX_DATA); + await request(gatewayApp) + .post(`/clob/batchOrders`) + .send({ + chain: 'oraichain', + connector: 'oraidex', + network: 'mainnet', + address: 'orai1swus8mwu8xjulawqxdwh8hvg4gknh2c64tuc0k', + createOrderParams: [ + { + market: 'xOCH-USDT', + amount: '0.01', + price: '9.5', + side: 'BUY', + orderType: 'LIMIT', + }, + { + market: 'xOCH-USDT', + amount: '0.01', + price: '9.6', + side: 'SELL', + orderType: 'LIMIT', + }, + ], + }) + .set('Accept', 'application/json') + .expect('Content-Type', /json/) + .expect(200) + .expect((res) => expect(res.body.txHash).toEqual(TX_HASH)); + }); + + it('should return 200 with proper request to delete batch orders', async () => { + oraichain.executeContractMultiple = jest.fn().mockResolvedValue({ transactionHash: TX_HASH }); + await request(gatewayApp) + .post(`/clob/batchOrders`) + .send({ + chain: 'oraichain', + connector: 'oraidex', + network: 'mainnet', + address: 'orai1swus8mwu8xjulawqxdwh8hvg4gknh2c64tuc0k', + cancelOrderParams: [ + { + market: 'xOCH-USDT', + orderId: '4199233', + }, + { + market: 'xOCH-USDT', + orderId: '4199232', + }, + ], + }) + .set('Accept', 'application/json') + .expect('Content-Type', /json/) + .expect(200) + .expect((res) => expect(res.body.txHash).toEqual(TX_HASH)); + }); + + it('should return 404 when parameters are invalid', async () => { + await request(gatewayApp) + .post(`/clob/batchOrders`) + .send(INVALID_REQUEST) + .expect(404); + }); +}); + +describe('GET /clob/estimateGas', () => { + it('should return 200 with proper request', async () => { + await request(gatewayApp) + .get(`/clob/estimateGas`) + .query({ + chain: 'oraichain', + network: 'mainnet', + connector: 'oraidex', + }) + .set('Accept', 'application/json') + .expect('Content-Type', /json/) + .expect(200); + }); + + it('should return 404 when parameters are invalid', async () => { + await request(gatewayApp) + .get(`/clob/estimateGas`) + .query(INVALID_REQUEST) + .expect(404); + }); +}); + +describe('others', () => { + it('getConnectedInstances', async () => { + const instances = OraidexCLOB.getConnectedInstances(); + expect(instances).toBeDefined(); + }); + + it('markets', async () => { + const markets = await oraiDex.markets({ + chain: 'oraichain', + network: 'mainnet', + connector: 'oraidex', + market: 'ORAI-USDT', + }); + expect(markets).toBeDefined(); + }); + + +}); From bed574c2492507c29a013fc004fa7910fa8f04f5 Mon Sep 17 00:00:00 2001 From: vuonghuuhung Date: Tue, 21 May 2024 21:26:19 +0700 Subject: [PATCH 22/24] (update) follow cosmos base class --- src/chains/cosmos/cosmos-base.ts | 2 +- src/chains/oraichain/oraichain.controller.ts | 20 +- src/chains/oraichain/oraichain.ts | 19 +- src/connectors/oraidex/oraidex.ts | 6 +- src/connectors/pancakeswap/pancakeswap.ts | 39 +- src/templates/lists/oraichain.json | 62 ++ test/chains/oraichain/oraichain.test.ts | 3 +- yarn.lock | 588 ++++++++++--------- 8 files changed, 416 insertions(+), 323 deletions(-) diff --git a/src/chains/cosmos/cosmos-base.ts b/src/chains/cosmos/cosmos-base.ts index 9af79f75ca..c5e3bf8277 100644 --- a/src/chains/cosmos/cosmos-base.ts +++ b/src/chains/cosmos/cosmos-base.ts @@ -200,7 +200,7 @@ export class CosmosBase { if (this.chainName == 'osmosis'){ this._provider = await createRPCQueryClient({rpcEndpoint: this.rpcUrl}); await this.getLatestBasePrice(); - }else{ + } else { this._provider = StargateClient.connect(this.rpcUrl); } // If we're not ready, this._initialized will be a Promise that resolves after init() completes diff --git a/src/chains/oraichain/oraichain.controller.ts b/src/chains/oraichain/oraichain.controller.ts index 9d1ca002e9..1973ba5abb 100644 --- a/src/chains/oraichain/oraichain.controller.ts +++ b/src/chains/oraichain/oraichain.controller.ts @@ -1,6 +1,5 @@ import { TokensRequest } from '../../network/network.requests'; import { TokenInfo, TokenValue, tokenValueToString } from '../../services/base'; -import { Token } from '../cosmos/cosmos-base'; import { Oraichain } from './oraichain'; import { validateGetTokensRequest } from './oraichain.validators'; import { @@ -19,6 +18,14 @@ import { import { decodeTxRaw } from '@cosmjs/proto-signing'; import { BigNumber } from 'ethers'; +export interface Token { + base: string; + address: string; + name: string; + symbol: string; + decimals: number; +} + export const toOraichainBalances = ( balances: Record, tokenSymbols: Array @@ -49,7 +56,6 @@ export class OraichainController { tokens = oraichainLish.storedTokenList; } else { for (const t of req.tokenSymbols as []) { - console.log('t', t); const token = oraichainLish.getTokenForSymbol(t); if (token != undefined) { tokens.push(token); @@ -61,7 +67,7 @@ export class OraichainController { const tokensInfo: TokenInfo[] = []; tokens.map((token) => { const tokenInfo: TokenInfo = { - address: token.address, + address: token.base, chainId: 0, decimals: token.decimals, name: token.name, @@ -90,7 +96,7 @@ export class OraichainController { TOKEN_NOT_SUPPORTED_ERROR_CODE ); } else { - if (token.address != 'orai' && !token.address.startsWith('ibc/')) { + if (token.base != 'orai' && !token.base.startsWith('ibc/')) { cw20Tokens.push(token); } } @@ -122,7 +128,7 @@ export class OraichainController { await Promise.all( tokens.map(async (token: Token) => { try { - let balance = await cosmosish.queryContractSmart(token.address, { + let balance = await cosmosish.queryContractSmart(token.base, { balance: { address, }, @@ -146,6 +152,10 @@ export class OraichainController { static async poll(cosmos: Oraichain, req: CosmosPollRequest) { validateCosmosPollRequest(req); + if (req.txHash == undefined) { + throw new HttpException(500, 'txHash is required'); + } + const transaction = await cosmos.getTransaction(req.txHash); const currentBlock = await cosmos.getCurrentBlockNumber(); diff --git a/src/chains/oraichain/oraichain.ts b/src/chains/oraichain/oraichain.ts index 6e483d381e..e51e9fa2f2 100644 --- a/src/chains/oraichain/oraichain.ts +++ b/src/chains/oraichain/oraichain.ts @@ -14,7 +14,6 @@ import { import * as cosmwasm from '@cosmjs/cosmwasm-stargate'; import { DirectSecp256k1Wallet } from '@cosmjs/proto-signing'; import { GasPrice, StargateClient, setupIbcExtension } from '@cosmjs/stargate'; -import { Decimal } from '@cosmjs/math'; import { BigNumber } from 'ethers'; export type MarketInfo = { @@ -142,13 +141,15 @@ export class Oraichain extends CosmosBase implements Cosmosish { this._rpcUrl, wallet, { - gasPrice: new GasPrice(Decimal.fromUserInput('0.001', 6), 'orai'), + gasPrice: GasPrice.fromString('0.001orai'), broadcastPollIntervalMs: 500, }, ); } - public async getSigningClient(address: string): Promise { + public async getSigningClient( + address: string, + ): Promise { let client = this._signers.get(address); if (!client) { @@ -166,7 +167,7 @@ export class Oraichain extends CosmosBase implements Cosmosish { ): Promise { const client = await this.getSigningClient(sender); - let res = await client.execute( + const res = await client.execute( sender, contractAddress, msg, @@ -174,8 +175,6 @@ export class Oraichain extends CosmosBase implements Cosmosish { undefined, funds, ); - - // console.dir(res, { depth: null }); return res; } @@ -186,16 +185,14 @@ export class Oraichain extends CosmosBase implements Cosmosish { ): Promise { const client = await this.getSigningClient(sender); - let res = await client.executeMultiple(sender, instructions, 'auto'); - - // console.dir(res, { depth: null }); + const res = await client.executeMultiple(sender, instructions, 'auto'); return res; } async getBalance(address: string): Promise> { const provider = await StargateClient.connect(this._rpcUrl); - + const balances: Record = {}; const allTokens = await provider.getAllBalances(address); @@ -233,7 +230,7 @@ export class Oraichain extends CosmosBase implements Cosmosish { public get gasPrice(): number { return this._gasPrice; } - + public get chain(): string { return this._chain; } diff --git a/src/connectors/oraidex/oraidex.ts b/src/connectors/oraidex/oraidex.ts index 86d45ae3cd..288bcfb95a 100644 --- a/src/connectors/oraidex/oraidex.ts +++ b/src/connectors/oraidex/oraidex.ts @@ -28,7 +28,7 @@ import { PlaceOrdersRequest, } from './oraidex.types'; import { BigNumber } from 'bignumber.js'; -import { OraiswapLimitOrderQueryClient } from '@oraichain/oraidex-contracts-sdk'; +import { OraiswapOrderbookQueryClient } from '@oraichain/oraidex-contracts-sdk'; import { OraidexConfig } from './oraidex.config'; import { JsonObject, ExecuteInstruction } from '@cosmjs/cosmwasm-stargate'; @@ -85,7 +85,7 @@ export class OraidexCLOB implements CLOBish { async init() { this.oraichainNetwork = await Oraichain.getInstance(this.network); await this.oraichainNetwork.init(); - this.orderbookQueryClient = new OraiswapLimitOrderQueryClient( + this.orderbookQueryClient = new OraiswapOrderbookQueryClient( this.oraichainNetwork.cosmwasmClient, this._swapLimitOrder, ); @@ -119,7 +119,7 @@ export class OraidexCLOB implements CLOBish { try { const loadedMarkets: Market[] = await Promise.all( - orderBooks.order_books.map(async (pair) => { + orderBooks.order_books.map(async (pair: any) => { const baseToken = await parseToToken( pair.base_coin_info, this.oraichainNetwork.cosmwasmClient, diff --git a/src/connectors/pancakeswap/pancakeswap.ts b/src/connectors/pancakeswap/pancakeswap.ts index 7d4d25f7fa..b0fe870db9 100644 --- a/src/connectors/pancakeswap/pancakeswap.ts +++ b/src/connectors/pancakeswap/pancakeswap.ts @@ -213,26 +213,8 @@ export class PancakeSwap implements Uniswapish { throw new UniswapishPriceError( `priceSwapOut: no trade pair found for ${baseToken.address} to ${quoteToken.address}.`, ); - const pair2: Pair = await Fetcher.fetchPairData( - wbnb, - baseToken, - this.bsc.provider - ); - - trades = Trade.bestTradeExactOut( - [pair1, pair2], - quoteToken, - nativeTokenAmount, - { - maxHops: 2, - } - ); - if (!trades || trades.length === 0) { - throw new UniswapishPriceError( - `priceSwapOut: no trade pair found for ${quoteToken.address} to ${baseToken.address}.` - ); - } } + logger.info( `Best trade for ${baseToken.address}-${quoteToken.address}: ` + `${trade.inputAmount.toExact()}` + @@ -280,25 +262,6 @@ export class PancakeSwap implements Uniswapish { throw new UniswapishPriceError( `priceSwapIn: no trade pair found for ${baseToken.address} to ${quoteToken.address}.`, ); - const pair2: Pair = await Fetcher.fetchPairData( - wbnb, - baseToken, - this.bsc.provider - ); - - trades = Trade.bestTradeExactIn( - [pair1, pair2], - nativeTokenAmount, - quoteToken, - { - maxHops: 2, - } - ); - if (!trades || trades.length === 0) { - throw new UniswapishPriceError( - `priceSwapIn: no trade pair found for ${baseToken} to ${quoteToken}.` - ); - } } logger.info( `Best trade for ${baseToken.address}-${quoteToken.address}: ` + diff --git a/src/templates/lists/oraichain.json b/src/templates/lists/oraichain.json index e0ea46c4c5..47f6da187b 100644 --- a/src/templates/lists/oraichain.json +++ b/src/templates/lists/oraichain.json @@ -1,6 +1,68 @@ { "name": "Oraichain token list", "URI": "", + "assets": [ + { + "denom_units": [ + { + "denom": "orai", + "exponent": 6 + } + ], + "base": "orai", + "name": "Oraichain token", + "display": "orai", + "symbol": "ORAI" + }, + { + "denom_units": [ + { + "denom": "usdt", + "exponent": 6 + } + ], + "base": "orai12hzjxfh77wl572gdzct2fxv2arxcwh6gykc7qh", + "name": "USDT token", + "display": "usdt", + "symbol": "USDT" + }, + { + "denom_units": [ + { + "denom": "xoch", + "exponent": 6 + } + ], + "base": "orai1lplapmgqnelqn253stz6kmvm3ulgdaytn89a8mz9y85xq8wd684s6xl3lt", + "name": "xOCH token", + "display": "xoch", + "symbol": "xOCH" + }, + { + "denom_units": [ + { + "denom": "btc", + "exponent": 6 + } + ], + "base": "orai10g6frpysmdgw5tdqke47als6f97aqmr8s3cljsvjce4n5enjftcqtamzsd", + "name": "BTC token", + "display": "btc", + "symbol": "BTC" + }, + { + "denom_units": [ + { + "denom": "atom", + "exponent": 6 + } + ], + "base": "ibc/A2E2EEC9057A4A1C2C0A6A4C78B0239118DF5F278830F50B4A6BDD7A66506B78", + "name": "ATOM token", + "display": "atom", + "symbol": "ATOM" + } + ], "tokens": [ { "name": "Oraichain token", diff --git a/test/chains/oraichain/oraichain.test.ts b/test/chains/oraichain/oraichain.test.ts index 341ee807ca..e2c04bdbd9 100644 --- a/test/chains/oraichain/oraichain.test.ts +++ b/test/chains/oraichain/oraichain.test.ts @@ -15,9 +15,10 @@ beforeAll(async () => { const mnemonic = new EnglishMnemonic( 'enlist hip relief stomach skate base shallow young switch frequent cry park', ); + //get me a default hd path const hdPath = makeCosmoshubPath(0); const seed = await Bip39.mnemonicToSeed(mnemonic); - const masterKey = Slip10.derivePath(Slip10Curve.Secp256k1, seed, hdPath); + const masterKey = Slip10.derivePath(Slip10Curve.Secp256k1, seed, hdPath as any); const privateKeyTest = masterKey.privkey; const wallet = await oraichain.getWalletFromPrivateKey( diff --git a/yarn.lock b/yarn.lock index 691306c603..e514cadddd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -771,6 +771,16 @@ "@cosmjs/math" "^0.29.3" "@cosmjs/utils" "^0.29.3" +"@cosmjs/amino@0.31.3", "@cosmjs/amino@^0.31.3": + version "0.31.3" + resolved "https://registry.yarnpkg.com/@cosmjs/amino/-/amino-0.31.3.tgz#0f4aa6bd68331c71bd51b187fa64f00eb075db0a" + integrity sha512-36emtUq895sPRX8PTSOnG+lhJDCVyIcE0Tr5ct59sUbgQiI14y43vj/4WAlJ/utSOxy+Zhj9wxcs4AZfu0BHsw== + dependencies: + "@cosmjs/crypto" "^0.31.3" + "@cosmjs/encoding" "^0.31.3" + "@cosmjs/math" "^0.31.3" + "@cosmjs/utils" "^0.31.3" + "@cosmjs/amino@0.32.2", "@cosmjs/amino@^0.32.2": version "0.32.2" resolved "https://registry.yarnpkg.com/@cosmjs/amino/-/amino-0.32.2.tgz#ba3cf255e4e6b1ba67461f1ef7b0b8ad3f895da7" @@ -834,6 +844,19 @@ ripemd160 "^2.0.2" sha.js "^2.4.11" +"@cosmjs/crypto@0.31.3", "@cosmjs/crypto@^0.31.3": + version "0.31.3" + resolved "https://registry.yarnpkg.com/@cosmjs/crypto/-/crypto-0.31.3.tgz#c752cb6d682fdc735dcb45a2519f89c56ba16c26" + integrity sha512-vRbvM9ZKR2017TO73dtJ50KxoGcFzKtKI7C8iO302BQ5p+DuB+AirUg1952UpSoLfv5ki9O416MFANNg8UN/EQ== + dependencies: + "@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-sumo "^0.7.11" + "@cosmjs/crypto@^0.29.3", "@cosmjs/crypto@^0.29.5": version "0.29.5" resolved "https://registry.yarnpkg.com/@cosmjs/crypto/-/crypto-0.29.5.tgz#ab99fc382b93d8a8db075780cf07487a0f9519fd" @@ -860,19 +883,6 @@ elliptic "^6.5.4" libsodium-wrappers "^0.7.6" -"@cosmjs/crypto@^0.31.3": - version "0.31.3" - resolved "https://registry.yarnpkg.com/@cosmjs/crypto/-/crypto-0.31.3.tgz#c752cb6d682fdc735dcb45a2519f89c56ba16c26" - integrity sha512-vRbvM9ZKR2017TO73dtJ50KxoGcFzKtKI7C8iO302BQ5p+DuB+AirUg1952UpSoLfv5ki9O416MFANNg8UN/EQ== - dependencies: - "@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-sumo "^0.7.11" - "@cosmjs/crypto@^0.32.2": version "0.32.2" resolved "https://registry.yarnpkg.com/@cosmjs/crypto/-/crypto-0.32.2.tgz#8ed255d3d1c1c4d916a1586f8cbc33eaab82f511" @@ -1024,6 +1034,19 @@ cosmjs-types "^0.5.2" long "^4.0.0" +"@cosmjs/proto-signing@0.31.3", "@cosmjs/proto-signing@^0.31.1", "@cosmjs/proto-signing@^0.31.3": + version "0.31.3" + resolved "https://registry.yarnpkg.com/@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.32.2", "@cosmjs/proto-signing@^0.32.2": version "0.32.2" resolved "https://registry.yarnpkg.com/@cosmjs/proto-signing/-/proto-signing-0.32.2.tgz#26ed2675978ce24078981f4c15a06c5d6b808f44" @@ -1062,19 +1085,6 @@ cosmjs-types "^0.7.1" long "^4.0.0" -"@cosmjs/proto-signing@^0.31.1", "@cosmjs/proto-signing@^0.31.3": - version "0.31.3" - resolved "https://registry.yarnpkg.com/@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/socket@^0.29.5": version "0.29.5" resolved "https://registry.yarnpkg.com/@cosmjs/socket/-/socket-0.29.5.tgz#a48df6b4c45dc6a6ef8e47232725dd4aa556ac2d" @@ -1133,6 +1143,24 @@ protobufjs "~6.11.3" xstream "^11.14.0" +"@cosmjs/stargate@0.31.3", "@cosmjs/stargate@^0.31.1", "@cosmjs/stargate@^0.31.3": + version "0.31.3" + resolved "https://registry.yarnpkg.com/@cosmjs/stargate/-/stargate-0.31.3.tgz#a2b38e398097a00f897dbd8f02d4d347d8fed818" + integrity sha512-53NxnzmB9FfXpG4KjOUAYAvWLYKdEmZKsutcat/u2BrDXNZ7BN8jim/ENcpwXfs9/Og0K24lEIdvA4gsq3JDQw== + dependencies: + "@confio/ics23" "^0.6.8" + "@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/stargate@0.32.2": version "0.32.2" resolved "https://registry.yarnpkg.com/@cosmjs/stargate/-/stargate-0.32.2.tgz#73718c5c6a3ae138682ee9987333d911eca22a13" @@ -1167,24 +1195,6 @@ protobufjs "~6.11.3" xstream "^11.14.0" -"@cosmjs/stargate@^0.31.1", "@cosmjs/stargate@^0.31.3": - version "0.31.3" - resolved "https://registry.yarnpkg.com/@cosmjs/stargate/-/stargate-0.31.3.tgz#a2b38e398097a00f897dbd8f02d4d347d8fed818" - integrity sha512-53NxnzmB9FfXpG4KjOUAYAvWLYKdEmZKsutcat/u2BrDXNZ7BN8jim/ENcpwXfs9/Og0K24lEIdvA4gsq3JDQw== - dependencies: - "@confio/ics23" "^0.6.8" - "@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.29.3", "@cosmjs/stream@^0.29.5": version "0.29.5" resolved "https://registry.yarnpkg.com/@cosmjs/stream/-/stream-0.29.5.tgz#350981cac496d04939b92ee793b9b19f44bc1d4e" @@ -1213,6 +1223,22 @@ dependencies: xstream "^11.14.0" +"@cosmjs/tendermint-rpc@0.31.3", "@cosmjs/tendermint-rpc@^0.31.3": + version "0.31.3" + resolved "https://registry.yarnpkg.com/@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" + "@cosmjs/tendermint-rpc@0.32.2", "@cosmjs/tendermint-rpc@^0.32.2": version "0.32.2" resolved "https://registry.yarnpkg.com/@cosmjs/tendermint-rpc/-/tendermint-rpc-0.32.2.tgz#c5607b8d472e5bf9fd58d5453db7194f500ccc62" @@ -1408,137 +1434,137 @@ "@ethersproject-xdc/abi@file:vendor/@ethersproject-xdc/abi": version "5.7.0" dependencies: - "@ethersproject-xdc/address" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-abi-5.7.0-dc6cad0a-b42e-41c0-add1-31aa9f73da8c-1711378365614/node_modules/@ethersproject-xdc/address" - "@ethersproject-xdc/bignumber" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-abi-5.7.0-dc6cad0a-b42e-41c0-add1-31aa9f73da8c-1711378365614/node_modules/@ethersproject-xdc/bignumber" - "@ethersproject-xdc/bytes" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-abi-5.7.0-dc6cad0a-b42e-41c0-add1-31aa9f73da8c-1711378365614/node_modules/@ethersproject-xdc/bytes" - "@ethersproject-xdc/constants" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-abi-5.7.0-dc6cad0a-b42e-41c0-add1-31aa9f73da8c-1711378365614/node_modules/@ethersproject-xdc/constants" - "@ethersproject-xdc/hash" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-abi-5.7.0-dc6cad0a-b42e-41c0-add1-31aa9f73da8c-1711378365614/node_modules/@ethersproject-xdc/hash" - "@ethersproject-xdc/keccak256" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-abi-5.7.0-dc6cad0a-b42e-41c0-add1-31aa9f73da8c-1711378365614/node_modules/@ethersproject-xdc/keccak256" - "@ethersproject-xdc/logger" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-abi-5.7.0-dc6cad0a-b42e-41c0-add1-31aa9f73da8c-1711378365614/node_modules/@ethersproject-xdc/logger" - "@ethersproject-xdc/properties" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-abi-5.7.0-dc6cad0a-b42e-41c0-add1-31aa9f73da8c-1711378365614/node_modules/@ethersproject-xdc/properties" - "@ethersproject-xdc/strings" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-abi-5.7.0-dc6cad0a-b42e-41c0-add1-31aa9f73da8c-1711378365614/node_modules/@ethersproject-xdc/strings" + "@ethersproject-xdc/address" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-abi-5.7.0-ffb586c8-53ee-4e71-a6e4-28323487989a-1716297675932/node_modules/@ethersproject-xdc/address" + "@ethersproject-xdc/bignumber" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-abi-5.7.0-ffb586c8-53ee-4e71-a6e4-28323487989a-1716297675932/node_modules/@ethersproject-xdc/bignumber" + "@ethersproject-xdc/bytes" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-abi-5.7.0-ffb586c8-53ee-4e71-a6e4-28323487989a-1716297675932/node_modules/@ethersproject-xdc/bytes" + "@ethersproject-xdc/constants" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-abi-5.7.0-ffb586c8-53ee-4e71-a6e4-28323487989a-1716297675932/node_modules/@ethersproject-xdc/constants" + "@ethersproject-xdc/hash" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-abi-5.7.0-ffb586c8-53ee-4e71-a6e4-28323487989a-1716297675932/node_modules/@ethersproject-xdc/hash" + "@ethersproject-xdc/keccak256" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-abi-5.7.0-ffb586c8-53ee-4e71-a6e4-28323487989a-1716297675932/node_modules/@ethersproject-xdc/keccak256" + "@ethersproject-xdc/logger" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-abi-5.7.0-ffb586c8-53ee-4e71-a6e4-28323487989a-1716297675932/node_modules/@ethersproject-xdc/logger" + "@ethersproject-xdc/properties" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-abi-5.7.0-ffb586c8-53ee-4e71-a6e4-28323487989a-1716297675932/node_modules/@ethersproject-xdc/properties" + "@ethersproject-xdc/strings" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-abi-5.7.0-ffb586c8-53ee-4e71-a6e4-28323487989a-1716297675932/node_modules/@ethersproject-xdc/strings" "@ethersproject-xdc/abstract-provider@file:vendor/@ethersproject-xdc/abstract-provider": version "5.7.0" dependencies: - "@ethersproject-xdc/bignumber" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-abstract-provider-5.7.0-7563efea-d843-42b7-b285-fbeff4443c61-1711378365615/node_modules/@ethersproject-xdc/bignumber" - "@ethersproject-xdc/bytes" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-abstract-provider-5.7.0-7563efea-d843-42b7-b285-fbeff4443c61-1711378365615/node_modules/@ethersproject-xdc/bytes" - "@ethersproject-xdc/logger" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-abstract-provider-5.7.0-7563efea-d843-42b7-b285-fbeff4443c61-1711378365615/node_modules/@ethersproject-xdc/logger" - "@ethersproject-xdc/networks" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-abstract-provider-5.7.0-7563efea-d843-42b7-b285-fbeff4443c61-1711378365615/node_modules/@ethersproject-xdc/networks" - "@ethersproject-xdc/properties" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-abstract-provider-5.7.0-7563efea-d843-42b7-b285-fbeff4443c61-1711378365615/node_modules/@ethersproject-xdc/properties" - "@ethersproject-xdc/transactions" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-abstract-provider-5.7.0-7563efea-d843-42b7-b285-fbeff4443c61-1711378365615/node_modules/@ethersproject-xdc/transactions" - "@ethersproject-xdc/web" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-abstract-provider-5.7.0-7563efea-d843-42b7-b285-fbeff4443c61-1711378365615/node_modules/@ethersproject-xdc/web" + "@ethersproject-xdc/bignumber" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-abstract-provider-5.7.0-6b574ed6-86bb-4334-a5aa-0e3cdb46dca0-1716297675932/node_modules/@ethersproject-xdc/bignumber" + "@ethersproject-xdc/bytes" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-abstract-provider-5.7.0-6b574ed6-86bb-4334-a5aa-0e3cdb46dca0-1716297675932/node_modules/@ethersproject-xdc/bytes" + "@ethersproject-xdc/logger" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-abstract-provider-5.7.0-6b574ed6-86bb-4334-a5aa-0e3cdb46dca0-1716297675932/node_modules/@ethersproject-xdc/logger" + "@ethersproject-xdc/networks" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-abstract-provider-5.7.0-6b574ed6-86bb-4334-a5aa-0e3cdb46dca0-1716297675932/node_modules/@ethersproject-xdc/networks" + "@ethersproject-xdc/properties" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-abstract-provider-5.7.0-6b574ed6-86bb-4334-a5aa-0e3cdb46dca0-1716297675932/node_modules/@ethersproject-xdc/properties" + "@ethersproject-xdc/transactions" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-abstract-provider-5.7.0-6b574ed6-86bb-4334-a5aa-0e3cdb46dca0-1716297675932/node_modules/@ethersproject-xdc/transactions" + "@ethersproject-xdc/web" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-abstract-provider-5.7.0-6b574ed6-86bb-4334-a5aa-0e3cdb46dca0-1716297675932/node_modules/@ethersproject-xdc/web" "@ethersproject-xdc/abstract-signer@file:vendor/@ethersproject-xdc/abstract-signer": version "5.7.0" dependencies: - "@ethersproject-xdc/abstract-provider" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-abstract-signer-5.7.0-e30fa525-50b0-4a94-a2fc-4b012803d33e-1711378365615/node_modules/@ethersproject-xdc/abstract-provider" - "@ethersproject-xdc/bignumber" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-abstract-signer-5.7.0-e30fa525-50b0-4a94-a2fc-4b012803d33e-1711378365615/node_modules/@ethersproject-xdc/bignumber" - "@ethersproject-xdc/bytes" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-abstract-signer-5.7.0-e30fa525-50b0-4a94-a2fc-4b012803d33e-1711378365615/node_modules/@ethersproject-xdc/bytes" - "@ethersproject-xdc/logger" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-abstract-signer-5.7.0-e30fa525-50b0-4a94-a2fc-4b012803d33e-1711378365615/node_modules/@ethersproject-xdc/logger" - "@ethersproject-xdc/properties" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-abstract-signer-5.7.0-e30fa525-50b0-4a94-a2fc-4b012803d33e-1711378365615/node_modules/@ethersproject-xdc/properties" + "@ethersproject-xdc/abstract-provider" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-abstract-signer-5.7.0-9e8375da-3792-40e7-b7e1-1299fb3a83b8-1716297675931/node_modules/@ethersproject-xdc/abstract-provider" + "@ethersproject-xdc/bignumber" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-abstract-signer-5.7.0-9e8375da-3792-40e7-b7e1-1299fb3a83b8-1716297675931/node_modules/@ethersproject-xdc/bignumber" + "@ethersproject-xdc/bytes" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-abstract-signer-5.7.0-9e8375da-3792-40e7-b7e1-1299fb3a83b8-1716297675931/node_modules/@ethersproject-xdc/bytes" + "@ethersproject-xdc/logger" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-abstract-signer-5.7.0-9e8375da-3792-40e7-b7e1-1299fb3a83b8-1716297675931/node_modules/@ethersproject-xdc/logger" + "@ethersproject-xdc/properties" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-abstract-signer-5.7.0-9e8375da-3792-40e7-b7e1-1299fb3a83b8-1716297675931/node_modules/@ethersproject-xdc/properties" "@ethersproject-xdc/address@file:vendor/@ethersproject-xdc/address": version "5.7.0" dependencies: - "@ethersproject-xdc/bignumber" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-address-5.7.0-ebb15099-34b3-4975-9cf8-7f3cae8cb2cf-1711378365616/node_modules/@ethersproject-xdc/bignumber" - "@ethersproject-xdc/bytes" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-address-5.7.0-ebb15099-34b3-4975-9cf8-7f3cae8cb2cf-1711378365616/node_modules/@ethersproject-xdc/bytes" - "@ethersproject-xdc/keccak256" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-address-5.7.0-ebb15099-34b3-4975-9cf8-7f3cae8cb2cf-1711378365616/node_modules/@ethersproject-xdc/keccak256" - "@ethersproject-xdc/logger" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-address-5.7.0-ebb15099-34b3-4975-9cf8-7f3cae8cb2cf-1711378365616/node_modules/@ethersproject-xdc/logger" - "@ethersproject-xdc/rlp" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-address-5.7.0-ebb15099-34b3-4975-9cf8-7f3cae8cb2cf-1711378365616/node_modules/@ethersproject-xdc/rlp" + "@ethersproject-xdc/bignumber" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-address-5.7.0-f53ff6a1-cc32-4f71-9fab-6389250c29df-1716297675932/node_modules/@ethersproject-xdc/bignumber" + "@ethersproject-xdc/bytes" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-address-5.7.0-f53ff6a1-cc32-4f71-9fab-6389250c29df-1716297675932/node_modules/@ethersproject-xdc/bytes" + "@ethersproject-xdc/keccak256" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-address-5.7.0-f53ff6a1-cc32-4f71-9fab-6389250c29df-1716297675932/node_modules/@ethersproject-xdc/keccak256" + "@ethersproject-xdc/logger" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-address-5.7.0-f53ff6a1-cc32-4f71-9fab-6389250c29df-1716297675932/node_modules/@ethersproject-xdc/logger" + "@ethersproject-xdc/rlp" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-address-5.7.0-f53ff6a1-cc32-4f71-9fab-6389250c29df-1716297675932/node_modules/@ethersproject-xdc/rlp" "@ethersproject-xdc/base64@file:vendor/@ethersproject-xdc/base64": version "5.7.0" dependencies: - "@ethersproject-xdc/bytes" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-base64-5.7.0-ac940ee8-f7d7-44f8-a8e6-a8a2aa43673b-1711378365615/node_modules/@ethersproject-xdc/bytes" + "@ethersproject-xdc/bytes" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-base64-5.7.0-15802780-5108-4492-a3da-e23949990554-1716297675933/node_modules/@ethersproject-xdc/bytes" "@ethersproject-xdc/basex@file:vendor/@ethersproject-xdc/basex": version "5.7.0" dependencies: - "@ethersproject-xdc/bytes" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-basex-5.7.0-a3964cd6-3388-4e1e-8827-ccb5f8cddbea-1711378365615/node_modules/@ethersproject-xdc/bytes" - "@ethersproject-xdc/properties" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-basex-5.7.0-a3964cd6-3388-4e1e-8827-ccb5f8cddbea-1711378365615/node_modules/@ethersproject-xdc/properties" + "@ethersproject-xdc/bytes" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-basex-5.7.0-19d173d8-1fe6-4f99-a3d2-fe2a7772b658-1716297675933/node_modules/@ethersproject-xdc/bytes" + "@ethersproject-xdc/properties" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-basex-5.7.0-19d173d8-1fe6-4f99-a3d2-fe2a7772b658-1716297675933/node_modules/@ethersproject-xdc/properties" "@ethersproject-xdc/bignumber@file:vendor/@ethersproject-xdc/bignumber": version "5.7.0" dependencies: - "@ethersproject-xdc/bytes" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-bignumber-5.7.0-bc93acda-27ae-4704-88d0-8826555c062b-1711378365615/node_modules/@ethersproject-xdc/bytes" - "@ethersproject-xdc/logger" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-bignumber-5.7.0-bc93acda-27ae-4704-88d0-8826555c062b-1711378365615/node_modules/@ethersproject-xdc/logger" + "@ethersproject-xdc/bytes" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-bignumber-5.7.0-2948124a-982c-4227-bf17-a32184b85f7e-1716297675933/node_modules/@ethersproject-xdc/bytes" + "@ethersproject-xdc/logger" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-bignumber-5.7.0-2948124a-982c-4227-bf17-a32184b85f7e-1716297675933/node_modules/@ethersproject-xdc/logger" bn.js "^5.2.1" "@ethersproject-xdc/bytes@file:vendor/@ethersproject-xdc/bytes": version "5.7.0" dependencies: - "@ethersproject-xdc/logger" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-bytes-5.7.0-99ecb1f1-f3c4-4352-b857-7f806ce05f5d-1711378365616/node_modules/@ethersproject-xdc/logger" + "@ethersproject-xdc/logger" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-bytes-5.7.0-3dc32bfc-5468-4c53-8833-516ce3846654-1716297675933/node_modules/@ethersproject-xdc/logger" "@ethersproject-xdc/constants@file:vendor/@ethersproject-xdc/constants": version "5.7.0" dependencies: - "@ethersproject-xdc/bignumber" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-constants-5.7.0-91a31af6-9be3-4e31-94b5-304ef35e3207-1711378365616/node_modules/@ethersproject-xdc/bignumber" + "@ethersproject-xdc/bignumber" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-constants-5.7.0-d7d0b798-5859-4eea-ac4b-8a914bf7efd3-1716297675933/node_modules/@ethersproject-xdc/bignumber" "@ethersproject-xdc/contracts@file:vendor/@ethersproject-xdc/contracts": version "5.6.0" dependencies: - "@ethersproject-xdc/abi" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-contracts-5.6.0-3a1d2199-b3e9-4cf8-a8e5-111bb620bb2f-1711378365616/node_modules/@ethersproject-xdc/abi" - "@ethersproject-xdc/abstract-provider" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-contracts-5.6.0-3a1d2199-b3e9-4cf8-a8e5-111bb620bb2f-1711378365616/node_modules/@ethersproject-xdc/abstract-provider" - "@ethersproject-xdc/abstract-signer" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-contracts-5.6.0-3a1d2199-b3e9-4cf8-a8e5-111bb620bb2f-1711378365616/node_modules/@ethersproject-xdc/abstract-signer" - "@ethersproject-xdc/address" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-contracts-5.6.0-3a1d2199-b3e9-4cf8-a8e5-111bb620bb2f-1711378365616/node_modules/@ethersproject-xdc/address" - "@ethersproject-xdc/bignumber" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-contracts-5.6.0-3a1d2199-b3e9-4cf8-a8e5-111bb620bb2f-1711378365616/node_modules/@ethersproject-xdc/bignumber" - "@ethersproject-xdc/bytes" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-contracts-5.6.0-3a1d2199-b3e9-4cf8-a8e5-111bb620bb2f-1711378365616/node_modules/@ethersproject-xdc/bytes" - "@ethersproject-xdc/constants" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-contracts-5.6.0-3a1d2199-b3e9-4cf8-a8e5-111bb620bb2f-1711378365616/node_modules/@ethersproject-xdc/constants" - "@ethersproject-xdc/logger" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-contracts-5.6.0-3a1d2199-b3e9-4cf8-a8e5-111bb620bb2f-1711378365616/node_modules/@ethersproject-xdc/logger" - "@ethersproject-xdc/properties" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-contracts-5.6.0-3a1d2199-b3e9-4cf8-a8e5-111bb620bb2f-1711378365616/node_modules/@ethersproject-xdc/properties" - "@ethersproject-xdc/transactions" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-contracts-5.6.0-3a1d2199-b3e9-4cf8-a8e5-111bb620bb2f-1711378365616/node_modules/@ethersproject-xdc/transactions" + "@ethersproject-xdc/abi" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-contracts-5.6.0-2e1964e4-3b79-43a1-910e-d23f8be582f3-1716297675933/node_modules/@ethersproject-xdc/abi" + "@ethersproject-xdc/abstract-provider" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-contracts-5.6.0-2e1964e4-3b79-43a1-910e-d23f8be582f3-1716297675933/node_modules/@ethersproject-xdc/abstract-provider" + "@ethersproject-xdc/abstract-signer" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-contracts-5.6.0-2e1964e4-3b79-43a1-910e-d23f8be582f3-1716297675933/node_modules/@ethersproject-xdc/abstract-signer" + "@ethersproject-xdc/address" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-contracts-5.6.0-2e1964e4-3b79-43a1-910e-d23f8be582f3-1716297675933/node_modules/@ethersproject-xdc/address" + "@ethersproject-xdc/bignumber" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-contracts-5.6.0-2e1964e4-3b79-43a1-910e-d23f8be582f3-1716297675933/node_modules/@ethersproject-xdc/bignumber" + "@ethersproject-xdc/bytes" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-contracts-5.6.0-2e1964e4-3b79-43a1-910e-d23f8be582f3-1716297675933/node_modules/@ethersproject-xdc/bytes" + "@ethersproject-xdc/constants" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-contracts-5.6.0-2e1964e4-3b79-43a1-910e-d23f8be582f3-1716297675933/node_modules/@ethersproject-xdc/constants" + "@ethersproject-xdc/logger" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-contracts-5.6.0-2e1964e4-3b79-43a1-910e-d23f8be582f3-1716297675933/node_modules/@ethersproject-xdc/logger" + "@ethersproject-xdc/properties" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-contracts-5.6.0-2e1964e4-3b79-43a1-910e-d23f8be582f3-1716297675933/node_modules/@ethersproject-xdc/properties" + "@ethersproject-xdc/transactions" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-contracts-5.6.0-2e1964e4-3b79-43a1-910e-d23f8be582f3-1716297675933/node_modules/@ethersproject-xdc/transactions" "@ethersproject-xdc/hash@file:vendor/@ethersproject-xdc/hash": version "5.7.0" dependencies: - "@ethersproject-xdc/abstract-signer" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-hash-5.7.0-e59c6ed5-6f74-42e7-b132-f4bea3ddfad0-1711378365617/node_modules/@ethersproject-xdc/abstract-signer" - "@ethersproject-xdc/address" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-hash-5.7.0-e59c6ed5-6f74-42e7-b132-f4bea3ddfad0-1711378365617/node_modules/@ethersproject-xdc/address" - "@ethersproject-xdc/base64" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-hash-5.7.0-e59c6ed5-6f74-42e7-b132-f4bea3ddfad0-1711378365617/node_modules/@ethersproject-xdc/base64" - "@ethersproject-xdc/bignumber" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-hash-5.7.0-e59c6ed5-6f74-42e7-b132-f4bea3ddfad0-1711378365617/node_modules/@ethersproject-xdc/bignumber" - "@ethersproject-xdc/bytes" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-hash-5.7.0-e59c6ed5-6f74-42e7-b132-f4bea3ddfad0-1711378365617/node_modules/@ethersproject-xdc/bytes" - "@ethersproject-xdc/keccak256" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-hash-5.7.0-e59c6ed5-6f74-42e7-b132-f4bea3ddfad0-1711378365617/node_modules/@ethersproject-xdc/keccak256" - "@ethersproject-xdc/logger" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-hash-5.7.0-e59c6ed5-6f74-42e7-b132-f4bea3ddfad0-1711378365617/node_modules/@ethersproject-xdc/logger" - "@ethersproject-xdc/properties" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-hash-5.7.0-e59c6ed5-6f74-42e7-b132-f4bea3ddfad0-1711378365617/node_modules/@ethersproject-xdc/properties" - "@ethersproject-xdc/strings" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-hash-5.7.0-e59c6ed5-6f74-42e7-b132-f4bea3ddfad0-1711378365617/node_modules/@ethersproject-xdc/strings" + "@ethersproject-xdc/abstract-signer" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-hash-5.7.0-4634dcf0-704e-4158-8b97-d038197e9943-1716297675934/node_modules/@ethersproject-xdc/abstract-signer" + "@ethersproject-xdc/address" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-hash-5.7.0-4634dcf0-704e-4158-8b97-d038197e9943-1716297675934/node_modules/@ethersproject-xdc/address" + "@ethersproject-xdc/base64" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-hash-5.7.0-4634dcf0-704e-4158-8b97-d038197e9943-1716297675934/node_modules/@ethersproject-xdc/base64" + "@ethersproject-xdc/bignumber" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-hash-5.7.0-4634dcf0-704e-4158-8b97-d038197e9943-1716297675934/node_modules/@ethersproject-xdc/bignumber" + "@ethersproject-xdc/bytes" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-hash-5.7.0-4634dcf0-704e-4158-8b97-d038197e9943-1716297675934/node_modules/@ethersproject-xdc/bytes" + "@ethersproject-xdc/keccak256" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-hash-5.7.0-4634dcf0-704e-4158-8b97-d038197e9943-1716297675934/node_modules/@ethersproject-xdc/keccak256" + "@ethersproject-xdc/logger" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-hash-5.7.0-4634dcf0-704e-4158-8b97-d038197e9943-1716297675934/node_modules/@ethersproject-xdc/logger" + "@ethersproject-xdc/properties" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-hash-5.7.0-4634dcf0-704e-4158-8b97-d038197e9943-1716297675934/node_modules/@ethersproject-xdc/properties" + "@ethersproject-xdc/strings" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-hash-5.7.0-4634dcf0-704e-4158-8b97-d038197e9943-1716297675934/node_modules/@ethersproject-xdc/strings" "@ethersproject-xdc/hdnode@file:vendor/@ethersproject-xdc/hdnode": version "5.7.0" dependencies: - "@ethersproject-xdc/abstract-signer" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-hdnode-5.7.0-7df6d3a0-85a2-4dd8-84f0-7defb4301c82-1711378365618/node_modules/@ethersproject-xdc/abstract-signer" - "@ethersproject-xdc/basex" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-hdnode-5.7.0-7df6d3a0-85a2-4dd8-84f0-7defb4301c82-1711378365618/node_modules/@ethersproject-xdc/basex" - "@ethersproject-xdc/bignumber" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-hdnode-5.7.0-7df6d3a0-85a2-4dd8-84f0-7defb4301c82-1711378365618/node_modules/@ethersproject-xdc/bignumber" - "@ethersproject-xdc/bytes" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-hdnode-5.7.0-7df6d3a0-85a2-4dd8-84f0-7defb4301c82-1711378365618/node_modules/@ethersproject-xdc/bytes" - "@ethersproject-xdc/logger" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-hdnode-5.7.0-7df6d3a0-85a2-4dd8-84f0-7defb4301c82-1711378365618/node_modules/@ethersproject-xdc/logger" - "@ethersproject-xdc/pbkdf2" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-hdnode-5.7.0-7df6d3a0-85a2-4dd8-84f0-7defb4301c82-1711378365618/node_modules/@ethersproject-xdc/pbkdf2" - "@ethersproject-xdc/properties" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-hdnode-5.7.0-7df6d3a0-85a2-4dd8-84f0-7defb4301c82-1711378365618/node_modules/@ethersproject-xdc/properties" - "@ethersproject-xdc/sha2" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-hdnode-5.7.0-7df6d3a0-85a2-4dd8-84f0-7defb4301c82-1711378365618/node_modules/@ethersproject-xdc/sha2" - "@ethersproject-xdc/signing-key" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-hdnode-5.7.0-7df6d3a0-85a2-4dd8-84f0-7defb4301c82-1711378365618/node_modules/@ethersproject-xdc/signing-key" - "@ethersproject-xdc/strings" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-hdnode-5.7.0-7df6d3a0-85a2-4dd8-84f0-7defb4301c82-1711378365618/node_modules/@ethersproject-xdc/strings" - "@ethersproject-xdc/transactions" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-hdnode-5.7.0-7df6d3a0-85a2-4dd8-84f0-7defb4301c82-1711378365618/node_modules/@ethersproject-xdc/transactions" - "@ethersproject-xdc/wordlists" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-hdnode-5.7.0-7df6d3a0-85a2-4dd8-84f0-7defb4301c82-1711378365618/node_modules/@ethersproject-xdc/wordlists" + "@ethersproject-xdc/abstract-signer" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-hdnode-5.7.0-a4f21af3-72bf-4254-a47d-65c7d8a97ad2-1716297675934/node_modules/@ethersproject-xdc/abstract-signer" + "@ethersproject-xdc/basex" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-hdnode-5.7.0-a4f21af3-72bf-4254-a47d-65c7d8a97ad2-1716297675934/node_modules/@ethersproject-xdc/basex" + "@ethersproject-xdc/bignumber" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-hdnode-5.7.0-a4f21af3-72bf-4254-a47d-65c7d8a97ad2-1716297675934/node_modules/@ethersproject-xdc/bignumber" + "@ethersproject-xdc/bytes" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-hdnode-5.7.0-a4f21af3-72bf-4254-a47d-65c7d8a97ad2-1716297675934/node_modules/@ethersproject-xdc/bytes" + "@ethersproject-xdc/logger" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-hdnode-5.7.0-a4f21af3-72bf-4254-a47d-65c7d8a97ad2-1716297675934/node_modules/@ethersproject-xdc/logger" + "@ethersproject-xdc/pbkdf2" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-hdnode-5.7.0-a4f21af3-72bf-4254-a47d-65c7d8a97ad2-1716297675934/node_modules/@ethersproject-xdc/pbkdf2" + "@ethersproject-xdc/properties" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-hdnode-5.7.0-a4f21af3-72bf-4254-a47d-65c7d8a97ad2-1716297675934/node_modules/@ethersproject-xdc/properties" + "@ethersproject-xdc/sha2" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-hdnode-5.7.0-a4f21af3-72bf-4254-a47d-65c7d8a97ad2-1716297675934/node_modules/@ethersproject-xdc/sha2" + "@ethersproject-xdc/signing-key" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-hdnode-5.7.0-a4f21af3-72bf-4254-a47d-65c7d8a97ad2-1716297675934/node_modules/@ethersproject-xdc/signing-key" + "@ethersproject-xdc/strings" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-hdnode-5.7.0-a4f21af3-72bf-4254-a47d-65c7d8a97ad2-1716297675934/node_modules/@ethersproject-xdc/strings" + "@ethersproject-xdc/transactions" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-hdnode-5.7.0-a4f21af3-72bf-4254-a47d-65c7d8a97ad2-1716297675934/node_modules/@ethersproject-xdc/transactions" + "@ethersproject-xdc/wordlists" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-hdnode-5.7.0-a4f21af3-72bf-4254-a47d-65c7d8a97ad2-1716297675934/node_modules/@ethersproject-xdc/wordlists" "@ethersproject-xdc/json-wallets@file:vendor/@ethersproject-xdc/json-wallets": version "5.6.0" dependencies: - "@ethersproject-xdc/abstract-signer" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-json-wallets-5.6.0-b09d5477-70d2-455d-95b9-95327c90a434-1711378365617/node_modules/@ethersproject-xdc/abstract-signer" - "@ethersproject-xdc/address" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-json-wallets-5.6.0-b09d5477-70d2-455d-95b9-95327c90a434-1711378365617/node_modules/@ethersproject-xdc/address" - "@ethersproject-xdc/bytes" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-json-wallets-5.6.0-b09d5477-70d2-455d-95b9-95327c90a434-1711378365617/node_modules/@ethersproject-xdc/bytes" - "@ethersproject-xdc/hdnode" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-json-wallets-5.6.0-b09d5477-70d2-455d-95b9-95327c90a434-1711378365617/node_modules/@ethersproject-xdc/hdnode" - "@ethersproject-xdc/keccak256" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-json-wallets-5.6.0-b09d5477-70d2-455d-95b9-95327c90a434-1711378365617/node_modules/@ethersproject-xdc/keccak256" - "@ethersproject-xdc/logger" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-json-wallets-5.6.0-b09d5477-70d2-455d-95b9-95327c90a434-1711378365617/node_modules/@ethersproject-xdc/logger" - "@ethersproject-xdc/pbkdf2" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-json-wallets-5.6.0-b09d5477-70d2-455d-95b9-95327c90a434-1711378365617/node_modules/@ethersproject-xdc/pbkdf2" - "@ethersproject-xdc/properties" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-json-wallets-5.6.0-b09d5477-70d2-455d-95b9-95327c90a434-1711378365617/node_modules/@ethersproject-xdc/properties" - "@ethersproject-xdc/random" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-json-wallets-5.6.0-b09d5477-70d2-455d-95b9-95327c90a434-1711378365617/node_modules/@ethersproject-xdc/random" - "@ethersproject-xdc/strings" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-json-wallets-5.6.0-b09d5477-70d2-455d-95b9-95327c90a434-1711378365617/node_modules/@ethersproject-xdc/strings" - "@ethersproject-xdc/transactions" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-json-wallets-5.6.0-b09d5477-70d2-455d-95b9-95327c90a434-1711378365617/node_modules/@ethersproject-xdc/transactions" + "@ethersproject-xdc/abstract-signer" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-json-wallets-5.6.0-231d1d58-37cd-4d83-87d7-cbb39caf8aa7-1716297675935/node_modules/@ethersproject-xdc/abstract-signer" + "@ethersproject-xdc/address" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-json-wallets-5.6.0-231d1d58-37cd-4d83-87d7-cbb39caf8aa7-1716297675935/node_modules/@ethersproject-xdc/address" + "@ethersproject-xdc/bytes" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-json-wallets-5.6.0-231d1d58-37cd-4d83-87d7-cbb39caf8aa7-1716297675935/node_modules/@ethersproject-xdc/bytes" + "@ethersproject-xdc/hdnode" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-json-wallets-5.6.0-231d1d58-37cd-4d83-87d7-cbb39caf8aa7-1716297675935/node_modules/@ethersproject-xdc/hdnode" + "@ethersproject-xdc/keccak256" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-json-wallets-5.6.0-231d1d58-37cd-4d83-87d7-cbb39caf8aa7-1716297675935/node_modules/@ethersproject-xdc/keccak256" + "@ethersproject-xdc/logger" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-json-wallets-5.6.0-231d1d58-37cd-4d83-87d7-cbb39caf8aa7-1716297675935/node_modules/@ethersproject-xdc/logger" + "@ethersproject-xdc/pbkdf2" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-json-wallets-5.6.0-231d1d58-37cd-4d83-87d7-cbb39caf8aa7-1716297675935/node_modules/@ethersproject-xdc/pbkdf2" + "@ethersproject-xdc/properties" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-json-wallets-5.6.0-231d1d58-37cd-4d83-87d7-cbb39caf8aa7-1716297675935/node_modules/@ethersproject-xdc/properties" + "@ethersproject-xdc/random" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-json-wallets-5.6.0-231d1d58-37cd-4d83-87d7-cbb39caf8aa7-1716297675935/node_modules/@ethersproject-xdc/random" + "@ethersproject-xdc/strings" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-json-wallets-5.6.0-231d1d58-37cd-4d83-87d7-cbb39caf8aa7-1716297675935/node_modules/@ethersproject-xdc/strings" + "@ethersproject-xdc/transactions" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-json-wallets-5.6.0-231d1d58-37cd-4d83-87d7-cbb39caf8aa7-1716297675935/node_modules/@ethersproject-xdc/transactions" aes-js "3.0.0" scrypt-js "3.0.1" "@ethersproject-xdc/keccak256@file:vendor/@ethersproject-xdc/keccak256": version "5.7.0" dependencies: - "@ethersproject-xdc/bytes" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-keccak256-5.7.0-9cb7534e-f2d4-4bb8-8726-aa8d2ae70a68-1711378365617/node_modules/@ethersproject-xdc/bytes" + "@ethersproject-xdc/bytes" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-keccak256-5.7.0-22e01e82-581e-4aa1-87e1-c519d1e31fd8-1716297675935/node_modules/@ethersproject-xdc/bytes" js-sha3 "0.8.0" "@ethersproject-xdc/logger@file:vendor/@ethersproject-xdc/logger": @@ -1547,67 +1573,67 @@ "@ethersproject-xdc/networks@file:vendor/@ethersproject-xdc/networks": version "5.7.1" dependencies: - "@ethersproject-xdc/logger" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-networks-5.7.1-3318040d-6ee2-4fe1-8d35-2e90df014a04-1711378365619/node_modules/@ethersproject-xdc/logger" + "@ethersproject-xdc/logger" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-networks-5.7.1-fb9e6b48-52db-41c9-bd3e-3a338a6d6fb6-1716297675937/node_modules/@ethersproject-xdc/logger" "@ethersproject-xdc/pbkdf2@file:vendor/@ethersproject-xdc/pbkdf2": version "5.7.0" dependencies: - "@ethersproject-xdc/bytes" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-pbkdf2-5.7.0-1db75448-b10f-4529-b48f-66f22c09a20a-1711378365617/node_modules/@ethersproject-xdc/bytes" - "@ethersproject-xdc/sha2" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-pbkdf2-5.7.0-1db75448-b10f-4529-b48f-66f22c09a20a-1711378365617/node_modules/@ethersproject-xdc/sha2" + "@ethersproject-xdc/bytes" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-pbkdf2-5.7.0-95e49d64-eb05-407c-a9e7-7d5715d2df75-1716297675936/node_modules/@ethersproject-xdc/bytes" + "@ethersproject-xdc/sha2" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-pbkdf2-5.7.0-95e49d64-eb05-407c-a9e7-7d5715d2df75-1716297675936/node_modules/@ethersproject-xdc/sha2" "@ethersproject-xdc/properties@file:vendor/@ethersproject-xdc/properties": version "5.7.0" dependencies: - "@ethersproject-xdc/logger" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-properties-5.7.0-d600654f-dc20-45bd-8730-5aea66cd419c-1711378365618/node_modules/@ethersproject-xdc/logger" + "@ethersproject-xdc/logger" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-properties-5.7.0-5f17628d-cc48-4d8c-a636-a6aaea03413b-1716297675939/node_modules/@ethersproject-xdc/logger" "@ethersproject-xdc/providers@file:vendor/@ethersproject-xdc/providers": version "5.6.2" dependencies: - "@ethersproject-xdc/abstract-provider" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-providers-5.6.2-0e620e87-104e-4693-b0d6-cc54eba98645-1711378365618/node_modules/@ethersproject-xdc/abstract-provider" - "@ethersproject-xdc/abstract-signer" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-providers-5.6.2-0e620e87-104e-4693-b0d6-cc54eba98645-1711378365618/node_modules/@ethersproject-xdc/abstract-signer" - "@ethersproject-xdc/address" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-providers-5.6.2-0e620e87-104e-4693-b0d6-cc54eba98645-1711378365618/node_modules/@ethersproject-xdc/address" - "@ethersproject-xdc/basex" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-providers-5.6.2-0e620e87-104e-4693-b0d6-cc54eba98645-1711378365618/node_modules/@ethersproject-xdc/basex" - "@ethersproject-xdc/bignumber" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-providers-5.6.2-0e620e87-104e-4693-b0d6-cc54eba98645-1711378365618/node_modules/@ethersproject-xdc/bignumber" - "@ethersproject-xdc/bytes" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-providers-5.6.2-0e620e87-104e-4693-b0d6-cc54eba98645-1711378365618/node_modules/@ethersproject-xdc/bytes" - "@ethersproject-xdc/constants" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-providers-5.6.2-0e620e87-104e-4693-b0d6-cc54eba98645-1711378365618/node_modules/@ethersproject-xdc/constants" - "@ethersproject-xdc/hash" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-providers-5.6.2-0e620e87-104e-4693-b0d6-cc54eba98645-1711378365618/node_modules/@ethersproject-xdc/hash" - "@ethersproject-xdc/logger" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-providers-5.6.2-0e620e87-104e-4693-b0d6-cc54eba98645-1711378365618/node_modules/@ethersproject-xdc/logger" - "@ethersproject-xdc/networks" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-providers-5.6.2-0e620e87-104e-4693-b0d6-cc54eba98645-1711378365618/node_modules/@ethersproject-xdc/networks" - "@ethersproject-xdc/properties" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-providers-5.6.2-0e620e87-104e-4693-b0d6-cc54eba98645-1711378365618/node_modules/@ethersproject-xdc/properties" - "@ethersproject-xdc/random" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-providers-5.6.2-0e620e87-104e-4693-b0d6-cc54eba98645-1711378365618/node_modules/@ethersproject-xdc/random" - "@ethersproject-xdc/rlp" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-providers-5.6.2-0e620e87-104e-4693-b0d6-cc54eba98645-1711378365618/node_modules/@ethersproject-xdc/rlp" - "@ethersproject-xdc/sha2" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-providers-5.6.2-0e620e87-104e-4693-b0d6-cc54eba98645-1711378365618/node_modules/@ethersproject-xdc/sha2" - "@ethersproject-xdc/strings" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-providers-5.6.2-0e620e87-104e-4693-b0d6-cc54eba98645-1711378365618/node_modules/@ethersproject-xdc/strings" - "@ethersproject-xdc/transactions" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-providers-5.6.2-0e620e87-104e-4693-b0d6-cc54eba98645-1711378365618/node_modules/@ethersproject-xdc/transactions" - "@ethersproject-xdc/web" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-providers-5.6.2-0e620e87-104e-4693-b0d6-cc54eba98645-1711378365618/node_modules/@ethersproject-xdc/web" + "@ethersproject-xdc/abstract-provider" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-providers-5.6.2-f2cc1102-7174-4e4b-94d5-88c1bf25e69a-1716297675935/node_modules/@ethersproject-xdc/abstract-provider" + "@ethersproject-xdc/abstract-signer" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-providers-5.6.2-f2cc1102-7174-4e4b-94d5-88c1bf25e69a-1716297675935/node_modules/@ethersproject-xdc/abstract-signer" + "@ethersproject-xdc/address" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-providers-5.6.2-f2cc1102-7174-4e4b-94d5-88c1bf25e69a-1716297675935/node_modules/@ethersproject-xdc/address" + "@ethersproject-xdc/basex" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-providers-5.6.2-f2cc1102-7174-4e4b-94d5-88c1bf25e69a-1716297675935/node_modules/@ethersproject-xdc/basex" + "@ethersproject-xdc/bignumber" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-providers-5.6.2-f2cc1102-7174-4e4b-94d5-88c1bf25e69a-1716297675935/node_modules/@ethersproject-xdc/bignumber" + "@ethersproject-xdc/bytes" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-providers-5.6.2-f2cc1102-7174-4e4b-94d5-88c1bf25e69a-1716297675935/node_modules/@ethersproject-xdc/bytes" + "@ethersproject-xdc/constants" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-providers-5.6.2-f2cc1102-7174-4e4b-94d5-88c1bf25e69a-1716297675935/node_modules/@ethersproject-xdc/constants" + "@ethersproject-xdc/hash" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-providers-5.6.2-f2cc1102-7174-4e4b-94d5-88c1bf25e69a-1716297675935/node_modules/@ethersproject-xdc/hash" + "@ethersproject-xdc/logger" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-providers-5.6.2-f2cc1102-7174-4e4b-94d5-88c1bf25e69a-1716297675935/node_modules/@ethersproject-xdc/logger" + "@ethersproject-xdc/networks" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-providers-5.6.2-f2cc1102-7174-4e4b-94d5-88c1bf25e69a-1716297675935/node_modules/@ethersproject-xdc/networks" + "@ethersproject-xdc/properties" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-providers-5.6.2-f2cc1102-7174-4e4b-94d5-88c1bf25e69a-1716297675935/node_modules/@ethersproject-xdc/properties" + "@ethersproject-xdc/random" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-providers-5.6.2-f2cc1102-7174-4e4b-94d5-88c1bf25e69a-1716297675935/node_modules/@ethersproject-xdc/random" + "@ethersproject-xdc/rlp" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-providers-5.6.2-f2cc1102-7174-4e4b-94d5-88c1bf25e69a-1716297675935/node_modules/@ethersproject-xdc/rlp" + "@ethersproject-xdc/sha2" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-providers-5.6.2-f2cc1102-7174-4e4b-94d5-88c1bf25e69a-1716297675935/node_modules/@ethersproject-xdc/sha2" + "@ethersproject-xdc/strings" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-providers-5.6.2-f2cc1102-7174-4e4b-94d5-88c1bf25e69a-1716297675935/node_modules/@ethersproject-xdc/strings" + "@ethersproject-xdc/transactions" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-providers-5.6.2-f2cc1102-7174-4e4b-94d5-88c1bf25e69a-1716297675935/node_modules/@ethersproject-xdc/transactions" + "@ethersproject-xdc/web" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-providers-5.6.2-f2cc1102-7174-4e4b-94d5-88c1bf25e69a-1716297675935/node_modules/@ethersproject-xdc/web" bech32 "1.1.4" ws "7.4.6" "@ethersproject-xdc/random@file:vendor/@ethersproject-xdc/random": version "5.7.0" dependencies: - "@ethersproject-xdc/bytes" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-random-5.7.0-98a7dd46-79c6-4335-9d15-21617d7f16a5-1711378365619/node_modules/@ethersproject-xdc/bytes" - "@ethersproject-xdc/logger" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-random-5.7.0-98a7dd46-79c6-4335-9d15-21617d7f16a5-1711378365619/node_modules/@ethersproject-xdc/logger" + "@ethersproject-xdc/bytes" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-random-5.7.0-3c816eb6-037f-4cd7-b0d0-3ee75241efa3-1716297675937/node_modules/@ethersproject-xdc/bytes" + "@ethersproject-xdc/logger" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-random-5.7.0-3c816eb6-037f-4cd7-b0d0-3ee75241efa3-1716297675937/node_modules/@ethersproject-xdc/logger" "@ethersproject-xdc/rlp@file:vendor/@ethersproject-xdc/rlp": version "5.7.0" dependencies: - "@ethersproject-xdc/bytes" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-rlp-5.7.0-7790503f-a04f-459f-8b5c-cf61ffd4ff12-1711378365619/node_modules/@ethersproject-xdc/bytes" - "@ethersproject-xdc/logger" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-rlp-5.7.0-7790503f-a04f-459f-8b5c-cf61ffd4ff12-1711378365619/node_modules/@ethersproject-xdc/logger" + "@ethersproject-xdc/bytes" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-rlp-5.7.0-5b745539-6d90-4f7b-8266-4e29531555d6-1716297675940/node_modules/@ethersproject-xdc/bytes" + "@ethersproject-xdc/logger" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-rlp-5.7.0-5b745539-6d90-4f7b-8266-4e29531555d6-1716297675940/node_modules/@ethersproject-xdc/logger" "@ethersproject-xdc/sha2@file:vendor/@ethersproject-xdc/sha2": version "5.7.0" dependencies: - "@ethersproject-xdc/bytes" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-sha2-5.7.0-c765449d-476b-4741-9e2e-dbccb8aa1809-1711378365619/node_modules/@ethersproject-xdc/bytes" - "@ethersproject-xdc/logger" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-sha2-5.7.0-c765449d-476b-4741-9e2e-dbccb8aa1809-1711378365619/node_modules/@ethersproject-xdc/logger" + "@ethersproject-xdc/bytes" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-sha2-5.7.0-ed2bee0d-f2a1-43bb-98f9-2181ead3a16f-1716297675938/node_modules/@ethersproject-xdc/bytes" + "@ethersproject-xdc/logger" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-sha2-5.7.0-ed2bee0d-f2a1-43bb-98f9-2181ead3a16f-1716297675938/node_modules/@ethersproject-xdc/logger" hash.js "1.1.7" "@ethersproject-xdc/signing-key@file:vendor/@ethersproject-xdc/signing-key": version "5.7.0" dependencies: - "@ethersproject-xdc/bytes" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-signing-key-5.7.0-21971b50-7b39-465c-bb5a-2f8689e48cc2-1711378365620/node_modules/@ethersproject-xdc/bytes" - "@ethersproject-xdc/logger" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-signing-key-5.7.0-21971b50-7b39-465c-bb5a-2f8689e48cc2-1711378365620/node_modules/@ethersproject-xdc/logger" - "@ethersproject-xdc/properties" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-signing-key-5.7.0-21971b50-7b39-465c-bb5a-2f8689e48cc2-1711378365620/node_modules/@ethersproject-xdc/properties" + "@ethersproject-xdc/bytes" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-signing-key-5.7.0-c631dbd2-296f-458e-8c64-6b57ab2ef55f-1716297675937/node_modules/@ethersproject-xdc/bytes" + "@ethersproject-xdc/logger" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-signing-key-5.7.0-c631dbd2-296f-458e-8c64-6b57ab2ef55f-1716297675937/node_modules/@ethersproject-xdc/logger" + "@ethersproject-xdc/properties" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-signing-key-5.7.0-c631dbd2-296f-458e-8c64-6b57ab2ef55f-1716297675937/node_modules/@ethersproject-xdc/properties" bn.js "^5.2.1" elliptic "6.5.4" hash.js "1.1.7" @@ -1615,76 +1641,76 @@ "@ethersproject-xdc/solidity@file:vendor/@ethersproject-xdc/solidity": version "5.6.0" dependencies: - "@ethersproject-xdc/bignumber" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-solidity-5.6.0-e3924149-bd04-4548-98cf-44195b92192d-1711378365619/node_modules/@ethersproject-xdc/bignumber" - "@ethersproject-xdc/bytes" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-solidity-5.6.0-e3924149-bd04-4548-98cf-44195b92192d-1711378365619/node_modules/@ethersproject-xdc/bytes" - "@ethersproject-xdc/keccak256" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-solidity-5.6.0-e3924149-bd04-4548-98cf-44195b92192d-1711378365619/node_modules/@ethersproject-xdc/keccak256" - "@ethersproject-xdc/logger" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-solidity-5.6.0-e3924149-bd04-4548-98cf-44195b92192d-1711378365619/node_modules/@ethersproject-xdc/logger" - "@ethersproject-xdc/sha2" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-solidity-5.6.0-e3924149-bd04-4548-98cf-44195b92192d-1711378365619/node_modules/@ethersproject-xdc/sha2" - "@ethersproject-xdc/strings" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-solidity-5.6.0-e3924149-bd04-4548-98cf-44195b92192d-1711378365619/node_modules/@ethersproject-xdc/strings" + "@ethersproject-xdc/bignumber" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-solidity-5.6.0-301a4aff-58b1-4475-8522-5300fe4b22a7-1716297675937/node_modules/@ethersproject-xdc/bignumber" + "@ethersproject-xdc/bytes" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-solidity-5.6.0-301a4aff-58b1-4475-8522-5300fe4b22a7-1716297675937/node_modules/@ethersproject-xdc/bytes" + "@ethersproject-xdc/keccak256" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-solidity-5.6.0-301a4aff-58b1-4475-8522-5300fe4b22a7-1716297675937/node_modules/@ethersproject-xdc/keccak256" + "@ethersproject-xdc/logger" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-solidity-5.6.0-301a4aff-58b1-4475-8522-5300fe4b22a7-1716297675937/node_modules/@ethersproject-xdc/logger" + "@ethersproject-xdc/sha2" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-solidity-5.6.0-301a4aff-58b1-4475-8522-5300fe4b22a7-1716297675937/node_modules/@ethersproject-xdc/sha2" + "@ethersproject-xdc/strings" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-solidity-5.6.0-301a4aff-58b1-4475-8522-5300fe4b22a7-1716297675937/node_modules/@ethersproject-xdc/strings" "@ethersproject-xdc/strings@file:vendor/@ethersproject-xdc/strings": version "5.7.0" dependencies: - "@ethersproject-xdc/bytes" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-strings-5.7.0-42e9cb08-71fd-4932-bd36-6f05e0f1b34b-1711378365620/node_modules/@ethersproject-xdc/bytes" - "@ethersproject-xdc/constants" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-strings-5.7.0-42e9cb08-71fd-4932-bd36-6f05e0f1b34b-1711378365620/node_modules/@ethersproject-xdc/constants" - "@ethersproject-xdc/logger" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-strings-5.7.0-42e9cb08-71fd-4932-bd36-6f05e0f1b34b-1711378365620/node_modules/@ethersproject-xdc/logger" + "@ethersproject-xdc/bytes" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-strings-5.7.0-e1e2b368-c344-4378-9cd0-8ea43170d394-1716297675939/node_modules/@ethersproject-xdc/bytes" + "@ethersproject-xdc/constants" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-strings-5.7.0-e1e2b368-c344-4378-9cd0-8ea43170d394-1716297675939/node_modules/@ethersproject-xdc/constants" + "@ethersproject-xdc/logger" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-strings-5.7.0-e1e2b368-c344-4378-9cd0-8ea43170d394-1716297675939/node_modules/@ethersproject-xdc/logger" "@ethersproject-xdc/transactions@file:vendor/@ethersproject-xdc/transactions": version "5.7.0" dependencies: - "@ethersproject-xdc/address" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-transactions-5.7.0-bb480f26-2b90-41a5-bfff-057ac9b6e8e9-1711378365622/node_modules/@ethersproject-xdc/address" - "@ethersproject-xdc/bignumber" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-transactions-5.7.0-bb480f26-2b90-41a5-bfff-057ac9b6e8e9-1711378365622/node_modules/@ethersproject-xdc/bignumber" - "@ethersproject-xdc/bytes" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-transactions-5.7.0-bb480f26-2b90-41a5-bfff-057ac9b6e8e9-1711378365622/node_modules/@ethersproject-xdc/bytes" - "@ethersproject-xdc/constants" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-transactions-5.7.0-bb480f26-2b90-41a5-bfff-057ac9b6e8e9-1711378365622/node_modules/@ethersproject-xdc/constants" - "@ethersproject-xdc/keccak256" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-transactions-5.7.0-bb480f26-2b90-41a5-bfff-057ac9b6e8e9-1711378365622/node_modules/@ethersproject-xdc/keccak256" - "@ethersproject-xdc/logger" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-transactions-5.7.0-bb480f26-2b90-41a5-bfff-057ac9b6e8e9-1711378365622/node_modules/@ethersproject-xdc/logger" - "@ethersproject-xdc/properties" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-transactions-5.7.0-bb480f26-2b90-41a5-bfff-057ac9b6e8e9-1711378365622/node_modules/@ethersproject-xdc/properties" - "@ethersproject-xdc/rlp" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-transactions-5.7.0-bb480f26-2b90-41a5-bfff-057ac9b6e8e9-1711378365622/node_modules/@ethersproject-xdc/rlp" - "@ethersproject-xdc/signing-key" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-transactions-5.7.0-bb480f26-2b90-41a5-bfff-057ac9b6e8e9-1711378365622/node_modules/@ethersproject-xdc/signing-key" + "@ethersproject-xdc/address" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-transactions-5.7.0-3459d0b8-cd9e-4b98-924e-5bc93576929c-1716297675939/node_modules/@ethersproject-xdc/address" + "@ethersproject-xdc/bignumber" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-transactions-5.7.0-3459d0b8-cd9e-4b98-924e-5bc93576929c-1716297675939/node_modules/@ethersproject-xdc/bignumber" + "@ethersproject-xdc/bytes" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-transactions-5.7.0-3459d0b8-cd9e-4b98-924e-5bc93576929c-1716297675939/node_modules/@ethersproject-xdc/bytes" + "@ethersproject-xdc/constants" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-transactions-5.7.0-3459d0b8-cd9e-4b98-924e-5bc93576929c-1716297675939/node_modules/@ethersproject-xdc/constants" + "@ethersproject-xdc/keccak256" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-transactions-5.7.0-3459d0b8-cd9e-4b98-924e-5bc93576929c-1716297675939/node_modules/@ethersproject-xdc/keccak256" + "@ethersproject-xdc/logger" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-transactions-5.7.0-3459d0b8-cd9e-4b98-924e-5bc93576929c-1716297675939/node_modules/@ethersproject-xdc/logger" + "@ethersproject-xdc/properties" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-transactions-5.7.0-3459d0b8-cd9e-4b98-924e-5bc93576929c-1716297675939/node_modules/@ethersproject-xdc/properties" + "@ethersproject-xdc/rlp" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-transactions-5.7.0-3459d0b8-cd9e-4b98-924e-5bc93576929c-1716297675939/node_modules/@ethersproject-xdc/rlp" + "@ethersproject-xdc/signing-key" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-transactions-5.7.0-3459d0b8-cd9e-4b98-924e-5bc93576929c-1716297675939/node_modules/@ethersproject-xdc/signing-key" "@ethersproject-xdc/units@file:vendor/@ethersproject-xdc/units": version "5.6.0" dependencies: - "@ethersproject-xdc/bignumber" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-units-5.6.0-5f41db51-35b1-4973-a795-080ed99a99b4-1711378365619/node_modules/@ethersproject-xdc/bignumber" - "@ethersproject-xdc/constants" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-units-5.6.0-5f41db51-35b1-4973-a795-080ed99a99b4-1711378365619/node_modules/@ethersproject-xdc/constants" - "@ethersproject-xdc/logger" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-units-5.6.0-5f41db51-35b1-4973-a795-080ed99a99b4-1711378365619/node_modules/@ethersproject-xdc/logger" + "@ethersproject-xdc/bignumber" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-units-5.6.0-3ca72b77-e338-4a38-95ae-5e5ba3d2cd70-1716297675940/node_modules/@ethersproject-xdc/bignumber" + "@ethersproject-xdc/constants" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-units-5.6.0-3ca72b77-e338-4a38-95ae-5e5ba3d2cd70-1716297675940/node_modules/@ethersproject-xdc/constants" + "@ethersproject-xdc/logger" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-units-5.6.0-3ca72b77-e338-4a38-95ae-5e5ba3d2cd70-1716297675940/node_modules/@ethersproject-xdc/logger" "@ethersproject-xdc/wallet@file:vendor/@ethersproject-xdc/wallet": version "5.6.0" dependencies: - "@ethersproject-xdc/abstract-provider" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-wallet-5.6.0-bc949dc4-090d-4ab9-b6c6-709a17fc75ad-1711378365622/node_modules/@ethersproject-xdc/abstract-provider" - "@ethersproject-xdc/abstract-signer" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-wallet-5.6.0-bc949dc4-090d-4ab9-b6c6-709a17fc75ad-1711378365622/node_modules/@ethersproject-xdc/abstract-signer" - "@ethersproject-xdc/address" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-wallet-5.6.0-bc949dc4-090d-4ab9-b6c6-709a17fc75ad-1711378365622/node_modules/@ethersproject-xdc/address" - "@ethersproject-xdc/bignumber" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-wallet-5.6.0-bc949dc4-090d-4ab9-b6c6-709a17fc75ad-1711378365622/node_modules/@ethersproject-xdc/bignumber" - "@ethersproject-xdc/bytes" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-wallet-5.6.0-bc949dc4-090d-4ab9-b6c6-709a17fc75ad-1711378365622/node_modules/@ethersproject-xdc/bytes" - "@ethersproject-xdc/hash" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-wallet-5.6.0-bc949dc4-090d-4ab9-b6c6-709a17fc75ad-1711378365622/node_modules/@ethersproject-xdc/hash" - "@ethersproject-xdc/hdnode" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-wallet-5.6.0-bc949dc4-090d-4ab9-b6c6-709a17fc75ad-1711378365622/node_modules/@ethersproject-xdc/hdnode" - "@ethersproject-xdc/json-wallets" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-wallet-5.6.0-bc949dc4-090d-4ab9-b6c6-709a17fc75ad-1711378365622/node_modules/@ethersproject-xdc/json-wallets" - "@ethersproject-xdc/keccak256" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-wallet-5.6.0-bc949dc4-090d-4ab9-b6c6-709a17fc75ad-1711378365622/node_modules/@ethersproject-xdc/keccak256" - "@ethersproject-xdc/logger" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-wallet-5.6.0-bc949dc4-090d-4ab9-b6c6-709a17fc75ad-1711378365622/node_modules/@ethersproject-xdc/logger" - "@ethersproject-xdc/properties" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-wallet-5.6.0-bc949dc4-090d-4ab9-b6c6-709a17fc75ad-1711378365622/node_modules/@ethersproject-xdc/properties" - "@ethersproject-xdc/random" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-wallet-5.6.0-bc949dc4-090d-4ab9-b6c6-709a17fc75ad-1711378365622/node_modules/@ethersproject-xdc/random" - "@ethersproject-xdc/signing-key" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-wallet-5.6.0-bc949dc4-090d-4ab9-b6c6-709a17fc75ad-1711378365622/node_modules/@ethersproject-xdc/signing-key" - "@ethersproject-xdc/transactions" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-wallet-5.6.0-bc949dc4-090d-4ab9-b6c6-709a17fc75ad-1711378365622/node_modules/@ethersproject-xdc/transactions" - "@ethersproject-xdc/wordlists" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-wallet-5.6.0-bc949dc4-090d-4ab9-b6c6-709a17fc75ad-1711378365622/node_modules/@ethersproject-xdc/wordlists" + "@ethersproject-xdc/abstract-provider" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-wallet-5.6.0-6ddc52d1-d7d8-448c-8495-458d8fbc1c99-1716297675940/node_modules/@ethersproject-xdc/abstract-provider" + "@ethersproject-xdc/abstract-signer" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-wallet-5.6.0-6ddc52d1-d7d8-448c-8495-458d8fbc1c99-1716297675940/node_modules/@ethersproject-xdc/abstract-signer" + "@ethersproject-xdc/address" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-wallet-5.6.0-6ddc52d1-d7d8-448c-8495-458d8fbc1c99-1716297675940/node_modules/@ethersproject-xdc/address" + "@ethersproject-xdc/bignumber" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-wallet-5.6.0-6ddc52d1-d7d8-448c-8495-458d8fbc1c99-1716297675940/node_modules/@ethersproject-xdc/bignumber" + "@ethersproject-xdc/bytes" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-wallet-5.6.0-6ddc52d1-d7d8-448c-8495-458d8fbc1c99-1716297675940/node_modules/@ethersproject-xdc/bytes" + "@ethersproject-xdc/hash" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-wallet-5.6.0-6ddc52d1-d7d8-448c-8495-458d8fbc1c99-1716297675940/node_modules/@ethersproject-xdc/hash" + "@ethersproject-xdc/hdnode" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-wallet-5.6.0-6ddc52d1-d7d8-448c-8495-458d8fbc1c99-1716297675940/node_modules/@ethersproject-xdc/hdnode" + "@ethersproject-xdc/json-wallets" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-wallet-5.6.0-6ddc52d1-d7d8-448c-8495-458d8fbc1c99-1716297675940/node_modules/@ethersproject-xdc/json-wallets" + "@ethersproject-xdc/keccak256" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-wallet-5.6.0-6ddc52d1-d7d8-448c-8495-458d8fbc1c99-1716297675940/node_modules/@ethersproject-xdc/keccak256" + "@ethersproject-xdc/logger" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-wallet-5.6.0-6ddc52d1-d7d8-448c-8495-458d8fbc1c99-1716297675940/node_modules/@ethersproject-xdc/logger" + "@ethersproject-xdc/properties" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-wallet-5.6.0-6ddc52d1-d7d8-448c-8495-458d8fbc1c99-1716297675940/node_modules/@ethersproject-xdc/properties" + "@ethersproject-xdc/random" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-wallet-5.6.0-6ddc52d1-d7d8-448c-8495-458d8fbc1c99-1716297675940/node_modules/@ethersproject-xdc/random" + "@ethersproject-xdc/signing-key" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-wallet-5.6.0-6ddc52d1-d7d8-448c-8495-458d8fbc1c99-1716297675940/node_modules/@ethersproject-xdc/signing-key" + "@ethersproject-xdc/transactions" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-wallet-5.6.0-6ddc52d1-d7d8-448c-8495-458d8fbc1c99-1716297675940/node_modules/@ethersproject-xdc/transactions" + "@ethersproject-xdc/wordlists" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-wallet-5.6.0-6ddc52d1-d7d8-448c-8495-458d8fbc1c99-1716297675940/node_modules/@ethersproject-xdc/wordlists" "@ethersproject-xdc/web@file:vendor/@ethersproject-xdc/web": version "5.7.1" dependencies: - "@ethersproject-xdc/base64" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-web-5.7.1-9ac39370-4d32-4c38-96c7-4498ea524885-1711378365623/node_modules/@ethersproject-xdc/base64" - "@ethersproject-xdc/bytes" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-web-5.7.1-9ac39370-4d32-4c38-96c7-4498ea524885-1711378365623/node_modules/@ethersproject-xdc/bytes" - "@ethersproject-xdc/logger" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-web-5.7.1-9ac39370-4d32-4c38-96c7-4498ea524885-1711378365623/node_modules/@ethersproject-xdc/logger" - "@ethersproject-xdc/properties" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-web-5.7.1-9ac39370-4d32-4c38-96c7-4498ea524885-1711378365623/node_modules/@ethersproject-xdc/properties" - "@ethersproject-xdc/strings" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-web-5.7.1-9ac39370-4d32-4c38-96c7-4498ea524885-1711378365623/node_modules/@ethersproject-xdc/strings" + "@ethersproject-xdc/base64" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-web-5.7.1-7ed4e428-4212-4f49-811d-eb75182bbea2-1716297675941/node_modules/@ethersproject-xdc/base64" + "@ethersproject-xdc/bytes" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-web-5.7.1-7ed4e428-4212-4f49-811d-eb75182bbea2-1716297675941/node_modules/@ethersproject-xdc/bytes" + "@ethersproject-xdc/logger" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-web-5.7.1-7ed4e428-4212-4f49-811d-eb75182bbea2-1716297675941/node_modules/@ethersproject-xdc/logger" + "@ethersproject-xdc/properties" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-web-5.7.1-7ed4e428-4212-4f49-811d-eb75182bbea2-1716297675941/node_modules/@ethersproject-xdc/properties" + "@ethersproject-xdc/strings" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-web-5.7.1-7ed4e428-4212-4f49-811d-eb75182bbea2-1716297675941/node_modules/@ethersproject-xdc/strings" "@ethersproject-xdc/wordlists@file:vendor/@ethersproject-xdc/wordlists": version "5.7.0" dependencies: - "@ethersproject-xdc/bytes" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-wordlists-5.7.0-eafc2a13-cd67-4bf6-9256-aec79a731277-1711378365623/node_modules/@ethersproject-xdc/bytes" - "@ethersproject-xdc/hash" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-wordlists-5.7.0-eafc2a13-cd67-4bf6-9256-aec79a731277-1711378365623/node_modules/@ethersproject-xdc/hash" - "@ethersproject-xdc/logger" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-wordlists-5.7.0-eafc2a13-cd67-4bf6-9256-aec79a731277-1711378365623/node_modules/@ethersproject-xdc/logger" - "@ethersproject-xdc/properties" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-wordlists-5.7.0-eafc2a13-cd67-4bf6-9256-aec79a731277-1711378365623/node_modules/@ethersproject-xdc/properties" - "@ethersproject-xdc/strings" "file:../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-wordlists-5.7.0-eafc2a13-cd67-4bf6-9256-aec79a731277-1711378365623/node_modules/@ethersproject-xdc/strings" + "@ethersproject-xdc/bytes" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-wordlists-5.7.0-600d3cd3-cfc7-438d-970d-541b8baac753-1716297675941/node_modules/@ethersproject-xdc/bytes" + "@ethersproject-xdc/hash" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-wordlists-5.7.0-600d3cd3-cfc7-438d-970d-541b8baac753-1716297675941/node_modules/@ethersproject-xdc/hash" + "@ethersproject-xdc/logger" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-wordlists-5.7.0-600d3cd3-cfc7-438d-970d-541b8baac753-1716297675941/node_modules/@ethersproject-xdc/logger" + "@ethersproject-xdc/properties" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-wordlists-5.7.0-600d3cd3-cfc7-438d-970d-541b8baac753-1716297675941/node_modules/@ethersproject-xdc/properties" + "@ethersproject-xdc/strings" "file:../../../../Library/Caches/Yarn/v6/npm-@ethersproject-xdc-wordlists-5.7.0-600d3cd3-cfc7-438d-970d-541b8baac753-1716297675941/node_modules/@ethersproject-xdc/strings" "@ethersproject/abi@5.7.0", "@ethersproject/abi@^5.0.12", "@ethersproject/abi@^5.1.2", "@ethersproject/abi@^5.4.0", "@ethersproject/abi@^5.5.0", "@ethersproject/abi@^5.6.3", "@ethersproject/abi@^5.7.0": version "5.7.0" @@ -1919,7 +1945,7 @@ bech32 "1.1.4" ws "7.4.6" -"@ethersproject/providers@5.7.2", "@ethersproject/providers@^5.0.4", "@ethersproject/providers@^5.4.0", "@ethersproject/providers@^5.7.2": +"@ethersproject/providers@5.7.2", "@ethersproject/providers@^5.0.10", "@ethersproject/providers@^5.0.4", "@ethersproject/providers@^5.4.0", "@ethersproject/providers@^5.7.2": version "5.7.2" resolved "https://registry.yarnpkg.com/@ethersproject/providers/-/providers-5.7.2.tgz#f8b1a4f275d7ce58cf0a2eec222269a08beb18cb" integrity sha512-g34EWZ1WWAVgr4aptGlVBF8mhl3VWjv+8hoAnzStu8Ah22VHBsuGzP17eb6xDVRzw895G4W7vvx60lFFur/1Rg== @@ -3263,6 +3289,37 @@ resolved "https://registry.yarnpkg.com/@openzeppelin/contracts/-/contracts-3.4.2-solc-0.7.tgz#38f4dbab672631034076ccdf2f3201fab1726635" integrity sha512-W6QmqgkADuFcTLzHL8vVoNBtkwjvQRpYIAom7KiUNoLKghyx3FgH0GBjt8NRvigV1ZmMOBllvE1By1C+bi8WpA== +"@oraichain/common-contracts-sdk@^1.0.31": + version "1.0.31" + resolved "https://registry.yarnpkg.com/@oraichain/common-contracts-sdk/-/common-contracts-sdk-1.0.31.tgz#595f93b168438d69d64896909b37855c9afc92fb" + integrity sha512-s8H20RXy5gCnu3DnM7L5ClQyj2mdQpbSBpZrXCpIAX9qY0LKsDdZG3sYaDQ8+VN333jz9Pp/qGWdFSYD+6PBsg== + +"@oraichain/oraidex-common@^1.0.86": + version "1.0.86" + resolved "https://registry.yarnpkg.com/@oraichain/oraidex-common/-/oraidex-common-1.0.86.tgz#41ff557609a02f9c61503f92af04b1490908ad2f" + integrity sha512-YzNy3RAXqIuDg4Lw/7yjc9vQJSwtUhqAdO714TgkLETsRD/AakWGyYOPxyV+MZGg6m3s6ujna+1ves0HexPUhg== + dependencies: + "@cosmjs/amino" "0.31.3" + "@cosmjs/cosmwasm-stargate" "0.31.3" + "@cosmjs/crypto" "0.31.3" + "@cosmjs/proto-signing" "0.31.3" + "@cosmjs/stargate" "0.31.3" + "@cosmjs/tendermint-rpc" "0.31.3" + "@ethersproject/providers" "^5.0.10" + "@injectivelabs/sdk-ts" "1.12.1" + "@keplr-wallet/types" "^0.11.38" + "@oraichain/oraidex-contracts-sdk" latest + axios "0.26.1" + axios-extensions "3.1.3" + bignumber.js "^9.1.2" + cosmjs-types "0.8.0" + ethers "^5.0.15" + +"@oraichain/oraidex-contracts-sdk@^1.0.31", "@oraichain/oraidex-contracts-sdk@latest": + version "1.0.44" + resolved "https://registry.yarnpkg.com/@oraichain/oraidex-contracts-sdk/-/oraidex-contracts-sdk-1.0.44.tgz#9ff41ec388dd92ba112c2eef545d11fd6e18c684" + integrity sha512-fMY/QOzO/afPlAVkLGH1bcpJTs6V/URrJju2r4UoE9f5HUWC/6OC6+H5dWuIgq26frp8wjH23mNCQAlmHzji8g== + "@osmonauts/math@^1.11.3": version "1.11.3" resolved "https://registry.yarnpkg.com/@osmonauts/math/-/math-1.11.3.tgz#22b3f60ea4b84e1329661184b28f72eb9b97c8e7" @@ -3274,11 +3331,6 @@ decimal.js-light "^2.5.1" osmojs "^16.8.3" -"@oraichain/oraidex-contracts-sdk@latest": - version "1.0.44" - resolved "https://registry.yarnpkg.com/@oraichain/oraidex-contracts-sdk/-/oraidex-contracts-sdk-1.0.44.tgz#9ff41ec388dd92ba112c2eef545d11fd6e18c684" - integrity sha512-fMY/QOzO/afPlAVkLGH1bcpJTs6V/URrJju2r4UoE9f5HUWC/6OC6+H5dWuIgq26frp8wjH23mNCQAlmHzji8g== - "@pancakeswap-libs/pancake-swap-core@^0.1.0": version "0.1.0" resolved "https://registry.yarnpkg.com/@pancakeswap-libs/pancake-swap-core/-/pancake-swap-core-0.1.0.tgz#6957f1fa02170531a2ffbf95f2c0e145e9d21bc2" @@ -5933,6 +5985,13 @@ axios@0.26.0: dependencies: follow-redirects "^1.14.8" +axios@0.26.1, axios@^0.26.0: + version "0.26.1" + resolved "https://registry.yarnpkg.com/axios/-/axios-0.26.1.tgz#1ede41c51fcf51bbbd6fd43669caaa4f0495aaa9" + integrity sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA== + dependencies: + follow-redirects "^1.14.8" + axios@0.27.2, axios@^0.27.2: version "0.27.2" resolved "https://registry.yarnpkg.com/axios/-/axios-0.27.2.tgz#207658cc8621606e586c85db4b41a750e756d972" @@ -5966,13 +6025,6 @@ axios@^0.21.1, axios@^0.21.2: dependencies: follow-redirects "^1.14.0" -axios@^0.26.0: - version "0.26.1" - resolved "https://registry.yarnpkg.com/axios/-/axios-0.26.1.tgz#1ede41c51fcf51bbbd6fd43669caaa4f0495aaa9" - integrity sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA== - dependencies: - follow-redirects "^1.14.8" - axios@^1.6.0: version "1.6.2" resolved "https://registry.yarnpkg.com/axios/-/axios-1.6.2.tgz#de67d42c755b571d3e698df1b6504cde9b0ee9f2" @@ -6145,7 +6197,7 @@ bignumber.js@9.1.1, bignumber.js@^9.0.0, bignumber.js@^9.0.1, bignumber.js@^9.1. resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-9.1.1.tgz#c4df7dc496bd849d4c9464344c1aa74228b4dac6" integrity sha512-pHm4LsMJ6lzgNGVfZHjMoO8sdoRhOzOH4MLmY65Jg70bpxCKu5iOHNJyfF6OyvYw7t8Fpf35RuzUyqnQsj8Vig== -bignumber.js@9.1.2: +bignumber.js@9.1.2, bignumber.js@^9.1.2: version "9.1.2" resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-9.1.2.tgz#b7c4242259c008903b13707983b5f4bbd31eda0c" integrity sha512-2/mKyZH9K85bzOEfhXDBFZTGd1CTs+5IHpeFQo9luiBG7hghdC851Pj2WAhb6E3R6b9tZj/XKhbg4fum+Kepug== @@ -7155,6 +7207,14 @@ cors@^2.8.1, cors@^2.8.5: object-assign "^4" vary "^1" +cosmjs-types@0.8.0, cosmjs-types@^0.8.0: + version "0.8.0" + resolved "https://registry.yarnpkg.com/cosmjs-types/-/cosmjs-types-0.8.0.tgz#2ed78f3e990f770229726f95f3ef5bf9e2b6859b" + integrity sha512-Q2Mj95Fl0PYMWEhA2LuGEIhipF7mQwd9gTQ85DdP9jjjopeoGaDxvmPa5nakNzsq7FnO1DMTatXTAx6bxMH7Lg== + dependencies: + long "^4.0.0" + protobufjs "~6.11.2" + cosmjs-types@^0.5.2: version "0.5.2" resolved "https://registry.yarnpkg.com/cosmjs-types/-/cosmjs-types-0.5.2.tgz#2d42b354946f330dfb5c90a87fdc2a36f97b965d" @@ -7171,14 +7231,6 @@ 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.yarnpkg.com/cosmjs-types/-/cosmjs-types-0.8.0.tgz#2ed78f3e990f770229726f95f3ef5bf9e2b6859b" - integrity sha512-Q2Mj95Fl0PYMWEhA2LuGEIhipF7mQwd9gTQ85DdP9jjjopeoGaDxvmPa5nakNzsq7FnO1DMTatXTAx6bxMH7Lg== - dependencies: - long "^4.0.0" - protobufjs "~6.11.2" - cosmjs-types@^0.9.0: version "0.9.0" resolved "https://registry.yarnpkg.com/cosmjs-types/-/cosmjs-types-0.9.0.tgz#c3bc482d28c7dfa25d1445093fdb2d9da1f6cfcc" @@ -7606,6 +7658,13 @@ doctrine@^2.1.0: dependencies: esutils "^2.0.2" +doctrine@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-3.0.0.tgz#addebead72a6574db783639dc87a121773973961" + integrity sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w== + dependencies: + esutils "^2.0.2" + dom-walk@^0.1.0: version "0.1.2" resolved "https://registry.yarnpkg.com/dom-walk/-/dom-walk-0.1.2.tgz#0c548bef048f4d1f2a97249002236060daa3fd84" @@ -8328,36 +8387,36 @@ ethereumjs-util@^6.0.0, ethereumjs-util@^6.2.1: "ethers-xdc@file:./vendor/ethers-xdc": version "5.7.2" dependencies: - "@ethersproject-xdc/abi" "file:../Library/Caches/Yarn/v6/npm-ethers-xdc-5.7.2-ba402b8c-f1be-43c1-a0b9-2b2aeab75ab2-1711378365608/node_modules/@ethersproject-xdc/abi" - "@ethersproject-xdc/abstract-provider" "file:../Library/Caches/Yarn/v6/npm-ethers-xdc-5.7.2-ba402b8c-f1be-43c1-a0b9-2b2aeab75ab2-1711378365608/node_modules/@ethersproject-xdc/abstract-provider" - "@ethersproject-xdc/abstract-signer" "file:../Library/Caches/Yarn/v6/npm-ethers-xdc-5.7.2-ba402b8c-f1be-43c1-a0b9-2b2aeab75ab2-1711378365608/node_modules/@ethersproject-xdc/abstract-signer" - "@ethersproject-xdc/address" "file:../Library/Caches/Yarn/v6/npm-ethers-xdc-5.7.2-ba402b8c-f1be-43c1-a0b9-2b2aeab75ab2-1711378365608/node_modules/@ethersproject-xdc/address" - "@ethersproject-xdc/base64" "file:../Library/Caches/Yarn/v6/npm-ethers-xdc-5.7.2-ba402b8c-f1be-43c1-a0b9-2b2aeab75ab2-1711378365608/node_modules/@ethersproject-xdc/base64" - "@ethersproject-xdc/basex" "file:../Library/Caches/Yarn/v6/npm-ethers-xdc-5.7.2-ba402b8c-f1be-43c1-a0b9-2b2aeab75ab2-1711378365608/node_modules/@ethersproject-xdc/basex" - "@ethersproject-xdc/bignumber" "file:../Library/Caches/Yarn/v6/npm-ethers-xdc-5.7.2-ba402b8c-f1be-43c1-a0b9-2b2aeab75ab2-1711378365608/node_modules/@ethersproject-xdc/bignumber" - "@ethersproject-xdc/bytes" "file:../Library/Caches/Yarn/v6/npm-ethers-xdc-5.7.2-ba402b8c-f1be-43c1-a0b9-2b2aeab75ab2-1711378365608/node_modules/@ethersproject-xdc/bytes" - "@ethersproject-xdc/constants" "file:../Library/Caches/Yarn/v6/npm-ethers-xdc-5.7.2-ba402b8c-f1be-43c1-a0b9-2b2aeab75ab2-1711378365608/node_modules/@ethersproject-xdc/constants" - "@ethersproject-xdc/contracts" "file:../Library/Caches/Yarn/v6/npm-ethers-xdc-5.7.2-ba402b8c-f1be-43c1-a0b9-2b2aeab75ab2-1711378365608/node_modules/@ethersproject-xdc/contracts" - "@ethersproject-xdc/hash" "file:../Library/Caches/Yarn/v6/npm-ethers-xdc-5.7.2-ba402b8c-f1be-43c1-a0b9-2b2aeab75ab2-1711378365608/node_modules/@ethersproject-xdc/hash" - "@ethersproject-xdc/hdnode" "file:../Library/Caches/Yarn/v6/npm-ethers-xdc-5.7.2-ba402b8c-f1be-43c1-a0b9-2b2aeab75ab2-1711378365608/node_modules/@ethersproject-xdc/hdnode" - "@ethersproject-xdc/json-wallets" "file:../Library/Caches/Yarn/v6/npm-ethers-xdc-5.7.2-ba402b8c-f1be-43c1-a0b9-2b2aeab75ab2-1711378365608/node_modules/@ethersproject-xdc/json-wallets" - "@ethersproject-xdc/keccak256" "file:../Library/Caches/Yarn/v6/npm-ethers-xdc-5.7.2-ba402b8c-f1be-43c1-a0b9-2b2aeab75ab2-1711378365608/node_modules/@ethersproject-xdc/keccak256" - "@ethersproject-xdc/logger" "file:../Library/Caches/Yarn/v6/npm-ethers-xdc-5.7.2-ba402b8c-f1be-43c1-a0b9-2b2aeab75ab2-1711378365608/node_modules/@ethersproject-xdc/logger" - "@ethersproject-xdc/networks" "file:../Library/Caches/Yarn/v6/npm-ethers-xdc-5.7.2-ba402b8c-f1be-43c1-a0b9-2b2aeab75ab2-1711378365608/node_modules/@ethersproject-xdc/networks" - "@ethersproject-xdc/pbkdf2" "file:../Library/Caches/Yarn/v6/npm-ethers-xdc-5.7.2-ba402b8c-f1be-43c1-a0b9-2b2aeab75ab2-1711378365608/node_modules/@ethersproject-xdc/pbkdf2" - "@ethersproject-xdc/properties" "file:../Library/Caches/Yarn/v6/npm-ethers-xdc-5.7.2-ba402b8c-f1be-43c1-a0b9-2b2aeab75ab2-1711378365608/node_modules/@ethersproject-xdc/properties" - "@ethersproject-xdc/providers" "file:../Library/Caches/Yarn/v6/npm-ethers-xdc-5.7.2-ba402b8c-f1be-43c1-a0b9-2b2aeab75ab2-1711378365608/node_modules/@ethersproject-xdc/providers" - "@ethersproject-xdc/random" "file:../Library/Caches/Yarn/v6/npm-ethers-xdc-5.7.2-ba402b8c-f1be-43c1-a0b9-2b2aeab75ab2-1711378365608/node_modules/@ethersproject-xdc/random" - "@ethersproject-xdc/rlp" "file:../Library/Caches/Yarn/v6/npm-ethers-xdc-5.7.2-ba402b8c-f1be-43c1-a0b9-2b2aeab75ab2-1711378365608/node_modules/@ethersproject-xdc/rlp" - "@ethersproject-xdc/sha2" "file:../Library/Caches/Yarn/v6/npm-ethers-xdc-5.7.2-ba402b8c-f1be-43c1-a0b9-2b2aeab75ab2-1711378365608/node_modules/@ethersproject-xdc/sha2" - "@ethersproject-xdc/signing-key" "file:../Library/Caches/Yarn/v6/npm-ethers-xdc-5.7.2-ba402b8c-f1be-43c1-a0b9-2b2aeab75ab2-1711378365608/node_modules/@ethersproject-xdc/signing-key" - "@ethersproject-xdc/solidity" "file:../Library/Caches/Yarn/v6/npm-ethers-xdc-5.7.2-ba402b8c-f1be-43c1-a0b9-2b2aeab75ab2-1711378365608/node_modules/@ethersproject-xdc/solidity" - "@ethersproject-xdc/strings" "file:../Library/Caches/Yarn/v6/npm-ethers-xdc-5.7.2-ba402b8c-f1be-43c1-a0b9-2b2aeab75ab2-1711378365608/node_modules/@ethersproject-xdc/strings" - "@ethersproject-xdc/transactions" "file:../Library/Caches/Yarn/v6/npm-ethers-xdc-5.7.2-ba402b8c-f1be-43c1-a0b9-2b2aeab75ab2-1711378365608/node_modules/@ethersproject-xdc/transactions" - "@ethersproject-xdc/units" "file:../Library/Caches/Yarn/v6/npm-ethers-xdc-5.7.2-ba402b8c-f1be-43c1-a0b9-2b2aeab75ab2-1711378365608/node_modules/@ethersproject-xdc/units" - "@ethersproject-xdc/wallet" "file:../Library/Caches/Yarn/v6/npm-ethers-xdc-5.7.2-ba402b8c-f1be-43c1-a0b9-2b2aeab75ab2-1711378365608/node_modules/@ethersproject-xdc/wallet" - "@ethersproject-xdc/web" "file:../Library/Caches/Yarn/v6/npm-ethers-xdc-5.7.2-ba402b8c-f1be-43c1-a0b9-2b2aeab75ab2-1711378365608/node_modules/@ethersproject-xdc/web" - "@ethersproject-xdc/wordlists" "file:../Library/Caches/Yarn/v6/npm-ethers-xdc-5.7.2-ba402b8c-f1be-43c1-a0b9-2b2aeab75ab2-1711378365608/node_modules/@ethersproject-xdc/wordlists" + "@ethersproject-xdc/abi" "file:../../../../Library/Caches/Yarn/v6/npm-ethers-xdc-5.7.2-7e2ffb93-73da-4437-aca4-fac37de06fc5-1716297675922/node_modules/@ethersproject-xdc/abi" + "@ethersproject-xdc/abstract-provider" "file:../../../../Library/Caches/Yarn/v6/npm-ethers-xdc-5.7.2-7e2ffb93-73da-4437-aca4-fac37de06fc5-1716297675922/node_modules/@ethersproject-xdc/abstract-provider" + "@ethersproject-xdc/abstract-signer" "file:../../../../Library/Caches/Yarn/v6/npm-ethers-xdc-5.7.2-7e2ffb93-73da-4437-aca4-fac37de06fc5-1716297675922/node_modules/@ethersproject-xdc/abstract-signer" + "@ethersproject-xdc/address" "file:../../../../Library/Caches/Yarn/v6/npm-ethers-xdc-5.7.2-7e2ffb93-73da-4437-aca4-fac37de06fc5-1716297675922/node_modules/@ethersproject-xdc/address" + "@ethersproject-xdc/base64" "file:../../../../Library/Caches/Yarn/v6/npm-ethers-xdc-5.7.2-7e2ffb93-73da-4437-aca4-fac37de06fc5-1716297675922/node_modules/@ethersproject-xdc/base64" + "@ethersproject-xdc/basex" "file:../../../../Library/Caches/Yarn/v6/npm-ethers-xdc-5.7.2-7e2ffb93-73da-4437-aca4-fac37de06fc5-1716297675922/node_modules/@ethersproject-xdc/basex" + "@ethersproject-xdc/bignumber" "file:../../../../Library/Caches/Yarn/v6/npm-ethers-xdc-5.7.2-7e2ffb93-73da-4437-aca4-fac37de06fc5-1716297675922/node_modules/@ethersproject-xdc/bignumber" + "@ethersproject-xdc/bytes" "file:../../../../Library/Caches/Yarn/v6/npm-ethers-xdc-5.7.2-7e2ffb93-73da-4437-aca4-fac37de06fc5-1716297675922/node_modules/@ethersproject-xdc/bytes" + "@ethersproject-xdc/constants" "file:../../../../Library/Caches/Yarn/v6/npm-ethers-xdc-5.7.2-7e2ffb93-73da-4437-aca4-fac37de06fc5-1716297675922/node_modules/@ethersproject-xdc/constants" + "@ethersproject-xdc/contracts" "file:../../../../Library/Caches/Yarn/v6/npm-ethers-xdc-5.7.2-7e2ffb93-73da-4437-aca4-fac37de06fc5-1716297675922/node_modules/@ethersproject-xdc/contracts" + "@ethersproject-xdc/hash" "file:../../../../Library/Caches/Yarn/v6/npm-ethers-xdc-5.7.2-7e2ffb93-73da-4437-aca4-fac37de06fc5-1716297675922/node_modules/@ethersproject-xdc/hash" + "@ethersproject-xdc/hdnode" "file:../../../../Library/Caches/Yarn/v6/npm-ethers-xdc-5.7.2-7e2ffb93-73da-4437-aca4-fac37de06fc5-1716297675922/node_modules/@ethersproject-xdc/hdnode" + "@ethersproject-xdc/json-wallets" "file:../../../../Library/Caches/Yarn/v6/npm-ethers-xdc-5.7.2-7e2ffb93-73da-4437-aca4-fac37de06fc5-1716297675922/node_modules/@ethersproject-xdc/json-wallets" + "@ethersproject-xdc/keccak256" "file:../../../../Library/Caches/Yarn/v6/npm-ethers-xdc-5.7.2-7e2ffb93-73da-4437-aca4-fac37de06fc5-1716297675922/node_modules/@ethersproject-xdc/keccak256" + "@ethersproject-xdc/logger" "file:../../../../Library/Caches/Yarn/v6/npm-ethers-xdc-5.7.2-7e2ffb93-73da-4437-aca4-fac37de06fc5-1716297675922/node_modules/@ethersproject-xdc/logger" + "@ethersproject-xdc/networks" "file:../../../../Library/Caches/Yarn/v6/npm-ethers-xdc-5.7.2-7e2ffb93-73da-4437-aca4-fac37de06fc5-1716297675922/node_modules/@ethersproject-xdc/networks" + "@ethersproject-xdc/pbkdf2" "file:../../../../Library/Caches/Yarn/v6/npm-ethers-xdc-5.7.2-7e2ffb93-73da-4437-aca4-fac37de06fc5-1716297675922/node_modules/@ethersproject-xdc/pbkdf2" + "@ethersproject-xdc/properties" "file:../../../../Library/Caches/Yarn/v6/npm-ethers-xdc-5.7.2-7e2ffb93-73da-4437-aca4-fac37de06fc5-1716297675922/node_modules/@ethersproject-xdc/properties" + "@ethersproject-xdc/providers" "file:../../../../Library/Caches/Yarn/v6/npm-ethers-xdc-5.7.2-7e2ffb93-73da-4437-aca4-fac37de06fc5-1716297675922/node_modules/@ethersproject-xdc/providers" + "@ethersproject-xdc/random" "file:../../../../Library/Caches/Yarn/v6/npm-ethers-xdc-5.7.2-7e2ffb93-73da-4437-aca4-fac37de06fc5-1716297675922/node_modules/@ethersproject-xdc/random" + "@ethersproject-xdc/rlp" "file:../../../../Library/Caches/Yarn/v6/npm-ethers-xdc-5.7.2-7e2ffb93-73da-4437-aca4-fac37de06fc5-1716297675922/node_modules/@ethersproject-xdc/rlp" + "@ethersproject-xdc/sha2" "file:../../../../Library/Caches/Yarn/v6/npm-ethers-xdc-5.7.2-7e2ffb93-73da-4437-aca4-fac37de06fc5-1716297675922/node_modules/@ethersproject-xdc/sha2" + "@ethersproject-xdc/signing-key" "file:../../../../Library/Caches/Yarn/v6/npm-ethers-xdc-5.7.2-7e2ffb93-73da-4437-aca4-fac37de06fc5-1716297675922/node_modules/@ethersproject-xdc/signing-key" + "@ethersproject-xdc/solidity" "file:../../../../Library/Caches/Yarn/v6/npm-ethers-xdc-5.7.2-7e2ffb93-73da-4437-aca4-fac37de06fc5-1716297675922/node_modules/@ethersproject-xdc/solidity" + "@ethersproject-xdc/strings" "file:../../../../Library/Caches/Yarn/v6/npm-ethers-xdc-5.7.2-7e2ffb93-73da-4437-aca4-fac37de06fc5-1716297675922/node_modules/@ethersproject-xdc/strings" + "@ethersproject-xdc/transactions" "file:../../../../Library/Caches/Yarn/v6/npm-ethers-xdc-5.7.2-7e2ffb93-73da-4437-aca4-fac37de06fc5-1716297675922/node_modules/@ethersproject-xdc/transactions" + "@ethersproject-xdc/units" "file:../../../../Library/Caches/Yarn/v6/npm-ethers-xdc-5.7.2-7e2ffb93-73da-4437-aca4-fac37de06fc5-1716297675922/node_modules/@ethersproject-xdc/units" + "@ethersproject-xdc/wallet" "file:../../../../Library/Caches/Yarn/v6/npm-ethers-xdc-5.7.2-7e2ffb93-73da-4437-aca4-fac37de06fc5-1716297675922/node_modules/@ethersproject-xdc/wallet" + "@ethersproject-xdc/web" "file:../../../../Library/Caches/Yarn/v6/npm-ethers-xdc-5.7.2-7e2ffb93-73da-4437-aca4-fac37de06fc5-1716297675922/node_modules/@ethersproject-xdc/web" + "@ethersproject-xdc/wordlists" "file:../../../../Library/Caches/Yarn/v6/npm-ethers-xdc-5.7.2-7e2ffb93-73da-4437-aca4-fac37de06fc5-1716297675922/node_modules/@ethersproject-xdc/wordlists" ethers@4.0.0-beta.3: version "4.0.0-beta.3" @@ -8748,12 +8807,12 @@ fetch-cookie@0.11.0: dependencies: tough-cookie "^2.3.3 || ^3.0.1 || ^4.0.0" -file-entry-cache@^8.0.0: - version "8.0.0" - resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-8.0.0.tgz#7787bddcf1131bffb92636c69457bbc0edd6d81f" - integrity sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ== +file-entry-cache@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-6.0.1.tgz#211b2dd9659cb0394b073e7323ac3c933d522027" + integrity sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg== dependencies: - flat-cache "^4.0.0" + flat-cache "^3.0.4" file-stream-rotator@^0.6.1: version "0.6.1" @@ -8842,13 +8901,14 @@ find-up@^4.0.0, find-up@^4.1.0: locate-path "^5.0.0" path-exists "^4.0.0" -flat-cache@^4.0.0: - version "4.0.1" - resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-4.0.1.tgz#0ece39fcb14ee012f4b0410bd33dd9c1f011127c" - integrity sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw== +flat-cache@^3.0.4: + version "3.2.0" + resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-3.2.0.tgz#2c0c2d5040c99b1632771a9d105725c0115363ee" + integrity sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw== dependencies: flatted "^3.2.9" - keyv "^4.5.4" + keyv "^4.5.3" + rimraf "^3.0.2" flat@^5.0.2: version "5.0.2" @@ -11071,7 +11131,7 @@ keyv@^4.0.0: dependencies: json-buffer "3.0.1" -keyv@^4.5.4: +keyv@^4.5.3: version "4.5.4" resolved "https://registry.yarnpkg.com/keyv/-/keyv-4.5.4.tgz#a879a99e29452f942439f2a405e3af8b31d4de93" integrity sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw== @@ -13978,11 +14038,6 @@ semver@^7.5.3, semver@^7.5.4: dependencies: lru-cache "^6.0.0" -semver@^7.6.0: - version "7.6.1" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.1.tgz#60bfe090bf907a25aa8119a72b9f90ef7ca281b2" - integrity sha512-f/vbBsu+fOiYt+lmwZV0rVwJScl46HppnOA1ZvIuBWKOTlllpyJ3bfVax76/OrhCH38dyxoDIA8K7uB963IYgA== - semver@~7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/semver/-/semver-7.0.0.tgz#5f3ca35761e47e05b206c6daff2cf814f0316b8e" @@ -15110,6 +15165,11 @@ type-detect@4.0.8: resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c" integrity sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g== +type-fest@^0.20.2: + version "0.20.2" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.20.2.tgz#1bf207f4b28f91583666cb5fbd327887301cd5f4" + integrity sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ== + type-fest@^0.21.3: version "0.21.3" resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.21.3.tgz#d260a24b0198436e133fa26a524a6d65fa3b2e37" From 0513a445c1b536fd995286b77fabea3b56d1f5fb Mon Sep 17 00:00:00 2001 From: vuonghuuhung Date: Tue, 21 May 2024 21:27:31 +0700 Subject: [PATCH 23/24] (update) set back node version in dockerfile --- Dockerfile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index e88a3a4309..9182082b16 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Set the base image -FROM node:18.18.0 +FROM node:18.10.0 # WORKDIR /usr/src/app/ WORKDIR /home/gateway @@ -25,7 +25,6 @@ ENV INSTALLATION_TYPE=docker RUN mkdir -p /home/gateway/conf /home/gateway/logs /home/gateway/db /home/gateway/certs # Install dependencies and compile -RUN yarn global add node-gyp RUN yarn install --frozen-lockfile RUN yarn build @@ -33,4 +32,4 @@ RUN yarn build EXPOSE 15888 # Set the default command to run when starting the container -CMD yarn run start +CMD yarn run start \ No newline at end of file From 068130c971f9be3fa8282d16ea04d6f3344a3be9 Mon Sep 17 00:00:00 2001 From: vuonghuuhung Date: Thu, 23 May 2024 15:08:30 +0700 Subject: [PATCH 24/24] (update) lint --- .../chains/oraichain/oraichain.routes.test.ts | 2 +- test/chains/oraichain/oraichain.test.ts | 16 +- test/connectors/oraidex/oraidex.test.ts | 406 +++++++++--------- 3 files changed, 223 insertions(+), 201 deletions(-) diff --git a/test/chains/oraichain/oraichain.routes.test.ts b/test/chains/oraichain/oraichain.routes.test.ts index 5698219506..d1193bc151 100644 --- a/test/chains/oraichain/oraichain.routes.test.ts +++ b/test/chains/oraichain/oraichain.routes.test.ts @@ -7,7 +7,7 @@ let oraichain: Oraichain; beforeAll(async () => { oraichain = Oraichain.getInstance('mainnet'); oraichain.initSigningCosmWasmClient = jest.fn(); - + await oraichain.init(); }); diff --git a/test/chains/oraichain/oraichain.test.ts b/test/chains/oraichain/oraichain.test.ts index e2c04bdbd9..18a331651c 100644 --- a/test/chains/oraichain/oraichain.test.ts +++ b/test/chains/oraichain/oraichain.test.ts @@ -18,7 +18,11 @@ beforeAll(async () => { //get me a default hd path const hdPath = makeCosmoshubPath(0); const seed = await Bip39.mnemonicToSeed(mnemonic); - const masterKey = Slip10.derivePath(Slip10Curve.Secp256k1, seed, hdPath as any); + const masterKey = Slip10.derivePath( + Slip10Curve.Secp256k1, + seed, + hdPath as any, + ); const privateKeyTest = masterKey.privkey; const wallet = await oraichain.getWalletFromPrivateKey( @@ -65,7 +69,7 @@ describe('Getter', () => { const newRequestCount = oraichain.requestCount; expect(requestCount).toEqual(newRequestCount - 1); oraichain.metricLogger(); - expect(requestCount).toEqual(0); + expect(requestCount).toEqual(0); }); it('getMetricsLogInterval', async () => { @@ -91,7 +95,12 @@ describe('Signing client', () => { }); it('should execute single transaction', async () => { - const res = await oraichain.executeContract(account.address, testContract, {}, {}); + const res = await oraichain.executeContract( + account.address, + testContract, + {}, + {}, + ); expect(res).toBeDefined(); }); @@ -100,4 +109,3 @@ describe('Signing client', () => { expect(res).toBeDefined(); }); }); - diff --git a/test/connectors/oraidex/oraidex.test.ts b/test/connectors/oraidex/oraidex.test.ts index db448a58e8..297a3f274f 100644 --- a/test/connectors/oraidex/oraidex.test.ts +++ b/test/connectors/oraidex/oraidex.test.ts @@ -16,178 +16,184 @@ const INVALID_REQUEST = { }; const TX_DATA = { - height: 21620440, - txIndex: 0, - hash: 'AB4256ED72AFDE0EBB42E2204108D87A87D4E68EB974C5B80A1EBC41F5BE3394', - code: 0, - events: [ - { - type: 'coin_spent', - attributes: [ - { - key: 'spender', - value: 'orai1swus8mwu8xjulawqxdwh8hvg4gknh2c64tuc0k' - }, - { key: 'amount', value: '142orai' } - ] - }, - { - type: 'coin_received', - attributes: [ - { - key: 'receiver', - value: 'orai17xpfvakm2amg962yls6f84z3kell8c5lr24r2w' - }, - { key: 'amount', value: '142orai' } - ] - }, - { - type: 'transfer', - attributes: [ - { - key: 'recipient', - value: 'orai17xpfvakm2amg962yls6f84z3kell8c5lr24r2w' - }, - { - key: 'sender', - value: 'orai1swus8mwu8xjulawqxdwh8hvg4gknh2c64tuc0k' - }, - { key: 'amount', value: '142orai' } - ] - }, - { - type: 'message', - attributes: [ - { - key: 'sender', - value: 'orai1swus8mwu8xjulawqxdwh8hvg4gknh2c64tuc0k' - } - ] - }, - { - type: 'tx', - attributes: [ - { key: 'fee', value: '142orai' }, - { - key: 'fee_payer', - value: 'orai1swus8mwu8xjulawqxdwh8hvg4gknh2c64tuc0k' - } - ] - }, - { - type: 'tx', - attributes: [ - { - key: 'acc_seq', - value: 'orai1swus8mwu8xjulawqxdwh8hvg4gknh2c64tuc0k/603' - } - ] - }, - { - type: 'tx', - attributes: [ - { - key: 'signature', - value: '6nxCFp3PiVa62DvMY/xWgYnEBHDW0AhWOhJyWWRKallz5KTfNviOJV37vzPENY44enIrftIont/QyuIk8MB01A==' - } - ] - }, - { - type: 'message', - attributes: [ - { - key: 'action', - value: '/cosmwasm.wasm.v1.MsgExecuteContract' - } - ] - }, - { - type: 'message', - attributes: [ - { key: 'module', value: 'wasm' }, - { - key: 'sender', - value: 'orai1swus8mwu8xjulawqxdwh8hvg4gknh2c64tuc0k' - } - ] - }, - { - type: 'coin_spent', - attributes: [ - { - key: 'spender', - value: 'orai1swus8mwu8xjulawqxdwh8hvg4gknh2c64tuc0k' - }, - { key: 'amount', value: '10000orai' } - ] - }, - { - type: 'coin_received', - attributes: [ - { - key: 'receiver', - value: 'orai1nt58gcu4e63v7k55phnr3gaym9tvk3q4apqzqccjuwppgjuyjy6sxk8yzp' - }, - { key: 'amount', value: '10000orai' } - ] - }, - { - type: 'transfer', - attributes: [ - { - key: 'recipient', - value: 'orai1nt58gcu4e63v7k55phnr3gaym9tvk3q4apqzqccjuwppgjuyjy6sxk8yzp' - }, - { - key: 'sender', - value: 'orai1swus8mwu8xjulawqxdwh8hvg4gknh2c64tuc0k' - }, - { key: 'amount', value: '10000orai' } - ] - }, - { - type: 'execute', - attributes: [ - { - key: '_contract_address', - value: 'orai1nt58gcu4e63v7k55phnr3gaym9tvk3q4apqzqccjuwppgjuyjy6sxk8yzp' - } - ] - }, - { - type: 'wasm', - attributes: [ - { - key: '_contract_address', - value: 'orai1nt58gcu4e63v7k55phnr3gaym9tvk3q4apqzqccjuwppgjuyjy6sxk8yzp' - }, - { key: 'action', value: 'submit_order' }, - { key: 'order_type', value: 'limit' }, - { - key: 'pair', - value: 'orai - orai12hzjxfh77wl572gdzct2fxv2arxcwh6gykc7qh' - }, - { key: 'order_id', value: '4214202' }, - { key: 'status', value: 'Open' }, - { key: 'direction', value: 'Sell' }, - { - key: 'bidder_addr', - value: 'orai1swus8mwu8xjulawqxdwh8hvg4gknh2c64tuc0k' - }, - { key: 'offer_asset', value: '10000 orai' }, - { - key: 'ask_asset', - value: '200000 orai12hzjxfh77wl572gdzct2fxv2arxcwh6gykc7qh' - } - ] - } - ], - rawLog: '[{"events":[{"type":"coin_received","attributes":[{"key":"receiver","value":"orai1nt58gcu4e63v7k55phnr3gaym9tvk3q4apqzqccjuwppgjuyjy6sxk8yzp"},{"key":"amount","value":"10000orai"}]},{"type":"coin_spent","attributes":[{"key":"spender","value":"orai1swus8mwu8xjulawqxdwh8hvg4gknh2c64tuc0k"},{"key":"amount","value":"10000orai"}]},{"type":"execute","attributes":[{"key":"_contract_address","value":"orai1nt58gcu4e63v7k55phnr3gaym9tvk3q4apqzqccjuwppgjuyjy6sxk8yzp"}]},{"type":"message","attributes":[{"key":"action","value":"/cosmwasm.wasm.v1.MsgExecuteContract"},{"key":"module","value":"wasm"},{"key":"sender","value":"orai1swus8mwu8xjulawqxdwh8hvg4gknh2c64tuc0k"}]},{"type":"transfer","attributes":[{"key":"recipient","value":"orai1nt58gcu4e63v7k55phnr3gaym9tvk3q4apqzqccjuwppgjuyjy6sxk8yzp"},{"key":"sender","value":"orai1swus8mwu8xjulawqxdwh8hvg4gknh2c64tuc0k"},{"key":"amount","value":"10000orai"}]},{"type":"wasm","attributes":[{"key":"_contract_address","value":"orai1nt58gcu4e63v7k55phnr3gaym9tvk3q4apqzqccjuwppgjuyjy6sxk8yzp"},{"key":"action","value":"submit_order"},{"key":"order_type","value":"limit"},{"key":"pair","value":"orai - orai12hzjxfh77wl572gdzct2fxv2arxcwh6gykc7qh"},{"key":"order_id","value":"4214202"},{"key":"status","value":"Open"},{"key":"direction","value":"Sell"},{"key":"bidder_addr","value":"orai1swus8mwu8xjulawqxdwh8hvg4gknh2c64tuc0k"},{"key":"offer_asset","value":"10000 orai"},{"key":"ask_asset","value":"200000 orai12hzjxfh77wl572gdzct2fxv2arxcwh6gykc7qh"}]}]}]', - tx: new Uint8Array(4)[1], - msgResponses: [], - gasUsed: 115207, - gasWanted: 141511 - } + height: 21620440, + txIndex: 0, + hash: 'AB4256ED72AFDE0EBB42E2204108D87A87D4E68EB974C5B80A1EBC41F5BE3394', + code: 0, + events: [ + { + type: 'coin_spent', + attributes: [ + { + key: 'spender', + value: 'orai1swus8mwu8xjulawqxdwh8hvg4gknh2c64tuc0k', + }, + { key: 'amount', value: '142orai' }, + ], + }, + { + type: 'coin_received', + attributes: [ + { + key: 'receiver', + value: 'orai17xpfvakm2amg962yls6f84z3kell8c5lr24r2w', + }, + { key: 'amount', value: '142orai' }, + ], + }, + { + type: 'transfer', + attributes: [ + { + key: 'recipient', + value: 'orai17xpfvakm2amg962yls6f84z3kell8c5lr24r2w', + }, + { + key: 'sender', + value: 'orai1swus8mwu8xjulawqxdwh8hvg4gknh2c64tuc0k', + }, + { key: 'amount', value: '142orai' }, + ], + }, + { + type: 'message', + attributes: [ + { + key: 'sender', + value: 'orai1swus8mwu8xjulawqxdwh8hvg4gknh2c64tuc0k', + }, + ], + }, + { + type: 'tx', + attributes: [ + { key: 'fee', value: '142orai' }, + { + key: 'fee_payer', + value: 'orai1swus8mwu8xjulawqxdwh8hvg4gknh2c64tuc0k', + }, + ], + }, + { + type: 'tx', + attributes: [ + { + key: 'acc_seq', + value: 'orai1swus8mwu8xjulawqxdwh8hvg4gknh2c64tuc0k/603', + }, + ], + }, + { + type: 'tx', + attributes: [ + { + key: 'signature', + value: + '6nxCFp3PiVa62DvMY/xWgYnEBHDW0AhWOhJyWWRKallz5KTfNviOJV37vzPENY44enIrftIont/QyuIk8MB01A==', + }, + ], + }, + { + type: 'message', + attributes: [ + { + key: 'action', + value: '/cosmwasm.wasm.v1.MsgExecuteContract', + }, + ], + }, + { + type: 'message', + attributes: [ + { key: 'module', value: 'wasm' }, + { + key: 'sender', + value: 'orai1swus8mwu8xjulawqxdwh8hvg4gknh2c64tuc0k', + }, + ], + }, + { + type: 'coin_spent', + attributes: [ + { + key: 'spender', + value: 'orai1swus8mwu8xjulawqxdwh8hvg4gknh2c64tuc0k', + }, + { key: 'amount', value: '10000orai' }, + ], + }, + { + type: 'coin_received', + attributes: [ + { + key: 'receiver', + value: + 'orai1nt58gcu4e63v7k55phnr3gaym9tvk3q4apqzqccjuwppgjuyjy6sxk8yzp', + }, + { key: 'amount', value: '10000orai' }, + ], + }, + { + type: 'transfer', + attributes: [ + { + key: 'recipient', + value: + 'orai1nt58gcu4e63v7k55phnr3gaym9tvk3q4apqzqccjuwppgjuyjy6sxk8yzp', + }, + { + key: 'sender', + value: 'orai1swus8mwu8xjulawqxdwh8hvg4gknh2c64tuc0k', + }, + { key: 'amount', value: '10000orai' }, + ], + }, + { + type: 'execute', + attributes: [ + { + key: '_contract_address', + value: + 'orai1nt58gcu4e63v7k55phnr3gaym9tvk3q4apqzqccjuwppgjuyjy6sxk8yzp', + }, + ], + }, + { + type: 'wasm', + attributes: [ + { + key: '_contract_address', + value: + 'orai1nt58gcu4e63v7k55phnr3gaym9tvk3q4apqzqccjuwppgjuyjy6sxk8yzp', + }, + { key: 'action', value: 'submit_order' }, + { key: 'order_type', value: 'limit' }, + { + key: 'pair', + value: 'orai - orai12hzjxfh77wl572gdzct2fxv2arxcwh6gykc7qh', + }, + { key: 'order_id', value: '4214202' }, + { key: 'status', value: 'Open' }, + { key: 'direction', value: 'Sell' }, + { + key: 'bidder_addr', + value: 'orai1swus8mwu8xjulawqxdwh8hvg4gknh2c64tuc0k', + }, + { key: 'offer_asset', value: '10000 orai' }, + { + key: 'ask_asset', + value: '200000 orai12hzjxfh77wl572gdzct2fxv2arxcwh6gykc7qh', + }, + ], + }, + ], + rawLog: + '[{"events":[{"type":"coin_received","attributes":[{"key":"receiver","value":"orai1nt58gcu4e63v7k55phnr3gaym9tvk3q4apqzqccjuwppgjuyjy6sxk8yzp"},{"key":"amount","value":"10000orai"}]},{"type":"coin_spent","attributes":[{"key":"spender","value":"orai1swus8mwu8xjulawqxdwh8hvg4gknh2c64tuc0k"},{"key":"amount","value":"10000orai"}]},{"type":"execute","attributes":[{"key":"_contract_address","value":"orai1nt58gcu4e63v7k55phnr3gaym9tvk3q4apqzqccjuwppgjuyjy6sxk8yzp"}]},{"type":"message","attributes":[{"key":"action","value":"/cosmwasm.wasm.v1.MsgExecuteContract"},{"key":"module","value":"wasm"},{"key":"sender","value":"orai1swus8mwu8xjulawqxdwh8hvg4gknh2c64tuc0k"}]},{"type":"transfer","attributes":[{"key":"recipient","value":"orai1nt58gcu4e63v7k55phnr3gaym9tvk3q4apqzqccjuwppgjuyjy6sxk8yzp"},{"key":"sender","value":"orai1swus8mwu8xjulawqxdwh8hvg4gknh2c64tuc0k"},{"key":"amount","value":"10000orai"}]},{"type":"wasm","attributes":[{"key":"_contract_address","value":"orai1nt58gcu4e63v7k55phnr3gaym9tvk3q4apqzqccjuwppgjuyjy6sxk8yzp"},{"key":"action","value":"submit_order"},{"key":"order_type","value":"limit"},{"key":"pair","value":"orai - orai12hzjxfh77wl572gdzct2fxv2arxcwh6gykc7qh"},{"key":"order_id","value":"4214202"},{"key":"status","value":"Open"},{"key":"direction","value":"Sell"},{"key":"bidder_addr","value":"orai1swus8mwu8xjulawqxdwh8hvg4gknh2c64tuc0k"},{"key":"offer_asset","value":"10000 orai"},{"key":"ask_asset","value":"200000 orai12hzjxfh77wl572gdzct2fxv2arxcwh6gykc7qh"}]}]}]', + tx: new Uint8Array(4)[1], + msgResponses: [], + gasUsed: 115207, + gasWanted: 141511, +}; beforeAll(async () => { oraichain = Oraichain.getInstance('mainnet'); @@ -292,11 +298,11 @@ describe('GET /clob/orders', () => { it('should return 200', async () => { oraiDex.getAllOrders = jest.fn().mockReturnValue({ - orders: [ - { - order_id: '123456' - } - ] + orders: [ + { + order_id: '123456', + }, + ], }); await request(gatewayApp) .get(`/clob/orders`) @@ -324,7 +330,9 @@ describe('GET /clob/orders', () => { describe('POST /clob/orders', () => { it('should return 200 with proper request', async () => { - oraichain.executeContract = jest.fn().mockResolvedValue({ transactionHash: TX_HASH }); + oraichain.executeContract = jest + .fn() + .mockResolvedValue({ transactionHash: TX_HASH }); oraichain.cosmwasmClient.getTx = jest.fn().mockResolvedValue(TX_DATA); await request(gatewayApp) .post(`/clob/orders`) @@ -347,7 +355,9 @@ describe('POST /clob/orders', () => { }); it('should return 200 with proper request', async () => { - oraichain.executeContract = jest.fn().mockResolvedValue({ transactionHash: TX_HASH }); + oraichain.executeContract = jest + .fn() + .mockResolvedValue({ transactionHash: TX_HASH }); oraichain.cosmwasmClient.getTx = jest.fn().mockResolvedValue(TX_DATA); await request(gatewayApp) .post(`/clob/orders`) @@ -379,7 +389,9 @@ describe('POST /clob/orders', () => { describe('DELETE /clob/orders', () => { it('should return 200 with proper request', async () => { - oraichain.executeContract = jest.fn().mockResolvedValue({ transactionHash: TX_HASH }); + oraichain.executeContract = jest + .fn() + .mockResolvedValue({ transactionHash: TX_HASH }); await request(gatewayApp) .delete(`/clob/orders`) .send({ @@ -406,7 +418,9 @@ describe('DELETE /clob/orders', () => { describe('POST /clob/batchOrders', () => { it('should return 200 with proper request to create batch orders', async () => { - oraichain.executeContractMultiple = jest.fn().mockResolvedValue({ transactionHash: TX_HASH }); + oraichain.executeContractMultiple = jest + .fn() + .mockResolvedValue({ transactionHash: TX_HASH }); oraichain.cosmwasmClient.getTx = jest.fn().mockResolvedValue(TX_DATA); await request(gatewayApp) .post(`/clob/batchOrders`) @@ -439,7 +453,9 @@ describe('POST /clob/batchOrders', () => { }); it('should return 200 with proper request to delete batch orders', async () => { - oraichain.executeContractMultiple = jest.fn().mockResolvedValue({ transactionHash: TX_HASH }); + oraichain.executeContractMultiple = jest + .fn() + .mockResolvedValue({ transactionHash: TX_HASH }); await request(gatewayApp) .post(`/clob/batchOrders`) .send({ @@ -495,20 +511,18 @@ describe('GET /clob/estimateGas', () => { }); describe('others', () => { - it('getConnectedInstances', async () => { - const instances = OraidexCLOB.getConnectedInstances(); - expect(instances).toBeDefined(); - }); + it('getConnectedInstances', async () => { + const instances = OraidexCLOB.getConnectedInstances(); + expect(instances).toBeDefined(); + }); - it('markets', async () => { - const markets = await oraiDex.markets({ - chain: 'oraichain', - network: 'mainnet', - connector: 'oraidex', - market: 'ORAI-USDT', - }); - expect(markets).toBeDefined(); + it('markets', async () => { + const markets = await oraiDex.markets({ + chain: 'oraichain', + network: 'mainnet', + connector: 'oraidex', + market: 'ORAI-USDT', }); - - + expect(markets).toBeDefined(); + }); });