@circle-fin/adapter-ethers-v6 1.6.2 → 1.6.4
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 +13 -0
- package/index.cjs +127 -22
- package/index.mjs +127 -22
- package/package.json +5 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @circle-fin/adapter-ethers-v6
|
|
2
2
|
|
|
3
|
+
## 1.6.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Update HyperEVM mainnet explorer URL to resolve location-restricted access issues
|
|
8
|
+
- Improved search discoverability
|
|
9
|
+
|
|
10
|
+
## 1.6.3
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Add support for Solana as a forwarder destination
|
|
15
|
+
|
|
3
16
|
## 1.6.2
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/index.cjs
CHANGED
|
@@ -420,6 +420,12 @@ const InputError = {
|
|
|
420
420
|
name: 'INPUT_UNSUPPORTED_TOKEN',
|
|
421
421
|
type: 'INPUT',
|
|
422
422
|
},
|
|
423
|
+
/** No route satisfies the slippage or minimum-output constraint */
|
|
424
|
+
SLIPPAGE_CONSTRAINT_NOT_MET: {
|
|
425
|
+
code: 1009,
|
|
426
|
+
name: 'INPUT_SLIPPAGE_CONSTRAINT_NOT_MET',
|
|
427
|
+
type: 'INPUT',
|
|
428
|
+
},
|
|
423
429
|
/** General validation failure for complex validation rules */
|
|
424
430
|
VALIDATION_FAILED: {
|
|
425
431
|
code: 1098,
|
|
@@ -1199,6 +1205,40 @@ function normalizeTransactionDetails(txHash, explorerUrl) {
|
|
|
1199
1205
|
}
|
|
1200
1206
|
return normalized;
|
|
1201
1207
|
}
|
|
1208
|
+
/**
|
|
1209
|
+
* Pattern that matches on-chain revert reasons caused by slippage or
|
|
1210
|
+
* price constraints. When a revert matches, the error is surfaced as
|
|
1211
|
+
* {@link InputError.SLIPPAGE_CONSTRAINT_NOT_MET} (RETRYABLE) instead of
|
|
1212
|
+
* a generic simulation-failed / transaction-reverted error.
|
|
1213
|
+
*
|
|
1214
|
+
* @internal
|
|
1215
|
+
*/
|
|
1216
|
+
const SLIPPAGE_REVERT_PATTERN = /slippage|lower than the minimum required|less than the initial balance|minimum.?output|price.?impact|stop.?limit|InsufficientOutput|InsufficientFinalBalance/i;
|
|
1217
|
+
/**
|
|
1218
|
+
* Handle simulation / execution revert errors, distinguishing slippage
|
|
1219
|
+
* constraint failures from generic reverts and simulation failures.
|
|
1220
|
+
*
|
|
1221
|
+
* @internal
|
|
1222
|
+
*/
|
|
1223
|
+
function handleRevertError(msg, error, context) {
|
|
1224
|
+
const reason = extractRevertReason(msg, error) ?? 'Transaction reverted';
|
|
1225
|
+
if (SLIPPAGE_REVERT_PATTERN.test(reason)) {
|
|
1226
|
+
return new KitError({
|
|
1227
|
+
...InputError.SLIPPAGE_CONSTRAINT_NOT_MET,
|
|
1228
|
+
recoverability: 'RETRYABLE',
|
|
1229
|
+
message: `Transaction on ${context.chain} reverted: "${reason}". ` +
|
|
1230
|
+
'Try increasing slippageBps or adjusting stopLimit.',
|
|
1231
|
+
cause: { trace: { rawError: error, chain: context.chain, reason } },
|
|
1232
|
+
});
|
|
1233
|
+
}
|
|
1234
|
+
if (/simulation failed/i.test(msg) || context.operation === 'simulation') {
|
|
1235
|
+
return createSimulationFailedError(context.chain, reason, {
|
|
1236
|
+
rawError: error,
|
|
1237
|
+
});
|
|
1238
|
+
}
|
|
1239
|
+
const { txHash, explorerUrl } = normalizeTransactionDetails(context.txHash, context.explorerUrl);
|
|
1240
|
+
return createTransactionRevertedError(context.chain, reason, { rawError: error }, txHash, explorerUrl);
|
|
1241
|
+
}
|
|
1202
1242
|
/**
|
|
1203
1243
|
* Parses raw blockchain errors into structured KitError instances.
|
|
1204
1244
|
*
|
|
@@ -1279,21 +1319,7 @@ function parseBlockchainError(error, context) {
|
|
|
1279
1319
|
// Pattern 2: Simulation and execution reverts
|
|
1280
1320
|
// Matches contract revert errors and simulation failures
|
|
1281
1321
|
if (/execution reverted|simulation failed|transaction reverted|transaction failed/i.test(msg)) {
|
|
1282
|
-
|
|
1283
|
-
// Distinguish between simulation failures and transaction reverts
|
|
1284
|
-
// "simulation failed" or "eth_call" indicates pre-flight simulation
|
|
1285
|
-
// "transaction failed" or context.operation === 'transaction' indicates post-execution
|
|
1286
|
-
if (/simulation failed/i.test(msg) || context.operation === 'simulation') {
|
|
1287
|
-
return createSimulationFailedError(context.chain, reason, {
|
|
1288
|
-
rawError: error,
|
|
1289
|
-
});
|
|
1290
|
-
}
|
|
1291
|
-
// Transaction execution failures or reverts
|
|
1292
|
-
// Include txHash and explorerUrl if available (transaction was submitted)
|
|
1293
|
-
const { txHash, explorerUrl } = normalizeTransactionDetails(context.txHash, context.explorerUrl);
|
|
1294
|
-
return createTransactionRevertedError(context.chain, reason, {
|
|
1295
|
-
rawError: error,
|
|
1296
|
-
}, txHash, explorerUrl);
|
|
1322
|
+
return handleRevertError(msg, error, context);
|
|
1297
1323
|
}
|
|
1298
1324
|
// Pattern 3: Gas-related errors
|
|
1299
1325
|
// Matches gas estimation failures and gas exhaustion
|
|
@@ -1318,8 +1344,12 @@ function parseBlockchainError(error, context) {
|
|
|
1318
1344
|
return createNetworkConnectionError(context.chain, { rawError: error });
|
|
1319
1345
|
}
|
|
1320
1346
|
// Pattern 5: RPC provider errors
|
|
1321
|
-
// Matches RPC endpoint errors, invalid responses,
|
|
1322
|
-
|
|
1347
|
+
// Matches RPC endpoint errors, invalid responses, rate limits, and
|
|
1348
|
+
// transient JSON-RPC internal errors (e.g. ethers.js "could not coalesce error").
|
|
1349
|
+
// Note: "internal error" alone is too broad — contracts like USDT emit
|
|
1350
|
+
// "An internal error was received" for on-chain assertion failures.
|
|
1351
|
+
// We require JSON-RPC context (codes -32603/-32000) instead.
|
|
1352
|
+
if (/rpc|invalid response|rate limit|too many requests|could not coalesce|no response|server error|json-rpc\s+internal|internal json-rpc|-32603|-32000/i.test(msg)) {
|
|
1323
1353
|
return createRpcEndpointError(context.chain, { rawError: error });
|
|
1324
1354
|
}
|
|
1325
1355
|
// Pattern 6: Transaction size limit errors
|
|
@@ -1744,8 +1774,9 @@ exports.Blockchain = void 0;
|
|
|
1744
1774
|
/**
|
|
1745
1775
|
* Enum representing chains that support same-chain swaps through the Swap Kit.
|
|
1746
1776
|
*
|
|
1747
|
-
* Unlike the full {@link Blockchain} enum, SwapChain includes
|
|
1748
|
-
* networks
|
|
1777
|
+
* Unlike the full {@link Blockchain} enum, SwapChain includes mainnet
|
|
1778
|
+
* networks and explicitly whitelisted testnets (e.g., {@link Arc_Testnet})
|
|
1779
|
+
* where adapter contracts are deployed (CCTPv2 support).
|
|
1749
1780
|
*
|
|
1750
1781
|
* Dynamic validation via {@link isSwapSupportedChain} ensures chains
|
|
1751
1782
|
* automatically work when adapter contracts and supported tokens are deployed.
|
|
@@ -1790,6 +1821,8 @@ var SwapChain;
|
|
|
1790
1821
|
SwapChain["XDC"] = "XDC";
|
|
1791
1822
|
SwapChain["HyperEVM"] = "HyperEVM";
|
|
1792
1823
|
SwapChain["Monad"] = "Monad";
|
|
1824
|
+
// Testnet chains with swap support
|
|
1825
|
+
SwapChain["Arc_Testnet"] = "Arc_Testnet";
|
|
1793
1826
|
})(SwapChain || (SwapChain = {}));
|
|
1794
1827
|
// -----------------------------------------------------------------------------
|
|
1795
1828
|
// Bridge Chain Enum (CCTPv2 Supported Chains)
|
|
@@ -1886,6 +1919,31 @@ var BridgeChain;
|
|
|
1886
1919
|
BridgeChain["World_Chain_Sepolia"] = "World_Chain_Sepolia";
|
|
1887
1920
|
BridgeChain["XDC_Apothem"] = "XDC_Apothem";
|
|
1888
1921
|
})(BridgeChain || (BridgeChain = {}));
|
|
1922
|
+
// -----------------------------------------------------------------------------
|
|
1923
|
+
// Earn Chain Enum
|
|
1924
|
+
// -----------------------------------------------------------------------------
|
|
1925
|
+
/**
|
|
1926
|
+
* Enumeration of blockchains that support earn (vault deposit/withdraw)
|
|
1927
|
+
* operations through the Earn Kit.
|
|
1928
|
+
*
|
|
1929
|
+
* Currently only Ethereum mainnet is supported. Additional chains
|
|
1930
|
+
* will be added as vault protocol support expands.
|
|
1931
|
+
*
|
|
1932
|
+
* @example
|
|
1933
|
+
* ```typescript
|
|
1934
|
+
* import { EarnChain } from '@core/chains'
|
|
1935
|
+
*
|
|
1936
|
+
* const result = await earnKit.deposit({
|
|
1937
|
+
* from: { adapter, chain: EarnChain.Ethereum },
|
|
1938
|
+
* vaultAddress: '0x...',
|
|
1939
|
+
* amount: '100',
|
|
1940
|
+
* })
|
|
1941
|
+
* ```
|
|
1942
|
+
*/
|
|
1943
|
+
var EarnChain;
|
|
1944
|
+
(function (EarnChain) {
|
|
1945
|
+
EarnChain["Ethereum"] = "Ethereum";
|
|
1946
|
+
})(EarnChain || (EarnChain = {}));
|
|
1889
1947
|
|
|
1890
1948
|
/**
|
|
1891
1949
|
* Helper function to define a chain with proper TypeScript typing.
|
|
@@ -2188,6 +2246,14 @@ const BRIDGE_CONTRACT_EVM_MAINNET = '0xB3FA262d0fB521cc93bE83d87b322b8A23DAf3F0'
|
|
|
2188
2246
|
* on EVM-compatible chains. Use this address for mainnet adapter integrations.
|
|
2189
2247
|
*/
|
|
2190
2248
|
const ADAPTER_CONTRACT_EVM_MAINNET = '0x7FB8c7260b63934d8da38aF902f87ae6e284a845';
|
|
2249
|
+
/**
|
|
2250
|
+
* The adapter contract address for EVM testnet networks.
|
|
2251
|
+
*
|
|
2252
|
+
* This contract serves as an adapter for integrating with various protocols
|
|
2253
|
+
* on EVM-compatible testnet chains. Use this address for testnet adapter
|
|
2254
|
+
* integrations (e.g., Arc Testnet).
|
|
2255
|
+
*/
|
|
2256
|
+
const ADAPTER_CONTRACT_EVM_TESTNET = '0xBBD70b01a1CAbc96d5b7b129Ae1AAabdf50dd40b';
|
|
2191
2257
|
|
|
2192
2258
|
/**
|
|
2193
2259
|
* Arc Testnet chain definition
|
|
@@ -2236,6 +2302,7 @@ const ArcTestnet = defineChain({
|
|
|
2236
2302
|
},
|
|
2237
2303
|
kitContracts: {
|
|
2238
2304
|
bridge: BRIDGE_CONTRACT_EVM_TESTNET,
|
|
2305
|
+
adapter: ADAPTER_CONTRACT_EVM_TESTNET,
|
|
2239
2306
|
},
|
|
2240
2307
|
});
|
|
2241
2308
|
|
|
@@ -2926,7 +2993,7 @@ const HyperEVM = defineChain({
|
|
|
2926
2993
|
},
|
|
2927
2994
|
chainId: 999,
|
|
2928
2995
|
isTestnet: false,
|
|
2929
|
-
explorerUrl: 'https://
|
|
2996
|
+
explorerUrl: 'https://hyperevmscan.io/tx/{hash}',
|
|
2930
2997
|
rpcEndpoints: ['https://rpc.hyperliquid.xyz/evm'],
|
|
2931
2998
|
eurcAddress: null,
|
|
2932
2999
|
usdcAddress: '0xb88339CB7199b77E23DB6E890353E22632Ba630f',
|
|
@@ -4034,7 +4101,7 @@ const Solana = defineChain({
|
|
|
4034
4101
|
},
|
|
4035
4102
|
forwarderSupported: {
|
|
4036
4103
|
source: true,
|
|
4037
|
-
destination:
|
|
4104
|
+
destination: true,
|
|
4038
4105
|
},
|
|
4039
4106
|
},
|
|
4040
4107
|
kitContracts: {
|
|
@@ -4081,7 +4148,7 @@ const SolanaDevnet = defineChain({
|
|
|
4081
4148
|
},
|
|
4082
4149
|
forwarderSupported: {
|
|
4083
4150
|
source: true,
|
|
4084
|
-
destination:
|
|
4151
|
+
destination: true,
|
|
4085
4152
|
},
|
|
4086
4153
|
},
|
|
4087
4154
|
kitContracts: {
|
|
@@ -4869,6 +4936,41 @@ zod.z.union([
|
|
|
4869
4936
|
message: `Chain "${chainDef.name}" (${chainDef.chain}) is not supported for bridging. Only chains in the BridgeChain enum support CCTPv2 bridging.`,
|
|
4870
4937
|
})),
|
|
4871
4938
|
]);
|
|
4939
|
+
/**
|
|
4940
|
+
* Zod schema for validating earn-specific chain identifiers.
|
|
4941
|
+
*
|
|
4942
|
+
* Validate that the provided chain is supported for earn (vault
|
|
4943
|
+
* deposit/withdraw) operations. Currently only Ethereum is
|
|
4944
|
+
* supported.
|
|
4945
|
+
*
|
|
4946
|
+
* Accept an EarnChain enum value, a matching string literal, or
|
|
4947
|
+
* a ChainDefinition for a supported chain.
|
|
4948
|
+
*
|
|
4949
|
+
* @example
|
|
4950
|
+
* ```typescript
|
|
4951
|
+
* import { earnChainIdentifierSchema } from '@core/chains'
|
|
4952
|
+
* import { EarnChain, Ethereum } from '@core/chains'
|
|
4953
|
+
*
|
|
4954
|
+
* // Valid
|
|
4955
|
+
* earnChainIdentifierSchema.parse(EarnChain.Ethereum)
|
|
4956
|
+
* earnChainIdentifierSchema.parse('Ethereum')
|
|
4957
|
+
* earnChainIdentifierSchema.parse(Ethereum)
|
|
4958
|
+
*
|
|
4959
|
+
* // Invalid (throws ZodError)
|
|
4960
|
+
* earnChainIdentifierSchema.parse('Solana')
|
|
4961
|
+
* ```
|
|
4962
|
+
*/
|
|
4963
|
+
zod.z.union([
|
|
4964
|
+
zod.z.string().refine((val) => val in EarnChain, (val) => ({
|
|
4965
|
+
message: `"${val}" is not a supported earn chain. ` +
|
|
4966
|
+
`Supported chains: ${Object.values(EarnChain).join(', ')}`,
|
|
4967
|
+
})),
|
|
4968
|
+
zod.z.nativeEnum(EarnChain),
|
|
4969
|
+
chainDefinitionSchema$1.refine((chain) => chain.chain in EarnChain, (chain) => ({
|
|
4970
|
+
message: `"${chain.chain}" is not a supported earn chain. ` +
|
|
4971
|
+
`Supported chains: ${Object.values(EarnChain).join(', ')}`,
|
|
4972
|
+
})),
|
|
4973
|
+
]);
|
|
4872
4974
|
|
|
4873
4975
|
/**
|
|
4874
4976
|
* @packageDocumentation
|
|
@@ -5956,6 +6058,7 @@ const USDC = {
|
|
|
5956
6058
|
// =========================================================================
|
|
5957
6059
|
// Testnets (alphabetically sorted)
|
|
5958
6060
|
// =========================================================================
|
|
6061
|
+
[exports.Blockchain.Arc_Testnet]: '0x3600000000000000000000000000000000000000',
|
|
5959
6062
|
[exports.Blockchain.Arbitrum_Sepolia]: '0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d',
|
|
5960
6063
|
[exports.Blockchain.Avalanche_Fuji]: '0x5425890298aed601595a70AB815c96711a31Bc65',
|
|
5961
6064
|
[exports.Blockchain.Base_Sepolia]: '0x036CbD53842c5426634e7929541eC2318f3dCF7e',
|
|
@@ -6032,6 +6135,8 @@ const EURC = {
|
|
|
6032
6135
|
[exports.Blockchain.Ethereum]: '0x1aBaEA1f7C830bD89Acc67eC4af516284b1bC33c',
|
|
6033
6136
|
[exports.Blockchain.Solana]: 'HzwqbKZw8HxMN6bF2yFZNrht3c2iXXzpKcFu7uBEDKtr',
|
|
6034
6137
|
[exports.Blockchain.World_Chain]: '0x1C60ba0A0eD1019e8Eb035E6daF4155A5cE2380B',
|
|
6138
|
+
// Testnets
|
|
6139
|
+
[exports.Blockchain.Arc_Testnet]: '0x89B50855Aa3bE2F677cD6303Cec089B5F319D72a',
|
|
6035
6140
|
},
|
|
6036
6141
|
};
|
|
6037
6142
|
|
package/index.mjs
CHANGED
|
@@ -415,6 +415,12 @@ const InputError = {
|
|
|
415
415
|
name: 'INPUT_UNSUPPORTED_TOKEN',
|
|
416
416
|
type: 'INPUT',
|
|
417
417
|
},
|
|
418
|
+
/** No route satisfies the slippage or minimum-output constraint */
|
|
419
|
+
SLIPPAGE_CONSTRAINT_NOT_MET: {
|
|
420
|
+
code: 1009,
|
|
421
|
+
name: 'INPUT_SLIPPAGE_CONSTRAINT_NOT_MET',
|
|
422
|
+
type: 'INPUT',
|
|
423
|
+
},
|
|
418
424
|
/** General validation failure for complex validation rules */
|
|
419
425
|
VALIDATION_FAILED: {
|
|
420
426
|
code: 1098,
|
|
@@ -1194,6 +1200,40 @@ function normalizeTransactionDetails(txHash, explorerUrl) {
|
|
|
1194
1200
|
}
|
|
1195
1201
|
return normalized;
|
|
1196
1202
|
}
|
|
1203
|
+
/**
|
|
1204
|
+
* Pattern that matches on-chain revert reasons caused by slippage or
|
|
1205
|
+
* price constraints. When a revert matches, the error is surfaced as
|
|
1206
|
+
* {@link InputError.SLIPPAGE_CONSTRAINT_NOT_MET} (RETRYABLE) instead of
|
|
1207
|
+
* a generic simulation-failed / transaction-reverted error.
|
|
1208
|
+
*
|
|
1209
|
+
* @internal
|
|
1210
|
+
*/
|
|
1211
|
+
const SLIPPAGE_REVERT_PATTERN = /slippage|lower than the minimum required|less than the initial balance|minimum.?output|price.?impact|stop.?limit|InsufficientOutput|InsufficientFinalBalance/i;
|
|
1212
|
+
/**
|
|
1213
|
+
* Handle simulation / execution revert errors, distinguishing slippage
|
|
1214
|
+
* constraint failures from generic reverts and simulation failures.
|
|
1215
|
+
*
|
|
1216
|
+
* @internal
|
|
1217
|
+
*/
|
|
1218
|
+
function handleRevertError(msg, error, context) {
|
|
1219
|
+
const reason = extractRevertReason(msg, error) ?? 'Transaction reverted';
|
|
1220
|
+
if (SLIPPAGE_REVERT_PATTERN.test(reason)) {
|
|
1221
|
+
return new KitError({
|
|
1222
|
+
...InputError.SLIPPAGE_CONSTRAINT_NOT_MET,
|
|
1223
|
+
recoverability: 'RETRYABLE',
|
|
1224
|
+
message: `Transaction on ${context.chain} reverted: "${reason}". ` +
|
|
1225
|
+
'Try increasing slippageBps or adjusting stopLimit.',
|
|
1226
|
+
cause: { trace: { rawError: error, chain: context.chain, reason } },
|
|
1227
|
+
});
|
|
1228
|
+
}
|
|
1229
|
+
if (/simulation failed/i.test(msg) || context.operation === 'simulation') {
|
|
1230
|
+
return createSimulationFailedError(context.chain, reason, {
|
|
1231
|
+
rawError: error,
|
|
1232
|
+
});
|
|
1233
|
+
}
|
|
1234
|
+
const { txHash, explorerUrl } = normalizeTransactionDetails(context.txHash, context.explorerUrl);
|
|
1235
|
+
return createTransactionRevertedError(context.chain, reason, { rawError: error }, txHash, explorerUrl);
|
|
1236
|
+
}
|
|
1197
1237
|
/**
|
|
1198
1238
|
* Parses raw blockchain errors into structured KitError instances.
|
|
1199
1239
|
*
|
|
@@ -1274,21 +1314,7 @@ function parseBlockchainError(error, context) {
|
|
|
1274
1314
|
// Pattern 2: Simulation and execution reverts
|
|
1275
1315
|
// Matches contract revert errors and simulation failures
|
|
1276
1316
|
if (/execution reverted|simulation failed|transaction reverted|transaction failed/i.test(msg)) {
|
|
1277
|
-
|
|
1278
|
-
// Distinguish between simulation failures and transaction reverts
|
|
1279
|
-
// "simulation failed" or "eth_call" indicates pre-flight simulation
|
|
1280
|
-
// "transaction failed" or context.operation === 'transaction' indicates post-execution
|
|
1281
|
-
if (/simulation failed/i.test(msg) || context.operation === 'simulation') {
|
|
1282
|
-
return createSimulationFailedError(context.chain, reason, {
|
|
1283
|
-
rawError: error,
|
|
1284
|
-
});
|
|
1285
|
-
}
|
|
1286
|
-
// Transaction execution failures or reverts
|
|
1287
|
-
// Include txHash and explorerUrl if available (transaction was submitted)
|
|
1288
|
-
const { txHash, explorerUrl } = normalizeTransactionDetails(context.txHash, context.explorerUrl);
|
|
1289
|
-
return createTransactionRevertedError(context.chain, reason, {
|
|
1290
|
-
rawError: error,
|
|
1291
|
-
}, txHash, explorerUrl);
|
|
1317
|
+
return handleRevertError(msg, error, context);
|
|
1292
1318
|
}
|
|
1293
1319
|
// Pattern 3: Gas-related errors
|
|
1294
1320
|
// Matches gas estimation failures and gas exhaustion
|
|
@@ -1313,8 +1339,12 @@ function parseBlockchainError(error, context) {
|
|
|
1313
1339
|
return createNetworkConnectionError(context.chain, { rawError: error });
|
|
1314
1340
|
}
|
|
1315
1341
|
// Pattern 5: RPC provider errors
|
|
1316
|
-
// Matches RPC endpoint errors, invalid responses,
|
|
1317
|
-
|
|
1342
|
+
// Matches RPC endpoint errors, invalid responses, rate limits, and
|
|
1343
|
+
// transient JSON-RPC internal errors (e.g. ethers.js "could not coalesce error").
|
|
1344
|
+
// Note: "internal error" alone is too broad — contracts like USDT emit
|
|
1345
|
+
// "An internal error was received" for on-chain assertion failures.
|
|
1346
|
+
// We require JSON-RPC context (codes -32603/-32000) instead.
|
|
1347
|
+
if (/rpc|invalid response|rate limit|too many requests|could not coalesce|no response|server error|json-rpc\s+internal|internal json-rpc|-32603|-32000/i.test(msg)) {
|
|
1318
1348
|
return createRpcEndpointError(context.chain, { rawError: error });
|
|
1319
1349
|
}
|
|
1320
1350
|
// Pattern 6: Transaction size limit errors
|
|
@@ -1739,8 +1769,9 @@ var Blockchain;
|
|
|
1739
1769
|
/**
|
|
1740
1770
|
* Enum representing chains that support same-chain swaps through the Swap Kit.
|
|
1741
1771
|
*
|
|
1742
|
-
* Unlike the full {@link Blockchain} enum, SwapChain includes
|
|
1743
|
-
* networks
|
|
1772
|
+
* Unlike the full {@link Blockchain} enum, SwapChain includes mainnet
|
|
1773
|
+
* networks and explicitly whitelisted testnets (e.g., {@link Arc_Testnet})
|
|
1774
|
+
* where adapter contracts are deployed (CCTPv2 support).
|
|
1744
1775
|
*
|
|
1745
1776
|
* Dynamic validation via {@link isSwapSupportedChain} ensures chains
|
|
1746
1777
|
* automatically work when adapter contracts and supported tokens are deployed.
|
|
@@ -1785,6 +1816,8 @@ var SwapChain;
|
|
|
1785
1816
|
SwapChain["XDC"] = "XDC";
|
|
1786
1817
|
SwapChain["HyperEVM"] = "HyperEVM";
|
|
1787
1818
|
SwapChain["Monad"] = "Monad";
|
|
1819
|
+
// Testnet chains with swap support
|
|
1820
|
+
SwapChain["Arc_Testnet"] = "Arc_Testnet";
|
|
1788
1821
|
})(SwapChain || (SwapChain = {}));
|
|
1789
1822
|
// -----------------------------------------------------------------------------
|
|
1790
1823
|
// Bridge Chain Enum (CCTPv2 Supported Chains)
|
|
@@ -1881,6 +1914,31 @@ var BridgeChain;
|
|
|
1881
1914
|
BridgeChain["World_Chain_Sepolia"] = "World_Chain_Sepolia";
|
|
1882
1915
|
BridgeChain["XDC_Apothem"] = "XDC_Apothem";
|
|
1883
1916
|
})(BridgeChain || (BridgeChain = {}));
|
|
1917
|
+
// -----------------------------------------------------------------------------
|
|
1918
|
+
// Earn Chain Enum
|
|
1919
|
+
// -----------------------------------------------------------------------------
|
|
1920
|
+
/**
|
|
1921
|
+
* Enumeration of blockchains that support earn (vault deposit/withdraw)
|
|
1922
|
+
* operations through the Earn Kit.
|
|
1923
|
+
*
|
|
1924
|
+
* Currently only Ethereum mainnet is supported. Additional chains
|
|
1925
|
+
* will be added as vault protocol support expands.
|
|
1926
|
+
*
|
|
1927
|
+
* @example
|
|
1928
|
+
* ```typescript
|
|
1929
|
+
* import { EarnChain } from '@core/chains'
|
|
1930
|
+
*
|
|
1931
|
+
* const result = await earnKit.deposit({
|
|
1932
|
+
* from: { adapter, chain: EarnChain.Ethereum },
|
|
1933
|
+
* vaultAddress: '0x...',
|
|
1934
|
+
* amount: '100',
|
|
1935
|
+
* })
|
|
1936
|
+
* ```
|
|
1937
|
+
*/
|
|
1938
|
+
var EarnChain;
|
|
1939
|
+
(function (EarnChain) {
|
|
1940
|
+
EarnChain["Ethereum"] = "Ethereum";
|
|
1941
|
+
})(EarnChain || (EarnChain = {}));
|
|
1884
1942
|
|
|
1885
1943
|
/**
|
|
1886
1944
|
* Helper function to define a chain with proper TypeScript typing.
|
|
@@ -2183,6 +2241,14 @@ const BRIDGE_CONTRACT_EVM_MAINNET = '0xB3FA262d0fB521cc93bE83d87b322b8A23DAf3F0'
|
|
|
2183
2241
|
* on EVM-compatible chains. Use this address for mainnet adapter integrations.
|
|
2184
2242
|
*/
|
|
2185
2243
|
const ADAPTER_CONTRACT_EVM_MAINNET = '0x7FB8c7260b63934d8da38aF902f87ae6e284a845';
|
|
2244
|
+
/**
|
|
2245
|
+
* The adapter contract address for EVM testnet networks.
|
|
2246
|
+
*
|
|
2247
|
+
* This contract serves as an adapter for integrating with various protocols
|
|
2248
|
+
* on EVM-compatible testnet chains. Use this address for testnet adapter
|
|
2249
|
+
* integrations (e.g., Arc Testnet).
|
|
2250
|
+
*/
|
|
2251
|
+
const ADAPTER_CONTRACT_EVM_TESTNET = '0xBBD70b01a1CAbc96d5b7b129Ae1AAabdf50dd40b';
|
|
2186
2252
|
|
|
2187
2253
|
/**
|
|
2188
2254
|
* Arc Testnet chain definition
|
|
@@ -2231,6 +2297,7 @@ const ArcTestnet = defineChain({
|
|
|
2231
2297
|
},
|
|
2232
2298
|
kitContracts: {
|
|
2233
2299
|
bridge: BRIDGE_CONTRACT_EVM_TESTNET,
|
|
2300
|
+
adapter: ADAPTER_CONTRACT_EVM_TESTNET,
|
|
2234
2301
|
},
|
|
2235
2302
|
});
|
|
2236
2303
|
|
|
@@ -2921,7 +2988,7 @@ const HyperEVM = defineChain({
|
|
|
2921
2988
|
},
|
|
2922
2989
|
chainId: 999,
|
|
2923
2990
|
isTestnet: false,
|
|
2924
|
-
explorerUrl: 'https://
|
|
2991
|
+
explorerUrl: 'https://hyperevmscan.io/tx/{hash}',
|
|
2925
2992
|
rpcEndpoints: ['https://rpc.hyperliquid.xyz/evm'],
|
|
2926
2993
|
eurcAddress: null,
|
|
2927
2994
|
usdcAddress: '0xb88339CB7199b77E23DB6E890353E22632Ba630f',
|
|
@@ -4029,7 +4096,7 @@ const Solana = defineChain({
|
|
|
4029
4096
|
},
|
|
4030
4097
|
forwarderSupported: {
|
|
4031
4098
|
source: true,
|
|
4032
|
-
destination:
|
|
4099
|
+
destination: true,
|
|
4033
4100
|
},
|
|
4034
4101
|
},
|
|
4035
4102
|
kitContracts: {
|
|
@@ -4076,7 +4143,7 @@ const SolanaDevnet = defineChain({
|
|
|
4076
4143
|
},
|
|
4077
4144
|
forwarderSupported: {
|
|
4078
4145
|
source: true,
|
|
4079
|
-
destination:
|
|
4146
|
+
destination: true,
|
|
4080
4147
|
},
|
|
4081
4148
|
},
|
|
4082
4149
|
kitContracts: {
|
|
@@ -4864,6 +4931,41 @@ z.union([
|
|
|
4864
4931
|
message: `Chain "${chainDef.name}" (${chainDef.chain}) is not supported for bridging. Only chains in the BridgeChain enum support CCTPv2 bridging.`,
|
|
4865
4932
|
})),
|
|
4866
4933
|
]);
|
|
4934
|
+
/**
|
|
4935
|
+
* Zod schema for validating earn-specific chain identifiers.
|
|
4936
|
+
*
|
|
4937
|
+
* Validate that the provided chain is supported for earn (vault
|
|
4938
|
+
* deposit/withdraw) operations. Currently only Ethereum is
|
|
4939
|
+
* supported.
|
|
4940
|
+
*
|
|
4941
|
+
* Accept an EarnChain enum value, a matching string literal, or
|
|
4942
|
+
* a ChainDefinition for a supported chain.
|
|
4943
|
+
*
|
|
4944
|
+
* @example
|
|
4945
|
+
* ```typescript
|
|
4946
|
+
* import { earnChainIdentifierSchema } from '@core/chains'
|
|
4947
|
+
* import { EarnChain, Ethereum } from '@core/chains'
|
|
4948
|
+
*
|
|
4949
|
+
* // Valid
|
|
4950
|
+
* earnChainIdentifierSchema.parse(EarnChain.Ethereum)
|
|
4951
|
+
* earnChainIdentifierSchema.parse('Ethereum')
|
|
4952
|
+
* earnChainIdentifierSchema.parse(Ethereum)
|
|
4953
|
+
*
|
|
4954
|
+
* // Invalid (throws ZodError)
|
|
4955
|
+
* earnChainIdentifierSchema.parse('Solana')
|
|
4956
|
+
* ```
|
|
4957
|
+
*/
|
|
4958
|
+
z.union([
|
|
4959
|
+
z.string().refine((val) => val in EarnChain, (val) => ({
|
|
4960
|
+
message: `"${val}" is not a supported earn chain. ` +
|
|
4961
|
+
`Supported chains: ${Object.values(EarnChain).join(', ')}`,
|
|
4962
|
+
})),
|
|
4963
|
+
z.nativeEnum(EarnChain),
|
|
4964
|
+
chainDefinitionSchema$1.refine((chain) => chain.chain in EarnChain, (chain) => ({
|
|
4965
|
+
message: `"${chain.chain}" is not a supported earn chain. ` +
|
|
4966
|
+
`Supported chains: ${Object.values(EarnChain).join(', ')}`,
|
|
4967
|
+
})),
|
|
4968
|
+
]);
|
|
4867
4969
|
|
|
4868
4970
|
/**
|
|
4869
4971
|
* @packageDocumentation
|
|
@@ -5951,6 +6053,7 @@ const USDC = {
|
|
|
5951
6053
|
// =========================================================================
|
|
5952
6054
|
// Testnets (alphabetically sorted)
|
|
5953
6055
|
// =========================================================================
|
|
6056
|
+
[Blockchain.Arc_Testnet]: '0x3600000000000000000000000000000000000000',
|
|
5954
6057
|
[Blockchain.Arbitrum_Sepolia]: '0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d',
|
|
5955
6058
|
[Blockchain.Avalanche_Fuji]: '0x5425890298aed601595a70AB815c96711a31Bc65',
|
|
5956
6059
|
[Blockchain.Base_Sepolia]: '0x036CbD53842c5426634e7929541eC2318f3dCF7e',
|
|
@@ -6027,6 +6130,8 @@ const EURC = {
|
|
|
6027
6130
|
[Blockchain.Ethereum]: '0x1aBaEA1f7C830bD89Acc67eC4af516284b1bC33c',
|
|
6028
6131
|
[Blockchain.Solana]: 'HzwqbKZw8HxMN6bF2yFZNrht3c2iXXzpKcFu7uBEDKtr',
|
|
6029
6132
|
[Blockchain.World_Chain]: '0x1C60ba0A0eD1019e8Eb035E6daF4155A5cE2380B',
|
|
6133
|
+
// Testnets
|
|
6134
|
+
[Blockchain.Arc_Testnet]: '0x89B50855Aa3bE2F677cD6303Cec089B5F319D72a',
|
|
6030
6135
|
},
|
|
6031
6136
|
};
|
|
6032
6137
|
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@circle-fin/adapter-ethers-v6",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.4",
|
|
4
4
|
"description": "EVM blockchain adapter powered by Ethers v6",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"circle",
|
|
7
|
+
"circle-fin",
|
|
7
8
|
"cctp",
|
|
8
9
|
"usdc",
|
|
9
10
|
"stablecoin",
|
|
@@ -15,7 +16,9 @@
|
|
|
15
16
|
"ethers",
|
|
16
17
|
"cross-chain",
|
|
17
18
|
"bridge",
|
|
18
|
-
"bridge-kit"
|
|
19
|
+
"bridge-kit",
|
|
20
|
+
"app-kit",
|
|
21
|
+
"swap-kit"
|
|
19
22
|
],
|
|
20
23
|
"main": "./index.cjs",
|
|
21
24
|
"module": "./index.mjs",
|