@circle-fin/bridge-kit 1.1.2 → 1.2.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 +22 -0
- package/QUICKSTART.md +144 -28
- package/README.md +127 -11
- package/chains.cjs +135 -2
- package/chains.d.ts +92 -3
- package/chains.mjs +136 -3
- package/index.cjs +3446 -2905
- package/index.d.ts +353 -84
- package/index.mjs +3447 -2907
- package/package.json +2 -2
package/chains.cjs
CHANGED
|
@@ -24,10 +24,16 @@ var zod = require('zod');
|
|
|
24
24
|
// Blockchain Enum
|
|
25
25
|
// -----------------------------------------------------------------------------
|
|
26
26
|
/**
|
|
27
|
-
* Enumeration of all blockchains
|
|
27
|
+
* Enumeration of all blockchains known to this library.
|
|
28
|
+
*
|
|
29
|
+
* This enum contains every blockchain that has a chain definition, regardless
|
|
30
|
+
* of whether bridging is currently supported. For chains that support bridging
|
|
31
|
+
* via CCTPv2, see {@link BridgeChain}.
|
|
32
|
+
*
|
|
28
33
|
* @enum
|
|
29
34
|
* @category Enums
|
|
30
|
-
* @description Provides string identifiers for each
|
|
35
|
+
* @description Provides string identifiers for each blockchain with a definition.
|
|
36
|
+
* @see {@link BridgeChain} for the subset of chains that support CCTPv2 bridging.
|
|
31
37
|
*/
|
|
32
38
|
var Blockchain;
|
|
33
39
|
(function (Blockchain) {
|
|
@@ -87,6 +93,95 @@ var Blockchain;
|
|
|
87
93
|
Blockchain["ZKSync_Era"] = "ZKSync_Era";
|
|
88
94
|
Blockchain["ZKSync_Sepolia"] = "ZKSync_Sepolia";
|
|
89
95
|
})(Blockchain || (Blockchain = {}));
|
|
96
|
+
// -----------------------------------------------------------------------------
|
|
97
|
+
// Bridge Chain Enum (CCTPv2 Supported Chains)
|
|
98
|
+
// -----------------------------------------------------------------------------
|
|
99
|
+
/**
|
|
100
|
+
* Enumeration of blockchains that support cross-chain bridging via CCTPv2.
|
|
101
|
+
*
|
|
102
|
+
* The enum is derived from the full {@link Blockchain} enum but filtered to only
|
|
103
|
+
* include chains with active CCTPv2 support. When new chains gain CCTPv2 support,
|
|
104
|
+
* they are added to this enum.
|
|
105
|
+
*
|
|
106
|
+
* @enum
|
|
107
|
+
* @category Enums
|
|
108
|
+
*
|
|
109
|
+
* @remarks
|
|
110
|
+
* - This enum is the **canonical source** of bridging-supported chains.
|
|
111
|
+
* - Use this enum (or its string literals) in `kit.bridge()` calls for type safety.
|
|
112
|
+
* - Attempting to use a chain not in this enum will produce a TypeScript compile error.
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* ```typescript
|
|
116
|
+
* import { BridgeKit, BridgeChain } from '@circle-fin/bridge-kit'
|
|
117
|
+
*
|
|
118
|
+
* const kit = new BridgeKit()
|
|
119
|
+
*
|
|
120
|
+
* // ✅ Valid - autocomplete suggests only supported chains
|
|
121
|
+
* await kit.bridge({
|
|
122
|
+
* from: { adapter, chain: BridgeChain.Ethereum },
|
|
123
|
+
* to: { adapter, chain: BridgeChain.Base },
|
|
124
|
+
* amount: '100'
|
|
125
|
+
* })
|
|
126
|
+
*
|
|
127
|
+
* // ✅ Also valid - string literals work with autocomplete
|
|
128
|
+
* await kit.bridge({
|
|
129
|
+
* from: { adapter, chain: 'Ethereum_Sepolia' },
|
|
130
|
+
* to: { adapter, chain: 'Base_Sepolia' },
|
|
131
|
+
* amount: '100'
|
|
132
|
+
* })
|
|
133
|
+
*
|
|
134
|
+
* // ❌ Compile error - Algorand is not in BridgeChain
|
|
135
|
+
* await kit.bridge({
|
|
136
|
+
* from: { adapter, chain: 'Algorand' }, // TypeScript error!
|
|
137
|
+
* to: { adapter, chain: 'Base' },
|
|
138
|
+
* amount: '100'
|
|
139
|
+
* })
|
|
140
|
+
* ```
|
|
141
|
+
*
|
|
142
|
+
* @see {@link Blockchain} for the complete list of all known blockchains.
|
|
143
|
+
* @see {@link BridgeChainIdentifier} for the type that accepts these values.
|
|
144
|
+
*/
|
|
145
|
+
exports.BridgeChain = void 0;
|
|
146
|
+
(function (BridgeChain) {
|
|
147
|
+
// Mainnet chains with CCTPv2 support
|
|
148
|
+
BridgeChain["Arbitrum"] = "Arbitrum";
|
|
149
|
+
BridgeChain["Avalanche"] = "Avalanche";
|
|
150
|
+
BridgeChain["Base"] = "Base";
|
|
151
|
+
BridgeChain["Codex"] = "Codex";
|
|
152
|
+
BridgeChain["Ethereum"] = "Ethereum";
|
|
153
|
+
BridgeChain["HyperEVM"] = "HyperEVM";
|
|
154
|
+
BridgeChain["Ink"] = "Ink";
|
|
155
|
+
BridgeChain["Linea"] = "Linea";
|
|
156
|
+
BridgeChain["Optimism"] = "Optimism";
|
|
157
|
+
BridgeChain["Plume"] = "Plume";
|
|
158
|
+
BridgeChain["Polygon"] = "Polygon";
|
|
159
|
+
BridgeChain["Sei"] = "Sei";
|
|
160
|
+
BridgeChain["Solana"] = "Solana";
|
|
161
|
+
BridgeChain["Sonic"] = "Sonic";
|
|
162
|
+
BridgeChain["Unichain"] = "Unichain";
|
|
163
|
+
BridgeChain["World_Chain"] = "World_Chain";
|
|
164
|
+
BridgeChain["XDC"] = "XDC";
|
|
165
|
+
// Testnet chains with CCTPv2 support
|
|
166
|
+
BridgeChain["Arc_Testnet"] = "Arc_Testnet";
|
|
167
|
+
BridgeChain["Arbitrum_Sepolia"] = "Arbitrum_Sepolia";
|
|
168
|
+
BridgeChain["Avalanche_Fuji"] = "Avalanche_Fuji";
|
|
169
|
+
BridgeChain["Base_Sepolia"] = "Base_Sepolia";
|
|
170
|
+
BridgeChain["Codex_Testnet"] = "Codex_Testnet";
|
|
171
|
+
BridgeChain["Ethereum_Sepolia"] = "Ethereum_Sepolia";
|
|
172
|
+
BridgeChain["HyperEVM_Testnet"] = "HyperEVM_Testnet";
|
|
173
|
+
BridgeChain["Ink_Testnet"] = "Ink_Testnet";
|
|
174
|
+
BridgeChain["Linea_Sepolia"] = "Linea_Sepolia";
|
|
175
|
+
BridgeChain["Optimism_Sepolia"] = "Optimism_Sepolia";
|
|
176
|
+
BridgeChain["Plume_Testnet"] = "Plume_Testnet";
|
|
177
|
+
BridgeChain["Polygon_Amoy_Testnet"] = "Polygon_Amoy_Testnet";
|
|
178
|
+
BridgeChain["Sei_Testnet"] = "Sei_Testnet";
|
|
179
|
+
BridgeChain["Solana_Devnet"] = "Solana_Devnet";
|
|
180
|
+
BridgeChain["Sonic_Testnet"] = "Sonic_Testnet";
|
|
181
|
+
BridgeChain["Unichain_Sepolia"] = "Unichain_Sepolia";
|
|
182
|
+
BridgeChain["World_Chain_Sepolia"] = "World_Chain_Sepolia";
|
|
183
|
+
BridgeChain["XDC_Apothem"] = "XDC_Apothem";
|
|
184
|
+
})(exports.BridgeChain || (exports.BridgeChain = {}));
|
|
90
185
|
|
|
91
186
|
/**
|
|
92
187
|
* Helper function to define a chain with proper TypeScript typing.
|
|
@@ -2265,6 +2360,44 @@ zod.z.union([
|
|
|
2265
2360
|
zod.z.nativeEnum(Blockchain),
|
|
2266
2361
|
chainDefinitionSchema,
|
|
2267
2362
|
]);
|
|
2363
|
+
/**
|
|
2364
|
+
* Zod schema for validating bridge chain identifiers.
|
|
2365
|
+
*
|
|
2366
|
+
* This schema validates that the provided chain is supported for CCTPv2 bridging.
|
|
2367
|
+
* It accepts either a BridgeChain enum value, a string matching a BridgeChain value,
|
|
2368
|
+
* or a ChainDefinition for a supported chain.
|
|
2369
|
+
*
|
|
2370
|
+
* Use this schema when validating chain parameters for bridge operations to ensure
|
|
2371
|
+
* only CCTPv2-supported chains are accepted at runtime.
|
|
2372
|
+
*
|
|
2373
|
+
* @example
|
|
2374
|
+
* ```typescript
|
|
2375
|
+
* import { bridgeChainIdentifierSchema } from '@core/chains/validation'
|
|
2376
|
+
* import { BridgeChain, Chains } from '@core/chains'
|
|
2377
|
+
*
|
|
2378
|
+
* // Valid - BridgeChain enum value
|
|
2379
|
+
* bridgeChainIdentifierSchema.parse(BridgeChain.Ethereum)
|
|
2380
|
+
*
|
|
2381
|
+
* // Valid - string literal
|
|
2382
|
+
* bridgeChainIdentifierSchema.parse('Base_Sepolia')
|
|
2383
|
+
*
|
|
2384
|
+
* // Valid - ChainDefinition (validated by CCTP support)
|
|
2385
|
+
* bridgeChainIdentifierSchema.parse(Chains.Solana)
|
|
2386
|
+
*
|
|
2387
|
+
* // Invalid - Algorand is not in BridgeChain (throws ZodError)
|
|
2388
|
+
* bridgeChainIdentifierSchema.parse('Algorand')
|
|
2389
|
+
* ```
|
|
2390
|
+
*
|
|
2391
|
+
* @see {@link BridgeChain} for the enum of supported chains.
|
|
2392
|
+
*/
|
|
2393
|
+
zod.z.union([
|
|
2394
|
+
zod.z.string().refine((val) => val in exports.BridgeChain, (val) => ({
|
|
2395
|
+
message: `Chain "${val}" is not supported for bridging. Only chains in the BridgeChain enum support CCTPv2 bridging.`,
|
|
2396
|
+
})),
|
|
2397
|
+
chainDefinitionSchema.refine((chainDef) => chainDef.chain in exports.BridgeChain, (chainDef) => ({
|
|
2398
|
+
message: `Chain "${chainDef.name}" (${chainDef.chain}) is not supported for bridging. Only chains in the BridgeChain enum support CCTPv2 bridging.`,
|
|
2399
|
+
})),
|
|
2400
|
+
]);
|
|
2268
2401
|
|
|
2269
2402
|
exports.Arbitrum = Arbitrum;
|
|
2270
2403
|
exports.ArbitrumSepolia = ArbitrumSepolia;
|
package/chains.d.ts
CHANGED
|
@@ -17,10 +17,16 @@
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
|
-
* Enumeration of all blockchains
|
|
20
|
+
* Enumeration of all blockchains known to this library.
|
|
21
|
+
*
|
|
22
|
+
* This enum contains every blockchain that has a chain definition, regardless
|
|
23
|
+
* of whether bridging is currently supported. For chains that support bridging
|
|
24
|
+
* via CCTPv2, see {@link BridgeChain}.
|
|
25
|
+
*
|
|
21
26
|
* @enum
|
|
22
27
|
* @category Enums
|
|
23
|
-
* @description Provides string identifiers for each
|
|
28
|
+
* @description Provides string identifiers for each blockchain with a definition.
|
|
29
|
+
* @see {@link BridgeChain} for the subset of chains that support CCTPv2 bridging.
|
|
24
30
|
*/
|
|
25
31
|
declare enum Blockchain {
|
|
26
32
|
Algorand = "Algorand",
|
|
@@ -79,6 +85,89 @@ declare enum Blockchain {
|
|
|
79
85
|
ZKSync_Era = "ZKSync_Era",
|
|
80
86
|
ZKSync_Sepolia = "ZKSync_Sepolia"
|
|
81
87
|
}
|
|
88
|
+
/**
|
|
89
|
+
* Enumeration of blockchains that support cross-chain bridging via CCTPv2.
|
|
90
|
+
*
|
|
91
|
+
* The enum is derived from the full {@link Blockchain} enum but filtered to only
|
|
92
|
+
* include chains with active CCTPv2 support. When new chains gain CCTPv2 support,
|
|
93
|
+
* they are added to this enum.
|
|
94
|
+
*
|
|
95
|
+
* @enum
|
|
96
|
+
* @category Enums
|
|
97
|
+
*
|
|
98
|
+
* @remarks
|
|
99
|
+
* - This enum is the **canonical source** of bridging-supported chains.
|
|
100
|
+
* - Use this enum (or its string literals) in `kit.bridge()` calls for type safety.
|
|
101
|
+
* - Attempting to use a chain not in this enum will produce a TypeScript compile error.
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* ```typescript
|
|
105
|
+
* import { BridgeKit, BridgeChain } from '@circle-fin/bridge-kit'
|
|
106
|
+
*
|
|
107
|
+
* const kit = new BridgeKit()
|
|
108
|
+
*
|
|
109
|
+
* // ✅ Valid - autocomplete suggests only supported chains
|
|
110
|
+
* await kit.bridge({
|
|
111
|
+
* from: { adapter, chain: BridgeChain.Ethereum },
|
|
112
|
+
* to: { adapter, chain: BridgeChain.Base },
|
|
113
|
+
* amount: '100'
|
|
114
|
+
* })
|
|
115
|
+
*
|
|
116
|
+
* // ✅ Also valid - string literals work with autocomplete
|
|
117
|
+
* await kit.bridge({
|
|
118
|
+
* from: { adapter, chain: 'Ethereum_Sepolia' },
|
|
119
|
+
* to: { adapter, chain: 'Base_Sepolia' },
|
|
120
|
+
* amount: '100'
|
|
121
|
+
* })
|
|
122
|
+
*
|
|
123
|
+
* // ❌ Compile error - Algorand is not in BridgeChain
|
|
124
|
+
* await kit.bridge({
|
|
125
|
+
* from: { adapter, chain: 'Algorand' }, // TypeScript error!
|
|
126
|
+
* to: { adapter, chain: 'Base' },
|
|
127
|
+
* amount: '100'
|
|
128
|
+
* })
|
|
129
|
+
* ```
|
|
130
|
+
*
|
|
131
|
+
* @see {@link Blockchain} for the complete list of all known blockchains.
|
|
132
|
+
* @see {@link BridgeChainIdentifier} for the type that accepts these values.
|
|
133
|
+
*/
|
|
134
|
+
declare enum BridgeChain {
|
|
135
|
+
Arbitrum = "Arbitrum",
|
|
136
|
+
Avalanche = "Avalanche",
|
|
137
|
+
Base = "Base",
|
|
138
|
+
Codex = "Codex",
|
|
139
|
+
Ethereum = "Ethereum",
|
|
140
|
+
HyperEVM = "HyperEVM",
|
|
141
|
+
Ink = "Ink",
|
|
142
|
+
Linea = "Linea",
|
|
143
|
+
Optimism = "Optimism",
|
|
144
|
+
Plume = "Plume",
|
|
145
|
+
Polygon = "Polygon",
|
|
146
|
+
Sei = "Sei",
|
|
147
|
+
Solana = "Solana",
|
|
148
|
+
Sonic = "Sonic",
|
|
149
|
+
Unichain = "Unichain",
|
|
150
|
+
World_Chain = "World_Chain",
|
|
151
|
+
XDC = "XDC",
|
|
152
|
+
Arc_Testnet = "Arc_Testnet",
|
|
153
|
+
Arbitrum_Sepolia = "Arbitrum_Sepolia",
|
|
154
|
+
Avalanche_Fuji = "Avalanche_Fuji",
|
|
155
|
+
Base_Sepolia = "Base_Sepolia",
|
|
156
|
+
Codex_Testnet = "Codex_Testnet",
|
|
157
|
+
Ethereum_Sepolia = "Ethereum_Sepolia",
|
|
158
|
+
HyperEVM_Testnet = "HyperEVM_Testnet",
|
|
159
|
+
Ink_Testnet = "Ink_Testnet",
|
|
160
|
+
Linea_Sepolia = "Linea_Sepolia",
|
|
161
|
+
Optimism_Sepolia = "Optimism_Sepolia",
|
|
162
|
+
Plume_Testnet = "Plume_Testnet",
|
|
163
|
+
Polygon_Amoy_Testnet = "Polygon_Amoy_Testnet",
|
|
164
|
+
Sei_Testnet = "Sei_Testnet",
|
|
165
|
+
Solana_Devnet = "Solana_Devnet",
|
|
166
|
+
Sonic_Testnet = "Sonic_Testnet",
|
|
167
|
+
Unichain_Sepolia = "Unichain_Sepolia",
|
|
168
|
+
World_Chain_Sepolia = "World_Chain_Sepolia",
|
|
169
|
+
XDC_Apothem = "XDC_Apothem"
|
|
170
|
+
}
|
|
82
171
|
|
|
83
172
|
/**
|
|
84
173
|
* Arc Testnet chain definition
|
|
@@ -1522,4 +1611,4 @@ declare const XDCApothem: {
|
|
|
1522
1611
|
};
|
|
1523
1612
|
};
|
|
1524
1613
|
|
|
1525
|
-
export { Arbitrum, ArbitrumSepolia, ArcTestnet, Avalanche, AvalancheFuji, Base, BaseSepolia, Codex, CodexTestnet, Ethereum, EthereumSepolia, HyperEVM, HyperEVMTestnet, Ink, InkTestnet, Linea, LineaSepolia, Optimism, OptimismSepolia, Plume, PlumeTestnet, Polygon, PolygonAmoy, Sei, SeiTestnet, Solana, SolanaDevnet, Sonic, SonicTestnet, Unichain, UnichainSepolia, WorldChain, WorldChainSepolia, XDC, XDCApothem };
|
|
1614
|
+
export { Arbitrum, ArbitrumSepolia, ArcTestnet, Avalanche, AvalancheFuji, Base, BaseSepolia, BridgeChain, Codex, CodexTestnet, Ethereum, EthereumSepolia, HyperEVM, HyperEVMTestnet, Ink, InkTestnet, Linea, LineaSepolia, Optimism, OptimismSepolia, Plume, PlumeTestnet, Polygon, PolygonAmoy, Sei, SeiTestnet, Solana, SolanaDevnet, Sonic, SonicTestnet, Unichain, UnichainSepolia, WorldChain, WorldChainSepolia, XDC, XDCApothem };
|
package/chains.mjs
CHANGED
|
@@ -22,10 +22,16 @@ import { z } from 'zod';
|
|
|
22
22
|
// Blockchain Enum
|
|
23
23
|
// -----------------------------------------------------------------------------
|
|
24
24
|
/**
|
|
25
|
-
* Enumeration of all blockchains
|
|
25
|
+
* Enumeration of all blockchains known to this library.
|
|
26
|
+
*
|
|
27
|
+
* This enum contains every blockchain that has a chain definition, regardless
|
|
28
|
+
* of whether bridging is currently supported. For chains that support bridging
|
|
29
|
+
* via CCTPv2, see {@link BridgeChain}.
|
|
30
|
+
*
|
|
26
31
|
* @enum
|
|
27
32
|
* @category Enums
|
|
28
|
-
* @description Provides string identifiers for each
|
|
33
|
+
* @description Provides string identifiers for each blockchain with a definition.
|
|
34
|
+
* @see {@link BridgeChain} for the subset of chains that support CCTPv2 bridging.
|
|
29
35
|
*/
|
|
30
36
|
var Blockchain;
|
|
31
37
|
(function (Blockchain) {
|
|
@@ -85,6 +91,95 @@ var Blockchain;
|
|
|
85
91
|
Blockchain["ZKSync_Era"] = "ZKSync_Era";
|
|
86
92
|
Blockchain["ZKSync_Sepolia"] = "ZKSync_Sepolia";
|
|
87
93
|
})(Blockchain || (Blockchain = {}));
|
|
94
|
+
// -----------------------------------------------------------------------------
|
|
95
|
+
// Bridge Chain Enum (CCTPv2 Supported Chains)
|
|
96
|
+
// -----------------------------------------------------------------------------
|
|
97
|
+
/**
|
|
98
|
+
* Enumeration of blockchains that support cross-chain bridging via CCTPv2.
|
|
99
|
+
*
|
|
100
|
+
* The enum is derived from the full {@link Blockchain} enum but filtered to only
|
|
101
|
+
* include chains with active CCTPv2 support. When new chains gain CCTPv2 support,
|
|
102
|
+
* they are added to this enum.
|
|
103
|
+
*
|
|
104
|
+
* @enum
|
|
105
|
+
* @category Enums
|
|
106
|
+
*
|
|
107
|
+
* @remarks
|
|
108
|
+
* - This enum is the **canonical source** of bridging-supported chains.
|
|
109
|
+
* - Use this enum (or its string literals) in `kit.bridge()` calls for type safety.
|
|
110
|
+
* - Attempting to use a chain not in this enum will produce a TypeScript compile error.
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* ```typescript
|
|
114
|
+
* import { BridgeKit, BridgeChain } from '@circle-fin/bridge-kit'
|
|
115
|
+
*
|
|
116
|
+
* const kit = new BridgeKit()
|
|
117
|
+
*
|
|
118
|
+
* // ✅ Valid - autocomplete suggests only supported chains
|
|
119
|
+
* await kit.bridge({
|
|
120
|
+
* from: { adapter, chain: BridgeChain.Ethereum },
|
|
121
|
+
* to: { adapter, chain: BridgeChain.Base },
|
|
122
|
+
* amount: '100'
|
|
123
|
+
* })
|
|
124
|
+
*
|
|
125
|
+
* // ✅ Also valid - string literals work with autocomplete
|
|
126
|
+
* await kit.bridge({
|
|
127
|
+
* from: { adapter, chain: 'Ethereum_Sepolia' },
|
|
128
|
+
* to: { adapter, chain: 'Base_Sepolia' },
|
|
129
|
+
* amount: '100'
|
|
130
|
+
* })
|
|
131
|
+
*
|
|
132
|
+
* // ❌ Compile error - Algorand is not in BridgeChain
|
|
133
|
+
* await kit.bridge({
|
|
134
|
+
* from: { adapter, chain: 'Algorand' }, // TypeScript error!
|
|
135
|
+
* to: { adapter, chain: 'Base' },
|
|
136
|
+
* amount: '100'
|
|
137
|
+
* })
|
|
138
|
+
* ```
|
|
139
|
+
*
|
|
140
|
+
* @see {@link Blockchain} for the complete list of all known blockchains.
|
|
141
|
+
* @see {@link BridgeChainIdentifier} for the type that accepts these values.
|
|
142
|
+
*/
|
|
143
|
+
var BridgeChain;
|
|
144
|
+
(function (BridgeChain) {
|
|
145
|
+
// Mainnet chains with CCTPv2 support
|
|
146
|
+
BridgeChain["Arbitrum"] = "Arbitrum";
|
|
147
|
+
BridgeChain["Avalanche"] = "Avalanche";
|
|
148
|
+
BridgeChain["Base"] = "Base";
|
|
149
|
+
BridgeChain["Codex"] = "Codex";
|
|
150
|
+
BridgeChain["Ethereum"] = "Ethereum";
|
|
151
|
+
BridgeChain["HyperEVM"] = "HyperEVM";
|
|
152
|
+
BridgeChain["Ink"] = "Ink";
|
|
153
|
+
BridgeChain["Linea"] = "Linea";
|
|
154
|
+
BridgeChain["Optimism"] = "Optimism";
|
|
155
|
+
BridgeChain["Plume"] = "Plume";
|
|
156
|
+
BridgeChain["Polygon"] = "Polygon";
|
|
157
|
+
BridgeChain["Sei"] = "Sei";
|
|
158
|
+
BridgeChain["Solana"] = "Solana";
|
|
159
|
+
BridgeChain["Sonic"] = "Sonic";
|
|
160
|
+
BridgeChain["Unichain"] = "Unichain";
|
|
161
|
+
BridgeChain["World_Chain"] = "World_Chain";
|
|
162
|
+
BridgeChain["XDC"] = "XDC";
|
|
163
|
+
// Testnet chains with CCTPv2 support
|
|
164
|
+
BridgeChain["Arc_Testnet"] = "Arc_Testnet";
|
|
165
|
+
BridgeChain["Arbitrum_Sepolia"] = "Arbitrum_Sepolia";
|
|
166
|
+
BridgeChain["Avalanche_Fuji"] = "Avalanche_Fuji";
|
|
167
|
+
BridgeChain["Base_Sepolia"] = "Base_Sepolia";
|
|
168
|
+
BridgeChain["Codex_Testnet"] = "Codex_Testnet";
|
|
169
|
+
BridgeChain["Ethereum_Sepolia"] = "Ethereum_Sepolia";
|
|
170
|
+
BridgeChain["HyperEVM_Testnet"] = "HyperEVM_Testnet";
|
|
171
|
+
BridgeChain["Ink_Testnet"] = "Ink_Testnet";
|
|
172
|
+
BridgeChain["Linea_Sepolia"] = "Linea_Sepolia";
|
|
173
|
+
BridgeChain["Optimism_Sepolia"] = "Optimism_Sepolia";
|
|
174
|
+
BridgeChain["Plume_Testnet"] = "Plume_Testnet";
|
|
175
|
+
BridgeChain["Polygon_Amoy_Testnet"] = "Polygon_Amoy_Testnet";
|
|
176
|
+
BridgeChain["Sei_Testnet"] = "Sei_Testnet";
|
|
177
|
+
BridgeChain["Solana_Devnet"] = "Solana_Devnet";
|
|
178
|
+
BridgeChain["Sonic_Testnet"] = "Sonic_Testnet";
|
|
179
|
+
BridgeChain["Unichain_Sepolia"] = "Unichain_Sepolia";
|
|
180
|
+
BridgeChain["World_Chain_Sepolia"] = "World_Chain_Sepolia";
|
|
181
|
+
BridgeChain["XDC_Apothem"] = "XDC_Apothem";
|
|
182
|
+
})(BridgeChain || (BridgeChain = {}));
|
|
88
183
|
|
|
89
184
|
/**
|
|
90
185
|
* Helper function to define a chain with proper TypeScript typing.
|
|
@@ -2263,6 +2358,44 @@ z.union([
|
|
|
2263
2358
|
z.nativeEnum(Blockchain),
|
|
2264
2359
|
chainDefinitionSchema,
|
|
2265
2360
|
]);
|
|
2361
|
+
/**
|
|
2362
|
+
* Zod schema for validating bridge chain identifiers.
|
|
2363
|
+
*
|
|
2364
|
+
* This schema validates that the provided chain is supported for CCTPv2 bridging.
|
|
2365
|
+
* It accepts either a BridgeChain enum value, a string matching a BridgeChain value,
|
|
2366
|
+
* or a ChainDefinition for a supported chain.
|
|
2367
|
+
*
|
|
2368
|
+
* Use this schema when validating chain parameters for bridge operations to ensure
|
|
2369
|
+
* only CCTPv2-supported chains are accepted at runtime.
|
|
2370
|
+
*
|
|
2371
|
+
* @example
|
|
2372
|
+
* ```typescript
|
|
2373
|
+
* import { bridgeChainIdentifierSchema } from '@core/chains/validation'
|
|
2374
|
+
* import { BridgeChain, Chains } from '@core/chains'
|
|
2375
|
+
*
|
|
2376
|
+
* // Valid - BridgeChain enum value
|
|
2377
|
+
* bridgeChainIdentifierSchema.parse(BridgeChain.Ethereum)
|
|
2378
|
+
*
|
|
2379
|
+
* // Valid - string literal
|
|
2380
|
+
* bridgeChainIdentifierSchema.parse('Base_Sepolia')
|
|
2381
|
+
*
|
|
2382
|
+
* // Valid - ChainDefinition (validated by CCTP support)
|
|
2383
|
+
* bridgeChainIdentifierSchema.parse(Chains.Solana)
|
|
2384
|
+
*
|
|
2385
|
+
* // Invalid - Algorand is not in BridgeChain (throws ZodError)
|
|
2386
|
+
* bridgeChainIdentifierSchema.parse('Algorand')
|
|
2387
|
+
* ```
|
|
2388
|
+
*
|
|
2389
|
+
* @see {@link BridgeChain} for the enum of supported chains.
|
|
2390
|
+
*/
|
|
2391
|
+
z.union([
|
|
2392
|
+
z.string().refine((val) => val in BridgeChain, (val) => ({
|
|
2393
|
+
message: `Chain "${val}" is not supported for bridging. Only chains in the BridgeChain enum support CCTPv2 bridging.`,
|
|
2394
|
+
})),
|
|
2395
|
+
chainDefinitionSchema.refine((chainDef) => chainDef.chain in BridgeChain, (chainDef) => ({
|
|
2396
|
+
message: `Chain "${chainDef.name}" (${chainDef.chain}) is not supported for bridging. Only chains in the BridgeChain enum support CCTPv2 bridging.`,
|
|
2397
|
+
})),
|
|
2398
|
+
]);
|
|
2266
2399
|
|
|
2267
|
-
export { Arbitrum, ArbitrumSepolia, ArcTestnet, Avalanche, AvalancheFuji, Base, BaseSepolia, Codex, CodexTestnet, Ethereum, EthereumSepolia, HyperEVM, HyperEVMTestnet, Ink, InkTestnet, Linea, LineaSepolia, Optimism, OptimismSepolia, Plume, PlumeTestnet, Polygon, PolygonAmoy, Sei, SeiTestnet, Solana, SolanaDevnet, Sonic, SonicTestnet, Unichain, UnichainSepolia, WorldChain, WorldChainSepolia, XDC, XDCApothem };
|
|
2400
|
+
export { Arbitrum, ArbitrumSepolia, ArcTestnet, Avalanche, AvalancheFuji, Base, BaseSepolia, BridgeChain, Codex, CodexTestnet, Ethereum, EthereumSepolia, HyperEVM, HyperEVMTestnet, Ink, InkTestnet, Linea, LineaSepolia, Optimism, OptimismSepolia, Plume, PlumeTestnet, Polygon, PolygonAmoy, Sei, SeiTestnet, Solana, SolanaDevnet, Sonic, SonicTestnet, Unichain, UnichainSepolia, WorldChain, WorldChainSepolia, XDC, XDCApothem };
|
|
2268
2401
|
//# sourceMappingURL=chains.mjs.map
|