@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.mjs
CHANGED
|
@@ -1767,7 +1767,7 @@ class KitError extends Error {
|
|
|
1767
1767
|
*
|
|
1768
1768
|
* Error code ranges:
|
|
1769
1769
|
* - 1100-1105: INPUT errors — invalid inputs, unsupported configurations
|
|
1770
|
-
* - 8100-
|
|
1770
|
+
* - 8100-8105: SERVICE errors — retryable backend/provider failures
|
|
1771
1771
|
*
|
|
1772
1772
|
* @example
|
|
1773
1773
|
* ```typescript
|
|
@@ -1843,6 +1843,11 @@ class KitError extends Error {
|
|
|
1843
1843
|
code: 8104,
|
|
1844
1844
|
name: 'EARN_PAUSED',
|
|
1845
1845
|
type: 'SERVICE'
|
|
1846
|
+
},
|
|
1847
|
+
/** Position PnL is still reconciling and can be retried. */ POSITION_PNL_PENDING: {
|
|
1848
|
+
code: 8105,
|
|
1849
|
+
name: 'EARN_POSITION_PNL_PENDING',
|
|
1850
|
+
type: 'SERVICE'
|
|
1846
1851
|
}
|
|
1847
1852
|
};
|
|
1848
1853
|
|
|
@@ -1870,7 +1875,7 @@ function getOptionalString(value) {
|
|
|
1870
1875
|
*
|
|
1871
1876
|
* SERVICE errors (RETRYABLE) — try again later:
|
|
1872
1877
|
* - signing-failed, provider-error, rewards-fetch-failed,
|
|
1873
|
-
* internal-error, vault-refresh-busy, off-chain-paused,
|
|
1878
|
+
* internal-error, vault-refresh-busy, off-chain-paused, position-PnL-pending,
|
|
1874
1879
|
* bridge failures/status lookup failures
|
|
1875
1880
|
*
|
|
1876
1881
|
* Unrecognized codes fall through to `parseApiError` for HTTP-status-based
|
|
@@ -2057,6 +2062,13 @@ function getOptionalString(value) {
|
|
|
2057
2062
|
recoverability: 'FATAL'
|
|
2058
2063
|
}
|
|
2059
2064
|
],
|
|
2065
|
+
[
|
|
2066
|
+
380416,
|
|
2067
|
+
{
|
|
2068
|
+
errorDef: EarnError.POSITION_PNL_PENDING,
|
|
2069
|
+
recoverability: 'RETRYABLE'
|
|
2070
|
+
}
|
|
2071
|
+
],
|
|
2060
2072
|
// Bridge (380_5XX)
|
|
2061
2073
|
[
|
|
2062
2074
|
380500,
|
|
@@ -2201,6 +2213,8 @@ function getOptionalString(value) {
|
|
|
2201
2213
|
Blockchain["Celo_Alfajores_Testnet"] = "Celo_Alfajores_Testnet";
|
|
2202
2214
|
Blockchain["Codex"] = "Codex";
|
|
2203
2215
|
Blockchain["Codex_Testnet"] = "Codex_Testnet";
|
|
2216
|
+
Blockchain["Cronos"] = "Cronos";
|
|
2217
|
+
Blockchain["Cronos_Testnet"] = "Cronos_Testnet";
|
|
2204
2218
|
Blockchain["Edge"] = "Edge";
|
|
2205
2219
|
Blockchain["Edge_Testnet"] = "Edge_Testnet";
|
|
2206
2220
|
Blockchain["Ethereum"] = "Ethereum";
|
|
@@ -2283,6 +2297,7 @@ var BridgeChain;
|
|
|
2283
2297
|
BridgeChain["Avalanche"] = "Avalanche";
|
|
2284
2298
|
BridgeChain["Base"] = "Base";
|
|
2285
2299
|
BridgeChain["Codex"] = "Codex";
|
|
2300
|
+
BridgeChain["Cronos"] = "Cronos";
|
|
2286
2301
|
BridgeChain["Edge"] = "Edge";
|
|
2287
2302
|
BridgeChain["Ethereum"] = "Ethereum";
|
|
2288
2303
|
BridgeChain["HyperEVM"] = "HyperEVM";
|
|
@@ -2307,6 +2322,7 @@ var BridgeChain;
|
|
|
2307
2322
|
BridgeChain["Avalanche_Fuji"] = "Avalanche_Fuji";
|
|
2308
2323
|
BridgeChain["Base_Sepolia"] = "Base_Sepolia";
|
|
2309
2324
|
BridgeChain["Codex_Testnet"] = "Codex_Testnet";
|
|
2325
|
+
BridgeChain["Cronos_Testnet"] = "Cronos_Testnet";
|
|
2310
2326
|
BridgeChain["Edge_Testnet"] = "Edge_Testnet";
|
|
2311
2327
|
BridgeChain["Ethereum_Sepolia"] = "Ethereum_Sepolia";
|
|
2312
2328
|
BridgeChain["HyperEVM_Testnet"] = "HyperEVM_Testnet";
|
|
@@ -3352,6 +3368,96 @@ var EarnChain;
|
|
|
3352
3368
|
}
|
|
3353
3369
|
});
|
|
3354
3370
|
|
|
3371
|
+
/**
|
|
3372
|
+
* Cronos Mainnet chain definition
|
|
3373
|
+
* @remarks
|
|
3374
|
+
* This represents the official production network for the Cronos blockchain.
|
|
3375
|
+
* Cronos is an EVM-compatible blockchain.
|
|
3376
|
+
*/ const Cronos = defineChain({
|
|
3377
|
+
type: 'evm',
|
|
3378
|
+
chain: Blockchain.Cronos,
|
|
3379
|
+
name: 'Cronos',
|
|
3380
|
+
title: 'Cronos Mainnet',
|
|
3381
|
+
nativeCurrency: {
|
|
3382
|
+
name: 'Cronos',
|
|
3383
|
+
symbol: 'CRO',
|
|
3384
|
+
decimals: 18
|
|
3385
|
+
},
|
|
3386
|
+
chainId: 25,
|
|
3387
|
+
isTestnet: false,
|
|
3388
|
+
explorerUrl: 'https://cronoscan.com/tx/{hash}',
|
|
3389
|
+
rpcEndpoints: [
|
|
3390
|
+
'https://evm.cronos.org'
|
|
3391
|
+
],
|
|
3392
|
+
eurcAddress: '0xA6dE01a2d62C6B5f3525d768f34d276652C554c8',
|
|
3393
|
+
usdcAddress: '0x3D7F2C478aAfdB65542BCB44bCeeC05849999d2D',
|
|
3394
|
+
usdtAddress: null,
|
|
3395
|
+
cctp: {
|
|
3396
|
+
domain: 32,
|
|
3397
|
+
contracts: {
|
|
3398
|
+
v2: {
|
|
3399
|
+
type: 'split',
|
|
3400
|
+
tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
|
|
3401
|
+
messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
|
|
3402
|
+
confirmations: 1,
|
|
3403
|
+
fastConfirmations: 1
|
|
3404
|
+
}
|
|
3405
|
+
},
|
|
3406
|
+
forwarderSupported: {
|
|
3407
|
+
source: false,
|
|
3408
|
+
destination: false
|
|
3409
|
+
}
|
|
3410
|
+
},
|
|
3411
|
+
kitContracts: {
|
|
3412
|
+
bridge: BRIDGE_CONTRACT_EVM_MAINNET
|
|
3413
|
+
}
|
|
3414
|
+
});
|
|
3415
|
+
|
|
3416
|
+
/**
|
|
3417
|
+
* Cronos Testnet chain definition
|
|
3418
|
+
* @remarks
|
|
3419
|
+
* This represents the official test network for the Cronos blockchain.
|
|
3420
|
+
* Cronos is an EVM-compatible blockchain.
|
|
3421
|
+
*/ const CronosTestnet = defineChain({
|
|
3422
|
+
type: 'evm',
|
|
3423
|
+
chain: Blockchain.Cronos_Testnet,
|
|
3424
|
+
name: 'Cronos Testnet',
|
|
3425
|
+
title: 'Cronos Testnet',
|
|
3426
|
+
nativeCurrency: {
|
|
3427
|
+
name: 'CRO',
|
|
3428
|
+
symbol: 'tCRO',
|
|
3429
|
+
decimals: 18
|
|
3430
|
+
},
|
|
3431
|
+
chainId: 338,
|
|
3432
|
+
isTestnet: true,
|
|
3433
|
+
explorerUrl: 'https://explorer.cronos.org/testnet/tx/{hash}',
|
|
3434
|
+
rpcEndpoints: [
|
|
3435
|
+
'https://evm-t3.cronos.org'
|
|
3436
|
+
],
|
|
3437
|
+
eurcAddress: '0x31f7538adb53cF16350e6B0c89d03D91b7D12c46',
|
|
3438
|
+
usdcAddress: '0xEb33dc5fac03833e132593659e1dE7256aB59794',
|
|
3439
|
+
usdtAddress: null,
|
|
3440
|
+
cctp: {
|
|
3441
|
+
domain: 32,
|
|
3442
|
+
contracts: {
|
|
3443
|
+
v2: {
|
|
3444
|
+
type: 'split',
|
|
3445
|
+
tokenMessenger: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',
|
|
3446
|
+
messageTransmitter: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',
|
|
3447
|
+
confirmations: 1,
|
|
3448
|
+
fastConfirmations: 1
|
|
3449
|
+
}
|
|
3450
|
+
},
|
|
3451
|
+
forwarderSupported: {
|
|
3452
|
+
source: false,
|
|
3453
|
+
destination: false
|
|
3454
|
+
}
|
|
3455
|
+
},
|
|
3456
|
+
kitContracts: {
|
|
3457
|
+
bridge: BRIDGE_CONTRACT_EVM_TESTNET
|
|
3458
|
+
}
|
|
3459
|
+
});
|
|
3460
|
+
|
|
3355
3461
|
/**
|
|
3356
3462
|
* Edge Mainnet chain definition
|
|
3357
3463
|
* @remarks
|
|
@@ -5703,6 +5809,8 @@ var Chains = /*#__PURE__*/Object.freeze({
|
|
|
5703
5809
|
CeloAlfajoresTestnet: CeloAlfajoresTestnet,
|
|
5704
5810
|
Codex: Codex,
|
|
5705
5811
|
CodexTestnet: CodexTestnet,
|
|
5812
|
+
Cronos: Cronos,
|
|
5813
|
+
CronosTestnet: CronosTestnet,
|
|
5706
5814
|
Edge: Edge,
|
|
5707
5815
|
EdgeTestnet: EdgeTestnet,
|
|
5708
5816
|
Ethereum: Ethereum,
|
|
@@ -7134,6 +7242,7 @@ const swapTokenEnumSchema = z.enum([
|
|
|
7134
7242
|
[Blockchain.Base]: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',
|
|
7135
7243
|
[Blockchain.Celo]: '0xcebA9300f2b948710d2653dD7B07f33A8B32118C',
|
|
7136
7244
|
[Blockchain.Codex]: '0xd996633a415985DBd7D6D12f4A4343E31f5037cf',
|
|
7245
|
+
[Blockchain.Cronos]: '0x3D7F2C478aAfdB65542BCB44bCeeC05849999d2D',
|
|
7137
7246
|
[Blockchain.Edge]: '0x98d2919b9A214E6Fa5384AC81E6864bA686Ad74c',
|
|
7138
7247
|
[Blockchain.Ethereum]: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
|
|
7139
7248
|
[Blockchain.Hedera]: '0.0.456858',
|
|
@@ -7167,6 +7276,7 @@ const swapTokenEnumSchema = z.enum([
|
|
|
7167
7276
|
[Blockchain.Avalanche_Fuji]: '0x5425890298aed601595a70AB815c96711a31Bc65',
|
|
7168
7277
|
[Blockchain.Base_Sepolia]: '0x036CbD53842c5426634e7929541eC2318f3dCF7e',
|
|
7169
7278
|
[Blockchain.Codex_Testnet]: '0x6d7f141b6819C2c9CC2f818e6ad549E7Ca090F8f',
|
|
7279
|
+
[Blockchain.Cronos_Testnet]: '0xEb33dc5fac03833e132593659e1dE7256aB59794',
|
|
7170
7280
|
[Blockchain.Edge_Testnet]: '0x2d9F7CAD728051AA35Ecdc472a14cf8cDF5CFD6B',
|
|
7171
7281
|
[Blockchain.Ethereum_Sepolia]: '0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238',
|
|
7172
7282
|
[Blockchain.Hedera_Testnet]: '0.0.429274',
|
|
@@ -7239,6 +7349,7 @@ const swapTokenEnumSchema = z.enum([
|
|
|
7239
7349
|
// =========================================================================
|
|
7240
7350
|
[Blockchain.Avalanche]: '0xc891EB4cbdEFf6e073e859e987815Ed1505c2ACD',
|
|
7241
7351
|
[Blockchain.Base]: '0x60a3E35Cc302bFA44Cb288Bc5a4F316Fdb1adb42',
|
|
7352
|
+
[Blockchain.Cronos]: '0xA6dE01a2d62C6B5f3525d768f34d276652C554c8',
|
|
7242
7353
|
[Blockchain.Ethereum]: '0x1aBaEA1f7C830bD89Acc67eC4af516284b1bC33c',
|
|
7243
7354
|
[Blockchain.Solana]: 'HzwqbKZw8HxMN6bF2yFZNrht3c2iXXzpKcFu7uBEDKtr',
|
|
7244
7355
|
[Blockchain.World_Chain]: '0x1C60ba0A0eD1019e8Eb035E6daF4155A5cE2380B',
|
|
@@ -7247,6 +7358,7 @@ const swapTokenEnumSchema = z.enum([
|
|
|
7247
7358
|
// =========================================================================
|
|
7248
7359
|
[Blockchain.Arc_Testnet]: '0x89B50855Aa3bE2F677cD6303Cec089B5F319D72a',
|
|
7249
7360
|
[Blockchain.Base_Sepolia]: '0x808456652fdb597867f38412077A9182bf77359F',
|
|
7361
|
+
[Blockchain.Cronos_Testnet]: '0x31f7538adb53cF16350e6B0c89d03D91b7D12c46',
|
|
7250
7362
|
[Blockchain.Ethereum_Sepolia]: '0x08210F9170F89Ab7658F0B5E3fF39b0E03C594D4'
|
|
7251
7363
|
}
|
|
7252
7364
|
};
|
|
@@ -7920,11 +8032,11 @@ const swapTokenEnumSchema = z.enum([
|
|
|
7920
8032
|
return pkgName.replace('@circle-fin/', '');
|
|
7921
8033
|
}
|
|
7922
8034
|
|
|
7923
|
-
var name$
|
|
7924
|
-
var version$
|
|
7925
|
-
var pkg$
|
|
7926
|
-
name: name$
|
|
7927
|
-
version: version$
|
|
8035
|
+
var name$3 = "@circle-fin/bridge-kit";
|
|
8036
|
+
var version$3 = "1.12.0";
|
|
8037
|
+
var pkg$3 = {
|
|
8038
|
+
name: name$3,
|
|
8039
|
+
version: version$3};
|
|
7928
8040
|
|
|
7929
8041
|
/**
|
|
7930
8042
|
* Schema for validating BridgeKit custom fee policy.
|
|
@@ -8772,16 +8884,16 @@ var TransferSpeed;
|
|
|
8772
8884
|
* @internal
|
|
8773
8885
|
*/ Object.values(Chains).filter((chain)=>isCCTPV2Supported(chain));
|
|
8774
8886
|
|
|
8775
|
-
/** SDK name used in telemetry payloads. */ resolveKitSdkName(pkg$
|
|
8887
|
+
/** SDK name used in telemetry payloads. */ resolveKitSdkName(pkg$3.name);
|
|
8776
8888
|
|
|
8777
8889
|
// Auto-register this kit for user agent tracking
|
|
8778
|
-
registerKit(`${pkg$
|
|
8890
|
+
registerKit(`${pkg$3.name}/${pkg$3.version}`);
|
|
8779
8891
|
|
|
8780
|
-
var name$
|
|
8781
|
-
var version$
|
|
8782
|
-
var pkg$
|
|
8783
|
-
name: name$
|
|
8784
|
-
version: version$
|
|
8892
|
+
var name$2 = "@circle-fin/swap-kit";
|
|
8893
|
+
var version$2 = "1.3.2";
|
|
8894
|
+
var pkg$2 = {
|
|
8895
|
+
name: name$2,
|
|
8896
|
+
version: version$2};
|
|
8785
8897
|
|
|
8786
8898
|
const chainIdentifierField = z.custom((value)=>chainIdentifierSchema.safeParse(value).success, {
|
|
8787
8899
|
message: 'chain must be a valid chain identifier'
|
|
@@ -12066,16 +12178,16 @@ new Set(Object.values(Blockchain));
|
|
|
12066
12178
|
|
|
12067
12179
|
new Set(Object.values(Blockchain));
|
|
12068
12180
|
|
|
12069
|
-
/** SDK name used in telemetry payloads. */ resolveKitSdkName(pkg$
|
|
12181
|
+
/** SDK name used in telemetry payloads. */ resolveKitSdkName(pkg$2.name);
|
|
12070
12182
|
|
|
12071
12183
|
// Auto-register this kit for user agent tracking
|
|
12072
|
-
registerKit(`${pkg$
|
|
12184
|
+
registerKit(`${pkg$2.name}/${pkg$2.version}`);
|
|
12073
12185
|
|
|
12074
|
-
var name = "@circle-fin/earn-kit";
|
|
12075
|
-
var version = "1.2.
|
|
12076
|
-
var pkg = {
|
|
12077
|
-
name: name,
|
|
12078
|
-
version: version};
|
|
12186
|
+
var name$1 = "@circle-fin/earn-kit";
|
|
12187
|
+
var version$1 = "1.2.2";
|
|
12188
|
+
var pkg$1 = {
|
|
12189
|
+
name: name$1,
|
|
12190
|
+
version: version$1};
|
|
12079
12191
|
|
|
12080
12192
|
const EARN_BRIDGE_ERC3009_TOKEN_SYMBOLS = [
|
|
12081
12193
|
'USDC'
|
|
@@ -13647,10 +13759,11 @@ const bridgeDepositPrepareReviewSchema = z.object({
|
|
|
13647
13759
|
* Zod schema for a fee entry in an EarnKit API response.
|
|
13648
13760
|
*
|
|
13649
13761
|
* Shared across deposit and withdrawal responses (and reusable for real
|
|
13650
|
-
* charged fees, not just quote estimates). `type` identifies the fee category
|
|
13651
|
-
*
|
|
13652
|
-
* (e.g. `'FORWARD'`, `'PRE_FINALITY'`).
|
|
13653
|
-
* `'
|
|
13762
|
+
* charged fees, not just quote estimates). `type` identifies the fee category.
|
|
13763
|
+
* For cross-chain deposit quotes this is the kits-proxy fee-quote item type
|
|
13764
|
+
* (e.g. `'FORWARD'`, `'PRE_FINALITY'`). For withdrawal quotes, Circle fees use
|
|
13765
|
+
* `type: 'circle'`. `status` qualifies the fee (e.g. `'estimated'` for a
|
|
13766
|
+
* pre-sign cross-chain fee). Both are omitted on plain fees.
|
|
13654
13767
|
*
|
|
13655
13768
|
* @internal
|
|
13656
13769
|
*/ const feeSchema = z.object({
|
|
@@ -13922,6 +14035,60 @@ const bridgeDepositPrepareReviewSchema = z.object({
|
|
|
13922
14035
|
return claimRewardsQuoteResponseSchema.safeParse(value).success;
|
|
13923
14036
|
}
|
|
13924
14037
|
|
|
14038
|
+
var name = "@circle-fin/provider-earn-service";
|
|
14039
|
+
var version = "1.2.2";
|
|
14040
|
+
var pkg = {
|
|
14041
|
+
name: name,
|
|
14042
|
+
version: version};
|
|
14043
|
+
|
|
14044
|
+
/**
|
|
14045
|
+
* HTTP header name used to report the EarnKit SDK version to the backend.
|
|
14046
|
+
*
|
|
14047
|
+
* @internal
|
|
14048
|
+
*/ const SDK_VERSION_HEADER = 'X-EarnKit-SDK-Version';
|
|
14049
|
+
/**
|
|
14050
|
+
* Resolve the SDK version string from its source components.
|
|
14051
|
+
*
|
|
14052
|
+
* Resolution order:
|
|
14053
|
+
* 1. The registered kit identifier (preferred) — e.g. `@circle-fin/earn-kit/1.1.0`
|
|
14054
|
+
* becomes `earn-kit/1.1.0`.
|
|
14055
|
+
* 2. The provider package itself (fallback when no kit is registered) —
|
|
14056
|
+
* e.g. `provider-earn-service/1.1.0`.
|
|
14057
|
+
* 3. The literal `unknown` when neither source is available.
|
|
14058
|
+
*
|
|
14059
|
+
* Kept as a pure function (no global / module reads) so every branch is
|
|
14060
|
+
* unit-testable.
|
|
14061
|
+
*
|
|
14062
|
+
* @param kitId - The registered kit identifier, or `undefined`.
|
|
14063
|
+
* @param providerName - The provider package name (e.g. `@circle-fin/provider-earn-service`).
|
|
14064
|
+
* @param providerVersion - The provider package version, or `undefined`.
|
|
14065
|
+
* @returns The formatted SDK version string.
|
|
14066
|
+
*
|
|
14067
|
+
* @internal
|
|
14068
|
+
*/ function formatSdkVersion(kitId, providerName, providerVersion) {
|
|
14069
|
+
if (kitId !== undefined && kitId !== '') {
|
|
14070
|
+
// e.g. '@circle-fin/earn-kit/1.1.0' -> 'earn-kit/1.1.0'
|
|
14071
|
+
return resolveKitSdkName(kitId);
|
|
14072
|
+
}
|
|
14073
|
+
{
|
|
14074
|
+
// e.g. '@circle-fin/provider-earn-service' + '1.1.0' -> 'provider-earn-service/1.1.0'
|
|
14075
|
+
return `${resolveKitSdkName(providerName)}/${providerVersion}`;
|
|
14076
|
+
}
|
|
14077
|
+
}
|
|
14078
|
+
/**
|
|
14079
|
+
* Resolve the value for the {@link SDK_VERSION_HEADER} header.
|
|
14080
|
+
*
|
|
14081
|
+
* Reads the kit registered at runtime via {@link createRequestContext} and
|
|
14082
|
+
* falls back to this provider package's own version when no kit is registered.
|
|
14083
|
+
*
|
|
14084
|
+
* @returns The SDK version string, e.g. `earn-kit/1.1.0` or
|
|
14085
|
+
* `provider-earn-service/1.1.0`, or `unknown`.
|
|
14086
|
+
*
|
|
14087
|
+
* @internal
|
|
14088
|
+
*/ function resolveSdkVersionHeader() {
|
|
14089
|
+
return formatSdkVersion(createRequestContext().kit, pkg.name, pkg.version);
|
|
14090
|
+
}
|
|
14091
|
+
|
|
13925
14092
|
/**
|
|
13926
14093
|
* Build an API polling config with optional authorization header,
|
|
13927
14094
|
* and resolve the base URL (configurable for testing).
|
|
@@ -13932,9 +14099,16 @@ const bridgeDepositPrepareReviewSchema = z.object({
|
|
|
13932
14099
|
* @internal
|
|
13933
14100
|
*/ function buildConfig(serviceConfig) {
|
|
13934
14101
|
const baseUrl = serviceConfig?.baseUrl ?? EARN_SERVICE_BASE_URL;
|
|
14102
|
+
const sdkVersion = resolveSdkVersionHeader();
|
|
13935
14103
|
if (serviceConfig?.kitKey === undefined) {
|
|
13936
14104
|
return {
|
|
13937
|
-
pollingConfig:
|
|
14105
|
+
pollingConfig: {
|
|
14106
|
+
...DEFAULT_CONFIG,
|
|
14107
|
+
headers: {
|
|
14108
|
+
...DEFAULT_CONFIG.headers,
|
|
14109
|
+
[SDK_VERSION_HEADER]: sdkVersion
|
|
14110
|
+
}
|
|
14111
|
+
},
|
|
13938
14112
|
baseUrl
|
|
13939
14113
|
};
|
|
13940
14114
|
}
|
|
@@ -13950,6 +14124,7 @@ const bridgeDepositPrepareReviewSchema = z.object({
|
|
|
13950
14124
|
...DEFAULT_CONFIG,
|
|
13951
14125
|
headers: {
|
|
13952
14126
|
...DEFAULT_CONFIG.headers,
|
|
14127
|
+
[SDK_VERSION_HEADER]: sdkVersion,
|
|
13953
14128
|
Authorization: `Bearer ${serviceConfig.kitKey}`
|
|
13954
14129
|
}
|
|
13955
14130
|
},
|
|
@@ -14682,9 +14857,15 @@ function toWithdrawalQuoteInfo(data) {
|
|
|
14682
14857
|
symbol: data.asset,
|
|
14683
14858
|
amount: Amount.fromJSON(data.maxWithdrawable)
|
|
14684
14859
|
},
|
|
14685
|
-
fees: data.fees.map((
|
|
14686
|
-
symbol:
|
|
14687
|
-
amount: Amount.fromJSON(
|
|
14860
|
+
fees: data.fees.map(({ token, amount, type, status })=>({
|
|
14861
|
+
symbol: token,
|
|
14862
|
+
amount: Amount.fromJSON(amount),
|
|
14863
|
+
...type !== undefined && {
|
|
14864
|
+
type
|
|
14865
|
+
},
|
|
14866
|
+
...status !== undefined && {
|
|
14867
|
+
status
|
|
14868
|
+
}
|
|
14688
14869
|
})),
|
|
14689
14870
|
gasFees: [],
|
|
14690
14871
|
// Wire format uses `warnings`, but the SDK surface uses
|
|
@@ -17893,7 +18074,7 @@ function formatRetryResult(operation, result) {
|
|
|
17893
18074
|
}
|
|
17894
18075
|
|
|
17895
18076
|
// Auto-register this kit for user agent tracking
|
|
17896
|
-
registerKit(`${pkg.name}/${pkg.version}`);
|
|
18077
|
+
registerKit(`${pkg$1.name}/${pkg$1.version}`);
|
|
17897
18078
|
|
|
17898
18079
|
/**
|
|
17899
18080
|
* Create an EarnKit instance for AppKit earn operations.
|