@circle-fin/app-kit 1.15.3 → 1.17.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 +91 -0
- package/README.md +5 -2
- package/borrow.cjs +28146 -0
- package/borrow.cjs.map +1 -0
- package/borrow.d.cts +10752 -0
- package/borrow.d.mts +10752 -0
- package/borrow.d.ts +10752 -0
- package/borrow.mjs +28118 -0
- package/borrow.mjs.map +1 -0
- package/bridge.cjs +2084 -328
- package/bridge.d.cts +121 -18
- package/bridge.d.mts +121 -18
- package/bridge.d.ts +121 -18
- package/bridge.mjs +2084 -328
- package/chains.cjs +78 -7
- package/chains.d.cts +2 -0
- package/chains.d.mts +2 -0
- package/chains.d.ts +2 -0
- package/chains.mjs +78 -7
- package/context.cjs +1 -0
- package/context.d.cts +121 -18
- package/context.d.mts +121 -18
- package/context.d.ts +121 -18
- package/context.mjs +1 -0
- package/earn.cjs +5322 -3219
- package/earn.d.cts +1149 -984
- package/earn.d.mts +1149 -984
- package/earn.d.ts +1149 -984
- package/earn.mjs +5322 -3219
- package/estimateBridge.cjs +2082 -326
- package/estimateBridge.d.cts +121 -18
- package/estimateBridge.d.mts +121 -18
- package/estimateBridge.d.ts +121 -18
- package/estimateBridge.mjs +2082 -326
- package/estimateSwap.cjs +8817 -6974
- package/estimateSwap.d.cts +169 -18
- package/estimateSwap.d.mts +169 -18
- package/estimateSwap.d.ts +169 -18
- package/estimateSwap.mjs +8822 -6979
- package/index.cjs +33149 -20719
- package/index.d.cts +23174 -2736
- package/index.d.mts +23174 -2736
- package/index.d.ts +23174 -2736
- package/index.mjs +33090 -20713
- package/package.json +17 -7
- package/server.cjs +133 -12
- package/server.d.cts +29 -10
- package/server.d.mts +29 -10
- package/server.d.ts +29 -10
- package/server.mjs +133 -12
- package/swap.cjs +8817 -6974
- package/swap.d.cts +169 -18
- package/swap.d.mts +169 -18
- package/swap.d.ts +169 -18
- package/swap.mjs +8822 -6979
- package/unifiedBalance.cjs +528 -138
- package/unifiedBalance.d.cts +108 -11
- package/unifiedBalance.d.mts +108 -11
- package/unifiedBalance.d.ts +108 -11
- package/unifiedBalance.mjs +528 -138
package/bridge.d.ts
CHANGED
|
@@ -551,8 +551,23 @@ interface CCTPXChainConfig {
|
|
|
551
551
|
* const contractType: KitContractType = 'bridge' // Valid
|
|
552
552
|
* const invalidType: KitContractType = 'invalid' // TypeScript error
|
|
553
553
|
* ```
|
|
554
|
-
|
|
555
|
-
|
|
554
|
+
*
|
|
555
|
+
* @remarks
|
|
556
|
+
* `'senderPreservingBatcher'` carries a stricter requirement than the others,
|
|
557
|
+
* because setting it wrong fails silently rather than loudly. It must name a
|
|
558
|
+
* batching contract that preserves the calling EOA as `msg.sender` in every
|
|
559
|
+
* subcall — on Arc, the `Multicall3From` predeploy, which achieves that
|
|
560
|
+
* through the `CallFrom` precompile. The name is deliberately more specific
|
|
561
|
+
* than "batcher": the ubiquitous Multicall3 at
|
|
562
|
+
* `0xcA11bde05977b3631167028862bE2a173976CA11` has the same ABI and the same
|
|
563
|
+
* selectors but does **not** qualify, since each subcall would arrive as the
|
|
564
|
+
* Multicall3 contract, so a batched `approve` would grant an allowance from
|
|
565
|
+
* the batcher's own balance rather than from the user's — a field named just
|
|
566
|
+
* `batcher` would make that misconfiguration look valid. Leave
|
|
567
|
+
* `senderPreservingBatcher` unset on any chain lacking one; an unset field
|
|
568
|
+
* simply means callers fall back to submitting calls one at a time.
|
|
569
|
+
*/
|
|
570
|
+
type KitContractType = 'bridge' | 'adapter' | 'senderPreservingBatcher';
|
|
556
571
|
/**
|
|
557
572
|
* Configuration for Gateway v1 contracts.
|
|
558
573
|
*
|
|
@@ -884,10 +899,10 @@ declare enum Blockchain {
|
|
|
884
899
|
*
|
|
885
900
|
* Unlike the full {@link Blockchain} enum, SwapChain includes mainnet
|
|
886
901
|
* networks and explicitly whitelisted testnets (e.g., {@link Arc_Testnet})
|
|
887
|
-
* where
|
|
902
|
+
* where Adapter contracts are deployed.
|
|
888
903
|
*
|
|
889
904
|
* Dynamic validation via {@link isSwapSupportedChain} ensures chains
|
|
890
|
-
* automatically work when
|
|
905
|
+
* automatically work when Adapter contracts and supported tokens are deployed.
|
|
891
906
|
*
|
|
892
907
|
* @example
|
|
893
908
|
* ```typescript
|
|
@@ -927,20 +942,22 @@ declare enum SwapChain {
|
|
|
927
942
|
HyperEVM = "HyperEVM",
|
|
928
943
|
Monad = "Monad",
|
|
929
944
|
Arc = "Arc",
|
|
945
|
+
Cronos = "Cronos",
|
|
946
|
+
Morph = "Morph",
|
|
930
947
|
Arc_Testnet = "Arc_Testnet"
|
|
931
948
|
}
|
|
932
949
|
/**
|
|
933
950
|
* Chain definition that supports swap operations.
|
|
934
951
|
*
|
|
935
952
|
* @remarks
|
|
936
|
-
* Expanded from 4 to
|
|
937
|
-
* -
|
|
953
|
+
* Expanded from 4 to supported mainnets and whitelisted testnets based on:
|
|
954
|
+
* - A deployed Adapter contract, configured directly or through CCTP v2
|
|
938
955
|
* - Mainnet chains plus whitelisted testnets (e.g., Arc Testnet)
|
|
939
956
|
*
|
|
940
957
|
* Use `isSwapSupportedChain()` for runtime validation.
|
|
941
958
|
*/
|
|
942
959
|
type SwapChainDefinition = ChainDefinition & {
|
|
943
|
-
chain: Blockchain.Ethereum | Blockchain.Base | Blockchain.Polygon | Blockchain.Solana | Blockchain.Arbitrum | Blockchain.Optimism | Blockchain.Avalanche | Blockchain.Linea | Blockchain.Ink | Blockchain.World_Chain | Blockchain.Unichain | Blockchain.Plume | Blockchain.Sei | Blockchain.Sonic | Blockchain.XDC | Blockchain.HyperEVM | Blockchain.Monad | Blockchain.Arc | Blockchain.Arc_Testnet;
|
|
960
|
+
chain: Blockchain.Ethereum | Blockchain.Base | Blockchain.Polygon | Blockchain.Solana | Blockchain.Arbitrum | Blockchain.Optimism | Blockchain.Avalanche | Blockchain.Linea | Blockchain.Ink | Blockchain.World_Chain | Blockchain.Unichain | Blockchain.Plume | Blockchain.Sei | Blockchain.Sonic | Blockchain.XDC | Blockchain.HyperEVM | Blockchain.Monad | Blockchain.Arc | Blockchain.Cronos | Blockchain.Morph | Blockchain.Arc_Testnet;
|
|
944
961
|
};
|
|
945
962
|
/**
|
|
946
963
|
* Chain identifier accepted by swap operations.
|
|
@@ -1436,8 +1453,13 @@ type PreparedChainRequest = EvmPreparedChainRequest | SolanaPreparedChainRequest
|
|
|
1436
1453
|
* Parameters for preparing an EVM contract execution.
|
|
1437
1454
|
*/
|
|
1438
1455
|
type EvmPreparedChainRequestParams = {
|
|
1439
|
-
/**
|
|
1440
|
-
|
|
1456
|
+
/**
|
|
1457
|
+
* The type of the prepared execution. Optional here because EVM is the
|
|
1458
|
+
* only chain type `Adapter.prepare()` implementations narrow their param
|
|
1459
|
+
* type to in practice — callers that only ever prepare EVM requests can
|
|
1460
|
+
* omit it rather than repeat a discriminator that never varies for them.
|
|
1461
|
+
*/
|
|
1462
|
+
type?: 'evm';
|
|
1441
1463
|
/** The ABI of the contract. */
|
|
1442
1464
|
abi: Abi | string[];
|
|
1443
1465
|
/** The address of the contract. */
|
|
@@ -2716,6 +2738,57 @@ interface EarnActionMap {
|
|
|
2716
2738
|
readonly claimRewards: ExecuteEarnParams;
|
|
2717
2739
|
}
|
|
2718
2740
|
|
|
2741
|
+
/** Permit standards accepted by Borrow Adapter executions. */
|
|
2742
|
+
declare enum BorrowPermitType {
|
|
2743
|
+
/** Tokens must be approved separately. */
|
|
2744
|
+
NONE = 0,
|
|
2745
|
+
/** EIP-2612 permit calldata accompanies the token input. */
|
|
2746
|
+
EIP2612 = 1
|
|
2747
|
+
}
|
|
2748
|
+
/** Token input forwarded by Borrow Kit to the Adapter Contract. */
|
|
2749
|
+
interface BorrowTokenInput {
|
|
2750
|
+
readonly permitType: BorrowPermitType;
|
|
2751
|
+
readonly token: `0x${string}`;
|
|
2752
|
+
readonly amount: bigint;
|
|
2753
|
+
readonly permitCalldata: `0x${string}`;
|
|
2754
|
+
}
|
|
2755
|
+
/** A single instruction in a Circle-signed Borrow execution. */
|
|
2756
|
+
interface BorrowInstruction {
|
|
2757
|
+
readonly target: `0x${string}`;
|
|
2758
|
+
readonly data: `0x${string}`;
|
|
2759
|
+
readonly value: string | bigint;
|
|
2760
|
+
readonly tokenIn: `0x${string}`;
|
|
2761
|
+
readonly amountToApprove: string | bigint;
|
|
2762
|
+
readonly tokenOut: `0x${string}`;
|
|
2763
|
+
readonly minTokenOut: string | bigint;
|
|
2764
|
+
}
|
|
2765
|
+
/** A token recipient in a Circle-signed Borrow execution. */
|
|
2766
|
+
interface BorrowTokenRecipient {
|
|
2767
|
+
readonly token: `0x${string}`;
|
|
2768
|
+
readonly beneficiary: `0x${string}`;
|
|
2769
|
+
}
|
|
2770
|
+
/** Circle-signed Borrow parameters forwarded to the Adapter Contract. */
|
|
2771
|
+
interface BorrowExecutionParams {
|
|
2772
|
+
readonly instructions: readonly BorrowInstruction[];
|
|
2773
|
+
readonly tokens: readonly BorrowTokenRecipient[];
|
|
2774
|
+
readonly execId: string | bigint;
|
|
2775
|
+
readonly deadline: string | bigint;
|
|
2776
|
+
readonly metadata: `0x${string}`;
|
|
2777
|
+
}
|
|
2778
|
+
/** Parameters for a service-signed Borrow Adapter execution. */
|
|
2779
|
+
interface ExecuteBorrowParams extends ActionParameters {
|
|
2780
|
+
readonly executeParams: BorrowExecutionParams;
|
|
2781
|
+
readonly tokenInputs: BorrowTokenInput[];
|
|
2782
|
+
readonly signature: `0x${string}`;
|
|
2783
|
+
}
|
|
2784
|
+
/** Borrow actions supported by EVM adapters. */
|
|
2785
|
+
interface BorrowActionMap {
|
|
2786
|
+
/** Execute a Circle-signed partial loan repayment. */
|
|
2787
|
+
readonly repay: ExecuteBorrowParams;
|
|
2788
|
+
/** Execute a Circle-signed borrow. */
|
|
2789
|
+
readonly execute: ExecuteBorrowParams;
|
|
2790
|
+
}
|
|
2791
|
+
|
|
2719
2792
|
/**
|
|
2720
2793
|
* Single instruction to execute within the Adapter Contract.
|
|
2721
2794
|
*
|
|
@@ -3672,6 +3745,8 @@ interface NativeActionMap {
|
|
|
3672
3745
|
* @see {@link ActionPayload} for extracting payload types
|
|
3673
3746
|
*/
|
|
3674
3747
|
interface ActionMap {
|
|
3748
|
+
/** Borrow operations that execute service-signed payloads. */
|
|
3749
|
+
readonly borrow: BorrowActionMap;
|
|
3675
3750
|
/** CCTP-specific operations with automatic address resolution. */
|
|
3676
3751
|
readonly cctp: CCTPActionMap;
|
|
3677
3752
|
/** CCTPx operations (CrossChainTokenService) for cross-chain transfers of registered tokens (Circle-issued or otherwise). */
|
|
@@ -3691,6 +3766,7 @@ interface ActionMap {
|
|
|
3691
3766
|
/** Earn operations that execute service-signed payloads via the adapter contract. */
|
|
3692
3767
|
readonly earn: EarnActionMap;
|
|
3693
3768
|
}
|
|
3769
|
+
|
|
3694
3770
|
/**
|
|
3695
3771
|
* Determine if a type represents an action parameter object (leaf node).
|
|
3696
3772
|
*
|
|
@@ -6901,7 +6977,7 @@ interface ServiceSwapConfig {
|
|
|
6901
6977
|
*
|
|
6902
6978
|
* @defaultValue true
|
|
6903
6979
|
*/
|
|
6904
|
-
batchTransactions?: boolean;
|
|
6980
|
+
batchTransactions?: boolean | undefined;
|
|
6905
6981
|
}
|
|
6906
6982
|
/**
|
|
6907
6983
|
* Parameters for initiating a swap operation through the Stablecoin Service.
|
|
@@ -7365,6 +7441,33 @@ interface SwapConfig {
|
|
|
7365
7441
|
* `apiKey` is omitted, and `apiKey` takes precedence when both are set.
|
|
7366
7442
|
*/
|
|
7367
7443
|
kitKey?: string;
|
|
7444
|
+
/**
|
|
7445
|
+
* Enable or disable atomic batched execution of the approval and swap.
|
|
7446
|
+
*
|
|
7447
|
+
* When `true` (or omitted), an EVM swap that needs an on-chain ERC-20
|
|
7448
|
+
* approval submits the approval and the swap as one atomic batch if the
|
|
7449
|
+
* connected wallet supports it (EIP-5792, or a signing strategy that
|
|
7450
|
+
* declares atomic batching). Set to `false` to force the sequential
|
|
7451
|
+
* approve-then-swap flow.
|
|
7452
|
+
*
|
|
7453
|
+
* @remarks
|
|
7454
|
+
* Has no effect on the gasless permit path, native-token swaps, or Solana,
|
|
7455
|
+
* which already execute as a single transaction. USDT input always uses the
|
|
7456
|
+
* sequential path because its allowance must be reset to zero first. The
|
|
7457
|
+
* batched path relies on the wallet's own gas estimation for the swap call;
|
|
7458
|
+
* set `false` if your wallet under-estimates gas for complex routes or
|
|
7459
|
+
* rejects batched calls.
|
|
7460
|
+
*
|
|
7461
|
+
* @defaultValue `undefined` (batching attempted when the wallet supports it)
|
|
7462
|
+
*
|
|
7463
|
+
* @example
|
|
7464
|
+
* ```typescript
|
|
7465
|
+
* const config: SwapConfig = {
|
|
7466
|
+
* batchTransactions: false, // force sequential approve → swap
|
|
7467
|
+
* }
|
|
7468
|
+
* ```
|
|
7469
|
+
*/
|
|
7470
|
+
batchTransactions?: boolean | undefined;
|
|
7368
7471
|
}
|
|
7369
7472
|
/**
|
|
7370
7473
|
* Resolved parameters for swap operations after validation and normalization.
|
|
@@ -8329,8 +8432,8 @@ interface AppKitContext {
|
|
|
8329
8432
|
*
|
|
8330
8433
|
* This property stores event handlers that are registered via the AppKit's
|
|
8331
8434
|
* `on()` method. Handlers are grouped by operation type. The runtime buckets
|
|
8332
|
-
* are `bridge` and `
|
|
8333
|
-
* AppKit wires action handlers for additional kits.
|
|
8435
|
+
* are `bridge`, `earn`, and `borrow`; the context can add more operation
|
|
8436
|
+
* buckets as AppKit wires action handlers for additional kits.
|
|
8334
8437
|
*
|
|
8335
8438
|
* Within each operation bucket, handlers are keyed by action name (for
|
|
8336
8439
|
* example, `bridge.approve` or `earn.deposit`) or `*` for wildcard handlers.
|
|
@@ -8349,13 +8452,13 @@ interface AppKitContext {
|
|
|
8349
8452
|
* // Earn handlers are registered with EarnKit when earn operations run
|
|
8350
8453
|
* ```
|
|
8351
8454
|
*/
|
|
8352
|
-
actions: Record<'bridge' | 'earn', Record<string, ((payload: unknown) => void)[]>>;
|
|
8455
|
+
actions: Record<'bridge' | 'earn' | 'borrow', Record<string, ((payload: unknown) => void)[]>>;
|
|
8353
8456
|
/**
|
|
8354
|
-
* Disable success analytics for the underlying EarnKit, SwapKit,
|
|
8355
|
-
* UnifiedBalanceKit.
|
|
8457
|
+
* Disable success analytics for the underlying EarnKit, SwapKit,
|
|
8458
|
+
* BorrowKit, and UnifiedBalanceKit.
|
|
8356
8459
|
*
|
|
8357
|
-
* When `true`, completed earn, swap, and unified balance operations
|
|
8358
|
-
* POST analytics events. This does not disable error reporting; use
|
|
8460
|
+
* When `true`, completed earn, swap, borrow, and unified balance operations
|
|
8461
|
+
* will not POST analytics events. This does not disable error reporting; use
|
|
8359
8462
|
* {@link AppKitContext.disableErrorReporting} for that. Defaults to `false`.
|
|
8360
8463
|
*
|
|
8361
8464
|
* @defaultValue false
|
|
@@ -8365,7 +8468,7 @@ interface AppKitContext {
|
|
|
8365
8468
|
* Disable error telemetry for all sub-kits.
|
|
8366
8469
|
*
|
|
8367
8470
|
* When `true`, none of the underlying kits (BridgeKit, SwapKit, EarnKit,
|
|
8368
|
-
* UnifiedBalanceKit) will POST error details to the telemetry
|
|
8471
|
+
* BorrowKit, UnifiedBalanceKit) will POST error details to the telemetry
|
|
8369
8472
|
* endpoint when operations throw. Defaults to `false` (enabled).
|
|
8370
8473
|
*
|
|
8371
8474
|
* @defaultValue false
|