@circle-fin/app-kit 1.12.0 → 1.13.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 +73 -0
- package/README.md +31 -12
- package/bridge.cjs +3893 -1714
- package/bridge.d.cts +186 -18
- package/bridge.d.mts +186 -18
- package/bridge.d.ts +186 -18
- package/bridge.mjs +3895 -1716
- package/chains.cjs +134 -0
- package/chains.d.cts +126 -1
- package/chains.d.mts +126 -1
- package/chains.d.ts +126 -1
- package/chains.mjs +133 -1
- package/context.d.cts +185 -17
- package/context.d.mts +185 -17
- package/context.d.ts +185 -17
- package/earn.cjs +651 -85
- package/earn.d.cts +185 -17
- package/earn.d.mts +185 -17
- package/earn.d.ts +185 -17
- package/earn.mjs +651 -85
- package/estimateBridge.cjs +3892 -1713
- package/estimateBridge.d.cts +295 -18
- package/estimateBridge.d.mts +295 -18
- package/estimateBridge.d.ts +295 -18
- package/estimateBridge.mjs +3894 -1715
- package/estimateSwap.cjs +748 -136
- package/estimateSwap.d.cts +185 -17
- package/estimateSwap.d.mts +185 -17
- package/estimateSwap.d.ts +185 -17
- package/estimateSwap.mjs +748 -136
- package/index.cjs +3806 -1952
- package/index.d.cts +2775 -1874
- package/index.d.mts +2775 -1874
- package/index.d.ts +2775 -1874
- package/index.mjs +3808 -1954
- package/package.json +6 -6
- package/swap.cjs +748 -136
- package/swap.d.cts +192 -18
- package/swap.d.mts +192 -18
- package/swap.d.ts +192 -18
- package/swap.mjs +748 -136
- package/unifiedBalance.cjs +509 -87
- package/unifiedBalance.d.cts +206 -33
- package/unifiedBalance.d.mts +206 -33
- package/unifiedBalance.d.ts +206 -33
- package/unifiedBalance.mjs +509 -87
package/bridge.d.cts
CHANGED
|
@@ -718,6 +718,8 @@ declare enum Blockchain {
|
|
|
718
718
|
Optimism_Sepolia = "Optimism_Sepolia",
|
|
719
719
|
Pharos = "Pharos",
|
|
720
720
|
Pharos_Testnet = "Pharos_Testnet",
|
|
721
|
+
Plasma = "Plasma",
|
|
722
|
+
Plasma_Testnet = "Plasma_Testnet",
|
|
721
723
|
Polkadot_Asset_Hub = "Polkadot_Asset_Hub",
|
|
722
724
|
Polkadot_Westmint = "Polkadot_Westmint",
|
|
723
725
|
Plume = "Plume",
|
|
@@ -946,6 +948,7 @@ declare enum BridgeChain {
|
|
|
946
948
|
Morph = "Morph",
|
|
947
949
|
Optimism = "Optimism",
|
|
948
950
|
Pharos = "Pharos",
|
|
951
|
+
Plasma = "Plasma",
|
|
949
952
|
Plume = "Plume",
|
|
950
953
|
Polygon = "Polygon",
|
|
951
954
|
Sei = "Sei",
|
|
@@ -971,6 +974,7 @@ declare enum BridgeChain {
|
|
|
971
974
|
Morph_Testnet = "Morph_Testnet",
|
|
972
975
|
Optimism_Sepolia = "Optimism_Sepolia",
|
|
973
976
|
Pharos_Testnet = "Pharos_Testnet",
|
|
977
|
+
Plasma_Testnet = "Plasma_Testnet",
|
|
974
978
|
Plume_Testnet = "Plume_Testnet",
|
|
975
979
|
Polygon_Amoy_Testnet = "Polygon_Amoy_Testnet",
|
|
976
980
|
Sei_Testnet = "Sei_Testnet",
|
|
@@ -2652,7 +2656,7 @@ interface ExecuteParams {
|
|
|
2652
2656
|
* fromAddress: '0x...',
|
|
2653
2657
|
* toAddress: '0x...',
|
|
2654
2658
|
* amount: '1000000',
|
|
2655
|
-
* apiKey: '
|
|
2659
|
+
* apiKey: 'TEST_API_KEY:...',
|
|
2656
2660
|
* })
|
|
2657
2661
|
*
|
|
2658
2662
|
* // Build token inputs with permit
|
|
@@ -2796,7 +2800,7 @@ interface ExecuteSwapEVMParams extends ActionParameters {
|
|
|
2796
2800
|
* fromAddress: 'YubQzu18FDqJRyNfG8JqHmsdbxhnoQqcKUHBdUkN6tP',
|
|
2797
2801
|
* toAddress: 'YubQzu18FDqJRyNfG8JqHmsdbxhnoQqcKUHBdUkN6tP',
|
|
2798
2802
|
* amount: '1000000',
|
|
2799
|
-
* apiKey: '
|
|
2803
|
+
* apiKey: 'TEST_API_KEY:...',
|
|
2800
2804
|
* })
|
|
2801
2805
|
*
|
|
2802
2806
|
* // Prepare action parameters
|
|
@@ -2957,6 +2961,18 @@ interface TokenActionMap {
|
|
|
2957
2961
|
*/
|
|
2958
2962
|
walletAddress?: string | undefined;
|
|
2959
2963
|
};
|
|
2964
|
+
/**
|
|
2965
|
+
* Get the on-chain name of the token contract.
|
|
2966
|
+
*
|
|
2967
|
+
* This is a read-only operation. For USDC the value is also the EIP-712
|
|
2968
|
+
* domain name, which permit and authorize signing flows need.
|
|
2969
|
+
*/
|
|
2970
|
+
name: ActionParameters & {
|
|
2971
|
+
/**
|
|
2972
|
+
* The contract address of the token.
|
|
2973
|
+
*/
|
|
2974
|
+
tokenAddress: string;
|
|
2975
|
+
};
|
|
2960
2976
|
}
|
|
2961
2977
|
|
|
2962
2978
|
/**
|
|
@@ -3786,6 +3802,30 @@ declare class ActionRegistry {
|
|
|
3786
3802
|
executeAction<TActionKey extends ActionKeys>(action: TActionKey, params: ActionPayload<TActionKey>, context: ResolvedOperationContext): Promise<PreparedChainRequest>;
|
|
3787
3803
|
}
|
|
3788
3804
|
|
|
3805
|
+
/**
|
|
3806
|
+
* Canonical list of actions that do not prepare or submit transactions.
|
|
3807
|
+
*
|
|
3808
|
+
* @internal
|
|
3809
|
+
*/
|
|
3810
|
+
declare const READ_ACTION_KEYS: readonly ["token.allowance", "token.balanceOf", "token.name", "native.balanceOf", "usdc.allowance", "usdc.balanceOf", "usdc.name", "gateway.v1.isDelegate", "gateway.v1.withdrawingBalance", "gateway.v1.withdrawalBlock", "gateway.v1.signBurnIntents"];
|
|
3811
|
+
/**
|
|
3812
|
+
* Action keys that execute without preparing or submitting a transaction.
|
|
3813
|
+
*
|
|
3814
|
+
* @remarks
|
|
3815
|
+
* Derive this type from the canonical runtime list so compile-time and runtime
|
|
3816
|
+
* classification cannot drift. `gateway.v1.signBurnIntents` is included
|
|
3817
|
+
* because the action system models off-chain signing as a read action: it does
|
|
3818
|
+
* not prepare a chain request.
|
|
3819
|
+
*
|
|
3820
|
+
* @example
|
|
3821
|
+
* ```typescript
|
|
3822
|
+
* import type { ReadActionKey } from '@core/adapter'
|
|
3823
|
+
*
|
|
3824
|
+
* const action: ReadActionKey = 'token.allowance'
|
|
3825
|
+
* ```
|
|
3826
|
+
*/
|
|
3827
|
+
type ReadActionKey = (typeof READ_ACTION_KEYS)[number];
|
|
3828
|
+
|
|
3789
3829
|
/**
|
|
3790
3830
|
* Defines the capabilities of an adapter, including address handling patterns and supported chains.
|
|
3791
3831
|
*
|
|
@@ -3954,6 +3994,69 @@ declare abstract class Adapter<TAdapterCapabilities extends AdapterCapabilities
|
|
|
3954
3994
|
* ```
|
|
3955
3995
|
*/
|
|
3956
3996
|
prepareAction<TActionKey extends ActionKeys>(action: TActionKey, params: ActionPayload<TActionKey>, ctx: OperationContext<TAdapterCapabilities>): Promise<PreparedChainRequest>;
|
|
3997
|
+
/**
|
|
3998
|
+
* Execute a non-transaction action without routing through transaction preparation.
|
|
3999
|
+
*
|
|
4000
|
+
* @remarks
|
|
4001
|
+
* Use this seam for balance, allowance, contract-state, and other actions
|
|
4002
|
+
* classified as reads. It never calls {@link Adapter.prepareAction}, so
|
|
4003
|
+
* transaction authorization wrappers only observe actions that can produce a
|
|
4004
|
+
* signable chain request.
|
|
4005
|
+
*
|
|
4006
|
+
* @typeParam TActionKey - The read action key.
|
|
4007
|
+
* @param action - The read action to execute.
|
|
4008
|
+
* @param params - The parameters for the read action.
|
|
4009
|
+
* @param ctx - The operation context.
|
|
4010
|
+
* @returns The raw action response.
|
|
4011
|
+
* @throws {KitError} When the key is not a read action or no handler is registered.
|
|
4012
|
+
* @throws Error When the operation context or action handler fails.
|
|
4013
|
+
*
|
|
4014
|
+
* @example
|
|
4015
|
+
* ```typescript
|
|
4016
|
+
* import { Ethereum } from '@core/chains'
|
|
4017
|
+
*
|
|
4018
|
+
* const balance = await adapter.readAction(
|
|
4019
|
+
* 'token.balanceOf',
|
|
4020
|
+
* { tokenAddress, walletAddress },
|
|
4021
|
+
* { chain: Ethereum },
|
|
4022
|
+
* )
|
|
4023
|
+
* ```
|
|
4024
|
+
*
|
|
4025
|
+
* @internal
|
|
4026
|
+
*/
|
|
4027
|
+
readAction<TActionKey extends ReadActionKey>(action: TActionKey, params: ActionPayload<TActionKey>, ctx: OperationContext<TAdapterCapabilities>): Promise<unknown>;
|
|
4028
|
+
/**
|
|
4029
|
+
* Read the current token allowance a delegate holds over an owner's tokens.
|
|
4030
|
+
*
|
|
4031
|
+
* @remarks
|
|
4032
|
+
* Perform a network read through {@link Adapter.readAction}. This method
|
|
4033
|
+
* never routes through {@link Adapter.prepareAction}. On chains without an
|
|
4034
|
+
* allowance model, such as Solana, return the maximum uint256 value.
|
|
4035
|
+
*
|
|
4036
|
+
* @param params - The token to query and the delegate whose allowance is being read.
|
|
4037
|
+
* @param ctx - Operation context with compile-time validated address requirements.
|
|
4038
|
+
* @returns A promise resolving to the current allowance in the token's base units.
|
|
4039
|
+
* @throws {KitError} When the adapter does not register a `token.allowance` handler.
|
|
4040
|
+
* @throws Error When the operation context or action handler fails.
|
|
4041
|
+
*
|
|
4042
|
+
* @example
|
|
4043
|
+
* ```typescript
|
|
4044
|
+
* import type { Adapter } from '@core/adapter'
|
|
4045
|
+
* import { Ethereum } from '@core/chains'
|
|
4046
|
+
*
|
|
4047
|
+
* declare const adapter: Adapter
|
|
4048
|
+
*
|
|
4049
|
+
* const allowance = await adapter.getTokenAllowance(
|
|
4050
|
+
* {
|
|
4051
|
+
* tokenAddress: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
|
|
4052
|
+
* delegate: '0x1111111111111111111111111111111111111111',
|
|
4053
|
+
* },
|
|
4054
|
+
* { chain: Ethereum },
|
|
4055
|
+
* )
|
|
4056
|
+
* console.log(allowance) // 1000000n
|
|
4057
|
+
* ```
|
|
4058
|
+
*/
|
|
4059
|
+
getTokenAllowance(params: ActionPayload<'token.allowance'>, ctx: OperationContext<TAdapterCapabilities>): Promise<bigint>;
|
|
3957
4060
|
/**
|
|
3958
4061
|
* Prepares a transaction for future gas estimation and execution.
|
|
3959
4062
|
*
|
|
@@ -5883,6 +5986,30 @@ type BridgeDestination<TAdapterCapabilities extends AdapterCapabilities = Adapte
|
|
|
5883
5986
|
useForwarder?: boolean;
|
|
5884
5987
|
}) | ForwarderDestination<TChainIdentifier>;
|
|
5885
5988
|
|
|
5989
|
+
/**
|
|
5990
|
+
* Configure how CCTP and forwarding fees are collected for a bridge.
|
|
5991
|
+
*
|
|
5992
|
+
* @remarks
|
|
5993
|
+
* Use `'source'` with `to.useForwarder: true` to treat `amount` as the exact
|
|
5994
|
+
* destination amount. Bridge Kit obtains a signed fee quote, collects the fee
|
|
5995
|
+
* in source-chain USDC, and leaves the destination mint unreduced. Omit the
|
|
5996
|
+
* option (or use `'destination'`) to preserve the existing max-fee behavior.
|
|
5997
|
+
*
|
|
5998
|
+
* @example
|
|
5999
|
+
* ```typescript
|
|
6000
|
+
* import type { BridgeExecutionConfig } from '@circle-fin/bridge-kit'
|
|
6001
|
+
*
|
|
6002
|
+
* const config: BridgeExecutionConfig = {
|
|
6003
|
+
* transferSpeed: 'FAST',
|
|
6004
|
+
* feePayment: 'source',
|
|
6005
|
+
* }
|
|
6006
|
+
* ```
|
|
6007
|
+
* @since 1.14.0
|
|
6008
|
+
*/
|
|
6009
|
+
interface BridgeExecutionConfig extends BridgeConfig {
|
|
6010
|
+
/** Select source-side signed fees or the legacy destination-side fee path. */
|
|
6011
|
+
feePayment?: 'source' | 'destination';
|
|
6012
|
+
}
|
|
5886
6013
|
type FeeFunction<TFromAdapterCapabilities extends AdapterCapabilities, TToAdapterCapabilities extends AdapterCapabilities> = (params: BridgeParams$1<TFromAdapterCapabilities, TToAdapterCapabilities>) => Promise<string> | string;
|
|
5887
6014
|
type FeeRecipientFunction<TFromAdapterCapabilities extends AdapterCapabilities, TToAdapterCapabilities extends AdapterCapabilities> = (feePayoutChain: ChainDefinition, params: BridgeParams$1<TFromAdapterCapabilities, TToAdapterCapabilities>) => Promise<string> | string;
|
|
5888
6015
|
/**
|
|
@@ -6043,7 +6170,7 @@ interface BridgeParams<TFromAdapterCapabilities extends AdapterCapabilities = Ad
|
|
|
6043
6170
|
* Optional bridge configuration (e.g., transfer speed).
|
|
6044
6171
|
* If omitted, defaults will be used
|
|
6045
6172
|
*/
|
|
6046
|
-
config?:
|
|
6173
|
+
config?: BridgeExecutionConfig;
|
|
6047
6174
|
/**
|
|
6048
6175
|
* The token to transfer. Defaults to 'USDC'.
|
|
6049
6176
|
* If omitted, the provider will use 'USDC' by default.
|
|
@@ -6070,6 +6197,16 @@ interface BridgeParams<TFromAdapterCapabilities extends AdapterCapabilities = Ad
|
|
|
6070
6197
|
* ```
|
|
6071
6198
|
*/
|
|
6072
6199
|
invocationMeta?: InvocationMeta;
|
|
6200
|
+
/**
|
|
6201
|
+
* Reuse the opaque signed quote returned by a receive-exact estimate.
|
|
6202
|
+
*
|
|
6203
|
+
* @remarks
|
|
6204
|
+
* Bridge Kit validates a supplied quote against the exact transfer and fails
|
|
6205
|
+
* when it is invalid, mismatched, expired, or too close to expiry. Omit this
|
|
6206
|
+
* value to let Bridge Kit fetch a fresh quote automatically. Never log or
|
|
6207
|
+
* decode it.
|
|
6208
|
+
*/
|
|
6209
|
+
quote?: string;
|
|
6073
6210
|
}
|
|
6074
6211
|
|
|
6075
6212
|
/**
|
|
@@ -6185,12 +6322,21 @@ interface ServiceSwapConfig {
|
|
|
6185
6322
|
recipientAddress?: string;
|
|
6186
6323
|
};
|
|
6187
6324
|
/**
|
|
6188
|
-
*
|
|
6189
|
-
*
|
|
6325
|
+
* Circle API key used to authenticate service-backed swap requests.
|
|
6326
|
+
*
|
|
6327
|
+
* Format: `<ENV>_API_KEY:<keyId>:<keySecret>`. A legacy
|
|
6328
|
+
* `KIT_KEY:<keyId>:<keySecret>` value is also accepted.
|
|
6190
6329
|
*
|
|
6191
6330
|
* Treat this value as a credential. Do not log it, embed it in client-side
|
|
6192
6331
|
* source, or expose it in telemetry.
|
|
6193
6332
|
*/
|
|
6333
|
+
apiKey?: string | undefined;
|
|
6334
|
+
/**
|
|
6335
|
+
* Circle API key used to authenticate service-backed swap requests.
|
|
6336
|
+
*
|
|
6337
|
+
* @deprecated Use {@link ServiceSwapConfig.apiKey} instead. Still honored
|
|
6338
|
+
* when `apiKey` is omitted, and `apiKey` takes precedence when both are set.
|
|
6339
|
+
*/
|
|
6194
6340
|
kitKey?: string;
|
|
6195
6341
|
/**
|
|
6196
6342
|
* DEX aggregator identifier used to source the swap route.
|
|
@@ -6668,12 +6814,21 @@ interface SwapConfig {
|
|
|
6668
6814
|
recipientAddress: string;
|
|
6669
6815
|
};
|
|
6670
6816
|
/**
|
|
6671
|
-
*
|
|
6672
|
-
*
|
|
6817
|
+
* Circle API key used to authenticate service-backed swap requests.
|
|
6818
|
+
*
|
|
6819
|
+
* Format: `<ENV>_API_KEY:<keyId>:<keySecret>`. A legacy
|
|
6820
|
+
* `KIT_KEY:<keyId>:<keySecret>` value is also accepted.
|
|
6673
6821
|
*
|
|
6674
6822
|
* Treat this value as a credential. Do not log it, embed it in client-side
|
|
6675
6823
|
* source, or expose it in telemetry.
|
|
6676
6824
|
*/
|
|
6825
|
+
apiKey?: string | undefined;
|
|
6826
|
+
/**
|
|
6827
|
+
* Circle API key used to authenticate service-backed swap requests.
|
|
6828
|
+
*
|
|
6829
|
+
* @deprecated Use {@link SwapConfig.apiKey} instead. Still honored when
|
|
6830
|
+
* `apiKey` is omitted, and `apiKey` takes precedence when both are set.
|
|
6831
|
+
*/
|
|
6677
6832
|
kitKey?: string;
|
|
6678
6833
|
}
|
|
6679
6834
|
/**
|
|
@@ -6802,29 +6957,37 @@ type EarnAdapterContext<TAdapterCapabilities extends AdapterCapabilities = Adapt
|
|
|
6802
6957
|
* Configuration options for earn operations.
|
|
6803
6958
|
*
|
|
6804
6959
|
* EarnKit supports dual-mode authentication: operations work both with
|
|
6805
|
-
* and without
|
|
6960
|
+
* and without an API key. When present, the API key enables permissioned
|
|
6806
6961
|
* features like integrator attribution tracking.
|
|
6807
6962
|
*
|
|
6808
6963
|
* @example
|
|
6809
6964
|
* ```typescript
|
|
6810
|
-
* // Permissionless (no
|
|
6965
|
+
* // Permissionless (no API key)
|
|
6811
6966
|
* const config: EarnConfig = {}
|
|
6812
6967
|
*
|
|
6813
|
-
* // Permissioned (with
|
|
6968
|
+
* // Permissioned (with API key)
|
|
6814
6969
|
* const config: EarnConfig = {
|
|
6815
|
-
*
|
|
6970
|
+
* apiKey: 'TEST_API_KEY:keyId:keySecret',
|
|
6816
6971
|
* }
|
|
6817
6972
|
* ```
|
|
6818
6973
|
*/
|
|
6819
6974
|
interface EarnConfig {
|
|
6820
6975
|
/**
|
|
6821
|
-
* Optional
|
|
6976
|
+
* Optional Circle API key for permissioned access.
|
|
6822
6977
|
*
|
|
6823
6978
|
* When provided, enables integrator attribution tracking and
|
|
6824
6979
|
* higher rate limits. When omitted, the SDK operates in
|
|
6825
6980
|
* permissionless mode.
|
|
6826
6981
|
*
|
|
6827
|
-
* Format:
|
|
6982
|
+
* Format: `<ENV>_API_KEY:<keyId>:<keySecret>`. A legacy
|
|
6983
|
+
* `KIT_KEY:<keyId>:<keySecret>` value is also accepted.
|
|
6984
|
+
*/
|
|
6985
|
+
readonly apiKey?: string | undefined;
|
|
6986
|
+
/**
|
|
6987
|
+
* Optional Circle API key for permissioned access.
|
|
6988
|
+
*
|
|
6989
|
+
* @deprecated Use {@link EarnConfig.apiKey} instead. Still honored when
|
|
6990
|
+
* `apiKey` is omitted, and `apiKey` takes precedence when both are set.
|
|
6828
6991
|
*/
|
|
6829
6992
|
readonly kitKey?: string | undefined;
|
|
6830
6993
|
/**
|
|
@@ -7591,13 +7754,18 @@ interface AppKitContext {
|
|
|
7591
7754
|
*/
|
|
7592
7755
|
disableErrorReporting?: boolean;
|
|
7593
7756
|
/**
|
|
7594
|
-
* Custom HTTP headers forwarded with
|
|
7595
|
-
* attestation (Iris)
|
|
7757
|
+
* Custom HTTP headers forwarded with Circle API requests made by the
|
|
7758
|
+
* underlying kits: the CCTP provider's attestation (Iris) requests for
|
|
7759
|
+
* bridge operations, and the Gateway API requests for unified-balance
|
|
7760
|
+
* operations.
|
|
7596
7761
|
*
|
|
7597
7762
|
* @remarks
|
|
7598
7763
|
* Headers are merged on top of the SDK defaults (such as `Content-Type`)
|
|
7599
|
-
* rather than replacing them.
|
|
7600
|
-
* the SDK does not interpret it.
|
|
7764
|
+
* rather than replacing them. Each header is forwarded as-is to Circle's API;
|
|
7765
|
+
* the SDK does not interpret it. The same map is forwarded to every relevant
|
|
7766
|
+
* kit, so a header a given API ignores is simply a no-op there. A
|
|
7767
|
+
* `unifiedBalance.headers` value, if provided, takes precedence for the
|
|
7768
|
+
* unified-balance kit.
|
|
7601
7769
|
*/
|
|
7602
7770
|
headers?: Record<string, string>;
|
|
7603
7771
|
}
|
|
@@ -7635,7 +7803,7 @@ interface AppKitContext {
|
|
|
7635
7803
|
* token: 'USDC'
|
|
7636
7804
|
* })
|
|
7637
7805
|
*
|
|
7638
|
-
* console.log(
|
|
7806
|
+
* console.log(`Bridged ${result.amount} ${result.token} (${result.state})`)
|
|
7639
7807
|
* ```
|
|
7640
7808
|
*/
|
|
7641
7809
|
declare const bridge: (context: AppKitContext, params: BridgeParams) => Promise<BridgeResult>;
|
package/bridge.d.mts
CHANGED
|
@@ -718,6 +718,8 @@ declare enum Blockchain {
|
|
|
718
718
|
Optimism_Sepolia = "Optimism_Sepolia",
|
|
719
719
|
Pharos = "Pharos",
|
|
720
720
|
Pharos_Testnet = "Pharos_Testnet",
|
|
721
|
+
Plasma = "Plasma",
|
|
722
|
+
Plasma_Testnet = "Plasma_Testnet",
|
|
721
723
|
Polkadot_Asset_Hub = "Polkadot_Asset_Hub",
|
|
722
724
|
Polkadot_Westmint = "Polkadot_Westmint",
|
|
723
725
|
Plume = "Plume",
|
|
@@ -946,6 +948,7 @@ declare enum BridgeChain {
|
|
|
946
948
|
Morph = "Morph",
|
|
947
949
|
Optimism = "Optimism",
|
|
948
950
|
Pharos = "Pharos",
|
|
951
|
+
Plasma = "Plasma",
|
|
949
952
|
Plume = "Plume",
|
|
950
953
|
Polygon = "Polygon",
|
|
951
954
|
Sei = "Sei",
|
|
@@ -971,6 +974,7 @@ declare enum BridgeChain {
|
|
|
971
974
|
Morph_Testnet = "Morph_Testnet",
|
|
972
975
|
Optimism_Sepolia = "Optimism_Sepolia",
|
|
973
976
|
Pharos_Testnet = "Pharos_Testnet",
|
|
977
|
+
Plasma_Testnet = "Plasma_Testnet",
|
|
974
978
|
Plume_Testnet = "Plume_Testnet",
|
|
975
979
|
Polygon_Amoy_Testnet = "Polygon_Amoy_Testnet",
|
|
976
980
|
Sei_Testnet = "Sei_Testnet",
|
|
@@ -2652,7 +2656,7 @@ interface ExecuteParams {
|
|
|
2652
2656
|
* fromAddress: '0x...',
|
|
2653
2657
|
* toAddress: '0x...',
|
|
2654
2658
|
* amount: '1000000',
|
|
2655
|
-
* apiKey: '
|
|
2659
|
+
* apiKey: 'TEST_API_KEY:...',
|
|
2656
2660
|
* })
|
|
2657
2661
|
*
|
|
2658
2662
|
* // Build token inputs with permit
|
|
@@ -2796,7 +2800,7 @@ interface ExecuteSwapEVMParams extends ActionParameters {
|
|
|
2796
2800
|
* fromAddress: 'YubQzu18FDqJRyNfG8JqHmsdbxhnoQqcKUHBdUkN6tP',
|
|
2797
2801
|
* toAddress: 'YubQzu18FDqJRyNfG8JqHmsdbxhnoQqcKUHBdUkN6tP',
|
|
2798
2802
|
* amount: '1000000',
|
|
2799
|
-
* apiKey: '
|
|
2803
|
+
* apiKey: 'TEST_API_KEY:...',
|
|
2800
2804
|
* })
|
|
2801
2805
|
*
|
|
2802
2806
|
* // Prepare action parameters
|
|
@@ -2957,6 +2961,18 @@ interface TokenActionMap {
|
|
|
2957
2961
|
*/
|
|
2958
2962
|
walletAddress?: string | undefined;
|
|
2959
2963
|
};
|
|
2964
|
+
/**
|
|
2965
|
+
* Get the on-chain name of the token contract.
|
|
2966
|
+
*
|
|
2967
|
+
* This is a read-only operation. For USDC the value is also the EIP-712
|
|
2968
|
+
* domain name, which permit and authorize signing flows need.
|
|
2969
|
+
*/
|
|
2970
|
+
name: ActionParameters & {
|
|
2971
|
+
/**
|
|
2972
|
+
* The contract address of the token.
|
|
2973
|
+
*/
|
|
2974
|
+
tokenAddress: string;
|
|
2975
|
+
};
|
|
2960
2976
|
}
|
|
2961
2977
|
|
|
2962
2978
|
/**
|
|
@@ -3786,6 +3802,30 @@ declare class ActionRegistry {
|
|
|
3786
3802
|
executeAction<TActionKey extends ActionKeys>(action: TActionKey, params: ActionPayload<TActionKey>, context: ResolvedOperationContext): Promise<PreparedChainRequest>;
|
|
3787
3803
|
}
|
|
3788
3804
|
|
|
3805
|
+
/**
|
|
3806
|
+
* Canonical list of actions that do not prepare or submit transactions.
|
|
3807
|
+
*
|
|
3808
|
+
* @internal
|
|
3809
|
+
*/
|
|
3810
|
+
declare const READ_ACTION_KEYS: readonly ["token.allowance", "token.balanceOf", "token.name", "native.balanceOf", "usdc.allowance", "usdc.balanceOf", "usdc.name", "gateway.v1.isDelegate", "gateway.v1.withdrawingBalance", "gateway.v1.withdrawalBlock", "gateway.v1.signBurnIntents"];
|
|
3811
|
+
/**
|
|
3812
|
+
* Action keys that execute without preparing or submitting a transaction.
|
|
3813
|
+
*
|
|
3814
|
+
* @remarks
|
|
3815
|
+
* Derive this type from the canonical runtime list so compile-time and runtime
|
|
3816
|
+
* classification cannot drift. `gateway.v1.signBurnIntents` is included
|
|
3817
|
+
* because the action system models off-chain signing as a read action: it does
|
|
3818
|
+
* not prepare a chain request.
|
|
3819
|
+
*
|
|
3820
|
+
* @example
|
|
3821
|
+
* ```typescript
|
|
3822
|
+
* import type { ReadActionKey } from '@core/adapter'
|
|
3823
|
+
*
|
|
3824
|
+
* const action: ReadActionKey = 'token.allowance'
|
|
3825
|
+
* ```
|
|
3826
|
+
*/
|
|
3827
|
+
type ReadActionKey = (typeof READ_ACTION_KEYS)[number];
|
|
3828
|
+
|
|
3789
3829
|
/**
|
|
3790
3830
|
* Defines the capabilities of an adapter, including address handling patterns and supported chains.
|
|
3791
3831
|
*
|
|
@@ -3954,6 +3994,69 @@ declare abstract class Adapter<TAdapterCapabilities extends AdapterCapabilities
|
|
|
3954
3994
|
* ```
|
|
3955
3995
|
*/
|
|
3956
3996
|
prepareAction<TActionKey extends ActionKeys>(action: TActionKey, params: ActionPayload<TActionKey>, ctx: OperationContext<TAdapterCapabilities>): Promise<PreparedChainRequest>;
|
|
3997
|
+
/**
|
|
3998
|
+
* Execute a non-transaction action without routing through transaction preparation.
|
|
3999
|
+
*
|
|
4000
|
+
* @remarks
|
|
4001
|
+
* Use this seam for balance, allowance, contract-state, and other actions
|
|
4002
|
+
* classified as reads. It never calls {@link Adapter.prepareAction}, so
|
|
4003
|
+
* transaction authorization wrappers only observe actions that can produce a
|
|
4004
|
+
* signable chain request.
|
|
4005
|
+
*
|
|
4006
|
+
* @typeParam TActionKey - The read action key.
|
|
4007
|
+
* @param action - The read action to execute.
|
|
4008
|
+
* @param params - The parameters for the read action.
|
|
4009
|
+
* @param ctx - The operation context.
|
|
4010
|
+
* @returns The raw action response.
|
|
4011
|
+
* @throws {KitError} When the key is not a read action or no handler is registered.
|
|
4012
|
+
* @throws Error When the operation context or action handler fails.
|
|
4013
|
+
*
|
|
4014
|
+
* @example
|
|
4015
|
+
* ```typescript
|
|
4016
|
+
* import { Ethereum } from '@core/chains'
|
|
4017
|
+
*
|
|
4018
|
+
* const balance = await adapter.readAction(
|
|
4019
|
+
* 'token.balanceOf',
|
|
4020
|
+
* { tokenAddress, walletAddress },
|
|
4021
|
+
* { chain: Ethereum },
|
|
4022
|
+
* )
|
|
4023
|
+
* ```
|
|
4024
|
+
*
|
|
4025
|
+
* @internal
|
|
4026
|
+
*/
|
|
4027
|
+
readAction<TActionKey extends ReadActionKey>(action: TActionKey, params: ActionPayload<TActionKey>, ctx: OperationContext<TAdapterCapabilities>): Promise<unknown>;
|
|
4028
|
+
/**
|
|
4029
|
+
* Read the current token allowance a delegate holds over an owner's tokens.
|
|
4030
|
+
*
|
|
4031
|
+
* @remarks
|
|
4032
|
+
* Perform a network read through {@link Adapter.readAction}. This method
|
|
4033
|
+
* never routes through {@link Adapter.prepareAction}. On chains without an
|
|
4034
|
+
* allowance model, such as Solana, return the maximum uint256 value.
|
|
4035
|
+
*
|
|
4036
|
+
* @param params - The token to query and the delegate whose allowance is being read.
|
|
4037
|
+
* @param ctx - Operation context with compile-time validated address requirements.
|
|
4038
|
+
* @returns A promise resolving to the current allowance in the token's base units.
|
|
4039
|
+
* @throws {KitError} When the adapter does not register a `token.allowance` handler.
|
|
4040
|
+
* @throws Error When the operation context or action handler fails.
|
|
4041
|
+
*
|
|
4042
|
+
* @example
|
|
4043
|
+
* ```typescript
|
|
4044
|
+
* import type { Adapter } from '@core/adapter'
|
|
4045
|
+
* import { Ethereum } from '@core/chains'
|
|
4046
|
+
*
|
|
4047
|
+
* declare const adapter: Adapter
|
|
4048
|
+
*
|
|
4049
|
+
* const allowance = await adapter.getTokenAllowance(
|
|
4050
|
+
* {
|
|
4051
|
+
* tokenAddress: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
|
|
4052
|
+
* delegate: '0x1111111111111111111111111111111111111111',
|
|
4053
|
+
* },
|
|
4054
|
+
* { chain: Ethereum },
|
|
4055
|
+
* )
|
|
4056
|
+
* console.log(allowance) // 1000000n
|
|
4057
|
+
* ```
|
|
4058
|
+
*/
|
|
4059
|
+
getTokenAllowance(params: ActionPayload<'token.allowance'>, ctx: OperationContext<TAdapterCapabilities>): Promise<bigint>;
|
|
3957
4060
|
/**
|
|
3958
4061
|
* Prepares a transaction for future gas estimation and execution.
|
|
3959
4062
|
*
|
|
@@ -5883,6 +5986,30 @@ type BridgeDestination<TAdapterCapabilities extends AdapterCapabilities = Adapte
|
|
|
5883
5986
|
useForwarder?: boolean;
|
|
5884
5987
|
}) | ForwarderDestination<TChainIdentifier>;
|
|
5885
5988
|
|
|
5989
|
+
/**
|
|
5990
|
+
* Configure how CCTP and forwarding fees are collected for a bridge.
|
|
5991
|
+
*
|
|
5992
|
+
* @remarks
|
|
5993
|
+
* Use `'source'` with `to.useForwarder: true` to treat `amount` as the exact
|
|
5994
|
+
* destination amount. Bridge Kit obtains a signed fee quote, collects the fee
|
|
5995
|
+
* in source-chain USDC, and leaves the destination mint unreduced. Omit the
|
|
5996
|
+
* option (or use `'destination'`) to preserve the existing max-fee behavior.
|
|
5997
|
+
*
|
|
5998
|
+
* @example
|
|
5999
|
+
* ```typescript
|
|
6000
|
+
* import type { BridgeExecutionConfig } from '@circle-fin/bridge-kit'
|
|
6001
|
+
*
|
|
6002
|
+
* const config: BridgeExecutionConfig = {
|
|
6003
|
+
* transferSpeed: 'FAST',
|
|
6004
|
+
* feePayment: 'source',
|
|
6005
|
+
* }
|
|
6006
|
+
* ```
|
|
6007
|
+
* @since 1.14.0
|
|
6008
|
+
*/
|
|
6009
|
+
interface BridgeExecutionConfig extends BridgeConfig {
|
|
6010
|
+
/** Select source-side signed fees or the legacy destination-side fee path. */
|
|
6011
|
+
feePayment?: 'source' | 'destination';
|
|
6012
|
+
}
|
|
5886
6013
|
type FeeFunction<TFromAdapterCapabilities extends AdapterCapabilities, TToAdapterCapabilities extends AdapterCapabilities> = (params: BridgeParams$1<TFromAdapterCapabilities, TToAdapterCapabilities>) => Promise<string> | string;
|
|
5887
6014
|
type FeeRecipientFunction<TFromAdapterCapabilities extends AdapterCapabilities, TToAdapterCapabilities extends AdapterCapabilities> = (feePayoutChain: ChainDefinition, params: BridgeParams$1<TFromAdapterCapabilities, TToAdapterCapabilities>) => Promise<string> | string;
|
|
5888
6015
|
/**
|
|
@@ -6043,7 +6170,7 @@ interface BridgeParams<TFromAdapterCapabilities extends AdapterCapabilities = Ad
|
|
|
6043
6170
|
* Optional bridge configuration (e.g., transfer speed).
|
|
6044
6171
|
* If omitted, defaults will be used
|
|
6045
6172
|
*/
|
|
6046
|
-
config?:
|
|
6173
|
+
config?: BridgeExecutionConfig;
|
|
6047
6174
|
/**
|
|
6048
6175
|
* The token to transfer. Defaults to 'USDC'.
|
|
6049
6176
|
* If omitted, the provider will use 'USDC' by default.
|
|
@@ -6070,6 +6197,16 @@ interface BridgeParams<TFromAdapterCapabilities extends AdapterCapabilities = Ad
|
|
|
6070
6197
|
* ```
|
|
6071
6198
|
*/
|
|
6072
6199
|
invocationMeta?: InvocationMeta;
|
|
6200
|
+
/**
|
|
6201
|
+
* Reuse the opaque signed quote returned by a receive-exact estimate.
|
|
6202
|
+
*
|
|
6203
|
+
* @remarks
|
|
6204
|
+
* Bridge Kit validates a supplied quote against the exact transfer and fails
|
|
6205
|
+
* when it is invalid, mismatched, expired, or too close to expiry. Omit this
|
|
6206
|
+
* value to let Bridge Kit fetch a fresh quote automatically. Never log or
|
|
6207
|
+
* decode it.
|
|
6208
|
+
*/
|
|
6209
|
+
quote?: string;
|
|
6073
6210
|
}
|
|
6074
6211
|
|
|
6075
6212
|
/**
|
|
@@ -6185,12 +6322,21 @@ interface ServiceSwapConfig {
|
|
|
6185
6322
|
recipientAddress?: string;
|
|
6186
6323
|
};
|
|
6187
6324
|
/**
|
|
6188
|
-
*
|
|
6189
|
-
*
|
|
6325
|
+
* Circle API key used to authenticate service-backed swap requests.
|
|
6326
|
+
*
|
|
6327
|
+
* Format: `<ENV>_API_KEY:<keyId>:<keySecret>`. A legacy
|
|
6328
|
+
* `KIT_KEY:<keyId>:<keySecret>` value is also accepted.
|
|
6190
6329
|
*
|
|
6191
6330
|
* Treat this value as a credential. Do not log it, embed it in client-side
|
|
6192
6331
|
* source, or expose it in telemetry.
|
|
6193
6332
|
*/
|
|
6333
|
+
apiKey?: string | undefined;
|
|
6334
|
+
/**
|
|
6335
|
+
* Circle API key used to authenticate service-backed swap requests.
|
|
6336
|
+
*
|
|
6337
|
+
* @deprecated Use {@link ServiceSwapConfig.apiKey} instead. Still honored
|
|
6338
|
+
* when `apiKey` is omitted, and `apiKey` takes precedence when both are set.
|
|
6339
|
+
*/
|
|
6194
6340
|
kitKey?: string;
|
|
6195
6341
|
/**
|
|
6196
6342
|
* DEX aggregator identifier used to source the swap route.
|
|
@@ -6668,12 +6814,21 @@ interface SwapConfig {
|
|
|
6668
6814
|
recipientAddress: string;
|
|
6669
6815
|
};
|
|
6670
6816
|
/**
|
|
6671
|
-
*
|
|
6672
|
-
*
|
|
6817
|
+
* Circle API key used to authenticate service-backed swap requests.
|
|
6818
|
+
*
|
|
6819
|
+
* Format: `<ENV>_API_KEY:<keyId>:<keySecret>`. A legacy
|
|
6820
|
+
* `KIT_KEY:<keyId>:<keySecret>` value is also accepted.
|
|
6673
6821
|
*
|
|
6674
6822
|
* Treat this value as a credential. Do not log it, embed it in client-side
|
|
6675
6823
|
* source, or expose it in telemetry.
|
|
6676
6824
|
*/
|
|
6825
|
+
apiKey?: string | undefined;
|
|
6826
|
+
/**
|
|
6827
|
+
* Circle API key used to authenticate service-backed swap requests.
|
|
6828
|
+
*
|
|
6829
|
+
* @deprecated Use {@link SwapConfig.apiKey} instead. Still honored when
|
|
6830
|
+
* `apiKey` is omitted, and `apiKey` takes precedence when both are set.
|
|
6831
|
+
*/
|
|
6677
6832
|
kitKey?: string;
|
|
6678
6833
|
}
|
|
6679
6834
|
/**
|
|
@@ -6802,29 +6957,37 @@ type EarnAdapterContext<TAdapterCapabilities extends AdapterCapabilities = Adapt
|
|
|
6802
6957
|
* Configuration options for earn operations.
|
|
6803
6958
|
*
|
|
6804
6959
|
* EarnKit supports dual-mode authentication: operations work both with
|
|
6805
|
-
* and without
|
|
6960
|
+
* and without an API key. When present, the API key enables permissioned
|
|
6806
6961
|
* features like integrator attribution tracking.
|
|
6807
6962
|
*
|
|
6808
6963
|
* @example
|
|
6809
6964
|
* ```typescript
|
|
6810
|
-
* // Permissionless (no
|
|
6965
|
+
* // Permissionless (no API key)
|
|
6811
6966
|
* const config: EarnConfig = {}
|
|
6812
6967
|
*
|
|
6813
|
-
* // Permissioned (with
|
|
6968
|
+
* // Permissioned (with API key)
|
|
6814
6969
|
* const config: EarnConfig = {
|
|
6815
|
-
*
|
|
6970
|
+
* apiKey: 'TEST_API_KEY:keyId:keySecret',
|
|
6816
6971
|
* }
|
|
6817
6972
|
* ```
|
|
6818
6973
|
*/
|
|
6819
6974
|
interface EarnConfig {
|
|
6820
6975
|
/**
|
|
6821
|
-
* Optional
|
|
6976
|
+
* Optional Circle API key for permissioned access.
|
|
6822
6977
|
*
|
|
6823
6978
|
* When provided, enables integrator attribution tracking and
|
|
6824
6979
|
* higher rate limits. When omitted, the SDK operates in
|
|
6825
6980
|
* permissionless mode.
|
|
6826
6981
|
*
|
|
6827
|
-
* Format:
|
|
6982
|
+
* Format: `<ENV>_API_KEY:<keyId>:<keySecret>`. A legacy
|
|
6983
|
+
* `KIT_KEY:<keyId>:<keySecret>` value is also accepted.
|
|
6984
|
+
*/
|
|
6985
|
+
readonly apiKey?: string | undefined;
|
|
6986
|
+
/**
|
|
6987
|
+
* Optional Circle API key for permissioned access.
|
|
6988
|
+
*
|
|
6989
|
+
* @deprecated Use {@link EarnConfig.apiKey} instead. Still honored when
|
|
6990
|
+
* `apiKey` is omitted, and `apiKey` takes precedence when both are set.
|
|
6828
6991
|
*/
|
|
6829
6992
|
readonly kitKey?: string | undefined;
|
|
6830
6993
|
/**
|
|
@@ -7591,13 +7754,18 @@ interface AppKitContext {
|
|
|
7591
7754
|
*/
|
|
7592
7755
|
disableErrorReporting?: boolean;
|
|
7593
7756
|
/**
|
|
7594
|
-
* Custom HTTP headers forwarded with
|
|
7595
|
-
* attestation (Iris)
|
|
7757
|
+
* Custom HTTP headers forwarded with Circle API requests made by the
|
|
7758
|
+
* underlying kits: the CCTP provider's attestation (Iris) requests for
|
|
7759
|
+
* bridge operations, and the Gateway API requests for unified-balance
|
|
7760
|
+
* operations.
|
|
7596
7761
|
*
|
|
7597
7762
|
* @remarks
|
|
7598
7763
|
* Headers are merged on top of the SDK defaults (such as `Content-Type`)
|
|
7599
|
-
* rather than replacing them.
|
|
7600
|
-
* the SDK does not interpret it.
|
|
7764
|
+
* rather than replacing them. Each header is forwarded as-is to Circle's API;
|
|
7765
|
+
* the SDK does not interpret it. The same map is forwarded to every relevant
|
|
7766
|
+
* kit, so a header a given API ignores is simply a no-op there. A
|
|
7767
|
+
* `unifiedBalance.headers` value, if provided, takes precedence for the
|
|
7768
|
+
* unified-balance kit.
|
|
7601
7769
|
*/
|
|
7602
7770
|
headers?: Record<string, string>;
|
|
7603
7771
|
}
|
|
@@ -7635,7 +7803,7 @@ interface AppKitContext {
|
|
|
7635
7803
|
* token: 'USDC'
|
|
7636
7804
|
* })
|
|
7637
7805
|
*
|
|
7638
|
-
* console.log(
|
|
7806
|
+
* console.log(`Bridged ${result.amount} ${result.token} (${result.state})`)
|
|
7639
7807
|
* ```
|
|
7640
7808
|
*/
|
|
7641
7809
|
declare const bridge: (context: AppKitContext, params: BridgeParams) => Promise<BridgeResult>;
|