From 276b1beec805906e0241bf7325ec8b1770dac34f Mon Sep 17 00:00:00 2001 From: Kirill Litvinov Date: Tue, 26 Sep 2023 14:03:27 +0300 Subject: [PATCH 1/6] multiple exchanges in suborder --- package-lock.json | 4 ++-- package.json | 2 +- src/services/Aggregator/schemas/orderSchema.ts | 1 + src/services/Aggregator/ws/schemas/addressUpdateSchema.ts | 3 +++ 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 89c4f12..ebb7752 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@orionprotocol/sdk", - "version": "0.19.84", + "version": "0.19.88-rc0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@orionprotocol/sdk", - "version": "0.19.84", + "version": "0.19.88-rc0", "hasInstallScript": true, "license": "ISC", "dependencies": { diff --git a/package.json b/package.json index 2a7efb9..345113a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@orionprotocol/sdk", - "version": "0.19.85", + "version": "0.19.88-rc0", "description": "Orion Protocol SDK", "main": "./lib/index.cjs", "module": "./lib/index.js", diff --git a/src/services/Aggregator/schemas/orderSchema.ts b/src/services/Aggregator/schemas/orderSchema.ts index 14fc395..0f2accf 100644 --- a/src/services/Aggregator/schemas/orderSchema.ts +++ b/src/services/Aggregator/schemas/orderSchema.ts @@ -87,6 +87,7 @@ const subOrderSchema = baseOrderSchema.extend({ message: `subOrder.parentOrderId must be a hex string, got ${value}`, })), exchange: z.string(), + exchanges: z.string().array().optional(), brokerAddress: brokerAddressSchema, tradesInfo: z.record( z.string().uuid(), diff --git a/src/services/Aggregator/ws/schemas/addressUpdateSchema.ts b/src/services/Aggregator/ws/schemas/addressUpdateSchema.ts index 0310b0a..7cfeb4b 100644 --- a/src/services/Aggregator/ws/schemas/addressUpdateSchema.ts +++ b/src/services/Aggregator/ws/schemas/addressUpdateSchema.ts @@ -23,6 +23,7 @@ const subOrderSchema = z.object({ A: z.number(), // settled amount p: z.number(), // avg weighed settlement price e: z.string(), // exchange + es: z.string().array().optional(), // exchanges b: z.string(), // broker address S: z.enum(subOrderStatuses), // status o: z.boolean(), // internal only @@ -52,6 +53,7 @@ export const orderUpdateSchema = z.object({ subOrders: o.c.map((so) => ({ pair: so.P, exchange: so.e, + exchanges: so.es, id: so.i, amount: so.a, settledAmount: so.A, @@ -106,6 +108,7 @@ export const fullOrderSchema = z.object({ subOrders: o.c.map((so) => ({ pair: so.P, exchange: so.e, + exchangs: so.es, id: so.i, amount: so.a, settledAmount: so.A, From 14b05af8503cf2966c564b6d60d04565c82a1276 Mon Sep 17 00:00:00 2001 From: Alex Kraiz Date: Wed, 27 Sep 2023 17:50:23 +0400 Subject: [PATCH 2/6] orionprotocol.io replaces with orion.xyz --- src/config/chains.json | 6 ++-- src/config/envs.json | 68 +++++++++++++++++++++--------------------- 2 files changed, 37 insertions(+), 37 deletions(-) diff --git a/src/config/chains.json b/src/config/chains.json index ea3dd8e..33b7724 100644 --- a/src/config/chains.json +++ b/src/config/chains.json @@ -5,7 +5,7 @@ "label": "Ethereum", "shortName": "ETH", "code": "eth", - "rpc": "https://trade.orionprotocol.io/eth-mainnet/rpc", + "rpc": "https://trade.orion.xyz/eth-mainnet/rpc", "baseCurrencyName": "ETH", "contracts": { "WETH": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", @@ -44,7 +44,7 @@ "label": "Ropsten", "shortName": "ETH-Ropsten", "code": "eth", - "rpc": "https://testing.orionprotocol.io/eth-ropsten/rpc", + "rpc": "https://testing.orion.xyz/eth-ropsten/rpc", "baseCurrencyName": "ETH", "contracts": { "WETH": "", @@ -57,7 +57,7 @@ "label": "Goerli", "shortName": "ETH-Goerli", "code": "eth", - "rpc": "https://testing.orionprotocol.io/eth-goerli/rpc", + "rpc": "https://testing.orion.xyz/eth-goerli/rpc", "baseCurrencyName": "ETH", "contracts": { "WETH": "", diff --git a/src/config/envs.json b/src/config/envs.json index fd2bb30..1c193bf 100644 --- a/src/config/envs.json +++ b/src/config/envs.json @@ -1,10 +1,10 @@ { "production": { - "analyticsAPI": "https://trade.orionprotocol.io/api/stats", - "referralAPI": "https://trade.orionprotocol.io/referral-api", + "analyticsAPI": "https://trade.orion.xyz/api/stats", + "referralAPI": "https://trade.orion.xyz/referral-api", "networks": { "1": { - "api": "https://trade.orionprotocol.io/eth-mainnet", + "api": "https://trade.orion.xyz/eth-mainnet", "services": { "aggregator": { "http": "/backend", @@ -20,7 +20,7 @@ "liquidityMigratorAddress": "0x23a1820a47BcD022E29f6058a5FD224242F50D1A" }, "56": { - "api": "https://trade.orionprotocol.io/bsc-mainnet", + "api": "https://trade.orion.xyz/bsc-mainnet", "services": { "aggregator": { "http": "/backend", @@ -35,7 +35,7 @@ } }, "250": { - "api": "https://trade.orionprotocol.io/ftm-mainnet", + "api": "https://trade.orion.xyz/ftm-mainnet", "services": { "aggregator": { "http": "/backend", @@ -50,7 +50,7 @@ } }, "137": { - "api": "https://trade.orionprotocol.io/polygon-mainnet", + "api": "https://trade.orion.xyz/polygon-mainnet", "services": { "aggregator": { "http": "/backend", @@ -65,7 +65,7 @@ } }, "66": { - "api": "https://trade.orionprotocol.io/okc-mainnet", + "api": "https://trade.orion.xyz/okc-mainnet", "services": { "aggregator": { "http": "/backend", @@ -82,11 +82,11 @@ } }, "testing": { - "analyticsAPI": "https://trade.orionprotocol.io/api/stats", - "referralAPI": "https://testing.orionprotocol.io/referral-api", + "analyticsAPI": "https://trade.orion.xyz/api/stats", + "referralAPI": "https://testing.orion.xyz/referral-api", "networks": { "97": { - "api": "https://testing.orionprotocol.io/bsc-testnet", + "api": "https://testing.orion.xyz/bsc-testnet", "services": { "aggregator": { "http": "/backend", @@ -102,7 +102,7 @@ "liquidityMigratorAddress": "0x01b10dds12478C88A5E18e2707E729906bC25CfF6" }, "5": { - "api": "https://testing.orionprotocol.io/eth-goerli", + "api": "https://testing.orion.xyz/eth-goerli", "services": { "aggregator": { "http": "/backend", @@ -117,7 +117,7 @@ } }, "421613": { - "api": "https://testing.orionprotocol.io/arbitrum-goerli", + "api": "https://testing.orion.xyz/arbitrum-goerli", "services": { "aggregator": { "http": "/backend", @@ -132,7 +132,7 @@ } }, "4002": { - "api": "https://testing.orionprotocol.io/ftm-testnet", + "api": "https://testing.orion.xyz/ftm-testnet", "services": { "aggregator": { "http": "/backend", @@ -147,7 +147,7 @@ } }, "80001": { - "api": "https://testing.orionprotocol.io/polygon-mumbai", + "api": "https://testing.orion.xyz/polygon-mumbai", "services": { "aggregator": { "http": "/backend", @@ -162,7 +162,7 @@ } }, "56303": { - "api": "https://testing.orionprotocol.io/drip-testnet", + "api": "https://testing.orion.xyz/drip-testnet", "services": { "aggregator": { "http": "/backend", @@ -179,11 +179,11 @@ } }, "staging": { - "analyticsAPI": "https://trade.orionprotocol.io/api/stats", - "referralAPI": "https://staging.orionprotocol.io/referral-api", + "analyticsAPI": "https://trade.orion.xyz/api/stats", + "referralAPI": "https://staging.orion.xyz/referral-api", "networks": { "1": { - "api": "https://staging.orionprotocol.io/eth-mainnet", + "api": "https://staging.orion.xyz/eth-mainnet", "services": { "aggregator": { "http": "/backend", @@ -198,7 +198,7 @@ } }, "56": { - "api": "https://staging.orionprotocol.io/bsc-mainnet", + "api": "https://staging.orion.xyz/bsc-mainnet", "services": { "aggregator": { "http": "/backend", @@ -213,7 +213,7 @@ } }, "250": { - "api": "https://staging.orionprotocol.io/ftm-mainnet", + "api": "https://staging.orion.xyz/ftm-mainnet", "services": { "aggregator": { "http": "/backend", @@ -228,7 +228,7 @@ } }, "137": { - "api": "https://staging.orionprotocol.io/polygon-mainnet", + "api": "https://staging.orion.xyz/polygon-mainnet", "services": { "aggregator": { "http": "/backend", @@ -243,7 +243,7 @@ } }, "66": { - "api": "https://staging.orionprotocol.io/okc-mainnet", + "api": "https://staging.orion.xyz/okc-mainnet", "services": { "aggregator": { "http": "/backend", @@ -260,11 +260,11 @@ } }, "experimental": { - "analyticsAPI": "https://trade.orionprotocol.io/api/stats", - "referralAPI": "https://testing.orionprotocol.io/referral-api", + "analyticsAPI": "https://trade.orion.xyz/api/stats", + "referralAPI": "https://testing.orion.xyz/referral-api", "networks": { "97": { - "api": "https://dn-dev.orionprotocol.io/bsc-testnet", + "api": "https://dn-dev.orion.xyz/bsc-testnet", "services": { "aggregator": { "http": "/backend", @@ -279,7 +279,7 @@ } }, "3": { - "api": "https://dn-dev.orionprotocol.io/eth-ropsten", + "api": "https://dn-dev.orion.xyz/eth-ropsten", "services": { "aggregator": { "http": "/backend", @@ -296,11 +296,11 @@ } }, "kucoin-production": { - "analyticsAPI": "https://trade.orionprotocol.io/api/stats", - "referralAPI": "https://trade.orionprotocol.io/referral-api", + "analyticsAPI": "https://trade.orion.xyz/api/stats", + "referralAPI": "https://trade.orion.xyz/referral-api", "networks": { "1": { - "api": "https://trade.orionprotocol.io/eth-mainnet", + "api": "https://trade.orion.xyz/eth-mainnet", "services": { "aggregator": { "http": "/backend", @@ -316,7 +316,7 @@ "liquidityMigratorAddress": "0x23a1820a47BcD022E29f6058a5FD224242F50D1A" }, "56": { - "api": "https://trade.orionprotocol.io/bsc-mainnet", + "api": "https://trade.orion.xyz/bsc-mainnet", "services": { "aggregator": { "http": "/backend", @@ -331,7 +331,7 @@ } }, "250": { - "api": "https://trade.orionprotocol.io/ftm-mainnet", + "api": "https://trade.orion.xyz/ftm-mainnet", "services": { "aggregator": { "http": "/backend", @@ -346,7 +346,7 @@ } }, "137": { - "api": "https://trade.orionprotocol.io/polygon-mainnet", + "api": "https://trade.orion.xyz/polygon-mainnet", "services": { "aggregator": { "http": "/backend", @@ -361,7 +361,7 @@ } }, "66": { - "api": "https://trade.orionprotocol.io/okc-mainnet", + "api": "https://trade.orion.xyz/okc-mainnet", "services": { "aggregator": { "http": "/backend", @@ -377,4 +377,4 @@ } } } -} \ No newline at end of file +} From 7c0c057e0fee8f94b29bccde9c02bdf7b7160130 Mon Sep 17 00:00:00 2001 From: Alex Kraiz Date: Wed, 27 Sep 2023 18:40:31 +0400 Subject: [PATCH 3/6] Bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index da99f7a..cd32b98 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@orionprotocol/sdk", - "version": "0.19.88", + "version": "0.19.89", "description": "Orion Protocol SDK", "main": "./lib/index.cjs", "module": "./lib/index.js", From 4ac13992eb67a59290843a09e5f7f6d3b09dc960 Mon Sep 17 00:00:00 2001 From: Alex Kraiz Date: Wed, 27 Sep 2023 18:45:26 +0400 Subject: [PATCH 4/6] Bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index cd32b98..d589054 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@orionprotocol/sdk", - "version": "0.19.89", + "version": "0.19.90", "description": "Orion Protocol SDK", "main": "./lib/index.cjs", "module": "./lib/index.js", From 27c426e815379a86d375a61ccf9844bb88dae5f5 Mon Sep 17 00:00:00 2001 From: Kirill Litvinov Date: Thu, 28 Sep 2023 12:33:13 +0300 Subject: [PATCH 5/6] bump version --- 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 0196ef9..0e30774 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@orionprotocol/sdk", - "version": "0.19.88-rc1", + "version": "0.19.91", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@orionprotocol/sdk", - "version": "0.19.88-rc1", + "version": "0.19.91", "hasInstallScript": true, "license": "ISC", "dependencies": { diff --git a/package.json b/package.json index 426e014..4e7d8fc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@orionprotocol/sdk", - "version": "0.19.88-rc1", + "version": "0.19.91", "description": "Orion Protocol SDK", "main": "./lib/index.cjs", "module": "./lib/index.js", From d5a3e1d64e8a2571901b6b60eff21948290ab316 Mon Sep 17 00:00:00 2001 From: Alex Kraiz Date: Thu, 28 Sep 2023 18:31:54 +0400 Subject: [PATCH 6/6] fix: getPlatformFees inputs --- src/services/BlockchainService/index.ts | 29 +++++++++++++------------ 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/src/services/BlockchainService/index.ts b/src/services/BlockchainService/index.ts index 8ac862e..6c43a0a 100644 --- a/src/services/BlockchainService/index.ts +++ b/src/services/BlockchainService/index.ts @@ -59,6 +59,13 @@ type AtomicSwapHistoryTargetQuery = AtomicSwapHistoryBaseQuery & { expiredRedeem?: 0 | 1 state?: 'REDEEMED' | 'BEFORE-REDEEM' } + +type PlatformFees = { + assetIn: string + assetOut: string + walletAddress?: string | undefined + fromWidget?: string | undefined +} class BlockchainService { private readonly apiUrl: string; @@ -231,23 +238,17 @@ class BlockchainService { { headers: this.basicAuthHeaders } ); - getPlatformFees = ( - { assetIn, assetOut, walletAddress, fromWidget }: { - assetIn?: string | undefined, - assetOut?: string | undefined, - walletAddress?: string | undefined, - fromWidget?: string | undefined - } + getPlatformFees = ({ + assetIn, + assetOut, + walletAddress, + fromWidget + }: PlatformFees ) => { const url = new URL(`${this.apiUrl}/api/platform-fees`); - if (assetIn !== undefined) { - url.searchParams.append('assetIn', assetIn); - } - - if (assetOut !== undefined) { - url.searchParams.append('assetOut', assetOut); - } + url.searchParams.append('assetIn', assetIn); + url.searchParams.append('assetOut', assetOut); if (walletAddress !== undefined) { url.searchParams.append('walletAddress', walletAddress);