@circle-fin/app-kit 1.8.1 → 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 +45 -0
- package/README.md +3 -3
- package/bridge.cjs +425 -179
- package/bridge.d.cts +14 -0
- package/bridge.d.mts +14 -0
- package/bridge.d.ts +14 -0
- package/bridge.mjs +425 -179
- 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 +14 -0
- package/context.d.mts +14 -0
- package/context.d.ts +14 -0
- package/earn.cjs +211 -30
- package/earn.d.cts +25 -5
- package/earn.d.mts +25 -5
- package/earn.d.ts +25 -5
- package/earn.mjs +211 -30
- package/estimateBridge.cjs +425 -179
- package/estimateBridge.d.cts +14 -0
- package/estimateBridge.d.mts +14 -0
- package/estimateBridge.d.ts +14 -0
- package/estimateBridge.mjs +425 -179
- package/estimateSwap.cjs +108 -7
- package/estimateSwap.d.cts +14 -0
- package/estimateSwap.d.mts +14 -0
- package/estimateSwap.d.ts +14 -0
- package/estimateSwap.mjs +108 -7
- package/index.cjs +586 -224
- package/index.d.cts +274 -17
- package/index.d.mts +274 -17
- package/index.d.ts +274 -17
- package/index.mjs +586 -224
- package/package.json +12 -6
- package/swap.cjs +108 -7
- package/swap.d.cts +14 -0
- package/swap.d.mts +14 -0
- package/swap.d.ts +14 -0
- package/swap.mjs +108 -7
- package/unifiedBalance.cjs +101 -1
- package/unifiedBalance.d.cts +2 -0
- package/unifiedBalance.d.mts +2 -0
- package/unifiedBalance.d.ts +2 -0
- package/unifiedBalance.mjs +101 -1
package/earn.cjs
CHANGED
|
@@ -1769,7 +1769,7 @@ class KitError extends Error {
|
|
|
1769
1769
|
*
|
|
1770
1770
|
* Error code ranges:
|
|
1771
1771
|
* - 1100-1105: INPUT errors — invalid inputs, unsupported configurations
|
|
1772
|
-
* - 8100-
|
|
1772
|
+
* - 8100-8105: SERVICE errors — retryable backend/provider failures
|
|
1773
1773
|
*
|
|
1774
1774
|
* @example
|
|
1775
1775
|
* ```typescript
|
|
@@ -1845,6 +1845,11 @@ class KitError extends Error {
|
|
|
1845
1845
|
code: 8104,
|
|
1846
1846
|
name: 'EARN_PAUSED',
|
|
1847
1847
|
type: 'SERVICE'
|
|
1848
|
+
},
|
|
1849
|
+
/** Position PnL is still reconciling and can be retried. */ POSITION_PNL_PENDING: {
|
|
1850
|
+
code: 8105,
|
|
1851
|
+
name: 'EARN_POSITION_PNL_PENDING',
|
|
1852
|
+
type: 'SERVICE'
|
|
1848
1853
|
}
|
|
1849
1854
|
};
|
|
1850
1855
|
|
|
@@ -1872,7 +1877,7 @@ function getOptionalString(value) {
|
|
|
1872
1877
|
*
|
|
1873
1878
|
* SERVICE errors (RETRYABLE) — try again later:
|
|
1874
1879
|
* - signing-failed, provider-error, rewards-fetch-failed,
|
|
1875
|
-
* internal-error, vault-refresh-busy, off-chain-paused,
|
|
1880
|
+
* internal-error, vault-refresh-busy, off-chain-paused, position-PnL-pending,
|
|
1876
1881
|
* bridge failures/status lookup failures
|
|
1877
1882
|
*
|
|
1878
1883
|
* Unrecognized codes fall through to `parseApiError` for HTTP-status-based
|
|
@@ -2059,6 +2064,13 @@ function getOptionalString(value) {
|
|
|
2059
2064
|
recoverability: 'FATAL'
|
|
2060
2065
|
}
|
|
2061
2066
|
],
|
|
2067
|
+
[
|
|
2068
|
+
380416,
|
|
2069
|
+
{
|
|
2070
|
+
errorDef: EarnError.POSITION_PNL_PENDING,
|
|
2071
|
+
recoverability: 'RETRYABLE'
|
|
2072
|
+
}
|
|
2073
|
+
],
|
|
2062
2074
|
// Bridge (380_5XX)
|
|
2063
2075
|
[
|
|
2064
2076
|
380500,
|
|
@@ -2203,6 +2215,8 @@ function getOptionalString(value) {
|
|
|
2203
2215
|
Blockchain["Celo_Alfajores_Testnet"] = "Celo_Alfajores_Testnet";
|
|
2204
2216
|
Blockchain["Codex"] = "Codex";
|
|
2205
2217
|
Blockchain["Codex_Testnet"] = "Codex_Testnet";
|
|
2218
|
+
Blockchain["Cronos"] = "Cronos";
|
|
2219
|
+
Blockchain["Cronos_Testnet"] = "Cronos_Testnet";
|
|
2206
2220
|
Blockchain["Edge"] = "Edge";
|
|
2207
2221
|
Blockchain["Edge_Testnet"] = "Edge_Testnet";
|
|
2208
2222
|
Blockchain["Ethereum"] = "Ethereum";
|
|
@@ -2285,6 +2299,7 @@ var BridgeChain;
|
|
|
2285
2299
|
BridgeChain["Avalanche"] = "Avalanche";
|
|
2286
2300
|
BridgeChain["Base"] = "Base";
|
|
2287
2301
|
BridgeChain["Codex"] = "Codex";
|
|
2302
|
+
BridgeChain["Cronos"] = "Cronos";
|
|
2288
2303
|
BridgeChain["Edge"] = "Edge";
|
|
2289
2304
|
BridgeChain["Ethereum"] = "Ethereum";
|
|
2290
2305
|
BridgeChain["HyperEVM"] = "HyperEVM";
|
|
@@ -2309,6 +2324,7 @@ var BridgeChain;
|
|
|
2309
2324
|
BridgeChain["Avalanche_Fuji"] = "Avalanche_Fuji";
|
|
2310
2325
|
BridgeChain["Base_Sepolia"] = "Base_Sepolia";
|
|
2311
2326
|
BridgeChain["Codex_Testnet"] = "Codex_Testnet";
|
|
2327
|
+
BridgeChain["Cronos_Testnet"] = "Cronos_Testnet";
|
|
2312
2328
|
BridgeChain["Edge_Testnet"] = "Edge_Testnet";
|
|
2313
2329
|
BridgeChain["Ethereum_Sepolia"] = "Ethereum_Sepolia";
|
|
2314
2330
|
BridgeChain["HyperEVM_Testnet"] = "HyperEVM_Testnet";
|
|
@@ -3354,6 +3370,96 @@ var EarnChain;
|
|
|
3354
3370
|
}
|
|
3355
3371
|
});
|
|
3356
3372
|
|
|
3373
|
+
/**
|
|
3374
|
+
* Cronos Mainnet chain definition
|
|
3375
|
+
* @remarks
|
|
3376
|
+
* This represents the official production network for the Cronos blockchain.
|
|
3377
|
+
* Cronos is an EVM-compatible blockchain.
|
|
3378
|
+
*/ const Cronos = defineChain({
|
|
3379
|
+
type: 'evm',
|
|
3380
|
+
chain: Blockchain.Cronos,
|
|
3381
|
+
name: 'Cronos',
|
|
3382
|
+
title: 'Cronos Mainnet',
|
|
3383
|
+
nativeCurrency: {
|
|
3384
|
+
name: 'Cronos',
|
|
3385
|
+
symbol: 'CRO',
|
|
3386
|
+
decimals: 18
|
|
3387
|
+
},
|
|
3388
|
+
chainId: 25,
|
|
3389
|
+
isTestnet: false,
|
|
3390
|
+
explorerUrl: 'https://cronoscan.com/tx/{hash}',
|
|
3391
|
+
rpcEndpoints: [
|
|
3392
|
+
'https://evm.cronos.org'
|
|
3393
|
+
],
|
|
3394
|
+
eurcAddress: '0xA6dE01a2d62C6B5f3525d768f34d276652C554c8',
|
|
3395
|
+
usdcAddress: '0x3D7F2C478aAfdB65542BCB44bCeeC05849999d2D',
|
|
3396
|
+
usdtAddress: null,
|
|
3397
|
+
cctp: {
|
|
3398
|
+
domain: 32,
|
|
3399
|
+
contracts: {
|
|
3400
|
+
v2: {
|
|
3401
|
+
type: 'split',
|
|
3402
|
+
tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
|
|
3403
|
+
messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
|
|
3404
|
+
confirmations: 1,
|
|
3405
|
+
fastConfirmations: 1
|
|
3406
|
+
}
|
|
3407
|
+
},
|
|
3408
|
+
forwarderSupported: {
|
|
3409
|
+
source: false,
|
|
3410
|
+
destination: false
|
|
3411
|
+
}
|
|
3412
|
+
},
|
|
3413
|
+
kitContracts: {
|
|
3414
|
+
bridge: BRIDGE_CONTRACT_EVM_MAINNET
|
|
3415
|
+
}
|
|
3416
|
+
});
|
|
3417
|
+
|
|
3418
|
+
/**
|
|
3419
|
+
* Cronos Testnet chain definition
|
|
3420
|
+
* @remarks
|
|
3421
|
+
* This represents the official test network for the Cronos blockchain.
|
|
3422
|
+
* Cronos is an EVM-compatible blockchain.
|
|
3423
|
+
*/ const CronosTestnet = defineChain({
|
|
3424
|
+
type: 'evm',
|
|
3425
|
+
chain: Blockchain.Cronos_Testnet,
|
|
3426
|
+
name: 'Cronos Testnet',
|
|
3427
|
+
title: 'Cronos Testnet',
|
|
3428
|
+
nativeCurrency: {
|
|
3429
|
+
name: 'CRO',
|
|
3430
|
+
symbol: 'tCRO',
|
|
3431
|
+
decimals: 18
|
|
3432
|
+
},
|
|
3433
|
+
chainId: 338,
|
|
3434
|
+
isTestnet: true,
|
|
3435
|
+
explorerUrl: 'https://explorer.cronos.org/testnet/tx/{hash}',
|
|
3436
|
+
rpcEndpoints: [
|
|
3437
|
+
'https://evm-t3.cronos.org'
|
|
3438
|
+
],
|
|
3439
|
+
eurcAddress: '0x31f7538adb53cF16350e6B0c89d03D91b7D12c46',
|
|
3440
|
+
usdcAddress: '0xEb33dc5fac03833e132593659e1dE7256aB59794',
|
|
3441
|
+
usdtAddress: null,
|
|
3442
|
+
cctp: {
|
|
3443
|
+
domain: 32,
|
|
3444
|
+
contracts: {
|
|
3445
|
+
v2: {
|
|
3446
|
+
type: 'split',
|
|
3447
|
+
tokenMessenger: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',
|
|
3448
|
+
messageTransmitter: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',
|
|
3449
|
+
confirmations: 1,
|
|
3450
|
+
fastConfirmations: 1
|
|
3451
|
+
}
|
|
3452
|
+
},
|
|
3453
|
+
forwarderSupported: {
|
|
3454
|
+
source: false,
|
|
3455
|
+
destination: false
|
|
3456
|
+
}
|
|
3457
|
+
},
|
|
3458
|
+
kitContracts: {
|
|
3459
|
+
bridge: BRIDGE_CONTRACT_EVM_TESTNET
|
|
3460
|
+
}
|
|
3461
|
+
});
|
|
3462
|
+
|
|
3357
3463
|
/**
|
|
3358
3464
|
* Edge Mainnet chain definition
|
|
3359
3465
|
* @remarks
|
|
@@ -5705,6 +5811,8 @@ var Chains = {
|
|
|
5705
5811
|
CeloAlfajoresTestnet: CeloAlfajoresTestnet,
|
|
5706
5812
|
Codex: Codex,
|
|
5707
5813
|
CodexTestnet: CodexTestnet,
|
|
5814
|
+
Cronos: Cronos,
|
|
5815
|
+
CronosTestnet: CronosTestnet,
|
|
5708
5816
|
Edge: Edge,
|
|
5709
5817
|
EdgeTestnet: EdgeTestnet,
|
|
5710
5818
|
Ethereum: Ethereum,
|
|
@@ -7136,6 +7244,7 @@ const swapTokenEnumSchema = zod.z.enum([
|
|
|
7136
7244
|
[Blockchain.Base]: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',
|
|
7137
7245
|
[Blockchain.Celo]: '0xcebA9300f2b948710d2653dD7B07f33A8B32118C',
|
|
7138
7246
|
[Blockchain.Codex]: '0xd996633a415985DBd7D6D12f4A4343E31f5037cf',
|
|
7247
|
+
[Blockchain.Cronos]: '0x3D7F2C478aAfdB65542BCB44bCeeC05849999d2D',
|
|
7139
7248
|
[Blockchain.Edge]: '0x98d2919b9A214E6Fa5384AC81E6864bA686Ad74c',
|
|
7140
7249
|
[Blockchain.Ethereum]: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
|
|
7141
7250
|
[Blockchain.Hedera]: '0.0.456858',
|
|
@@ -7169,6 +7278,7 @@ const swapTokenEnumSchema = zod.z.enum([
|
|
|
7169
7278
|
[Blockchain.Avalanche_Fuji]: '0x5425890298aed601595a70AB815c96711a31Bc65',
|
|
7170
7279
|
[Blockchain.Base_Sepolia]: '0x036CbD53842c5426634e7929541eC2318f3dCF7e',
|
|
7171
7280
|
[Blockchain.Codex_Testnet]: '0x6d7f141b6819C2c9CC2f818e6ad549E7Ca090F8f',
|
|
7281
|
+
[Blockchain.Cronos_Testnet]: '0xEb33dc5fac03833e132593659e1dE7256aB59794',
|
|
7172
7282
|
[Blockchain.Edge_Testnet]: '0x2d9F7CAD728051AA35Ecdc472a14cf8cDF5CFD6B',
|
|
7173
7283
|
[Blockchain.Ethereum_Sepolia]: '0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238',
|
|
7174
7284
|
[Blockchain.Hedera_Testnet]: '0.0.429274',
|
|
@@ -7241,6 +7351,7 @@ const swapTokenEnumSchema = zod.z.enum([
|
|
|
7241
7351
|
// =========================================================================
|
|
7242
7352
|
[Blockchain.Avalanche]: '0xc891EB4cbdEFf6e073e859e987815Ed1505c2ACD',
|
|
7243
7353
|
[Blockchain.Base]: '0x60a3E35Cc302bFA44Cb288Bc5a4F316Fdb1adb42',
|
|
7354
|
+
[Blockchain.Cronos]: '0xA6dE01a2d62C6B5f3525d768f34d276652C554c8',
|
|
7244
7355
|
[Blockchain.Ethereum]: '0x1aBaEA1f7C830bD89Acc67eC4af516284b1bC33c',
|
|
7245
7356
|
[Blockchain.Solana]: 'HzwqbKZw8HxMN6bF2yFZNrht3c2iXXzpKcFu7uBEDKtr',
|
|
7246
7357
|
[Blockchain.World_Chain]: '0x1C60ba0A0eD1019e8Eb035E6daF4155A5cE2380B',
|
|
@@ -7249,6 +7360,7 @@ const swapTokenEnumSchema = zod.z.enum([
|
|
|
7249
7360
|
// =========================================================================
|
|
7250
7361
|
[Blockchain.Arc_Testnet]: '0x89B50855Aa3bE2F677cD6303Cec089B5F319D72a',
|
|
7251
7362
|
[Blockchain.Base_Sepolia]: '0x808456652fdb597867f38412077A9182bf77359F',
|
|
7363
|
+
[Blockchain.Cronos_Testnet]: '0x31f7538adb53cF16350e6B0c89d03D91b7D12c46',
|
|
7252
7364
|
[Blockchain.Ethereum_Sepolia]: '0x08210F9170F89Ab7658F0B5E3fF39b0E03C594D4'
|
|
7253
7365
|
}
|
|
7254
7366
|
};
|
|
@@ -7922,11 +8034,11 @@ const swapTokenEnumSchema = zod.z.enum([
|
|
|
7922
8034
|
return pkgName.replace('@circle-fin/', '');
|
|
7923
8035
|
}
|
|
7924
8036
|
|
|
7925
|
-
var name$
|
|
7926
|
-
var version$
|
|
7927
|
-
var pkg$
|
|
7928
|
-
name: name$
|
|
7929
|
-
version: version$
|
|
8037
|
+
var name$3 = "@circle-fin/bridge-kit";
|
|
8038
|
+
var version$3 = "1.12.0";
|
|
8039
|
+
var pkg$3 = {
|
|
8040
|
+
name: name$3,
|
|
8041
|
+
version: version$3};
|
|
7930
8042
|
|
|
7931
8043
|
/**
|
|
7932
8044
|
* Schema for validating BridgeKit custom fee policy.
|
|
@@ -8774,16 +8886,16 @@ var TransferSpeed;
|
|
|
8774
8886
|
* @internal
|
|
8775
8887
|
*/ Object.values(Chains).filter((chain)=>isCCTPV2Supported(chain));
|
|
8776
8888
|
|
|
8777
|
-
/** SDK name used in telemetry payloads. */ resolveKitSdkName(pkg$
|
|
8889
|
+
/** SDK name used in telemetry payloads. */ resolveKitSdkName(pkg$3.name);
|
|
8778
8890
|
|
|
8779
8891
|
// Auto-register this kit for user agent tracking
|
|
8780
|
-
registerKit(`${pkg$
|
|
8892
|
+
registerKit(`${pkg$3.name}/${pkg$3.version}`);
|
|
8781
8893
|
|
|
8782
|
-
var name$
|
|
8783
|
-
var version$
|
|
8784
|
-
var pkg$
|
|
8785
|
-
name: name$
|
|
8786
|
-
version: version$
|
|
8894
|
+
var name$2 = "@circle-fin/swap-kit";
|
|
8895
|
+
var version$2 = "1.3.2";
|
|
8896
|
+
var pkg$2 = {
|
|
8897
|
+
name: name$2,
|
|
8898
|
+
version: version$2};
|
|
8787
8899
|
|
|
8788
8900
|
const chainIdentifierField = zod.z.custom((value)=>chainIdentifierSchema.safeParse(value).success, {
|
|
8789
8901
|
message: 'chain must be a valid chain identifier'
|
|
@@ -12068,16 +12180,16 @@ new Set(Object.values(Blockchain));
|
|
|
12068
12180
|
|
|
12069
12181
|
new Set(Object.values(Blockchain));
|
|
12070
12182
|
|
|
12071
|
-
/** SDK name used in telemetry payloads. */ resolveKitSdkName(pkg$
|
|
12183
|
+
/** SDK name used in telemetry payloads. */ resolveKitSdkName(pkg$2.name);
|
|
12072
12184
|
|
|
12073
12185
|
// Auto-register this kit for user agent tracking
|
|
12074
|
-
registerKit(`${pkg$
|
|
12186
|
+
registerKit(`${pkg$2.name}/${pkg$2.version}`);
|
|
12075
12187
|
|
|
12076
|
-
var name = "@circle-fin/earn-kit";
|
|
12077
|
-
var version = "1.2.
|
|
12078
|
-
var pkg = {
|
|
12079
|
-
name: name,
|
|
12080
|
-
version: version};
|
|
12188
|
+
var name$1 = "@circle-fin/earn-kit";
|
|
12189
|
+
var version$1 = "1.2.2";
|
|
12190
|
+
var pkg$1 = {
|
|
12191
|
+
name: name$1,
|
|
12192
|
+
version: version$1};
|
|
12081
12193
|
|
|
12082
12194
|
const EARN_BRIDGE_ERC3009_TOKEN_SYMBOLS = [
|
|
12083
12195
|
'USDC'
|
|
@@ -13649,10 +13761,11 @@ const bridgeDepositPrepareReviewSchema = zod.z.object({
|
|
|
13649
13761
|
* Zod schema for a fee entry in an EarnKit API response.
|
|
13650
13762
|
*
|
|
13651
13763
|
* Shared across deposit and withdrawal responses (and reusable for real
|
|
13652
|
-
* charged fees, not just quote estimates). `type` identifies the fee category
|
|
13653
|
-
*
|
|
13654
|
-
* (e.g. `'FORWARD'`, `'PRE_FINALITY'`).
|
|
13655
|
-
* `'
|
|
13764
|
+
* charged fees, not just quote estimates). `type` identifies the fee category.
|
|
13765
|
+
* For cross-chain deposit quotes this is the kits-proxy fee-quote item type
|
|
13766
|
+
* (e.g. `'FORWARD'`, `'PRE_FINALITY'`). For withdrawal quotes, Circle fees use
|
|
13767
|
+
* `type: 'circle'`. `status` qualifies the fee (e.g. `'estimated'` for a
|
|
13768
|
+
* pre-sign cross-chain fee). Both are omitted on plain fees.
|
|
13656
13769
|
*
|
|
13657
13770
|
* @internal
|
|
13658
13771
|
*/ const feeSchema = zod.z.object({
|
|
@@ -13924,6 +14037,60 @@ const bridgeDepositPrepareReviewSchema = zod.z.object({
|
|
|
13924
14037
|
return claimRewardsQuoteResponseSchema.safeParse(value).success;
|
|
13925
14038
|
}
|
|
13926
14039
|
|
|
14040
|
+
var name = "@circle-fin/provider-earn-service";
|
|
14041
|
+
var version = "1.2.2";
|
|
14042
|
+
var pkg = {
|
|
14043
|
+
name: name,
|
|
14044
|
+
version: version};
|
|
14045
|
+
|
|
14046
|
+
/**
|
|
14047
|
+
* HTTP header name used to report the EarnKit SDK version to the backend.
|
|
14048
|
+
*
|
|
14049
|
+
* @internal
|
|
14050
|
+
*/ const SDK_VERSION_HEADER = 'X-EarnKit-SDK-Version';
|
|
14051
|
+
/**
|
|
14052
|
+
* Resolve the SDK version string from its source components.
|
|
14053
|
+
*
|
|
14054
|
+
* Resolution order:
|
|
14055
|
+
* 1. The registered kit identifier (preferred) — e.g. `@circle-fin/earn-kit/1.1.0`
|
|
14056
|
+
* becomes `earn-kit/1.1.0`.
|
|
14057
|
+
* 2. The provider package itself (fallback when no kit is registered) —
|
|
14058
|
+
* e.g. `provider-earn-service/1.1.0`.
|
|
14059
|
+
* 3. The literal `unknown` when neither source is available.
|
|
14060
|
+
*
|
|
14061
|
+
* Kept as a pure function (no global / module reads) so every branch is
|
|
14062
|
+
* unit-testable.
|
|
14063
|
+
*
|
|
14064
|
+
* @param kitId - The registered kit identifier, or `undefined`.
|
|
14065
|
+
* @param providerName - The provider package name (e.g. `@circle-fin/provider-earn-service`).
|
|
14066
|
+
* @param providerVersion - The provider package version, or `undefined`.
|
|
14067
|
+
* @returns The formatted SDK version string.
|
|
14068
|
+
*
|
|
14069
|
+
* @internal
|
|
14070
|
+
*/ function formatSdkVersion(kitId, providerName, providerVersion) {
|
|
14071
|
+
if (kitId !== undefined && kitId !== '') {
|
|
14072
|
+
// e.g. '@circle-fin/earn-kit/1.1.0' -> 'earn-kit/1.1.0'
|
|
14073
|
+
return resolveKitSdkName(kitId);
|
|
14074
|
+
}
|
|
14075
|
+
{
|
|
14076
|
+
// e.g. '@circle-fin/provider-earn-service' + '1.1.0' -> 'provider-earn-service/1.1.0'
|
|
14077
|
+
return `${resolveKitSdkName(providerName)}/${providerVersion}`;
|
|
14078
|
+
}
|
|
14079
|
+
}
|
|
14080
|
+
/**
|
|
14081
|
+
* Resolve the value for the {@link SDK_VERSION_HEADER} header.
|
|
14082
|
+
*
|
|
14083
|
+
* Reads the kit registered at runtime via {@link createRequestContext} and
|
|
14084
|
+
* falls back to this provider package's own version when no kit is registered.
|
|
14085
|
+
*
|
|
14086
|
+
* @returns The SDK version string, e.g. `earn-kit/1.1.0` or
|
|
14087
|
+
* `provider-earn-service/1.1.0`, or `unknown`.
|
|
14088
|
+
*
|
|
14089
|
+
* @internal
|
|
14090
|
+
*/ function resolveSdkVersionHeader() {
|
|
14091
|
+
return formatSdkVersion(createRequestContext().kit, pkg.name, pkg.version);
|
|
14092
|
+
}
|
|
14093
|
+
|
|
13927
14094
|
/**
|
|
13928
14095
|
* Build an API polling config with optional authorization header,
|
|
13929
14096
|
* and resolve the base URL (configurable for testing).
|
|
@@ -13934,9 +14101,16 @@ const bridgeDepositPrepareReviewSchema = zod.z.object({
|
|
|
13934
14101
|
* @internal
|
|
13935
14102
|
*/ function buildConfig(serviceConfig) {
|
|
13936
14103
|
const baseUrl = serviceConfig?.baseUrl ?? EARN_SERVICE_BASE_URL;
|
|
14104
|
+
const sdkVersion = resolveSdkVersionHeader();
|
|
13937
14105
|
if (serviceConfig?.kitKey === undefined) {
|
|
13938
14106
|
return {
|
|
13939
|
-
pollingConfig:
|
|
14107
|
+
pollingConfig: {
|
|
14108
|
+
...DEFAULT_CONFIG,
|
|
14109
|
+
headers: {
|
|
14110
|
+
...DEFAULT_CONFIG.headers,
|
|
14111
|
+
[SDK_VERSION_HEADER]: sdkVersion
|
|
14112
|
+
}
|
|
14113
|
+
},
|
|
13940
14114
|
baseUrl
|
|
13941
14115
|
};
|
|
13942
14116
|
}
|
|
@@ -13952,6 +14126,7 @@ const bridgeDepositPrepareReviewSchema = zod.z.object({
|
|
|
13952
14126
|
...DEFAULT_CONFIG,
|
|
13953
14127
|
headers: {
|
|
13954
14128
|
...DEFAULT_CONFIG.headers,
|
|
14129
|
+
[SDK_VERSION_HEADER]: sdkVersion,
|
|
13955
14130
|
Authorization: `Bearer ${serviceConfig.kitKey}`
|
|
13956
14131
|
}
|
|
13957
14132
|
},
|
|
@@ -14684,9 +14859,15 @@ function toWithdrawalQuoteInfo(data) {
|
|
|
14684
14859
|
symbol: data.asset,
|
|
14685
14860
|
amount: Amount.fromJSON(data.maxWithdrawable)
|
|
14686
14861
|
},
|
|
14687
|
-
fees: data.fees.map((
|
|
14688
|
-
symbol:
|
|
14689
|
-
amount: Amount.fromJSON(
|
|
14862
|
+
fees: data.fees.map(({ token, amount, type, status })=>({
|
|
14863
|
+
symbol: token,
|
|
14864
|
+
amount: Amount.fromJSON(amount),
|
|
14865
|
+
...type !== undefined && {
|
|
14866
|
+
type
|
|
14867
|
+
},
|
|
14868
|
+
...status !== undefined && {
|
|
14869
|
+
status
|
|
14870
|
+
}
|
|
14690
14871
|
})),
|
|
14691
14872
|
gasFees: [],
|
|
14692
14873
|
// Wire format uses `warnings`, but the SDK surface uses
|
|
@@ -17895,7 +18076,7 @@ function formatRetryResult(operation, result) {
|
|
|
17895
18076
|
}
|
|
17896
18077
|
|
|
17897
18078
|
// Auto-register this kit for user agent tracking
|
|
17898
|
-
registerKit(`${pkg.name}/${pkg.version}`);
|
|
18079
|
+
registerKit(`${pkg$1.name}/${pkg$1.version}`);
|
|
17899
18080
|
|
|
17900
18081
|
/**
|
|
17901
18082
|
* Create an EarnKit instance for AppKit earn operations.
|
package/earn.d.cts
CHANGED
|
@@ -659,6 +659,8 @@ declare enum Blockchain {
|
|
|
659
659
|
Celo_Alfajores_Testnet = "Celo_Alfajores_Testnet",
|
|
660
660
|
Codex = "Codex",
|
|
661
661
|
Codex_Testnet = "Codex_Testnet",
|
|
662
|
+
Cronos = "Cronos",
|
|
663
|
+
Cronos_Testnet = "Cronos_Testnet",
|
|
662
664
|
Edge = "Edge",
|
|
663
665
|
Edge_Testnet = "Edge_Testnet",
|
|
664
666
|
Ethereum = "Ethereum",
|
|
@@ -900,6 +902,7 @@ declare enum BridgeChain {
|
|
|
900
902
|
Avalanche = "Avalanche",
|
|
901
903
|
Base = "Base",
|
|
902
904
|
Codex = "Codex",
|
|
905
|
+
Cronos = "Cronos",
|
|
903
906
|
Edge = "Edge",
|
|
904
907
|
Ethereum = "Ethereum",
|
|
905
908
|
HyperEVM = "HyperEVM",
|
|
@@ -923,6 +926,7 @@ declare enum BridgeChain {
|
|
|
923
926
|
Avalanche_Fuji = "Avalanche_Fuji",
|
|
924
927
|
Base_Sepolia = "Base_Sepolia",
|
|
925
928
|
Codex_Testnet = "Codex_Testnet",
|
|
929
|
+
Cronos_Testnet = "Cronos_Testnet",
|
|
926
930
|
Edge_Testnet = "Edge_Testnet",
|
|
927
931
|
Ethereum_Sepolia = "Ethereum_Sepolia",
|
|
928
932
|
HyperEVM_Testnet = "HyperEVM_Testnet",
|
|
@@ -6380,10 +6384,11 @@ interface AssetAmount {
|
|
|
6380
6384
|
/**
|
|
6381
6385
|
* Optional category tag for the amount.
|
|
6382
6386
|
*
|
|
6383
|
-
* Present on fee entries to identify the kind of fee
|
|
6384
|
-
*
|
|
6385
|
-
* `'PRE_FINALITY'`)
|
|
6386
|
-
* (
|
|
6387
|
+
* Present on fee entries to identify the kind of fee. For cross-chain deposit
|
|
6388
|
+
* quotes this is the source-fee item type (e.g. `'FORWARD'`,
|
|
6389
|
+
* `'PRE_FINALITY'`), and for withdrawal quotes this can identify Circle fees
|
|
6390
|
+
* (e.g. `'circle'`). Omitted when the amount has no meaningful
|
|
6391
|
+
* category (plain deposit/withdrawal/share/reward amounts).
|
|
6387
6392
|
*/
|
|
6388
6393
|
readonly type?: string | undefined;
|
|
6389
6394
|
/**
|
|
@@ -6806,7 +6811,12 @@ interface WithdrawalQuoteInfo {
|
|
|
6806
6811
|
* available balance and quoted withdrawal in a single round-trip.
|
|
6807
6812
|
*/
|
|
6808
6813
|
readonly maxWithdrawable: AssetAmount;
|
|
6809
|
-
/**
|
|
6814
|
+
/**
|
|
6815
|
+
* Fees applied to the withdrawal.
|
|
6816
|
+
*
|
|
6817
|
+
* Circle fees are returned with `type: 'circle'` so callers can distinguish
|
|
6818
|
+
* them from untyped plain fees and native gas estimates.
|
|
6819
|
+
*/
|
|
6810
6820
|
readonly fees: readonly AssetAmount[];
|
|
6811
6821
|
/**
|
|
6812
6822
|
* Estimated native gas fees for the transactions needed to withdraw.
|
|
@@ -8064,6 +8074,16 @@ interface AppKitContext {
|
|
|
8064
8074
|
* @defaultValue false
|
|
8065
8075
|
*/
|
|
8066
8076
|
disableErrorReporting?: boolean;
|
|
8077
|
+
/**
|
|
8078
|
+
* Custom HTTP headers forwarded with the underlying CCTP provider's
|
|
8079
|
+
* attestation (Iris) API requests made by bridge operations.
|
|
8080
|
+
*
|
|
8081
|
+
* @remarks
|
|
8082
|
+
* Headers are merged on top of the SDK defaults (such as `Content-Type`)
|
|
8083
|
+
* rather than replacing them. The header is forwarded as-is to Circle's API;
|
|
8084
|
+
* the SDK does not interpret it.
|
|
8085
|
+
*/
|
|
8086
|
+
headers?: Record<string, string>;
|
|
8067
8087
|
}
|
|
8068
8088
|
|
|
8069
8089
|
/**
|
package/earn.d.mts
CHANGED
|
@@ -659,6 +659,8 @@ declare enum Blockchain {
|
|
|
659
659
|
Celo_Alfajores_Testnet = "Celo_Alfajores_Testnet",
|
|
660
660
|
Codex = "Codex",
|
|
661
661
|
Codex_Testnet = "Codex_Testnet",
|
|
662
|
+
Cronos = "Cronos",
|
|
663
|
+
Cronos_Testnet = "Cronos_Testnet",
|
|
662
664
|
Edge = "Edge",
|
|
663
665
|
Edge_Testnet = "Edge_Testnet",
|
|
664
666
|
Ethereum = "Ethereum",
|
|
@@ -900,6 +902,7 @@ declare enum BridgeChain {
|
|
|
900
902
|
Avalanche = "Avalanche",
|
|
901
903
|
Base = "Base",
|
|
902
904
|
Codex = "Codex",
|
|
905
|
+
Cronos = "Cronos",
|
|
903
906
|
Edge = "Edge",
|
|
904
907
|
Ethereum = "Ethereum",
|
|
905
908
|
HyperEVM = "HyperEVM",
|
|
@@ -923,6 +926,7 @@ declare enum BridgeChain {
|
|
|
923
926
|
Avalanche_Fuji = "Avalanche_Fuji",
|
|
924
927
|
Base_Sepolia = "Base_Sepolia",
|
|
925
928
|
Codex_Testnet = "Codex_Testnet",
|
|
929
|
+
Cronos_Testnet = "Cronos_Testnet",
|
|
926
930
|
Edge_Testnet = "Edge_Testnet",
|
|
927
931
|
Ethereum_Sepolia = "Ethereum_Sepolia",
|
|
928
932
|
HyperEVM_Testnet = "HyperEVM_Testnet",
|
|
@@ -6380,10 +6384,11 @@ interface AssetAmount {
|
|
|
6380
6384
|
/**
|
|
6381
6385
|
* Optional category tag for the amount.
|
|
6382
6386
|
*
|
|
6383
|
-
* Present on fee entries to identify the kind of fee
|
|
6384
|
-
*
|
|
6385
|
-
* `'PRE_FINALITY'`)
|
|
6386
|
-
* (
|
|
6387
|
+
* Present on fee entries to identify the kind of fee. For cross-chain deposit
|
|
6388
|
+
* quotes this is the source-fee item type (e.g. `'FORWARD'`,
|
|
6389
|
+
* `'PRE_FINALITY'`), and for withdrawal quotes this can identify Circle fees
|
|
6390
|
+
* (e.g. `'circle'`). Omitted when the amount has no meaningful
|
|
6391
|
+
* category (plain deposit/withdrawal/share/reward amounts).
|
|
6387
6392
|
*/
|
|
6388
6393
|
readonly type?: string | undefined;
|
|
6389
6394
|
/**
|
|
@@ -6806,7 +6811,12 @@ interface WithdrawalQuoteInfo {
|
|
|
6806
6811
|
* available balance and quoted withdrawal in a single round-trip.
|
|
6807
6812
|
*/
|
|
6808
6813
|
readonly maxWithdrawable: AssetAmount;
|
|
6809
|
-
/**
|
|
6814
|
+
/**
|
|
6815
|
+
* Fees applied to the withdrawal.
|
|
6816
|
+
*
|
|
6817
|
+
* Circle fees are returned with `type: 'circle'` so callers can distinguish
|
|
6818
|
+
* them from untyped plain fees and native gas estimates.
|
|
6819
|
+
*/
|
|
6810
6820
|
readonly fees: readonly AssetAmount[];
|
|
6811
6821
|
/**
|
|
6812
6822
|
* Estimated native gas fees for the transactions needed to withdraw.
|
|
@@ -8064,6 +8074,16 @@ interface AppKitContext {
|
|
|
8064
8074
|
* @defaultValue false
|
|
8065
8075
|
*/
|
|
8066
8076
|
disableErrorReporting?: boolean;
|
|
8077
|
+
/**
|
|
8078
|
+
* Custom HTTP headers forwarded with the underlying CCTP provider's
|
|
8079
|
+
* attestation (Iris) API requests made by bridge operations.
|
|
8080
|
+
*
|
|
8081
|
+
* @remarks
|
|
8082
|
+
* Headers are merged on top of the SDK defaults (such as `Content-Type`)
|
|
8083
|
+
* rather than replacing them. The header is forwarded as-is to Circle's API;
|
|
8084
|
+
* the SDK does not interpret it.
|
|
8085
|
+
*/
|
|
8086
|
+
headers?: Record<string, string>;
|
|
8067
8087
|
}
|
|
8068
8088
|
|
|
8069
8089
|
/**
|
package/earn.d.ts
CHANGED
|
@@ -659,6 +659,8 @@ declare enum Blockchain {
|
|
|
659
659
|
Celo_Alfajores_Testnet = "Celo_Alfajores_Testnet",
|
|
660
660
|
Codex = "Codex",
|
|
661
661
|
Codex_Testnet = "Codex_Testnet",
|
|
662
|
+
Cronos = "Cronos",
|
|
663
|
+
Cronos_Testnet = "Cronos_Testnet",
|
|
662
664
|
Edge = "Edge",
|
|
663
665
|
Edge_Testnet = "Edge_Testnet",
|
|
664
666
|
Ethereum = "Ethereum",
|
|
@@ -900,6 +902,7 @@ declare enum BridgeChain {
|
|
|
900
902
|
Avalanche = "Avalanche",
|
|
901
903
|
Base = "Base",
|
|
902
904
|
Codex = "Codex",
|
|
905
|
+
Cronos = "Cronos",
|
|
903
906
|
Edge = "Edge",
|
|
904
907
|
Ethereum = "Ethereum",
|
|
905
908
|
HyperEVM = "HyperEVM",
|
|
@@ -923,6 +926,7 @@ declare enum BridgeChain {
|
|
|
923
926
|
Avalanche_Fuji = "Avalanche_Fuji",
|
|
924
927
|
Base_Sepolia = "Base_Sepolia",
|
|
925
928
|
Codex_Testnet = "Codex_Testnet",
|
|
929
|
+
Cronos_Testnet = "Cronos_Testnet",
|
|
926
930
|
Edge_Testnet = "Edge_Testnet",
|
|
927
931
|
Ethereum_Sepolia = "Ethereum_Sepolia",
|
|
928
932
|
HyperEVM_Testnet = "HyperEVM_Testnet",
|
|
@@ -6380,10 +6384,11 @@ interface AssetAmount {
|
|
|
6380
6384
|
/**
|
|
6381
6385
|
* Optional category tag for the amount.
|
|
6382
6386
|
*
|
|
6383
|
-
* Present on fee entries to identify the kind of fee
|
|
6384
|
-
*
|
|
6385
|
-
* `'PRE_FINALITY'`)
|
|
6386
|
-
* (
|
|
6387
|
+
* Present on fee entries to identify the kind of fee. For cross-chain deposit
|
|
6388
|
+
* quotes this is the source-fee item type (e.g. `'FORWARD'`,
|
|
6389
|
+
* `'PRE_FINALITY'`), and for withdrawal quotes this can identify Circle fees
|
|
6390
|
+
* (e.g. `'circle'`). Omitted when the amount has no meaningful
|
|
6391
|
+
* category (plain deposit/withdrawal/share/reward amounts).
|
|
6387
6392
|
*/
|
|
6388
6393
|
readonly type?: string | undefined;
|
|
6389
6394
|
/**
|
|
@@ -6806,7 +6811,12 @@ interface WithdrawalQuoteInfo {
|
|
|
6806
6811
|
* available balance and quoted withdrawal in a single round-trip.
|
|
6807
6812
|
*/
|
|
6808
6813
|
readonly maxWithdrawable: AssetAmount;
|
|
6809
|
-
/**
|
|
6814
|
+
/**
|
|
6815
|
+
* Fees applied to the withdrawal.
|
|
6816
|
+
*
|
|
6817
|
+
* Circle fees are returned with `type: 'circle'` so callers can distinguish
|
|
6818
|
+
* them from untyped plain fees and native gas estimates.
|
|
6819
|
+
*/
|
|
6810
6820
|
readonly fees: readonly AssetAmount[];
|
|
6811
6821
|
/**
|
|
6812
6822
|
* Estimated native gas fees for the transactions needed to withdraw.
|
|
@@ -8064,6 +8074,16 @@ interface AppKitContext {
|
|
|
8064
8074
|
* @defaultValue false
|
|
8065
8075
|
*/
|
|
8066
8076
|
disableErrorReporting?: boolean;
|
|
8077
|
+
/**
|
|
8078
|
+
* Custom HTTP headers forwarded with the underlying CCTP provider's
|
|
8079
|
+
* attestation (Iris) API requests made by bridge operations.
|
|
8080
|
+
*
|
|
8081
|
+
* @remarks
|
|
8082
|
+
* Headers are merged on top of the SDK defaults (such as `Content-Type`)
|
|
8083
|
+
* rather than replacing them. The header is forwarded as-is to Circle's API;
|
|
8084
|
+
* the SDK does not interpret it.
|
|
8085
|
+
*/
|
|
8086
|
+
headers?: Record<string, string>;
|
|
8067
8087
|
}
|
|
8068
8088
|
|
|
8069
8089
|
/**
|