@allbridge/bridge-core-sdk 3.32.1 → 3.33.0-alpha.2
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/dist/browser/index.js +2 -2
- package/dist/browser/index.js.map +4 -4
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/index.js.map +4 -4
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +4 -4
- package/dist/src/client/core-api/api-client-caching.d.ts +2 -0
- package/dist/src/client/core-api/api-client-caching.js +2 -0
- package/dist/src/client/core-api/api-client-caching.js.map +1 -1
- package/dist/src/client/core-api/api-client.d.ts +5 -0
- package/dist/src/client/core-api/api-client.js +2 -0
- package/dist/src/client/core-api/api-client.js.map +1 -1
- package/dist/src/client/core-api/core-api-mapper.d.ts +15 -0
- package/dist/src/client/core-api/core-api-mapper.js +15 -0
- package/dist/src/client/core-api/core-api-mapper.js.map +1 -1
- package/dist/src/client/core-api/core-api.model.d.ts +30 -0
- package/dist/src/client/core-api/core-api.model.js +4 -0
- package/dist/src/client/core-api/core-api.model.js.map +1 -1
- package/dist/src/client/core-api/core-client-base.d.ts +9 -0
- package/dist/src/client/core-api/core-client-base.js +3 -0
- package/dist/src/client/core-api/core-client-base.js.map +1 -1
- package/dist/src/client/core-api/core-client-filtered.d.ts +16 -0
- package/dist/src/client/core-api/core-client-filtered.js +4 -0
- package/dist/src/client/core-api/core-client-filtered.js.map +1 -1
- package/dist/src/client/core-api/core-client-pool-info-caching.d.ts +13 -0
- package/dist/src/client/core-api/core-client-pool-info-caching.js +7 -0
- package/dist/src/client/core-api/core-client-pool-info-caching.js.map +1 -1
- package/dist/src/exceptions/exceptions.d.ts +4 -0
- package/dist/src/exceptions/exceptions.js +4 -0
- package/dist/src/exceptions/exceptions.js.map +1 -1
- package/dist/src/index.d.ts +48 -30
- package/dist/src/index.js +17 -86
- package/dist/src/index.js.map +1 -1
- package/dist/src/models/index.d.ts +2 -1
- package/dist/src/models/index.js.map +1 -1
- package/dist/src/services/bridge/alg/index.d.ts +1 -0
- package/dist/src/services/bridge/alg/index.js +1 -0
- package/dist/src/services/bridge/alg/index.js.map +1 -1
- package/dist/src/services/bridge/evm/index.d.ts +2 -0
- package/dist/src/services/bridge/evm/index.js +2 -0
- package/dist/src/services/bridge/evm/index.js.map +1 -1
- package/dist/src/services/bridge/index.d.ts +4 -2
- package/dist/src/services/bridge/index.js +7 -45
- package/dist/src/services/bridge/index.js.map +1 -1
- package/dist/src/services/bridge/models/bridge.d.ts +1 -0
- package/dist/src/services/bridge/models/bridge.js.map +1 -1
- package/dist/src/services/bridge/models/bridge.model.d.ts +14 -6
- package/dist/src/services/bridge/models/bridge.model.js.map +1 -1
- package/dist/src/services/bridge/raw-bridge-transaction-builder.d.ts +6 -0
- package/dist/src/services/bridge/raw-bridge-transaction-builder.js +3 -2
- package/dist/src/services/bridge/raw-bridge-transaction-builder.js.map +1 -1
- package/dist/src/services/bridge/sol/bridge-tx-service.d.ts +3 -1
- package/dist/src/services/bridge/sol/bridge-tx-service.js +4 -0
- package/dist/src/services/bridge/sol/bridge-tx-service.js.map +1 -1
- package/dist/src/services/bridge/sol/index.d.ts +3 -1
- package/dist/src/services/bridge/sol/index.js +1 -0
- package/dist/src/services/bridge/sol/index.js.map +1 -1
- package/dist/src/services/bridge/sol/payer-with-token-service.js +3 -0
- package/dist/src/services/bridge/sol/payer-with-token-service.js.map +1 -1
- package/dist/src/services/bridge/spender.d.ts +4 -0
- package/dist/src/services/bridge/spender.js +45 -0
- package/dist/src/services/bridge/spender.js.map +1 -0
- package/dist/src/services/bridge/srb/index.d.ts +2 -0
- package/dist/src/services/bridge/srb/index.js +2 -0
- package/dist/src/services/bridge/srb/index.js.map +1 -1
- package/dist/src/services/bridge/stx/index.d.ts +1 -0
- package/dist/src/services/bridge/stx/index.js +1 -0
- package/dist/src/services/bridge/stx/index.js.map +1 -1
- package/dist/src/services/bridge/sui/index.d.ts +1 -0
- package/dist/src/services/bridge/sui/index.js +1 -0
- package/dist/src/services/bridge/sui/index.js.map +1 -1
- package/dist/src/services/bridge/trx/index.d.ts +2 -0
- package/dist/src/services/bridge/trx/index.js +2 -0
- package/dist/src/services/bridge/trx/index.js.map +1 -1
- package/dist/src/services/bridge/utils.d.ts +4 -0
- package/dist/src/services/bridge/utils.js +1 -0
- package/dist/src/services/bridge/utils.js.map +1 -1
- package/dist/src/services/index.d.ts +25 -2
- package/dist/src/services/index.js +17 -2
- package/dist/src/services/index.js.map +1 -1
- package/dist/src/services/liquidity-pool/alg/index.d.ts +3 -0
- package/dist/src/services/liquidity-pool/alg/index.js +3 -0
- package/dist/src/services/liquidity-pool/alg/index.js.map +1 -1
- package/dist/src/services/liquidity-pool/evm/index.d.ts +3 -0
- package/dist/src/services/liquidity-pool/evm/index.js +3 -0
- package/dist/src/services/liquidity-pool/evm/index.js.map +1 -1
- package/dist/src/services/liquidity-pool/index.d.ts +19 -0
- package/dist/src/services/liquidity-pool/index.js +9 -1
- package/dist/src/services/liquidity-pool/index.js.map +1 -1
- package/dist/src/services/liquidity-pool/models/pool.d.ts +8 -0
- package/dist/src/services/liquidity-pool/models/pool.js +3 -0
- package/dist/src/services/liquidity-pool/models/pool.js.map +1 -1
- package/dist/src/services/liquidity-pool/models/pool.model.d.ts +27 -0
- package/dist/src/services/liquidity-pool/models/pool.model.js +3 -0
- package/dist/src/services/liquidity-pool/models/pool.model.js.map +1 -1
- package/dist/src/services/liquidity-pool/raw-pool-transaction-builder.d.ts +11 -0
- package/dist/src/services/liquidity-pool/raw-pool-transaction-builder.js +3 -0
- package/dist/src/services/liquidity-pool/raw-pool-transaction-builder.js.map +1 -1
- package/dist/src/services/liquidity-pool/sol/index.d.ts +3 -0
- package/dist/src/services/liquidity-pool/sol/index.js +3 -0
- package/dist/src/services/liquidity-pool/sol/index.js.map +1 -1
- package/dist/src/services/liquidity-pool/srb/index.d.ts +3 -0
- package/dist/src/services/liquidity-pool/srb/index.js +3 -0
- package/dist/src/services/liquidity-pool/srb/index.js.map +1 -1
- package/dist/src/services/liquidity-pool/stx/index.d.ts +3 -0
- package/dist/src/services/liquidity-pool/stx/index.js +3 -0
- package/dist/src/services/liquidity-pool/stx/index.js.map +1 -1
- package/dist/src/services/liquidity-pool/sui/index.d.ts +3 -0
- package/dist/src/services/liquidity-pool/sui/index.js +3 -0
- package/dist/src/services/liquidity-pool/sui/index.js.map +1 -1
- package/dist/src/services/liquidity-pool/trx/index.d.ts +3 -0
- package/dist/src/services/liquidity-pool/trx/index.js +3 -0
- package/dist/src/services/liquidity-pool/trx/index.js.map +1 -1
- package/dist/src/services/utils/calculation/index.d.ts +6 -0
- package/dist/src/services/utils/calculation/index.js +6 -0
- package/dist/src/services/utils/calculation/index.js.map +1 -1
- package/dist/src/services/utils/sol/index.d.ts +6 -0
- package/dist/src/services/utils/sol/index.js +6 -0
- package/dist/src/services/utils/sol/index.js.map +1 -1
- package/dist/src/tokens-info/tokens-info.model.d.ts +24 -0
- package/dist/src/tokens-info/tokens-info.model.js.map +1 -1
- package/dist/src/utils/calculation/index.d.ts +26 -0
- package/dist/src/utils/calculation/index.js +26 -0
- package/dist/src/utils/calculation/index.js.map +1 -1
- package/dist/src/utils/calculation/swap-and-bridge-details.d.ts +9 -0
- package/dist/src/utils/calculation/swap-and-bridge-details.js +3 -0
- package/dist/src/utils/calculation/swap-and-bridge-details.js.map +1 -1
- package/dist/src/utils/calculation/swap-and-bridge-fee-calc.d.ts +18 -0
- package/dist/src/utils/calculation/swap-and-bridge-fee-calc.js +6 -0
- package/dist/src/utils/calculation/swap-and-bridge-fee-calc.js.map +1 -1
- package/dist/src/utils/utils.d.ts +3 -0
- package/dist/src/utils/utils.js +3 -0
- package/dist/src/utils/utils.js.map +1 -1
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/version.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
import { ChainDetailsMapWithFlags, PoolInfo, PoolKeyObject, TokenWithChainDetailsWithFlags } from "../../tokens-info";
|
|
2
2
|
import { GasBalanceResponse, PendingInfoResponse, ReceiveTransactionCostRequest, ReceiveTransactionCostResponse, TransferStatusResponse } from "./core-api.model";
|
|
3
3
|
import { AllbridgeCoreClientWithPoolInfo, AllbridgeCoreClientWithTokens } from "./core-client-base";
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated Do not use.
|
|
6
|
+
*/
|
|
4
7
|
export interface AllbridgeCoreClientPoolsExt {
|
|
8
|
+
/** @deprecated Do not use. */
|
|
5
9
|
getPoolInfoByKey(poolKeyObject: PoolKeyObject): Promise<PoolInfo>;
|
|
10
|
+
/** @deprecated Do not use. */
|
|
6
11
|
refreshPoolInfo(poolKeyObjects?: PoolKeyObject | PoolKeyObject[]): Promise<void>;
|
|
12
|
+
/** @deprecated Do not use. */
|
|
7
13
|
cachePut(poolKeyObject: PoolKeyObject, poolInfo: PoolInfo): void;
|
|
8
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated Do not use.
|
|
17
|
+
*/
|
|
9
18
|
export declare class AllbridgeCoreClientPoolInfoCaching implements AllbridgeCoreClientWithTokens, AllbridgeCoreClientPoolsExt {
|
|
10
19
|
private readonly client;
|
|
11
20
|
private readonly poolInfoCache;
|
|
@@ -14,9 +23,13 @@ export declare class AllbridgeCoreClientPoolInfoCaching implements AllbridgeCore
|
|
|
14
23
|
tokens(): Promise<TokenWithChainDetailsWithFlags[]>;
|
|
15
24
|
getTransferStatus(chainSymbol: string, txId: string): Promise<TransferStatusResponse>;
|
|
16
25
|
getReceiveTransactionCost(args: ReceiveTransactionCostRequest): Promise<ReceiveTransactionCostResponse>;
|
|
26
|
+
/** @deprecated Do not use. */
|
|
17
27
|
getPendingInfo(): Promise<PendingInfoResponse>;
|
|
18
28
|
getGasBalance(chainSymbol: string, address: string): Promise<GasBalanceResponse>;
|
|
29
|
+
/** @deprecated Do not use. */
|
|
19
30
|
getPoolInfoByKey(poolKeyObject: PoolKeyObject): Promise<PoolInfo>;
|
|
31
|
+
/** @deprecated Do not use. */
|
|
20
32
|
refreshPoolInfo(poolKeyObjects?: PoolKeyObject | PoolKeyObject[]): Promise<void>;
|
|
33
|
+
/** @deprecated Do not use. */
|
|
21
34
|
cachePut(poolKeyObject: PoolKeyObject, poolInfo: PoolInfo): void;
|
|
22
35
|
}
|
|
@@ -2,6 +2,9 @@ import Cache from "timed-cache";
|
|
|
2
2
|
import { SdkError } from "../../exceptions";
|
|
3
3
|
import { mapChainDetailsMapToPoolKeyObjects, mapPoolKeyObjectToPoolKey } from "./core-api-mapper";
|
|
4
4
|
const _55_SECONDS_TTL = 55 * 1000;
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated Do not use.
|
|
7
|
+
*/
|
|
5
8
|
export class AllbridgeCoreClientPoolInfoCaching {
|
|
6
9
|
client;
|
|
7
10
|
poolInfoCache;
|
|
@@ -22,12 +25,14 @@ export class AllbridgeCoreClientPoolInfoCaching {
|
|
|
22
25
|
getReceiveTransactionCost(args) {
|
|
23
26
|
return this.client.getReceiveTransactionCost(args);
|
|
24
27
|
}
|
|
28
|
+
/** @deprecated Do not use. */
|
|
25
29
|
getPendingInfo() {
|
|
26
30
|
return this.client.getPendingInfo();
|
|
27
31
|
}
|
|
28
32
|
getGasBalance(chainSymbol, address) {
|
|
29
33
|
return this.client.getGasBalance(chainSymbol, address);
|
|
30
34
|
}
|
|
35
|
+
/** @deprecated Do not use. */
|
|
31
36
|
async getPoolInfoByKey(poolKeyObject) {
|
|
32
37
|
this.poolInfoCache.putAllIfNotExists((await this.client.getChainDetailsMapAndPoolInfoMap()).poolInfoMap);
|
|
33
38
|
const poolInfo = this.poolInfoCache.get(poolKeyObject);
|
|
@@ -44,6 +49,7 @@ export class AllbridgeCoreClientPoolInfoCaching {
|
|
|
44
49
|
throw new SdkError("Cannot find pool info for " + poolKeyObject.poolAddress + " on chain " + poolKeyObject.chainSymbol);
|
|
45
50
|
}
|
|
46
51
|
}
|
|
52
|
+
/** @deprecated Do not use. */
|
|
47
53
|
async refreshPoolInfo(poolKeyObjects) {
|
|
48
54
|
let poolInfoMap;
|
|
49
55
|
if (poolKeyObjects) {
|
|
@@ -56,6 +62,7 @@ export class AllbridgeCoreClientPoolInfoCaching {
|
|
|
56
62
|
}
|
|
57
63
|
this.poolInfoCache.putAll(poolInfoMap);
|
|
58
64
|
}
|
|
65
|
+
/** @deprecated Do not use. */
|
|
59
66
|
cachePut(poolKeyObject, poolInfo) {
|
|
60
67
|
this.poolInfoCache.put(mapPoolKeyObjectToPoolKey(poolKeyObject), poolInfo);
|
|
61
68
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core-client-pool-info-caching.js","sourceRoot":"","sources":["../../../../src/client/core-api/core-client-pool-info-caching.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,aAAa,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAQ5C,OAAO,EAAE,kCAAkC,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAUlG,MAAM,eAAe,GAAG,EAAE,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"core-client-pool-info-caching.js","sourceRoot":"","sources":["../../../../src/client/core-api/core-client-pool-info-caching.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,aAAa,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAQ5C,OAAO,EAAE,kCAAkC,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAUlG,MAAM,eAAe,GAAG,EAAE,GAAG,IAAI,CAAC;AAclC;;GAEG;AACH,MAAM,OAAO,kCAAkC;IAGhB;IAFZ,aAAa,CAAC;IAE/B,YAA6B,MAAuC;QAAvC,WAAM,GAAN,MAAM,CAAiC;QAClE,IAAI,CAAC,aAAa,GAAG,IAAI,aAAa,EAAE,CAAC;IAC3C,CAAC;IAED,KAAK,CAAC,kBAAkB;QACtB,MAA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,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAC7B,CAAC;IACH,CAAC;IAED,iBAAiB,CAAC,WAAwB;QACxC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC;YACvD,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;gBACzB,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;YAC7B,CAAC;QACH,CAAC;IACH,CAAC;IAED,GAAG,CAAC,GAAW,EAAE,QAAkB;QACjC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;IAChC,CAAC;IAED,GAAG,CAAC,aAA4B;QAC9B,MAAM,GAAG,GAAG,yBAAyB,CAAC,aAAa,CAAC,CAAC;QACrD,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;CACF","sourcesContent":["import Cache from \"timed-cache\";\nimport { SdkError } from \"../../exceptions\";\nimport {\n ChainDetailsMapWithFlags,\n PoolInfo,\n PoolInfoMap,\n PoolKeyObject,\n TokenWithChainDetailsWithFlags,\n} from \"../../tokens-info\";\nimport { mapChainDetailsMapToPoolKeyObjects, mapPoolKeyObjectToPoolKey } from \"./core-api-mapper\";\nimport {\n GasBalanceResponse,\n PendingInfoResponse,\n ReceiveTransactionCostRequest,\n ReceiveTransactionCostResponse,\n TransferStatusResponse,\n} from \"./core-api.model\";\nimport { AllbridgeCoreClientWithPoolInfo, AllbridgeCoreClientWithTokens } from \"./core-client-base\";\n\nconst _55_SECONDS_TTL = 55 * 1000;\n\n/**\n * @deprecated Do not use.\n */\nexport interface AllbridgeCoreClientPoolsExt {\n /** @deprecated Do not use. */\n getPoolInfoByKey(poolKeyObject: PoolKeyObject): Promise<PoolInfo>;\n /** @deprecated Do not use. */\n refreshPoolInfo(poolKeyObjects?: PoolKeyObject | PoolKeyObject[]): Promise<void>;\n /** @deprecated Do not use. */\n cachePut(poolKeyObject: PoolKeyObject, poolInfo: PoolInfo): void;\n}\n\n/**\n * @deprecated Do not use.\n */\nexport class AllbridgeCoreClientPoolInfoCaching implements AllbridgeCoreClientWithTokens, AllbridgeCoreClientPoolsExt {\n private readonly poolInfoCache;\n\n constructor(private readonly client: AllbridgeCoreClientWithPoolInfo) {\n this.poolInfoCache = new PoolInfoCache();\n }\n\n async getChainDetailsMap(): Promise<ChainDetailsMapWithFlags> {\n const result = await this.client.getChainDetailsMapAndPoolInfoMap();\n return result.chainDetailsMap;\n }\n\n async tokens(): Promise<TokenWithChainDetailsWithFlags[]> {\n return await this.client.tokens();\n }\n\n getTransferStatus(chainSymbol: string, txId: string): Promise<TransferStatusResponse> {\n return this.client.getTransferStatus(chainSymbol, txId);\n }\n\n getReceiveTransactionCost(args: ReceiveTransactionCostRequest): Promise<ReceiveTransactionCostResponse> {\n return this.client.getReceiveTransactionCost(args);\n }\n\n /** @deprecated Do not use. */\n getPendingInfo(): Promise<PendingInfoResponse> {\n return this.client.getPendingInfo();\n }\n\n getGasBalance(chainSymbol: string, address: string): Promise<GasBalanceResponse> {\n return this.client.getGasBalance(chainSymbol, address);\n }\n\n /** @deprecated Do not use. */\n async getPoolInfoByKey(poolKeyObject: PoolKeyObject): Promise<PoolInfo> {\n this.poolInfoCache.putAllIfNotExists((await this.client.getChainDetailsMapAndPoolInfoMap()).poolInfoMap);\n const poolInfo = this.poolInfoCache.get(poolKeyObject);\n\n if (poolInfo) {\n return poolInfo;\n } else {\n const poolInfoMap = await this.client.getPoolInfoMap(poolKeyObject);\n this.poolInfoCache.putAll(poolInfoMap);\n const result = poolInfoMap[mapPoolKeyObjectToPoolKey(poolKeyObject)];\n if (result) {\n return result;\n }\n throw new SdkError(\n \"Cannot find pool info for \" + poolKeyObject.poolAddress + \" on chain \" + poolKeyObject.chainSymbol\n );\n }\n }\n\n /** @deprecated Do not use. */\n async refreshPoolInfo(poolKeyObjects?: PoolKeyObject | PoolKeyObject[]): Promise<void> {\n let poolInfoMap;\n if (poolKeyObjects) {\n this.poolInfoCache.putAllIfNotExists((await this.client.getChainDetailsMapAndPoolInfoMap()).poolInfoMap);\n poolInfoMap = await this.client.getPoolInfoMap(poolKeyObjects);\n } else {\n const result = await this.client.getChainDetailsMapAndPoolInfoMap();\n poolInfoMap = await this.client.getPoolInfoMap(mapChainDetailsMapToPoolKeyObjects(result.chainDetailsMap));\n }\n this.poolInfoCache.putAll(poolInfoMap);\n }\n\n /** @deprecated Do not use. */\n cachePut(poolKeyObject: PoolKeyObject, poolInfo: PoolInfo): void {\n this.poolInfoCache.put(mapPoolKeyObjectToPoolKey(poolKeyObject), poolInfo);\n }\n}\n\nclass PoolInfoCache {\n private cache;\n\n constructor() {\n this.cache = new Cache<PoolInfo>({ defaultTtl: _55_SECONDS_TTL });\n }\n\n putAll(poolInfoMap: PoolInfoMap) {\n for (const [key, value] of Object.entries(poolInfoMap)) {\n this.cache.put(key, value);\n }\n }\n\n putAllIfNotExists(poolInfoMap: PoolInfoMap) {\n for (const [key, value] of Object.entries(poolInfoMap)) {\n if (!this.cache.get(key)) {\n this.cache.put(key, value);\n }\n }\n }\n\n put(key: string, poolInfo: PoolInfo) {\n this.cache.put(key, poolInfo);\n }\n\n get(poolKeyObject: PoolKeyObject): PoolInfo | undefined {\n const key = mapPoolKeyObjectToPoolKey(poolKeyObject);\n return this.cache.get(key);\n }\n}\n"]}
|
|
@@ -11,6 +11,9 @@ export declare class InvalidAmountError extends SdkRootError {
|
|
|
11
11
|
export declare class AmountNotEnoughError extends SdkRootError {
|
|
12
12
|
constructor(message?: string);
|
|
13
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated Do not use.
|
|
16
|
+
*/
|
|
14
17
|
export declare class InsufficientPoolLiquidityError extends SdkRootError {
|
|
15
18
|
constructor(message?: string);
|
|
16
19
|
}
|
|
@@ -60,6 +63,7 @@ export declare enum ErrorCode {
|
|
|
60
63
|
SDK_ERROR = "SdkError",
|
|
61
64
|
INVALID_AMOUNT_ERROR = "InvalidAmountError",
|
|
62
65
|
AMOUNT_NOT_ENOUGH_ERROR = "AmountNotEnoughError",
|
|
66
|
+
/** @deprecated Do not use. */
|
|
63
67
|
INSUFFICIENT_POOL_LIQUIDITY_ERROR = "InsufficientPoolLiquidityError",
|
|
64
68
|
JUPITER_ERROR = "JupiterError",
|
|
65
69
|
INVALID_GAS_FEE_PAYMENT_OPTION_ERROR = "InvalidGasFeePaymentOptionError",
|
|
@@ -20,6 +20,9 @@ export class AmountNotEnoughError extends SdkRootError {
|
|
|
20
20
|
super(ErrorCode.AMOUNT_NOT_ENOUGH_ERROR, message);
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* @deprecated Do not use.
|
|
25
|
+
*/
|
|
23
26
|
export class InsufficientPoolLiquidityError extends SdkRootError {
|
|
24
27
|
constructor(message) {
|
|
25
28
|
super(ErrorCode.INSUFFICIENT_POOL_LIQUIDITY_ERROR, message);
|
|
@@ -100,6 +103,7 @@ export var ErrorCode;
|
|
|
100
103
|
ErrorCode["SDK_ERROR"] = "SdkError";
|
|
101
104
|
ErrorCode["INVALID_AMOUNT_ERROR"] = "InvalidAmountError";
|
|
102
105
|
ErrorCode["AMOUNT_NOT_ENOUGH_ERROR"] = "AmountNotEnoughError";
|
|
106
|
+
/** @deprecated Do not use. */
|
|
103
107
|
ErrorCode["INSUFFICIENT_POOL_LIQUIDITY_ERROR"] = "InsufficientPoolLiquidityError";
|
|
104
108
|
ErrorCode["JUPITER_ERROR"] = "JupiterError";
|
|
105
109
|
ErrorCode["INVALID_GAS_FEE_PAYMENT_OPTION_ERROR"] = "InvalidGasFeePaymentOptionError";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exceptions.js","sourceRoot":"","sources":["../../../src/exce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\n\n protected constructor(code: ErrorCode, message?: string) {\n super(message);\n this.errorCode = code;\n }\n}\n\nexport class SdkError extends SdkRootError {\n constructor(message?: string) {\n super(ErrorCode.SDK_ERROR, message);\n }\n}\n\nexport class InvalidAmountError extends SdkRootError {\n constructor(message?: string) {\n super(ErrorCode.INVALID_AMOUNT_ERROR, message);\n }\n}\n\nexport class AmountNotEnoughError extends SdkRootError {\n constructor(message?: string) {\n super(ErrorCode.AMOUNT_NOT_ENOUGH_ERROR, message);\n }\n}\n\n/**\n * @deprecated Do not use.\n */\nexport class InsufficientPoolLiquidityError extends SdkRootError {\n constructor(message?: string) {\n super(ErrorCode.INSUFFICIENT_POOL_LIQUIDITY_ERROR, message);\n }\n}\n\nexport class JupiterError extends SdkRootError {\n constructor(message?: string) {\n super(ErrorCode.JUPITER_ERROR, message);\n }\n}\n\nexport class InvalidGasFeePaymentOptionError extends SdkRootError {\n constructor(message?: string) {\n super(ErrorCode.INVALID_GAS_FEE_PAYMENT_OPTION_ERROR, message);\n }\n}\n\nexport class InvalidMessengerOptionError extends SdkRootError {\n constructor(message?: string) {\n super(ErrorCode.INVALID_MESSENGER_OPTION_ERROR, message);\n }\n}\n\nexport class MethodNotSupportedError extends SdkRootError {\n constructor(message?: string) {\n super(ErrorCode.METHOD_NOT_SUPPORTED_ERROR, message);\n }\n}\n\nexport class VerifyTxError extends SdkRootError {\n constructor(message?: string) {\n super(ErrorCode.VERIFY_TX_ERROR, message);\n }\n}\n\nexport class InvalidTxError extends SdkRootError {\n constructor(message?: string) {\n super(ErrorCode.INVALID_TX_ERROR, message);\n }\n}\n\nexport class ExtraGasMaxLimitExceededError extends SdkRootError {\n constructor(message?: string) {\n super(ErrorCode.EXTRA_GAS_MAX_LIMIT_EXCEEDED_ERROR, message);\n }\n}\n\nexport class ArgumentInvalidDecimalsError extends SdkRootError {\n constructor(argName: string, decimalsIs: number, decimalsRequired: number) {\n super(\n ErrorCode.ARGUMENT_INVALID_DECIMALS_ERROR,\n `Argument '${argName}' decimals '${decimalsIs}' cannot be greater than '${decimalsRequired}'`\n );\n }\n}\n\nexport class TimeoutError extends SdkRootError {\n constructor(message?: string) {\n super(ErrorCode.TIMEOUT_ERROR, message);\n }\n}\n\nexport class NodeRpcUrlNotInitializedError extends SdkRootError {\n constructor(chainSymbol: string) {\n super(ErrorCode.NODE_RPC_URL_NOT_INITIALIZED_ERROR, `For chain '${chainSymbol}' Node RPC URL not initialized`);\n }\n}\n\nexport class CCTPDoesNotSupportedError extends SdkRootError {\n constructor(message?: string) {\n super(ErrorCode.CCTP_DOES_NOT_SUPPORTED_ERROR, message);\n }\n}\n\nexport class OFTDoesNotSupportedError extends SdkRootError {\n constructor(message?: string) {\n super(ErrorCode.OFT_DOES_NOT_SUPPORTED_ERROR, message);\n }\n}\n\nexport class YieldDoesNotSupportedError extends SdkRootError {\n constructor(message?: string) {\n super(ErrorCode.YIELD_DOES_NOT_SUPPORTED_ERROR, message);\n }\n}\n\nexport class TxTooLargeError extends SdkRootError {\n constructor() {\n super(\n ErrorCode.TX_TOO_LARGE,\n \"Transaction too large: try again later or switch to another messenger or pay relayer fee in native gas currency\"\n );\n }\n}\n\nexport enum ErrorCode {\n SDK_ERROR = \"SdkError\",\n INVALID_AMOUNT_ERROR = \"InvalidAmountError\",\n AMOUNT_NOT_ENOUGH_ERROR = \"AmountNotEnoughError\",\n /** @deprecated Do not use. */\n INSUFFICIENT_POOL_LIQUIDITY_ERROR = \"InsufficientPoolLiquidityError\",\n JUPITER_ERROR = \"JupiterError\",\n INVALID_GAS_FEE_PAYMENT_OPTION_ERROR = \"InvalidGasFeePaymentOptionError\",\n INVALID_MESSENGER_OPTION_ERROR = \"InvalidMessengerOptionError\",\n METHOD_NOT_SUPPORTED_ERROR = \"MethodNotSupportedError\",\n VERIFY_TX_ERROR = \"VerifyTxError\",\n INVALID_TX_ERROR = \"InvalidTxError\",\n EXTRA_GAS_MAX_LIMIT_EXCEEDED_ERROR = \"ExtraGasMaxLimitExceededError\",\n ARGUMENT_INVALID_DECIMALS_ERROR = \"ArgumentInvalidDecimalsError\",\n TIMEOUT_ERROR = \"TimeoutError\",\n NODE_RPC_URL_NOT_INITIALIZED_ERROR = \"NodeRpcUrlNotInitializedError\",\n CCTP_DOES_NOT_SUPPORTED_ERROR = \"CCTPDoesNotSupportedError\",\n OFT_DOES_NOT_SUPPORTED_ERROR = \"OFTDoesNotSupportedError\",\n YIELD_DOES_NOT_SUPPORTED_ERROR = \"YieldDoesNotSupportedError\",\n TX_TOO_LARGE = \"TxTooLargeError\",\n}\n"]}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BigSource } from "big.js";
|
|
2
2
|
import { AdditionalBasicChainProperties } from "./chains/models";
|
|
3
|
-
import { AmountFormat, AmountFormatted, AmountsAndGasFeeOptions, BridgeService, ChainDetailsMap, CheckAddressResponse, ExtraGasMaxLimitResponse, GasBalanceResponse, GasFeeOptions, GetNativeTokenBalanceParams, GetTokenBalanceParams, LiquidityPoolService, Messenger, PendingStatusInfoResponse, PoolInfo, Provider, SendAmountDetails, SwapAndBridgeCalculationData, TokenWithChainDetails, TransferStatusResponse } from "./models";
|
|
3
|
+
import { ActiveMessenger, AmountFormat, AmountFormatted, AmountsAndGasFeeOptions, BridgeService, ChainDetailsMap, CheckAddressResponse, ExtraGasMaxLimitResponse, GasBalanceResponse, GasFeeOptions, GetNativeTokenBalanceParams, GetTokenBalanceParams, LiquidityPoolService, LegacyMessenger, Messenger, PendingStatusInfoResponse, PoolInfo, Provider, SendAmountDetails, SwapAndBridgeCalculationData, TokenWithChainDetails, TransferStatusResponse } from "./models";
|
|
4
4
|
import { CctpParams } from "./services/bridge/sol";
|
|
5
5
|
import { YieldService } from "./services/yield";
|
|
6
6
|
import { Utils } from "./utils";
|
|
@@ -38,13 +38,17 @@ export interface AllbridgeCoreSdkOptions {
|
|
|
38
38
|
* {@link https://station.jup.ag/docs/apis/swap-api#using-maxaccounts}
|
|
39
39
|
*/
|
|
40
40
|
jupiterMaxAccounts?: number;
|
|
41
|
-
|
|
41
|
+
/**
|
|
42
|
+
* @deprecated Do not use.
|
|
43
|
+
*/
|
|
44
|
+
wormholeMessengerProgramId?: string;
|
|
42
45
|
solanaLookUpTable: string;
|
|
43
46
|
sorobanNetworkPassphrase: string;
|
|
44
47
|
/**
|
|
45
48
|
* Optional. Will be used in methods</br>
|
|
46
49
|
* {@link LiquidityPoolService.getPoolInfoFromChain} and {@link LiquidityPoolService.getAmountToBeWithdrawn}</br>
|
|
47
50
|
* to fetch information from the blockchain with fewer HTTP requests using JSON-RPC API
|
|
51
|
+
* @deprecated Do not use.
|
|
48
52
|
*/
|
|
49
53
|
tronJsonRpc?: string;
|
|
50
54
|
cctpParams: CctpParams;
|
|
@@ -52,8 +56,9 @@ export interface AllbridgeCoreSdkOptions {
|
|
|
52
56
|
* The number of seconds that pool information taken from the chain will be cached.
|
|
53
57
|
*
|
|
54
58
|
* @type {number}
|
|
59
|
+
* @deprecated Do not use.
|
|
55
60
|
*/
|
|
56
|
-
cachePoolInfoChainSec
|
|
61
|
+
cachePoolInfoChainSec?: number;
|
|
57
62
|
/**
|
|
58
63
|
* @internal
|
|
59
64
|
* Optional additional properties to merge with the default properties.
|
|
@@ -83,6 +88,9 @@ export interface NodeUrlsConfig {
|
|
|
83
88
|
export declare class AllbridgeCoreSdk {
|
|
84
89
|
readonly params: AllbridgeCoreSdkOptions;
|
|
85
90
|
bridge: BridgeService;
|
|
91
|
+
/**
|
|
92
|
+
* @deprecated Do not use.
|
|
93
|
+
*/
|
|
86
94
|
pool: LiquidityPoolService;
|
|
87
95
|
yield: YieldService;
|
|
88
96
|
utils: Utils;
|
|
@@ -102,7 +110,10 @@ export declare class AllbridgeCoreSdk {
|
|
|
102
110
|
* Can be either 'swap' for send or 'pool' for liquidity pools setup.
|
|
103
111
|
* Defaults to 'swap'.
|
|
104
112
|
*/
|
|
105
|
-
|
|
113
|
+
/** @deprecated Do not use. */
|
|
114
|
+
chainDetailsMap(type: "pool"): Promise<ChainDetailsMap>;
|
|
115
|
+
chainDetailsMap(type?: "swap"): Promise<ChainDetailsMap>;
|
|
116
|
+
chainDetailsMap(type: "swap" | "pool"): Promise<ChainDetailsMap>;
|
|
106
117
|
/**
|
|
107
118
|
* Returns a list of supported {@link TokenWithChainDetails | tokens}.
|
|
108
119
|
*
|
|
@@ -111,7 +122,10 @@ export declare class AllbridgeCoreSdk {
|
|
|
111
122
|
* Defaults to 'swap'.
|
|
112
123
|
* @returns A promise that resolves to an array of {@link TokenWithChainDetails}.
|
|
113
124
|
*/
|
|
114
|
-
|
|
125
|
+
/** @deprecated Do not use. */
|
|
126
|
+
tokens(type: "pool"): Promise<TokenWithChainDetails[]>;
|
|
127
|
+
tokens(type?: "swap"): Promise<TokenWithChainDetails[]>;
|
|
128
|
+
tokens(type: "swap" | "pool"): Promise<TokenWithChainDetails[]>;
|
|
115
129
|
/**
|
|
116
130
|
* Returns a list of supported {@link TokenWithChainDetails | tokens} on the selected chain.
|
|
117
131
|
* @param chainSymbol - The symbol of the chain representing one of the supported blockchain networks (e.g., "ETH" for Ethereum). For more details, see: {@link ChainSymbol}.
|
|
@@ -119,7 +133,10 @@ export declare class AllbridgeCoreSdk {
|
|
|
119
133
|
* Can be either 'swap' for tokens to send or 'pool' for liquidity pools operations.
|
|
120
134
|
* Defaults to 'swap'.
|
|
121
135
|
*/
|
|
122
|
-
|
|
136
|
+
/** @deprecated Do not use. */
|
|
137
|
+
tokensByChain(chainSymbol: string, type: "pool"): Promise<TokenWithChainDetails[]>;
|
|
138
|
+
tokensByChain(chainSymbol: string, type?: "swap"): Promise<TokenWithChainDetails[]>;
|
|
139
|
+
tokensByChain(chainSymbol: string, type: "swap" | "pool"): Promise<TokenWithChainDetails[]>;
|
|
123
140
|
/**
|
|
124
141
|
* Fetches information about tokens transfer by chosen chainSymbol and transaction Id from the Allbridge Core API.
|
|
125
142
|
* @param chainSymbol - The symbol of the chain representing one of the supported blockchain networks (e.g., "ETH" for Ethereum). For more details, see: {@link ChainSymbol}.
|
|
@@ -142,6 +159,7 @@ export declare class AllbridgeCoreSdk {
|
|
|
142
159
|
checkAddress(_chainSymbol: string, _recipientAddress: string, _tokenAddress?: string): Promise<CheckAddressResponse>;
|
|
143
160
|
/**
|
|
144
161
|
* Returns information about pending transactions for the same destination chain and the amount of tokens can be received as a result of transfer considering pending transactions.
|
|
162
|
+
* @deprecated Do not use.
|
|
145
163
|
* @param amount the amount of tokens that will be sent
|
|
146
164
|
* @param amountFormat amount format
|
|
147
165
|
* @param sourceToken selected token transfer from
|
|
@@ -214,11 +232,9 @@ export declare class AllbridgeCoreSdk {
|
|
|
214
232
|
* @param destinationChainToken selected token on the destination chain
|
|
215
233
|
* @param messenger selected messenger
|
|
216
234
|
*/
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
*/
|
|
221
|
-
messenger?: Messenger): Promise<string>;
|
|
235
|
+
/** @deprecated Do not use. */
|
|
236
|
+
getAmountToBeReceived(amountToSendFloat: BigSource, sourceChainToken: TokenWithChainDetails, destinationChainToken: TokenWithChainDetails, messenger: LegacyMessenger): Promise<string>;
|
|
237
|
+
getAmountToBeReceived(amountToSendFloat: BigSource, sourceChainToken: TokenWithChainDetails, destinationChainToken: TokenWithChainDetails, messenger: ActiveMessenger): Promise<string>;
|
|
222
238
|
/**
|
|
223
239
|
* Calculates the amount of tokens to be received as a result of transfer based on actual blockchain pool state.
|
|
224
240
|
* @param amountToSendFloat the amount of tokens that will be sent
|
|
@@ -228,11 +244,8 @@ export declare class AllbridgeCoreSdk {
|
|
|
228
244
|
* @param sourceProvider Optional. source chain Provider
|
|
229
245
|
* @param destinationProvider Optional. destination chain Provider
|
|
230
246
|
*/
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
* The Messengers for different routes.
|
|
234
|
-
*/
|
|
235
|
-
messenger?: Messenger, sourceProvider?: Provider, destinationProvider?: Provider): Promise<string>;
|
|
247
|
+
/** @deprecated Do not use. */
|
|
248
|
+
getAmountToBeReceivedFromChain(amountToSendFloat: BigSource, sourceChainToken: TokenWithChainDetails, destinationChainToken: TokenWithChainDetails, messenger: Messenger, sourceProvider?: Provider, destinationProvider?: Provider): Promise<string>;
|
|
236
249
|
/**
|
|
237
250
|
* Calculates the amount of tokens to be received as a result of transfer based on passed pool state.
|
|
238
251
|
* @param amountToSendFloat the amount of tokens that will be sent
|
|
@@ -242,7 +255,8 @@ export declare class AllbridgeCoreSdk {
|
|
|
242
255
|
* @param destinationPool destination token pool state
|
|
243
256
|
* @param messenger selected messenger
|
|
244
257
|
*/
|
|
245
|
-
|
|
258
|
+
/** @deprecated Do not use. */
|
|
259
|
+
getAmountToBeReceivedFromPools(amountToSendFloat: BigSource, sourceChainToken: TokenWithChainDetails, destinationChainToken: TokenWithChainDetails, sourcePool: PoolInfo, destinationPool: PoolInfo, messenger: Exclude<Messenger, Messenger.OFT>): string;
|
|
246
260
|
/**
|
|
247
261
|
* Calculates the amount of tokens to send based on requested tokens amount be received as a result of transfer.
|
|
248
262
|
* @param amountToBeReceivedFloat the amount of tokens that should be received
|
|
@@ -250,11 +264,9 @@ export declare class AllbridgeCoreSdk {
|
|
|
250
264
|
* @param destinationChainToken selected token on the destination chain
|
|
251
265
|
* @param messenger selected messenger
|
|
252
266
|
*/
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
*/
|
|
257
|
-
messenger?: Messenger): Promise<string>;
|
|
267
|
+
/** @deprecated Do not use. */
|
|
268
|
+
getAmountToSend(amountToBeReceivedFloat: BigSource, sourceChainToken: TokenWithChainDetails, destinationChainToken: TokenWithChainDetails, messenger: LegacyMessenger): Promise<string>;
|
|
269
|
+
getAmountToSend(amountToBeReceivedFloat: BigSource, sourceChainToken: TokenWithChainDetails, destinationChainToken: TokenWithChainDetails, messenger: ActiveMessenger): Promise<string>;
|
|
258
270
|
/**
|
|
259
271
|
* Calculates the amount of tokens to send based on requested tokens amount be received as a result of transfer based on actual blockchain pool state.
|
|
260
272
|
* @param amountToBeReceivedFloat the amount of tokens that should be received
|
|
@@ -264,11 +276,8 @@ export declare class AllbridgeCoreSdk {
|
|
|
264
276
|
* @param sourceProvider Optional. source chain Provider
|
|
265
277
|
* @param destinationProvider Optional. destination chain Provider
|
|
266
278
|
*/
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
* The Messengers for different routes.
|
|
270
|
-
*/
|
|
271
|
-
messenger?: Messenger, sourceProvider?: Provider, destinationProvider?: Provider): Promise<string>;
|
|
279
|
+
/** @deprecated Do not use. */
|
|
280
|
+
getAmountToSendFromChain(amountToBeReceivedFloat: BigSource, sourceChainToken: TokenWithChainDetails, destinationChainToken: TokenWithChainDetails, messenger: Messenger, sourceProvider?: Provider, destinationProvider?: Provider): Promise<string>;
|
|
272
281
|
/**
|
|
273
282
|
* Calculates the amount of tokens to send based on requested tokens amount be received as a result of transfer based on passed pool state.
|
|
274
283
|
* @param amountToBeReceivedFloat the amount of tokens that should be received
|
|
@@ -278,7 +287,8 @@ export declare class AllbridgeCoreSdk {
|
|
|
278
287
|
* @param destinationPool destination token pool state
|
|
279
288
|
* @param messenger selected messenger
|
|
280
289
|
*/
|
|
281
|
-
|
|
290
|
+
/** @deprecated Do not use. */
|
|
291
|
+
getAmountToSendFromPools(amountToBeReceivedFloat: BigSource, sourceChainToken: TokenWithChainDetails, destinationChainToken: TokenWithChainDetails, sourcePool: PoolInfo, destinationPool: PoolInfo, messenger: Exclude<Messenger, Messenger.OFT>): string;
|
|
282
292
|
/**
|
|
283
293
|
* Fetches possible ways to pay the transfer gas fee.
|
|
284
294
|
* @param sourceChainToken selected token on the source chain
|
|
@@ -297,6 +307,7 @@ export declare class AllbridgeCoreSdk {
|
|
|
297
307
|
getAverageTransferTime(sourceChainToken: TokenWithChainDetails, destinationChainToken: TokenWithChainDetails, messenger: Messenger): number | null;
|
|
298
308
|
/**
|
|
299
309
|
* Gets information about the poolInfo by token
|
|
310
|
+
* @deprecated Do not use.
|
|
300
311
|
* @param token
|
|
301
312
|
* @returns poolInfo
|
|
302
313
|
*/
|
|
@@ -306,11 +317,13 @@ export declare class AllbridgeCoreSdk {
|
|
|
306
317
|
* Outdated cache leads to calculated amounts being less accurate.
|
|
307
318
|
* The cache is invalidated at regular intervals, but it can be forced to be refreshed by calling this method.+
|
|
308
319
|
*
|
|
320
|
+
* @deprecated Do not use.
|
|
309
321
|
* @param tokens if present, the corresponding liquidity pools will be updated
|
|
310
322
|
*/
|
|
311
323
|
refreshPoolInfo(tokens?: TokenWithChainDetails | TokenWithChainDetails[]): Promise<void>;
|
|
312
324
|
/**
|
|
313
325
|
* Convert APR to percentage view
|
|
326
|
+
* @deprecated Do not use.
|
|
314
327
|
* @param apr
|
|
315
328
|
* @returns aprPercentageView
|
|
316
329
|
*/
|
|
@@ -319,11 +332,14 @@ export declare class AllbridgeCoreSdk {
|
|
|
319
332
|
* Get possible limit of extra gas amount.
|
|
320
333
|
* @param sourceChainToken selected token on the source chain
|
|
321
334
|
* @param destinationChainToken selected token on the destination chain
|
|
322
|
-
* @param messenger selected Messenger
|
|
335
|
+
* @param messenger selected Messenger
|
|
323
336
|
* @returns {@link ExtraGasMaxLimitResponse}
|
|
324
337
|
*/
|
|
325
|
-
|
|
338
|
+
/** @deprecated Do not use. */
|
|
339
|
+
getExtraGasMaxLimits(sourceChainToken: TokenWithChainDetails, destinationChainToken: TokenWithChainDetails, messenger: LegacyMessenger): Promise<ExtraGasMaxLimitResponse>;
|
|
340
|
+
getExtraGasMaxLimits(sourceChainToken: TokenWithChainDetails, destinationChainToken: TokenWithChainDetails, messenger: ActiveMessenger): Promise<ExtraGasMaxLimitResponse>;
|
|
326
341
|
/**
|
|
342
|
+
* @deprecated Do not use.
|
|
327
343
|
* @param amount - amount
|
|
328
344
|
* @param amountFormat - AmountFormat
|
|
329
345
|
* @param sourceToken - selected token on the source chain
|
|
@@ -331,6 +347,7 @@ export declare class AllbridgeCoreSdk {
|
|
|
331
347
|
*/
|
|
332
348
|
getVUsdFromAmount(amount: string, amountFormat: AmountFormat, sourceToken: TokenWithChainDetails): Promise<AmountFormatted>;
|
|
333
349
|
/**
|
|
350
|
+
* @deprecated Do not use.
|
|
334
351
|
* @param vUsdAmount - amount of vUsd, int format
|
|
335
352
|
* @param destToken selected token on the destination chain
|
|
336
353
|
* @return amount of destToken
|
|
@@ -352,6 +369,7 @@ export declare class AllbridgeCoreSdk {
|
|
|
352
369
|
swapAndBridgeFeeCalculationReverse(amountInTokenPrecision: string, sourceToken: TokenWithChainDetails, destToken: TokenWithChainDetails): Promise<SwapAndBridgeCalculationData>;
|
|
353
370
|
/**
|
|
354
371
|
* Show amount changes (fee and amount adjustment) during send through pools on source and destination chains
|
|
372
|
+
* @deprecated Do not use.
|
|
355
373
|
*/
|
|
356
374
|
getSendAmountDetails(amount: string, amountFormat: AmountFormat, sourceToken: TokenWithChainDetails, destToken: TokenWithChainDetails): Promise<SendAmountDetails>;
|
|
357
375
|
}
|
package/dist/src/index.js
CHANGED
|
@@ -13,6 +13,9 @@ function isNodeUrlsConfig(nodeUrls) {
|
|
|
13
13
|
export class AllbridgeCoreSdk {
|
|
14
14
|
params;
|
|
15
15
|
bridge;
|
|
16
|
+
/**
|
|
17
|
+
* @deprecated Do not use.
|
|
18
|
+
*/
|
|
16
19
|
pool;
|
|
17
20
|
yield;
|
|
18
21
|
utils;
|
|
@@ -39,34 +42,12 @@ export class AllbridgeCoreSdk {
|
|
|
39
42
|
this.utils = new DefaultUtils(this.service);
|
|
40
43
|
this.params = params;
|
|
41
44
|
}
|
|
42
|
-
/**
|
|
43
|
-
* Returns {@link ChainDetailsMap} containing a list of supported tokens groped by chain.
|
|
44
|
-
*
|
|
45
|
-
* @param type - A string value which specifies ChainDetailsMap to retrieve.
|
|
46
|
-
* Can be either 'swap' for send or 'pool' for liquidity pools setup.
|
|
47
|
-
* Defaults to 'swap'.
|
|
48
|
-
*/
|
|
49
45
|
async chainDetailsMap(type = "swap") {
|
|
50
46
|
return this.service.chainDetailsMap(type);
|
|
51
47
|
}
|
|
52
|
-
/**
|
|
53
|
-
* Returns a list of supported {@link TokenWithChainDetails | tokens}.
|
|
54
|
-
*
|
|
55
|
-
* @param type - A string value which specifies a set of tokens to retrieve.
|
|
56
|
-
* Can be either 'swap' for tokens to send or 'pool' for liquidity pools operations.
|
|
57
|
-
* Defaults to 'swap'.
|
|
58
|
-
* @returns A promise that resolves to an array of {@link TokenWithChainDetails}.
|
|
59
|
-
*/
|
|
60
48
|
async tokens(type = "swap") {
|
|
61
49
|
return this.service.tokens(type);
|
|
62
50
|
}
|
|
63
|
-
/**
|
|
64
|
-
* Returns a list of supported {@link TokenWithChainDetails | tokens} on the selected chain.
|
|
65
|
-
* @param chainSymbol - The symbol of the chain representing one of the supported blockchain networks (e.g., "ETH" for Ethereum). For more details, see: {@link ChainSymbol}.
|
|
66
|
-
* @param type - A string value which specifies a set of tokens to retrieve.
|
|
67
|
-
* Can be either 'swap' for tokens to send or 'pool' for liquidity pools operations.
|
|
68
|
-
* Defaults to 'swap'.
|
|
69
|
-
*/
|
|
70
51
|
async tokensByChain(chainSymbol, type = "swap") {
|
|
71
52
|
return this.service.tokensByChain(chainSymbol, type);
|
|
72
53
|
}
|
|
@@ -98,6 +79,7 @@ export class AllbridgeCoreSdk {
|
|
|
98
79
|
}
|
|
99
80
|
/**
|
|
100
81
|
* Returns information about pending transactions for the same destination chain and the amount of tokens can be received as a result of transfer considering pending transactions.
|
|
82
|
+
* @deprecated Do not use.
|
|
101
83
|
* @param amount the amount of tokens that will be sent
|
|
102
84
|
* @param amountFormat amount format
|
|
103
85
|
* @param sourceToken selected token transfer from
|
|
@@ -177,46 +159,21 @@ export class AllbridgeCoreSdk {
|
|
|
177
159
|
async getAmountToSendAndGasFeeOptions(amountToBeReceivedFloat, sourceChainToken, destinationChainToken, messenger) {
|
|
178
160
|
return this.service.getAmountToSendAndGasFeeOptions(amountToBeReceivedFloat, sourceChainToken, destinationChainToken, messenger);
|
|
179
161
|
}
|
|
180
|
-
/**
|
|
181
|
-
* Calculates the amount of tokens to be received as a result of transfer.
|
|
182
|
-
* @param amountToSendFloat the amount of tokens that will be sent
|
|
183
|
-
* @param sourceChainToken selected token on the source chain
|
|
184
|
-
* @param destinationChainToken selected token on the destination chain
|
|
185
|
-
* @param messenger selected messenger
|
|
186
|
-
*/
|
|
187
162
|
async getAmountToBeReceived(amountToSendFloat, sourceChainToken, destinationChainToken,
|
|
188
163
|
/**
|
|
189
164
|
* The Messengers for different routes.
|
|
190
165
|
*/
|
|
191
|
-
messenger
|
|
166
|
+
messenger) {
|
|
192
167
|
return this.service.getAmountToBeReceived(amountToSendFloat, sourceChainToken, destinationChainToken, messenger);
|
|
193
168
|
}
|
|
194
|
-
/**
|
|
195
|
-
* Calculates the amount of tokens to be received as a result of transfer based on actual blockchain pool state.
|
|
196
|
-
* @param amountToSendFloat the amount of tokens that will be sent
|
|
197
|
-
* @param sourceChainToken selected token on the source chain
|
|
198
|
-
* @param destinationChainToken selected token on the destination chain
|
|
199
|
-
* @param messenger selected messenger
|
|
200
|
-
* @param sourceProvider Optional. source chain Provider
|
|
201
|
-
* @param destinationProvider Optional. destination chain Provider
|
|
202
|
-
*/
|
|
203
169
|
async getAmountToBeReceivedFromChain(amountToSendFloat, sourceChainToken, destinationChainToken,
|
|
204
170
|
/**
|
|
205
171
|
* The Messengers for different routes.
|
|
206
172
|
*/
|
|
207
|
-
messenger
|
|
173
|
+
messenger, sourceProvider, destinationProvider) {
|
|
208
174
|
return this.service.getAmountToBeReceivedFromChain(amountToSendFloat, sourceChainToken, destinationChainToken, messenger, sourceProvider, destinationProvider);
|
|
209
175
|
}
|
|
210
|
-
|
|
211
|
-
* Calculates the amount of tokens to be received as a result of transfer based on passed pool state.
|
|
212
|
-
* @param amountToSendFloat the amount of tokens that will be sent
|
|
213
|
-
* @param sourceChainToken selected token on the source chain
|
|
214
|
-
* @param destinationChainToken selected token on the destination chain
|
|
215
|
-
* @param sourcePool source token pool state
|
|
216
|
-
* @param destinationPool destination token pool state
|
|
217
|
-
* @param messenger selected messenger
|
|
218
|
-
*/
|
|
219
|
-
getAmountToBeReceivedFromPools(amountToSendFloat, sourceChainToken, destinationChainToken, sourcePool, destinationPool, messenger = Messenger.ALLBRIDGE) {
|
|
176
|
+
getAmountToBeReceivedFromPools(amountToSendFloat, sourceChainToken, destinationChainToken, sourcePool, destinationPool, messenger) {
|
|
220
177
|
switch (messenger) {
|
|
221
178
|
case Messenger.ALLBRIDGE:
|
|
222
179
|
case Messenger.WORMHOLE:
|
|
@@ -228,46 +185,21 @@ export class AllbridgeCoreSdk {
|
|
|
228
185
|
return this.service.getAmountToBeReceivedComputeXReserve(amountToSendFloat, sourceChainToken, destinationChainToken);
|
|
229
186
|
}
|
|
230
187
|
}
|
|
231
|
-
/**
|
|
232
|
-
* Calculates the amount of tokens to send based on requested tokens amount be received as a result of transfer.
|
|
233
|
-
* @param amountToBeReceivedFloat the amount of tokens that should be received
|
|
234
|
-
* @param sourceChainToken selected token on the source chain
|
|
235
|
-
* @param destinationChainToken selected token on the destination chain
|
|
236
|
-
* @param messenger selected messenger
|
|
237
|
-
*/
|
|
238
188
|
async getAmountToSend(amountToBeReceivedFloat, sourceChainToken, destinationChainToken,
|
|
239
189
|
/**
|
|
240
190
|
* The Messengers for different routes.
|
|
241
191
|
*/
|
|
242
|
-
messenger
|
|
192
|
+
messenger) {
|
|
243
193
|
return this.service.getAmountToSend(amountToBeReceivedFloat, sourceChainToken, destinationChainToken, messenger);
|
|
244
194
|
}
|
|
245
|
-
/**
|
|
246
|
-
* Calculates the amount of tokens to send based on requested tokens amount be received as a result of transfer based on actual blockchain pool state.
|
|
247
|
-
* @param amountToBeReceivedFloat the amount of tokens that should be received
|
|
248
|
-
* @param sourceChainToken selected token on the source chain
|
|
249
|
-
* @param destinationChainToken selected token on the destination chain
|
|
250
|
-
* @param messenger selected messenger
|
|
251
|
-
* @param sourceProvider Optional. source chain Provider
|
|
252
|
-
* @param destinationProvider Optional. destination chain Provider
|
|
253
|
-
*/
|
|
254
195
|
async getAmountToSendFromChain(amountToBeReceivedFloat, sourceChainToken, destinationChainToken,
|
|
255
196
|
/**
|
|
256
197
|
* The Messengers for different routes.
|
|
257
198
|
*/
|
|
258
|
-
messenger
|
|
199
|
+
messenger, sourceProvider, destinationProvider) {
|
|
259
200
|
return this.service.getAmountToSendFromChain(amountToBeReceivedFloat, sourceChainToken, destinationChainToken, messenger, sourceProvider, destinationProvider);
|
|
260
201
|
}
|
|
261
|
-
|
|
262
|
-
* Calculates the amount of tokens to send based on requested tokens amount be received as a result of transfer based on passed pool state.
|
|
263
|
-
* @param amountToBeReceivedFloat the amount of tokens that should be received
|
|
264
|
-
* @param sourceChainToken selected token on the source chain
|
|
265
|
-
* @param destinationChainToken selected token on the destination chain
|
|
266
|
-
* @param sourcePool source token pool state
|
|
267
|
-
* @param destinationPool destination token pool state
|
|
268
|
-
* @param messenger selected messenger
|
|
269
|
-
*/
|
|
270
|
-
getAmountToSendFromPools(amountToBeReceivedFloat, sourceChainToken, destinationChainToken, sourcePool, destinationPool, messenger = Messenger.ALLBRIDGE) {
|
|
202
|
+
getAmountToSendFromPools(amountToBeReceivedFloat, sourceChainToken, destinationChainToken, sourcePool, destinationPool, messenger) {
|
|
271
203
|
switch (messenger) {
|
|
272
204
|
case Messenger.ALLBRIDGE:
|
|
273
205
|
case Messenger.WORMHOLE:
|
|
@@ -301,6 +233,7 @@ export class AllbridgeCoreSdk {
|
|
|
301
233
|
}
|
|
302
234
|
/**
|
|
303
235
|
* Gets information about the poolInfo by token
|
|
236
|
+
* @deprecated Do not use.
|
|
304
237
|
* @param token
|
|
305
238
|
* @returns poolInfo
|
|
306
239
|
*/
|
|
@@ -312,6 +245,7 @@ export class AllbridgeCoreSdk {
|
|
|
312
245
|
* Outdated cache leads to calculated amounts being less accurate.
|
|
313
246
|
* The cache is invalidated at regular intervals, but it can be forced to be refreshed by calling this method.+
|
|
314
247
|
*
|
|
248
|
+
* @deprecated Do not use.
|
|
315
249
|
* @param tokens if present, the corresponding liquidity pools will be updated
|
|
316
250
|
*/
|
|
317
251
|
async refreshPoolInfo(tokens) {
|
|
@@ -319,23 +253,18 @@ export class AllbridgeCoreSdk {
|
|
|
319
253
|
}
|
|
320
254
|
/**
|
|
321
255
|
* Convert APR to percentage view
|
|
256
|
+
* @deprecated Do not use.
|
|
322
257
|
* @param apr
|
|
323
258
|
* @returns aprPercentageView
|
|
324
259
|
*/
|
|
325
260
|
aprInPercents(apr) {
|
|
326
261
|
return this.service.aprInPercents(apr);
|
|
327
262
|
}
|
|
328
|
-
|
|
329
|
-
* Get possible limit of extra gas amount.
|
|
330
|
-
* @param sourceChainToken selected token on the source chain
|
|
331
|
-
* @param destinationChainToken selected token on the destination chain
|
|
332
|
-
* @param messenger selected Messenger, Allbridge by default
|
|
333
|
-
* @returns {@link ExtraGasMaxLimitResponse}
|
|
334
|
-
*/
|
|
335
|
-
async getExtraGasMaxLimits(sourceChainToken, destinationChainToken, messenger = Messenger.ALLBRIDGE) {
|
|
263
|
+
async getExtraGasMaxLimits(sourceChainToken, destinationChainToken, messenger) {
|
|
336
264
|
return this.service.getExtraGasMaxLimits(sourceChainToken, destinationChainToken, messenger);
|
|
337
265
|
}
|
|
338
266
|
/**
|
|
267
|
+
* @deprecated Do not use.
|
|
339
268
|
* @param amount - amount
|
|
340
269
|
* @param amountFormat - AmountFormat
|
|
341
270
|
* @param sourceToken - selected token on the source chain
|
|
@@ -345,6 +274,7 @@ export class AllbridgeCoreSdk {
|
|
|
345
274
|
return this.service.getVUsdFromAmount(amount, amountFormat, sourceToken);
|
|
346
275
|
}
|
|
347
276
|
/**
|
|
277
|
+
* @deprecated Do not use.
|
|
348
278
|
* @param vUsdAmount - amount of vUsd, int format
|
|
349
279
|
* @param destToken selected token on the destination chain
|
|
350
280
|
* @return amount of destToken
|
|
@@ -372,6 +302,7 @@ export class AllbridgeCoreSdk {
|
|
|
372
302
|
}
|
|
373
303
|
/**
|
|
374
304
|
* Show amount changes (fee and amount adjustment) during send through pools on source and destination chains
|
|
305
|
+
* @deprecated Do not use.
|
|
375
306
|
*/
|
|
376
307
|
async getSendAmountDetails(amount, amountFormat, sourceToken, destToken) {
|
|
377
308
|
return this.service.getSendAmountDetails(amount, amountFormat, sourceToken, destToken);
|