@allbridge/bridge-core-sdk 3.35.0 → 3.36.0-beta.1
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 +2 -2
- package/dist/browser/index.js +2 -2
- package/dist/browser/index.js.map +3 -3
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/index.js.map +3 -3
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +3 -3
- package/dist/src/client/core-api/api-client.d.ts +11 -3
- package/dist/src/client/core-api/api-client.js +15 -14
- package/dist/src/client/core-api/api-client.js.map +1 -1
- package/dist/src/client/core-api/core-api-mapper.d.ts +1 -0
- package/dist/src/client/core-api/core-api-mapper.js +19 -7
- 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 -18
- package/dist/src/client/core-api/core-api.model.js.map +1 -1
- package/dist/src/exceptions/exceptions.d.ts +6 -0
- package/dist/src/exceptions/exceptions.js +6 -0
- package/dist/src/exceptions/exceptions.js.map +1 -1
- package/dist/src/index.d.ts +71 -29
- package/dist/src/index.js +5 -2
- package/dist/src/index.js.map +1 -1
- package/dist/src/models/index.d.ts +1 -1
- package/dist/src/models/index.js.map +1 -1
- package/dist/src/services/models/index.d.ts +3 -0
- package/dist/src/services/models/index.js.map +1 -1
- package/dist/src/services/yield/index.d.ts +18 -0
- package/dist/src/services/yield/index.js +6 -0
- package/dist/src/services/yield/index.js.map +1 -1
- package/dist/src/services/yield/models/yield.model.d.ts +33 -0
- package/dist/src/services/yield/models/yield.model.js.map +1 -1
- package/dist/src/services/yield/raw-yield-transaction-builder.d.ts +9 -0
- package/dist/src/services/yield/raw-yield-transaction-builder.js +3 -0
- package/dist/src/services/yield/raw-yield-transaction-builder.js.map +1 -1
- package/dist/src/services/yield/validations.d.ts +2 -0
- package/dist/src/services/yield/validations.js +2 -0
- package/dist/src/services/yield/validations.js.map +1 -1
- package/dist/src/tokens-info/tokens-info.model.d.ts +4 -0
- package/dist/src/tokens-info/tokens-info.model.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
|
@@ -20,11 +20,19 @@ export declare class ApiClientImpl implements ApiClient {
|
|
|
20
20
|
private api;
|
|
21
21
|
constructor(params: AllbridgeCoreClientParams);
|
|
22
22
|
getTokenInfo(): Promise<TokenInfo>;
|
|
23
|
-
/**
|
|
23
|
+
/**
|
|
24
|
+
* @deprecated Do not use.
|
|
25
|
+
* The `/pending-info` endpoint was removed from the Core API together with the liquidity pools;
|
|
26
|
+
* always resolves to an empty object without calling the server.
|
|
27
|
+
*/
|
|
24
28
|
getPendingInfo(): Promise<PendingInfoResponse>;
|
|
25
29
|
getGasBalance(chainSymbol: string, address: string): Promise<GasBalanceResponse>;
|
|
26
30
|
getTransferStatus(chainSymbol: string, txId: string): Promise<TransferStatusResponse>;
|
|
27
31
|
getReceiveTransactionCost(args: ReceiveTransactionCostRequest): Promise<ReceiveTransactionCostResponse>;
|
|
28
|
-
/**
|
|
29
|
-
|
|
32
|
+
/**
|
|
33
|
+
* @deprecated Do not use.
|
|
34
|
+
* The `/pool-info` endpoint was removed from the Core API together with the liquidity pools;
|
|
35
|
+
* always resolves to an empty map without calling the server.
|
|
36
|
+
*/
|
|
37
|
+
getPoolInfoMap(_pools: PoolKeyObject[] | PoolKeyObject): Promise<PoolInfoMap>;
|
|
30
38
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AxiosHeaders, create } from "axios";
|
|
2
2
|
import { InvalidMessengerOptionError } from "../../exceptions";
|
|
3
3
|
import { VERSION } from "../../version";
|
|
4
|
-
import { mapChainDetailsResponseToChainDetailsMap, mapChainDetailsResponseToPoolInfoMap
|
|
4
|
+
import { mapChainDetailsResponseToChainDetailsMap, mapChainDetailsResponseToPoolInfoMap } from "./core-api-mapper";
|
|
5
5
|
import { Messenger, } from "./core-api.model";
|
|
6
6
|
export class ApiClientImpl {
|
|
7
7
|
api;
|
|
@@ -40,10 +40,13 @@ export class ApiClientImpl {
|
|
|
40
40
|
poolInfoMap: mapChainDetailsResponseToPoolInfoMap(data),
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
|
-
/**
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
/**
|
|
44
|
+
* @deprecated Do not use.
|
|
45
|
+
* The `/pending-info` endpoint was removed from the Core API together with the liquidity pools;
|
|
46
|
+
* always resolves to an empty object without calling the server.
|
|
47
|
+
*/
|
|
48
|
+
getPendingInfo() {
|
|
49
|
+
return Promise.resolve({});
|
|
47
50
|
}
|
|
48
51
|
async getGasBalance(chainSymbol, address) {
|
|
49
52
|
const { data } = await this.api.get(`/check/${chainSymbol}/${address}`);
|
|
@@ -70,15 +73,13 @@ export class ApiClientImpl {
|
|
|
70
73
|
adminFeeShareWithExtras: data.adminFeeShareWithExtras,
|
|
71
74
|
};
|
|
72
75
|
}
|
|
73
|
-
/**
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
});
|
|
81
|
-
return mapPoolInfoResponseToPoolInfoMap(data);
|
|
76
|
+
/**
|
|
77
|
+
* @deprecated Do not use.
|
|
78
|
+
* The `/pool-info` endpoint was removed from the Core API together with the liquidity pools;
|
|
79
|
+
* always resolves to an empty map without calling the server.
|
|
80
|
+
*/
|
|
81
|
+
getPoolInfoMap(_pools) {
|
|
82
|
+
return Promise.resolve({});
|
|
82
83
|
}
|
|
83
84
|
}
|
|
84
85
|
//# sourceMappingURL=api-client.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-client.js","sourceRoot":"","sources":["../../../../src/client/core-api/api-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,YAAY,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,EAAE,2BAA2B,EAAE,MAAM,kBAAkB,CAAC;AAE/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SAAS,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YAC1D,MAAM,IAAI,2BAA2B,CAAC,8BAA8B,CAAC,CAAC;QACxE,CAAC;QACD,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,IAAI,CAAiC,cAAc,EAAE,IAAI,EAAE;YACzF,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;aACnC;SACF,CAAC,CAAC;QACH,OAAO;YACL,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,sBAAsB,EAAE,IAAI,CAAC,sBAAsB;YACnD,eAAe,EAAE,IAAI,CAAC,eAAe;YACrC,uBAAuB,EAAE,IAAI,CAAC,uBAAuB;SACtD,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACH,cAAc,CAAC,MAAuC;QACpD,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAC7B,CAAC;CACF","sourcesContent":["import { Axios, AxiosHeaders, create } from \"axios\";\nimport { InvalidMessengerOptionError } from \"../../exceptions\";\nimport { ChainDetailsMapWithFlags, PoolInfoMap, PoolKeyObject } from \"../../tokens-info\";\nimport { VERSION } from \"../../version\";\nimport { mapChainDetailsResponseToChainDetailsMap, mapChainDetailsResponseToPoolInfoMap } from \"./core-api-mapper\";\nimport {\n ChainDetailsResponse,\n GasBalanceResponse,\n Messenger,\n PendingInfoResponse,\n ReceiveTransactionCostRequest,\n ReceiveTransactionCostResponse,\n TransferStatusResponse,\n} from \"./core-api.model\";\nimport { AllbridgeCoreClientParams } from \"./core-client-base\";\n\nexport interface TokenInfo {\n chainDetailsMap: ChainDetailsMapWithFlags;\n /** @deprecated Do not use. */\n poolInfoMap: PoolInfoMap;\n}\n\nexport interface ApiClient {\n getTokenInfo(): Promise<TokenInfo>;\n\n /** @deprecated Do not use. */\n getPendingInfo(): Promise<PendingInfoResponse>;\n\n getGasBalance(chainSymbol: string, address: string): Promise<GasBalanceResponse>;\n\n getTransferStatus(chainSymbol: string, txId: string): Promise<TransferStatusResponse>;\n\n getReceiveTransactionCost(args: ReceiveTransactionCostRequest): Promise<ReceiveTransactionCostResponse>;\n\n /** @deprecated Do not use. */\n getPoolInfoMap(pools: PoolKeyObject[] | PoolKeyObject): Promise<PoolInfoMap>;\n}\n\nexport class ApiClientImpl implements ApiClient {\n private api: Axios;\n\n constructor(params: AllbridgeCoreClientParams) {\n this.api = create({\n baseURL: params.coreApiUrl,\n headers: {\n Accept: \"application/json\",\n ...params.coreApiHeaders,\n \"x-Sdk-Agent\": \"AllbridgeCoreSDK/\" + VERSION,\n },\n params: params.coreApiQueryParams,\n });\n\n if (params.coreApiHeadersProvider) {\n this.api.interceptors.request.use(async (config: { headers: any }) => {\n const dynamicHeaders = await params.coreApiHeadersProvider?.();\n if (!dynamicHeaders || Object.keys(dynamicHeaders).length === 0) {\n return config;\n }\n\n const headers = AxiosHeaders.from(config.headers);\n for (const [headerName, headerValue] of Object.entries(dynamicHeaders)) {\n if (!headerValue || headers.has(headerName)) {\n continue;\n }\n headers.set(headerName, headerValue);\n }\n\n config.headers = headers;\n return config;\n });\n }\n }\n\n async getTokenInfo(): Promise<TokenInfo> {\n const { data } = await this.api.get<ChainDetailsResponse>(\"/token-info\", { params: { filter: \"all\" } });\n return {\n chainDetailsMap: mapChainDetailsResponseToChainDetailsMap(data),\n poolInfoMap: mapChainDetailsResponseToPoolInfoMap(data),\n };\n }\n\n /**\n * @deprecated Do not use.\n * The `/pending-info` endpoint was removed from the Core API together with the liquidity pools;\n * always resolves to an empty object without calling the server.\n */\n getPendingInfo(): Promise<PendingInfoResponse> {\n return Promise.resolve({});\n }\n\n async getGasBalance(chainSymbol: string, address: string): Promise<GasBalanceResponse> {\n const { data } = await this.api.get<GasBalanceResponse>(`/check/${chainSymbol}/${address}`);\n return data;\n }\n\n async getTransferStatus(chainSymbol: string, txId: string): Promise<TransferStatusResponse> {\n const { data } = await this.api.get<TransferStatusResponse>(`/chain/${chainSymbol}/${txId}`);\n return data;\n }\n\n async getReceiveTransactionCost(args: ReceiveTransactionCostRequest): Promise<ReceiveTransactionCostResponse> {\n if (args.messenger === Messenger.OFT && !args.sourceToken) {\n throw new InvalidMessengerOptionError(\"For OFT sourceToken required\");\n }\n const { data } = await this.api.post<ReceiveTransactionCostResponse>(\"/receive-fee\", args, {\n headers: {\n \"Content-Type\": \"application/json\",\n },\n });\n return {\n exchangeRate: data.exchangeRate,\n fee: data.fee,\n sourceNativeTokenPrice: data.sourceNativeTokenPrice,\n abrExchangeRate: data.abrExchangeRate,\n adminFeeShareWithExtras: data.adminFeeShareWithExtras,\n };\n }\n\n /**\n * @deprecated Do not use.\n * The `/pool-info` endpoint was removed from the Core API together with the liquidity pools;\n * always resolves to an empty map without calling the server.\n */\n getPoolInfoMap(_pools: PoolKeyObject[] | PoolKeyObject): Promise<PoolInfoMap> {\n return Promise.resolve({});\n }\n}\n"]}
|
|
@@ -3,6 +3,7 @@ import { ChainDetailsResponse, PoolInfoResponse } from "./core-api.model";
|
|
|
3
3
|
export declare function mapChainDetailsResponseToChainDetailsMap(response: ChainDetailsResponse): ChainDetailsMapWithFlags;
|
|
4
4
|
/**
|
|
5
5
|
* @deprecated Do not use.
|
|
6
|
+
* The current Core API does not serve pool data, so the result is empty for it.
|
|
6
7
|
*/
|
|
7
8
|
export declare function mapChainDetailsResponseToPoolInfoMap(response: ChainDetailsResponse): PoolInfoMap;
|
|
8
9
|
/**
|
|
@@ -14,29 +14,39 @@ export function mapChainDetailsResponseToChainDetailsMap(response) {
|
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
16
|
* @deprecated Do not use.
|
|
17
|
+
* The current Core API does not serve pool data, so the result is empty for it.
|
|
17
18
|
*/
|
|
18
19
|
export function mapChainDetailsResponseToPoolInfoMap(response) {
|
|
19
20
|
const poolInfoMap = {};
|
|
20
21
|
for (const [chainSymbolValue, chainDetailsDTO] of Object.entries(response)) {
|
|
21
22
|
const chainSymbol = chainSymbolValue;
|
|
22
23
|
for (const token of chainDetailsDTO.tokens) {
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
const
|
|
28
|
-
|
|
24
|
+
const { poolAddress, poolInfo } = token;
|
|
25
|
+
if (!poolAddress || !poolInfo) {
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
const poolKey = mapPoolKeyObjectToPoolKey({ chainSymbol, poolAddress });
|
|
29
|
+
const imbalance = calculatePoolInfoImbalance(poolInfo);
|
|
30
|
+
poolInfoMap[poolKey] = { ...poolInfo, imbalance };
|
|
29
31
|
}
|
|
30
32
|
}
|
|
31
33
|
return poolInfoMap;
|
|
32
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* Flags assumed for tokens served without them: the current Core API returns every token as a token to send
|
|
37
|
+
* and has no liquidity pools.
|
|
38
|
+
*/
|
|
39
|
+
const DEFAULT_TOKEN_FLAGS = { swap: true, pool: false };
|
|
33
40
|
function mapTokenWithChainDetailsFromDto(chainDetails, dto) {
|
|
34
41
|
const { name: chainName, ...chainDetailsWithoutName } = chainDetails;
|
|
35
|
-
const { poolInfo: _poolInfo, ...dtoWithoutPoolInfo } = dto;
|
|
42
|
+
const { poolInfo: _poolInfo, flags, ...dtoWithoutPoolInfo } = dto;
|
|
43
|
+
// The deprecated pool-era token fields (poolAddress, feeShare, apr, lpRate, ...) are kept on the public type
|
|
44
|
+
// for backward compatibility but are undefined when served by the current Core API.
|
|
36
45
|
return {
|
|
37
46
|
...dtoWithoutPoolInfo,
|
|
38
47
|
...chainDetailsWithoutName,
|
|
39
48
|
chainName,
|
|
49
|
+
flags: flags ?? { ...DEFAULT_TOKEN_FLAGS },
|
|
40
50
|
};
|
|
41
51
|
}
|
|
42
52
|
function mapMessengerKeyDtoToMessenger(dto) {
|
|
@@ -75,6 +85,8 @@ function mapChainDetailsFromDto(chainSymbol, dto) {
|
|
|
75
85
|
if (!basicChainProperties) {
|
|
76
86
|
return null;
|
|
77
87
|
}
|
|
88
|
+
// bridgeAddress is deprecated and undefined when served by the current Core API; the public type keeps it
|
|
89
|
+
// for backward compatibility.
|
|
78
90
|
const chainDetails = {
|
|
79
91
|
...basicChainProperties,
|
|
80
92
|
allbridgeChainId: dto.chainId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core-api-mapper.js","sourceRoot":"","sources":["../../../../src/client/core-api/core-api-mapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AActC,OAAO,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,EAKL,SAAS,EACT,eAAe,GAKhB,MAAM,kBAAkB,CAAC;AAE1B,MAAM,UAAU,wCAAwC,CAAC,QAA8B;IACrF,OAAO,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,MAAM,CAA2B,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;QAC9E,MAAM,WAAW,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QAC7B,MAAM,eAAe,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACjC,MAAM,YAAY,GAAG,sBAAsB,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC;QAC1E,IAAI,YAAY,EAAE,CAAC;YACjB,GAAG,CAAC,WAAW,CAAC,GAAG,YAAY,CAAC;QAClC,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oCAAoC,CAAC,QAA8B;IACjF,MAAM,WAAW,GAAgB,EAAE,CAAC;IACpC,KAAK,MAAM,CAAC,gBAAgB,EAAE,eAAe,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC3E,MAAM,WAAW,GAAG,gBAAgB,CAAC;QACrC,KAAK,MAAM,KAAK,IAAI,eAAe,CAAC,MAAM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QAAQ,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,iBAAiB,CAAC,EAAE,CAAC;YACxE,QAAQ,CAAC,SAAS,GAAG,0BAA0B,CAAC,QAAQ,CAAC,CAAC;YAC1D,WAAW,CAAC,yBAAyB,CAAC,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC,CAAC,GAAG,QAAQ,CAAC;QAClF,CAAC;IACH,CAAC;IACD,OAAO,WAAW,CAAC;AACrB,CAAC","sourcesContent":["import { Chains } from \"../../chains\";\nimport { ChainSymbol } from \"../../chains/chain.enums\";\nimport {\n AbrPayerAvailability,\n ChainDetails,\n ChainDetailsMap,\n ChainDetailsMapWithFlags,\n ChainDetailsWithTokensWithFlags,\n MessengerTransferTime,\n PoolInfoMap,\n PoolKeyObject,\n TokenWithChainDetailsWithFlags,\n TransferTime,\n} from \"../../tokens-info\";\nimport { calculatePoolInfoImbalance } from \"../../utils/calculation\";\nimport {\n AbrPayerAvailabilityKeyDTO,\n AbrPayerAvailabilityTypeDTO,\n ChainDetailsDTO,\n ChainDetailsResponse,\n Messenger,\n MessengerKeyDTO,\n MessengerTransferTimeDTO,\n PoolInfoResponse,\n TokenDTO,\n TransferTimeDTO,\n} from \"./core-api.model\";\n\nexport function mapChainDetailsResponseToChainDetailsMap(response: ChainDetailsResponse): ChainDetailsMapWithFlags {\n return Object.entries(response).reduce<ChainDetailsMapWithFlags>((map, entry) => {\n const chainSymbol = entry[0];\n const chainDetailsDTO = entry[1];\n const chainDetails = mapChainDetailsFromDto(chainSymbol, chainDetailsDTO);\n if (chainDetails) {\n map[chainSymbol] = chainDetails;\n }\n return map;\n }, {});\n}\n\n/**\n * @deprecated Do not use.\n */\nexport function mapChainDetailsResponseToPoolInfoMap(response: ChainDetailsResponse): PoolInfoMap {\n const poolInfoMap: PoolInfoMap = {};\n for (const [chainSymbolValue, chainDetailsDTO] of Object.entries(response)) {\n const chainSymbol = chainSymbolValue;\n for (const token of chainDetailsDTO.tokens) {\n const poolKey = mapPoolKeyObjectToPoolKey({\n chainSymbol,\n poolAddress: token.poolAddress,\n });\n const imbalance = calculatePoolInfoImbalance(token.poolInfo);\n poolInfoMap[poolKey] = { ...token.poolInfo, imbalance };\n }\n }\n return poolInfoMap;\n}\n\nfunction mapTokenWithChainDetailsFromDto(chainDetails: ChainDetails, dto: TokenDTO): TokenWithChainDetailsWithFlags {\n const { name: chainName, ...chainDetailsWithoutName } = chainDetails;\n const { poolInfo: _poolInfo, ...dtoWithoutPoolInfo } = dto;\n return {\n ...dtoWithoutPoolInfo,\n ...chainDetailsWithoutName,\n chainName,\n };\n}\n\nfunction mapMessengerKeyDtoToMessenger(dto: MessengerKeyDTO): Messenger | null {\n switch (dto) {\n case MessengerKeyDTO.ALLBRIDGE:\n return Messenger.ALLBRIDGE;\n case MessengerKeyDTO.WORMHOLE:\n return Messenger.WORMHOLE;\n case MessengerKeyDTO.CCTP:\n return Messenger.CCTP;\n case MessengerKeyDTO.CCTP_V2:\n return Messenger.CCTP_V2;\n case MessengerKeyDTO.OFT:\n return Messenger.OFT;\n case MessengerKeyDTO.X_RESERVE:\n return Messenger.X_RESERVE;\n }\n}\n\nfunction mapTransferTimeFromDto(dto: TransferTimeDTO): TransferTime {\n return Object.entries(dto).reduce<TransferTime>((result, [key, value]) => {\n result[key as ChainSymbol] = mapMessengerTransferTimeFromDto(value);\n return result;\n }, {});\n}\n\nfunction mapMessengerTransferTimeFromDto(dto: MessengerTransferTimeDTO): MessengerTransferTime {\n return Object.entries(dto).reduce<MessengerTransferTime>((messengerTransferTime, [key, value]) => {\n const messenger = mapMessengerKeyDtoToMessenger(key as MessengerKeyDTO);\n if (messenger && value != null) {\n messengerTransferTime[messenger] = value;\n }\n return messengerTransferTime;\n }, {});\n}\n\nfunction mapChainDetailsFromDto(chainSymbol: string, dto: ChainDetailsDTO): ChainDetailsWithTokensWithFlags | null {\n const basicChainProperties = Chains.getChainsProperties()[chainSymbol];\n if (!basicChainProperties) {\n return null;\n }\n const chainDetails: ChainDetails = {\n ...basicChainProperties,\n allbridgeChainId: dto.chainId,\n bridgeId: dto.bridgeId,\n paddingUtilId: dto.paddingUtilId,\n bridgeAddress: dto.bridgeAddress,\n oftBridgeAddress: dto.oftBridgeAddress,\n yieldAddress: dto.yieldAddress,\n abrPayer: dto.abrPayer\n ? {\n payerAddress: dto.abrPayer.payerAddress,\n abrToken: {\n chainSymbol: chainSymbol as ChainSymbol,\n tokenAddress: dto.abrPayer.tokenAddress,\n decimals: dto.abrPayer.tokenDecimals,\n },\n payerAvailability: mapAbrPayerAvailabilityFromDto(dto.abrPayer.payerAvailability),\n }\n : undefined,\n transferTime: mapTransferTimeFromDto(dto.transferTime),\n txCostAmount: dto.txCostAmount,\n confirmations: dto.confirmations,\n suiAddresses: dto.suiAddresses,\n };\n return {\n ...chainDetails,\n tokens: dto.tokens.map((tokenDto) => mapTokenWithChainDetailsFromDto(chainDetails, tokenDto)),\n };\n}\n\nfunction mapAbrPayerAvailabilityFromDto(dto: AbrPayerAvailabilityTypeDTO): AbrPayerAvailability {\n if (!dto) return {};\n const out: AbrPayerAvailability = {};\n\n for (const [dtoKey, isAvailable] of Object.entries(dto) as [AbrPayerAvailabilityKeyDTO, boolean][]) {\n if (!isAvailable) continue;\n\n const messengerEnumValue = dtoKeyToMessenger[dtoKey];\n if (!messengerEnumValue) continue;\n\n out[messengerEnumValue] = true;\n }\n\n return out;\n}\n\n// Build mapping from dto key (\"allbridge\") to Messenger enum value (1..5)\nconst dtoKeyToMessenger: Record<AbrPayerAvailabilityKeyDTO, Messenger> = Object.fromEntries(\n Object.entries(MessengerKeyDTO).map(([enumKey, dtoKey]) => {\n // enumKey: \"ALLBRIDGE\"\n // dtoKey: \"allbridge\"\n return [dtoKey, Messenger[enumKey as keyof typeof Messenger]];\n })\n) as Record<AbrPayerAvailabilityKeyDTO, Messenger>;\n\n/**\n * @deprecated Do not use.\n */\nexport function mapPoolKeyToPoolKeyObject(poolKey: string): PoolKeyObject {\n const dividerPosition = poolKey.indexOf(\"_\");\n return {\n chainSymbol: poolKey.substring(0, dividerPosition),\n poolAddress: poolKey.substring(dividerPosition + 1),\n };\n}\n\n/**\n * @deprecated Do not use.\n */\nexport function mapPoolKeyObjectToPoolKey(poolKeyObject: PoolKeyObject): string {\n return poolKeyObject.chainSymbol + \"_\" + poolKeyObject.poolAddress;\n}\n\n/**\n * @deprecated Do not use.\n */\nexport function mapChainDetailsMapToPoolKeyObjects(chainDetailsMap: ChainDetailsMap): PoolKeyObject[] {\n const result = [];\n for (const [chainSymbolValue, chainDetails] of Object.entries(chainDetailsMap)) {\n const chainSymbol = chainSymbolValue;\n for (const token of chainDetails.tokens) {\n result.push({\n chainSymbol,\n poolAddress: token.poolAddress,\n });\n }\n }\n return result;\n}\n\n/**\n * @deprecated Do not use.\n */\nexport function mapPoolInfoResponseToPoolInfoMap(responseBody: PoolInfoResponse): PoolInfoMap {\n const poolInfoMap: PoolInfoMap = {};\n for (const [chainSymbolValue, poolInfoByAddress] of Object.entries(responseBody)) {\n const chainSymbol = chainSymbolValue;\n for (const [poolAddress, poolInfo] of Object.entries(poolInfoByAddress)) {\n poolInfo.imbalance = calculatePoolInfoImbalance(poolInfo);\n poolInfoMap[mapPoolKeyObjectToPoolKey({ chainSymbol, poolAddress })] = poolInfo;\n }\n }\n return poolInfoMap;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"core-api-mapper.js","sourceRoot":"","sources":["../../../../src/client/core-api/core-api-mapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AActC,OAAO,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,EAKL,SAAS,EACT,eAAe,GAKhB,MAAM,kBAAkB,CAAC;AAE1B,MAAM,UAAU,wCAAwC,CAAC,QAA8B;IACrF,OAAO,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,MAAM,CAA2B,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;QAC9E,MAAM,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../../chains\";\nimport { ChainSymbol } from \"../../chains/chain.enums\";\nimport {\n AbrPayerAvailability,\n ChainDetails,\n ChainDetailsMap,\n ChainDetailsMapWithFlags,\n ChainDetailsWithTokensWithFlags,\n MessengerTransferTime,\n PoolInfoMap,\n PoolKeyObject,\n TokenWithChainDetailsWithFlags,\n TransferTime,\n} from \"../../tokens-info\";\nimport { calculatePoolInfoImbalance } from \"../../utils/calculation\";\nimport {\n AbrPayerAvailabilityKeyDTO,\n AbrPayerAvailabilityTypeDTO,\n ChainDetailsDTO,\n ChainDetailsResponse,\n Messenger,\n MessengerKeyDTO,\n MessengerTransferTimeDTO,\n PoolInfoResponse,\n TokenDTO,\n TransferTimeDTO,\n} from \"./core-api.model\";\n\nexport function mapChainDetailsResponseToChainDetailsMap(response: ChainDetailsResponse): ChainDetailsMapWithFlags {\n return Object.entries(response).reduce<ChainDetailsMapWithFlags>((map, entry) => {\n const chainSymbol = entry[0];\n const chainDetailsDTO = entry[1];\n const chainDetails = mapChainDetailsFromDto(chainSymbol, chainDetailsDTO);\n if (chainDetails) {\n map[chainSymbol] = chainDetails;\n }\n return map;\n }, {});\n}\n\n/**\n * @deprecated Do not use.\n * The current Core API does not serve pool data, so the result is empty for it.\n */\nexport function mapChainDetailsResponseToPoolInfoMap(response: ChainDetailsResponse): PoolInfoMap {\n const poolInfoMap: PoolInfoMap = {};\n for (const [chainSymbolValue, chainDetailsDTO] of Object.entries(response)) {\n const chainSymbol = chainSymbolValue;\n for (const token of chainDetailsDTO.tokens) {\n const { poolAddress, poolInfo } = token;\n if (!poolAddress || !poolInfo) {\n continue;\n }\n const poolKey = mapPoolKeyObjectToPoolKey({ chainSymbol, poolAddress });\n const imbalance = calculatePoolInfoImbalance(poolInfo);\n poolInfoMap[poolKey] = { ...poolInfo, imbalance };\n }\n }\n return poolInfoMap;\n}\n\n/**\n * Flags assumed for tokens served without them: the current Core API returns every token as a token to send\n * and has no liquidity pools.\n */\nconst DEFAULT_TOKEN_FLAGS: TokenWithChainDetailsWithFlags[\"flags\"] = { swap: true, pool: false };\n\nfunction mapTokenWithChainDetailsFromDto(chainDetails: ChainDetails, dto: TokenDTO): TokenWithChainDetailsWithFlags {\n const { name: chainName, ...chainDetailsWithoutName } = chainDetails;\n const { poolInfo: _poolInfo, flags, ...dtoWithoutPoolInfo } = dto;\n // The deprecated pool-era token fields (poolAddress, feeShare, apr, lpRate, ...) are kept on the public type\n // for backward compatibility but are undefined when served by the current Core API.\n return {\n ...dtoWithoutPoolInfo,\n ...chainDetailsWithoutName,\n chainName,\n flags: flags ?? { ...DEFAULT_TOKEN_FLAGS },\n } as TokenWithChainDetailsWithFlags;\n}\n\nfunction mapMessengerKeyDtoToMessenger(dto: MessengerKeyDTO): Messenger | null {\n switch (dto) {\n case MessengerKeyDTO.ALLBRIDGE:\n return Messenger.ALLBRIDGE;\n case MessengerKeyDTO.WORMHOLE:\n return Messenger.WORMHOLE;\n case MessengerKeyDTO.CCTP:\n return Messenger.CCTP;\n case MessengerKeyDTO.CCTP_V2:\n return Messenger.CCTP_V2;\n case MessengerKeyDTO.OFT:\n return Messenger.OFT;\n case MessengerKeyDTO.X_RESERVE:\n return Messenger.X_RESERVE;\n }\n}\n\nfunction mapTransferTimeFromDto(dto: TransferTimeDTO): TransferTime {\n return Object.entries(dto).reduce<TransferTime>((result, [key, value]) => {\n result[key as ChainSymbol] = mapMessengerTransferTimeFromDto(value);\n return result;\n }, {});\n}\n\nfunction mapMessengerTransferTimeFromDto(dto: MessengerTransferTimeDTO): MessengerTransferTime {\n return Object.entries(dto).reduce<MessengerTransferTime>((messengerTransferTime, [key, value]) => {\n const messenger = mapMessengerKeyDtoToMessenger(key as MessengerKeyDTO);\n if (messenger && value != null) {\n messengerTransferTime[messenger] = value;\n }\n return messengerTransferTime;\n }, {});\n}\n\nfunction mapChainDetailsFromDto(chainSymbol: string, dto: ChainDetailsDTO): ChainDetailsWithTokensWithFlags | null {\n const basicChainProperties = Chains.getChainsProperties()[chainSymbol];\n if (!basicChainProperties) {\n return null;\n }\n // bridgeAddress is deprecated and undefined when served by the current Core API; the public type keeps it\n // for backward compatibility.\n const chainDetails = {\n ...basicChainProperties,\n allbridgeChainId: dto.chainId,\n bridgeId: dto.bridgeId,\n paddingUtilId: dto.paddingUtilId,\n bridgeAddress: dto.bridgeAddress,\n oftBridgeAddress: dto.oftBridgeAddress,\n yieldAddress: dto.yieldAddress,\n abrPayer: dto.abrPayer\n ? {\n payerAddress: dto.abrPayer.payerAddress,\n abrToken: {\n chainSymbol: chainSymbol as ChainSymbol,\n tokenAddress: dto.abrPayer.tokenAddress,\n decimals: dto.abrPayer.tokenDecimals,\n },\n payerAvailability: mapAbrPayerAvailabilityFromDto(dto.abrPayer.payerAvailability),\n }\n : undefined,\n transferTime: mapTransferTimeFromDto(dto.transferTime),\n txCostAmount: dto.txCostAmount,\n confirmations: dto.confirmations,\n suiAddresses: dto.suiAddresses,\n } as ChainDetails;\n return {\n ...chainDetails,\n tokens: dto.tokens.map((tokenDto) => mapTokenWithChainDetailsFromDto(chainDetails, tokenDto)),\n };\n}\n\nfunction mapAbrPayerAvailabilityFromDto(dto: AbrPayerAvailabilityTypeDTO): AbrPayerAvailability {\n if (!dto) return {};\n const out: AbrPayerAvailability = {};\n\n for (const [dtoKey, isAvailable] of Object.entries(dto) as [AbrPayerAvailabilityKeyDTO, boolean][]) {\n if (!isAvailable) continue;\n\n const messengerEnumValue = dtoKeyToMessenger[dtoKey];\n if (!messengerEnumValue) continue;\n\n out[messengerEnumValue] = true;\n }\n\n return out;\n}\n\n// Build mapping from dto key (\"allbridge\") to Messenger enum value (1..5)\nconst dtoKeyToMessenger: Record<AbrPayerAvailabilityKeyDTO, Messenger> = Object.fromEntries(\n Object.entries(MessengerKeyDTO).map(([enumKey, dtoKey]) => {\n // enumKey: \"ALLBRIDGE\"\n // dtoKey: \"allbridge\"\n return [dtoKey, Messenger[enumKey as keyof typeof Messenger]];\n })\n) as Record<AbrPayerAvailabilityKeyDTO, Messenger>;\n\n/**\n * @deprecated Do not use.\n */\nexport function mapPoolKeyToPoolKeyObject(poolKey: string): PoolKeyObject {\n const dividerPosition = poolKey.indexOf(\"_\");\n return {\n chainSymbol: poolKey.substring(0, dividerPosition),\n poolAddress: poolKey.substring(dividerPosition + 1),\n };\n}\n\n/**\n * @deprecated Do not use.\n */\nexport function mapPoolKeyObjectToPoolKey(poolKeyObject: PoolKeyObject): string {\n return poolKeyObject.chainSymbol + \"_\" + poolKeyObject.poolAddress;\n}\n\n/**\n * @deprecated Do not use.\n */\nexport function mapChainDetailsMapToPoolKeyObjects(chainDetailsMap: ChainDetailsMap): PoolKeyObject[] {\n const result = [];\n for (const [chainSymbolValue, chainDetails] of Object.entries(chainDetailsMap)) {\n const chainSymbol = chainSymbolValue;\n for (const token of chainDetails.tokens) {\n result.push({\n chainSymbol,\n poolAddress: token.poolAddress,\n });\n }\n }\n return result;\n}\n\n/**\n * @deprecated Do not use.\n */\nexport function mapPoolInfoResponseToPoolInfoMap(responseBody: PoolInfoResponse): PoolInfoMap {\n const poolInfoMap: PoolInfoMap = {};\n for (const [chainSymbolValue, poolInfoByAddress] of Object.entries(responseBody)) {\n const chainSymbol = chainSymbolValue;\n for (const [poolAddress, poolInfo] of Object.entries(poolInfoByAddress)) {\n poolInfo.imbalance = calculatePoolInfoImbalance(poolInfo);\n poolInfoMap[mapPoolKeyObjectToPoolKey({ chainSymbol, poolAddress })] = poolInfo;\n }\n }\n return poolInfoMap;\n}\n"]}
|
|
@@ -12,11 +12,15 @@ export interface ChainDetailsDTO {
|
|
|
12
12
|
chainId: number;
|
|
13
13
|
bridgeId?: string;
|
|
14
14
|
paddingUtilId?: string;
|
|
15
|
-
/** @deprecated Do not use. */
|
|
16
|
-
bridgeAddress
|
|
15
|
+
/** @deprecated Do not use. Not served by the current Core API. */
|
|
16
|
+
bridgeAddress?: string;
|
|
17
17
|
oftBridgeAddress?: string;
|
|
18
18
|
abrPayer?: AbrPayerChainInfoDTO;
|
|
19
|
-
|
|
19
|
+
/** @deprecated Do not use. Not served by the current Core API. */
|
|
20
|
+
swapAddress?: string;
|
|
21
|
+
/**
|
|
22
|
+
* @deprecated Do not use.
|
|
23
|
+
*/
|
|
20
24
|
yieldAddress?: string;
|
|
21
25
|
transferTime: TransferTimeDTO;
|
|
22
26
|
txCostAmount: TxCostAmountDTO;
|
|
@@ -35,29 +39,37 @@ export interface TokenDTO {
|
|
|
35
39
|
symbol: string;
|
|
36
40
|
name: string;
|
|
37
41
|
decimals: number;
|
|
38
|
-
/** @deprecated Do not use. */
|
|
39
|
-
poolAddress
|
|
42
|
+
/** @deprecated Do not use. Not served by the current Core API. */
|
|
43
|
+
poolAddress?: string;
|
|
40
44
|
tokenAddress: string;
|
|
41
|
-
|
|
42
|
-
|
|
45
|
+
originTokenAddress?: string;
|
|
46
|
+
/** @deprecated Do not use. Not served by the current Core API. */
|
|
47
|
+
poolInfo?: PoolInfoDTO;
|
|
43
48
|
oftId?: string;
|
|
44
|
-
/** @deprecated Do not use. */
|
|
45
|
-
feeShare
|
|
46
|
-
/** @deprecated Do not use. */
|
|
47
|
-
apr
|
|
48
|
-
/** @deprecated Do not use. */
|
|
49
|
-
apr7d
|
|
50
|
-
/** @deprecated Do not use. */
|
|
51
|
-
apr30d
|
|
52
|
-
/** @deprecated Do not use. */
|
|
53
|
-
lpRate
|
|
49
|
+
/** @deprecated Do not use. Not served by the current Core API. */
|
|
50
|
+
feeShare?: string;
|
|
51
|
+
/** @deprecated Do not use. Not served by the current Core API. */
|
|
52
|
+
apr?: string;
|
|
53
|
+
/** @deprecated Do not use. Not served by the current Core API. */
|
|
54
|
+
apr7d?: string;
|
|
55
|
+
/** @deprecated Do not use. Not served by the current Core API. */
|
|
56
|
+
apr30d?: string;
|
|
57
|
+
/** @deprecated Do not use. Not served by the current Core API. */
|
|
58
|
+
lpRate?: string;
|
|
54
59
|
cctpAddress?: string;
|
|
55
60
|
cctpV2Address?: string;
|
|
56
61
|
cctpFeeShare?: string;
|
|
57
62
|
cctpV2FeeShare?: string;
|
|
63
|
+
/**
|
|
64
|
+
* @deprecated Do not use.
|
|
65
|
+
*/
|
|
58
66
|
yieldId?: number;
|
|
59
67
|
xReserve?: XReserveDTO;
|
|
60
|
-
|
|
68
|
+
/**
|
|
69
|
+
* Optional: the current Core API always returns all tokens and omits the flags,
|
|
70
|
+
* in which case every token is treated as `swap: true, pool: false`.
|
|
71
|
+
*/
|
|
72
|
+
flags?: {
|
|
61
73
|
swap: boolean;
|
|
62
74
|
/** @deprecated Do not use. */
|
|
63
75
|
pool: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core-api.model.js","sourceRoot":"","sources":["../../../../src/client/core-api/core-api.model.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"core-api.model.js","sourceRoot":"","sources":["../../../../src/client/core-api/core-api.model.ts"],"names":[],"mappings":"AAiCA,MAAM,CAAN,IAAY,aAOX;AAPD,WAAY,aAAa;IACvB,0BAAS,CAAA;IACT,oCAAmB,CAAA;IACnB,wCAAuB,CAAA;IACvB,gDAA+B,CAAA;IAC/B,sDAAqC,CAAA;IACrC,kFAAiE,CAAA;AACnE,CAAC,EAPW,aAAa,KAAb,aAAa,QAOxB;AA+DD,MAAM,CAAN,IAAY,eASX;AATD,WAAY,eAAe;IACzB,8BAA8B;IAC9B,0CAAuB,CAAA;IACvB,8BAA8B;IAC9B,wCAAqB,CAAA;IACrB,gCAAa,CAAA;IACb,qCAAkB,CAAA;IAClB,8BAAW,CAAA;IACX,yCAAsB,CAAA;AACxB,CAAC,EATW,eAAe,KAAf,eAAe,QAS1B;AAkBD;;;GAGG;AACH,MAAM,CAAN,IAAY,SA0BX;AA1BD,WAAY,SAAS;IACnB,8BAA8B;IAC9B,mDAAa,CAAA;IACb,8BAA8B;IAC9B,iDAAY,CAAA;IACZ;;;OAGG;IACH,yCAAQ,CAAA;IACR;;;OAGG;IACH,+CAAW,CAAA;IACX;;;;OAIG;IACH,uCAAO,CAAA;IACP;;;OAGG;IACH,mDAAa,CAAA;AACf,CAAC,EA1BW,SAAS,KAAT,SAAS,QA0BpB","sourcesContent":["import { ChainSymbol } from \"../../chains/chain.enums\";\nimport { PoolInfo, SuiAddresses } from \"../../tokens-info\";\n\nexport type ChainDetailsResponse = Record<string, ChainDetailsDTO>;\n\nexport interface AbrPayerChainInfoDTO {\n payerAddress: string;\n tokenAddress: string;\n tokenDecimals: number;\n payerAvailability: AbrPayerAvailabilityTypeDTO;\n}\n\nexport interface ChainDetailsDTO {\n tokens: TokenDTO[];\n chainId: number;\n bridgeId?: string;\n paddingUtilId?: string;\n /** @deprecated Do not use. Not served by the current Core API. */\n bridgeAddress?: string;\n oftBridgeAddress?: string;\n abrPayer?: AbrPayerChainInfoDTO;\n /** @deprecated Do not use. Not served by the current Core API. */\n swapAddress?: string;\n /**\n * @deprecated Do not use.\n */\n yieldAddress?: string;\n transferTime: TransferTimeDTO;\n txCostAmount: TxCostAmountDTO;\n confirmations: number;\n suiAddresses?: SuiAddresses;\n}\n\nexport enum AddressStatus {\n OK = \"OK\",\n INVALID = \"INVALID\",\n FORBIDDEN = \"FORBIDDEN\",\n UNINITIALIZED = \"UNINITIALIZED\",\n CONTRACT_ADDRESS = \"CONTRACT_ADDRESS\",\n WRONG_ASSOCIATED_ACCOUNT_OWNER = \"WRONG_ASSOCIATED_ACCOUNT_OWNER\",\n}\n\nexport interface TokenDTO {\n symbol: string;\n name: string;\n decimals: number;\n /** @deprecated Do not use. Not served by the current Core API. */\n poolAddress?: string;\n tokenAddress: string;\n originTokenAddress?: string;\n /** @deprecated Do not use. Not served by the current Core API. */\n poolInfo?: PoolInfoDTO;\n oftId?: string;\n /** @deprecated Do not use. Not served by the current Core API. */\n feeShare?: string;\n /** @deprecated Do not use. Not served by the current Core API. */\n apr?: string;\n /** @deprecated Do not use. Not served by the current Core API. */\n apr7d?: string;\n /** @deprecated Do not use. Not served by the current Core API. */\n apr30d?: string;\n /** @deprecated Do not use. Not served by the current Core API. */\n lpRate?: string;\n cctpAddress?: string;\n cctpV2Address?: string;\n cctpFeeShare?: string;\n cctpV2FeeShare?: string;\n /**\n * @deprecated Do not use.\n */\n yieldId?: number;\n xReserve?: XReserveDTO;\n /**\n * Optional: the current Core API always returns all tokens and omits the flags,\n * in which case every token is treated as `swap: true, pool: false`.\n */\n flags?: {\n swap: boolean;\n /** @deprecated Do not use. */\n pool: boolean;\n };\n}\n\nexport interface XReserveDTO {\n bridgeAddress: string;\n feeConst: string;\n feeShare: string;\n protocolAddress?: string;\n}\n\n/**\n * @deprecated Do not use.\n */\nexport interface PoolInfoDTO {\n aValue: string;\n dValue: string;\n tokenBalance: string;\n vUsdBalance: string;\n totalLpAmount: string;\n accRewardPerShareP: string;\n p: number;\n}\n\nexport enum MessengerKeyDTO {\n /** @deprecated Do not use. */\n ALLBRIDGE = \"allbridge\",\n /** @deprecated Do not use. */\n WORMHOLE = \"wormhole\",\n CCTP = \"cctp\",\n CCTP_V2 = \"cctpV2\",\n OFT = \"oft\",\n X_RESERVE = \"xReserve\",\n}\n\nexport type AbrPayerAvailabilityKeyDTO = (typeof MessengerKeyDTO)[keyof typeof MessengerKeyDTO];\n\nexport type AbrPayerAvailabilityTypeDTO = Partial<Record<AbrPayerAvailabilityKeyDTO, boolean>>;\n\nexport type TransferTimeDTO = Record<string, MessengerTransferTimeDTO>;\n\nexport interface TxCostAmountDTO {\n maxAmount: string;\n swap: string;\n transfer: string;\n}\n\nexport type MessengerTransferTimeDTO = {\n [messenger in MessengerKeyDTO]: number | null;\n};\n\n/**\n * Bridging protocol used for a transfer.\n * Only {@link ActiveMessenger} values are supported.\n */\nexport enum Messenger {\n /** @deprecated Do not use. */\n ALLBRIDGE = 1,\n /** @deprecated Do not use. */\n WORMHOLE = 2,\n /**\n * Circle CCTP.\n * Route is supported when `cctpAddress` is defined on both source and destination tokens.\n */\n CCTP = 3,\n /**\n * Circle CCTP V2.\n * Route is supported when `cctpV2Address` is defined on both source and destination tokens.\n */\n CCTP_V2 = 4,\n /**\n * LayerZero OFT.\n * Route is supported when source and destination tokens have the same `oftId`\n * and `oftBridgeAddress` is defined on both chains.\n */\n OFT = 5,\n /**\n * xReserve.\n * Route is supported when `xReserve` is defined on both source and destination tokens.\n */\n X_RESERVE = 6,\n}\n\n/**\n * @deprecated Do not use.\n */\nexport type LegacyMessenger = Messenger.ALLBRIDGE | Messenger.WORMHOLE;\n/**\n * Messengers supported for transfers: {@link Messenger.CCTP}, {@link Messenger.CCTP_V2}, {@link Messenger.OFT}, {@link Messenger.X_RESERVE}\n */\nexport type ActiveMessenger = Exclude<Messenger, LegacyMessenger>;\n\nexport interface ReceiveTransactionCostRequest {\n sourceChainId: number;\n destinationChainId: number;\n messenger: Messenger;\n sourceToken?: string;\n}\n\nexport interface ReceiveTransactionCostResponse {\n exchangeRate: string;\n fee: string;\n sourceNativeTokenPrice: string;\n abrExchangeRate?: string;\n adminFeeShareWithExtras?: string;\n}\n\nexport interface GasBalanceResponse {\n gasBalance: string | null;\n status: AddressStatus;\n}\n\nexport interface CheckAddressResponse {\n gasBalance: string | null;\n status: AddressStatus;\n}\n\nexport interface TransferStatusResponse {\n txId: string;\n\n sourceChainSymbol: ChainSymbol;\n destinationChainSymbol: ChainSymbol;\n\n sendAmount: string;\n sendAmountFormatted: number;\n\n stableFee: string;\n stableFeeFormatted: number;\n\n sourceTokenAddress: string;\n destinationTokenAddress: string;\n\n originSourceTokenAddress?: string;\n originDestinationTokenAddress?: string;\n\n senderAddress: string;\n recipientAddress: string;\n\n signaturesCount: number;\n signaturesNeeded: number;\n\n send: BridgeTransaction;\n receive?: BridgeTransaction;\n\n responseTime?: number;\n}\n\nexport interface BridgeTransaction {\n txId: string;\n\n sourceChainId: number;\n destinationChainId: number;\n\n fee: string;\n feeFormatted: number;\n\n stableFee: string;\n stableFeeFormatted: number;\n\n amount: string;\n amountFormatted: number;\n virtualAmount: string;\n\n bridgeContract: string;\n sender: string;\n recipient: string;\n\n sourceTokenAddress: string;\n destinationTokenAddress: string;\n\n originSourceTokenAddress?: string;\n originDestinationTokenAddress?: string;\n\n hash: string;\n\n messenger: Messenger;\n\n blockTime: number;\n blockId: string;\n\n confirmations: number;\n confirmationsNeeded: number;\n\n isClaimable?: boolean;\n}\n\n/**\n * @deprecated Do not use.\n */\nexport type PoolInfoResponse = Record<string, PoolInfo>;\n/**\n * @deprecated Do not use.\n */\nexport type PendingInfoResponse = Partial<Record<string, TokenPendingInfoDTO>>;\n/**\n * @deprecated Do not use.\n */\nexport type TokenPendingInfoDTO = Record<string, PendingInfoDTO>;\n\n/**\n * @deprecated Do not use.\n */\nexport interface PendingInfoDTO {\n pendingTxs: number;\n totalSentAmount: string;\n}\n"]}
|
|
@@ -53,6 +53,9 @@ export declare class CCTPDoesNotSupportedError extends SdkRootError {
|
|
|
53
53
|
export declare class OFTDoesNotSupportedError extends SdkRootError {
|
|
54
54
|
constructor(message?: string);
|
|
55
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* @deprecated Do not use.
|
|
58
|
+
*/
|
|
56
59
|
export declare class YieldDoesNotSupportedError extends SdkRootError {
|
|
57
60
|
constructor(message?: string);
|
|
58
61
|
}
|
|
@@ -77,6 +80,9 @@ export declare enum ErrorCode {
|
|
|
77
80
|
NODE_RPC_URL_NOT_INITIALIZED_ERROR = "NodeRpcUrlNotInitializedError",
|
|
78
81
|
CCTP_DOES_NOT_SUPPORTED_ERROR = "CCTPDoesNotSupportedError",
|
|
79
82
|
OFT_DOES_NOT_SUPPORTED_ERROR = "OFTDoesNotSupportedError",
|
|
83
|
+
/**
|
|
84
|
+
* @deprecated Do not use.
|
|
85
|
+
*/
|
|
80
86
|
YIELD_DOES_NOT_SUPPORTED_ERROR = "YieldDoesNotSupportedError",
|
|
81
87
|
TX_TOO_LARGE = "TxTooLargeError"
|
|
82
88
|
}
|
|
@@ -88,6 +88,9 @@ export class OFTDoesNotSupportedError extends SdkRootError {
|
|
|
88
88
|
super(ErrorCode.OFT_DOES_NOT_SUPPORTED_ERROR, message);
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
|
+
/**
|
|
92
|
+
* @deprecated Do not use.
|
|
93
|
+
*/
|
|
91
94
|
export class YieldDoesNotSupportedError extends SdkRootError {
|
|
92
95
|
constructor(message) {
|
|
93
96
|
super(ErrorCode.YIELD_DOES_NOT_SUPPORTED_ERROR, message);
|
|
@@ -117,6 +120,9 @@ export var ErrorCode;
|
|
|
117
120
|
ErrorCode["NODE_RPC_URL_NOT_INITIALIZED_ERROR"] = "NodeRpcUrlNotInitializedError";
|
|
118
121
|
ErrorCode["CCTP_DOES_NOT_SUPPORTED_ERROR"] = "CCTPDoesNotSupportedError";
|
|
119
122
|
ErrorCode["OFT_DOES_NOT_SUPPORTED_ERROR"] = "OFTDoesNotSupportedError";
|
|
123
|
+
/**
|
|
124
|
+
* @deprecated Do not use.
|
|
125
|
+
*/
|
|
120
126
|
ErrorCode["YIELD_DOES_NOT_SUPPORTED_ERROR"] = "YieldDoesNotSupportedError";
|
|
121
127
|
ErrorCode["TX_TOO_LARGE"] = "TxTooLargeError";
|
|
122
128
|
})(ErrorCode || (ErrorCode = {}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exceptions.js","sourceRoot":"","sources":["../../../src/exceptions/exceptions.ts"],"names":[],"mappings":"AAAA,MAAM,OAAgB,YAAa,SAAQ,KAAK;IACvC,SAAS,CAAY;IAE5B,YAAsB,IAAe,EAAE,OAAgB;QACrD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;IACxB,CAAC;CACF;AAED,MAAM,OAAO,QAAS,SAAQ,YAAY;IACxC,YAAY,OAAgB;QAC1B,KAAK,CAAC,SAAS,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IACtC,CAAC;CACF;AAED,MAAM,OAAO,kBAAmB,SAAQ,YAAY;IAClD,YAAY,OAAgB;QAC1B,KAAK,CAAC,SAAS,CAAC,oBAAoB,EAAE,OAAO,CAAC,C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;AACH,MAAM,OAAO,0BAA2B,SAAQ,YAAY;IAC1D,YAAY,OAAgB;QAC1B,KAAK,CAAC,SAAS,CAAC,8BAA8B,EAAE,OAAO,CAAC,CAAC;IAC3D,CAAC;CACF;AAED,MAAM,OAAO,eAAgB,SAAQ,YAAY;IAC/C;QACE,KAAK,CACH,SAAS,CAAC,YAAY,EACtB,iHAAiH,CAClH,CAAC;IACJ,CAAC;CACF;AAED,MAAM,CAAN,IAAY,SAuBX;AAvBD,WAAY,SAAS;IACnB,mCAAsB,CAAA;IACtB,wDAA2C,CAAA;IAC3C,6DAAgD,CAAA;IAChD,8BAA8B;IAC9B,iFAAoE,CAAA;IACpE,2CAA8B,CAAA;IAC9B,qFAAwE,CAAA;IACxE,2EAA8D,CAAA;IAC9D,mEAAsD,CAAA;IACtD,8CAAiC,CAAA;IACjC,gDAAmC,CAAA;IACnC,iFAAoE,CAAA;IACpE,6EAAgE,CAAA;IAChE,2CAA8B,CAAA;IAC9B,iFAAoE,CAAA;IACpE,wEAA2D,CAAA;IAC3D,sEAAyD,CAAA;IACzD;;OAEG;IACH,0EAA6D,CAAA;IAC7D,6CAAgC,CAAA;AAClC,CAAC,EAvBW,SAAS,KAAT,SAAS,QAuBpB","sourcesContent":["export abstract class SdkRootError extends Error {\n public errorCode: ErrorCode;\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\n/**\n * @deprecated Do not use.\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 /**\n * @deprecated Do not use.\n */\n YIELD_DOES_NOT_SUPPORTED_ERROR = \"YieldDoesNotSupportedError\",\n TX_TOO_LARGE = \"TxTooLargeError\",\n}\n"]}
|