@veridex/sdk 1.1.5 → 1.1.7
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/dist/{EVMClient-Bmy9czkE.d.mts → EVMClient-DqDiFak8.d.mts} +1 -1
- package/dist/auth/prepareAuth.d.mts +5 -4
- package/dist/auth/prepareAuth.js +143 -1422
- package/dist/auth/prepareAuth.js.map +1 -1
- package/dist/auth/prepareAuth.mjs +17 -96
- package/dist/auth/prepareAuth.mjs.map +1 -1
- package/dist/chains/aptos/index.d.mts +1 -1
- package/dist/chains/aptos/index.js +11 -33
- package/dist/chains/aptos/index.js.map +1 -1
- package/dist/chains/aptos/index.mjs +2 -2
- package/dist/chains/avalanche/index.d.mts +2 -2
- package/dist/chains/avalanche/index.js +19 -115
- package/dist/chains/avalanche/index.js.map +1 -1
- package/dist/chains/avalanche/index.mjs +3 -3
- package/dist/chains/evm/index.d.mts +5 -4
- package/dist/chains/evm/index.js +19 -115
- package/dist/chains/evm/index.js.map +1 -1
- package/dist/chains/evm/index.mjs +2 -2
- package/dist/chains/solana/index.d.mts +1 -1
- package/dist/chains/solana/index.js +11 -33
- package/dist/chains/solana/index.js.map +1 -1
- package/dist/chains/solana/index.mjs +2 -2
- package/dist/chains/stacks/index.d.mts +1 -1
- package/dist/chains/stacks/index.js +11 -38
- package/dist/chains/stacks/index.js.map +1 -1
- package/dist/chains/stacks/index.mjs +2 -2
- package/dist/chains/starknet/index.d.mts +36 -2
- package/dist/chains/starknet/index.js +208 -37
- package/dist/chains/starknet/index.js.map +1 -1
- package/dist/chains/starknet/index.mjs +9 -4
- package/dist/chains/stellar/index.d.mts +2 -1
- package/dist/chains/sui/index.d.mts +1 -1
- package/dist/chains/sui/index.js +11 -27
- package/dist/chains/sui/index.js.map +1 -1
- package/dist/chains/sui/index.mjs +2 -2
- package/dist/{chunk-ZNIVNPGF.mjs → chunk-3PCAVZUZ.mjs} +173 -37
- package/dist/chunk-3PCAVZUZ.mjs.map +1 -0
- package/dist/{chunk-DQOW3G7M.mjs → chunk-6BINP4RT.mjs} +48 -9
- package/dist/{chunk-DQOW3G7M.mjs.map → chunk-6BINP4RT.mjs.map} +1 -1
- package/dist/{chunk-7KN6Y4GX.mjs → chunk-AK5HWYX4.mjs} +12 -40
- package/dist/chunk-AK5HWYX4.mjs.map +1 -0
- package/dist/{chunk-QVTADARB.mjs → chunk-FPSCAGYS.mjs} +12 -35
- package/dist/chunk-FPSCAGYS.mjs.map +1 -0
- package/dist/{chunk-USVZH4QC.mjs → chunk-H3WRT6Y4.mjs} +20 -117
- package/dist/chunk-H3WRT6Y4.mjs.map +1 -0
- package/dist/{chunk-GXJUY2SC.mjs → chunk-MNH22BM2.mjs} +12 -35
- package/dist/chunk-MNH22BM2.mjs.map +1 -0
- package/dist/chunk-N42LPFPJ.mjs +177 -0
- package/dist/chunk-N42LPFPJ.mjs.map +1 -0
- package/dist/{chunk-D57UJ4L5.mjs → chunk-NKSRF45N.mjs} +12 -29
- package/dist/chunk-NKSRF45N.mjs.map +1 -0
- package/dist/{chunk-BJH5HJL5.mjs → chunk-SKZLZFE2.mjs} +91 -65
- package/dist/chunk-SKZLZFE2.mjs.map +1 -0
- package/dist/{chunk-NVRAQPSF.mjs → chunk-UF5NWMSQ.mjs} +20 -4
- package/dist/chunk-UF5NWMSQ.mjs.map +1 -0
- package/dist/chunk-WC4X3MAO.mjs +58 -0
- package/dist/chunk-WC4X3MAO.mjs.map +1 -0
- package/dist/{chunk-5FH67KLG.mjs → chunk-XHDOSV2F.mjs} +2 -2
- package/dist/{index-CKKUV4J7.d.mts → index-D1nb2JV9.d.mts} +2 -2
- package/dist/index-qyOqd8tx.d.mts +517 -0
- package/dist/index.d.mts +30 -366
- package/dist/index.js +2412 -2486
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +986 -55
- package/dist/index.mjs.map +1 -1
- package/dist/passkey-fh8bo2w-.d.mts +241 -0
- package/dist/passkey.d.mts +2 -182
- package/dist/passkey.js +86 -7
- package/dist/passkey.js.map +1 -1
- package/dist/passkey.mjs +2 -1
- package/dist/payload.d.mts +22 -28
- package/dist/payload.js +50 -9
- package/dist/payload.js.map +1 -1
- package/dist/payload.mjs +7 -3
- package/dist/platform/index.d.mts +3 -0
- package/dist/platform/index.js +216 -0
- package/dist/platform/index.js.map +1 -0
- package/dist/platform/index.mjs +21 -0
- package/dist/platform/index.mjs.map +1 -0
- package/dist/{portfolio-W2FQ2G3O.mjs → portfolio-MLP2JIFK.mjs} +2 -3
- package/dist/queries/index.mjs +324 -10
- package/dist/queries/index.mjs.map +1 -1
- package/dist/{types-DP2CQT8p.d.mts → types-CdlEbixV.d.mts} +12 -1
- package/dist/types.d.mts +1 -0
- package/dist/types.js.map +1 -1
- package/package.json +7 -1
- package/dist/chunk-72ZA3OYQ.mjs +0 -20
- package/dist/chunk-72ZA3OYQ.mjs.map +0 -1
- package/dist/chunk-7KN6Y4GX.mjs.map +0 -1
- package/dist/chunk-BJH5HJL5.mjs.map +0 -1
- package/dist/chunk-D57UJ4L5.mjs.map +0 -1
- package/dist/chunk-GXJUY2SC.mjs.map +0 -1
- package/dist/chunk-NVRAQPSF.mjs.map +0 -1
- package/dist/chunk-QVTADARB.mjs.map +0 -1
- package/dist/chunk-USVZH4QC.mjs.map +0 -1
- package/dist/chunk-XDIIFIW6.mjs +0 -330
- package/dist/chunk-XDIIFIW6.mjs.map +0 -1
- package/dist/chunk-ZNIVNPGF.mjs.map +0 -1
- package/dist/chunk-ZXMTPBSP.mjs +0 -857
- package/dist/chunk-ZXMTPBSP.mjs.map +0 -1
- /package/dist/{chunk-5FH67KLG.mjs.map → chunk-XHDOSV2F.mjs.map} +0 -0
- /package/dist/{portfolio-W2FQ2G3O.mjs.map → portfolio-MLP2JIFK.mjs.map} +0 -0
package/dist/auth/prepareAuth.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
6
|
var __export = (target, all) => {
|
|
9
7
|
for (var name in all)
|
|
@@ -17,14 +15,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
15
|
}
|
|
18
16
|
return to;
|
|
19
17
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
19
|
|
|
30
20
|
// src/auth/prepareAuth.ts
|
|
@@ -33,7 +23,6 @@ __export(prepareAuth_exports, {
|
|
|
33
23
|
authenticateAndPrepare: () => authenticateAndPrepare
|
|
34
24
|
});
|
|
35
25
|
module.exports = __toCommonJS(prepareAuth_exports);
|
|
36
|
-
var import_ethers5 = require("ethers");
|
|
37
26
|
|
|
38
27
|
// src/core/PasskeyManager.ts
|
|
39
28
|
var import_browser = require("@simplewebauthn/browser");
|
|
@@ -46,255 +35,6 @@ var import_ethers = require("ethers");
|
|
|
46
35
|
var ACTION_TRANSFER = 1;
|
|
47
36
|
var ACTION_EXECUTE = 2;
|
|
48
37
|
var ACTION_BRIDGE = 4;
|
|
49
|
-
var TESTNET_CHAINS = {
|
|
50
|
-
baseSepolia: {
|
|
51
|
-
name: "Base Sepolia",
|
|
52
|
-
chainId: 84532,
|
|
53
|
-
wormholeChainId: 10004,
|
|
54
|
-
rpcUrl: "https://sepolia.base.org",
|
|
55
|
-
explorerUrl: "https://sepolia.basescan.org",
|
|
56
|
-
isEvm: true,
|
|
57
|
-
contracts: {
|
|
58
|
-
hub: "0xD5D29b6EaeE6FF4b765e704298a7e48D22607059",
|
|
59
|
-
vaultFactory: "0xb25b73D5FeD5693dcd1Bb78f8e33387B59A022EC",
|
|
60
|
-
vaultImplementation: "0x2CB8397df988c1880d9e5cFfF65bfC22D7D90EE6",
|
|
61
|
-
wormholeCoreBridge: "0x79A1027a6A159502049F10906D333EC57E95F083",
|
|
62
|
-
tokenBridge: "0x86F55A04690fd7815A3D802bD587e83eA888B239"
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
ethereumSepolia: {
|
|
66
|
-
name: "Ethereum Sepolia",
|
|
67
|
-
chainId: 11155111,
|
|
68
|
-
wormholeChainId: 10002,
|
|
69
|
-
rpcUrl: "https://ethereum-sepolia-rpc.publicnode.com",
|
|
70
|
-
explorerUrl: "https://sepolia.etherscan.io",
|
|
71
|
-
isEvm: true,
|
|
72
|
-
contracts: {
|
|
73
|
-
vaultFactory: "0x265c10763B4d16AD970bC3d7670c645e37f63AF4",
|
|
74
|
-
vaultImplementation: "0x942426C94652ebC48f4f404928016B95ADb1DA25",
|
|
75
|
-
wormholeCoreBridge: "0x4a8bc80Ed5a4067f1CCf107057b8270E0cC11A78",
|
|
76
|
-
tokenBridge: "0xDB5492265f6038831E89f495670FF909aDe94bd9"
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
|
-
optimismSepolia: {
|
|
80
|
-
name: "Optimism Sepolia",
|
|
81
|
-
chainId: 11155420,
|
|
82
|
-
wormholeChainId: 10005,
|
|
83
|
-
rpcUrl: "https://sepolia.optimism.io",
|
|
84
|
-
explorerUrl: "https://sepolia-optimism.etherscan.io",
|
|
85
|
-
isEvm: true,
|
|
86
|
-
contracts: {
|
|
87
|
-
vaultFactory: "0x3c5e4aCdC8Cd53ae5ae603B4c511885191fBb868",
|
|
88
|
-
vaultImplementation: "0xA45dBF322c5A3028687fEEB161603d3BCe02e119",
|
|
89
|
-
wormholeCoreBridge: "0x31377888146f3253211EFEf5c676D41ECe7D58Fe",
|
|
90
|
-
tokenBridge: "0x99737Ec4B815d816c49A385943baf0380e75c0Ac"
|
|
91
|
-
}
|
|
92
|
-
},
|
|
93
|
-
arbitrumSepolia: {
|
|
94
|
-
name: "Arbitrum Sepolia",
|
|
95
|
-
chainId: 421614,
|
|
96
|
-
wormholeChainId: 10003,
|
|
97
|
-
rpcUrl: "https://sepolia-rollup.arbitrum.io/rpc",
|
|
98
|
-
explorerUrl: "https://sepolia.arbiscan.io",
|
|
99
|
-
isEvm: true,
|
|
100
|
-
contracts: {
|
|
101
|
-
vaultFactory: "0xB9C3e6bad3c6f26956be4a4bb5a366376Fd3045D",
|
|
102
|
-
vaultImplementation: "0x8601881b94B68B09b485f407317686103d3CB681",
|
|
103
|
-
wormholeCoreBridge: "0x6b9C8671cdDC8dEab9c719bB87cBd3e782bA6a35",
|
|
104
|
-
tokenBridge: "0xC7A204bDBFe983FCD8d8E61D02b475D4073fF97e"
|
|
105
|
-
}
|
|
106
|
-
},
|
|
107
|
-
monadTestnet: {
|
|
108
|
-
name: "Monad Testnet",
|
|
109
|
-
chainId: 10143,
|
|
110
|
-
wormholeChainId: 10048,
|
|
111
|
-
rpcUrl: "https://testnet-rpc.monad.xyz",
|
|
112
|
-
explorerUrl: "https://testnet.monadexplorer.com",
|
|
113
|
-
isEvm: true,
|
|
114
|
-
contracts: {
|
|
115
|
-
vaultFactory: "0xbE9B9c39956448DA75Ac97E5e3dE17e34171660A",
|
|
116
|
-
vaultImplementation: "0x500853DCc54Fd1A707ec9d443032Bb7748f426d3",
|
|
117
|
-
wormholeCoreBridge: "0xBB73cB66C26740F31d1FabDC6b7A46a038A300dd",
|
|
118
|
-
tokenBridge: "0x0000000000000000000000000000000000000000"
|
|
119
|
-
}
|
|
120
|
-
},
|
|
121
|
-
avalancheFuji: {
|
|
122
|
-
name: "Avalanche Fuji",
|
|
123
|
-
chainId: 43113,
|
|
124
|
-
wormholeChainId: 6,
|
|
125
|
-
rpcUrl: "https://api.avax-test.network/ext/bc/C/rpc",
|
|
126
|
-
explorerUrl: "https://testnet.snowtrace.io",
|
|
127
|
-
isEvm: true,
|
|
128
|
-
contracts: {
|
|
129
|
-
vaultFactory: "0x9e9716442e908A9b61F11432cC38024DD390cd2a",
|
|
130
|
-
vaultImplementation: "0xE0b9919ffDf3415355Db369C8FfA5Dd4e000052c",
|
|
131
|
-
wormholeCoreBridge: "0x7bbcE28e64B3F8b84d876Ab298393c38ad7aac4C",
|
|
132
|
-
tokenBridge: "0x61E44E506Ca5659E6c0bba9b678586fA2d729756"
|
|
133
|
-
}
|
|
134
|
-
},
|
|
135
|
-
polygonAmoy: {
|
|
136
|
-
name: "Polygon Amoy",
|
|
137
|
-
chainId: 80002,
|
|
138
|
-
wormholeChainId: 10007,
|
|
139
|
-
rpcUrl: "https://rpc-amoy.polygon.technology",
|
|
140
|
-
explorerUrl: "https://amoy.polygonscan.com",
|
|
141
|
-
isEvm: true,
|
|
142
|
-
contracts: {
|
|
143
|
-
vaultFactory: "0x07F608AFf6d63b68029488b726d895c4Bb593038",
|
|
144
|
-
vaultImplementation: "0xD66153fccFB6731fB6c4944FbD607ba86A76a1f6",
|
|
145
|
-
wormholeCoreBridge: "0x6b9C8671cdDC8dEab9c719bB87cBd3e782bA6a35",
|
|
146
|
-
tokenBridge: "0xC7A204bDBFe983FCD8d8E61D02b475D4073fF97e"
|
|
147
|
-
}
|
|
148
|
-
},
|
|
149
|
-
solanaDevnet: {
|
|
150
|
-
name: "Solana Devnet",
|
|
151
|
-
chainId: 0,
|
|
152
|
-
wormholeChainId: 1,
|
|
153
|
-
rpcUrl: "https://api.devnet.solana.com",
|
|
154
|
-
explorerUrl: "https://explorer.solana.com",
|
|
155
|
-
isEvm: false,
|
|
156
|
-
contracts: {
|
|
157
|
-
hub: "64ZZBdmGd1YT6Fok7PELvAdfoXyR4PHxHnRqHNqZHJ13",
|
|
158
|
-
wormholeCoreBridge: "3u8hJUVTA4jH1wYAyUur7FFZVQ8H635K3tSHHF4ssjQ5",
|
|
159
|
-
tokenBridge: "DZnkkTmCiFWfYTfT41X3Rd1kDgozqzxWaHqsw6W4x2oe"
|
|
160
|
-
}
|
|
161
|
-
},
|
|
162
|
-
aptosTestnet: {
|
|
163
|
-
name: "Aptos Testnet",
|
|
164
|
-
chainId: 0,
|
|
165
|
-
wormholeChainId: 22,
|
|
166
|
-
rpcUrl: "https://fullnode.testnet.aptoslabs.com/v1",
|
|
167
|
-
explorerUrl: "https://explorer.aptoslabs.com",
|
|
168
|
-
isEvm: false,
|
|
169
|
-
contracts: {
|
|
170
|
-
hub: "0x9e8641143245ab8b93af1417a1fbc698d40fd351a25f6c17e4210e59bf82c9c7",
|
|
171
|
-
wormholeCoreBridge: "0x5bc11445584a763c1fa7ed39081f1b920954da14e04b32440cba863d03e19625",
|
|
172
|
-
tokenBridge: "0x576410486a2da45eee6c949c995670112ddf2fbeedab20350d506328eefc9d4f"
|
|
173
|
-
}
|
|
174
|
-
},
|
|
175
|
-
suiTestnet: {
|
|
176
|
-
name: "Sui Testnet",
|
|
177
|
-
chainId: 0,
|
|
178
|
-
wormholeChainId: 21,
|
|
179
|
-
rpcUrl: "https://fullnode.testnet.sui.io:443",
|
|
180
|
-
explorerUrl: "https://suiscan.xyz/testnet",
|
|
181
|
-
isEvm: false,
|
|
182
|
-
contracts: {
|
|
183
|
-
hub: "0xaf36d8bc349883b23e78b00a342a656c799319508600583eaee9121ffaa7f5f7",
|
|
184
|
-
wormholeCoreBridge: "0x31358d198147da50db32eda2562951d53973a0c0ad5ed738e9b17d88b213d790"
|
|
185
|
-
}
|
|
186
|
-
},
|
|
187
|
-
starknetSepolia: {
|
|
188
|
-
name: "Starknet Sepolia",
|
|
189
|
-
chainId: 0,
|
|
190
|
-
wormholeChainId: 50001,
|
|
191
|
-
rpcUrl: "https://starknet-sepolia-rpc.publicnode.com",
|
|
192
|
-
explorerUrl: "https://sepolia.starkscan.co",
|
|
193
|
-
isEvm: false,
|
|
194
|
-
contracts: {
|
|
195
|
-
hub: "0x7bb7cbe7d82e910b296611b582035a207343431f98bdd7b692bddfdd6f28737",
|
|
196
|
-
wormholeCoreBridge: "0x30d2e7f26dc75819cfddcd7caa26a76b681d5918f219c99060c42ce1e3f69e4"
|
|
197
|
-
},
|
|
198
|
-
hubChainId: 10004
|
|
199
|
-
}
|
|
200
|
-
};
|
|
201
|
-
var MAINNET_CHAINS = {
|
|
202
|
-
ethereum: {
|
|
203
|
-
name: "Ethereum",
|
|
204
|
-
chainId: 1,
|
|
205
|
-
wormholeChainId: 2,
|
|
206
|
-
rpcUrl: "https://eth.llamarpc.com",
|
|
207
|
-
explorerUrl: "https://etherscan.io",
|
|
208
|
-
isEvm: true,
|
|
209
|
-
contracts: {
|
|
210
|
-
wormholeCoreBridge: "0x98f3c9e6E3fAce36bAAd05FE09d375Ef1464288B",
|
|
211
|
-
tokenBridge: "0x3ee18B2214AFF97000D974cf647E7C347E8fa585"
|
|
212
|
-
}
|
|
213
|
-
},
|
|
214
|
-
base: {
|
|
215
|
-
name: "Base",
|
|
216
|
-
chainId: 8453,
|
|
217
|
-
wormholeChainId: 30,
|
|
218
|
-
rpcUrl: "https://mainnet.base.org",
|
|
219
|
-
explorerUrl: "https://basescan.org",
|
|
220
|
-
isEvm: true,
|
|
221
|
-
contracts: {
|
|
222
|
-
wormholeCoreBridge: "0xbebdb6C8ddC678FfA9f8748f85C815C556Dd8ac6",
|
|
223
|
-
tokenBridge: "0x8d2de8d2f73F1F4cAB472AC9A881C9b123C79627"
|
|
224
|
-
}
|
|
225
|
-
},
|
|
226
|
-
optimism: {
|
|
227
|
-
name: "Optimism",
|
|
228
|
-
chainId: 10,
|
|
229
|
-
wormholeChainId: 24,
|
|
230
|
-
rpcUrl: "https://mainnet.optimism.io",
|
|
231
|
-
explorerUrl: "https://optimistic.etherscan.io",
|
|
232
|
-
isEvm: true,
|
|
233
|
-
contracts: {
|
|
234
|
-
wormholeCoreBridge: "0xEe91C335eab126dF5fDB3797EA9d6aD93aeC9722",
|
|
235
|
-
tokenBridge: "0x1D68124e65faFC907325e3EDbF8c4d84499DAa8b"
|
|
236
|
-
}
|
|
237
|
-
},
|
|
238
|
-
arbitrum: {
|
|
239
|
-
name: "Arbitrum",
|
|
240
|
-
chainId: 42161,
|
|
241
|
-
wormholeChainId: 23,
|
|
242
|
-
rpcUrl: "https://arb1.arbitrum.io/rpc",
|
|
243
|
-
explorerUrl: "https://arbiscan.io",
|
|
244
|
-
isEvm: true,
|
|
245
|
-
contracts: {
|
|
246
|
-
wormholeCoreBridge: "0xa5f208e072434bC67592E4C49C1B991BA79BCA46",
|
|
247
|
-
tokenBridge: "0x0b2402144Bb366A632D14B83F244D2e0e21bD39c"
|
|
248
|
-
}
|
|
249
|
-
},
|
|
250
|
-
polygon: {
|
|
251
|
-
name: "Polygon",
|
|
252
|
-
chainId: 137,
|
|
253
|
-
wormholeChainId: 5,
|
|
254
|
-
rpcUrl: "https://polygon-rpc.com",
|
|
255
|
-
explorerUrl: "https://polygonscan.com",
|
|
256
|
-
isEvm: true,
|
|
257
|
-
contracts: {
|
|
258
|
-
wormholeCoreBridge: "0x7A4B5a56256163F07b2C80A7cA55aBE66c4ec4d7",
|
|
259
|
-
tokenBridge: "0x5a58505a96D1dbf8dF91cB21B54419FC36e93fdE"
|
|
260
|
-
}
|
|
261
|
-
},
|
|
262
|
-
solana: {
|
|
263
|
-
name: "Solana",
|
|
264
|
-
chainId: 0,
|
|
265
|
-
wormholeChainId: 1,
|
|
266
|
-
rpcUrl: "https://api.mainnet-beta.solana.com",
|
|
267
|
-
explorerUrl: "https://explorer.solana.com",
|
|
268
|
-
isEvm: false,
|
|
269
|
-
contracts: {
|
|
270
|
-
wormholeCoreBridge: "worm2ZoG2kUd4vFXhvjh93UUH596ayRfgQ2MgjNMTth",
|
|
271
|
-
tokenBridge: "wormDTUJ6AWPNvk59vGQbDvGJmqbDTdgWgAqcLBCgUb"
|
|
272
|
-
}
|
|
273
|
-
},
|
|
274
|
-
aptos: {
|
|
275
|
-
name: "Aptos",
|
|
276
|
-
chainId: 0,
|
|
277
|
-
wormholeChainId: 22,
|
|
278
|
-
rpcUrl: "https://fullnode.mainnet.aptoslabs.com/v1",
|
|
279
|
-
explorerUrl: "https://explorer.aptoslabs.com",
|
|
280
|
-
isEvm: false,
|
|
281
|
-
contracts: {
|
|
282
|
-
wormholeCoreBridge: "0x5bc11445584a763c1fa7ed39081f1b920954da14e04b32440cba863d03e19625",
|
|
283
|
-
tokenBridge: "0x576410486a2da45eee6c949c995670112ddf2fbeedab20350d506328eefc9d4f"
|
|
284
|
-
}
|
|
285
|
-
},
|
|
286
|
-
sui: {
|
|
287
|
-
name: "Sui",
|
|
288
|
-
chainId: 0,
|
|
289
|
-
wormholeChainId: 21,
|
|
290
|
-
rpcUrl: "https://fullnode.mainnet.sui.io:443",
|
|
291
|
-
explorerUrl: "https://suiscan.xyz/mainnet",
|
|
292
|
-
isEvm: false,
|
|
293
|
-
contracts: {
|
|
294
|
-
wormholeCoreBridge: "0xaeab97f96cf9877fee2883315d459552b2b921edc16d7ceac6eab944dd88919c"
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
};
|
|
298
38
|
|
|
299
39
|
// src/utils.ts
|
|
300
40
|
function base64URLEncode(buffer) {
|
|
@@ -499,7 +239,8 @@ var PasskeyManager = class _PasskeyManager {
|
|
|
499
239
|
credentialId: response.id,
|
|
500
240
|
publicKeyX: publicKey.x,
|
|
501
241
|
publicKeyY: publicKey.y,
|
|
502
|
-
keyHash
|
|
242
|
+
keyHash,
|
|
243
|
+
assurance: _PasskeyManager.assuranceFromRegistration(response) ?? void 0
|
|
503
244
|
};
|
|
504
245
|
return this.credential;
|
|
505
246
|
}
|
|
@@ -878,7 +619,8 @@ var PasskeyManager = class _PasskeyManager {
|
|
|
878
619
|
credentialId: response.id,
|
|
879
620
|
publicKeyX: publicKey.x,
|
|
880
621
|
publicKeyY: publicKey.y,
|
|
881
|
-
keyHash
|
|
622
|
+
keyHash,
|
|
623
|
+
assurance: _PasskeyManager.assuranceFromRegistration(response) ?? void 0
|
|
882
624
|
};
|
|
883
625
|
this.addCredentialToStorage(backupCredential);
|
|
884
626
|
return backupCredential;
|
|
@@ -895,17 +637,94 @@ var PasskeyManager = class _PasskeyManager {
|
|
|
895
637
|
*/
|
|
896
638
|
static parseBackupFlags(authenticatorData) {
|
|
897
639
|
try {
|
|
898
|
-
const
|
|
899
|
-
if (
|
|
900
|
-
const flags = data[32];
|
|
640
|
+
const assurance = _PasskeyManager.deriveAssurance(import_ethers2.ethers.getBytes(authenticatorData));
|
|
641
|
+
if (!assurance) return null;
|
|
901
642
|
return {
|
|
902
|
-
backupEligible:
|
|
903
|
-
backupState:
|
|
643
|
+
backupEligible: assurance.backupEligible,
|
|
644
|
+
backupState: assurance.backupState
|
|
904
645
|
};
|
|
905
646
|
} catch {
|
|
906
647
|
return null;
|
|
907
648
|
}
|
|
908
649
|
}
|
|
650
|
+
/**
|
|
651
|
+
* Derive credential assurance from raw WebAuthn authenticator data.
|
|
652
|
+
*
|
|
653
|
+
* authData layout:
|
|
654
|
+
* rpIdHash (32) | flags (1) | signCount (4) | [attestedCredentialData: aaguid (16) | ...]
|
|
655
|
+
*
|
|
656
|
+
* Flags byte: UP 0x01 | UV 0x04 | BE 0x08 | BS 0x10 | AT 0x40 | ED 0x80
|
|
657
|
+
*
|
|
658
|
+
* BE is the authoritative signal for whether a credential is device-bound or
|
|
659
|
+
* syncable. It is set by the authenticator itself — unlike a platform/user-agent
|
|
660
|
+
* guess, it correctly identifies a hardware key used on a syncing platform.
|
|
661
|
+
*
|
|
662
|
+
* @returns Assurance, or `null` if authData is too short to be valid.
|
|
663
|
+
*/
|
|
664
|
+
static deriveAssurance(authData) {
|
|
665
|
+
if (authData.length < 37) return null;
|
|
666
|
+
const flags = authData[32];
|
|
667
|
+
const backupEligible = (flags & 8) !== 0;
|
|
668
|
+
const attestedCredentialData = (flags & 64) !== 0;
|
|
669
|
+
let aaguid;
|
|
670
|
+
if (attestedCredentialData && authData.length >= 53) {
|
|
671
|
+
aaguid = import_ethers2.ethers.hexlify(authData.slice(37, 53));
|
|
672
|
+
}
|
|
673
|
+
return {
|
|
674
|
+
backupEligible,
|
|
675
|
+
backupState: (flags & 16) !== 0,
|
|
676
|
+
userVerified: (flags & 4) !== 0,
|
|
677
|
+
level: backupEligible ? "synced" : "device-bound",
|
|
678
|
+
aaguid
|
|
679
|
+
};
|
|
680
|
+
}
|
|
681
|
+
/**
|
|
682
|
+
* Extract raw authenticator data from a registration response.
|
|
683
|
+
*
|
|
684
|
+
* Prefers the `authenticatorData` field when the authenticator provides it,
|
|
685
|
+
* and otherwise locates the `authData` byte string inside the CBOR
|
|
686
|
+
* attestation object.
|
|
687
|
+
*/
|
|
688
|
+
static extractAuthData(response) {
|
|
689
|
+
const direct = response.response.authenticatorData;
|
|
690
|
+
if (direct) {
|
|
691
|
+
try {
|
|
692
|
+
return base64URLDecode(direct);
|
|
693
|
+
} catch {
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
try {
|
|
697
|
+
const attestationObject = base64URLDecode(response.response.attestationObject);
|
|
698
|
+
let offset = 0;
|
|
699
|
+
if (attestationObject[offset] >= 160 && attestationObject[offset] <= 191) {
|
|
700
|
+
offset++;
|
|
701
|
+
}
|
|
702
|
+
const key = [104, 97, 117, 116, 104, 68, 97, 116, 97];
|
|
703
|
+
let found = false;
|
|
704
|
+
while (offset < attestationObject.length - 37) {
|
|
705
|
+
if (key.every((byte, i) => attestationObject[offset + i] === byte)) {
|
|
706
|
+
offset += key.length;
|
|
707
|
+
found = true;
|
|
708
|
+
break;
|
|
709
|
+
}
|
|
710
|
+
offset++;
|
|
711
|
+
}
|
|
712
|
+
if (!found) return null;
|
|
713
|
+
if (attestationObject[offset] === 88) {
|
|
714
|
+
offset += 2;
|
|
715
|
+
} else if (attestationObject[offset] === 89) {
|
|
716
|
+
offset += 3;
|
|
717
|
+
}
|
|
718
|
+
return attestationObject.slice(offset);
|
|
719
|
+
} catch {
|
|
720
|
+
return null;
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
/** Derive assurance directly from a registration response. */
|
|
724
|
+
static assuranceFromRegistration(response) {
|
|
725
|
+
const authData = _PasskeyManager.extractAuthData(response);
|
|
726
|
+
return authData ? _PasskeyManager.deriveAssurance(authData) : null;
|
|
727
|
+
}
|
|
909
728
|
/**
|
|
910
729
|
* Get the number of credentials stored locally.
|
|
911
730
|
*/
|
|
@@ -1273,1105 +1092,55 @@ function padTo32Bytes(address) {
|
|
|
1273
1092
|
}
|
|
1274
1093
|
return "0x" + hex.padStart(64, "0");
|
|
1275
1094
|
}
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1095
|
+
var HUB_NONCE_DOMAIN = 0;
|
|
1096
|
+
var TIER_T2_AUTHORITATIVE = 3;
|
|
1097
|
+
var CHALLENGE_DOMAIN = import_ethers3.ethers.sha256(import_ethers3.ethers.toUtf8Bytes("veridex.challenge.v1"));
|
|
1098
|
+
function buildCanonicalChallenge(input) {
|
|
1099
|
+
if (!Number.isInteger(input.veridexChainId) || input.veridexChainId <= 0 || input.veridexChainId > 4294967295) {
|
|
1100
|
+
throw new Error("veridexChainId must be an integer between 1 and 4294967295");
|
|
1101
|
+
}
|
|
1102
|
+
if (!Number.isInteger(input.minTier) || input.minTier < 0 || input.minTier > TIER_T2_AUTHORITATIVE) {
|
|
1103
|
+
throw new Error("minTier must be an integer between 0 and 3");
|
|
1104
|
+
}
|
|
1105
|
+
if (input.nonce < 0n || input.nonce > 0xffffffffffffffffn) {
|
|
1106
|
+
throw new Error("nonce must fit in uint64");
|
|
1107
|
+
}
|
|
1108
|
+
const executor = import_ethers3.ethers.hexlify(import_ethers3.ethers.zeroPadValue(input.executor, 32));
|
|
1109
|
+
if (executor === import_ethers3.ethers.ZeroHash) {
|
|
1110
|
+
throw new Error("executor must not be zero");
|
|
1111
|
+
}
|
|
1112
|
+
const preimage = import_ethers3.ethers.solidityPacked(
|
|
1113
|
+
["bytes32", "uint8", "uint8", "uint32", "bytes32", "uint32", "uint64", "bytes32"],
|
|
1114
|
+
[
|
|
1115
|
+
CHALLENGE_DOMAIN,
|
|
1116
|
+
1,
|
|
1117
|
+
input.minTier,
|
|
1118
|
+
input.veridexChainId,
|
|
1119
|
+
executor,
|
|
1120
|
+
HUB_NONCE_DOMAIN,
|
|
1121
|
+
input.nonce,
|
|
1122
|
+
input.actionHash
|
|
1123
|
+
]
|
|
1280
1124
|
);
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
const packed = createGaslessMessageHash(targetChain, actionPayload, nonce, hubChainId);
|
|
1284
|
-
return import_ethers3.ethers.getBytes(packed);
|
|
1285
|
-
}
|
|
1286
|
-
|
|
1287
|
-
// src/queries/hubState.ts
|
|
1288
|
-
var import_axios = __toESM(require("axios"));
|
|
1289
|
-
var import_buffer = require("buffer");
|
|
1290
|
-
var import_ethers4 = require("ethers");
|
|
1291
|
-
var import_wormhole_query_sdk = require("@wormhole-foundation/wormhole-query-sdk");
|
|
1292
|
-
|
|
1293
|
-
// src/queries/constants.ts
|
|
1294
|
-
var WORMHOLE_QUERY_PROXY_URLS = {
|
|
1295
|
-
mainnet: "https://query.wormhole.com/v1/query",
|
|
1296
|
-
testnet: "https://testnet.query.wormhole.com/v1/query"
|
|
1297
|
-
};
|
|
1298
|
-
|
|
1299
|
-
// src/queries/hubState.ts
|
|
1300
|
-
var QueryHubStateError = class extends Error {
|
|
1301
|
-
code;
|
|
1302
|
-
cause;
|
|
1303
|
-
constructor(code, message, cause) {
|
|
1304
|
-
super(message);
|
|
1305
|
-
this.name = "QueryHubStateError";
|
|
1306
|
-
this.code = code;
|
|
1307
|
-
this.cause = cause;
|
|
1308
|
-
}
|
|
1309
|
-
};
|
|
1310
|
-
function resolveNetwork(options) {
|
|
1311
|
-
if (options?.network) return options.network;
|
|
1312
|
-
const envCandidates = [
|
|
1313
|
-
globalThis?.process?.env?.NEXT_PUBLIC_VERIDEX_NETWORK,
|
|
1314
|
-
globalThis?.process?.env?.VERIDEX_NETWORK,
|
|
1315
|
-
globalThis?.process?.env?.NEXT_PUBLIC_WORMHOLE_NETWORK,
|
|
1316
|
-
globalThis?.process?.env?.WORMHOLE_NETWORK
|
|
1317
|
-
].filter(Boolean);
|
|
1318
|
-
const env = envCandidates[0]?.toLowerCase();
|
|
1319
|
-
if (env === "mainnet" || env === "testnet") return env;
|
|
1320
|
-
return "testnet";
|
|
1321
|
-
}
|
|
1322
|
-
function concatBytes(parts) {
|
|
1323
|
-
const total = parts.reduce((sum, p) => sum + p.length, 0);
|
|
1324
|
-
const out = new Uint8Array(total);
|
|
1325
|
-
let offset = 0;
|
|
1326
|
-
for (const p of parts) {
|
|
1327
|
-
out.set(p, offset);
|
|
1328
|
-
offset += p.length;
|
|
1329
|
-
}
|
|
1330
|
-
return out;
|
|
1331
|
-
}
|
|
1332
|
-
function signaturesToProofBytes(signatures) {
|
|
1333
|
-
const chunks = [];
|
|
1334
|
-
for (const sig of signatures) {
|
|
1335
|
-
if (typeof sig !== "string" || sig.length !== 132 || !/^[0-9a-fA-F]+$/.test(sig)) {
|
|
1336
|
-
throw new QueryHubStateError(
|
|
1337
|
-
"PROXY_RESPONSE_INVALID",
|
|
1338
|
-
`Invalid guardian signature format (expected 132 hex chars): ${String(sig)}`
|
|
1339
|
-
);
|
|
1340
|
-
}
|
|
1341
|
-
chunks.push((0, import_wormhole_query_sdk.hexToUint8Array)(`0x${sig}`));
|
|
1342
|
-
}
|
|
1343
|
-
return concatBytes(chunks);
|
|
1344
|
-
}
|
|
1345
|
-
function decodeQueryBytes(bytes) {
|
|
1346
|
-
if (typeof bytes !== "string" || bytes.length === 0) {
|
|
1347
|
-
throw new QueryHubStateError("PROXY_RESPONSE_INVALID", "Missing query response bytes");
|
|
1348
|
-
}
|
|
1349
|
-
if ((0, import_wormhole_query_sdk.isValidHexString)(bytes)) {
|
|
1350
|
-
return (0, import_wormhole_query_sdk.hexToUint8Array)(bytes);
|
|
1351
|
-
}
|
|
1352
|
-
try {
|
|
1353
|
-
if (typeof atob === "function") {
|
|
1354
|
-
const raw = atob(bytes);
|
|
1355
|
-
const arr = new Uint8Array(raw.length);
|
|
1356
|
-
for (let i = 0; i < raw.length; i++) arr[i] = raw.charCodeAt(i);
|
|
1357
|
-
return arr;
|
|
1358
|
-
}
|
|
1359
|
-
} catch {
|
|
1360
|
-
}
|
|
1361
|
-
try {
|
|
1362
|
-
return new Uint8Array(import_buffer.Buffer.from(bytes, "base64"));
|
|
1363
|
-
} catch (cause) {
|
|
1364
|
-
throw new QueryHubStateError("PROXY_RESPONSE_INVALID", "Unrecognized query response bytes encoding", cause);
|
|
1365
|
-
}
|
|
1366
|
-
}
|
|
1367
|
-
function sleep(ms) {
|
|
1368
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
1369
|
-
}
|
|
1370
|
-
async function withExponentialBackoff(fn, maxAttempts) {
|
|
1371
|
-
let attempt = 0;
|
|
1372
|
-
let lastError;
|
|
1373
|
-
while (attempt < maxAttempts) {
|
|
1374
|
-
try {
|
|
1375
|
-
return await fn();
|
|
1376
|
-
} catch (err) {
|
|
1377
|
-
lastError = err;
|
|
1378
|
-
attempt += 1;
|
|
1379
|
-
if (attempt >= maxAttempts) break;
|
|
1380
|
-
const baseMs = 250;
|
|
1381
|
-
const backoffMs = Math.min(5e3, baseMs * 2 ** (attempt - 1));
|
|
1382
|
-
const jitterMs = Math.floor(Math.random() * 100);
|
|
1383
|
-
await sleep(backoffMs + jitterMs);
|
|
1384
|
-
}
|
|
1385
|
-
}
|
|
1386
|
-
throw lastError;
|
|
1387
|
-
}
|
|
1388
|
-
function getHubConfig(network) {
|
|
1389
|
-
if (network === "testnet") {
|
|
1390
|
-
const baseSepolia = TESTNET_CHAINS.baseSepolia;
|
|
1391
|
-
if (!baseSepolia?.contracts?.hub) {
|
|
1392
|
-
throw new QueryHubStateError("MISSING_HUB_ADDRESS", "Missing Base Sepolia hub address in SDK constants");
|
|
1393
|
-
}
|
|
1394
|
-
return {
|
|
1395
|
-
wormholeChainId: baseSepolia.wormholeChainId,
|
|
1396
|
-
hubAddress: baseSepolia.contracts.hub,
|
|
1397
|
-
endpoint: WORMHOLE_QUERY_PROXY_URLS.testnet,
|
|
1398
|
-
rpcUrl: baseSepolia.rpcUrl
|
|
1399
|
-
};
|
|
1400
|
-
}
|
|
1401
|
-
if (network === "mainnet") {
|
|
1402
|
-
const base = MAINNET_CHAINS.base;
|
|
1403
|
-
const hubAddress = base?.contracts?.hub;
|
|
1404
|
-
if (!hubAddress) {
|
|
1405
|
-
throw new QueryHubStateError(
|
|
1406
|
-
"MISSING_HUB_ADDRESS",
|
|
1407
|
-
"Missing mainnet hub address in SDK constants (MAINNET_CHAINS.base.contracts.hub)"
|
|
1408
|
-
);
|
|
1409
|
-
}
|
|
1410
|
-
return {
|
|
1411
|
-
wormholeChainId: base.wormholeChainId,
|
|
1412
|
-
hubAddress,
|
|
1413
|
-
endpoint: WORMHOLE_QUERY_PROXY_URLS.mainnet,
|
|
1414
|
-
rpcUrl: base.rpcUrl
|
|
1415
|
-
};
|
|
1416
|
-
}
|
|
1417
|
-
throw new QueryHubStateError("UNSUPPORTED_NETWORK", `Unsupported network: ${network}`);
|
|
1418
|
-
}
|
|
1419
|
-
function encodeHubCalls(hubAddress, userKeyHash) {
|
|
1420
|
-
const nonceAbiCandidates = [
|
|
1421
|
-
"function getUserNonce(bytes32 userKeyHash) view returns (uint256)",
|
|
1422
|
-
"function userNonces(bytes32 userKeyHash) view returns (uint256)",
|
|
1423
|
-
"function getNonceByHash(bytes32 userKeyHash) view returns (uint256)"
|
|
1424
|
-
];
|
|
1425
|
-
const registeredAbiCandidates = [
|
|
1426
|
-
"function registeredKeys(bytes32 userKeyHash) view returns (bool)",
|
|
1427
|
-
"function isKeyRegisteredByHash(bytes32 userKeyHash) view returns (bool)"
|
|
1428
|
-
];
|
|
1429
|
-
const actionHashAbiCandidates = [
|
|
1430
|
-
"function getUserLastActionHash(bytes32 userKeyHash) view returns (bytes32)",
|
|
1431
|
-
"function userLastActionHash(bytes32 userKeyHash) view returns (bytes32)"
|
|
1432
|
-
];
|
|
1433
|
-
const iface = new import_ethers4.ethers.Interface([
|
|
1434
|
-
...nonceAbiCandidates,
|
|
1435
|
-
...registeredAbiCandidates,
|
|
1436
|
-
...actionHashAbiCandidates
|
|
1437
|
-
]);
|
|
1438
|
-
const nonceFnNames = ["getUserNonce", "userNonces", "getNonceByHash"];
|
|
1439
|
-
const regFnNames = ["registeredKeys", "isKeyRegisteredByHash"];
|
|
1440
|
-
const actionHashFnNames = ["getUserLastActionHash", "userLastActionHash"];
|
|
1441
|
-
return [
|
|
1442
|
-
...nonceFnNames.map((fn) => ({
|
|
1443
|
-
to: hubAddress,
|
|
1444
|
-
data: iface.encodeFunctionData(fn, [userKeyHash])
|
|
1445
|
-
})),
|
|
1446
|
-
...regFnNames.map((fn) => ({
|
|
1447
|
-
to: hubAddress,
|
|
1448
|
-
data: iface.encodeFunctionData(fn, [userKeyHash])
|
|
1449
|
-
})),
|
|
1450
|
-
...actionHashFnNames.map((fn) => ({
|
|
1451
|
-
to: hubAddress,
|
|
1452
|
-
data: iface.encodeFunctionData(fn, [userKeyHash])
|
|
1453
|
-
}))
|
|
1454
|
-
];
|
|
1455
|
-
}
|
|
1456
|
-
function decodeFirstNonce(results) {
|
|
1457
|
-
const candidates = [
|
|
1458
|
-
"function getUserNonce(bytes32 userKeyHash) view returns (uint256)",
|
|
1459
|
-
"function userNonces(bytes32 userKeyHash) view returns (uint256)",
|
|
1460
|
-
"function getNonceByHash(bytes32 userKeyHash) view returns (uint256)"
|
|
1461
|
-
];
|
|
1462
|
-
const iface = new import_ethers4.ethers.Interface(candidates);
|
|
1463
|
-
const fnNames = ["getUserNonce", "userNonces", "getNonceByHash"];
|
|
1464
|
-
for (let idx = 0; idx < fnNames.length; idx++) {
|
|
1465
|
-
const fnName = fnNames[idx];
|
|
1466
|
-
try {
|
|
1467
|
-
const data = results[idx];
|
|
1468
|
-
if (!data || data === "0x") continue;
|
|
1469
|
-
const decoded = iface.decodeFunctionResult(fnName, data);
|
|
1470
|
-
return decoded[0];
|
|
1471
|
-
} catch {
|
|
1472
|
-
}
|
|
1473
|
-
}
|
|
1474
|
-
throw new QueryHubStateError("QUERY_RESPONSE_INVALID", "Unable to decode user nonce from query response");
|
|
1475
|
-
}
|
|
1476
|
-
function decodeFirstIsRegistered(results) {
|
|
1477
|
-
const nonceCandidateCount = 3;
|
|
1478
|
-
const candidates = [
|
|
1479
|
-
"function registeredKeys(bytes32 userKeyHash) view returns (bool)",
|
|
1480
|
-
"function isKeyRegisteredByHash(bytes32 userKeyHash) view returns (bool)"
|
|
1481
|
-
];
|
|
1482
|
-
const iface = new import_ethers4.ethers.Interface(candidates);
|
|
1483
|
-
const fnNames = ["registeredKeys", "isKeyRegisteredByHash"];
|
|
1484
|
-
for (let i = 0; i < fnNames.length; i++) {
|
|
1485
|
-
const fnName = fnNames[i];
|
|
1486
|
-
try {
|
|
1487
|
-
const data = results[nonceCandidateCount + i];
|
|
1488
|
-
if (!data || data === "0x") continue;
|
|
1489
|
-
const decoded = iface.decodeFunctionResult(fnName, data);
|
|
1490
|
-
return Boolean(decoded[0]);
|
|
1491
|
-
} catch {
|
|
1492
|
-
}
|
|
1493
|
-
}
|
|
1494
|
-
return false;
|
|
1495
|
-
}
|
|
1496
|
-
function decodeLastActionHash(results) {
|
|
1497
|
-
const nonceCandidateCount = 3;
|
|
1498
|
-
const registeredCandidateCount = 2;
|
|
1499
|
-
const actionHashOffset = nonceCandidateCount + registeredCandidateCount;
|
|
1500
|
-
const candidates = [
|
|
1501
|
-
"function getUserLastActionHash(bytes32 userKeyHash) view returns (bytes32)",
|
|
1502
|
-
"function userLastActionHash(bytes32 userKeyHash) view returns (bytes32)"
|
|
1503
|
-
];
|
|
1504
|
-
const iface = new import_ethers4.ethers.Interface(candidates);
|
|
1505
|
-
const fnNames = ["getUserLastActionHash", "userLastActionHash"];
|
|
1506
|
-
for (let i = 0; i < fnNames.length; i++) {
|
|
1507
|
-
const fnName = fnNames[i];
|
|
1508
|
-
try {
|
|
1509
|
-
const data = results[actionHashOffset + i];
|
|
1510
|
-
if (!data || data === "0x") continue;
|
|
1511
|
-
const decoded = iface.decodeFunctionResult(fnName, data);
|
|
1512
|
-
return decoded[0];
|
|
1513
|
-
} catch {
|
|
1514
|
-
}
|
|
1515
|
-
}
|
|
1516
|
-
return import_ethers4.ethers.ZeroHash;
|
|
1517
|
-
}
|
|
1518
|
-
async function queryHubState(userKeyHash, apiKey, options) {
|
|
1519
|
-
if (typeof userKeyHash !== "string" || userKeyHash.length === 0) {
|
|
1520
|
-
throw new QueryHubStateError("INVALID_ARGUMENT", "userKeyHash is required");
|
|
1521
|
-
}
|
|
1522
|
-
if (!(0, import_wormhole_query_sdk.isValidHexString)(userKeyHash) || (0, import_wormhole_query_sdk.hexToUint8Array)(userKeyHash).length !== 32) {
|
|
1523
|
-
throw new QueryHubStateError("INVALID_ARGUMENT", "userKeyHash must be a 32-byte hex string");
|
|
1524
|
-
}
|
|
1525
|
-
if (typeof apiKey !== "string" || apiKey.length === 0) {
|
|
1526
|
-
throw new QueryHubStateError("INVALID_ARGUMENT", "apiKey is required");
|
|
1527
|
-
}
|
|
1528
|
-
const network = resolveNetwork(options);
|
|
1529
|
-
const maxAgeSeconds = options?.maxAge ?? 60;
|
|
1530
|
-
const maxAttempts = options?.maxAttempts ?? 4;
|
|
1531
|
-
const { wormholeChainId, hubAddress, endpoint, rpcUrl } = getHubConfig(network);
|
|
1532
|
-
const provider = new import_ethers4.ethers.JsonRpcProvider(rpcUrl);
|
|
1533
|
-
const callData = encodeHubCalls(hubAddress, userKeyHash);
|
|
1534
|
-
const doFetch = async () => {
|
|
1535
|
-
try {
|
|
1536
|
-
const latestBlock = await provider.getBlockNumber();
|
|
1537
|
-
const blockTag = Math.max(0, latestBlock - 2);
|
|
1538
|
-
const request = new import_wormhole_query_sdk.QueryRequest(Date.now() & 4294967295, [
|
|
1539
|
-
new import_wormhole_query_sdk.PerChainQueryRequest(wormholeChainId, new import_wormhole_query_sdk.EthCallQueryRequest(blockTag, callData))
|
|
1540
|
-
]);
|
|
1541
|
-
const requestHex = import_buffer.Buffer.from(request.serialize()).toString("hex");
|
|
1542
|
-
const response = await import_axios.default.post(
|
|
1543
|
-
endpoint,
|
|
1544
|
-
{ bytes: requestHex },
|
|
1545
|
-
{
|
|
1546
|
-
headers: {
|
|
1547
|
-
"X-API-Key": apiKey,
|
|
1548
|
-
"Content-Type": "application/json"
|
|
1549
|
-
},
|
|
1550
|
-
timeout: 1e4
|
|
1551
|
-
}
|
|
1552
|
-
);
|
|
1553
|
-
const data = response.data;
|
|
1554
|
-
const signatures = data?.signatures;
|
|
1555
|
-
const bytes = data?.bytes;
|
|
1556
|
-
if (!Array.isArray(signatures) || typeof bytes !== "string") {
|
|
1557
|
-
throw new QueryHubStateError("PROXY_RESPONSE_INVALID", "Query Proxy response missing signatures/bytes");
|
|
1558
|
-
}
|
|
1559
|
-
const proof = signaturesToProofBytes(signatures);
|
|
1560
|
-
const queryBytes = decodeQueryBytes(bytes);
|
|
1561
|
-
const parsed = import_wormhole_query_sdk.QueryResponse.from(queryBytes);
|
|
1562
|
-
const perChain = parsed.responses.find((r) => r.chainId === wormholeChainId);
|
|
1563
|
-
if (!perChain) {
|
|
1564
|
-
throw new QueryHubStateError("QUERY_RESPONSE_INVALID", "Missing per-chain response for hub chain");
|
|
1565
|
-
}
|
|
1566
|
-
const chainResp = import_wormhole_query_sdk.EthCallQueryResponse.from(perChain.response.serialize());
|
|
1567
|
-
const blockTime = Number(chainResp.blockTime);
|
|
1568
|
-
const nowSeconds = Math.floor(Date.now() / 1e3);
|
|
1569
|
-
if (nowSeconds - blockTime > maxAgeSeconds) {
|
|
1570
|
-
throw new QueryHubStateError(
|
|
1571
|
-
"ATTESTATION_STALE",
|
|
1572
|
-
`Guardian attestation is stale (blockTime=${blockTime}, now=${nowSeconds}, maxAge=${maxAgeSeconds}s)`
|
|
1573
|
-
);
|
|
1574
|
-
}
|
|
1575
|
-
const nonce = decodeFirstNonce(chainResp.results);
|
|
1576
|
-
const isRegistered = decodeFirstIsRegistered(chainResp.results);
|
|
1577
|
-
const lastActionHash = decodeLastActionHash(chainResp.results);
|
|
1578
|
-
return {
|
|
1579
|
-
nonce,
|
|
1580
|
-
isRegistered,
|
|
1581
|
-
blockTime,
|
|
1582
|
-
proof,
|
|
1583
|
-
lastActionHash
|
|
1584
|
-
};
|
|
1585
|
-
} catch (err) {
|
|
1586
|
-
if (err instanceof QueryHubStateError) throw err;
|
|
1587
|
-
if (import_axios.default.isAxiosError(err)) {
|
|
1588
|
-
const ax = err;
|
|
1589
|
-
const status = ax.response?.status;
|
|
1590
|
-
const statusText = ax.response?.statusText;
|
|
1591
|
-
const details = typeof ax.response?.data === "string" ? ax.response?.data : void 0;
|
|
1592
|
-
throw new QueryHubStateError(
|
|
1593
|
-
"PROXY_HTTP_ERROR",
|
|
1594
|
-
`Query Proxy request failed${status ? ` (${status} ${statusText ?? ""})` : ""}${details ? `: ${details}` : ""}`,
|
|
1595
|
-
err
|
|
1596
|
-
);
|
|
1597
|
-
}
|
|
1598
|
-
throw new QueryHubStateError("PROXY_HTTP_ERROR", "Query Proxy request failed", err);
|
|
1599
|
-
}
|
|
1600
|
-
};
|
|
1601
|
-
return await withExponentialBackoff(doFetch, maxAttempts);
|
|
1602
|
-
}
|
|
1603
|
-
|
|
1604
|
-
// src/featureFlags.ts
|
|
1605
|
-
var DEFAULT_FLAGS = {
|
|
1606
|
-
multiHub: false,
|
|
1607
|
-
primaryHub: "base"
|
|
1608
|
-
};
|
|
1609
|
-
var _flags = { ...DEFAULT_FLAGS };
|
|
1610
|
-
function getEffectivePrimaryHub() {
|
|
1611
|
-
if (!_flags.multiHub) {
|
|
1612
|
-
return "base";
|
|
1125
|
+
if (import_ethers3.ethers.dataLength(preimage) !== 114) {
|
|
1126
|
+
throw new Error("canonical challenge preimage must be 114 bytes");
|
|
1613
1127
|
}
|
|
1614
|
-
return
|
|
1128
|
+
return import_ethers3.ethers.getBytes(import_ethers3.ethers.sha256(preimage));
|
|
1615
1129
|
}
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
name: "Base Sepolia",
|
|
1628
|
-
chainId: 84532,
|
|
1629
|
-
wormholeChainId: 10004,
|
|
1630
|
-
rpcUrl: "https://sepolia.base.org",
|
|
1631
|
-
explorerUrl: "https://sepolia.basescan.org",
|
|
1632
|
-
isEvm: true,
|
|
1633
|
-
contracts: {
|
|
1634
|
-
hub: "0xD5D29b6EaeE6FF4b765e704298a7e48D22607059",
|
|
1635
|
-
vaultFactory: "0xb25b73D5FeD5693dcd1Bb78f8e33387B59A022EC",
|
|
1636
|
-
vaultImplementation: "0x2CB8397df988c1880d9e5cFfF65bfC22D7D90EE6",
|
|
1637
|
-
wormholeCoreBridge: "0x79A1027a6A159502049F10906D333EC57E95F083",
|
|
1638
|
-
tokenBridge: "0x86F55A04690fd7815A3D802bD587e83eA888B239"
|
|
1639
|
-
}
|
|
1640
|
-
},
|
|
1641
|
-
mainnet: {
|
|
1642
|
-
name: "Base",
|
|
1643
|
-
chainId: 8453,
|
|
1644
|
-
wormholeChainId: 30,
|
|
1645
|
-
rpcUrl: "https://mainnet.base.org",
|
|
1646
|
-
explorerUrl: "https://basescan.org",
|
|
1647
|
-
isEvm: true,
|
|
1648
|
-
contracts: {
|
|
1649
|
-
// TODO: Deploy mainnet contracts
|
|
1650
|
-
wormholeCoreBridge: "0xbebdb6C8ddC678FfA9f8748f85C815C556Dd8ac6",
|
|
1651
|
-
tokenBridge: "0x8d2de8d2f73F1F4cAB472AC9A881C9b123C79627"
|
|
1652
|
-
}
|
|
1653
|
-
}
|
|
1654
|
-
},
|
|
1655
|
-
// ────────────────────────────────────────────────────────────────────────
|
|
1656
|
-
// OPTIMISM - Secondary Hub / Spoke
|
|
1657
|
-
// ────────────────────────────────────────────────────────────────────────
|
|
1658
|
-
optimism: {
|
|
1659
|
-
displayName: "Optimism",
|
|
1660
|
-
type: "evm",
|
|
1661
|
-
canBeHub: true,
|
|
1662
|
-
testnet: {
|
|
1663
|
-
name: "Optimism Sepolia",
|
|
1664
|
-
chainId: 11155420,
|
|
1665
|
-
wormholeChainId: 10005,
|
|
1666
|
-
rpcUrl: "https://sepolia.optimism.io",
|
|
1667
|
-
explorerUrl: "https://sepolia-optimism.etherscan.io",
|
|
1668
|
-
isEvm: true,
|
|
1669
|
-
contracts: {
|
|
1670
|
-
vaultFactory: "0x3c5e4aCdC8Cd53ae5ae603B4c511885191fBb868",
|
|
1671
|
-
vaultImplementation: "0xA45dBF322c5A3028687fEEB161603d3BCe02e119",
|
|
1672
|
-
wormholeCoreBridge: "0x31377888146f3253211EFEf5c676D41ECe7D58Fe",
|
|
1673
|
-
tokenBridge: "0x99737Ec4B815d816c49A385943baf0380e75c0Ac"
|
|
1674
|
-
}
|
|
1675
|
-
},
|
|
1676
|
-
mainnet: {
|
|
1677
|
-
name: "Optimism",
|
|
1678
|
-
chainId: 10,
|
|
1679
|
-
wormholeChainId: 24,
|
|
1680
|
-
rpcUrl: "https://mainnet.optimism.io",
|
|
1681
|
-
explorerUrl: "https://optimistic.etherscan.io",
|
|
1682
|
-
isEvm: true,
|
|
1683
|
-
contracts: {
|
|
1684
|
-
wormholeCoreBridge: "0xEe91C335eab126dF5fDB3797EA9d6aD93aeC9722",
|
|
1685
|
-
tokenBridge: "0x1D68124e65faFC907325e3EDbF8c4d84499DAa8b"
|
|
1686
|
-
}
|
|
1687
|
-
}
|
|
1688
|
-
},
|
|
1689
|
-
// ────────────────────────────────────────────────────────────────────────
|
|
1690
|
-
// ARBITRUM
|
|
1691
|
-
// ────────────────────────────────────────────────────────────────────────
|
|
1692
|
-
arbitrum: {
|
|
1693
|
-
displayName: "Arbitrum",
|
|
1694
|
-
type: "evm",
|
|
1695
|
-
canBeHub: true,
|
|
1696
|
-
testnet: {
|
|
1697
|
-
name: "Arbitrum Sepolia",
|
|
1698
|
-
chainId: 421614,
|
|
1699
|
-
wormholeChainId: 10003,
|
|
1700
|
-
rpcUrl: "https://sepolia-rollup.arbitrum.io/rpc",
|
|
1701
|
-
explorerUrl: "https://sepolia.arbiscan.io",
|
|
1702
|
-
isEvm: true,
|
|
1703
|
-
contracts: {
|
|
1704
|
-
vaultFactory: "0xB9C3e6bad3c6f26956be4a4bb5a366376Fd3045D",
|
|
1705
|
-
vaultImplementation: "0x8601881b94B68B09b485f407317686103d3CB681",
|
|
1706
|
-
wormholeCoreBridge: "0x6b9C8671cdDC8dEab9c719bB87cBd3e782bA6a35",
|
|
1707
|
-
tokenBridge: "0xC7A204bDBFe983FCD8d8E61D02b475D4073fF97e"
|
|
1708
|
-
}
|
|
1709
|
-
},
|
|
1710
|
-
mainnet: {
|
|
1711
|
-
name: "Arbitrum",
|
|
1712
|
-
chainId: 42161,
|
|
1713
|
-
wormholeChainId: 23,
|
|
1714
|
-
rpcUrl: "https://arb1.arbitrum.io/rpc",
|
|
1715
|
-
explorerUrl: "https://arbiscan.io",
|
|
1716
|
-
isEvm: true,
|
|
1717
|
-
contracts: {
|
|
1718
|
-
wormholeCoreBridge: "0xa5f208e072434bC67592E4C49C1B991BA79BCA46",
|
|
1719
|
-
tokenBridge: "0x0b2402144Bb366A632D14B83F244D2e0e21bD39c"
|
|
1720
|
-
}
|
|
1721
|
-
}
|
|
1722
|
-
},
|
|
1723
|
-
// ────────────────────────────────────────────────────────────────────────
|
|
1724
|
-
// ETHEREUM
|
|
1725
|
-
// ────────────────────────────────────────────────────────────────────────
|
|
1726
|
-
ethereum: {
|
|
1727
|
-
displayName: "Ethereum",
|
|
1728
|
-
type: "evm",
|
|
1729
|
-
canBeHub: false,
|
|
1730
|
-
testnet: {
|
|
1731
|
-
name: "Sepolia",
|
|
1732
|
-
chainId: 11155111,
|
|
1733
|
-
wormholeChainId: 10002,
|
|
1734
|
-
rpcUrl: "https://ethereum-sepolia-rpc.publicnode.com",
|
|
1735
|
-
explorerUrl: "https://sepolia.etherscan.io",
|
|
1736
|
-
isEvm: true,
|
|
1737
|
-
contracts: {
|
|
1738
|
-
vaultFactory: "0x265c10763B4d16AD970bC3d7670c645e37f63AF4",
|
|
1739
|
-
vaultImplementation: "0x942426C94652ebC48f4f404928016B95ADb1DA25",
|
|
1740
|
-
wormholeCoreBridge: "0x4a8bc80Ed5a4067f1CCf107057b8270E0cC11A78",
|
|
1741
|
-
tokenBridge: "0xDB5492265f6038831E89f495670FF909aDe94bd9"
|
|
1742
|
-
}
|
|
1743
|
-
},
|
|
1744
|
-
mainnet: {
|
|
1745
|
-
name: "Ethereum",
|
|
1746
|
-
chainId: 1,
|
|
1747
|
-
wormholeChainId: 2,
|
|
1748
|
-
rpcUrl: "https://eth.llamarpc.com",
|
|
1749
|
-
explorerUrl: "https://etherscan.io",
|
|
1750
|
-
isEvm: true,
|
|
1751
|
-
contracts: {
|
|
1752
|
-
wormholeCoreBridge: "0x98f3c9e6E3fAce36bAAd05FE09d375Ef1464288B",
|
|
1753
|
-
tokenBridge: "0x3ee18B2214AFF97000D974cf647E7C347E8fa585"
|
|
1754
|
-
}
|
|
1755
|
-
}
|
|
1756
|
-
},
|
|
1757
|
-
// ────────────────────────────────────────────────────────────────────────
|
|
1758
|
-
// POLYGON
|
|
1759
|
-
// ────────────────────────────────────────────────────────────────────────
|
|
1760
|
-
polygon: {
|
|
1761
|
-
displayName: "Polygon",
|
|
1762
|
-
type: "evm",
|
|
1763
|
-
canBeHub: false,
|
|
1764
|
-
testnet: {
|
|
1765
|
-
name: "Polygon Amoy",
|
|
1766
|
-
chainId: 80002,
|
|
1767
|
-
wormholeChainId: 10007,
|
|
1768
|
-
rpcUrl: "https://rpc-amoy.polygon.technology",
|
|
1769
|
-
explorerUrl: "https://amoy.polygonscan.com",
|
|
1770
|
-
isEvm: true,
|
|
1771
|
-
contracts: {
|
|
1772
|
-
wormholeCoreBridge: "0x0CBE91CF822c73C2315FB05100C2F714765d5c20",
|
|
1773
|
-
tokenBridge: "0x0290FB167208Af455bB137780163b7B7a9a10C16"
|
|
1774
|
-
}
|
|
1775
|
-
},
|
|
1776
|
-
mainnet: {
|
|
1777
|
-
name: "Polygon",
|
|
1778
|
-
chainId: 137,
|
|
1779
|
-
wormholeChainId: 5,
|
|
1780
|
-
rpcUrl: "https://polygon-rpc.com",
|
|
1781
|
-
explorerUrl: "https://polygonscan.com",
|
|
1782
|
-
isEvm: true,
|
|
1783
|
-
contracts: {
|
|
1784
|
-
wormholeCoreBridge: "0x7A4B5a56256163F07b2C80A7cA55aBE66c4ec4d7",
|
|
1785
|
-
tokenBridge: "0x5a58505a96D1dbf8dF91cB21B54419FC36e93fdE"
|
|
1786
|
-
}
|
|
1787
|
-
}
|
|
1788
|
-
},
|
|
1789
|
-
// ────────────────────────────────────────────────────────────────────────
|
|
1790
|
-
// BSC
|
|
1791
|
-
// ────────────────────────────────────────────────────────────────────────
|
|
1792
|
-
bsc: {
|
|
1793
|
-
displayName: "BNB Chain",
|
|
1794
|
-
type: "evm",
|
|
1795
|
-
canBeHub: false,
|
|
1796
|
-
testnet: {
|
|
1797
|
-
name: "BSC Testnet",
|
|
1798
|
-
chainId: 97,
|
|
1799
|
-
wormholeChainId: 4,
|
|
1800
|
-
rpcUrl: "https://data-seed-prebsc-1-s1.binance.org:8545",
|
|
1801
|
-
explorerUrl: "https://testnet.bscscan.com",
|
|
1802
|
-
isEvm: true,
|
|
1803
|
-
contracts: {
|
|
1804
|
-
wormholeCoreBridge: "0x68605AD7b15c732a30b1BbC62BE8F2A509D74b4D",
|
|
1805
|
-
tokenBridge: "0x9dcF9D205C9De35334D646BeE44b2D2859712A09"
|
|
1806
|
-
}
|
|
1807
|
-
},
|
|
1808
|
-
mainnet: {
|
|
1809
|
-
name: "BNB Chain",
|
|
1810
|
-
chainId: 56,
|
|
1811
|
-
wormholeChainId: 4,
|
|
1812
|
-
rpcUrl: "https://bsc-dataseed.binance.org",
|
|
1813
|
-
explorerUrl: "https://bscscan.com",
|
|
1814
|
-
isEvm: true,
|
|
1815
|
-
contracts: {
|
|
1816
|
-
wormholeCoreBridge: "0x98f3c9e6E3fAce36bAAd05FE09d375Ef1464288B",
|
|
1817
|
-
tokenBridge: "0xB6F6D86a8f9879A9c87f643768d9efc38c1Da6E7"
|
|
1818
|
-
}
|
|
1819
|
-
}
|
|
1820
|
-
},
|
|
1821
|
-
// ────────────────────────────────────────────────────────────────────────
|
|
1822
|
-
// AVALANCHE — ACP-204 Native P-256 + ICM Teleporter + Hub-Capable
|
|
1823
|
-
// ────────────────────────────────────────────────────────────────────────
|
|
1824
|
-
avalanche: {
|
|
1825
|
-
displayName: "Avalanche",
|
|
1826
|
-
type: "evm",
|
|
1827
|
-
canBeHub: true,
|
|
1828
|
-
// ACP-204 provides native P-256 at 0x0100 (6,900 gas)
|
|
1829
|
-
testnet: {
|
|
1830
|
-
name: "Avalanche Fuji",
|
|
1831
|
-
chainId: 43113,
|
|
1832
|
-
wormholeChainId: 6,
|
|
1833
|
-
rpcUrl: "https://api.avax-test.network/ext/bc/C/rpc",
|
|
1834
|
-
explorerUrl: "https://testnet.snowtrace.io",
|
|
1835
|
-
isEvm: true,
|
|
1836
|
-
contracts: {
|
|
1837
|
-
// Veridex Hub (deployed via deploy-avalanche.ts)
|
|
1838
|
-
hub: "",
|
|
1839
|
-
// No Hub on Fuji — Hub is on Base Sepolia
|
|
1840
|
-
vaultFactory: "0x9e9716442e908A9b61F11432cC38024DD390cd2a",
|
|
1841
|
-
vaultImplementation: "0xE0b9919ffDf3415355Db369C8FfA5Dd4e000052c",
|
|
1842
|
-
// Wormhole bridges (canonical Fuji addresses)
|
|
1843
|
-
wormholeCoreBridge: "0x7bbcE28e64B3F8b84d876Ab298393c38ad7aac4C",
|
|
1844
|
-
tokenBridge: "0x61E44E506Ca5659E6c0bba9b678586fA2d729756",
|
|
1845
|
-
// Avalanche-specific: ACP-204 P-256 verifier wrapper
|
|
1846
|
-
p256Verifier: "0xB5d29EA1E2e90A24D6506E2a6a269506a12974CC",
|
|
1847
|
-
// Avalanche-specific: ICM Spoke for cross-L1 session bridging
|
|
1848
|
-
icmSpoke: "0x9fCFC608086539A69839EfA9628884dB75ac07D0",
|
|
1849
|
-
// Chainlink price feeds (Fuji testnet)
|
|
1850
|
-
chainlinkAvaxUsd: "0x5498BB86BC934c8D34FDA08E81D444153d0D06aD",
|
|
1851
|
-
chainlinkUsdcUsd: "0x7898AcCC83587C3C55116c5230C17a6Cd9C71bad",
|
|
1852
|
-
chainlinkUsdtUsd: "0x7898AcCC83587C3C55116c5230C17a6Cd9C71bad"
|
|
1853
|
-
},
|
|
1854
|
-
hubChainId: 10004
|
|
1855
|
-
// Base Sepolia (primary Hub)
|
|
1856
|
-
},
|
|
1857
|
-
mainnet: {
|
|
1858
|
-
name: "Avalanche",
|
|
1859
|
-
chainId: 43114,
|
|
1860
|
-
wormholeChainId: 6,
|
|
1861
|
-
rpcUrl: "https://api.avax.network/ext/bc/C/rpc",
|
|
1862
|
-
explorerUrl: "https://snowtrace.io",
|
|
1863
|
-
isEvm: true,
|
|
1864
|
-
contracts: {
|
|
1865
|
-
wormholeCoreBridge: "0x54a8e5f9c4CbA08F9943965859F6c34eAF03E26c",
|
|
1866
|
-
tokenBridge: "0x0e082F06FF657D94310cB8cE8B0D9a04541d8052",
|
|
1867
|
-
// Chainlink price feeds (Avalanche mainnet)
|
|
1868
|
-
chainlinkAvaxUsd: "0x0A77230d17318075983913bC2145DB16C7366156",
|
|
1869
|
-
chainlinkUsdcUsd: "0xF096872672F44d6EBA71458D74fe67F9a77a23B9",
|
|
1870
|
-
chainlinkUsdtUsd: "0xEBE676ee90Fe1112671f19b6B7459bC678B67e8a"
|
|
1871
|
-
}
|
|
1872
|
-
}
|
|
1873
|
-
},
|
|
1874
|
-
// ────────────────────────────────────────────────────────────────────────
|
|
1875
|
-
// SCROLL
|
|
1876
|
-
// ────────────────────────────────────────────────────────────────────────
|
|
1877
|
-
scroll: {
|
|
1878
|
-
displayName: "Scroll",
|
|
1879
|
-
type: "evm",
|
|
1880
|
-
canBeHub: false,
|
|
1881
|
-
testnet: {
|
|
1882
|
-
name: "Scroll Sepolia",
|
|
1883
|
-
chainId: 534351,
|
|
1884
|
-
wormholeChainId: 34,
|
|
1885
|
-
rpcUrl: "https://sepolia-rpc.scroll.io",
|
|
1886
|
-
explorerUrl: "https://sepolia.scrollscan.com",
|
|
1887
|
-
isEvm: true,
|
|
1888
|
-
contracts: {
|
|
1889
|
-
wormholeCoreBridge: "0x055F47F1250012C6B20c436570a76e52c17Af2D5",
|
|
1890
|
-
tokenBridge: "0x22427d90B7dA3fA4642F7025A854c7254E4e45BF"
|
|
1891
|
-
}
|
|
1892
|
-
},
|
|
1893
|
-
mainnet: {
|
|
1894
|
-
name: "Scroll",
|
|
1895
|
-
chainId: 534352,
|
|
1896
|
-
wormholeChainId: 34,
|
|
1897
|
-
rpcUrl: "https://rpc.scroll.io",
|
|
1898
|
-
explorerUrl: "https://scrollscan.com",
|
|
1899
|
-
isEvm: true,
|
|
1900
|
-
contracts: {
|
|
1901
|
-
wormholeCoreBridge: "0xbebdb6C8ddC678FfA9f8748f85C815C556Dd8ac6",
|
|
1902
|
-
tokenBridge: "0x24850c6f61C438823F01B7A3BF2B89B72174Fa9d"
|
|
1903
|
-
}
|
|
1904
|
-
}
|
|
1905
|
-
},
|
|
1906
|
-
// ────────────────────────────────────────────────────────────────────────
|
|
1907
|
-
// BLAST
|
|
1908
|
-
// ────────────────────────────────────────────────────────────────────────
|
|
1909
|
-
blast: {
|
|
1910
|
-
displayName: "Blast",
|
|
1911
|
-
type: "evm",
|
|
1912
|
-
canBeHub: false,
|
|
1913
|
-
testnet: {
|
|
1914
|
-
name: "Blast Sepolia",
|
|
1915
|
-
chainId: 168587773,
|
|
1916
|
-
wormholeChainId: 36,
|
|
1917
|
-
rpcUrl: "https://sepolia.blast.io",
|
|
1918
|
-
explorerUrl: "https://sepolia.blastscan.io",
|
|
1919
|
-
isEvm: true,
|
|
1920
|
-
contracts: {
|
|
1921
|
-
wormholeCoreBridge: "0x473e002D7add6fB67a4964F13bFd61280Ca46886",
|
|
1922
|
-
tokenBridge: "0x430855B4D43b8AEB9D2B9869B74d58dda79C0dB2"
|
|
1923
|
-
}
|
|
1924
|
-
},
|
|
1925
|
-
mainnet: {
|
|
1926
|
-
name: "Blast",
|
|
1927
|
-
chainId: 81457,
|
|
1928
|
-
wormholeChainId: 36,
|
|
1929
|
-
rpcUrl: "https://rpc.blast.io",
|
|
1930
|
-
explorerUrl: "https://blastscan.io",
|
|
1931
|
-
isEvm: true,
|
|
1932
|
-
contracts: {
|
|
1933
|
-
wormholeCoreBridge: "0xbebdb6C8ddC678FfA9f8748f85C815C556Dd8ac6",
|
|
1934
|
-
tokenBridge: "0x24850c6f61C438823F01B7A3BF2B89B72174Fa9d"
|
|
1935
|
-
}
|
|
1936
|
-
}
|
|
1937
|
-
},
|
|
1938
|
-
// ────────────────────────────────────────────────────────────────────────
|
|
1939
|
-
// MANTLE
|
|
1940
|
-
// ────────────────────────────────────────────────────────────────────────
|
|
1941
|
-
mantle: {
|
|
1942
|
-
displayName: "Mantle",
|
|
1943
|
-
type: "evm",
|
|
1944
|
-
canBeHub: false,
|
|
1945
|
-
testnet: {
|
|
1946
|
-
name: "Mantle Sepolia",
|
|
1947
|
-
chainId: 5003,
|
|
1948
|
-
wormholeChainId: 35,
|
|
1949
|
-
rpcUrl: "https://rpc.sepolia.mantle.xyz",
|
|
1950
|
-
explorerUrl: "https://sepolia.mantlescan.xyz",
|
|
1951
|
-
isEvm: true,
|
|
1952
|
-
contracts: {
|
|
1953
|
-
wormholeCoreBridge: "0x376428e7f26D5867e69201b275553C45B09EE090",
|
|
1954
|
-
tokenBridge: "0x75Bfa155a9D7A3714b0861c8a8aF0C4633c45b5D"
|
|
1955
|
-
}
|
|
1956
|
-
},
|
|
1957
|
-
mainnet: {
|
|
1958
|
-
name: "Mantle",
|
|
1959
|
-
chainId: 5e3,
|
|
1960
|
-
wormholeChainId: 35,
|
|
1961
|
-
rpcUrl: "https://rpc.mantle.xyz",
|
|
1962
|
-
explorerUrl: "https://mantlescan.xyz",
|
|
1963
|
-
isEvm: true,
|
|
1964
|
-
contracts: {
|
|
1965
|
-
wormholeCoreBridge: "0xbebdb6C8ddC678FfA9f8748f85C815C556Dd8ac6",
|
|
1966
|
-
tokenBridge: "0x24850c6f61C438823F01B7A3BF2B89B72174Fa9d"
|
|
1967
|
-
}
|
|
1968
|
-
}
|
|
1969
|
-
},
|
|
1970
|
-
// ────────────────────────────────────────────────────────────────────────
|
|
1971
|
-
// FANTOM
|
|
1972
|
-
// ────────────────────────────────────────────────────────────────────────
|
|
1973
|
-
fantom: {
|
|
1974
|
-
displayName: "Fantom",
|
|
1975
|
-
type: "evm",
|
|
1976
|
-
canBeHub: false,
|
|
1977
|
-
testnet: {
|
|
1978
|
-
name: "Fantom Testnet",
|
|
1979
|
-
chainId: 4002,
|
|
1980
|
-
wormholeChainId: 10,
|
|
1981
|
-
rpcUrl: "https://rpc.testnet.fantom.network",
|
|
1982
|
-
explorerUrl: "https://testnet.ftmscan.com",
|
|
1983
|
-
isEvm: true,
|
|
1984
|
-
contracts: {
|
|
1985
|
-
wormholeCoreBridge: "0x1BB3B4119b7BA9dfad76B0545fb3F531383c3bB7",
|
|
1986
|
-
tokenBridge: "0x599CEa2204B4FaECd584Ab1F2b6aCA137a0afbE8"
|
|
1987
|
-
}
|
|
1988
|
-
},
|
|
1989
|
-
mainnet: {
|
|
1990
|
-
name: "Fantom",
|
|
1991
|
-
chainId: 250,
|
|
1992
|
-
wormholeChainId: 10,
|
|
1993
|
-
rpcUrl: "https://rpcapi.fantom.network",
|
|
1994
|
-
explorerUrl: "https://ftmscan.com",
|
|
1995
|
-
isEvm: true,
|
|
1996
|
-
contracts: {
|
|
1997
|
-
wormholeCoreBridge: "0x126783A6Cb203a3E35344528B26ca3a0489a1485",
|
|
1998
|
-
tokenBridge: "0x7C9Fc5741288cDFdD83CeB07f3ea7e22618D79D2"
|
|
1999
|
-
}
|
|
2000
|
-
}
|
|
2001
|
-
},
|
|
2002
|
-
// ────────────────────────────────────────────────────────────────────────
|
|
2003
|
-
// CELO
|
|
2004
|
-
// ────────────────────────────────────────────────────────────────────────
|
|
2005
|
-
celo: {
|
|
2006
|
-
displayName: "Celo",
|
|
2007
|
-
type: "evm",
|
|
2008
|
-
canBeHub: false,
|
|
2009
|
-
testnet: {
|
|
2010
|
-
name: "Celo Alfajores",
|
|
2011
|
-
chainId: 44787,
|
|
2012
|
-
wormholeChainId: 14,
|
|
2013
|
-
rpcUrl: "https://alfajores-forno.celo-testnet.org",
|
|
2014
|
-
explorerUrl: "https://alfajores.celoscan.io",
|
|
2015
|
-
isEvm: true,
|
|
2016
|
-
contracts: {
|
|
2017
|
-
wormholeCoreBridge: "0x88505117CA88e7dd2eC6EA1E13f0948db2D50D56",
|
|
2018
|
-
tokenBridge: "0x05ca6037eC51F8b712eD2E6Fa72219FEaE74E153"
|
|
2019
|
-
}
|
|
2020
|
-
},
|
|
2021
|
-
mainnet: {
|
|
2022
|
-
name: "Celo",
|
|
2023
|
-
chainId: 42220,
|
|
2024
|
-
wormholeChainId: 14,
|
|
2025
|
-
rpcUrl: "https://forno.celo.org",
|
|
2026
|
-
explorerUrl: "https://celoscan.io",
|
|
2027
|
-
isEvm: true,
|
|
2028
|
-
contracts: {
|
|
2029
|
-
wormholeCoreBridge: "0xa321448d90d4e5b0A732867c18eA198e75CAC48E",
|
|
2030
|
-
tokenBridge: "0x796Dff6D74F3E27060B71255Fe517BFb23C93eed"
|
|
2031
|
-
}
|
|
2032
|
-
}
|
|
2033
|
-
},
|
|
2034
|
-
// ────────────────────────────────────────────────────────────────────────
|
|
2035
|
-
// MOONBEAM
|
|
2036
|
-
// ────────────────────────────────────────────────────────────────────────
|
|
2037
|
-
moonbeam: {
|
|
2038
|
-
displayName: "Moonbeam",
|
|
2039
|
-
type: "evm",
|
|
2040
|
-
canBeHub: false,
|
|
2041
|
-
testnet: {
|
|
2042
|
-
name: "Moonbase Alpha",
|
|
2043
|
-
chainId: 1287,
|
|
2044
|
-
wormholeChainId: 16,
|
|
2045
|
-
rpcUrl: "https://rpc.api.moonbase.moonbeam.network",
|
|
2046
|
-
explorerUrl: "https://moonbase.moonscan.io",
|
|
2047
|
-
isEvm: true,
|
|
2048
|
-
contracts: {
|
|
2049
|
-
wormholeCoreBridge: "0xa5B7D85a8f27dd7907dc8FdC21FA5657D5E2F901",
|
|
2050
|
-
tokenBridge: "0xbc976D4b9D57E57c3cA52e1Fd136C45FF7955A96"
|
|
2051
|
-
}
|
|
2052
|
-
},
|
|
2053
|
-
mainnet: {
|
|
2054
|
-
name: "Moonbeam",
|
|
2055
|
-
chainId: 1284,
|
|
2056
|
-
wormholeChainId: 16,
|
|
2057
|
-
rpcUrl: "https://rpc.api.moonbeam.network",
|
|
2058
|
-
explorerUrl: "https://moonscan.io",
|
|
2059
|
-
isEvm: true,
|
|
2060
|
-
contracts: {
|
|
2061
|
-
wormholeCoreBridge: "0xC8e2b0cD52Cf01b0Ce87d389Daa3d414d4cE29f3",
|
|
2062
|
-
tokenBridge: "0xb1731c586ca89a23809861c6103F0b96B3F57D92"
|
|
2063
|
-
}
|
|
2064
|
-
}
|
|
2065
|
-
},
|
|
2066
|
-
// ────────────────────────────────────────────────────────────────────────
|
|
2067
|
-
// MONAD - High-Performance L1 with EIP-7951 P256 + Agent Gateway
|
|
2068
|
-
// ────────────────────────────────────────────────────────────────────────
|
|
2069
|
-
monad: {
|
|
2070
|
-
displayName: "Monad",
|
|
2071
|
-
type: "evm",
|
|
2072
|
-
canBeHub: true,
|
|
2073
|
-
// Has native P-256 precompile (EIP-7951)
|
|
2074
|
-
testnet: {
|
|
2075
|
-
name: "Monad Testnet",
|
|
2076
|
-
chainId: 10143,
|
|
2077
|
-
wormholeChainId: 10048,
|
|
2078
|
-
rpcUrl: "https://testnet-rpc.monad.xyz",
|
|
2079
|
-
explorerUrl: "https://testnet.monadvision.com",
|
|
2080
|
-
isEvm: true,
|
|
2081
|
-
contracts: {
|
|
2082
|
-
vaultFactory: "0x50F2c37584823A6cc293bd0d7647D558d05CA4C1",
|
|
2083
|
-
vaultImplementation: "0x53d4D3943d0E524836f0B1955AbB216449F538fF",
|
|
2084
|
-
wormholeCoreBridge: "0xBB73cB66C26740F31d1FabDC6b7A46a038A300dd",
|
|
2085
|
-
// Agent Gateway contracts
|
|
2086
|
-
serviceDirectory: "0x2d20f29E1f5B24294B3F125B47f2a22a7012a35E"
|
|
2087
|
-
},
|
|
2088
|
-
hubChainId: 10004
|
|
2089
|
-
// Base Sepolia
|
|
2090
|
-
},
|
|
2091
|
-
mainnet: {
|
|
2092
|
-
name: "Monad",
|
|
2093
|
-
chainId: 143,
|
|
2094
|
-
wormholeChainId: 0,
|
|
2095
|
-
// TBD
|
|
2096
|
-
rpcUrl: "https://rpc.monad.xyz",
|
|
2097
|
-
explorerUrl: "https://monadscan.com",
|
|
2098
|
-
isEvm: true,
|
|
2099
|
-
contracts: {
|
|
2100
|
-
wormholeCoreBridge: "0x194B123c5E96B9b2E49763619985790Dc241CAC0",
|
|
2101
|
-
tokenBridge: "0x0B2719cdA2F10595369e6673ceA3Ee2EDFa13BA7"
|
|
2102
|
-
}
|
|
2103
|
-
}
|
|
2104
|
-
},
|
|
2105
|
-
// ────────────────────────────────────────────────────────────────────────
|
|
2106
|
-
// SEI
|
|
2107
|
-
// ────────────────────────────────────────────────────────────────────────
|
|
2108
|
-
sei: {
|
|
2109
|
-
displayName: "Sei",
|
|
2110
|
-
type: "evm",
|
|
2111
|
-
canBeHub: false,
|
|
2112
|
-
testnet: {
|
|
2113
|
-
name: "Sei Atlantic-2",
|
|
2114
|
-
chainId: 1328,
|
|
2115
|
-
wormholeChainId: 40,
|
|
2116
|
-
rpcUrl: "https://evm-rpc-testnet.sei-apis.com",
|
|
2117
|
-
explorerUrl: "https://seitrace.com/?chain=atlantic-2",
|
|
2118
|
-
isEvm: true,
|
|
2119
|
-
contracts: {
|
|
2120
|
-
vaultFactory: "0x07F608AFf6d63b68029488b726d895c4Bb593038",
|
|
2121
|
-
vaultImplementation: "0xD66153fccFB6731fB6c4944FbD607ba86A76a1f6",
|
|
2122
|
-
wormholeCoreBridge: "0x0000000000000000000000000000000000000000"
|
|
2123
|
-
}
|
|
2124
|
-
},
|
|
2125
|
-
mainnet: {
|
|
2126
|
-
name: "Sei",
|
|
2127
|
-
chainId: 1329,
|
|
2128
|
-
wormholeChainId: 32,
|
|
2129
|
-
rpcUrl: "https://evm-rpc.sei-apis.com",
|
|
2130
|
-
explorerUrl: "https://seitrace.com",
|
|
2131
|
-
isEvm: true,
|
|
2132
|
-
contracts: {
|
|
2133
|
-
wormholeCoreBridge: "0x0000000000000000000000000000000000000000"
|
|
2134
|
-
}
|
|
2135
|
-
}
|
|
2136
|
-
},
|
|
2137
|
-
// ────────────────────────────────────────────────────────────────────────
|
|
2138
|
-
// SOLANA
|
|
2139
|
-
// ────────────────────────────────────────────────────────────────────────
|
|
2140
|
-
solana: {
|
|
2141
|
-
displayName: "Solana",
|
|
2142
|
-
type: "solana",
|
|
2143
|
-
canBeHub: false,
|
|
2144
|
-
testnet: {
|
|
2145
|
-
name: "Solana Devnet",
|
|
2146
|
-
chainId: 0,
|
|
2147
|
-
wormholeChainId: 1,
|
|
2148
|
-
rpcUrl: "https://api.devnet.solana.com",
|
|
2149
|
-
explorerUrl: "https://explorer.solana.com",
|
|
2150
|
-
isEvm: false,
|
|
2151
|
-
contracts: {
|
|
2152
|
-
hub: "64ZZBdmGd1YT6Fok7PELvAdfoXyR4PHxHnRqHNqZHJ13",
|
|
2153
|
-
wormholeCoreBridge: "3u8hJUVTA4jH1wYAyUur7FFZVQ8H635K3tSHHF4ssjQ5",
|
|
2154
|
-
tokenBridge: "DZnkkTmCiFWfYTfT41X3Rd1kDgozqzxWaHqsw6W4x2oe"
|
|
2155
|
-
}
|
|
2156
|
-
},
|
|
2157
|
-
mainnet: {
|
|
2158
|
-
name: "Solana",
|
|
2159
|
-
chainId: 0,
|
|
2160
|
-
wormholeChainId: 1,
|
|
2161
|
-
rpcUrl: "https://api.mainnet-beta.solana.com",
|
|
2162
|
-
explorerUrl: "https://explorer.solana.com",
|
|
2163
|
-
isEvm: false,
|
|
2164
|
-
contracts: {
|
|
2165
|
-
wormholeCoreBridge: "worm2ZoG2kUd4vFXhvjh93UUH596ayRfgQ2MgjNMTth",
|
|
2166
|
-
tokenBridge: "wormDTUJ6AWPNvk59vGQbDvGJmqbDTdgWgAqcLBCgUb"
|
|
2167
|
-
}
|
|
2168
|
-
}
|
|
2169
|
-
},
|
|
2170
|
-
// ────────────────────────────────────────────────────────────────────────
|
|
2171
|
-
// APTOS
|
|
2172
|
-
// ────────────────────────────────────────────────────────────────────────
|
|
2173
|
-
aptos: {
|
|
2174
|
-
displayName: "Aptos",
|
|
2175
|
-
type: "aptos",
|
|
2176
|
-
canBeHub: false,
|
|
2177
|
-
testnet: {
|
|
2178
|
-
name: "Aptos Testnet",
|
|
2179
|
-
chainId: 0,
|
|
2180
|
-
wormholeChainId: 22,
|
|
2181
|
-
rpcUrl: "https://fullnode.testnet.aptoslabs.com/v1",
|
|
2182
|
-
explorerUrl: "https://explorer.aptoslabs.com",
|
|
2183
|
-
isEvm: false,
|
|
2184
|
-
contracts: {
|
|
2185
|
-
hub: "0x9e8641143245ab8b93af1417a1fbc698d40fd351a25f6c17e4210e59bf82c9c7",
|
|
2186
|
-
wormholeCoreBridge: "0x5bc11445584a763c1fa7ed39081f1b920954da14e04b32440cba863d03e19625",
|
|
2187
|
-
tokenBridge: "0x576410486a2da45eee6c949c995670112ddf2fbeedab20350d506328eefc9d4f"
|
|
2188
|
-
}
|
|
2189
|
-
},
|
|
2190
|
-
mainnet: {
|
|
2191
|
-
name: "Aptos",
|
|
2192
|
-
chainId: 0,
|
|
2193
|
-
wormholeChainId: 22,
|
|
2194
|
-
rpcUrl: "https://fullnode.mainnet.aptoslabs.com/v1",
|
|
2195
|
-
explorerUrl: "https://explorer.aptoslabs.com",
|
|
2196
|
-
isEvm: false,
|
|
2197
|
-
contracts: {
|
|
2198
|
-
wormholeCoreBridge: "0x5bc11445584a763c1fa7ed39081f1b920954da14e04b32440cba863d03e19625",
|
|
2199
|
-
tokenBridge: "0x576410486a2da45eee6c949c995670112ddf2fbeedab20350d506328eefc9d4f"
|
|
2200
|
-
}
|
|
2201
|
-
}
|
|
2202
|
-
},
|
|
2203
|
-
// ────────────────────────────────────────────────────────────────────────
|
|
2204
|
-
// SUI
|
|
2205
|
-
// ────────────────────────────────────────────────────────────────────────
|
|
2206
|
-
sui: {
|
|
2207
|
-
displayName: "Sui",
|
|
2208
|
-
type: "sui",
|
|
2209
|
-
canBeHub: false,
|
|
2210
|
-
testnet: {
|
|
2211
|
-
name: "Sui Testnet",
|
|
2212
|
-
chainId: 0,
|
|
2213
|
-
wormholeChainId: 21,
|
|
2214
|
-
rpcUrl: "https://fullnode.testnet.sui.io:443",
|
|
2215
|
-
explorerUrl: "https://suiscan.xyz/testnet",
|
|
2216
|
-
isEvm: false,
|
|
2217
|
-
contracts: {
|
|
2218
|
-
hub: "0xaf36d8bc349883b23e78b00a342a656c799319508600583eaee9121ffaa7f5f7",
|
|
2219
|
-
wormholeCoreBridge: "0x31358d198147da50db32eda2562951d53973a0c0ad5ed738e9b17d88b213d790"
|
|
2220
|
-
}
|
|
2221
|
-
},
|
|
2222
|
-
mainnet: {
|
|
2223
|
-
name: "Sui",
|
|
2224
|
-
chainId: 0,
|
|
2225
|
-
wormholeChainId: 21,
|
|
2226
|
-
rpcUrl: "https://fullnode.mainnet.sui.io:443",
|
|
2227
|
-
explorerUrl: "https://suiscan.xyz/mainnet",
|
|
2228
|
-
isEvm: false,
|
|
2229
|
-
contracts: {
|
|
2230
|
-
wormholeCoreBridge: "0xaeab97f96cf9877fee2883315d459552b2b921edc16d7ceac6eab944dd88919c"
|
|
2231
|
-
}
|
|
2232
|
-
}
|
|
2233
|
-
},
|
|
2234
|
-
// ────────────────────────────────────────────────────────────────────────
|
|
2235
|
-
// STARKNET
|
|
2236
|
-
// ────────────────────────────────────────────────────────────────────────
|
|
2237
|
-
starknet: {
|
|
2238
|
-
displayName: "Starknet",
|
|
2239
|
-
type: "starknet",
|
|
2240
|
-
canBeHub: false,
|
|
2241
|
-
testnet: {
|
|
2242
|
-
name: "Starknet Sepolia",
|
|
2243
|
-
chainId: 0,
|
|
2244
|
-
wormholeChainId: 50001,
|
|
2245
|
-
// Custom bridge (non-Wormhole)
|
|
2246
|
-
rpcUrl: "https://starknet-sepolia-rpc.publicnode.com",
|
|
2247
|
-
explorerUrl: "https://sepolia.starkscan.co",
|
|
2248
|
-
isEvm: false,
|
|
2249
|
-
contracts: {
|
|
2250
|
-
hub: "0x7bb7cbe7d82e910b296611b582035a207343431f98bdd7b692bddfdd6f28737",
|
|
2251
|
-
wormholeCoreBridge: "0x30d2e7f26dc75819cfddcd7caa26a76b681d5918f219c99060c42ce1e3f69e4"
|
|
2252
|
-
},
|
|
2253
|
-
hubChainId: 10004
|
|
2254
|
-
// Base Sepolia
|
|
2255
|
-
},
|
|
2256
|
-
mainnet: {
|
|
2257
|
-
name: "Starknet",
|
|
2258
|
-
chainId: 0,
|
|
2259
|
-
wormholeChainId: 50001,
|
|
2260
|
-
rpcUrl: "https://starknet-mainnet.public.blastapi.io/rpc/v0_7",
|
|
2261
|
-
explorerUrl: "https://starkscan.co",
|
|
2262
|
-
isEvm: false,
|
|
2263
|
-
contracts: {
|
|
2264
|
-
// TODO: Deploy mainnet contracts
|
|
2265
|
-
wormholeCoreBridge: ""
|
|
2266
|
-
}
|
|
2267
|
-
}
|
|
2268
|
-
},
|
|
2269
|
-
// ────────────────────────────────────────────────────────────────────────
|
|
2270
|
-
// STACKS
|
|
2271
|
-
// ────────────────────────────────────────────────────────────────────────
|
|
2272
|
-
stacks: {
|
|
2273
|
-
displayName: "Stacks",
|
|
2274
|
-
type: "stacks",
|
|
2275
|
-
canBeHub: false,
|
|
2276
|
-
testnet: {
|
|
2277
|
-
name: "Stacks Testnet",
|
|
2278
|
-
chainId: 2147483648,
|
|
2279
|
-
// CAIP-2: stacks:2147483648
|
|
2280
|
-
wormholeChainId: 60,
|
|
2281
|
-
// Official Wormhole chain ID for Stacks
|
|
2282
|
-
rpcUrl: "https://api.testnet.hiro.so",
|
|
2283
|
-
explorerUrl: "https://explorer.hiro.so/?chain=testnet",
|
|
2284
|
-
isEvm: false,
|
|
2285
|
-
contracts: {
|
|
2286
|
-
// Spoke contract: identity + session management
|
|
2287
|
-
hub: "STWJ9E8J5NPKB4MT1378G6XWNFGAKRY1E6D6PYSM.veridex-spoke",
|
|
2288
|
-
// Vault contract: STX/sBTC custody
|
|
2289
|
-
vaultFactory: "STWJ9E8J5NPKB4MT1378G6XWNFGAKRY1E6D6PYSM.veridex-vault",
|
|
2290
|
-
wormholeCoreBridge: "",
|
|
2291
|
-
// Phase 2: Wormhole integration contracts
|
|
2292
|
-
wormholeVerifier: "STWJ9E8J5NPKB4MT1378G6XWNFGAKRY1E6D6PYSM.veridex-wormhole-verifier",
|
|
2293
|
-
vaultVaa: "STWJ9E8J5NPKB4MT1378G6XWNFGAKRY1E6D6PYSM.veridex-vault-vaa"
|
|
2294
|
-
},
|
|
2295
|
-
hubChainId: 10004
|
|
2296
|
-
// Base Sepolia
|
|
2297
|
-
},
|
|
2298
|
-
mainnet: {
|
|
2299
|
-
name: "Stacks",
|
|
2300
|
-
chainId: 1,
|
|
2301
|
-
// CAIP-2: stacks:1
|
|
2302
|
-
wormholeChainId: 60,
|
|
2303
|
-
rpcUrl: "https://api.hiro.so",
|
|
2304
|
-
explorerUrl: "https://explorer.hiro.so",
|
|
2305
|
-
isEvm: false,
|
|
2306
|
-
contracts: {
|
|
2307
|
-
// TODO: Deploy mainnet contracts
|
|
2308
|
-
wormholeCoreBridge: ""
|
|
2309
|
-
}
|
|
2310
|
-
}
|
|
2311
|
-
},
|
|
2312
|
-
// ────────────────────────────────────────────────────────────────────────
|
|
2313
|
-
// NEAR
|
|
2314
|
-
// ────────────────────────────────────────────────────────────────────────
|
|
2315
|
-
near: {
|
|
2316
|
-
displayName: "Near",
|
|
2317
|
-
type: "near",
|
|
2318
|
-
canBeHub: false,
|
|
2319
|
-
testnet: {
|
|
2320
|
-
name: "Near Testnet",
|
|
2321
|
-
chainId: 0,
|
|
2322
|
-
wormholeChainId: 15,
|
|
2323
|
-
rpcUrl: "https://rpc.testnet.near.org",
|
|
2324
|
-
explorerUrl: "https://explorer.testnet.near.org",
|
|
2325
|
-
isEvm: false,
|
|
2326
|
-
contracts: {
|
|
2327
|
-
wormholeCoreBridge: "wormhole.wormhole.testnet",
|
|
2328
|
-
tokenBridge: "token.wormhole.testnet"
|
|
2329
|
-
}
|
|
2330
|
-
},
|
|
2331
|
-
mainnet: {
|
|
2332
|
-
name: "Near",
|
|
2333
|
-
chainId: 0,
|
|
2334
|
-
wormholeChainId: 15,
|
|
2335
|
-
rpcUrl: "https://rpc.mainnet.near.org",
|
|
2336
|
-
explorerUrl: "https://explorer.near.org",
|
|
2337
|
-
isEvm: false,
|
|
2338
|
-
contracts: {
|
|
2339
|
-
wormholeCoreBridge: "contract.wormhole_crypto.near",
|
|
2340
|
-
tokenBridge: "contract.portalbridge.near"
|
|
2341
|
-
}
|
|
2342
|
-
}
|
|
2343
|
-
}
|
|
2344
|
-
};
|
|
2345
|
-
function getDefaultHub(network = "testnet") {
|
|
2346
|
-
const primary = getEffectivePrimaryHub();
|
|
2347
|
-
return CHAIN_PRESETS[primary][network];
|
|
1130
|
+
function buildGaslessChallenge(input) {
|
|
1131
|
+
if (!Number.isInteger(input.targetChain) || input.targetChain < 0 || input.targetChain > 65535) {
|
|
1132
|
+
throw new Error("targetChain must fit in uint16");
|
|
1133
|
+
}
|
|
1134
|
+
return buildCanonicalChallenge({
|
|
1135
|
+
veridexChainId: input.veridexChainId,
|
|
1136
|
+
executor: input.executor,
|
|
1137
|
+
minTier: input.minTier,
|
|
1138
|
+
nonce: input.nonce,
|
|
1139
|
+
actionHash: import_ethers3.ethers.keccak256(input.actionPayload)
|
|
1140
|
+
});
|
|
2348
1141
|
}
|
|
2349
1142
|
|
|
2350
1143
|
// src/auth/prepareAuth.ts
|
|
2351
|
-
function resolveNetwork2() {
|
|
2352
|
-
const envCandidates = [
|
|
2353
|
-
globalThis?.process?.env?.NEXT_PUBLIC_VERIDEX_NETWORK,
|
|
2354
|
-
globalThis?.process?.env?.VERIDEX_NETWORK,
|
|
2355
|
-
globalThis?.process?.env?.NEXT_PUBLIC_WORMHOLE_NETWORK,
|
|
2356
|
-
globalThis?.process?.env?.WORMHOLE_NETWORK
|
|
2357
|
-
].filter(Boolean);
|
|
2358
|
-
const env = envCandidates[0]?.toLowerCase();
|
|
2359
|
-
if (env === "mainnet" || env === "testnet") return env;
|
|
2360
|
-
return "testnet";
|
|
2361
|
-
}
|
|
2362
|
-
function getHubChainId(network) {
|
|
2363
|
-
return getDefaultHub(network).wormholeChainId;
|
|
2364
|
-
}
|
|
2365
|
-
function getHubRpcUrl(network) {
|
|
2366
|
-
return getDefaultHub(network).rpcUrl;
|
|
2367
|
-
}
|
|
2368
|
-
function getHubAddress(network) {
|
|
2369
|
-
const hub = getDefaultHub(network).contracts.hub;
|
|
2370
|
-
if (!hub) {
|
|
2371
|
-
throw new Error("Hub address missing in SDK constants");
|
|
2372
|
-
}
|
|
2373
|
-
return hub;
|
|
2374
|
-
}
|
|
2375
1144
|
function encodeActionPayload(action, targetChain) {
|
|
2376
1145
|
if (action.token !== void 0 && action.recipient !== void 0) {
|
|
2377
1146
|
const a2 = action;
|
|
@@ -2384,68 +1153,21 @@ function encodeActionPayload(action, targetChain) {
|
|
|
2384
1153
|
const a = action;
|
|
2385
1154
|
return encodeBridgeAction(a.token, a.amount, targetChain, a.recipient);
|
|
2386
1155
|
}
|
|
2387
|
-
async function fetchNonceViaRpc(userKeyHash, network) {
|
|
2388
|
-
const rpcUrl = getHubRpcUrl(network);
|
|
2389
|
-
const hubAddress = getHubAddress(network);
|
|
2390
|
-
const provider = new import_ethers5.ethers.JsonRpcProvider(rpcUrl);
|
|
2391
|
-
const hubIface = new import_ethers5.ethers.Interface([
|
|
2392
|
-
"function getNonce(bytes32 userKeyHash) external view returns (uint256)",
|
|
2393
|
-
"function userNonces(bytes32 userKeyHash) external view returns (uint256)"
|
|
2394
|
-
]);
|
|
2395
|
-
const calls = [
|
|
2396
|
-
async () => {
|
|
2397
|
-
const data = hubIface.encodeFunctionData("getNonce", [userKeyHash]);
|
|
2398
|
-
const res = await provider.call({ to: hubAddress, data });
|
|
2399
|
-
const decoded = hubIface.decodeFunctionResult("getNonce", res);
|
|
2400
|
-
return decoded[0];
|
|
2401
|
-
},
|
|
2402
|
-
async () => {
|
|
2403
|
-
const data = hubIface.encodeFunctionData("userNonces", [userKeyHash]);
|
|
2404
|
-
const res = await provider.call({ to: hubAddress, data });
|
|
2405
|
-
const decoded = hubIface.decodeFunctionResult("userNonces", res);
|
|
2406
|
-
return decoded[0];
|
|
2407
|
-
}
|
|
2408
|
-
];
|
|
2409
|
-
let lastErr;
|
|
2410
|
-
for (const fn of calls) {
|
|
2411
|
-
try {
|
|
2412
|
-
return await fn();
|
|
2413
|
-
} catch (e) {
|
|
2414
|
-
lastErr = e;
|
|
2415
|
-
}
|
|
2416
|
-
}
|
|
2417
|
-
throw lastErr instanceof Error ? lastErr : new Error(String(lastErr));
|
|
2418
|
-
}
|
|
2419
1156
|
function toHex32(value) {
|
|
2420
1157
|
return "0x" + value.toString(16).padStart(64, "0");
|
|
2421
1158
|
}
|
|
2422
|
-
async function authenticateAndPrepare(userParams
|
|
2423
|
-
const network = resolveNetwork2();
|
|
2424
|
-
const hubChainId = getHubChainId(network);
|
|
1159
|
+
async function authenticateAndPrepare(userParams) {
|
|
2425
1160
|
const actionPayload = userParams.actionPayload ?? (userParams.action ? encodeActionPayload(userParams.action, userParams.targetChain) : void 0);
|
|
2426
1161
|
if (!actionPayload) {
|
|
2427
1162
|
throw new Error("Missing action payload: provide either actionPayload or action");
|
|
2428
1163
|
}
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
}
|
|
2437
|
-
const state = await queryHubState(userParams.credential.keyHash, apiKey, { network, maxAge: 60 });
|
|
2438
|
-
if (!state.isRegistered) {
|
|
2439
|
-
throw new Error("Passkey is not registered on Hub");
|
|
2440
|
-
}
|
|
2441
|
-
nonce = state.nonce;
|
|
2442
|
-
queryProof = state.proof;
|
|
2443
|
-
} catch {
|
|
2444
|
-
nonce = await fetchNonceViaRpc(userParams.credential.keyHash, network);
|
|
2445
|
-
queryProof = new Uint8Array();
|
|
2446
|
-
}
|
|
2447
|
-
const queryLatencyMs = Date.now() - queryStart;
|
|
2448
|
-
const challenge = buildGaslessChallenge(userParams.targetChain, actionPayload, nonce, hubChainId);
|
|
1164
|
+
const nonce = userParams.nonce;
|
|
1165
|
+
const queryProof = new Uint8Array();
|
|
1166
|
+
const challenge = buildGaslessChallenge({
|
|
1167
|
+
...userParams.destination,
|
|
1168
|
+
actionPayload,
|
|
1169
|
+
nonce
|
|
1170
|
+
});
|
|
2449
1171
|
const passkey = new PasskeyManager();
|
|
2450
1172
|
passkey.setCredential(userParams.credential);
|
|
2451
1173
|
const signature = await passkey.sign(challenge);
|
|
@@ -2459,19 +1181,18 @@ async function authenticateAndPrepare(userParams, apiKey) {
|
|
|
2459
1181
|
publicKeyX: toHex32(userParams.credential.publicKeyX),
|
|
2460
1182
|
publicKeyY: toHex32(userParams.credential.publicKeyY),
|
|
2461
1183
|
targetChain: userParams.targetChain,
|
|
1184
|
+
veridexChainId: userParams.destination.veridexChainId,
|
|
1185
|
+
executor: userParams.destination.executor,
|
|
1186
|
+
minTier: userParams.destination.minTier,
|
|
2462
1187
|
actionPayload,
|
|
2463
|
-
nonce:
|
|
1188
|
+
nonce: nonce.toString()
|
|
2464
1189
|
};
|
|
2465
|
-
if (queryProof.length) {
|
|
2466
|
-
requestBody.queryProof = import_ethers5.ethers.hexlify(queryProof);
|
|
2467
|
-
}
|
|
2468
1190
|
const serializedTx = new TextEncoder().encode(JSON.stringify(requestBody));
|
|
2469
|
-
const estimatedLatency = queryProof.length ? Math.max(250, queryLatencyMs) : Math.max(800, queryLatencyMs);
|
|
2470
1191
|
return {
|
|
2471
1192
|
serializedTx,
|
|
2472
1193
|
queryProof,
|
|
2473
|
-
estimatedLatency,
|
|
2474
|
-
fallbackAvailable
|
|
1194
|
+
estimatedLatency: 0,
|
|
1195
|
+
fallbackAvailable: false
|
|
2475
1196
|
};
|
|
2476
1197
|
}
|
|
2477
1198
|
// Annotate the CommonJS export names for ESM import in node:
|