merge with main

This commit is contained in:
Alex Kraiz
2023-09-29 11:03:50 +04:00
7 changed files with 57 additions and 388 deletions

336
package-lock.json generated
View File

@@ -617,54 +617,6 @@
"@jridgewell/sourcemap-codec": "^1.4.10"
}
},
"node_modules/@esbuild/android-arm": {
"version": "0.18.20",
"resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.18.20.tgz",
"integrity": "sha512-fyi7TDI/ijKKNZTUJAQqiG5T7YjJXgnzkURqmGj13C6dCqckZBLdl4h7bkhHt/t0WP+zO9/zwroDvANaOqO5Sw==",
"cpu": [
"arm"
],
"dev": true,
"optional": true,
"os": [
"android"
],
"engines": {
"node": ">=12"
}
},
"node_modules/@esbuild/android-arm64": {
"version": "0.18.20",
"resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.18.20.tgz",
"integrity": "sha512-Nz4rJcchGDtENV0eMKUNa6L12zz2zBDXuhj/Vjh18zGqB44Bi7MBMSXjgunJgjRhCmKOjnPuZp4Mb6OKqtMHLQ==",
"cpu": [
"arm64"
],
"dev": true,
"optional": true,
"os": [
"android"
],
"engines": {
"node": ">=12"
}
},
"node_modules/@esbuild/android-x64": {
"version": "0.18.20",
"resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.18.20.tgz",
"integrity": "sha512-8GDdlePJA8D6zlZYJV/jnrRAi6rOiNaCC/JclcXpB+KIuvfBN4owLtgzY2bsxnx666XjJx2kDPUmnTtR8qKQUg==",
"cpu": [
"x64"
],
"dev": true,
"optional": true,
"os": [
"android"
],
"engines": {
"node": ">=12"
}
},
"node_modules/@esbuild/darwin-arm64": {
"version": "0.18.20",
"resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.18.20.tgz",
@@ -681,294 +633,6 @@
"node": ">=12"
}
},
"node_modules/@esbuild/darwin-x64": {
"version": "0.18.20",
"resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.18.20.tgz",
"integrity": "sha512-pc5gxlMDxzm513qPGbCbDukOdsGtKhfxD1zJKXjCCcU7ju50O7MeAZ8c4krSJcOIJGFR+qx21yMMVYwiQvyTyQ==",
"cpu": [
"x64"
],
"dev": true,
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": ">=12"
}
},
"node_modules/@esbuild/freebsd-arm64": {
"version": "0.18.20",
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.18.20.tgz",
"integrity": "sha512-yqDQHy4QHevpMAaxhhIwYPMv1NECwOvIpGCZkECn8w2WFHXjEwrBn3CeNIYsibZ/iZEUemj++M26W3cNR5h+Tw==",
"cpu": [
"arm64"
],
"dev": true,
"optional": true,
"os": [
"freebsd"
],
"engines": {
"node": ">=12"
}
},
"node_modules/@esbuild/freebsd-x64": {
"version": "0.18.20",
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.18.20.tgz",
"integrity": "sha512-tgWRPPuQsd3RmBZwarGVHZQvtzfEBOreNuxEMKFcd5DaDn2PbBxfwLcj4+aenoh7ctXcbXmOQIn8HI6mCSw5MQ==",
"cpu": [
"x64"
],
"dev": true,
"optional": true,
"os": [
"freebsd"
],
"engines": {
"node": ">=12"
}
},
"node_modules/@esbuild/linux-arm": {
"version": "0.18.20",
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.18.20.tgz",
"integrity": "sha512-/5bHkMWnq1EgKr1V+Ybz3s1hWXok7mDFUMQ4cG10AfW3wL02PSZi5kFpYKrptDsgb2WAJIvRcDm+qIvXf/apvg==",
"cpu": [
"arm"
],
"dev": true,
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=12"
}
},
"node_modules/@esbuild/linux-arm64": {
"version": "0.18.20",
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.18.20.tgz",
"integrity": "sha512-2YbscF+UL7SQAVIpnWvYwM+3LskyDmPhe31pE7/aoTMFKKzIc9lLbyGUpmmb8a8AixOL61sQ/mFh3jEjHYFvdA==",
"cpu": [
"arm64"
],
"dev": true,
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=12"
}
},
"node_modules/@esbuild/linux-ia32": {
"version": "0.18.20",
"resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.18.20.tgz",
"integrity": "sha512-P4etWwq6IsReT0E1KHU40bOnzMHoH73aXp96Fs8TIT6z9Hu8G6+0SHSw9i2isWrD2nbx2qo5yUqACgdfVGx7TA==",
"cpu": [
"ia32"
],
"dev": true,
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=12"
}
},
"node_modules/@esbuild/linux-loong64": {
"version": "0.18.20",
"resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.18.20.tgz",
"integrity": "sha512-nXW8nqBTrOpDLPgPY9uV+/1DjxoQ7DoB2N8eocyq8I9XuqJ7BiAMDMf9n1xZM9TgW0J8zrquIb/A7s3BJv7rjg==",
"cpu": [
"loong64"
],
"dev": true,
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=12"
}
},
"node_modules/@esbuild/linux-mips64el": {
"version": "0.18.20",
"resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.18.20.tgz",
"integrity": "sha512-d5NeaXZcHp8PzYy5VnXV3VSd2D328Zb+9dEq5HE6bw6+N86JVPExrA6O68OPwobntbNJ0pzCpUFZTo3w0GyetQ==",
"cpu": [
"mips64el"
],
"dev": true,
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=12"
}
},
"node_modules/@esbuild/linux-ppc64": {
"version": "0.18.20",
"resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.18.20.tgz",
"integrity": "sha512-WHPyeScRNcmANnLQkq6AfyXRFr5D6N2sKgkFo2FqguP44Nw2eyDlbTdZwd9GYk98DZG9QItIiTlFLHJHjxP3FA==",
"cpu": [
"ppc64"
],
"dev": true,
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=12"
}
},
"node_modules/@esbuild/linux-riscv64": {
"version": "0.18.20",
"resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.18.20.tgz",
"integrity": "sha512-WSxo6h5ecI5XH34KC7w5veNnKkju3zBRLEQNY7mv5mtBmrP/MjNBCAlsM2u5hDBlS3NGcTQpoBvRzqBcRtpq1A==",
"cpu": [
"riscv64"
],
"dev": true,
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=12"
}
},
"node_modules/@esbuild/linux-s390x": {
"version": "0.18.20",
"resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.18.20.tgz",
"integrity": "sha512-+8231GMs3mAEth6Ja1iK0a1sQ3ohfcpzpRLH8uuc5/KVDFneH6jtAJLFGafpzpMRO6DzJ6AvXKze9LfFMrIHVQ==",
"cpu": [
"s390x"
],
"dev": true,
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=12"
}
},
"node_modules/@esbuild/linux-x64": {
"version": "0.18.20",
"resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.18.20.tgz",
"integrity": "sha512-UYqiqemphJcNsFEskc73jQ7B9jgwjWrSayxawS6UVFZGWrAAtkzjxSqnoclCXxWtfwLdzU+vTpcNYhpn43uP1w==",
"cpu": [
"x64"
],
"dev": true,
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=12"
}
},
"node_modules/@esbuild/netbsd-x64": {
"version": "0.18.20",
"resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.18.20.tgz",
"integrity": "sha512-iO1c++VP6xUBUmltHZoMtCUdPlnPGdBom6IrO4gyKPFFVBKioIImVooR5I83nTew5UOYrk3gIJhbZh8X44y06A==",
"cpu": [
"x64"
],
"dev": true,
"optional": true,
"os": [
"netbsd"
],
"engines": {
"node": ">=12"
}
},
"node_modules/@esbuild/openbsd-x64": {
"version": "0.18.20",
"resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.18.20.tgz",
"integrity": "sha512-e5e4YSsuQfX4cxcygw/UCPIEP6wbIL+se3sxPdCiMbFLBWu0eiZOJ7WoD+ptCLrmjZBK1Wk7I6D/I3NglUGOxg==",
"cpu": [
"x64"
],
"dev": true,
"optional": true,
"os": [
"openbsd"
],
"engines": {
"node": ">=12"
}
},
"node_modules/@esbuild/sunos-x64": {
"version": "0.18.20",
"resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.18.20.tgz",
"integrity": "sha512-kDbFRFp0YpTQVVrqUd5FTYmWo45zGaXe0X8E1G/LKFC0v8x0vWrhOWSLITcCn63lmZIxfOMXtCfti/RxN/0wnQ==",
"cpu": [
"x64"
],
"dev": true,
"optional": true,
"os": [
"sunos"
],
"engines": {
"node": ">=12"
}
},
"node_modules/@esbuild/win32-arm64": {
"version": "0.18.20",
"resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.18.20.tgz",
"integrity": "sha512-ddYFR6ItYgoaq4v4JmQQaAI5s7npztfV4Ag6NrhiaW0RrnOXqBkgwZLofVTlq1daVTQNhtI5oieTvkRPfZrePg==",
"cpu": [
"arm64"
],
"dev": true,
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">=12"
}
},
"node_modules/@esbuild/win32-ia32": {
"version": "0.18.20",
"resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.18.20.tgz",
"integrity": "sha512-Wv7QBi3ID/rROT08SABTS7eV4hX26sVduqDOTe1MvGMjNd3EjOz4b7zeexIR62GTIEKrfJXKL9LFxTYgkyeu7g==",
"cpu": [
"ia32"
],
"dev": true,
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">=12"
}
},
"node_modules/@esbuild/win32-x64": {
"version": "0.18.20",
"resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.18.20.tgz",
"integrity": "sha512-kTdfRcSiDfQca/y9QIkng02avJ+NCaQvrMejlsB3RRv5sE9rRoeBPISaZpKxHELzRxZyLvNts1P27W3wV+8geQ==",
"cpu": [
"x64"
],
"dev": true,
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">=12"
}
},
"node_modules/@eslint-community/eslint-utils": {
"version": "4.4.0",
"resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz",

View File

@@ -1,6 +1,6 @@
{
"name": "@orionprotocol/sdk",
"version": "0.19.89-rc9",
"version": "0.19.89-rc10",
"description": "Orion Protocol SDK",
"main": "./lib/index.cjs",
"module": "./lib/index.js",

View File

@@ -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": "",

View File

@@ -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",
@@ -23,7 +23,7 @@
"liquidityMigratorAddress": "0x23a1820a47BcD022E29f6058a5FD224242F50D1A"
},
"56": {
"api": "https://trade.orionprotocol.io/bsc-mainnet",
"api": "https://trade.orion.xyz/bsc-mainnet",
"services": {
"aggregator": {
"http": "/backend",
@@ -41,7 +41,7 @@
}
},
"250": {
"api": "https://trade.orionprotocol.io/ftm-mainnet",
"api": "https://trade.orion.xyz/ftm-mainnet",
"services": {
"aggregator": {
"http": "/backend",
@@ -59,7 +59,7 @@
}
},
"137": {
"api": "https://trade.orionprotocol.io/polygon-mainnet",
"api": "https://trade.orion.xyz/polygon-mainnet",
"services": {
"aggregator": {
"http": "/backend",
@@ -77,7 +77,7 @@
}
},
"66": {
"api": "https://trade.orionprotocol.io/okc-mainnet",
"api": "https://trade.orion.xyz/okc-mainnet",
"services": {
"aggregator": {
"http": "/backend",
@@ -97,11 +97,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",
@@ -120,7 +120,7 @@
"liquidityMigratorAddress": "0x01b10dds12478C88A5E18e2707E729906bC25CfF6"
},
"5": {
"api": "https://testing.orionprotocol.io/eth-goerli",
"api": "https://testing.orion.xyz/eth-goerli",
"services": {
"aggregator": {
"http": "/backend",
@@ -138,7 +138,7 @@
}
},
"421613": {
"api": "https://testing.orionprotocol.io/arbitrum-goerli",
"api": "https://testing.orion.xyz/arbitrum-goerli",
"services": {
"aggregator": {
"http": "/backend",
@@ -156,7 +156,7 @@
}
},
"4002": {
"api": "https://testing.orionprotocol.io/ftm-testnet",
"api": "https://testing.orion.xyz/ftm-testnet",
"services": {
"aggregator": {
"http": "/backend",
@@ -174,7 +174,7 @@
}
},
"80001": {
"api": "https://testing.orionprotocol.io/polygon-mumbai",
"api": "https://testing.orion.xyz/polygon-mumbai",
"services": {
"aggregator": {
"http": "/backend",
@@ -192,7 +192,7 @@
}
},
"56303": {
"api": "https://testing.orionprotocol.io/drip-testnet",
"api": "https://testing.orion.xyz/drip-testnet",
"services": {
"aggregator": {
"http": "/backend",
@@ -212,11 +212,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",
@@ -234,7 +234,7 @@
}
},
"56": {
"api": "https://staging.orionprotocol.io/bsc-mainnet",
"api": "https://staging.orion.xyz/bsc-mainnet",
"services": {
"aggregator": {
"http": "/backend",
@@ -252,7 +252,7 @@
}
},
"250": {
"api": "https://staging.orionprotocol.io/ftm-mainnet",
"api": "https://staging.orion.xyz/ftm-mainnet",
"services": {
"aggregator": {
"http": "/backend",
@@ -270,7 +270,7 @@
}
},
"137": {
"api": "https://staging.orionprotocol.io/polygon-mainnet",
"api": "https://staging.orion.xyz/polygon-mainnet",
"services": {
"aggregator": {
"http": "/backend",
@@ -288,7 +288,7 @@
}
},
"66": {
"api": "https://staging.orionprotocol.io/okc-mainnet",
"api": "https://staging.orion.xyz/okc-mainnet",
"services": {
"aggregator": {
"http": "/backend",
@@ -308,11 +308,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",
@@ -330,7 +330,7 @@
}
},
"3": {
"api": "https://dn-dev.orionprotocol.io/eth-ropsten",
"api": "https://dn-dev.orion.xyz/eth-ropsten",
"services": {
"aggregator": {
"http": "/backend",
@@ -350,11 +350,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",
@@ -373,7 +373,7 @@
"liquidityMigratorAddress": "0x23a1820a47BcD022E29f6058a5FD224242F50D1A"
},
"56": {
"api": "https://trade.orionprotocol.io/bsc-mainnet",
"api": "https://trade.orion.xyz/bsc-mainnet",
"services": {
"aggregator": {
"http": "/backend",
@@ -391,7 +391,7 @@
}
},
"250": {
"api": "https://trade.orionprotocol.io/ftm-mainnet",
"api": "https://trade.orion.xyz/ftm-mainnet",
"services": {
"aggregator": {
"http": "/backend",
@@ -409,7 +409,7 @@
}
},
"137": {
"api": "https://trade.orionprotocol.io/polygon-mainnet",
"api": "https://trade.orion.xyz/polygon-mainnet",
"services": {
"aggregator": {
"http": "/backend",
@@ -427,7 +427,7 @@
}
},
"66": {
"api": "https://trade.orionprotocol.io/okc-mainnet",
"api": "https://trade.orion.xyz/okc-mainnet",
"services": {
"aggregator": {
"http": "/backend",
@@ -446,4 +446,4 @@
}
}
}
}
}

View File

@@ -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(),

View File

@@ -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,

View File

@@ -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);