@allbridge/bridge-core-sdk 3.35.1 → 3.36.0-beta.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 +6 -1
- package/dist/src/client/core-api/api-client-caching.js +11 -0
- package/dist/src/client/core-api/api-client-caching.js.map +1 -1
- package/dist/src/client/core-api/api-client.d.ts +38 -4
- package/dist/src/client/core-api/api-client.js +83 -16
- package/dist/src/client/core-api/api-client.js.map +1 -1
- package/dist/src/client/core-api/core-api-mapper.d.ts +4 -1
- package/dist/src/client/core-api/core-api-mapper.js +25 -10
- package/dist/src/client/core-api/core-api-mapper.js.map +1 -1
- package/dist/src/client/core-api/core-api.model.d.ts +124 -21
- package/dist/src/client/core-api/core-api.model.js +9 -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 +7 -1
- package/dist/src/client/core-api/core-client-base.js +9 -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 +4 -1
- package/dist/src/client/core-api/core-client-filtered.js +9 -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 +4 -1
- package/dist/src/client/core-api/core-client-pool-info-caching.js +9 -0
- package/dist/src/client/core-api/core-client-pool-info-caching.js.map +1 -1
- package/dist/src/exceptions/exceptions.d.ts +41 -0
- package/dist/src/exceptions/exceptions.js +52 -0
- package/dist/src/exceptions/exceptions.js.map +1 -1
- package/dist/src/index.d.ts +19 -6
- package/dist/src/index.js +6 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/models/index.d.ts +4 -2
- package/dist/src/models/index.js.map +1 -1
- package/dist/src/services/bridge/alg/index.d.ts +5 -1
- package/dist/src/services/bridge/alg/index.js +7 -0
- package/dist/src/services/bridge/alg/index.js.map +1 -1
- package/dist/src/services/bridge/evm/index.d.ts +12 -2
- package/dist/src/services/bridge/evm/index.js +32 -0
- package/dist/src/services/bridge/evm/index.js.map +1 -1
- package/dist/src/services/bridge/index.d.ts +10 -3
- package/dist/src/services/bridge/index.js +27 -3
- package/dist/src/services/bridge/index.js.map +1 -1
- package/dist/src/services/bridge/models/bridge.d.ts +17 -1
- package/dist/src/services/bridge/models/bridge.js +6 -0
- package/dist/src/services/bridge/models/bridge.js.map +1 -1
- package/dist/src/services/bridge/models/bridge.model.d.ts +25 -0
- package/dist/src/services/bridge/models/bridge.model.js.map +1 -1
- package/dist/src/services/bridge/raw-bridge-transaction-builder.d.ts +8 -1
- package/dist/src/services/bridge/raw-bridge-transaction-builder.js +11 -1
- package/dist/src/services/bridge/raw-bridge-transaction-builder.js.map +1 -1
- package/dist/src/services/bridge/sol/bridge-tx-service.js +3 -0
- package/dist/src/services/bridge/sol/bridge-tx-service.js.map +1 -1
- package/dist/src/services/bridge/sol/index.d.ts +14 -1
- package/dist/src/services/bridge/sol/index.js +47 -2
- 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.js +4 -0
- package/dist/src/services/bridge/spender.js.map +1 -1
- package/dist/src/services/bridge/srb/index.d.ts +9 -1
- package/dist/src/services/bridge/srb/index.js +45 -3
- package/dist/src/services/bridge/srb/index.js.map +1 -1
- package/dist/src/services/bridge/stx/index.d.ts +6 -2
- package/dist/src/services/bridge/stx/index.js +7 -0
- package/dist/src/services/bridge/stx/index.js.map +1 -1
- package/dist/src/services/bridge/sui/index.d.ts +8 -1
- package/dist/src/services/bridge/sui/index.js +24 -0
- package/dist/src/services/bridge/sui/index.js.map +1 -1
- package/dist/src/services/bridge/trx/index.d.ts +11 -1
- package/dist/src/services/bridge/trx/index.js +25 -0
- package/dist/src/services/bridge/trx/index.js.map +1 -1
- package/dist/src/services/bridge/utils.js +4 -1
- package/dist/src/services/bridge/utils.js.map +1 -1
- package/dist/src/services/index.d.ts +10 -0
- package/dist/src/services/index.js +36 -1
- package/dist/src/services/index.js.map +1 -1
- package/dist/src/services/near-intents/index.d.ts +62 -0
- package/dist/src/services/near-intents/index.js +115 -0
- package/dist/src/services/near-intents/index.js.map +1 -0
- package/dist/src/services/near-intents/models.d.ts +169 -0
- package/dist/src/services/near-intents/models.js +2 -0
- package/dist/src/services/near-intents/models.js.map +1 -0
- package/dist/src/services/near-intents/utils.d.ts +34 -0
- package/dist/src/services/near-intents/utils.js +53 -0
- package/dist/src/services/near-intents/utils.js.map +1 -0
- package/dist/src/services/token/evm/index.js +3 -0
- package/dist/src/services/token/evm/index.js.map +1 -1
- package/dist/src/services/token/sol/index.js +3 -0
- package/dist/src/services/token/sol/index.js.map +1 -1
- package/dist/src/services/token/srb/index.js +11 -0
- package/dist/src/services/token/srb/index.js.map +1 -1
- package/dist/src/services/token/sui/index.js +5 -0
- package/dist/src/services/token/sui/index.js.map +1 -1
- package/dist/src/services/token/trx/index.js +3 -0
- package/dist/src/services/token/trx/index.js.map +1 -1
- package/dist/src/tokens-info/tokens-info.model.d.ts +23 -1
- 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
|
@@ -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,IA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AC;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"]}
|
|
1
|
+
{"version":3,"file":"exceptions.js","sourceRoot":"","sources":["../../../src/exceptions/exceptions.ts"],"names":[],"mappings":"AAAA,MAAM,OAAgB,YAAa,SAAQ,KAAK;IACvC,SAAS,CAAY;IAE5B,YAA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FAAoE,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,uFAA0E,CAAA;IAC1E,+EAAkE,CAAA;IAClE,4EAA+D,CAAA;IAC/D,+DAAkD,CAAA;IAClD;;OAEG;IACH,0EAA6D,CAAA;IAC7D,6CAAgC,CAAA;AAClC,CAAC,EA3BW,SAAS,KAAT,SAAS,QA2BpB","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 * The route is not supported by `Messenger.NEAR_INTENTS`: `nearIntents` is missing on the source or destination token,\n * or the Core API does not know the route.\n */\nexport class NearIntentsDoesNotSupportedError extends SdkRootError {\n constructor(message?: string) {\n super(ErrorCode.NEAR_INTENTS_DOES_NOT_SUPPORTED_ERROR, message);\n }\n}\n\n/**\n * The NEAR Intents amount is below the route minimum.\n */\nexport class NearIntentsAmountTooLowError extends SdkRootError {\n /**\n * Minimum amount, integer in the source token units. Optional.\n */\n public minAmount?: string;\n /**\n * Minimum amount in USD. Optional.\n */\n public minAmountUsd?: string;\n\n constructor(message?: string, minAmount?: string, minAmountUsd?: string) {\n super(ErrorCode.NEAR_INTENTS_AMOUNT_TOO_LOW_ERROR, message);\n this.minAmount = minAmount;\n this.minAmountUsd = minAmountUsd;\n }\n}\n\n/**\n * NEAR Intents has no liquidity for the route right now.\n */\nexport class NearIntentsNoLiquidityError extends SdkRootError {\n constructor(message?: string) {\n super(ErrorCode.NEAR_INTENTS_NO_LIQUIDITY_ERROR, message);\n }\n}\n\n/**\n * NEAR Intents failed to produce a quote or deposit (`FAILED_TO_GET_QUOTE`, or an upstream error).\n */\nexport class NearIntentsQuoteError extends SdkRootError {\n /**\n * Core API error code, e.g. `FAILED_TO_GET_QUOTE` or `UPSTREAM_ERROR`. Optional.\n */\n public code?: string;\n\n constructor(message?: string, code?: string) {\n super(ErrorCode.NEAR_INTENTS_QUOTE_ERROR, message);\n this.code = code;\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 NEAR_INTENTS_DOES_NOT_SUPPORTED_ERROR = \"NearIntentsDoesNotSupportedError\",\n NEAR_INTENTS_AMOUNT_TOO_LOW_ERROR = \"NearIntentsAmountTooLowError\",\n NEAR_INTENTS_NO_LIQUIDITY_ERROR = \"NearIntentsNoLiquidityError\",\n NEAR_INTENTS_QUOTE_ERROR = \"NearIntentsQuoteError\",\n /**\n * @deprecated Do not use.\n */\n YIELD_DOES_NOT_SUPPORTED_ERROR = \"YieldDoesNotSupportedError\",\n TX_TOO_LARGE = \"TxTooLargeError\",\n}\n"]}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { BigSource } from "big.js";
|
|
|
2
2
|
import { AdditionalBasicChainProperties } from "./chains/models";
|
|
3
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
|
+
import { NearIntentsService } from "./services/near-intents";
|
|
5
6
|
import { YieldService } from "./services/yield";
|
|
6
7
|
import { Utils } from "./utils";
|
|
7
8
|
export * from "./configs";
|
|
@@ -100,6 +101,10 @@ export declare class AllbridgeCoreSdk {
|
|
|
100
101
|
* @deprecated Do not use.
|
|
101
102
|
*/
|
|
102
103
|
yield: YieldService;
|
|
104
|
+
/**
|
|
105
|
+
* NEAR Intents ({@link Messenger.NEAR_INTENTS}) quotes and deposits, see {@link NearIntentsService}.
|
|
106
|
+
*/
|
|
107
|
+
nearIntents: NearIntentsService;
|
|
103
108
|
utils: Utils;
|
|
104
109
|
private service;
|
|
105
110
|
/**
|
|
@@ -261,11 +266,15 @@ export declare class AllbridgeCoreSdk {
|
|
|
261
266
|
/**
|
|
262
267
|
* Calculates the amount of tokens to be received as a result of transfer
|
|
263
268
|
* after applying the fee of the selected messenger.
|
|
269
|
+
* For {@link Messenger.NEAR_INTENTS} the amount is the `amountOut` of an `EXACT_INPUT` quote: live (the Core API
|
|
270
|
+
* waits for NEAR Intents solvers, about 3 s) or estimated from recent quotes on the route;
|
|
271
|
+
* see {@link NearIntentsService.getQuote} for `minAmountOut` and `estimated`.
|
|
264
272
|
* @param amountToSendFloat the amount of tokens that will be sent
|
|
265
273
|
* @param sourceChainToken selected token on the source chain
|
|
266
274
|
* @param destinationChainToken selected token on the destination chain
|
|
267
275
|
* @param messenger selected messenger, see {@link ActiveMessenger}
|
|
268
|
-
* @throws CCTPDoesNotSupportedError, OFTDoesNotSupportedError or SdkError if the route is not supported by the messenger
|
|
276
|
+
* @throws CCTPDoesNotSupportedError, OFTDoesNotSupportedError, NearIntentsDoesNotSupportedError or SdkError if the route is not supported by the messenger;
|
|
277
|
+
* NearIntentsAmountTooLowError, NearIntentsNoLiquidityError or NearIntentsQuoteError if NEAR Intents has no quote
|
|
269
278
|
*/
|
|
270
279
|
getAmountToBeReceived(amountToSendFloat: BigSource, sourceChainToken: TokenWithChainDetails, destinationChainToken: TokenWithChainDetails, messenger: ActiveMessenger): Promise<string>;
|
|
271
280
|
/**
|
|
@@ -289,7 +298,7 @@ export declare class AllbridgeCoreSdk {
|
|
|
289
298
|
* @param messenger selected messenger
|
|
290
299
|
* @deprecated Do not use.
|
|
291
300
|
*/
|
|
292
|
-
getAmountToBeReceivedFromPools(amountToSendFloat: BigSource, sourceChainToken: TokenWithChainDetails, destinationChainToken: TokenWithChainDetails, sourcePool: PoolInfo, destinationPool: PoolInfo, messenger: Exclude<Messenger, Messenger.OFT>): string;
|
|
301
|
+
getAmountToBeReceivedFromPools(amountToSendFloat: BigSource, sourceChainToken: TokenWithChainDetails, destinationChainToken: TokenWithChainDetails, sourcePool: PoolInfo, destinationPool: PoolInfo, messenger: Exclude<Messenger, Messenger.OFT | Messenger.NEAR_INTENTS>): string;
|
|
293
302
|
/**
|
|
294
303
|
* Calculates the amount of tokens to send based on requested tokens amount be received as a result of transfer through a legacy messenger.
|
|
295
304
|
* @param amountToBeReceivedFloat the amount of tokens that should be received
|
|
@@ -302,11 +311,15 @@ export declare class AllbridgeCoreSdk {
|
|
|
302
311
|
/**
|
|
303
312
|
* Calculates the amount of tokens to send based on requested tokens amount be received as a result of transfer
|
|
304
313
|
* after applying the fee of the selected messenger.
|
|
314
|
+
* For {@link Messenger.NEAR_INTENTS} the amount is the `amountIn` of an `EXACT_OUTPUT` quote: live (the Core API
|
|
315
|
+
* waits for NEAR Intents solvers, about 3 s) or estimated from recent quotes on the route;
|
|
316
|
+
* see {@link NearIntentsService.getQuote} for `estimated`.
|
|
305
317
|
* @param amountToBeReceivedFloat the amount of tokens that should be received
|
|
306
318
|
* @param sourceChainToken selected token on the source chain
|
|
307
319
|
* @param destinationChainToken selected token on the destination chain
|
|
308
320
|
* @param messenger selected messenger, see {@link ActiveMessenger}
|
|
309
|
-
* @throws CCTPDoesNotSupportedError, OFTDoesNotSupportedError or SdkError if the route is not supported by the messenger
|
|
321
|
+
* @throws CCTPDoesNotSupportedError, OFTDoesNotSupportedError, NearIntentsDoesNotSupportedError or SdkError if the route is not supported by the messenger;
|
|
322
|
+
* NearIntentsAmountTooLowError, NearIntentsNoLiquidityError or NearIntentsQuoteError if NEAR Intents has no quote
|
|
310
323
|
*/
|
|
311
324
|
getAmountToSend(amountToBeReceivedFloat: BigSource, sourceChainToken: TokenWithChainDetails, destinationChainToken: TokenWithChainDetails, messenger: ActiveMessenger): Promise<string>;
|
|
312
325
|
/**
|
|
@@ -330,13 +343,13 @@ export declare class AllbridgeCoreSdk {
|
|
|
330
343
|
* @param messenger selected messenger
|
|
331
344
|
* @deprecated Do not use.
|
|
332
345
|
*/
|
|
333
|
-
getAmountToSendFromPools(amountToBeReceivedFloat: BigSource, sourceChainToken: TokenWithChainDetails, destinationChainToken: TokenWithChainDetails, sourcePool: PoolInfo, destinationPool: PoolInfo, messenger: Exclude<Messenger, Messenger.OFT>): string;
|
|
346
|
+
getAmountToSendFromPools(amountToBeReceivedFloat: BigSource, sourceChainToken: TokenWithChainDetails, destinationChainToken: TokenWithChainDetails, sourcePool: PoolInfo, destinationPool: PoolInfo, messenger: Exclude<Messenger, Messenger.OFT | Messenger.NEAR_INTENTS>): string;
|
|
334
347
|
/**
|
|
335
348
|
* Fetches possible ways to pay the transfer gas fee.
|
|
336
349
|
* @param sourceChainToken selected token on the source chain
|
|
337
350
|
* @param destinationChainToken selected token on the destination chain
|
|
338
351
|
* @param messenger selected messenger, see {@link ActiveMessenger}
|
|
339
|
-
* @returns {@link GasFeeOptions}
|
|
352
|
+
* @returns {@link GasFeeOptions}; for {@link Messenger.NEAR_INTENTS} only a zero native fee (the protocol fee is inside the quote)
|
|
340
353
|
*/
|
|
341
354
|
getGasFeeOptions(sourceChainToken: TokenWithChainDetails, destinationChainToken: TokenWithChainDetails, messenger: Messenger): Promise<GasFeeOptions>;
|
|
342
355
|
/**
|
|
@@ -380,7 +393,7 @@ export declare class AllbridgeCoreSdk {
|
|
|
380
393
|
getExtraGasMaxLimits(sourceChainToken: TokenWithChainDetails, destinationChainToken: TokenWithChainDetails, messenger: LegacyMessenger): Promise<ExtraGasMaxLimitResponse>;
|
|
381
394
|
/**
|
|
382
395
|
* Get possible limit of extra gas amount.
|
|
383
|
-
* For {@link Messenger.X_RESERVE} extra gas is not supported and zero limits are returned.
|
|
396
|
+
* For {@link Messenger.X_RESERVE} and {@link Messenger.NEAR_INTENTS} extra gas is not supported and zero limits are returned.
|
|
384
397
|
* @param sourceChainToken selected token on the source chain
|
|
385
398
|
* @param destinationChainToken selected token on the destination chain
|
|
386
399
|
* @param messenger selected messenger, see {@link ActiveMessenger}
|
package/dist/src/index.js
CHANGED
|
@@ -21,6 +21,10 @@ export class AllbridgeCoreSdk {
|
|
|
21
21
|
* @deprecated Do not use.
|
|
22
22
|
*/
|
|
23
23
|
yield;
|
|
24
|
+
/**
|
|
25
|
+
* NEAR Intents ({@link Messenger.NEAR_INTENTS}) quotes and deposits, see {@link NearIntentsService}.
|
|
26
|
+
*/
|
|
27
|
+
nearIntents;
|
|
24
28
|
utils;
|
|
25
29
|
service;
|
|
26
30
|
/**
|
|
@@ -42,6 +46,7 @@ export class AllbridgeCoreSdk {
|
|
|
42
46
|
this.bridge = this.service.bridge;
|
|
43
47
|
this.pool = this.service.pool;
|
|
44
48
|
this.yield = this.service.yield;
|
|
49
|
+
this.nearIntents = this.service.nearIntents;
|
|
45
50
|
this.utils = new DefaultUtils(this.service);
|
|
46
51
|
this.params = params;
|
|
47
52
|
}
|
|
@@ -217,7 +222,7 @@ export class AllbridgeCoreSdk {
|
|
|
217
222
|
* @param sourceChainToken selected token on the source chain
|
|
218
223
|
* @param destinationChainToken selected token on the destination chain
|
|
219
224
|
* @param messenger selected messenger, see {@link ActiveMessenger}
|
|
220
|
-
* @returns {@link GasFeeOptions}
|
|
225
|
+
* @returns {@link GasFeeOptions}; for {@link Messenger.NEAR_INTENTS} only a zero native fee (the protocol fee is inside the quote)
|
|
221
226
|
*/
|
|
222
227
|
async getGasFeeOptions(sourceChainToken, destinationChainToken, messenger) {
|
|
223
228
|
return this.service.getGasFeeOptions(sourceChainToken, destinationChainToken, messenger);
|
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAeL,SAAS,GAQV,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAGxE,OAAO,EAAE,YAAY,EAAS,MAAM,SAAS,CAAC;AAE9C,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AA2FzB;;GAEG;AACH,SAAS,gBAAgB,CAAC,QAAsC;IAC9D,OAAO,cAAc,IAAI,QAAQ,CAAC;AACpC,CAAC;AAED,MAAM,OAAO,gBAAgB;IAClB,MAAM,CAA0B;IAEzC,MAAM,CAAgB;IACtB;;OAEG;IACH,IAAI,CAAuB;IAC3B;;OAEG;IACH,KAAK,CAAe;IACpB,KAAK,CAAQ;IAEL,OAAO,CAA0B;IAEzC;;;;;;OAMG;IACH,YAAY,QAAsC,EAAE,SAAkC,OAAO;QAC3F,IAAI,iBAAoC,CAAC;QACzC,IAAI,gBAAgB,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC/B,iBAAiB,GAAG,IAAI,iBAAiB,CAAC,EAAE,GAAG,EAAE,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC;QACtG,CAAC;aAAM,CAAC;YACN,iBAAiB,GAAG,IAAI,iBAAiB,CAAC,QAAQ,CAAC,CAAC;QACtD,CAAC;QACD,IAAI,CAAC,OAAO,GAAG,IAAI,uBAAuB,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC;QACtE,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;QAClC,IAAI,CAAC,IAAI,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IAAI,CAAC,OAAO,CAAC,2BAA2B,CAAC,sBAAsB,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;IAClG,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,kCAAkC,CACtC,sBAA8B,EAC9B,WAAkC,EAClC,SAAgC;QAEhC,OAAO,IAAI,CAAC,OAAO,CAAC,kCAAkC,CAAC,sBAAsB,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;IACzG,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,oBAAoB,CACxB,MAAc,EACd,YAA0B,EAC1B,WAAkC,EAClC,SAAgC;QAEhC,OAAO,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;IACzF,CAAC;CACF","sourcesContent":["/* eslint-disable @typescript-eslint/unified-signatures -- overloads intentionally expose route-specific deprecation metadata */\nimport { BigSource } from \"big.js\";\nimport { AdditionalBasicChainProperties } from \"./chains/models\";\nimport { mainnet } from \"./configs\";\nimport {\n ActiveMessenger,\n AmountFormat,\n AmountFormatted,\n AmountsAndGasFeeOptions,\n BridgeService,\n ChainDetailsMap,\n CheckAddressResponse,\n ExtraGasMaxLimitResponse,\n GasBalanceResponse,\n GasFeeOptions,\n GetNativeTokenBalanceParams,\n GetTokenBalanceParams,\n LiquidityPoolService,\n LegacyMessenger,\n Messenger,\n PendingStatusInfoResponse,\n PoolInfo,\n Provider,\n SendAmountDetails,\n SwapAndBridgeCalculationData,\n TokenWithChainDetails,\n TransferStatusResponse,\n} from \"./models\";\nimport { AllbridgeCoreSdkService, NodeRpcUrlsConfig } from \"./services\";\nimport { CctpParams } from \"./services/bridge/sol\";\nimport { YieldService } from \"./services/yield\";\nimport { DefaultUtils, Utils } from \"./utils\";\n\nexport * from \"./configs\";\nexport * from \"./models\";\n\nexport interface AllbridgeCoreSdkOptions {\n coreApiUrl: string;\n /**\n * A set of query parameters to be added to all requests to the Core API.\n */\n coreApiQueryParams?: Record<string, string>;\n /**\n * A set of headers to be added to all requests to the Core API.\n */\n coreApiHeaders?: Record<string, string>;\n /**\n * A function that returns headers to be added to a single Core API request.\n * It is evaluated right before each request\n */\n coreApiHeadersProvider?: () => Promise<Record<string, string> | undefined>;\n /**\n * Jupiter Swap Api</br>\n * Default: https://lite-api.jup.ag/swap/v1</br>\n * {@link https://dev.jup.ag/docs/swap-api/}\n */\n jupiterUrl: string;\n /**\n * Jupiter Api Key Header</br>\n * {@link https://dev.jup.ag/docs/api-setup}\n */\n jupiterApiKeyHeader?: string;\n /**\n * Jupiter v6 'maxAccounts' parameter</br>\n * Rough estimate of the max accounts to be used for the quote, so that you can compose with your own accounts</br>\n * {@link https://station.jup.ag/docs/apis/swap-api#using-maxaccounts}\n */\n jupiterMaxAccounts?: number;\n /**\n * @deprecated Do not use.\n */\n wormholeMessengerProgramId?: string;\n solanaLookUpTable: string;\n sorobanNetworkPassphrase: string;\n /**\n * Optional. Will be used in methods</br>\n * {@link LiquidityPoolService.getPoolInfoFromChain} and {@link LiquidityPoolService.getAmountToBeWithdrawn}</br>\n * to fetch information from the blockchain with fewer HTTP requests using JSON-RPC API\n * @deprecated Do not use.\n */\n tronJsonRpc?: string;\n /**\n * Solana CCTP / CCTP V2 program ids and CCTP domains, see {@link CctpParams}.\n * Required for transfers with {@link Messenger.CCTP} and {@link Messenger.CCTP_V2} from Solana.\n */\n cctpParams: CctpParams;\n /**\n * The number of seconds that pool information taken from the chain will be cached.\n *\n * @type {number}\n * @deprecated Do not use.\n */\n cachePoolInfoChainSec?: number;\n\n /**\n * @internal\n * Optional additional properties to merge with the default properties.\n */\n additionalChainsProperties?: Record<string, AdditionalBasicChainProperties>;\n\n suiIsTestnet?: boolean;\n\n stxIsTestnet?: boolean;\n stxHeroApiKey?: string;\n}\n\n/**\n * Type representing RPC node URLs for different blockchain chains.</br>\n * Provide node RPC URL for chain connection you intend to communicate with</br>\n * - required for SOL, TRX chains</br>\n * - optional for EVM chains -- you can interact by passing a {@link Provider} that will be used to communicate with the chain</br>\n * @typedef {Record<string, string>} NodeRpcUrls\n * @property {string} chainSymbol - The symbol of the chain representing one of the supported blockchain networks (e.g., \"ETH\" for Ethereum). For more details, see: {@link ChainSymbol}.\n * @property {string} rpcUrl - The RPC node URL for the specified chain.\n */\nexport type NodeRpcUrls = Record<string, string>;\n\n/**\n * @deprecated Use {@link NodeRpcUrls}\n */\nexport interface NodeUrlsConfig {\n solanaRpcUrl: string;\n tronRpcUrl: string;\n}\n\n/**\n * @deprecated Use {@link NodeRpcUrls}\n */\nfunction isNodeUrlsConfig(nodeUrls: NodeUrlsConfig | NodeRpcUrls): nodeUrls is NodeUrlsConfig {\n return \"solanaRpcUrl\" in nodeUrls;\n}\n\nexport class AllbridgeCoreSdk {\n readonly params: AllbridgeCoreSdkOptions;\n\n bridge: BridgeService;\n /**\n * @deprecated Do not use.\n */\n pool: LiquidityPoolService;\n /**\n * @deprecated Do not use.\n */\n yield: YieldService;\n utils: Utils;\n\n private service: AllbridgeCoreSdkService;\n\n /**\n * Initializes the SDK object.\n * @param nodeUrls node rpc urls for full functionality\n * @param params\n * Optional.\n * If not defined, the default {@link mainnet} parameters are used.\n */\n constructor(nodeUrls: NodeUrlsConfig | NodeRpcUrls, params: AllbridgeCoreSdkOptions = mainnet) {\n let nodeRpcUrlsConfig: NodeRpcUrlsConfig;\n if (isNodeUrlsConfig(nodeUrls)) {\n nodeRpcUrlsConfig = new NodeRpcUrlsConfig({ SOL: nodeUrls.solanaRpcUrl, TRX: nodeUrls.tronRpcUrl });\n } else {\n nodeRpcUrlsConfig = new NodeRpcUrlsConfig(nodeUrls);\n }\n this.service = new AllbridgeCoreSdkService(nodeRpcUrlsConfig, params);\n this.bridge = this.service.bridge;\n this.pool = this.service.pool;\n this.yield = this.service.yield;\n this.utils = new DefaultUtils(this.service);\n this.params = params;\n }\n\n /**\n * Returns {@link ChainDetailsMap} containing a list of tokens for liquidity pools operations grouped by chain.\n * @param type - 'pool'\n * @deprecated Do not use.\n */\n chainDetailsMap(type: \"pool\"): Promise<ChainDetailsMap>;\n /**\n * Returns {@link ChainDetailsMap} containing a list of supported tokens grouped by chain.\n * @param type - Optional. 'swap' (tokens to send) is the only supported value and the default.\n */\n chainDetailsMap(type?: \"swap\"): Promise<ChainDetailsMap>;\n /**\n * Returns {@link ChainDetailsMap} containing a list of supported tokens grouped by chain.\n * @param type - 'swap' for tokens to send. The 'pool' value (liquidity pools setup) is deprecated. Do not use.\n */\n chainDetailsMap(type: \"swap\" | \"pool\"): Promise<ChainDetailsMap>;\n async chainDetailsMap(type: \"swap\" | \"pool\" = \"swap\"): Promise<ChainDetailsMap> {\n return this.service.chainDetailsMap(type);\n }\n\n /**\n * Returns a list of {@link TokenWithChainDetails | tokens} for liquidity pools operations.\n * @param type - 'pool'\n * @deprecated Do not use.\n */\n tokens(type: \"pool\"): Promise<TokenWithChainDetails[]>;\n /**\n * Returns a list of supported {@link TokenWithChainDetails | tokens}.\n * @param type - Optional. 'swap' (tokens to send) is the only supported value and the default.\n * @returns A promise that resolves to an array of {@link TokenWithChainDetails}.\n */\n tokens(type?: \"swap\"): Promise<TokenWithChainDetails[]>;\n /**\n * Returns a list of supported {@link TokenWithChainDetails | tokens}.\n * @param type - 'swap' for tokens to send. The 'pool' value (liquidity pools operations) is deprecated. Do not use.\n * @returns A promise that resolves to an array of {@link TokenWithChainDetails}.\n */\n tokens(type: \"swap\" | \"pool\"): Promise<TokenWithChainDetails[]>;\n async tokens(type: \"swap\" | \"pool\" = \"swap\"): Promise<TokenWithChainDetails[]> {\n return this.service.tokens(type);\n }\n\n /**\n * Returns a list of {@link TokenWithChainDetails | tokens} for liquidity pools operations on the selected chain.\n * @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}.\n * @param type - 'pool'\n * @deprecated Do not use.\n */\n tokensByChain(chainSymbol: string, type: \"pool\"): Promise<TokenWithChainDetails[]>;\n /**\n * Returns a list of supported {@link TokenWithChainDetails | tokens} on the selected chain.\n * @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}.\n * @param type - Optional. 'swap' (tokens to send) is the only supported value and the default.\n */\n tokensByChain(chainSymbol: string, type?: \"swap\"): Promise<TokenWithChainDetails[]>;\n /**\n * Returns a list of supported {@link TokenWithChainDetails | tokens} on the selected chain.\n * @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}.\n * @param type - 'swap' for tokens to send. The 'pool' value (liquidity pools operations) is deprecated. Do not use.\n */\n tokensByChain(chainSymbol: string, type: \"swap\" | \"pool\"): Promise<TokenWithChainDetails[]>;\n async tokensByChain(chainSymbol: string, type: \"swap\" | \"pool\" = \"swap\"): Promise<TokenWithChainDetails[]> {\n return this.service.tokensByChain(chainSymbol, type);\n }\n\n /**\n * Fetches information about tokens transfer by chosen chainSymbol and transaction Id from the Allbridge Core API.\n * @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}.\n * @param txId\n */\n async getTransferStatus(chainSymbol: string, txId: string): Promise<TransferStatusResponse> {\n return this.service.getTransferStatus(chainSymbol, txId);\n }\n\n /**\n * Get gas balance\n * @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}.\n * @param address\n */\n async getGasBalance(chainSymbol: string, address: string): Promise<GasBalanceResponse> {\n return this.service.getGasBalance(chainSymbol, address);\n }\n\n /**\n * Check address and show gas balance\n * @deprecated\n * @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}.\n * @param _recipientAddress\n * @param _tokenAddress\n */\n async checkAddress(\n _chainSymbol: string,\n _recipientAddress: string,\n _tokenAddress?: string\n ): Promise<CheckAddressResponse> {\n return await this.service.checkAddress();\n }\n\n /**\n * 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.\n * @deprecated Do not use.\n * @param amount the amount of tokens that will be sent\n * @param amountFormat amount format\n * @param sourceToken selected token transfer from\n * @param destToken selected token transfer to\n * @returns range of possible amount based on already pending transactions\n */\n async getPendingStatusInfo(\n amount: string,\n amountFormat: AmountFormat,\n sourceToken: TokenWithChainDetails,\n destToken: TokenWithChainDetails\n ): Promise<PendingStatusInfoResponse> {\n return this.service.getPendingStatusInfo(amount, amountFormat, sourceToken, destToken);\n }\n\n /**\n * Get token balance\n * @param params\n * @param provider\n * @returns Token balance\n */\n async getTokenBalance(params: GetTokenBalanceParams, provider?: Provider): Promise<string> {\n return this.service.getTokenBalance(params, provider);\n }\n\n /**\n * Get native (gas) token balance\n * @param params\n * @param provider\n * @returns Token balance\n */\n async getNativeTokenBalance(params: GetNativeTokenBalanceParams, provider?: Provider): Promise<AmountFormatted> {\n return this.service.getNativeTokenBalance(params, provider);\n }\n\n /**\n * @deprecated\n * Calculates the percentage of fee from the initial amount that is charged when swapping from the selected source chain.\n * (Does not include fee related to the destination chain. Does not include gas fee)\n * @param amountFloat initial amount of tokens to swap\n * @param sourceChainToken selected token on the source chain\n * @returns fee percent\n */\n async calculateFeePercentOnSourceChain(\n amountFloat: BigSource,\n sourceChainToken: TokenWithChainDetails\n ): Promise<number> {\n return this.service.calculateFeePercentOnSourceChain(amountFloat, sourceChainToken);\n }\n\n /**\n * @deprecated\n * Calculates the percentage of fee that is charged when swapping to the selected destination chain. The destination chain fee percent applies to the amount after the source chain fee.\n * (Does not include fee related to the source chain. Does not include gas fee)\n * @see {@link calculateFeePercentOnSourceChain}\n * @param amountFloat initial amount of tokens to swap\n * @param sourceChainToken selected token on the source chain\n * @param destinationChainToken selected token on the destination chain\n * @returns fee percent\n */\n async calculateFeePercentOnDestinationChain(\n amountFloat: BigSource,\n sourceChainToken: TokenWithChainDetails,\n destinationChainToken: TokenWithChainDetails\n ): Promise<number> {\n return this.service.calculateFeePercentOnDestinationChain(amountFloat, sourceChainToken, destinationChainToken);\n }\n\n /**\n * Calculates the amount of tokens to be received as a result of transfer\n * and fetches {@link GasFeeOptions} which contains available ways to pay the gas fee.\n * @param amountToSendFloat the amount of tokens that will be sent\n * @param sourceChainToken selected token on the source chain\n * @param destinationChainToken selected token on the destination chain\n * @param messenger\n *\n * @deprecated Use {@link getGasFeeOptions} and {@link getAmountToBeReceived}.\n */\n async getAmountToBeReceivedAndGasFeeOptions(\n amountToSendFloat: BigSource,\n sourceChainToken: TokenWithChainDetails,\n destinationChainToken: TokenWithChainDetails,\n messenger: Messenger\n ): Promise<AmountsAndGasFeeOptions> {\n return this.service.getAmountToBeReceivedAndGasFeeOptions(\n amountToSendFloat,\n sourceChainToken,\n destinationChainToken,\n messenger\n );\n }\n\n /**\n * Calculates the amount of tokens to send based on requested tokens amount be received as a result of transfer.\n * and fetches {@link GasFeeOptions} which contains available ways to pay the gas fee.\n * @param amountToBeReceivedFloat the amount of tokens that should be received\n * @param sourceChainToken selected token on the source chain\n * @param destinationChainToken selected token on the destination chain\n * @param messenger\n *\n * @deprecated Use {@link getGasFeeOptions} and {@link getAmountToSend}.\n */\n async getAmountToSendAndGasFeeOptions(\n amountToBeReceivedFloat: BigSource,\n sourceChainToken: TokenWithChainDetails,\n destinationChainToken: TokenWithChainDetails,\n messenger: Messenger\n ): Promise<AmountsAndGasFeeOptions> {\n return this.service.getAmountToSendAndGasFeeOptions(\n amountToBeReceivedFloat,\n sourceChainToken,\n destinationChainToken,\n messenger\n );\n }\n\n /**\n * Calculates the amount of tokens to be received as a result of transfer through a legacy messenger.\n * @param amountToSendFloat the amount of tokens that will be sent\n * @param sourceChainToken selected token on the source chain\n * @param destinationChainToken selected token on the destination chain\n * @param messenger {@link LegacyMessenger}\n * @deprecated Do not use.\n */\n getAmountToBeReceived(\n amountToSendFloat: BigSource,\n sourceChainToken: TokenWithChainDetails,\n destinationChainToken: TokenWithChainDetails,\n messenger: LegacyMessenger\n ): Promise<string>;\n /**\n * Calculates the amount of tokens to be received as a result of transfer\n * after applying the fee of the selected messenger.\n * @param amountToSendFloat the amount of tokens that will be sent\n * @param sourceChainToken selected token on the source chain\n * @param destinationChainToken selected token on the destination chain\n * @param messenger selected messenger, see {@link ActiveMessenger}\n * @throws CCTPDoesNotSupportedError, OFTDoesNotSupportedError or SdkError if the route is not supported by the messenger\n */\n getAmountToBeReceived(\n amountToSendFloat: BigSource,\n sourceChainToken: TokenWithChainDetails,\n destinationChainToken: TokenWithChainDetails,\n messenger: ActiveMessenger\n ): Promise<string>;\n async getAmountToBeReceived(\n amountToSendFloat: BigSource,\n sourceChainToken: TokenWithChainDetails,\n destinationChainToken: TokenWithChainDetails,\n /**\n * The Messengers for different routes.\n */\n messenger: Messenger\n ): Promise<string> {\n return this.service.getAmountToBeReceived(amountToSendFloat, sourceChainToken, destinationChainToken, messenger);\n }\n\n /**\n * Calculates the amount of tokens to be received as a result of transfer based on actual blockchain pool state.\n * @param amountToSendFloat the amount of tokens that will be sent\n * @param sourceChainToken selected token on the source chain\n * @param destinationChainToken selected token on the destination chain\n * @param messenger selected messenger\n * @param sourceProvider Optional. source chain Provider\n * @param destinationProvider Optional. destination chain Provider\n * @deprecated Do not use.\n */\n getAmountToBeReceivedFromChain(\n amountToSendFloat: BigSource,\n sourceChainToken: TokenWithChainDetails,\n destinationChainToken: TokenWithChainDetails,\n messenger: Messenger,\n sourceProvider?: Provider,\n destinationProvider?: Provider\n ): Promise<string>;\n async getAmountToBeReceivedFromChain(\n amountToSendFloat: BigSource,\n sourceChainToken: TokenWithChainDetails,\n destinationChainToken: TokenWithChainDetails,\n /**\n * The Messengers for different routes.\n */\n messenger: Messenger,\n sourceProvider?: Provider,\n destinationProvider?: Provider\n ): Promise<string> {\n return this.service.getAmountToBeReceivedFromChain(\n amountToSendFloat,\n sourceChainToken,\n destinationChainToken,\n messenger,\n sourceProvider,\n destinationProvider\n );\n }\n\n /**\n * Calculates the amount of tokens to be received as a result of transfer based on passed pool state.\n * @param amountToSendFloat the amount of tokens that will be sent\n * @param sourceChainToken selected token on the source chain\n * @param destinationChainToken selected token on the destination chain\n * @param sourcePool source token pool state\n * @param destinationPool destination token pool state\n * @param messenger selected messenger\n * @deprecated Do not use.\n */\n getAmountToBeReceivedFromPools(\n amountToSendFloat: BigSource,\n sourceChainToken: TokenWithChainDetails,\n destinationChainToken: TokenWithChainDetails,\n sourcePool: PoolInfo,\n destinationPool: PoolInfo,\n messenger: Exclude<Messenger, Messenger.OFT>\n ): string;\n getAmountToBeReceivedFromPools(\n amountToSendFloat: BigSource,\n sourceChainToken: TokenWithChainDetails,\n destinationChainToken: TokenWithChainDetails,\n sourcePool: PoolInfo,\n destinationPool: PoolInfo,\n messenger: Exclude<Messenger, Messenger.OFT>\n ): string {\n switch (messenger) {\n case Messenger.ALLBRIDGE:\n case Messenger.WORMHOLE:\n return this.service.getAmountToBeReceivedComputeWithPools(\n amountToSendFloat,\n sourceChainToken,\n destinationChainToken,\n sourcePool,\n destinationPool\n );\n case Messenger.CCTP:\n case Messenger.CCTP_V2:\n return this.service.getAmountToBeReceivedComputeCctp(\n amountToSendFloat,\n sourceChainToken,\n destinationChainToken,\n messenger\n );\n case Messenger.X_RESERVE:\n return this.service.getAmountToBeReceivedComputeXReserve(\n amountToSendFloat,\n sourceChainToken,\n destinationChainToken\n );\n }\n }\n\n /**\n * Calculates the amount of tokens to send based on requested tokens amount be received as a result of transfer through a legacy messenger.\n * @param amountToBeReceivedFloat the amount of tokens that should be received\n * @param sourceChainToken selected token on the source chain\n * @param destinationChainToken selected token on the destination chain\n * @param messenger {@link LegacyMessenger}\n * @deprecated Do not use.\n */\n getAmountToSend(\n amountToBeReceivedFloat: BigSource,\n sourceChainToken: TokenWithChainDetails,\n destinationChainToken: TokenWithChainDetails,\n messenger: LegacyMessenger\n ): Promise<string>;\n /**\n * Calculates the amount of tokens to send based on requested tokens amount be received as a result of transfer\n * after applying the fee of the selected messenger.\n * @param amountToBeReceivedFloat the amount of tokens that should be received\n * @param sourceChainToken selected token on the source chain\n * @param destinationChainToken selected token on the destination chain\n * @param messenger selected messenger, see {@link ActiveMessenger}\n * @throws CCTPDoesNotSupportedError, OFTDoesNotSupportedError or SdkError if the route is not supported by the messenger\n */\n getAmountToSend(\n amountToBeReceivedFloat: BigSource,\n sourceChainToken: TokenWithChainDetails,\n destinationChainToken: TokenWithChainDetails,\n messenger: ActiveMessenger\n ): Promise<string>;\n async getAmountToSend(\n amountToBeReceivedFloat: BigSource,\n sourceChainToken: TokenWithChainDetails,\n destinationChainToken: TokenWithChainDetails,\n /**\n * The Messengers for different routes.\n */\n messenger: Messenger\n ): Promise<string> {\n return this.service.getAmountToSend(amountToBeReceivedFloat, sourceChainToken, destinationChainToken, messenger);\n }\n\n /**\n * 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.\n * @param amountToBeReceivedFloat the amount of tokens that should be received\n * @param sourceChainToken selected token on the source chain\n * @param destinationChainToken selected token on the destination chain\n * @param messenger selected messenger\n * @param sourceProvider Optional. source chain Provider\n * @param destinationProvider Optional. destination chain Provider\n * @deprecated Do not use.\n */\n getAmountToSendFromChain(\n amountToBeReceivedFloat: BigSource,\n sourceChainToken: TokenWithChainDetails,\n destinationChainToken: TokenWithChainDetails,\n messenger: Messenger,\n sourceProvider?: Provider,\n destinationProvider?: Provider\n ): Promise<string>;\n async getAmountToSendFromChain(\n amountToBeReceivedFloat: BigSource,\n sourceChainToken: TokenWithChainDetails,\n destinationChainToken: TokenWithChainDetails,\n /**\n * The Messengers for different routes.\n */\n messenger: Messenger,\n sourceProvider?: Provider,\n destinationProvider?: Provider\n ): Promise<string> {\n return this.service.getAmountToSendFromChain(\n amountToBeReceivedFloat,\n sourceChainToken,\n destinationChainToken,\n messenger,\n sourceProvider,\n destinationProvider\n );\n }\n\n /**\n * Calculates the amount of tokens to send based on requested tokens amount be received as a result of transfer based on passed pool state.\n * @param amountToBeReceivedFloat the amount of tokens that should be received\n * @param sourceChainToken selected token on the source chain\n * @param destinationChainToken selected token on the destination chain\n * @param sourcePool source token pool state\n * @param destinationPool destination token pool state\n * @param messenger selected messenger\n * @deprecated Do not use.\n */\n getAmountToSendFromPools(\n amountToBeReceivedFloat: BigSource,\n sourceChainToken: TokenWithChainDetails,\n destinationChainToken: TokenWithChainDetails,\n sourcePool: PoolInfo,\n destinationPool: PoolInfo,\n messenger: Exclude<Messenger, Messenger.OFT>\n ): string;\n getAmountToSendFromPools(\n amountToBeReceivedFloat: BigSource,\n sourceChainToken: TokenWithChainDetails,\n destinationChainToken: TokenWithChainDetails,\n sourcePool: PoolInfo,\n destinationPool: PoolInfo,\n messenger: Exclude<Messenger, Messenger.OFT>\n ): string {\n switch (messenger) {\n case Messenger.ALLBRIDGE:\n case Messenger.WORMHOLE:\n return this.service.getAmountToSendComputeWithPools(\n amountToBeReceivedFloat,\n sourceChainToken,\n destinationChainToken,\n sourcePool,\n destinationPool\n );\n case Messenger.CCTP:\n case Messenger.CCTP_V2:\n return this.service.getAmountToSendComputeCctp(\n amountToBeReceivedFloat,\n sourceChainToken,\n destinationChainToken,\n messenger\n );\n case Messenger.X_RESERVE:\n return this.service.getAmountToSendComputeXReserve(\n amountToBeReceivedFloat,\n sourceChainToken,\n destinationChainToken\n );\n }\n }\n\n /**\n * Fetches possible ways to pay the transfer gas fee.\n * @param sourceChainToken selected token on the source chain\n * @param destinationChainToken selected token on the destination chain\n * @param messenger selected messenger, see {@link ActiveMessenger}\n * @returns {@link GasFeeOptions}\n */\n async getGasFeeOptions(\n sourceChainToken: TokenWithChainDetails,\n destinationChainToken: TokenWithChainDetails,\n messenger: Messenger\n ): Promise<GasFeeOptions> {\n return this.service.getGasFeeOptions(sourceChainToken, destinationChainToken, messenger);\n }\n\n /**\n * Gets the average time in ms to complete a transfer for given tokens and messenger.\n * @param sourceChainToken selected token on the source chain.\n * @param destinationChainToken selected token on the destination chain.\n * @param messenger selected messenger, see {@link ActiveMessenger}\n * @returns Average transfer time in milliseconds or null if a given combination of tokens and messenger is not supported.\n */\n getAverageTransferTime(\n sourceChainToken: TokenWithChainDetails,\n destinationChainToken: TokenWithChainDetails,\n messenger: Messenger\n ): number | null {\n return this.service.getAverageTransferTime(sourceChainToken, destinationChainToken, messenger);\n }\n\n /**\n * Gets information about the poolInfo by token\n * @deprecated Do not use.\n * @param token\n * @returns poolInfo\n */\n async getPoolInfoByToken(token: TokenWithChainDetails): Promise<PoolInfo> {\n return this.service.getPoolInfoByToken(token);\n }\n\n /**\n * Forces refresh of cached information about the state of liquidity pools.\n * Outdated cache leads to calculated amounts being less accurate.\n * The cache is invalidated at regular intervals, but it can be forced to be refreshed by calling this method.+\n *\n * @deprecated Do not use.\n * @param tokens if present, the corresponding liquidity pools will be updated\n */\n async refreshPoolInfo(tokens?: TokenWithChainDetails | TokenWithChainDetails[]): Promise<void> {\n return this.service.refreshPoolInfo(tokens);\n }\n\n /**\n * Convert APR to percentage view\n * @deprecated Do not use.\n * @param apr\n * @returns aprPercentageView\n */\n aprInPercents(apr: string): string {\n return this.service.aprInPercents(apr);\n }\n\n /**\n * Get possible limit of extra gas amount for a legacy messenger.\n * @param sourceChainToken selected token on the source chain\n * @param destinationChainToken selected token on the destination chain\n * @param messenger {@link LegacyMessenger}\n * @deprecated Do not use.\n */\n getExtraGasMaxLimits(\n sourceChainToken: TokenWithChainDetails,\n destinationChainToken: TokenWithChainDetails,\n messenger: LegacyMessenger\n ): Promise<ExtraGasMaxLimitResponse>;\n /**\n * Get possible limit of extra gas amount.\n * For {@link Messenger.X_RESERVE} extra gas is not supported and zero limits are returned.\n * @param sourceChainToken selected token on the source chain\n * @param destinationChainToken selected token on the destination chain\n * @param messenger selected messenger, see {@link ActiveMessenger}\n * @returns {@link ExtraGasMaxLimitResponse}\n */\n getExtraGasMaxLimits(\n sourceChainToken: TokenWithChainDetails,\n destinationChainToken: TokenWithChainDetails,\n messenger: ActiveMessenger\n ): Promise<ExtraGasMaxLimitResponse>;\n async getExtraGasMaxLimits(\n sourceChainToken: TokenWithChainDetails,\n destinationChainToken: TokenWithChainDetails,\n messenger: Messenger\n ): Promise<ExtraGasMaxLimitResponse> {\n return this.service.getExtraGasMaxLimits(sourceChainToken, destinationChainToken, messenger);\n }\n\n /**\n * @deprecated Do not use.\n * @param amount - amount\n * @param amountFormat - AmountFormat\n * @param sourceToken - selected token on the source chain\n * @return virtual amount\n */\n async getVUsdFromAmount(\n amount: string,\n amountFormat: AmountFormat,\n sourceToken: TokenWithChainDetails\n ): Promise<AmountFormatted> {\n return this.service.getVUsdFromAmount(amount, amountFormat, sourceToken);\n }\n\n /**\n * @deprecated Do not use.\n * @param vUsdAmount - amount of vUsd, int format\n * @param destToken selected token on the destination chain\n * @return amount of destToken\n */\n async getAmountFromVUsd(vUsdAmount: string, destToken: TokenWithChainDetails): Promise<AmountFormatted> {\n return this.service.getAmountFromVUsd(vUsdAmount, destToken);\n }\n\n /**\n * @deprecated Do not use.\n * @param amountInTokenPrecision\n * @param sourceToken\n * @param destToken\n */\n async swapAndBridgeFeeCalculation(\n amountInTokenPrecision: string,\n sourceToken: TokenWithChainDetails,\n destToken: TokenWithChainDetails\n ): Promise<SwapAndBridgeCalculationData> {\n return this.service.swapAndBridgeFeeCalculation(amountInTokenPrecision, sourceToken, destToken);\n }\n\n /**\n * @deprecated Do not use.\n * @param amountInTokenPrecision\n * @param sourceToken\n * @param destToken\n */\n async swapAndBridgeFeeCalculationReverse(\n amountInTokenPrecision: string,\n sourceToken: TokenWithChainDetails,\n destToken: TokenWithChainDetails\n ): Promise<SwapAndBridgeCalculationData> {\n return this.service.swapAndBridgeFeeCalculationReverse(amountInTokenPrecision, sourceToken, destToken);\n }\n\n /**\n * Show amount changes (fee and amount adjustment) during send through pools on source and destination chains\n * @deprecated Do not use.\n */\n async getSendAmountDetails(\n amount: string,\n amountFormat: AmountFormat,\n sourceToken: TokenWithChainDetails,\n destToken: TokenWithChainDetails\n ): Promise<SendAmountDetails> {\n return this.service.getSendAmountDetails(amount, amountFormat, sourceToken, destToken);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAeL,SAAS,GAQV,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAIxE,OAAO,EAAE,YAAY,EAAS,MAAM,SAAS,CAAC;AAE9C,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AA2FzB;;GAEG;AACH,SAAS,gBAAgB,CAAC,QAAsC;IAC9D,OAAO,cAAc,IAAI,QAAQ,CAAC;AACpC,CAAC;AAED,MAAM,OAAO,gBAAgB;IAClB,MAAM,CAA0B;IAEzC,MAAM,CAAgB;IACtB;;OAEG;IACH,IAAI,CAAuB;IAC3B;;OAEG;IACH,KAAK,CAAe;IACpB;;OAEG;IACH,WAAW,CAAqB;IAChC,KAAK,CAAQ;IAEL,OAAO,CAA0B;IAEzC;;;;;;OAMG;IACH,YAAY,QAAsC,EAAE,SAAkC,OAAO;QAC3F,IAAI,iBAAoC,CAAC;QACzC,IAAI,gBAAgB,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC/B,iBAAiB,GAAG,IAAI,iBAAiB,CAAC,EAAE,GAAG,EAAE,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC;QACtG,CAAC;aAAM,CAAC;YACN,iBAAiB,GAAG,IAAI,iBAAiB,CAAC,QAAQ,CAAC,CAAC;QACtD,CAAC;QACD,IAAI,CAAC,OAAO,GAAG,IAAI,uBAAuB,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC;QACtE,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;QAClC,IAAI,CAAC,IAAI,GAAG,IAAI,CAA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sBAA8B,EAC9B,WAAkC,EAClC,SAAgC;QAEhC,OAAO,IAAI,CAAC,OAAO,CAAC,2BAA2B,CAAC,sBAAsB,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;IAClG,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,kCAAkC,CACtC,sBAA8B,EAC9B,WAAkC,EAClC,SAAgC;QAEhC,OAAO,IAAI,CAAC,OAAO,CAAC,kCAAkC,CAAC,sBAAsB,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;IACzG,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,oBAAoB,CACxB,MAAc,EACd,YAA0B,EAC1B,WAAkC,EAClC,SAAgC;QAEhC,OAAO,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;IACzF,CAAC;CACF","sourcesContent":["/* eslint-disable @typescript-eslint/unified-signatures -- overloads intentionally expose route-specific deprecation metadata */\nimport { BigSource } from \"big.js\";\nimport { AdditionalBasicChainProperties } from \"./chains/models\";\nimport { mainnet } from \"./configs\";\nimport {\n ActiveMessenger,\n AmountFormat,\n AmountFormatted,\n AmountsAndGasFeeOptions,\n BridgeService,\n ChainDetailsMap,\n CheckAddressResponse,\n ExtraGasMaxLimitResponse,\n GasBalanceResponse,\n GasFeeOptions,\n GetNativeTokenBalanceParams,\n GetTokenBalanceParams,\n LiquidityPoolService,\n LegacyMessenger,\n Messenger,\n PendingStatusInfoResponse,\n PoolInfo,\n Provider,\n SendAmountDetails,\n SwapAndBridgeCalculationData,\n TokenWithChainDetails,\n TransferStatusResponse,\n} from \"./models\";\nimport { AllbridgeCoreSdkService, NodeRpcUrlsConfig } from \"./services\";\nimport { CctpParams } from \"./services/bridge/sol\";\nimport { NearIntentsService } from \"./services/near-intents\";\nimport { YieldService } from \"./services/yield\";\nimport { DefaultUtils, Utils } from \"./utils\";\n\nexport * from \"./configs\";\nexport * from \"./models\";\n\nexport interface AllbridgeCoreSdkOptions {\n coreApiUrl: string;\n /**\n * A set of query parameters to be added to all requests to the Core API.\n */\n coreApiQueryParams?: Record<string, string>;\n /**\n * A set of headers to be added to all requests to the Core API.\n */\n coreApiHeaders?: Record<string, string>;\n /**\n * A function that returns headers to be added to a single Core API request.\n * It is evaluated right before each request\n */\n coreApiHeadersProvider?: () => Promise<Record<string, string> | undefined>;\n /**\n * Jupiter Swap Api</br>\n * Default: https://lite-api.jup.ag/swap/v1</br>\n * {@link https://dev.jup.ag/docs/swap-api/}\n */\n jupiterUrl: string;\n /**\n * Jupiter Api Key Header</br>\n * {@link https://dev.jup.ag/docs/api-setup}\n */\n jupiterApiKeyHeader?: string;\n /**\n * Jupiter v6 'maxAccounts' parameter</br>\n * Rough estimate of the max accounts to be used for the quote, so that you can compose with your own accounts</br>\n * {@link https://station.jup.ag/docs/apis/swap-api#using-maxaccounts}\n */\n jupiterMaxAccounts?: number;\n /**\n * @deprecated Do not use.\n */\n wormholeMessengerProgramId?: string;\n solanaLookUpTable: string;\n sorobanNetworkPassphrase: string;\n /**\n * Optional. Will be used in methods</br>\n * {@link LiquidityPoolService.getPoolInfoFromChain} and {@link LiquidityPoolService.getAmountToBeWithdrawn}</br>\n * to fetch information from the blockchain with fewer HTTP requests using JSON-RPC API\n * @deprecated Do not use.\n */\n tronJsonRpc?: string;\n /**\n * Solana CCTP / CCTP V2 program ids and CCTP domains, see {@link CctpParams}.\n * Required for transfers with {@link Messenger.CCTP} and {@link Messenger.CCTP_V2} from Solana.\n */\n cctpParams: CctpParams;\n /**\n * The number of seconds that pool information taken from the chain will be cached.\n *\n * @type {number}\n * @deprecated Do not use.\n */\n cachePoolInfoChainSec?: number;\n\n /**\n * @internal\n * Optional additional properties to merge with the default properties.\n */\n additionalChainsProperties?: Record<string, AdditionalBasicChainProperties>;\n\n suiIsTestnet?: boolean;\n\n stxIsTestnet?: boolean;\n stxHeroApiKey?: string;\n}\n\n/**\n * Type representing RPC node URLs for different blockchain chains.</br>\n * Provide node RPC URL for chain connection you intend to communicate with</br>\n * - required for SOL, TRX chains</br>\n * - optional for EVM chains -- you can interact by passing a {@link Provider} that will be used to communicate with the chain</br>\n * @typedef {Record<string, string>} NodeRpcUrls\n * @property {string} chainSymbol - The symbol of the chain representing one of the supported blockchain networks (e.g., \"ETH\" for Ethereum). For more details, see: {@link ChainSymbol}.\n * @property {string} rpcUrl - The RPC node URL for the specified chain.\n */\nexport type NodeRpcUrls = Record<string, string>;\n\n/**\n * @deprecated Use {@link NodeRpcUrls}\n */\nexport interface NodeUrlsConfig {\n solanaRpcUrl: string;\n tronRpcUrl: string;\n}\n\n/**\n * @deprecated Use {@link NodeRpcUrls}\n */\nfunction isNodeUrlsConfig(nodeUrls: NodeUrlsConfig | NodeRpcUrls): nodeUrls is NodeUrlsConfig {\n return \"solanaRpcUrl\" in nodeUrls;\n}\n\nexport class AllbridgeCoreSdk {\n readonly params: AllbridgeCoreSdkOptions;\n\n bridge: BridgeService;\n /**\n * @deprecated Do not use.\n */\n pool: LiquidityPoolService;\n /**\n * @deprecated Do not use.\n */\n yield: YieldService;\n /**\n * NEAR Intents ({@link Messenger.NEAR_INTENTS}) quotes and deposits, see {@link NearIntentsService}.\n */\n nearIntents: NearIntentsService;\n utils: Utils;\n\n private service: AllbridgeCoreSdkService;\n\n /**\n * Initializes the SDK object.\n * @param nodeUrls node rpc urls for full functionality\n * @param params\n * Optional.\n * If not defined, the default {@link mainnet} parameters are used.\n */\n constructor(nodeUrls: NodeUrlsConfig | NodeRpcUrls, params: AllbridgeCoreSdkOptions = mainnet) {\n let nodeRpcUrlsConfig: NodeRpcUrlsConfig;\n if (isNodeUrlsConfig(nodeUrls)) {\n nodeRpcUrlsConfig = new NodeRpcUrlsConfig({ SOL: nodeUrls.solanaRpcUrl, TRX: nodeUrls.tronRpcUrl });\n } else {\n nodeRpcUrlsConfig = new NodeRpcUrlsConfig(nodeUrls);\n }\n this.service = new AllbridgeCoreSdkService(nodeRpcUrlsConfig, params);\n this.bridge = this.service.bridge;\n this.pool = this.service.pool;\n this.yield = this.service.yield;\n this.nearIntents = this.service.nearIntents;\n this.utils = new DefaultUtils(this.service);\n this.params = params;\n }\n\n /**\n * Returns {@link ChainDetailsMap} containing a list of tokens for liquidity pools operations grouped by chain.\n * @param type - 'pool'\n * @deprecated Do not use.\n */\n chainDetailsMap(type: \"pool\"): Promise<ChainDetailsMap>;\n /**\n * Returns {@link ChainDetailsMap} containing a list of supported tokens grouped by chain.\n * @param type - Optional. 'swap' (tokens to send) is the only supported value and the default.\n */\n chainDetailsMap(type?: \"swap\"): Promise<ChainDetailsMap>;\n /**\n * Returns {@link ChainDetailsMap} containing a list of supported tokens grouped by chain.\n * @param type - 'swap' for tokens to send. The 'pool' value (liquidity pools setup) is deprecated. Do not use.\n */\n chainDetailsMap(type: \"swap\" | \"pool\"): Promise<ChainDetailsMap>;\n async chainDetailsMap(type: \"swap\" | \"pool\" = \"swap\"): Promise<ChainDetailsMap> {\n return this.service.chainDetailsMap(type);\n }\n\n /**\n * Returns a list of {@link TokenWithChainDetails | tokens} for liquidity pools operations.\n * @param type - 'pool'\n * @deprecated Do not use.\n */\n tokens(type: \"pool\"): Promise<TokenWithChainDetails[]>;\n /**\n * Returns a list of supported {@link TokenWithChainDetails | tokens}.\n * @param type - Optional. 'swap' (tokens to send) is the only supported value and the default.\n * @returns A promise that resolves to an array of {@link TokenWithChainDetails}.\n */\n tokens(type?: \"swap\"): Promise<TokenWithChainDetails[]>;\n /**\n * Returns a list of supported {@link TokenWithChainDetails | tokens}.\n * @param type - 'swap' for tokens to send. The 'pool' value (liquidity pools operations) is deprecated. Do not use.\n * @returns A promise that resolves to an array of {@link TokenWithChainDetails}.\n */\n tokens(type: \"swap\" | \"pool\"): Promise<TokenWithChainDetails[]>;\n async tokens(type: \"swap\" | \"pool\" = \"swap\"): Promise<TokenWithChainDetails[]> {\n return this.service.tokens(type);\n }\n\n /**\n * Returns a list of {@link TokenWithChainDetails | tokens} for liquidity pools operations on the selected chain.\n * @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}.\n * @param type - 'pool'\n * @deprecated Do not use.\n */\n tokensByChain(chainSymbol: string, type: \"pool\"): Promise<TokenWithChainDetails[]>;\n /**\n * Returns a list of supported {@link TokenWithChainDetails | tokens} on the selected chain.\n * @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}.\n * @param type - Optional. 'swap' (tokens to send) is the only supported value and the default.\n */\n tokensByChain(chainSymbol: string, type?: \"swap\"): Promise<TokenWithChainDetails[]>;\n /**\n * Returns a list of supported {@link TokenWithChainDetails | tokens} on the selected chain.\n * @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}.\n * @param type - 'swap' for tokens to send. The 'pool' value (liquidity pools operations) is deprecated. Do not use.\n */\n tokensByChain(chainSymbol: string, type: \"swap\" | \"pool\"): Promise<TokenWithChainDetails[]>;\n async tokensByChain(chainSymbol: string, type: \"swap\" | \"pool\" = \"swap\"): Promise<TokenWithChainDetails[]> {\n return this.service.tokensByChain(chainSymbol, type);\n }\n\n /**\n * Fetches information about tokens transfer by chosen chainSymbol and transaction Id from the Allbridge Core API.\n * @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}.\n * @param txId\n */\n async getTransferStatus(chainSymbol: string, txId: string): Promise<TransferStatusResponse> {\n return this.service.getTransferStatus(chainSymbol, txId);\n }\n\n /**\n * Get gas balance\n * @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}.\n * @param address\n */\n async getGasBalance(chainSymbol: string, address: string): Promise<GasBalanceResponse> {\n return this.service.getGasBalance(chainSymbol, address);\n }\n\n /**\n * Check address and show gas balance\n * @deprecated\n * @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}.\n * @param _recipientAddress\n * @param _tokenAddress\n */\n async checkAddress(\n _chainSymbol: string,\n _recipientAddress: string,\n _tokenAddress?: string\n ): Promise<CheckAddressResponse> {\n return await this.service.checkAddress();\n }\n\n /**\n * 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.\n * @deprecated Do not use.\n * @param amount the amount of tokens that will be sent\n * @param amountFormat amount format\n * @param sourceToken selected token transfer from\n * @param destToken selected token transfer to\n * @returns range of possible amount based on already pending transactions\n */\n async getPendingStatusInfo(\n amount: string,\n amountFormat: AmountFormat,\n sourceToken: TokenWithChainDetails,\n destToken: TokenWithChainDetails\n ): Promise<PendingStatusInfoResponse> {\n return this.service.getPendingStatusInfo(amount, amountFormat, sourceToken, destToken);\n }\n\n /**\n * Get token balance\n * @param params\n * @param provider\n * @returns Token balance\n */\n async getTokenBalance(params: GetTokenBalanceParams, provider?: Provider): Promise<string> {\n return this.service.getTokenBalance(params, provider);\n }\n\n /**\n * Get native (gas) token balance\n * @param params\n * @param provider\n * @returns Token balance\n */\n async getNativeTokenBalance(params: GetNativeTokenBalanceParams, provider?: Provider): Promise<AmountFormatted> {\n return this.service.getNativeTokenBalance(params, provider);\n }\n\n /**\n * @deprecated\n * Calculates the percentage of fee from the initial amount that is charged when swapping from the selected source chain.\n * (Does not include fee related to the destination chain. Does not include gas fee)\n * @param amountFloat initial amount of tokens to swap\n * @param sourceChainToken selected token on the source chain\n * @returns fee percent\n */\n async calculateFeePercentOnSourceChain(\n amountFloat: BigSource,\n sourceChainToken: TokenWithChainDetails\n ): Promise<number> {\n return this.service.calculateFeePercentOnSourceChain(amountFloat, sourceChainToken);\n }\n\n /**\n * @deprecated\n * Calculates the percentage of fee that is charged when swapping to the selected destination chain. The destination chain fee percent applies to the amount after the source chain fee.\n * (Does not include fee related to the source chain. Does not include gas fee)\n * @see {@link calculateFeePercentOnSourceChain}\n * @param amountFloat initial amount of tokens to swap\n * @param sourceChainToken selected token on the source chain\n * @param destinationChainToken selected token on the destination chain\n * @returns fee percent\n */\n async calculateFeePercentOnDestinationChain(\n amountFloat: BigSource,\n sourceChainToken: TokenWithChainDetails,\n destinationChainToken: TokenWithChainDetails\n ): Promise<number> {\n return this.service.calculateFeePercentOnDestinationChain(amountFloat, sourceChainToken, destinationChainToken);\n }\n\n /**\n * Calculates the amount of tokens to be received as a result of transfer\n * and fetches {@link GasFeeOptions} which contains available ways to pay the gas fee.\n * @param amountToSendFloat the amount of tokens that will be sent\n * @param sourceChainToken selected token on the source chain\n * @param destinationChainToken selected token on the destination chain\n * @param messenger\n *\n * @deprecated Use {@link getGasFeeOptions} and {@link getAmountToBeReceived}.\n */\n async getAmountToBeReceivedAndGasFeeOptions(\n amountToSendFloat: BigSource,\n sourceChainToken: TokenWithChainDetails,\n destinationChainToken: TokenWithChainDetails,\n messenger: Messenger\n ): Promise<AmountsAndGasFeeOptions> {\n return this.service.getAmountToBeReceivedAndGasFeeOptions(\n amountToSendFloat,\n sourceChainToken,\n destinationChainToken,\n messenger\n );\n }\n\n /**\n * Calculates the amount of tokens to send based on requested tokens amount be received as a result of transfer.\n * and fetches {@link GasFeeOptions} which contains available ways to pay the gas fee.\n * @param amountToBeReceivedFloat the amount of tokens that should be received\n * @param sourceChainToken selected token on the source chain\n * @param destinationChainToken selected token on the destination chain\n * @param messenger\n *\n * @deprecated Use {@link getGasFeeOptions} and {@link getAmountToSend}.\n */\n async getAmountToSendAndGasFeeOptions(\n amountToBeReceivedFloat: BigSource,\n sourceChainToken: TokenWithChainDetails,\n destinationChainToken: TokenWithChainDetails,\n messenger: Messenger\n ): Promise<AmountsAndGasFeeOptions> {\n return this.service.getAmountToSendAndGasFeeOptions(\n amountToBeReceivedFloat,\n sourceChainToken,\n destinationChainToken,\n messenger\n );\n }\n\n /**\n * Calculates the amount of tokens to be received as a result of transfer through a legacy messenger.\n * @param amountToSendFloat the amount of tokens that will be sent\n * @param sourceChainToken selected token on the source chain\n * @param destinationChainToken selected token on the destination chain\n * @param messenger {@link LegacyMessenger}\n * @deprecated Do not use.\n */\n getAmountToBeReceived(\n amountToSendFloat: BigSource,\n sourceChainToken: TokenWithChainDetails,\n destinationChainToken: TokenWithChainDetails,\n messenger: LegacyMessenger\n ): Promise<string>;\n /**\n * Calculates the amount of tokens to be received as a result of transfer\n * after applying the fee of the selected messenger.\n * For {@link Messenger.NEAR_INTENTS} the amount is the `amountOut` of an `EXACT_INPUT` quote: live (the Core API\n * waits for NEAR Intents solvers, about 3 s) or estimated from recent quotes on the route;\n * see {@link NearIntentsService.getQuote} for `minAmountOut` and `estimated`.\n * @param amountToSendFloat the amount of tokens that will be sent\n * @param sourceChainToken selected token on the source chain\n * @param destinationChainToken selected token on the destination chain\n * @param messenger selected messenger, see {@link ActiveMessenger}\n * @throws CCTPDoesNotSupportedError, OFTDoesNotSupportedError, NearIntentsDoesNotSupportedError or SdkError if the route is not supported by the messenger;\n * NearIntentsAmountTooLowError, NearIntentsNoLiquidityError or NearIntentsQuoteError if NEAR Intents has no quote\n */\n getAmountToBeReceived(\n amountToSendFloat: BigSource,\n sourceChainToken: TokenWithChainDetails,\n destinationChainToken: TokenWithChainDetails,\n messenger: ActiveMessenger\n ): Promise<string>;\n async getAmountToBeReceived(\n amountToSendFloat: BigSource,\n sourceChainToken: TokenWithChainDetails,\n destinationChainToken: TokenWithChainDetails,\n /**\n * The Messengers for different routes.\n */\n messenger: Messenger\n ): Promise<string> {\n return this.service.getAmountToBeReceived(amountToSendFloat, sourceChainToken, destinationChainToken, messenger);\n }\n\n /**\n * Calculates the amount of tokens to be received as a result of transfer based on actual blockchain pool state.\n * @param amountToSendFloat the amount of tokens that will be sent\n * @param sourceChainToken selected token on the source chain\n * @param destinationChainToken selected token on the destination chain\n * @param messenger selected messenger\n * @param sourceProvider Optional. source chain Provider\n * @param destinationProvider Optional. destination chain Provider\n * @deprecated Do not use.\n */\n getAmountToBeReceivedFromChain(\n amountToSendFloat: BigSource,\n sourceChainToken: TokenWithChainDetails,\n destinationChainToken: TokenWithChainDetails,\n messenger: Messenger,\n sourceProvider?: Provider,\n destinationProvider?: Provider\n ): Promise<string>;\n async getAmountToBeReceivedFromChain(\n amountToSendFloat: BigSource,\n sourceChainToken: TokenWithChainDetails,\n destinationChainToken: TokenWithChainDetails,\n /**\n * The Messengers for different routes.\n */\n messenger: Messenger,\n sourceProvider?: Provider,\n destinationProvider?: Provider\n ): Promise<string> {\n return this.service.getAmountToBeReceivedFromChain(\n amountToSendFloat,\n sourceChainToken,\n destinationChainToken,\n messenger,\n sourceProvider,\n destinationProvider\n );\n }\n\n /**\n * Calculates the amount of tokens to be received as a result of transfer based on passed pool state.\n * @param amountToSendFloat the amount of tokens that will be sent\n * @param sourceChainToken selected token on the source chain\n * @param destinationChainToken selected token on the destination chain\n * @param sourcePool source token pool state\n * @param destinationPool destination token pool state\n * @param messenger selected messenger\n * @deprecated Do not use.\n */\n getAmountToBeReceivedFromPools(\n amountToSendFloat: BigSource,\n sourceChainToken: TokenWithChainDetails,\n destinationChainToken: TokenWithChainDetails,\n sourcePool: PoolInfo,\n destinationPool: PoolInfo,\n messenger: Exclude<Messenger, Messenger.OFT | Messenger.NEAR_INTENTS>\n ): string;\n getAmountToBeReceivedFromPools(\n amountToSendFloat: BigSource,\n sourceChainToken: TokenWithChainDetails,\n destinationChainToken: TokenWithChainDetails,\n sourcePool: PoolInfo,\n destinationPool: PoolInfo,\n messenger: Exclude<Messenger, Messenger.OFT | Messenger.NEAR_INTENTS>\n ): string {\n switch (messenger) {\n case Messenger.ALLBRIDGE:\n case Messenger.WORMHOLE:\n return this.service.getAmountToBeReceivedComputeWithPools(\n amountToSendFloat,\n sourceChainToken,\n destinationChainToken,\n sourcePool,\n destinationPool\n );\n case Messenger.CCTP:\n case Messenger.CCTP_V2:\n return this.service.getAmountToBeReceivedComputeCctp(\n amountToSendFloat,\n sourceChainToken,\n destinationChainToken,\n messenger\n );\n case Messenger.X_RESERVE:\n return this.service.getAmountToBeReceivedComputeXReserve(\n amountToSendFloat,\n sourceChainToken,\n destinationChainToken\n );\n }\n }\n\n /**\n * Calculates the amount of tokens to send based on requested tokens amount be received as a result of transfer through a legacy messenger.\n * @param amountToBeReceivedFloat the amount of tokens that should be received\n * @param sourceChainToken selected token on the source chain\n * @param destinationChainToken selected token on the destination chain\n * @param messenger {@link LegacyMessenger}\n * @deprecated Do not use.\n */\n getAmountToSend(\n amountToBeReceivedFloat: BigSource,\n sourceChainToken: TokenWithChainDetails,\n destinationChainToken: TokenWithChainDetails,\n messenger: LegacyMessenger\n ): Promise<string>;\n /**\n * Calculates the amount of tokens to send based on requested tokens amount be received as a result of transfer\n * after applying the fee of the selected messenger.\n * For {@link Messenger.NEAR_INTENTS} the amount is the `amountIn` of an `EXACT_OUTPUT` quote: live (the Core API\n * waits for NEAR Intents solvers, about 3 s) or estimated from recent quotes on the route;\n * see {@link NearIntentsService.getQuote} for `estimated`.\n * @param amountToBeReceivedFloat the amount of tokens that should be received\n * @param sourceChainToken selected token on the source chain\n * @param destinationChainToken selected token on the destination chain\n * @param messenger selected messenger, see {@link ActiveMessenger}\n * @throws CCTPDoesNotSupportedError, OFTDoesNotSupportedError, NearIntentsDoesNotSupportedError or SdkError if the route is not supported by the messenger;\n * NearIntentsAmountTooLowError, NearIntentsNoLiquidityError or NearIntentsQuoteError if NEAR Intents has no quote\n */\n getAmountToSend(\n amountToBeReceivedFloat: BigSource,\n sourceChainToken: TokenWithChainDetails,\n destinationChainToken: TokenWithChainDetails,\n messenger: ActiveMessenger\n ): Promise<string>;\n async getAmountToSend(\n amountToBeReceivedFloat: BigSource,\n sourceChainToken: TokenWithChainDetails,\n destinationChainToken: TokenWithChainDetails,\n /**\n * The Messengers for different routes.\n */\n messenger: Messenger\n ): Promise<string> {\n return this.service.getAmountToSend(amountToBeReceivedFloat, sourceChainToken, destinationChainToken, messenger);\n }\n\n /**\n * 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.\n * @param amountToBeReceivedFloat the amount of tokens that should be received\n * @param sourceChainToken selected token on the source chain\n * @param destinationChainToken selected token on the destination chain\n * @param messenger selected messenger\n * @param sourceProvider Optional. source chain Provider\n * @param destinationProvider Optional. destination chain Provider\n * @deprecated Do not use.\n */\n getAmountToSendFromChain(\n amountToBeReceivedFloat: BigSource,\n sourceChainToken: TokenWithChainDetails,\n destinationChainToken: TokenWithChainDetails,\n messenger: Messenger,\n sourceProvider?: Provider,\n destinationProvider?: Provider\n ): Promise<string>;\n async getAmountToSendFromChain(\n amountToBeReceivedFloat: BigSource,\n sourceChainToken: TokenWithChainDetails,\n destinationChainToken: TokenWithChainDetails,\n /**\n * The Messengers for different routes.\n */\n messenger: Messenger,\n sourceProvider?: Provider,\n destinationProvider?: Provider\n ): Promise<string> {\n return this.service.getAmountToSendFromChain(\n amountToBeReceivedFloat,\n sourceChainToken,\n destinationChainToken,\n messenger,\n sourceProvider,\n destinationProvider\n );\n }\n\n /**\n * Calculates the amount of tokens to send based on requested tokens amount be received as a result of transfer based on passed pool state.\n * @param amountToBeReceivedFloat the amount of tokens that should be received\n * @param sourceChainToken selected token on the source chain\n * @param destinationChainToken selected token on the destination chain\n * @param sourcePool source token pool state\n * @param destinationPool destination token pool state\n * @param messenger selected messenger\n * @deprecated Do not use.\n */\n getAmountToSendFromPools(\n amountToBeReceivedFloat: BigSource,\n sourceChainToken: TokenWithChainDetails,\n destinationChainToken: TokenWithChainDetails,\n sourcePool: PoolInfo,\n destinationPool: PoolInfo,\n messenger: Exclude<Messenger, Messenger.OFT | Messenger.NEAR_INTENTS>\n ): string;\n getAmountToSendFromPools(\n amountToBeReceivedFloat: BigSource,\n sourceChainToken: TokenWithChainDetails,\n destinationChainToken: TokenWithChainDetails,\n sourcePool: PoolInfo,\n destinationPool: PoolInfo,\n messenger: Exclude<Messenger, Messenger.OFT | Messenger.NEAR_INTENTS>\n ): string {\n switch (messenger) {\n case Messenger.ALLBRIDGE:\n case Messenger.WORMHOLE:\n return this.service.getAmountToSendComputeWithPools(\n amountToBeReceivedFloat,\n sourceChainToken,\n destinationChainToken,\n sourcePool,\n destinationPool\n );\n case Messenger.CCTP:\n case Messenger.CCTP_V2:\n return this.service.getAmountToSendComputeCctp(\n amountToBeReceivedFloat,\n sourceChainToken,\n destinationChainToken,\n messenger\n );\n case Messenger.X_RESERVE:\n return this.service.getAmountToSendComputeXReserve(\n amountToBeReceivedFloat,\n sourceChainToken,\n destinationChainToken\n );\n }\n }\n\n /**\n * Fetches possible ways to pay the transfer gas fee.\n * @param sourceChainToken selected token on the source chain\n * @param destinationChainToken selected token on the destination chain\n * @param messenger selected messenger, see {@link ActiveMessenger}\n * @returns {@link GasFeeOptions}; for {@link Messenger.NEAR_INTENTS} only a zero native fee (the protocol fee is inside the quote)\n */\n async getGasFeeOptions(\n sourceChainToken: TokenWithChainDetails,\n destinationChainToken: TokenWithChainDetails,\n messenger: Messenger\n ): Promise<GasFeeOptions> {\n return this.service.getGasFeeOptions(sourceChainToken, destinationChainToken, messenger);\n }\n\n /**\n * Gets the average time in ms to complete a transfer for given tokens and messenger.\n * @param sourceChainToken selected token on the source chain.\n * @param destinationChainToken selected token on the destination chain.\n * @param messenger selected messenger, see {@link ActiveMessenger}\n * @returns Average transfer time in milliseconds or null if a given combination of tokens and messenger is not supported.\n */\n getAverageTransferTime(\n sourceChainToken: TokenWithChainDetails,\n destinationChainToken: TokenWithChainDetails,\n messenger: Messenger\n ): number | null {\n return this.service.getAverageTransferTime(sourceChainToken, destinationChainToken, messenger);\n }\n\n /**\n * Gets information about the poolInfo by token\n * @deprecated Do not use.\n * @param token\n * @returns poolInfo\n */\n async getPoolInfoByToken(token: TokenWithChainDetails): Promise<PoolInfo> {\n return this.service.getPoolInfoByToken(token);\n }\n\n /**\n * Forces refresh of cached information about the state of liquidity pools.\n * Outdated cache leads to calculated amounts being less accurate.\n * The cache is invalidated at regular intervals, but it can be forced to be refreshed by calling this method.+\n *\n * @deprecated Do not use.\n * @param tokens if present, the corresponding liquidity pools will be updated\n */\n async refreshPoolInfo(tokens?: TokenWithChainDetails | TokenWithChainDetails[]): Promise<void> {\n return this.service.refreshPoolInfo(tokens);\n }\n\n /**\n * Convert APR to percentage view\n * @deprecated Do not use.\n * @param apr\n * @returns aprPercentageView\n */\n aprInPercents(apr: string): string {\n return this.service.aprInPercents(apr);\n }\n\n /**\n * Get possible limit of extra gas amount for a legacy messenger.\n * @param sourceChainToken selected token on the source chain\n * @param destinationChainToken selected token on the destination chain\n * @param messenger {@link LegacyMessenger}\n * @deprecated Do not use.\n */\n getExtraGasMaxLimits(\n sourceChainToken: TokenWithChainDetails,\n destinationChainToken: TokenWithChainDetails,\n messenger: LegacyMessenger\n ): Promise<ExtraGasMaxLimitResponse>;\n /**\n * Get possible limit of extra gas amount.\n * For {@link Messenger.X_RESERVE} and {@link Messenger.NEAR_INTENTS} extra gas is not supported and zero limits are returned.\n * @param sourceChainToken selected token on the source chain\n * @param destinationChainToken selected token on the destination chain\n * @param messenger selected messenger, see {@link ActiveMessenger}\n * @returns {@link ExtraGasMaxLimitResponse}\n */\n getExtraGasMaxLimits(\n sourceChainToken: TokenWithChainDetails,\n destinationChainToken: TokenWithChainDetails,\n messenger: ActiveMessenger\n ): Promise<ExtraGasMaxLimitResponse>;\n async getExtraGasMaxLimits(\n sourceChainToken: TokenWithChainDetails,\n destinationChainToken: TokenWithChainDetails,\n messenger: Messenger\n ): Promise<ExtraGasMaxLimitResponse> {\n return this.service.getExtraGasMaxLimits(sourceChainToken, destinationChainToken, messenger);\n }\n\n /**\n * @deprecated Do not use.\n * @param amount - amount\n * @param amountFormat - AmountFormat\n * @param sourceToken - selected token on the source chain\n * @return virtual amount\n */\n async getVUsdFromAmount(\n amount: string,\n amountFormat: AmountFormat,\n sourceToken: TokenWithChainDetails\n ): Promise<AmountFormatted> {\n return this.service.getVUsdFromAmount(amount, amountFormat, sourceToken);\n }\n\n /**\n * @deprecated Do not use.\n * @param vUsdAmount - amount of vUsd, int format\n * @param destToken selected token on the destination chain\n * @return amount of destToken\n */\n async getAmountFromVUsd(vUsdAmount: string, destToken: TokenWithChainDetails): Promise<AmountFormatted> {\n return this.service.getAmountFromVUsd(vUsdAmount, destToken);\n }\n\n /**\n * @deprecated Do not use.\n * @param amountInTokenPrecision\n * @param sourceToken\n * @param destToken\n */\n async swapAndBridgeFeeCalculation(\n amountInTokenPrecision: string,\n sourceToken: TokenWithChainDetails,\n destToken: TokenWithChainDetails\n ): Promise<SwapAndBridgeCalculationData> {\n return this.service.swapAndBridgeFeeCalculation(amountInTokenPrecision, sourceToken, destToken);\n }\n\n /**\n * @deprecated Do not use.\n * @param amountInTokenPrecision\n * @param sourceToken\n * @param destToken\n */\n async swapAndBridgeFeeCalculationReverse(\n amountInTokenPrecision: string,\n sourceToken: TokenWithChainDetails,\n destToken: TokenWithChainDetails\n ): Promise<SwapAndBridgeCalculationData> {\n return this.service.swapAndBridgeFeeCalculationReverse(amountInTokenPrecision, sourceToken, destToken);\n }\n\n /**\n * Show amount changes (fee and amount adjustment) during send through pools on source and destination chains\n * @deprecated Do not use.\n */\n async getSendAmountDetails(\n amount: string,\n amountFormat: AmountFormat,\n sourceToken: TokenWithChainDetails,\n destToken: TokenWithChainDetails\n ): Promise<SendAmountDetails> {\n return this.service.getSendAmountDetails(amount, amountFormat, sourceToken, destToken);\n }\n}\n"]}
|
|
@@ -2,8 +2,10 @@ export { ApproveParams as BridgeApproveParams, BaseSendParams, CheckAllowancePar
|
|
|
2
2
|
export { BridgeService } from "../services/bridge/index";
|
|
3
3
|
export { CctpParams, CctpDomains } from "../services/bridge/sol";
|
|
4
4
|
export { LiquidityPoolService } from "../services/liquidity-pool/index";
|
|
5
|
-
export { ActiveMessenger, LegacyMessenger, Messenger, TransferStatusResponse, BridgeTransaction, GasBalanceResponse, CheckAddressResponse, AddressStatus, } from "../client/core-api/core-api.model";
|
|
5
|
+
export { ActiveMessenger, LegacyMessenger, Messenger, NearIntentsSwapType, TransferStatusResponse, BridgeTransaction, GasBalanceResponse, CheckAddressResponse, AddressStatus, } from "../client/core-api/core-api.model";
|
|
6
6
|
export { RawBridgeTransactionBuilder } from "../services/bridge/raw-bridge-transaction-builder";
|
|
7
|
+
export { NearIntentsService } from "../services/near-intents/index";
|
|
8
|
+
export { NearIntentsQuoteParams, NearIntentsQuote, NearIntentsCreateDepositParams, NearIntentsDeposit, NearIntentsSubmitDepositParams, NearIntentsSendParams, NearIntentsSendTransaction, } from "../services/near-intents/models";
|
|
7
9
|
export { RawPoolTransactionBuilder } from "../services/liquidity-pool/raw-pool-transaction-builder";
|
|
8
10
|
export { UserBalanceInfo, UserBalanceInfoDTO, LiquidityPoolsParams, LiquidityPoolsParamsWithAmount, ApproveParams as LiquidityPoolsApproveParams, CheckAllowanceParams as LiquidityPoolsCheckAllowanceParams, GetAllowanceParams as LiquidityPoolsGetAllowanceParams, } from "../services/liquidity-pool/models/pool.model";
|
|
9
11
|
export * from "../services/models/index";
|
|
@@ -13,7 +15,7 @@ export { TokenWithChainDetailsYield, CYDToken, YieldGetAllowanceParams, YieldChe
|
|
|
13
15
|
export { RawYieldTransactionBuilder } from "../services/yield/raw-yield-transaction-builder";
|
|
14
16
|
export { SwapAndBridgeCalculationData, SwapFromVUsdCalcResult, SwapToVUsdCalcResult, } from "../utils/calculation/swap-and-bridge-fee-calc";
|
|
15
17
|
export { SendAmountDetails, AmountImpact } from "../utils/calculation/swap-and-bridge-details";
|
|
16
|
-
export { AbrPayerAvailability, AbrPayerChainInfo, PoolInfo, TokenCoreFields, XReserveTokenInfo, TokenWithChainDetails, TransferTime, TxCostAmount, SuiAddresses, MessengerTransferTime, ChainDetailsMap, ChainDetailsWithTokens, } from "../tokens-info";
|
|
18
|
+
export { AbrPayerAvailability, AbrPayerChainInfo, PoolInfo, TokenCoreFields, XReserveTokenInfo, NearIntentsTokenInfo, TokenWithChainDetails, TransferTime, TxCostAmount, SuiAddresses, MessengerTransferTime, ChainDetailsMap, ChainDetailsWithTokens, } from "../tokens-info";
|
|
17
19
|
export { Utils } from "../utils";
|
|
18
20
|
export { SrbUtils, TrustLineParams } from "../utils/srb";
|
|
19
21
|
export { SolUtils } from "../utils/sol";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/models/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAGL,SAAS,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/models/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAGL,SAAS,EAMT,aAAa,GACd,MAAM,mCAAmC,CAAC;AAsB3C,cAAc,0BAA0B,CAAC;AAEzC,OAAO,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAuCzF,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAG/D,MAAM,CAAN,IAAY,gBAeX;AAfD,WAAY,gBAAgB;IAC1B;;OAEG;IACH,mDAA+B,CAAA;IAE/B;;OAEG;IACH,kDAA8B,CAAA;IAE9B;;OAEG;IACH,oCAAgB,CAAA;AAClB,CAAC,EAfW,gBAAgB,KAAhB,gBAAgB,QAe3B;AAwCD;;;;GAIG;AACH,MAAM,CAAN,IAAY,YASX;AATD,WAAY,YAAY;IACtB;;OAEG;IACH,2BAAW,CAAA;IACX;;OAEG;IACH,+BAAe,CAAA;AACjB,CAAC,EATW,YAAY,KAAZ,YAAY,QASvB","sourcesContent":["export {\n ApproveParams as BridgeApproveParams,\n BaseSendParams,\n CheckAllowanceParams,\n GetAllowanceParams,\n GetTokenBalanceParams,\n SendParams,\n SwapParams,\n GetNativeTokenBalanceParams,\n} from \"../services/bridge/models/bridge.model\";\nexport { BridgeService } from \"../services/bridge/index\";\nexport { CctpParams, CctpDomains } from \"../services/bridge/sol\";\nexport { LiquidityPoolService } from \"../services/liquidity-pool/index\";\nexport {\n ActiveMessenger,\n LegacyMessenger,\n Messenger,\n NearIntentsSwapType,\n TransferStatusResponse,\n BridgeTransaction,\n GasBalanceResponse,\n CheckAddressResponse,\n AddressStatus,\n} from \"../client/core-api/core-api.model\";\nexport { RawBridgeTransactionBuilder } from \"../services/bridge/raw-bridge-transaction-builder\";\nexport { NearIntentsService } from \"../services/near-intents/index\";\nexport {\n NearIntentsQuoteParams,\n NearIntentsQuote,\n NearIntentsCreateDepositParams,\n NearIntentsDeposit,\n NearIntentsSubmitDepositParams,\n NearIntentsSendParams,\n NearIntentsSendTransaction,\n} from \"../services/near-intents/models\";\nexport { RawPoolTransactionBuilder } from \"../services/liquidity-pool/raw-pool-transaction-builder\";\nexport {\n UserBalanceInfo,\n UserBalanceInfoDTO,\n LiquidityPoolsParams,\n LiquidityPoolsParamsWithAmount,\n ApproveParams as LiquidityPoolsApproveParams,\n CheckAllowanceParams as LiquidityPoolsCheckAllowanceParams,\n GetAllowanceParams as LiquidityPoolsGetAllowanceParams,\n} from \"../services/liquidity-pool/models/pool.model\";\nexport * from \"../services/models/index\";\nexport { YieldService } from \"../services/yield/index\";\nexport { assertYieldIsSupported, isYieldSupported } from \"../services/yield/validations\";\nexport {\n TokenWithChainDetailsYield,\n CYDToken,\n YieldGetAllowanceParams,\n YieldCheckAllowanceParams,\n YieldBalanceParams,\n YieldGetEstimatedAmountOnDepositParams,\n YieldGetWithdrawProportionAmountParams,\n YieldWithdrawAmount,\n YieldApproveParams,\n YieldDepositParams,\n YieldWithdrawParams,\n} from \"../services/yield/models/yield.model\";\nexport { RawYieldTransactionBuilder } from \"../services/yield/raw-yield-transaction-builder\";\nexport {\n SwapAndBridgeCalculationData,\n SwapFromVUsdCalcResult,\n SwapToVUsdCalcResult,\n} from \"../utils/calculation/swap-and-bridge-fee-calc\";\nexport { SendAmountDetails, AmountImpact } from \"../utils/calculation/swap-and-bridge-details\";\nexport {\n AbrPayerAvailability,\n AbrPayerChainInfo,\n PoolInfo,\n TokenCoreFields,\n XReserveTokenInfo,\n NearIntentsTokenInfo,\n TokenWithChainDetails,\n TransferTime,\n TxCostAmount,\n SuiAddresses,\n MessengerTransferTime,\n ChainDetailsMap,\n ChainDetailsWithTokens,\n} from \"../tokens-info\";\nexport { Utils } from \"../utils\";\nexport { SrbUtils, TrustLineParams } from \"../utils/srb\";\nexport { SolUtils } from \"../utils/sol\";\nexport * from \"../exceptions\";\nexport { ChainSymbol, ChainType } from \"../chains/chain.enums\";\nexport { AdditionalBasicChainProperties, BasicChainProperties } from \"../chains/models\";\n\nexport enum FeePaymentMethod {\n /**\n * The fee is paid in the native currency of the source chain.\n */\n WITH_NATIVE_CURRENCY = \"native\",\n\n /**\n * The fee is paid with the stablecoin token.\n */\n WITH_STABLECOIN = \"stablecoin\",\n\n /**\n * The fee is paid with the ABR token.\n */\n WITH_ABR = \"abr\",\n}\n\n/**\n * @deprecated Do not use.\n */\nexport interface AmountsAndGasFeeOptions {\n /**\n * The floating point amount of tokens to be sent (not including gas fee).\n */\n amountToSendFloat: string;\n\n /**\n * The floating point amount of tokens to be received.\n */\n amountToBeReceivedFloat: string;\n\n /**\n * Available ways to pay the transfer gas fee and gas fee amount.\n */\n gasFeeOptions: GasFeeOptions;\n}\n\ntype GasFeeOptionsType = {\n [key in FeePaymentMethod]?: AmountFormatted;\n};\n\n/**\n * Describes available options of paying the gas fee and the amount to pay when using the corresponding method.\n *\n * For {@link FeePaymentMethod.WITH_NATIVE_CURRENCY} value contains the amount in the smallest denomination of the source chain currency\n *\n * For {@link FeePaymentMethod.WITH_STABLECOIN} value contains the amount in the smallest denomination of the source token\n */\nexport interface GasFeeOptions extends GasFeeOptionsType {\n [FeePaymentMethod.WITH_NATIVE_CURRENCY]: AmountFormatted;\n [FeePaymentMethod.WITH_STABLECOIN]?: AmountFormatted;\n [FeePaymentMethod.WITH_ABR]?: AmountFormatted;\n adminFeeShareWithExtras?: string;\n}\n\n/**\n * Define the type of amount data<p/>\n * Example:<p/>\n * \"1500000\" USDC {@link AmountFormat.INT} = \"1.5\" USDC {@link AmountFormat.FLOAT}, if USDC.decimals = 6\n */\nexport enum AmountFormat {\n /**\n * denominated in the smallest unit of the source token\n */\n INT = \"int\",\n /**\n * denominated in the unit of the source token\n */\n FLOAT = \"float\",\n}\n\n/**\n * Describes the same amount in two variation formats.\n *\n * For {@link AmountFormat.INT} value contains the amount in the smallest denomination\n *\n * For {@link AmountFormat.FLOAT} value contains the amount in tokens denomination\n */\nexport type AmountFormatted = {\n [key in AmountFormat]: string;\n};\n\n/**\n * Describes MAX extra gas value can to be passed when using the corresponding method.\n *\n * For {@link FeePaymentMethod.WITH_NATIVE_CURRENCY} value contains {@link ExtraGasMaxLimit} the amount of the source chain currency\n *\n * For {@link FeePaymentMethod.WITH_STABLECOIN} value contains {@link ExtraGasMaxLimit} the amount of the source token\n */\nexport type ExtraGasMaxLimits = {\n [key in FeePaymentMethod]?: ExtraGasMaxLimit;\n};\n\n/**\n * Describes the same MAX extra gas amount.\n */\nexport type ExtraGasMaxLimit = AmountFormatted;\n\n/**\n * Provide extra gas information\n */\nexport interface ExtraGasMaxLimitResponse {\n /**\n * See {@link ExtraGasMaxLimits}\n */\n extraGasMax: ExtraGasMaxLimits;\n /**\n * Information due to destination chain\n */\n destinationChain: {\n /**\n * gasAmountMax maximum amount you can receive as extra gas on dest chain\n */\n gasAmountMax: ExtraGasMaxLimit;\n /**\n * cost of swap tx on chain\n */\n swap: AmountFormatted;\n /**\n * cost of send tx on chain\n */\n transfer: AmountFormatted;\n };\n /**\n * Exchange rate\n */\n exchangeRate: string;\n /**\n * Exchange rate\n */\n abrExchangeRate?: string;\n /**\n * Source native token price\n */\n sourceNativeTokenPrice: string;\n}\n\n/**\n * Provide pending status information\n * @deprecated Do not use.\n */\nexport interface PendingStatusInfoResponse {\n /**\n * Number of pending transactions\n */\n pendingTxs: number;\n /**\n * Total amount of pending transactions\n */\n pendingAmount: AmountFormatted;\n /**\n * The amount of tokens can be received as a result of transfer considering pending transactions\n */\n estimatedAmount: { min: AmountFormatted; max: AmountFormatted };\n}\n"]}
|
|
@@ -2,7 +2,7 @@ import { AlgorandClient } from "@algorandfoundation/algokit-utils";
|
|
|
2
2
|
import { ChainType } from "../../../chains/chain.enums";
|
|
3
3
|
import { AllbridgeCoreClient } from "../../../client/core-api/core-client-base";
|
|
4
4
|
import { RawTransaction, TransactionResponse } from "../../models";
|
|
5
|
-
import { ChainBridgeService, SendParams, SwapParams } from "../models";
|
|
5
|
+
import { ChainBridgeService, SendParams, SwapParams, TxTransferParams } from "../models";
|
|
6
6
|
export declare class AlgBridgeService extends ChainBridgeService {
|
|
7
7
|
algorand: AlgorandClient;
|
|
8
8
|
api: AllbridgeCoreClient;
|
|
@@ -10,6 +10,10 @@ export declare class AlgBridgeService extends ChainBridgeService {
|
|
|
10
10
|
constructor(algorand: AlgorandClient, api: AllbridgeCoreClient);
|
|
11
11
|
send(_params: SendParams): Promise<TransactionResponse>;
|
|
12
12
|
buildRawTransactionSend(params: SendParams): Promise<RawTransaction>;
|
|
13
|
+
/**
|
|
14
|
+
* NEAR Intents deposit transfers are not supported from this chain yet.
|
|
15
|
+
*/
|
|
16
|
+
buildRawTransactionTransfer(params: TxTransferParams): Promise<RawTransaction>;
|
|
13
17
|
/** @deprecated Do not use. */
|
|
14
18
|
buildRawTransactionSwap(params: SwapParams): Promise<RawTransaction>;
|
|
15
19
|
private getBridge;
|
|
@@ -7,6 +7,7 @@ import { FeePaymentMethod } from "../../../models";
|
|
|
7
7
|
import { assertNever } from "../../../utils/utils";
|
|
8
8
|
import { BridgeClient } from "../../models/alg/BridgeClient";
|
|
9
9
|
import { PaddingUtilClient } from "../../models/alg/PaddingUtilClient";
|
|
10
|
+
import { nearIntentsChainNotSupportedError } from "../../near-intents/utils";
|
|
10
11
|
import { checkAssetOptIn, feeForInner, populateAndEncodeTxs } from "../../utils/alg";
|
|
11
12
|
import { ChainBridgeService } from "../models";
|
|
12
13
|
import { getNonce, prepareTxSendParams, prepareTxSwapParams } from "../utils";
|
|
@@ -113,6 +114,12 @@ export class AlgBridgeService extends ChainBridgeService {
|
|
|
113
114
|
const { transactions } = await composer.buildTransactions();
|
|
114
115
|
return populateAndEncodeTxs(transactions, sender, this.algorand.client.algod);
|
|
115
116
|
}
|
|
117
|
+
/**
|
|
118
|
+
* NEAR Intents deposit transfers are not supported from this chain yet.
|
|
119
|
+
*/
|
|
120
|
+
buildRawTransactionTransfer(params) {
|
|
121
|
+
return Promise.reject(nearIntentsChainNotSupportedError(params.token.chainSymbol));
|
|
122
|
+
}
|
|
116
123
|
/** @deprecated Do not use. */
|
|
117
124
|
async buildRawTransactionSwap(params) {
|
|
118
125
|
const txSwapParams = prepareTxSwapParams(this.chainType, params);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/services/bridge/alg/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,iDAAiD,CAAC;AACjF,OAAO,EAAE,UAAU,EAAE,MAAM,gDAAgD,CAAC;AAC5E,OAAO,OAAO,EAAE,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAExD,OAAO,EAAE,uBAAuB,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACrF,OAAO,EAAE,kBAAkB,EAA0B,MAAM,WAAW,CAAC;AACvE,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAA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C;QAC5D,OAAO,oBAAoB,CAAC,YAAY,EAAE,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAChF,CAAC;IAEO,SAAS,CAAC,KAAa;QAC7B,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,qBAAqB,CAAC,YAAY,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IAC7E,CAAC;IAEO,cAAc,CAAC,KAAa;QAClC,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,qBAAqB,CAAC,iBAAiB,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IAClF,CAAC;CACF","sourcesContent":["import { AlgorandClient } from \"@algorandfoundation/algokit-utils\";\nimport { SigningAccount } from \"@algorandfoundation/algokit-utils/types/account\";\nimport { AlgoAmount } from \"@algorandfoundation/algokit-utils/types/amount\";\nimport algosdk, { Address } from \"algosdk\";\nimport { ChainType } from \"../../../chains/chain.enums\";\nimport { AllbridgeCoreClient } from \"../../../client/core-api/core-client-base\";\nimport { MethodNotSupportedError, SdkError } from \"../../../exceptions\";\nimport { FeePaymentMethod } from \"../../../models\";\nimport { assertNever } from \"../../../utils/utils\";\nimport { RawTransaction, TransactionResponse } from \"../../models\";\nimport { BridgeClient } from \"../../models/alg/BridgeClient\";\nimport { PaddingUtilClient } from \"../../models/alg/PaddingUtilClient\";\nimport { checkAssetOptIn, feeForInner, populateAndEncodeTxs } from \"../../utils/alg\";\nimport { ChainBridgeService, SendParams, SwapParams } from \"../models\";\nimport { getNonce, prepareTxSendParams, prepareTxSwapParams } from \"../utils\";\n\nexport class AlgBridgeService extends ChainBridgeService {\n chainType: ChainType.ALG = ChainType.ALG;\n\n constructor(\n public algorand: AlgorandClient,\n public api: AllbridgeCoreClient\n ) {\n super();\n const randomAccount = algosdk.generateAccount();\n const signer = new SigningAccount(randomAccount, randomAccount.addr);\n algorand.setDefaultSigner(signer);\n algorand.setDefaultValidityWindow(100);\n }\n\n send(_params: SendParams): Promise<TransactionResponse> {\n throw new MethodNotSupportedError();\n }\n\n async buildRawTransactionSend(params: SendParams): Promise<RawTransaction> {\n const txSendParams = await prepareTxSendParams(this.chainType, params, this.api);\n\n if (!params.sourceToken.bridgeId) {\n throw new SdkError(\"ALG sourceToken must contain 'bridgeId'\");\n }\n if (!params.sourceToken.paddingUtilId) {\n throw new SdkError(\"ALG sourceToken must contain 'paddingUtilId'\");\n }\n const bridgeId = BigInt(params.sourceToken.bridgeId);\n const bridge = this.getBridge(bridgeId);\n const paddingUtilId = BigInt(params.sourceToken.paddingUtilId);\n const paddingUtil = this.getPaddingUtil(paddingUtilId);\n const sender = Address.fromString(params.fromAccountAddress);\n const tokenId = BigInt(params.sourceToken.tokenAddress);\n const destinationChainId = txSendParams.toChainId;\n const recipient = txSendParams.toAccountAddress;\n const receiveToken = txSendParams.toTokenAddress;\n const nonce = getNonce();\n const amount = BigInt(txSendParams.amount);\n\n let totalFee = BigInt(txSendParams.fee);\n if (txSendParams.extraGas) {\n totalFee = totalFee + BigInt(txSendParams.extraGas);\n }\n\n const composer = this.algorand.newGroup();\n\n const assetTransferTx = await this.algorand.createTransaction.assetTransfer({\n amount,\n assetId: tokenId,\n receiver: bridge.appAddress,\n sender,\n });\n\n switch (txSendParams.gasFeePaymentMethod) {\n case FeePaymentMethod.WITH_NATIVE_CURRENCY: {\n const paymentTx = await this.algorand.createTransaction.payment({\n amount: AlgoAmount.MicroAlgo(totalFee),\n receiver: bridge.appAddress,\n sender,\n });\n composer.addAppCallMethodCall(\n await bridge.params.swapAndBridge({\n args: {\n paymentRef: paymentTx,\n assetTransferRef: assetTransferTx,\n recipient,\n destinationChainId,\n receiveToken,\n nonce,\n },\n sender,\n extraFee: feeForInner(8),\n })\n );\n break;\n }\n case FeePaymentMethod.WITH_STABLECOIN: {\n composer.addAppCallMethodCall(\n await bridge.params.swapAndBridgeWithStable({\n args: {\n assetTransferRef: assetTransferTx,\n recipient,\n destinationChainId,\n receiveToken,\n nonce,\n feeTokenAmount: totalFee,\n },\n sender,\n extraFee: feeForInner(9),\n })\n );\n break;\n }\n case FeePaymentMethod.WITH_ABR:\n throw new SdkError(\"ALG bridge does not support ABR payment method\");\n default: {\n return assertNever(txSendParams.gasFeePaymentMethod, \"Unhandled FeePaymentMethod\");\n }\n }\n const paddingTx1 = await this.algorand.createTransaction.appCall({\n appId: paddingUtil.appId,\n sender,\n note: \"padding1\",\n });\n composer.addTransaction(paddingTx1);\n const paddingTx2 = await this.algorand.createTransaction.appCall({\n appId: paddingUtil.appId,\n sender,\n note: \"padding2\",\n });\n composer.addTransaction(paddingTx2);\n\n const { transactions } = await composer.buildTransactions();\n return populateAndEncodeTxs(transactions, sender, this.algorand.client.algod);\n }\n\n /** @deprecated Do not use. */\n async buildRawTransactionSwap(params: SwapParams): Promise<RawTransaction> {\n const txSwapParams = prepareTxSwapParams(this.chainType, params);\n\n const sender = Address.fromString(params.fromAccountAddress);\n const recipient = params.toAccountAddress;\n const tokenId = BigInt(params.sourceToken.tokenAddress);\n const receiveTokenId = BigInt(params.destinationToken.tokenAddress);\n const receiveAmountMin = BigInt(txSwapParams.minimumReceiveAmount);\n const amount = BigInt(txSwapParams.amount);\n\n if (!params.sourceToken.bridgeId) {\n throw new SdkError(\"ALG sourceToken must contain 'bridgeId'\");\n }\n if (!params.sourceToken.paddingUtilId) {\n throw new SdkError(\"ALG sourceToken must contain 'paddingUtilId'\");\n }\n const bridgeId = BigInt(params.sourceToken.bridgeId);\n const bridge = this.getBridge(bridgeId);\n const paddingUtilId = BigInt(params.sourceToken.paddingUtilId);\n const paddingUtil = this.getPaddingUtil(paddingUtilId);\n\n const composer = this.algorand.newGroup();\n\n if (params.fromAccountAddress === recipient) {\n const optIn = await checkAssetOptIn(receiveTokenId, recipient, this.algorand);\n if (!optIn) {\n composer.addAssetOptIn({ sender: sender, assetId: receiveTokenId });\n }\n }\n\n const assetTransfer = this.algorand.createTransaction.assetTransfer({\n assetId: tokenId,\n amount: amount,\n sender,\n receiver: bridge.appAddress,\n });\n composer.addAppCallMethodCall(\n await bridge.params.swap({\n args: { assetTransferRef: assetTransfer, recipient, receiveAsset: receiveTokenId, receiveAmountMin },\n sender,\n extraFee: feeForInner(4),\n })\n );\n const paddingTx = await this.algorand.createTransaction.appCall({\n appId: paddingUtil.appId,\n sender,\n });\n composer.addTransaction(paddingTx);\n const { transactions } = await composer.buildTransactions();\n return populateAndEncodeTxs(transactions, sender, this.algorand.client.algod);\n }\n\n private getBridge(appId: bigint): BridgeClient {\n return this.algorand.client.getTypedAppClientById(BridgeClient, { appId });\n }\n\n private getPaddingUtil(appId: bigint): PaddingUtilClient {\n return this.algorand.client.getTypedAppClientById(PaddingUtilClient, { appId });\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/services/bridge/alg/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,iDAAiD,CAAC;AACjF,OAAO,EAAE,UAAU,EAAE,MAAM,gDAAgD,CAAC;AAC5E,OAAO,OAAO,EAAE,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAExD,OAAO,EAAE,uBAAuB,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,iCAAiC,EAAE,MAAM,0BAA0B,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACrF,OAAO,EAAE,kBAAkB,EAA4C,MAAM,WAAW,CAAC;AACzF,OAAO,EAAE,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,CAAC,OAAO,CAAC;YAC9D,KAAK,EAAE,WAAW,CAAC,KAAK;YACxB,MAAM;SACP,CAAC,CAAC;QACH,QAAQ,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;QACnC,MAAM,EAAE,YAAY,EAAE,GAAG,MAAM,QAAQ,CAAC,iBAAiB,EAAE,CAAC;QAC5D,OAAO,oBAAoB,CAAC,YAAY,EAAE,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAChF,CAAC;IAEO,SAAS,CAAC,KAAa;QAC7B,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,qBAAqB,CAAC,YAAY,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IAC7E,CAAC;IAEO,cAAc,CAAC,KAAa;QAClC,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,qBAAqB,CAAC,iBAAiB,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IAClF,CAAC;CACF","sourcesContent":["import { AlgorandClient } from \"@algorandfoundation/algokit-utils\";\nimport { SigningAccount } from \"@algorandfoundation/algokit-utils/types/account\";\nimport { AlgoAmount } from \"@algorandfoundation/algokit-utils/types/amount\";\nimport algosdk, { Address } from \"algosdk\";\nimport { ChainType } from \"../../../chains/chain.enums\";\nimport { AllbridgeCoreClient } from \"../../../client/core-api/core-client-base\";\nimport { MethodNotSupportedError, SdkError } from \"../../../exceptions\";\nimport { FeePaymentMethod } from \"../../../models\";\nimport { assertNever } from \"../../../utils/utils\";\nimport { RawTransaction, TransactionResponse } from \"../../models\";\nimport { BridgeClient } from \"../../models/alg/BridgeClient\";\nimport { PaddingUtilClient } from \"../../models/alg/PaddingUtilClient\";\nimport { nearIntentsChainNotSupportedError } from \"../../near-intents/utils\";\nimport { checkAssetOptIn, feeForInner, populateAndEncodeTxs } from \"../../utils/alg\";\nimport { ChainBridgeService, SendParams, SwapParams, TxTransferParams } from \"../models\";\nimport { getNonce, prepareTxSendParams, prepareTxSwapParams } from \"../utils\";\n\nexport class AlgBridgeService extends ChainBridgeService {\n chainType: ChainType.ALG = ChainType.ALG;\n\n constructor(\n public algorand: AlgorandClient,\n public api: AllbridgeCoreClient\n ) {\n super();\n const randomAccount = algosdk.generateAccount();\n const signer = new SigningAccount(randomAccount, randomAccount.addr);\n algorand.setDefaultSigner(signer);\n algorand.setDefaultValidityWindow(100);\n }\n\n send(_params: SendParams): Promise<TransactionResponse> {\n throw new MethodNotSupportedError();\n }\n\n async buildRawTransactionSend(params: SendParams): Promise<RawTransaction> {\n const txSendParams = await prepareTxSendParams(this.chainType, params, this.api);\n\n if (!params.sourceToken.bridgeId) {\n throw new SdkError(\"ALG sourceToken must contain 'bridgeId'\");\n }\n if (!params.sourceToken.paddingUtilId) {\n throw new SdkError(\"ALG sourceToken must contain 'paddingUtilId'\");\n }\n const bridgeId = BigInt(params.sourceToken.bridgeId);\n const bridge = this.getBridge(bridgeId);\n const paddingUtilId = BigInt(params.sourceToken.paddingUtilId);\n const paddingUtil = this.getPaddingUtil(paddingUtilId);\n const sender = Address.fromString(params.fromAccountAddress);\n const tokenId = BigInt(params.sourceToken.tokenAddress);\n const destinationChainId = txSendParams.toChainId;\n const recipient = txSendParams.toAccountAddress;\n const receiveToken = txSendParams.toTokenAddress;\n const nonce = getNonce();\n const amount = BigInt(txSendParams.amount);\n\n let totalFee = BigInt(txSendParams.fee);\n if (txSendParams.extraGas) {\n totalFee = totalFee + BigInt(txSendParams.extraGas);\n }\n\n const composer = this.algorand.newGroup();\n\n const assetTransferTx = await this.algorand.createTransaction.assetTransfer({\n amount,\n assetId: tokenId,\n receiver: bridge.appAddress,\n sender,\n });\n\n switch (txSendParams.gasFeePaymentMethod) {\n case FeePaymentMethod.WITH_NATIVE_CURRENCY: {\n const paymentTx = await this.algorand.createTransaction.payment({\n amount: AlgoAmount.MicroAlgo(totalFee),\n receiver: bridge.appAddress,\n sender,\n });\n composer.addAppCallMethodCall(\n await bridge.params.swapAndBridge({\n args: {\n paymentRef: paymentTx,\n assetTransferRef: assetTransferTx,\n recipient,\n destinationChainId,\n receiveToken,\n nonce,\n },\n sender,\n extraFee: feeForInner(8),\n })\n );\n break;\n }\n case FeePaymentMethod.WITH_STABLECOIN: {\n composer.addAppCallMethodCall(\n await bridge.params.swapAndBridgeWithStable({\n args: {\n assetTransferRef: assetTransferTx,\n recipient,\n destinationChainId,\n receiveToken,\n nonce,\n feeTokenAmount: totalFee,\n },\n sender,\n extraFee: feeForInner(9),\n })\n );\n break;\n }\n case FeePaymentMethod.WITH_ABR:\n throw new SdkError(\"ALG bridge does not support ABR payment method\");\n default: {\n return assertNever(txSendParams.gasFeePaymentMethod, \"Unhandled FeePaymentMethod\");\n }\n }\n const paddingTx1 = await this.algorand.createTransaction.appCall({\n appId: paddingUtil.appId,\n sender,\n note: \"padding1\",\n });\n composer.addTransaction(paddingTx1);\n const paddingTx2 = await this.algorand.createTransaction.appCall({\n appId: paddingUtil.appId,\n sender,\n note: \"padding2\",\n });\n composer.addTransaction(paddingTx2);\n\n const { transactions } = await composer.buildTransactions();\n return populateAndEncodeTxs(transactions, sender, this.algorand.client.algod);\n }\n\n /**\n * NEAR Intents deposit transfers are not supported from this chain yet.\n */\n buildRawTransactionTransfer(params: TxTransferParams): Promise<RawTransaction> {\n return Promise.reject(nearIntentsChainNotSupportedError(params.token.chainSymbol));\n }\n\n /** @deprecated Do not use. */\n async buildRawTransactionSwap(params: SwapParams): Promise<RawTransaction> {\n const txSwapParams = prepareTxSwapParams(this.chainType, params);\n\n const sender = Address.fromString(params.fromAccountAddress);\n const recipient = params.toAccountAddress;\n const tokenId = BigInt(params.sourceToken.tokenAddress);\n const receiveTokenId = BigInt(params.destinationToken.tokenAddress);\n const receiveAmountMin = BigInt(txSwapParams.minimumReceiveAmount);\n const amount = BigInt(txSwapParams.amount);\n\n if (!params.sourceToken.bridgeId) {\n throw new SdkError(\"ALG sourceToken must contain 'bridgeId'\");\n }\n if (!params.sourceToken.paddingUtilId) {\n throw new SdkError(\"ALG sourceToken must contain 'paddingUtilId'\");\n }\n const bridgeId = BigInt(params.sourceToken.bridgeId);\n const bridge = this.getBridge(bridgeId);\n const paddingUtilId = BigInt(params.sourceToken.paddingUtilId);\n const paddingUtil = this.getPaddingUtil(paddingUtilId);\n\n const composer = this.algorand.newGroup();\n\n if (params.fromAccountAddress === recipient) {\n const optIn = await checkAssetOptIn(receiveTokenId, recipient, this.algorand);\n if (!optIn) {\n composer.addAssetOptIn({ sender: sender, assetId: receiveTokenId });\n }\n }\n\n const assetTransfer = this.algorand.createTransaction.assetTransfer({\n assetId: tokenId,\n amount: amount,\n sender,\n receiver: bridge.appAddress,\n });\n composer.addAppCallMethodCall(\n await bridge.params.swap({\n args: { assetTransferRef: assetTransfer, recipient, receiveAsset: receiveTokenId, receiveAmountMin },\n sender,\n extraFee: feeForInner(4),\n })\n );\n const paddingTx = await this.algorand.createTransaction.appCall({\n appId: paddingUtil.appId,\n sender,\n });\n composer.addTransaction(paddingTx);\n const { transactions } = await composer.buildTransactions();\n return populateAndEncodeTxs(transactions, sender, this.algorand.client.algod);\n }\n\n private getBridge(appId: bigint): BridgeClient {\n return this.algorand.client.getTypedAppClientById(BridgeClient, { appId });\n }\n\n private getPaddingUtil(appId: bigint): PaddingUtilClient {\n return this.algorand.client.getTypedAppClientById(PaddingUtilClient, { appId });\n }\n}\n"]}
|
|
@@ -2,7 +2,7 @@ import { AllbridgeCoreClient } from "../../../client/core-api/core-client-base";
|
|
|
2
2
|
import { ChainType, EssentialWeb3, SwapParams, TransactionResponse } from "../../../models";
|
|
3
3
|
import { NodeRpcUrlsConfig } from "../../index";
|
|
4
4
|
import { RawTransaction } from "../../models";
|
|
5
|
-
import { ChainBridgeService, SendParams, TxSwapParamsEvm } from "../models";
|
|
5
|
+
import { ChainBridgeService, SendParams, TxSwapParamsEvm, TxTransferParams } from "../models";
|
|
6
6
|
export declare class EvmBridgeService extends ChainBridgeService {
|
|
7
7
|
web3: EssentialWeb3;
|
|
8
8
|
api: AllbridgeCoreClient;
|
|
@@ -15,13 +15,23 @@ export declare class EvmBridgeService extends ChainBridgeService {
|
|
|
15
15
|
/** @deprecated Do not use. */
|
|
16
16
|
buildRawTransactionSwapFromParams(params: TxSwapParamsEvm): Promise<RawTransaction>;
|
|
17
17
|
buildRawTransactionSend(params: SendParams): Promise<RawTransaction>;
|
|
18
|
+
/**
|
|
19
|
+
* Builds a plain transfer: ERC-20 `transfer(toAddress, amount)` on the token contract,
|
|
20
|
+
* or a native currency value transfer when `token.isNative`. Used for {@link Messenger.NEAR_INTENTS} deposits.
|
|
21
|
+
*/
|
|
22
|
+
buildRawTransactionTransfer(params: TxTransferParams): Promise<RawTransaction>;
|
|
18
23
|
private buildRawTransactionCctpSend;
|
|
19
24
|
private buildRawTransactionOftSend;
|
|
20
25
|
private buildRawTransactionXReserveSend;
|
|
21
|
-
|
|
26
|
+
/**
|
|
27
|
+
* Estimates gas and sends the raw transaction through the provider.
|
|
28
|
+
* @internal
|
|
29
|
+
*/
|
|
30
|
+
sendRawTransaction(rawTransaction: RawTransaction): Promise<TransactionResponse>;
|
|
22
31
|
private getBridgeContract;
|
|
23
32
|
private getCctpBridgeContract;
|
|
24
33
|
private getOftBridgeContract;
|
|
25
34
|
private getAbrPayerContract;
|
|
35
|
+
private getERC20Contract;
|
|
26
36
|
private getXReserveBridgeContract;
|
|
27
37
|
}
|