@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/context.d.ts
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
|
*
|
|
@@ -5697,6 +5800,30 @@ type BridgeDestination<TAdapterCapabilities extends AdapterCapabilities = Adapte
|
|
|
5697
5800
|
useForwarder?: boolean;
|
|
5698
5801
|
}) | ForwarderDestination<TChainIdentifier>;
|
|
5699
5802
|
|
|
5803
|
+
/**
|
|
5804
|
+
* Configure how CCTP and forwarding fees are collected for a bridge.
|
|
5805
|
+
*
|
|
5806
|
+
* @remarks
|
|
5807
|
+
* Use `'source'` with `to.useForwarder: true` to treat `amount` as the exact
|
|
5808
|
+
* destination amount. Bridge Kit obtains a signed fee quote, collects the fee
|
|
5809
|
+
* in source-chain USDC, and leaves the destination mint unreduced. Omit the
|
|
5810
|
+
* option (or use `'destination'`) to preserve the existing max-fee behavior.
|
|
5811
|
+
*
|
|
5812
|
+
* @example
|
|
5813
|
+
* ```typescript
|
|
5814
|
+
* import type { BridgeExecutionConfig } from '@circle-fin/bridge-kit'
|
|
5815
|
+
*
|
|
5816
|
+
* const config: BridgeExecutionConfig = {
|
|
5817
|
+
* transferSpeed: 'FAST',
|
|
5818
|
+
* feePayment: 'source',
|
|
5819
|
+
* }
|
|
5820
|
+
* ```
|
|
5821
|
+
* @since 1.14.0
|
|
5822
|
+
*/
|
|
5823
|
+
interface BridgeExecutionConfig extends BridgeConfig {
|
|
5824
|
+
/** Select source-side signed fees or the legacy destination-side fee path. */
|
|
5825
|
+
feePayment?: 'source' | 'destination';
|
|
5826
|
+
}
|
|
5700
5827
|
type FeeFunction<TFromAdapterCapabilities extends AdapterCapabilities, TToAdapterCapabilities extends AdapterCapabilities> = (params: BridgeParams$1<TFromAdapterCapabilities, TToAdapterCapabilities>) => Promise<string> | string;
|
|
5701
5828
|
type FeeRecipientFunction<TFromAdapterCapabilities extends AdapterCapabilities, TToAdapterCapabilities extends AdapterCapabilities> = (feePayoutChain: ChainDefinition, params: BridgeParams$1<TFromAdapterCapabilities, TToAdapterCapabilities>) => Promise<string> | string;
|
|
5702
5829
|
/**
|
|
@@ -5857,7 +5984,7 @@ interface BridgeParams<TFromAdapterCapabilities extends AdapterCapabilities = Ad
|
|
|
5857
5984
|
* Optional bridge configuration (e.g., transfer speed).
|
|
5858
5985
|
* If omitted, defaults will be used
|
|
5859
5986
|
*/
|
|
5860
|
-
config?:
|
|
5987
|
+
config?: BridgeExecutionConfig;
|
|
5861
5988
|
/**
|
|
5862
5989
|
* The token to transfer. Defaults to 'USDC'.
|
|
5863
5990
|
* If omitted, the provider will use 'USDC' by default.
|
|
@@ -5884,6 +6011,16 @@ interface BridgeParams<TFromAdapterCapabilities extends AdapterCapabilities = Ad
|
|
|
5884
6011
|
* ```
|
|
5885
6012
|
*/
|
|
5886
6013
|
invocationMeta?: InvocationMeta;
|
|
6014
|
+
/**
|
|
6015
|
+
* Reuse the opaque signed quote returned by a receive-exact estimate.
|
|
6016
|
+
*
|
|
6017
|
+
* @remarks
|
|
6018
|
+
* Bridge Kit validates a supplied quote against the exact transfer and fails
|
|
6019
|
+
* when it is invalid, mismatched, expired, or too close to expiry. Omit this
|
|
6020
|
+
* value to let Bridge Kit fetch a fresh quote automatically. Never log or
|
|
6021
|
+
* decode it.
|
|
6022
|
+
*/
|
|
6023
|
+
quote?: string;
|
|
5887
6024
|
}
|
|
5888
6025
|
|
|
5889
6026
|
/**
|
|
@@ -5999,12 +6136,21 @@ interface ServiceSwapConfig {
|
|
|
5999
6136
|
recipientAddress?: string;
|
|
6000
6137
|
};
|
|
6001
6138
|
/**
|
|
6002
|
-
*
|
|
6003
|
-
*
|
|
6139
|
+
* Circle API key used to authenticate service-backed swap requests.
|
|
6140
|
+
*
|
|
6141
|
+
* Format: `<ENV>_API_KEY:<keyId>:<keySecret>`. A legacy
|
|
6142
|
+
* `KIT_KEY:<keyId>:<keySecret>` value is also accepted.
|
|
6004
6143
|
*
|
|
6005
6144
|
* Treat this value as a credential. Do not log it, embed it in client-side
|
|
6006
6145
|
* source, or expose it in telemetry.
|
|
6007
6146
|
*/
|
|
6147
|
+
apiKey?: string | undefined;
|
|
6148
|
+
/**
|
|
6149
|
+
* Circle API key used to authenticate service-backed swap requests.
|
|
6150
|
+
*
|
|
6151
|
+
* @deprecated Use {@link ServiceSwapConfig.apiKey} instead. Still honored
|
|
6152
|
+
* when `apiKey` is omitted, and `apiKey` takes precedence when both are set.
|
|
6153
|
+
*/
|
|
6008
6154
|
kitKey?: string;
|
|
6009
6155
|
/**
|
|
6010
6156
|
* DEX aggregator identifier used to source the swap route.
|
|
@@ -6482,12 +6628,21 @@ interface SwapConfig {
|
|
|
6482
6628
|
recipientAddress: string;
|
|
6483
6629
|
};
|
|
6484
6630
|
/**
|
|
6485
|
-
*
|
|
6486
|
-
*
|
|
6631
|
+
* Circle API key used to authenticate service-backed swap requests.
|
|
6632
|
+
*
|
|
6633
|
+
* Format: `<ENV>_API_KEY:<keyId>:<keySecret>`. A legacy
|
|
6634
|
+
* `KIT_KEY:<keyId>:<keySecret>` value is also accepted.
|
|
6487
6635
|
*
|
|
6488
6636
|
* Treat this value as a credential. Do not log it, embed it in client-side
|
|
6489
6637
|
* source, or expose it in telemetry.
|
|
6490
6638
|
*/
|
|
6639
|
+
apiKey?: string | undefined;
|
|
6640
|
+
/**
|
|
6641
|
+
* Circle API key used to authenticate service-backed swap requests.
|
|
6642
|
+
*
|
|
6643
|
+
* @deprecated Use {@link SwapConfig.apiKey} instead. Still honored when
|
|
6644
|
+
* `apiKey` is omitted, and `apiKey` takes precedence when both are set.
|
|
6645
|
+
*/
|
|
6491
6646
|
kitKey?: string;
|
|
6492
6647
|
}
|
|
6493
6648
|
/**
|
|
@@ -6616,29 +6771,37 @@ type EarnAdapterContext<TAdapterCapabilities extends AdapterCapabilities = Adapt
|
|
|
6616
6771
|
* Configuration options for earn operations.
|
|
6617
6772
|
*
|
|
6618
6773
|
* EarnKit supports dual-mode authentication: operations work both with
|
|
6619
|
-
* and without
|
|
6774
|
+
* and without an API key. When present, the API key enables permissioned
|
|
6620
6775
|
* features like integrator attribution tracking.
|
|
6621
6776
|
*
|
|
6622
6777
|
* @example
|
|
6623
6778
|
* ```typescript
|
|
6624
|
-
* // Permissionless (no
|
|
6779
|
+
* // Permissionless (no API key)
|
|
6625
6780
|
* const config: EarnConfig = {}
|
|
6626
6781
|
*
|
|
6627
|
-
* // Permissioned (with
|
|
6782
|
+
* // Permissioned (with API key)
|
|
6628
6783
|
* const config: EarnConfig = {
|
|
6629
|
-
*
|
|
6784
|
+
* apiKey: 'TEST_API_KEY:keyId:keySecret',
|
|
6630
6785
|
* }
|
|
6631
6786
|
* ```
|
|
6632
6787
|
*/
|
|
6633
6788
|
interface EarnConfig {
|
|
6634
6789
|
/**
|
|
6635
|
-
* Optional
|
|
6790
|
+
* Optional Circle API key for permissioned access.
|
|
6636
6791
|
*
|
|
6637
6792
|
* When provided, enables integrator attribution tracking and
|
|
6638
6793
|
* higher rate limits. When omitted, the SDK operates in
|
|
6639
6794
|
* permissionless mode.
|
|
6640
6795
|
*
|
|
6641
|
-
* Format:
|
|
6796
|
+
* Format: `<ENV>_API_KEY:<keyId>:<keySecret>`. A legacy
|
|
6797
|
+
* `KIT_KEY:<keyId>:<keySecret>` value is also accepted.
|
|
6798
|
+
*/
|
|
6799
|
+
readonly apiKey?: string | undefined;
|
|
6800
|
+
/**
|
|
6801
|
+
* Optional Circle API key for permissioned access.
|
|
6802
|
+
*
|
|
6803
|
+
* @deprecated Use {@link EarnConfig.apiKey} instead. Still honored when
|
|
6804
|
+
* `apiKey` is omitted, and `apiKey` takes precedence when both are set.
|
|
6642
6805
|
*/
|
|
6643
6806
|
readonly kitKey?: string | undefined;
|
|
6644
6807
|
/**
|
|
@@ -7405,13 +7568,18 @@ interface AppKitContext {
|
|
|
7405
7568
|
*/
|
|
7406
7569
|
disableErrorReporting?: boolean;
|
|
7407
7570
|
/**
|
|
7408
|
-
* Custom HTTP headers forwarded with
|
|
7409
|
-
* attestation (Iris)
|
|
7571
|
+
* Custom HTTP headers forwarded with Circle API requests made by the
|
|
7572
|
+
* underlying kits: the CCTP provider's attestation (Iris) requests for
|
|
7573
|
+
* bridge operations, and the Gateway API requests for unified-balance
|
|
7574
|
+
* operations.
|
|
7410
7575
|
*
|
|
7411
7576
|
* @remarks
|
|
7412
7577
|
* Headers are merged on top of the SDK defaults (such as `Content-Type`)
|
|
7413
|
-
* rather than replacing them.
|
|
7414
|
-
* the SDK does not interpret it.
|
|
7578
|
+
* rather than replacing them. Each header is forwarded as-is to Circle's API;
|
|
7579
|
+
* the SDK does not interpret it. The same map is forwarded to every relevant
|
|
7580
|
+
* kit, so a header a given API ignores is simply a no-op there. A
|
|
7581
|
+
* `unifiedBalance.headers` value, if provided, takes precedence for the
|
|
7582
|
+
* unified-balance kit.
|
|
7415
7583
|
*/
|
|
7416
7584
|
headers?: Record<string, string>;
|
|
7417
7585
|
}
|