@allbridge/bridge-core-sdk 3.33.0-alpha.1 → 3.33.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -41,7 +41,7 @@ export interface AllbridgeCoreSdkOptions {
41
41
  /**
42
42
  * @deprecated Do not use.
43
43
  */
44
- wormholeMessengerProgramId: string;
44
+ wormholeMessengerProgramId?: string;
45
45
  solanaLookUpTable: string;
46
46
  sorobanNetworkPassphrase: string;
47
47
  /**
@@ -58,7 +58,7 @@ export interface AllbridgeCoreSdkOptions {
58
58
  * @type {number}
59
59
  * @deprecated Do not use.
60
60
  */
61
- cachePoolInfoChainSec: number;
61
+ cachePoolInfoChainSec?: number;
62
62
  /**
63
63
  * @internal
64
64
  * Optional additional properties to merge with the default properties.
@@ -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;AAuFzB;;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,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;Y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rB,MAAc,EACd,YAA0B,EAC1B,WAAkC;QAElC,OAAO,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,MAAM,EAAE,YAAY,EAAE,WAAW,CAAC,CAAC;IAC3E,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,iBAAiB,CAAC,UAAkB,EAAE,SAAgC;QAC1E,OAAO,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;IAC/D,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,2BAA2B,CAC/B,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 { 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 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 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 supported tokens groped by chain.\n *\n * @param type - A string value which specifies ChainDetailsMap to retrieve.\n * Can be either 'swap' for send or 'pool' for liquidity pools setup.\n * Defaults to 'swap'.\n */\n /** @deprecated Do not use. */\n chainDetailsMap(type: \"pool\"): Promise<ChainDetailsMap>;\n chainDetailsMap(type?: \"swap\"): Promise<ChainDetailsMap>;\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 supported {@link TokenWithChainDetails | tokens}.\n *\n * @param type - A string value which specifies a set of tokens to retrieve.\n * Can be either 'swap' for tokens to send or 'pool' for liquidity pools operations.\n * Defaults to 'swap'.\n * @returns A promise that resolves to an array of {@link TokenWithChainDetails}.\n */\n /** @deprecated Do not use. */\n tokens(type: \"pool\"): Promise<TokenWithChainDetails[]>;\n tokens(type?: \"swap\"): Promise<TokenWithChainDetails[]>;\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 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 - A string value which specifies a set of tokens to retrieve.\n * Can be either 'swap' for tokens to send or 'pool' for liquidity pools operations.\n * Defaults to 'swap'.\n */\n /** @deprecated Do not use. */\n tokensByChain(chainSymbol: string, type: \"pool\"): Promise<TokenWithChainDetails[]>;\n tokensByChain(chainSymbol: string, type?: \"swap\"): Promise<TokenWithChainDetails[]>;\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 separately call one of:\n * {@link getAmountToBeReceived}, {@link getAmountToBeReceivedFromChain}, or {@link getAmountToBeReceivedFromPools}.\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 separately call one of:\n * {@link getAmountToSend}, {@link getAmountToSendFromChain}, or {@link getAmountToSendFromPools}.\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.\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 */\n /** @deprecated Do not use. */\n getAmountToBeReceived(\n amountToSendFloat: BigSource,\n sourceChainToken: TokenWithChainDetails,\n destinationChainToken: TokenWithChainDetails,\n messenger: LegacyMessenger\n ): Promise<string>;\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 */\n /** @deprecated Do not use. */\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 */\n /** @deprecated Do not use. */\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.\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 */\n /** @deprecated Do not use. */\n getAmountToSend(\n amountToBeReceivedFloat: BigSource,\n sourceChainToken: TokenWithChainDetails,\n destinationChainToken: TokenWithChainDetails,\n messenger: LegacyMessenger\n ): Promise<string>;\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 */\n /** @deprecated Do not use. */\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 */\n /** @deprecated Do not use. */\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\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\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.\n * @param sourceChainToken selected token on the source chain\n * @param destinationChainToken selected token on the destination chain\n * @param messenger selected Messenger\n * @returns {@link ExtraGasMaxLimitResponse}\n */\n /** @deprecated Do not use. */\n getExtraGasMaxLimits(\n sourceChainToken: TokenWithChainDetails,\n destinationChainToken: TokenWithChainDetails,\n messenger: LegacyMessenger\n ): Promise<ExtraGasMaxLimitResponse>;\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 Use {@link getSendAmountDetails}\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 Use {@link getAmountToBeReceived} and then {@link getSendAmountDetails}\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;AAGxE,OAAO,EAAE,YAAY,EAAS,MAAM,SAAS,CAAC;AAE9C,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AAuFzB;;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,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,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,WAAW,CAAC,CAAC;IAC3E,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,iBAAiB,CAAC,UAAkB,EAAE,SAAgC;QAC1E,OAAO,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;IAC/D,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,2BAA2B,CAC/B,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 { 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 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 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 supported tokens groped by chain.\n *\n * @param type - A string value which specifies ChainDetailsMap to retrieve.\n * Can be either 'swap' for send or 'pool' for liquidity pools setup.\n * Defaults to 'swap'.\n */\n /** @deprecated Do not use. */\n chainDetailsMap(type: \"pool\"): Promise<ChainDetailsMap>;\n chainDetailsMap(type?: \"swap\"): Promise<ChainDetailsMap>;\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 supported {@link TokenWithChainDetails | tokens}.\n *\n * @param type - A string value which specifies a set of tokens to retrieve.\n * Can be either 'swap' for tokens to send or 'pool' for liquidity pools operations.\n * Defaults to 'swap'.\n * @returns A promise that resolves to an array of {@link TokenWithChainDetails}.\n */\n /** @deprecated Do not use. */\n tokens(type: \"pool\"): Promise<TokenWithChainDetails[]>;\n tokens(type?: \"swap\"): Promise<TokenWithChainDetails[]>;\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 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 - A string value which specifies a set of tokens to retrieve.\n * Can be either 'swap' for tokens to send or 'pool' for liquidity pools operations.\n * Defaults to 'swap'.\n */\n /** @deprecated Do not use. */\n tokensByChain(chainSymbol: string, type: \"pool\"): Promise<TokenWithChainDetails[]>;\n tokensByChain(chainSymbol: string, type?: \"swap\"): Promise<TokenWithChainDetails[]>;\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 separately call one of:\n * {@link getAmountToBeReceived}, {@link getAmountToBeReceivedFromChain}, or {@link getAmountToBeReceivedFromPools}.\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 separately call one of:\n * {@link getAmountToSend}, {@link getAmountToSendFromChain}, or {@link getAmountToSendFromPools}.\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.\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 */\n /** @deprecated Do not use. */\n getAmountToBeReceived(\n amountToSendFloat: BigSource,\n sourceChainToken: TokenWithChainDetails,\n destinationChainToken: TokenWithChainDetails,\n messenger: LegacyMessenger\n ): Promise<string>;\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 */\n /** @deprecated Do not use. */\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 */\n /** @deprecated Do not use. */\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.\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 */\n /** @deprecated Do not use. */\n getAmountToSend(\n amountToBeReceivedFloat: BigSource,\n sourceChainToken: TokenWithChainDetails,\n destinationChainToken: TokenWithChainDetails,\n messenger: LegacyMessenger\n ): Promise<string>;\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 */\n /** @deprecated Do not use. */\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 */\n /** @deprecated Do not use. */\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\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\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.\n * @param sourceChainToken selected token on the source chain\n * @param destinationChainToken selected token on the destination chain\n * @param messenger selected Messenger\n * @returns {@link ExtraGasMaxLimitResponse}\n */\n /** @deprecated Do not use. */\n getExtraGasMaxLimits(\n sourceChainToken: TokenWithChainDetails,\n destinationChainToken: TokenWithChainDetails,\n messenger: LegacyMessenger\n ): Promise<ExtraGasMaxLimitResponse>;\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 Use {@link getSendAmountDetails}\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 Use {@link getAmountToBeReceived} and then {@link getSendAmountDetails}\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"]}
@@ -28,7 +28,7 @@ interface SwapAndBridgeSolDataCctpData<IDL extends Idl> {
28
28
  }
29
29
  export interface SolanaBridgeParams {
30
30
  /** @deprecated Do not use. */
31
- wormholeMessengerProgramId: string;
31
+ wormholeMessengerProgramId?: string;
32
32
  solanaLookUpTable: string;
33
33
  cctpParams: CctpParams;
34
34
  }
@@ -248,6 +248,9 @@ export class BridgeTxService {
248
248
  async buildSwapAndBridgeWormholeTransaction(swapAndBridgeData) {
249
249
  const { bridge, vusdAmount, nonce, recipient, receiveToken, poolAccount, lockAccount, bridgeAuthority, userToken, bridgeTokenAccount, chainBridgeAccount, otherBridgeTokenAccount, userAccount, destinationChainId, mint, config, configAccountInfo, gasPrice, thisGasPrice, extraGasInstruction, } = swapAndBridgeData;
250
250
  const wormholeProgramId = this.params.wormholeMessengerProgramId;
251
+ if (!wormholeProgramId) {
252
+ throw new SdkError("Do not use.");
253
+ }
251
254
  const [whBridgeAccount] = PublicKey.findProgramAddressSync([Buffer.from("Bridge")], new PublicKey(wormholeProgramId));
252
255
  const [whFeeCollectorAccount] = PublicKey.findProgramAddressSync([Buffer.from("fee_collector")], new PublicKey(wormholeProgramId));
253
256
  const [whSequenceAccount] = PublicKey.findProgramAddressSync([Buffer.from("Sequence"), bridgeAuthority.toBuffer()], new PublicKey(wormholeProgramId));
@@ -1 +1 @@
1
- {"version":3,"file":"bridge-tx-service.js","sourceRoot":"","sources":["../../../../../src/services/bridge/sol/bridge-tx-service.ts"],"names":[],"mappings":"AAAA,O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,EAAE,wBAAwB;YACrD,yBAAyB,EAAE,wBAAwB;YACnD,yBAAyB,EAAE,yBAAyB;YACpD,cAAc,EAAE,cAAc;YAC9B,WAAW,EAAE,WAAW;YACxB,UAAU,EAAE,UAAU;YACtB,oBAAoB,EAAE,oBAAoB;YAC1C,YAAY,EAAE,YAAY;YAC1B,cAAc,EAAE,4BAA4B;YAE5C,QAAQ,EAAE,QAAQ;YAClB,YAAY,EAAE,YAAY;YAC1B,WAAW,EAAE,kBAAkB;YAC/B,SAAS;SACV,CAAC;aACD,eAAe,CAAC;YACf,IAAI,CAAC,oBAAoB,CAAC,mBAAmB,CAAC;gBAC5C,KAAK,EAAE,OAAO;aACf,CAAC;SACH,CAAC;aACD,gBAAgB,CAAC,YAAY,CAAC;aAC9B,WAAW,EAAE,CAAC;QACjB,MAAM,UAAU,GAAG,QAAQ,CAAC,UAAU,CAAC;QACvC,EAAE,CAAC,eAAe,GAAG,CAAC,MAAM,UAAU,CAAC,kBAAkB,EAAE,CAAC,CAAC,SAAS,CAAC;QACvE,EAAE,CAAC,QAAQ,GAAG,WAAW,CAAC;QAC1B,OAAO;YACL,WAAW,EAAE,MAAM,6BAA6B,CAAC,EAAE,EAAE,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC;YAC/F,2BAA2B;SAC5B,CAAC;IACJ,CAAC;CACF","sourcesContent":["import { BN, Idl, Program, Provider, web3 } from \"@coral-xyz/anchor\";\nimport { createAssociatedTokenAccountInstruction, getAssociatedTokenAddressSync } from \"@solana/spl-token\";\nimport { Keypair, PublicKey, SystemProgram, TransactionInstruction, VersionedTransaction } from \"@solana/web3.js\";\nimport { Messenger } from \"../../../client/core-api/core-api.model\";\nimport { AllbridgeCoreClient } from \"../../../client/core-api/core-client-base\";\nimport { CCTPDoesNotSupportedError, OFTDoesNotSupportedError, SdkError } from \"../../../exceptions\";\nimport { CctpParams, ChainType, SwapParams, TxFeeParams } from \"../../../models\";\nimport { assertNever } from \"../../../utils/utils\";\nimport { RawTransaction } from \"../../models\";\nimport { Bridge as BridgeType } from \"../../models/sol/types/bridge\";\nimport * as bridgeIdl from \"../../models/sol/types/bridge.json\";\nimport { CctpBridge as CctpBridgeType } from \"../../models/sol/types/cctp_bridge\";\nimport * as cctpBridgeIdl from \"../../models/sol/types/cctp_bridge.json\";\nimport { CctpV2Bridge as CctpV2BridgeType } from \"../../models/sol/types/cctp_v2_bridge\";\nimport * as cctpV2BridgeIdl from \"../../models/sol/types/cctp_v2_bridge.json\";\nimport { getMessage, getTokenAccountData, getVUsdAmount } from \"../../utils/sol\";\nimport {\n getAssociatedAccount,\n getAuthorityAccount,\n getBridgeTokenAccount,\n getCctpAccounts,\n getCctpAuthorityAccount,\n getCctpBridgeAccount,\n getCctpBridgeTokenAccount,\n getCctpLockAccount,\n getCctpV2BridgeConfigAccount,\n getChainBridgeAccount,\n getConfigAccount,\n getGasUsageAccount,\n getLockAccount,\n getOtherChainTokenAccount,\n getPriceAccount,\n getSendMessageAccount,\n} from \"../../utils/sol/accounts\";\nimport { buildAnchorProvider } from \"../../utils/sol/anchor-provider\";\nimport { addUnitLimitAndUnitPriceToTx } from \"../../utils/sol/compute-budget\";\nimport { SendParams, TxSwapParamsSol } from \"../models\";\nimport { getNonce, prepareTxSwapParams } from \"../utils\";\nimport { convertToVersionedTransaction, SolTxSendParams } from \"./utils\";\n\ninterface SwapAndBridgeSolData {\n bridge: Program<BridgeType>;\n amount: BN;\n vusdAmount: BN;\n nonce: number[];\n recipient: number[];\n receiveToken: number[];\n poolAccount: PublicKey;\n lockAccount: PublicKey;\n bridgeAuthority: PublicKey;\n userToken: PublicKey;\n bridgeTokenAccount: PublicKey;\n chainBridgeAccount: PublicKey;\n otherBridgeTokenAccount: PublicKey;\n userAccount: PublicKey;\n destinationChainId: number;\n mint: PublicKey;\n config: PublicKey;\n configAccountInfo: ConfigAccountInfo;\n gasPrice: PublicKey;\n thisGasPrice: PublicKey;\n message: Buffer;\n extraGasInstruction?: TransactionInstruction;\n provider: Provider;\n}\n\ninterface ConfigAccountInfo {\n allbridgeMessengerProgramId: PublicKey;\n wormholeMessengerProgramId: PublicKey;\n gasOracleProgramId: PublicKey;\n}\n\ninterface SwapAndBridgeSolDataCctpData<IDL extends Idl> {\n cctpBridge: Program<IDL>;\n cctpBridgeAccount: PublicKey;\n cctpAddressAccount: PublicKey;\n amount: BN;\n recipient: number[];\n receiveToken: number[];\n userToken: PublicKey;\n bridgeAuthority: PublicKey;\n bridgeTokenAccount: PublicKey;\n chainBridgeAccount: PublicKey;\n userAccount: PublicKey;\n destinationChainId: number;\n mint: PublicKey;\n gasPrice: PublicKey;\n thisGasPrice: PublicKey;\n extraGasInstruction?: TransactionInstruction;\n provider: Provider;\n}\n\nexport interface SolanaBridgeParams {\n /** @deprecated Do not use. */\n wormholeMessengerProgramId: string;\n solanaLookUpTable: string;\n cctpParams: CctpParams;\n}\n\nconst COMPUTE_UNIT_LIMIT = 1_000_000;\n\nexport class BridgeTxService {\n chainType: ChainType.SOLANA = ChainType.SOLANA;\n\n constructor(\n public solanaRpcUrl: string,\n public params: SolanaBridgeParams,\n public api: AllbridgeCoreClient\n ) {}\n\n /** @deprecated Do not use. */\n async buildRawTransactionSwap(params: SwapParams): Promise<RawTransaction> {\n const txSwapParams = prepareTxSwapParams(this.chainType, params);\n return await this.buildSwapTransaction(\n txSwapParams,\n params.sourceToken.poolAddress,\n params.destinationToken.poolAddress,\n params.txFeeParams\n );\n }\n\n private async buildSwapTransaction(\n params: TxSwapParamsSol,\n poolAddress: string,\n toPoolAddress: string,\n txFeeParams?: TxFeeParams\n ): Promise<VersionedTransaction> {\n const {\n fromAccountAddress,\n amount,\n contractAddress,\n fromTokenAddress,\n toTokenAddress,\n toAccountAddress,\n minimumReceiveAmount,\n } = params;\n const account = fromAccountAddress;\n const bridgeAddress = contractAddress;\n const tokenAddress = fromTokenAddress;\n const receiveTokenAddress = toTokenAddress;\n const receivePoolAddress = toPoolAddress;\n const receiverOriginal = toAccountAddress;\n\n const userAccount = new PublicKey(account);\n const provider = buildAnchorProvider(this.solanaRpcUrl, userAccount.toString());\n const bridge = new Program<BridgeType>({ ...bridgeIdl, address: bridgeAddress }, provider);\n\n const bridgeAuthority = await getAuthorityAccount(bridge.programId);\n const configAccount = await getConfigAccount(bridge.programId);\n\n const sendMint = new PublicKey(tokenAddress);\n const sendBridgeToken = await getBridgeTokenAccount(sendMint, bridge.programId);\n const sendPool = new PublicKey(poolAddress);\n const sendUserToken = getAssociatedAccount(userAccount, sendMint);\n\n const receiverAccount = new PublicKey(receiverOriginal);\n const receiveMint = new PublicKey(receiveTokenAddress);\n const receiveBridgeToken = await getBridgeTokenAccount(receiveMint, bridge.programId);\n const receivePool = new PublicKey(receivePoolAddress);\n const receiveUserToken = getAssociatedAccount(receiverAccount, receiveMint);\n\n const preInstructions: TransactionInstruction[] = [\n web3.ComputeBudgetProgram.setComputeUnitLimit({\n units: COMPUTE_UNIT_LIMIT,\n }),\n ];\n\n try {\n await getTokenAccountData(receiveUserToken, provider);\n } catch (ignoreError) {\n const receiveUserToken = getAssociatedTokenAddressSync(receiveMint, receiverAccount);\n const createReceiveUserTokenInstruction = createAssociatedTokenAccountInstruction(\n userAccount,\n receiveUserToken,\n receiverAccount,\n receiveMint\n );\n preInstructions.push(createReceiveUserTokenInstruction);\n }\n const transaction = await bridge.methods\n .swap(new BN(amount), new BN(minimumReceiveAmount || 0))\n .accountsPartial({\n payer: userAccount,\n config: configAccount,\n bridgeAuthority,\n user: userAccount,\n sendBridgeToken,\n sendMint,\n sendPool,\n sendUserToken,\n receiveBridgeToken,\n receiveMint,\n receivePool,\n receiveUserToken,\n })\n .preInstructions(preInstructions)\n .transaction();\n\n const connection = provider.connection;\n transaction.recentBlockhash = (await connection.getLatestBlockhash()).blockhash;\n transaction.feePayer = userAccount;\n await addUnitLimitAndUnitPriceToTx(transaction, txFeeParams, this.solanaRpcUrl);\n return await convertToVersionedTransaction(transaction, connection, this.params.solanaLookUpTable);\n }\n\n async buildRawTransactionSend(\n params: SendParams,\n solTxSendParams: SolTxSendParams\n ): Promise<{ tx: VersionedTransaction; requiredMessageSigner: Keypair | undefined }> {\n let swapAndBridgeTx: VersionedTransaction;\n let requiredMessageSigner: Keypair | undefined = undefined;\n switch (params.messenger) {\n case Messenger.ALLBRIDGE: {\n const swapAndBridgeSolData = await this.prepareSwapAndBridgeData(solTxSendParams);\n swapAndBridgeTx = await this.buildSwapAndBridgeAllbridgeTransaction(swapAndBridgeSolData);\n break;\n }\n case Messenger.WORMHOLE: {\n const swapAndBridgeSolData = await this.prepareSwapAndBridgeData(solTxSendParams);\n const { transaction, messageAccount } = await this.buildSwapAndBridgeWormholeTransaction(swapAndBridgeSolData);\n swapAndBridgeTx = transaction;\n requiredMessageSigner = messageAccount;\n break;\n }\n case Messenger.CCTP: {\n const swapAndBridgeSolData = await this.prepareSwapAndBridgeCctpData(solTxSendParams);\n const { transaction, messageSentEventDataKeypair } = await this.buildSwapAndBridgeCctpTransaction(\n params.destinationToken.chainSymbol,\n swapAndBridgeSolData\n );\n swapAndBridgeTx = transaction;\n requiredMessageSigner = messageSentEventDataKeypair;\n break;\n }\n case Messenger.CCTP_V2: {\n const swapAndBridgeSolData = await this.prepareSwapAndBridgeCctpV2Data(solTxSendParams);\n const { transaction, messageSentEventDataKeypair } = await this.buildSwapAndBridgeCctpV2Transaction(\n params.destinationToken.chainSymbol,\n swapAndBridgeSolData\n );\n swapAndBridgeTx = transaction;\n requiredMessageSigner = messageSentEventDataKeypair;\n break;\n }\n case Messenger.X_RESERVE:\n throw new SdkError(\"Messenger xReserve is not supported yet.\");\n case Messenger.OFT:\n throw new OFTDoesNotSupportedError(\"Messenger OFT is not supported yet.\");\n default: {\n return assertNever(params.messenger, \"Unhandled Messenger type\");\n }\n }\n return { tx: swapAndBridgeTx, requiredMessageSigner };\n }\n private getExtraGasInstruction(\n extraGas: string,\n userAccount: PublicKey,\n configAccount: PublicKey\n ): TransactionInstruction | undefined {\n return web3.SystemProgram.transfer({\n fromPubkey: userAccount,\n toPubkey: configAccount,\n lamports: +extraGas,\n });\n }\n\n private async prepareSwapAndBridgeData(txSendParams: SolTxSendParams): Promise<SwapAndBridgeSolData> {\n const {\n amount,\n contractAddress,\n fromChainId,\n fromAccountAddress,\n fromTokenAddress,\n toChainId,\n toAccountAddress,\n toTokenAddress,\n poolAddress,\n extraGas,\n } = txSendParams;\n const tokenAddress = fromTokenAddress;\n const account = fromAccountAddress;\n const destinationChainId = toChainId;\n const receiveTokenAddress = toTokenAddress;\n const receiverInBuffer32 = toAccountAddress;\n const bridgeAddress = contractAddress;\n const sourceChainId = fromChainId;\n\n const provider = buildAnchorProvider(this.solanaRpcUrl, account);\n const bridge = new Program<BridgeType>({ ...bridgeIdl, address: bridgeAddress }, provider);\n const nonce = Array.from(getNonce());\n const poolAccount = new PublicKey(poolAddress);\n const vUsdAmount = await getVUsdAmount(amount, bridge, poolAccount);\n\n const lockAccount = await getLockAccount(nonce, bridge.programId);\n const bridgeAuthority = await getAuthorityAccount(bridge.programId);\n const userToken = getAssociatedAccount(new PublicKey(account), new PublicKey(tokenAddress));\n const bridgeTokenAccount = await getBridgeTokenAccount(new PublicKey(tokenAddress), bridge.programId);\n const chainBridgeAccount = await getChainBridgeAccount(destinationChainId, bridge.programId);\n const otherBridgeTokenAccount = await getOtherChainTokenAccount(\n destinationChainId,\n Buffer.from(receiveTokenAddress),\n bridge.programId\n );\n\n const configAccount = await getConfigAccount(bridge.programId);\n const configAccountInfo = await bridge.account.config.fetch(configAccount);\n const priceAccount = await getPriceAccount(destinationChainId, configAccountInfo.gasOracleProgramId);\n const thisGasPriceAccount = await getPriceAccount(sourceChainId, configAccountInfo.gasOracleProgramId);\n\n const message = getMessage({\n amount: vUsdAmount,\n recipient: Buffer.from(receiverInBuffer32),\n nonce: Buffer.from(nonce),\n receiveToken: Buffer.from(receiveTokenAddress),\n destinationChainId,\n sourceChainId,\n chainBridge: (await getAuthorityAccount(bridge.programId)).toBuffer(),\n });\n\n const swapAndBridgeData = {} as SwapAndBridgeSolData;\n\n swapAndBridgeData.bridge = bridge;\n swapAndBridgeData.amount = new BN(amount);\n swapAndBridgeData.vusdAmount = new BN(vUsdAmount);\n swapAndBridgeData.nonce = nonce;\n swapAndBridgeData.recipient = Array.from(receiverInBuffer32);\n swapAndBridgeData.receiveToken = Array.from(receiveTokenAddress);\n swapAndBridgeData.poolAccount = poolAccount;\n swapAndBridgeData.lockAccount = lockAccount;\n swapAndBridgeData.bridgeAuthority = bridgeAuthority;\n swapAndBridgeData.userToken = userToken;\n swapAndBridgeData.bridgeTokenAccount = bridgeTokenAccount;\n swapAndBridgeData.chainBridgeAccount = chainBridgeAccount;\n swapAndBridgeData.otherBridgeTokenAccount = otherBridgeTokenAccount;\n swapAndBridgeData.userAccount = new PublicKey(account);\n swapAndBridgeData.destinationChainId = destinationChainId;\n swapAndBridgeData.mint = new PublicKey(tokenAddress);\n swapAndBridgeData.config = configAccount;\n swapAndBridgeData.configAccountInfo = configAccountInfo;\n swapAndBridgeData.gasPrice = priceAccount;\n swapAndBridgeData.thisGasPrice = thisGasPriceAccount;\n swapAndBridgeData.message = message;\n\n if (extraGas) {\n swapAndBridgeData.extraGasInstruction = this.getExtraGasInstruction(\n extraGas,\n swapAndBridgeData.userAccount,\n configAccount\n );\n }\n return swapAndBridgeData;\n }\n\n private async buildSwapAndBridgeAllbridgeTransaction(\n swapAndBridgeData: SwapAndBridgeSolData\n ): Promise<VersionedTransaction> {\n const {\n bridge,\n vusdAmount,\n nonce,\n recipient,\n receiveToken,\n poolAccount,\n lockAccount,\n bridgeAuthority,\n userToken,\n bridgeTokenAccount,\n chainBridgeAccount,\n otherBridgeTokenAccount,\n userAccount,\n destinationChainId,\n mint,\n config,\n configAccountInfo,\n gasPrice,\n thisGasPrice,\n message,\n extraGasInstruction,\n } = swapAndBridgeData;\n const allbridgeMessengerProgramId = configAccountInfo.allbridgeMessengerProgramId;\n const messengerGasUsageAccount = await getGasUsageAccount(destinationChainId, allbridgeMessengerProgramId);\n const messengerConfig = await getConfigAccount(allbridgeMessengerProgramId);\n\n const sentMessageAccount = await getSendMessageAccount(message, allbridgeMessengerProgramId);\n\n const instructions: TransactionInstruction[] = [];\n if (extraGasInstruction) {\n instructions.push(extraGasInstruction);\n }\n\n const transaction = await bridge.methods\n .swapAndBridge({\n vusdAmount,\n nonce,\n destinationChainId,\n recipient,\n receiveToken,\n })\n .accountsPartial({\n payer: userAccount,\n mint,\n user: userAccount,\n config,\n lock: lockAccount,\n pool: poolAccount,\n gasPrice,\n thisGasPrice,\n bridgeAuthority,\n userToken,\n bridgeToken: bridgeTokenAccount,\n chainBridge: chainBridgeAccount,\n messenger: allbridgeMessengerProgramId,\n messengerGasUsage: messengerGasUsageAccount,\n messengerConfig,\n sentMessageAccount,\n otherBridgeToken: otherBridgeTokenAccount,\n })\n .preInstructions([\n web3.ComputeBudgetProgram.setComputeUnitLimit({\n units: COMPUTE_UNIT_LIMIT,\n }),\n ])\n .postInstructions(instructions)\n .transaction();\n const connection = buildAnchorProvider(this.solanaRpcUrl, userAccount.toString()).connection;\n transaction.recentBlockhash = (await connection.getLatestBlockhash()).blockhash;\n transaction.feePayer = userAccount;\n return await convertToVersionedTransaction(transaction, connection, this.params.solanaLookUpTable);\n }\n\n private async buildSwapAndBridgeWormholeTransaction(\n swapAndBridgeData: SwapAndBridgeSolData\n ): Promise<{ transaction: VersionedTransaction; messageAccount: Keypair }> {\n const {\n bridge,\n vusdAmount,\n nonce,\n recipient,\n receiveToken,\n poolAccount,\n lockAccount,\n bridgeAuthority,\n userToken,\n bridgeTokenAccount,\n chainBridgeAccount,\n otherBridgeTokenAccount,\n userAccount,\n destinationChainId,\n mint,\n config,\n configAccountInfo,\n gasPrice,\n thisGasPrice,\n extraGasInstruction,\n } = swapAndBridgeData;\n const wormholeProgramId = this.params.wormholeMessengerProgramId;\n\n const [whBridgeAccount] = PublicKey.findProgramAddressSync(\n [Buffer.from(\"Bridge\")],\n new PublicKey(wormholeProgramId)\n );\n const [whFeeCollectorAccount] = PublicKey.findProgramAddressSync(\n [Buffer.from(\"fee_collector\")],\n new PublicKey(wormholeProgramId)\n );\n const [whSequenceAccount] = PublicKey.findProgramAddressSync(\n [Buffer.from(\"Sequence\"), bridgeAuthority.toBuffer()],\n new PublicKey(wormholeProgramId)\n );\n\n const messengerGasUsageAccount = await getGasUsageAccount(\n destinationChainId,\n configAccountInfo.wormholeMessengerProgramId\n );\n const wormholeMessengerConfigAccount = await getConfigAccount(configAccountInfo.wormholeMessengerProgramId);\n const messageAccount = Keypair.generate();\n\n const provider = buildAnchorProvider(this.solanaRpcUrl, userAccount.toString());\n\n const bridgeAccountInfo = await provider.connection.getAccountInfo(whBridgeAccount);\n if (bridgeAccountInfo == null) {\n throw new SdkError(\"Cannot fetch wormhole bridge account info\");\n }\n const feeLamports = new BN(bridgeAccountInfo.data.slice(16, 24), \"le\").toString();\n\n const feeInstruction = SystemProgram.transfer({\n fromPubkey: userAccount,\n toPubkey: whFeeCollectorAccount,\n lamports: +feeLamports,\n });\n\n const instructions: TransactionInstruction[] = [];\n if (extraGasInstruction) {\n instructions.push(extraGasInstruction);\n }\n\n const accounts = {\n payer: userAccount,\n mint,\n user: userAccount,\n config,\n lock: lockAccount,\n pool: poolAccount,\n gasPrice,\n thisGasPrice,\n bridgeAuthority,\n userToken,\n bridgeToken: bridgeTokenAccount,\n chainBridge: chainBridgeAccount,\n otherBridgeToken: otherBridgeTokenAccount,\n messengerGasUsage: messengerGasUsageAccount,\n wormholeProgram: wormholeProgramId,\n bridge: whBridgeAccount,\n message: messageAccount.publicKey,\n wormholeMessenger: configAccountInfo.wormholeMessengerProgramId,\n sequence: whSequenceAccount,\n feeCollector: whFeeCollectorAccount,\n wormholeMessengerConfig: wormholeMessengerConfigAccount,\n clock: web3.SYSVAR_CLOCK_PUBKEY,\n };\n\n const transaction = await bridge.methods\n .swapAndBridgeWormhole({\n vusdAmount,\n nonce: nonce,\n destinationChainId,\n recipient,\n receiveToken,\n })\n .accounts(accounts)\n .preInstructions([\n web3.ComputeBudgetProgram.setComputeUnitLimit({\n units: COMPUTE_UNIT_LIMIT,\n }),\n feeInstruction,\n ])\n .postInstructions(instructions)\n .signers([messageAccount])\n .transaction();\n transaction.recentBlockhash = (await provider.connection.getLatestBlockhash()).blockhash;\n transaction.feePayer = userAccount;\n return {\n transaction: await convertToVersionedTransaction(transaction, provider.connection, this.params.solanaLookUpTable),\n messageAccount,\n };\n }\n\n private async prepareSwapAndBridgeCctpData(\n txSendParams: SolTxSendParams\n ): Promise<SwapAndBridgeSolDataCctpData<CctpBridgeType>> {\n const {\n contractAddress,\n amount,\n fromAccountAddress,\n fromTokenAddress,\n toChainId,\n toAccountAddress,\n toTokenAddress,\n extraGas,\n } = txSendParams;\n const cctpAddress = contractAddress;\n if (!cctpAddress) {\n throw new CCTPDoesNotSupportedError(\"Such route does not support CCTP protocol\");\n }\n const CHAIN_ID = 4;\n\n const account = fromAccountAddress;\n const receiveTokenAddress = toTokenAddress;\n const receiverInBuffer32 = toAccountAddress;\n\n const provider = buildAnchorProvider(this.solanaRpcUrl, account);\n const cctpBridge: Program<CctpBridgeType> = new Program<CctpBridgeType>(\n { ...cctpBridgeIdl, address: cctpAddress },\n provider\n );\n const mint = new PublicKey(fromTokenAddress);\n const cctpBridgeAccount = await getCctpBridgeAccount(mint, cctpBridge.programId);\n const userAccount = new PublicKey(account);\n\n const configAccountInfo = await cctpBridge.account.cctpBridge.fetch(cctpBridgeAccount);\n\n const swapAndBridgeData = {} as SwapAndBridgeSolDataCctpData<CctpBridgeType>;\n\n swapAndBridgeData.cctpBridge = cctpBridge;\n swapAndBridgeData.cctpBridgeAccount = cctpBridgeAccount;\n swapAndBridgeData.cctpAddressAccount = new PublicKey(cctpAddress);\n swapAndBridgeData.amount = new BN(amount);\n swapAndBridgeData.recipient = Array.from(receiverInBuffer32);\n swapAndBridgeData.receiveToken = Array.from(receiveTokenAddress);\n swapAndBridgeData.userToken = getAssociatedAccount(userAccount, mint);\n swapAndBridgeData.bridgeAuthority = await getCctpAuthorityAccount(cctpBridgeAccount, cctpBridge.programId);\n swapAndBridgeData.bridgeTokenAccount = await getCctpBridgeTokenAccount(mint, cctpBridge.programId);\n swapAndBridgeData.chainBridgeAccount = await getChainBridgeAccount(toChainId, cctpBridge.programId);\n swapAndBridgeData.userAccount = userAccount;\n swapAndBridgeData.destinationChainId = toChainId;\n swapAndBridgeData.mint = mint;\n swapAndBridgeData.gasPrice = await getPriceAccount(toChainId, configAccountInfo.gasOracleProgramId);\n swapAndBridgeData.thisGasPrice = await getPriceAccount(CHAIN_ID, configAccountInfo.gasOracleProgramId);\n swapAndBridgeData.provider = provider;\n\n if (extraGas) {\n swapAndBridgeData.extraGasInstruction = this.getExtraGasInstruction(\n extraGas,\n swapAndBridgeData.userAccount,\n cctpBridgeAccount\n );\n }\n return swapAndBridgeData;\n }\n\n async buildSwapAndBridgeCctpTransaction(\n destinationChainSymbol: string,\n swapAndBridgeData: SwapAndBridgeSolDataCctpData<CctpBridgeType>\n ): Promise<{ transaction: VersionedTransaction; messageSentEventDataKeypair: Keypair }> {\n const {\n cctpBridge,\n cctpBridgeAccount,\n amount,\n recipient,\n receiveToken,\n bridgeAuthority,\n userToken,\n bridgeTokenAccount,\n chainBridgeAccount,\n userAccount,\n destinationChainId,\n mint,\n gasPrice,\n thisGasPrice,\n extraGasInstruction,\n provider,\n } = swapAndBridgeData;\n const domain = this.params.cctpParams.cctpDomains[destinationChainSymbol];\n const cctpTransmitterProgramIdAddress = this.params.cctpParams.cctpTransmitterProgramId;\n const cctpTokenMessengerMinterAddress = this.params.cctpParams.cctpTokenMessengerMinter;\n if (domain == undefined || !cctpTransmitterProgramIdAddress || !cctpTokenMessengerMinterAddress) {\n throw new SdkError(\"CCTP is not configured\");\n }\n const cctpTransmitterProgramId = new PublicKey(cctpTransmitterProgramIdAddress);\n const cctpTokenMessengerMinter = new PublicKey(cctpTokenMessengerMinterAddress);\n const {\n messageTransmitterAccount,\n tokenMessenger,\n tokenMessengerEventAuthority,\n tokenMinter,\n localToken,\n remoteTokenMessengerKey,\n authorityPda,\n } = getCctpAccounts(domain, mint, cctpTransmitterProgramId, cctpTokenMessengerMinter);\n\n const instructions: TransactionInstruction[] = [];\n if (extraGasInstruction) {\n instructions.push(extraGasInstruction);\n }\n\n const messageSentEventDataKeypair = Keypair.generate();\n const lockAccount = getCctpLockAccount(cctpBridge.programId, messageSentEventDataKeypair.publicKey);\n\n const tx = await cctpBridge.methods\n .bridge({\n amount,\n destinationChainId,\n recipient,\n receiveToken,\n })\n .accountsPartial({\n mint: mint,\n user: userAccount,\n cctpBridge: cctpBridgeAccount,\n payer: userAccount,\n\n messageSentEventData: messageSentEventDataKeypair.publicKey,\n lock: lockAccount,\n\n cctpMessenger: cctpTokenMessengerMinter,\n messageTransmitterProgram: cctpTransmitterProgramId,\n messageTransmitterAccount: messageTransmitterAccount,\n tokenMessenger: tokenMessenger,\n tokenMinter: tokenMinter,\n localToken: localToken,\n remoteTokenMessengerKey: remoteTokenMessengerKey,\n authorityPda: authorityPda,\n eventAuthority: tokenMessengerEventAuthority,\n\n bridgeToken: bridgeTokenAccount,\n gasPrice: gasPrice,\n thisGasPrice: thisGasPrice,\n chainBridge: chainBridgeAccount,\n userToken,\n bridgeAuthority: bridgeAuthority,\n })\n .preInstructions([\n web3.ComputeBudgetProgram.setComputeUnitLimit({\n units: 2000000,\n }),\n ])\n .postInstructions(instructions)\n .transaction();\n const connection = provider.connection;\n tx.recentBlockhash = (await connection.getLatestBlockhash()).blockhash;\n tx.feePayer = userAccount;\n return {\n transaction: await convertToVersionedTransaction(tx, connection, this.params.solanaLookUpTable),\n messageSentEventDataKeypair,\n };\n }\n\n private async prepareSwapAndBridgeCctpV2Data(\n txSendParams: SolTxSendParams\n ): Promise<SwapAndBridgeSolDataCctpData<CctpV2BridgeType>> {\n const {\n contractAddress,\n amount,\n fromAccountAddress,\n fromTokenAddress,\n toChainId,\n toAccountAddress,\n toTokenAddress,\n extraGas,\n } = txSendParams;\n const cctpV2BridgeAddress = contractAddress;\n if (!cctpV2BridgeAddress) {\n throw new CCTPDoesNotSupportedError(\"The route does not support CCTPv2 protocol\");\n }\n const CHAIN_ID = 4;\n\n const account = fromAccountAddress;\n const receiveTokenAddress = toTokenAddress;\n const receiverInBuffer32 = toAccountAddress;\n\n const provider = buildAnchorProvider(this.solanaRpcUrl, account);\n const cctpBridge: Program<CctpV2BridgeType> = new Program<CctpV2BridgeType>(\n { ...cctpV2BridgeIdl, address: cctpV2BridgeAddress },\n provider\n );\n const mint = new PublicKey(fromTokenAddress);\n const cctpBridgeConfigAccount = getCctpV2BridgeConfigAccount(mint, cctpBridge.programId);\n const userAccount = new PublicKey(account);\n\n const configAccountInfo = await cctpBridge.account.config.fetch(cctpBridgeConfigAccount);\n\n const swapAndBridgeData = {} as SwapAndBridgeSolDataCctpData<CctpV2BridgeType>;\n\n swapAndBridgeData.cctpBridge = cctpBridge;\n swapAndBridgeData.amount = new BN(amount);\n swapAndBridgeData.recipient = Array.from(receiverInBuffer32);\n swapAndBridgeData.receiveToken = Array.from(receiveTokenAddress);\n swapAndBridgeData.userToken = getAssociatedAccount(userAccount, mint);\n swapAndBridgeData.chainBridgeAccount = await getChainBridgeAccount(toChainId, cctpBridge.programId);\n swapAndBridgeData.userAccount = userAccount;\n swapAndBridgeData.destinationChainId = toChainId;\n swapAndBridgeData.mint = mint;\n swapAndBridgeData.gasPrice = await getPriceAccount(toChainId, configAccountInfo.gasOracleProgramId);\n swapAndBridgeData.thisGasPrice = await getPriceAccount(CHAIN_ID, configAccountInfo.gasOracleProgramId);\n swapAndBridgeData.provider = provider;\n\n if (extraGas) {\n swapAndBridgeData.extraGasInstruction = this.getExtraGasInstruction(\n extraGas,\n swapAndBridgeData.userAccount,\n cctpBridgeConfigAccount\n );\n }\n\n return swapAndBridgeData;\n }\n\n async buildSwapAndBridgeCctpV2Transaction(\n destinationChainSymbol: string,\n swapAndBridgeData: SwapAndBridgeSolDataCctpData<CctpV2BridgeType>\n ): Promise<{ transaction: VersionedTransaction; messageSentEventDataKeypair: Keypair }> {\n const {\n amount,\n cctpBridge: program,\n chainBridgeAccount,\n destinationChainId,\n extraGasInstruction,\n gasPrice,\n mint,\n provider,\n receiveToken,\n recipient,\n thisGasPrice,\n userAccount,\n userToken,\n } = swapAndBridgeData;\n const domain = this.params.cctpParams.cctpDomains[destinationChainSymbol];\n const cctpTransmitterProgramIdAddress = this.params.cctpParams.cctpV2TransmitterProgramId;\n const cctpTokenMessengerMinterAddress = this.params.cctpParams.cctpV2TokenMessengerMinter;\n if (domain == undefined || !cctpTransmitterProgramIdAddress || !cctpTokenMessengerMinterAddress) {\n throw new SdkError(\"CCTPv2 is not configured\");\n }\n const cctpTransmitterProgramId = new PublicKey(cctpTransmitterProgramIdAddress);\n const cctpTokenMessengerMinter = new PublicKey(cctpTokenMessengerMinterAddress);\n const {\n messageTransmitterAccount,\n tokenMessenger,\n tokenMessengerEventAuthority,\n tokenMinter,\n localToken,\n remoteTokenMessengerKey: remoteTokenMessenger,\n authorityPda,\n } = getCctpAccounts(domain, mint, cctpTransmitterProgramId, cctpTokenMessengerMinter);\n\n const instructions: TransactionInstruction[] = [];\n if (extraGasInstruction) {\n instructions.push(extraGasInstruction);\n }\n\n const messageSentEventDataKeypair = Keypair.generate();\n\n const tx = await program.methods\n .bridge({\n amount,\n destinationChainId,\n recipient,\n receiveToken,\n })\n .accounts({\n mint: mint,\n user: userAccount,\n messageSentEventData: messageSentEventDataKeypair.publicKey,\n tokenMessengerMinterProgram: cctpTokenMessengerMinter,\n messageTransmitterProgram: cctpTransmitterProgramId,\n messageTransmitterAccount: messageTransmitterAccount,\n tokenMessenger: tokenMessenger,\n tokenMinter: tokenMinter,\n localToken: localToken,\n remoteTokenMessenger: remoteTokenMessenger,\n authorityPda: authorityPda,\n eventAuthority: tokenMessengerEventAuthority,\n\n gasPrice: gasPrice,\n thisGasPrice: thisGasPrice,\n chainBridge: chainBridgeAccount,\n userToken,\n })\n .preInstructions([\n web3.ComputeBudgetProgram.setComputeUnitLimit({\n units: 2000000,\n }),\n ])\n .postInstructions(instructions)\n .transaction();\n const connection = provider.connection;\n tx.recentBlockhash = (await connection.getLatestBlockhash()).blockhash;\n tx.feePayer = userAccount;\n return {\n transaction: await convertToVersionedTransaction(tx, connection, this.params.solanaLookUpTable),\n messageSentEventDataKeypair,\n };\n }\n}\n"]}
1
+ {"version":3,"file":"bridge-tx-service.js","sourceRoot":"","sources":["../../../../../src/services/bridge/sol/bridge-tx-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAO,OAAO,EAAY,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACrE,OAAO,EAAE,uCAAuC,EAAE,6BAA6B,EAAE,MAAM,mBAAmB,CAAC;AAC3G,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,aAAa,EAAgD,MAAM,iBAAiB,CAAC;AAClH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpG,OAAO,EAAc,SAAS,EAA2B,MAAM,iBAAiB,CAAC;AACjF,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAGnD,OAAO,KAAK,SAAS,MAAM,oCAAoC,CAAC;AAEhE,OAAO,KAAK,aAAa,MAAM,yCAAyC,CAAC;AAEzE,OAAO,KAAK,eAAe,MAAM,4CAA4C,CAAC;AAC9E,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACjF,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,qBAAqB,EACrB,eAAe,EACf,uBAAuB,EACvB,oBAAoB,EACpB,yBAAyB,EACzB,kBAAkB,EAClB,4BAA4B,EAC5B,qBAAqB,EACrB,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,EACd,yBAAyB,EACzB,eAAe,EACf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AiB,CAAC;YAC/F,2BAA2B;SAC5B,CAAC;IACJ,CAAC;CACF","sourcesContent":["import { BN, Idl, Program, Provider, web3 } from \"@coral-xyz/anchor\";\nimport { createAssociatedTokenAccountInstruction, getAssociatedTokenAddressSync } from \"@solana/spl-token\";\nimport { Keypair, PublicKey, SystemProgram, TransactionInstruction, VersionedTransaction } from \"@solana/web3.js\";\nimport { Messenger } from \"../../../client/core-api/core-api.model\";\nimport { AllbridgeCoreClient } from \"../../../client/core-api/core-client-base\";\nimport { CCTPDoesNotSupportedError, OFTDoesNotSupportedError, SdkError } from \"../../../exceptions\";\nimport { CctpParams, ChainType, SwapParams, TxFeeParams } from \"../../../models\";\nimport { assertNever } from \"../../../utils/utils\";\nimport { RawTransaction } from \"../../models\";\nimport { Bridge as BridgeType } from \"../../models/sol/types/bridge\";\nimport * as bridgeIdl from \"../../models/sol/types/bridge.json\";\nimport { CctpBridge as CctpBridgeType } from \"../../models/sol/types/cctp_bridge\";\nimport * as cctpBridgeIdl from \"../../models/sol/types/cctp_bridge.json\";\nimport { CctpV2Bridge as CctpV2BridgeType } from \"../../models/sol/types/cctp_v2_bridge\";\nimport * as cctpV2BridgeIdl from \"../../models/sol/types/cctp_v2_bridge.json\";\nimport { getMessage, getTokenAccountData, getVUsdAmount } from \"../../utils/sol\";\nimport {\n getAssociatedAccount,\n getAuthorityAccount,\n getBridgeTokenAccount,\n getCctpAccounts,\n getCctpAuthorityAccount,\n getCctpBridgeAccount,\n getCctpBridgeTokenAccount,\n getCctpLockAccount,\n getCctpV2BridgeConfigAccount,\n getChainBridgeAccount,\n getConfigAccount,\n getGasUsageAccount,\n getLockAccount,\n getOtherChainTokenAccount,\n getPriceAccount,\n getSendMessageAccount,\n} from \"../../utils/sol/accounts\";\nimport { buildAnchorProvider } from \"../../utils/sol/anchor-provider\";\nimport { addUnitLimitAndUnitPriceToTx } from \"../../utils/sol/compute-budget\";\nimport { SendParams, TxSwapParamsSol } from \"../models\";\nimport { getNonce, prepareTxSwapParams } from \"../utils\";\nimport { convertToVersionedTransaction, SolTxSendParams } from \"./utils\";\n\ninterface SwapAndBridgeSolData {\n bridge: Program<BridgeType>;\n amount: BN;\n vusdAmount: BN;\n nonce: number[];\n recipient: number[];\n receiveToken: number[];\n poolAccount: PublicKey;\n lockAccount: PublicKey;\n bridgeAuthority: PublicKey;\n userToken: PublicKey;\n bridgeTokenAccount: PublicKey;\n chainBridgeAccount: PublicKey;\n otherBridgeTokenAccount: PublicKey;\n userAccount: PublicKey;\n destinationChainId: number;\n mint: PublicKey;\n config: PublicKey;\n configAccountInfo: ConfigAccountInfo;\n gasPrice: PublicKey;\n thisGasPrice: PublicKey;\n message: Buffer;\n extraGasInstruction?: TransactionInstruction;\n provider: Provider;\n}\n\ninterface ConfigAccountInfo {\n allbridgeMessengerProgramId: PublicKey;\n wormholeMessengerProgramId: PublicKey;\n gasOracleProgramId: PublicKey;\n}\n\ninterface SwapAndBridgeSolDataCctpData<IDL extends Idl> {\n cctpBridge: Program<IDL>;\n cctpBridgeAccount: PublicKey;\n cctpAddressAccount: PublicKey;\n amount: BN;\n recipient: number[];\n receiveToken: number[];\n userToken: PublicKey;\n bridgeAuthority: PublicKey;\n bridgeTokenAccount: PublicKey;\n chainBridgeAccount: PublicKey;\n userAccount: PublicKey;\n destinationChainId: number;\n mint: PublicKey;\n gasPrice: PublicKey;\n thisGasPrice: PublicKey;\n extraGasInstruction?: TransactionInstruction;\n provider: Provider;\n}\n\nexport interface SolanaBridgeParams {\n /** @deprecated Do not use. */\n wormholeMessengerProgramId?: string;\n solanaLookUpTable: string;\n cctpParams: CctpParams;\n}\n\nconst COMPUTE_UNIT_LIMIT = 1_000_000;\n\nexport class BridgeTxService {\n chainType: ChainType.SOLANA = ChainType.SOLANA;\n\n constructor(\n public solanaRpcUrl: string,\n public params: SolanaBridgeParams,\n public api: AllbridgeCoreClient\n ) {}\n\n /** @deprecated Do not use. */\n async buildRawTransactionSwap(params: SwapParams): Promise<RawTransaction> {\n const txSwapParams = prepareTxSwapParams(this.chainType, params);\n return await this.buildSwapTransaction(\n txSwapParams,\n params.sourceToken.poolAddress,\n params.destinationToken.poolAddress,\n params.txFeeParams\n );\n }\n\n private async buildSwapTransaction(\n params: TxSwapParamsSol,\n poolAddress: string,\n toPoolAddress: string,\n txFeeParams?: TxFeeParams\n ): Promise<VersionedTransaction> {\n const {\n fromAccountAddress,\n amount,\n contractAddress,\n fromTokenAddress,\n toTokenAddress,\n toAccountAddress,\n minimumReceiveAmount,\n } = params;\n const account = fromAccountAddress;\n const bridgeAddress = contractAddress;\n const tokenAddress = fromTokenAddress;\n const receiveTokenAddress = toTokenAddress;\n const receivePoolAddress = toPoolAddress;\n const receiverOriginal = toAccountAddress;\n\n const userAccount = new PublicKey(account);\n const provider = buildAnchorProvider(this.solanaRpcUrl, userAccount.toString());\n const bridge = new Program<BridgeType>({ ...bridgeIdl, address: bridgeAddress }, provider);\n\n const bridgeAuthority = await getAuthorityAccount(bridge.programId);\n const configAccount = await getConfigAccount(bridge.programId);\n\n const sendMint = new PublicKey(tokenAddress);\n const sendBridgeToken = await getBridgeTokenAccount(sendMint, bridge.programId);\n const sendPool = new PublicKey(poolAddress);\n const sendUserToken = getAssociatedAccount(userAccount, sendMint);\n\n const receiverAccount = new PublicKey(receiverOriginal);\n const receiveMint = new PublicKey(receiveTokenAddress);\n const receiveBridgeToken = await getBridgeTokenAccount(receiveMint, bridge.programId);\n const receivePool = new PublicKey(receivePoolAddress);\n const receiveUserToken = getAssociatedAccount(receiverAccount, receiveMint);\n\n const preInstructions: TransactionInstruction[] = [\n web3.ComputeBudgetProgram.setComputeUnitLimit({\n units: COMPUTE_UNIT_LIMIT,\n }),\n ];\n\n try {\n await getTokenAccountData(receiveUserToken, provider);\n } catch (ignoreError) {\n const receiveUserToken = getAssociatedTokenAddressSync(receiveMint, receiverAccount);\n const createReceiveUserTokenInstruction = createAssociatedTokenAccountInstruction(\n userAccount,\n receiveUserToken,\n receiverAccount,\n receiveMint\n );\n preInstructions.push(createReceiveUserTokenInstruction);\n }\n const transaction = await bridge.methods\n .swap(new BN(amount), new BN(minimumReceiveAmount || 0))\n .accountsPartial({\n payer: userAccount,\n config: configAccount,\n bridgeAuthority,\n user: userAccount,\n sendBridgeToken,\n sendMint,\n sendPool,\n sendUserToken,\n receiveBridgeToken,\n receiveMint,\n receivePool,\n receiveUserToken,\n })\n .preInstructions(preInstructions)\n .transaction();\n\n const connection = provider.connection;\n transaction.recentBlockhash = (await connection.getLatestBlockhash()).blockhash;\n transaction.feePayer = userAccount;\n await addUnitLimitAndUnitPriceToTx(transaction, txFeeParams, this.solanaRpcUrl);\n return await convertToVersionedTransaction(transaction, connection, this.params.solanaLookUpTable);\n }\n\n async buildRawTransactionSend(\n params: SendParams,\n solTxSendParams: SolTxSendParams\n ): Promise<{ tx: VersionedTransaction; requiredMessageSigner: Keypair | undefined }> {\n let swapAndBridgeTx: VersionedTransaction;\n let requiredMessageSigner: Keypair | undefined = undefined;\n switch (params.messenger) {\n case Messenger.ALLBRIDGE: {\n const swapAndBridgeSolData = await this.prepareSwapAndBridgeData(solTxSendParams);\n swapAndBridgeTx = await this.buildSwapAndBridgeAllbridgeTransaction(swapAndBridgeSolData);\n break;\n }\n case Messenger.WORMHOLE: {\n const swapAndBridgeSolData = await this.prepareSwapAndBridgeData(solTxSendParams);\n const { transaction, messageAccount } = await this.buildSwapAndBridgeWormholeTransaction(swapAndBridgeSolData);\n swapAndBridgeTx = transaction;\n requiredMessageSigner = messageAccount;\n break;\n }\n case Messenger.CCTP: {\n const swapAndBridgeSolData = await this.prepareSwapAndBridgeCctpData(solTxSendParams);\n const { transaction, messageSentEventDataKeypair } = await this.buildSwapAndBridgeCctpTransaction(\n params.destinationToken.chainSymbol,\n swapAndBridgeSolData\n );\n swapAndBridgeTx = transaction;\n requiredMessageSigner = messageSentEventDataKeypair;\n break;\n }\n case Messenger.CCTP_V2: {\n const swapAndBridgeSolData = await this.prepareSwapAndBridgeCctpV2Data(solTxSendParams);\n const { transaction, messageSentEventDataKeypair } = await this.buildSwapAndBridgeCctpV2Transaction(\n params.destinationToken.chainSymbol,\n swapAndBridgeSolData\n );\n swapAndBridgeTx = transaction;\n requiredMessageSigner = messageSentEventDataKeypair;\n break;\n }\n case Messenger.X_RESERVE:\n throw new SdkError(\"Messenger xReserve is not supported yet.\");\n case Messenger.OFT:\n throw new OFTDoesNotSupportedError(\"Messenger OFT is not supported yet.\");\n default: {\n return assertNever(params.messenger, \"Unhandled Messenger type\");\n }\n }\n return { tx: swapAndBridgeTx, requiredMessageSigner };\n }\n private getExtraGasInstruction(\n extraGas: string,\n userAccount: PublicKey,\n configAccount: PublicKey\n ): TransactionInstruction | undefined {\n return web3.SystemProgram.transfer({\n fromPubkey: userAccount,\n toPubkey: configAccount,\n lamports: +extraGas,\n });\n }\n\n private async prepareSwapAndBridgeData(txSendParams: SolTxSendParams): Promise<SwapAndBridgeSolData> {\n const {\n amount,\n contractAddress,\n fromChainId,\n fromAccountAddress,\n fromTokenAddress,\n toChainId,\n toAccountAddress,\n toTokenAddress,\n poolAddress,\n extraGas,\n } = txSendParams;\n const tokenAddress = fromTokenAddress;\n const account = fromAccountAddress;\n const destinationChainId = toChainId;\n const receiveTokenAddress = toTokenAddress;\n const receiverInBuffer32 = toAccountAddress;\n const bridgeAddress = contractAddress;\n const sourceChainId = fromChainId;\n\n const provider = buildAnchorProvider(this.solanaRpcUrl, account);\n const bridge = new Program<BridgeType>({ ...bridgeIdl, address: bridgeAddress }, provider);\n const nonce = Array.from(getNonce());\n const poolAccount = new PublicKey(poolAddress);\n const vUsdAmount = await getVUsdAmount(amount, bridge, poolAccount);\n\n const lockAccount = await getLockAccount(nonce, bridge.programId);\n const bridgeAuthority = await getAuthorityAccount(bridge.programId);\n const userToken = getAssociatedAccount(new PublicKey(account), new PublicKey(tokenAddress));\n const bridgeTokenAccount = await getBridgeTokenAccount(new PublicKey(tokenAddress), bridge.programId);\n const chainBridgeAccount = await getChainBridgeAccount(destinationChainId, bridge.programId);\n const otherBridgeTokenAccount = await getOtherChainTokenAccount(\n destinationChainId,\n Buffer.from(receiveTokenAddress),\n bridge.programId\n );\n\n const configAccount = await getConfigAccount(bridge.programId);\n const configAccountInfo = await bridge.account.config.fetch(configAccount);\n const priceAccount = await getPriceAccount(destinationChainId, configAccountInfo.gasOracleProgramId);\n const thisGasPriceAccount = await getPriceAccount(sourceChainId, configAccountInfo.gasOracleProgramId);\n\n const message = getMessage({\n amount: vUsdAmount,\n recipient: Buffer.from(receiverInBuffer32),\n nonce: Buffer.from(nonce),\n receiveToken: Buffer.from(receiveTokenAddress),\n destinationChainId,\n sourceChainId,\n chainBridge: (await getAuthorityAccount(bridge.programId)).toBuffer(),\n });\n\n const swapAndBridgeData = {} as SwapAndBridgeSolData;\n\n swapAndBridgeData.bridge = bridge;\n swapAndBridgeData.amount = new BN(amount);\n swapAndBridgeData.vusdAmount = new BN(vUsdAmount);\n swapAndBridgeData.nonce = nonce;\n swapAndBridgeData.recipient = Array.from(receiverInBuffer32);\n swapAndBridgeData.receiveToken = Array.from(receiveTokenAddress);\n swapAndBridgeData.poolAccount = poolAccount;\n swapAndBridgeData.lockAccount = lockAccount;\n swapAndBridgeData.bridgeAuthority = bridgeAuthority;\n swapAndBridgeData.userToken = userToken;\n swapAndBridgeData.bridgeTokenAccount = bridgeTokenAccount;\n swapAndBridgeData.chainBridgeAccount = chainBridgeAccount;\n swapAndBridgeData.otherBridgeTokenAccount = otherBridgeTokenAccount;\n swapAndBridgeData.userAccount = new PublicKey(account);\n swapAndBridgeData.destinationChainId = destinationChainId;\n swapAndBridgeData.mint = new PublicKey(tokenAddress);\n swapAndBridgeData.config = configAccount;\n swapAndBridgeData.configAccountInfo = configAccountInfo;\n swapAndBridgeData.gasPrice = priceAccount;\n swapAndBridgeData.thisGasPrice = thisGasPriceAccount;\n swapAndBridgeData.message = message;\n\n if (extraGas) {\n swapAndBridgeData.extraGasInstruction = this.getExtraGasInstruction(\n extraGas,\n swapAndBridgeData.userAccount,\n configAccount\n );\n }\n return swapAndBridgeData;\n }\n\n private async buildSwapAndBridgeAllbridgeTransaction(\n swapAndBridgeData: SwapAndBridgeSolData\n ): Promise<VersionedTransaction> {\n const {\n bridge,\n vusdAmount,\n nonce,\n recipient,\n receiveToken,\n poolAccount,\n lockAccount,\n bridgeAuthority,\n userToken,\n bridgeTokenAccount,\n chainBridgeAccount,\n otherBridgeTokenAccount,\n userAccount,\n destinationChainId,\n mint,\n config,\n configAccountInfo,\n gasPrice,\n thisGasPrice,\n message,\n extraGasInstruction,\n } = swapAndBridgeData;\n const allbridgeMessengerProgramId = configAccountInfo.allbridgeMessengerProgramId;\n const messengerGasUsageAccount = await getGasUsageAccount(destinationChainId, allbridgeMessengerProgramId);\n const messengerConfig = await getConfigAccount(allbridgeMessengerProgramId);\n\n const sentMessageAccount = await getSendMessageAccount(message, allbridgeMessengerProgramId);\n\n const instructions: TransactionInstruction[] = [];\n if (extraGasInstruction) {\n instructions.push(extraGasInstruction);\n }\n\n const transaction = await bridge.methods\n .swapAndBridge({\n vusdAmount,\n nonce,\n destinationChainId,\n recipient,\n receiveToken,\n })\n .accountsPartial({\n payer: userAccount,\n mint,\n user: userAccount,\n config,\n lock: lockAccount,\n pool: poolAccount,\n gasPrice,\n thisGasPrice,\n bridgeAuthority,\n userToken,\n bridgeToken: bridgeTokenAccount,\n chainBridge: chainBridgeAccount,\n messenger: allbridgeMessengerProgramId,\n messengerGasUsage: messengerGasUsageAccount,\n messengerConfig,\n sentMessageAccount,\n otherBridgeToken: otherBridgeTokenAccount,\n })\n .preInstructions([\n web3.ComputeBudgetProgram.setComputeUnitLimit({\n units: COMPUTE_UNIT_LIMIT,\n }),\n ])\n .postInstructions(instructions)\n .transaction();\n const connection = buildAnchorProvider(this.solanaRpcUrl, userAccount.toString()).connection;\n transaction.recentBlockhash = (await connection.getLatestBlockhash()).blockhash;\n transaction.feePayer = userAccount;\n return await convertToVersionedTransaction(transaction, connection, this.params.solanaLookUpTable);\n }\n\n private async buildSwapAndBridgeWormholeTransaction(\n swapAndBridgeData: SwapAndBridgeSolData\n ): Promise<{ transaction: VersionedTransaction; messageAccount: Keypair }> {\n const {\n bridge,\n vusdAmount,\n nonce,\n recipient,\n receiveToken,\n poolAccount,\n lockAccount,\n bridgeAuthority,\n userToken,\n bridgeTokenAccount,\n chainBridgeAccount,\n otherBridgeTokenAccount,\n userAccount,\n destinationChainId,\n mint,\n config,\n configAccountInfo,\n gasPrice,\n thisGasPrice,\n extraGasInstruction,\n } = swapAndBridgeData;\n const wormholeProgramId = this.params.wormholeMessengerProgramId;\n if (!wormholeProgramId) {\n throw new SdkError(\"Do not use.\");\n }\n\n const [whBridgeAccount] = PublicKey.findProgramAddressSync(\n [Buffer.from(\"Bridge\")],\n new PublicKey(wormholeProgramId)\n );\n const [whFeeCollectorAccount] = PublicKey.findProgramAddressSync(\n [Buffer.from(\"fee_collector\")],\n new PublicKey(wormholeProgramId)\n );\n const [whSequenceAccount] = PublicKey.findProgramAddressSync(\n [Buffer.from(\"Sequence\"), bridgeAuthority.toBuffer()],\n new PublicKey(wormholeProgramId)\n );\n\n const messengerGasUsageAccount = await getGasUsageAccount(\n destinationChainId,\n configAccountInfo.wormholeMessengerProgramId\n );\n const wormholeMessengerConfigAccount = await getConfigAccount(configAccountInfo.wormholeMessengerProgramId);\n const messageAccount = Keypair.generate();\n\n const provider = buildAnchorProvider(this.solanaRpcUrl, userAccount.toString());\n\n const bridgeAccountInfo = await provider.connection.getAccountInfo(whBridgeAccount);\n if (bridgeAccountInfo == null) {\n throw new SdkError(\"Cannot fetch wormhole bridge account info\");\n }\n const feeLamports = new BN(bridgeAccountInfo.data.slice(16, 24), \"le\").toString();\n\n const feeInstruction = SystemProgram.transfer({\n fromPubkey: userAccount,\n toPubkey: whFeeCollectorAccount,\n lamports: +feeLamports,\n });\n\n const instructions: TransactionInstruction[] = [];\n if (extraGasInstruction) {\n instructions.push(extraGasInstruction);\n }\n\n const accounts = {\n payer: userAccount,\n mint,\n user: userAccount,\n config,\n lock: lockAccount,\n pool: poolAccount,\n gasPrice,\n thisGasPrice,\n bridgeAuthority,\n userToken,\n bridgeToken: bridgeTokenAccount,\n chainBridge: chainBridgeAccount,\n otherBridgeToken: otherBridgeTokenAccount,\n messengerGasUsage: messengerGasUsageAccount,\n wormholeProgram: wormholeProgramId,\n bridge: whBridgeAccount,\n message: messageAccount.publicKey,\n wormholeMessenger: configAccountInfo.wormholeMessengerProgramId,\n sequence: whSequenceAccount,\n feeCollector: whFeeCollectorAccount,\n wormholeMessengerConfig: wormholeMessengerConfigAccount,\n clock: web3.SYSVAR_CLOCK_PUBKEY,\n };\n\n const transaction = await bridge.methods\n .swapAndBridgeWormhole({\n vusdAmount,\n nonce: nonce,\n destinationChainId,\n recipient,\n receiveToken,\n })\n .accounts(accounts)\n .preInstructions([\n web3.ComputeBudgetProgram.setComputeUnitLimit({\n units: COMPUTE_UNIT_LIMIT,\n }),\n feeInstruction,\n ])\n .postInstructions(instructions)\n .signers([messageAccount])\n .transaction();\n transaction.recentBlockhash = (await provider.connection.getLatestBlockhash()).blockhash;\n transaction.feePayer = userAccount;\n return {\n transaction: await convertToVersionedTransaction(transaction, provider.connection, this.params.solanaLookUpTable),\n messageAccount,\n };\n }\n\n private async prepareSwapAndBridgeCctpData(\n txSendParams: SolTxSendParams\n ): Promise<SwapAndBridgeSolDataCctpData<CctpBridgeType>> {\n const {\n contractAddress,\n amount,\n fromAccountAddress,\n fromTokenAddress,\n toChainId,\n toAccountAddress,\n toTokenAddress,\n extraGas,\n } = txSendParams;\n const cctpAddress = contractAddress;\n if (!cctpAddress) {\n throw new CCTPDoesNotSupportedError(\"Such route does not support CCTP protocol\");\n }\n const CHAIN_ID = 4;\n\n const account = fromAccountAddress;\n const receiveTokenAddress = toTokenAddress;\n const receiverInBuffer32 = toAccountAddress;\n\n const provider = buildAnchorProvider(this.solanaRpcUrl, account);\n const cctpBridge: Program<CctpBridgeType> = new Program<CctpBridgeType>(\n { ...cctpBridgeIdl, address: cctpAddress },\n provider\n );\n const mint = new PublicKey(fromTokenAddress);\n const cctpBridgeAccount = await getCctpBridgeAccount(mint, cctpBridge.programId);\n const userAccount = new PublicKey(account);\n\n const configAccountInfo = await cctpBridge.account.cctpBridge.fetch(cctpBridgeAccount);\n\n const swapAndBridgeData = {} as SwapAndBridgeSolDataCctpData<CctpBridgeType>;\n\n swapAndBridgeData.cctpBridge = cctpBridge;\n swapAndBridgeData.cctpBridgeAccount = cctpBridgeAccount;\n swapAndBridgeData.cctpAddressAccount = new PublicKey(cctpAddress);\n swapAndBridgeData.amount = new BN(amount);\n swapAndBridgeData.recipient = Array.from(receiverInBuffer32);\n swapAndBridgeData.receiveToken = Array.from(receiveTokenAddress);\n swapAndBridgeData.userToken = getAssociatedAccount(userAccount, mint);\n swapAndBridgeData.bridgeAuthority = await getCctpAuthorityAccount(cctpBridgeAccount, cctpBridge.programId);\n swapAndBridgeData.bridgeTokenAccount = await getCctpBridgeTokenAccount(mint, cctpBridge.programId);\n swapAndBridgeData.chainBridgeAccount = await getChainBridgeAccount(toChainId, cctpBridge.programId);\n swapAndBridgeData.userAccount = userAccount;\n swapAndBridgeData.destinationChainId = toChainId;\n swapAndBridgeData.mint = mint;\n swapAndBridgeData.gasPrice = await getPriceAccount(toChainId, configAccountInfo.gasOracleProgramId);\n swapAndBridgeData.thisGasPrice = await getPriceAccount(CHAIN_ID, configAccountInfo.gasOracleProgramId);\n swapAndBridgeData.provider = provider;\n\n if (extraGas) {\n swapAndBridgeData.extraGasInstruction = this.getExtraGasInstruction(\n extraGas,\n swapAndBridgeData.userAccount,\n cctpBridgeAccount\n );\n }\n return swapAndBridgeData;\n }\n\n async buildSwapAndBridgeCctpTransaction(\n destinationChainSymbol: string,\n swapAndBridgeData: SwapAndBridgeSolDataCctpData<CctpBridgeType>\n ): Promise<{ transaction: VersionedTransaction; messageSentEventDataKeypair: Keypair }> {\n const {\n cctpBridge,\n cctpBridgeAccount,\n amount,\n recipient,\n receiveToken,\n bridgeAuthority,\n userToken,\n bridgeTokenAccount,\n chainBridgeAccount,\n userAccount,\n destinationChainId,\n mint,\n gasPrice,\n thisGasPrice,\n extraGasInstruction,\n provider,\n } = swapAndBridgeData;\n const domain = this.params.cctpParams.cctpDomains[destinationChainSymbol];\n const cctpTransmitterProgramIdAddress = this.params.cctpParams.cctpTransmitterProgramId;\n const cctpTokenMessengerMinterAddress = this.params.cctpParams.cctpTokenMessengerMinter;\n if (domain == undefined || !cctpTransmitterProgramIdAddress || !cctpTokenMessengerMinterAddress) {\n throw new SdkError(\"CCTP is not configured\");\n }\n const cctpTransmitterProgramId = new PublicKey(cctpTransmitterProgramIdAddress);\n const cctpTokenMessengerMinter = new PublicKey(cctpTokenMessengerMinterAddress);\n const {\n messageTransmitterAccount,\n tokenMessenger,\n tokenMessengerEventAuthority,\n tokenMinter,\n localToken,\n remoteTokenMessengerKey,\n authorityPda,\n } = getCctpAccounts(domain, mint, cctpTransmitterProgramId, cctpTokenMessengerMinter);\n\n const instructions: TransactionInstruction[] = [];\n if (extraGasInstruction) {\n instructions.push(extraGasInstruction);\n }\n\n const messageSentEventDataKeypair = Keypair.generate();\n const lockAccount = getCctpLockAccount(cctpBridge.programId, messageSentEventDataKeypair.publicKey);\n\n const tx = await cctpBridge.methods\n .bridge({\n amount,\n destinationChainId,\n recipient,\n receiveToken,\n })\n .accountsPartial({\n mint: mint,\n user: userAccount,\n cctpBridge: cctpBridgeAccount,\n payer: userAccount,\n\n messageSentEventData: messageSentEventDataKeypair.publicKey,\n lock: lockAccount,\n\n cctpMessenger: cctpTokenMessengerMinter,\n messageTransmitterProgram: cctpTransmitterProgramId,\n messageTransmitterAccount: messageTransmitterAccount,\n tokenMessenger: tokenMessenger,\n tokenMinter: tokenMinter,\n localToken: localToken,\n remoteTokenMessengerKey: remoteTokenMessengerKey,\n authorityPda: authorityPda,\n eventAuthority: tokenMessengerEventAuthority,\n\n bridgeToken: bridgeTokenAccount,\n gasPrice: gasPrice,\n thisGasPrice: thisGasPrice,\n chainBridge: chainBridgeAccount,\n userToken,\n bridgeAuthority: bridgeAuthority,\n })\n .preInstructions([\n web3.ComputeBudgetProgram.setComputeUnitLimit({\n units: 2000000,\n }),\n ])\n .postInstructions(instructions)\n .transaction();\n const connection = provider.connection;\n tx.recentBlockhash = (await connection.getLatestBlockhash()).blockhash;\n tx.feePayer = userAccount;\n return {\n transaction: await convertToVersionedTransaction(tx, connection, this.params.solanaLookUpTable),\n messageSentEventDataKeypair,\n };\n }\n\n private async prepareSwapAndBridgeCctpV2Data(\n txSendParams: SolTxSendParams\n ): Promise<SwapAndBridgeSolDataCctpData<CctpV2BridgeType>> {\n const {\n contractAddress,\n amount,\n fromAccountAddress,\n fromTokenAddress,\n toChainId,\n toAccountAddress,\n toTokenAddress,\n extraGas,\n } = txSendParams;\n const cctpV2BridgeAddress = contractAddress;\n if (!cctpV2BridgeAddress) {\n throw new CCTPDoesNotSupportedError(\"The route does not support CCTPv2 protocol\");\n }\n const CHAIN_ID = 4;\n\n const account = fromAccountAddress;\n const receiveTokenAddress = toTokenAddress;\n const receiverInBuffer32 = toAccountAddress;\n\n const provider = buildAnchorProvider(this.solanaRpcUrl, account);\n const cctpBridge: Program<CctpV2BridgeType> = new Program<CctpV2BridgeType>(\n { ...cctpV2BridgeIdl, address: cctpV2BridgeAddress },\n provider\n );\n const mint = new PublicKey(fromTokenAddress);\n const cctpBridgeConfigAccount = getCctpV2BridgeConfigAccount(mint, cctpBridge.programId);\n const userAccount = new PublicKey(account);\n\n const configAccountInfo = await cctpBridge.account.config.fetch(cctpBridgeConfigAccount);\n\n const swapAndBridgeData = {} as SwapAndBridgeSolDataCctpData<CctpV2BridgeType>;\n\n swapAndBridgeData.cctpBridge = cctpBridge;\n swapAndBridgeData.amount = new BN(amount);\n swapAndBridgeData.recipient = Array.from(receiverInBuffer32);\n swapAndBridgeData.receiveToken = Array.from(receiveTokenAddress);\n swapAndBridgeData.userToken = getAssociatedAccount(userAccount, mint);\n swapAndBridgeData.chainBridgeAccount = await getChainBridgeAccount(toChainId, cctpBridge.programId);\n swapAndBridgeData.userAccount = userAccount;\n swapAndBridgeData.destinationChainId = toChainId;\n swapAndBridgeData.mint = mint;\n swapAndBridgeData.gasPrice = await getPriceAccount(toChainId, configAccountInfo.gasOracleProgramId);\n swapAndBridgeData.thisGasPrice = await getPriceAccount(CHAIN_ID, configAccountInfo.gasOracleProgramId);\n swapAndBridgeData.provider = provider;\n\n if (extraGas) {\n swapAndBridgeData.extraGasInstruction = this.getExtraGasInstruction(\n extraGas,\n swapAndBridgeData.userAccount,\n cctpBridgeConfigAccount\n );\n }\n\n return swapAndBridgeData;\n }\n\n async buildSwapAndBridgeCctpV2Transaction(\n destinationChainSymbol: string,\n swapAndBridgeData: SwapAndBridgeSolDataCctpData<CctpV2BridgeType>\n ): Promise<{ transaction: VersionedTransaction; messageSentEventDataKeypair: Keypair }> {\n const {\n amount,\n cctpBridge: program,\n chainBridgeAccount,\n destinationChainId,\n extraGasInstruction,\n gasPrice,\n mint,\n provider,\n receiveToken,\n recipient,\n thisGasPrice,\n userAccount,\n userToken,\n } = swapAndBridgeData;\n const domain = this.params.cctpParams.cctpDomains[destinationChainSymbol];\n const cctpTransmitterProgramIdAddress = this.params.cctpParams.cctpV2TransmitterProgramId;\n const cctpTokenMessengerMinterAddress = this.params.cctpParams.cctpV2TokenMessengerMinter;\n if (domain == undefined || !cctpTransmitterProgramIdAddress || !cctpTokenMessengerMinterAddress) {\n throw new SdkError(\"CCTPv2 is not configured\");\n }\n const cctpTransmitterProgramId = new PublicKey(cctpTransmitterProgramIdAddress);\n const cctpTokenMessengerMinter = new PublicKey(cctpTokenMessengerMinterAddress);\n const {\n messageTransmitterAccount,\n tokenMessenger,\n tokenMessengerEventAuthority,\n tokenMinter,\n localToken,\n remoteTokenMessengerKey: remoteTokenMessenger,\n authorityPda,\n } = getCctpAccounts(domain, mint, cctpTransmitterProgramId, cctpTokenMessengerMinter);\n\n const instructions: TransactionInstruction[] = [];\n if (extraGasInstruction) {\n instructions.push(extraGasInstruction);\n }\n\n const messageSentEventDataKeypair = Keypair.generate();\n\n const tx = await program.methods\n .bridge({\n amount,\n destinationChainId,\n recipient,\n receiveToken,\n })\n .accounts({\n mint: mint,\n user: userAccount,\n messageSentEventData: messageSentEventDataKeypair.publicKey,\n tokenMessengerMinterProgram: cctpTokenMessengerMinter,\n messageTransmitterProgram: cctpTransmitterProgramId,\n messageTransmitterAccount: messageTransmitterAccount,\n tokenMessenger: tokenMessenger,\n tokenMinter: tokenMinter,\n localToken: localToken,\n remoteTokenMessenger: remoteTokenMessenger,\n authorityPda: authorityPda,\n eventAuthority: tokenMessengerEventAuthority,\n\n gasPrice: gasPrice,\n thisGasPrice: thisGasPrice,\n chainBridge: chainBridgeAccount,\n userToken,\n })\n .preInstructions([\n web3.ComputeBudgetProgram.setComputeUnitLimit({\n units: 2000000,\n }),\n ])\n .postInstructions(instructions)\n .transaction();\n const connection = provider.connection;\n tx.recentBlockhash = (await connection.getLatestBlockhash()).blockhash;\n tx.feePayer = userAccount;\n return {\n transaction: await convertToVersionedTransaction(tx, connection, this.params.solanaLookUpTable),\n messageSentEventDataKeypair,\n };\n }\n}\n"]}
@@ -5,7 +5,7 @@ import { ChainBridgeService, SendParams } from "../models";
5
5
  import { JupiterParams } from "./jupiter-service";
6
6
  export interface SolanaBridgeParams {
7
7
  /** @deprecated Do not use. */
8
- wormholeMessengerProgramId: string;
8
+ wormholeMessengerProgramId?: string;
9
9
  solanaLookUpTable: string;
10
10
  cctpParams: CctpParams;
11
11
  jupiterParams: JupiterParams;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/services/bridge/sol/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAiC,MAAM,iBAAiB,CAAC;AAE5E,OAAO,EAAE,YAAY,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC5E,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAc,MA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ED,IAAI,CAAC,OAAmB;QACtB,MAAM,IAAI,uBAAuB,EAAE,CAAC;IACtC,CAAC;IAEO,cAAc,CAAC,MAAkB,EAAE,YAA6B;QACtE,OAAO;YACL,GAAG,YAAY;YACf,WAAW,EAAE,MAAM,CAAC,WAAW,CAAC,WAAW;SAC5C,CAAC;IACJ,CAAC;CACF","sourcesContent":["import { Connection, Keypair, VersionedTransaction } from \"@solana/web3.js\";\nimport { AllbridgeCoreClient } from \"../../../client/core-api/core-client-base\";\nimport { JupiterError, MethodNotSupportedError } from \"../../../exceptions\";\nimport { ChainType, FeePaymentMethod, SwapParams } from \"../../../models\";\nimport { assertNever } from \"../../../utils/utils\";\nimport { RawTransaction, TransactionResponse } from \"../../models\";\nimport { addUnitLimitAndUnitPriceToVersionedTx } from \"../../utils/sol/compute-budget\";\nimport { ChainBridgeService, SendParams, TxSendParamsSol } from \"../models\";\nimport { prepareTxSendParams } from \"../utils\";\nimport { BridgeTxService } from \"./bridge-tx-service\";\nimport { JupiterParams, JupiterService } from \"./jupiter-service\";\nimport { PayerWithTokenService } from \"./payer-with-token-service\";\nimport { amendJupiterWithSdkTx, SolTxSendParams } from \"./utils\";\n\nexport interface SolanaBridgeParams {\n /** @deprecated Do not use. */\n wormholeMessengerProgramId: string;\n solanaLookUpTable: string;\n cctpParams: CctpParams;\n jupiterParams: JupiterParams;\n}\n\nexport interface CctpParams {\n cctpTransmitterProgramId: string;\n cctpTokenMessengerMinter: string;\n cctpV2TransmitterProgramId: string;\n cctpV2TokenMessengerMinter: string;\n cctpDomains: CctpDomains;\n}\n\n/**\n * Type representing a map of CCTP domains to their corresponding numeric values.\n *\n * @typedef {Record<string, number>} CctpDomains\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 {number} value - The numeric value associated with the specified chain.\n */\nexport type CctpDomains = Record<string, number>;\n\nexport class SolanaBridgeService extends ChainBridgeService {\n chainType: ChainType.SOLANA = ChainType.SOLANA;\n\n private readonly connection: Connection;\n private jupiterService: JupiterService;\n private bridgeTxService: BridgeTxService;\n private payerWithTokenService: PayerWithTokenService;\n\n constructor(\n public solanaRpcUrl: string,\n public params: SolanaBridgeParams,\n public api: AllbridgeCoreClient\n ) {\n super();\n this.connection = new Connection(solanaRpcUrl);\n this.jupiterService = new JupiterService(api, params.jupiterParams);\n this.bridgeTxService = new BridgeTxService(solanaRpcUrl, params, api);\n this.payerWithTokenService = new PayerWithTokenService(solanaRpcUrl, params, api);\n }\n\n /** @deprecated Do not use. */\n async buildRawTransactionSwap(params: SwapParams): Promise<RawTransaction> {\n return this.bridgeTxService.buildRawTransactionSwap(params);\n }\n\n async buildRawTransactionSend(params: SendParams): Promise<RawTransaction> {\n const txSendParams = await prepareTxSendParams(this.chainType, params, this.api);\n const solTxSendParams = this.addPoolAddress(params, txSendParams);\n\n const paymentType = params.gasFeePaymentMethod ?? FeePaymentMethod.WITH_NATIVE_CURRENCY;\n\n let tx: VersionedTransaction;\n let requiredMessageSigner: Keypair | undefined;\n\n switch (paymentType) {\n case FeePaymentMethod.WITH_NATIVE_CURRENCY: {\n const builtTxResult = await this.buildTxWithNativePayment(params, solTxSendParams);\n tx = builtTxResult.tx;\n requiredMessageSigner = builtTxResult.requiredMessageSigner;\n break;\n }\n case FeePaymentMethod.WITH_STABLECOIN: {\n const builtTxResult = await this.buildTxWithStablePayment(params, solTxSendParams);\n tx = builtTxResult.tx;\n requiredMessageSigner = builtTxResult.requiredMessageSigner;\n break;\n }\n case FeePaymentMethod.WITH_ABR: {\n const builtTxResult = await this.buildTxWithAbrPayment(params, solTxSendParams);\n tx = builtTxResult.tx;\n requiredMessageSigner = builtTxResult.requiredMessageSigner;\n break;\n }\n default: {\n return assertNever(paymentType, \"Unhandled FeePaymentMethod\");\n }\n }\n await addUnitLimitAndUnitPriceToVersionedTx(tx, params.txFeeParams, this.solanaRpcUrl);\n\n if (requiredMessageSigner) {\n tx.sign([requiredMessageSigner]);\n }\n return tx;\n }\n\n private async buildTxWithNativePayment(\n params: SendParams,\n solTxSendParams: SolTxSendParams\n ): Promise<{ tx: VersionedTransaction; requiredMessageSigner: Keypair | undefined }> {\n return await this.bridgeTxService.buildRawTransactionSend(params, solTxSendParams);\n }\n\n private async buildTxWithStablePayment(\n params: SendParams,\n solTxSendParams: SolTxSendParams\n ): Promise<{ tx: VersionedTransaction; requiredMessageSigner: Keypair | undefined }> {\n const { jupTx, solTxSendParams: updatedSolTxSendParams } = await this.jupiterService.buildJupAndUpdateTxSendParams(\n params,\n solTxSendParams\n );\n\n const { tx, requiredMessageSigner } = await this.bridgeTxService.buildRawTransactionSend(\n params,\n updatedSolTxSendParams\n );\n\n if (!jupTx) {\n throw new JupiterError(\"Swap tx is absent\");\n }\n const resultTx = await amendJupiterWithSdkTx(this.connection, jupTx, tx);\n return { tx: resultTx, requiredMessageSigner: requiredMessageSigner };\n }\n\n private async buildTxWithAbrPayment(\n params: SendParams,\n solTxSendParams: SolTxSendParams\n ): Promise<{ tx: VersionedTransaction; requiredMessageSigner?: Keypair }> {\n return this.payerWithTokenService.buildRawTransactionSend(params, solTxSendParams);\n }\n\n send(_params: SendParams): Promise<TransactionResponse> {\n throw new MethodNotSupportedError();\n }\n\n private addPoolAddress(params: SendParams, txSendParams: TxSendParamsSol): SolTxSendParams {\n return {\n ...txSendParams,\n poolAddress: params.sourceToken.poolAddress,\n };\n }\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/services/bridge/sol/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAiC,MAAM,iBAAiB,CAAC;AAE5E,OAAO,EAAE,YAAY,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC5E,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAc,MAAM,iBAAiB,CAAC;AAC1E,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,OAAO,EAAE,qCAAqC,E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AAE,YAA6B;QACtE,OAAO;YACL,GAAG,YAAY;YACf,WAAW,EAAE,MAAM,CAAC,WAAW,CAAC,WAAW;SAC5C,CAAC;IACJ,CAAC;CACF","sourcesContent":["import { Connection, Keypair, VersionedTransaction } from \"@solana/web3.js\";\nimport { AllbridgeCoreClient } from \"../../../client/core-api/core-client-base\";\nimport { JupiterError, MethodNotSupportedError } from \"../../../exceptions\";\nimport { ChainType, FeePaymentMethod, SwapParams } from \"../../../models\";\nimport { assertNever } from \"../../../utils/utils\";\nimport { RawTransaction, TransactionResponse } from \"../../models\";\nimport { addUnitLimitAndUnitPriceToVersionedTx } from \"../../utils/sol/compute-budget\";\nimport { ChainBridgeService, SendParams, TxSendParamsSol } from \"../models\";\nimport { prepareTxSendParams } from \"../utils\";\nimport { BridgeTxService } from \"./bridge-tx-service\";\nimport { JupiterParams, JupiterService } from \"./jupiter-service\";\nimport { PayerWithTokenService } from \"./payer-with-token-service\";\nimport { amendJupiterWithSdkTx, SolTxSendParams } from \"./utils\";\n\nexport interface SolanaBridgeParams {\n /** @deprecated Do not use. */\n wormholeMessengerProgramId?: string;\n solanaLookUpTable: string;\n cctpParams: CctpParams;\n jupiterParams: JupiterParams;\n}\n\nexport interface CctpParams {\n cctpTransmitterProgramId: string;\n cctpTokenMessengerMinter: string;\n cctpV2TransmitterProgramId: string;\n cctpV2TokenMessengerMinter: string;\n cctpDomains: CctpDomains;\n}\n\n/**\n * Type representing a map of CCTP domains to their corresponding numeric values.\n *\n * @typedef {Record<string, number>} CctpDomains\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 {number} value - The numeric value associated with the specified chain.\n */\nexport type CctpDomains = Record<string, number>;\n\nexport class SolanaBridgeService extends ChainBridgeService {\n chainType: ChainType.SOLANA = ChainType.SOLANA;\n\n private readonly connection: Connection;\n private jupiterService: JupiterService;\n private bridgeTxService: BridgeTxService;\n private payerWithTokenService: PayerWithTokenService;\n\n constructor(\n public solanaRpcUrl: string,\n public params: SolanaBridgeParams,\n public api: AllbridgeCoreClient\n ) {\n super();\n this.connection = new Connection(solanaRpcUrl);\n this.jupiterService = new JupiterService(api, params.jupiterParams);\n this.bridgeTxService = new BridgeTxService(solanaRpcUrl, params, api);\n this.payerWithTokenService = new PayerWithTokenService(solanaRpcUrl, params, api);\n }\n\n /** @deprecated Do not use. */\n async buildRawTransactionSwap(params: SwapParams): Promise<RawTransaction> {\n return this.bridgeTxService.buildRawTransactionSwap(params);\n }\n\n async buildRawTransactionSend(params: SendParams): Promise<RawTransaction> {\n const txSendParams = await prepareTxSendParams(this.chainType, params, this.api);\n const solTxSendParams = this.addPoolAddress(params, txSendParams);\n\n const paymentType = params.gasFeePaymentMethod ?? FeePaymentMethod.WITH_NATIVE_CURRENCY;\n\n let tx: VersionedTransaction;\n let requiredMessageSigner: Keypair | undefined;\n\n switch (paymentType) {\n case FeePaymentMethod.WITH_NATIVE_CURRENCY: {\n const builtTxResult = await this.buildTxWithNativePayment(params, solTxSendParams);\n tx = builtTxResult.tx;\n requiredMessageSigner = builtTxResult.requiredMessageSigner;\n break;\n }\n case FeePaymentMethod.WITH_STABLECOIN: {\n const builtTxResult = await this.buildTxWithStablePayment(params, solTxSendParams);\n tx = builtTxResult.tx;\n requiredMessageSigner = builtTxResult.requiredMessageSigner;\n break;\n }\n case FeePaymentMethod.WITH_ABR: {\n const builtTxResult = await this.buildTxWithAbrPayment(params, solTxSendParams);\n tx = builtTxResult.tx;\n requiredMessageSigner = builtTxResult.requiredMessageSigner;\n break;\n }\n default: {\n return assertNever(paymentType, \"Unhandled FeePaymentMethod\");\n }\n }\n await addUnitLimitAndUnitPriceToVersionedTx(tx, params.txFeeParams, this.solanaRpcUrl);\n\n if (requiredMessageSigner) {\n tx.sign([requiredMessageSigner]);\n }\n return tx;\n }\n\n private async buildTxWithNativePayment(\n params: SendParams,\n solTxSendParams: SolTxSendParams\n ): Promise<{ tx: VersionedTransaction; requiredMessageSigner: Keypair | undefined }> {\n return await this.bridgeTxService.buildRawTransactionSend(params, solTxSendParams);\n }\n\n private async buildTxWithStablePayment(\n params: SendParams,\n solTxSendParams: SolTxSendParams\n ): Promise<{ tx: VersionedTransaction; requiredMessageSigner: Keypair | undefined }> {\n const { jupTx, solTxSendParams: updatedSolTxSendParams } = await this.jupiterService.buildJupAndUpdateTxSendParams(\n params,\n solTxSendParams\n );\n\n const { tx, requiredMessageSigner } = await this.bridgeTxService.buildRawTransactionSend(\n params,\n updatedSolTxSendParams\n );\n\n if (!jupTx) {\n throw new JupiterError(\"Swap tx is absent\");\n }\n const resultTx = await amendJupiterWithSdkTx(this.connection, jupTx, tx);\n return { tx: resultTx, requiredMessageSigner: requiredMessageSigner };\n }\n\n private async buildTxWithAbrPayment(\n params: SendParams,\n solTxSendParams: SolTxSendParams\n ): Promise<{ tx: VersionedTransaction; requiredMessageSigner?: Keypair }> {\n return this.payerWithTokenService.buildRawTransactionSend(params, solTxSendParams);\n }\n\n send(_params: SendParams): Promise<TransactionResponse> {\n throw new MethodNotSupportedError();\n }\n\n private addPoolAddress(params: SendParams, txSendParams: TxSendParamsSol): SolTxSendParams {\n return {\n ...txSendParams,\n poolAddress: params.sourceToken.poolAddress,\n };\n }\n}\n"]}
@@ -190,6 +190,9 @@ export class PayerWithTokenService {
190
190
  const wormholeMessengerConfigAccount = await getConfigAccount(wormholeMessengerAccount);
191
191
  const messengerGasUsageAccount = await getGasUsageAccount(toChainId, wormholeMessengerAccount);
192
192
  const wormholeProgramId = this.params.wormholeMessengerProgramId;
193
+ if (!wormholeProgramId) {
194
+ throw new SdkError("Do not use.");
195
+ }
193
196
  const { wormholeBridgeAccount, wormholeSequenceAccount, wormholeFeeCollectorAccount } = this.getWormholeProgramAddresses(wormholeProgramId, bridgeAuthorityAccount);
194
197
  const messageAccount = Keypair.generate();
195
198
  const feeInstruction = await this.getWormholeFeeInstruction(provider, wormholeBridgeAccount, userAccount, wormholeFeeCollectorAccount);