@avalabs/fusion-sdk 0.15.1 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (169) hide show
  1. package/dist/constants.cjs +1 -1
  2. package/dist/constants.cjs.map +1 -1
  3. package/dist/constants.d.cts +21 -1
  4. package/dist/constants.d.ts +21 -1
  5. package/dist/constants.js +1 -1
  6. package/dist/constants.js.map +1 -1
  7. package/dist/errors.cjs +1 -1
  8. package/dist/errors.cjs.map +1 -1
  9. package/dist/errors.js +1 -1
  10. package/dist/errors.js.map +1 -1
  11. package/dist/mod.cjs +1 -1
  12. package/dist/mod.d.cts +7 -5
  13. package/dist/mod.d.ts +7 -5
  14. package/dist/mod.js +1 -1
  15. package/dist/quoter/quoter.cjs +1 -1
  16. package/dist/quoter/quoter.cjs.map +1 -1
  17. package/dist/quoter/quoter.js +1 -1
  18. package/dist/quoter/quoter.js.map +1 -1
  19. package/dist/transfer-manager.cjs +1 -1
  20. package/dist/transfer-manager.cjs.map +1 -1
  21. package/dist/transfer-manager.js +1 -1
  22. package/dist/transfer-manager.js.map +1 -1
  23. package/dist/transfer-service/_evm-gas.cjs +1 -1
  24. package/dist/transfer-service/_evm-gas.js +1 -1
  25. package/dist/transfer-service/_utils.cjs +1 -1
  26. package/dist/transfer-service/_utils.cjs.map +1 -1
  27. package/dist/transfer-service/_utils.js +1 -1
  28. package/dist/transfer-service/_utils.js.map +1 -1
  29. package/dist/transfer-service/avalanche-cct/_handlers/analyze-support.cjs +2 -0
  30. package/dist/transfer-service/avalanche-cct/_handlers/analyze-support.cjs.map +1 -0
  31. package/dist/transfer-service/avalanche-cct/_handlers/analyze-support.js +2 -0
  32. package/dist/transfer-service/avalanche-cct/_handlers/analyze-support.js.map +1 -0
  33. package/dist/transfer-service/avalanche-cct/_handlers/estimate-native-fee.cjs +2 -0
  34. package/dist/transfer-service/avalanche-cct/_handlers/estimate-native-fee.cjs.map +1 -0
  35. package/dist/transfer-service/avalanche-cct/_handlers/estimate-native-fee.js +2 -0
  36. package/dist/transfer-service/avalanche-cct/_handlers/estimate-native-fee.js.map +1 -0
  37. package/dist/transfer-service/avalanche-cct/_handlers/get-bridgeable-assets.cjs +2 -0
  38. package/dist/transfer-service/avalanche-cct/_handlers/get-bridgeable-assets.cjs.map +1 -0
  39. package/dist/transfer-service/avalanche-cct/_handlers/get-bridgeable-assets.js +2 -0
  40. package/dist/transfer-service/avalanche-cct/_handlers/get-bridgeable-assets.js.map +1 -0
  41. package/dist/transfer-service/avalanche-cct/_handlers/get-minimum-transfer-amount.cjs +2 -0
  42. package/dist/transfer-service/avalanche-cct/_handlers/get-minimum-transfer-amount.cjs.map +1 -0
  43. package/dist/transfer-service/avalanche-cct/_handlers/get-minimum-transfer-amount.js +2 -0
  44. package/dist/transfer-service/avalanche-cct/_handlers/get-minimum-transfer-amount.js.map +1 -0
  45. package/dist/transfer-service/avalanche-cct/_handlers/get-supported-chains.cjs +2 -0
  46. package/dist/transfer-service/avalanche-cct/_handlers/get-supported-chains.cjs.map +1 -0
  47. package/dist/transfer-service/avalanche-cct/_handlers/get-supported-chains.js +2 -0
  48. package/dist/transfer-service/avalanche-cct/_handlers/get-supported-chains.js.map +1 -0
  49. package/dist/transfer-service/avalanche-cct/_handlers/stream-quotes.cjs +2 -0
  50. package/dist/transfer-service/avalanche-cct/_handlers/stream-quotes.cjs.map +1 -0
  51. package/dist/transfer-service/avalanche-cct/_handlers/stream-quotes.js +2 -0
  52. package/dist/transfer-service/avalanche-cct/_handlers/stream-quotes.js.map +1 -0
  53. package/dist/transfer-service/avalanche-cct/_handlers/track-transfer.cjs +2 -0
  54. package/dist/transfer-service/avalanche-cct/_handlers/track-transfer.cjs.map +1 -0
  55. package/dist/transfer-service/avalanche-cct/_handlers/track-transfer.js +2 -0
  56. package/dist/transfer-service/avalanche-cct/_handlers/track-transfer.js.map +1 -0
  57. package/dist/transfer-service/avalanche-cct/_handlers/transfer-asset.cjs +2 -0
  58. package/dist/transfer-service/avalanche-cct/_handlers/transfer-asset.cjs.map +1 -0
  59. package/dist/transfer-service/avalanche-cct/_handlers/transfer-asset.js +2 -0
  60. package/dist/transfer-service/avalanche-cct/_handlers/transfer-asset.js.map +1 -0
  61. package/dist/transfer-service/avalanche-cct/_type-guards.cjs +2 -0
  62. package/dist/transfer-service/avalanche-cct/_type-guards.cjs.map +1 -0
  63. package/dist/transfer-service/avalanche-cct/_type-guards.js +2 -0
  64. package/dist/transfer-service/avalanche-cct/_type-guards.js.map +1 -0
  65. package/dist/transfer-service/avalanche-cct/_utils/addresses.cjs +2 -0
  66. package/dist/transfer-service/avalanche-cct/_utils/addresses.cjs.map +1 -0
  67. package/dist/transfer-service/avalanche-cct/_utils/addresses.js +2 -0
  68. package/dist/transfer-service/avalanche-cct/_utils/addresses.js.map +1 -0
  69. package/dist/transfer-service/avalanche-cct/_utils/fees.cjs +2 -0
  70. package/dist/transfer-service/avalanche-cct/_utils/fees.cjs.map +1 -0
  71. package/dist/transfer-service/avalanche-cct/_utils/fees.js +2 -0
  72. package/dist/transfer-service/avalanche-cct/_utils/fees.js.map +1 -0
  73. package/dist/transfer-service/avalanche-cct/_utils/p-chain.cjs +2 -0
  74. package/dist/transfer-service/avalanche-cct/_utils/p-chain.cjs.map +1 -0
  75. package/dist/transfer-service/avalanche-cct/_utils/p-chain.js +2 -0
  76. package/dist/transfer-service/avalanche-cct/_utils/p-chain.js.map +1 -0
  77. package/dist/transfer-service/avalanche-cct/_utils/polling.cjs +2 -0
  78. package/dist/transfer-service/avalanche-cct/_utils/polling.cjs.map +1 -0
  79. package/dist/transfer-service/avalanche-cct/_utils/polling.js +2 -0
  80. package/dist/transfer-service/avalanche-cct/_utils/polling.js.map +1 -0
  81. package/dist/transfer-service/avalanche-cct/_utils/transactions.cjs +2 -0
  82. package/dist/transfer-service/avalanche-cct/_utils/transactions.cjs.map +1 -0
  83. package/dist/transfer-service/avalanche-cct/_utils/transactions.js +2 -0
  84. package/dist/transfer-service/avalanche-cct/_utils/transactions.js.map +1 -0
  85. package/dist/transfer-service/avalanche-cct/_utils.cjs +2 -0
  86. package/dist/transfer-service/avalanche-cct/_utils.cjs.map +1 -0
  87. package/dist/transfer-service/avalanche-cct/_utils.js +2 -0
  88. package/dist/transfer-service/avalanche-cct/_utils.js.map +1 -0
  89. package/dist/transfer-service/avalanche-cct/avalanche-cct-service.cjs +2 -0
  90. package/dist/transfer-service/avalanche-cct/avalanche-cct-service.cjs.map +1 -0
  91. package/dist/transfer-service/avalanche-cct/avalanche-cct-service.js +2 -0
  92. package/dist/transfer-service/avalanche-cct/avalanche-cct-service.js.map +1 -0
  93. package/dist/transfer-service/avalanche-cct/constants.cjs +2 -0
  94. package/dist/transfer-service/avalanche-cct/constants.cjs.map +1 -0
  95. package/dist/transfer-service/avalanche-cct/constants.js +2 -0
  96. package/dist/transfer-service/avalanche-cct/constants.js.map +1 -0
  97. package/dist/transfer-service/avalanche-cct/types.d.cts +33 -0
  98. package/dist/transfer-service/avalanche-cct/types.d.ts +33 -0
  99. package/dist/transfer-service/avalanche-evm/_handlers/get-bridgeable-assets.cjs +1 -1
  100. package/dist/transfer-service/avalanche-evm/_handlers/get-bridgeable-assets.cjs.map +1 -1
  101. package/dist/transfer-service/avalanche-evm/_handlers/get-bridgeable-assets.js +1 -1
  102. package/dist/transfer-service/avalanche-evm/_handlers/get-bridgeable-assets.js.map +1 -1
  103. package/dist/transfer-service/avalanche-evm/_handlers/transfer-asset.cjs +1 -1
  104. package/dist/transfer-service/avalanche-evm/_handlers/transfer-asset.js +1 -1
  105. package/dist/transfer-service/avalanche-evm/_utils/wrap.cjs +1 -1
  106. package/dist/transfer-service/avalanche-evm/_utils/wrap.js +1 -1
  107. package/dist/transfer-service/fetch-utilities.cjs +1 -1
  108. package/dist/transfer-service/fetch-utilities.cjs.map +1 -1
  109. package/dist/transfer-service/fetch-utilities.js +1 -1
  110. package/dist/transfer-service/fetch-utilities.js.map +1 -1
  111. package/dist/transfer-service/lombard/btc-to-btcb/_handlers/get-bridgeable-assets.cjs +1 -1
  112. package/dist/transfer-service/lombard/btc-to-btcb/_handlers/get-bridgeable-assets.cjs.map +1 -1
  113. package/dist/transfer-service/lombard/btc-to-btcb/_handlers/get-bridgeable-assets.js +1 -1
  114. package/dist/transfer-service/lombard/btc-to-btcb/_handlers/get-bridgeable-assets.js.map +1 -1
  115. package/dist/transfer-service/lombard/btcb-to-btc/_handlers/get-bridgeable-assets.cjs +1 -1
  116. package/dist/transfer-service/lombard/btcb-to-btc/_handlers/get-bridgeable-assets.cjs.map +1 -1
  117. package/dist/transfer-service/lombard/btcb-to-btc/_handlers/get-bridgeable-assets.js +1 -1
  118. package/dist/transfer-service/lombard/btcb-to-btc/_handlers/get-bridgeable-assets.js.map +1 -1
  119. package/dist/transfer-service/markr/_handlers/estimate-native-fee.cjs +1 -1
  120. package/dist/transfer-service/markr/_handlers/estimate-native-fee.js +1 -1
  121. package/dist/transfer-service/markr/_handlers/get-bridgeable-assets.cjs +1 -1
  122. package/dist/transfer-service/markr/_handlers/get-bridgeable-assets.cjs.map +1 -1
  123. package/dist/transfer-service/markr/_handlers/get-bridgeable-assets.js +1 -1
  124. package/dist/transfer-service/markr/_handlers/get-bridgeable-assets.js.map +1 -1
  125. package/dist/transfer-service/markr/_handlers/track-transfer.cjs +1 -1
  126. package/dist/transfer-service/markr/_handlers/track-transfer.js +1 -1
  127. package/dist/transfer-service/markr/_handlers/transfer-asset.cjs +1 -1
  128. package/dist/transfer-service/markr/_handlers/transfer-asset.js +1 -1
  129. package/dist/transfer-service/markr/_schema.cjs +1 -1
  130. package/dist/transfer-service/markr/_schema.cjs.map +1 -1
  131. package/dist/transfer-service/markr/_schema.js +1 -1
  132. package/dist/transfer-service/markr/_schema.js.map +1 -1
  133. package/dist/transfer-service/markr/markr-service.cjs.map +1 -1
  134. package/dist/transfer-service/markr/markr-service.js.map +1 -1
  135. package/dist/transfer-service/service-schemas.cjs +1 -1
  136. package/dist/transfer-service/service-schemas.cjs.map +1 -1
  137. package/dist/transfer-service/service-schemas.js +1 -1
  138. package/dist/transfer-service/service-schemas.js.map +1 -1
  139. package/dist/transfer-service/wrap-unwrap/_handlers/get-bridgeable-assets.cjs +1 -1
  140. package/dist/transfer-service/wrap-unwrap/_handlers/get-bridgeable-assets.cjs.map +1 -1
  141. package/dist/transfer-service/wrap-unwrap/_handlers/get-bridgeable-assets.js +1 -1
  142. package/dist/transfer-service/wrap-unwrap/_handlers/get-bridgeable-assets.js.map +1 -1
  143. package/dist/transfer-service/wrap-unwrap/_handlers/transfer-asset.cjs +1 -1
  144. package/dist/transfer-service/wrap-unwrap/_handlers/transfer-asset.js +1 -1
  145. package/dist/types/asset.d.cts +18 -2
  146. package/dist/types/asset.d.ts +18 -2
  147. package/dist/types/quote.d.cts +1 -1
  148. package/dist/types/quote.d.ts +1 -1
  149. package/dist/types/service.d.cts +95 -7
  150. package/dist/types/service.d.ts +95 -7
  151. package/dist/types/transfer-manager.d.cts +19 -10
  152. package/dist/types/transfer-manager.d.ts +19 -10
  153. package/dist/types/utility-types.d.cts +8 -1
  154. package/dist/types/utility-types.d.ts +8 -1
  155. package/dist/utils/asset-id.cjs +1 -1
  156. package/dist/utils/asset-id.cjs.map +1 -1
  157. package/dist/utils/asset-id.js +1 -1
  158. package/dist/utils/asset-id.js.map +1 -1
  159. package/dist/utils/bridgeable-assets.cjs +2 -0
  160. package/dist/utils/bridgeable-assets.cjs.map +1 -0
  161. package/dist/utils/bridgeable-assets.d.cts +16 -0
  162. package/dist/utils/bridgeable-assets.d.ts +16 -0
  163. package/dist/utils/bridgeable-assets.js +2 -0
  164. package/dist/utils/bridgeable-assets.js.map +1 -0
  165. package/dist/utils/transfer-utils.cjs +1 -1
  166. package/dist/utils/transfer-utils.cjs.map +1 -1
  167. package/dist/utils/transfer-utils.js +1 -1
  168. package/dist/utils/transfer-utils.js.map +1 -1
  169. package/package.json +5 -3
@@ -1 +1 @@
1
- {"version":3,"file":"markr-service.cjs","names":["getPartnerFeeBps","getSupportedChains","getSupportedTokens","analyzeSupportFactory","estimateNativeFeeFactory","getAssetsFactory","getBridgeableAssetsFactory","getMinimumTransferAmountFactory","streamQuotesFactory","trackTransferFactory","transferAssetFactory","ServiceType"],"sources":["../../../src/transfer-service/markr/markr-service.ts"],"sourcesContent":["import { ServiceType } from '../../constants';\nimport type { Environment } from '../../constants';\nimport type { Asset } from '../../types/asset';\nimport type { EvmSigner, SolanaSigner } from '../../types/signer';\nimport type { MutableGetSupportedChainsResult, TransferService } from '../../types/service';\nimport { analyzeSupportFactory } from './_handlers/analyze-support';\nimport { estimateNativeFeeFactory } from './_handlers/estimate-native-fee';\nimport { getAssetsFactory } from './_handlers/get-assets';\nimport { getBridgeableAssetsFactory } from './_handlers/get-bridgeable-assets';\nimport { getMinimumTransferAmountFactory } from './_handlers/get-minimum-transfer-amount';\nimport { streamQuotesFactory } from './_handlers/stream-quotes';\nimport { trackTransferFactory } from './_handlers/track-transfer';\nimport { transferAssetFactory } from './_handlers/transfer-asset';\nimport { getPartnerFeeBps, getSupportedChains, getSupportedTokens } from './_utils';\nimport { DEFAULT_MARKR_API_URL } from './constants';\nimport type { ApiOptions } from './_api';\nimport type { Caip2ChainId } from '../../types/caip';\nimport type { Fetch } from '../../types/utility-types';\n\nexport interface MarkrServiceOptions {\n apiBaseUrl?: string;\n apiToken?: string;\n appId: string;\n disableCrossChainSwaps?: boolean;\n environment: Environment;\n evmSigner: EvmSigner;\n fetch?: Fetch;\n getTargetChainAssets: (targetChainId: Caip2ChainId) => Promise<readonly Asset[]>;\n solanaSigner?: SolanaSigner;\n}\n\nexport async function createMarkrService({\n apiBaseUrl: apiBaseUrlString,\n apiToken,\n appId,\n disableCrossChainSwaps,\n environment,\n evmSigner,\n fetch: customFetch,\n getTargetChainAssets,\n solanaSigner,\n}: MarkrServiceOptions): Promise<TransferService> {\n const apiBaseUrl = new URL(apiBaseUrlString ?? DEFAULT_MARKR_API_URL);\n\n const apiOptions: ApiOptions = {\n apiBaseUrl,\n apiToken,\n fetch: customFetch,\n };\n\n // Parallelize fetching.\n const [partnerFeeBps, supportedChains] = await Promise.all([\n getPartnerFeeBps(apiOptions),\n getSupportedChains(apiOptions, disableCrossChainSwaps),\n ]);\n\n const supportedTokens = await getSupportedTokens(apiOptions, supportedChains);\n\n const hasSolanaSigner = Boolean(solanaSigner);\n const analyzeSupport = analyzeSupportFactory({ hasSolanaSigner, supportedChains });\n\n return {\n analyzeSupport,\n estimateNativeFee: estimateNativeFeeFactory({ apiOptions, appId }),\n getAssets: getAssetsFactory({ supportedChains, supportedTokens }),\n getBridgeableAssets: getBridgeableAssetsFactory({ getTargetChainAssets, supportedChains }),\n getMinimumTransferAmount: getMinimumTransferAmountFactory({\n analyzeSupport,\n partnerFeeBps,\n }),\n getSupportedChains: async () => {\n const supportedChainsMap: MutableGetSupportedChainsResult = new Map();\n\n for (const [sourceChainId, { crossChainTargetChainIds, swapEnabled }] of supportedChains.entries()) {\n if (!swapEnabled && crossChainTargetChainIds.size === 0) {\n // If neither swap nor cross-chain swap is enabled, skip this chain as a source.\n continue;\n }\n\n const supportedTargetChainIds = new Set<Caip2ChainId>();\n\n // Add self as supported target if same-chain swap is enabled.\n if (swapEnabled) {\n supportedTargetChainIds.add(sourceChainId);\n }\n\n for (const chainId of crossChainTargetChainIds) {\n if (chainId !== sourceChainId && supportedChains.has(chainId)) {\n supportedTargetChainIds.add(chainId);\n }\n }\n\n if (supportedTargetChainIds.size > 0) {\n supportedChainsMap.set(sourceChainId, supportedTargetChainIds);\n }\n }\n\n return supportedChainsMap;\n },\n streamQuotes: streamQuotesFactory({ apiOptions, appId, partnerFeeBps }),\n trackTransfer: trackTransferFactory({ apiOptions }),\n transferAsset: transferAssetFactory({\n apiOptions,\n appId,\n environment,\n evmSigner,\n solanaSigner,\n }),\n type: ServiceType.MARKR,\n } satisfies TransferService;\n}\n"],"mappings":"udA+BA,eAAsB,EAAmB,CACvC,WAAY,EACZ,WACA,QACA,yBACA,cACA,YACA,MAAO,EACP,uBACA,gBACgD,CAGhD,IAAM,EAAyB,CAC7B,WAHiB,IAAI,IAAI,GAAA,oDAA0C,CAInE,WACA,MAAO,EACR,CAGK,CAAC,EAAe,GAAmB,MAAM,QAAQ,IAAI,CACzDA,EAAAA,iBAAiB,EAAW,CAC5BC,EAAAA,mBAAmB,EAAY,EAAuB,CACvD,CAAC,CAEI,EAAkB,MAAMC,EAAAA,mBAAmB,EAAY,EAAgB,CAGvE,EAAiBC,EAAAA,sBAAsB,CAAE,gBADvB,EAAQ,EACgC,kBAAiB,CAAC,CAElF,MAAO,CACL,iBACA,kBAAmBC,EAAAA,yBAAyB,CAAE,aAAY,QAAO,CAAC,CAClE,UAAWC,EAAAA,iBAAiB,CAAE,kBAAiB,kBAAiB,CAAC,CACjE,oBAAqBC,EAAAA,2BAA2B,CAAE,uBAAsB,kBAAiB,CAAC,CAC1F,yBAA0BC,EAAAA,gCAAgC,CACxD,iBACA,gBACD,CAAC,CACF,mBAAoB,SAAY,CAC9B,IAAM,EAAsD,IAAI,IAEhE,IAAK,GAAM,CAAC,EAAe,CAAE,2BAA0B,kBAAkB,EAAgB,SAAS,CAAE,CAClG,GAAI,CAAC,GAAe,EAAyB,OAAS,EAEpD,SAGF,IAAM,EAA0B,IAAI,IAGhC,GACF,EAAwB,IAAI,EAAc,CAG5C,IAAK,IAAM,KAAW,EAChB,IAAY,GAAiB,EAAgB,IAAI,EAAQ,EAC3D,EAAwB,IAAI,EAAQ,CAIpC,EAAwB,KAAO,GACjC,EAAmB,IAAI,EAAe,EAAwB,CAIlE,OAAO,GAET,aAAcC,EAAAA,oBAAoB,CAAE,aAAY,QAAO,gBAAe,CAAC,CACvE,cAAeC,EAAAA,qBAAqB,CAAE,aAAY,CAAC,CACnD,cAAeC,EAAAA,qBAAqB,CAClC,aACA,QACA,cACA,YACA,eACD,CAAC,CACF,KAAMC,EAAAA,YAAY,MACnB"}
1
+ {"version":3,"file":"markr-service.cjs","names":["getPartnerFeeBps","getSupportedChains","getSupportedTokens","analyzeSupportFactory","estimateNativeFeeFactory","getAssetsFactory","getBridgeableAssetsFactory","getMinimumTransferAmountFactory","streamQuotesFactory","trackTransferFactory","transferAssetFactory","ServiceType"],"sources":["../../../src/transfer-service/markr/markr-service.ts"],"sourcesContent":["import { ServiceType } from '../../constants';\nimport type { Environment } from '../../constants';\nimport type { AssetWithExtras } from '../../types/asset';\nimport type { AssetSearchQuery } from '../../types/service';\nimport type { EvmSigner, SolanaSigner } from '../../types/signer';\nimport type { MutableGetSupportedChainsResult, TransferService } from '../../types/service';\nimport { analyzeSupportFactory } from './_handlers/analyze-support';\nimport { estimateNativeFeeFactory } from './_handlers/estimate-native-fee';\nimport { getAssetsFactory } from './_handlers/get-assets';\nimport { getBridgeableAssetsFactory } from './_handlers/get-bridgeable-assets';\nimport { getMinimumTransferAmountFactory } from './_handlers/get-minimum-transfer-amount';\nimport { streamQuotesFactory } from './_handlers/stream-quotes';\nimport { trackTransferFactory } from './_handlers/track-transfer';\nimport { transferAssetFactory } from './_handlers/transfer-asset';\nimport { getPartnerFeeBps, getSupportedChains, getSupportedTokens } from './_utils';\nimport { DEFAULT_MARKR_API_URL } from './constants';\nimport type { ApiOptions } from './_api';\nimport type { Caip2ChainId } from '../../types/caip';\nimport type { Fetch } from '../../types/utility-types';\n\nexport interface MarkrServiceOptions {\n apiBaseUrl?: string;\n apiToken?: string;\n appId: string;\n disableCrossChainSwaps?: boolean;\n environment: Environment;\n evmSigner: EvmSigner;\n fetch?: Fetch;\n getTargetChainAssets: (queryProps: {\n search?: AssetSearchQuery;\n limit: number;\n page: number;\n targetChainId: Caip2ChainId;\n }) => Promise<{\n readonly assets: readonly AssetWithExtras[];\n readonly meta: { readonly currentPage: number; readonly hasMore: boolean; readonly nextPage?: number };\n }>;\n solanaSigner?: SolanaSigner;\n}\n\nexport async function createMarkrService({\n apiBaseUrl: apiBaseUrlString,\n apiToken,\n appId,\n disableCrossChainSwaps,\n environment,\n evmSigner,\n fetch: customFetch,\n getTargetChainAssets,\n solanaSigner,\n}: MarkrServiceOptions): Promise<TransferService> {\n const apiBaseUrl = new URL(apiBaseUrlString ?? DEFAULT_MARKR_API_URL);\n\n const apiOptions: ApiOptions = {\n apiBaseUrl,\n apiToken,\n fetch: customFetch,\n };\n\n // Parallelize fetching.\n const [partnerFeeBps, supportedChains] = await Promise.all([\n getPartnerFeeBps(apiOptions),\n getSupportedChains(apiOptions, disableCrossChainSwaps),\n ]);\n\n const supportedTokens = await getSupportedTokens(apiOptions, supportedChains);\n\n const hasSolanaSigner = Boolean(solanaSigner);\n const analyzeSupport = analyzeSupportFactory({ hasSolanaSigner, supportedChains });\n\n return {\n analyzeSupport,\n estimateNativeFee: estimateNativeFeeFactory({ apiOptions, appId }),\n getAssets: getAssetsFactory({ supportedChains, supportedTokens }),\n getBridgeableAssets: getBridgeableAssetsFactory({ getTargetChainAssets, supportedChains }),\n getMinimumTransferAmount: getMinimumTransferAmountFactory({\n analyzeSupport,\n partnerFeeBps,\n }),\n getSupportedChains: async () => {\n const supportedChainsMap: MutableGetSupportedChainsResult = new Map();\n\n for (const [sourceChainId, { crossChainTargetChainIds, swapEnabled }] of supportedChains.entries()) {\n if (!swapEnabled && crossChainTargetChainIds.size === 0) {\n // If neither swap nor cross-chain swap is enabled, skip this chain as a source.\n continue;\n }\n\n const supportedTargetChainIds = new Set<Caip2ChainId>();\n\n // Add self as supported target if same-chain swap is enabled.\n if (swapEnabled) {\n supportedTargetChainIds.add(sourceChainId);\n }\n\n for (const chainId of crossChainTargetChainIds) {\n if (chainId !== sourceChainId && supportedChains.has(chainId)) {\n supportedTargetChainIds.add(chainId);\n }\n }\n\n if (supportedTargetChainIds.size > 0) {\n supportedChainsMap.set(sourceChainId, supportedTargetChainIds);\n }\n }\n\n return supportedChainsMap;\n },\n streamQuotes: streamQuotesFactory({ apiOptions, appId, partnerFeeBps }),\n trackTransfer: trackTransferFactory({ apiOptions }),\n transferAsset: transferAssetFactory({\n apiOptions,\n appId,\n environment,\n evmSigner,\n solanaSigner,\n }),\n type: ServiceType.MARKR,\n } satisfies TransferService;\n}\n"],"mappings":"udAwCA,eAAsB,EAAmB,CACvC,WAAY,EACZ,WACA,QACA,yBACA,cACA,YACA,MAAO,EACP,uBACA,gBACgD,CAGhD,IAAM,EAAyB,CAC7B,WAHiB,IAAI,IAAI,GAAA,oDAA0C,CAInE,WACA,MAAO,EACR,CAGK,CAAC,EAAe,GAAmB,MAAM,QAAQ,IAAI,CACzDA,EAAAA,iBAAiB,EAAW,CAC5BC,EAAAA,mBAAmB,EAAY,EAAuB,CACvD,CAAC,CAEI,EAAkB,MAAMC,EAAAA,mBAAmB,EAAY,EAAgB,CAGvE,EAAiBC,EAAAA,sBAAsB,CAAE,gBADvB,EAAQ,EACgC,kBAAiB,CAAC,CAElF,MAAO,CACL,iBACA,kBAAmBC,EAAAA,yBAAyB,CAAE,aAAY,QAAO,CAAC,CAClE,UAAWC,EAAAA,iBAAiB,CAAE,kBAAiB,kBAAiB,CAAC,CACjE,oBAAqBC,EAAAA,2BAA2B,CAAE,uBAAsB,kBAAiB,CAAC,CAC1F,yBAA0BC,EAAAA,gCAAgC,CACxD,iBACA,gBACD,CAAC,CACF,mBAAoB,SAAY,CAC9B,IAAM,EAAsD,IAAI,IAEhE,IAAK,GAAM,CAAC,EAAe,CAAE,2BAA0B,kBAAkB,EAAgB,SAAS,CAAE,CAClG,GAAI,CAAC,GAAe,EAAyB,OAAS,EAEpD,SAGF,IAAM,EAA0B,IAAI,IAGhC,GACF,EAAwB,IAAI,EAAc,CAG5C,IAAK,IAAM,KAAW,EAChB,IAAY,GAAiB,EAAgB,IAAI,EAAQ,EAC3D,EAAwB,IAAI,EAAQ,CAIpC,EAAwB,KAAO,GACjC,EAAmB,IAAI,EAAe,EAAwB,CAIlE,OAAO,GAET,aAAcC,EAAAA,oBAAoB,CAAE,aAAY,QAAO,gBAAe,CAAC,CACvE,cAAeC,EAAAA,qBAAqB,CAAE,aAAY,CAAC,CACnD,cAAeC,EAAAA,qBAAqB,CAClC,aACA,QACA,cACA,YACA,eACD,CAAC,CACF,KAAMC,EAAAA,YAAY,MACnB"}
@@ -1 +1 @@
1
- {"version":3,"file":"markr-service.js","names":[],"sources":["../../../src/transfer-service/markr/markr-service.ts"],"sourcesContent":["import { ServiceType } from '../../constants';\nimport type { Environment } from '../../constants';\nimport type { Asset } from '../../types/asset';\nimport type { EvmSigner, SolanaSigner } from '../../types/signer';\nimport type { MutableGetSupportedChainsResult, TransferService } from '../../types/service';\nimport { analyzeSupportFactory } from './_handlers/analyze-support';\nimport { estimateNativeFeeFactory } from './_handlers/estimate-native-fee';\nimport { getAssetsFactory } from './_handlers/get-assets';\nimport { getBridgeableAssetsFactory } from './_handlers/get-bridgeable-assets';\nimport { getMinimumTransferAmountFactory } from './_handlers/get-minimum-transfer-amount';\nimport { streamQuotesFactory } from './_handlers/stream-quotes';\nimport { trackTransferFactory } from './_handlers/track-transfer';\nimport { transferAssetFactory } from './_handlers/transfer-asset';\nimport { getPartnerFeeBps, getSupportedChains, getSupportedTokens } from './_utils';\nimport { DEFAULT_MARKR_API_URL } from './constants';\nimport type { ApiOptions } from './_api';\nimport type { Caip2ChainId } from '../../types/caip';\nimport type { Fetch } from '../../types/utility-types';\n\nexport interface MarkrServiceOptions {\n apiBaseUrl?: string;\n apiToken?: string;\n appId: string;\n disableCrossChainSwaps?: boolean;\n environment: Environment;\n evmSigner: EvmSigner;\n fetch?: Fetch;\n getTargetChainAssets: (targetChainId: Caip2ChainId) => Promise<readonly Asset[]>;\n solanaSigner?: SolanaSigner;\n}\n\nexport async function createMarkrService({\n apiBaseUrl: apiBaseUrlString,\n apiToken,\n appId,\n disableCrossChainSwaps,\n environment,\n evmSigner,\n fetch: customFetch,\n getTargetChainAssets,\n solanaSigner,\n}: MarkrServiceOptions): Promise<TransferService> {\n const apiBaseUrl = new URL(apiBaseUrlString ?? DEFAULT_MARKR_API_URL);\n\n const apiOptions: ApiOptions = {\n apiBaseUrl,\n apiToken,\n fetch: customFetch,\n };\n\n // Parallelize fetching.\n const [partnerFeeBps, supportedChains] = await Promise.all([\n getPartnerFeeBps(apiOptions),\n getSupportedChains(apiOptions, disableCrossChainSwaps),\n ]);\n\n const supportedTokens = await getSupportedTokens(apiOptions, supportedChains);\n\n const hasSolanaSigner = Boolean(solanaSigner);\n const analyzeSupport = analyzeSupportFactory({ hasSolanaSigner, supportedChains });\n\n return {\n analyzeSupport,\n estimateNativeFee: estimateNativeFeeFactory({ apiOptions, appId }),\n getAssets: getAssetsFactory({ supportedChains, supportedTokens }),\n getBridgeableAssets: getBridgeableAssetsFactory({ getTargetChainAssets, supportedChains }),\n getMinimumTransferAmount: getMinimumTransferAmountFactory({\n analyzeSupport,\n partnerFeeBps,\n }),\n getSupportedChains: async () => {\n const supportedChainsMap: MutableGetSupportedChainsResult = new Map();\n\n for (const [sourceChainId, { crossChainTargetChainIds, swapEnabled }] of supportedChains.entries()) {\n if (!swapEnabled && crossChainTargetChainIds.size === 0) {\n // If neither swap nor cross-chain swap is enabled, skip this chain as a source.\n continue;\n }\n\n const supportedTargetChainIds = new Set<Caip2ChainId>();\n\n // Add self as supported target if same-chain swap is enabled.\n if (swapEnabled) {\n supportedTargetChainIds.add(sourceChainId);\n }\n\n for (const chainId of crossChainTargetChainIds) {\n if (chainId !== sourceChainId && supportedChains.has(chainId)) {\n supportedTargetChainIds.add(chainId);\n }\n }\n\n if (supportedTargetChainIds.size > 0) {\n supportedChainsMap.set(sourceChainId, supportedTargetChainIds);\n }\n }\n\n return supportedChainsMap;\n },\n streamQuotes: streamQuotesFactory({ apiOptions, appId, partnerFeeBps }),\n trackTransfer: trackTransferFactory({ apiOptions }),\n transferAsset: transferAssetFactory({\n apiOptions,\n appId,\n environment,\n evmSigner,\n solanaSigner,\n }),\n type: ServiceType.MARKR,\n } satisfies TransferService;\n}\n"],"mappings":"qvBA+BA,eAAsB,EAAmB,CACvC,WAAY,EACZ,WACA,QACA,yBACA,cACA,YACA,MAAO,EACP,uBACA,gBACgD,CAGhD,IAAM,EAAyB,CAC7B,WAHiB,IAAI,IAAI,GAAA,oDAA0C,CAInE,WACA,MAAO,EACR,CAGK,CAAC,EAAe,GAAmB,MAAM,QAAQ,IAAI,CACzD,EAAiB,EAAW,CAC5B,EAAmB,EAAY,EAAuB,CACvD,CAAC,CAEI,EAAkB,MAAM,EAAmB,EAAY,EAAgB,CAGvE,EAAiB,EAAsB,CAAE,gBADvB,EAAQ,EACgC,kBAAiB,CAAC,CAElF,MAAO,CACL,iBACA,kBAAmB,EAAyB,CAAE,aAAY,QAAO,CAAC,CAClE,UAAW,EAAiB,CAAE,kBAAiB,kBAAiB,CAAC,CACjE,oBAAqB,EAA2B,CAAE,uBAAsB,kBAAiB,CAAC,CAC1F,yBAA0B,EAAgC,CACxD,iBACA,gBACD,CAAC,CACF,mBAAoB,SAAY,CAC9B,IAAM,EAAsD,IAAI,IAEhE,IAAK,GAAM,CAAC,EAAe,CAAE,2BAA0B,kBAAkB,EAAgB,SAAS,CAAE,CAClG,GAAI,CAAC,GAAe,EAAyB,OAAS,EAEpD,SAGF,IAAM,EAA0B,IAAI,IAGhC,GACF,EAAwB,IAAI,EAAc,CAG5C,IAAK,IAAM,KAAW,EAChB,IAAY,GAAiB,EAAgB,IAAI,EAAQ,EAC3D,EAAwB,IAAI,EAAQ,CAIpC,EAAwB,KAAO,GACjC,EAAmB,IAAI,EAAe,EAAwB,CAIlE,OAAO,GAET,aAAc,EAAoB,CAAE,aAAY,QAAO,gBAAe,CAAC,CACvE,cAAe,EAAqB,CAAE,aAAY,CAAC,CACnD,cAAe,EAAqB,CAClC,aACA,QACA,cACA,YACA,eACD,CAAC,CACF,KAAM,EAAY,MACnB"}
1
+ {"version":3,"file":"markr-service.js","names":[],"sources":["../../../src/transfer-service/markr/markr-service.ts"],"sourcesContent":["import { ServiceType } from '../../constants';\nimport type { Environment } from '../../constants';\nimport type { AssetWithExtras } from '../../types/asset';\nimport type { AssetSearchQuery } from '../../types/service';\nimport type { EvmSigner, SolanaSigner } from '../../types/signer';\nimport type { MutableGetSupportedChainsResult, TransferService } from '../../types/service';\nimport { analyzeSupportFactory } from './_handlers/analyze-support';\nimport { estimateNativeFeeFactory } from './_handlers/estimate-native-fee';\nimport { getAssetsFactory } from './_handlers/get-assets';\nimport { getBridgeableAssetsFactory } from './_handlers/get-bridgeable-assets';\nimport { getMinimumTransferAmountFactory } from './_handlers/get-minimum-transfer-amount';\nimport { streamQuotesFactory } from './_handlers/stream-quotes';\nimport { trackTransferFactory } from './_handlers/track-transfer';\nimport { transferAssetFactory } from './_handlers/transfer-asset';\nimport { getPartnerFeeBps, getSupportedChains, getSupportedTokens } from './_utils';\nimport { DEFAULT_MARKR_API_URL } from './constants';\nimport type { ApiOptions } from './_api';\nimport type { Caip2ChainId } from '../../types/caip';\nimport type { Fetch } from '../../types/utility-types';\n\nexport interface MarkrServiceOptions {\n apiBaseUrl?: string;\n apiToken?: string;\n appId: string;\n disableCrossChainSwaps?: boolean;\n environment: Environment;\n evmSigner: EvmSigner;\n fetch?: Fetch;\n getTargetChainAssets: (queryProps: {\n search?: AssetSearchQuery;\n limit: number;\n page: number;\n targetChainId: Caip2ChainId;\n }) => Promise<{\n readonly assets: readonly AssetWithExtras[];\n readonly meta: { readonly currentPage: number; readonly hasMore: boolean; readonly nextPage?: number };\n }>;\n solanaSigner?: SolanaSigner;\n}\n\nexport async function createMarkrService({\n apiBaseUrl: apiBaseUrlString,\n apiToken,\n appId,\n disableCrossChainSwaps,\n environment,\n evmSigner,\n fetch: customFetch,\n getTargetChainAssets,\n solanaSigner,\n}: MarkrServiceOptions): Promise<TransferService> {\n const apiBaseUrl = new URL(apiBaseUrlString ?? DEFAULT_MARKR_API_URL);\n\n const apiOptions: ApiOptions = {\n apiBaseUrl,\n apiToken,\n fetch: customFetch,\n };\n\n // Parallelize fetching.\n const [partnerFeeBps, supportedChains] = await Promise.all([\n getPartnerFeeBps(apiOptions),\n getSupportedChains(apiOptions, disableCrossChainSwaps),\n ]);\n\n const supportedTokens = await getSupportedTokens(apiOptions, supportedChains);\n\n const hasSolanaSigner = Boolean(solanaSigner);\n const analyzeSupport = analyzeSupportFactory({ hasSolanaSigner, supportedChains });\n\n return {\n analyzeSupport,\n estimateNativeFee: estimateNativeFeeFactory({ apiOptions, appId }),\n getAssets: getAssetsFactory({ supportedChains, supportedTokens }),\n getBridgeableAssets: getBridgeableAssetsFactory({ getTargetChainAssets, supportedChains }),\n getMinimumTransferAmount: getMinimumTransferAmountFactory({\n analyzeSupport,\n partnerFeeBps,\n }),\n getSupportedChains: async () => {\n const supportedChainsMap: MutableGetSupportedChainsResult = new Map();\n\n for (const [sourceChainId, { crossChainTargetChainIds, swapEnabled }] of supportedChains.entries()) {\n if (!swapEnabled && crossChainTargetChainIds.size === 0) {\n // If neither swap nor cross-chain swap is enabled, skip this chain as a source.\n continue;\n }\n\n const supportedTargetChainIds = new Set<Caip2ChainId>();\n\n // Add self as supported target if same-chain swap is enabled.\n if (swapEnabled) {\n supportedTargetChainIds.add(sourceChainId);\n }\n\n for (const chainId of crossChainTargetChainIds) {\n if (chainId !== sourceChainId && supportedChains.has(chainId)) {\n supportedTargetChainIds.add(chainId);\n }\n }\n\n if (supportedTargetChainIds.size > 0) {\n supportedChainsMap.set(sourceChainId, supportedTargetChainIds);\n }\n }\n\n return supportedChainsMap;\n },\n streamQuotes: streamQuotesFactory({ apiOptions, appId, partnerFeeBps }),\n trackTransfer: trackTransferFactory({ apiOptions }),\n transferAsset: transferAssetFactory({\n apiOptions,\n appId,\n environment,\n evmSigner,\n solanaSigner,\n }),\n type: ServiceType.MARKR,\n } satisfies TransferService;\n}\n"],"mappings":"qvBAwCA,eAAsB,EAAmB,CACvC,WAAY,EACZ,WACA,QACA,yBACA,cACA,YACA,MAAO,EACP,uBACA,gBACgD,CAGhD,IAAM,EAAyB,CAC7B,WAHiB,IAAI,IAAI,GAAA,oDAA0C,CAInE,WACA,MAAO,EACR,CAGK,CAAC,EAAe,GAAmB,MAAM,QAAQ,IAAI,CACzD,EAAiB,EAAW,CAC5B,EAAmB,EAAY,EAAuB,CACvD,CAAC,CAEI,EAAkB,MAAM,EAAmB,EAAY,EAAgB,CAGvE,EAAiB,EAAsB,CAAE,gBADvB,EAAQ,EACgC,kBAAiB,CAAC,CAElF,MAAO,CACL,iBACA,kBAAmB,EAAyB,CAAE,aAAY,QAAO,CAAC,CAClE,UAAW,EAAiB,CAAE,kBAAiB,kBAAiB,CAAC,CACjE,oBAAqB,EAA2B,CAAE,uBAAsB,kBAAiB,CAAC,CAC1F,yBAA0B,EAAgC,CACxD,iBACA,gBACD,CAAC,CACF,mBAAoB,SAAY,CAC9B,IAAM,EAAsD,IAAI,IAEhE,IAAK,GAAM,CAAC,EAAe,CAAE,2BAA0B,kBAAkB,EAAgB,SAAS,CAAE,CAClG,GAAI,CAAC,GAAe,EAAyB,OAAS,EAEpD,SAGF,IAAM,EAA0B,IAAI,IAGhC,GACF,EAAwB,IAAI,EAAc,CAG5C,IAAK,IAAM,KAAW,EAChB,IAAY,GAAiB,EAAgB,IAAI,EAAQ,EAC3D,EAAwB,IAAI,EAAQ,CAIpC,EAAwB,KAAO,GACjC,EAAmB,IAAI,EAAe,EAAwB,CAIlE,OAAO,GAET,aAAc,EAAoB,CAAE,aAAY,QAAO,gBAAe,CAAC,CACvE,cAAe,EAAqB,CAAE,aAAY,CAAC,CACnD,cAAe,EAAqB,CAClC,aACA,QACA,cACA,YACA,eACD,CAAC,CACF,KAAM,EAAY,MACnB"}
@@ -1,2 +1,2 @@
1
- require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`../utils/bitcoin-address.cjs`);let t=require(`zod`),n=require(`viem`),r=require(`@solana/kit`);const i=t.z.string().refine(n.isAddress,{message:`Invalid EVM address`}).transform(e=>e),a=t.z.string().refine(n.isHex,{message:`Invalid hex string`}).transform(e=>e),o=t.z.string().refine(e.isBech32Address,{message:`Invalid BTC address`}),s=t.z.string().refine(n.isHash,{message:`Invalid hash string`}).transform(e=>e),c=t.z.string().refine(r.isAddress,{message:`Invalid Solana address`}).transform(e=>e),l=t.z.string().refine(r.isSignature,{message:`Invalid Solana signature`}).transform(e=>e);exports.BtcAddressSchema=o,exports.EvmAddressSchema=i,exports.HashSchema=s,exports.HexSchema=a,exports.SolAddressSchema=c,exports.SolSignatureSchema=l;
1
+ require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`../utils/bitcoin-address.cjs`);let t=require(`zod`),n=require(`viem`),r=require(`@solana/kit`);const i=t.z.string().refine(n.isAddress,{message:`Invalid EVM address`}).transform(e=>e),a=t.z.string().refine(e=>e.startsWith(`0x`)&&/^0x[0-9a-fA-F]+$/.test(e),{message:`Invalid Hyperliquid quote hex address`}).refine(e=>{let t=e.length-2;return t>0&&t<40}).transform(e=>`0x${e.slice(2).padStart(40,`0`)}`).refine(n.isAddress,{message:`Invalid EVM address after Hyperliquid quote padding`}).transform(e=>e),o=t.z.string().refine(n.isHex,{message:`Invalid hex string`}).transform(e=>e),s=t.z.string().refine(e.isBech32Address,{message:`Invalid BTC address`}),c=t.z.string().refine(n.isHash,{message:`Invalid hash string`}).transform(e=>e),l=t.z.string().refine(r.isAddress,{message:`Invalid Solana address`}).transform(e=>e),u=t.z.string().refine(r.isSignature,{message:`Invalid Solana signature`}).transform(e=>e);exports.BtcAddressSchema=s,exports.EvmAddressSchema=i,exports.HashSchema=c,exports.HexSchema=o,exports.HyperliquidAddressSchema=a,exports.SolAddressSchema=l,exports.SolSignatureSchema=u;
2
2
  //# sourceMappingURL=service-schemas.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"service-schemas.cjs","names":["z","isEvmAddress","isHex","isBech32Address","isHash","isSolAddress","isSignature"],"sources":["../../src/transfer-service/service-schemas.ts"],"sourcesContent":["import { type Signature, type Address as SolAddress, isSignature, isAddress as isSolAddress } from '@solana/kit';\nimport { z } from 'zod';\nimport { isAddress as isEvmAddress, isHash, isHex, type Address as EvmAddress, type Hash } from 'viem';\nimport type { Hex } from '../types/signer';\nimport { isBech32Address } from '../utils/bitcoin-address';\n\nexport const EvmAddressSchema: z.ZodType<EvmAddress> = z\n .string()\n .refine(isEvmAddress, { message: 'Invalid EVM address' })\n .transform((addr) => addr as EvmAddress);\n\nexport const HexSchema: z.ZodType<Hex> = z\n .string()\n .refine(isHex, { message: 'Invalid hex string' })\n .transform((hex) => hex as Hex);\n\nexport const BtcAddressSchema: z.ZodType<string> = z\n .string()\n .refine(isBech32Address, { message: 'Invalid BTC address' });\n\nexport const HashSchema: z.ZodType<Hash> = z\n .string()\n .refine(isHash, { message: 'Invalid hash string' })\n .transform((hash) => hash as Hash);\n\nexport const SolAddressSchema: z.ZodType<SolAddress> = z\n .string()\n .refine(isSolAddress, { message: 'Invalid Solana address' })\n .transform((addr) => addr as SolAddress);\n\nexport const SolSignatureSchema: z.ZodType<Signature> = z\n .string()\n .refine(isSignature, { message: 'Invalid Solana signature' })\n .transform((sig) => sig as Signature);\n"],"mappings":"6JAMA,MAAa,EAA0CA,EAAAA,EACpD,QAAQ,CACR,OAAOC,EAAAA,UAAc,CAAE,QAAS,sBAAuB,CAAC,CACxD,UAAW,GAAS,EAAmB,CAE7B,EAA4BD,EAAAA,EACtC,QAAQ,CACR,OAAOE,EAAAA,MAAO,CAAE,QAAS,qBAAsB,CAAC,CAChD,UAAW,GAAQ,EAAW,CAEpB,EAAsCF,EAAAA,EAChD,QAAQ,CACR,OAAOG,EAAAA,gBAAiB,CAAE,QAAS,sBAAuB,CAAC,CAEjD,EAA8BH,EAAAA,EACxC,QAAQ,CACR,OAAOI,EAAAA,OAAQ,CAAE,QAAS,sBAAuB,CAAC,CAClD,UAAW,GAAS,EAAa,CAEvB,EAA0CJ,EAAAA,EACpD,QAAQ,CACR,OAAOK,EAAAA,UAAc,CAAE,QAAS,yBAA0B,CAAC,CAC3D,UAAW,GAAS,EAAmB,CAE7B,EAA2CL,EAAAA,EACrD,QAAQ,CACR,OAAOM,EAAAA,YAAa,CAAE,QAAS,2BAA4B,CAAC,CAC5D,UAAW,GAAQ,EAAiB"}
1
+ {"version":3,"file":"service-schemas.cjs","names":["z","isEvmAddress","isHex","isBech32Address","isHash","isSolAddress","isSignature"],"sources":["../../src/transfer-service/service-schemas.ts"],"sourcesContent":["import { type Signature, type Address as SolAddress, isSignature, isAddress as isSolAddress } from '@solana/kit';\nimport { z } from 'zod';\nimport { isAddress as isEvmAddress, isHash, isHex, type Address as EvmAddress, type Hash } from 'viem';\nimport type { Hex } from '../types/signer';\nimport { isBech32Address } from '../utils/bitcoin-address';\n\nexport const EvmAddressSchema: z.ZodType<EvmAddress> = z\n .string()\n .refine(isEvmAddress, { message: 'Invalid EVM address' })\n .transform((addr) => addr as EvmAddress);\n\n/**\n * **Hyperliquid spot `tokenId` (16-byte hex)** — In `spotMeta` / token APIs, each spot token has a\n * `tokenId` that Hyperliquid documents as a **34-character** hex string: `0x` plus **32** hex digits\n * (128 bits), e.g. `0x6d1e7cde53ba9467b783cb7c530ce054`. The `tokenDetails` info request uses the same\n * shape (`tokenId` parameter; see Hyperliquid API docs: Spot → tokenDetails).\n *\n * That is **not** the same as **HyperCore ↔ HyperEVM system addresses**: those are full **20-byte**\n * addresses whose leading byte is `0x20` with the token index in the tail (big-endian), or the HYPE\n * sentinel `0x2222…2222` (see Hyperliquid docs: HyperCore <> HyperEVM transfers → System Addresses).\n *\n * Aggregator quote payloads (e.g. Markr) may carry Hyperliquid **tokenId**-width hex where downstream\n * code expects a 20-byte EVM `0x` string. **Left-pad** the hex body to 40 nybbles, then validate with\n * viem `isAddress`. Standard 42-character EVM addresses are parsed by {@link EvmAddressSchema} instead\n * (union order in callers).\n *\n * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/spot\n * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/hyperevm/hypercore-less-than-greater-than-hyperevm-transfers\n */\nexport const HyperliquidAddressSchema: z.ZodType<EvmAddress> = z\n .string()\n .refine((value) => value.startsWith('0x') && /^0x[0-9a-fA-F]+$/.test(value), {\n message: 'Invalid Hyperliquid quote hex address',\n })\n .refine((value) => {\n const nybbles = value.length - 2;\n return nybbles > 0 && nybbles < 40;\n })\n .transform((value) => `0x${value.slice(2).padStart(40, '0')}`)\n .refine(isEvmAddress, { message: 'Invalid EVM address after Hyperliquid quote padding' })\n .transform((addr) => addr as EvmAddress);\n\nexport const HexSchema: z.ZodType<Hex> = z\n .string()\n .refine(isHex, { message: 'Invalid hex string' })\n .transform((hex) => hex as Hex);\n\nexport const BtcAddressSchema: z.ZodType<string> = z\n .string()\n .refine(isBech32Address, { message: 'Invalid BTC address' });\n\nexport const HashSchema: z.ZodType<Hash> = z\n .string()\n .refine(isHash, { message: 'Invalid hash string' })\n .transform((hash) => hash as Hash);\n\nexport const SolAddressSchema: z.ZodType<SolAddress> = z\n .string()\n .refine(isSolAddress, { message: 'Invalid Solana address' })\n .transform((addr) => addr as SolAddress);\n\nexport const SolSignatureSchema: z.ZodType<Signature> = z\n .string()\n .refine(isSignature, { message: 'Invalid Solana signature' })\n .transform((sig) => sig as Signature);\n"],"mappings":"6JAMA,MAAa,EAA0CA,EAAAA,EACpD,QAAQ,CACR,OAAOC,EAAAA,UAAc,CAAE,QAAS,sBAAuB,CAAC,CACxD,UAAW,GAAS,EAAmB,CAoB7B,EAAkDD,EAAAA,EAC5D,QAAQ,CACR,OAAQ,GAAU,EAAM,WAAW,KAAK,EAAI,mBAAmB,KAAK,EAAM,CAAE,CAC3E,QAAS,wCACV,CAAC,CACD,OAAQ,GAAU,CACjB,IAAM,EAAU,EAAM,OAAS,EAC/B,OAAO,EAAU,GAAK,EAAU,IAChC,CACD,UAAW,GAAU,KAAK,EAAM,MAAM,EAAE,CAAC,SAAS,GAAI,IAAI,GAAG,CAC7D,OAAOC,EAAAA,UAAc,CAAE,QAAS,sDAAuD,CAAC,CACxF,UAAW,GAAS,EAAmB,CAE7B,EAA4BD,EAAAA,EACtC,QAAQ,CACR,OAAOE,EAAAA,MAAO,CAAE,QAAS,qBAAsB,CAAC,CAChD,UAAW,GAAQ,EAAW,CAEpB,EAAsCF,EAAAA,EAChD,QAAQ,CACR,OAAOG,EAAAA,gBAAiB,CAAE,QAAS,sBAAuB,CAAC,CAEjD,EAA8BH,EAAAA,EACxC,QAAQ,CACR,OAAOI,EAAAA,OAAQ,CAAE,QAAS,sBAAuB,CAAC,CAClD,UAAW,GAAS,EAAa,CAEvB,EAA0CJ,EAAAA,EACpD,QAAQ,CACR,OAAOK,EAAAA,UAAc,CAAE,QAAS,yBAA0B,CAAC,CAC3D,UAAW,GAAS,EAAmB,CAE7B,EAA2CL,EAAAA,EACrD,QAAQ,CACR,OAAOM,EAAAA,YAAa,CAAE,QAAS,2BAA4B,CAAC,CAC5D,UAAW,GAAQ,EAAiB"}
@@ -1,2 +1,2 @@
1
- import{isBech32Address as e}from"../utils/bitcoin-address.js";import{z as t}from"zod";import{isAddress as n,isHash as r,isHex as i}from"viem";import{isAddress as a,isSignature as o}from"@solana/kit";const s=t.string().refine(n,{message:`Invalid EVM address`}).transform(e=>e),c=t.string().refine(i,{message:`Invalid hex string`}).transform(e=>e),l=t.string().refine(e,{message:`Invalid BTC address`}),u=t.string().refine(r,{message:`Invalid hash string`}).transform(e=>e),d=t.string().refine(a,{message:`Invalid Solana address`}).transform(e=>e),f=t.string().refine(o,{message:`Invalid Solana signature`}).transform(e=>e);export{l as BtcAddressSchema,s as EvmAddressSchema,u as HashSchema,c as HexSchema,d as SolAddressSchema,f as SolSignatureSchema};
1
+ import{isBech32Address as e}from"../utils/bitcoin-address.js";import{z as t}from"zod";import{isAddress as n,isHash as r,isHex as i}from"viem";import{isAddress as a,isSignature as o}from"@solana/kit";const s=t.string().refine(n,{message:`Invalid EVM address`}).transform(e=>e),c=t.string().refine(e=>e.startsWith(`0x`)&&/^0x[0-9a-fA-F]+$/.test(e),{message:`Invalid Hyperliquid quote hex address`}).refine(e=>{let t=e.length-2;return t>0&&t<40}).transform(e=>`0x${e.slice(2).padStart(40,`0`)}`).refine(n,{message:`Invalid EVM address after Hyperliquid quote padding`}).transform(e=>e),l=t.string().refine(i,{message:`Invalid hex string`}).transform(e=>e),u=t.string().refine(e,{message:`Invalid BTC address`}),d=t.string().refine(r,{message:`Invalid hash string`}).transform(e=>e),f=t.string().refine(a,{message:`Invalid Solana address`}).transform(e=>e),p=t.string().refine(o,{message:`Invalid Solana signature`}).transform(e=>e);export{u as BtcAddressSchema,s as EvmAddressSchema,d as HashSchema,l as HexSchema,c as HyperliquidAddressSchema,f as SolAddressSchema,p as SolSignatureSchema};
2
2
  //# sourceMappingURL=service-schemas.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"service-schemas.js","names":["isEvmAddress","isSolAddress"],"sources":["../../src/transfer-service/service-schemas.ts"],"sourcesContent":["import { type Signature, type Address as SolAddress, isSignature, isAddress as isSolAddress } from '@solana/kit';\nimport { z } from 'zod';\nimport { isAddress as isEvmAddress, isHash, isHex, type Address as EvmAddress, type Hash } from 'viem';\nimport type { Hex } from '../types/signer';\nimport { isBech32Address } from '../utils/bitcoin-address';\n\nexport const EvmAddressSchema: z.ZodType<EvmAddress> = z\n .string()\n .refine(isEvmAddress, { message: 'Invalid EVM address' })\n .transform((addr) => addr as EvmAddress);\n\nexport const HexSchema: z.ZodType<Hex> = z\n .string()\n .refine(isHex, { message: 'Invalid hex string' })\n .transform((hex) => hex as Hex);\n\nexport const BtcAddressSchema: z.ZodType<string> = z\n .string()\n .refine(isBech32Address, { message: 'Invalid BTC address' });\n\nexport const HashSchema: z.ZodType<Hash> = z\n .string()\n .refine(isHash, { message: 'Invalid hash string' })\n .transform((hash) => hash as Hash);\n\nexport const SolAddressSchema: z.ZodType<SolAddress> = z\n .string()\n .refine(isSolAddress, { message: 'Invalid Solana address' })\n .transform((addr) => addr as SolAddress);\n\nexport const SolSignatureSchema: z.ZodType<Signature> = z\n .string()\n .refine(isSignature, { message: 'Invalid Solana signature' })\n .transform((sig) => sig as Signature);\n"],"mappings":"uMAMA,MAAa,EAA0C,EACpD,QAAQ,CACR,OAAOA,EAAc,CAAE,QAAS,sBAAuB,CAAC,CACxD,UAAW,GAAS,EAAmB,CAE7B,EAA4B,EACtC,QAAQ,CACR,OAAO,EAAO,CAAE,QAAS,qBAAsB,CAAC,CAChD,UAAW,GAAQ,EAAW,CAEpB,EAAsC,EAChD,QAAQ,CACR,OAAO,EAAiB,CAAE,QAAS,sBAAuB,CAAC,CAEjD,EAA8B,EACxC,QAAQ,CACR,OAAO,EAAQ,CAAE,QAAS,sBAAuB,CAAC,CAClD,UAAW,GAAS,EAAa,CAEvB,EAA0C,EACpD,QAAQ,CACR,OAAOC,EAAc,CAAE,QAAS,yBAA0B,CAAC,CAC3D,UAAW,GAAS,EAAmB,CAE7B,EAA2C,EACrD,QAAQ,CACR,OAAO,EAAa,CAAE,QAAS,2BAA4B,CAAC,CAC5D,UAAW,GAAQ,EAAiB"}
1
+ {"version":3,"file":"service-schemas.js","names":["isEvmAddress","isSolAddress"],"sources":["../../src/transfer-service/service-schemas.ts"],"sourcesContent":["import { type Signature, type Address as SolAddress, isSignature, isAddress as isSolAddress } from '@solana/kit';\nimport { z } from 'zod';\nimport { isAddress as isEvmAddress, isHash, isHex, type Address as EvmAddress, type Hash } from 'viem';\nimport type { Hex } from '../types/signer';\nimport { isBech32Address } from '../utils/bitcoin-address';\n\nexport const EvmAddressSchema: z.ZodType<EvmAddress> = z\n .string()\n .refine(isEvmAddress, { message: 'Invalid EVM address' })\n .transform((addr) => addr as EvmAddress);\n\n/**\n * **Hyperliquid spot `tokenId` (16-byte hex)** — In `spotMeta` / token APIs, each spot token has a\n * `tokenId` that Hyperliquid documents as a **34-character** hex string: `0x` plus **32** hex digits\n * (128 bits), e.g. `0x6d1e7cde53ba9467b783cb7c530ce054`. The `tokenDetails` info request uses the same\n * shape (`tokenId` parameter; see Hyperliquid API docs: Spot → tokenDetails).\n *\n * That is **not** the same as **HyperCore ↔ HyperEVM system addresses**: those are full **20-byte**\n * addresses whose leading byte is `0x20` with the token index in the tail (big-endian), or the HYPE\n * sentinel `0x2222…2222` (see Hyperliquid docs: HyperCore <> HyperEVM transfers → System Addresses).\n *\n * Aggregator quote payloads (e.g. Markr) may carry Hyperliquid **tokenId**-width hex where downstream\n * code expects a 20-byte EVM `0x` string. **Left-pad** the hex body to 40 nybbles, then validate with\n * viem `isAddress`. Standard 42-character EVM addresses are parsed by {@link EvmAddressSchema} instead\n * (union order in callers).\n *\n * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/spot\n * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/hyperevm/hypercore-less-than-greater-than-hyperevm-transfers\n */\nexport const HyperliquidAddressSchema: z.ZodType<EvmAddress> = z\n .string()\n .refine((value) => value.startsWith('0x') && /^0x[0-9a-fA-F]+$/.test(value), {\n message: 'Invalid Hyperliquid quote hex address',\n })\n .refine((value) => {\n const nybbles = value.length - 2;\n return nybbles > 0 && nybbles < 40;\n })\n .transform((value) => `0x${value.slice(2).padStart(40, '0')}`)\n .refine(isEvmAddress, { message: 'Invalid EVM address after Hyperliquid quote padding' })\n .transform((addr) => addr as EvmAddress);\n\nexport const HexSchema: z.ZodType<Hex> = z\n .string()\n .refine(isHex, { message: 'Invalid hex string' })\n .transform((hex) => hex as Hex);\n\nexport const BtcAddressSchema: z.ZodType<string> = z\n .string()\n .refine(isBech32Address, { message: 'Invalid BTC address' });\n\nexport const HashSchema: z.ZodType<Hash> = z\n .string()\n .refine(isHash, { message: 'Invalid hash string' })\n .transform((hash) => hash as Hash);\n\nexport const SolAddressSchema: z.ZodType<SolAddress> = z\n .string()\n .refine(isSolAddress, { message: 'Invalid Solana address' })\n .transform((addr) => addr as SolAddress);\n\nexport const SolSignatureSchema: z.ZodType<Signature> = z\n .string()\n .refine(isSignature, { message: 'Invalid Solana signature' })\n .transform((sig) => sig as Signature);\n"],"mappings":"uMAMA,MAAa,EAA0C,EACpD,QAAQ,CACR,OAAOA,EAAc,CAAE,QAAS,sBAAuB,CAAC,CACxD,UAAW,GAAS,EAAmB,CAoB7B,EAAkD,EAC5D,QAAQ,CACR,OAAQ,GAAU,EAAM,WAAW,KAAK,EAAI,mBAAmB,KAAK,EAAM,CAAE,CAC3E,QAAS,wCACV,CAAC,CACD,OAAQ,GAAU,CACjB,IAAM,EAAU,EAAM,OAAS,EAC/B,OAAO,EAAU,GAAK,EAAU,IAChC,CACD,UAAW,GAAU,KAAK,EAAM,MAAM,EAAE,CAAC,SAAS,GAAI,IAAI,GAAG,CAC7D,OAAOA,EAAc,CAAE,QAAS,sDAAuD,CAAC,CACxF,UAAW,GAAS,EAAmB,CAE7B,EAA4B,EACtC,QAAQ,CACR,OAAO,EAAO,CAAE,QAAS,qBAAsB,CAAC,CAChD,UAAW,GAAQ,EAAW,CAEpB,EAAsC,EAChD,QAAQ,CACR,OAAO,EAAiB,CAAE,QAAS,sBAAuB,CAAC,CAEjD,EAA8B,EACxC,QAAQ,CACR,OAAO,EAAQ,CAAE,QAAS,sBAAuB,CAAC,CAClD,UAAW,GAAS,EAAa,CAEvB,EAA0C,EACpD,QAAQ,CACR,OAAOC,EAAc,CAAE,QAAS,yBAA0B,CAAC,CAC3D,UAAW,GAAS,EAAmB,CAE7B,EAA2C,EACrD,QAAQ,CACR,OAAO,EAAa,CAAE,QAAS,2BAA4B,CAAC,CAC5D,UAAW,GAAQ,EAAiB"}
@@ -1,2 +1,2 @@
1
- const e=require(`../../../constants.cjs`);function t({chainConfigs:t}){return async({sourceAsset:n,sourceChainId:r,targetChainId:i})=>{if(r!==i)return[];let a=t.get(r);return a?n.type===e.TokenType.NATIVE?[{...a.wrappedAsset,bridgeProviders:[e.ServiceType.WRAP_UNWRAP]}]:n.type===e.TokenType.ERC20&&n.address.toLowerCase()===a.wrappedAsset.address.toLowerCase()?[{...a.nativeAsset,bridgeProviders:[e.ServiceType.WRAP_UNWRAP]}]:[]:[]}}exports.getBridgeableAssetsFactory=t;
1
+ const e=require(`../../../constants.cjs`),t=require(`../../../utils/asset-id.cjs`),n=({assets:e,limit:t,page:n})=>{let r=(n-1)*t,i=e.slice(r,r+t),a=r+i.length<e.length;return{assets:i,meta:{currentPage:n,hasMore:a,...a?{nextPage:n+1}:{}}}};function r({chainConfigs:r}){return async({sourceAsset:i,sourceChainId:a,targetChainId:o,limit:s,page:c})=>{let l=s??100,u=c??1;if(a!==o)return n({assets:[],limit:l,page:u});let d=r.get(a);return d?i.type===e.TokenType.NATIVE?n({assets:[{...d.wrappedAsset,id:t.getAssetId(o,d.wrappedAsset),bridgeProviders:[e.ServiceType.WRAP_UNWRAP]}],limit:l,page:u}):i.type===e.TokenType.ERC20&&i.address.toLowerCase()===d.wrappedAsset.address.toLowerCase()?n({assets:[{...d.nativeAsset,id:t.getAssetId(o,d.nativeAsset),bridgeProviders:[e.ServiceType.WRAP_UNWRAP]}],limit:l,page:u}):n({assets:[],limit:l,page:u}):n({assets:[],limit:l,page:u})}}exports.getBridgeableAssetsFactory=r;
2
2
  //# sourceMappingURL=get-bridgeable-assets.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-bridgeable-assets.cjs","names":["TokenType","ServiceType"],"sources":["../../../../src/transfer-service/wrap-unwrap/_handlers/get-bridgeable-assets.ts"],"sourcesContent":["import { ServiceType, TokenType } from '../../../constants';\nimport type { GetBridgeableAssetsProps, TransferService } from '../../../types/service';\nimport type { BridgeableUiAsset } from '../../../types/asset';\nimport type { Caip2ChainId } from '../../../types/caip';\nimport type { WrapChainConfig } from '../constants';\n\nexport function getBridgeableAssetsFactory({\n chainConfigs,\n}: {\n chainConfigs: ReadonlyMap<Caip2ChainId, WrapChainConfig>;\n}): TransferService['getBridgeableAssets'] {\n return async ({\n sourceAsset,\n sourceChainId,\n targetChainId,\n }: GetBridgeableAssetsProps): Promise<readonly BridgeableUiAsset[]> => {\n if (sourceChainId !== targetChainId) {\n return [];\n }\n const config = chainConfigs.get(sourceChainId);\n if (!config) {\n return [];\n }\n if (sourceAsset.type === TokenType.NATIVE) {\n return [{ ...config.wrappedAsset, bridgeProviders: [ServiceType.WRAP_UNWRAP] }];\n }\n if (\n sourceAsset.type === TokenType.ERC20 &&\n sourceAsset.address.toLowerCase() === config.wrappedAsset.address.toLowerCase()\n ) {\n return [{ ...config.nativeAsset, bridgeProviders: [ServiceType.WRAP_UNWRAP] }];\n }\n return [];\n };\n}\n"],"mappings":"0CAMA,SAAgB,EAA2B,CACzC,gBAGyC,CACzC,OAAO,MAAO,CACZ,cACA,gBACA,mBACqE,CACrE,GAAI,IAAkB,EACpB,MAAO,EAAE,CAEX,IAAM,EAAS,EAAa,IAAI,EAAc,CAa9C,OAZK,EAGD,EAAY,OAASA,EAAAA,UAAU,OAC1B,CAAC,CAAE,GAAG,EAAO,aAAc,gBAAiB,CAACC,EAAAA,YAAY,YAAY,CAAE,CAAC,CAG/E,EAAY,OAASD,EAAAA,UAAU,OAC/B,EAAY,QAAQ,aAAa,GAAK,EAAO,aAAa,QAAQ,aAAa,CAExE,CAAC,CAAE,GAAG,EAAO,YAAa,gBAAiB,CAACC,EAAAA,YAAY,YAAY,CAAE,CAAC,CAEzE,EAAE,CAXA,EAAE"}
1
+ {"version":3,"file":"get-bridgeable-assets.cjs","names":["TokenType","getAssetId","ServiceType"],"sources":["../../../../src/transfer-service/wrap-unwrap/_handlers/get-bridgeable-assets.ts"],"sourcesContent":["import { ServiceType, TokenType } from '../../../constants';\nimport type { GetBridgeableAssetsProps, GetBridgeableAssetsResult, TransferService } from '../../../types/service';\nimport type { Caip2ChainId } from '../../../types/caip';\nimport { getAssetId } from '../../../utils/asset-id';\nimport type { WrapChainConfig } from '../constants';\n\nconst DEFAULT_PAGE = 1;\nconst DEFAULT_LIMIT = 100;\n\nconst paginateAssets = ({\n assets,\n limit,\n page,\n}: {\n assets: GetBridgeableAssetsResult['assets'];\n limit: number;\n page: number;\n}): GetBridgeableAssetsResult => {\n const startIndex = (page - 1) * limit;\n const pageAssets = assets.slice(startIndex, startIndex + limit);\n const hasMore = startIndex + pageAssets.length < assets.length;\n\n return {\n assets: pageAssets,\n meta: {\n currentPage: page,\n hasMore,\n ...(hasMore ? { nextPage: page + 1 } : {}),\n },\n };\n};\n\nexport function getBridgeableAssetsFactory({\n chainConfigs,\n}: {\n chainConfigs: ReadonlyMap<Caip2ChainId, WrapChainConfig>;\n}): TransferService['getBridgeableAssets'] {\n return async ({\n sourceAsset,\n sourceChainId,\n targetChainId,\n limit,\n page,\n }: GetBridgeableAssetsProps): Promise<GetBridgeableAssetsResult> => {\n const pageLimit = limit ?? DEFAULT_LIMIT;\n const currentPage = page ?? DEFAULT_PAGE;\n\n if (sourceChainId !== targetChainId) {\n return paginateAssets({ assets: [], limit: pageLimit, page: currentPage });\n }\n const config = chainConfigs.get(sourceChainId);\n if (!config) {\n return paginateAssets({ assets: [], limit: pageLimit, page: currentPage });\n }\n if (sourceAsset.type === TokenType.NATIVE) {\n return paginateAssets({\n assets: [\n {\n ...config.wrappedAsset,\n id: getAssetId(targetChainId, config.wrappedAsset),\n bridgeProviders: [ServiceType.WRAP_UNWRAP],\n },\n ],\n limit: pageLimit,\n page: currentPage,\n });\n }\n if (\n sourceAsset.type === TokenType.ERC20 &&\n sourceAsset.address.toLowerCase() === config.wrappedAsset.address.toLowerCase()\n ) {\n return paginateAssets({\n assets: [\n {\n ...config.nativeAsset,\n id: getAssetId(targetChainId, config.nativeAsset),\n bridgeProviders: [ServiceType.WRAP_UNWRAP],\n },\n ],\n limit: pageLimit,\n page: currentPage,\n });\n }\n return paginateAssets({ assets: [], limit: pageLimit, page: currentPage });\n };\n}\n"],"mappings":"mFASM,GAAkB,CACtB,SACA,QACA,UAK+B,CAC/B,IAAM,GAAc,EAAO,GAAK,EAC1B,EAAa,EAAO,MAAM,EAAY,EAAa,EAAM,CACzD,EAAU,EAAa,EAAW,OAAS,EAAO,OAExD,MAAO,CACL,OAAQ,EACR,KAAM,CACJ,YAAa,EACb,UACA,GAAI,EAAU,CAAE,SAAU,EAAO,EAAG,CAAG,EAAE,CAC1C,CACF,EAGH,SAAgB,EAA2B,CACzC,gBAGyC,CACzC,OAAO,MAAO,CACZ,cACA,gBACA,gBACA,QACA,UACkE,CAClE,IAAM,EAAY,GAAS,IACrB,EAAc,GAAQ,EAE5B,GAAI,IAAkB,EACpB,OAAO,EAAe,CAAE,OAAQ,EAAE,CAAE,MAAO,EAAW,KAAM,EAAa,CAAC,CAE5E,IAAM,EAAS,EAAa,IAAI,EAAc,CAiC9C,OAhCK,EAGD,EAAY,OAASA,EAAAA,UAAU,OAC1B,EAAe,CACpB,OAAQ,CACN,CACE,GAAG,EAAO,aACV,GAAIC,EAAAA,WAAW,EAAe,EAAO,aAAa,CAClD,gBAAiB,CAACC,EAAAA,YAAY,YAAY,CAC3C,CACF,CACD,MAAO,EACP,KAAM,EACP,CAAC,CAGF,EAAY,OAASF,EAAAA,UAAU,OAC/B,EAAY,QAAQ,aAAa,GAAK,EAAO,aAAa,QAAQ,aAAa,CAExE,EAAe,CACpB,OAAQ,CACN,CACE,GAAG,EAAO,YACV,GAAIC,EAAAA,WAAW,EAAe,EAAO,YAAY,CACjD,gBAAiB,CAACC,EAAAA,YAAY,YAAY,CAC3C,CACF,CACD,MAAO,EACP,KAAM,EACP,CAAC,CAEG,EAAe,CAAE,OAAQ,EAAE,CAAE,MAAO,EAAW,KAAM,EAAa,CAAC,CA/BjE,EAAe,CAAE,OAAQ,EAAE,CAAE,MAAO,EAAW,KAAM,EAAa,CAAC"}
@@ -1,2 +1,2 @@
1
- import{ServiceType as e,TokenType as t}from"../../../constants.js";function n({chainConfigs:n}){return async({sourceAsset:r,sourceChainId:i,targetChainId:a})=>{if(i!==a)return[];let o=n.get(i);return o?r.type===t.NATIVE?[{...o.wrappedAsset,bridgeProviders:[e.WRAP_UNWRAP]}]:r.type===t.ERC20&&r.address.toLowerCase()===o.wrappedAsset.address.toLowerCase()?[{...o.nativeAsset,bridgeProviders:[e.WRAP_UNWRAP]}]:[]:[]}}export{n as getBridgeableAssetsFactory};
1
+ import{ServiceType as e,TokenType as t}from"../../../constants.js";import{getAssetId as n}from"../../../utils/asset-id.js";const r=({assets:e,limit:t,page:n})=>{let r=(n-1)*t,i=e.slice(r,r+t),a=r+i.length<e.length;return{assets:i,meta:{currentPage:n,hasMore:a,...a?{nextPage:n+1}:{}}}};function i({chainConfigs:i}){return async({sourceAsset:a,sourceChainId:o,targetChainId:s,limit:c,page:l})=>{let u=c??100,d=l??1;if(o!==s)return r({assets:[],limit:u,page:d});let f=i.get(o);return f?a.type===t.NATIVE?r({assets:[{...f.wrappedAsset,id:n(s,f.wrappedAsset),bridgeProviders:[e.WRAP_UNWRAP]}],limit:u,page:d}):a.type===t.ERC20&&a.address.toLowerCase()===f.wrappedAsset.address.toLowerCase()?r({assets:[{...f.nativeAsset,id:n(s,f.nativeAsset),bridgeProviders:[e.WRAP_UNWRAP]}],limit:u,page:d}):r({assets:[],limit:u,page:d}):r({assets:[],limit:u,page:d})}}export{i as getBridgeableAssetsFactory};
2
2
  //# sourceMappingURL=get-bridgeable-assets.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-bridgeable-assets.js","names":[],"sources":["../../../../src/transfer-service/wrap-unwrap/_handlers/get-bridgeable-assets.ts"],"sourcesContent":["import { ServiceType, TokenType } from '../../../constants';\nimport type { GetBridgeableAssetsProps, TransferService } from '../../../types/service';\nimport type { BridgeableUiAsset } from '../../../types/asset';\nimport type { Caip2ChainId } from '../../../types/caip';\nimport type { WrapChainConfig } from '../constants';\n\nexport function getBridgeableAssetsFactory({\n chainConfigs,\n}: {\n chainConfigs: ReadonlyMap<Caip2ChainId, WrapChainConfig>;\n}): TransferService['getBridgeableAssets'] {\n return async ({\n sourceAsset,\n sourceChainId,\n targetChainId,\n }: GetBridgeableAssetsProps): Promise<readonly BridgeableUiAsset[]> => {\n if (sourceChainId !== targetChainId) {\n return [];\n }\n const config = chainConfigs.get(sourceChainId);\n if (!config) {\n return [];\n }\n if (sourceAsset.type === TokenType.NATIVE) {\n return [{ ...config.wrappedAsset, bridgeProviders: [ServiceType.WRAP_UNWRAP] }];\n }\n if (\n sourceAsset.type === TokenType.ERC20 &&\n sourceAsset.address.toLowerCase() === config.wrappedAsset.address.toLowerCase()\n ) {\n return [{ ...config.nativeAsset, bridgeProviders: [ServiceType.WRAP_UNWRAP] }];\n }\n return [];\n };\n}\n"],"mappings":"mEAMA,SAAgB,EAA2B,CACzC,gBAGyC,CACzC,OAAO,MAAO,CACZ,cACA,gBACA,mBACqE,CACrE,GAAI,IAAkB,EACpB,MAAO,EAAE,CAEX,IAAM,EAAS,EAAa,IAAI,EAAc,CAa9C,OAZK,EAGD,EAAY,OAAS,EAAU,OAC1B,CAAC,CAAE,GAAG,EAAO,aAAc,gBAAiB,CAAC,EAAY,YAAY,CAAE,CAAC,CAG/E,EAAY,OAAS,EAAU,OAC/B,EAAY,QAAQ,aAAa,GAAK,EAAO,aAAa,QAAQ,aAAa,CAExE,CAAC,CAAE,GAAG,EAAO,YAAa,gBAAiB,CAAC,EAAY,YAAY,CAAE,CAAC,CAEzE,EAAE,CAXA,EAAE"}
1
+ {"version":3,"file":"get-bridgeable-assets.js","names":[],"sources":["../../../../src/transfer-service/wrap-unwrap/_handlers/get-bridgeable-assets.ts"],"sourcesContent":["import { ServiceType, TokenType } from '../../../constants';\nimport type { GetBridgeableAssetsProps, GetBridgeableAssetsResult, TransferService } from '../../../types/service';\nimport type { Caip2ChainId } from '../../../types/caip';\nimport { getAssetId } from '../../../utils/asset-id';\nimport type { WrapChainConfig } from '../constants';\n\nconst DEFAULT_PAGE = 1;\nconst DEFAULT_LIMIT = 100;\n\nconst paginateAssets = ({\n assets,\n limit,\n page,\n}: {\n assets: GetBridgeableAssetsResult['assets'];\n limit: number;\n page: number;\n}): GetBridgeableAssetsResult => {\n const startIndex = (page - 1) * limit;\n const pageAssets = assets.slice(startIndex, startIndex + limit);\n const hasMore = startIndex + pageAssets.length < assets.length;\n\n return {\n assets: pageAssets,\n meta: {\n currentPage: page,\n hasMore,\n ...(hasMore ? { nextPage: page + 1 } : {}),\n },\n };\n};\n\nexport function getBridgeableAssetsFactory({\n chainConfigs,\n}: {\n chainConfigs: ReadonlyMap<Caip2ChainId, WrapChainConfig>;\n}): TransferService['getBridgeableAssets'] {\n return async ({\n sourceAsset,\n sourceChainId,\n targetChainId,\n limit,\n page,\n }: GetBridgeableAssetsProps): Promise<GetBridgeableAssetsResult> => {\n const pageLimit = limit ?? DEFAULT_LIMIT;\n const currentPage = page ?? DEFAULT_PAGE;\n\n if (sourceChainId !== targetChainId) {\n return paginateAssets({ assets: [], limit: pageLimit, page: currentPage });\n }\n const config = chainConfigs.get(sourceChainId);\n if (!config) {\n return paginateAssets({ assets: [], limit: pageLimit, page: currentPage });\n }\n if (sourceAsset.type === TokenType.NATIVE) {\n return paginateAssets({\n assets: [\n {\n ...config.wrappedAsset,\n id: getAssetId(targetChainId, config.wrappedAsset),\n bridgeProviders: [ServiceType.WRAP_UNWRAP],\n },\n ],\n limit: pageLimit,\n page: currentPage,\n });\n }\n if (\n sourceAsset.type === TokenType.ERC20 &&\n sourceAsset.address.toLowerCase() === config.wrappedAsset.address.toLowerCase()\n ) {\n return paginateAssets({\n assets: [\n {\n ...config.nativeAsset,\n id: getAssetId(targetChainId, config.nativeAsset),\n bridgeProviders: [ServiceType.WRAP_UNWRAP],\n },\n ],\n limit: pageLimit,\n page: currentPage,\n });\n }\n return paginateAssets({ assets: [], limit: pageLimit, page: currentPage });\n };\n}\n"],"mappings":"2HAMA,MAGM,GAAkB,CACtB,SACA,QACA,UAK+B,CAC/B,IAAM,GAAc,EAAO,GAAK,EAC1B,EAAa,EAAO,MAAM,EAAY,EAAa,EAAM,CACzD,EAAU,EAAa,EAAW,OAAS,EAAO,OAExD,MAAO,CACL,OAAQ,EACR,KAAM,CACJ,YAAa,EACb,UACA,GAAI,EAAU,CAAE,SAAU,EAAO,EAAG,CAAG,EAAE,CAC1C,CACF,EAGH,SAAgB,EAA2B,CACzC,gBAGyC,CACzC,OAAO,MAAO,CACZ,cACA,gBACA,gBACA,QACA,UACkE,CAClE,IAAM,EAAY,GAAS,IACrB,EAAc,GAAQ,EAE5B,GAAI,IAAkB,EACpB,OAAO,EAAe,CAAE,OAAQ,EAAE,CAAE,MAAO,EAAW,KAAM,EAAa,CAAC,CAE5E,IAAM,EAAS,EAAa,IAAI,EAAc,CAiC9C,OAhCK,EAGD,EAAY,OAAS,EAAU,OAC1B,EAAe,CACpB,OAAQ,CACN,CACE,GAAG,EAAO,aACV,GAAI,EAAW,EAAe,EAAO,aAAa,CAClD,gBAAiB,CAAC,EAAY,YAAY,CAC3C,CACF,CACD,MAAO,EACP,KAAM,EACP,CAAC,CAGF,EAAY,OAAS,EAAU,OAC/B,EAAY,QAAQ,aAAa,GAAK,EAAO,aAAa,QAAQ,aAAa,CAExE,EAAe,CACpB,OAAQ,CACN,CACE,GAAG,EAAO,YACV,GAAI,EAAW,EAAe,EAAO,YAAY,CACjD,gBAAiB,CAAC,EAAY,YAAY,CAC3C,CACF,CACD,MAAO,EACP,KAAM,EACP,CAAC,CAEG,EAAe,CAAE,OAAQ,EAAE,CAAE,MAAO,EAAW,KAAM,EAAa,CAAC,CA/BjE,EAAe,CAAE,OAAQ,EAAE,CAAE,MAAO,EAAW,KAAM,EAAa,CAAC"}
@@ -1,2 +1,2 @@
1
- require(`../../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../../constants.cjs`),t=require(`../../../errors.cjs`),n=require(`../../../utils/caip.cjs`),r=require(`../../_utils.cjs`),i=require(`../_utils.cjs`),a=require(`../../_transfer-utilities.cjs`);let o=require(`viem`);function s({chainConfigs:s,environment:c,evmSigner:l}){return async({quote:u,gasSettings:d,onStepChange:f})=>{if(u.serviceType!==e.ServiceType.WRAP_UNWRAP)throw new t.SdkError(t.ErrorReason.INCORRECT_PROVIDER_PROVIDED,t.ErrorCode.INVALID_PARAMS);let p=Math.floor(Date.now()/1e3);if(u.expiresAt<=p)throw new t.SdkError(t.ErrorReason.QUOTE_EXPIRED,t.ErrorCode.INVALID_PARAMS);let m=u.fromAddress;if(!(0,o.isAddress)(m))throw new t.SdkError(t.ErrorReason.INVALID_PARAMS,t.ErrorCode.INVALID_PARAMS,{details:`fromAddress is not a valid EVM address.`});let h=u.sourceChain.chainId,g=i.getWrapDirection(u.assetIn,u.assetOut,h,s);if(!g)throw new t.SdkError(t.ErrorReason.INVALID_PARAMS,t.ErrorCode.INVALID_PARAMS,{details:`Quote does not represent a valid wrap/unwrap pair.`});let _=i.getWrapperContractAddress(h,s),v=g===`wrap`,y=i.encodeWrapUnwrapData(g,u.amountIn),b=r.getEvmClientForChain({chain:u.sourceChain}),x=await i.estimateWrapUnwrapGas({direction:g,amountIn:u.amountIn,contractAddress:_,fromAddress:m,client:b,estimateGasMarginBps:d?.estimateGasMarginBps}),S={chainId:n.caip2ToEip155HexChainId(u.sourceChain.chainId),data:y,from:m,gas:x,to:_,value:v?u.amountIn:0n,...d?.maxFeePerGas===void 0?null:{maxFeePerGas:d.maxFeePerGas,maxPriorityFeePerGas:d.maxPriorityFeePerGas}},C={currentSignature:1,currentSignatureReason:e.TransferSignatureReason.WrapToken,quote:u,requiredSignatures:1};f?.(C);let w=Date.now();return a.sourcePendingTransferFromQuote(u,{environment:c,txHash:await l.sign(S,async e=>b.sendRawTransaction({serializedTransaction:e}),C),startedAtMs:w,requiredConfirmationCount:1})}}exports.transferAssetFactory=s;
1
+ require(`../../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../../constants.cjs`),t=require(`../../../errors.cjs`),n=require(`../../../utils/caip.cjs`),r=require(`../../_transfer-utilities.cjs`),i=require(`../../_utils.cjs`),a=require(`../_utils.cjs`);let o=require(`viem`);function s({chainConfigs:s,environment:c,evmSigner:l}){return async({quote:u,gasSettings:d,onStepChange:f})=>{if(u.serviceType!==e.ServiceType.WRAP_UNWRAP)throw new t.SdkError(t.ErrorReason.INCORRECT_PROVIDER_PROVIDED,t.ErrorCode.INVALID_PARAMS);let p=Math.floor(Date.now()/1e3);if(u.expiresAt<=p)throw new t.SdkError(t.ErrorReason.QUOTE_EXPIRED,t.ErrorCode.INVALID_PARAMS);let m=u.fromAddress;if(!(0,o.isAddress)(m))throw new t.SdkError(t.ErrorReason.INVALID_PARAMS,t.ErrorCode.INVALID_PARAMS,{details:`fromAddress is not a valid EVM address.`});let h=u.sourceChain.chainId,g=a.getWrapDirection(u.assetIn,u.assetOut,h,s);if(!g)throw new t.SdkError(t.ErrorReason.INVALID_PARAMS,t.ErrorCode.INVALID_PARAMS,{details:`Quote does not represent a valid wrap/unwrap pair.`});let _=a.getWrapperContractAddress(h,s),v=g===`wrap`,y=a.encodeWrapUnwrapData(g,u.amountIn),b=i.getEvmClientForChain({chain:u.sourceChain}),x=await a.estimateWrapUnwrapGas({direction:g,amountIn:u.amountIn,contractAddress:_,fromAddress:m,client:b,estimateGasMarginBps:d?.estimateGasMarginBps}),S={chainId:n.caip2ToEip155HexChainId(u.sourceChain.chainId),data:y,from:m,gas:x,to:_,value:v?u.amountIn:0n,...d?.maxFeePerGas===void 0?null:{maxFeePerGas:d.maxFeePerGas,maxPriorityFeePerGas:d.maxPriorityFeePerGas}},C={currentSignature:1,currentSignatureReason:e.TransferSignatureReason.WrapToken,quote:u,requiredSignatures:1};f?.(C);let w=Date.now();return r.sourcePendingTransferFromQuote(u,{environment:c,txHash:await l.sign(S,async e=>b.sendRawTransaction({serializedTransaction:e}),C),startedAtMs:w,requiredConfirmationCount:1})}}exports.transferAssetFactory=s;
2
2
  //# sourceMappingURL=transfer-asset.cjs.map
@@ -1,2 +1,2 @@
1
- import{ServiceType as e,TransferSignatureReason as t}from"../../../constants.js";import{ErrorCode as n,ErrorReason as r,SdkError as i}from"../../../errors.js";import{caip2ToEip155HexChainId as a}from"../../../utils/caip.js";import{getEvmClientForChain as o}from"../../_utils.js";import{encodeWrapUnwrapData as s,estimateWrapUnwrapGas as c,getWrapDirection as l,getWrapperContractAddress as u}from"../_utils.js";import{sourcePendingTransferFromQuote as d}from"../../_transfer-utilities.js";import{isAddress as f}from"viem";function p({chainConfigs:p,environment:m,evmSigner:h}){return async({quote:g,gasSettings:_,onStepChange:v})=>{if(g.serviceType!==e.WRAP_UNWRAP)throw new i(r.INCORRECT_PROVIDER_PROVIDED,n.INVALID_PARAMS);let y=Math.floor(Date.now()/1e3);if(g.expiresAt<=y)throw new i(r.QUOTE_EXPIRED,n.INVALID_PARAMS);let b=g.fromAddress;if(!f(b))throw new i(r.INVALID_PARAMS,n.INVALID_PARAMS,{details:`fromAddress is not a valid EVM address.`});let x=g.sourceChain.chainId,S=l(g.assetIn,g.assetOut,x,p);if(!S)throw new i(r.INVALID_PARAMS,n.INVALID_PARAMS,{details:`Quote does not represent a valid wrap/unwrap pair.`});let C=u(x,p),w=S===`wrap`,T=s(S,g.amountIn),E=o({chain:g.sourceChain}),D=await c({direction:S,amountIn:g.amountIn,contractAddress:C,fromAddress:b,client:E,estimateGasMarginBps:_?.estimateGasMarginBps}),O={chainId:a(g.sourceChain.chainId),data:T,from:b,gas:D,to:C,value:w?g.amountIn:0n,..._?.maxFeePerGas===void 0?null:{maxFeePerGas:_.maxFeePerGas,maxPriorityFeePerGas:_.maxPriorityFeePerGas}},k={currentSignature:1,currentSignatureReason:t.WrapToken,quote:g,requiredSignatures:1};v?.(k);let A=Date.now();return d(g,{environment:m,txHash:await h.sign(O,async e=>E.sendRawTransaction({serializedTransaction:e}),k),startedAtMs:A,requiredConfirmationCount:1})}}export{p as transferAssetFactory};
1
+ import{ServiceType as e,TransferSignatureReason as t}from"../../../constants.js";import{ErrorCode as n,ErrorReason as r,SdkError as i}from"../../../errors.js";import{caip2ToEip155HexChainId as a}from"../../../utils/caip.js";import{sourcePendingTransferFromQuote as o}from"../../_transfer-utilities.js";import{getEvmClientForChain as s}from"../../_utils.js";import{encodeWrapUnwrapData as c,estimateWrapUnwrapGas as l,getWrapDirection as u,getWrapperContractAddress as d}from"../_utils.js";import{isAddress as f}from"viem";function p({chainConfigs:p,environment:m,evmSigner:h}){return async({quote:g,gasSettings:_,onStepChange:v})=>{if(g.serviceType!==e.WRAP_UNWRAP)throw new i(r.INCORRECT_PROVIDER_PROVIDED,n.INVALID_PARAMS);let y=Math.floor(Date.now()/1e3);if(g.expiresAt<=y)throw new i(r.QUOTE_EXPIRED,n.INVALID_PARAMS);let b=g.fromAddress;if(!f(b))throw new i(r.INVALID_PARAMS,n.INVALID_PARAMS,{details:`fromAddress is not a valid EVM address.`});let x=g.sourceChain.chainId,S=u(g.assetIn,g.assetOut,x,p);if(!S)throw new i(r.INVALID_PARAMS,n.INVALID_PARAMS,{details:`Quote does not represent a valid wrap/unwrap pair.`});let C=d(x,p),w=S===`wrap`,T=c(S,g.amountIn),E=s({chain:g.sourceChain}),D=await l({direction:S,amountIn:g.amountIn,contractAddress:C,fromAddress:b,client:E,estimateGasMarginBps:_?.estimateGasMarginBps}),O={chainId:a(g.sourceChain.chainId),data:T,from:b,gas:D,to:C,value:w?g.amountIn:0n,..._?.maxFeePerGas===void 0?null:{maxFeePerGas:_.maxFeePerGas,maxPriorityFeePerGas:_.maxPriorityFeePerGas}},k={currentSignature:1,currentSignatureReason:t.WrapToken,quote:g,requiredSignatures:1};v?.(k);let A=Date.now();return o(g,{environment:m,txHash:await h.sign(O,async e=>E.sendRawTransaction({serializedTransaction:e}),k),startedAtMs:A,requiredConfirmationCount:1})}}export{p as transferAssetFactory};
2
2
  //# sourceMappingURL=transfer-asset.js.map
@@ -57,10 +57,26 @@ type DestinationInfo = Record<string, {
57
57
  address: string;
58
58
  bridgeProviders: ServiceType[];
59
59
  }>;
60
+ /**
61
+ * Asset augmented with optional provider-specific metadata.
62
+ * `extras` is passed through by bridgeable-asset APIs without SDK-specific interpretation.
63
+ */
64
+ type AssetWithExtras = Asset & {
65
+ readonly extras?: Record<string, unknown>;
66
+ };
67
+ /**
68
+ * Asset shape used by bridgeable-assets APIs.
69
+ *
70
+ * - `id` is generated via `getAssetId(chainId, asset)`.
71
+ * - `extras` is an optional bag for provider-specific metadata.
72
+ */
73
+ type BridgeableAsset = AssetWithExtras & {
74
+ readonly id: string;
75
+ };
60
76
  /** Asset enriched with bridge providers that support it as a destination. */
61
- type BridgeableUiAsset = Asset & {
77
+ type BridgeableUiAsset = BridgeableAsset & {
62
78
  readonly bridgeProviders: readonly ServiceType[];
63
79
  };
64
80
  //#endregion
65
- export { Asset, BridgeableUiAsset, ChainAssetMap, DestinationInfo, Erc20Asset, NativeAsset, SplAsset, TransferableAsset };
81
+ export { Asset, AssetWithExtras, BridgeableAsset, BridgeableUiAsset, ChainAssetMap, DestinationInfo, Erc20Asset, NativeAsset, SplAsset, TransferableAsset };
66
82
  //# sourceMappingURL=asset.d.cts.map
@@ -57,10 +57,26 @@ type DestinationInfo = Record<string, {
57
57
  address: string;
58
58
  bridgeProviders: ServiceType[];
59
59
  }>;
60
+ /**
61
+ * Asset augmented with optional provider-specific metadata.
62
+ * `extras` is passed through by bridgeable-asset APIs without SDK-specific interpretation.
63
+ */
64
+ type AssetWithExtras = Asset & {
65
+ readonly extras?: Record<string, unknown>;
66
+ };
67
+ /**
68
+ * Asset shape used by bridgeable-assets APIs.
69
+ *
70
+ * - `id` is generated via `getAssetId(chainId, asset)`.
71
+ * - `extras` is an optional bag for provider-specific metadata.
72
+ */
73
+ type BridgeableAsset = AssetWithExtras & {
74
+ readonly id: string;
75
+ };
60
76
  /** Asset enriched with bridge providers that support it as a destination. */
61
- type BridgeableUiAsset = Asset & {
77
+ type BridgeableUiAsset = BridgeableAsset & {
62
78
  readonly bridgeProviders: readonly ServiceType[];
63
79
  };
64
80
  //#endregion
65
- export { Asset, BridgeableUiAsset, ChainAssetMap, DestinationInfo, Erc20Asset, NativeAsset, SplAsset, TransferableAsset };
81
+ export { Asset, AssetWithExtras, BridgeableAsset, BridgeableUiAsset, ChainAssetMap, DestinationInfo, Erc20Asset, NativeAsset, SplAsset, TransferableAsset };
66
82
  //# sourceMappingURL=asset.d.ts.map
@@ -12,7 +12,7 @@ import { Address as Address$1 } from "@solana/kit";
12
12
  * - "partner" fee is the fee charged by Core to facilitate the transfer.
13
13
  * It is already removed from the `amountOut` and is included here for transparency.
14
14
  */
15
- type QuoteFeeType = "partner" | "protocol" | "gas" | "bridge" | "slippage" | "swap" | "other";
15
+ type QuoteFeeType = "partner" | "protocol" | "gas" | "bridge" | "slippage" | "swap" | "other" | "relay";
16
16
  type QuoteFeeToken = {
17
17
  type: TokenType.NATIVE;
18
18
  } | {
@@ -12,7 +12,7 @@ import { Address as Address$1 } from "@solana/kit";
12
12
  * - "partner" fee is the fee charged by Core to facilitate the transfer.
13
13
  * It is already removed from the `amountOut` and is included here for transparency.
14
14
  */
15
- type QuoteFeeType = "partner" | "protocol" | "gas" | "bridge" | "slippage" | "swap" | "other";
15
+ type QuoteFeeType = "partner" | "protocol" | "gas" | "bridge" | "slippage" | "swap" | "other" | "relay";
16
16
  type QuoteFeeToken = {
17
17
  type: TokenType.NATIVE;
18
18
  } | {
@@ -1,12 +1,14 @@
1
1
  import { Caip2ChainId } from "./caip.cjs";
2
2
  import { BitcoinFunctions } from "./bitcoin.cjs";
3
3
  import { FeeRateTier } from "./fee.cjs";
4
- import { EVM_SERVICE_TYPES, ServiceType } from "../constants.cjs";
5
- import { Asset, BridgeableUiAsset, ChainAssetMap, NativeAsset } from "./asset.cjs";
4
+ import { AvalancheBlockchainAlias, EVM_SERVICE_TYPES, ServiceType } from "../constants.cjs";
5
+ import { Asset, AssetWithExtras, BridgeableUiAsset, ChainAssetMap, NativeAsset } from "./asset.cjs";
6
6
  import { Quote, QuoterProps, ServiceQuoteEventHandler } from "./quote.cjs";
7
+ import { ArrayElement } from "./utility-types.cjs";
8
+ import { GetAtomicUtxosCallback, GetCoreEthAddressCallback, GetUtxosCallback, GetWalletAddressesForChainAliasCallback, GetWalletChangeAddressForChainAliasCallback } from "../transfer-service/avalanche-cct/types.cjs";
7
9
  import { Transfer, TransferStepDetails } from "./transfer.cjs";
8
10
  import { BtcSigner, EvmSigner, EvmSignerWithMessage, SolanaSigner } from "./signer.cjs";
9
- import { ArrayElement } from "./utility-types.cjs";
11
+ import { UnsignedTx } from "@avalabs/avalanchejs";
10
12
 
11
13
  //#region src/types/service.d.ts
12
14
  /** Optional EIP-1559-style gas settings. */
@@ -121,11 +123,40 @@ interface EstimateNativeFeeOptions {
121
123
  maxPriorityFeePerGas?: bigint;
122
124
  }>;
123
125
  }
126
+ /**
127
+ * Asset search input used by bridgeable-assets queries.
128
+ *
129
+ * - `type: 'address'` means `value` is matched as an on-chain asset address.
130
+ * - `type: 'keyword'` means `value` is matched against asset name/symbol text.
131
+ */
132
+ interface AssetSearchQuery {
133
+ readonly type: "address" | "keyword";
134
+ readonly value: string;
135
+ }
124
136
  interface GetBridgeableAssetsProps {
137
+ /** Maximum number of assets requested per page. Must be a positive integer. */
138
+ readonly limit?: number;
139
+ /** 1-based page index for service-level pagination. */
140
+ readonly page?: number;
141
+ /**
142
+ * Optional query used to search by address or keyword (name/symbol).
143
+ * Currently, search filtering is only applied by the Markr service.
144
+ */
145
+ readonly search?: AssetSearchQuery;
125
146
  readonly sourceAsset: Asset;
126
147
  readonly sourceChainId: Caip2ChainId;
127
148
  readonly targetChainId: Caip2ChainId;
128
149
  }
150
+ interface GetBridgeableAssetsResult {
151
+ /** Assets for the requested page. */
152
+ readonly assets: readonly BridgeableUiAsset[];
153
+ /** Service pagination metadata for this response page. */
154
+ readonly meta: {
155
+ readonly currentPage: number;
156
+ readonly hasMore: boolean;
157
+ readonly nextPage?: number;
158
+ };
159
+ }
129
160
  /**
130
161
  * Mapping of services supported chains, and their corresponding supported destination chains.
131
162
  */
@@ -165,12 +196,56 @@ interface TransferService {
165
196
  result: Promise<Transfer>;
166
197
  };
167
198
  /** Return assets receivable on targetChainId for the given source, via this service. */
168
- getBridgeableAssets(props: GetBridgeableAssetsProps): Promise<readonly BridgeableUiAsset[]>;
199
+ getBridgeableAssets(props: GetBridgeableAssetsProps): Promise<GetBridgeableAssetsResult>;
169
200
  /** Execute the quote, emitting `onStepChange` for signature steps. */
170
201
  transferAsset(props: TransferAssetProps): Promise<Transfer>;
171
202
  /** Concrete discriminator for this service. */
172
203
  type: ServiceType;
173
204
  }
205
+ type AvalancheSendTxFunction = (unsignedTx: UnsignedTx, txType: "export" | "import", chainAlias: AvalancheBlockchainAlias) => Promise<string>;
206
+ type AvalancheCctInitializer = {
207
+ type: ServiceType.AVALANCHE_CCT;
208
+ /**
209
+ * Sends a fully built Avalanche export/import transaction and returns its transaction hash.
210
+ *
211
+ * You must implement signing and broadcasting on your side using the connected wallet/account
212
+ * for the provided chain alias.
213
+ */
214
+ avalancheSendTx: AvalancheSendTxFunction;
215
+ /**
216
+ * Maps an EVM C-Chain hex address (for example `0x...`) to the equivalent Coreth bech32 address.
217
+ *
218
+ * You must provide the address conversion from your wallet/provider stack so the SDK can route
219
+ * C-Chain imports/exports that require bech32 address format.
220
+ */
221
+ getCoreEthAddress: GetCoreEthAddressCallback;
222
+ /**
223
+ * Returns atomic UTXOs that are pending import into `destinationChain` from `sourceChain`.
224
+ *
225
+ * You must query Avalanche APIs/wallet state and return only currently importable atomic UTXOs
226
+ * for the specified source/destination chain pair.
227
+ */
228
+ getAtomicUtxos: GetAtomicUtxosCallback;
229
+ /**
230
+ * Returns spendable UTXOs for the provided P-Chain or X-Chain alias.
231
+ *
232
+ * You must load the wallet's current UTXO set for that chain so export transactions can be built.
233
+ */
234
+ getUtxos: GetUtxosCallback;
235
+ /**
236
+ * Returns addresses on the provided chain alias that are controlled by the connected wallet.
237
+ *
238
+ * You must provide all wallet-owned addresses relevant for transaction input ownership/signing checks.
239
+ */
240
+ getWalletAddressesForChainAlias: GetWalletAddressesForChainAliasCallback;
241
+ /**
242
+ * Returns the change address for the provided chain alias.
243
+ *
244
+ * You must return a valid wallet-controlled address that should receive change outputs
245
+ * when UTXO-based transactions are constructed.
246
+ */
247
+ getWalletChangeAddressForChainAlias: GetWalletChangeAddressForChainAliasCallback;
248
+ };
174
249
  /** EVM-family service initializer. */
175
250
  type EvmServiceInitializer = {
176
251
  type: ArrayElement<typeof EVM_SERVICE_TYPES>;
@@ -200,10 +275,23 @@ type MarkrServiceInitializer = {
200
275
  * Returns the assets available to receive on targetChainId via Markr cross-chain swaps.
201
276
  * The SDK calls this during getBridgeableAssets.
202
277
  * Similar to the bitcoinFunctions pattern, this decouples the SDK from any specific token registry.
278
+ * Any provider-specific metadata can be supplied via BridgeableAsset.extras and is passed through to consumers.
203
279
  */
204
- getTargetChainAssets: (targetChainId: Caip2ChainId) => Promise<readonly Asset[]>;
280
+ getTargetChainAssets: (queryProps: {
281
+ /** Optional query used to search by address or keyword (name/symbol). */search?: AssetSearchQuery;
282
+ limit: number;
283
+ page: number;
284
+ targetChainId: Caip2ChainId;
285
+ }) => Promise<{
286
+ readonly assets: readonly AssetWithExtras[];
287
+ readonly meta: {
288
+ readonly currentPage: number;
289
+ readonly hasMore: boolean;
290
+ readonly nextPage: number | undefined;
291
+ };
292
+ }>;
205
293
  };
206
- type ServiceInitializer = EvmServiceInitializer | LombardServiceInitializer | MarkrServiceInitializer;
294
+ type ServiceInitializer = AvalancheCctInitializer | EvmServiceInitializer | LombardServiceInitializer | MarkrServiceInitializer;
207
295
  //#endregion
208
- export { EstimateNativeFeeOptions, EvmServiceInitializer, GasSettings, GetBridgeableAssetsProps, GetMinimumTransferAmountProps, GetSupportedChainsResult, LombardServiceInitializer, MarkrServiceInitializer, MutableGetSupportedChainsResult, NativeFeeEstimate, ServiceInitializer, TrackTransferProps, TransferAssetProps, TransferService };
296
+ export { AssetSearchQuery, AvalancheCctInitializer, AvalancheSendTxFunction, EstimateNativeFeeOptions, EvmServiceInitializer, GasSettings, GetBridgeableAssetsProps, GetBridgeableAssetsResult, GetMinimumTransferAmountProps, GetSupportedChainsResult, LombardServiceInitializer, MarkrServiceInitializer, MutableGetSupportedChainsResult, NativeFeeEstimate, ServiceInitializer, TrackTransferProps, TransferAssetProps, TransferService };
209
297
  //# sourceMappingURL=service.d.cts.map
@@ -1,12 +1,14 @@
1
1
  import { Caip2ChainId } from "./caip.js";
2
2
  import { BitcoinFunctions } from "./bitcoin.js";
3
3
  import { FeeRateTier } from "./fee.js";
4
- import { EVM_SERVICE_TYPES, ServiceType } from "../constants.js";
5
- import { Asset, BridgeableUiAsset, ChainAssetMap, NativeAsset } from "./asset.js";
4
+ import { AvalancheBlockchainAlias, EVM_SERVICE_TYPES, ServiceType } from "../constants.js";
5
+ import { Asset, AssetWithExtras, BridgeableUiAsset, ChainAssetMap, NativeAsset } from "./asset.js";
6
6
  import { Quote, QuoterProps, ServiceQuoteEventHandler } from "./quote.js";
7
+ import { ArrayElement } from "./utility-types.js";
8
+ import { GetAtomicUtxosCallback, GetCoreEthAddressCallback, GetUtxosCallback, GetWalletAddressesForChainAliasCallback, GetWalletChangeAddressForChainAliasCallback } from "../transfer-service/avalanche-cct/types.js";
7
9
  import { Transfer, TransferStepDetails } from "./transfer.js";
8
10
  import { BtcSigner, EvmSigner, EvmSignerWithMessage, SolanaSigner } from "./signer.js";
9
- import { ArrayElement } from "./utility-types.js";
11
+ import { UnsignedTx } from "@avalabs/avalanchejs";
10
12
 
11
13
  //#region src/types/service.d.ts
12
14
  /** Optional EIP-1559-style gas settings. */
@@ -121,11 +123,40 @@ interface EstimateNativeFeeOptions {
121
123
  maxPriorityFeePerGas?: bigint;
122
124
  }>;
123
125
  }
126
+ /**
127
+ * Asset search input used by bridgeable-assets queries.
128
+ *
129
+ * - `type: 'address'` means `value` is matched as an on-chain asset address.
130
+ * - `type: 'keyword'` means `value` is matched against asset name/symbol text.
131
+ */
132
+ interface AssetSearchQuery {
133
+ readonly type: "address" | "keyword";
134
+ readonly value: string;
135
+ }
124
136
  interface GetBridgeableAssetsProps {
137
+ /** Maximum number of assets requested per page. Must be a positive integer. */
138
+ readonly limit?: number;
139
+ /** 1-based page index for service-level pagination. */
140
+ readonly page?: number;
141
+ /**
142
+ * Optional query used to search by address or keyword (name/symbol).
143
+ * Currently, search filtering is only applied by the Markr service.
144
+ */
145
+ readonly search?: AssetSearchQuery;
125
146
  readonly sourceAsset: Asset;
126
147
  readonly sourceChainId: Caip2ChainId;
127
148
  readonly targetChainId: Caip2ChainId;
128
149
  }
150
+ interface GetBridgeableAssetsResult {
151
+ /** Assets for the requested page. */
152
+ readonly assets: readonly BridgeableUiAsset[];
153
+ /** Service pagination metadata for this response page. */
154
+ readonly meta: {
155
+ readonly currentPage: number;
156
+ readonly hasMore: boolean;
157
+ readonly nextPage?: number;
158
+ };
159
+ }
129
160
  /**
130
161
  * Mapping of services supported chains, and their corresponding supported destination chains.
131
162
  */
@@ -165,12 +196,56 @@ interface TransferService {
165
196
  result: Promise<Transfer>;
166
197
  };
167
198
  /** Return assets receivable on targetChainId for the given source, via this service. */
168
- getBridgeableAssets(props: GetBridgeableAssetsProps): Promise<readonly BridgeableUiAsset[]>;
199
+ getBridgeableAssets(props: GetBridgeableAssetsProps): Promise<GetBridgeableAssetsResult>;
169
200
  /** Execute the quote, emitting `onStepChange` for signature steps. */
170
201
  transferAsset(props: TransferAssetProps): Promise<Transfer>;
171
202
  /** Concrete discriminator for this service. */
172
203
  type: ServiceType;
173
204
  }
205
+ type AvalancheSendTxFunction = (unsignedTx: UnsignedTx, txType: "export" | "import", chainAlias: AvalancheBlockchainAlias) => Promise<string>;
206
+ type AvalancheCctInitializer = {
207
+ type: ServiceType.AVALANCHE_CCT;
208
+ /**
209
+ * Sends a fully built Avalanche export/import transaction and returns its transaction hash.
210
+ *
211
+ * You must implement signing and broadcasting on your side using the connected wallet/account
212
+ * for the provided chain alias.
213
+ */
214
+ avalancheSendTx: AvalancheSendTxFunction;
215
+ /**
216
+ * Maps an EVM C-Chain hex address (for example `0x...`) to the equivalent Coreth bech32 address.
217
+ *
218
+ * You must provide the address conversion from your wallet/provider stack so the SDK can route
219
+ * C-Chain imports/exports that require bech32 address format.
220
+ */
221
+ getCoreEthAddress: GetCoreEthAddressCallback;
222
+ /**
223
+ * Returns atomic UTXOs that are pending import into `destinationChain` from `sourceChain`.
224
+ *
225
+ * You must query Avalanche APIs/wallet state and return only currently importable atomic UTXOs
226
+ * for the specified source/destination chain pair.
227
+ */
228
+ getAtomicUtxos: GetAtomicUtxosCallback;
229
+ /**
230
+ * Returns spendable UTXOs for the provided P-Chain or X-Chain alias.
231
+ *
232
+ * You must load the wallet's current UTXO set for that chain so export transactions can be built.
233
+ */
234
+ getUtxos: GetUtxosCallback;
235
+ /**
236
+ * Returns addresses on the provided chain alias that are controlled by the connected wallet.
237
+ *
238
+ * You must provide all wallet-owned addresses relevant for transaction input ownership/signing checks.
239
+ */
240
+ getWalletAddressesForChainAlias: GetWalletAddressesForChainAliasCallback;
241
+ /**
242
+ * Returns the change address for the provided chain alias.
243
+ *
244
+ * You must return a valid wallet-controlled address that should receive change outputs
245
+ * when UTXO-based transactions are constructed.
246
+ */
247
+ getWalletChangeAddressForChainAlias: GetWalletChangeAddressForChainAliasCallback;
248
+ };
174
249
  /** EVM-family service initializer. */
175
250
  type EvmServiceInitializer = {
176
251
  type: ArrayElement<typeof EVM_SERVICE_TYPES>;
@@ -200,10 +275,23 @@ type MarkrServiceInitializer = {
200
275
  * Returns the assets available to receive on targetChainId via Markr cross-chain swaps.
201
276
  * The SDK calls this during getBridgeableAssets.
202
277
  * Similar to the bitcoinFunctions pattern, this decouples the SDK from any specific token registry.
278
+ * Any provider-specific metadata can be supplied via BridgeableAsset.extras and is passed through to consumers.
203
279
  */
204
- getTargetChainAssets: (targetChainId: Caip2ChainId) => Promise<readonly Asset[]>;
280
+ getTargetChainAssets: (queryProps: {
281
+ /** Optional query used to search by address or keyword (name/symbol). */search?: AssetSearchQuery;
282
+ limit: number;
283
+ page: number;
284
+ targetChainId: Caip2ChainId;
285
+ }) => Promise<{
286
+ readonly assets: readonly AssetWithExtras[];
287
+ readonly meta: {
288
+ readonly currentPage: number;
289
+ readonly hasMore: boolean;
290
+ readonly nextPage: number | undefined;
291
+ };
292
+ }>;
205
293
  };
206
- type ServiceInitializer = EvmServiceInitializer | LombardServiceInitializer | MarkrServiceInitializer;
294
+ type ServiceInitializer = AvalancheCctInitializer | EvmServiceInitializer | LombardServiceInitializer | MarkrServiceInitializer;
207
295
  //#endregion
208
- export { EstimateNativeFeeOptions, EvmServiceInitializer, GasSettings, GetBridgeableAssetsProps, GetMinimumTransferAmountProps, GetSupportedChainsResult, LombardServiceInitializer, MarkrServiceInitializer, MutableGetSupportedChainsResult, NativeFeeEstimate, ServiceInitializer, TrackTransferProps, TransferAssetProps, TransferService };
296
+ export { AssetSearchQuery, AvalancheCctInitializer, AvalancheSendTxFunction, EstimateNativeFeeOptions, EvmServiceInitializer, GasSettings, GetBridgeableAssetsProps, GetBridgeableAssetsResult, GetMinimumTransferAmountProps, GetSupportedChainsResult, LombardServiceInitializer, MarkrServiceInitializer, MutableGetSupportedChainsResult, NativeFeeEstimate, ServiceInitializer, TrackTransferProps, TransferAssetProps, TransferService };
209
297
  //# sourceMappingURL=service.d.ts.map
@@ -2,10 +2,10 @@ import { Caip2ChainId } from "./caip.cjs";
2
2
  import { Environment, ServiceType } from "../constants.cjs";
3
3
  import { Asset, BridgeableUiAsset } from "./asset.cjs";
4
4
  import { Quote, QuoterInterface, QuoterProps } from "./quote.cjs";
5
+ import { Fetch } from "./utility-types.cjs";
5
6
  import { SdkError } from "../errors.cjs";
6
7
  import { Transfer } from "./transfer.cjs";
7
- import { Fetch } from "./utility-types.cjs";
8
- import { EstimateNativeFeeOptions, GetMinimumTransferAmountProps, GetSupportedChainsResult, NativeFeeEstimate, ServiceInitializer, TrackTransferProps, TransferAssetProps } from "./service.cjs";
8
+ import { EstimateNativeFeeOptions, GetBridgeableAssetsProps, GetMinimumTransferAmountProps, GetSupportedChainsResult, NativeFeeEstimate, ServiceInitializer, TrackTransferProps, TransferAssetProps } from "./service.cjs";
9
9
  import { QuoterOptions } from "../quoter/quoter.cjs";
10
10
 
11
11
  //#region src/types/transfer-manager.d.ts
@@ -55,19 +55,28 @@ interface TransferManager {
55
55
  /** Estimate the native fee for executing the provided quote. */
56
56
  estimateNativeFee(quote: Quote, options?: EstimateNativeFeeOptions): Promise<NativeFeeEstimate>;
57
57
  /**
58
- * Returns all assets possibly receivable on targetChainId for the given source asset,
59
- * across all configured bridge and swap providers. Assets are enriched with logoUri
60
- * where available.
58
+ * Returns a single page of combined bridgeable assets for the given source/target route.
59
+ * This API is designed for React Query `useInfiniteQuery`:
60
+ *
61
+ * - pass `pageParam` to this method as `page`
62
+ * - use `result.assets` as the current page payload
63
+ * - use `result.meta.nextPage` in `getNextPageParam`
64
+ *
65
+ * `search` is forwarded to all configured services, but currently only Markr
66
+ * applies search filtering in service implementations.
61
67
  *
62
68
  * Note: inclusion in this list does not guarantee a quote will succeed — for some
63
69
  * providers (e.g. Markr) routes are discovered at quote time and may not always be
64
70
  * available.
65
71
  */
66
- getBridgeableAssets(props: {
67
- sourceAsset: Asset;
68
- sourceChainId: Caip2ChainId;
69
- targetChainId: Caip2ChainId;
70
- }): Promise<readonly BridgeableUiAsset[]>;
72
+ getBridgeableAssets(props: GetBridgeableAssetsProps): Promise<{
73
+ readonly assets: readonly BridgeableUiAsset[];
74
+ readonly meta: {
75
+ readonly currentPage: number;
76
+ readonly hasMore: boolean;
77
+ readonly nextPage?: number;
78
+ };
79
+ }>;
71
80
  /**
72
81
  * Minimum supported source amount for a given pair.
73
82
  *