mirror of
https://github.com/orionprotocol/sdk.git
synced 2026-03-14 06:02:36 +03:00
Add TON mainnet/testnet
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@orionprotocol/sdk",
|
"name": "@orionprotocol/sdk",
|
||||||
"version": "0.19.92-rc121",
|
"version": "0.19.92-rc122",
|
||||||
"description": "Orion Protocol SDK",
|
"description": "Orion Protocol SDK",
|
||||||
"main": "./lib/index.cjs",
|
"main": "./lib/index.cjs",
|
||||||
"module": "./lib/index.js",
|
"module": "./lib/index.js",
|
||||||
|
|||||||
@@ -283,5 +283,25 @@
|
|||||||
"WETH": "0x4200000000000000000000000000000000000006",
|
"WETH": "0x4200000000000000000000000000000000000006",
|
||||||
"curveRegistry": ""
|
"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": {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -219,6 +219,25 @@
|
|||||||
"http": "/orion-indexer/"
|
"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/"
|
"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/"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ export const developmentChains = [
|
|||||||
SupportedChainId.OKC_TESTNET,
|
SupportedChainId.OKC_TESTNET,
|
||||||
SupportedChainId.EVENT_HORIZON_TESTNET,
|
SupportedChainId.EVENT_HORIZON_TESTNET,
|
||||||
SupportedChainId.LUMIA_TESTNET,
|
SupportedChainId.LUMIA_TESTNET,
|
||||||
|
SupportedChainId.TON_TESTNET,
|
||||||
];
|
];
|
||||||
export const productionChains = [
|
export const productionChains = [
|
||||||
SupportedChainId.MAINNET,
|
SupportedChainId.MAINNET,
|
||||||
@@ -25,4 +26,5 @@ export const productionChains = [
|
|||||||
SupportedChainId.AVAX,
|
SupportedChainId.AVAX,
|
||||||
SupportedChainId.BASE,
|
SupportedChainId.BASE,
|
||||||
SupportedChainId.LUMIA,
|
SupportedChainId.LUMIA,
|
||||||
|
SupportedChainId.TON,
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
538
src/types.ts
538
src/types.ts
@@ -6,80 +6,82 @@ import type positionStatuses from './constants/positionStatuses.js';
|
|||||||
import type { knownEnvs } from './config/schemas/index.js';
|
import type { knownEnvs } from './config/schemas/index.js';
|
||||||
import type getHistory from './Orion/bridge/getHistory.js';
|
import type getHistory from './Orion/bridge/getHistory.js';
|
||||||
|
|
||||||
export type DeepPartial<T> = T extends object ? {
|
export type DeepPartial<T> = T extends object
|
||||||
[P in keyof T]?: DeepPartial<T[P]>;
|
? {
|
||||||
} : T;
|
[P in keyof T]?: DeepPartial<T[P]>;
|
||||||
|
}
|
||||||
|
: T;
|
||||||
|
|
||||||
export type AssetPairUpdate = {
|
export type AssetPairUpdate = {
|
||||||
minQty: number
|
minQty: number;
|
||||||
pricePrecision: number
|
pricePrecision: number;
|
||||||
}
|
};
|
||||||
export type SubOrder = {
|
export type SubOrder = {
|
||||||
pair: string
|
pair: string;
|
||||||
exchange: string
|
exchange: string;
|
||||||
id: number
|
id: number;
|
||||||
amount: number
|
amount: number;
|
||||||
settledAmount: number
|
settledAmount: number;
|
||||||
price: number
|
price: number;
|
||||||
status: typeof subOrderStatuses[number]
|
status: (typeof subOrderStatuses)[number];
|
||||||
side: 'BUY' | 'SELL'
|
side: 'BUY' | 'SELL';
|
||||||
subOrdQty: number
|
subOrdQty: number;
|
||||||
}
|
};
|
||||||
|
|
||||||
export type Balance = {
|
export type Balance = {
|
||||||
tradable: string
|
tradable: string;
|
||||||
reserved: string
|
reserved: string;
|
||||||
contract: string
|
contract: string;
|
||||||
wallet: string
|
wallet: string;
|
||||||
allowance: string
|
allowance: string;
|
||||||
}
|
};
|
||||||
|
|
||||||
export type PositionStatus = typeof positionStatuses[number];
|
export type PositionStatus = (typeof positionStatuses)[number];
|
||||||
|
|
||||||
export type Order = {
|
export type Order = {
|
||||||
senderAddress: string // address
|
senderAddress: string; // address
|
||||||
matcherAddress: string // address
|
matcherAddress: string; // address
|
||||||
baseAsset: string // address
|
baseAsset: string; // address
|
||||||
quoteAsset: string // address
|
quoteAsset: string; // address
|
||||||
matcherFeeAsset: string // address
|
matcherFeeAsset: string; // address
|
||||||
amount: number // uint64
|
amount: number; // uint64
|
||||||
price: number // uint64
|
price: number; // uint64
|
||||||
matcherFee: number // uint64
|
matcherFee: number; // uint64
|
||||||
nonce: number // uint64
|
nonce: number; // uint64
|
||||||
expiration: number // uint64
|
expiration: number; // uint64
|
||||||
buySide: 0 | 1 // uint8, 1=buy, 0=sell
|
buySide: 0 | 1; // uint8, 1=buy, 0=sell
|
||||||
isPersonalSign: boolean // bool
|
isPersonalSign: boolean; // bool
|
||||||
}
|
};
|
||||||
|
|
||||||
export type SignedOrder = {
|
export type SignedOrder = {
|
||||||
id: string // hash of Order (it's not part of order structure in smart-contract)
|
id: string; // hash of Order (it's not part of order structure in smart-contract)
|
||||||
signature: string // bytes
|
signature: string; // bytes
|
||||||
needWithdraw?: boolean // bool (not supported yet by smart-contract)
|
needWithdraw?: boolean; // bool (not supported yet by smart-contract)
|
||||||
} & Order
|
} & Order;
|
||||||
|
|
||||||
export type CancelOrderRequest = {
|
export type CancelOrderRequest = {
|
||||||
id: number | string
|
id: number | string;
|
||||||
senderAddress: string
|
senderAddress: string;
|
||||||
isPersonalSign: boolean
|
isPersonalSign: boolean;
|
||||||
}
|
};
|
||||||
|
|
||||||
export type SignedCancelOrderRequest = {
|
export type SignedCancelOrderRequest = {
|
||||||
id: number | string
|
id: number | string;
|
||||||
senderAddress: string
|
senderAddress: string;
|
||||||
signature: string
|
signature: string;
|
||||||
} & CancelOrderRequest
|
} & CancelOrderRequest;
|
||||||
|
|
||||||
export type Pair = {
|
export type Pair = {
|
||||||
name: string
|
name: string;
|
||||||
baseCurrency: string
|
baseCurrency: string;
|
||||||
quoteCurrency: string
|
quoteCurrency: string;
|
||||||
lastPrice: string
|
lastPrice: string;
|
||||||
openPrice: string
|
openPrice: string;
|
||||||
change24h: string
|
change24h: string;
|
||||||
high: string
|
high: string;
|
||||||
low: string
|
low: string;
|
||||||
vol24h: string
|
vol24h: string;
|
||||||
}
|
};
|
||||||
|
|
||||||
export enum SupportedChainId {
|
export enum SupportedChainId {
|
||||||
MAINNET = '1',
|
MAINNET = '1',
|
||||||
@@ -107,121 +109,126 @@ export enum SupportedChainId {
|
|||||||
EVENT_HORIZON_TESTNET = '123420000034',
|
EVENT_HORIZON_TESTNET = '123420000034',
|
||||||
LUMIA_TESTNET = '1952959480',
|
LUMIA_TESTNET = '1952959480',
|
||||||
|
|
||||||
|
TON = '4398026970693',
|
||||||
|
TON_TESTNET = '4398026970694',
|
||||||
|
|
||||||
// For testing and debug purpose
|
// For testing and debug purpose
|
||||||
// BROKEN = '0',
|
// BROKEN = '0',
|
||||||
}
|
}
|
||||||
|
|
||||||
const balanceTypes = ['exchange', 'wallet'] as const;
|
const balanceTypes = ['exchange', 'wallet'] as const;
|
||||||
|
|
||||||
export type Source = typeof balanceTypes[number];
|
export type Source = (typeof balanceTypes)[number];
|
||||||
export type Asset = {
|
export type Asset = {
|
||||||
name: string
|
name: string;
|
||||||
address: string
|
address: string;
|
||||||
}
|
};
|
||||||
export type BalanceRequirement = {
|
export type BalanceRequirement = {
|
||||||
readonly reason: string
|
readonly reason: string;
|
||||||
readonly asset: Asset
|
readonly asset: Asset;
|
||||||
readonly amount: string
|
readonly amount: string;
|
||||||
readonly sources: Source[]
|
readonly sources: Source[];
|
||||||
readonly spenderAddress?: string | undefined
|
readonly spenderAddress?: string | undefined;
|
||||||
}
|
};
|
||||||
|
|
||||||
export type AggregatedBalanceRequirement = {
|
export type AggregatedBalanceRequirement = {
|
||||||
readonly asset: Asset
|
readonly asset: Asset;
|
||||||
readonly sources: Source[]
|
readonly sources: Source[];
|
||||||
readonly spenderAddress?: string | undefined
|
readonly spenderAddress?: string | undefined;
|
||||||
items: Partial<Record<string, string>>
|
items: Partial<Record<string, string>>;
|
||||||
}
|
};
|
||||||
|
|
||||||
export type ApproveFix = {
|
export type ApproveFix = {
|
||||||
readonly type: 'byApprove'
|
readonly type: 'byApprove';
|
||||||
readonly targetAmount: BigNumber.Value
|
readonly targetAmount: BigNumber.Value;
|
||||||
readonly spenderAddress: string
|
readonly spenderAddress: string;
|
||||||
}
|
};
|
||||||
|
|
||||||
export type DepositFix = {
|
export type DepositFix = {
|
||||||
readonly type: 'byDeposit'
|
readonly type: 'byDeposit';
|
||||||
readonly amount: BigNumber.Value
|
readonly amount: BigNumber.Value;
|
||||||
readonly asset: string
|
readonly asset: string;
|
||||||
}
|
};
|
||||||
|
|
||||||
type Fix = ApproveFix | DepositFix;
|
type Fix = ApproveFix | DepositFix;
|
||||||
|
|
||||||
export type BalanceIssue = {
|
export type BalanceIssue = {
|
||||||
readonly asset: Asset
|
readonly asset: Asset;
|
||||||
readonly message: string
|
readonly message: string;
|
||||||
readonly sources: Source[]
|
readonly sources: Source[];
|
||||||
readonly fixes?: Fix[]
|
readonly fixes?: Fix[];
|
||||||
}
|
};
|
||||||
|
|
||||||
// export type Exchange = typeof exchanges[number];
|
// export type Exchange = typeof exchanges[number];
|
||||||
|
|
||||||
export type OrderbookItem = {
|
export type OrderbookItem = {
|
||||||
price: string
|
price: string;
|
||||||
amount: string
|
amount: string;
|
||||||
exchanges: string[]
|
exchanges: string[];
|
||||||
vob: Array<{
|
vob: Array<{
|
||||||
side: 'BUY' | 'SELL'
|
side: 'BUY' | 'SELL';
|
||||||
pairName: string
|
pairName: string;
|
||||||
}>
|
}>;
|
||||||
}
|
};
|
||||||
|
|
||||||
export type SwapInfoAlternative = {
|
export type SwapInfoAlternative = {
|
||||||
exchanges: string[]
|
exchanges: string[];
|
||||||
path: string[]
|
path: string[];
|
||||||
marketAmountOut?: number | undefined
|
marketAmountOut?: number | undefined;
|
||||||
marketAmountIn?: number | undefined
|
marketAmountIn?: number | undefined;
|
||||||
marketPrice: number
|
marketPrice: number;
|
||||||
availableAmountIn?: number | undefined
|
availableAmountIn?: number | undefined;
|
||||||
availableAmountOut?: number | undefined
|
availableAmountOut?: number | undefined;
|
||||||
}
|
};
|
||||||
|
|
||||||
export type Factory = typeof factories[number]
|
export type Factory = (typeof factories)[number];
|
||||||
|
|
||||||
export type SingleSwap = {
|
export type SingleSwap = {
|
||||||
pool: string
|
pool: string;
|
||||||
assetIn: string
|
assetIn: string;
|
||||||
assetOut: string
|
assetOut: string;
|
||||||
factory: Factory
|
factory: Factory;
|
||||||
}
|
};
|
||||||
|
|
||||||
export type SwapInfoBase = {
|
export type SwapInfoBase = {
|
||||||
swapRequestId: string
|
swapRequestId: string;
|
||||||
assetIn: string
|
assetIn: string;
|
||||||
assetOut: string
|
assetOut: string;
|
||||||
amountIn: number
|
amountIn: number;
|
||||||
amountOut: number
|
amountOut: number;
|
||||||
minAmountIn: number
|
minAmountIn: number;
|
||||||
minAmountOut: number
|
minAmountOut: number;
|
||||||
|
|
||||||
path: string[]
|
path: string[];
|
||||||
exchangeContractPath: SingleSwap[]
|
exchangeContractPath: SingleSwap[];
|
||||||
exchanges?: string[] | undefined
|
exchanges?: string[] | undefined;
|
||||||
poolOptimal: boolean
|
poolOptimal: boolean;
|
||||||
|
|
||||||
price?: number | undefined
|
price?: number | undefined;
|
||||||
marketPrice?: number | undefined
|
marketPrice?: number | undefined;
|
||||||
orderInfo?: {
|
orderInfo?:
|
||||||
pair: string
|
| {
|
||||||
side: 'BUY' | 'SELL'
|
pair: string;
|
||||||
amount: number
|
side: 'BUY' | 'SELL';
|
||||||
safePrice: number
|
amount: number;
|
||||||
} | undefined
|
safePrice: number;
|
||||||
alternatives: SwapInfoAlternative[]
|
}
|
||||||
assetsNameMapping?: Partial<Record<string, string>> | undefined
|
| undefined;
|
||||||
}
|
alternatives: SwapInfoAlternative[];
|
||||||
|
assetsNameMapping?: Partial<Record<string, string>> | undefined;
|
||||||
|
};
|
||||||
|
|
||||||
export type SwapInfoByAmountIn = SwapInfoBase & {
|
export type SwapInfoByAmountIn = SwapInfoBase & {
|
||||||
kind: 'exactSpend'
|
kind: 'exactSpend';
|
||||||
availableAmountIn?: number | undefined
|
availableAmountIn?: number | undefined;
|
||||||
marketAmountOut?: number | undefined
|
marketAmountOut?: number | undefined;
|
||||||
}
|
};
|
||||||
|
|
||||||
export type SwapInfoByAmountOut = SwapInfoBase & {
|
export type SwapInfoByAmountOut = SwapInfoBase & {
|
||||||
kind: 'exactReceive'
|
kind: 'exactReceive';
|
||||||
marketAmountIn?: number | undefined
|
marketAmountIn?: number | undefined;
|
||||||
availableAmountOut?: number | undefined
|
availableAmountOut?: number | undefined;
|
||||||
}
|
};
|
||||||
|
|
||||||
export type SwapInfo = SwapInfoByAmountIn | SwapInfoByAmountOut;
|
export type SwapInfo = SwapInfoByAmountIn | SwapInfoByAmountOut;
|
||||||
|
|
||||||
@@ -233,107 +240,114 @@ export enum HistoryTransactionStatus {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export type BasicAuthCredentials = {
|
export type BasicAuthCredentials = {
|
||||||
username: string
|
username: string;
|
||||||
password: string
|
password: string;
|
||||||
}
|
};
|
||||||
|
|
||||||
export type VerboseUnitConfig = {
|
export type VerboseUnitConfig = {
|
||||||
// env?: string;
|
// env?: string;
|
||||||
// api: string;
|
// api: string;
|
||||||
chainId: SupportedChainId
|
chainId: SupportedChainId;
|
||||||
nodeJsonRpc: string
|
nodeJsonRpc: string;
|
||||||
services: {
|
services: {
|
||||||
blockchainService: {
|
blockchainService: {
|
||||||
http: string
|
http: string;
|
||||||
// For example:
|
// For example:
|
||||||
// http://localhost:3001/,
|
// http://localhost:3001/,
|
||||||
// http://10.123.34.23:3001/,
|
// http://10.123.34.23:3001/,
|
||||||
// https://blockchain:3001/
|
// https://blockchain:3001/
|
||||||
}
|
};
|
||||||
aggregator: {
|
aggregator: {
|
||||||
http: string
|
http: string;
|
||||||
ws: string
|
ws: string;
|
||||||
// For example:
|
// For example:
|
||||||
// http://localhost:3002/,
|
// http://localhost:3002/,
|
||||||
// http://10.34.23.5:3002/,
|
// http://10.34.23.5:3002/,
|
||||||
// https://aggregator:3002/
|
// https://aggregator:3002/
|
||||||
}
|
};
|
||||||
priceFeed: {
|
priceFeed: {
|
||||||
api: string
|
api: string;
|
||||||
// For example:
|
// For example:
|
||||||
// http://localhost:3003/,
|
// http://localhost:3003/,
|
||||||
// http://10.23.5.11:3003/,
|
// http://10.23.5.11:3003/,
|
||||||
// https://price-feed: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 = {
|
export type EnvConfig = {
|
||||||
analyticsAPI: string
|
analyticsAPI: string;
|
||||||
referralAPI: string
|
referralAPI: string;
|
||||||
networks: Partial<
|
networks: Partial<Record<SupportedChainId, VerboseUnitConfig>>;
|
||||||
Record<
|
};
|
||||||
SupportedChainId,
|
|
||||||
VerboseUnitConfig
|
|
||||||
>
|
|
||||||
>
|
|
||||||
}
|
|
||||||
export type AggregatedAssets = Partial<
|
export type AggregatedAssets = Partial<
|
||||||
Record<
|
Record<
|
||||||
string,
|
string,
|
||||||
Partial<
|
Partial<
|
||||||
Record<SupportedChainId, {
|
Record<
|
||||||
address: string
|
SupportedChainId,
|
||||||
}>
|
{
|
||||||
|
address: string;
|
||||||
|
}
|
||||||
|
>
|
||||||
>
|
>
|
||||||
>
|
>
|
||||||
>;
|
>;
|
||||||
|
|
||||||
export type RedeemOrder = {
|
export type RedeemOrder = {
|
||||||
sender: string
|
sender: string;
|
||||||
receiver: string
|
receiver: string;
|
||||||
asset: string
|
asset: string;
|
||||||
amount: number
|
amount: number;
|
||||||
expiration: number
|
expiration: number;
|
||||||
secretHash: string
|
secretHash: string;
|
||||||
signature: string
|
signature: string;
|
||||||
claimReceiver: string
|
claimReceiver: string;
|
||||||
}
|
};
|
||||||
|
|
||||||
export interface AtomicSwapLocal {
|
export interface AtomicSwapLocal {
|
||||||
secret: string
|
secret: string;
|
||||||
secretHash: string
|
secretHash: string;
|
||||||
walletAddress: string
|
walletAddress: string;
|
||||||
env?: string | undefined
|
env?: string | undefined;
|
||||||
|
|
||||||
sourceChainId?: SupportedChainId | undefined
|
sourceChainId?: SupportedChainId | undefined;
|
||||||
targetChainId?: SupportedChainId | undefined
|
targetChainId?: SupportedChainId | undefined;
|
||||||
|
|
||||||
amount?: string | undefined
|
amount?: string | undefined;
|
||||||
assetName?: string | undefined
|
assetName?: string | undefined;
|
||||||
|
|
||||||
liquidityMigrationTxHash?: string | undefined
|
liquidityMigrationTxHash?: string | undefined;
|
||||||
lockTransactionHash?: string | undefined
|
lockTransactionHash?: string | undefined;
|
||||||
refundTransactionHash?: string | undefined
|
refundTransactionHash?: string | undefined;
|
||||||
|
|
||||||
creationDate?: number | undefined
|
creationDate?: number | undefined;
|
||||||
lockExpiration?: number | undefined
|
lockExpiration?: number | undefined;
|
||||||
placingOrderError?: string | undefined
|
placingOrderError?: string | undefined;
|
||||||
redeemSettlement?: {
|
redeemSettlement?:
|
||||||
type: 'own_tx'
|
| {
|
||||||
} | {
|
type: 'own_tx';
|
||||||
type: 'orion_tx'
|
}
|
||||||
requestedAt?: number
|
| {
|
||||||
result?: {
|
type: 'orion_tx';
|
||||||
timestamp: number
|
requestedAt?: number;
|
||||||
value: 'success' | 'failed'
|
result?: {
|
||||||
}
|
timestamp: number;
|
||||||
} | undefined
|
value: 'success' | 'failed';
|
||||||
|
};
|
||||||
|
}
|
||||||
|
| undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum TxStatus {
|
export enum TxStatus {
|
||||||
@@ -361,71 +375,72 @@ export enum TxType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export type TxDepositOrWithdrawPayload = {
|
export type TxDepositOrWithdrawPayload = {
|
||||||
type: TxType.DEPOSIT | TxType.WITHDRAW
|
type: TxType.DEPOSIT | TxType.WITHDRAW;
|
||||||
data: {
|
data: {
|
||||||
asset: string
|
asset: string;
|
||||||
amount: string
|
amount: string;
|
||||||
}
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export type TxSwapThroughOrionPoolPayload = {
|
export type TxSwapThroughOrionPoolPayload = {
|
||||||
type: TxType.SWAP_THROUGH_ORION_POOL
|
type: TxType.SWAP_THROUGH_ORION_POOL;
|
||||||
data: {
|
data: {
|
||||||
side: 'buy' | 'sell'
|
side: 'buy' | 'sell';
|
||||||
assetIn: string
|
assetIn: string;
|
||||||
assetOut: string
|
assetOut: string;
|
||||||
amount: string
|
amount: string;
|
||||||
price: string
|
price: string;
|
||||||
}
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export type TxBridgePayload = {
|
export type TxBridgePayload = {
|
||||||
type: TxType.BRIDGE_LOCK | TxType.BRIDGE_REDEEM | TxType.BRIDGE_REFUND
|
type: TxType.BRIDGE_LOCK | TxType.BRIDGE_REDEEM | TxType.BRIDGE_REFUND;
|
||||||
data: {
|
data: {
|
||||||
secretHash: string
|
secretHash: string;
|
||||||
}
|
};
|
||||||
}
|
};
|
||||||
|
|
||||||
export type TxLiquidityMigrationPayload = {
|
export type TxLiquidityMigrationPayload = {
|
||||||
type: TxType.LIQUIDITY_MIGRATION
|
type: TxType.LIQUIDITY_MIGRATION;
|
||||||
data: {
|
data: {
|
||||||
source: SupportedChainId
|
source: SupportedChainId;
|
||||||
target: SupportedChainId
|
target: SupportedChainId;
|
||||||
pair: string
|
pair: string;
|
||||||
pairAddress: string
|
pairAddress: string;
|
||||||
assetA: {
|
assetA: {
|
||||||
amount: string
|
amount: string;
|
||||||
secretHash: string
|
secretHash: string;
|
||||||
secret: string
|
secret: string;
|
||||||
}
|
};
|
||||||
assetB: {
|
assetB: {
|
||||||
amount: string
|
amount: string;
|
||||||
secretHash: string
|
secretHash: string;
|
||||||
secret: string
|
secret: string;
|
||||||
}
|
};
|
||||||
expiration: number
|
expiration: number;
|
||||||
env?: string
|
env?: string;
|
||||||
}
|
};
|
||||||
}
|
};
|
||||||
|
|
||||||
export type TxRedeemTwoAtomicsPayload = {
|
export type TxRedeemTwoAtomicsPayload = {
|
||||||
type: TxType.REDEEM_TWO_ATOMICS
|
type: TxType.REDEEM_TWO_ATOMICS;
|
||||||
data: {
|
data: {
|
||||||
secretHash1: string
|
secretHash1: string;
|
||||||
secretHash2: string
|
secretHash2: string;
|
||||||
}
|
};
|
||||||
}
|
};
|
||||||
|
|
||||||
export type TransactionInfo = {
|
export type TransactionInfo = {
|
||||||
id?: string
|
id?: string;
|
||||||
status?: TxStatus
|
status?: TxStatus;
|
||||||
hash?: string
|
hash?: string;
|
||||||
payload?: TxDepositOrWithdrawPayload
|
payload?:
|
||||||
| TxSwapThroughOrionPoolPayload
|
| TxDepositOrWithdrawPayload
|
||||||
| TxBridgePayload
|
| TxSwapThroughOrionPoolPayload
|
||||||
| TxLiquidityMigrationPayload
|
| TxBridgePayload
|
||||||
| TxRedeemTwoAtomicsPayload
|
| TxLiquidityMigrationPayload
|
||||||
}
|
| TxRedeemTwoAtomicsPayload;
|
||||||
|
};
|
||||||
|
|
||||||
type BridgeHistory = Awaited<ReturnType<typeof getHistory>>;
|
type BridgeHistory = Awaited<ReturnType<typeof getHistory>>;
|
||||||
|
|
||||||
@@ -433,21 +448,20 @@ type BridgeHistoryItem = NonNullable<BridgeHistory[string]>;
|
|||||||
|
|
||||||
export type AtomicSwap = Partial<
|
export type AtomicSwap = Partial<
|
||||||
Omit<BridgeHistoryItem, 'creationDate' | 'expiration' | 'secret'>
|
Omit<BridgeHistoryItem, 'creationDate' | 'expiration' | 'secret'>
|
||||||
> & Partial<
|
> &
|
||||||
Omit<AtomicSwapLocal, 'creationDate' | 'expiration' | 'secret'>
|
Partial<Omit<AtomicSwapLocal, 'creationDate' | 'expiration' | 'secret'>> & {
|
||||||
> & {
|
sourceChainId: SupportedChainId;
|
||||||
sourceChainId: SupportedChainId
|
targetChainId: SupportedChainId;
|
||||||
targetChainId: SupportedChainId
|
lockExpiration: number;
|
||||||
lockExpiration: number
|
secretHash: string;
|
||||||
secretHash: string
|
walletAddress: string;
|
||||||
walletAddress: string
|
secret?: string | undefined;
|
||||||
secret?: string | undefined
|
|
||||||
|
|
||||||
creationDate?: number | undefined
|
creationDate?: number | undefined;
|
||||||
redeemExpired?: boolean | undefined
|
redeemExpired?: boolean | undefined;
|
||||||
|
|
||||||
lockTx?: TransactionInfo | undefined
|
lockTx?: TransactionInfo | undefined;
|
||||||
redeemTx?: TransactionInfo | undefined
|
redeemTx?: TransactionInfo | undefined;
|
||||||
refundTx?: TransactionInfo | undefined
|
refundTx?: TransactionInfo | undefined;
|
||||||
liquidityMigrationTx?: TransactionInfo | undefined
|
liquidityMigrationTx?: TransactionInfo | undefined;
|
||||||
}
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user