From f4f2d0ba3c2f807e470571ed8f9dc456d23ed8c5 Mon Sep 17 00:00:00 2001 From: Mikhail Gladchenko Date: Tue, 16 Jan 2024 08:30:44 +0000 Subject: [PATCH 01/26] feat: added chains for old SDK for OB --- package.json | 2 +- src/config/chains.json | 41 ++++++++++--- src/config/envs.json | 105 ++++++++++++++++++++++++++++++++++ src/constants/chains.ts | 2 + src/constants/networkCodes.ts | 2 +- src/types.ts | 21 +++++-- 6 files changed, 159 insertions(+), 14 deletions(-) diff --git a/package.json b/package.json index 6f7421eb..74f16d3c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@orionprotocol/sdk", - "version": "0.19.92-rc105", + "version": "0.19.92-rc106", "description": "Orion Protocol SDK", "main": "./lib/index.cjs", "module": "./lib/index.js", diff --git a/src/config/chains.json b/src/config/chains.json index 33b77242..ea887a81 100644 --- a/src/config/chains.json +++ b/src/config/chains.json @@ -18,7 +18,7 @@ "label": "BNB Chain", "shortName": "BSC", "code": "bsc", - "rpc": "https://bsc-dataseed.binance.org/", + "rpc": "https://bsc-dataseed.bnbchain.org/", "baseCurrencyName": "BNB", "contracts": { "WETH": "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", @@ -35,7 +35,19 @@ "baseCurrencyName": "BNB", "contracts": { "WETH": "0x23eE96bEaAB62abE126AA192e677c52bB7d274F0", - "curveRegistry": "0x8845b36C3DE93379F468590FFa102D4aF8C49A6c" + "curveRegistry": "0x93461072c00b2740c474a3d52c70be6249c802d8" + } + }, + "204": { + "chainId": "204", + "explorer": "http://opbnbscan.com/", + "label": "opBNB Chain", + "shortName": "opBNB", + "code": "opbnb", + "rpc": "https://opbnb-mainnet-rpc.bnbchain.org", + "baseCurrencyName": "BNB", + "contracts": { + "WETH": "0x4200000000000000000000000000000000000006" } }, "3": { @@ -77,6 +89,19 @@ "curveRegistry": "" } }, + "42161": { + "chainId": "42161", + "explorer": "https://arbiscan.io/", + "label": "Arbitrum", + "shortName": "Arbitrum", + "code": "arb", + "rpc": "https://arb1.arbitrum.io/rpc", + "baseCurrencyName": "ARB", + "contracts": { + "WETH": "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1", + "curveRegistiry": "0x445FE580eF8d70FF569aB36e80c647af338db351" + } + }, "4002": { "chainId": "4002", "explorer": "https://testnet.ftmscan.com/", @@ -99,8 +124,8 @@ "rpc": "https://rpcapi.fantom.network/", "baseCurrencyName": "FTM", "contracts": { - "WETH": "", - "curveRegistry": "" + "WETH": "0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83", + "curveRegistry": "0x0f854EA9F38ceA4B1c2FC79047E9D0134419D5d6" } }, "137": { @@ -112,8 +137,8 @@ "rpc": "https://polygon-rpc.com/", "explorer": "https://polygonscan.com/", "contracts": { - "WETH": "", - "curveRegistry": "" + "WETH": "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270", + "curveRegistry": "0x094d12e5b541784701FD8d65F11fc0598FBC6332" } }, "80001": { @@ -138,7 +163,7 @@ "rpc": "https://exchainrpc.okex.org/", "baseCurrencyName": "OKT", "contracts": { - "WETH": "", + "WETH": "0x843340759bFCa4a3776F401cD2E03fE9bc0d838f", "curveRegistry": "" } }, @@ -161,7 +186,7 @@ "shortName": "DRIP Chain", "code": "drip", "baseCurrencyName": "DRIP", - "rpc": "testnet.1d.rip", + "rpc": "https://testnet.1d.rip/", "explorer": "https://explorer-testnet.1d.rip/", "contracts": { "WETH": "", diff --git a/src/config/envs.json b/src/config/envs.json index 1c193bfb..86725166 100644 --- a/src/config/envs.json +++ b/src/config/envs.json @@ -15,6 +15,9 @@ }, "priceFeed": { "all": "/price-feed" + }, + "indexer": { + "http": "/orion-indexer/" } }, "liquidityMigratorAddress": "0x23a1820a47BcD022E29f6058a5FD224242F50D1A" @@ -31,6 +34,9 @@ }, "priceFeed": { "all": "/price-feed" + }, + "indexer": { + "http": "/orion-indexer/" } } }, @@ -46,6 +52,9 @@ }, "priceFeed": { "all": "/price-feed" + }, + "indexer": { + "http": "/orion-indexer/" } } }, @@ -61,6 +70,9 @@ }, "priceFeed": { "all": "/price-feed" + }, + "indexer": { + "http": "/orion-indexer/" } } }, @@ -76,6 +88,45 @@ }, "priceFeed": { "all": "/price-feed" + }, + "indexer": { + "http": "/orion-indexer/" + } + } + }, + "42161": { + "api": "https://trade.orion.xyz/arbitrum-mainnet", + "services": { + "aggregator": { + "http": "/backend", + "ws": "/v1" + }, + "blockchain": { + "http": "" + }, + "priceFeed": { + "all": "/price-feed" + }, + "indexer": { + "http": "/orion-indexer/" + } + } + }, + "204": { + "api": "https://trade.orion.xyz/opbnb-mainnet", + "services": { + "aggregator": { + "http": "/backend", + "ws": "/v1" + }, + "blockchain": { + "http": "" + }, + "priceFeed": { + "all": "/price-feed" + }, + "indexer": { + "http": "/orion-indexer/" } } } @@ -97,6 +148,9 @@ }, "priceFeed": { "all": "/price-feed" + }, + "indexer": { + "http": "/orion-indexer/" } }, "liquidityMigratorAddress": "0x01b10dds12478C88A5E18e2707E729906bC25CfF6" @@ -113,6 +167,9 @@ }, "priceFeed": { "all": "/price-feed" + }, + "indexer": { + "http": "/orion-indexer/" } } }, @@ -128,6 +185,9 @@ }, "priceFeed": { "all": "/price-feed" + }, + "indexer": { + "http": "/orion-indexer/" } } }, @@ -143,6 +203,9 @@ }, "priceFeed": { "all": "/price-feed" + }, + "indexer": { + "http": "/orion-indexer/" } } }, @@ -158,6 +221,9 @@ }, "priceFeed": { "all": "/price-feed" + }, + "indexer": { + "http": "/orion-indexer/" } } }, @@ -173,6 +239,9 @@ }, "priceFeed": { "all": "/price-feed" + }, + "indexer": { + "http": "/orion-indexer/" } } } @@ -194,6 +263,9 @@ }, "priceFeed": { "all": "/price-feed" + }, + "indexer": { + "http": "/orion-indexer/" } } }, @@ -209,6 +281,9 @@ }, "priceFeed": { "all": "/price-feed" + }, + "indexer": { + "http": "/orion-indexer/" } } }, @@ -224,6 +299,9 @@ }, "priceFeed": { "all": "/price-feed" + }, + "indexer": { + "http": "/orion-indexer/" } } }, @@ -239,6 +317,9 @@ }, "priceFeed": { "all": "/price-feed" + }, + "indexer": { + "http": "/orion-indexer/" } } }, @@ -254,6 +335,9 @@ }, "priceFeed": { "all": "/price-feed" + }, + "indexer": { + "http": "/orion-indexer/" } } } @@ -275,6 +359,9 @@ }, "priceFeed": { "all": "/price-feed" + }, + "indexer": { + "http": "/orion-indexer/" } } }, @@ -290,6 +377,9 @@ }, "priceFeed": { "all": "/price-feed" + }, + "indexer": { + "http": "/orion-indexer/" } } } @@ -311,6 +401,9 @@ }, "priceFeed": { "all": "/price-feed" + }, + "indexer": { + "http": "/orion-indexer/" } }, "liquidityMigratorAddress": "0x23a1820a47BcD022E29f6058a5FD224242F50D1A" @@ -327,6 +420,9 @@ }, "priceFeed": { "all": "/price-feed" + }, + "indexer": { + "http": "/orion-indexer/" } } }, @@ -342,6 +438,9 @@ }, "priceFeed": { "all": "/price-feed" + }, + "indexer": { + "http": "/orion-indexer/" } } }, @@ -357,6 +456,9 @@ }, "priceFeed": { "all": "/price-feed" + }, + "indexer": { + "http": "/orion-indexer/" } } }, @@ -372,6 +474,9 @@ }, "priceFeed": { "all": "/price-feed" + }, + "indexer": { + "http": "/orion-indexer/" } } } diff --git a/src/constants/chains.ts b/src/constants/chains.ts index 790a42da..74135ed4 100644 --- a/src/constants/chains.ts +++ b/src/constants/chains.ts @@ -15,4 +15,6 @@ export const productionChains = [ SupportedChainId.FANTOM_OPERA, SupportedChainId.POLYGON, SupportedChainId.OKC, + SupportedChainId.ARBITRUM, + SupportedChainId.OPBNB, ]; diff --git a/src/constants/networkCodes.ts b/src/constants/networkCodes.ts index 75fe8ee4..d04ac04d 100644 --- a/src/constants/networkCodes.ts +++ b/src/constants/networkCodes.ts @@ -1 +1 @@ -export default ['ftm', 'bsc', 'eth', 'polygon', 'okc', 'arb', 'drip'] as const; +export default ['ftm', 'bsc', 'eth', 'polygon', 'okc', 'arb', 'drip', 'opbnb'] as const; diff --git a/src/types.ts b/src/types.ts index 6f3afc4a..46852764 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,5 +1,5 @@ /* eslint-disable @typescript-eslint/consistent-type-definitions */ -import factories from './constants/factories.js'; +import type factories from './constants/factories.js'; import type { BigNumber } from 'bignumber.js'; import type subOrderStatuses from './constants/subOrderStatuses.js'; import type positionStatuses from './constants/positionStatuses.js'; @@ -48,7 +48,6 @@ export type Order = { nonce: number // uint64 expiration: number // uint64 buySide: 0 | 1 // uint8, 1=buy, 0=sell - isPersonalSign: boolean // bool } export type SignedOrder = { @@ -60,7 +59,6 @@ export type SignedOrder = { export type CancelOrderRequest = { id: number | string senderAddress: string - isPersonalSign: boolean } export type SignedCancelOrderRequest = { @@ -85,10 +83,11 @@ export enum SupportedChainId { MAINNET = '1', ROPSTEN = '3', GOERLI = '5', - ARBITRUM_GOERLI = '421613', + ARBITRUM = '42161', FANTOM_OPERA = '250', POLYGON = '137', OKC = '66', + OPBNB = '204', POLYGON_TESTNET = '80001', FANTOM_TESTNET = '4002', @@ -96,6 +95,7 @@ export enum SupportedChainId { BSC_TESTNET = '97', OKC_TESTNET = '65', DRIP_TESTNET = '56303', + ARBITRUM_GOERLI = '421613', // For testing and debug purpose // BROKEN = '0', @@ -199,6 +199,13 @@ export type SwapInfoBase = { } | undefined alternatives: SwapInfoAlternative[] assetsNameMapping?: Partial> | undefined + usdInfo: { + availableAmountIn: number | undefined + availableAmountOut: number | undefined + marketAmountOut: number | undefined + marketAmountIn: number | undefined + difference: string | undefined + } | undefined } export type SwapInfoByAmountIn = SwapInfoBase & { @@ -255,6 +262,12 @@ export type VerboseUnitConfig = { // http://10.23.5.11:3003/, // https://price-feed:3003/ } + indexer: { + api: string + // For example: + // http://localhost:3004/, + // http:// + } } basicAuth?: BasicAuthCredentials } From 669a6849e75e85116202e45b575837aa921be3fc Mon Sep 17 00:00:00 2001 From: Mikhail Gladchenko Date: Tue, 16 Jan 2024 08:43:48 +0000 Subject: [PATCH 02/26] bug: fixed type bug --- src/types.ts | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/src/types.ts b/src/types.ts index 46852764..ec072e7a 100644 --- a/src/types.ts +++ b/src/types.ts @@ -48,6 +48,7 @@ export type Order = { nonce: number // uint64 expiration: number // uint64 buySide: 0 | 1 // uint8, 1=buy, 0=sell + isPersonalSign: boolean // bool } export type SignedOrder = { @@ -59,6 +60,7 @@ export type SignedOrder = { export type CancelOrderRequest = { id: number | string senderAddress: string + isPersonalSign: boolean } export type SignedCancelOrderRequest = { @@ -199,13 +201,6 @@ export type SwapInfoBase = { } | undefined alternatives: SwapInfoAlternative[] assetsNameMapping?: Partial> | undefined - usdInfo: { - availableAmountIn: number | undefined - availableAmountOut: number | undefined - marketAmountOut: number | undefined - marketAmountIn: number | undefined - difference: string | undefined - } | undefined } export type SwapInfoByAmountIn = SwapInfoBase & { @@ -262,12 +257,6 @@ export type VerboseUnitConfig = { // http://10.23.5.11:3003/, // https://price-feed:3003/ } - indexer: { - api: string - // For example: - // http://localhost:3004/, - // http:// - } } basicAuth?: BasicAuthCredentials } From 0dc8bfbbfa371401da9c85e8d1beab16f20e8678 Mon Sep 17 00:00:00 2001 From: Mikhail Gladchenko Date: Wed, 24 Jan 2024 08:03:10 +0000 Subject: [PATCH 03/26] feat: updated staging networks in envs.json --- package.json | 2 +- src/config/envs.json | 39 +++++++++++++++++++++++++++++++++++++-- 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 74f16d3c..503efffc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@orionprotocol/sdk", - "version": "0.19.92-rc106", + "version": "0.19.92-rc107", "description": "Orion Protocol SDK", "main": "./lib/index.cjs", "module": "./lib/index.js", diff --git a/src/config/envs.json b/src/config/envs.json index 86725166..8d046c44 100644 --- a/src/config/envs.json +++ b/src/config/envs.json @@ -95,7 +95,7 @@ } }, "42161": { - "api": "https://trade.orion.xyz/arbitrum-mainnet", + "api": "https://trade.orion.xyz/arbitrum-one", "services": { "aggregator": { "http": "/backend", @@ -340,7 +340,42 @@ "http": "/orion-indexer/" } } - } + }, + "42161": { + "api": "https://staging.orion.xyz/arbitrum-one", + "services": { + "aggregator": { + "http": "/backend", + "ws": "/v1" + }, + "blockchain": { + "http": "" + }, + "priceFeed": { + "all": "/price-feed" + }, + "indexer": { + "http": "/orion-indexer/" + } + } + }, + "204": { + "api": "https://staging.orion.xyz/opbnb-mainnet", + "services": { + "aggregator": { + "http": "/backend", + "ws": "/v1" + }, + "blockchain": { + "http": "" + }, + "priceFeed": { + "all": "/price-feed" + }, + "indexer": { + "http": "/orion-indexer/" + } + } } }, "experimental": { From 6506fc1ee52ea5112f8c4a3a96bfbc7dafb0494e Mon Sep 17 00:00:00 2001 From: Mikhail Gladchenko Date: Wed, 24 Jan 2024 08:15:03 +0000 Subject: [PATCH 04/26] bug: small bugfix --- src/config/envs.json | 1 + 1 file changed, 1 insertion(+) diff --git a/src/config/envs.json b/src/config/envs.json index 8d046c44..d8ba4d23 100644 --- a/src/config/envs.json +++ b/src/config/envs.json @@ -376,6 +376,7 @@ "http": "/orion-indexer/" } } + } } }, "experimental": { From 6524feca795bb41583d7488e95a3e63f4e4f6cd6 Mon Sep 17 00:00:00 2001 From: Mikhail Gladchenko Date: Wed, 24 Jan 2024 08:24:28 +0000 Subject: [PATCH 05/26] feat: up version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 503efffc..c300d108 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@orionprotocol/sdk", - "version": "0.19.92-rc107", + "version": "0.19.92-rc108", "description": "Orion Protocol SDK", "main": "./lib/index.cjs", "module": "./lib/index.js", From 49d854a6ea02b231e7bde6ff534678e4a1837761 Mon Sep 17 00:00:00 2001 From: Mikhail Gladchenko Date: Wed, 24 Jan 2024 13:22:12 +0000 Subject: [PATCH 06/26] feat: up version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c300d108..1af74a31 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@orionprotocol/sdk", - "version": "0.19.92-rc108", + "version": "0.19.92-rc109", "description": "Orion Protocol SDK", "main": "./lib/index.cjs", "module": "./lib/index.js", From 81340a554bc2486db6d24d9cca836c0338704f43 Mon Sep 17 00:00:00 2001 From: Mikhail Gladchenko Date: Fri, 1 Mar 2024 16:14:29 +0000 Subject: [PATCH 07/26] feat: added Line and inEVM mainnet chains --- package.json | 2 +- src/config/chains.json | 26 +++++++++++++ src/config/envs.json | 72 +++++++++++++++++++++++++++++++++++ src/constants/chains.ts | 2 + src/constants/networkCodes.ts | 2 +- src/types.ts | 2 + 6 files changed, 104 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 1af74a31..18d3bf01 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@orionprotocol/sdk", - "version": "0.19.92-rc109", + "version": "0.19.92-rc110", "description": "Orion Protocol SDK", "main": "./lib/index.cjs", "module": "./lib/index.js", diff --git a/src/config/chains.json b/src/config/chains.json index ea887a81..fbf86a90 100644 --- a/src/config/chains.json +++ b/src/config/chains.json @@ -192,5 +192,31 @@ "WETH": "", "curveRegistry": "" } + }, + "2525": { + "chainId": "2525", + "label": "inEVM", + "shortName": "inEVM", + "code": "inevm", + "baseCurrencyName": "INJ", + "rpc": "https://inevm.calderachain.xyz/http/", + "explorer": "https://explorer.injective.network/", + "contracts": { + "WETH": "0x4C3A213bd5e8c4BD70a8396d6F3C8302571598Cd", + "curveRegistry": "" + } + }, + "59144": { + "chainId": "59144", + "label": "Linea", + "shortName": "Linea", + "code": "linea", + "baseCurrencyName": "ETH", + "rpc": "https://rpc.linea.build/", + "explorer": "https://lineascan.build/", + "contracts": { + "WETH": "0xe5d7c2a44ffddf6b295a15c148167daaaf5cf34f", + "curveRegistry": "" + } } } diff --git a/src/config/envs.json b/src/config/envs.json index d8ba4d23..41094b32 100644 --- a/src/config/envs.json +++ b/src/config/envs.json @@ -129,6 +129,42 @@ "http": "/orion-indexer/" } } + }, + "2525": { + "api": "https://trade.orion.xyz/inevm-mainnet", + "services": { + "aggregator": { + "http": "/backend", + "ws": "/v1" + }, + "blockchain": { + "http": "" + }, + "priceFeed": { + "all": "/price-feed" + }, + "indexer": { + "http": "/orion-indexer/" + } + } + }, + "59144": { + "api": "https://trade.orion.xyz/linea-mainnet", + "services": { + "aggregator": { + "http": "/backend", + "ws": "/v1" + }, + "blockchain": { + "http": "" + }, + "priceFeed": { + "all": "/price-feed" + }, + "indexer": { + "http": "/orion-indexer/" + } + } } } }, @@ -376,6 +412,42 @@ "http": "/orion-indexer/" } } + }, + "2525": { + "api": "https://trade.orion.xyz/inevm-mainnet", + "services": { + "aggregator": { + "http": "/backend", + "ws": "/v1" + }, + "blockchain": { + "http": "" + }, + "priceFeed": { + "all": "/price-feed" + }, + "indexer": { + "http": "/orion-indexer/" + } + } + }, + "59144": { + "api": "https://trade.orion.xyz/linea-mainnet", + "services": { + "aggregator": { + "http": "/backend", + "ws": "/v1" + }, + "blockchain": { + "http": "" + }, + "priceFeed": { + "all": "/price-feed" + }, + "indexer": { + "http": "/orion-indexer/" + } + } } } }, diff --git a/src/constants/chains.ts b/src/constants/chains.ts index 74135ed4..0e0b0251 100644 --- a/src/constants/chains.ts +++ b/src/constants/chains.ts @@ -17,4 +17,6 @@ export const productionChains = [ SupportedChainId.OKC, SupportedChainId.ARBITRUM, SupportedChainId.OPBNB, + SupportedChainId.INEVM, + SupportedChainId.LINEA, ]; diff --git a/src/constants/networkCodes.ts b/src/constants/networkCodes.ts index d04ac04d..74b0d0fa 100644 --- a/src/constants/networkCodes.ts +++ b/src/constants/networkCodes.ts @@ -1 +1 @@ -export default ['ftm', 'bsc', 'eth', 'polygon', 'okc', 'arb', 'drip', 'opbnb'] as const; +export default ['ftm', 'bsc', 'eth', 'polygon', 'okc', 'arb', 'drip', 'opbnb', 'inevm', 'linea'] as const; diff --git a/src/types.ts b/src/types.ts index ec072e7a..375693bd 100644 --- a/src/types.ts +++ b/src/types.ts @@ -90,6 +90,8 @@ export enum SupportedChainId { POLYGON = '137', OKC = '66', OPBNB = '204', + INEVM = '2525', + LINEA = '59144', POLYGON_TESTNET = '80001', FANTOM_TESTNET = '4002', From 2f889155ba4065f3b12a7042914dfe3b1612d867 Mon Sep 17 00:00:00 2001 From: Mikhail Gladchenko Date: Mon, 25 Mar 2024 08:42:58 +0000 Subject: [PATCH 08/26] feat: added new AVAX network --- src/config/chains.json | 13 +++++++++ src/config/envs.json | 36 +++++++++++++++++++++++++ src/constants/chains.ts | 1 + src/constants/networkCodes.ts | 2 +- src/constants/uppercasedNetworkCodes.ts | 2 +- src/types.ts | 1 + 6 files changed, 53 insertions(+), 2 deletions(-) diff --git a/src/config/chains.json b/src/config/chains.json index fbf86a90..09f7c354 100644 --- a/src/config/chains.json +++ b/src/config/chains.json @@ -218,5 +218,18 @@ "WETH": "0xe5d7c2a44ffddf6b295a15c148167daaaf5cf34f", "curveRegistry": "" } + }, + "43114": { + "chainId": "43114", + "label": "Avalanche Network", + "shortName": "Avax", + "code": "avax", + "baseCurrencyName": "AVAX", + "rpc": "https://api.avax.network/ext/bc/C/rpc/", + "explorer": "https://snowtrace.io/", + "contracts": { + "WETH": "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7", + "curveRegistry": "" + } } } diff --git a/src/config/envs.json b/src/config/envs.json index 41094b32..175b9a81 100644 --- a/src/config/envs.json +++ b/src/config/envs.json @@ -165,6 +165,24 @@ "http": "/orion-indexer/" } } + }, + "43114": { + "api": "https://trade.orion.xyz/avax-mainnet", + "services": { + "aggregator": { + "http": "/backend", + "ws": "/v1" + }, + "blockchain": { + "http": "" + }, + "priceFeed": { + "all": "/price-feed" + }, + "indexer": { + "http": "/orion-indexer/" + } + } } } }, @@ -448,6 +466,24 @@ "http": "/orion-indexer/" } } + }, + "43114": { + "api": "https://trade.orion.xyz/avax-mainnet", + "services": { + "aggregator": { + "http": "/backend", + "ws": "/v1" + }, + "blockchain": { + "http": "" + }, + "priceFeed": { + "all": "/price-feed" + }, + "indexer": { + "http": "/orion-indexer/" + } + } } } }, diff --git a/src/constants/chains.ts b/src/constants/chains.ts index 0e0b0251..aac82130 100644 --- a/src/constants/chains.ts +++ b/src/constants/chains.ts @@ -19,4 +19,5 @@ export const productionChains = [ SupportedChainId.OPBNB, SupportedChainId.INEVM, SupportedChainId.LINEA, + SupportedChainId.AVAX, ]; diff --git a/src/constants/networkCodes.ts b/src/constants/networkCodes.ts index 74b0d0fa..c3a5dad8 100644 --- a/src/constants/networkCodes.ts +++ b/src/constants/networkCodes.ts @@ -1 +1 @@ -export default ['ftm', 'bsc', 'eth', 'polygon', 'okc', 'arb', 'drip', 'opbnb', 'inevm', 'linea'] as const; +export default ['ftm', 'bsc', 'eth', 'polygon', 'okc', 'arb', 'drip', 'opbnb', 'inevm', 'linea', 'avax'] as const; diff --git a/src/constants/uppercasedNetworkCodes.ts b/src/constants/uppercasedNetworkCodes.ts index 8dc00e31..6b8e312c 100644 --- a/src/constants/uppercasedNetworkCodes.ts +++ b/src/constants/uppercasedNetworkCodes.ts @@ -1 +1 @@ -export default ['FTM', 'BSC', 'ETH', 'POLYGON', 'OKC', 'ARB'] as const; +export default ['FTM', 'BSC', 'ETH', 'POLYGON', 'OKC', 'ARB', 'OPBNB', 'INEVM', 'LINEA', 'AVAX'] as const; diff --git a/src/types.ts b/src/types.ts index 375693bd..ae2de64b 100644 --- a/src/types.ts +++ b/src/types.ts @@ -92,6 +92,7 @@ export enum SupportedChainId { OPBNB = '204', INEVM = '2525', LINEA = '59144', + AVAX = '43114', POLYGON_TESTNET = '80001', FANTOM_TESTNET = '4002', From 28ac27132f4451e7634deeaed749ccfaf06c3d70 Mon Sep 17 00:00:00 2001 From: Mikhail Gladchenko Date: Mon, 25 Mar 2024 08:43:26 +0000 Subject: [PATCH 09/26] feat: added new AVAX network --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 18d3bf01..f39fe311 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@orionprotocol/sdk", - "version": "0.19.92-rc110", + "version": "0.19.92-rc111", "description": "Orion Protocol SDK", "main": "./lib/index.cjs", "module": "./lib/index.js", From 85fbbd4c9f834e52760309626acf365bdbe8e049 Mon Sep 17 00:00:00 2001 From: Mikhail Gladchenko Date: Mon, 25 Mar 2024 09:28:09 +0000 Subject: [PATCH 10/26] feat: updated api url for AVAX network --- src/config/envs.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/config/envs.json b/src/config/envs.json index 175b9a81..55dcd92b 100644 --- a/src/config/envs.json +++ b/src/config/envs.json @@ -167,7 +167,7 @@ } }, "43114": { - "api": "https://trade.orion.xyz/avax-mainnet", + "api": "https://trade.orion.xyz/avalanche-c-chain", "services": { "aggregator": { "http": "/backend", @@ -468,7 +468,7 @@ } }, "43114": { - "api": "https://trade.orion.xyz/avax-mainnet", + "api": "https://trade.orion.xyz/avalanche-c-chain", "services": { "aggregator": { "http": "/backend", From cbc3cb611e0a25df4312aefc8db6f4671eac78b8 Mon Sep 17 00:00:00 2001 From: Mikhail Gladchenko Date: Mon, 25 Mar 2024 09:32:07 +0000 Subject: [PATCH 11/26] feat: updated api url for AVAX network --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f39fe311..02f8bd83 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@orionprotocol/sdk", - "version": "0.19.92-rc111", + "version": "0.19.92-rc112", "description": "Orion Protocol SDK", "main": "./lib/index.cjs", "module": "./lib/index.js", From 668f958d0755972e7add7e886f5f1bf24b79e72d Mon Sep 17 00:00:00 2001 From: Mikhail Gladchenko Date: Mon, 22 Apr 2024 17:22:50 +0100 Subject: [PATCH 12/26] feat: added new base chain --- package.json | 2 +- src/config/chains.json | 13 ++++++++ src/config/envs.json | 42 +++++++++++++++++++++++-- src/constants/chains.ts | 1 + src/constants/networkCodes.ts | 2 +- src/constants/uppercasedNetworkCodes.ts | 2 +- src/types.ts | 1 + 7 files changed, 57 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 02f8bd83..468fb0c0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@orionprotocol/sdk", - "version": "0.19.92-rc112", + "version": "0.19.92-rc113", "description": "Orion Protocol SDK", "main": "./lib/index.cjs", "module": "./lib/index.js", diff --git a/src/config/chains.json b/src/config/chains.json index 09f7c354..caea817f 100644 --- a/src/config/chains.json +++ b/src/config/chains.json @@ -231,5 +231,18 @@ "WETH": "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7", "curveRegistry": "" } + }, + "8453": { + "chainId": "8453", + "label": "Base", + "shortName": "BASE", + "code": "base", + "baseCurrencyName": "ETH", + "rpc": "https://mainnet.base.org/", + "explorer": "https://basescan.org/", + "contracts": { + "WETH": "0x4200000000000000000000000000000000000006", + "curveRegistry": "" + } } } diff --git a/src/config/envs.json b/src/config/envs.json index 55dcd92b..f413cb94 100644 --- a/src/config/envs.json +++ b/src/config/envs.json @@ -183,6 +183,24 @@ "http": "/orion-indexer/" } } + }, + "8453": { + "api": "https://trade.orion.xyz/base-mainnet", + "services": { + "aggregator": { + "http": "/backend", + "ws": "/v1" + }, + "blockchain": { + "http": "" + }, + "priceFeed": { + "all": "/price-feed" + }, + "indexer": { + "http": "/orion-indexer/" + } + } } } }, @@ -432,7 +450,7 @@ } }, "2525": { - "api": "https://trade.orion.xyz/inevm-mainnet", + "api": "https://staging.orion.xyz/inevm-mainnet", "services": { "aggregator": { "http": "/backend", @@ -450,7 +468,7 @@ } }, "59144": { - "api": "https://trade.orion.xyz/linea-mainnet", + "api": "https://staging.orion.xyz/linea-mainnet", "services": { "aggregator": { "http": "/backend", @@ -468,7 +486,25 @@ } }, "43114": { - "api": "https://trade.orion.xyz/avalanche-c-chain", + "api": "https://staging.orion.xyz/avalanche-c-chain", + "services": { + "aggregator": { + "http": "/backend", + "ws": "/v1" + }, + "blockchain": { + "http": "" + }, + "priceFeed": { + "all": "/price-feed" + }, + "indexer": { + "http": "/orion-indexer/" + } + } + }, + "8453": { + "api": "https://staging.orion.xyz/base-mainnet", "services": { "aggregator": { "http": "/backend", diff --git a/src/constants/chains.ts b/src/constants/chains.ts index aac82130..1fb8ff30 100644 --- a/src/constants/chains.ts +++ b/src/constants/chains.ts @@ -20,4 +20,5 @@ export const productionChains = [ SupportedChainId.INEVM, SupportedChainId.LINEA, SupportedChainId.AVAX, + SupportedChainId.BASE, ]; diff --git a/src/constants/networkCodes.ts b/src/constants/networkCodes.ts index c3a5dad8..498e1490 100644 --- a/src/constants/networkCodes.ts +++ b/src/constants/networkCodes.ts @@ -1 +1 @@ -export default ['ftm', 'bsc', 'eth', 'polygon', 'okc', 'arb', 'drip', 'opbnb', 'inevm', 'linea', 'avax'] as const; +export default ['ftm', 'bsc', 'eth', 'polygon', 'okc', 'arb', 'drip', 'opbnb', 'inevm', 'linea', 'avax', 'base'] as const; diff --git a/src/constants/uppercasedNetworkCodes.ts b/src/constants/uppercasedNetworkCodes.ts index 6b8e312c..e69605f0 100644 --- a/src/constants/uppercasedNetworkCodes.ts +++ b/src/constants/uppercasedNetworkCodes.ts @@ -1 +1 @@ -export default ['FTM', 'BSC', 'ETH', 'POLYGON', 'OKC', 'ARB', 'OPBNB', 'INEVM', 'LINEA', 'AVAX'] as const; +export default ['FTM', 'BSC', 'ETH', 'POLYGON', 'OKC', 'ARB', 'OPBNB', 'INEVM', 'LINEA', 'AVAX', 'BASE'] as const; diff --git a/src/types.ts b/src/types.ts index ae2de64b..9b5d97c0 100644 --- a/src/types.ts +++ b/src/types.ts @@ -93,6 +93,7 @@ export enum SupportedChainId { INEVM = '2525', LINEA = '59144', AVAX = '43114', + BASE = '8453', POLYGON_TESTNET = '80001', FANTOM_TESTNET = '4002', From ab657b06a94a6badc30d8cfaaa9317e4a760e988 Mon Sep 17 00:00:00 2001 From: Mikhail Gladchenko Date: Fri, 17 May 2024 13:09:29 +0100 Subject: [PATCH 13/26] feat: added Sepolia network --- package.json | 2 +- src/config/chains.json | 13 +++++++++++++ src/config/envs.json | 4 ++-- src/constants/chains.ts | 1 + src/types.ts | 5 +++-- 5 files changed, 20 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 468fb0c0..01d4e75c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@orionprotocol/sdk", - "version": "0.19.92-rc113", + "version": "0.19.92-rc114", "description": "Orion Protocol SDK", "main": "./lib/index.cjs", "module": "./lib/index.js", diff --git a/src/config/chains.json b/src/config/chains.json index caea817f..853c7719 100644 --- a/src/config/chains.json +++ b/src/config/chains.json @@ -76,6 +76,19 @@ "curveRegistry": "" } }, + "11155111": { + "chainId": "11155111", + "explorer": "https://sepolia.etherscan.io/", + "label": "Sepolia", + "shortName": "ETH-Sepolia", + "code": "eth", + "rpc": "https://gateway.tenderly.co/public/sepolia", + "baseCurrencyName": "ETH", + "contracts": { + "WETH": "", + "curveRegistry": "" + } + }, "421613": { "chainId": "421613", "explorer": "https://goerli.arbiscan.io/", diff --git a/src/config/envs.json b/src/config/envs.json index f413cb94..e8533db7 100644 --- a/src/config/envs.json +++ b/src/config/envs.json @@ -227,8 +227,8 @@ }, "liquidityMigratorAddress": "0x01b10dds12478C88A5E18e2707E729906bC25CfF6" }, - "5": { - "api": "https://testing.orion.xyz/eth-goerli", + "11155111": { + "api": "https://testing.orion.xyz/eth-sepolia", "services": { "aggregator": { "http": "/backend", diff --git a/src/constants/chains.ts b/src/constants/chains.ts index 1fb8ff30..df0bd2fd 100644 --- a/src/constants/chains.ts +++ b/src/constants/chains.ts @@ -4,6 +4,7 @@ export const developmentChains = [ SupportedChainId.BSC_TESTNET, SupportedChainId.ROPSTEN, SupportedChainId.GOERLI, + SupportedChainId.SEPOLIA, SupportedChainId.ARBITRUM_GOERLI, SupportedChainId.FANTOM_TESTNET, SupportedChainId.POLYGON_TESTNET, diff --git a/src/types.ts b/src/types.ts index 9b5d97c0..ce987c83 100644 --- a/src/types.ts +++ b/src/types.ts @@ -83,8 +83,6 @@ export type Pair = { export enum SupportedChainId { MAINNET = '1', - ROPSTEN = '3', - GOERLI = '5', ARBITRUM = '42161', FANTOM_OPERA = '250', POLYGON = '137', @@ -95,6 +93,9 @@ export enum SupportedChainId { AVAX = '43114', BASE = '8453', + ROPSTEN = '3', + GOERLI = '5', + SEPOLIA = '11155111', POLYGON_TESTNET = '80001', FANTOM_TESTNET = '4002', BSC = '56', From 58bd952d4924dde4709de339e2abe0757e9a3030 Mon Sep 17 00:00:00 2001 From: Slava Startsev Date: Tue, 18 Jun 2024 14:56:43 +0300 Subject: [PATCH 14/26] feat: add event horizon test network --- package.json | 2 +- src/config/chains.json | 13 +++++++++++++ src/config/envs.json | 18 ++++++++++++++++++ src/constants/chains.ts | 1 + src/types.ts | 1 + 5 files changed, 34 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 01d4e75c..cb12005d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@orionprotocol/sdk", - "version": "0.19.92-rc114", + "version": "0.19.92-rc115", "description": "Orion Protocol SDK", "main": "./lib/index.cjs", "module": "./lib/index.js", diff --git a/src/config/chains.json b/src/config/chains.json index 853c7719..dff233a7 100644 --- a/src/config/chains.json +++ b/src/config/chains.json @@ -89,6 +89,19 @@ "curveRegistry": "" } }, + "123420000034": { + "chainId": "123420000034", + "explorer": "https://blockscout-123420000034.raas-testnet.gelato.digital/", + "label": "Event Horizon Testnet", + "shortName": "EH-Testnet", + "code": "eth", + "rpc": "https://rpc-123420000034.raas-testnet.gelato.digital/", + "baseCurrencyName": "ETH", + "contracts": { + "WETH": "0x4200000000000000000000000000000000000006", + "curveRegistry": "" + } + }, "421613": { "chainId": "421613", "explorer": "https://goerli.arbiscan.io/", diff --git a/src/config/envs.json b/src/config/envs.json index e8533db7..d8ad0bb8 100644 --- a/src/config/envs.json +++ b/src/config/envs.json @@ -245,6 +245,24 @@ } } }, + "123420000034": { + "api": "https://testing.orion.xyz/event-horizon", + "services": { + "aggregator": { + "http": "/backend", + "ws": "/v1" + }, + "blockchain": { + "http": "" + }, + "priceFeed": { + "all": "/price-feed" + }, + "indexer": { + "http": "/orion-indexer/" + } + } + }, "421613": { "api": "https://testing.orion.xyz/arbitrum-goerli", "services": { diff --git a/src/constants/chains.ts b/src/constants/chains.ts index df0bd2fd..a17b9167 100644 --- a/src/constants/chains.ts +++ b/src/constants/chains.ts @@ -9,6 +9,7 @@ export const developmentChains = [ SupportedChainId.FANTOM_TESTNET, SupportedChainId.POLYGON_TESTNET, SupportedChainId.OKC_TESTNET, + SupportedChainId.EVENT_HORIZON, ]; export const productionChains = [ SupportedChainId.MAINNET, diff --git a/src/types.ts b/src/types.ts index ce987c83..944ed780 100644 --- a/src/types.ts +++ b/src/types.ts @@ -103,6 +103,7 @@ export enum SupportedChainId { OKC_TESTNET = '65', DRIP_TESTNET = '56303', ARBITRUM_GOERLI = '421613', + EVENT_HORIZON = '123420000034', // For testing and debug purpose // BROKEN = '0', From e5288d2471f5e301db4ccd9342e0de5a5c755d28 Mon Sep 17 00:00:00 2001 From: Slava Startsev Date: Tue, 18 Jun 2024 18:17:00 +0300 Subject: [PATCH 15/26] chore: update EH variable name for tn --- package.json | 2 +- src/constants/chains.ts | 2 +- src/types.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index cb12005d..5ed697db 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@orionprotocol/sdk", - "version": "0.19.92-rc115", + "version": "0.19.92-rc116", "description": "Orion Protocol SDK", "main": "./lib/index.cjs", "module": "./lib/index.js", diff --git a/src/constants/chains.ts b/src/constants/chains.ts index a17b9167..d0211bba 100644 --- a/src/constants/chains.ts +++ b/src/constants/chains.ts @@ -9,7 +9,7 @@ export const developmentChains = [ SupportedChainId.FANTOM_TESTNET, SupportedChainId.POLYGON_TESTNET, SupportedChainId.OKC_TESTNET, - SupportedChainId.EVENT_HORIZON, + SupportedChainId.EVENT_HORIZON_TESTNET, ]; export const productionChains = [ SupportedChainId.MAINNET, diff --git a/src/types.ts b/src/types.ts index 944ed780..9853d73c 100644 --- a/src/types.ts +++ b/src/types.ts @@ -103,7 +103,7 @@ export enum SupportedChainId { OKC_TESTNET = '65', DRIP_TESTNET = '56303', ARBITRUM_GOERLI = '421613', - EVENT_HORIZON = '123420000034', + EVENT_HORIZON_TESTNET = '123420000034', // For testing and debug purpose // BROKEN = '0', From 330778a06d5a1029d998acac8cab42406565dbef Mon Sep 17 00:00:00 2001 From: Slava Startsev Date: Tue, 18 Jun 2024 18:49:32 +0300 Subject: [PATCH 16/26] new event horizon api --- package.json | 2 +- src/config/envs.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 5ed697db..9aee0262 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@orionprotocol/sdk", - "version": "0.19.92-rc116", + "version": "0.19.92-rc117", "description": "Orion Protocol SDK", "main": "./lib/index.cjs", "module": "./lib/index.js", diff --git a/src/config/envs.json b/src/config/envs.json index d8ad0bb8..ba334bcc 100644 --- a/src/config/envs.json +++ b/src/config/envs.json @@ -246,7 +246,7 @@ } }, "123420000034": { - "api": "https://testing.orion.xyz/event-horizon", + "api": "https://testing.orion.xyz/event-horizon-testnet", "services": { "aggregator": { "http": "/backend", From b34fa679d789818e80771387ceb4f839c8a993ea Mon Sep 17 00:00:00 2001 From: Slava Startsev Date: Tue, 13 Aug 2024 12:27:28 +0300 Subject: [PATCH 17/26] feat: add Lumia Testnet network --- package.json | 2 +- src/config/chains.json | 18 ++++---- src/config/envs.json | 58 +------------------------ src/constants/chains.ts | 1 + src/constants/networkCodes.ts | 2 +- src/constants/uppercasedNetworkCodes.ts | 2 +- src/types.ts | 1 + 7 files changed, 16 insertions(+), 68 deletions(-) diff --git a/package.json b/package.json index 9aee0262..70ebf34b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@orionprotocol/sdk", - "version": "0.19.92-rc117", + "version": "0.19.92-rc118", "description": "Orion Protocol SDK", "main": "./lib/index.cjs", "module": "./lib/index.js", diff --git a/src/config/chains.json b/src/config/chains.json index dff233a7..e7c24712 100644 --- a/src/config/chains.json +++ b/src/config/chains.json @@ -102,16 +102,16 @@ "curveRegistry": "" } }, - "421613": { - "chainId": "421613", - "explorer": "https://goerli.arbiscan.io/", - "label": "Arbitrum Goerli", - "shortName": "Arbitrum Goerli", - "code": "arb", - "rpc": "https://goerli-rollup.arbitrum.io/rpc", - "baseCurrencyName": "ETH", + "1952959480": { + "chainId": "1952959480", + "explorer": "https://testnet-explorer.lumia.org/", + "label": "Lumia Testnet", + "shortName": "Lumia Testnet", + "code": "lumia", + "rpc": "https://testnet-rpc.lumia.org", + "baseCurrencyName": "LUMIA", "contracts": { - "WETH": "", + "WETH": "0x1a1aF9C78704D3a0Ab9e031C92E7bd808711A582", "curveRegistry": "" } }, diff --git a/src/config/envs.json b/src/config/envs.json index ba334bcc..d79cfb27 100644 --- a/src/config/envs.json +++ b/src/config/envs.json @@ -263,62 +263,8 @@ } } }, - "421613": { - "api": "https://testing.orion.xyz/arbitrum-goerli", - "services": { - "aggregator": { - "http": "/backend", - "ws": "/v1" - }, - "blockchain": { - "http": "" - }, - "priceFeed": { - "all": "/price-feed" - }, - "indexer": { - "http": "/orion-indexer/" - } - } - }, - "4002": { - "api": "https://testing.orion.xyz/ftm-testnet", - "services": { - "aggregator": { - "http": "/backend", - "ws": "/v1" - }, - "blockchain": { - "http": "" - }, - "priceFeed": { - "all": "/price-feed" - }, - "indexer": { - "http": "/orion-indexer/" - } - } - }, - "80001": { - "api": "https://testing.orion.xyz/polygon-mumbai", - "services": { - "aggregator": { - "http": "/backend", - "ws": "/v1" - }, - "blockchain": { - "http": "" - }, - "priceFeed": { - "all": "/price-feed" - }, - "indexer": { - "http": "/orion-indexer/" - } - } - }, - "56303": { - "api": "https://testing.orion.xyz/drip-testnet", + "1952959480": { + "api": "https://testing.orion.xyz/lumia-testnet", "services": { "aggregator": { "http": "/backend", diff --git a/src/constants/chains.ts b/src/constants/chains.ts index d0211bba..454833a6 100644 --- a/src/constants/chains.ts +++ b/src/constants/chains.ts @@ -10,6 +10,7 @@ export const developmentChains = [ SupportedChainId.POLYGON_TESTNET, SupportedChainId.OKC_TESTNET, SupportedChainId.EVENT_HORIZON_TESTNET, + SupportedChainId.LUMIA_TESTNET, ]; export const productionChains = [ SupportedChainId.MAINNET, diff --git a/src/constants/networkCodes.ts b/src/constants/networkCodes.ts index 498e1490..76e0d932 100644 --- a/src/constants/networkCodes.ts +++ b/src/constants/networkCodes.ts @@ -1 +1 @@ -export default ['ftm', 'bsc', 'eth', 'polygon', 'okc', 'arb', 'drip', 'opbnb', 'inevm', 'linea', 'avax', 'base'] as const; +export default ['ftm', 'bsc', 'eth', 'polygon', 'okc', 'arb', 'drip', 'opbnb', 'inevm', 'linea', 'avax', 'base', 'lumia'] as const; diff --git a/src/constants/uppercasedNetworkCodes.ts b/src/constants/uppercasedNetworkCodes.ts index e69605f0..9c8e9f21 100644 --- a/src/constants/uppercasedNetworkCodes.ts +++ b/src/constants/uppercasedNetworkCodes.ts @@ -1 +1 @@ -export default ['FTM', 'BSC', 'ETH', 'POLYGON', 'OKC', 'ARB', 'OPBNB', 'INEVM', 'LINEA', 'AVAX', 'BASE'] as const; +export default ['FTM', 'BSC', 'ETH', 'POLYGON', 'OKC', 'ARB', 'OPBNB', 'INEVM', 'LINEA', 'AVAX', 'BASE', 'LUMIA'] as const; diff --git a/src/types.ts b/src/types.ts index 9853d73c..40362912 100644 --- a/src/types.ts +++ b/src/types.ts @@ -104,6 +104,7 @@ export enum SupportedChainId { DRIP_TESTNET = '56303', ARBITRUM_GOERLI = '421613', EVENT_HORIZON_TESTNET = '123420000034', + LUMIA_TESTNET = '1952959480', // For testing and debug purpose // BROKEN = '0', From 7cba7c941ac22895b9fd6449d75989752203cfce Mon Sep 17 00:00:00 2001 From: Olga Kanishcheva Date: Wed, 11 Sep 2024 13:51:28 +0400 Subject: [PATCH 18/26] add Lumia mainnet --- src/config/chains.json | 13 +++++++++++++ src/config/envs.json | 18 ++++++++++++++++++ src/constants/chains.ts | 1 + src/types.ts | 1 + 4 files changed, 33 insertions(+) diff --git a/src/config/chains.json b/src/config/chains.json index e7c24712..980a42ae 100644 --- a/src/config/chains.json +++ b/src/config/chains.json @@ -115,6 +115,19 @@ "curveRegistry": "" } }, + "994873017": { + "chainId": "994873017", + "explorer": "https://explorer.lumia.org/", + "label": "Lumia", + "shortName": "Lumia", + "code": "lumia", + "rpc": "https://mainnet-rpc.lumia.org/", + "baseCurrencyName": "LUMIA", + "contracts": { + "WETH": "0x5A77f1443D16ee5761d310e38b62f77f726bC71c", + "curveRegistry": "" + } + }, "42161": { "chainId": "42161", "explorer": "https://arbiscan.io/", diff --git a/src/config/envs.json b/src/config/envs.json index d79cfb27..6b96f32c 100644 --- a/src/config/envs.json +++ b/src/config/envs.json @@ -201,6 +201,24 @@ "http": "/orion-indexer/" } } + }, + "994873017": { + "api": "https://app.electra.trade/lumia-mainnet", + "services": { + "aggregator": { + "http": "/backend", + "ws": "/v1" + }, + "blockchain": { + "http": "" + }, + "priceFeed": { + "all": "/price-feed" + }, + "indexer": { + "http": "/orion-indexer/" + } + } } } }, diff --git a/src/constants/chains.ts b/src/constants/chains.ts index 454833a6..e9fc119c 100644 --- a/src/constants/chains.ts +++ b/src/constants/chains.ts @@ -24,4 +24,5 @@ export const productionChains = [ SupportedChainId.LINEA, SupportedChainId.AVAX, SupportedChainId.BASE, + SupportedChainId.LUMIA, ]; diff --git a/src/types.ts b/src/types.ts index 40362912..e5d6dec9 100644 --- a/src/types.ts +++ b/src/types.ts @@ -92,6 +92,7 @@ export enum SupportedChainId { LINEA = '59144', AVAX = '43114', BASE = '8453', + LUMIA = '994873017', ROPSTEN = '3', GOERLI = '5', From c39a577f8acd231163ee2297ab062fa76927befa Mon Sep 17 00:00:00 2001 From: Olga Kanishcheva Date: Wed, 11 Sep 2024 13:51:34 +0400 Subject: [PATCH 19/26] 0.19.92-rc119 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 66f5474f..663c854e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@orionprotocol/sdk", - "version": "0.19.91", + "version": "0.19.92-rc119", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@orionprotocol/sdk", - "version": "0.19.91", + "version": "0.19.92-rc119", "hasInstallScript": true, "license": "ISC", "dependencies": { diff --git a/package.json b/package.json index 70ebf34b..c55bb0f3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@orionprotocol/sdk", - "version": "0.19.92-rc118", + "version": "0.19.92-rc119", "description": "Orion Protocol SDK", "main": "./lib/index.cjs", "module": "./lib/index.js", From d87a17db6a8daf9219026923b71fa817b1335adf Mon Sep 17 00:00:00 2001 From: Olga Kanishcheva Date: Wed, 11 Sep 2024 15:28:51 +0400 Subject: [PATCH 20/26] change weyh contract --- src/config/chains.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config/chains.json b/src/config/chains.json index 980a42ae..1ba1fa6f 100644 --- a/src/config/chains.json +++ b/src/config/chains.json @@ -124,7 +124,7 @@ "rpc": "https://mainnet-rpc.lumia.org/", "baseCurrencyName": "LUMIA", "contracts": { - "WETH": "0x5A77f1443D16ee5761d310e38b62f77f726bC71c", + "WETH": "0xE891B5EE2F52E312038710b761EC165792AD25B1", "curveRegistry": "" } }, From 36c506cb038df43c0cf4fb19584ec6e39beb80f0 Mon Sep 17 00:00:00 2001 From: Olga Kanishcheva Date: Wed, 11 Sep 2024 15:29:03 +0400 Subject: [PATCH 21/26] 0.19.92-rc120 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 663c854e..b4b4a0f7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@orionprotocol/sdk", - "version": "0.19.92-rc119", + "version": "0.19.92-rc120", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@orionprotocol/sdk", - "version": "0.19.92-rc119", + "version": "0.19.92-rc120", "hasInstallScript": true, "license": "ISC", "dependencies": { diff --git a/package.json b/package.json index c55bb0f3..5eaad4e6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@orionprotocol/sdk", - "version": "0.19.92-rc119", + "version": "0.19.92-rc120", "description": "Orion Protocol SDK", "main": "./lib/index.cjs", "module": "./lib/index.js", From 0c28905fac1ea430ea7f99a9fa727b89206c4bee Mon Sep 17 00:00:00 2001 From: Olga Kanishcheva Date: Fri, 13 Sep 2024 12:30:44 +0400 Subject: [PATCH 22/26] Change Lumia api url --- src/config/envs.json | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/config/envs.json b/src/config/envs.json index 6b96f32c..f672dc17 100644 --- a/src/config/envs.json +++ b/src/config/envs.json @@ -203,7 +203,7 @@ } }, "994873017": { - "api": "https://app.electra.trade/lumia-mainnet", + "api": "https://staging.electra.finance/lumia-mainnet", "services": { "aggregator": { "http": "/backend", @@ -502,6 +502,24 @@ "http": "/orion-indexer/" } } + }, + "994873017": { + "api": "https://staging.electra.finance/lumia-mainnet", + "services": { + "aggregator": { + "http": "/backend", + "ws": "/v1" + }, + "blockchain": { + "http": "" + }, + "priceFeed": { + "all": "/price-feed" + }, + "indexer": { + "http": "/orion-indexer/" + } + } } } }, From 9d17368c82ce841f0add2d98ac10ed53a64c851f Mon Sep 17 00:00:00 2001 From: Olga Kanishcheva Date: Fri, 13 Sep 2024 12:31:31 +0400 Subject: [PATCH 23/26] 0.19.92-rc121 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index b4b4a0f7..4fcabae6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@orionprotocol/sdk", - "version": "0.19.92-rc120", + "version": "0.19.92-rc121", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@orionprotocol/sdk", - "version": "0.19.92-rc120", + "version": "0.19.92-rc121", "hasInstallScript": true, "license": "ISC", "dependencies": { diff --git a/package.json b/package.json index 5eaad4e6..17870d31 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@orionprotocol/sdk", - "version": "0.19.92-rc120", + "version": "0.19.92-rc121", "description": "Orion Protocol SDK", "main": "./lib/index.cjs", "module": "./lib/index.js", From 8b4aae64e8b4f63f4e84cdda59160d021e2f0e8d Mon Sep 17 00:00:00 2001 From: sunsetlover36 Date: Wed, 23 Oct 2024 15:42:47 +0300 Subject: [PATCH 24/26] Add TON mainnet/testnet --- package.json | 2 +- src/config/chains.json | 20 + src/config/envs.json | 38 ++ src/constants/chains.ts | 2 + src/constants/networkCodes.ts | 18 +- src/constants/uppercasedNetworkCodes.ts | 17 +- src/types.ts | 554 ++++++++++++------------ 7 files changed, 378 insertions(+), 273 deletions(-) diff --git a/package.json b/package.json index 17870d31..496c699a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@orionprotocol/sdk", - "version": "0.19.92-rc121", + "version": "0.19.92-rc122", "description": "Orion Protocol SDK", "main": "./lib/index.cjs", "module": "./lib/index.js", diff --git a/src/config/chains.json b/src/config/chains.json index 1ba1fa6f..af5f6b4c 100644 --- a/src/config/chains.json +++ b/src/config/chains.json @@ -283,5 +283,25 @@ "WETH": "0x4200000000000000000000000000000000000006", "curveRegistry": "" } + }, + "4398026970694": { + "chainId": "4398026970694", + "explorer": "https://testnet.tonscan.org/", + "label": "TON Testnet", + "shortName": "TON Testnet", + "code": "tonTestnet", + "rpc": "https://testnet-v4.tonhubapi.com", + "baseCurrencyName": "TON", + "contracts": {} + }, + "4398026970693": { + "chainId": "4398026970693", + "explorer": "https://tonscan.org/", + "label": "TON Mainnet", + "shortName": "TON Mainnet", + "code": "ton", + "rpc": "https://mainnet-v4.tonhubapi.com", + "baseCurrencyName": "TON", + "contracts": {} } } diff --git a/src/config/envs.json b/src/config/envs.json index f672dc17..1a97464c 100644 --- a/src/config/envs.json +++ b/src/config/envs.json @@ -219,6 +219,25 @@ "http": "/orion-indexer/" } } + }, + "4398026970693": { + "api": "https://app.electra.trade/lumia-mainnet", + "rpc": "https://mainnet-v4.tonhubapi.com", + "services": { + "aggregator": { + "http": "/backend", + "ws": "/v1" + }, + "blockchain": { + "http": "" + }, + "priceFeed": { + "all": "/price-feed" + }, + "indexer": { + "http": "/orion-indexer/" + } + } } } }, @@ -298,6 +317,25 @@ "http": "/orion-indexer/" } } + }, + "4398026970694": { + "api": "https://app.electra.trade/lumia-testnet", + "rpc": "https://testnet-v4.tonhubapi.com", + "services": { + "aggregator": { + "http": "/backend", + "ws": "/v1" + }, + "blockchain": { + "http": "" + }, + "priceFeed": { + "all": "/price-feed" + }, + "indexer": { + "http": "/orion-indexer/" + } + } } } }, diff --git a/src/constants/chains.ts b/src/constants/chains.ts index e9fc119c..5b716545 100644 --- a/src/constants/chains.ts +++ b/src/constants/chains.ts @@ -11,6 +11,7 @@ export const developmentChains = [ SupportedChainId.OKC_TESTNET, SupportedChainId.EVENT_HORIZON_TESTNET, SupportedChainId.LUMIA_TESTNET, + SupportedChainId.TON_TESTNET, ]; export const productionChains = [ SupportedChainId.MAINNET, @@ -25,4 +26,5 @@ export const productionChains = [ SupportedChainId.AVAX, SupportedChainId.BASE, SupportedChainId.LUMIA, + SupportedChainId.TON, ]; diff --git a/src/constants/networkCodes.ts b/src/constants/networkCodes.ts index 76e0d932..bfc36a58 100644 --- a/src/constants/networkCodes.ts +++ b/src/constants/networkCodes.ts @@ -1 +1,17 @@ -export default ['ftm', 'bsc', 'eth', 'polygon', 'okc', 'arb', 'drip', 'opbnb', 'inevm', 'linea', 'avax', 'base', 'lumia'] as const; +export default [ + 'ftm', + 'bsc', + 'eth', + 'polygon', + 'okc', + 'arb', + 'drip', + 'opbnb', + 'inevm', + 'linea', + 'avax', + 'base', + 'lumia', + 'ton', + 'tonTestnet', +] as const; diff --git a/src/constants/uppercasedNetworkCodes.ts b/src/constants/uppercasedNetworkCodes.ts index 9c8e9f21..506cbf0c 100644 --- a/src/constants/uppercasedNetworkCodes.ts +++ b/src/constants/uppercasedNetworkCodes.ts @@ -1 +1,16 @@ -export default ['FTM', 'BSC', 'ETH', 'POLYGON', 'OKC', 'ARB', 'OPBNB', 'INEVM', 'LINEA', 'AVAX', 'BASE', 'LUMIA'] as const; +export default [ + 'FTM', + 'BSC', + 'ETH', + 'POLYGON', + 'OKC', + 'ARB', + 'OPBNB', + 'INEVM', + 'LINEA', + 'AVAX', + 'BASE', + 'LUMIA', + 'TON', + 'TON_TESTNET', +] as const; diff --git a/src/types.ts b/src/types.ts index e5d6dec9..3f079fe2 100644 --- a/src/types.ts +++ b/src/types.ts @@ -6,80 +6,82 @@ import type positionStatuses from './constants/positionStatuses.js'; import type { knownEnvs } from './config/schemas/index.js'; import type getHistory from './Orion/bridge/getHistory.js'; -export type DeepPartial = T extends object ? { - [P in keyof T]?: DeepPartial; -} : T; +export type DeepPartial = T extends object + ? { + [P in keyof T]?: DeepPartial; + } + : T; export type AssetPairUpdate = { - minQty: number - pricePrecision: number -} + minQty: number; + pricePrecision: number; +}; export type SubOrder = { - pair: string - exchange: string - id: number - amount: number - settledAmount: number - price: number - status: typeof subOrderStatuses[number] - side: 'BUY' | 'SELL' - subOrdQty: number -} + pair: string; + exchange: string; + id: number; + amount: number; + settledAmount: number; + price: number; + status: (typeof subOrderStatuses)[number]; + side: 'BUY' | 'SELL'; + subOrdQty: number; +}; export type Balance = { - tradable: string - reserved: string - contract: string - wallet: string - allowance: string -} + tradable: string; + reserved: string; + contract: string; + wallet: string; + allowance: string; +}; -export type PositionStatus = typeof positionStatuses[number]; +export type PositionStatus = (typeof positionStatuses)[number]; export type Order = { - senderAddress: string // address - matcherAddress: string // address - baseAsset: string // address - quoteAsset: string // address - matcherFeeAsset: string // address - amount: number // uint64 - price: number // uint64 - matcherFee: number // uint64 - nonce: number // uint64 - expiration: number // uint64 - buySide: 0 | 1 // uint8, 1=buy, 0=sell - isPersonalSign: boolean // bool -} + senderAddress: string; // address + matcherAddress: string; // address + baseAsset: string; // address + quoteAsset: string; // address + matcherFeeAsset: string; // address + amount: number; // uint64 + price: number; // uint64 + matcherFee: number; // uint64 + nonce: number; // uint64 + expiration: number; // uint64 + buySide: 0 | 1; // uint8, 1=buy, 0=sell + isPersonalSign: boolean; // bool +}; export type SignedOrder = { - id: string // hash of Order (it's not part of order structure in smart-contract) - signature: string // bytes - needWithdraw?: boolean // bool (not supported yet by smart-contract) -} & Order + id: string; // hash of Order (it's not part of order structure in smart-contract) + signature: string; // bytes + needWithdraw?: boolean; // bool (not supported yet by smart-contract) +} & Order; export type CancelOrderRequest = { - id: number | string - senderAddress: string - isPersonalSign: boolean -} + id: number | string; + senderAddress: string; + isPersonalSign: boolean; +}; export type SignedCancelOrderRequest = { - id: number | string - senderAddress: string - signature: string -} & CancelOrderRequest + id: number | string; + senderAddress: string; + signature: string; +} & CancelOrderRequest; export type Pair = { - name: string - baseCurrency: string - quoteCurrency: string - lastPrice: string - openPrice: string - change24h: string - high: string - low: string - vol24h: string -} + name: string; + baseCurrency: string; + quoteCurrency: string; + lastPrice: string; + openPrice: string; + change24h: string; + high: string; + low: string; + vol24h: string; +}; export enum SupportedChainId { MAINNET = '1', @@ -107,121 +109,126 @@ export enum SupportedChainId { EVENT_HORIZON_TESTNET = '123420000034', LUMIA_TESTNET = '1952959480', + TON = '4398026970693', + TON_TESTNET = '4398026970694', + // For testing and debug purpose // BROKEN = '0', } const balanceTypes = ['exchange', 'wallet'] as const; -export type Source = typeof balanceTypes[number]; +export type Source = (typeof balanceTypes)[number]; export type Asset = { - name: string - address: string -} + name: string; + address: string; +}; export type BalanceRequirement = { - readonly reason: string - readonly asset: Asset - readonly amount: string - readonly sources: Source[] - readonly spenderAddress?: string | undefined -} + readonly reason: string; + readonly asset: Asset; + readonly amount: string; + readonly sources: Source[]; + readonly spenderAddress?: string | undefined; +}; export type AggregatedBalanceRequirement = { - readonly asset: Asset - readonly sources: Source[] - readonly spenderAddress?: string | undefined - items: Partial> -} + readonly asset: Asset; + readonly sources: Source[]; + readonly spenderAddress?: string | undefined; + items: Partial>; +}; export type ApproveFix = { - readonly type: 'byApprove' - readonly targetAmount: BigNumber.Value - readonly spenderAddress: string -} + readonly type: 'byApprove'; + readonly targetAmount: BigNumber.Value; + readonly spenderAddress: string; +}; export type DepositFix = { - readonly type: 'byDeposit' - readonly amount: BigNumber.Value - readonly asset: string -} + readonly type: 'byDeposit'; + readonly amount: BigNumber.Value; + readonly asset: string; +}; type Fix = ApproveFix | DepositFix; export type BalanceIssue = { - readonly asset: Asset - readonly message: string - readonly sources: Source[] - readonly fixes?: Fix[] -} + readonly asset: Asset; + readonly message: string; + readonly sources: Source[]; + readonly fixes?: Fix[]; +}; // export type Exchange = typeof exchanges[number]; export type OrderbookItem = { - price: string - amount: string - exchanges: string[] + price: string; + amount: string; + exchanges: string[]; vob: Array<{ - side: 'BUY' | 'SELL' - pairName: string - }> -} + side: 'BUY' | 'SELL'; + pairName: string; + }>; +}; export type SwapInfoAlternative = { - exchanges: string[] - path: string[] - marketAmountOut?: number | undefined - marketAmountIn?: number | undefined - marketPrice: number - availableAmountIn?: number | undefined - availableAmountOut?: number | undefined -} + exchanges: string[]; + path: string[]; + marketAmountOut?: number | undefined; + marketAmountIn?: number | undefined; + marketPrice: number; + availableAmountIn?: number | undefined; + availableAmountOut?: number | undefined; +}; -export type Factory = typeof factories[number] +export type Factory = (typeof factories)[number]; export type SingleSwap = { - pool: string - assetIn: string - assetOut: string - factory: Factory -} + pool: string; + assetIn: string; + assetOut: string; + factory: Factory; +}; export type SwapInfoBase = { - swapRequestId: string - assetIn: string - assetOut: string - amountIn: number - amountOut: number - minAmountIn: number - minAmountOut: number - - path: string[] - exchangeContractPath: SingleSwap[] - exchanges?: string[] | undefined - poolOptimal: boolean - - price?: number | undefined - marketPrice?: number | undefined - orderInfo?: { - pair: string - side: 'BUY' | 'SELL' - amount: number - safePrice: number - } | undefined - alternatives: SwapInfoAlternative[] - assetsNameMapping?: Partial> | undefined -} + swapRequestId: string; + assetIn: string; + assetOut: string; + amountIn: number; + amountOut: number; + minAmountIn: number; + minAmountOut: number; + + path: string[]; + exchangeContractPath: SingleSwap[]; + exchanges?: string[] | undefined; + poolOptimal: boolean; + + price?: number | undefined; + marketPrice?: number | undefined; + orderInfo?: + | { + pair: string; + side: 'BUY' | 'SELL'; + amount: number; + safePrice: number; + } + | undefined; + alternatives: SwapInfoAlternative[]; + assetsNameMapping?: Partial> | undefined; +}; export type SwapInfoByAmountIn = SwapInfoBase & { - kind: 'exactSpend' - availableAmountIn?: number | undefined - marketAmountOut?: number | undefined -} + kind: 'exactSpend'; + availableAmountIn?: number | undefined; + marketAmountOut?: number | undefined; +}; export type SwapInfoByAmountOut = SwapInfoBase & { - kind: 'exactReceive' - marketAmountIn?: number | undefined - availableAmountOut?: number | undefined -} + kind: 'exactReceive'; + marketAmountIn?: number | undefined; + availableAmountOut?: number | undefined; +}; export type SwapInfo = SwapInfoByAmountIn | SwapInfoByAmountOut; @@ -233,107 +240,114 @@ export enum HistoryTransactionStatus { } export type BasicAuthCredentials = { - username: string - password: string -} + username: string; + password: string; +}; export type VerboseUnitConfig = { // env?: string; // api: string; - chainId: SupportedChainId - nodeJsonRpc: string + chainId: SupportedChainId; + nodeJsonRpc: string; services: { blockchainService: { - http: string + http: string; // For example: // http://localhost:3001/, // http://10.123.34.23:3001/, // https://blockchain:3001/ - } + }; aggregator: { - http: string - ws: string + http: string; + ws: string; // For example: // http://localhost:3002/, // http://10.34.23.5:3002/, // https://aggregator:3002/ - } + }; priceFeed: { - api: string + api: string; // For example: // http://localhost:3003/, // http://10.23.5.11:3003/, // https://price-feed:3003/ - } - } - basicAuth?: BasicAuthCredentials -} + }; + }; + basicAuth?: BasicAuthCredentials; +}; -export type KnownEnv = typeof knownEnvs[number]; +export type KnownEnv = (typeof knownEnvs)[number]; -export type Json = string | number | boolean | null | Json[] | { [key: string]: Json }; +export type Json = + | string + | number + | boolean + | null + | Json[] + | { [key: string]: Json }; export type EnvConfig = { - analyticsAPI: string - referralAPI: string - networks: Partial< - Record< - SupportedChainId, - VerboseUnitConfig - > - > -} + analyticsAPI: string; + referralAPI: string; + networks: Partial>; +}; export type AggregatedAssets = Partial< Record< string, Partial< - Record + Record< + SupportedChainId, + { + address: string; + } + > > > - >; +>; export type RedeemOrder = { - sender: string - receiver: string - asset: string - amount: number - expiration: number - secretHash: string - signature: string - claimReceiver: string -} + sender: string; + receiver: string; + asset: string; + amount: number; + expiration: number; + secretHash: string; + signature: string; + claimReceiver: string; +}; export interface AtomicSwapLocal { - secret: string - secretHash: string - walletAddress: string - env?: string | undefined - - sourceChainId?: SupportedChainId | undefined - targetChainId?: SupportedChainId | undefined - - amount?: string | undefined - assetName?: string | undefined - - liquidityMigrationTxHash?: string | undefined - lockTransactionHash?: string | undefined - refundTransactionHash?: string | undefined - - creationDate?: number | undefined - lockExpiration?: number | undefined - placingOrderError?: string | undefined - redeemSettlement?: { - type: 'own_tx' - } | { - type: 'orion_tx' - requestedAt?: number - result?: { - timestamp: number - value: 'success' | 'failed' - } - } | undefined + secret: string; + secretHash: string; + walletAddress: string; + env?: string | undefined; + + sourceChainId?: SupportedChainId | undefined; + targetChainId?: SupportedChainId | undefined; + + amount?: string | undefined; + assetName?: string | undefined; + + liquidityMigrationTxHash?: string | undefined; + lockTransactionHash?: string | undefined; + refundTransactionHash?: string | undefined; + + creationDate?: number | undefined; + lockExpiration?: number | undefined; + placingOrderError?: string | undefined; + redeemSettlement?: + | { + type: 'own_tx'; + } + | { + type: 'orion_tx'; + requestedAt?: number; + result?: { + timestamp: number; + value: 'success' | 'failed'; + }; + } + | undefined; } export enum TxStatus { @@ -361,71 +375,72 @@ export enum TxType { } export type TxDepositOrWithdrawPayload = { - type: TxType.DEPOSIT | TxType.WITHDRAW + type: TxType.DEPOSIT | TxType.WITHDRAW; data: { - asset: string - amount: string - } + asset: string; + amount: string; + }; }; export type TxSwapThroughOrionPoolPayload = { - type: TxType.SWAP_THROUGH_ORION_POOL + type: TxType.SWAP_THROUGH_ORION_POOL; data: { - side: 'buy' | 'sell' - assetIn: string - assetOut: string - amount: string - price: string - } + side: 'buy' | 'sell'; + assetIn: string; + assetOut: string; + amount: string; + price: string; + }; }; export type TxBridgePayload = { - type: TxType.BRIDGE_LOCK | TxType.BRIDGE_REDEEM | TxType.BRIDGE_REFUND + type: TxType.BRIDGE_LOCK | TxType.BRIDGE_REDEEM | TxType.BRIDGE_REFUND; data: { - secretHash: string - } -} + secretHash: string; + }; +}; export type TxLiquidityMigrationPayload = { - type: TxType.LIQUIDITY_MIGRATION + type: TxType.LIQUIDITY_MIGRATION; data: { - source: SupportedChainId - target: SupportedChainId - pair: string - pairAddress: string + source: SupportedChainId; + target: SupportedChainId; + pair: string; + pairAddress: string; assetA: { - amount: string - secretHash: string - secret: string - } + amount: string; + secretHash: string; + secret: string; + }; assetB: { - amount: string - secretHash: string - secret: string - } - expiration: number - env?: string - } -} + amount: string; + secretHash: string; + secret: string; + }; + expiration: number; + env?: string; + }; +}; export type TxRedeemTwoAtomicsPayload = { - type: TxType.REDEEM_TWO_ATOMICS + type: TxType.REDEEM_TWO_ATOMICS; data: { - secretHash1: string - secretHash2: string - } -} + secretHash1: string; + secretHash2: string; + }; +}; export type TransactionInfo = { - id?: string - status?: TxStatus - hash?: string - payload?: TxDepositOrWithdrawPayload - | TxSwapThroughOrionPoolPayload - | TxBridgePayload - | TxLiquidityMigrationPayload - | TxRedeemTwoAtomicsPayload -} + id?: string; + status?: TxStatus; + hash?: string; + payload?: + | TxDepositOrWithdrawPayload + | TxSwapThroughOrionPoolPayload + | TxBridgePayload + | TxLiquidityMigrationPayload + | TxRedeemTwoAtomicsPayload; +}; type BridgeHistory = Awaited>; @@ -433,21 +448,20 @@ type BridgeHistoryItem = NonNullable; export type AtomicSwap = Partial< Omit -> & Partial< - Omit -> & { - sourceChainId: SupportedChainId - targetChainId: SupportedChainId - lockExpiration: number - secretHash: string - walletAddress: string - secret?: string | undefined - - creationDate?: number | undefined - redeemExpired?: boolean | undefined - - lockTx?: TransactionInfo | undefined - redeemTx?: TransactionInfo | undefined - refundTx?: TransactionInfo | undefined - liquidityMigrationTx?: TransactionInfo | undefined -} +> & + Partial> & { + sourceChainId: SupportedChainId; + targetChainId: SupportedChainId; + lockExpiration: number; + secretHash: string; + walletAddress: string; + secret?: string | undefined; + + creationDate?: number | undefined; + redeemExpired?: boolean | undefined; + + lockTx?: TransactionInfo | undefined; + redeemTx?: TransactionInfo | undefined; + refundTx?: TransactionInfo | undefined; + liquidityMigrationTx?: TransactionInfo | undefined; + }; From c5c049aa0c83987a182f9e4e4663c963caff98aa Mon Sep 17 00:00:00 2001 From: sunsetlover36 Date: Wed, 23 Oct 2024 16:14:43 +0300 Subject: [PATCH 25/26] Fix ton testnet chain id --- src/config/chains.json | 4 ++-- src/config/envs.json | 2 +- src/types.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/config/chains.json b/src/config/chains.json index af5f6b4c..f807ce15 100644 --- a/src/config/chains.json +++ b/src/config/chains.json @@ -284,8 +284,8 @@ "curveRegistry": "" } }, - "4398026970694": { - "chainId": "4398026970694", + "4398026970692": { + "chainId": "4398026970692", "explorer": "https://testnet.tonscan.org/", "label": "TON Testnet", "shortName": "TON Testnet", diff --git a/src/config/envs.json b/src/config/envs.json index 1a97464c..36ea4b34 100644 --- a/src/config/envs.json +++ b/src/config/envs.json @@ -318,7 +318,7 @@ } } }, - "4398026970694": { + "4398026970692": { "api": "https://app.electra.trade/lumia-testnet", "rpc": "https://testnet-v4.tonhubapi.com", "services": { diff --git a/src/types.ts b/src/types.ts index 3f079fe2..cce91b71 100644 --- a/src/types.ts +++ b/src/types.ts @@ -110,7 +110,7 @@ export enum SupportedChainId { LUMIA_TESTNET = '1952959480', TON = '4398026970693', - TON_TESTNET = '4398026970694', + TON_TESTNET = '4398026970692', // For testing and debug purpose // BROKEN = '0', From 0536be93d5b77facb4fc43b43912424505128dbd Mon Sep 17 00:00:00 2001 From: sunsetlover36 Date: Wed, 23 Oct 2024 16:24:08 +0300 Subject: [PATCH 26/26] Bump ver --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 496c699a..75882f54 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@orionprotocol/sdk", - "version": "0.19.92-rc122", + "version": "0.19.92-rc123", "description": "Orion Protocol SDK", "main": "./lib/index.cjs", "module": "./lib/index.js",