@avalabs/fusion-sdk 0.16.0 → 0.18.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 (187) hide show
  1. package/dist/constants.cjs +1 -1
  2. package/dist/constants.cjs.map +1 -1
  3. package/dist/constants.d.cts +34 -2
  4. package/dist/constants.d.ts +34 -2
  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.d.cts +6 -0
  10. package/dist/errors.d.ts +6 -0
  11. package/dist/errors.js +1 -1
  12. package/dist/errors.js.map +1 -1
  13. package/dist/mod.cjs +1 -1
  14. package/dist/mod.d.cts +8 -6
  15. package/dist/mod.d.ts +8 -6
  16. package/dist/mod.js +1 -1
  17. package/dist/transfer-manager.cjs +1 -1
  18. package/dist/transfer-manager.cjs.map +1 -1
  19. package/dist/transfer-manager.js +1 -1
  20. package/dist/transfer-manager.js.map +1 -1
  21. package/dist/transfer-service/_evm-gas.cjs +1 -1
  22. package/dist/transfer-service/_evm-gas.js +1 -1
  23. package/dist/transfer-service/_utils.cjs +1 -1
  24. package/dist/transfer-service/_utils.cjs.map +1 -1
  25. package/dist/transfer-service/_utils.js +1 -1
  26. package/dist/transfer-service/_utils.js.map +1 -1
  27. package/dist/transfer-service/avalanche-cct/_handlers/analyze-support.cjs +2 -0
  28. package/dist/transfer-service/avalanche-cct/_handlers/analyze-support.cjs.map +1 -0
  29. package/dist/transfer-service/avalanche-cct/_handlers/analyze-support.js +2 -0
  30. package/dist/transfer-service/avalanche-cct/_handlers/analyze-support.js.map +1 -0
  31. package/dist/transfer-service/avalanche-cct/_handlers/estimate-native-fee.cjs +2 -0
  32. package/dist/transfer-service/avalanche-cct/_handlers/estimate-native-fee.cjs.map +1 -0
  33. package/dist/transfer-service/avalanche-cct/_handlers/estimate-native-fee.js +2 -0
  34. package/dist/transfer-service/avalanche-cct/_handlers/estimate-native-fee.js.map +1 -0
  35. package/dist/transfer-service/avalanche-cct/_handlers/get-bridgeable-assets.cjs +2 -0
  36. package/dist/transfer-service/avalanche-cct/_handlers/get-bridgeable-assets.cjs.map +1 -0
  37. package/dist/transfer-service/avalanche-cct/_handlers/get-bridgeable-assets.js +2 -0
  38. package/dist/transfer-service/avalanche-cct/_handlers/get-bridgeable-assets.js.map +1 -0
  39. package/dist/transfer-service/avalanche-cct/_handlers/get-minimum-transfer-amount.cjs +2 -0
  40. package/dist/transfer-service/avalanche-cct/_handlers/get-minimum-transfer-amount.cjs.map +1 -0
  41. package/dist/transfer-service/avalanche-cct/_handlers/get-minimum-transfer-amount.js +2 -0
  42. package/dist/transfer-service/avalanche-cct/_handlers/get-minimum-transfer-amount.js.map +1 -0
  43. package/dist/transfer-service/avalanche-cct/_handlers/get-supported-chains.cjs +2 -0
  44. package/dist/transfer-service/avalanche-cct/_handlers/get-supported-chains.cjs.map +1 -0
  45. package/dist/transfer-service/avalanche-cct/_handlers/get-supported-chains.js +2 -0
  46. package/dist/transfer-service/avalanche-cct/_handlers/get-supported-chains.js.map +1 -0
  47. package/dist/transfer-service/avalanche-cct/_handlers/stream-quotes.cjs +2 -0
  48. package/dist/transfer-service/avalanche-cct/_handlers/stream-quotes.cjs.map +1 -0
  49. package/dist/transfer-service/avalanche-cct/_handlers/stream-quotes.js +2 -0
  50. package/dist/transfer-service/avalanche-cct/_handlers/stream-quotes.js.map +1 -0
  51. package/dist/transfer-service/avalanche-cct/_handlers/track-transfer.cjs +2 -0
  52. package/dist/transfer-service/avalanche-cct/_handlers/track-transfer.cjs.map +1 -0
  53. package/dist/transfer-service/avalanche-cct/_handlers/track-transfer.js +2 -0
  54. package/dist/transfer-service/avalanche-cct/_handlers/track-transfer.js.map +1 -0
  55. package/dist/transfer-service/avalanche-cct/_handlers/transfer-asset.cjs +2 -0
  56. package/dist/transfer-service/avalanche-cct/_handlers/transfer-asset.cjs.map +1 -0
  57. package/dist/transfer-service/avalanche-cct/_handlers/transfer-asset.js +2 -0
  58. package/dist/transfer-service/avalanche-cct/_handlers/transfer-asset.js.map +1 -0
  59. package/dist/transfer-service/avalanche-cct/_type-guards.cjs +2 -0
  60. package/dist/transfer-service/avalanche-cct/_type-guards.cjs.map +1 -0
  61. package/dist/transfer-service/avalanche-cct/_type-guards.js +2 -0
  62. package/dist/transfer-service/avalanche-cct/_type-guards.js.map +1 -0
  63. package/dist/transfer-service/avalanche-cct/_utils/addresses.cjs +2 -0
  64. package/dist/transfer-service/avalanche-cct/_utils/addresses.cjs.map +1 -0
  65. package/dist/transfer-service/avalanche-cct/_utils/addresses.js +2 -0
  66. package/dist/transfer-service/avalanche-cct/_utils/addresses.js.map +1 -0
  67. package/dist/transfer-service/avalanche-cct/_utils/fees.cjs +2 -0
  68. package/dist/transfer-service/avalanche-cct/_utils/fees.cjs.map +1 -0
  69. package/dist/transfer-service/avalanche-cct/_utils/fees.js +2 -0
  70. package/dist/transfer-service/avalanche-cct/_utils/fees.js.map +1 -0
  71. package/dist/transfer-service/avalanche-cct/_utils/p-chain.cjs +2 -0
  72. package/dist/transfer-service/avalanche-cct/_utils/p-chain.cjs.map +1 -0
  73. package/dist/transfer-service/avalanche-cct/_utils/p-chain.js +2 -0
  74. package/dist/transfer-service/avalanche-cct/_utils/p-chain.js.map +1 -0
  75. package/dist/transfer-service/avalanche-cct/_utils/polling.cjs +2 -0
  76. package/dist/transfer-service/avalanche-cct/_utils/polling.cjs.map +1 -0
  77. package/dist/transfer-service/avalanche-cct/_utils/polling.js +2 -0
  78. package/dist/transfer-service/avalanche-cct/_utils/polling.js.map +1 -0
  79. package/dist/transfer-service/avalanche-cct/_utils/transactions.cjs +2 -0
  80. package/dist/transfer-service/avalanche-cct/_utils/transactions.cjs.map +1 -0
  81. package/dist/transfer-service/avalanche-cct/_utils/transactions.js +2 -0
  82. package/dist/transfer-service/avalanche-cct/_utils/transactions.js.map +1 -0
  83. package/dist/transfer-service/avalanche-cct/_utils.cjs +2 -0
  84. package/dist/transfer-service/avalanche-cct/_utils.cjs.map +1 -0
  85. package/dist/transfer-service/avalanche-cct/_utils.js +2 -0
  86. package/dist/transfer-service/avalanche-cct/_utils.js.map +1 -0
  87. package/dist/transfer-service/avalanche-cct/avalanche-cct-service.cjs +2 -0
  88. package/dist/transfer-service/avalanche-cct/avalanche-cct-service.cjs.map +1 -0
  89. package/dist/transfer-service/avalanche-cct/avalanche-cct-service.js +2 -0
  90. package/dist/transfer-service/avalanche-cct/avalanche-cct-service.js.map +1 -0
  91. package/dist/transfer-service/avalanche-cct/constants.cjs +2 -0
  92. package/dist/transfer-service/avalanche-cct/constants.cjs.map +1 -0
  93. package/dist/transfer-service/avalanche-cct/constants.js +2 -0
  94. package/dist/transfer-service/avalanche-cct/constants.js.map +1 -0
  95. package/dist/transfer-service/avalanche-cct/types.d.cts +33 -0
  96. package/dist/transfer-service/avalanche-cct/types.d.ts +33 -0
  97. package/dist/transfer-service/avalanche-evm/_handlers/get-bridgeable-assets.cjs +1 -1
  98. package/dist/transfer-service/avalanche-evm/_handlers/get-bridgeable-assets.cjs.map +1 -1
  99. package/dist/transfer-service/avalanche-evm/_handlers/get-bridgeable-assets.js +1 -1
  100. package/dist/transfer-service/avalanche-evm/_handlers/get-bridgeable-assets.js.map +1 -1
  101. package/dist/transfer-service/avalanche-evm/_handlers/transfer-asset.cjs +1 -1
  102. package/dist/transfer-service/avalanche-evm/_handlers/transfer-asset.js +1 -1
  103. package/dist/transfer-service/avalanche-evm/_utils/wrap.cjs +1 -1
  104. package/dist/transfer-service/avalanche-evm/_utils/wrap.js +1 -1
  105. package/dist/transfer-service/fetch-utilities.cjs +1 -1
  106. package/dist/transfer-service/fetch-utilities.cjs.map +1 -1
  107. package/dist/transfer-service/fetch-utilities.js +1 -1
  108. package/dist/transfer-service/fetch-utilities.js.map +1 -1
  109. package/dist/transfer-service/lombard/btc-to-btcb/_handlers/get-bridgeable-assets.cjs +1 -1
  110. package/dist/transfer-service/lombard/btc-to-btcb/_handlers/get-bridgeable-assets.cjs.map +1 -1
  111. package/dist/transfer-service/lombard/btc-to-btcb/_handlers/get-bridgeable-assets.js +1 -1
  112. package/dist/transfer-service/lombard/btc-to-btcb/_handlers/get-bridgeable-assets.js.map +1 -1
  113. package/dist/transfer-service/lombard/btcb-to-btc/_handlers/get-bridgeable-assets.cjs +1 -1
  114. package/dist/transfer-service/lombard/btcb-to-btc/_handlers/get-bridgeable-assets.cjs.map +1 -1
  115. package/dist/transfer-service/lombard/btcb-to-btc/_handlers/get-bridgeable-assets.js +1 -1
  116. package/dist/transfer-service/lombard/btcb-to-btc/_handlers/get-bridgeable-assets.js.map +1 -1
  117. package/dist/transfer-service/markr/_api.cjs +1 -1
  118. package/dist/transfer-service/markr/_api.cjs.map +1 -1
  119. package/dist/transfer-service/markr/_api.js +1 -1
  120. package/dist/transfer-service/markr/_api.js.map +1 -1
  121. package/dist/transfer-service/markr/_handlers/estimate-native-fee.cjs +1 -1
  122. package/dist/transfer-service/markr/_handlers/estimate-native-fee.cjs.map +1 -1
  123. package/dist/transfer-service/markr/_handlers/estimate-native-fee.js +1 -1
  124. package/dist/transfer-service/markr/_handlers/estimate-native-fee.js.map +1 -1
  125. package/dist/transfer-service/markr/_handlers/get-bridgeable-assets.cjs +1 -1
  126. package/dist/transfer-service/markr/_handlers/get-bridgeable-assets.cjs.map +1 -1
  127. package/dist/transfer-service/markr/_handlers/get-bridgeable-assets.js +1 -1
  128. package/dist/transfer-service/markr/_handlers/get-bridgeable-assets.js.map +1 -1
  129. package/dist/transfer-service/markr/_handlers/track-transfer.cjs +1 -1
  130. package/dist/transfer-service/markr/_handlers/track-transfer.js +1 -1
  131. package/dist/transfer-service/markr/_handlers/transfer-asset-hyperliquid-withdraw.cjs +2 -0
  132. package/dist/transfer-service/markr/_handlers/transfer-asset-hyperliquid-withdraw.cjs.map +1 -0
  133. package/dist/transfer-service/markr/_handlers/transfer-asset-hyperliquid-withdraw.js +2 -0
  134. package/dist/transfer-service/markr/_handlers/transfer-asset-hyperliquid-withdraw.js.map +1 -0
  135. package/dist/transfer-service/markr/_handlers/transfer-asset.cjs +1 -1
  136. package/dist/transfer-service/markr/_handlers/transfer-asset.cjs.map +1 -1
  137. package/dist/transfer-service/markr/_handlers/transfer-asset.js +1 -1
  138. package/dist/transfer-service/markr/_handlers/transfer-asset.js.map +1 -1
  139. package/dist/transfer-service/markr/_hyperliquid-eip712.cjs +2 -0
  140. package/dist/transfer-service/markr/_hyperliquid-eip712.cjs.map +1 -0
  141. package/dist/transfer-service/markr/_hyperliquid-eip712.js +2 -0
  142. package/dist/transfer-service/markr/_hyperliquid-eip712.js.map +1 -0
  143. package/dist/transfer-service/markr/_hyperliquid-schema.cjs +2 -0
  144. package/dist/transfer-service/markr/_hyperliquid-schema.cjs.map +1 -0
  145. package/dist/transfer-service/markr/_hyperliquid-schema.js +2 -0
  146. package/dist/transfer-service/markr/_hyperliquid-schema.js.map +1 -0
  147. package/dist/transfer-service/markr/_hyperliquid.cjs +2 -0
  148. package/dist/transfer-service/markr/_hyperliquid.cjs.map +1 -0
  149. package/dist/transfer-service/markr/_hyperliquid.js +2 -0
  150. package/dist/transfer-service/markr/_hyperliquid.js.map +1 -0
  151. package/dist/transfer-service/markr/_schema.cjs +1 -1
  152. package/dist/transfer-service/markr/_schema.cjs.map +1 -1
  153. package/dist/transfer-service/markr/_schema.js +1 -1
  154. package/dist/transfer-service/markr/_schema.js.map +1 -1
  155. package/dist/transfer-service/markr/_type-guards.cjs +1 -1
  156. package/dist/transfer-service/markr/_type-guards.cjs.map +1 -1
  157. package/dist/transfer-service/markr/_type-guards.js +1 -1
  158. package/dist/transfer-service/markr/_type-guards.js.map +1 -1
  159. package/dist/transfer-service/markr/markr-service.cjs.map +1 -1
  160. package/dist/transfer-service/markr/markr-service.js.map +1 -1
  161. package/dist/transfer-service/wrap-unwrap/_handlers/get-bridgeable-assets.cjs +1 -1
  162. package/dist/transfer-service/wrap-unwrap/_handlers/get-bridgeable-assets.cjs.map +1 -1
  163. package/dist/transfer-service/wrap-unwrap/_handlers/get-bridgeable-assets.js +1 -1
  164. package/dist/transfer-service/wrap-unwrap/_handlers/get-bridgeable-assets.js.map +1 -1
  165. package/dist/transfer-service/wrap-unwrap/_handlers/transfer-asset.cjs +1 -1
  166. package/dist/transfer-service/wrap-unwrap/_handlers/transfer-asset.js +1 -1
  167. package/dist/types/asset.d.cts +18 -2
  168. package/dist/types/asset.d.ts +18 -2
  169. package/dist/types/service.d.cts +106 -7
  170. package/dist/types/service.d.ts +106 -7
  171. package/dist/types/signer.d.cts +37 -1
  172. package/dist/types/signer.d.ts +37 -1
  173. package/dist/types/transfer-manager.d.cts +19 -10
  174. package/dist/types/transfer-manager.d.ts +19 -10
  175. package/dist/types/utility-types.d.cts +8 -1
  176. package/dist/types/utility-types.d.ts +8 -1
  177. package/dist/utils/asset-id.cjs +1 -1
  178. package/dist/utils/asset-id.cjs.map +1 -1
  179. package/dist/utils/asset-id.js +1 -1
  180. package/dist/utils/asset-id.js.map +1 -1
  181. package/dist/utils/bridgeable-assets.cjs +2 -0
  182. package/dist/utils/bridgeable-assets.cjs.map +1 -0
  183. package/dist/utils/bridgeable-assets.d.cts +16 -0
  184. package/dist/utils/bridgeable-assets.d.ts +16 -0
  185. package/dist/utils/bridgeable-assets.js +2 -0
  186. package/dist/utils/bridgeable-assets.js.map +1 -0
  187. package/package.json +5 -3
@@ -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,62 @@ 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 AvalancheSendTxParams = {
206
+ baseFeeInNanoAvax: bigint;
207
+ chainAlias: AvalancheBlockchainAlias;
208
+ txType: "export" | "import";
209
+ unsignedTx: UnsignedTx;
210
+ };
211
+ type AvalancheSendTxFunction = (params: AvalancheSendTxParams) => Promise<string>;
212
+ type AvalancheCctInitializer = {
213
+ type: ServiceType.AVALANCHE_CCT;
214
+ /**
215
+ * Sends a fully built Avalanche export/import transaction and returns its transaction hash.
216
+ *
217
+ * You must implement signing and broadcasting on your side using the connected wallet/account
218
+ * for the provided chain alias.
219
+ */
220
+ avalancheSendTx: AvalancheSendTxFunction;
221
+ /**
222
+ * Maps an EVM C-Chain hex address (for example `0x...`) to the equivalent Coreth bech32 address.
223
+ *
224
+ * You must provide the address conversion from your wallet/provider stack so the SDK can route
225
+ * C-Chain imports/exports that require bech32 address format.
226
+ */
227
+ getCoreEthAddress: GetCoreEthAddressCallback;
228
+ /**
229
+ * Returns atomic UTXOs that are pending import into `destinationChain` from `sourceChain`.
230
+ *
231
+ * You must query Avalanche APIs/wallet state and return only currently importable atomic UTXOs
232
+ * for the specified source/destination chain pair.
233
+ */
234
+ getAtomicUtxos: GetAtomicUtxosCallback;
235
+ /**
236
+ * Returns spendable UTXOs for the provided P-Chain or X-Chain alias.
237
+ *
238
+ * You must load the wallet's current UTXO set for that chain so export transactions can be built.
239
+ */
240
+ getUtxos: GetUtxosCallback;
241
+ /**
242
+ * Returns addresses on the provided chain alias that are controlled by the connected wallet.
243
+ *
244
+ * You must provide all wallet-owned addresses relevant for transaction input ownership/signing checks.
245
+ */
246
+ getWalletAddressesForChainAlias: GetWalletAddressesForChainAliasCallback;
247
+ /**
248
+ * Returns the change address for the provided chain alias.
249
+ *
250
+ * You must return a valid wallet-controlled address that should receive change outputs
251
+ * when UTXO-based transactions are constructed.
252
+ */
253
+ getWalletChangeAddressForChainAlias: GetWalletChangeAddressForChainAliasCallback;
254
+ };
174
255
  /** EVM-family service initializer. */
175
256
  type EvmServiceInitializer = {
176
257
  type: ArrayElement<typeof EVM_SERVICE_TYPES>;
@@ -186,6 +267,11 @@ type LombardServiceInitializer = {
186
267
  /** Markr initializer (swaps, cross-chain swaps). */
187
268
  type MarkrServiceInitializer = {
188
269
  type: ServiceType.MARKR;
270
+ /**
271
+ * EVM signer. Wire up `signTypedData` on the signer to enable Hyperliquid
272
+ * 2-phase withdrawals; otherwise a plain {@link EvmSigner} is sufficient
273
+ * for non-HL EVM swaps and bridges.
274
+ */
189
275
  evmSigner: EvmSigner;
190
276
  markrApiUrl?: string;
191
277
  markrApiToken?: string;
@@ -200,10 +286,23 @@ type MarkrServiceInitializer = {
200
286
  * Returns the assets available to receive on targetChainId via Markr cross-chain swaps.
201
287
  * The SDK calls this during getBridgeableAssets.
202
288
  * Similar to the bitcoinFunctions pattern, this decouples the SDK from any specific token registry.
289
+ * Any provider-specific metadata can be supplied via BridgeableAsset.extras and is passed through to consumers.
203
290
  */
204
- getTargetChainAssets: (targetChainId: Caip2ChainId) => Promise<readonly Asset[]>;
291
+ getTargetChainAssets: (queryProps: {
292
+ /** Optional query used to search by address or keyword (name/symbol). */search?: AssetSearchQuery;
293
+ limit: number;
294
+ page: number;
295
+ targetChainId: Caip2ChainId;
296
+ }) => Promise<{
297
+ readonly assets: readonly AssetWithExtras[];
298
+ readonly meta: {
299
+ readonly currentPage: number;
300
+ readonly hasMore: boolean;
301
+ readonly nextPage: number | undefined;
302
+ };
303
+ }>;
205
304
  };
206
- type ServiceInitializer = EvmServiceInitializer | LombardServiceInitializer | MarkrServiceInitializer;
305
+ type ServiceInitializer = AvalancheCctInitializer | EvmServiceInitializer | LombardServiceInitializer | MarkrServiceInitializer;
207
306
  //#endregion
208
- export { EstimateNativeFeeOptions, EvmServiceInitializer, GasSettings, GetBridgeableAssetsProps, GetMinimumTransferAmountProps, GetSupportedChainsResult, LombardServiceInitializer, MarkrServiceInitializer, MutableGetSupportedChainsResult, NativeFeeEstimate, ServiceInitializer, TrackTransferProps, TransferAssetProps, TransferService };
307
+ export { AssetSearchQuery, AvalancheCctInitializer, AvalancheSendTxFunction, AvalancheSendTxParams, EstimateNativeFeeOptions, EvmServiceInitializer, GasSettings, GetBridgeableAssetsProps, GetBridgeableAssetsResult, GetMinimumTransferAmountProps, GetSupportedChainsResult, LombardServiceInitializer, MarkrServiceInitializer, MutableGetSupportedChainsResult, NativeFeeEstimate, ServiceInitializer, TrackTransferProps, TransferAssetProps, TransferService };
209
308
  //# 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,62 @@ 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 AvalancheSendTxParams = {
206
+ baseFeeInNanoAvax: bigint;
207
+ chainAlias: AvalancheBlockchainAlias;
208
+ txType: "export" | "import";
209
+ unsignedTx: UnsignedTx;
210
+ };
211
+ type AvalancheSendTxFunction = (params: AvalancheSendTxParams) => Promise<string>;
212
+ type AvalancheCctInitializer = {
213
+ type: ServiceType.AVALANCHE_CCT;
214
+ /**
215
+ * Sends a fully built Avalanche export/import transaction and returns its transaction hash.
216
+ *
217
+ * You must implement signing and broadcasting on your side using the connected wallet/account
218
+ * for the provided chain alias.
219
+ */
220
+ avalancheSendTx: AvalancheSendTxFunction;
221
+ /**
222
+ * Maps an EVM C-Chain hex address (for example `0x...`) to the equivalent Coreth bech32 address.
223
+ *
224
+ * You must provide the address conversion from your wallet/provider stack so the SDK can route
225
+ * C-Chain imports/exports that require bech32 address format.
226
+ */
227
+ getCoreEthAddress: GetCoreEthAddressCallback;
228
+ /**
229
+ * Returns atomic UTXOs that are pending import into `destinationChain` from `sourceChain`.
230
+ *
231
+ * You must query Avalanche APIs/wallet state and return only currently importable atomic UTXOs
232
+ * for the specified source/destination chain pair.
233
+ */
234
+ getAtomicUtxos: GetAtomicUtxosCallback;
235
+ /**
236
+ * Returns spendable UTXOs for the provided P-Chain or X-Chain alias.
237
+ *
238
+ * You must load the wallet's current UTXO set for that chain so export transactions can be built.
239
+ */
240
+ getUtxos: GetUtxosCallback;
241
+ /**
242
+ * Returns addresses on the provided chain alias that are controlled by the connected wallet.
243
+ *
244
+ * You must provide all wallet-owned addresses relevant for transaction input ownership/signing checks.
245
+ */
246
+ getWalletAddressesForChainAlias: GetWalletAddressesForChainAliasCallback;
247
+ /**
248
+ * Returns the change address for the provided chain alias.
249
+ *
250
+ * You must return a valid wallet-controlled address that should receive change outputs
251
+ * when UTXO-based transactions are constructed.
252
+ */
253
+ getWalletChangeAddressForChainAlias: GetWalletChangeAddressForChainAliasCallback;
254
+ };
174
255
  /** EVM-family service initializer. */
175
256
  type EvmServiceInitializer = {
176
257
  type: ArrayElement<typeof EVM_SERVICE_TYPES>;
@@ -186,6 +267,11 @@ type LombardServiceInitializer = {
186
267
  /** Markr initializer (swaps, cross-chain swaps). */
187
268
  type MarkrServiceInitializer = {
188
269
  type: ServiceType.MARKR;
270
+ /**
271
+ * EVM signer. Wire up `signTypedData` on the signer to enable Hyperliquid
272
+ * 2-phase withdrawals; otherwise a plain {@link EvmSigner} is sufficient
273
+ * for non-HL EVM swaps and bridges.
274
+ */
189
275
  evmSigner: EvmSigner;
190
276
  markrApiUrl?: string;
191
277
  markrApiToken?: string;
@@ -200,10 +286,23 @@ type MarkrServiceInitializer = {
200
286
  * Returns the assets available to receive on targetChainId via Markr cross-chain swaps.
201
287
  * The SDK calls this during getBridgeableAssets.
202
288
  * Similar to the bitcoinFunctions pattern, this decouples the SDK from any specific token registry.
289
+ * Any provider-specific metadata can be supplied via BridgeableAsset.extras and is passed through to consumers.
203
290
  */
204
- getTargetChainAssets: (targetChainId: Caip2ChainId) => Promise<readonly Asset[]>;
291
+ getTargetChainAssets: (queryProps: {
292
+ /** Optional query used to search by address or keyword (name/symbol). */search?: AssetSearchQuery;
293
+ limit: number;
294
+ page: number;
295
+ targetChainId: Caip2ChainId;
296
+ }) => Promise<{
297
+ readonly assets: readonly AssetWithExtras[];
298
+ readonly meta: {
299
+ readonly currentPage: number;
300
+ readonly hasMore: boolean;
301
+ readonly nextPage: number | undefined;
302
+ };
303
+ }>;
205
304
  };
206
- type ServiceInitializer = EvmServiceInitializer | LombardServiceInitializer | MarkrServiceInitializer;
305
+ type ServiceInitializer = AvalancheCctInitializer | EvmServiceInitializer | LombardServiceInitializer | MarkrServiceInitializer;
207
306
  //#endregion
208
- export { EstimateNativeFeeOptions, EvmServiceInitializer, GasSettings, GetBridgeableAssetsProps, GetMinimumTransferAmountProps, GetSupportedChainsResult, LombardServiceInitializer, MarkrServiceInitializer, MutableGetSupportedChainsResult, NativeFeeEstimate, ServiceInitializer, TrackTransferProps, TransferAssetProps, TransferService };
307
+ export { AssetSearchQuery, AvalancheCctInitializer, AvalancheSendTxFunction, AvalancheSendTxParams, EstimateNativeFeeOptions, EvmServiceInitializer, GasSettings, GetBridgeableAssetsProps, GetBridgeableAssetsResult, GetMinimumTransferAmountProps, GetSupportedChainsResult, LombardServiceInitializer, MarkrServiceInitializer, MutableGetSupportedChainsResult, NativeFeeEstimate, ServiceInitializer, TrackTransferProps, TransferAssetProps, TransferService };
209
308
  //# sourceMappingURL=service.d.ts.map
@@ -27,9 +27,45 @@ type EvmSignMessage = (params: {
27
27
  address: Address;
28
28
  chainId: number;
29
29
  }, dispatch: EvmDispatch, step: TransferStepDetails) => Promise<Hex>;
30
+ /**
31
+ * EIP-712 typed-data payload passed to `signTypedData`.
32
+ *
33
+ * Mirrors the shape `viem`'s `walletClient.signTypedData` / `useSignTypedData`
34
+ * accept so consumers can forward the object verbatim. Types intentionally use
35
+ * `Record` instead of `viem`'s generics to avoid leaking heavy type plumbing
36
+ * across the SDK surface — runtime shape is stable across EIP-712 versions.
37
+ */
38
+ interface EvmTypedData {
39
+ readonly domain: {
40
+ readonly name?: string;
41
+ readonly version?: string;
42
+ readonly chainId?: number;
43
+ readonly verifyingContract?: Address;
44
+ readonly salt?: Hex;
45
+ };
46
+ readonly types: Readonly<Record<string, ReadonlyArray<{
47
+ readonly name: string;
48
+ readonly type: string;
49
+ }>>>;
50
+ readonly primaryType: string;
51
+ readonly message: Readonly<Record<string, unknown>>;
52
+ }
53
+ type EvmSignTypedData = (params: {
54
+ typedData: EvmTypedData;
55
+ address: Address;
56
+ chainId: number;
57
+ }, step: TransferStepDetails) => Promise<Hex>;
30
58
  interface EvmSigner {
31
59
  sign: EvmSign;
32
60
  signBatch?: EvmSignBatch;
61
+ /**
62
+ * EIP-712 typed-data signature.
63
+ *
64
+ * Optional for backwards compatibility — handlers that require this
65
+ * (e.g. the Hyperliquid 2-phase withdrawal) throw if the consumer hasn't
66
+ * wired it.
67
+ */
68
+ signTypedData?: EvmSignTypedData;
33
69
  }
34
70
  interface EvmSignerWithMessage extends EvmSigner {
35
71
  signMessage: EvmSignMessage;
@@ -48,5 +84,5 @@ interface SolanaSigner {
48
84
  signAndSend: SolanaSign;
49
85
  }
50
86
  //#endregion
51
- export { BtcDispatch, BtcSign, BtcSigner, BtcTransactionRequest, EvmDispatch, EvmSign, EvmSignBatch, EvmSignMessage, EvmSigner, EvmSignerWithMessage, EvmTransactionRequest, Hex, SolanaSign, SolanaSigner };
87
+ export { BtcDispatch, BtcSign, BtcSigner, BtcTransactionRequest, EvmDispatch, EvmSign, EvmSignBatch, EvmSignMessage, EvmSignTypedData, EvmSigner, EvmSignerWithMessage, EvmTransactionRequest, EvmTypedData, Hex, SolanaSign, SolanaSigner };
52
88
  //# sourceMappingURL=signer.d.cts.map
@@ -27,9 +27,45 @@ type EvmSignMessage = (params: {
27
27
  address: Address;
28
28
  chainId: number;
29
29
  }, dispatch: EvmDispatch, step: TransferStepDetails) => Promise<Hex>;
30
+ /**
31
+ * EIP-712 typed-data payload passed to `signTypedData`.
32
+ *
33
+ * Mirrors the shape `viem`'s `walletClient.signTypedData` / `useSignTypedData`
34
+ * accept so consumers can forward the object verbatim. Types intentionally use
35
+ * `Record` instead of `viem`'s generics to avoid leaking heavy type plumbing
36
+ * across the SDK surface — runtime shape is stable across EIP-712 versions.
37
+ */
38
+ interface EvmTypedData {
39
+ readonly domain: {
40
+ readonly name?: string;
41
+ readonly version?: string;
42
+ readonly chainId?: number;
43
+ readonly verifyingContract?: Address;
44
+ readonly salt?: Hex;
45
+ };
46
+ readonly types: Readonly<Record<string, ReadonlyArray<{
47
+ readonly name: string;
48
+ readonly type: string;
49
+ }>>>;
50
+ readonly primaryType: string;
51
+ readonly message: Readonly<Record<string, unknown>>;
52
+ }
53
+ type EvmSignTypedData = (params: {
54
+ typedData: EvmTypedData;
55
+ address: Address;
56
+ chainId: number;
57
+ }, step: TransferStepDetails) => Promise<Hex>;
30
58
  interface EvmSigner {
31
59
  sign: EvmSign;
32
60
  signBatch?: EvmSignBatch;
61
+ /**
62
+ * EIP-712 typed-data signature.
63
+ *
64
+ * Optional for backwards compatibility — handlers that require this
65
+ * (e.g. the Hyperliquid 2-phase withdrawal) throw if the consumer hasn't
66
+ * wired it.
67
+ */
68
+ signTypedData?: EvmSignTypedData;
33
69
  }
34
70
  interface EvmSignerWithMessage extends EvmSigner {
35
71
  signMessage: EvmSignMessage;
@@ -48,5 +84,5 @@ interface SolanaSigner {
48
84
  signAndSend: SolanaSign;
49
85
  }
50
86
  //#endregion
51
- export { BtcDispatch, BtcSign, BtcSigner, BtcTransactionRequest, EvmDispatch, EvmSign, EvmSignBatch, EvmSignMessage, EvmSigner, EvmSignerWithMessage, EvmTransactionRequest, Hex, SolanaSign, SolanaSigner };
87
+ export { BtcDispatch, BtcSign, BtcSigner, BtcTransactionRequest, EvmDispatch, EvmSign, EvmSignBatch, EvmSignMessage, EvmSignTypedData, EvmSigner, EvmSignerWithMessage, EvmTransactionRequest, EvmTypedData, Hex, SolanaSign, SolanaSigner };
52
88
  //# sourceMappingURL=signer.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
  *
@@ -2,10 +2,10 @@ import { Caip2ChainId } from "./caip.js";
2
2
  import { Environment, ServiceType } from "../constants.js";
3
3
  import { Asset, BridgeableUiAsset } from "./asset.js";
4
4
  import { Quote, QuoterInterface, QuoterProps } from "./quote.js";
5
+ import { Fetch } from "./utility-types.js";
5
6
  import { SdkError } from "../errors.js";
6
7
  import { Transfer } from "./transfer.js";
7
- import { Fetch } from "./utility-types.js";
8
- import { EstimateNativeFeeOptions, GetMinimumTransferAmountProps, GetSupportedChainsResult, NativeFeeEstimate, ServiceInitializer, TrackTransferProps, TransferAssetProps } from "./service.js";
8
+ import { EstimateNativeFeeOptions, GetBridgeableAssetsProps, GetMinimumTransferAmountProps, GetSupportedChainsResult, NativeFeeEstimate, ServiceInitializer, TrackTransferProps, TransferAssetProps } from "./service.js";
9
9
  import { QuoterOptions } from "../quoter/quoter.js";
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
  *
@@ -8,6 +8,13 @@
8
8
  */
9
9
  type ArrayElement<A> = A extends readonly (infer T)[] ? T : never;
10
10
  /**
11
+ * Utility type to create a branded type, which is a subtype of the original
12
+ * type but with an additional unique brand property to prevent accidental interchangeability.
13
+ */
14
+ type Brand<K, T> = K & {
15
+ readonly __brand: T;
16
+ };
17
+ /**
11
18
  * Utility type to make all properties of a type mutable (non-readonly).
12
19
  */
13
20
  type Mutable<T> = { -readonly [P in keyof T]: T[P] };
@@ -17,5 +24,5 @@ type Mutable<T> = { -readonly [P in keyof T]: T[P] };
17
24
  type DeepMutable<T> = { -readonly [P in keyof T]: T[P] extends object ? DeepMutable<T[P]> : T[P] };
18
25
  type Fetch = typeof globalThis.fetch;
19
26
  //#endregion
20
- export { ArrayElement, DeepMutable, Fetch, Mutable };
27
+ export { ArrayElement, Brand, DeepMutable, Fetch, Mutable };
21
28
  //# sourceMappingURL=utility-types.d.cts.map
@@ -8,6 +8,13 @@
8
8
  */
9
9
  type ArrayElement<A> = A extends readonly (infer T)[] ? T : never;
10
10
  /**
11
+ * Utility type to create a branded type, which is a subtype of the original
12
+ * type but with an additional unique brand property to prevent accidental interchangeability.
13
+ */
14
+ type Brand<K, T> = K & {
15
+ readonly __brand: T;
16
+ };
17
+ /**
11
18
  * Utility type to make all properties of a type mutable (non-readonly).
12
19
  */
13
20
  type Mutable<T> = { -readonly [P in keyof T]: T[P] };
@@ -17,5 +24,5 @@ type Mutable<T> = { -readonly [P in keyof T]: T[P] };
17
24
  type DeepMutable<T> = { -readonly [P in keyof T]: T[P] extends object ? DeepMutable<T[P]> : T[P] };
18
25
  type Fetch = typeof globalThis.fetch;
19
26
  //#endregion
20
- export { ArrayElement, DeepMutable, Fetch, Mutable };
27
+ export { ArrayElement, Brand, DeepMutable, Fetch, Mutable };
21
28
  //# sourceMappingURL=utility-types.d.ts.map
@@ -1,2 +1,2 @@
1
- const e=require(`../constants.cjs`);function t(t,n){return n.type===e.TokenType.NATIVE?`${t}:${n.type}`:`${t}:${n.type}:${n.address.toLowerCase()}`}exports.getAssetId=t;
1
+ const e=require(`../constants.cjs`);function t(t,n){return n.type===e.TokenType.NATIVE?`${t}::${n.type}`:`${t}::${n.type}::${n.address.toLowerCase()}`}exports.getAssetId=t;
2
2
  //# sourceMappingURL=asset-id.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"asset-id.cjs","names":["TokenType"],"sources":["../../src/utils/asset-id.ts"],"sourcesContent":["import { TokenType } from '../constants';\nimport type { Asset } from '../types/asset';\nimport type { Caip2ChainId } from '../types/caip';\n\n/**\n * Returns a unique string identifier for an asset on a given chain.\n *\n * Format:\n * - Native assets: `{chainId}:native`\n * - Token assets: `{chainId}:{tokenType}:{lowercaseAddress}`\n */\nexport function getAssetId(chainId: Caip2ChainId, asset: Asset): string {\n if (asset.type === TokenType.NATIVE) {\n return `${chainId}:${asset.type}`;\n }\n\n return `${chainId}:${asset.type}:${asset.address.toLowerCase()}`;\n}\n"],"mappings":"oCAWA,SAAgB,EAAW,EAAuB,EAAsB,CAKtE,OAJI,EAAM,OAASA,EAAAA,UAAU,OACpB,GAAG,EAAQ,GAAG,EAAM,OAGtB,GAAG,EAAQ,GAAG,EAAM,KAAK,GAAG,EAAM,QAAQ,aAAa"}
1
+ {"version":3,"file":"asset-id.cjs","names":["TokenType"],"sources":["../../src/utils/asset-id.ts"],"sourcesContent":["import { TokenType } from '../constants';\nimport type { Asset } from '../types/asset';\nimport type { Caip2ChainId } from '../types/caip';\n\n/**\n * Returns a unique string identifier for an asset on a given chain.\n *\n * Format:\n * - Native assets: `{chainId}::native`\n * - Token assets: `{chainId}::{tokenType}::{lowercaseAddress}`\n */\nexport function getAssetId(chainId: Caip2ChainId, asset: Asset): string {\n if (asset.type === TokenType.NATIVE) {\n return `${chainId}::${asset.type}`;\n }\n\n return `${chainId}::${asset.type}::${asset.address.toLowerCase()}`;\n}\n"],"mappings":"oCAWA,SAAgB,EAAW,EAAuB,EAAsB,CAKtE,OAJI,EAAM,OAASA,EAAAA,UAAU,OACpB,GAAG,EAAQ,IAAI,EAAM,OAGvB,GAAG,EAAQ,IAAI,EAAM,KAAK,IAAI,EAAM,QAAQ,aAAa"}
@@ -1,2 +1,2 @@
1
- import{TokenType as e}from"../constants.js";function t(t,n){return n.type===e.NATIVE?`${t}:${n.type}`:`${t}:${n.type}:${n.address.toLowerCase()}`}export{t as getAssetId};
1
+ import{TokenType as e}from"../constants.js";function t(t,n){return n.type===e.NATIVE?`${t}::${n.type}`:`${t}::${n.type}::${n.address.toLowerCase()}`}export{t as getAssetId};
2
2
  //# sourceMappingURL=asset-id.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"asset-id.js","names":[],"sources":["../../src/utils/asset-id.ts"],"sourcesContent":["import { TokenType } from '../constants';\nimport type { Asset } from '../types/asset';\nimport type { Caip2ChainId } from '../types/caip';\n\n/**\n * Returns a unique string identifier for an asset on a given chain.\n *\n * Format:\n * - Native assets: `{chainId}:native`\n * - Token assets: `{chainId}:{tokenType}:{lowercaseAddress}`\n */\nexport function getAssetId(chainId: Caip2ChainId, asset: Asset): string {\n if (asset.type === TokenType.NATIVE) {\n return `${chainId}:${asset.type}`;\n }\n\n return `${chainId}:${asset.type}:${asset.address.toLowerCase()}`;\n}\n"],"mappings":"4CAWA,SAAgB,EAAW,EAAuB,EAAsB,CAKtE,OAJI,EAAM,OAAS,EAAU,OACpB,GAAG,EAAQ,GAAG,EAAM,OAGtB,GAAG,EAAQ,GAAG,EAAM,KAAK,GAAG,EAAM,QAAQ,aAAa"}
1
+ {"version":3,"file":"asset-id.js","names":[],"sources":["../../src/utils/asset-id.ts"],"sourcesContent":["import { TokenType } from '../constants';\nimport type { Asset } from '../types/asset';\nimport type { Caip2ChainId } from '../types/caip';\n\n/**\n * Returns a unique string identifier for an asset on a given chain.\n *\n * Format:\n * - Native assets: `{chainId}::native`\n * - Token assets: `{chainId}::{tokenType}::{lowercaseAddress}`\n */\nexport function getAssetId(chainId: Caip2ChainId, asset: Asset): string {\n if (asset.type === TokenType.NATIVE) {\n return `${chainId}::${asset.type}`;\n }\n\n return `${chainId}::${asset.type}::${asset.address.toLowerCase()}`;\n}\n"],"mappings":"4CAWA,SAAgB,EAAW,EAAuB,EAAsB,CAKtE,OAJI,EAAM,OAAS,EAAU,OACpB,GAAG,EAAQ,IAAI,EAAM,OAGvB,GAAG,EAAQ,IAAI,EAAM,KAAK,IAAI,EAAM,QAAQ,aAAa"}
@@ -0,0 +1,2 @@
1
+ const e=require(`../constants.cjs`),t=t=>{let n=new Map,r=[];for(let i of t){let t=n.get(i.id);if(!t){n.set(i.id,{...i,bridgeProviders:[...new Set(i.bridgeProviders)]}),r.push(i.id);continue}let a=t.extras!==void 0||i.extras!==void 0?{...t.extras??{},...i.extras??{}}:void 0,o=i.bridgeProviders.includes(e.ServiceType.MARKR)?i:t;n.set(i.id,{...o,bridgeProviders:[...new Set([...t.bridgeProviders,...i.bridgeProviders])],...a===void 0?{}:{extras:a}})}return r.map(e=>n.get(e)).filter(e=>e!==void 0)};exports.dedupeBridgeableAssets=t;
2
+ //# sourceMappingURL=bridgeable-assets.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bridgeable-assets.cjs","names":["ServiceType"],"sources":["../../src/utils/bridgeable-assets.ts"],"sourcesContent":["import { ServiceType } from '../constants';\nimport type { BridgeableUiAsset } from '../types/asset';\n\n/**\n * Deduplicates bridgeable assets by ID while preserving first-seen order.\n *\n * When duplicates are found:\n * - bridgeProviders are merged as a unique set (first-seen order)\n * - extras are shallow merged ({ ...existing.extras, ...incoming.extras })\n * - if the incoming duplicate includes MARKR, MARKR is treated as authoritative\n * for name/symbol/logoUri/address fields\n */\nexport const dedupeBridgeableAssets = (assets: readonly BridgeableUiAsset[]): readonly BridgeableUiAsset[] => {\n const merged = new Map<string, BridgeableUiAsset>();\n const orderedIds: string[] = [];\n\n for (const asset of assets) {\n const existing = merged.get(asset.id);\n\n if (!existing) {\n merged.set(asset.id, {\n ...asset,\n bridgeProviders: [...new Set(asset.bridgeProviders)],\n });\n orderedIds.push(asset.id);\n continue;\n }\n\n const mergedExtras =\n existing.extras !== undefined || asset.extras !== undefined\n ? {\n ...(existing.extras ?? {}),\n ...(asset.extras ?? {}),\n }\n : undefined;\n const incomingFromMarkr = asset.bridgeProviders.includes(ServiceType.MARKR);\n const canonicalAsset = incomingFromMarkr ? asset : existing;\n\n merged.set(asset.id, {\n ...canonicalAsset,\n bridgeProviders: [...new Set([...existing.bridgeProviders, ...asset.bridgeProviders])],\n ...(mergedExtras !== undefined ? { extras: mergedExtras } : {}),\n });\n }\n\n return orderedIds.map((id) => merged.get(id)).filter((asset): asset is BridgeableUiAsset => asset !== undefined);\n};\n"],"mappings":"oCAYa,EAA0B,GAAuE,CAC5G,IAAM,EAAS,IAAI,IACb,EAAuB,EAAE,CAE/B,IAAK,IAAM,KAAS,EAAQ,CAC1B,IAAM,EAAW,EAAO,IAAI,EAAM,GAAG,CAErC,GAAI,CAAC,EAAU,CACb,EAAO,IAAI,EAAM,GAAI,CACnB,GAAG,EACH,gBAAiB,CAAC,GAAG,IAAI,IAAI,EAAM,gBAAgB,CAAC,CACrD,CAAC,CACF,EAAW,KAAK,EAAM,GAAG,CACzB,SAGF,IAAM,EACJ,EAAS,SAAW,IAAA,IAAa,EAAM,SAAW,IAAA,GAC9C,CACE,GAAI,EAAS,QAAU,EAAE,CACzB,GAAI,EAAM,QAAU,EAAE,CACvB,CACD,IAAA,GAEA,EADoB,EAAM,gBAAgB,SAASA,EAAAA,YAAY,MAAM,CAChC,EAAQ,EAEnD,EAAO,IAAI,EAAM,GAAI,CACnB,GAAG,EACH,gBAAiB,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,EAAS,gBAAiB,GAAG,EAAM,gBAAgB,CAAC,CAAC,CACtF,GAAI,IAAiB,IAAA,GAAuC,EAAE,CAA7B,CAAE,OAAQ,EAAc,CAC1D,CAAC,CAGJ,OAAO,EAAW,IAAK,GAAO,EAAO,IAAI,EAAG,CAAC,CAAC,OAAQ,GAAsC,IAAU,IAAA,GAAU"}
@@ -0,0 +1,16 @@
1
+ import { BridgeableUiAsset } from "../types/asset.cjs";
2
+
3
+ //#region src/utils/bridgeable-assets.d.ts
4
+ /**
5
+ * Deduplicates bridgeable assets by ID while preserving first-seen order.
6
+ *
7
+ * When duplicates are found:
8
+ * - bridgeProviders are merged as a unique set (first-seen order)
9
+ * - extras are shallow merged ({ ...existing.extras, ...incoming.extras })
10
+ * - if the incoming duplicate includes MARKR, MARKR is treated as authoritative
11
+ * for name/symbol/logoUri/address fields
12
+ */
13
+ declare const dedupeBridgeableAssets: (assets: readonly BridgeableUiAsset[]) => readonly BridgeableUiAsset[];
14
+ //#endregion
15
+ export { dedupeBridgeableAssets };
16
+ //# sourceMappingURL=bridgeable-assets.d.cts.map
@@ -0,0 +1,16 @@
1
+ import { BridgeableUiAsset } from "../types/asset.js";
2
+
3
+ //#region src/utils/bridgeable-assets.d.ts
4
+ /**
5
+ * Deduplicates bridgeable assets by ID while preserving first-seen order.
6
+ *
7
+ * When duplicates are found:
8
+ * - bridgeProviders are merged as a unique set (first-seen order)
9
+ * - extras are shallow merged ({ ...existing.extras, ...incoming.extras })
10
+ * - if the incoming duplicate includes MARKR, MARKR is treated as authoritative
11
+ * for name/symbol/logoUri/address fields
12
+ */
13
+ declare const dedupeBridgeableAssets: (assets: readonly BridgeableUiAsset[]) => readonly BridgeableUiAsset[];
14
+ //#endregion
15
+ export { dedupeBridgeableAssets };
16
+ //# sourceMappingURL=bridgeable-assets.d.ts.map
@@ -0,0 +1,2 @@
1
+ import{ServiceType as e}from"../constants.js";const t=t=>{let n=new Map,r=[];for(let i of t){let t=n.get(i.id);if(!t){n.set(i.id,{...i,bridgeProviders:[...new Set(i.bridgeProviders)]}),r.push(i.id);continue}let a=t.extras!==void 0||i.extras!==void 0?{...t.extras??{},...i.extras??{}}:void 0,o=i.bridgeProviders.includes(e.MARKR)?i:t;n.set(i.id,{...o,bridgeProviders:[...new Set([...t.bridgeProviders,...i.bridgeProviders])],...a===void 0?{}:{extras:a}})}return r.map(e=>n.get(e)).filter(e=>e!==void 0)};export{t as dedupeBridgeableAssets};
2
+ //# sourceMappingURL=bridgeable-assets.js.map