@circle-fin/app-kit 1.13.0 → 1.15.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.
- package/CHANGELOG.md +122 -0
- package/README.md +3 -3
- package/bridge.cjs +8388 -515
- package/bridge.d.cts +640 -61
- package/bridge.d.mts +640 -61
- package/bridge.d.ts +640 -61
- package/bridge.mjs +8389 -516
- package/chains.cjs +275 -15
- package/chains.d.cts +117 -2
- package/chains.d.mts +117 -2
- package/chains.d.ts +117 -2
- package/chains.mjs +275 -16
- package/context.d.cts +577 -57
- package/context.d.mts +577 -57
- package/context.d.ts +577 -57
- package/earn.cjs +973 -271
- package/earn.d.cts +577 -57
- package/earn.d.mts +577 -57
- package/earn.d.ts +577 -57
- package/earn.mjs +919 -221
- package/estimateBridge.cjs +8388 -518
- package/estimateBridge.d.cts +704 -82
- package/estimateBridge.d.mts +704 -82
- package/estimateBridge.d.ts +704 -82
- package/estimateBridge.mjs +8390 -520
- package/estimateSwap.cjs +982 -237
- package/estimateSwap.d.cts +577 -57
- package/estimateSwap.d.mts +577 -57
- package/estimateSwap.d.ts +577 -57
- package/estimateSwap.mjs +981 -237
- package/index.cjs +21401 -8522
- package/index.d.cts +6045 -2149
- package/index.d.mts +6045 -2149
- package/index.d.ts +6045 -2149
- package/index.mjs +21401 -8524
- package/package.json +17 -6
- package/server.cjs +10040 -0
- package/server.cjs.map +1 -0
- package/server.d.cts +2467 -0
- package/server.d.mts +2467 -0
- package/server.d.ts +2467 -0
- package/server.mjs +10028 -0
- package/server.mjs.map +1 -0
- package/swap.cjs +982 -237
- package/swap.d.cts +577 -57
- package/swap.d.mts +577 -57
- package/swap.d.ts +577 -57
- package/swap.mjs +981 -237
- package/unifiedBalance.cjs +20510 -7599
- package/unifiedBalance.d.cts +807 -201
- package/unifiedBalance.d.mts +807 -201
- package/unifiedBalance.d.ts +807 -201
- package/unifiedBalance.mjs +20513 -7603
package/unifiedBalance.d.cts
CHANGED
|
@@ -166,6 +166,30 @@ interface BaseChainDefinition {
|
|
|
166
166
|
* ```
|
|
167
167
|
*/
|
|
168
168
|
kitContracts?: KitContracts;
|
|
169
|
+
/**
|
|
170
|
+
* Optional CCTPx configuration.
|
|
171
|
+
*
|
|
172
|
+
* @description When provided, the chain supports CCTPx (Cross-Chain Token Service).
|
|
173
|
+
* CCTPx is a service-level protocol layered on top of CCTP v2's message-passing layer
|
|
174
|
+
* that enables cross-chain transfers of registered tokens (Circle-issued or otherwise).
|
|
175
|
+
*
|
|
176
|
+
* The CCTS contract is deployed via CREATE3 so its address is deterministic and may
|
|
177
|
+
* be committed to chain config ahead of the on-chain deployment.
|
|
178
|
+
*
|
|
179
|
+
* Use the {@link isCCTPXSupported} type guard to check if a chain has CCTPx support
|
|
180
|
+
* before accessing this property.
|
|
181
|
+
*
|
|
182
|
+
* @example
|
|
183
|
+
* ```typescript
|
|
184
|
+
* if (isCCTPXSupported(chain)) {
|
|
185
|
+
* console.log('CCTS address:', chain.cctpx.serviceAddress)
|
|
186
|
+
* }
|
|
187
|
+
* ```
|
|
188
|
+
*
|
|
189
|
+
* @see {@link CCTPXChainConfig} for the structure of CCTPx configuration.
|
|
190
|
+
* @see {@link isCCTPXSupported} for checking CCTPx support.
|
|
191
|
+
*/
|
|
192
|
+
cctpx?: CCTPXChainConfig;
|
|
169
193
|
/**
|
|
170
194
|
* Optional Gateway contract configuration for Gateway protocol support.
|
|
171
195
|
*
|
|
@@ -485,6 +509,34 @@ interface CCTPConfig {
|
|
|
485
509
|
destination: boolean;
|
|
486
510
|
};
|
|
487
511
|
}
|
|
512
|
+
/**
|
|
513
|
+
* Configuration for Circle's Cross-Chain Token Service (CCTS) — the CCTPx protocol.
|
|
514
|
+
*
|
|
515
|
+
* @category Types
|
|
516
|
+
*
|
|
517
|
+
* @description Contains the CCTS proxy contract address on a given chain. The CCTS
|
|
518
|
+
* contract is the service-level entry point for CCTPx cross-chain transfers of
|
|
519
|
+
* registered tokens (Circle-issued or otherwise). Addresses are deterministic via CREATE3
|
|
520
|
+
* and may be committed to chain config ahead of the on-chain deploy.
|
|
521
|
+
*
|
|
522
|
+
* @example
|
|
523
|
+
* ```typescript
|
|
524
|
+
* const cctpxConfig: CCTPXChainConfig = {
|
|
525
|
+
* serviceAddress: '0x1234567890abcdef1234567890abcdef12345678'
|
|
526
|
+
* }
|
|
527
|
+
* ```
|
|
528
|
+
*/
|
|
529
|
+
interface CCTPXChainConfig {
|
|
530
|
+
/**
|
|
531
|
+
* The CrossChainTokenService (CCTS) proxy contract address on this chain.
|
|
532
|
+
*
|
|
533
|
+
* @description Deterministic CREATE3 address. Used by the SDK as the `to` field
|
|
534
|
+
* when calling `crossChainTransfer` and `resolveTokenManager`.
|
|
535
|
+
*
|
|
536
|
+
* @example "0x1234567890abcdef1234567890abcdef12345678"
|
|
537
|
+
*/
|
|
538
|
+
serviceAddress: string;
|
|
539
|
+
}
|
|
488
540
|
/**
|
|
489
541
|
* Available kit contract types for enhanced chain functionality.
|
|
490
542
|
*
|
|
@@ -558,6 +610,19 @@ interface GatewayV1Contracts {
|
|
|
558
610
|
* @example "0xD05E7D2E7d30b92c5F17d7d0fC575fce231F1A48"
|
|
559
611
|
*/
|
|
560
612
|
depositForHandler?: string;
|
|
613
|
+
/**
|
|
614
|
+
* The address of the `GenericExecutor` contract.
|
|
615
|
+
*
|
|
616
|
+
* @description Optional. The contract that acts as `mintRecipient` and
|
|
617
|
+
* `destinationCaller` for the CCTP v2 prepaid FORWARD path. It receives the
|
|
618
|
+
* CCTP mint and calls {@link GatewayV1Contracts.depositForHandler} to
|
|
619
|
+
* complete the fast deposit into the {@link GatewayV1Contracts.wallet}.
|
|
620
|
+
* Present only on chains that are fast-deposit destinations; other Gateway
|
|
621
|
+
* chains omit it.
|
|
622
|
+
*
|
|
623
|
+
* @example "0xFa7be2f04F3Ad4ca969260729c6d45B5625984A7"
|
|
624
|
+
*/
|
|
625
|
+
genericExecutor?: string;
|
|
561
626
|
}
|
|
562
627
|
/**
|
|
563
628
|
* Versioned map of Gateway contract configurations.
|
|
@@ -678,9 +743,10 @@ declare enum Blockchain {
|
|
|
678
743
|
Algorand_Testnet = "Algorand_Testnet",
|
|
679
744
|
Aptos = "Aptos",
|
|
680
745
|
Aptos_Testnet = "Aptos_Testnet",
|
|
681
|
-
Arc_Testnet = "Arc_Testnet",
|
|
682
746
|
Arbitrum = "Arbitrum",
|
|
683
747
|
Arbitrum_Sepolia = "Arbitrum_Sepolia",
|
|
748
|
+
Arc = "Arc",
|
|
749
|
+
Arc_Testnet = "Arc_Testnet",
|
|
684
750
|
Avalanche = "Avalanche",
|
|
685
751
|
Avalanche_Fuji = "Avalanche_Fuji",
|
|
686
752
|
Base = "Base",
|
|
@@ -746,6 +812,135 @@ declare enum Blockchain {
|
|
|
746
812
|
ZKSync_Era = "ZKSync_Era",
|
|
747
813
|
ZKSync_Sepolia = "ZKSync_Sepolia"
|
|
748
814
|
}
|
|
815
|
+
/**
|
|
816
|
+
* Enumeration of blockchains that support cross-chain bridging via CCTPv2.
|
|
817
|
+
*
|
|
818
|
+
* The enum is derived from the full {@link Blockchain} enum but filtered to only
|
|
819
|
+
* include chains with active CCTPv2 support. When new chains gain CCTPv2 support,
|
|
820
|
+
* they are added to this enum.
|
|
821
|
+
*
|
|
822
|
+
* @enum
|
|
823
|
+
* @category Enums
|
|
824
|
+
*
|
|
825
|
+
* @remarks
|
|
826
|
+
* - This enum is the **canonical source** of bridging-supported chains.
|
|
827
|
+
* - Use this enum (or its string literals) in `kit.bridge()` calls for type safety.
|
|
828
|
+
* - Attempting to use a chain not in this enum will produce a TypeScript compile error.
|
|
829
|
+
*
|
|
830
|
+
* @example
|
|
831
|
+
* ```typescript
|
|
832
|
+
* import { BridgeKit, BridgeChain } from '@circle-fin/bridge-kit'
|
|
833
|
+
*
|
|
834
|
+
* const kit = new BridgeKit()
|
|
835
|
+
*
|
|
836
|
+
* // ✅ Valid - autocomplete suggests only supported chains
|
|
837
|
+
* await kit.bridge({
|
|
838
|
+
* from: { adapter, chain: BridgeChain.Ethereum },
|
|
839
|
+
* to: { adapter, chain: BridgeChain.Base },
|
|
840
|
+
* amount: '100'
|
|
841
|
+
* })
|
|
842
|
+
*
|
|
843
|
+
* // ✅ Also valid - string literals work with autocomplete
|
|
844
|
+
* await kit.bridge({
|
|
845
|
+
* from: { adapter, chain: 'Ethereum_Sepolia' },
|
|
846
|
+
* to: { adapter, chain: 'Base_Sepolia' },
|
|
847
|
+
* amount: '100'
|
|
848
|
+
* })
|
|
849
|
+
*
|
|
850
|
+
* // ❌ Compile error - Algorand is not in BridgeChain
|
|
851
|
+
* await kit.bridge({
|
|
852
|
+
* from: { adapter, chain: 'Algorand' }, // TypeScript error!
|
|
853
|
+
* to: { adapter, chain: 'Base' },
|
|
854
|
+
* amount: '100'
|
|
855
|
+
* })
|
|
856
|
+
* ```
|
|
857
|
+
*
|
|
858
|
+
* @see {@link Blockchain} for the complete list of all known blockchains.
|
|
859
|
+
* @see {@link BridgeChainIdentifier} for the type that accepts these values.
|
|
860
|
+
*/
|
|
861
|
+
declare enum BridgeChain {
|
|
862
|
+
Arbitrum = "Arbitrum",
|
|
863
|
+
Arc = "Arc",
|
|
864
|
+
Avalanche = "Avalanche",
|
|
865
|
+
Base = "Base",
|
|
866
|
+
Codex = "Codex",
|
|
867
|
+
Cronos = "Cronos",
|
|
868
|
+
Edge = "Edge",
|
|
869
|
+
Ethereum = "Ethereum",
|
|
870
|
+
HyperEVM = "HyperEVM",
|
|
871
|
+
Injective = "Injective",
|
|
872
|
+
Ink = "Ink",
|
|
873
|
+
Linea = "Linea",
|
|
874
|
+
Monad = "Monad",
|
|
875
|
+
Morph = "Morph",
|
|
876
|
+
Optimism = "Optimism",
|
|
877
|
+
Pharos = "Pharos",
|
|
878
|
+
Plasma = "Plasma",
|
|
879
|
+
Plume = "Plume",
|
|
880
|
+
Polygon = "Polygon",
|
|
881
|
+
Sei = "Sei",
|
|
882
|
+
Solana = "Solana",
|
|
883
|
+
Sonic = "Sonic",
|
|
884
|
+
Unichain = "Unichain",
|
|
885
|
+
World_Chain = "World_Chain",
|
|
886
|
+
XDC = "XDC",
|
|
887
|
+
X_Layer = "X_Layer",
|
|
888
|
+
Arc_Testnet = "Arc_Testnet",
|
|
889
|
+
Arbitrum_Sepolia = "Arbitrum_Sepolia",
|
|
890
|
+
Avalanche_Fuji = "Avalanche_Fuji",
|
|
891
|
+
Base_Sepolia = "Base_Sepolia",
|
|
892
|
+
Codex_Testnet = "Codex_Testnet",
|
|
893
|
+
Cronos_Testnet = "Cronos_Testnet",
|
|
894
|
+
Edge_Testnet = "Edge_Testnet",
|
|
895
|
+
Ethereum_Sepolia = "Ethereum_Sepolia",
|
|
896
|
+
HyperEVM_Testnet = "HyperEVM_Testnet",
|
|
897
|
+
Injective_Testnet = "Injective_Testnet",
|
|
898
|
+
Ink_Testnet = "Ink_Testnet",
|
|
899
|
+
Linea_Sepolia = "Linea_Sepolia",
|
|
900
|
+
Monad_Testnet = "Monad_Testnet",
|
|
901
|
+
Morph_Testnet = "Morph_Testnet",
|
|
902
|
+
Optimism_Sepolia = "Optimism_Sepolia",
|
|
903
|
+
Pharos_Testnet = "Pharos_Testnet",
|
|
904
|
+
Plasma_Testnet = "Plasma_Testnet",
|
|
905
|
+
Plume_Testnet = "Plume_Testnet",
|
|
906
|
+
Polygon_Amoy_Testnet = "Polygon_Amoy_Testnet",
|
|
907
|
+
Sei_Testnet = "Sei_Testnet",
|
|
908
|
+
Solana_Devnet = "Solana_Devnet",
|
|
909
|
+
Sonic_Testnet = "Sonic_Testnet",
|
|
910
|
+
Unichain_Sepolia = "Unichain_Sepolia",
|
|
911
|
+
World_Chain_Sepolia = "World_Chain_Sepolia",
|
|
912
|
+
XDC_Apothem = "XDC_Apothem",
|
|
913
|
+
X_Layer_Testnet = "X_Layer_Testnet"
|
|
914
|
+
}
|
|
915
|
+
/**
|
|
916
|
+
* Type representing valid bridge chain identifiers.
|
|
917
|
+
*
|
|
918
|
+
* This type constrains chain parameters to only accept chains that support CCTPv2 bridging
|
|
919
|
+
*
|
|
920
|
+
* Accepts:
|
|
921
|
+
* - A {@link BridgeChain} enum value (e.g., `BridgeChain.Ethereum`)
|
|
922
|
+
* - A string literal matching a BridgeChain value (e.g., `'Ethereum'`)
|
|
923
|
+
* - A {@link ChainDefinition} object for a supported chain
|
|
924
|
+
*
|
|
925
|
+
* @example
|
|
926
|
+
* ```typescript
|
|
927
|
+
* import type { BridgeChainIdentifier } from '@circle-fin/bridge-kit'
|
|
928
|
+
* import { BridgeChain } from '@circle-fin/bridge-kit'
|
|
929
|
+
* import { Solana } from '@circle-fin/bridge-kit/chains'
|
|
930
|
+
*
|
|
931
|
+
* // All of these are valid BridgeChainIdentifier values:
|
|
932
|
+
* const chain1: BridgeChainIdentifier = BridgeChain.Ethereum
|
|
933
|
+
* const chain2: BridgeChainIdentifier = 'Base_Sepolia'
|
|
934
|
+
* const chain3: BridgeChainIdentifier = Solana // ChainDefinition
|
|
935
|
+
*
|
|
936
|
+
* // This will cause a TypeScript error:
|
|
937
|
+
* const chain4: BridgeChainIdentifier = 'Algorand' // Error!
|
|
938
|
+
* ```
|
|
939
|
+
*
|
|
940
|
+
* @see {@link BridgeChain} for the enum of supported chains.
|
|
941
|
+
* @see {@link ChainIdentifier} for the less restrictive type accepting all chains.
|
|
942
|
+
*/
|
|
943
|
+
type BridgeChainIdentifier = ChainDefinition | BridgeChain | `${BridgeChain}`;
|
|
749
944
|
/**
|
|
750
945
|
* Enumeration of blockchains that support Gateway V1 operations
|
|
751
946
|
* (deposit, spend, balance, delegate, removeFund).
|
|
@@ -766,6 +961,7 @@ declare enum Blockchain {
|
|
|
766
961
|
* @see {@link UnifiedBalanceChainIdentifier} for the type that accepts these values.
|
|
767
962
|
*/
|
|
768
963
|
declare enum UnifiedBalanceChain {
|
|
964
|
+
Arc = "Arc",
|
|
769
965
|
Arbitrum = "Arbitrum",
|
|
770
966
|
Avalanche = "Avalanche",
|
|
771
967
|
Base = "Base",
|
|
@@ -1990,6 +2186,171 @@ interface CCTPActionMap {
|
|
|
1990
2186
|
readonly v2: CCTPv2ActionMap;
|
|
1991
2187
|
}
|
|
1992
2188
|
|
|
2189
|
+
/**
|
|
2190
|
+
* Action map for Circle's CCTPx protocol operations.
|
|
2191
|
+
*
|
|
2192
|
+
* Define the parameter schemas for CCTPx actions that enable cross-chain transfers
|
|
2193
|
+
* of registered tokens (Circle-issued or otherwise) through Circle's `CrossChainTokenService`
|
|
2194
|
+
* (CCTS) contract.
|
|
2195
|
+
*
|
|
2196
|
+
* @remarks
|
|
2197
|
+
* CCTPx is a service-level protocol layered on top of CCTP v2's message-passing layer.
|
|
2198
|
+
* The CCTS contract coordinates token locking/burning, fee collection, and cross-chain
|
|
2199
|
+
* message dispatch. The SDK obtains a signed fee quote from IRIS, then calls
|
|
2200
|
+
* `crossChainTransfer` on CCTS with the quote bytes verbatim and the native fee as
|
|
2201
|
+
* `msg.value`. The auto-relay flow handled by Circle's Orbit relayer (paid for via the
|
|
2202
|
+
* `FORWARD` fee component included in the signed quote) means no separate
|
|
2203
|
+
* `receiveMessage` step is required on the destination.
|
|
2204
|
+
*
|
|
2205
|
+
* USDC and EURC bridging continues to use CCTP v2 (`cctp.v2.*`) actions, not CCTPx.
|
|
2206
|
+
*
|
|
2207
|
+
* @example
|
|
2208
|
+
* ```typescript
|
|
2209
|
+
* import type { ActionPayload } from '@core/adapter'
|
|
2210
|
+
*
|
|
2211
|
+
* const transferParams: ActionPayload<'cctpx.crossChainTransfer'> = {
|
|
2212
|
+
* tokenId: '0xabc123...',
|
|
2213
|
+
* amount: 1_000_000n,
|
|
2214
|
+
* destinationDomain: 1,
|
|
2215
|
+
* destinationAddress: '0xRecipient',
|
|
2216
|
+
* destinationCaller: '0x0000000000000000000000000000000000000000000000000000000000000000',
|
|
2217
|
+
* minFinalityThreshold: 1000,
|
|
2218
|
+
* claim: { signedQuote: '0xdeadbeef...', refundAddress: '0xSenderEOA...' },
|
|
2219
|
+
* autoExecuteHookData: false,
|
|
2220
|
+
* hookData: '0x',
|
|
2221
|
+
* serviceAddress: '0xCCTSProxy...',
|
|
2222
|
+
* nativeFeeAmount: 100_000n,
|
|
2223
|
+
* fromChain,
|
|
2224
|
+
* }
|
|
2225
|
+
* ```
|
|
2226
|
+
*/
|
|
2227
|
+
interface CCTPXActionMap {
|
|
2228
|
+
/**
|
|
2229
|
+
* Initiate a CCTPx cross-chain transfer through the `CrossChainTokenService` contract.
|
|
2230
|
+
*
|
|
2231
|
+
* Encode and submit a `crossChainTransfer(...)` call to the CCTS proxy on the source
|
|
2232
|
+
* chain, passing the IRIS-signed fee quote bytes verbatim and the native fee as
|
|
2233
|
+
* `msg.value`. The contract emits CCTP v2's `MessageSent` event, which IRIS attests
|
|
2234
|
+
* to before Circle's Orbit relayer auto-executes the destination mint.
|
|
2235
|
+
*
|
|
2236
|
+
* @remarks
|
|
2237
|
+
* The caller (typically `CCTPXBridgingProvider`) is responsible for:
|
|
2238
|
+
* - Resolving `tokenId` and the per-chain `tokenAddress` from the IRIS token registry
|
|
2239
|
+
* - Approving the per-token `TokenManager` for `amount` before this call
|
|
2240
|
+
* - Fetching `claim.signedQuote` and computing `nativeFeeAmount` from IRIS
|
|
2241
|
+
*
|
|
2242
|
+
* This action only encodes and submits the on-chain call; it does not perform any
|
|
2243
|
+
* off-chain orchestration.
|
|
2244
|
+
*/
|
|
2245
|
+
crossChainTransfer: ActionParameters & {
|
|
2246
|
+
/**
|
|
2247
|
+
* The CCTPx tokenId for the asset being transferred.
|
|
2248
|
+
*
|
|
2249
|
+
* Provided as a 32-byte hex string assigned by CCTPx at registration time.
|
|
2250
|
+
* The same `tokenId` is used across all chains for a given token; per-chain
|
|
2251
|
+
* `tokenAddress` is resolved from the IRIS token registry separately.
|
|
2252
|
+
*/
|
|
2253
|
+
tokenId: string;
|
|
2254
|
+
/**
|
|
2255
|
+
* Amount of the token to transfer, in the token's smallest units.
|
|
2256
|
+
*/
|
|
2257
|
+
amount: bigint;
|
|
2258
|
+
/**
|
|
2259
|
+
* CCTP domain identifier of the destination chain.
|
|
2260
|
+
*
|
|
2261
|
+
* CCTPx reuses CCTP v2 domain numbering; pass `dstChain.cctp.domain`.
|
|
2262
|
+
*/
|
|
2263
|
+
destinationDomain: number;
|
|
2264
|
+
/**
|
|
2265
|
+
* Recipient address on the destination chain, encoded as bytes.
|
|
2266
|
+
*
|
|
2267
|
+
* For EVM destinations this is a 20-byte address encoded as a hex string.
|
|
2268
|
+
*/
|
|
2269
|
+
destinationAddress: string;
|
|
2270
|
+
/**
|
|
2271
|
+
* `bytes32` value restricting which address may execute on the destination.
|
|
2272
|
+
*
|
|
2273
|
+
* Omit (or pass the 32-byte zero hash) to allow permissionless relay — the
|
|
2274
|
+
* default for auto-relayed CCTPx transfers. When omitted, the handler
|
|
2275
|
+
* substitutes the zero hash.
|
|
2276
|
+
*
|
|
2277
|
+
* @defaultValue `ZERO_HASH` — permissionless relay
|
|
2278
|
+
*/
|
|
2279
|
+
destinationCaller?: string;
|
|
2280
|
+
/**
|
|
2281
|
+
* Minimum finality threshold for attestation eligibility.
|
|
2282
|
+
*
|
|
2283
|
+
* Use `1000` for FAST transfers (pre-finality) or `2000` for SLOW transfers
|
|
2284
|
+
* (full finality). For FAST, the `claim.signedQuote` must include a
|
|
2285
|
+
* `PRE_FINALITY` item; otherwise the on-chain call reverts.
|
|
2286
|
+
*/
|
|
2287
|
+
minFinalityThreshold: number;
|
|
2288
|
+
/**
|
|
2289
|
+
* The CCTS fee-quote claim — maps 1:1 to the on-chain
|
|
2290
|
+
* `IFeeManager.QuoteClaim` tuple.
|
|
2291
|
+
*
|
|
2292
|
+
* The contract requires a tuple here, not a flat bytes blob. Encoding the
|
|
2293
|
+
* signed quote without the tuple wrapper produces a different function
|
|
2294
|
+
* selector and the call will revert.
|
|
2295
|
+
*/
|
|
2296
|
+
claim: {
|
|
2297
|
+
/**
|
|
2298
|
+
* IRIS-signed fee quote bytes, passed verbatim to the contract.
|
|
2299
|
+
*
|
|
2300
|
+
* Obtained from `POST /v1/quote/cctpx/{tokenId}/{src}/{dst}`. Contains the
|
|
2301
|
+
* version-prefixed ABI-encoded `Quote` struct and Circle's signature; the
|
|
2302
|
+
* `FeeManager` contract validates the signature against the quote items.
|
|
2303
|
+
*/
|
|
2304
|
+
signedQuote: string;
|
|
2305
|
+
/**
|
|
2306
|
+
* Address that receives any native-fee refund from `FeeManager`.
|
|
2307
|
+
*
|
|
2308
|
+
* Forwarded verbatim to `FeeManager` for refund attribution. The contract
|
|
2309
|
+
* accepts `address(0)` (the zero address) to disable refunds, so omitting
|
|
2310
|
+
* this field is safe; the handler will substitute the zero address.
|
|
2311
|
+
*
|
|
2312
|
+
* @defaultValue `ZERO_ADDRESS` — refunds disabled
|
|
2313
|
+
*/
|
|
2314
|
+
refundAddress?: string;
|
|
2315
|
+
};
|
|
2316
|
+
/**
|
|
2317
|
+
* Whether the destination chain should auto-execute the hook data.
|
|
2318
|
+
*
|
|
2319
|
+
* For basic transfers this is `false`. Reserved for advanced integrations
|
|
2320
|
+
* that bundle a post-mint hook on the destination.
|
|
2321
|
+
*/
|
|
2322
|
+
autoExecuteHookData: boolean;
|
|
2323
|
+
/**
|
|
2324
|
+
* Optional hook data bytes passed through to the destination handler.
|
|
2325
|
+
*
|
|
2326
|
+
* Pass `'0x'` (empty bytes) for basic transfers.
|
|
2327
|
+
*/
|
|
2328
|
+
hookData: string;
|
|
2329
|
+
/**
|
|
2330
|
+
* The `CrossChainTokenService` proxy address on the source chain.
|
|
2331
|
+
*
|
|
2332
|
+
* Used as the transaction `to` field. Typically sourced from
|
|
2333
|
+
* `srcChain.cctpx.serviceAddress` — but is passed as an explicit parameter
|
|
2334
|
+
* so the action does not depend on chain-config narrowing at the call site.
|
|
2335
|
+
*/
|
|
2336
|
+
serviceAddress: string;
|
|
2337
|
+
/**
|
|
2338
|
+
* Native gas amount to send as `msg.value`.
|
|
2339
|
+
*
|
|
2340
|
+
* Must exactly equal `sum(quote.items[].amount)` when `feeToken` is the
|
|
2341
|
+
* native currency (the P0 default). The contract verifies the value against
|
|
2342
|
+
* the signed quote; do not over-send.
|
|
2343
|
+
*/
|
|
2344
|
+
nativeFeeAmount: bigint;
|
|
2345
|
+
/**
|
|
2346
|
+
* Source chain definition.
|
|
2347
|
+
*
|
|
2348
|
+
* Provides the adapter with chain context (chainId, RPC, etc.) for the call.
|
|
2349
|
+
*/
|
|
2350
|
+
fromChain: ChainDefinition;
|
|
2351
|
+
};
|
|
2352
|
+
}
|
|
2353
|
+
|
|
1993
2354
|
/**
|
|
1994
2355
|
* Permit signature standards for gasless token approvals.
|
|
1995
2356
|
*
|
|
@@ -3085,6 +3446,8 @@ interface NativeActionMap {
|
|
|
3085
3446
|
interface ActionMap {
|
|
3086
3447
|
/** CCTP-specific operations with automatic address resolution. */
|
|
3087
3448
|
readonly cctp: CCTPActionMap;
|
|
3449
|
+
/** CCTPx operations (CrossChainTokenService) for cross-chain transfers of registered tokens (Circle-issued or otherwise). */
|
|
3450
|
+
readonly cctpx: CCTPXActionMap;
|
|
3088
3451
|
/** Gateway Wallet operations, versioned (e.g. gateway.v1.deposit). */
|
|
3089
3452
|
readonly gateway: GatewayActionMap;
|
|
3090
3453
|
/** Native token operations (ETH, SOL, MATIC, etc.). */
|
|
@@ -4408,63 +4771,140 @@ interface DepositResult$1 {
|
|
|
4408
4771
|
}
|
|
4409
4772
|
|
|
4410
4773
|
/**
|
|
4411
|
-
*
|
|
4774
|
+
* Fee category describing the origin of a fee line item.
|
|
4412
4775
|
*
|
|
4413
|
-
*
|
|
4414
|
-
*
|
|
4415
|
-
*
|
|
4776
|
+
* - `'provider'` — Fee charged by the cross-chain provider (e.g. protocol fee).
|
|
4777
|
+
* - `'gasFee'` — On-chain gas cost denominated in the transfer token (e.g. USDC).
|
|
4778
|
+
* - `'kit'` — Fee charged by the kit / developer integration.
|
|
4779
|
+
* - `'forwarder'` — Fee charged by Circle's Forwarding Service for automatic mint.
|
|
4780
|
+
*/
|
|
4781
|
+
type FeeType = 'provider' | 'gasFee' | 'kit' | 'forwarder';
|
|
4782
|
+
/**
|
|
4783
|
+
* Per-chain breakdown of a fee amount.
|
|
4416
4784
|
*
|
|
4417
4785
|
* @example
|
|
4418
4786
|
* ```typescript
|
|
4419
|
-
* import type {
|
|
4787
|
+
* import type { FeeAllocation } from '@core/types'
|
|
4788
|
+
* import { Blockchain } from '@core/chains'
|
|
4420
4789
|
*
|
|
4421
|
-
* const
|
|
4422
|
-
*
|
|
4423
|
-
*
|
|
4424
|
-
* txHash: '0xabc…',
|
|
4425
|
-
* explorerUrl: 'https://basescan.org/tx/0xabc…',
|
|
4790
|
+
* const allocation: FeeAllocation = {
|
|
4791
|
+
* chain: Blockchain.Ethereum,
|
|
4792
|
+
* amount: '0.00005',
|
|
4426
4793
|
* }
|
|
4427
4794
|
* ```
|
|
4428
4795
|
*/
|
|
4429
|
-
interface
|
|
4430
|
-
/**
|
|
4431
|
-
|
|
4432
|
-
/** The
|
|
4433
|
-
|
|
4434
|
-
/** Optional transaction hash for this step (if applicable). */
|
|
4435
|
-
txHash?: string;
|
|
4436
|
-
/** Optional explorer URL for viewing this transaction on a block explorer. */
|
|
4437
|
-
explorerUrl?: string;
|
|
4438
|
-
/** Optional data for the step. */
|
|
4439
|
-
data?: unknown;
|
|
4440
|
-
/** Optional human-readable error message. */
|
|
4441
|
-
errorMessage?: string;
|
|
4442
|
-
/** Optional raw error object. */
|
|
4443
|
-
error?: unknown;
|
|
4796
|
+
interface FeeAllocation {
|
|
4797
|
+
/** The chain to which this portion of the fee applies. */
|
|
4798
|
+
chain: Blockchain;
|
|
4799
|
+
/** The fee amount on this chain (human-readable decimal string). */
|
|
4800
|
+
amount: string;
|
|
4444
4801
|
}
|
|
4445
4802
|
/**
|
|
4446
|
-
*
|
|
4803
|
+
* A single fee line item within an estimate.
|
|
4447
4804
|
*
|
|
4448
4805
|
* @remarks
|
|
4449
|
-
*
|
|
4450
|
-
*
|
|
4451
|
-
*
|
|
4452
|
-
*
|
|
4453
|
-
* @typeParam TAdapterCapabilities - Adapter capability constraints.
|
|
4454
|
-
* @typeParam TChainIdentifier - Accepted chain identifier type.
|
|
4806
|
+
* Each entry describes a fee category (`type`), the token it is
|
|
4807
|
+
* denominated in, the aggregate `amount`, and an optional per-chain
|
|
4808
|
+
* `allocations` breakdown.
|
|
4455
4809
|
*
|
|
4456
4810
|
* @example
|
|
4457
4811
|
* ```typescript
|
|
4458
|
-
* import type {
|
|
4812
|
+
* import type { FeeEntry } from '@core/types'
|
|
4813
|
+
* import { Blockchain } from '@core/chains'
|
|
4459
4814
|
*
|
|
4460
|
-
*
|
|
4461
|
-
*
|
|
4462
|
-
*
|
|
4463
|
-
*
|
|
4815
|
+
* // Fee with per-chain allocation breakdown
|
|
4816
|
+
* const providerFee: FeeEntry = {
|
|
4817
|
+
* type: 'provider',
|
|
4818
|
+
* token: 'USDC',
|
|
4819
|
+
* amount: '0.00011',
|
|
4820
|
+
* allocations: [
|
|
4821
|
+
* { chain: Blockchain.Ethereum, amount: '0.00005' },
|
|
4822
|
+
* { chain: Blockchain.Polygon, amount: '0.00006' },
|
|
4823
|
+
* ],
|
|
4464
4824
|
* }
|
|
4465
|
-
*
|
|
4466
|
-
|
|
4467
|
-
|
|
4825
|
+
*
|
|
4826
|
+
* // Flat fee without allocations (e.g. forwarder)
|
|
4827
|
+
* const forwarderFee: FeeEntry = {
|
|
4828
|
+
* type: 'forwarder',
|
|
4829
|
+
* token: 'USDC',
|
|
4830
|
+
* amount: '0.005',
|
|
4831
|
+
* }
|
|
4832
|
+
* ```
|
|
4833
|
+
*/
|
|
4834
|
+
interface FeeEntry {
|
|
4835
|
+
/** The category of this fee. */
|
|
4836
|
+
type: FeeType;
|
|
4837
|
+
/** The token in which this fee is denominated (e.g. `'USDC'`, `'ETH'`). */
|
|
4838
|
+
token: string;
|
|
4839
|
+
/** Aggregate fee amount (human-readable decimal string). */
|
|
4840
|
+
amount: string;
|
|
4841
|
+
/** Per-chain breakdown of the fee. Omitted for flat fees (e.g. forwarder). */
|
|
4842
|
+
allocations?: FeeAllocation[];
|
|
4843
|
+
/**
|
|
4844
|
+
* When `type === 'kit'`, the address that receives the kit fee.
|
|
4845
|
+
* Omitted for other fee types.
|
|
4846
|
+
*/
|
|
4847
|
+
recipientAddress?: string;
|
|
4848
|
+
}
|
|
4849
|
+
|
|
4850
|
+
/**
|
|
4851
|
+
* Data payload for a single step in a spend operation.
|
|
4852
|
+
*
|
|
4853
|
+
* @remarks
|
|
4854
|
+
* Each spend step carries its current state, optional transaction details,
|
|
4855
|
+
* and error information when the step fails.
|
|
4856
|
+
*
|
|
4857
|
+
* @example
|
|
4858
|
+
* ```typescript
|
|
4859
|
+
* import type { SpendStep } from '@circle-fin/provider-gateway-v1'
|
|
4860
|
+
*
|
|
4861
|
+
* const step: SpendStep = {
|
|
4862
|
+
* name: 'mint',
|
|
4863
|
+
* state: 'success',
|
|
4864
|
+
* txHash: '0xabc…',
|
|
4865
|
+
* explorerUrl: 'https://basescan.org/tx/0xabc…',
|
|
4866
|
+
* }
|
|
4867
|
+
* ```
|
|
4868
|
+
*/
|
|
4869
|
+
interface SpendStep {
|
|
4870
|
+
/** Human-readable name of the step (e.g., "buildBurnIntents", "mint"). */
|
|
4871
|
+
name: string;
|
|
4872
|
+
/** The state of the step. */
|
|
4873
|
+
state: 'pending' | 'success' | 'error';
|
|
4874
|
+
/** Optional transaction hash for this step (if applicable). */
|
|
4875
|
+
txHash?: string;
|
|
4876
|
+
/** Optional explorer URL for viewing this transaction on a block explorer. */
|
|
4877
|
+
explorerUrl?: string;
|
|
4878
|
+
/** Optional data for the step. */
|
|
4879
|
+
data?: unknown;
|
|
4880
|
+
/** Optional human-readable error message. */
|
|
4881
|
+
errorMessage?: string;
|
|
4882
|
+
/** Optional raw error object. */
|
|
4883
|
+
error?: unknown;
|
|
4884
|
+
}
|
|
4885
|
+
/**
|
|
4886
|
+
* Destination for a Gateway spend (mint) operation.
|
|
4887
|
+
*
|
|
4888
|
+
* @remarks
|
|
4889
|
+
* Omitting `recipientAddress` causes funds to be minted to the
|
|
4890
|
+
* address resolved from the adapter. Providing it overrides the
|
|
4891
|
+
* default destination.
|
|
4892
|
+
*
|
|
4893
|
+
* @typeParam TAdapterCapabilities - Adapter capability constraints.
|
|
4894
|
+
* @typeParam TChainIdentifier - Accepted chain identifier type.
|
|
4895
|
+
*
|
|
4896
|
+
* @example
|
|
4897
|
+
* ```typescript
|
|
4898
|
+
* import type { SpendDestination } from '@circle-fin/provider-gateway-v1'
|
|
4899
|
+
*
|
|
4900
|
+
* const destination: SpendDestination = {
|
|
4901
|
+
* adapter: avalancheAdapter,
|
|
4902
|
+
* chain: 'Avalanche',
|
|
4903
|
+
* recipientAddress: '0xDEST…abcd',
|
|
4904
|
+
* }
|
|
4905
|
+
* ```
|
|
4906
|
+
*/
|
|
4907
|
+
type SpendDestination$1<TAdapterCapabilities extends AdapterCapabilities = AdapterCapabilities, TChainIdentifier extends UnifiedBalanceChainIdentifier = UnifiedBalanceChainIdentifier> = {
|
|
4468
4908
|
/** The adapter for executing on-chain calls. */
|
|
4469
4909
|
adapter: Adapter<TAdapterCapabilities>;
|
|
4470
4910
|
/** The destination chain. */
|
|
@@ -4766,7 +5206,7 @@ interface SpendResult$1 {
|
|
|
4766
5206
|
* executed spend. Same shape as {@link EstimateSpendResult.fees}.
|
|
4767
5207
|
* Omitted when using `config.retry` (no estimate was run).
|
|
4768
5208
|
*/
|
|
4769
|
-
fees?: FeeEntry
|
|
5209
|
+
fees?: FeeEntry[];
|
|
4770
5210
|
/**
|
|
4771
5211
|
* Gateway transfer identifier. Present when `useForwarder` is enabled
|
|
4772
5212
|
* and can be used to query transfer status via `GET /v1/transfer/{id}`.
|
|
@@ -4788,80 +5228,6 @@ interface SpendResult$1 {
|
|
|
4788
5228
|
*/
|
|
4789
5229
|
steps?: SpendStep[];
|
|
4790
5230
|
}
|
|
4791
|
-
/**
|
|
4792
|
-
* Fee category describing the origin of a fee line item.
|
|
4793
|
-
*
|
|
4794
|
-
* - `'provider'` — Fee charged by the cross-chain provider (e.g. protocol fee).
|
|
4795
|
-
* - `'gasFee'` — On-chain gas cost denominated in the transfer token (e.g. USDC).
|
|
4796
|
-
* - `'kit'` — Fee charged by the kit / developer integration.
|
|
4797
|
-
* - `'forwarder'` — Fee charged by Circle's Forwarding Service for automatic mint.
|
|
4798
|
-
*/
|
|
4799
|
-
type FeeType$1 = 'provider' | 'gasFee' | 'kit' | 'forwarder';
|
|
4800
|
-
/**
|
|
4801
|
-
* Per-chain breakdown of a fee amount.
|
|
4802
|
-
*
|
|
4803
|
-
* @example
|
|
4804
|
-
* ```typescript
|
|
4805
|
-
* import type { FeeAllocation } from '@circle-fin/provider-gateway-v1'
|
|
4806
|
-
*
|
|
4807
|
-
* const allocation: FeeAllocation = {
|
|
4808
|
-
* chain: 'Ethereum',
|
|
4809
|
-
* amount: '0.00005',
|
|
4810
|
-
* }
|
|
4811
|
-
* ```
|
|
4812
|
-
*/
|
|
4813
|
-
interface FeeAllocation$1 {
|
|
4814
|
-
/** The chain to which this portion of the fee applies. */
|
|
4815
|
-
chain: Blockchain;
|
|
4816
|
-
/** The fee amount on this chain (human-readable decimal string). */
|
|
4817
|
-
amount: string;
|
|
4818
|
-
}
|
|
4819
|
-
/**
|
|
4820
|
-
* A single fee line item within an estimate.
|
|
4821
|
-
*
|
|
4822
|
-
* @remarks
|
|
4823
|
-
* Each entry describes a fee category (`type`), the token it is
|
|
4824
|
-
* denominated in, the aggregate `amount`, and an optional per-chain
|
|
4825
|
-
* `allocations` breakdown.
|
|
4826
|
-
*
|
|
4827
|
-
* @example
|
|
4828
|
-
* ```typescript
|
|
4829
|
-
* import type { FeeEntry } from '@circle-fin/provider-gateway-v1'
|
|
4830
|
-
*
|
|
4831
|
-
* // Fee with per-chain allocation breakdown
|
|
4832
|
-
* const providerFee: FeeEntry = {
|
|
4833
|
-
* type: 'provider',
|
|
4834
|
-
* token: 'USDC',
|
|
4835
|
-
* amount: '0.00011',
|
|
4836
|
-
* allocations: [
|
|
4837
|
-
* { chain: 'Ethereum', amount: '0.00005' },
|
|
4838
|
-
* { chain: 'Polygon', amount: '0.00006' },
|
|
4839
|
-
* ],
|
|
4840
|
-
* }
|
|
4841
|
-
*
|
|
4842
|
-
* // Flat fee without allocations (e.g. forwarder)
|
|
4843
|
-
* const forwarderFee: FeeEntry = {
|
|
4844
|
-
* type: 'forwarder',
|
|
4845
|
-
* token: 'USDC',
|
|
4846
|
-
* amount: '0.005',
|
|
4847
|
-
* }
|
|
4848
|
-
* ```
|
|
4849
|
-
*/
|
|
4850
|
-
interface FeeEntry$1 {
|
|
4851
|
-
/** The category of this fee. */
|
|
4852
|
-
type: FeeType$1;
|
|
4853
|
-
/** The token in which this fee is denominated (e.g. `'USDC'`, `'ETH'`). */
|
|
4854
|
-
token: string;
|
|
4855
|
-
/** Aggregate fee amount (human-readable decimal string). */
|
|
4856
|
-
amount: string;
|
|
4857
|
-
/** Per-chain breakdown of the fee. Omitted for flat fees (e.g. forwarder). */
|
|
4858
|
-
allocations?: FeeAllocation$1[];
|
|
4859
|
-
/**
|
|
4860
|
-
* When `type === 'kit'`, the address that receives the kit fee.
|
|
4861
|
-
* Omitted for other fee types.
|
|
4862
|
-
*/
|
|
4863
|
-
recipientAddress?: string;
|
|
4864
|
-
}
|
|
4865
5231
|
/**
|
|
4866
5232
|
* Cost estimation for a spend (mint) operation.
|
|
4867
5233
|
*
|
|
@@ -4909,7 +5275,7 @@ interface FeeEntry$1 {
|
|
|
4909
5275
|
*/
|
|
4910
5276
|
interface EstimateSpendResult$1 {
|
|
4911
5277
|
/** Itemised fee breakdown for the spend operation. */
|
|
4912
|
-
fees: FeeEntry
|
|
5278
|
+
fees: FeeEntry[];
|
|
4913
5279
|
}
|
|
4914
5280
|
|
|
4915
5281
|
/**
|
|
@@ -6296,80 +6662,7 @@ type FeeRecipientChainType = 'evm' | 'solana';
|
|
|
6296
6662
|
* ```
|
|
6297
6663
|
*/
|
|
6298
6664
|
type FeeRecipientsConfig = Partial<Record<FeeRecipientChainType, string>>;
|
|
6299
|
-
|
|
6300
|
-
* Fee category describing the origin of a fee line item.
|
|
6301
|
-
*
|
|
6302
|
-
* - `'provider'` — Fee charged by the cross-chain provider (e.g. protocol fee).
|
|
6303
|
-
* - `'gasFee'` — On-chain gas cost denominated in the transfer token (e.g. USDC).
|
|
6304
|
-
* - `'kit'` — Fee charged by the kit / developer integration.
|
|
6305
|
-
* - `'forwarder'` — Fee charged by Circle's Forwarding Service for automatic mint.
|
|
6306
|
-
*/
|
|
6307
|
-
type FeeType = 'provider' | 'gasFee' | 'kit' | 'forwarder';
|
|
6308
|
-
/**
|
|
6309
|
-
* Per-chain breakdown of a fee amount.
|
|
6310
|
-
*
|
|
6311
|
-
* @example
|
|
6312
|
-
* ```typescript
|
|
6313
|
-
* import type { FeeAllocation } from '@circle-fin/unified-balance-kit'
|
|
6314
|
-
*
|
|
6315
|
-
* const allocation: FeeAllocation = {
|
|
6316
|
-
* chain: 'Ethereum',
|
|
6317
|
-
* amount: '0.00005',
|
|
6318
|
-
* }
|
|
6319
|
-
* ```
|
|
6320
|
-
*/
|
|
6321
|
-
interface FeeAllocation {
|
|
6322
|
-
/** The chain to which this portion of the fee applies. */
|
|
6323
|
-
chain: Blockchain;
|
|
6324
|
-
/** The fee amount on this chain (human-readable decimal string). */
|
|
6325
|
-
amount: string;
|
|
6326
|
-
}
|
|
6327
|
-
/**
|
|
6328
|
-
* A single fee line item within an estimate.
|
|
6329
|
-
*
|
|
6330
|
-
* @remarks
|
|
6331
|
-
* Each entry describes a fee category (`type`), the token it is
|
|
6332
|
-
* denominated in, the aggregate `amount`, and an optional per-chain
|
|
6333
|
-
* `allocations` breakdown.
|
|
6334
|
-
*
|
|
6335
|
-
* @example
|
|
6336
|
-
* ```typescript
|
|
6337
|
-
* import type { FeeEntry } from '@circle-fin/unified-balance-kit'
|
|
6338
|
-
*
|
|
6339
|
-
* // Fee with per-chain allocation breakdown
|
|
6340
|
-
* const providerFee: FeeEntry = {
|
|
6341
|
-
* type: 'provider',
|
|
6342
|
-
* token: 'USDC',
|
|
6343
|
-
* amount: '0.00011',
|
|
6344
|
-
* allocations: [
|
|
6345
|
-
* { chain: 'Ethereum', amount: '0.00005' },
|
|
6346
|
-
* { chain: 'Polygon', amount: '0.00006' },
|
|
6347
|
-
* ],
|
|
6348
|
-
* }
|
|
6349
|
-
*
|
|
6350
|
-
* // Flat fee without allocations (e.g. forwarder)
|
|
6351
|
-
* const forwarderFee: FeeEntry = {
|
|
6352
|
-
* type: 'forwarder',
|
|
6353
|
-
* token: 'USDC',
|
|
6354
|
-
* amount: '0.005',
|
|
6355
|
-
* }
|
|
6356
|
-
* ```
|
|
6357
|
-
*/
|
|
6358
|
-
interface FeeEntry {
|
|
6359
|
-
/** The category of this fee. */
|
|
6360
|
-
type: FeeType;
|
|
6361
|
-
/** The token in which this fee is denominated (e.g. `'USDC'`, `'ETH'`). */
|
|
6362
|
-
token: string;
|
|
6363
|
-
/** Aggregate fee amount (human-readable decimal string). */
|
|
6364
|
-
amount: string;
|
|
6365
|
-
/** Per-chain breakdown of the fee. Omitted for flat fees (e.g. forwarder). */
|
|
6366
|
-
allocations?: FeeAllocation[];
|
|
6367
|
-
/**
|
|
6368
|
-
* When `type === 'kit'`, the address that receives the kit fee.
|
|
6369
|
-
* Omitted for other fee types.
|
|
6370
|
-
*/
|
|
6371
|
-
recipientAddress?: string;
|
|
6372
|
-
}
|
|
6665
|
+
|
|
6373
6666
|
/**
|
|
6374
6667
|
* Cost estimation for a spend (mint) operation.
|
|
6375
6668
|
*
|
|
@@ -6570,6 +6863,21 @@ interface UnifiedBalanceKitConfig<TExtraProviders extends FlexibleGatewayProvide
|
|
|
6570
6863
|
headers?: Record<string, string>;
|
|
6571
6864
|
}
|
|
6572
6865
|
|
|
6866
|
+
/**
|
|
6867
|
+
* USD exchange-rate metadata.
|
|
6868
|
+
*
|
|
6869
|
+
* Non-binding, useful for USD-denominated fee estimates. `feeTokenUsd` prices
|
|
6870
|
+
* the source-chain fee token (the token `feeTotalAmount` is denominated in).
|
|
6871
|
+
*
|
|
6872
|
+
* @internal
|
|
6873
|
+
*/
|
|
6874
|
+
interface FeeQuoteExchangeRates {
|
|
6875
|
+
/** USD price of the fee token, as a decimal string. */
|
|
6876
|
+
readonly feeTokenUsd: string;
|
|
6877
|
+
/** USD price of the destination token, as a decimal string. */
|
|
6878
|
+
readonly destinationTokenUsd: string;
|
|
6879
|
+
}
|
|
6880
|
+
|
|
6573
6881
|
/**
|
|
6574
6882
|
* Token allowance strategy used to authorize a Gateway deposit.
|
|
6575
6883
|
*
|
|
@@ -6609,7 +6917,7 @@ type AllowanceStrategy = 'approve' | 'permit' | 'authorize';
|
|
|
6609
6917
|
* }
|
|
6610
6918
|
* ```
|
|
6611
6919
|
*/
|
|
6612
|
-
interface DepositParams<TAdapterCapabilities extends AdapterCapabilities = AdapterCapabilities, TChainIdentifier extends
|
|
6920
|
+
interface DepositParams<TAdapterCapabilities extends AdapterCapabilities = AdapterCapabilities, TChainIdentifier extends BridgeChainIdentifier = BridgeChainIdentifier> {
|
|
6613
6921
|
/**
|
|
6614
6922
|
* The adapter context identifying the depositor and chain.
|
|
6615
6923
|
*/
|
|
@@ -6622,7 +6930,7 @@ interface DepositParams<TAdapterCapabilities extends AdapterCapabilities = Adapt
|
|
|
6622
6930
|
amount: string;
|
|
6623
6931
|
/**
|
|
6624
6932
|
* The token to deposit.
|
|
6625
|
-
* Accepts any case (e.g. `'usdc'`, `'Usdc'`);
|
|
6933
|
+
* Accepts any case (e.g. `'usdc'`, `'Usdc'`); normalized to uppercase internally.
|
|
6626
6934
|
*
|
|
6627
6935
|
* @defaultValue 'USDC'
|
|
6628
6936
|
*/
|
|
@@ -6630,9 +6938,40 @@ interface DepositParams<TAdapterCapabilities extends AdapterCapabilities = Adapt
|
|
|
6630
6938
|
/**
|
|
6631
6939
|
* The token allowance strategy to authorize the deposit.
|
|
6632
6940
|
*
|
|
6941
|
+
* Only valid for same-chain (STANDARD) deposits. Must not be set when
|
|
6942
|
+
* `to` is provided (FAST cross-chain deposits do not use an allowance
|
|
6943
|
+
* strategy).
|
|
6944
|
+
*
|
|
6633
6945
|
* @defaultValue 'authorize'
|
|
6634
6946
|
*/
|
|
6635
6947
|
allowanceStrategy?: AllowanceStrategy;
|
|
6948
|
+
/**
|
|
6949
|
+
* Destination chain for a FAST cross-chain deposit.
|
|
6950
|
+
*
|
|
6951
|
+
* When set, the deposit follows the prepaid-FORWARD CCTP v2 path:
|
|
6952
|
+
* the burned USDC is minted to the GenericExecutor on the destination
|
|
6953
|
+
* chain, which then calls Gateway `deposit` in a single relayed flow.
|
|
6954
|
+
*
|
|
6955
|
+
* Must not be set when `config.transferSpeed` is `'STANDARD'`.
|
|
6956
|
+
*/
|
|
6957
|
+
to?: {
|
|
6958
|
+
chain: UnifiedBalanceChainIdentifier;
|
|
6959
|
+
};
|
|
6960
|
+
/**
|
|
6961
|
+
* Transfer configuration for the deposit.
|
|
6962
|
+
*
|
|
6963
|
+
* @defaultValue `{ transferSpeed: 'STANDARD' }`. Set `transferSpeed: 'FAST'`
|
|
6964
|
+
* explicitly for cross-chain deposits (when `to` is provided).
|
|
6965
|
+
*/
|
|
6966
|
+
config?: DepositConfig;
|
|
6967
|
+
/**
|
|
6968
|
+
* Opaque signed fee-quote bytes from the Quote API.
|
|
6969
|
+
*
|
|
6970
|
+
* Pass this to commit to the fee price returned by a previous
|
|
6971
|
+
* {@link estimateDeposit} call (see {@link EstimateDepositResult.quote}).
|
|
6972
|
+
* When omitted a fresh quote is fetched automatically (FAST path only).
|
|
6973
|
+
*/
|
|
6974
|
+
quote?: string;
|
|
6636
6975
|
}
|
|
6637
6976
|
/**
|
|
6638
6977
|
* Parameters for depositing tokens into *another* Gateway account.
|
|
@@ -6659,7 +6998,7 @@ interface DepositParams<TAdapterCapabilities extends AdapterCapabilities = Adapt
|
|
|
6659
6998
|
* }
|
|
6660
6999
|
* ```
|
|
6661
7000
|
*/
|
|
6662
|
-
interface DepositForParams<TAdapterCapabilities extends AdapterCapabilities = AdapterCapabilities, TChainIdentifier extends
|
|
7001
|
+
interface DepositForParams<TAdapterCapabilities extends AdapterCapabilities = AdapterCapabilities, TChainIdentifier extends BridgeChainIdentifier = BridgeChainIdentifier> extends Omit<DepositParams<TAdapterCapabilities, TChainIdentifier>, 'allowanceStrategy'> {
|
|
6663
7002
|
/**
|
|
6664
7003
|
* The Gateway account address to credit with the deposit.
|
|
6665
7004
|
*
|
|
@@ -6668,6 +7007,34 @@ interface DepositForParams<TAdapterCapabilities extends AdapterCapabilities = Ad
|
|
|
6668
7007
|
*/
|
|
6669
7008
|
depositAccount: string;
|
|
6670
7009
|
}
|
|
7010
|
+
/**
|
|
7011
|
+
* Relay progress for a cross-chain (FAST) deposit.
|
|
7012
|
+
*
|
|
7013
|
+
* Set after `depositFastCrossChain` completes the ~60-second relay wait.
|
|
7014
|
+
* Always present on the FAST path; absent on same-chain STANDARD deposits.
|
|
7015
|
+
*
|
|
7016
|
+
* @example
|
|
7017
|
+
* ```typescript
|
|
7018
|
+
* if (result.progress?.status === 'DONE') {
|
|
7019
|
+
* console.log('Minted on destination:', result.txHash)
|
|
7020
|
+
* } else if (result.progress?.status === 'PENDING') {
|
|
7021
|
+
* console.log('Relay still in progress — poll getDepositStatus later')
|
|
7022
|
+
* } else if (result.progress?.status === 'FAILED') {
|
|
7023
|
+
* console.log('Relay failed — manual mint may be required')
|
|
7024
|
+
* }
|
|
7025
|
+
* ```
|
|
7026
|
+
*/
|
|
7027
|
+
interface DepositProgress {
|
|
7028
|
+
/**
|
|
7029
|
+
* Relay outcome after the burn is confirmed on the source chain.
|
|
7030
|
+
*
|
|
7031
|
+
* - `'DONE'` — Circle's relayer minted USDC on the destination chain.
|
|
7032
|
+
* - `'PENDING'` — Relay timed out (~60 s); the mint may still complete.
|
|
7033
|
+
* - `'FAILED'` — Relayer reported a permanent failure; manual mint may
|
|
7034
|
+
* be required.
|
|
7035
|
+
*/
|
|
7036
|
+
status: 'DONE' | 'PENDING' | 'FAILED';
|
|
7037
|
+
}
|
|
6671
7038
|
/**
|
|
6672
7039
|
* Result returned after a successful deposit operation.
|
|
6673
7040
|
*
|
|
@@ -6697,22 +7064,232 @@ interface DepositResult {
|
|
|
6697
7064
|
depositedTo: string;
|
|
6698
7065
|
/** The address that signed and funded the deposit. */
|
|
6699
7066
|
depositedBy: string;
|
|
6700
|
-
/**
|
|
7067
|
+
/**
|
|
7068
|
+
* The chain where the deposit balance lands.
|
|
7069
|
+
*
|
|
7070
|
+
* @remarks For cross-chain (FAST) deposits this is the destination chain
|
|
7071
|
+
* where the minted USDC is credited. For same-chain (STANDARD) deposits it
|
|
7072
|
+
* is the chain the deposit occurred on. Prefer `sourceChain` /
|
|
7073
|
+
* `destinationChain` for cross-chain flows.
|
|
7074
|
+
*/
|
|
6701
7075
|
chain: Blockchain;
|
|
6702
7076
|
/**
|
|
6703
|
-
*
|
|
6704
|
-
*
|
|
7077
|
+
* Transaction hash of the completed deposit.
|
|
7078
|
+
*
|
|
7079
|
+
* @remarks
|
|
7080
|
+
* For same-chain (STANDARD) deposits this is the on-chain deposit
|
|
7081
|
+
* transaction. For cross-chain (FAST) deposits with
|
|
7082
|
+
* `progress.status === 'DONE'` this is the Circle-relayed mint on the
|
|
7083
|
+
* destination chain; when the relay is still pending or has failed it
|
|
7084
|
+
* falls back to the source-chain burn hash.
|
|
6705
7085
|
*/
|
|
6706
7086
|
txHash: string;
|
|
6707
7087
|
/**
|
|
6708
|
-
* Link to view the transaction
|
|
6709
|
-
* blockchain explorer.
|
|
7088
|
+
* Link to view the transaction on a block explorer.
|
|
6710
7089
|
*
|
|
6711
7090
|
* @remarks
|
|
6712
|
-
*
|
|
6713
|
-
* for the chain.
|
|
7091
|
+
* Follows the same chain as {@link txHash}: points to the destination-chain
|
|
7092
|
+
* mint for a completed FAST deposit, or the source-chain burn otherwise.
|
|
7093
|
+
* May be `undefined` when the chain has no configured explorer URL.
|
|
6714
7094
|
*/
|
|
6715
7095
|
explorerUrl?: string;
|
|
7096
|
+
/**
|
|
7097
|
+
* Source chain of the cross-chain deposit (FAST path only).
|
|
7098
|
+
*
|
|
7099
|
+
* Present when `to` was specified in the deposit params.
|
|
7100
|
+
*/
|
|
7101
|
+
sourceChain?: Blockchain;
|
|
7102
|
+
/**
|
|
7103
|
+
* Destination chain of the cross-chain deposit (FAST path only).
|
|
7104
|
+
*
|
|
7105
|
+
* Present when `to` was specified in the deposit params.
|
|
7106
|
+
*/
|
|
7107
|
+
destinationChain?: Blockchain;
|
|
7108
|
+
/**
|
|
7109
|
+
* Itemised fee breakdown for the cross-chain deposit (FAST path only).
|
|
7110
|
+
*
|
|
7111
|
+
* Contains at least a `gasFee` entry and a `forwarder` entry (Circle
|
|
7112
|
+
* FORWARD fee). The `gasFee` covers the source-chain burn gas; when a
|
|
7113
|
+
* `usdc.approve` was required it also includes the actual on-chain approve
|
|
7114
|
+
* gas derived from the transaction receipt.
|
|
7115
|
+
*/
|
|
7116
|
+
fees?: FeeEntry[];
|
|
7117
|
+
/**
|
|
7118
|
+
* Relay progress after the source-chain burn (FAST path only).
|
|
7119
|
+
*
|
|
7120
|
+
* Present on every FAST deposit result. Use this to determine whether
|
|
7121
|
+
* the destination-chain mint completed within the ~60-second relay window.
|
|
7122
|
+
*/
|
|
7123
|
+
progress?: DepositProgress;
|
|
7124
|
+
}
|
|
7125
|
+
/**
|
|
7126
|
+
* Transfer-speed configuration for a deposit operation.
|
|
7127
|
+
*
|
|
7128
|
+
* @example
|
|
7129
|
+
* ```typescript
|
|
7130
|
+
* import type { DepositConfig } from '@circle-fin/unified-balance-kit'
|
|
7131
|
+
*
|
|
7132
|
+
* const config: DepositConfig = { transferSpeed: 'FAST' }
|
|
7133
|
+
* ```
|
|
7134
|
+
*/
|
|
7135
|
+
interface DepositConfig {
|
|
7136
|
+
/**
|
|
7137
|
+
* Requested transfer speed for a cross-chain fast deposit.
|
|
7138
|
+
*
|
|
7139
|
+
* @defaultValue `'STANDARD'`
|
|
7140
|
+
*/
|
|
7141
|
+
transferSpeed?: 'FAST' | 'STANDARD';
|
|
7142
|
+
}
|
|
7143
|
+
/**
|
|
7144
|
+
* Parameters for estimating the fees of a fast cross-chain deposit.
|
|
7145
|
+
*
|
|
7146
|
+
* The result is plain, serializable data — no live adapter reference is
|
|
7147
|
+
* included. Pass the result (plus `from`) directly to
|
|
7148
|
+
* {@link DepositParams} or {@link DepositForParams} for execution:
|
|
7149
|
+
*
|
|
7150
|
+
* ```typescript
|
|
7151
|
+
* const estimate = await kit.estimateDeposit({ from, amount, token, to })
|
|
7152
|
+
* const result = await kit.deposit({ ...estimate, from })
|
|
7153
|
+
* ```
|
|
7154
|
+
*
|
|
7155
|
+
* @typeParam TAdapterCapabilities - Adapter capability constraints.
|
|
7156
|
+
* @typeParam TChainIdentifier - Accepted chain identifier type.
|
|
7157
|
+
*
|
|
7158
|
+
* @example
|
|
7159
|
+
* ```typescript
|
|
7160
|
+
* import type { EstimateDepositParams } from '@circle-fin/unified-balance-kit'
|
|
7161
|
+
*
|
|
7162
|
+
* const params: EstimateDepositParams = {
|
|
7163
|
+
* from: { adapter: evmAdapter, chain: 'Ethereum' },
|
|
7164
|
+
* amount: '100',
|
|
7165
|
+
* to: { chain: 'Arc_Testnet' },
|
|
7166
|
+
* config: { transferSpeed: 'FAST' },
|
|
7167
|
+
* }
|
|
7168
|
+
* ```
|
|
7169
|
+
*/
|
|
7170
|
+
interface EstimateDepositParams<TAdapterCapabilities extends AdapterCapabilities = AdapterCapabilities, TChainIdentifier extends BridgeChainIdentifier = BridgeChainIdentifier> {
|
|
7171
|
+
/**
|
|
7172
|
+
* The adapter context identifying the depositor and source chain.
|
|
7173
|
+
* The adapter is used for source-chain gas estimation.
|
|
7174
|
+
*/
|
|
7175
|
+
from: AdapterContext<TAdapterCapabilities, TChainIdentifier>;
|
|
7176
|
+
/**
|
|
7177
|
+
* The amount of tokens to deposit (human-readable decimal string).
|
|
7178
|
+
*
|
|
7179
|
+
* @example "100", "0.5"
|
|
7180
|
+
*/
|
|
7181
|
+
amount: string;
|
|
7182
|
+
/**
|
|
7183
|
+
* The token to deposit.
|
|
7184
|
+
*
|
|
7185
|
+
* @defaultValue 'USDC'
|
|
7186
|
+
*/
|
|
7187
|
+
token?: SupportedTokenInput;
|
|
7188
|
+
/**
|
|
7189
|
+
* Destination chain for a FAST cross-chain deposit.
|
|
7190
|
+
*
|
|
7191
|
+
* Required when `config.transferSpeed` is `'FAST'`.
|
|
7192
|
+
* Must not be set when `config.transferSpeed` is `'STANDARD'` (the default).
|
|
7193
|
+
*/
|
|
7194
|
+
to?: {
|
|
7195
|
+
chain: UnifiedBalanceChainIdentifier;
|
|
7196
|
+
};
|
|
7197
|
+
/**
|
|
7198
|
+
* Transfer configuration.
|
|
7199
|
+
*
|
|
7200
|
+
* @defaultValue `{ transferSpeed: 'STANDARD' }`
|
|
7201
|
+
*/
|
|
7202
|
+
config?: DepositConfig;
|
|
7203
|
+
/**
|
|
7204
|
+
* Gateway account address to credit (for a `depositFor` round-trip).
|
|
7205
|
+
*
|
|
7206
|
+
* When provided, this value is echoed on the result so
|
|
7207
|
+
* `kit.depositFor({ ...estimate, from })` works without re-specifying it.
|
|
7208
|
+
*/
|
|
7209
|
+
depositAccount?: string;
|
|
7210
|
+
/**
|
|
7211
|
+
* Allowance strategy echoed to the result for round-trip convenience.
|
|
7212
|
+
*/
|
|
7213
|
+
allowanceStrategy?: AllowanceStrategy;
|
|
7214
|
+
}
|
|
7215
|
+
/**
|
|
7216
|
+
* Fee-preview result returned by `estimateDeposit`.
|
|
7217
|
+
*
|
|
7218
|
+
* Plain, serializable data — no live adapter reference. Pass the result
|
|
7219
|
+
* directly to `deposit` or `depositFor` (re-attaching only `from`):
|
|
7220
|
+
*
|
|
7221
|
+
* ```typescript
|
|
7222
|
+
* const estimate = await kit.estimateDeposit({ from, amount, token, to })
|
|
7223
|
+
* const result = await kit.deposit({ ...estimate, from })
|
|
7224
|
+
* ```
|
|
7225
|
+
*
|
|
7226
|
+
* @example
|
|
7227
|
+
* ```typescript
|
|
7228
|
+
* import type { EstimateDepositResult } from '@circle-fin/unified-balance-kit'
|
|
7229
|
+
*
|
|
7230
|
+
* const result: EstimateDepositResult = {
|
|
7231
|
+
* amount: '100',
|
|
7232
|
+
* token: 'USDC',
|
|
7233
|
+
* to: { chain: 'Arc_Testnet' },
|
|
7234
|
+
* config: { transferSpeed: 'FAST' },
|
|
7235
|
+
* fees: [
|
|
7236
|
+
* { type: 'gasFee', token: 'ETH', amount: '0.0002' },
|
|
7237
|
+
* { type: 'forwarder', token: 'USDC', amount: '0.12' },
|
|
7238
|
+
* ],
|
|
7239
|
+
* quote: '0x…',
|
|
7240
|
+
* }
|
|
7241
|
+
* ```
|
|
7242
|
+
*/
|
|
7243
|
+
interface EstimateDepositResult {
|
|
7244
|
+
/** Deposit amount (human-readable decimal string). */
|
|
7245
|
+
amount: string;
|
|
7246
|
+
/** Normalized token to deposit. */
|
|
7247
|
+
token: SupportedToken;
|
|
7248
|
+
/**
|
|
7249
|
+
* Destination chain (echoed from input).
|
|
7250
|
+
*
|
|
7251
|
+
* Present for FAST transfers; absent for STANDARD.
|
|
7252
|
+
*/
|
|
7253
|
+
to?: {
|
|
7254
|
+
chain: UnifiedBalanceChainIdentifier;
|
|
7255
|
+
};
|
|
7256
|
+
/** Transfer configuration (echoed with defaults applied). */
|
|
7257
|
+
config: Required<DepositConfig>;
|
|
7258
|
+
/**
|
|
7259
|
+
* Itemized fee breakdown.
|
|
7260
|
+
*
|
|
7261
|
+
* Always contains at least a `gasFee` entry. For FAST transfers the gas
|
|
7262
|
+
* cost includes the source-chain burn; when the current USDC allowance is
|
|
7263
|
+
* insufficient it also includes the `usdc.approve` transaction. For
|
|
7264
|
+
* STANDARD deposits on EVM with `allowanceStrategy: 'approve'`, or any
|
|
7265
|
+
* `depositFor` on EVM, the gas cost includes both the
|
|
7266
|
+
* `usdc.increaseAllowance` and the deposit transaction. A `forwarder`
|
|
7267
|
+
* entry is always present for FAST cross-chain transfers.
|
|
7268
|
+
*/
|
|
7269
|
+
fees: FeeEntry[];
|
|
7270
|
+
/**
|
|
7271
|
+
* Opaque signed fee-quote bytes from the Quote API.
|
|
7272
|
+
*
|
|
7273
|
+
* Present for FAST cross-chain deposits; absent for STANDARD or
|
|
7274
|
+
* same-chain. Pass this to {@link deposit} or {@link depositFor} to
|
|
7275
|
+
* commit to the quoted price.
|
|
7276
|
+
*/
|
|
7277
|
+
quote?: string;
|
|
7278
|
+
/**
|
|
7279
|
+
* Gateway account to credit (echoed from input for `depositFor` round-trip).
|
|
7280
|
+
*/
|
|
7281
|
+
depositAccount?: string;
|
|
7282
|
+
/**
|
|
7283
|
+
* Allowance strategy (echoed from input for `deposit` round-trip).
|
|
7284
|
+
*/
|
|
7285
|
+
allowanceStrategy?: AllowanceStrategy;
|
|
7286
|
+
/**
|
|
7287
|
+
* Optional USD exchange-rate metadata from the Quote API.
|
|
7288
|
+
*
|
|
7289
|
+
* Present when the Quote API returns exchange rates for the fee token
|
|
7290
|
+
* and destination token. Non-binding; useful for USD-denominated display.
|
|
7291
|
+
*/
|
|
7292
|
+
exchangeRates?: FeeQuoteExchangeRates;
|
|
6716
7293
|
}
|
|
6717
7294
|
|
|
6718
7295
|
/**
|
|
@@ -7460,6 +8037,35 @@ declare class AppKitUnifiedBalance {
|
|
|
7460
8037
|
* ```
|
|
7461
8038
|
*/
|
|
7462
8039
|
depositFor(params: DepositForParams): Promise<DepositResult>;
|
|
8040
|
+
/**
|
|
8041
|
+
* Estimate the fees for a deposit without executing it.
|
|
8042
|
+
*
|
|
8043
|
+
* Return plain, serializable data that can be spread directly into
|
|
8044
|
+
* {@link AppKitUnifiedBalance.deposit} or
|
|
8045
|
+
* {@link AppKitUnifiedBalance.depositFor}.
|
|
8046
|
+
*
|
|
8047
|
+
* @param params - Estimate details including the depositor context, amount,
|
|
8048
|
+
* destination chain, and optional transfer speed.
|
|
8049
|
+
* @returns Promise resolving to the itemised fee estimate.
|
|
8050
|
+
* @throws {KitError} If the estimate parameters are invalid or the route is
|
|
8051
|
+
* unsupported.
|
|
8052
|
+
*
|
|
8053
|
+
* @example
|
|
8054
|
+
* ```typescript
|
|
8055
|
+
* const estimate = await kit.unifiedBalance.estimateDeposit({
|
|
8056
|
+
* from: { adapter, chain: 'Ethereum' },
|
|
8057
|
+
* amount: '100',
|
|
8058
|
+
* to: { chain: 'Polygon' },
|
|
8059
|
+
* config: { transferSpeed: 'FAST' },
|
|
8060
|
+
* })
|
|
8061
|
+
*
|
|
8062
|
+
* const result = await kit.unifiedBalance.deposit({
|
|
8063
|
+
* ...estimate,
|
|
8064
|
+
* from: { adapter, chain: 'Ethereum' },
|
|
8065
|
+
* })
|
|
8066
|
+
* ```
|
|
8067
|
+
*/
|
|
8068
|
+
estimateDeposit(params: EstimateDepositParams): Promise<EstimateDepositResult>;
|
|
7463
8069
|
/**
|
|
7464
8070
|
* Spend (mint) USDC on a destination chain by pulling funds from one or
|
|
7465
8071
|
* more account sources.
|