@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/swap.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
|
*
|
|
@@ -5810,12 +5913,21 @@ interface ServiceSwapConfig {
|
|
|
5810
5913
|
recipientAddress?: string;
|
|
5811
5914
|
};
|
|
5812
5915
|
/**
|
|
5813
|
-
*
|
|
5814
|
-
*
|
|
5916
|
+
* Circle API key used to authenticate service-backed swap requests.
|
|
5917
|
+
*
|
|
5918
|
+
* Format: `<ENV>_API_KEY:<keyId>:<keySecret>`. A legacy
|
|
5919
|
+
* `KIT_KEY:<keyId>:<keySecret>` value is also accepted.
|
|
5815
5920
|
*
|
|
5816
5921
|
* Treat this value as a credential. Do not log it, embed it in client-side
|
|
5817
5922
|
* source, or expose it in telemetry.
|
|
5818
5923
|
*/
|
|
5924
|
+
apiKey?: string | undefined;
|
|
5925
|
+
/**
|
|
5926
|
+
* Circle API key used to authenticate service-backed swap requests.
|
|
5927
|
+
*
|
|
5928
|
+
* @deprecated Use {@link ServiceSwapConfig.apiKey} instead. Still honored
|
|
5929
|
+
* when `apiKey` is omitted, and `apiKey` takes precedence when both are set.
|
|
5930
|
+
*/
|
|
5819
5931
|
kitKey?: string;
|
|
5820
5932
|
/**
|
|
5821
5933
|
* DEX aggregator identifier used to source the swap route.
|
|
@@ -6346,12 +6458,21 @@ interface SwapConfig {
|
|
|
6346
6458
|
recipientAddress: string;
|
|
6347
6459
|
};
|
|
6348
6460
|
/**
|
|
6349
|
-
*
|
|
6350
|
-
*
|
|
6461
|
+
* Circle API key used to authenticate service-backed swap requests.
|
|
6462
|
+
*
|
|
6463
|
+
* Format: `<ENV>_API_KEY:<keyId>:<keySecret>`. A legacy
|
|
6464
|
+
* `KIT_KEY:<keyId>:<keySecret>` value is also accepted.
|
|
6351
6465
|
*
|
|
6352
6466
|
* Treat this value as a credential. Do not log it, embed it in client-side
|
|
6353
6467
|
* source, or expose it in telemetry.
|
|
6354
6468
|
*/
|
|
6469
|
+
apiKey?: string | undefined;
|
|
6470
|
+
/**
|
|
6471
|
+
* Circle API key used to authenticate service-backed swap requests.
|
|
6472
|
+
*
|
|
6473
|
+
* @deprecated Use {@link SwapConfig.apiKey} instead. Still honored when
|
|
6474
|
+
* `apiKey` is omitted, and `apiKey` takes precedence when both are set.
|
|
6475
|
+
*/
|
|
6355
6476
|
kitKey?: string;
|
|
6356
6477
|
}
|
|
6357
6478
|
/**
|
|
@@ -6391,7 +6512,13 @@ interface ResolvedSwapConfig extends Omit<SwapConfig, 'customFee'> {
|
|
|
6391
6512
|
recipientAddress?: string;
|
|
6392
6513
|
};
|
|
6393
6514
|
}
|
|
6394
|
-
|
|
6515
|
+
/**
|
|
6516
|
+
* Swap config as echoed back on a result, with credentials removed.
|
|
6517
|
+
*
|
|
6518
|
+
* Both credential fields are omitted so a returned {@link SwapResult} can be
|
|
6519
|
+
* logged or serialized without leaking the secret used to authenticate it.
|
|
6520
|
+
*/
|
|
6521
|
+
type SwapResultConfig = Omit<ResolvedSwapConfig, 'apiKey' | 'kitKey'>;
|
|
6395
6522
|
/**
|
|
6396
6523
|
* Result of an executed swap operation.
|
|
6397
6524
|
*
|
|
@@ -6687,6 +6814,30 @@ interface SwapParams<TFromAdapterCapabilities extends AdapterCapabilities = Adap
|
|
|
6687
6814
|
config?: SwapConfig;
|
|
6688
6815
|
}
|
|
6689
6816
|
|
|
6817
|
+
/**
|
|
6818
|
+
* Configure how CCTP and forwarding fees are collected for a bridge.
|
|
6819
|
+
*
|
|
6820
|
+
* @remarks
|
|
6821
|
+
* Use `'source'` with `to.useForwarder: true` to treat `amount` as the exact
|
|
6822
|
+
* destination amount. Bridge Kit obtains a signed fee quote, collects the fee
|
|
6823
|
+
* in source-chain USDC, and leaves the destination mint unreduced. Omit the
|
|
6824
|
+
* option (or use `'destination'`) to preserve the existing max-fee behavior.
|
|
6825
|
+
*
|
|
6826
|
+
* @example
|
|
6827
|
+
* ```typescript
|
|
6828
|
+
* import type { BridgeExecutionConfig } from '@circle-fin/bridge-kit'
|
|
6829
|
+
*
|
|
6830
|
+
* const config: BridgeExecutionConfig = {
|
|
6831
|
+
* transferSpeed: 'FAST',
|
|
6832
|
+
* feePayment: 'source',
|
|
6833
|
+
* }
|
|
6834
|
+
* ```
|
|
6835
|
+
* @since 1.14.0
|
|
6836
|
+
*/
|
|
6837
|
+
interface BridgeExecutionConfig extends BridgeConfig {
|
|
6838
|
+
/** Select source-side signed fees or the legacy destination-side fee path. */
|
|
6839
|
+
feePayment?: 'source' | 'destination';
|
|
6840
|
+
}
|
|
6690
6841
|
type FeeFunction<TFromAdapterCapabilities extends AdapterCapabilities, TToAdapterCapabilities extends AdapterCapabilities> = (params: BridgeParams$1<TFromAdapterCapabilities, TToAdapterCapabilities>) => Promise<string> | string;
|
|
6691
6842
|
type FeeRecipientFunction<TFromAdapterCapabilities extends AdapterCapabilities, TToAdapterCapabilities extends AdapterCapabilities> = (feePayoutChain: ChainDefinition, params: BridgeParams$1<TFromAdapterCapabilities, TToAdapterCapabilities>) => Promise<string> | string;
|
|
6692
6843
|
/**
|
|
@@ -6847,7 +6998,7 @@ interface BridgeParams<TFromAdapterCapabilities extends AdapterCapabilities = Ad
|
|
|
6847
6998
|
* Optional bridge configuration (e.g., transfer speed).
|
|
6848
6999
|
* If omitted, defaults will be used
|
|
6849
7000
|
*/
|
|
6850
|
-
config?:
|
|
7001
|
+
config?: BridgeExecutionConfig;
|
|
6851
7002
|
/**
|
|
6852
7003
|
* The token to transfer. Defaults to 'USDC'.
|
|
6853
7004
|
* If omitted, the provider will use 'USDC' by default.
|
|
@@ -6874,6 +7025,16 @@ interface BridgeParams<TFromAdapterCapabilities extends AdapterCapabilities = Ad
|
|
|
6874
7025
|
* ```
|
|
6875
7026
|
*/
|
|
6876
7027
|
invocationMeta?: InvocationMeta;
|
|
7028
|
+
/**
|
|
7029
|
+
* Reuse the opaque signed quote returned by a receive-exact estimate.
|
|
7030
|
+
*
|
|
7031
|
+
* @remarks
|
|
7032
|
+
* Bridge Kit validates a supplied quote against the exact transfer and fails
|
|
7033
|
+
* when it is invalid, mismatched, expired, or too close to expiry. Omit this
|
|
7034
|
+
* value to let Bridge Kit fetch a fresh quote automatically. Never log or
|
|
7035
|
+
* decode it.
|
|
7036
|
+
*/
|
|
7037
|
+
quote?: string;
|
|
6877
7038
|
}
|
|
6878
7039
|
|
|
6879
7040
|
/**
|
|
@@ -6918,29 +7079,37 @@ type EarnAdapterContext<TAdapterCapabilities extends AdapterCapabilities = Adapt
|
|
|
6918
7079
|
* Configuration options for earn operations.
|
|
6919
7080
|
*
|
|
6920
7081
|
* EarnKit supports dual-mode authentication: operations work both with
|
|
6921
|
-
* and without
|
|
7082
|
+
* and without an API key. When present, the API key enables permissioned
|
|
6922
7083
|
* features like integrator attribution tracking.
|
|
6923
7084
|
*
|
|
6924
7085
|
* @example
|
|
6925
7086
|
* ```typescript
|
|
6926
|
-
* // Permissionless (no
|
|
7087
|
+
* // Permissionless (no API key)
|
|
6927
7088
|
* const config: EarnConfig = {}
|
|
6928
7089
|
*
|
|
6929
|
-
* // Permissioned (with
|
|
7090
|
+
* // Permissioned (with API key)
|
|
6930
7091
|
* const config: EarnConfig = {
|
|
6931
|
-
*
|
|
7092
|
+
* apiKey: 'TEST_API_KEY:keyId:keySecret',
|
|
6932
7093
|
* }
|
|
6933
7094
|
* ```
|
|
6934
7095
|
*/
|
|
6935
7096
|
interface EarnConfig {
|
|
6936
7097
|
/**
|
|
6937
|
-
* Optional
|
|
7098
|
+
* Optional Circle API key for permissioned access.
|
|
6938
7099
|
*
|
|
6939
7100
|
* When provided, enables integrator attribution tracking and
|
|
6940
7101
|
* higher rate limits. When omitted, the SDK operates in
|
|
6941
7102
|
* permissionless mode.
|
|
6942
7103
|
*
|
|
6943
|
-
* Format:
|
|
7104
|
+
* Format: `<ENV>_API_KEY:<keyId>:<keySecret>`. A legacy
|
|
7105
|
+
* `KIT_KEY:<keyId>:<keySecret>` value is also accepted.
|
|
7106
|
+
*/
|
|
7107
|
+
readonly apiKey?: string | undefined;
|
|
7108
|
+
/**
|
|
7109
|
+
* Optional Circle API key for permissioned access.
|
|
7110
|
+
*
|
|
7111
|
+
* @deprecated Use {@link EarnConfig.apiKey} instead. Still honored when
|
|
7112
|
+
* `apiKey` is omitted, and `apiKey` takes precedence when both are set.
|
|
6944
7113
|
*/
|
|
6945
7114
|
readonly kitKey?: string | undefined;
|
|
6946
7115
|
/**
|
|
@@ -7707,13 +7876,18 @@ interface AppKitContext {
|
|
|
7707
7876
|
*/
|
|
7708
7877
|
disableErrorReporting?: boolean;
|
|
7709
7878
|
/**
|
|
7710
|
-
* Custom HTTP headers forwarded with
|
|
7711
|
-
* attestation (Iris)
|
|
7879
|
+
* Custom HTTP headers forwarded with Circle API requests made by the
|
|
7880
|
+
* underlying kits: the CCTP provider's attestation (Iris) requests for
|
|
7881
|
+
* bridge operations, and the Gateway API requests for unified-balance
|
|
7882
|
+
* operations.
|
|
7712
7883
|
*
|
|
7713
7884
|
* @remarks
|
|
7714
7885
|
* Headers are merged on top of the SDK defaults (such as `Content-Type`)
|
|
7715
|
-
* rather than replacing them.
|
|
7716
|
-
* the SDK does not interpret it.
|
|
7886
|
+
* rather than replacing them. Each header is forwarded as-is to Circle's API;
|
|
7887
|
+
* the SDK does not interpret it. The same map is forwarded to every relevant
|
|
7888
|
+
* kit, so a header a given API ignores is simply a no-op there. A
|
|
7889
|
+
* `unifiedBalance.headers` value, if provided, takes precedence for the
|
|
7890
|
+
* unified-balance kit.
|
|
7717
7891
|
*/
|
|
7718
7892
|
headers?: Record<string, string>;
|
|
7719
7893
|
}
|
package/swap.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
|
*
|
|
@@ -5810,12 +5913,21 @@ interface ServiceSwapConfig {
|
|
|
5810
5913
|
recipientAddress?: string;
|
|
5811
5914
|
};
|
|
5812
5915
|
/**
|
|
5813
|
-
*
|
|
5814
|
-
*
|
|
5916
|
+
* Circle API key used to authenticate service-backed swap requests.
|
|
5917
|
+
*
|
|
5918
|
+
* Format: `<ENV>_API_KEY:<keyId>:<keySecret>`. A legacy
|
|
5919
|
+
* `KIT_KEY:<keyId>:<keySecret>` value is also accepted.
|
|
5815
5920
|
*
|
|
5816
5921
|
* Treat this value as a credential. Do not log it, embed it in client-side
|
|
5817
5922
|
* source, or expose it in telemetry.
|
|
5818
5923
|
*/
|
|
5924
|
+
apiKey?: string | undefined;
|
|
5925
|
+
/**
|
|
5926
|
+
* Circle API key used to authenticate service-backed swap requests.
|
|
5927
|
+
*
|
|
5928
|
+
* @deprecated Use {@link ServiceSwapConfig.apiKey} instead. Still honored
|
|
5929
|
+
* when `apiKey` is omitted, and `apiKey` takes precedence when both are set.
|
|
5930
|
+
*/
|
|
5819
5931
|
kitKey?: string;
|
|
5820
5932
|
/**
|
|
5821
5933
|
* DEX aggregator identifier used to source the swap route.
|
|
@@ -6346,12 +6458,21 @@ interface SwapConfig {
|
|
|
6346
6458
|
recipientAddress: string;
|
|
6347
6459
|
};
|
|
6348
6460
|
/**
|
|
6349
|
-
*
|
|
6350
|
-
*
|
|
6461
|
+
* Circle API key used to authenticate service-backed swap requests.
|
|
6462
|
+
*
|
|
6463
|
+
* Format: `<ENV>_API_KEY:<keyId>:<keySecret>`. A legacy
|
|
6464
|
+
* `KIT_KEY:<keyId>:<keySecret>` value is also accepted.
|
|
6351
6465
|
*
|
|
6352
6466
|
* Treat this value as a credential. Do not log it, embed it in client-side
|
|
6353
6467
|
* source, or expose it in telemetry.
|
|
6354
6468
|
*/
|
|
6469
|
+
apiKey?: string | undefined;
|
|
6470
|
+
/**
|
|
6471
|
+
* Circle API key used to authenticate service-backed swap requests.
|
|
6472
|
+
*
|
|
6473
|
+
* @deprecated Use {@link SwapConfig.apiKey} instead. Still honored when
|
|
6474
|
+
* `apiKey` is omitted, and `apiKey` takes precedence when both are set.
|
|
6475
|
+
*/
|
|
6355
6476
|
kitKey?: string;
|
|
6356
6477
|
}
|
|
6357
6478
|
/**
|
|
@@ -6391,7 +6512,13 @@ interface ResolvedSwapConfig extends Omit<SwapConfig, 'customFee'> {
|
|
|
6391
6512
|
recipientAddress?: string;
|
|
6392
6513
|
};
|
|
6393
6514
|
}
|
|
6394
|
-
|
|
6515
|
+
/**
|
|
6516
|
+
* Swap config as echoed back on a result, with credentials removed.
|
|
6517
|
+
*
|
|
6518
|
+
* Both credential fields are omitted so a returned {@link SwapResult} can be
|
|
6519
|
+
* logged or serialized without leaking the secret used to authenticate it.
|
|
6520
|
+
*/
|
|
6521
|
+
type SwapResultConfig = Omit<ResolvedSwapConfig, 'apiKey' | 'kitKey'>;
|
|
6395
6522
|
/**
|
|
6396
6523
|
* Result of an executed swap operation.
|
|
6397
6524
|
*
|
|
@@ -6687,6 +6814,30 @@ interface SwapParams<TFromAdapterCapabilities extends AdapterCapabilities = Adap
|
|
|
6687
6814
|
config?: SwapConfig;
|
|
6688
6815
|
}
|
|
6689
6816
|
|
|
6817
|
+
/**
|
|
6818
|
+
* Configure how CCTP and forwarding fees are collected for a bridge.
|
|
6819
|
+
*
|
|
6820
|
+
* @remarks
|
|
6821
|
+
* Use `'source'` with `to.useForwarder: true` to treat `amount` as the exact
|
|
6822
|
+
* destination amount. Bridge Kit obtains a signed fee quote, collects the fee
|
|
6823
|
+
* in source-chain USDC, and leaves the destination mint unreduced. Omit the
|
|
6824
|
+
* option (or use `'destination'`) to preserve the existing max-fee behavior.
|
|
6825
|
+
*
|
|
6826
|
+
* @example
|
|
6827
|
+
* ```typescript
|
|
6828
|
+
* import type { BridgeExecutionConfig } from '@circle-fin/bridge-kit'
|
|
6829
|
+
*
|
|
6830
|
+
* const config: BridgeExecutionConfig = {
|
|
6831
|
+
* transferSpeed: 'FAST',
|
|
6832
|
+
* feePayment: 'source',
|
|
6833
|
+
* }
|
|
6834
|
+
* ```
|
|
6835
|
+
* @since 1.14.0
|
|
6836
|
+
*/
|
|
6837
|
+
interface BridgeExecutionConfig extends BridgeConfig {
|
|
6838
|
+
/** Select source-side signed fees or the legacy destination-side fee path. */
|
|
6839
|
+
feePayment?: 'source' | 'destination';
|
|
6840
|
+
}
|
|
6690
6841
|
type FeeFunction<TFromAdapterCapabilities extends AdapterCapabilities, TToAdapterCapabilities extends AdapterCapabilities> = (params: BridgeParams$1<TFromAdapterCapabilities, TToAdapterCapabilities>) => Promise<string> | string;
|
|
6691
6842
|
type FeeRecipientFunction<TFromAdapterCapabilities extends AdapterCapabilities, TToAdapterCapabilities extends AdapterCapabilities> = (feePayoutChain: ChainDefinition, params: BridgeParams$1<TFromAdapterCapabilities, TToAdapterCapabilities>) => Promise<string> | string;
|
|
6692
6843
|
/**
|
|
@@ -6847,7 +6998,7 @@ interface BridgeParams<TFromAdapterCapabilities extends AdapterCapabilities = Ad
|
|
|
6847
6998
|
* Optional bridge configuration (e.g., transfer speed).
|
|
6848
6999
|
* If omitted, defaults will be used
|
|
6849
7000
|
*/
|
|
6850
|
-
config?:
|
|
7001
|
+
config?: BridgeExecutionConfig;
|
|
6851
7002
|
/**
|
|
6852
7003
|
* The token to transfer. Defaults to 'USDC'.
|
|
6853
7004
|
* If omitted, the provider will use 'USDC' by default.
|
|
@@ -6874,6 +7025,16 @@ interface BridgeParams<TFromAdapterCapabilities extends AdapterCapabilities = Ad
|
|
|
6874
7025
|
* ```
|
|
6875
7026
|
*/
|
|
6876
7027
|
invocationMeta?: InvocationMeta;
|
|
7028
|
+
/**
|
|
7029
|
+
* Reuse the opaque signed quote returned by a receive-exact estimate.
|
|
7030
|
+
*
|
|
7031
|
+
* @remarks
|
|
7032
|
+
* Bridge Kit validates a supplied quote against the exact transfer and fails
|
|
7033
|
+
* when it is invalid, mismatched, expired, or too close to expiry. Omit this
|
|
7034
|
+
* value to let Bridge Kit fetch a fresh quote automatically. Never log or
|
|
7035
|
+
* decode it.
|
|
7036
|
+
*/
|
|
7037
|
+
quote?: string;
|
|
6877
7038
|
}
|
|
6878
7039
|
|
|
6879
7040
|
/**
|
|
@@ -6918,29 +7079,37 @@ type EarnAdapterContext<TAdapterCapabilities extends AdapterCapabilities = Adapt
|
|
|
6918
7079
|
* Configuration options for earn operations.
|
|
6919
7080
|
*
|
|
6920
7081
|
* EarnKit supports dual-mode authentication: operations work both with
|
|
6921
|
-
* and without
|
|
7082
|
+
* and without an API key. When present, the API key enables permissioned
|
|
6922
7083
|
* features like integrator attribution tracking.
|
|
6923
7084
|
*
|
|
6924
7085
|
* @example
|
|
6925
7086
|
* ```typescript
|
|
6926
|
-
* // Permissionless (no
|
|
7087
|
+
* // Permissionless (no API key)
|
|
6927
7088
|
* const config: EarnConfig = {}
|
|
6928
7089
|
*
|
|
6929
|
-
* // Permissioned (with
|
|
7090
|
+
* // Permissioned (with API key)
|
|
6930
7091
|
* const config: EarnConfig = {
|
|
6931
|
-
*
|
|
7092
|
+
* apiKey: 'TEST_API_KEY:keyId:keySecret',
|
|
6932
7093
|
* }
|
|
6933
7094
|
* ```
|
|
6934
7095
|
*/
|
|
6935
7096
|
interface EarnConfig {
|
|
6936
7097
|
/**
|
|
6937
|
-
* Optional
|
|
7098
|
+
* Optional Circle API key for permissioned access.
|
|
6938
7099
|
*
|
|
6939
7100
|
* When provided, enables integrator attribution tracking and
|
|
6940
7101
|
* higher rate limits. When omitted, the SDK operates in
|
|
6941
7102
|
* permissionless mode.
|
|
6942
7103
|
*
|
|
6943
|
-
* Format:
|
|
7104
|
+
* Format: `<ENV>_API_KEY:<keyId>:<keySecret>`. A legacy
|
|
7105
|
+
* `KIT_KEY:<keyId>:<keySecret>` value is also accepted.
|
|
7106
|
+
*/
|
|
7107
|
+
readonly apiKey?: string | undefined;
|
|
7108
|
+
/**
|
|
7109
|
+
* Optional Circle API key for permissioned access.
|
|
7110
|
+
*
|
|
7111
|
+
* @deprecated Use {@link EarnConfig.apiKey} instead. Still honored when
|
|
7112
|
+
* `apiKey` is omitted, and `apiKey` takes precedence when both are set.
|
|
6944
7113
|
*/
|
|
6945
7114
|
readonly kitKey?: string | undefined;
|
|
6946
7115
|
/**
|
|
@@ -7707,13 +7876,18 @@ interface AppKitContext {
|
|
|
7707
7876
|
*/
|
|
7708
7877
|
disableErrorReporting?: boolean;
|
|
7709
7878
|
/**
|
|
7710
|
-
* Custom HTTP headers forwarded with
|
|
7711
|
-
* attestation (Iris)
|
|
7879
|
+
* Custom HTTP headers forwarded with Circle API requests made by the
|
|
7880
|
+
* underlying kits: the CCTP provider's attestation (Iris) requests for
|
|
7881
|
+
* bridge operations, and the Gateway API requests for unified-balance
|
|
7882
|
+
* operations.
|
|
7712
7883
|
*
|
|
7713
7884
|
* @remarks
|
|
7714
7885
|
* Headers are merged on top of the SDK defaults (such as `Content-Type`)
|
|
7715
|
-
* rather than replacing them.
|
|
7716
|
-
* the SDK does not interpret it.
|
|
7886
|
+
* rather than replacing them. Each header is forwarded as-is to Circle's API;
|
|
7887
|
+
* the SDK does not interpret it. The same map is forwarded to every relevant
|
|
7888
|
+
* kit, so a header a given API ignores is simply a no-op there. A
|
|
7889
|
+
* `unifiedBalance.headers` value, if provided, takes precedence for the
|
|
7890
|
+
* unified-balance kit.
|
|
7717
7891
|
*/
|
|
7718
7892
|
headers?: Record<string, string>;
|
|
7719
7893
|
}
|