@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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@circle-fin/app-kit",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.12.0",
|
|
4
4
|
"description": "A one-stop Circle SDK solution for building stablecoin (e.g. USDC) applications, with bridging, swapping, and more on-chain operations",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"circle",
|
|
@@ -36,11 +36,11 @@
|
|
|
36
36
|
"module": "./index.mjs",
|
|
37
37
|
"types": "./index.d.cts",
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@circle-fin/unified-balance-kit": "1.
|
|
40
|
-
"@circle-fin/provider-gateway-v1": "1.
|
|
41
|
-
"@circle-fin/earn-kit": "1.
|
|
42
|
-
"@circle-fin/bridge-kit": "1.
|
|
43
|
-
"@circle-fin/swap-kit": "1.5.
|
|
39
|
+
"@circle-fin/unified-balance-kit": "1.4.0",
|
|
40
|
+
"@circle-fin/provider-gateway-v1": "1.2.0",
|
|
41
|
+
"@circle-fin/earn-kit": "1.5.0",
|
|
42
|
+
"@circle-fin/bridge-kit": "1.13.0",
|
|
43
|
+
"@circle-fin/swap-kit": "1.5.1",
|
|
44
44
|
"@coral-xyz/anchor": "^0.31.1",
|
|
45
45
|
"@noble/curves": "1.4.2",
|
|
46
46
|
"bn.js": "^5.2.3",
|
package/swap.cjs
CHANGED
|
@@ -40,6 +40,7 @@ require('@coral-xyz/anchor');
|
|
|
40
40
|
var bs58 = require('bs58');
|
|
41
41
|
require('@noble/curves/ed25519');
|
|
42
42
|
var units = require('@ethersproject/units');
|
|
43
|
+
require('viem');
|
|
43
44
|
var keccak256 = require('@ethersproject/keccak256');
|
|
44
45
|
|
|
45
46
|
function _interopDefault (e) { return e && e.__esModule ? e.default : e; }
|
|
@@ -3008,6 +3009,8 @@ class KitError extends Error {
|
|
|
3008
3009
|
Blockchain["World_Chain_Sepolia"] = "World_Chain_Sepolia";
|
|
3009
3010
|
Blockchain["XDC"] = "XDC";
|
|
3010
3011
|
Blockchain["XDC_Apothem"] = "XDC_Apothem";
|
|
3012
|
+
Blockchain["X_Layer"] = "X_Layer";
|
|
3013
|
+
Blockchain["X_Layer_Testnet"] = "X_Layer_Testnet";
|
|
3011
3014
|
Blockchain["ZKSync_Era"] = "ZKSync_Era";
|
|
3012
3015
|
Blockchain["ZKSync_Sepolia"] = "ZKSync_Sepolia";
|
|
3013
3016
|
})(Blockchain || (Blockchain = {}));
|
|
@@ -3061,6 +3064,7 @@ var BridgeChain;
|
|
|
3061
3064
|
BridgeChain["Unichain"] = "Unichain";
|
|
3062
3065
|
BridgeChain["World_Chain"] = "World_Chain";
|
|
3063
3066
|
BridgeChain["XDC"] = "XDC";
|
|
3067
|
+
BridgeChain["X_Layer"] = "X_Layer";
|
|
3064
3068
|
// Testnet chains with CCTPv2 support
|
|
3065
3069
|
BridgeChain["Arc_Testnet"] = "Arc_Testnet";
|
|
3066
3070
|
BridgeChain["Arbitrum_Sepolia"] = "Arbitrum_Sepolia";
|
|
@@ -3086,6 +3090,7 @@ var BridgeChain;
|
|
|
3086
3090
|
BridgeChain["Unichain_Sepolia"] = "Unichain_Sepolia";
|
|
3087
3091
|
BridgeChain["World_Chain_Sepolia"] = "World_Chain_Sepolia";
|
|
3088
3092
|
BridgeChain["XDC_Apothem"] = "XDC_Apothem";
|
|
3093
|
+
BridgeChain["X_Layer_Testnet"] = "X_Layer_Testnet";
|
|
3089
3094
|
})(BridgeChain || (BridgeChain = {}));
|
|
3090
3095
|
var UnifiedBalanceChain;
|
|
3091
3096
|
(function(UnifiedBalanceChain) {
|
|
@@ -5634,7 +5639,8 @@ var EarnChain;
|
|
|
5634
5639
|
isTestnet: true,
|
|
5635
5640
|
explorerUrl: 'https://amoy.polygonscan.com/tx/{hash}',
|
|
5636
5641
|
rpcEndpoints: [
|
|
5637
|
-
'https://
|
|
5642
|
+
'https://polygon-amoy-bor-rpc.publicnode.com',
|
|
5643
|
+
'https://polygon-amoy.drpc.org'
|
|
5638
5644
|
],
|
|
5639
5645
|
eurcAddress: null,
|
|
5640
5646
|
usdcAddress: '0x41e94eb019c0762f9bfcf9fb1e58725bfb0e7582',
|
|
@@ -6499,6 +6505,104 @@ var EarnChain;
|
|
|
6499
6505
|
}
|
|
6500
6506
|
});
|
|
6501
6507
|
|
|
6508
|
+
/**
|
|
6509
|
+
* X Layer Mainnet chain definition
|
|
6510
|
+
* @remarks
|
|
6511
|
+
* This represents the official production network for the X Layer blockchain.
|
|
6512
|
+
* X Layer is an EVM-compatible OP Stack Layer-2 blockchain built by OKX,
|
|
6513
|
+
* using OKB as its native gas token. (Migrated from Polygon zkEVM/CDK to the
|
|
6514
|
+
* OP Stack on 2025-10-27; older docs describing it as zkEVM are obsolete.)
|
|
6515
|
+
*/ const XLayer = defineChain({
|
|
6516
|
+
type: 'evm',
|
|
6517
|
+
chain: Blockchain.X_Layer,
|
|
6518
|
+
name: 'X Layer',
|
|
6519
|
+
title: 'X Layer Mainnet',
|
|
6520
|
+
nativeCurrency: {
|
|
6521
|
+
name: 'OKB',
|
|
6522
|
+
symbol: 'OKB',
|
|
6523
|
+
decimals: 18
|
|
6524
|
+
},
|
|
6525
|
+
chainId: 196,
|
|
6526
|
+
isTestnet: false,
|
|
6527
|
+
explorerUrl: 'https://www.oklink.com/xlayer/tx/{hash}',
|
|
6528
|
+
rpcEndpoints: [
|
|
6529
|
+
'https://xlayerrpc.okx.com'
|
|
6530
|
+
],
|
|
6531
|
+
eurcAddress: null,
|
|
6532
|
+
usdcAddress: '0xB6CEceAB302E2E4948951eE7843FC24E92933061',
|
|
6533
|
+
usdtAddress: null,
|
|
6534
|
+
cctp: {
|
|
6535
|
+
domain: 37,
|
|
6536
|
+
contracts: {
|
|
6537
|
+
v2: {
|
|
6538
|
+
type: 'split',
|
|
6539
|
+
tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
|
|
6540
|
+
messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
|
|
6541
|
+
confirmations: 65,
|
|
6542
|
+
fastConfirmations: 1
|
|
6543
|
+
}
|
|
6544
|
+
},
|
|
6545
|
+
forwarderSupported: {
|
|
6546
|
+
source: false,
|
|
6547
|
+
destination: false
|
|
6548
|
+
}
|
|
6549
|
+
},
|
|
6550
|
+
kitContracts: {
|
|
6551
|
+
bridge: BRIDGE_CONTRACT_EVM_MAINNET
|
|
6552
|
+
}
|
|
6553
|
+
});
|
|
6554
|
+
|
|
6555
|
+
/**
|
|
6556
|
+
* X Layer Testnet chain definition
|
|
6557
|
+
* @remarks
|
|
6558
|
+
* This represents the official test network for the X Layer blockchain.
|
|
6559
|
+
* X Layer is an EVM-compatible OP Stack Layer-2 blockchain built by OKX,
|
|
6560
|
+
* using OKB as its native gas token. (Migrated from Polygon zkEVM/CDK to the
|
|
6561
|
+
* OP Stack on 2025-10-27; older docs describing it as zkEVM are obsolete.)
|
|
6562
|
+
*/ const XLayerTestnet = defineChain({
|
|
6563
|
+
type: 'evm',
|
|
6564
|
+
chain: Blockchain.X_Layer_Testnet,
|
|
6565
|
+
name: 'X Layer Testnet',
|
|
6566
|
+
title: 'X Layer Testnet',
|
|
6567
|
+
nativeCurrency: {
|
|
6568
|
+
name: 'OKB',
|
|
6569
|
+
symbol: 'OKB',
|
|
6570
|
+
decimals: 18
|
|
6571
|
+
},
|
|
6572
|
+
chainId: 1952,
|
|
6573
|
+
isTestnet: true,
|
|
6574
|
+
// Deliberately not oklink.com (used for mainnet): viem's bundled OKLink
|
|
6575
|
+
// testnet URL targets the deprecated pre-rebrand chain ID 195, not this
|
|
6576
|
+
// chain's ID (1952). Verified against the internal chain-expansion-scripts
|
|
6577
|
+
// config (`v2config.sandbox.yml`) — do not "normalize" this to match mainnet.
|
|
6578
|
+
explorerUrl: 'https://web3.okx.com/explorer/x-layer-testnet/tx/{hash}',
|
|
6579
|
+
rpcEndpoints: [
|
|
6580
|
+
'https://testrpc.xlayer.tech'
|
|
6581
|
+
],
|
|
6582
|
+
eurcAddress: null,
|
|
6583
|
+
usdcAddress: '0xDec90b78111Ba2fc6FC6d84d8B9ec159A2d4b9B3',
|
|
6584
|
+
usdtAddress: null,
|
|
6585
|
+
cctp: {
|
|
6586
|
+
domain: 37,
|
|
6587
|
+
contracts: {
|
|
6588
|
+
v2: {
|
|
6589
|
+
type: 'split',
|
|
6590
|
+
tokenMessenger: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',
|
|
6591
|
+
messageTransmitter: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',
|
|
6592
|
+
confirmations: 65,
|
|
6593
|
+
fastConfirmations: 1
|
|
6594
|
+
}
|
|
6595
|
+
},
|
|
6596
|
+
forwarderSupported: {
|
|
6597
|
+
source: false,
|
|
6598
|
+
destination: false
|
|
6599
|
+
}
|
|
6600
|
+
},
|
|
6601
|
+
kitContracts: {
|
|
6602
|
+
bridge: BRIDGE_CONTRACT_EVM_TESTNET
|
|
6603
|
+
}
|
|
6604
|
+
});
|
|
6605
|
+
|
|
6502
6606
|
/**
|
|
6503
6607
|
* ZKSync Era Mainnet chain definition
|
|
6504
6608
|
* @remarks
|
|
@@ -6618,6 +6722,8 @@ var Chains = {
|
|
|
6618
6722
|
WorldChainSepolia: WorldChainSepolia,
|
|
6619
6723
|
XDC: XDC,
|
|
6620
6724
|
XDCApothem: XDCApothem,
|
|
6725
|
+
XLayer: XLayer,
|
|
6726
|
+
XLayerTestnet: XLayerTestnet,
|
|
6621
6727
|
ZKSyncEra: ZKSyncEra,
|
|
6622
6728
|
ZKSyncEraSepolia: ZKSyncEraSepolia
|
|
6623
6729
|
};
|
|
@@ -8646,6 +8752,7 @@ const swapTokenEnumSchema = zod.z.enum([
|
|
|
8646
8752
|
[Blockchain.Unichain]: '0x078D782b760474a361dDA0AF3839290b0EF57AD6',
|
|
8647
8753
|
[Blockchain.World_Chain]: '0x79A02482A880bCE3F13e09Da970dC34db4CD24d1',
|
|
8648
8754
|
[Blockchain.XDC]: '0xfA2958CB79b0491CC627c1557F441eF849Ca8eb1',
|
|
8755
|
+
[Blockchain.X_Layer]: '0xB6CEceAB302E2E4948951eE7843FC24E92933061',
|
|
8649
8756
|
[Blockchain.ZKSync_Era]: '0x1d17CBcF0D6D143135aE902365D2E5e2A16538D4',
|
|
8650
8757
|
// =========================================================================
|
|
8651
8758
|
// Testnets (alphabetically sorted)
|
|
@@ -8680,6 +8787,7 @@ const swapTokenEnumSchema = zod.z.enum([
|
|
|
8680
8787
|
[Blockchain.Unichain_Sepolia]: '0x31d0220469e10c4E71834a79b1f276d740d3768F',
|
|
8681
8788
|
[Blockchain.World_Chain_Sepolia]: '0x66145f38cBAC35Ca6F1Dfb4914dF98F1614aeA88',
|
|
8682
8789
|
[Blockchain.XDC_Apothem]: '0xb5AB69F7bBada22B28e79C8FFAECe55eF1c771D4',
|
|
8790
|
+
[Blockchain.X_Layer_Testnet]: '0xDec90b78111Ba2fc6FC6d84d8B9ec159A2d4b9B3',
|
|
8683
8791
|
[Blockchain.ZKSync_Sepolia]: '0xAe045DE5638162fa134807Cb558E15A3F5A7F853'
|
|
8684
8792
|
}
|
|
8685
8793
|
};
|
|
@@ -9967,7 +10075,7 @@ const swapTokenEnumSchema = zod.z.enum([
|
|
|
9967
10075
|
}
|
|
9968
10076
|
|
|
9969
10077
|
var name$2 = "@circle-fin/bridge-kit";
|
|
9970
|
-
var version$2 = "1.
|
|
10078
|
+
var version$2 = "1.13.0";
|
|
9971
10079
|
var pkg$2 = {
|
|
9972
10080
|
name: name$2,
|
|
9973
10081
|
version: version$2};
|
|
@@ -10003,13 +10111,21 @@ var pkg$2 = {
|
|
|
10003
10111
|
computeFee: zod.z.function().returns(zod.z.string().or(zod.z.promise(zod.z.string()))).optional(),
|
|
10004
10112
|
calculateFee: zod.z.function().returns(zod.z.string().or(zod.z.promise(zod.z.string()))).optional(),
|
|
10005
10113
|
resolveFeeRecipientAddress: zod.z.function().returns(zod.z.string().or(zod.z.promise(zod.z.string())))
|
|
10006
|
-
}).strict().
|
|
10114
|
+
}).strict().superRefine((data, ctx)=>{
|
|
10007
10115
|
const hasComputeFee = data.computeFee !== undefined;
|
|
10008
10116
|
const hasCalculateFee = data.calculateFee !== undefined;
|
|
10009
|
-
|
|
10010
|
-
|
|
10011
|
-
|
|
10012
|
-
|
|
10117
|
+
if (hasComputeFee && hasCalculateFee) {
|
|
10118
|
+
ctx.addIssue({
|
|
10119
|
+
code: zod.z.ZodIssueCode.custom,
|
|
10120
|
+
message: 'Provide either computeFee or calculateFee, not both. Use computeFee (recommended) for human-readable amounts.'
|
|
10121
|
+
});
|
|
10122
|
+
}
|
|
10123
|
+
if (!hasComputeFee && !hasCalculateFee) {
|
|
10124
|
+
ctx.addIssue({
|
|
10125
|
+
code: zod.z.ZodIssueCode.custom,
|
|
10126
|
+
message: 'Provide either computeFee or calculateFee. Use computeFee (recommended) for human-readable amounts.'
|
|
10127
|
+
});
|
|
10128
|
+
}
|
|
10013
10129
|
});
|
|
10014
10130
|
|
|
10015
10131
|
/**
|
|
@@ -10868,7 +10984,7 @@ var TransferSpeed;
|
|
|
10868
10984
|
registerKit(`${pkg$2.name}/${pkg$2.version}`);
|
|
10869
10985
|
|
|
10870
10986
|
var name$1 = "@circle-fin/swap-kit";
|
|
10871
|
-
var version$1 = "1.5.
|
|
10987
|
+
var version$1 = "1.5.1";
|
|
10872
10988
|
var pkg$1 = {
|
|
10873
10989
|
name: name$1,
|
|
10874
10990
|
version: version$1};
|
|
@@ -21073,7 +21189,9 @@ registerKit(`${pkg$1.name}/${pkg$1.version}`);
|
|
|
21073
21189
|
disableAnalytics: context.disableAnalytics
|
|
21074
21190
|
}
|
|
21075
21191
|
});
|
|
21076
|
-
if (
|
|
21192
|
+
if (context.customFeePolicy?.swap != null) {
|
|
21193
|
+
kit.setCustomFeePolicy(context.customFeePolicy.swap);
|
|
21194
|
+
} else if (hasBoth) {
|
|
21077
21195
|
kit.setCustomFeePolicy({
|
|
21078
21196
|
computeFee: async (params)=>{
|
|
21079
21197
|
// Adapt provider-level params (with tokenIn/tokenOut)
|
|
@@ -21132,7 +21250,7 @@ registerKit(`${pkg$1.name}/${pkg$1.version}`);
|
|
|
21132
21250
|
};
|
|
21133
21251
|
|
|
21134
21252
|
var name = "@circle-fin/earn-kit";
|
|
21135
|
-
var version = "1.
|
|
21253
|
+
var version = "1.5.0";
|
|
21136
21254
|
var pkg = {
|
|
21137
21255
|
name: name,
|
|
21138
21256
|
version: version};
|
|
@@ -22143,11 +22261,16 @@ const sourceAdapterContextSchema = zod.z.object({
|
|
|
22143
22261
|
*
|
|
22144
22262
|
* Validate the optional Kit Key field using the standard `apiKeySchema`
|
|
22145
22263
|
* format (`KIT_KEY:<keyId>:<keySecret>`). When omitted, the SDK
|
|
22146
|
-
* operates in permissionless mode.
|
|
22264
|
+
* operates in permissionless mode. `baseUrl` overrides the Earn Service
|
|
22265
|
+
* endpoint (e.g. staging); `batchTransactions: false` opts out of atomic
|
|
22266
|
+
* batched execution. Both are forwarded to the provider, so this `.strict()`
|
|
22267
|
+
* schema must accept them or a valid config object is rejected.
|
|
22147
22268
|
*
|
|
22148
22269
|
* @internal
|
|
22149
22270
|
*/ const earnConfigSchema = zod.z.object({
|
|
22150
|
-
kitKey: apiKeySchema.optional()
|
|
22271
|
+
kitKey: apiKeySchema.optional(),
|
|
22272
|
+
baseUrl: zod.z.string().optional(),
|
|
22273
|
+
batchTransactions: zod.z.boolean().optional()
|
|
22151
22274
|
}).strict();
|
|
22152
22275
|
/**
|
|
22153
22276
|
* Canonical decimal form: a leading digit with no leading zeros (a single
|