@circle-fin/app-kit 1.11.0 → 1.12.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 +39 -0
- package/README.md +56 -25
- package/bridge.cjs +227 -30
- package/bridge.d.cts +879 -1
- package/bridge.d.mts +879 -1
- package/bridge.d.ts +879 -1
- package/bridge.mjs +227 -30
- package/chains.cjs +106 -1
- package/chains.d.cts +96 -2
- package/chains.d.mts +96 -2
- package/chains.d.ts +96 -2
- package/chains.mjs +105 -2
- package/context.d.cts +879 -1
- package/context.d.mts +879 -1
- package/context.d.ts +879 -1
- package/earn.cjs +1595 -79
- package/earn.d.cts +879 -1
- package/earn.d.mts +879 -1
- package/earn.d.ts +879 -1
- package/earn.mjs +1595 -79
- package/estimateBridge.cjs +227 -30
- package/estimateBridge.d.cts +879 -1
- package/estimateBridge.d.mts +879 -1
- package/estimateBridge.d.ts +879 -1
- package/estimateBridge.mjs +227 -30
- package/estimateSwap.cjs +135 -12
- package/estimateSwap.d.cts +878 -1
- package/estimateSwap.d.mts +878 -1
- package/estimateSwap.d.ts +878 -1
- package/estimateSwap.mjs +135 -12
- package/index.cjs +2063 -245
- package/index.d.cts +2309 -1653
- package/index.d.mts +2309 -1653
- package/index.d.ts +2309 -1653
- package/index.mjs +2062 -246
- package/package.json +6 -6
- package/swap.cjs +135 -12
- package/swap.d.cts +878 -1
- package/swap.d.mts +878 -1
- package/swap.d.ts +878 -1
- package/swap.mjs +135 -12
- package/unifiedBalance.cjs +316 -107
- package/unifiedBalance.d.cts +2 -0
- package/unifiedBalance.d.mts +2 -0
- package/unifiedBalance.d.ts +2 -0
- package/unifiedBalance.mjs +316 -107
package/bridge.mjs
CHANGED
|
@@ -38,6 +38,7 @@ import { PublicKey } from '@solana/web3.js';
|
|
|
38
38
|
import 'bn.js';
|
|
39
39
|
import '@coral-xyz/anchor';
|
|
40
40
|
import '@noble/curves/ed25519';
|
|
41
|
+
import 'viem';
|
|
41
42
|
import { keccak256 } from '@ethersproject/keccak256';
|
|
42
43
|
|
|
43
44
|
// Import global type declarations
|
|
@@ -2555,6 +2556,8 @@ class KitError extends Error {
|
|
|
2555
2556
|
Blockchain["World_Chain_Sepolia"] = "World_Chain_Sepolia";
|
|
2556
2557
|
Blockchain["XDC"] = "XDC";
|
|
2557
2558
|
Blockchain["XDC_Apothem"] = "XDC_Apothem";
|
|
2559
|
+
Blockchain["X_Layer"] = "X_Layer";
|
|
2560
|
+
Blockchain["X_Layer_Testnet"] = "X_Layer_Testnet";
|
|
2558
2561
|
Blockchain["ZKSync_Era"] = "ZKSync_Era";
|
|
2559
2562
|
Blockchain["ZKSync_Sepolia"] = "ZKSync_Sepolia";
|
|
2560
2563
|
})(Blockchain || (Blockchain = {}));
|
|
@@ -2608,6 +2611,7 @@ var BridgeChain;
|
|
|
2608
2611
|
BridgeChain["Unichain"] = "Unichain";
|
|
2609
2612
|
BridgeChain["World_Chain"] = "World_Chain";
|
|
2610
2613
|
BridgeChain["XDC"] = "XDC";
|
|
2614
|
+
BridgeChain["X_Layer"] = "X_Layer";
|
|
2611
2615
|
// Testnet chains with CCTPv2 support
|
|
2612
2616
|
BridgeChain["Arc_Testnet"] = "Arc_Testnet";
|
|
2613
2617
|
BridgeChain["Arbitrum_Sepolia"] = "Arbitrum_Sepolia";
|
|
@@ -2633,6 +2637,7 @@ var BridgeChain;
|
|
|
2633
2637
|
BridgeChain["Unichain_Sepolia"] = "Unichain_Sepolia";
|
|
2634
2638
|
BridgeChain["World_Chain_Sepolia"] = "World_Chain_Sepolia";
|
|
2635
2639
|
BridgeChain["XDC_Apothem"] = "XDC_Apothem";
|
|
2640
|
+
BridgeChain["X_Layer_Testnet"] = "X_Layer_Testnet";
|
|
2636
2641
|
})(BridgeChain || (BridgeChain = {}));
|
|
2637
2642
|
var UnifiedBalanceChain;
|
|
2638
2643
|
(function(UnifiedBalanceChain) {
|
|
@@ -5170,7 +5175,8 @@ var EarnChain;
|
|
|
5170
5175
|
isTestnet: true,
|
|
5171
5176
|
explorerUrl: 'https://amoy.polygonscan.com/tx/{hash}',
|
|
5172
5177
|
rpcEndpoints: [
|
|
5173
|
-
'https://
|
|
5178
|
+
'https://polygon-amoy-bor-rpc.publicnode.com',
|
|
5179
|
+
'https://polygon-amoy.drpc.org'
|
|
5174
5180
|
],
|
|
5175
5181
|
eurcAddress: null,
|
|
5176
5182
|
usdcAddress: '0x41e94eb019c0762f9bfcf9fb1e58725bfb0e7582',
|
|
@@ -6035,6 +6041,104 @@ var EarnChain;
|
|
|
6035
6041
|
}
|
|
6036
6042
|
});
|
|
6037
6043
|
|
|
6044
|
+
/**
|
|
6045
|
+
* X Layer Mainnet chain definition
|
|
6046
|
+
* @remarks
|
|
6047
|
+
* This represents the official production network for the X Layer blockchain.
|
|
6048
|
+
* X Layer is an EVM-compatible OP Stack Layer-2 blockchain built by OKX,
|
|
6049
|
+
* using OKB as its native gas token. (Migrated from Polygon zkEVM/CDK to the
|
|
6050
|
+
* OP Stack on 2025-10-27; older docs describing it as zkEVM are obsolete.)
|
|
6051
|
+
*/ const XLayer = defineChain({
|
|
6052
|
+
type: 'evm',
|
|
6053
|
+
chain: Blockchain.X_Layer,
|
|
6054
|
+
name: 'X Layer',
|
|
6055
|
+
title: 'X Layer Mainnet',
|
|
6056
|
+
nativeCurrency: {
|
|
6057
|
+
name: 'OKB',
|
|
6058
|
+
symbol: 'OKB',
|
|
6059
|
+
decimals: 18
|
|
6060
|
+
},
|
|
6061
|
+
chainId: 196,
|
|
6062
|
+
isTestnet: false,
|
|
6063
|
+
explorerUrl: 'https://www.oklink.com/xlayer/tx/{hash}',
|
|
6064
|
+
rpcEndpoints: [
|
|
6065
|
+
'https://xlayerrpc.okx.com'
|
|
6066
|
+
],
|
|
6067
|
+
eurcAddress: null,
|
|
6068
|
+
usdcAddress: '0xB6CEceAB302E2E4948951eE7843FC24E92933061',
|
|
6069
|
+
usdtAddress: null,
|
|
6070
|
+
cctp: {
|
|
6071
|
+
domain: 37,
|
|
6072
|
+
contracts: {
|
|
6073
|
+
v2: {
|
|
6074
|
+
type: 'split',
|
|
6075
|
+
tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
|
|
6076
|
+
messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
|
|
6077
|
+
confirmations: 65,
|
|
6078
|
+
fastConfirmations: 1
|
|
6079
|
+
}
|
|
6080
|
+
},
|
|
6081
|
+
forwarderSupported: {
|
|
6082
|
+
source: false,
|
|
6083
|
+
destination: false
|
|
6084
|
+
}
|
|
6085
|
+
},
|
|
6086
|
+
kitContracts: {
|
|
6087
|
+
bridge: BRIDGE_CONTRACT_EVM_MAINNET
|
|
6088
|
+
}
|
|
6089
|
+
});
|
|
6090
|
+
|
|
6091
|
+
/**
|
|
6092
|
+
* X Layer Testnet chain definition
|
|
6093
|
+
* @remarks
|
|
6094
|
+
* This represents the official test network for the X Layer blockchain.
|
|
6095
|
+
* X Layer is an EVM-compatible OP Stack Layer-2 blockchain built by OKX,
|
|
6096
|
+
* using OKB as its native gas token. (Migrated from Polygon zkEVM/CDK to the
|
|
6097
|
+
* OP Stack on 2025-10-27; older docs describing it as zkEVM are obsolete.)
|
|
6098
|
+
*/ const XLayerTestnet = defineChain({
|
|
6099
|
+
type: 'evm',
|
|
6100
|
+
chain: Blockchain.X_Layer_Testnet,
|
|
6101
|
+
name: 'X Layer Testnet',
|
|
6102
|
+
title: 'X Layer Testnet',
|
|
6103
|
+
nativeCurrency: {
|
|
6104
|
+
name: 'OKB',
|
|
6105
|
+
symbol: 'OKB',
|
|
6106
|
+
decimals: 18
|
|
6107
|
+
},
|
|
6108
|
+
chainId: 1952,
|
|
6109
|
+
isTestnet: true,
|
|
6110
|
+
// Deliberately not oklink.com (used for mainnet): viem's bundled OKLink
|
|
6111
|
+
// testnet URL targets the deprecated pre-rebrand chain ID 195, not this
|
|
6112
|
+
// chain's ID (1952). Verified against the internal chain-expansion-scripts
|
|
6113
|
+
// config (`v2config.sandbox.yml`) — do not "normalize" this to match mainnet.
|
|
6114
|
+
explorerUrl: 'https://web3.okx.com/explorer/x-layer-testnet/tx/{hash}',
|
|
6115
|
+
rpcEndpoints: [
|
|
6116
|
+
'https://testrpc.xlayer.tech'
|
|
6117
|
+
],
|
|
6118
|
+
eurcAddress: null,
|
|
6119
|
+
usdcAddress: '0xDec90b78111Ba2fc6FC6d84d8B9ec159A2d4b9B3',
|
|
6120
|
+
usdtAddress: null,
|
|
6121
|
+
cctp: {
|
|
6122
|
+
domain: 37,
|
|
6123
|
+
contracts: {
|
|
6124
|
+
v2: {
|
|
6125
|
+
type: 'split',
|
|
6126
|
+
tokenMessenger: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',
|
|
6127
|
+
messageTransmitter: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',
|
|
6128
|
+
confirmations: 65,
|
|
6129
|
+
fastConfirmations: 1
|
|
6130
|
+
}
|
|
6131
|
+
},
|
|
6132
|
+
forwarderSupported: {
|
|
6133
|
+
source: false,
|
|
6134
|
+
destination: false
|
|
6135
|
+
}
|
|
6136
|
+
},
|
|
6137
|
+
kitContracts: {
|
|
6138
|
+
bridge: BRIDGE_CONTRACT_EVM_TESTNET
|
|
6139
|
+
}
|
|
6140
|
+
});
|
|
6141
|
+
|
|
6038
6142
|
/**
|
|
6039
6143
|
* ZKSync Era Mainnet chain definition
|
|
6040
6144
|
* @remarks
|
|
@@ -6154,6 +6258,8 @@ var Chains = /*#__PURE__*/Object.freeze({
|
|
|
6154
6258
|
WorldChainSepolia: WorldChainSepolia,
|
|
6155
6259
|
XDC: XDC,
|
|
6156
6260
|
XDCApothem: XDCApothem,
|
|
6261
|
+
XLayer: XLayer,
|
|
6262
|
+
XLayerTestnet: XLayerTestnet,
|
|
6157
6263
|
ZKSyncEra: ZKSyncEra,
|
|
6158
6264
|
ZKSyncEraSepolia: ZKSyncEraSepolia
|
|
6159
6265
|
});
|
|
@@ -8208,6 +8314,7 @@ const swapTokenEnumSchema = z.enum([
|
|
|
8208
8314
|
[Blockchain.Unichain]: '0x078D782b760474a361dDA0AF3839290b0EF57AD6',
|
|
8209
8315
|
[Blockchain.World_Chain]: '0x79A02482A880bCE3F13e09Da970dC34db4CD24d1',
|
|
8210
8316
|
[Blockchain.XDC]: '0xfA2958CB79b0491CC627c1557F441eF849Ca8eb1',
|
|
8317
|
+
[Blockchain.X_Layer]: '0xB6CEceAB302E2E4948951eE7843FC24E92933061',
|
|
8211
8318
|
[Blockchain.ZKSync_Era]: '0x1d17CBcF0D6D143135aE902365D2E5e2A16538D4',
|
|
8212
8319
|
// =========================================================================
|
|
8213
8320
|
// Testnets (alphabetically sorted)
|
|
@@ -8242,6 +8349,7 @@ const swapTokenEnumSchema = z.enum([
|
|
|
8242
8349
|
[Blockchain.Unichain_Sepolia]: '0x31d0220469e10c4E71834a79b1f276d740d3768F',
|
|
8243
8350
|
[Blockchain.World_Chain_Sepolia]: '0x66145f38cBAC35Ca6F1Dfb4914dF98F1614aeA88',
|
|
8244
8351
|
[Blockchain.XDC_Apothem]: '0xb5AB69F7bBada22B28e79C8FFAECe55eF1c771D4',
|
|
8352
|
+
[Blockchain.X_Layer_Testnet]: '0xDec90b78111Ba2fc6FC6d84d8B9ec159A2d4b9B3',
|
|
8245
8353
|
[Blockchain.ZKSync_Sepolia]: '0xAe045DE5638162fa134807Cb558E15A3F5A7F853'
|
|
8246
8354
|
}
|
|
8247
8355
|
};
|
|
@@ -9653,7 +9761,7 @@ function resolveOptions(options) {
|
|
|
9653
9761
|
}
|
|
9654
9762
|
|
|
9655
9763
|
var name$2 = "@circle-fin/bridge-kit";
|
|
9656
|
-
var version$3 = "1.
|
|
9764
|
+
var version$3 = "1.13.0";
|
|
9657
9765
|
var pkg$3 = {
|
|
9658
9766
|
name: name$2,
|
|
9659
9767
|
version: version$3};
|
|
@@ -9690,13 +9798,21 @@ const assertCustomFeePolicySymbol = Symbol('assertCustomFeePolicy');
|
|
|
9690
9798
|
computeFee: z.function().returns(z.string().or(z.promise(z.string()))).optional(),
|
|
9691
9799
|
calculateFee: z.function().returns(z.string().or(z.promise(z.string()))).optional(),
|
|
9692
9800
|
resolveFeeRecipientAddress: z.function().returns(z.string().or(z.promise(z.string())))
|
|
9693
|
-
}).strict().
|
|
9801
|
+
}).strict().superRefine((data, ctx)=>{
|
|
9694
9802
|
const hasComputeFee = data.computeFee !== undefined;
|
|
9695
9803
|
const hasCalculateFee = data.calculateFee !== undefined;
|
|
9696
|
-
|
|
9697
|
-
|
|
9698
|
-
|
|
9699
|
-
|
|
9804
|
+
if (hasComputeFee && hasCalculateFee) {
|
|
9805
|
+
ctx.addIssue({
|
|
9806
|
+
code: z.ZodIssueCode.custom,
|
|
9807
|
+
message: 'Provide either computeFee or calculateFee, not both. Use computeFee (recommended) for human-readable amounts.'
|
|
9808
|
+
});
|
|
9809
|
+
}
|
|
9810
|
+
if (!hasComputeFee && !hasCalculateFee) {
|
|
9811
|
+
ctx.addIssue({
|
|
9812
|
+
code: z.ZodIssueCode.custom,
|
|
9813
|
+
message: 'Provide either computeFee or calculateFee. Use computeFee (recommended) for human-readable amounts.'
|
|
9814
|
+
});
|
|
9815
|
+
}
|
|
9700
9816
|
});
|
|
9701
9817
|
/**
|
|
9702
9818
|
* Assert that the provided value conforms to {@link CustomFeePolicy}.
|
|
@@ -12457,14 +12573,32 @@ const CUSTOM_BURN_GAS_ESTIMATE_EVM = 201_525n // p99 and max are same here: 201_
|
|
|
12457
12573
|
;
|
|
12458
12574
|
const RECEIVE_MESSAGE_GAS_ESTIMATE_EVM = 237_401n // (99p: 163_963n + max: 310_839n) / 2 = 237_401n
|
|
12459
12575
|
;
|
|
12460
|
-
//
|
|
12461
|
-
//
|
|
12462
|
-
//
|
|
12463
|
-
|
|
12576
|
+
// Gas FLOORS, not ceilings — kept separate from the fee-estimate averages
|
|
12577
|
+
// above. `executePreparedChainRequest` submits
|
|
12578
|
+
// max(estimate * buffer, floor), so a chain whose real cost exceeds the floor
|
|
12579
|
+
// is covered by its own estimate, and a chain whose estimator under-reports
|
|
12580
|
+
// (Cronos: returns 30_600 where the EIP-7623 calldata floor is 45_000) is
|
|
12581
|
+
// covered by the floor.
|
|
12582
|
+
//
|
|
12583
|
+
// Two distinct chain surcharges drive these numbers, both measured live:
|
|
12584
|
+
// Sei — ~+51_500 per NEWLY CREATED storage slot (73_595 vs vanilla 22_100);
|
|
12585
|
+
// no flat per-tx surcharge (31_535, identical to Base).
|
|
12586
|
+
// Edge — ~+53_200 flat on EVERY tx (84_751 vs Base 31_535); storage priced
|
|
12587
|
+
// normally. Edge therefore fails warm as well as cold.
|
|
12588
|
+
// A floor must clear the worst COLD cost, since a slot that exists at estimate
|
|
12589
|
+
// time can be consumed before inclusion and cost a full step more on execution.
|
|
12590
|
+
// Each floor is therefore derived from the worst observed estimate *after* the
|
|
12591
|
+
// 1.25x buffer, plus headroom — sizing it below the buffered value would leave
|
|
12592
|
+
// the estimate governing and defeat the point of the floor.
|
|
12593
|
+
//
|
|
12594
|
+
// The `*_GAS_LIMIT_EVM` names are kept despite these being floors: they are
|
|
12595
|
+
// exported, so renaming to `*_GAS_FLOOR_EVM` would be a breaking change for
|
|
12596
|
+
// consumers. Read "LIMIT" here as "the limit we submit", never as a ceiling.
|
|
12597
|
+
const APPROVE_GAS_LIMIT_EVM = 150_000n // buffered worst cold 149_355 (Edge Testnet 119_484 x 1.25) + drift headroom
|
|
12464
12598
|
;
|
|
12465
|
-
const DEPOSIT_FOR_BURN_GAS_LIMIT_EVM =
|
|
12599
|
+
const DEPOSIT_FOR_BURN_GAS_LIMIT_EVM = 500_000n // buffered worst 474_078 (Sei 379_263 x 1.25) + ~26k headroom
|
|
12466
12600
|
;
|
|
12467
|
-
const RECEIVE_MESSAGE_GAS_LIMIT_EVM = 400_000n // observed max 310_839
|
|
12601
|
+
const RECEIVE_MESSAGE_GAS_LIMIT_EVM = 400_000n // observed max 310_839; clears Cronos' calldata floor ~10x
|
|
12468
12602
|
;
|
|
12469
12603
|
/**
|
|
12470
12604
|
* The minimum finality threshold for CCTPv2 transfers.
|
|
@@ -13929,6 +14063,63 @@ function hasPendingState(analysis, result) {
|
|
|
13929
14063
|
return waitForPendingTransaction(pendingStep, adapter, chain);
|
|
13930
14064
|
}
|
|
13931
14065
|
|
|
14066
|
+
/**
|
|
14067
|
+
* Multiplier applied to a successful gas estimate before it is submitted.
|
|
14068
|
+
*
|
|
14069
|
+
* Estimates are exact, not padded: Sei returns 109_739 for an approve that
|
|
14070
|
+
* consumes 107_717 (1.9% headroom). Chains that price storage in large steps
|
|
14071
|
+
* can exceed the estimate if state changes between estimation and inclusion,
|
|
14072
|
+
* so the estimate is padded before use.
|
|
14073
|
+
*
|
|
14074
|
+
* @remarks
|
|
14075
|
+
* This buffer alone does NOT cover Sei's ~51_500 per-new-slot step at approve
|
|
14076
|
+
* scale (25% of ~110_000 is only ~27_500). For approve, the FLOOR is what
|
|
14077
|
+
* covers a slot that exists at estimation time and is consumed before
|
|
14078
|
+
* inclusion — so do not lower `APPROVE_GAS_LIMIT_EVM` on the reasoning that
|
|
14079
|
+
* the estimate covers it. For burn the buffer does cover a step (25% of
|
|
14080
|
+
* ~300_000 exceeds 51_500).
|
|
14081
|
+
*/ const GAS_ESTIMATE_BUFFER_PERCENT = 125n;
|
|
14082
|
+
/**
|
|
14083
|
+
* Resolve the gas limit for an EVM request as `max(estimate * buffer, floor)`.
|
|
14084
|
+
*
|
|
14085
|
+
* Estimates first so chains whose real cost exceeds the floor are covered by
|
|
14086
|
+
* their own measurement, and falls back to the floor whenever estimation is
|
|
14087
|
+
* unavailable or under-reports. Estimation failure is never fatal here: before
|
|
14088
|
+
* floors existed these requests were submitted with a pinned limit and no
|
|
14089
|
+
* estimate at all, so degrading to the floor is never worse than the previous
|
|
14090
|
+
* behaviour.
|
|
14091
|
+
*
|
|
14092
|
+
* @param request - The prepared EVM request to size a gas limit for
|
|
14093
|
+
* @param gasFloor - The minimum gas limit to submit, in gas units
|
|
14094
|
+
* @returns The gas limit to submit, in gas units
|
|
14095
|
+
* @throws Never — estimation failures degrade to `gasFloor`
|
|
14096
|
+
*
|
|
14097
|
+
* @example
|
|
14098
|
+
* ```typescript
|
|
14099
|
+
* const gasLimit = await resolveGasLimit(request, 150_000)
|
|
14100
|
+
* ```
|
|
14101
|
+
*/ const resolveGasLimit = async (request, gasFloor)=>{
|
|
14102
|
+
try {
|
|
14103
|
+
// Deliberately called without a `fallback`: both the viem and ethers
|
|
14104
|
+
// adapters *return* the supplied fallback object when estimation reverts
|
|
14105
|
+
// rather than throwing, which would set the estimate to the floor and then
|
|
14106
|
+
// multiply it by the buffer below. Omitting it routes reverts through the
|
|
14107
|
+
// catch, so a failed estimate degrades to exactly the floor.
|
|
14108
|
+
const estimate = await request.estimate();
|
|
14109
|
+
// The arithmetic stays inside the try on purpose. `EstimatedGas.gas` is
|
|
14110
|
+
// typed `bigint`, but adapters are a public extension point and may be
|
|
14111
|
+
// implemented in plain JS, so a non-bigint `gas` would throw here
|
|
14112
|
+
// ("Cannot mix BigInt and other types"). Guarding it keeps the documented
|
|
14113
|
+
// contract — estimation never aborts a step, it degrades to the floor.
|
|
14114
|
+
const buffered = estimate.gas * GAS_ESTIMATE_BUFFER_PERCENT / 100n;
|
|
14115
|
+
// Convert before comparing: Math.max throws on BigInt operands, and gas
|
|
14116
|
+
// units are far below Number.MAX_SAFE_INTEGER so the narrowing is lossless.
|
|
14117
|
+
return Math.max(Number(buffered), gasFloor);
|
|
14118
|
+
} catch {
|
|
14119
|
+
// Estimation is best-effort; the floor is the known-safe value.
|
|
14120
|
+
return gasFloor;
|
|
14121
|
+
}
|
|
14122
|
+
};
|
|
13932
14123
|
/**
|
|
13933
14124
|
* Executes a prepared chain request and returns the result as a bridge step.
|
|
13934
14125
|
*
|
|
@@ -13942,8 +14133,8 @@ function hasPendingState(analysis, result) {
|
|
|
13942
14133
|
* - `adapter`: The adapter that will execute the transaction
|
|
13943
14134
|
* - `confirmations`: The number of confirmations to wait for (defaults to 1)
|
|
13944
14135
|
* - `timeout`: The timeout for the request in milliseconds
|
|
13945
|
-
* - `
|
|
13946
|
-
*
|
|
14136
|
+
* - `gasFloor`: Optional minimum gas limit (number); the request is submitted
|
|
14137
|
+
* with `max(estimate * 1.25, gasFloor)`. Ignored for non-EVM requests
|
|
13947
14138
|
* @returns The bridge step with the transaction details and explorer URL
|
|
13948
14139
|
* @throws If the transaction execution fails
|
|
13949
14140
|
*
|
|
@@ -13958,7 +14149,7 @@ function hasPendingState(analysis, result) {
|
|
|
13958
14149
|
* })
|
|
13959
14150
|
* console.log('Transaction hash:', step.txHash)
|
|
13960
14151
|
* ```
|
|
13961
|
-
*/ async function executePreparedChainRequest({ name, request, adapter, chain, confirmations = 1, timeout,
|
|
14152
|
+
*/ async function executePreparedChainRequest({ name, request, adapter, chain, confirmations = 1, timeout, gasFloor }) {
|
|
13962
14153
|
const step = {
|
|
13963
14154
|
name,
|
|
13964
14155
|
state: 'pending'
|
|
@@ -13971,8 +14162,8 @@ function hasPendingState(analysis, result) {
|
|
|
13971
14162
|
step.state = 'noop';
|
|
13972
14163
|
return step;
|
|
13973
14164
|
}
|
|
13974
|
-
const txHash = request.type === 'evm' &&
|
|
13975
|
-
gasLimit
|
|
14165
|
+
const txHash = request.type === 'evm' && gasFloor !== undefined ? await request.execute({
|
|
14166
|
+
gasLimit: await resolveGasLimit(request, gasFloor)
|
|
13976
14167
|
}) : await request.execute();
|
|
13977
14168
|
step.txHash = txHash;
|
|
13978
14169
|
const retryOptions = {
|
|
@@ -14046,7 +14237,7 @@ function hasPendingState(analysis, result) {
|
|
|
14046
14237
|
adapter: params.source.adapter,
|
|
14047
14238
|
chain: params.source.chain,
|
|
14048
14239
|
request: await provider.approve(params.source, approvalAmount),
|
|
14049
|
-
|
|
14240
|
+
gasFloor: Number(APPROVE_GAS_LIMIT_EVM)
|
|
14050
14241
|
});
|
|
14051
14242
|
}
|
|
14052
14243
|
|
|
@@ -14074,7 +14265,7 @@ function hasPendingState(analysis, result) {
|
|
|
14074
14265
|
adapter: params.source.adapter,
|
|
14075
14266
|
chain: params.source.chain,
|
|
14076
14267
|
request: await provider.burn(params),
|
|
14077
|
-
|
|
14268
|
+
gasFloor: Number(DEPOSIT_FOR_BURN_GAS_LIMIT_EVM)
|
|
14078
14269
|
});
|
|
14079
14270
|
}
|
|
14080
14271
|
|
|
@@ -14168,10 +14359,9 @@ function hasPendingState(analysis, result) {
|
|
|
14168
14359
|
request: mintRequest,
|
|
14169
14360
|
// Some chains (e.g. Cronos) enforce an EIP-7623 calldata gas floor that
|
|
14170
14361
|
// eth_estimateGas does not account for, returning a below-floor value
|
|
14171
|
-
// without reverting.
|
|
14172
|
-
//
|
|
14173
|
-
|
|
14174
|
-
gasLimit: Number(RECEIVE_MESSAGE_GAS_LIMIT_EVM)
|
|
14362
|
+
// without reverting. The floor covers those; chains that cost more than the
|
|
14363
|
+
// floor are covered by their own estimate.
|
|
14364
|
+
gasFloor: Number(RECEIVE_MESSAGE_GAS_LIMIT_EVM)
|
|
14175
14365
|
});
|
|
14176
14366
|
// Add forwarded: false for non-relayer mints
|
|
14177
14367
|
return {
|
|
@@ -14694,7 +14884,7 @@ const mockAttestationMessage = {
|
|
|
14694
14884
|
return step;
|
|
14695
14885
|
}
|
|
14696
14886
|
|
|
14697
|
-
var version$2 = "1.10.
|
|
14887
|
+
var version$2 = "1.10.2";
|
|
14698
14888
|
var pkg$2 = {
|
|
14699
14889
|
version: version$2};
|
|
14700
14890
|
|
|
@@ -17292,7 +17482,9 @@ registerKit(`${pkg$3.name}/${pkg$3.version}`);
|
|
|
17292
17482
|
headers: context.headers
|
|
17293
17483
|
}
|
|
17294
17484
|
});
|
|
17295
|
-
if (
|
|
17485
|
+
if (context.customFeePolicy?.bridge != null) {
|
|
17486
|
+
kit.setCustomFeePolicy(context.customFeePolicy.bridge);
|
|
17487
|
+
} else if (hasBoth) {
|
|
17296
17488
|
kit.setCustomFeePolicy({
|
|
17297
17489
|
calculateFee: async (params)=>{
|
|
17298
17490
|
const feeStr = await getFee('bridge', params);
|
|
@@ -17308,7 +17500,7 @@ registerKit(`${pkg$3.name}/${pkg$3.version}`);
|
|
|
17308
17500
|
};
|
|
17309
17501
|
|
|
17310
17502
|
var name$1 = "@circle-fin/swap-kit";
|
|
17311
|
-
var version$1 = "1.5.
|
|
17503
|
+
var version$1 = "1.5.1";
|
|
17312
17504
|
var pkg$1 = {
|
|
17313
17505
|
name: name$1,
|
|
17314
17506
|
version: version$1};
|
|
@@ -19251,7 +19443,7 @@ new Set(Object.values(Blockchain));
|
|
|
19251
19443
|
registerKit(`${pkg$1.name}/${pkg$1.version}`);
|
|
19252
19444
|
|
|
19253
19445
|
var name = "@circle-fin/earn-kit";
|
|
19254
|
-
var version = "1.
|
|
19446
|
+
var version = "1.5.0";
|
|
19255
19447
|
var pkg = {
|
|
19256
19448
|
name: name,
|
|
19257
19449
|
version: version};
|
|
@@ -20262,11 +20454,16 @@ const sourceAdapterContextSchema = z.object({
|
|
|
20262
20454
|
*
|
|
20263
20455
|
* Validate the optional Kit Key field using the standard `apiKeySchema`
|
|
20264
20456
|
* format (`KIT_KEY:<keyId>:<keySecret>`). When omitted, the SDK
|
|
20265
|
-
* operates in permissionless mode.
|
|
20457
|
+
* operates in permissionless mode. `baseUrl` overrides the Earn Service
|
|
20458
|
+
* endpoint (e.g. staging); `batchTransactions: false` opts out of atomic
|
|
20459
|
+
* batched execution. Both are forwarded to the provider, so this `.strict()`
|
|
20460
|
+
* schema must accept them or a valid config object is rejected.
|
|
20266
20461
|
*
|
|
20267
20462
|
* @internal
|
|
20268
20463
|
*/ const earnConfigSchema = z.object({
|
|
20269
|
-
kitKey: apiKeySchema.optional()
|
|
20464
|
+
kitKey: apiKeySchema.optional(),
|
|
20465
|
+
baseUrl: z.string().optional(),
|
|
20466
|
+
batchTransactions: z.boolean().optional()
|
|
20270
20467
|
}).strict();
|
|
20271
20468
|
/**
|
|
20272
20469
|
* Canonical decimal form: a leading digit with no leading zeros (a single
|
package/chains.cjs
CHANGED
|
@@ -124,6 +124,8 @@ var zod = require('zod');
|
|
|
124
124
|
Blockchain["World_Chain_Sepolia"] = "World_Chain_Sepolia";
|
|
125
125
|
Blockchain["XDC"] = "XDC";
|
|
126
126
|
Blockchain["XDC_Apothem"] = "XDC_Apothem";
|
|
127
|
+
Blockchain["X_Layer"] = "X_Layer";
|
|
128
|
+
Blockchain["X_Layer_Testnet"] = "X_Layer_Testnet";
|
|
127
129
|
Blockchain["ZKSync_Era"] = "ZKSync_Era";
|
|
128
130
|
Blockchain["ZKSync_Sepolia"] = "ZKSync_Sepolia";
|
|
129
131
|
})(Blockchain || (Blockchain = {}));
|
|
@@ -177,6 +179,7 @@ var BridgeChain;
|
|
|
177
179
|
BridgeChain["Unichain"] = "Unichain";
|
|
178
180
|
BridgeChain["World_Chain"] = "World_Chain";
|
|
179
181
|
BridgeChain["XDC"] = "XDC";
|
|
182
|
+
BridgeChain["X_Layer"] = "X_Layer";
|
|
180
183
|
// Testnet chains with CCTPv2 support
|
|
181
184
|
BridgeChain["Arc_Testnet"] = "Arc_Testnet";
|
|
182
185
|
BridgeChain["Arbitrum_Sepolia"] = "Arbitrum_Sepolia";
|
|
@@ -202,6 +205,7 @@ var BridgeChain;
|
|
|
202
205
|
BridgeChain["Unichain_Sepolia"] = "Unichain_Sepolia";
|
|
203
206
|
BridgeChain["World_Chain_Sepolia"] = "World_Chain_Sepolia";
|
|
204
207
|
BridgeChain["XDC_Apothem"] = "XDC_Apothem";
|
|
208
|
+
BridgeChain["X_Layer_Testnet"] = "X_Layer_Testnet";
|
|
205
209
|
})(BridgeChain || (BridgeChain = {}));
|
|
206
210
|
var UnifiedBalanceChain;
|
|
207
211
|
(function(UnifiedBalanceChain) {
|
|
@@ -2739,7 +2743,8 @@ var EarnChain;
|
|
|
2739
2743
|
isTestnet: true,
|
|
2740
2744
|
explorerUrl: 'https://amoy.polygonscan.com/tx/{hash}',
|
|
2741
2745
|
rpcEndpoints: [
|
|
2742
|
-
'https://
|
|
2746
|
+
'https://polygon-amoy-bor-rpc.publicnode.com',
|
|
2747
|
+
'https://polygon-amoy.drpc.org'
|
|
2743
2748
|
],
|
|
2744
2749
|
eurcAddress: null,
|
|
2745
2750
|
usdcAddress: '0x41e94eb019c0762f9bfcf9fb1e58725bfb0e7582',
|
|
@@ -3604,6 +3609,104 @@ var EarnChain;
|
|
|
3604
3609
|
}
|
|
3605
3610
|
});
|
|
3606
3611
|
|
|
3612
|
+
/**
|
|
3613
|
+
* X Layer Mainnet chain definition
|
|
3614
|
+
* @remarks
|
|
3615
|
+
* This represents the official production network for the X Layer blockchain.
|
|
3616
|
+
* X Layer is an EVM-compatible OP Stack Layer-2 blockchain built by OKX,
|
|
3617
|
+
* using OKB as its native gas token. (Migrated from Polygon zkEVM/CDK to the
|
|
3618
|
+
* OP Stack on 2025-10-27; older docs describing it as zkEVM are obsolete.)
|
|
3619
|
+
*/ const XLayer = defineChain({
|
|
3620
|
+
type: 'evm',
|
|
3621
|
+
chain: Blockchain.X_Layer,
|
|
3622
|
+
name: 'X Layer',
|
|
3623
|
+
title: 'X Layer Mainnet',
|
|
3624
|
+
nativeCurrency: {
|
|
3625
|
+
name: 'OKB',
|
|
3626
|
+
symbol: 'OKB',
|
|
3627
|
+
decimals: 18
|
|
3628
|
+
},
|
|
3629
|
+
chainId: 196,
|
|
3630
|
+
isTestnet: false,
|
|
3631
|
+
explorerUrl: 'https://www.oklink.com/xlayer/tx/{hash}',
|
|
3632
|
+
rpcEndpoints: [
|
|
3633
|
+
'https://xlayerrpc.okx.com'
|
|
3634
|
+
],
|
|
3635
|
+
eurcAddress: null,
|
|
3636
|
+
usdcAddress: '0xB6CEceAB302E2E4948951eE7843FC24E92933061',
|
|
3637
|
+
usdtAddress: null,
|
|
3638
|
+
cctp: {
|
|
3639
|
+
domain: 37,
|
|
3640
|
+
contracts: {
|
|
3641
|
+
v2: {
|
|
3642
|
+
type: 'split',
|
|
3643
|
+
tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
|
|
3644
|
+
messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
|
|
3645
|
+
confirmations: 65,
|
|
3646
|
+
fastConfirmations: 1
|
|
3647
|
+
}
|
|
3648
|
+
},
|
|
3649
|
+
forwarderSupported: {
|
|
3650
|
+
source: false,
|
|
3651
|
+
destination: false
|
|
3652
|
+
}
|
|
3653
|
+
},
|
|
3654
|
+
kitContracts: {
|
|
3655
|
+
bridge: BRIDGE_CONTRACT_EVM_MAINNET
|
|
3656
|
+
}
|
|
3657
|
+
});
|
|
3658
|
+
|
|
3659
|
+
/**
|
|
3660
|
+
* X Layer Testnet chain definition
|
|
3661
|
+
* @remarks
|
|
3662
|
+
* This represents the official test network for the X Layer blockchain.
|
|
3663
|
+
* X Layer is an EVM-compatible OP Stack Layer-2 blockchain built by OKX,
|
|
3664
|
+
* using OKB as its native gas token. (Migrated from Polygon zkEVM/CDK to the
|
|
3665
|
+
* OP Stack on 2025-10-27; older docs describing it as zkEVM are obsolete.)
|
|
3666
|
+
*/ const XLayerTestnet = defineChain({
|
|
3667
|
+
type: 'evm',
|
|
3668
|
+
chain: Blockchain.X_Layer_Testnet,
|
|
3669
|
+
name: 'X Layer Testnet',
|
|
3670
|
+
title: 'X Layer Testnet',
|
|
3671
|
+
nativeCurrency: {
|
|
3672
|
+
name: 'OKB',
|
|
3673
|
+
symbol: 'OKB',
|
|
3674
|
+
decimals: 18
|
|
3675
|
+
},
|
|
3676
|
+
chainId: 1952,
|
|
3677
|
+
isTestnet: true,
|
|
3678
|
+
// Deliberately not oklink.com (used for mainnet): viem's bundled OKLink
|
|
3679
|
+
// testnet URL targets the deprecated pre-rebrand chain ID 195, not this
|
|
3680
|
+
// chain's ID (1952). Verified against the internal chain-expansion-scripts
|
|
3681
|
+
// config (`v2config.sandbox.yml`) — do not "normalize" this to match mainnet.
|
|
3682
|
+
explorerUrl: 'https://web3.okx.com/explorer/x-layer-testnet/tx/{hash}',
|
|
3683
|
+
rpcEndpoints: [
|
|
3684
|
+
'https://testrpc.xlayer.tech'
|
|
3685
|
+
],
|
|
3686
|
+
eurcAddress: null,
|
|
3687
|
+
usdcAddress: '0xDec90b78111Ba2fc6FC6d84d8B9ec159A2d4b9B3',
|
|
3688
|
+
usdtAddress: null,
|
|
3689
|
+
cctp: {
|
|
3690
|
+
domain: 37,
|
|
3691
|
+
contracts: {
|
|
3692
|
+
v2: {
|
|
3693
|
+
type: 'split',
|
|
3694
|
+
tokenMessenger: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',
|
|
3695
|
+
messageTransmitter: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',
|
|
3696
|
+
confirmations: 65,
|
|
3697
|
+
fastConfirmations: 1
|
|
3698
|
+
}
|
|
3699
|
+
},
|
|
3700
|
+
forwarderSupported: {
|
|
3701
|
+
source: false,
|
|
3702
|
+
destination: false
|
|
3703
|
+
}
|
|
3704
|
+
},
|
|
3705
|
+
kitContracts: {
|
|
3706
|
+
bridge: BRIDGE_CONTRACT_EVM_TESTNET
|
|
3707
|
+
}
|
|
3708
|
+
});
|
|
3709
|
+
|
|
3607
3710
|
/**
|
|
3608
3711
|
* ZKSync Era Mainnet chain definition
|
|
3609
3712
|
* @remarks
|
|
@@ -4106,4 +4209,6 @@ exports.WorldChain = WorldChain;
|
|
|
4106
4209
|
exports.WorldChainSepolia = WorldChainSepolia;
|
|
4107
4210
|
exports.XDC = XDC;
|
|
4108
4211
|
exports.XDCApothem = XDCApothem;
|
|
4212
|
+
exports.XLayer = XLayer;
|
|
4213
|
+
exports.XLayerTestnet = XLayerTestnet;
|
|
4109
4214
|
//# sourceMappingURL=chains.cjs.map
|