@reyaxyz/common 0.344.3 → 0.346.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/incentives-api-types.js.map +1 -1
- package/dist/trading-api-types.js.map +1 -1
- package/dist/transactions/executeTransaction.js +8 -123
- package/dist/transactions/executeTransaction.js.map +1 -1
- package/dist/types/incentives-api-types.d.ts +6 -2
- package/dist/types/incentives-api-types.d.ts.map +1 -1
- package/dist/types/trading-api-types.d.ts +103 -1
- package/dist/types/trading-api-types.d.ts.map +1 -1
- package/dist/types/transactions/executeTransaction.d.ts +2 -15
- package/dist/types/transactions/executeTransaction.d.ts.map +1 -1
- package/dist/types/utils/layerzero.d.ts +22 -0
- package/dist/types/utils/layerzero.d.ts.map +1 -0
- package/dist/types/utils/token/batch-token-getters.d.ts +0 -5
- package/dist/types/utils/token/batch-token-getters.d.ts.map +1 -1
- package/dist/types/utils/token/token-getters.d.ts +0 -2
- package/dist/types/utils/token/token-getters.d.ts.map +1 -1
- package/dist/utils/layerzero.js +31 -0
- package/dist/utils/layerzero.js.map +1 -0
- package/dist/utils/token/batch-token-getters.js +13 -64
- package/dist/utils/token/batch-token-getters.js.map +1 -1
- package/dist/utils/token/token-getters.js +1 -42
- package/dist/utils/token/token-getters.js.map +1 -1
- package/package.json +2 -2
- package/src/incentives-api-types.ts +11 -5
- package/src/trading-api-types.ts +105 -1
- package/src/transactions/executeTransaction.ts +2 -130
- package/src/utils/layerzero.ts +66 -0
- package/src/utils/token/batch-token-getters.ts +0 -28
- package/src/utils/token/token-getters.ts +0 -29
- package/dist/types/utils/layerzero/index.d.ts +0 -3
- package/dist/types/utils/layerzero/index.d.ts.map +0 -1
- package/dist/types/utils/layerzero/oft-config.d.ts +0 -4
- package/dist/types/utils/layerzero/oft-config.d.ts.map +0 -1
- package/dist/types/utils/layerzero/types.d.ts +0 -23
- package/dist/types/utils/layerzero/types.d.ts.map +0 -1
- package/dist/utils/layerzero/index.js +0 -19
- package/dist/utils/layerzero/index.js.map +0 -1
- package/dist/utils/layerzero/oft-config.js +0 -29
- package/dist/utils/layerzero/oft-config.js.map +0 -1
- package/dist/utils/layerzero/types.js +0 -3
- package/dist/utils/layerzero/types.js.map +0 -1
- package/src/utils/layerzero/index.ts +0 -2
- package/src/utils/layerzero/oft-config.ts +0 -32
- package/src/utils/layerzero/types.ts +0 -25
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { MoneyInOutChainId, ReyaChainId } from '../types';
|
|
1
|
+
import { JsonRpcSigner, Signer } from 'ethers';
|
|
3
2
|
import { ContractType } from './contractAddresses';
|
|
4
3
|
export type Transaction = {
|
|
5
4
|
from: string;
|
|
@@ -7,17 +6,5 @@ export type Transaction = {
|
|
|
7
6
|
data: string;
|
|
8
7
|
value?: string;
|
|
9
8
|
};
|
|
10
|
-
export declare function
|
|
11
|
-
gasLimit: bigint;
|
|
12
|
-
maxPriorityFeePerGas?: bigint;
|
|
13
|
-
maxFeePerGas?: bigint;
|
|
14
|
-
}>;
|
|
15
|
-
export declare function estimateGasGivenAddress(accountAddress: string, data: string, value: string, chainId: number, targetContract: ContractType | string): Promise<Transaction & {
|
|
16
|
-
gasLimit: bigint;
|
|
17
|
-
maxPriorityFeePerGas?: bigint;
|
|
18
|
-
maxFeePerGas?: bigint;
|
|
19
|
-
}>;
|
|
20
|
-
export declare function estimateGasFromTxAndChainId(chainId: ReyaChainId | MoneyInOutChainId, tx: ethers.TransactionRequest): Promise<bigint>;
|
|
21
|
-
export declare function executeTransaction(signer: Signer | JsonRpcSigner, data: string, value: string, chainId: number, targetContract: ContractType | string): Promise<ethers.TransactionReceipt | null>;
|
|
22
|
-
export declare function decodeErrorBytes(returnData: string): Promise<string>;
|
|
9
|
+
export declare function executeTransaction(signer: Signer | JsonRpcSigner, data: string, value: string, chainId: number, targetContract: ContractType | string): Promise<import("ethers").TransactionReceipt | null>;
|
|
23
10
|
//# sourceMappingURL=executeTransaction.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executeTransaction.d.ts","sourceRoot":"/","sources":["transactions/executeTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"executeTransaction.d.ts","sourceRoot":"/","sources":["transactions/executeTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAE/C,OAAO,EAAE,YAAY,EAAc,MAAM,qBAAqB,CAAC;AAM/D,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAuDF,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,MAAM,GAAG,aAAa,EAC9B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EACf,cAAc,EAAE,YAAY,GAAG,MAAM,uDAkBtC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export type OFTMessagingFee = {
|
|
2
|
+
nativeFee: string;
|
|
3
|
+
lzTokenFee: string;
|
|
4
|
+
};
|
|
5
|
+
export type OFTSendParams = {
|
|
6
|
+
dstEid: number;
|
|
7
|
+
to: string;
|
|
8
|
+
amountLD: bigint;
|
|
9
|
+
minAmountLD: bigint;
|
|
10
|
+
extraOptions: string;
|
|
11
|
+
composeMsg: string;
|
|
12
|
+
oftCmd: string;
|
|
13
|
+
};
|
|
14
|
+
export declare const buildOFTSendParamsToDepositInMA: (params: {
|
|
15
|
+
amount: bigint;
|
|
16
|
+
collateralAddressInReyaPeriphery: string;
|
|
17
|
+
dstEid: number;
|
|
18
|
+
extraOptions: string;
|
|
19
|
+
receiverAddress: string;
|
|
20
|
+
marginAccountId: number;
|
|
21
|
+
}) => OFTSendParams;
|
|
22
|
+
//# sourceMappingURL=layerzero.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layerzero.d.ts","sourceRoot":"/","sources":["utils/layerzero.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,eAAe,GAAG;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAQF,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAoBF,eAAO,MAAM,+BAA+B,WAAY;IACtD,MAAM,EAAE,MAAM,CAAC;IACf,gCAAgC,EAAE,MAAM,CAAC;IACzC,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;CACzB,KAAG,aAiBH,CAAC"}
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
import { MoneyInOutChainId, ReyaChainId } from '../../types';
|
|
2
|
-
export type GetETHBalanceBatchArgs = {
|
|
3
|
-
walletAddress: string;
|
|
4
|
-
chain: MoneyInOutChainId | ReyaChainId;
|
|
5
|
-
};
|
|
6
2
|
export type GetERC20BalanceBatchArgs = {
|
|
7
3
|
tokenAddress: string;
|
|
8
4
|
tokenDecimals: number;
|
|
@@ -16,7 +12,6 @@ export type GetERC20AllowanceBatchArgs = {
|
|
|
16
12
|
spenderAddress: string;
|
|
17
13
|
chain: MoneyInOutChainId | ReyaChainId;
|
|
18
14
|
};
|
|
19
|
-
export declare const getETHBalanceBatch: ({ walletAddress, chain, }: GetETHBalanceBatchArgs) => Promise<number>;
|
|
20
15
|
export declare const getERC20BalanceBatch: ({ tokenAddress, tokenDecimals, walletAddress, chain, }: GetERC20BalanceBatchArgs) => Promise<number>;
|
|
21
16
|
export declare const getERC20AllowanceBatch: ({ tokenAddress, tokenDecimals, walletAddress, spenderAddress, chain, }: GetERC20AllowanceBatchArgs) => Promise<number>;
|
|
22
17
|
//# sourceMappingURL=batch-token-getters.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"batch-token-getters.d.ts","sourceRoot":"/","sources":["utils/token/batch-token-getters.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"batch-token-getters.d.ts","sourceRoot":"/","sources":["utils/token/batch-token-getters.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAI7D,MAAM,MAAM,wBAAwB,GAAG;IACrC,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,iBAAiB,GAAG,WAAW,CAAC;CACxC,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG;IACvC,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,iBAAiB,GAAG,WAAW,CAAC;CACxC,CAAC;AAEF,eAAO,MAAM,oBAAoB,2DAK9B,wBAAwB,KAAG,QAAQ,MAAM,CAiB3C,CAAC;AAEF,eAAO,MAAM,sBAAsB,2EAMhC,0BAA0B,KAAG,QAAQ,MAAM,CAoB7C,CAAC"}
|
|
@@ -18,6 +18,4 @@ export type GetERC20AllowanceArgs = {
|
|
|
18
18
|
subject: ethers.Signer;
|
|
19
19
|
};
|
|
20
20
|
export declare const getERC20Allowance: ({ walletAddress, tokenAddress, tokenDecimals, spenderAddress, subject, }: GetERC20AllowanceArgs) => Promise<number>;
|
|
21
|
-
export declare const getERC20Balance: ({ tokenAddress, tokenDecimals, walletAddress, subject, }: GetERC20BalanceArgs) => Promise<number>;
|
|
22
|
-
export declare const getETHBalance: ({ walletAddress, subject, }: GetETHBalanceArgs) => Promise<number>;
|
|
23
21
|
//# sourceMappingURL=token-getters.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token-getters.d.ts","sourceRoot":"/","sources":["utils/token/token-getters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG3C,MAAM,MAAM,mBAAmB,GAAG;IAChC,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC;CAC1C,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC;CAC1C,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,YAAY,CAAC,cAAc,CAAC,CAAC;IAC3C,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC;CACxB,CAAC;AAEF,eAAO,MAAM,iBAAiB,6EAM3B,qBAAqB,KAAG,QAAQ,MAAM,CAUxC,CAAC
|
|
1
|
+
{"version":3,"file":"token-getters.d.ts","sourceRoot":"/","sources":["utils/token/token-getters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG3C,MAAM,MAAM,mBAAmB,GAAG;IAChC,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC;CAC1C,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC;CAC1C,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,YAAY,CAAC,cAAc,CAAC,CAAC;IAC3C,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC;CACxB,CAAC;AAEF,eAAO,MAAM,iBAAiB,6EAM3B,qBAAqB,KAAG,QAAQ,MAAM,CAUxC,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildOFTSendParamsToDepositInMA = void 0;
|
|
4
|
+
var ethers_1 = require("ethers");
|
|
5
|
+
var LzComposerOperationType;
|
|
6
|
+
(function (LzComposerOperationType) {
|
|
7
|
+
LzComposerOperationType[LzComposerOperationType["NONE"] = 0] = "NONE";
|
|
8
|
+
LzComposerOperationType[LzComposerOperationType["DEPOSIT_SPOT_ACCOUNT"] = 1] = "DEPOSIT_SPOT_ACCOUNT";
|
|
9
|
+
LzComposerOperationType[LzComposerOperationType["DEPOSIT_ACCOUNT"] = 2] = "DEPOSIT_ACCOUNT";
|
|
10
|
+
})(LzComposerOperationType || (LzComposerOperationType = {}));
|
|
11
|
+
var buildComposeMsg = function (accountId, collateralAddressInReyaPeriphery) {
|
|
12
|
+
var opType = LzComposerOperationType.DEPOSIT_ACCOUNT;
|
|
13
|
+
var opData = ethers_1.ethers.AbiCoder.defaultAbiCoder().encode(['uint128', 'address'], [accountId, collateralAddressInReyaPeriphery]);
|
|
14
|
+
var composeMsg = ethers_1.ethers.AbiCoder.defaultAbiCoder().encode(['uint8', 'bytes'], [opType, opData]);
|
|
15
|
+
return composeMsg;
|
|
16
|
+
};
|
|
17
|
+
var buildOFTSendParamsToDepositInMA = function (params) {
|
|
18
|
+
var receiverBytes32 = ethers_1.ethers.zeroPadValue(params.receiverAddress, 32);
|
|
19
|
+
var composeMsg = buildComposeMsg(params.marginAccountId, params.collateralAddressInReyaPeriphery);
|
|
20
|
+
return {
|
|
21
|
+
dstEid: params.dstEid,
|
|
22
|
+
to: receiverBytes32,
|
|
23
|
+
amountLD: params.amount,
|
|
24
|
+
minAmountLD: params.amount,
|
|
25
|
+
extraOptions: params.extraOptions,
|
|
26
|
+
composeMsg: composeMsg,
|
|
27
|
+
oftCmd: '0x',
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
exports.buildOFTSendParamsToDepositInMA = buildOFTSendParamsToDepositInMA;
|
|
31
|
+
//# sourceMappingURL=layerzero.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layerzero.js","sourceRoot":"/","sources":["utils/layerzero.ts"],"names":[],"mappings":";;;AAAA,iCAAgC;AAOhC,IAAK,uBAIJ;AAJD,WAAK,uBAAuB;IAC1B,qEAAQ,CAAA;IACR,qGAAwB,CAAA;IACxB,2FAAmB,CAAA;AACrB,CAAC,EAJI,uBAAuB,KAAvB,uBAAuB,QAI3B;AAYD,IAAM,eAAe,GAAG,UACtB,SAAiB,EACjB,gCAAwC;IAExC,IAAM,MAAM,GAAG,uBAAuB,CAAC,eAAe,CAAC;IACvD,IAAM,MAAM,GAAG,eAAM,CAAC,QAAQ,CAAC,eAAe,EAAE,CAAC,MAAM,CACrD,CAAC,SAAS,EAAE,SAAS,CAAC,EACtB,CAAC,SAAS,EAAE,gCAAgC,CAAC,CAC9C,CAAC;IAEF,IAAM,UAAU,GAAG,eAAM,CAAC,QAAQ,CAAC,eAAe,EAAE,CAAC,MAAM,CACzD,CAAC,OAAO,EAAE,OAAO,CAAC,EAClB,CAAC,MAAM,EAAE,MAAM,CAAC,CACjB,CAAC;IAEF,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC;AAEK,IAAM,+BAA+B,GAAG,UAAC,MAO/C;IACC,IAAM,eAAe,GAAG,eAAM,CAAC,YAAY,CAAC,MAAM,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC;IAExE,IAAM,UAAU,GAAG,eAAe,CAChC,MAAM,CAAC,eAAe,EACtB,MAAM,CAAC,gCAAgC,CACxC,CAAC;IAEF,OAAO;QACL,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,EAAE,EAAE,eAAe;QACnB,QAAQ,EAAE,MAAM,CAAC,MAAM;QACvB,WAAW,EAAE,MAAM,CAAC,MAAM;QAC1B,YAAY,EAAE,MAAM,CAAC,YAAY;QACjC,UAAU,YAAA;QACV,MAAM,EAAE,IAAI;KACb,CAAC;AACJ,CAAC,CAAC;AAxBW,QAAA,+BAA+B,mCAwB1C","sourcesContent":["import { ethers } from 'ethers';\n\nexport type OFTMessagingFee = {\n nativeFee: string;\n lzTokenFee: string;\n};\n\nenum LzComposerOperationType {\n NONE = 0,\n DEPOSIT_SPOT_ACCOUNT = 1,\n DEPOSIT_ACCOUNT = 2,\n}\n\nexport type OFTSendParams = {\n dstEid: number;\n to: string;\n amountLD: bigint;\n minAmountLD: bigint;\n extraOptions: string;\n composeMsg: string;\n oftCmd: string;\n};\n\nconst buildComposeMsg = (\n accountId: number,\n collateralAddressInReyaPeriphery: string,\n) => {\n const opType = LzComposerOperationType.DEPOSIT_ACCOUNT;\n const opData = ethers.AbiCoder.defaultAbiCoder().encode(\n ['uint128', 'address'],\n [accountId, collateralAddressInReyaPeriphery],\n );\n\n const composeMsg = ethers.AbiCoder.defaultAbiCoder().encode(\n ['uint8', 'bytes'],\n [opType, opData],\n );\n\n return composeMsg;\n};\n\nexport const buildOFTSendParamsToDepositInMA = (params: {\n amount: bigint;\n collateralAddressInReyaPeriphery: string;\n dstEid: number;\n extraOptions: string;\n receiverAddress: string;\n marginAccountId: number;\n}): OFTSendParams => {\n const receiverBytes32 = ethers.zeroPadValue(params.receiverAddress, 32);\n\n const composeMsg = buildComposeMsg(\n params.marginAccountId,\n params.collateralAddressInReyaPeriphery,\n );\n\n return {\n dstEid: params.dstEid,\n to: receiverBytes32,\n amountLD: params.amount,\n minAmountLD: params.amount,\n extraOptions: params.extraOptions,\n composeMsg,\n oftCmd: '0x',\n };\n};\n"]}
|
|
@@ -36,75 +36,24 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.getERC20AllowanceBatch = exports.getERC20BalanceBatch =
|
|
39
|
+
exports.getERC20AllowanceBatch = exports.getERC20BalanceBatch = void 0;
|
|
40
40
|
var ethers_1 = require("ethers");
|
|
41
41
|
var network_1 = require("../network");
|
|
42
|
-
var retry_1 = require("../retry");
|
|
43
42
|
var utils_1 = require("./utils");
|
|
44
|
-
var getETHBalanceBatch = function (_a) {
|
|
45
|
-
var walletAddress = _a.walletAddress, chain = _a.chain;
|
|
46
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
47
|
-
var rpcUrls, lastError, _loop_1, _i, rpcUrls_1, url, state_1;
|
|
48
|
-
return __generator(this, function (_b) {
|
|
49
|
-
switch (_b.label) {
|
|
50
|
-
case 0:
|
|
51
|
-
rpcUrls = (0, network_1.getPublicRpcUrlsOrThrow)(chain);
|
|
52
|
-
lastError = null;
|
|
53
|
-
_loop_1 = function (url) {
|
|
54
|
-
var provider_1, currentBalance, error_1;
|
|
55
|
-
return __generator(this, function (_c) {
|
|
56
|
-
switch (_c.label) {
|
|
57
|
-
case 0:
|
|
58
|
-
_c.trys.push([0, 2, , 3]);
|
|
59
|
-
provider_1 = new ethers_1.ethers.JsonRpcProvider(url);
|
|
60
|
-
return [4 /*yield*/, (0, retry_1.exponentialBackoff)(function () {
|
|
61
|
-
return provider_1.getBalance(ethers_1.ethers.getAddress(walletAddress));
|
|
62
|
-
})];
|
|
63
|
-
case 1:
|
|
64
|
-
currentBalance = _c.sent();
|
|
65
|
-
return [2 /*return*/, { value: (0, utils_1.descale)(18)(currentBalance) }];
|
|
66
|
-
case 2:
|
|
67
|
-
error_1 = _c.sent();
|
|
68
|
-
lastError = error_1;
|
|
69
|
-
return [3 /*break*/, 3];
|
|
70
|
-
case 3: return [2 /*return*/];
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
};
|
|
74
|
-
_i = 0, rpcUrls_1 = rpcUrls;
|
|
75
|
-
_b.label = 1;
|
|
76
|
-
case 1:
|
|
77
|
-
if (!(_i < rpcUrls_1.length)) return [3 /*break*/, 4];
|
|
78
|
-
url = rpcUrls_1[_i];
|
|
79
|
-
return [5 /*yield**/, _loop_1(url)];
|
|
80
|
-
case 2:
|
|
81
|
-
state_1 = _b.sent();
|
|
82
|
-
if (typeof state_1 === "object")
|
|
83
|
-
return [2 /*return*/, state_1.value];
|
|
84
|
-
_b.label = 3;
|
|
85
|
-
case 3:
|
|
86
|
-
_i++;
|
|
87
|
-
return [3 /*break*/, 1];
|
|
88
|
-
case 4: throw new Error('All RPC URLs failed; last error: ' + lastError);
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
});
|
|
92
|
-
};
|
|
93
|
-
exports.getETHBalanceBatch = getETHBalanceBatch;
|
|
94
43
|
var getERC20BalanceBatch = function (_a) {
|
|
95
44
|
var tokenAddress = _a.tokenAddress, tokenDecimals = _a.tokenDecimals, walletAddress = _a.walletAddress, chain = _a.chain;
|
|
96
45
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
97
|
-
var rpcUrls, lastError, _i,
|
|
46
|
+
var rpcUrls, lastError, _i, rpcUrls_1, url, provider, token, currentBalance, error_1;
|
|
98
47
|
return __generator(this, function (_b) {
|
|
99
48
|
switch (_b.label) {
|
|
100
49
|
case 0:
|
|
101
50
|
rpcUrls = (0, network_1.getPublicRpcUrlsOrThrow)(chain);
|
|
102
51
|
lastError = null;
|
|
103
|
-
_i = 0,
|
|
52
|
+
_i = 0, rpcUrls_1 = rpcUrls;
|
|
104
53
|
_b.label = 1;
|
|
105
54
|
case 1:
|
|
106
|
-
if (!(_i <
|
|
107
|
-
url =
|
|
55
|
+
if (!(_i < rpcUrls_1.length)) return [3 /*break*/, 6];
|
|
56
|
+
url = rpcUrls_1[_i];
|
|
108
57
|
_b.label = 2;
|
|
109
58
|
case 2:
|
|
110
59
|
_b.trys.push([2, 4, , 5]);
|
|
@@ -115,8 +64,8 @@ var getERC20BalanceBatch = function (_a) {
|
|
|
115
64
|
currentBalance = _b.sent();
|
|
116
65
|
return [2 /*return*/, (0, utils_1.descale)(tokenDecimals)(currentBalance)];
|
|
117
66
|
case 4:
|
|
118
|
-
|
|
119
|
-
lastError =
|
|
67
|
+
error_1 = _b.sent();
|
|
68
|
+
lastError = error_1;
|
|
120
69
|
return [3 /*break*/, 5];
|
|
121
70
|
case 5:
|
|
122
71
|
_i++;
|
|
@@ -130,17 +79,17 @@ exports.getERC20BalanceBatch = getERC20BalanceBatch;
|
|
|
130
79
|
var getERC20AllowanceBatch = function (_a) {
|
|
131
80
|
var tokenAddress = _a.tokenAddress, tokenDecimals = _a.tokenDecimals, walletAddress = _a.walletAddress, spenderAddress = _a.spenderAddress, chain = _a.chain;
|
|
132
81
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
133
|
-
var rpcUrls, lastError, _i,
|
|
82
|
+
var rpcUrls, lastError, _i, rpcUrls_2, url, provider, token, currentBalance, error_2;
|
|
134
83
|
return __generator(this, function (_b) {
|
|
135
84
|
switch (_b.label) {
|
|
136
85
|
case 0:
|
|
137
86
|
rpcUrls = (0, network_1.getPublicRpcUrlsOrThrow)(chain);
|
|
138
87
|
lastError = null;
|
|
139
|
-
_i = 0,
|
|
88
|
+
_i = 0, rpcUrls_2 = rpcUrls;
|
|
140
89
|
_b.label = 1;
|
|
141
90
|
case 1:
|
|
142
|
-
if (!(_i <
|
|
143
|
-
url =
|
|
91
|
+
if (!(_i < rpcUrls_2.length)) return [3 /*break*/, 6];
|
|
92
|
+
url = rpcUrls_2[_i];
|
|
144
93
|
_b.label = 2;
|
|
145
94
|
case 2:
|
|
146
95
|
_b.trys.push([2, 4, , 5]);
|
|
@@ -151,8 +100,8 @@ var getERC20AllowanceBatch = function (_a) {
|
|
|
151
100
|
currentBalance = _b.sent();
|
|
152
101
|
return [2 /*return*/, (0, utils_1.descale)(tokenDecimals)(currentBalance)];
|
|
153
102
|
case 4:
|
|
154
|
-
|
|
155
|
-
lastError =
|
|
103
|
+
error_2 = _b.sent();
|
|
104
|
+
lastError = error_2;
|
|
156
105
|
return [3 /*break*/, 5];
|
|
157
106
|
case 5:
|
|
158
107
|
_i++;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"batch-token-getters.js","sourceRoot":"/","sources":["utils/token/batch-token-getters.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCAAgC;AAEhC,sCAAqD;AACrD,
|
|
1
|
+
{"version":3,"file":"batch-token-getters.js","sourceRoot":"/","sources":["utils/token/batch-token-getters.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCAAgC;AAEhC,sCAAqD;AACrD,iCAAyD;AAiBlD,IAAM,oBAAoB,GAAG,UAAO,EAKhB;QAJzB,YAAY,kBAAA,EACZ,aAAa,mBAAA,EACb,aAAa,mBAAA,EACb,KAAK,WAAA;;;;;;oBAEC,OAAO,GAAG,IAAA,iCAAuB,EAAC,KAAK,CAAC,CAAC;oBAC3C,SAAS,GAAG,IAAI,CAAC;0BAEI,EAAP,mBAAO;;;yBAAP,CAAA,qBAAO,CAAA;oBAAd,GAAG;;;;oBAEJ,QAAQ,GAAG,IAAI,eAAM,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;oBAC3C,KAAK,GAAG,IAAA,6BAAqB,EAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;oBACrC,qBAAM,KAAK,CAAC,SAAS,CAAC,aAAa,CAAC,EAAA;;oBAArD,cAAc,GAAG,SAAoC;oBAE3D,sBAAO,IAAA,eAAO,EAAC,aAAa,CAAC,CAAC,cAAc,CAAC,EAAC;;;oBAE9C,SAAS,GAAG,OAAK,CAAC;;;oBARJ,IAAO,CAAA;;wBAYzB,MAAM,IAAI,KAAK,CAAC,mCAAmC,GAAG,SAAS,CAAC,CAAC;;;;CAClE,CAAC;AAtBW,QAAA,oBAAoB,wBAsB/B;AAEK,IAAM,sBAAsB,GAAG,UAAO,EAMhB;QAL3B,YAAY,kBAAA,EACZ,aAAa,mBAAA,EACb,aAAa,mBAAA,EACb,cAAc,oBAAA,EACd,KAAK,WAAA;;;;;;oBAEC,OAAO,GAAG,IAAA,iCAAuB,EAAC,KAAK,CAAC,CAAC;oBAC3C,SAAS,GAAG,IAAI,CAAC;0BAEI,EAAP,mBAAO;;;yBAAP,CAAA,qBAAO,CAAA;oBAAd,GAAG;;;;oBAEJ,QAAQ,GAAG,IAAI,eAAM,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;oBAC3C,KAAK,GAAG,IAAA,6BAAqB,EAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;oBACrC,qBAAM,KAAK,CAAC,SAAS,CAC1C,aAAa,EACb,cAAc,CACf,EAAA;;oBAHK,cAAc,GAAG,SAGtB;oBAED,sBAAO,IAAA,eAAO,EAAC,aAAa,CAAC,CAAC,cAAc,CAAC,EAAC;;;oBAE9C,SAAS,GAAG,OAAK,CAAC;;;oBAXJ,IAAO,CAAA;;wBAezB,MAAM,IAAI,KAAK,CAAC,mCAAmC,GAAG,SAAS,CAAC,CAAC;;;;CAClE,CAAC;AA1BW,QAAA,sBAAsB,0BA0BjC","sourcesContent":["import { ethers } from 'ethers';\nimport { MoneyInOutChainId, ReyaChainId } from '../../types';\nimport { getPublicRpcUrlsOrThrow } from '../network';\nimport { descale, getERC20TokenContract } from './utils';\n\nexport type GetERC20BalanceBatchArgs = {\n tokenAddress: string;\n tokenDecimals: number;\n walletAddress: string;\n chain: MoneyInOutChainId | ReyaChainId;\n};\n\nexport type GetERC20AllowanceBatchArgs = {\n tokenAddress: string;\n tokenDecimals: number;\n walletAddress: string;\n spenderAddress: string;\n chain: MoneyInOutChainId | ReyaChainId;\n};\n\nexport const getERC20BalanceBatch = async ({\n tokenAddress,\n tokenDecimals,\n walletAddress,\n chain,\n}: GetERC20BalanceBatchArgs): Promise<number> => {\n const rpcUrls = getPublicRpcUrlsOrThrow(chain);\n let lastError = null;\n\n for (const url of rpcUrls) {\n try {\n const provider = new ethers.JsonRpcProvider(url);\n const token = getERC20TokenContract(tokenAddress, provider);\n const currentBalance = await token.balanceOf(walletAddress);\n\n return descale(tokenDecimals)(currentBalance);\n } catch (error) {\n lastError = error;\n }\n }\n\n throw new Error('All RPC URLs failed; last error: ' + lastError);\n};\n\nexport const getERC20AllowanceBatch = async ({\n tokenAddress,\n tokenDecimals,\n walletAddress,\n spenderAddress,\n chain,\n}: GetERC20AllowanceBatchArgs): Promise<number> => {\n const rpcUrls = getPublicRpcUrlsOrThrow(chain);\n let lastError = null;\n\n for (const url of rpcUrls) {\n try {\n const provider = new ethers.JsonRpcProvider(url);\n const token = getERC20TokenContract(tokenAddress, provider);\n const currentBalance = await token.allowance(\n walletAddress,\n spenderAddress,\n );\n\n return descale(tokenDecimals)(currentBalance);\n } catch (error) {\n lastError = error;\n }\n }\n\n throw new Error('All RPC URLs failed; last error: ' + lastError);\n};\n"]}
|
|
@@ -36,8 +36,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.
|
|
40
|
-
var ethers_1 = require("ethers");
|
|
39
|
+
exports.getERC20Allowance = void 0;
|
|
41
40
|
var retry_1 = require("../retry");
|
|
42
41
|
var utils_1 = require("./utils");
|
|
43
42
|
var getERC20Allowance = function (_a) {
|
|
@@ -61,44 +60,4 @@ var getERC20Allowance = function (_a) {
|
|
|
61
60
|
});
|
|
62
61
|
};
|
|
63
62
|
exports.getERC20Allowance = getERC20Allowance;
|
|
64
|
-
var getERC20Balance = function (_a) {
|
|
65
|
-
var tokenAddress = _a.tokenAddress, tokenDecimals = _a.tokenDecimals, walletAddress = _a.walletAddress, subject = _a.subject;
|
|
66
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
67
|
-
var token, currentBalance;
|
|
68
|
-
return __generator(this, function (_b) {
|
|
69
|
-
switch (_b.label) {
|
|
70
|
-
case 0:
|
|
71
|
-
token = (0, utils_1.getERC20TokenContract)(tokenAddress, subject);
|
|
72
|
-
return [4 /*yield*/, (0, retry_1.exponentialBackoff)(function () {
|
|
73
|
-
return token.balanceOf(walletAddress);
|
|
74
|
-
})];
|
|
75
|
-
case 1:
|
|
76
|
-
currentBalance = _b.sent();
|
|
77
|
-
return [2 /*return*/, (0, utils_1.descale)(tokenDecimals)(currentBalance)];
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
});
|
|
81
|
-
};
|
|
82
|
-
exports.getERC20Balance = getERC20Balance;
|
|
83
|
-
var getETHBalance = function (_a) {
|
|
84
|
-
var walletAddress = _a.walletAddress, subject = _a.subject;
|
|
85
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
86
|
-
var provider, currentBalance;
|
|
87
|
-
return __generator(this, function (_b) {
|
|
88
|
-
switch (_b.label) {
|
|
89
|
-
case 0:
|
|
90
|
-
provider = subject.provider;
|
|
91
|
-
if (!provider)
|
|
92
|
-
throw new Error("User's provider not found");
|
|
93
|
-
return [4 /*yield*/, (0, retry_1.exponentialBackoff)(function () {
|
|
94
|
-
return provider.getBalance(ethers_1.ethers.getAddress(walletAddress));
|
|
95
|
-
})];
|
|
96
|
-
case 1:
|
|
97
|
-
currentBalance = _b.sent();
|
|
98
|
-
return [2 /*return*/, (0, utils_1.descale)(18)(currentBalance)];
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
});
|
|
102
|
-
};
|
|
103
|
-
exports.getETHBalance = getETHBalance;
|
|
104
63
|
//# sourceMappingURL=token-getters.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token-getters.js","sourceRoot":"/","sources":["utils/token/token-getters.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"token-getters.js","sourceRoot":"/","sources":["utils/token/token-getters.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,kCAA8C;AAE9C,iCAAgE;AAsBzD,IAAM,iBAAiB,GAAG,UAAO,EAMhB;QALtB,aAAa,mBAAA,EACb,YAAY,kBAAA,EACZ,aAAa,mBAAA,EACb,cAAc,oBAAA,EACd,OAAO,aAAA;;;;;;oBAED,aAAa,GAAG,IAAA,6BAAqB,EAAC,YAAY,EAAE,OAAO,CAAC,CAAC;oBAEjD,qBAAM,IAAA,0BAAkB,EAAC;4BACzC,OAAA,aAAa,CAAC,SAAS,CAAC,aAAa,EAAE,cAAc,CAAC;wBAAtD,CAAsD,CACvD,EAAA;;oBAFK,SAAS,GAAG,SAEjB;oBAED,sBAAO,MAAM,CAAC,SAAS,CAAC,GAAG,IAAA,aAAK,EAAC,aAAa,CAAC,CAAC,MAAM,CAAC,gBAAgB,CAAC;4BACtE,CAAC,CAAC,MAAM,CAAC,gBAAgB;4BACzB,CAAC,CAAC,IAAA,eAAO,EAAC,aAAa,CAAC,CAAC,SAAS,CAAC,EAAC;;;;CACvC,CAAC;AAhBW,QAAA,iBAAiB,qBAgB5B","sourcesContent":["import { ethers } from 'ethers';\nimport { exponentialBackoff } from '../retry';\nimport { LpPoolEntity } from '../../types';\nimport { getERC20TokenContract, scale, descale } from './utils';\n\nexport type GetERC20BalanceArgs = {\n tokenAddress: string;\n tokenDecimals: number;\n walletAddress: string;\n subject: ethers.Signer | ethers.Provider;\n};\n\nexport type GetETHBalanceArgs = {\n walletAddress: string;\n subject: ethers.Signer | ethers.Provider;\n};\n\nexport type GetERC20AllowanceArgs = {\n walletAddress: string;\n tokenAddress: LpPoolEntity['tokenAddress'];\n tokenDecimals: number;\n spenderAddress: string;\n subject: ethers.Signer;\n};\n\nexport const getERC20Allowance = async ({\n walletAddress,\n tokenAddress,\n tokenDecimals,\n spenderAddress,\n subject,\n}: GetERC20AllowanceArgs): Promise<number> => {\n const tokenContract = getERC20TokenContract(tokenAddress, subject);\n\n const allowance = await exponentialBackoff(() =>\n tokenContract.allowance(walletAddress, spenderAddress),\n );\n\n return BigInt(allowance) > scale(tokenDecimals)(Number.MAX_SAFE_INTEGER)\n ? Number.MAX_SAFE_INTEGER\n : descale(tokenDecimals)(allowance);\n};\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reyaxyz/common",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.346.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"generate:coverage-badges": "npx istanbul-badges-readme --silent"
|
|
46
46
|
},
|
|
47
47
|
"packageManager": "pnpm@8.3.1",
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "e58f32638c802226ae571812d910eae628be7cc1"
|
|
49
49
|
}
|
|
@@ -102,11 +102,17 @@ export type LeaderBoardParams = { type: 'weekly' | 'total' };
|
|
|
102
102
|
|
|
103
103
|
export type TradingCompetitionRoundParams = { round: number };
|
|
104
104
|
|
|
105
|
-
export type TradingCompetitionUserSummaryData =
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
105
|
+
export type TradingCompetitionUserSummaryData =
|
|
106
|
+
| {
|
|
107
|
+
status: 'out';
|
|
108
|
+
}
|
|
109
|
+
| {
|
|
110
|
+
status: 'in';
|
|
111
|
+
realizedPnl: number;
|
|
112
|
+
position: number;
|
|
113
|
+
volume: number;
|
|
114
|
+
volumePosition: number;
|
|
115
|
+
};
|
|
110
116
|
|
|
111
117
|
export type TradingCompetitionLeaderboardEntry = {
|
|
112
118
|
walletAddress: string;
|
package/src/trading-api-types.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ParamsDictionary, Query } from 'express-serve-static-core';
|
|
2
|
-
import { AssetPair, CollateralPrice, MarketPrice } from './types';
|
|
2
|
+
import { Address, AssetPair, CollateralPrice, MarketPrice } from './types';
|
|
3
3
|
import {
|
|
4
4
|
AddressParam,
|
|
5
5
|
ApiEndpoint,
|
|
@@ -602,6 +602,12 @@ export type TradingApiSource = {
|
|
|
602
602
|
address: string;
|
|
603
603
|
}
|
|
604
604
|
>;
|
|
605
|
+
'collaterals/definitions': TradingApiEndpoint<
|
|
606
|
+
{
|
|
607
|
+
collaterals: CollateralDefinition[];
|
|
608
|
+
},
|
|
609
|
+
never
|
|
610
|
+
>;
|
|
605
611
|
};
|
|
606
612
|
|
|
607
613
|
export type Req<P = ParamsDictionary, ReqQuery = Query> = {
|
|
@@ -723,6 +729,104 @@ type ReplicationMessage =
|
|
|
723
729
|
| GenericReplicationMessage<spot_execution_bust, 'spot_execution_busts'>
|
|
724
730
|
| GenericReplicationMessage<Order, 'orders'>;
|
|
725
731
|
|
|
732
|
+
export type SocketDepositChainDetails = {
|
|
733
|
+
chainId: number;
|
|
734
|
+
chainName: string;
|
|
735
|
+
collateralAddress: Address;
|
|
736
|
+
collateralName: string;
|
|
737
|
+
collateralAddressInReyaPeriphery: Address;
|
|
738
|
+
vaultAddress: Address;
|
|
739
|
+
connectorAddress: Address;
|
|
740
|
+
msgGasLimit: string;
|
|
741
|
+
bridgeTime: number;
|
|
742
|
+
};
|
|
743
|
+
|
|
744
|
+
export type SocketWithdrawChainDetails = {
|
|
745
|
+
chainId: number;
|
|
746
|
+
chainName: string;
|
|
747
|
+
collateralAddress: Address;
|
|
748
|
+
collateralName: string;
|
|
749
|
+
collateralAddressInReyaCore: Address;
|
|
750
|
+
msgGasLimit: string;
|
|
751
|
+
bridgeFee: string;
|
|
752
|
+
bridgeTime: number;
|
|
753
|
+
};
|
|
754
|
+
|
|
755
|
+
export type LayerzeroDepositChainDetails = {
|
|
756
|
+
chainId: number;
|
|
757
|
+
chainName: string;
|
|
758
|
+
collateralAddress: Address;
|
|
759
|
+
collateralName: string;
|
|
760
|
+
collateralAddressInReyaPeriphery: Address;
|
|
761
|
+
dstEid: number;
|
|
762
|
+
extraOptions: string;
|
|
763
|
+
bridgeTime: number;
|
|
764
|
+
};
|
|
765
|
+
|
|
766
|
+
export type LayerzeroWithdrawChainDetails = {
|
|
767
|
+
chainId: number;
|
|
768
|
+
chainName: string;
|
|
769
|
+
collateralAddress: Address;
|
|
770
|
+
collateralName: string;
|
|
771
|
+
collateralAddressInReyaCore: Address;
|
|
772
|
+
dstEid: number;
|
|
773
|
+
bridgeFee: string;
|
|
774
|
+
bridgeTime: number;
|
|
775
|
+
};
|
|
776
|
+
|
|
777
|
+
export type SocketDepositInfo =
|
|
778
|
+
| { enabled: false }
|
|
779
|
+
| { enabled: true; chains: SocketDepositChainDetails[]; minAmount: number };
|
|
780
|
+
|
|
781
|
+
export type SocketWithdrawInfo =
|
|
782
|
+
| { enabled: false }
|
|
783
|
+
| { enabled: true; chains: SocketWithdrawChainDetails[]; minAmount: number };
|
|
784
|
+
|
|
785
|
+
export type LayerzeroDepositInfo =
|
|
786
|
+
| { enabled: false }
|
|
787
|
+
| {
|
|
788
|
+
enabled: true;
|
|
789
|
+
minAmount: number;
|
|
790
|
+
chains: LayerzeroDepositChainDetails[];
|
|
791
|
+
};
|
|
792
|
+
|
|
793
|
+
export type LayerzeroWithdrawInfo =
|
|
794
|
+
| { enabled: false }
|
|
795
|
+
| {
|
|
796
|
+
enabled: true;
|
|
797
|
+
minAmount: number;
|
|
798
|
+
chains: LayerzeroWithdrawChainDetails[];
|
|
799
|
+
};
|
|
800
|
+
|
|
801
|
+
export type TransferInfo = { enabled: boolean };
|
|
802
|
+
|
|
803
|
+
export type SpotInfo =
|
|
804
|
+
| { enabled: false }
|
|
805
|
+
| { enabled: true; spotMarketSymbol: string };
|
|
806
|
+
|
|
807
|
+
export type DisplayInfo = {
|
|
808
|
+
advertisedInSpot: boolean;
|
|
809
|
+
advertisedInPerp: boolean;
|
|
810
|
+
displayName: string;
|
|
811
|
+
displayDecimals: number;
|
|
812
|
+
};
|
|
813
|
+
|
|
814
|
+
export type CollateralDefinition = {
|
|
815
|
+
id: Uppercase<string>;
|
|
816
|
+
address: Address;
|
|
817
|
+
assetPairId: string;
|
|
818
|
+
priceHaircut: string;
|
|
819
|
+
liquidationDiscount: string;
|
|
820
|
+
decimals: number;
|
|
821
|
+
socketDepositInfo: SocketDepositInfo;
|
|
822
|
+
socketWithdrawInfo: SocketWithdrawInfo;
|
|
823
|
+
layerzeroDepositInfo: LayerzeroDepositInfo;
|
|
824
|
+
layerzeroWithdrawInfo: LayerzeroWithdrawInfo;
|
|
825
|
+
transferInfo: TransferInfo;
|
|
826
|
+
spotInfo: SpotInfo;
|
|
827
|
+
displayInfo: DisplayInfo;
|
|
828
|
+
};
|
|
829
|
+
|
|
726
830
|
export type Replication = {
|
|
727
831
|
[K in ReplicationMessage as `replication:${K['model']}`]: Extract<
|
|
728
832
|
ReplicationMessage,
|