@circle-fin/app-kit 1.8.0 → 1.9.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 +53 -0
- package/README.md +3 -3
- package/bridge.cjs +469 -231
- package/bridge.d.cts +16 -2
- package/bridge.d.mts +16 -2
- package/bridge.d.ts +16 -2
- package/bridge.mjs +469 -231
- package/chains.cjs +94 -0
- package/chains.d.cts +2 -0
- package/chains.d.mts +2 -0
- package/chains.d.ts +2 -0
- package/chains.mjs +94 -0
- package/context.d.cts +16 -2
- package/context.d.mts +16 -2
- package/context.d.ts +16 -2
- package/earn.cjs +438 -208
- package/earn.d.cts +33 -13
- package/earn.d.mts +33 -13
- package/earn.d.ts +33 -13
- package/earn.mjs +438 -208
- package/estimateBridge.cjs +469 -231
- package/estimateBridge.d.cts +16 -2
- package/estimateBridge.d.mts +16 -2
- package/estimateBridge.d.ts +16 -2
- package/estimateBridge.mjs +469 -231
- package/estimateSwap.cjs +210 -87
- package/estimateSwap.d.cts +16 -2
- package/estimateSwap.d.mts +16 -2
- package/estimateSwap.d.ts +16 -2
- package/estimateSwap.mjs +210 -87
- package/index.cjs +884 -413
- package/index.d.cts +284 -27
- package/index.d.mts +284 -27
- package/index.d.ts +284 -27
- package/index.mjs +884 -413
- package/package.json +12 -6
- package/swap.cjs +210 -87
- package/swap.d.cts +16 -2
- package/swap.d.mts +16 -2
- package/swap.d.ts +16 -2
- package/swap.mjs +210 -87
- package/unifiedBalance.cjs +119 -5
- package/unifiedBalance.d.cts +2 -0
- package/unifiedBalance.d.mts +2 -0
- package/unifiedBalance.d.ts +2 -0
- package/unifiedBalance.mjs +119 -5
package/estimateSwap.mjs
CHANGED
|
@@ -2895,6 +2895,8 @@ class KitError extends Error {
|
|
|
2895
2895
|
Blockchain["Celo_Alfajores_Testnet"] = "Celo_Alfajores_Testnet";
|
|
2896
2896
|
Blockchain["Codex"] = "Codex";
|
|
2897
2897
|
Blockchain["Codex_Testnet"] = "Codex_Testnet";
|
|
2898
|
+
Blockchain["Cronos"] = "Cronos";
|
|
2899
|
+
Blockchain["Cronos_Testnet"] = "Cronos_Testnet";
|
|
2898
2900
|
Blockchain["Edge"] = "Edge";
|
|
2899
2901
|
Blockchain["Edge_Testnet"] = "Edge_Testnet";
|
|
2900
2902
|
Blockchain["Ethereum"] = "Ethereum";
|
|
@@ -2977,6 +2979,7 @@ var BridgeChain;
|
|
|
2977
2979
|
BridgeChain["Avalanche"] = "Avalanche";
|
|
2978
2980
|
BridgeChain["Base"] = "Base";
|
|
2979
2981
|
BridgeChain["Codex"] = "Codex";
|
|
2982
|
+
BridgeChain["Cronos"] = "Cronos";
|
|
2980
2983
|
BridgeChain["Edge"] = "Edge";
|
|
2981
2984
|
BridgeChain["Ethereum"] = "Ethereum";
|
|
2982
2985
|
BridgeChain["HyperEVM"] = "HyperEVM";
|
|
@@ -3001,6 +3004,7 @@ var BridgeChain;
|
|
|
3001
3004
|
BridgeChain["Avalanche_Fuji"] = "Avalanche_Fuji";
|
|
3002
3005
|
BridgeChain["Base_Sepolia"] = "Base_Sepolia";
|
|
3003
3006
|
BridgeChain["Codex_Testnet"] = "Codex_Testnet";
|
|
3007
|
+
BridgeChain["Cronos_Testnet"] = "Cronos_Testnet";
|
|
3004
3008
|
BridgeChain["Edge_Testnet"] = "Edge_Testnet";
|
|
3005
3009
|
BridgeChain["Ethereum_Sepolia"] = "Ethereum_Sepolia";
|
|
3006
3010
|
BridgeChain["HyperEVM_Testnet"] = "HyperEVM_Testnet";
|
|
@@ -4057,6 +4061,96 @@ var EarnChain;
|
|
|
4057
4061
|
}
|
|
4058
4062
|
});
|
|
4059
4063
|
|
|
4064
|
+
/**
|
|
4065
|
+
* Cronos Mainnet chain definition
|
|
4066
|
+
* @remarks
|
|
4067
|
+
* This represents the official production network for the Cronos blockchain.
|
|
4068
|
+
* Cronos is an EVM-compatible blockchain.
|
|
4069
|
+
*/ const Cronos = defineChain({
|
|
4070
|
+
type: 'evm',
|
|
4071
|
+
chain: Blockchain.Cronos,
|
|
4072
|
+
name: 'Cronos',
|
|
4073
|
+
title: 'Cronos Mainnet',
|
|
4074
|
+
nativeCurrency: {
|
|
4075
|
+
name: 'Cronos',
|
|
4076
|
+
symbol: 'CRO',
|
|
4077
|
+
decimals: 18
|
|
4078
|
+
},
|
|
4079
|
+
chainId: 25,
|
|
4080
|
+
isTestnet: false,
|
|
4081
|
+
explorerUrl: 'https://cronoscan.com/tx/{hash}',
|
|
4082
|
+
rpcEndpoints: [
|
|
4083
|
+
'https://evm.cronos.org'
|
|
4084
|
+
],
|
|
4085
|
+
eurcAddress: '0xA6dE01a2d62C6B5f3525d768f34d276652C554c8',
|
|
4086
|
+
usdcAddress: '0x3D7F2C478aAfdB65542BCB44bCeeC05849999d2D',
|
|
4087
|
+
usdtAddress: null,
|
|
4088
|
+
cctp: {
|
|
4089
|
+
domain: 32,
|
|
4090
|
+
contracts: {
|
|
4091
|
+
v2: {
|
|
4092
|
+
type: 'split',
|
|
4093
|
+
tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
|
|
4094
|
+
messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
|
|
4095
|
+
confirmations: 1,
|
|
4096
|
+
fastConfirmations: 1
|
|
4097
|
+
}
|
|
4098
|
+
},
|
|
4099
|
+
forwarderSupported: {
|
|
4100
|
+
source: false,
|
|
4101
|
+
destination: false
|
|
4102
|
+
}
|
|
4103
|
+
},
|
|
4104
|
+
kitContracts: {
|
|
4105
|
+
bridge: BRIDGE_CONTRACT_EVM_MAINNET
|
|
4106
|
+
}
|
|
4107
|
+
});
|
|
4108
|
+
|
|
4109
|
+
/**
|
|
4110
|
+
* Cronos Testnet chain definition
|
|
4111
|
+
* @remarks
|
|
4112
|
+
* This represents the official test network for the Cronos blockchain.
|
|
4113
|
+
* Cronos is an EVM-compatible blockchain.
|
|
4114
|
+
*/ const CronosTestnet = defineChain({
|
|
4115
|
+
type: 'evm',
|
|
4116
|
+
chain: Blockchain.Cronos_Testnet,
|
|
4117
|
+
name: 'Cronos Testnet',
|
|
4118
|
+
title: 'Cronos Testnet',
|
|
4119
|
+
nativeCurrency: {
|
|
4120
|
+
name: 'CRO',
|
|
4121
|
+
symbol: 'tCRO',
|
|
4122
|
+
decimals: 18
|
|
4123
|
+
},
|
|
4124
|
+
chainId: 338,
|
|
4125
|
+
isTestnet: true,
|
|
4126
|
+
explorerUrl: 'https://explorer.cronos.org/testnet/tx/{hash}',
|
|
4127
|
+
rpcEndpoints: [
|
|
4128
|
+
'https://evm-t3.cronos.org'
|
|
4129
|
+
],
|
|
4130
|
+
eurcAddress: '0x31f7538adb53cF16350e6B0c89d03D91b7D12c46',
|
|
4131
|
+
usdcAddress: '0xEb33dc5fac03833e132593659e1dE7256aB59794',
|
|
4132
|
+
usdtAddress: null,
|
|
4133
|
+
cctp: {
|
|
4134
|
+
domain: 32,
|
|
4135
|
+
contracts: {
|
|
4136
|
+
v2: {
|
|
4137
|
+
type: 'split',
|
|
4138
|
+
tokenMessenger: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',
|
|
4139
|
+
messageTransmitter: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',
|
|
4140
|
+
confirmations: 1,
|
|
4141
|
+
fastConfirmations: 1
|
|
4142
|
+
}
|
|
4143
|
+
},
|
|
4144
|
+
forwarderSupported: {
|
|
4145
|
+
source: false,
|
|
4146
|
+
destination: false
|
|
4147
|
+
}
|
|
4148
|
+
},
|
|
4149
|
+
kitContracts: {
|
|
4150
|
+
bridge: BRIDGE_CONTRACT_EVM_TESTNET
|
|
4151
|
+
}
|
|
4152
|
+
});
|
|
4153
|
+
|
|
4060
4154
|
/**
|
|
4061
4155
|
* Edge Mainnet chain definition
|
|
4062
4156
|
* @remarks
|
|
@@ -6408,6 +6502,8 @@ var Chains = /*#__PURE__*/Object.freeze({
|
|
|
6408
6502
|
CeloAlfajoresTestnet: CeloAlfajoresTestnet,
|
|
6409
6503
|
Codex: Codex,
|
|
6410
6504
|
CodexTestnet: CodexTestnet,
|
|
6505
|
+
Cronos: Cronos,
|
|
6506
|
+
CronosTestnet: CronosTestnet,
|
|
6411
6507
|
Edge: Edge,
|
|
6412
6508
|
EdgeTestnet: EdgeTestnet,
|
|
6413
6509
|
Ethereum: Ethereum,
|
|
@@ -8457,6 +8553,7 @@ const swapTokenEnumSchema = z.enum([
|
|
|
8457
8553
|
[Blockchain.Base]: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',
|
|
8458
8554
|
[Blockchain.Celo]: '0xcebA9300f2b948710d2653dD7B07f33A8B32118C',
|
|
8459
8555
|
[Blockchain.Codex]: '0xd996633a415985DBd7D6D12f4A4343E31f5037cf',
|
|
8556
|
+
[Blockchain.Cronos]: '0x3D7F2C478aAfdB65542BCB44bCeeC05849999d2D',
|
|
8460
8557
|
[Blockchain.Edge]: '0x98d2919b9A214E6Fa5384AC81E6864bA686Ad74c',
|
|
8461
8558
|
[Blockchain.Ethereum]: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
|
|
8462
8559
|
[Blockchain.Hedera]: '0.0.456858',
|
|
@@ -8490,6 +8587,7 @@ const swapTokenEnumSchema = z.enum([
|
|
|
8490
8587
|
[Blockchain.Avalanche_Fuji]: '0x5425890298aed601595a70AB815c96711a31Bc65',
|
|
8491
8588
|
[Blockchain.Base_Sepolia]: '0x036CbD53842c5426634e7929541eC2318f3dCF7e',
|
|
8492
8589
|
[Blockchain.Codex_Testnet]: '0x6d7f141b6819C2c9CC2f818e6ad549E7Ca090F8f',
|
|
8590
|
+
[Blockchain.Cronos_Testnet]: '0xEb33dc5fac03833e132593659e1dE7256aB59794',
|
|
8493
8591
|
[Blockchain.Edge_Testnet]: '0x2d9F7CAD728051AA35Ecdc472a14cf8cDF5CFD6B',
|
|
8494
8592
|
[Blockchain.Ethereum_Sepolia]: '0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238',
|
|
8495
8593
|
[Blockchain.Hedera_Testnet]: '0.0.429274',
|
|
@@ -8557,13 +8655,22 @@ const swapTokenEnumSchema = z.enum([
|
|
|
8557
8655
|
symbol: 'EURC',
|
|
8558
8656
|
decimals: 6,
|
|
8559
8657
|
locators: {
|
|
8658
|
+
// =========================================================================
|
|
8659
|
+
// Mainnets
|
|
8660
|
+
// =========================================================================
|
|
8560
8661
|
[Blockchain.Avalanche]: '0xc891EB4cbdEFf6e073e859e987815Ed1505c2ACD',
|
|
8561
8662
|
[Blockchain.Base]: '0x60a3E35Cc302bFA44Cb288Bc5a4F316Fdb1adb42',
|
|
8663
|
+
[Blockchain.Cronos]: '0xA6dE01a2d62C6B5f3525d768f34d276652C554c8',
|
|
8562
8664
|
[Blockchain.Ethereum]: '0x1aBaEA1f7C830bD89Acc67eC4af516284b1bC33c',
|
|
8563
8665
|
[Blockchain.Solana]: 'HzwqbKZw8HxMN6bF2yFZNrht3c2iXXzpKcFu7uBEDKtr',
|
|
8564
8666
|
[Blockchain.World_Chain]: '0x1C60ba0A0eD1019e8Eb035E6daF4155A5cE2380B',
|
|
8667
|
+
// =========================================================================
|
|
8565
8668
|
// Testnets
|
|
8566
|
-
|
|
8669
|
+
// =========================================================================
|
|
8670
|
+
[Blockchain.Arc_Testnet]: '0x89B50855Aa3bE2F677cD6303Cec089B5F319D72a',
|
|
8671
|
+
[Blockchain.Base_Sepolia]: '0x808456652fdb597867f38412077A9182bf77359F',
|
|
8672
|
+
[Blockchain.Cronos_Testnet]: '0x31f7538adb53cF16350e6B0c89d03D91b7D12c46',
|
|
8673
|
+
[Blockchain.Ethereum_Sepolia]: '0x08210F9170F89Ab7658F0B5E3fF39b0E03C594D4'
|
|
8567
8674
|
}
|
|
8568
8675
|
};
|
|
8569
8676
|
|
|
@@ -8773,8 +8880,7 @@ const swapTokenEnumSchema = z.enum([
|
|
|
8773
8880
|
* cirBTC (Circle Bitcoin) token definition with addresses and metadata.
|
|
8774
8881
|
*
|
|
8775
8882
|
* @remarks
|
|
8776
|
-
* Built-in cirBTC definition for the TokenRegistry.
|
|
8777
|
-
* on Arc Testnet.
|
|
8883
|
+
* Built-in cirBTC definition for the TokenRegistry.
|
|
8778
8884
|
*
|
|
8779
8885
|
* @example
|
|
8780
8886
|
* ```typescript
|
|
@@ -8790,7 +8896,15 @@ const swapTokenEnumSchema = z.enum([
|
|
|
8790
8896
|
symbol: 'cirBTC',
|
|
8791
8897
|
decimals: 8,
|
|
8792
8898
|
locators: {
|
|
8793
|
-
|
|
8899
|
+
// =========================================================================
|
|
8900
|
+
// Mainnets
|
|
8901
|
+
// =========================================================================
|
|
8902
|
+
[Blockchain.Ethereum]: '0x72DFB2E44f59C5AD2bAFE84314E5b99a7cd5075E',
|
|
8903
|
+
// =========================================================================
|
|
8904
|
+
// Testnets
|
|
8905
|
+
// =========================================================================
|
|
8906
|
+
[Blockchain.Arc_Testnet]: '0xf0C4a4CE82A5746AbAAd9425360Ab04fbBA432BF',
|
|
8907
|
+
[Blockchain.Ethereum_Sepolia]: '0x3a3fe695F684Bf9b9e43CF43C2b895Ea5e392bB3'
|
|
8794
8908
|
}
|
|
8795
8909
|
};
|
|
8796
8910
|
|
|
@@ -9742,7 +9856,7 @@ const swapTokenEnumSchema = z.enum([
|
|
|
9742
9856
|
}
|
|
9743
9857
|
|
|
9744
9858
|
var name$2 = "@circle-fin/bridge-kit";
|
|
9745
|
-
var version$2 = "1.
|
|
9859
|
+
var version$2 = "1.12.0";
|
|
9746
9860
|
var pkg$2 = {
|
|
9747
9861
|
name: name$2,
|
|
9748
9862
|
version: version$2};
|
|
@@ -10632,7 +10746,7 @@ var TransferSpeed;
|
|
|
10632
10746
|
registerKit(`${pkg$2.name}/${pkg$2.version}`);
|
|
10633
10747
|
|
|
10634
10748
|
var name$1 = "@circle-fin/swap-kit";
|
|
10635
|
-
var version$1 = "1.3.
|
|
10749
|
+
var version$1 = "1.3.2";
|
|
10636
10750
|
var pkg$1 = {
|
|
10637
10751
|
name: name$1,
|
|
10638
10752
|
version: version$1};
|
|
@@ -15038,6 +15152,19 @@ const TOKEN_REGISTRY = createTokenRegistry();
|
|
|
15038
15152
|
*
|
|
15039
15153
|
* @internal
|
|
15040
15154
|
*/ const SUPPORTED_CHAINS = getSwapSupportedChains(Chains);
|
|
15155
|
+
/**
|
|
15156
|
+
* Inter-poll delays (ms) for the same-chain `amountOut` enrichment loop.
|
|
15157
|
+
*
|
|
15158
|
+
* A same-chain swap is already terminal `DONE` once its source transaction
|
|
15159
|
+
* confirms; this short, escalating budget (~5s total across up to four polls)
|
|
15160
|
+
* gives the service a brief window to resolve the output amount before
|
|
15161
|
+
* `swap()` returns. The loop exits the instant `amountOut` is available.
|
|
15162
|
+
*/ const SAME_CHAIN_AMOUNT_OUT_POLL_DELAYS_MS = [
|
|
15163
|
+
1_000,
|
|
15164
|
+
2_000,
|
|
15165
|
+
2_000
|
|
15166
|
+
];
|
|
15167
|
+
const sleep$2 = async (ms)=>new Promise((resolve)=>setTimeout(resolve, ms));
|
|
15041
15168
|
function buildSwapProgress(statusResult) {
|
|
15042
15169
|
return {
|
|
15043
15170
|
status: statusResult.status,
|
|
@@ -15057,29 +15184,46 @@ async function fetchSameChainStatusSnapshot({ isCrossChainSwap, txHash, chain, a
|
|
|
15057
15184
|
}
|
|
15058
15185
|
};
|
|
15059
15186
|
}
|
|
15060
|
-
|
|
15061
|
-
|
|
15062
|
-
|
|
15063
|
-
|
|
15064
|
-
|
|
15065
|
-
|
|
15066
|
-
|
|
15067
|
-
|
|
15187
|
+
// A same-chain swap completes atomically in the source transaction, which
|
|
15188
|
+
// has already been confirmed (and receipt-checked for revert) by the time we
|
|
15189
|
+
// get here. Its terminal status is therefore `DONE`. We briefly poll the
|
|
15190
|
+
// status endpoint to enrich `amountOut`, which the service usually resolves
|
|
15191
|
+
// within a few seconds. A non-DONE/erroneous peek never downgrades the
|
|
15192
|
+
// status — once the short budget is exhausted we return `DONE` without
|
|
15193
|
+
// `amountOut`, and the caller can fetch it later via `getSwapStatus`.
|
|
15194
|
+
for(let attempt = 0;; attempt += 1){
|
|
15195
|
+
try {
|
|
15196
|
+
const statusResult = await getSwapStatus$1({
|
|
15197
|
+
txHash,
|
|
15198
|
+
chain: chain.chain,
|
|
15199
|
+
apiKey
|
|
15200
|
+
});
|
|
15201
|
+
if (statusResult.status === 'DONE' && statusResult.amountOut !== undefined) {
|
|
15202
|
+
return {
|
|
15203
|
+
progress: buildSwapProgress(statusResult),
|
|
15204
|
+
amountOut: statusResult.amountOut
|
|
15205
|
+
};
|
|
15206
|
+
}
|
|
15207
|
+
} catch {
|
|
15208
|
+
// Reachability/parse failure during enrichment — non-fatal; the swap
|
|
15209
|
+
// already succeeded on-chain. `getSwapStatus` already retried transient
|
|
15210
|
+
// network errors internally, so further polling is unlikely to help.
|
|
15068
15211
|
return {
|
|
15069
|
-
progress
|
|
15070
|
-
|
|
15212
|
+
progress: {
|
|
15213
|
+
status: 'DONE'
|
|
15214
|
+
}
|
|
15071
15215
|
};
|
|
15072
15216
|
}
|
|
15073
|
-
|
|
15074
|
-
|
|
15075
|
-
|
|
15076
|
-
|
|
15077
|
-
|
|
15078
|
-
|
|
15079
|
-
|
|
15080
|
-
|
|
15081
|
-
|
|
15082
|
-
|
|
15217
|
+
const delayMs = SAME_CHAIN_AMOUNT_OUT_POLL_DELAYS_MS[attempt];
|
|
15218
|
+
if (delayMs === undefined) {
|
|
15219
|
+
// Budget exhausted — terminal `DONE`, `amountOut` not yet available.
|
|
15220
|
+
return {
|
|
15221
|
+
progress: {
|
|
15222
|
+
status: 'DONE'
|
|
15223
|
+
}
|
|
15224
|
+
};
|
|
15225
|
+
}
|
|
15226
|
+
await sleep$2(delayMs);
|
|
15083
15227
|
}
|
|
15084
15228
|
}
|
|
15085
15229
|
/**
|
|
@@ -15957,14 +16101,14 @@ async function fetchSameChainStatusSnapshot({ isCrossChainSwap, txHash, chain, a
|
|
|
15957
16101
|
}
|
|
15958
16102
|
// Build swap fees with adapter-backed formatting for unregistered tokens
|
|
15959
16103
|
const swapResultFees = serviceResponse.fees ? await this.buildFormattedFees(serviceResponse.fees, chain, destinationChain, adapter, config?.customFee?.recipientAddress) : undefined;
|
|
15960
|
-
// Best-effort enrichment:
|
|
15961
|
-
//
|
|
15962
|
-
//
|
|
15963
|
-
//
|
|
15964
|
-
// destination mint takes minutes (CCTPv2 attestation),
|
|
15965
|
-
//
|
|
15966
|
-
//
|
|
15967
|
-
//
|
|
16104
|
+
// Best-effort enrichment: briefly poll for amountOut on same-chain swaps.
|
|
16105
|
+
// They complete atomically in the (already-confirmed) source tx, so the
|
|
16106
|
+
// result is terminal `DONE` regardless; the short poll only adds amountOut
|
|
16107
|
+
// once the service has resolved it. Cross-chain swaps are skipped because
|
|
16108
|
+
// the destination mint takes minutes (CCTPv2 attestation), so polling would
|
|
16109
|
+
// always return PENDING/WAIT_DESTINATION_TRANSACTION while burning the
|
|
16110
|
+
// budget. Callers should use `kit.getSwapStatus()` to poll cross-chain
|
|
16111
|
+
// swaps to DONE.
|
|
15968
16112
|
const statusSnapshot = await fetchSameChainStatusSnapshot({
|
|
15969
16113
|
isCrossChainSwap,
|
|
15970
16114
|
txHash,
|
|
@@ -20266,7 +20410,7 @@ registerKit(`${pkg$1.name}/${pkg$1.version}`);
|
|
|
20266
20410
|
};
|
|
20267
20411
|
|
|
20268
20412
|
var name = "@circle-fin/earn-kit";
|
|
20269
|
-
var version = "1.2.
|
|
20413
|
+
var version = "1.2.2";
|
|
20270
20414
|
var pkg = {
|
|
20271
20415
|
name: name,
|
|
20272
20416
|
version: version};
|
|
@@ -20305,20 +20449,7 @@ var pkg = {
|
|
|
20305
20449
|
*/ ({
|
|
20306
20450
|
[Blockchain.Arc_Testnet]: CHAIN_TO_API[Blockchain.Arc_Testnet]
|
|
20307
20451
|
});
|
|
20308
|
-
|
|
20309
|
-
* Expected EIP-712 domain of the ERC-3009 authorization token per source
|
|
20310
|
-
* chain.
|
|
20311
|
-
*
|
|
20312
|
-
* Cross-chain Earn deposits are USDC-only, but USDC deployments differ on the
|
|
20313
|
-
* EIP-712 domain name: newer deployments use `USDC` while older ones (for
|
|
20314
|
-
* example Arbitrum Sepolia) kept `USD Coin` from the FiatToken V2 upgrade.
|
|
20315
|
-
* These values mirror the bridge service's per-chain domain table and the
|
|
20316
|
-
* on-chain `DOMAIN_SEPARATOR` inputs. Asserted before signing so a tampered
|
|
20317
|
-
* prepare response cannot point the signature at another token. The
|
|
20318
|
-
* `satisfies` check forces a domain entry whenever a source chain is added.
|
|
20319
|
-
*
|
|
20320
|
-
* @internal
|
|
20321
|
-
*/ ({
|
|
20452
|
+
({
|
|
20322
20453
|
[Blockchain.Arbitrum_Sepolia]: {
|
|
20323
20454
|
},
|
|
20324
20455
|
[Blockchain.Base_Sepolia]: {
|
|
@@ -20354,6 +20485,7 @@ const hexSignatureSchema = evmSignatureSchema;
|
|
|
20354
20485
|
const hexAddressSchema = evmAddressSchema;
|
|
20355
20486
|
// '0x' prefix + 32 bytes * 2 hex chars.
|
|
20356
20487
|
const BYTES32_HEX_LENGTH = 66;
|
|
20488
|
+
const bridgeFeeTokenSchema = hexAddressSchema;
|
|
20357
20489
|
/**
|
|
20358
20490
|
* Zod schema for a non-negative uint256-like value.
|
|
20359
20491
|
*
|
|
@@ -20640,14 +20772,12 @@ const eip712DomainSchema = eip712DomainSchema$1.extend({
|
|
|
20640
20772
|
*
|
|
20641
20773
|
* The bridge prepare path returns one item per collected source fee (e.g.
|
|
20642
20774
|
* `PRE_FINALITY` for the fast-burn fee and `FORWARD` for the destination
|
|
20643
|
-
* forward fee), all denominated in the shared `feeToken`.
|
|
20644
|
-
*
|
|
20645
|
-
* guard parses these to recompute the expected value. Each item's `amount` is
|
|
20646
|
-
* a base-unit decimal string in `feeToken` units.
|
|
20775
|
+
* forward fee), all denominated in the shared `feeToken`. Each item's `amount`
|
|
20776
|
+
* is a base-unit decimal string in `feeToken` units.
|
|
20647
20777
|
*
|
|
20648
20778
|
* @internal
|
|
20649
20779
|
*/ const bridgeFeeQuoteSchema = z.object({
|
|
20650
|
-
feeToken:
|
|
20780
|
+
feeToken: bridgeFeeTokenSchema,
|
|
20651
20781
|
items: z.array(z.object({
|
|
20652
20782
|
type: z.string(),
|
|
20653
20783
|
amount: uint256LikeSchema
|
|
@@ -20663,6 +20793,12 @@ const eip712DomainSchema = eip712DomainSchema$1.extend({
|
|
|
20663
20793
|
erc3009TypedData: erc3009TypedDataSchema,
|
|
20664
20794
|
feeQuote: bridgeFeeQuoteSchema
|
|
20665
20795
|
}).passthrough();
|
|
20796
|
+
const bridgeDepositPrepareReviewSchema = z.object({
|
|
20797
|
+
sourceChain: z.string(),
|
|
20798
|
+
destinationChain: z.string(),
|
|
20799
|
+
amount: amountJsonSchema,
|
|
20800
|
+
vaultAddress: hexAddressSchema
|
|
20801
|
+
}).passthrough();
|
|
20666
20802
|
/**
|
|
20667
20803
|
* Zod schema for the bridge deposit prepare payload.
|
|
20668
20804
|
*
|
|
@@ -20674,7 +20810,7 @@ const eip712DomainSchema = eip712DomainSchema$1.extend({
|
|
|
20674
20810
|
execId: bridgeDepositExecIdSchema,
|
|
20675
20811
|
erc3009TypedData: bridgeDepositPreparedBundleSchema,
|
|
20676
20812
|
expiresAt: z.string().datetime(),
|
|
20677
|
-
review:
|
|
20813
|
+
review: bridgeDepositPrepareReviewSchema
|
|
20678
20814
|
});
|
|
20679
20815
|
/**
|
|
20680
20816
|
* Zod schema for the `POST /v1/earnKit/bridge/deposit/prepare` API response.
|
|
@@ -20799,10 +20935,11 @@ const eip712DomainSchema = eip712DomainSchema$1.extend({
|
|
|
20799
20935
|
* Zod schema for a fee entry in an EarnKit API response.
|
|
20800
20936
|
*
|
|
20801
20937
|
* Shared across deposit and withdrawal responses (and reusable for real
|
|
20802
|
-
* charged fees, not just quote estimates). `type` identifies the fee category
|
|
20803
|
-
*
|
|
20804
|
-
* (e.g. `'FORWARD'`, `'PRE_FINALITY'`).
|
|
20805
|
-
* `'
|
|
20938
|
+
* charged fees, not just quote estimates). `type` identifies the fee category.
|
|
20939
|
+
* For cross-chain deposit quotes this is the kits-proxy fee-quote item type
|
|
20940
|
+
* (e.g. `'FORWARD'`, `'PRE_FINALITY'`). For withdrawal quotes, Circle fees use
|
|
20941
|
+
* `type: 'circle'`. `status` qualifies the fee (e.g. `'estimated'` for a
|
|
20942
|
+
* pre-sign cross-chain fee). Both are omitted on plain fees.
|
|
20806
20943
|
*
|
|
20807
20944
|
* @internal
|
|
20808
20945
|
*/ const feeSchema = z.object({
|
|
@@ -20953,6 +21090,10 @@ const eip712DomainSchema = eip712DomainSchema$1.extend({
|
|
|
20953
21090
|
data: exploreVaultsPayloadSchema
|
|
20954
21091
|
});
|
|
20955
21092
|
|
|
21093
|
+
// Intentionally built-ins-only: Earn bridge support is limited to SDK-known
|
|
21094
|
+
// token contracts plus the explicit ERC-3009 domain allowlist below.
|
|
21095
|
+
createTokenRegistry();
|
|
21096
|
+
|
|
20956
21097
|
/**
|
|
20957
21098
|
* Shared UTF-8 encoder for building the keccak input in
|
|
20958
21099
|
* {@link isValidEip55Checksum}, hoisted to module scope to avoid allocating a
|
|
@@ -21075,10 +21216,9 @@ const sourceAdapterContextSchema = z.object({
|
|
|
21075
21216
|
* Schema for validating human-readable decimal amount strings.
|
|
21076
21217
|
*
|
|
21077
21218
|
* Accept positive decimal strings like '100', '100.50', '0.001'. Reject
|
|
21078
|
-
* zero, negative, non-numeric, and non-canonical strings.
|
|
21079
|
-
*
|
|
21080
|
-
*
|
|
21081
|
-
* 7+ decimal-place inputs to the server.
|
|
21219
|
+
* zero, negative, non-numeric, and non-canonical strings. Same-chain
|
|
21220
|
+
* EarnKit vaults can use different asset precisions, so the service enforces
|
|
21221
|
+
* the vault-specific decimal cap after resolving the vault asset.
|
|
21082
21222
|
*
|
|
21083
21223
|
* @internal
|
|
21084
21224
|
*/ const amountSchema = z.string({
|
|
@@ -21087,32 +21227,15 @@ const sourceAdapterContextSchema = z.object({
|
|
|
21087
21227
|
allowZero: false,
|
|
21088
21228
|
regexMessage: AMOUNT_FORMAT_ERROR_MESSAGE,
|
|
21089
21229
|
attributeName: 'amount',
|
|
21090
|
-
maxDecimals:
|
|
21091
|
-
})(z.string())).refine((value)=>CANONICAL_AMOUNT_REGEX.test(value), AMOUNT_FORMAT_ERROR_MESSAGE);
|
|
21092
|
-
/**
|
|
21093
|
-
* Schema for cross-chain deposit amount strings.
|
|
21094
|
-
*
|
|
21095
|
-
* Cross-chain Earn deposits are USDC-only, and the signed ERC-3009 value is
|
|
21096
|
-
* denominated in USDC's 6 decimals. Reject more precise inputs up front so
|
|
21097
|
-
* the signed value always equals the requested amount instead of a silent
|
|
21098
|
-
* truncation. Non-canonical forms (leading dot, leading zeros) are rejected
|
|
21099
|
-
* too, matching the Earn Service.
|
|
21100
|
-
*
|
|
21101
|
-
* @internal
|
|
21102
|
-
*/ const crossChainAmountSchema = z.string({
|
|
21103
|
-
required_error: 'amount is required'
|
|
21104
|
-
}).min(1, 'amount is required').pipe(createDecimalStringValidator({
|
|
21105
|
-
allowZero: false,
|
|
21106
|
-
regexMessage: AMOUNT_FORMAT_ERROR_MESSAGE,
|
|
21107
|
-
attributeName: 'amount',
|
|
21108
|
-
maxDecimals: 6
|
|
21230
|
+
maxDecimals: 18
|
|
21109
21231
|
})(z.string())).refine((value)=>CANONICAL_AMOUNT_REGEX.test(value), AMOUNT_FORMAT_ERROR_MESSAGE);
|
|
21110
21232
|
/**
|
|
21111
21233
|
* Schema for cross-chain source fee caps.
|
|
21112
21234
|
*
|
|
21113
|
-
* Cross-chain source fees are denominated in
|
|
21114
|
-
* when the quote contains no source-collected fees; otherwise the cap
|
|
21115
|
-
* the caller-accepted total from a recent quote.
|
|
21235
|
+
* Cross-chain source fees are denominated in the quote's fee token. Zero is
|
|
21236
|
+
* valid when the quote contains no source-collected fees; otherwise the cap
|
|
21237
|
+
* should be the caller-accepted total from a recent quote. The provider
|
|
21238
|
+
* enforces the prepared bundle's fee-token precision before signing.
|
|
21116
21239
|
*
|
|
21117
21240
|
* @internal
|
|
21118
21241
|
*/ const crossChainMaxFeeSchema = z.string({
|
|
@@ -21121,7 +21244,7 @@ const sourceAdapterContextSchema = z.object({
|
|
|
21121
21244
|
allowZero: true,
|
|
21122
21245
|
regexMessage: AMOUNT_FORMAT_ERROR_MESSAGE,
|
|
21123
21246
|
attributeName: 'maxFee',
|
|
21124
|
-
maxDecimals:
|
|
21247
|
+
maxDecimals: 18
|
|
21125
21248
|
})(z.string())).refine((value)=>CANONICAL_AMOUNT_REGEX.test(value), AMOUNT_FORMAT_ERROR_MESSAGE);
|
|
21126
21249
|
/**
|
|
21127
21250
|
* Build a schema for an optional non-negative decimal filter string.
|
|
@@ -21282,7 +21405,7 @@ const crossChainDepositDestinationSchema = z.object({
|
|
|
21282
21405
|
from: sourceAdapterContextSchema,
|
|
21283
21406
|
to: crossChainDepositDestinationSchema,
|
|
21284
21407
|
vaultAddress: vaultAddressSchema,
|
|
21285
|
-
amount:
|
|
21408
|
+
amount: amountSchema,
|
|
21286
21409
|
maxFee: crossChainMaxFeeSchema,
|
|
21287
21410
|
transferSpeed: z.enum([
|
|
21288
21411
|
'FAST',
|