@humanode-hyperlane/cli 30.0.0-humanode.1 → 1045.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/README.md +1 -1
- package/bundle/154.index.js +462 -0
- package/bundle/230.index.js +572 -0
- package/bundle/25.index.js +9569 -0
- package/bundle/{214.index.js → 308.index.js} +192 -88
- package/bundle/367.index.js +4 -0
- package/bundle/461.index.js +49 -0
- package/bundle/505.index.js +126369 -0
- package/bundle/529.index.js +3603 -0
- package/bundle/576.index.js +36 -0
- package/bundle/610.index.js +86 -0
- package/bundle/628.index.js +152 -0
- package/bundle/633.index.js +86 -0
- package/bundle/697.index.js +410 -0
- package/bundle/{30fb121a258f7502fa97.js → 7183ea1c1bf0a5da980d.js} +1 -1
- package/bundle/748.index.js +674 -0
- package/bundle/78.index.js +372 -0
- package/bundle/787.index.js +175 -0
- package/bundle/841.index.js +2093 -0
- package/bundle/{172.index.js → 848.index.js} +779 -915
- package/bundle/868.index.js +460 -0
- package/bundle/902.index.js +173 -0
- package/bundle/956.index.js +9901 -0
- package/bundle/aleo_wasm.wasm +0 -0
- package/bundle/aleo_wasm1.wasm +0 -0
- package/bundle/build/Release/bigint_buffer.node +0 -0
- package/bundle/index.js +2 -2
- package/bundle/worker2.js +9123 -3469
- package/bundle/worker3.js +9109 -3455
- package/examples/layerzero/layerzero-warp-route.yaml +91 -0
- package/examples/sealevel/core-config-composite-ism.yaml +21 -0
- package/examples/sealevel/igp-hook-config.yaml +13 -0
- package/examples/sealevel/warp-config-routing-message-id-multisig-ism.yaml +21 -0
- package/examples/warp-base.yaml +24 -0
- package/examples/warp-config-predicate-mainnet.yaml +14 -0
- package/examples/warp-deployed-predicate-mainnet.yaml +19 -0
- package/examples/warp-ethereum.yaml +19 -0
- package/examples/wormhole/wormhole-warp-route.yaml +46 -0
- package/package.json +35 -28
- package/bundle/100.index.js +0 -1453
- package/bundle/12.index.js +0 -91
- package/bundle/213.index.js +0 -901
- package/bundle/306.index.js +0 -1037
- package/bundle/467.index.js +0 -222
- package/bundle/485.index.js +0 -85430
- package/bundle/515.index.js +0 -5191
- package/bundle/544.index.js +0 -792
- package/bundle/617.index.js +0 -1612
- package/bundle/660.index.js +0 -223
- package/bundle/688.index.js +0 -232
- package/bundle/756.index.js +0 -8595
- package/bundle/824.index.js +0 -385
- package/bundle/95.index.js +0 -264
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export const id =
|
|
2
|
-
export const ids = [
|
|
1
|
+
export const id = 848;
|
|
2
|
+
export const ids = [848];
|
|
3
3
|
export const modules = {
|
|
4
4
|
|
|
5
|
-
/***/
|
|
5
|
+
/***/ 80848:
|
|
6
6
|
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
7
7
|
|
|
8
8
|
|
|
@@ -11,22 +11,24 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
11
11
|
StarknetProtocolProvider: () => (/* reexport */ StarknetProtocolProvider)
|
|
12
12
|
});
|
|
13
13
|
|
|
14
|
-
// UNUSED EXPORTS:
|
|
14
|
+
// UNUSED EXPORTS: StarknetProvider, StarknetSigner
|
|
15
15
|
|
|
16
16
|
// EXTERNAL MODULE: ../utils/dist/validation.js
|
|
17
17
|
var validation = __webpack_require__(21387);
|
|
18
|
-
// EXTERNAL MODULE: ../provider-sdk/dist/index.js +
|
|
19
|
-
var dist = __webpack_require__(
|
|
18
|
+
// EXTERNAL MODULE: ../provider-sdk/dist/index.js + 5 modules
|
|
19
|
+
var dist = __webpack_require__(75859);
|
|
20
20
|
// EXTERNAL MODULE: ../provider-sdk/dist/hook.js
|
|
21
21
|
var hook = __webpack_require__(77230);
|
|
22
|
-
// EXTERNAL MODULE: ../../node_modules/.pnpm/starknet@
|
|
23
|
-
var starknet_dist = __webpack_require__(
|
|
24
|
-
// EXTERNAL MODULE:
|
|
25
|
-
var
|
|
26
|
-
// EXTERNAL MODULE:
|
|
27
|
-
var
|
|
22
|
+
// EXTERNAL MODULE: ../../node_modules/.pnpm/starknet@8.9.2/node_modules/starknet/dist/index.mjs + 47 modules
|
|
23
|
+
var starknet_dist = __webpack_require__(20162);
|
|
24
|
+
// EXTERNAL MODULE: ../provider-sdk/dist/warp.js
|
|
25
|
+
var warp = __webpack_require__(17791);
|
|
26
|
+
// EXTERNAL MODULE: ../../starknet/dist/runtime.js + 98 modules
|
|
27
|
+
var runtime = __webpack_require__(69334);
|
|
28
28
|
// EXTERNAL MODULE: ../utils/dist/typeof.js
|
|
29
29
|
var dist_typeof = __webpack_require__(73689);
|
|
30
|
+
// EXTERNAL MODULE: ../utils/dist/addresses.js
|
|
31
|
+
var addresses = __webpack_require__(93142);
|
|
30
32
|
// EXTERNAL MODULE: ../utils/dist/logging.js
|
|
31
33
|
var logging = __webpack_require__(94523);
|
|
32
34
|
;// CONCATENATED MODULE: ../starknet-sdk/dist/contracts.js
|
|
@@ -96,6 +98,8 @@ var StarknetContractName;
|
|
|
96
98
|
StarknetContractName["MESSAGE_ID_MULTISIG_ISM"] = "messageid_multisig_ism";
|
|
97
99
|
StarknetContractName["MERKLE_ROOT_MULTISIG_ISM"] = "merkleroot_multisig_ism";
|
|
98
100
|
StarknetContractName["ROUTING_ISM"] = "domain_routing_ism";
|
|
101
|
+
StarknetContractName["AGGREGATION_ISM"] = "aggregation";
|
|
102
|
+
StarknetContractName["PAUSABLE_ISM"] = "pausable_ism";
|
|
99
103
|
StarknetContractName["NOOP_ISM"] = "noop_ism";
|
|
100
104
|
StarknetContractName["HOOK"] = "hook";
|
|
101
105
|
StarknetContractName["MERKLE_TREE_HOOK"] = "merkle_tree_hook";
|
|
@@ -112,11 +116,14 @@ const STARKNET_DEFAULT_FEE_TOKEN_ADDRESSES = {
|
|
|
112
116
|
paradex: '0x7348407ebad690fec0cc8597e87dc16ef7b269a655ff72587dafff83d462be2',
|
|
113
117
|
paradexsepolia: '0x06f373b346561036d98ea10fb3e60d2f459c872b1933b50b21fe6ef4fda3b75e',
|
|
114
118
|
};
|
|
115
|
-
function getStarknetContract(contractName, address, providerOrAccount, contractType =
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
119
|
+
function getStarknetContract(contractName, address, providerOrAccount, contractType = runtime/* ContractType */.h$.CONTRACT) {
|
|
120
|
+
return new starknet_dist/* Contract */.NZ({
|
|
121
|
+
abi: (0,runtime/* getContractAbi */.fJ)(contractName, contractType),
|
|
122
|
+
address: contracts_normalizeStarknetAddressSafe(address),
|
|
123
|
+
providerOrAccount,
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
function contracts_normalizeStarknetAddressSafe(value) {
|
|
120
127
|
if (typeof value === 'string') {
|
|
121
128
|
if ((0,addresses/* isZeroishAddress */.Hi)(value))
|
|
122
129
|
return addresses/* ZERO_ADDRESS_HEX_32 */.qx;
|
|
@@ -130,13 +137,13 @@ function normalizeStarknetAddressSafe(value) {
|
|
|
130
137
|
return (0,starknet_dist/* addAddressPadding */.N6)((0,addresses/* ensure0x */.Ho)(starknet_dist/* uint256 */.iN.uint256ToBN(value).toString(16)));
|
|
131
138
|
}
|
|
132
139
|
if ('value' in value) {
|
|
133
|
-
return
|
|
140
|
+
return contracts_normalizeStarknetAddressSafe(value['value']);
|
|
134
141
|
}
|
|
135
142
|
}
|
|
136
143
|
throw new Error(`Unable to normalize Starknet address: ${describeUnknown(value) || '[unsupported value]'}`);
|
|
137
144
|
}
|
|
138
145
|
function addressToEvmAddress(value) {
|
|
139
|
-
return (0,addresses/* bytes32ToAddress */.ov)(
|
|
146
|
+
return (0,addresses/* bytes32ToAddress */.ov)(contracts_normalizeStarknetAddressSafe(value));
|
|
140
147
|
}
|
|
141
148
|
async function callContract(contract, method, args = []) {
|
|
142
149
|
(0,validation/* assert */.v)(hasAbiMethod(contract, method), `Unable to call ${method} on contract ${contract.address}: method not found in ABI`);
|
|
@@ -162,7 +169,7 @@ async function populateInvokeTx(contract, method, args = []) {
|
|
|
162
169
|
if (isPopulatedInvokeTx(tx)) {
|
|
163
170
|
return {
|
|
164
171
|
kind: 'invoke',
|
|
165
|
-
contractAddress:
|
|
172
|
+
contractAddress: contracts_normalizeStarknetAddressSafe(tx.contractAddress),
|
|
166
173
|
entrypoint: tx.entrypoint,
|
|
167
174
|
calldata: tx.calldata ?? [],
|
|
168
175
|
};
|
|
@@ -171,7 +178,7 @@ async function populateInvokeTx(contract, method, args = []) {
|
|
|
171
178
|
const abi = getContractAbi(contract);
|
|
172
179
|
return {
|
|
173
180
|
kind: 'invoke',
|
|
174
|
-
contractAddress:
|
|
181
|
+
contractAddress: contracts_normalizeStarknetAddressSafe(contract.address),
|
|
175
182
|
entrypoint: method,
|
|
176
183
|
calldata: abi ? new starknet_dist/* CallData */.fP(abi).compile(method, args) : args,
|
|
177
184
|
};
|
|
@@ -245,17 +252,17 @@ function toBigInt(value) {
|
|
|
245
252
|
}
|
|
246
253
|
function getFeeTokenAddress(params) {
|
|
247
254
|
if (params.nativeDenom && !(0,addresses/* isZeroishAddress */.Hi)(params.nativeDenom)) {
|
|
248
|
-
return
|
|
255
|
+
return contracts_normalizeStarknetAddressSafe(params.nativeDenom);
|
|
249
256
|
}
|
|
250
257
|
const token = STARKNET_DEFAULT_FEE_TOKEN_ADDRESSES[params.chainName];
|
|
251
258
|
(0,validation/* assert */.v)(token, `Missing Starknet fee token for chain ${params.chainName}`);
|
|
252
|
-
return
|
|
259
|
+
return contracts_normalizeStarknetAddressSafe(token);
|
|
253
260
|
}
|
|
254
261
|
function normalizeRoutersAddress(value) {
|
|
255
262
|
if (isUint256Like(value)) {
|
|
256
|
-
return
|
|
263
|
+
return contracts_normalizeStarknetAddressSafe(starknet_dist/* num */.bu.toHex(starknet_dist/* uint256 */.iN.uint256ToBN(value)));
|
|
257
264
|
}
|
|
258
|
-
return
|
|
265
|
+
return contracts_normalizeStarknetAddressSafe(value);
|
|
259
266
|
}
|
|
260
267
|
/**
|
|
261
268
|
* Creates a Contract instance using the on-chain ABI fetched from the provider.
|
|
@@ -266,14 +273,22 @@ function normalizeRoutersAddress(value) {
|
|
|
266
273
|
* and Cairo 0 proxies (`implementation` returning a felt).
|
|
267
274
|
*/
|
|
268
275
|
async function getOnChainStarknetContract(provider, address) {
|
|
269
|
-
const normalized =
|
|
276
|
+
const normalized = contracts_normalizeStarknetAddressSafe(address);
|
|
270
277
|
const { abi } = await provider.getClassAt(normalized);
|
|
271
|
-
const contract = new starknet_dist/* Contract */.NZ(
|
|
278
|
+
const contract = new starknet_dist/* Contract */.NZ({
|
|
279
|
+
abi,
|
|
280
|
+
address: normalized,
|
|
281
|
+
providerOrAccount: provider,
|
|
282
|
+
});
|
|
272
283
|
const implHash = await resolveImplementationHash(contract);
|
|
273
284
|
if ((0,dist_typeof/* isNullish */.u)(implHash) || implHash === 0n)
|
|
274
285
|
return contract;
|
|
275
286
|
const implClass = await provider.getClassByHash(`0x${implHash.toString(16)}`);
|
|
276
|
-
return new starknet_dist/* Contract */.NZ(
|
|
287
|
+
return new starknet_dist/* Contract */.NZ({
|
|
288
|
+
abi: implClass.abi,
|
|
289
|
+
address: normalized,
|
|
290
|
+
providerOrAccount: provider,
|
|
291
|
+
});
|
|
277
292
|
}
|
|
278
293
|
async function resolveImplementationHash(contract) {
|
|
279
294
|
try {
|
|
@@ -339,29 +354,76 @@ function shouldFallbackStorageRead(error) {
|
|
|
339
354
|
const normalizedMessage = message.toLowerCase();
|
|
340
355
|
return STORAGE_READ_FALLBACK_MESSAGES.some((fragment) => normalizedMessage.includes(fragment));
|
|
341
356
|
}
|
|
357
|
+
function isProbeMiss(error) {
|
|
358
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
359
|
+
return [
|
|
360
|
+
'entry point',
|
|
361
|
+
'entrypoint',
|
|
362
|
+
'viewable method not found in abi',
|
|
363
|
+
'not found in abi',
|
|
364
|
+
'not found in contract',
|
|
365
|
+
'invalid message selector',
|
|
366
|
+
].some((needle) => message.toLowerCase().includes(needle));
|
|
367
|
+
}
|
|
342
368
|
//# sourceMappingURL=contracts.js.map
|
|
369
|
+
;// CONCATENATED MODULE: ../starknet-sdk/dist/mailbox/mailbox-query.js
|
|
370
|
+
|
|
371
|
+
async function getMailboxConfig(provider, mailboxAddress) {
|
|
372
|
+
const mailbox = getStarknetContract(StarknetContractName.MAILBOX, mailboxAddress, provider);
|
|
373
|
+
const [owner, localDomain, defaultIsm, defaultHook, requiredHook, nonce] = await Promise.all([
|
|
374
|
+
callContract(mailbox, 'owner'),
|
|
375
|
+
callContract(mailbox, 'get_local_domain'),
|
|
376
|
+
callContract(mailbox, 'get_default_ism'),
|
|
377
|
+
callContract(mailbox, 'get_default_hook'),
|
|
378
|
+
callContract(mailbox, 'get_required_hook'),
|
|
379
|
+
callContract(mailbox, 'nonce'),
|
|
380
|
+
]);
|
|
381
|
+
return {
|
|
382
|
+
address: contracts_normalizeStarknetAddressSafe(mailboxAddress),
|
|
383
|
+
owner: contracts_normalizeStarknetAddressSafe(owner),
|
|
384
|
+
localDomain: toNumber(localDomain),
|
|
385
|
+
defaultIsm: contracts_normalizeStarknetAddressSafe(defaultIsm),
|
|
386
|
+
defaultHook: contracts_normalizeStarknetAddressSafe(defaultHook),
|
|
387
|
+
requiredHook: contracts_normalizeStarknetAddressSafe(requiredHook),
|
|
388
|
+
nonce: toNumber(nonce),
|
|
389
|
+
};
|
|
390
|
+
}
|
|
391
|
+
async function isMessageDelivered(provider, mailboxAddress, messageId) {
|
|
392
|
+
const mailbox = getStarknetContract(StarknetContractName.MAILBOX, mailboxAddress, provider);
|
|
393
|
+
const delivered = await callContract(mailbox, 'delivered', [messageId]);
|
|
394
|
+
if (typeof delivered === 'boolean')
|
|
395
|
+
return delivered;
|
|
396
|
+
return toBigInt(delivered) !== 0n;
|
|
397
|
+
}
|
|
398
|
+
//# sourceMappingURL=mailbox-query.js.map
|
|
343
399
|
;// CONCATENATED MODULE: ../starknet-sdk/dist/clients/provider.js
|
|
344
400
|
|
|
345
401
|
|
|
346
402
|
|
|
347
403
|
|
|
348
404
|
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
const RPC_V08_PATH_REGEX = /\/rpc\/v0_8(?:\/|$)/i;
|
|
349
408
|
let tokenTypeByClassHash;
|
|
409
|
+
function getRpcSpecVersion(rpcUrl) {
|
|
410
|
+
return RPC_V08_PATH_REGEX.test(new URL(rpcUrl).pathname) ? '0.8.1' : '0.9.0';
|
|
411
|
+
}
|
|
350
412
|
function getTokenTypeByClassHash() {
|
|
351
413
|
if (tokenTypeByClassHash) {
|
|
352
414
|
return tokenTypeByClassHash;
|
|
353
415
|
}
|
|
354
416
|
const entries = [
|
|
355
417
|
[
|
|
356
|
-
|
|
418
|
+
(0,runtime/* getContractClassHash */.Vd)(StarknetContractName.HYP_ERC20, runtime/* ContractType */.h$.TOKEN),
|
|
357
419
|
dist/* AltVM.TokenType */.bx.ks.synthetic,
|
|
358
420
|
],
|
|
359
421
|
[
|
|
360
|
-
|
|
422
|
+
(0,runtime/* getContractClassHash */.Vd)(StarknetContractName.HYP_ERC20_COLLATERAL, runtime/* ContractType */.h$.TOKEN),
|
|
361
423
|
dist/* AltVM.TokenType */.bx.ks.collateral,
|
|
362
424
|
],
|
|
363
425
|
[
|
|
364
|
-
|
|
426
|
+
(0,runtime/* getContractClassHash */.Vd)(StarknetContractName.HYP_NATIVE, runtime/* ContractType */.h$.TOKEN),
|
|
365
427
|
dist/* AltVM.TokenType */.bx.ks.native,
|
|
366
428
|
],
|
|
367
429
|
];
|
|
@@ -371,26 +433,40 @@ function getTokenTypeByClassHash() {
|
|
|
371
433
|
]));
|
|
372
434
|
return tokenTypeByClassHash;
|
|
373
435
|
}
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
436
|
+
// Warp-deploy cost breakdown for Starknet. Composed additively in
|
|
437
|
+
// getMinGasForWarpDeploy() based on the WarpConfig shape. Values are native
|
|
438
|
+
// denom (fri, 18 decimals).
|
|
439
|
+
//
|
|
440
|
+
// The base is a devnet-observed base-router deploy floor with safety margin;
|
|
441
|
+
// mainnet gas prices differ, so treat it as a lower-bound advisory. Per-feature
|
|
442
|
+
// deltas stay 0n pending measured feature-heavy deploys.
|
|
443
|
+
const WARP_DEPLOY_BASE_FRI = 10000000000000000000n; // 10 STRK base router deploy
|
|
444
|
+
const WARP_DEPLOY_CROSS_COLLATERAL_EXTRA_FRI = 0n; // + crossCollateral router extras
|
|
445
|
+
const WARP_DEPLOY_FEE_PROGRAM_FRI = 0n; // + fee program (config.fee object)
|
|
446
|
+
const WARP_DEPLOY_CUSTOM_ISM_FRI = 0n; // + custom ISM (config.interchainSecurityModule object)
|
|
447
|
+
const WARP_DEPLOY_CUSTOM_HOOK_FRI = 0n; // + custom hook / IGP (config.hook object)
|
|
385
448
|
class StarknetProvider {
|
|
386
449
|
provider;
|
|
387
450
|
metadata;
|
|
388
451
|
rpcUrls;
|
|
389
|
-
static connect(
|
|
390
|
-
(
|
|
391
|
-
const
|
|
392
|
-
(0,validation/* assert */.v)(
|
|
393
|
-
const
|
|
452
|
+
static connect(metadata) {
|
|
453
|
+
const rpcUrls = (metadata.rpcUrls ?? []).map(({ http }) => http);
|
|
454
|
+
const rpcUrl = rpcUrls[0];
|
|
455
|
+
(0,validation/* assert */.v)(rpcUrl, 'at least one rpc url is required');
|
|
456
|
+
const blockTime = metadata.blocks?.estimateBlockTime;
|
|
457
|
+
const transactionRetryIntervalFallback = !(0,dist_typeof/* isNullish */.u)(blockTime) && blockTime <= 1 ? 1000 : undefined;
|
|
458
|
+
const provider = new starknet_dist/* RpcProvider */.bd({
|
|
459
|
+
nodeUrl: rpcUrl,
|
|
460
|
+
// starknet.js v8 defaults to RPC 0.9, whose receipt parser does not
|
|
461
|
+
// recognize the REJECTED finality status returned by RPC 0.8 endpoints.
|
|
462
|
+
specVersion: getRpcSpecVersion(rpcUrl),
|
|
463
|
+
transactionRetryIntervalFallback,
|
|
464
|
+
// Default reads to the latest accepted block instead of starknet.js's
|
|
465
|
+
// `pending` default. Some RPC providers reject `block_id: "pending"`
|
|
466
|
+
// (-32602 Invalid block id), and reading already-finalized state at
|
|
467
|
+
// `latest` is both universally supported and semantically correct.
|
|
468
|
+
blockIdentifier: starknet_dist/* BlockTag */.Ys.LATEST,
|
|
469
|
+
});
|
|
394
470
|
return new StarknetProvider(provider, metadata, rpcUrls);
|
|
395
471
|
}
|
|
396
472
|
constructor(provider, metadata, rpcUrls) {
|
|
@@ -398,6 +474,15 @@ class StarknetProvider {
|
|
|
398
474
|
this.metadata = metadata;
|
|
399
475
|
this.rpcUrls = rpcUrls;
|
|
400
476
|
}
|
|
477
|
+
async getMinGasForWarpDeploy(warpConfig) {
|
|
478
|
+
return (0,warp/* composeWarpDeployGas */.vm)(warpConfig, {
|
|
479
|
+
base: WARP_DEPLOY_BASE_FRI,
|
|
480
|
+
crossCollateralExtra: WARP_DEPLOY_CROSS_COLLATERAL_EXTRA_FRI,
|
|
481
|
+
feeProgram: WARP_DEPLOY_FEE_PROGRAM_FRI,
|
|
482
|
+
customIsm: WARP_DEPLOY_CUSTOM_ISM_FRI,
|
|
483
|
+
customHook: WARP_DEPLOY_CUSTOM_HOOK_FRI,
|
|
484
|
+
});
|
|
485
|
+
}
|
|
401
486
|
getRawProvider() {
|
|
402
487
|
return this.provider;
|
|
403
488
|
}
|
|
@@ -413,11 +498,15 @@ class StarknetProvider {
|
|
|
413
498
|
nativeDenom: this.metadata.nativeToken?.denom,
|
|
414
499
|
});
|
|
415
500
|
}
|
|
501
|
+
getFeeTokenAddress() {
|
|
502
|
+
return this.feeTokenAddress;
|
|
503
|
+
}
|
|
416
504
|
parseString(value) {
|
|
417
505
|
if (typeof value === 'string')
|
|
418
506
|
return value;
|
|
419
507
|
if (typeof value === 'number' || typeof value === 'bigint') {
|
|
420
508
|
try {
|
|
509
|
+
// oxlint-disable-next-line typescript/no-deprecated -- starknet.js v8 deprecates this but ships no public utility replacement.
|
|
421
510
|
return starknet_dist/* shortString */.Gm.decodeShortString((0,addresses/* ensure0x */.Ho)(BigInt(value).toString(16)));
|
|
422
511
|
}
|
|
423
512
|
catch {
|
|
@@ -442,7 +531,7 @@ class StarknetProvider {
|
|
|
442
531
|
const tx = await populateInvokeTx(contract, method, args);
|
|
443
532
|
(0,validation/* assert */.v)(tx.kind === 'invoke', 'Expected invoke Starknet transaction');
|
|
444
533
|
return {
|
|
445
|
-
contractAddress:
|
|
534
|
+
contractAddress: contracts_normalizeStarknetAddressSafe(tx.contractAddress),
|
|
446
535
|
entrypoint: tx.entrypoint,
|
|
447
536
|
calldata: tx.calldata,
|
|
448
537
|
};
|
|
@@ -454,13 +543,13 @@ class StarknetProvider {
|
|
|
454
543
|
return value;
|
|
455
544
|
}
|
|
456
545
|
async determineTokenType(tokenAddress) {
|
|
457
|
-
const address =
|
|
546
|
+
const address = contracts_normalizeStarknetAddressSafe(tokenAddress);
|
|
458
547
|
const classHash = await this.provider.getClassHashAt(address);
|
|
459
548
|
const tokenType = getTokenTypeByClassHash().get(BigInt(classHash).toString());
|
|
460
549
|
if (tokenType)
|
|
461
550
|
return tokenType;
|
|
462
551
|
try {
|
|
463
|
-
const collateral = this.withContract(StarknetContractName.HYP_ERC20_COLLATERAL, address, this.provider,
|
|
552
|
+
const collateral = this.withContract(StarknetContractName.HYP_ERC20_COLLATERAL, address, this.provider, runtime/* ContractType */.h$.TOKEN);
|
|
464
553
|
await callContract(collateral, 'get_wrapped_token');
|
|
465
554
|
return dist/* AltVM.TokenType */.bx.ks.collateral;
|
|
466
555
|
}
|
|
@@ -469,7 +558,7 @@ class StarknetProvider {
|
|
|
469
558
|
throw error;
|
|
470
559
|
}
|
|
471
560
|
try {
|
|
472
|
-
const native = this.withContract(StarknetContractName.HYP_NATIVE, address, this.provider,
|
|
561
|
+
const native = this.withContract(StarknetContractName.HYP_NATIVE, address, this.provider, runtime/* ContractType */.h$.TOKEN);
|
|
473
562
|
await callContract(native, 'native_token');
|
|
474
563
|
return dist/* AltVM.TokenType */.bx.ks.native;
|
|
475
564
|
}
|
|
@@ -487,15 +576,15 @@ class StarknetProvider {
|
|
|
487
576
|
async getTokenMetadata(tokenAddress) {
|
|
488
577
|
const nativeToken = this.metadata.nativeToken;
|
|
489
578
|
if (nativeToken?.denom &&
|
|
490
|
-
|
|
491
|
-
|
|
579
|
+
contracts_normalizeStarknetAddressSafe(tokenAddress) ===
|
|
580
|
+
contracts_normalizeStarknetAddressSafe(nativeToken.denom)) {
|
|
492
581
|
return {
|
|
493
582
|
name: nativeToken.name,
|
|
494
583
|
symbol: nativeToken.symbol,
|
|
495
584
|
decimals: nativeToken.decimals ?? 18,
|
|
496
585
|
};
|
|
497
586
|
}
|
|
498
|
-
const address =
|
|
587
|
+
const address = contracts_normalizeStarknetAddressSafe(tokenAddress);
|
|
499
588
|
const token = await getOnChainStarknetContract(this.provider, address);
|
|
500
589
|
const [name, symbol, decimals] = await Promise.all([
|
|
501
590
|
callContract(token, 'name'),
|
|
@@ -556,148 +645,41 @@ class StarknetProvider {
|
|
|
556
645
|
}
|
|
557
646
|
async getBalance(req) {
|
|
558
647
|
const tokenAddress = req.denom
|
|
559
|
-
?
|
|
648
|
+
? contracts_normalizeStarknetAddressSafe(req.denom)
|
|
560
649
|
: this.feeTokenAddress;
|
|
561
|
-
const token = this.withContract(StarknetContractName.ETHER, tokenAddress, this.provider,
|
|
650
|
+
const token = this.withContract(StarknetContractName.ETHER, tokenAddress, this.provider, runtime/* ContractType */.h$.TOKEN);
|
|
562
651
|
let balance;
|
|
563
652
|
try {
|
|
564
653
|
balance = await callContract(token, 'balanceOf', [
|
|
565
|
-
|
|
654
|
+
contracts_normalizeStarknetAddressSafe(req.address),
|
|
566
655
|
]);
|
|
567
656
|
}
|
|
568
657
|
catch (error) {
|
|
569
658
|
if (!isProbeMiss(error))
|
|
570
659
|
throw error;
|
|
571
660
|
balance = await callContract(token, 'balance_of', [
|
|
572
|
-
|
|
661
|
+
contracts_normalizeStarknetAddressSafe(req.address),
|
|
573
662
|
]);
|
|
574
663
|
}
|
|
575
664
|
return toBigInt(this.unwrapBalance(balance));
|
|
576
665
|
}
|
|
577
666
|
async getTotalSupply(req) {
|
|
578
667
|
const tokenAddress = req.denom
|
|
579
|
-
?
|
|
668
|
+
? contracts_normalizeStarknetAddressSafe(req.denom)
|
|
580
669
|
: this.feeTokenAddress;
|
|
581
|
-
const token = this.withContract(StarknetContractName.ETHER, tokenAddress, this.provider,
|
|
670
|
+
const token = this.withContract(StarknetContractName.ETHER, tokenAddress, this.provider, runtime/* ContractType */.h$.TOKEN);
|
|
582
671
|
return toBigInt(await callContract(token, 'total_supply'));
|
|
583
672
|
}
|
|
584
673
|
async estimateTransactionFee(_req) {
|
|
585
674
|
throw new Error('Starknet transaction fee estimation is unsupported without an account-backed signer');
|
|
586
675
|
}
|
|
587
|
-
// ### QUERY CORE ###
|
|
588
|
-
async getMailbox(req) {
|
|
589
|
-
const mailbox = this.withContract(StarknetContractName.MAILBOX, req.mailboxAddress);
|
|
590
|
-
const [owner, localDomain, defaultIsm, defaultHook, requiredHook, nonce] = await Promise.all([
|
|
591
|
-
callContract(mailbox, 'owner'),
|
|
592
|
-
callContract(mailbox, 'get_local_domain'),
|
|
593
|
-
callContract(mailbox, 'get_default_ism'),
|
|
594
|
-
callContract(mailbox, 'get_default_hook'),
|
|
595
|
-
callContract(mailbox, 'get_required_hook'),
|
|
596
|
-
callContract(mailbox, 'nonce'),
|
|
597
|
-
]);
|
|
598
|
-
return {
|
|
599
|
-
address: normalizeStarknetAddressSafe(req.mailboxAddress),
|
|
600
|
-
owner: normalizeStarknetAddressSafe(owner),
|
|
601
|
-
localDomain: toNumber(localDomain),
|
|
602
|
-
defaultIsm: normalizeStarknetAddressSafe(defaultIsm),
|
|
603
|
-
defaultHook: normalizeStarknetAddressSafe(defaultHook),
|
|
604
|
-
requiredHook: normalizeStarknetAddressSafe(requiredHook),
|
|
605
|
-
nonce: toNumber(nonce),
|
|
606
|
-
};
|
|
607
|
-
}
|
|
608
676
|
async isMessageDelivered(req) {
|
|
609
|
-
|
|
610
|
-
const delivered = await callContract(mailbox, 'delivered', [req.messageId]);
|
|
611
|
-
if (typeof delivered === 'boolean')
|
|
612
|
-
return delivered;
|
|
613
|
-
return toBigInt(delivered) !== 0n;
|
|
614
|
-
}
|
|
615
|
-
async getIsmType(req) {
|
|
616
|
-
try {
|
|
617
|
-
const ism = this.withContract(StarknetContractName.MERKLE_ROOT_MULTISIG_ISM, req.ismAddress);
|
|
618
|
-
const moduleType = await callContract(ism, 'module_type');
|
|
619
|
-
return this.parseIsmVariant(extractEnumVariant(moduleType));
|
|
620
|
-
}
|
|
621
|
-
catch (error) {
|
|
622
|
-
if (!isProbeMiss(error))
|
|
623
|
-
throw error;
|
|
624
|
-
return dist/* AltVM.IsmType */.bx.GO.CUSTOM;
|
|
625
|
-
}
|
|
626
|
-
}
|
|
627
|
-
async getMessageIdMultisigIsm(req) {
|
|
628
|
-
const ism = this.withContract(StarknetContractName.MESSAGE_ID_MULTISIG_ISM, req.ismAddress);
|
|
629
|
-
const [validators, threshold] = await Promise.all([
|
|
630
|
-
callContract(ism, 'get_validators'),
|
|
631
|
-
callContract(ism, 'get_threshold'),
|
|
632
|
-
]);
|
|
633
|
-
(0,validation/* assert */.v)(Array.isArray(validators), 'Expected Starknet validators array');
|
|
634
|
-
return {
|
|
635
|
-
address: normalizeStarknetAddressSafe(req.ismAddress),
|
|
636
|
-
threshold: toNumber(threshold),
|
|
637
|
-
validators: validators.map((v) => addressToEvmAddress(v)),
|
|
638
|
-
};
|
|
639
|
-
}
|
|
640
|
-
async getMerkleRootMultisigIsm(req) {
|
|
641
|
-
const ism = this.withContract(StarknetContractName.MERKLE_ROOT_MULTISIG_ISM, req.ismAddress);
|
|
642
|
-
const [validators, threshold] = await Promise.all([
|
|
643
|
-
callContract(ism, 'get_validators'),
|
|
644
|
-
callContract(ism, 'get_threshold'),
|
|
645
|
-
]);
|
|
646
|
-
(0,validation/* assert */.v)(Array.isArray(validators), 'Expected Starknet validators array');
|
|
647
|
-
return {
|
|
648
|
-
address: normalizeStarknetAddressSafe(req.ismAddress),
|
|
649
|
-
threshold: toNumber(threshold),
|
|
650
|
-
validators: validators.map((v) => addressToEvmAddress(v)),
|
|
651
|
-
};
|
|
652
|
-
}
|
|
653
|
-
async getRoutingIsm(req) {
|
|
654
|
-
const ism = this.withContract(StarknetContractName.ROUTING_ISM, req.ismAddress);
|
|
655
|
-
const [owner, domains] = await Promise.all([
|
|
656
|
-
callContract(ism, 'owner'),
|
|
657
|
-
callContract(ism, 'domains'),
|
|
658
|
-
]);
|
|
659
|
-
(0,validation/* assert */.v)(Array.isArray(domains), 'Expected Starknet routing domains array');
|
|
660
|
-
const routes = await Promise.all(domains.map(async (domainId) => {
|
|
661
|
-
const routeAddress = await callContract(ism, 'module', [domainId]);
|
|
662
|
-
return {
|
|
663
|
-
domainId: toNumber(domainId),
|
|
664
|
-
ismAddress: normalizeStarknetAddressSafe(routeAddress),
|
|
665
|
-
};
|
|
666
|
-
}));
|
|
667
|
-
return {
|
|
668
|
-
address: normalizeStarknetAddressSafe(req.ismAddress),
|
|
669
|
-
owner: normalizeStarknetAddressSafe(owner),
|
|
670
|
-
routes,
|
|
671
|
-
};
|
|
672
|
-
}
|
|
673
|
-
async getNoopIsm(req) {
|
|
674
|
-
return { address: normalizeStarknetAddressSafe(req.ismAddress) };
|
|
675
|
-
}
|
|
676
|
-
async getHookType(req) {
|
|
677
|
-
try {
|
|
678
|
-
const hook = this.withContract(StarknetContractName.HOOK, req.hookAddress);
|
|
679
|
-
const hookType = await callContract(hook, 'hook_type');
|
|
680
|
-
return this.parseHookVariant(extractEnumVariant(hookType));
|
|
681
|
-
}
|
|
682
|
-
catch (error) {
|
|
683
|
-
if (!isProbeMiss(error))
|
|
684
|
-
throw error;
|
|
685
|
-
return dist/* AltVM.HookType */.bx.WD.CUSTOM;
|
|
686
|
-
}
|
|
687
|
-
}
|
|
688
|
-
async getInterchainGasPaymasterHook(_req) {
|
|
689
|
-
throw new Error('interchainGasPaymaster hook type is unsupported on Starknet; use protocolFee hook type');
|
|
690
|
-
}
|
|
691
|
-
async getMerkleTreeHook(req) {
|
|
692
|
-
return { address: normalizeStarknetAddressSafe(req.hookAddress) };
|
|
693
|
-
}
|
|
694
|
-
async getNoopHook(req) {
|
|
695
|
-
return { address: normalizeStarknetAddressSafe(req.hookAddress) };
|
|
677
|
+
return isMessageDelivered(this.provider, req.mailboxAddress, req.messageId);
|
|
696
678
|
}
|
|
697
679
|
// ### QUERY WARP ###
|
|
698
680
|
async getToken(req) {
|
|
699
|
-
const tokenAddress =
|
|
700
|
-
const token = this.withContract(StarknetContractName.HYP_ERC20, tokenAddress, this.provider,
|
|
681
|
+
const tokenAddress = contracts_normalizeStarknetAddressSafe(req.tokenAddress);
|
|
682
|
+
const token = this.withContract(StarknetContractName.HYP_ERC20, tokenAddress, this.provider, runtime/* ContractType */.h$.TOKEN);
|
|
701
683
|
const tokenType = await this.determineTokenType(tokenAddress);
|
|
702
684
|
const [owner, mailboxAddress, ismAddress, hookAddress] = await Promise.all([
|
|
703
685
|
callContract(token, 'owner'),
|
|
@@ -720,9 +702,9 @@ class StarknetProvider {
|
|
|
720
702
|
throw error;
|
|
721
703
|
}
|
|
722
704
|
if (tokenType === dist/* AltVM.TokenType */.bx.ks.collateral) {
|
|
723
|
-
const collateral = this.withContract(StarknetContractName.HYP_ERC20_COLLATERAL, tokenAddress, this.provider,
|
|
705
|
+
const collateral = this.withContract(StarknetContractName.HYP_ERC20_COLLATERAL, tokenAddress, this.provider, runtime/* ContractType */.h$.TOKEN);
|
|
724
706
|
const wrapped = await callContract(collateral, 'get_wrapped_token');
|
|
725
|
-
denom =
|
|
707
|
+
denom = contracts_normalizeStarknetAddressSafe(wrapped);
|
|
726
708
|
try {
|
|
727
709
|
const wrappedMeta = await this.getTokenMetadata(denom);
|
|
728
710
|
name = wrappedMeta.name;
|
|
@@ -735,10 +717,10 @@ class StarknetProvider {
|
|
|
735
717
|
}
|
|
736
718
|
}
|
|
737
719
|
else if (tokenType === dist/* AltVM.TokenType */.bx.ks.native) {
|
|
738
|
-
const native = this.withContract(StarknetContractName.HYP_NATIVE, tokenAddress, this.provider,
|
|
720
|
+
const native = this.withContract(StarknetContractName.HYP_NATIVE, tokenAddress, this.provider, runtime/* ContractType */.h$.TOKEN);
|
|
739
721
|
try {
|
|
740
722
|
const nativeTokenAddress = await callContract(native, 'native_token');
|
|
741
|
-
denom =
|
|
723
|
+
denom = contracts_normalizeStarknetAddressSafe(nativeTokenAddress);
|
|
742
724
|
}
|
|
743
725
|
catch (error) {
|
|
744
726
|
if (!isProbeMiss(error))
|
|
@@ -751,11 +733,11 @@ class StarknetProvider {
|
|
|
751
733
|
}
|
|
752
734
|
return {
|
|
753
735
|
address: tokenAddress,
|
|
754
|
-
owner:
|
|
736
|
+
owner: contracts_normalizeStarknetAddressSafe(owner),
|
|
755
737
|
tokenType,
|
|
756
|
-
mailboxAddress:
|
|
757
|
-
ismAddress:
|
|
758
|
-
hookAddress:
|
|
738
|
+
mailboxAddress: contracts_normalizeStarknetAddressSafe(mailboxAddress),
|
|
739
|
+
ismAddress: contracts_normalizeStarknetAddressSafe(ismAddress),
|
|
740
|
+
hookAddress: contracts_normalizeStarknetAddressSafe(hookAddress),
|
|
759
741
|
denom,
|
|
760
742
|
name,
|
|
761
743
|
symbol,
|
|
@@ -763,7 +745,7 @@ class StarknetProvider {
|
|
|
763
745
|
};
|
|
764
746
|
}
|
|
765
747
|
async getRemoteRouters(req) {
|
|
766
|
-
const token = this.withContract(StarknetContractName.HYP_ERC20, req.tokenAddress, this.provider,
|
|
748
|
+
const token = this.withContract(StarknetContractName.HYP_ERC20, req.tokenAddress, this.provider, runtime/* ContractType */.h$.TOKEN);
|
|
767
749
|
const domains = await callContract(token, 'domains');
|
|
768
750
|
(0,validation/* assert */.v)(Array.isArray(domains), 'Expected Starknet token domains array');
|
|
769
751
|
const remoteRouters = await Promise.all(domains.map(async (domainId) => {
|
|
@@ -779,13 +761,13 @@ class StarknetProvider {
|
|
|
779
761
|
};
|
|
780
762
|
}));
|
|
781
763
|
return {
|
|
782
|
-
address:
|
|
764
|
+
address: contracts_normalizeStarknetAddressSafe(req.tokenAddress),
|
|
783
765
|
remoteRouters,
|
|
784
766
|
};
|
|
785
767
|
}
|
|
786
768
|
async getBridgedSupply(req) {
|
|
787
769
|
const tokenInfo = await this.getToken({ tokenAddress: req.tokenAddress });
|
|
788
|
-
const token = this.withContract(StarknetContractName.HYP_ERC20, req.tokenAddress, this.provider,
|
|
770
|
+
const token = this.withContract(StarknetContractName.HYP_ERC20, req.tokenAddress, this.provider, runtime/* ContractType */.h$.TOKEN);
|
|
789
771
|
if (tokenInfo.tokenType === dist/* AltVM.TokenType */.bx.ks.synthetic) {
|
|
790
772
|
return toBigInt(await callContract(token, 'total_supply'));
|
|
791
773
|
}
|
|
@@ -795,7 +777,7 @@ class StarknetProvider {
|
|
|
795
777
|
});
|
|
796
778
|
}
|
|
797
779
|
async quoteRemoteTransfer(req) {
|
|
798
|
-
const token = this.withContract(StarknetContractName.HYP_ERC20, req.tokenAddress, this.provider,
|
|
780
|
+
const token = this.withContract(StarknetContractName.HYP_ERC20, req.tokenAddress, this.provider, runtime/* ContractType */.h$.TOKEN);
|
|
799
781
|
const quote = await callContract(token, 'quote_gas_payment', [
|
|
800
782
|
req.destinationDomainId,
|
|
801
783
|
]);
|
|
@@ -804,255 +786,14 @@ class StarknetProvider {
|
|
|
804
786
|
amount: toBigInt(quote),
|
|
805
787
|
};
|
|
806
788
|
}
|
|
807
|
-
// ###
|
|
808
|
-
async getCreateMailboxTransaction(req) {
|
|
809
|
-
return {
|
|
810
|
-
kind: 'deploy',
|
|
811
|
-
contractName: StarknetContractName.MAILBOX,
|
|
812
|
-
constructorArgs: [
|
|
813
|
-
req.domainId,
|
|
814
|
-
normalizeStarknetAddressSafe(req.signer),
|
|
815
|
-
normalizeStarknetAddressSafe(req.defaultIsmAddress ?? addresses/* ZERO_ADDRESS_HEX_32 */.qx),
|
|
816
|
-
normalizeStarknetAddressSafe(req.defaultHookAddress ?? addresses/* ZERO_ADDRESS_HEX_32 */.qx),
|
|
817
|
-
normalizeStarknetAddressSafe(req.requiredHookAddress ?? addresses/* ZERO_ADDRESS_HEX_32 */.qx),
|
|
818
|
-
],
|
|
819
|
-
};
|
|
820
|
-
}
|
|
821
|
-
async getSetDefaultIsmTransaction(req) {
|
|
822
|
-
const mailbox = this.withContract(StarknetContractName.MAILBOX, req.mailboxAddress);
|
|
823
|
-
return populateInvokeTx(mailbox, 'set_default_ism', [
|
|
824
|
-
normalizeStarknetAddressSafe(req.ismAddress),
|
|
825
|
-
]);
|
|
826
|
-
}
|
|
827
|
-
async getSetDefaultHookTransaction(req) {
|
|
828
|
-
const mailbox = this.withContract(StarknetContractName.MAILBOX, req.mailboxAddress);
|
|
829
|
-
return populateInvokeTx(mailbox, 'set_default_hook', [
|
|
830
|
-
normalizeStarknetAddressSafe(req.hookAddress),
|
|
831
|
-
]);
|
|
832
|
-
}
|
|
833
|
-
async getSetRequiredHookTransaction(req) {
|
|
834
|
-
const mailbox = this.withContract(StarknetContractName.MAILBOX, req.mailboxAddress);
|
|
835
|
-
return populateInvokeTx(mailbox, 'set_required_hook', [
|
|
836
|
-
normalizeStarknetAddressSafe(req.hookAddress),
|
|
837
|
-
]);
|
|
838
|
-
}
|
|
839
|
-
async getSetMailboxOwnerTransaction(req) {
|
|
840
|
-
const mailbox = this.withContract(StarknetContractName.MAILBOX, req.mailboxAddress);
|
|
841
|
-
return populateInvokeTx(mailbox, 'transfer_ownership', [
|
|
842
|
-
normalizeStarknetAddressSafe(req.newOwner),
|
|
843
|
-
]);
|
|
844
|
-
}
|
|
845
|
-
async getCreateMerkleRootMultisigIsmTransaction(req) {
|
|
846
|
-
return {
|
|
847
|
-
kind: 'deploy',
|
|
848
|
-
contractName: StarknetContractName.MERKLE_ROOT_MULTISIG_ISM,
|
|
849
|
-
constructorArgs: [
|
|
850
|
-
normalizeStarknetAddressSafe(req.signer),
|
|
851
|
-
req.validators.map((validator) => (0,addresses/* addressToBytes32 */.In)(validator)),
|
|
852
|
-
req.threshold,
|
|
853
|
-
],
|
|
854
|
-
};
|
|
855
|
-
}
|
|
856
|
-
async getCreateMessageIdMultisigIsmTransaction(req) {
|
|
857
|
-
return {
|
|
858
|
-
kind: 'deploy',
|
|
859
|
-
contractName: StarknetContractName.MESSAGE_ID_MULTISIG_ISM,
|
|
860
|
-
constructorArgs: [
|
|
861
|
-
normalizeStarknetAddressSafe(req.signer),
|
|
862
|
-
req.validators.map((validator) => (0,addresses/* addressToBytes32 */.In)(validator)),
|
|
863
|
-
req.threshold,
|
|
864
|
-
],
|
|
865
|
-
};
|
|
866
|
-
}
|
|
867
|
-
async getCreateRoutingIsmTransaction(req) {
|
|
868
|
-
return {
|
|
869
|
-
kind: 'deploy',
|
|
870
|
-
contractName: StarknetContractName.ROUTING_ISM,
|
|
871
|
-
constructorArgs: [normalizeStarknetAddressSafe(req.signer)],
|
|
872
|
-
};
|
|
873
|
-
}
|
|
874
|
-
async getSetRoutingIsmRouteTransaction(req) {
|
|
875
|
-
const routing = this.withContract(StarknetContractName.ROUTING_ISM, req.ismAddress);
|
|
876
|
-
return populateInvokeTx(routing, 'set', [
|
|
877
|
-
req.route.domainId,
|
|
878
|
-
normalizeStarknetAddressSafe(req.route.ismAddress),
|
|
879
|
-
]);
|
|
880
|
-
}
|
|
881
|
-
async getRemoveRoutingIsmRouteTransaction(req) {
|
|
882
|
-
const routing = this.withContract(StarknetContractName.ROUTING_ISM, req.ismAddress);
|
|
883
|
-
return populateInvokeTx(routing, 'remove', [req.domainId]);
|
|
884
|
-
}
|
|
885
|
-
async getSetRoutingIsmOwnerTransaction(req) {
|
|
886
|
-
const routing = this.withContract(StarknetContractName.ROUTING_ISM, req.ismAddress);
|
|
887
|
-
return populateInvokeTx(routing, 'transfer_ownership', [
|
|
888
|
-
normalizeStarknetAddressSafe(req.newOwner),
|
|
889
|
-
]);
|
|
890
|
-
}
|
|
891
|
-
async getCreateNoopIsmTransaction(_req) {
|
|
892
|
-
return {
|
|
893
|
-
kind: 'deploy',
|
|
894
|
-
contractName: StarknetContractName.NOOP_ISM,
|
|
895
|
-
constructorArgs: [],
|
|
896
|
-
};
|
|
897
|
-
}
|
|
898
|
-
async getCreateMerkleTreeHookTransaction(req) {
|
|
899
|
-
return {
|
|
900
|
-
kind: 'deploy',
|
|
901
|
-
contractName: StarknetContractName.MERKLE_TREE_HOOK,
|
|
902
|
-
constructorArgs: [
|
|
903
|
-
normalizeStarknetAddressSafe(req.mailboxAddress),
|
|
904
|
-
normalizeStarknetAddressSafe(req.signer),
|
|
905
|
-
],
|
|
906
|
-
};
|
|
907
|
-
}
|
|
908
|
-
async getCreateInterchainGasPaymasterHookTransaction(_req) {
|
|
909
|
-
throw new Error('interchainGasPaymaster hook type is unsupported on Starknet; use protocolFee hook type');
|
|
910
|
-
}
|
|
911
|
-
async getSetInterchainGasPaymasterHookOwnerTransaction(_req) {
|
|
912
|
-
throw new Error('interchainGasPaymaster hook type is unsupported on Starknet; use protocolFee hook type');
|
|
913
|
-
}
|
|
914
|
-
async getSetDestinationGasConfigTransaction(_req) {
|
|
915
|
-
throw new Error('interchainGasPaymaster hook type is unsupported on Starknet');
|
|
916
|
-
}
|
|
917
|
-
async getRemoveDestinationGasConfigTransaction(_req) {
|
|
918
|
-
throw new Error('interchainGasPaymaster hook type is unsupported on Starknet');
|
|
919
|
-
}
|
|
920
|
-
async getCreateNoopHookTransaction(_req) {
|
|
921
|
-
return {
|
|
922
|
-
kind: 'deploy',
|
|
923
|
-
contractName: StarknetContractName.HOOK,
|
|
924
|
-
constructorArgs: [],
|
|
925
|
-
};
|
|
926
|
-
}
|
|
927
|
-
async getCreateValidatorAnnounceTransaction(req) {
|
|
928
|
-
return {
|
|
929
|
-
kind: 'deploy',
|
|
930
|
-
contractName: StarknetContractName.VALIDATOR_ANNOUNCE,
|
|
931
|
-
constructorArgs: [
|
|
932
|
-
normalizeStarknetAddressSafe(req.mailboxAddress),
|
|
933
|
-
normalizeStarknetAddressSafe(req.signer),
|
|
934
|
-
],
|
|
935
|
-
};
|
|
936
|
-
}
|
|
937
|
-
async getCreateProxyAdminTransaction(_req) {
|
|
938
|
-
throw new Error('Proxy admin unsupported on Starknet');
|
|
939
|
-
}
|
|
940
|
-
async getSetProxyAdminOwnerTransaction(_req) {
|
|
941
|
-
throw new Error('Proxy admin unsupported on Starknet');
|
|
942
|
-
}
|
|
943
|
-
// ### GET WARP TXS ###
|
|
944
|
-
async getCreateNativeTokenTransaction(req) {
|
|
945
|
-
const mailbox = await this.getMailbox({
|
|
946
|
-
mailboxAddress: req.mailboxAddress,
|
|
947
|
-
});
|
|
948
|
-
return {
|
|
949
|
-
kind: 'deploy',
|
|
950
|
-
contractName: StarknetContractName.HYP_NATIVE,
|
|
951
|
-
contractType: starknet_dist_0/* ContractType */.h$.TOKEN,
|
|
952
|
-
constructorArgs: [
|
|
953
|
-
normalizeStarknetAddressSafe(req.mailboxAddress),
|
|
954
|
-
this.feeTokenAddress,
|
|
955
|
-
normalizeStarknetAddressSafe(mailbox.defaultHook),
|
|
956
|
-
normalizeStarknetAddressSafe(mailbox.defaultIsm),
|
|
957
|
-
normalizeStarknetAddressSafe(req.signer),
|
|
958
|
-
],
|
|
959
|
-
};
|
|
960
|
-
}
|
|
961
|
-
async getCreateCollateralTokenTransaction(req) {
|
|
962
|
-
const mailbox = await this.getMailbox({
|
|
963
|
-
mailboxAddress: req.mailboxAddress,
|
|
964
|
-
});
|
|
965
|
-
return {
|
|
966
|
-
kind: 'deploy',
|
|
967
|
-
contractName: StarknetContractName.HYP_ERC20_COLLATERAL,
|
|
968
|
-
contractType: starknet_dist_0/* ContractType */.h$.TOKEN,
|
|
969
|
-
constructorArgs: [
|
|
970
|
-
normalizeStarknetAddressSafe(req.mailboxAddress),
|
|
971
|
-
normalizeStarknetAddressSafe(req.collateralDenom),
|
|
972
|
-
normalizeStarknetAddressSafe(req.signer),
|
|
973
|
-
normalizeStarknetAddressSafe(mailbox.defaultHook),
|
|
974
|
-
normalizeStarknetAddressSafe(mailbox.defaultIsm),
|
|
975
|
-
],
|
|
976
|
-
};
|
|
977
|
-
}
|
|
978
|
-
async getCreateSyntheticTokenTransaction(req) {
|
|
979
|
-
const mailbox = await this.getMailbox({
|
|
980
|
-
mailboxAddress: req.mailboxAddress,
|
|
981
|
-
});
|
|
982
|
-
return {
|
|
983
|
-
kind: 'deploy',
|
|
984
|
-
contractName: StarknetContractName.HYP_ERC20,
|
|
985
|
-
contractType: starknet_dist_0/* ContractType */.h$.TOKEN,
|
|
986
|
-
constructorArgs: [
|
|
987
|
-
req.decimals,
|
|
988
|
-
normalizeStarknetAddressSafe(req.mailboxAddress),
|
|
989
|
-
0,
|
|
990
|
-
req.name,
|
|
991
|
-
req.denom,
|
|
992
|
-
normalizeStarknetAddressSafe(mailbox.defaultHook),
|
|
993
|
-
normalizeStarknetAddressSafe(mailbox.defaultIsm),
|
|
994
|
-
normalizeStarknetAddressSafe(req.signer),
|
|
995
|
-
],
|
|
996
|
-
};
|
|
997
|
-
}
|
|
998
|
-
async getSetTokenOwnerTransaction(req) {
|
|
999
|
-
const token = this.withContract(StarknetContractName.HYP_ERC20, req.tokenAddress, this.provider, starknet_dist_0/* ContractType */.h$.TOKEN);
|
|
1000
|
-
return populateInvokeTx(token, 'transfer_ownership', [
|
|
1001
|
-
normalizeStarknetAddressSafe(req.newOwner),
|
|
1002
|
-
]);
|
|
1003
|
-
}
|
|
1004
|
-
async getSetTokenIsmTransaction(req) {
|
|
1005
|
-
const token = this.withContract(StarknetContractName.HYP_ERC20, req.tokenAddress, this.provider, starknet_dist_0/* ContractType */.h$.TOKEN);
|
|
1006
|
-
return populateInvokeTx(token, 'set_interchain_security_module', [
|
|
1007
|
-
normalizeStarknetAddressSafe(req.ismAddress ?? addresses/* ZERO_ADDRESS_HEX_32 */.qx),
|
|
1008
|
-
]);
|
|
1009
|
-
}
|
|
1010
|
-
async getSetTokenHookTransaction(req) {
|
|
1011
|
-
const token = this.withContract(StarknetContractName.HYP_ERC20, req.tokenAddress, this.provider, starknet_dist_0/* ContractType */.h$.TOKEN);
|
|
1012
|
-
return populateInvokeTx(token, 'set_hook', [
|
|
1013
|
-
normalizeStarknetAddressSafe(req.hookAddress ?? addresses/* ZERO_ADDRESS_HEX_32 */.qx),
|
|
1014
|
-
]);
|
|
1015
|
-
}
|
|
1016
|
-
async getEnrollRemoteRouterTransaction(req) {
|
|
1017
|
-
const token = this.withContract(StarknetContractName.HYP_ERC20, req.tokenAddress, this.provider, starknet_dist_0/* ContractType */.h$.TOKEN);
|
|
1018
|
-
const receiverAddress = (0,addresses/* isZeroishAddress */.Hi)(req.remoteRouter.receiverAddress)
|
|
1019
|
-
? addresses/* ZERO_ADDRESS_HEX_32 */.qx
|
|
1020
|
-
: (0,addresses/* ensure0x */.Ho)(req.remoteRouter.receiverAddress);
|
|
1021
|
-
const noneOption = new starknet_dist/* CairoOption */.ci(starknet_dist/* CairoOptionVariant */.RV.None);
|
|
1022
|
-
const domainOption = new starknet_dist/* CairoOption */.ci(starknet_dist/* CairoOptionVariant */.RV.Some, req.remoteRouter.receiverDomainId);
|
|
1023
|
-
const gasOption = new starknet_dist/* CairoOption */.ci(starknet_dist/* CairoOptionVariant */.RV.Some, req.remoteRouter.gas);
|
|
1024
|
-
const [enrollCall, gasCall] = await Promise.all([
|
|
1025
|
-
this.populateInvokeCall(token, 'enroll_remote_router', [
|
|
1026
|
-
req.remoteRouter.receiverDomainId,
|
|
1027
|
-
receiverAddress,
|
|
1028
|
-
]),
|
|
1029
|
-
this.populateInvokeCall(token, 'set_destination_gas', [
|
|
1030
|
-
noneOption,
|
|
1031
|
-
domainOption,
|
|
1032
|
-
gasOption,
|
|
1033
|
-
]),
|
|
1034
|
-
]);
|
|
1035
|
-
return {
|
|
1036
|
-
kind: 'invoke',
|
|
1037
|
-
contractAddress: enrollCall.contractAddress,
|
|
1038
|
-
entrypoint: enrollCall.entrypoint,
|
|
1039
|
-
calldata: enrollCall.calldata,
|
|
1040
|
-
calls: [enrollCall, gasCall],
|
|
1041
|
-
};
|
|
1042
|
-
}
|
|
1043
|
-
async getUnenrollRemoteRouterTransaction(req) {
|
|
1044
|
-
const token = this.withContract(StarknetContractName.HYP_ERC20, req.tokenAddress, this.provider, starknet_dist_0/* ContractType */.h$.TOKEN);
|
|
1045
|
-
return populateInvokeTx(token, 'unenroll_remote_router', [
|
|
1046
|
-
req.receiverDomainId,
|
|
1047
|
-
]);
|
|
1048
|
-
}
|
|
789
|
+
// ### TRANSFER TXS ###
|
|
1049
790
|
async getTransferTransaction(req) {
|
|
1050
791
|
const denom = req.denom
|
|
1051
|
-
?
|
|
792
|
+
? contracts_normalizeStarknetAddressSafe(req.denom)
|
|
1052
793
|
: this.feeTokenAddress;
|
|
1053
|
-
const token = this.withContract(StarknetContractName.ETHER, denom, this.provider,
|
|
794
|
+
const token = this.withContract(StarknetContractName.ETHER, denom, this.provider, runtime/* ContractType */.h$.TOKEN);
|
|
1054
795
|
return populateInvokeTx(token, 'transfer', [
|
|
1055
|
-
|
|
796
|
+
contracts_normalizeStarknetAddressSafe(req.recipient),
|
|
1056
797
|
req.amount,
|
|
1057
798
|
]);
|
|
1058
799
|
}
|
|
@@ -1064,7 +805,7 @@ class StarknetProvider {
|
|
|
1064
805
|
throw new Error('Custom hook metadata/addresses are unsupported for Starknet transfer_remote in provider-sdk');
|
|
1065
806
|
}
|
|
1066
807
|
const tokenType = tokenInfo?.tokenType ?? (await this.determineTokenType(req.tokenAddress));
|
|
1067
|
-
const token = this.withContract(StarknetContractName.HYP_ERC20, req.tokenAddress, this.provider,
|
|
808
|
+
const token = this.withContract(StarknetContractName.HYP_ERC20, req.tokenAddress, this.provider, runtime/* ContractType */.h$.TOKEN);
|
|
1068
809
|
const noneOption = new starknet_dist/* CairoOption */.ci(starknet_dist/* CairoOptionVariant */.RV.None);
|
|
1069
810
|
let value;
|
|
1070
811
|
if (tokenType === dist/* AltVM.TokenType */.bx.ks.native) {
|
|
@@ -1096,28 +837,27 @@ class StarknetProvider {
|
|
|
1096
837
|
|
|
1097
838
|
class StarknetSigner extends StarknetProvider {
|
|
1098
839
|
signerAddress;
|
|
1099
|
-
static
|
|
1100
|
-
|
|
1101
|
-
return undefined;
|
|
1102
|
-
const candidate = Reflect.get(value, key);
|
|
1103
|
-
return typeof candidate === 'string' ? candidate : undefined;
|
|
1104
|
-
}
|
|
1105
|
-
static async connectWithSigner(rpcUrls, privateKey, extraParams) {
|
|
1106
|
-
(0,validation/* assert */.v)(extraParams?.metadata, 'metadata missing for Starknet signer');
|
|
1107
|
-
const metadata = extraParams.metadata;
|
|
1108
|
-
const accountAddress = extraParams.accountAddress;
|
|
840
|
+
static async connectWithSigner(metadata, privateKey, extraParams) {
|
|
841
|
+
const accountAddress = extraParams?.accountAddress;
|
|
1109
842
|
(0,validation/* assert */.v)(accountAddress, 'accountAddress missing for Starknet signer');
|
|
1110
843
|
(0,validation/* assert */.v)(privateKey, 'private key missing for Starknet signer');
|
|
1111
|
-
const
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
return new StarknetSigner(provider.getRawProvider(), metadata, rpcUrls, normalizeStarknetAddressSafe(accountAddress), privateKey);
|
|
844
|
+
const rpcUrls = (metadata.rpcUrls ?? []).map(({ http }) => http);
|
|
845
|
+
const provider = StarknetProvider.connect(metadata);
|
|
846
|
+
return new StarknetSigner(provider.getRawProvider(), metadata, rpcUrls, contracts_normalizeStarknetAddressSafe(accountAddress), privateKey);
|
|
1115
847
|
}
|
|
1116
848
|
account;
|
|
1117
849
|
constructor(provider, metadata, rpcUrls, signerAddress, privateKey) {
|
|
1118
850
|
super(provider, metadata, rpcUrls);
|
|
1119
851
|
this.signerAddress = signerAddress;
|
|
1120
|
-
this.account = new starknet_dist/* Account */.gD(
|
|
852
|
+
this.account = new starknet_dist/* Account */.gD({
|
|
853
|
+
provider,
|
|
854
|
+
address: signerAddress,
|
|
855
|
+
signer: privateKey,
|
|
856
|
+
// The legacy UDC remains deployed across old devnets and production
|
|
857
|
+
// networks. starknet.js v8's new default UDC is unavailable on older
|
|
858
|
+
// networks that this SDK still supports.
|
|
859
|
+
deployer: starknet_dist/* legacyDeployer */.kW,
|
|
860
|
+
});
|
|
1121
861
|
}
|
|
1122
862
|
get accountAddress() {
|
|
1123
863
|
return this.signerAddress;
|
|
@@ -1148,34 +888,27 @@ class StarknetSigner extends StarknetProvider {
|
|
|
1148
888
|
if (receipt.isError()) {
|
|
1149
889
|
(0,validation/* assert */.v)(false, `Starknet transaction ${transactionHash} failed: ${receipt.value.message}`);
|
|
1150
890
|
}
|
|
1151
|
-
(0,validation/* assert */.v)(false, `Starknet transaction ${transactionHash} failed with status
|
|
891
|
+
(0,validation/* assert */.v)(false, `Starknet transaction ${transactionHash} failed with an unknown status`);
|
|
1152
892
|
}
|
|
1153
893
|
async deployContract(params) {
|
|
1154
|
-
const
|
|
1155
|
-
const
|
|
1156
|
-
const contractArtifact =
|
|
894
|
+
const { getCompiledContract, getContractArtifact } = await __webpack_require__.e(/* import() */ 367).then(__webpack_require__.bind(__webpack_require__, 67367));
|
|
895
|
+
const compiledContract = getCompiledContract(params.contractName, params.contractType);
|
|
896
|
+
const contractArtifact = getContractArtifact(params.contractName, params.contractType);
|
|
1157
897
|
(0,validation/* assert */.v)(contractArtifact.compiled_contract_class, `Missing compiled_contract_class for Starknet contract ${params.contractName}`);
|
|
1158
|
-
(0,validation/* assert */.v)(compiledClassHash, `Missing compiledClassHash for Starknet contract ${params.contractName}`);
|
|
1159
898
|
const hasConstructor = compiledContract.abi.some((item) => item.type === 'constructor');
|
|
1160
899
|
const constructorCalldata = hasConstructor
|
|
1161
900
|
? new starknet_dist/* CallData */.fP(compiledContract.abi).compile('constructor', params.constructorArgs)
|
|
1162
901
|
: undefined;
|
|
1163
|
-
const
|
|
1164
|
-
compiledContract,
|
|
902
|
+
const { deploy } = await this.account.declareAndDeploy({
|
|
903
|
+
contract: compiledContract,
|
|
1165
904
|
casm: contractArtifact.compiled_contract_class,
|
|
1166
|
-
|
|
1167
|
-
account: this.account,
|
|
905
|
+
constructorCalldata,
|
|
1168
906
|
});
|
|
1169
|
-
const
|
|
1170
|
-
? await factory.deploy()
|
|
1171
|
-
: await factory.deploy(constructorCalldata);
|
|
1172
|
-
const transactionHash = deployment.deployTransactionHash ??
|
|
1173
|
-
StarknetSigner.readStringField(deployment, 'transaction_hash');
|
|
907
|
+
const transactionHash = deploy.transaction_hash;
|
|
1174
908
|
(0,validation/* assert */.v)(transactionHash, 'missing Starknet deploy transaction hash');
|
|
1175
|
-
const rawAddress =
|
|
1176
|
-
StarknetSigner.readStringField(deployment, 'contract_address');
|
|
909
|
+
const rawAddress = deploy.contract_address;
|
|
1177
910
|
(0,validation/* assert */.v)(rawAddress, 'missing Starknet deploy contract address');
|
|
1178
|
-
const address =
|
|
911
|
+
const address = contracts_normalizeStarknetAddressSafe(rawAddress);
|
|
1179
912
|
const receipt = await this.account.waitForTransaction(transactionHash);
|
|
1180
913
|
this.assertSuccessfulReceipt(transactionHash, receipt);
|
|
1181
914
|
return {
|
|
@@ -1230,7 +963,6 @@ class StarknetSigner extends StarknetProvider {
|
|
|
1230
963
|
this.assertSuccessfulReceipt(transactionHash, receipt);
|
|
1231
964
|
return { transactionHash, receipt };
|
|
1232
965
|
}
|
|
1233
|
-
// ### TX CORE ###
|
|
1234
966
|
async estimateTransactionFee(req) {
|
|
1235
967
|
(0,validation/* assert */.v)(req.transaction.kind === 'invoke', 'Starknet transaction fee estimation only supports invoke transactions');
|
|
1236
968
|
const calls = req.transaction.calls ?? [
|
|
@@ -1241,291 +973,14 @@ class StarknetSigner extends StarknetProvider {
|
|
|
1241
973
|
},
|
|
1242
974
|
];
|
|
1243
975
|
const estimate = await this.account.estimateInvokeFee(calls);
|
|
1244
|
-
const
|
|
1245
|
-
|
|
1246
|
-
(estimate.l2_gas_consumed ?? 0n);
|
|
976
|
+
const { l1_gas, l1_data_gas, l2_gas } = estimate.resourceBounds;
|
|
977
|
+
const gasUnits = l1_gas.max_amount + l1_data_gas.max_amount + l2_gas.max_amount;
|
|
1247
978
|
return {
|
|
1248
979
|
gasUnits,
|
|
1249
|
-
gasPrice: Number(
|
|
980
|
+
gasPrice: Number(l1_gas.max_price_per_unit),
|
|
1250
981
|
fee: estimate.overall_fee,
|
|
1251
982
|
};
|
|
1252
983
|
}
|
|
1253
|
-
async createMailbox(req) {
|
|
1254
|
-
if (req.proxyAdminAddress) {
|
|
1255
|
-
throw new Error('Proxy admin unsupported on Starknet');
|
|
1256
|
-
}
|
|
1257
|
-
const defaultIsmAddress = req.defaultIsmAddress ?? (await this.createNoopIsm({})).ismAddress;
|
|
1258
|
-
const defaultHookAddress = req.defaultHookAddress ??
|
|
1259
|
-
(await this.createNoopHook({
|
|
1260
|
-
// Hook deployment currently ignores mailboxAddress on Starknet.
|
|
1261
|
-
mailboxAddress: this.signerAddress,
|
|
1262
|
-
})).hookAddress;
|
|
1263
|
-
// Keep required hooks opt-in. Auto-deploying a noop required hook would
|
|
1264
|
-
// change mailbox semantics for callers that intentionally leave it unset.
|
|
1265
|
-
const requiredHookAddress = req.requiredHookAddress;
|
|
1266
|
-
const tx = await this.getCreateMailboxTransaction({
|
|
1267
|
-
signer: this.signerAddress,
|
|
1268
|
-
...req,
|
|
1269
|
-
defaultIsmAddress,
|
|
1270
|
-
defaultHookAddress,
|
|
1271
|
-
requiredHookAddress,
|
|
1272
|
-
});
|
|
1273
|
-
const receipt = await this.sendAndConfirmTransaction(tx);
|
|
1274
|
-
(0,validation/* assert */.v)(receipt.contractAddress, 'failed to get Starknet mailbox address');
|
|
1275
|
-
return { mailboxAddress: receipt.contractAddress };
|
|
1276
|
-
}
|
|
1277
|
-
async setDefaultIsm(req) {
|
|
1278
|
-
const tx = await this.getSetDefaultIsmTransaction({
|
|
1279
|
-
signer: this.signerAddress,
|
|
1280
|
-
...req,
|
|
1281
|
-
});
|
|
1282
|
-
await this.sendAndConfirmTransaction(tx);
|
|
1283
|
-
return { ismAddress: req.ismAddress };
|
|
1284
|
-
}
|
|
1285
|
-
async setDefaultHook(req) {
|
|
1286
|
-
const tx = await this.getSetDefaultHookTransaction({
|
|
1287
|
-
signer: this.signerAddress,
|
|
1288
|
-
...req,
|
|
1289
|
-
});
|
|
1290
|
-
await this.sendAndConfirmTransaction(tx);
|
|
1291
|
-
return { hookAddress: req.hookAddress };
|
|
1292
|
-
}
|
|
1293
|
-
async setRequiredHook(req) {
|
|
1294
|
-
const tx = await this.getSetRequiredHookTransaction({
|
|
1295
|
-
signer: this.signerAddress,
|
|
1296
|
-
...req,
|
|
1297
|
-
});
|
|
1298
|
-
await this.sendAndConfirmTransaction(tx);
|
|
1299
|
-
return { hookAddress: req.hookAddress };
|
|
1300
|
-
}
|
|
1301
|
-
async setMailboxOwner(req) {
|
|
1302
|
-
const tx = await this.getSetMailboxOwnerTransaction({
|
|
1303
|
-
signer: this.signerAddress,
|
|
1304
|
-
...req,
|
|
1305
|
-
});
|
|
1306
|
-
await this.sendAndConfirmTransaction(tx);
|
|
1307
|
-
return { newOwner: req.newOwner };
|
|
1308
|
-
}
|
|
1309
|
-
async createMerkleRootMultisigIsm(req) {
|
|
1310
|
-
const tx = await this.getCreateMerkleRootMultisigIsmTransaction({
|
|
1311
|
-
signer: this.signerAddress,
|
|
1312
|
-
...req,
|
|
1313
|
-
});
|
|
1314
|
-
const receipt = await this.sendAndConfirmTransaction(tx);
|
|
1315
|
-
(0,validation/* assert */.v)(receipt.contractAddress, 'failed to get Starknet ISM address');
|
|
1316
|
-
return { ismAddress: receipt.contractAddress };
|
|
1317
|
-
}
|
|
1318
|
-
async createMessageIdMultisigIsm(req) {
|
|
1319
|
-
const tx = await this.getCreateMessageIdMultisigIsmTransaction({
|
|
1320
|
-
signer: this.signerAddress,
|
|
1321
|
-
...req,
|
|
1322
|
-
});
|
|
1323
|
-
const receipt = await this.sendAndConfirmTransaction(tx);
|
|
1324
|
-
(0,validation/* assert */.v)(receipt.contractAddress, 'failed to get Starknet ISM address');
|
|
1325
|
-
return { ismAddress: receipt.contractAddress };
|
|
1326
|
-
}
|
|
1327
|
-
async createRoutingIsm(req) {
|
|
1328
|
-
const tx = await this.getCreateRoutingIsmTransaction({
|
|
1329
|
-
signer: this.signerAddress,
|
|
1330
|
-
...req,
|
|
1331
|
-
});
|
|
1332
|
-
const receipt = await this.sendAndConfirmTransaction(tx);
|
|
1333
|
-
const ismAddress = receipt.contractAddress;
|
|
1334
|
-
(0,validation/* assert */.v)(ismAddress, 'failed to get Starknet routing ISM address');
|
|
1335
|
-
if (req.routes.length > 0) {
|
|
1336
|
-
const routeTxs = await Promise.all(req.routes.map(async (route) => this.getSetRoutingIsmRouteTransaction({
|
|
1337
|
-
signer: this.signerAddress,
|
|
1338
|
-
ismAddress,
|
|
1339
|
-
route,
|
|
1340
|
-
})));
|
|
1341
|
-
await this.sendAndConfirmBatchTransactions(routeTxs);
|
|
1342
|
-
}
|
|
1343
|
-
return { ismAddress };
|
|
1344
|
-
}
|
|
1345
|
-
async setRoutingIsmRoute(req) {
|
|
1346
|
-
const tx = await this.getSetRoutingIsmRouteTransaction({
|
|
1347
|
-
signer: this.signerAddress,
|
|
1348
|
-
...req,
|
|
1349
|
-
});
|
|
1350
|
-
await this.sendAndConfirmTransaction(tx);
|
|
1351
|
-
return { route: req.route };
|
|
1352
|
-
}
|
|
1353
|
-
async removeRoutingIsmRoute(req) {
|
|
1354
|
-
const tx = await this.getRemoveRoutingIsmRouteTransaction({
|
|
1355
|
-
signer: this.signerAddress,
|
|
1356
|
-
...req,
|
|
1357
|
-
});
|
|
1358
|
-
await this.sendAndConfirmTransaction(tx);
|
|
1359
|
-
return { domainId: req.domainId };
|
|
1360
|
-
}
|
|
1361
|
-
async setRoutingIsmOwner(req) {
|
|
1362
|
-
const tx = await this.getSetRoutingIsmOwnerTransaction({
|
|
1363
|
-
signer: this.signerAddress,
|
|
1364
|
-
...req,
|
|
1365
|
-
});
|
|
1366
|
-
await this.sendAndConfirmTransaction(tx);
|
|
1367
|
-
return { newOwner: req.newOwner };
|
|
1368
|
-
}
|
|
1369
|
-
async createNoopIsm(req) {
|
|
1370
|
-
const tx = await this.getCreateNoopIsmTransaction({
|
|
1371
|
-
signer: this.signerAddress,
|
|
1372
|
-
...req,
|
|
1373
|
-
});
|
|
1374
|
-
const receipt = await this.sendAndConfirmTransaction(tx);
|
|
1375
|
-
(0,validation/* assert */.v)(receipt.contractAddress, 'failed to get Starknet noop ISM address');
|
|
1376
|
-
return { ismAddress: receipt.contractAddress };
|
|
1377
|
-
}
|
|
1378
|
-
async createMerkleTreeHook(req) {
|
|
1379
|
-
const tx = await this.getCreateMerkleTreeHookTransaction({
|
|
1380
|
-
signer: this.signerAddress,
|
|
1381
|
-
...req,
|
|
1382
|
-
});
|
|
1383
|
-
const receipt = await this.sendAndConfirmTransaction(tx);
|
|
1384
|
-
(0,validation/* assert */.v)(receipt.contractAddress, 'failed to get Starknet hook address');
|
|
1385
|
-
return { hookAddress: receipt.contractAddress };
|
|
1386
|
-
}
|
|
1387
|
-
async createInterchainGasPaymasterHook(req) {
|
|
1388
|
-
const tx = await this.getCreateInterchainGasPaymasterHookTransaction({
|
|
1389
|
-
signer: this.signerAddress,
|
|
1390
|
-
...req,
|
|
1391
|
-
});
|
|
1392
|
-
const receipt = await this.sendAndConfirmTransaction(tx);
|
|
1393
|
-
(0,validation/* assert */.v)(receipt.contractAddress, 'failed to get Starknet interchainGasPaymaster hook');
|
|
1394
|
-
return { hookAddress: receipt.contractAddress };
|
|
1395
|
-
}
|
|
1396
|
-
async setInterchainGasPaymasterHookOwner(req) {
|
|
1397
|
-
const tx = await this.getSetInterchainGasPaymasterHookOwnerTransaction({
|
|
1398
|
-
signer: this.signerAddress,
|
|
1399
|
-
...req,
|
|
1400
|
-
});
|
|
1401
|
-
await this.sendAndConfirmTransaction(tx);
|
|
1402
|
-
return { newOwner: req.newOwner };
|
|
1403
|
-
}
|
|
1404
|
-
async setDestinationGasConfig(req) {
|
|
1405
|
-
const tx = await this.getSetDestinationGasConfigTransaction({
|
|
1406
|
-
signer: this.signerAddress,
|
|
1407
|
-
...req,
|
|
1408
|
-
});
|
|
1409
|
-
await this.sendAndConfirmTransaction(tx);
|
|
1410
|
-
return { destinationGasConfig: req.destinationGasConfig };
|
|
1411
|
-
}
|
|
1412
|
-
async removeDestinationGasConfig(req) {
|
|
1413
|
-
const tx = await this.getRemoveDestinationGasConfigTransaction({
|
|
1414
|
-
signer: this.signerAddress,
|
|
1415
|
-
...req,
|
|
1416
|
-
});
|
|
1417
|
-
await this.sendAndConfirmTransaction(tx);
|
|
1418
|
-
return { remoteDomainId: req.remoteDomainId };
|
|
1419
|
-
}
|
|
1420
|
-
async createNoopHook(req) {
|
|
1421
|
-
const tx = await this.getCreateNoopHookTransaction({
|
|
1422
|
-
signer: this.signerAddress,
|
|
1423
|
-
...req,
|
|
1424
|
-
});
|
|
1425
|
-
const receipt = await this.sendAndConfirmTransaction(tx);
|
|
1426
|
-
(0,validation/* assert */.v)(receipt.contractAddress, 'failed to get Starknet noop hook');
|
|
1427
|
-
return { hookAddress: receipt.contractAddress };
|
|
1428
|
-
}
|
|
1429
|
-
async createValidatorAnnounce(req) {
|
|
1430
|
-
const tx = await this.getCreateValidatorAnnounceTransaction({
|
|
1431
|
-
signer: this.signerAddress,
|
|
1432
|
-
...req,
|
|
1433
|
-
});
|
|
1434
|
-
const receipt = await this.sendAndConfirmTransaction(tx);
|
|
1435
|
-
(0,validation/* assert */.v)(receipt.contractAddress, 'failed to get Starknet validator announce address');
|
|
1436
|
-
return { validatorAnnounceId: receipt.contractAddress };
|
|
1437
|
-
}
|
|
1438
|
-
async createProxyAdmin(_req) {
|
|
1439
|
-
throw new Error('Proxy admin unsupported on Starknet');
|
|
1440
|
-
}
|
|
1441
|
-
async setProxyAdminOwner(_req) {
|
|
1442
|
-
throw new Error('Proxy admin unsupported on Starknet');
|
|
1443
|
-
}
|
|
1444
|
-
// ### TX WARP ###
|
|
1445
|
-
async createNativeToken(req) {
|
|
1446
|
-
if (req.proxyAdminAddress) {
|
|
1447
|
-
throw new Error('Proxy admin unsupported on Starknet');
|
|
1448
|
-
}
|
|
1449
|
-
const tx = await this.getCreateNativeTokenTransaction({
|
|
1450
|
-
signer: this.signerAddress,
|
|
1451
|
-
...req,
|
|
1452
|
-
});
|
|
1453
|
-
const receipt = await this.sendAndConfirmTransaction(tx);
|
|
1454
|
-
(0,validation/* assert */.v)(receipt.contractAddress, 'failed to get Starknet warp token');
|
|
1455
|
-
return { tokenAddress: receipt.contractAddress };
|
|
1456
|
-
}
|
|
1457
|
-
async createCollateralToken(req) {
|
|
1458
|
-
if (req.proxyAdminAddress) {
|
|
1459
|
-
throw new Error('Proxy admin unsupported on Starknet');
|
|
1460
|
-
}
|
|
1461
|
-
const tx = await this.getCreateCollateralTokenTransaction({
|
|
1462
|
-
signer: this.signerAddress,
|
|
1463
|
-
...req,
|
|
1464
|
-
});
|
|
1465
|
-
const receipt = await this.sendAndConfirmTransaction(tx);
|
|
1466
|
-
(0,validation/* assert */.v)(receipt.contractAddress, 'failed to get Starknet warp token');
|
|
1467
|
-
return { tokenAddress: receipt.contractAddress };
|
|
1468
|
-
}
|
|
1469
|
-
async createSyntheticToken(req) {
|
|
1470
|
-
if (req.proxyAdminAddress) {
|
|
1471
|
-
throw new Error('Proxy admin unsupported on Starknet');
|
|
1472
|
-
}
|
|
1473
|
-
const tx = await this.getCreateSyntheticTokenTransaction({
|
|
1474
|
-
signer: this.signerAddress,
|
|
1475
|
-
...req,
|
|
1476
|
-
});
|
|
1477
|
-
const receipt = await this.sendAndConfirmTransaction(tx);
|
|
1478
|
-
(0,validation/* assert */.v)(receipt.contractAddress, 'failed to get Starknet warp token');
|
|
1479
|
-
return { tokenAddress: receipt.contractAddress };
|
|
1480
|
-
}
|
|
1481
|
-
async setTokenOwner(req) {
|
|
1482
|
-
const tx = await this.getSetTokenOwnerTransaction({
|
|
1483
|
-
signer: this.signerAddress,
|
|
1484
|
-
...req,
|
|
1485
|
-
});
|
|
1486
|
-
await this.sendAndConfirmTransaction(tx);
|
|
1487
|
-
return { newOwner: req.newOwner };
|
|
1488
|
-
}
|
|
1489
|
-
async setTokenIsm(req) {
|
|
1490
|
-
const tx = await this.getSetTokenIsmTransaction({
|
|
1491
|
-
signer: this.signerAddress,
|
|
1492
|
-
...req,
|
|
1493
|
-
});
|
|
1494
|
-
await this.sendAndConfirmTransaction(tx);
|
|
1495
|
-
return { ismAddress: req.ismAddress ?? addresses/* ZERO_ADDRESS_HEX_32 */.qx };
|
|
1496
|
-
}
|
|
1497
|
-
async setTokenHook(req) {
|
|
1498
|
-
const tx = await this.getSetTokenHookTransaction({
|
|
1499
|
-
signer: this.signerAddress,
|
|
1500
|
-
...req,
|
|
1501
|
-
});
|
|
1502
|
-
await this.sendAndConfirmTransaction(tx);
|
|
1503
|
-
return { hookAddress: req.hookAddress ?? addresses/* ZERO_ADDRESS_HEX_32 */.qx };
|
|
1504
|
-
}
|
|
1505
|
-
async enrollRemoteRouter(req) {
|
|
1506
|
-
const tx = await this.getEnrollRemoteRouterTransaction({
|
|
1507
|
-
signer: this.signerAddress,
|
|
1508
|
-
...req,
|
|
1509
|
-
});
|
|
1510
|
-
await this.sendAndConfirmTransaction(tx);
|
|
1511
|
-
return { receiverDomainId: req.remoteRouter.receiverDomainId };
|
|
1512
|
-
}
|
|
1513
|
-
async unenrollRemoteRouter(req) {
|
|
1514
|
-
const tx = await this.getUnenrollRemoteRouterTransaction({
|
|
1515
|
-
signer: this.signerAddress,
|
|
1516
|
-
...req,
|
|
1517
|
-
});
|
|
1518
|
-
await this.sendAndConfirmTransaction(tx);
|
|
1519
|
-
return { receiverDomainId: req.receiverDomainId };
|
|
1520
|
-
}
|
|
1521
|
-
async transfer(req) {
|
|
1522
|
-
const tx = await this.getTransferTransaction({
|
|
1523
|
-
signer: this.signerAddress,
|
|
1524
|
-
...req,
|
|
1525
|
-
});
|
|
1526
|
-
await this.sendAndConfirmTransaction(tx);
|
|
1527
|
-
return { recipient: req.recipient };
|
|
1528
|
-
}
|
|
1529
984
|
async remoteTransfer(req) {
|
|
1530
985
|
const token = await this.getToken({ tokenAddress: req.tokenAddress });
|
|
1531
986
|
const tokenType = token.tokenType;
|
|
@@ -1535,32 +990,32 @@ class StarknetSigner extends StarknetProvider {
|
|
|
1535
990
|
}, token);
|
|
1536
991
|
const batchedTxs = [];
|
|
1537
992
|
if (tokenType === dist/* AltVM.TokenType */.bx.ks.native) {
|
|
1538
|
-
const nativeToken = getStarknetContract(StarknetContractName.ETHER, token.denom, this.provider,
|
|
993
|
+
const nativeToken = getStarknetContract(StarknetContractName.ETHER, token.denom, this.provider, runtime/* ContractType */.h$.TOKEN);
|
|
1539
994
|
batchedTxs.push(await populateInvokeTx(nativeToken, 'approve', [
|
|
1540
|
-
|
|
995
|
+
contracts_normalizeStarknetAddressSafe(req.tokenAddress),
|
|
1541
996
|
toBigInt(req.amount) + toBigInt(req.maxFee.amount),
|
|
1542
997
|
]));
|
|
1543
998
|
}
|
|
1544
999
|
else if (tokenType === dist/* AltVM.TokenType */.bx.ks.collateral) {
|
|
1545
|
-
const collateralToken = getStarknetContract(StarknetContractName.ETHER, token.denom, this.provider,
|
|
1546
|
-
const collateralDenom =
|
|
1547
|
-
const feeDenom =
|
|
1000
|
+
const collateralToken = getStarknetContract(StarknetContractName.ETHER, token.denom, this.provider, runtime/* ContractType */.h$.TOKEN);
|
|
1001
|
+
const collateralDenom = contracts_normalizeStarknetAddressSafe(token.denom);
|
|
1002
|
+
const feeDenom = contracts_normalizeStarknetAddressSafe(req.maxFee.denom);
|
|
1548
1003
|
const approvalAmount = collateralDenom === feeDenom
|
|
1549
1004
|
? toBigInt(req.amount) + toBigInt(req.maxFee.amount)
|
|
1550
1005
|
: toBigInt(req.amount);
|
|
1551
1006
|
batchedTxs.push(await populateInvokeTx(collateralToken, 'approve', [
|
|
1552
|
-
|
|
1007
|
+
contracts_normalizeStarknetAddressSafe(req.tokenAddress),
|
|
1553
1008
|
approvalAmount,
|
|
1554
1009
|
]));
|
|
1555
1010
|
}
|
|
1556
1011
|
const usesSharedCollateralAndFeeToken = tokenType === dist/* AltVM.TokenType */.bx.ks.collateral &&
|
|
1557
|
-
|
|
1558
|
-
|
|
1012
|
+
contracts_normalizeStarknetAddressSafe(token.denom) ===
|
|
1013
|
+
contracts_normalizeStarknetAddressSafe(req.maxFee.denom);
|
|
1559
1014
|
if (tokenType !== dist/* AltVM.TokenType */.bx.ks.native &&
|
|
1560
1015
|
!usesSharedCollateralAndFeeToken) {
|
|
1561
|
-
const feeToken = getStarknetContract(StarknetContractName.ETHER, req.maxFee.denom, this.provider,
|
|
1016
|
+
const feeToken = getStarknetContract(StarknetContractName.ETHER, req.maxFee.denom, this.provider, runtime/* ContractType */.h$.TOKEN);
|
|
1562
1017
|
batchedTxs.push(await populateInvokeTx(feeToken, 'approve', [
|
|
1563
|
-
|
|
1018
|
+
contracts_normalizeStarknetAddressSafe(req.tokenAddress),
|
|
1564
1019
|
toBigInt(req.maxFee.amount),
|
|
1565
1020
|
]));
|
|
1566
1021
|
}
|
|
@@ -1574,6 +1029,36 @@ class StarknetSigner extends StarknetProvider {
|
|
|
1574
1029
|
}
|
|
1575
1030
|
}
|
|
1576
1031
|
//# sourceMappingURL=signer.js.map
|
|
1032
|
+
;// CONCATENATED MODULE: ../starknet-sdk/dist/hook/hook-query.js
|
|
1033
|
+
|
|
1034
|
+
|
|
1035
|
+
function parseHookVariant(variant) {
|
|
1036
|
+
const upper = variant.toUpperCase();
|
|
1037
|
+
if (upper.includes('MERKLE_TREE'))
|
|
1038
|
+
return dist/* AltVM.HookType */.bx.WD.MERKLE_TREE;
|
|
1039
|
+
if (upper.includes('PROTOCOL_FEE'))
|
|
1040
|
+
return dist/* AltVM.HookType */.bx.WD.PROTOCOL_FEE;
|
|
1041
|
+
if (upper.includes('INTERCHAIN_GAS_PAYMASTER')) {
|
|
1042
|
+
return dist/* AltVM.HookType */.bx.WD.INTERCHAIN_GAS_PAYMASTER;
|
|
1043
|
+
}
|
|
1044
|
+
return dist/* AltVM.HookType */.bx.WD.CUSTOM;
|
|
1045
|
+
}
|
|
1046
|
+
async function getHookType(provider, hookAddress) {
|
|
1047
|
+
try {
|
|
1048
|
+
const hook = getStarknetContract(StarknetContractName.HOOK, hookAddress, provider);
|
|
1049
|
+
const hookType = await callContract(hook, 'hook_type');
|
|
1050
|
+
return parseHookVariant(extractEnumVariant(hookType));
|
|
1051
|
+
}
|
|
1052
|
+
catch (error) {
|
|
1053
|
+
if (!isProbeMiss(error))
|
|
1054
|
+
throw error;
|
|
1055
|
+
return dist/* AltVM.HookType */.bx.WD.CUSTOM;
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1058
|
+
function getMerkleTreeHookConfig(hookAddress) {
|
|
1059
|
+
return { address: normalizeStarknetAddressSafe(hookAddress) };
|
|
1060
|
+
}
|
|
1061
|
+
//# sourceMappingURL=hook-query.js.map
|
|
1577
1062
|
;// CONCATENATED MODULE: ../starknet-sdk/dist/hook/interchain-gas-paymaster-hook-artifact-manager.js
|
|
1578
1063
|
|
|
1579
1064
|
|
|
@@ -1600,17 +1085,38 @@ function createStarknetInterchainGasPaymasterHookWriter() {
|
|
|
1600
1085
|
//# sourceMappingURL=interchain-gas-paymaster-hook-artifact-manager.js.map
|
|
1601
1086
|
// EXTERNAL MODULE: ../provider-sdk/dist/artifact.js
|
|
1602
1087
|
var dist_artifact = __webpack_require__(4287);
|
|
1088
|
+
;// CONCATENATED MODULE: ../starknet-sdk/dist/hook/hook-tx.js
|
|
1089
|
+
|
|
1090
|
+
function getCreateMerkleTreeHookTx(signer, mailboxAddress) {
|
|
1091
|
+
return {
|
|
1092
|
+
kind: 'deploy',
|
|
1093
|
+
contractName: StarknetContractName.MERKLE_TREE_HOOK,
|
|
1094
|
+
constructorArgs: [
|
|
1095
|
+
contracts_normalizeStarknetAddressSafe(mailboxAddress),
|
|
1096
|
+
contracts_normalizeStarknetAddressSafe(signer),
|
|
1097
|
+
],
|
|
1098
|
+
};
|
|
1099
|
+
}
|
|
1100
|
+
function getCreateNoopHookTx() {
|
|
1101
|
+
return {
|
|
1102
|
+
kind: 'deploy',
|
|
1103
|
+
contractName: StarknetContractName.HOOK,
|
|
1104
|
+
constructorArgs: [],
|
|
1105
|
+
};
|
|
1106
|
+
}
|
|
1107
|
+
//# sourceMappingURL=hook-tx.js.map
|
|
1603
1108
|
;// CONCATENATED MODULE: ../starknet-sdk/dist/hook/merkle-tree-hook-artifact-manager.js
|
|
1604
1109
|
|
|
1605
1110
|
|
|
1606
1111
|
|
|
1607
1112
|
|
|
1113
|
+
|
|
1608
1114
|
class StarknetMerkleTreeHookReader {
|
|
1609
1115
|
async read(address) {
|
|
1610
1116
|
return {
|
|
1611
1117
|
artifactState: dist_artifact/* ArtifactState */.O2.DEPLOYED,
|
|
1612
1118
|
config: { type: dist/* AltVM.HookType */.bx.WD.MERKLE_TREE },
|
|
1613
|
-
deployed: { address:
|
|
1119
|
+
deployed: { address: contracts_normalizeStarknetAddressSafe(address) },
|
|
1614
1120
|
};
|
|
1615
1121
|
}
|
|
1616
1122
|
}
|
|
@@ -1623,10 +1129,7 @@ class StarknetMerkleTreeHookWriter extends StarknetMerkleTreeHookReader {
|
|
|
1623
1129
|
this.mailboxAddress = mailboxAddress;
|
|
1624
1130
|
}
|
|
1625
1131
|
async create(artifact) {
|
|
1626
|
-
const tx =
|
|
1627
|
-
signer: this.signer.getSignerAddress(),
|
|
1628
|
-
mailboxAddress: this.mailboxAddress,
|
|
1629
|
-
});
|
|
1132
|
+
const tx = getCreateMerkleTreeHookTx(this.signer.getSignerAddress(), this.mailboxAddress);
|
|
1630
1133
|
const receipt = await this.signer.sendAndConfirmTransaction(tx);
|
|
1631
1134
|
const hookAddress = receipt.contractAddress;
|
|
1632
1135
|
(0,validation/* assert */.v)(hookAddress, 'failed to deploy Starknet merkle tree hook');
|
|
@@ -1706,15 +1209,15 @@ class StarknetProtocolFeeHookReader {
|
|
|
1706
1209
|
this.provider = provider;
|
|
1707
1210
|
}
|
|
1708
1211
|
async read(address) {
|
|
1709
|
-
const normalizedAddress =
|
|
1212
|
+
const normalizedAddress = contracts_normalizeStarknetAddressSafe(address);
|
|
1710
1213
|
const hook = getStarknetContract(StarknetContractName.PROTOCOL_FEE, normalizedAddress, this.provider.getRawProvider());
|
|
1711
1214
|
const [owner, beneficiary, protocolFee] = await Promise.all([
|
|
1712
1215
|
callContract(hook, 'owner'),
|
|
1713
1216
|
callContract(hook, 'get_beneficiary'),
|
|
1714
1217
|
callContract(hook, 'get_protocol_fee'),
|
|
1715
1218
|
]);
|
|
1716
|
-
const ownerAddress =
|
|
1717
|
-
const beneficiaryAddress =
|
|
1219
|
+
const ownerAddress = contracts_normalizeStarknetAddressSafe(owner);
|
|
1220
|
+
const beneficiaryAddress = contracts_normalizeStarknetAddressSafe(beneficiary);
|
|
1718
1221
|
const protocolFeeAmount = toBigInt(protocolFee);
|
|
1719
1222
|
const maxProtocolFee = await readProtocolFeeMaxFromStorage(this.provider, normalizedAddress, protocolFeeAmount);
|
|
1720
1223
|
const config = {
|
|
@@ -1758,8 +1261,8 @@ class StarknetProtocolFeeHookWriter extends StarknetProtocolFeeHookReader {
|
|
|
1758
1261
|
constructorArgs: [
|
|
1759
1262
|
artifact.config.maxProtocolFee,
|
|
1760
1263
|
artifact.config.protocolFee,
|
|
1761
|
-
|
|
1762
|
-
|
|
1264
|
+
contracts_normalizeStarknetAddressSafe(artifact.config.beneficiary),
|
|
1265
|
+
contracts_normalizeStarknetAddressSafe(artifact.config.owner),
|
|
1763
1266
|
tokenAddress,
|
|
1764
1267
|
],
|
|
1765
1268
|
};
|
|
@@ -1770,7 +1273,7 @@ class StarknetProtocolFeeHookWriter extends StarknetProtocolFeeHookReader {
|
|
|
1770
1273
|
artifactState: dist_artifact/* ArtifactState */.O2.DEPLOYED,
|
|
1771
1274
|
config: artifact.config,
|
|
1772
1275
|
deployed: {
|
|
1773
|
-
address:
|
|
1276
|
+
address: contracts_normalizeStarknetAddressSafe(receipt.contractAddress),
|
|
1774
1277
|
},
|
|
1775
1278
|
},
|
|
1776
1279
|
[receipt],
|
|
@@ -1790,7 +1293,7 @@ class StarknetProtocolFeeHookWriter extends StarknetProtocolFeeHookReader {
|
|
|
1790
1293
|
txs.push({
|
|
1791
1294
|
annotation: `Updating protocol fee beneficiary for ${contractAddress}`,
|
|
1792
1295
|
...(await populateInvokeTx(contract, 'set_beneficiary', [
|
|
1793
|
-
|
|
1296
|
+
contracts_normalizeStarknetAddressSafe(artifact.config.beneficiary),
|
|
1794
1297
|
])),
|
|
1795
1298
|
});
|
|
1796
1299
|
}
|
|
@@ -1806,7 +1309,7 @@ class StarknetProtocolFeeHookWriter extends StarknetProtocolFeeHookReader {
|
|
|
1806
1309
|
txs.push({
|
|
1807
1310
|
annotation: `Transferring protocol fee hook ownership for ${contractAddress}`,
|
|
1808
1311
|
...(await populateInvokeTx(contract, 'transfer_ownership', [
|
|
1809
|
-
|
|
1312
|
+
contracts_normalizeStarknetAddressSafe(artifact.config.owner),
|
|
1810
1313
|
])),
|
|
1811
1314
|
});
|
|
1812
1315
|
}
|
|
@@ -1822,7 +1325,7 @@ class StarknetUnknownHookReader {
|
|
|
1822
1325
|
return {
|
|
1823
1326
|
artifactState: dist_artifact/* ArtifactState */.O2.DEPLOYED,
|
|
1824
1327
|
config: { type: 'unknownHook' },
|
|
1825
|
-
deployed: { address:
|
|
1328
|
+
deployed: { address: contracts_normalizeStarknetAddressSafe(address) },
|
|
1826
1329
|
};
|
|
1827
1330
|
}
|
|
1828
1331
|
}
|
|
@@ -1846,15 +1349,16 @@ class StarknetUnknownHookWriter extends StarknetUnknownHookReader {
|
|
|
1846
1349
|
|
|
1847
1350
|
|
|
1848
1351
|
|
|
1352
|
+
|
|
1849
1353
|
class StarknetHookArtifactManager {
|
|
1850
1354
|
chainMetadata;
|
|
1851
1355
|
provider;
|
|
1852
1356
|
mailboxAddress;
|
|
1853
1357
|
constructor(chainMetadata, context) {
|
|
1854
1358
|
this.chainMetadata = chainMetadata;
|
|
1855
|
-
this.provider = StarknetProvider.connect(
|
|
1359
|
+
this.provider = StarknetProvider.connect(chainMetadata);
|
|
1856
1360
|
this.mailboxAddress = context?.mailbox
|
|
1857
|
-
?
|
|
1361
|
+
? contracts_normalizeStarknetAddressSafe(context.mailbox)
|
|
1858
1362
|
: '';
|
|
1859
1363
|
}
|
|
1860
1364
|
requireStarknetSigner(signer) {
|
|
@@ -1862,9 +1366,7 @@ class StarknetHookArtifactManager {
|
|
|
1862
1366
|
return signer;
|
|
1863
1367
|
}
|
|
1864
1368
|
async readHook(address) {
|
|
1865
|
-
const hookType = await this.provider.
|
|
1866
|
-
hookAddress: address,
|
|
1867
|
-
});
|
|
1369
|
+
const hookType = await getHookType(this.provider.getRawProvider(), address);
|
|
1868
1370
|
switch (hookType) {
|
|
1869
1371
|
case dist/* AltVM.HookType */.bx.WD.CUSTOM:
|
|
1870
1372
|
return this.createReader('unknownHook').read(address);
|
|
@@ -1908,19 +1410,238 @@ class StarknetHookArtifactManager {
|
|
|
1908
1410
|
//# sourceMappingURL=hook-artifact-manager.js.map
|
|
1909
1411
|
// EXTERNAL MODULE: ../provider-sdk/dist/ism.js
|
|
1910
1412
|
var ism = __webpack_require__(96426);
|
|
1413
|
+
;// CONCATENATED MODULE: ../starknet-sdk/dist/ism/ism-query.js
|
|
1414
|
+
|
|
1415
|
+
|
|
1416
|
+
|
|
1417
|
+
|
|
1418
|
+
function parseIsmVariant(variant) {
|
|
1419
|
+
const upper = variant.toUpperCase();
|
|
1420
|
+
if (upper === 'AGGREGATION')
|
|
1421
|
+
return dist/* AltVM.IsmType */.bx.GO.AGGREGATION;
|
|
1422
|
+
if (upper.includes('MERKLE_ROOT_MULTISIG')) {
|
|
1423
|
+
return dist/* AltVM.IsmType */.bx.GO.MERKLE_ROOT_MULTISIG;
|
|
1424
|
+
}
|
|
1425
|
+
if (upper.includes('MESSAGE_ID_MULTISIG')) {
|
|
1426
|
+
return dist/* AltVM.IsmType */.bx.GO.MESSAGE_ID_MULTISIG;
|
|
1427
|
+
}
|
|
1428
|
+
if (upper.includes('ROUTING')) {
|
|
1429
|
+
return dist/* AltVM.IsmType */.bx.GO.ROUTING;
|
|
1430
|
+
}
|
|
1431
|
+
return dist/* AltVM.IsmType */.bx.GO.CUSTOM;
|
|
1432
|
+
}
|
|
1433
|
+
async function getIsmType(provider, ismAddress) {
|
|
1434
|
+
try {
|
|
1435
|
+
const ism = getStarknetContract(StarknetContractName.MERKLE_ROOT_MULTISIG_ISM, ismAddress, provider);
|
|
1436
|
+
const moduleType = await callContract(ism, 'module_type');
|
|
1437
|
+
const variant = extractEnumVariant(moduleType).toUpperCase();
|
|
1438
|
+
if (variant === 'NULL') {
|
|
1439
|
+
// NULL is shared by pausable and noop ISMs; it does not mean accept-all.
|
|
1440
|
+
const pausable = getStarknetContract(StarknetContractName.PAUSABLE_ISM, ismAddress, provider);
|
|
1441
|
+
try {
|
|
1442
|
+
await callContract(pausable, 'is_paused');
|
|
1443
|
+
return dist/* AltVM.IsmType */.bx.GO.PAUSABLE;
|
|
1444
|
+
}
|
|
1445
|
+
catch (error) {
|
|
1446
|
+
if (!isProbeMiss(error))
|
|
1447
|
+
throw error;
|
|
1448
|
+
}
|
|
1449
|
+
const classHash = await provider.getClassHashAt(ismAddress);
|
|
1450
|
+
return BigInt(classHash) ===
|
|
1451
|
+
BigInt((0,runtime/* getContractClassHash */.Vd)(StarknetContractName.NOOP_ISM))
|
|
1452
|
+
? dist/* AltVM.IsmType */.bx.GO.TEST_ISM
|
|
1453
|
+
: dist/* AltVM.IsmType */.bx.GO.CUSTOM;
|
|
1454
|
+
}
|
|
1455
|
+
return parseIsmVariant(variant);
|
|
1456
|
+
}
|
|
1457
|
+
catch (error) {
|
|
1458
|
+
if (!isProbeMiss(error))
|
|
1459
|
+
throw error;
|
|
1460
|
+
return dist/* AltVM.IsmType */.bx.GO.CUSTOM;
|
|
1461
|
+
}
|
|
1462
|
+
}
|
|
1463
|
+
async function getMultisigIsmConfig(provider, ismAddress, contractName) {
|
|
1464
|
+
const ism = getStarknetContract(contractName, ismAddress, provider);
|
|
1465
|
+
const [validators, threshold] = await Promise.all([
|
|
1466
|
+
callContract(ism, 'get_validators'),
|
|
1467
|
+
callContract(ism, 'get_threshold'),
|
|
1468
|
+
]);
|
|
1469
|
+
(0,validation/* assert */.v)(Array.isArray(validators), 'Expected Starknet validators array');
|
|
1470
|
+
return {
|
|
1471
|
+
address: contracts_normalizeStarknetAddressSafe(ismAddress),
|
|
1472
|
+
threshold: toNumber(threshold),
|
|
1473
|
+
validators: validators.map((v) => addressToEvmAddress(v)),
|
|
1474
|
+
};
|
|
1475
|
+
}
|
|
1476
|
+
async function getMessageIdMultisigIsmConfig(provider, ismAddress) {
|
|
1477
|
+
return getMultisigIsmConfig(provider, ismAddress, StarknetContractName.MESSAGE_ID_MULTISIG_ISM);
|
|
1478
|
+
}
|
|
1479
|
+
async function getMerkleRootMultisigIsmConfig(provider, ismAddress) {
|
|
1480
|
+
return getMultisigIsmConfig(provider, ismAddress, StarknetContractName.MERKLE_ROOT_MULTISIG_ISM);
|
|
1481
|
+
}
|
|
1482
|
+
async function getRoutingIsmConfig(provider, ismAddress) {
|
|
1483
|
+
const ism = getStarknetContract(StarknetContractName.ROUTING_ISM, ismAddress, provider);
|
|
1484
|
+
const [owner, domains] = await Promise.all([
|
|
1485
|
+
callContract(ism, 'owner'),
|
|
1486
|
+
callContract(ism, 'domains'),
|
|
1487
|
+
]);
|
|
1488
|
+
(0,validation/* assert */.v)(Array.isArray(domains), 'Expected Starknet routing domains array');
|
|
1489
|
+
const routes = await Promise.all(domains.map(async (domainId) => {
|
|
1490
|
+
const routeAddress = await callContract(ism, 'module', [domainId]);
|
|
1491
|
+
return {
|
|
1492
|
+
domainId: toNumber(domainId),
|
|
1493
|
+
ismAddress: contracts_normalizeStarknetAddressSafe(routeAddress),
|
|
1494
|
+
};
|
|
1495
|
+
}));
|
|
1496
|
+
return {
|
|
1497
|
+
address: contracts_normalizeStarknetAddressSafe(ismAddress),
|
|
1498
|
+
owner: contracts_normalizeStarknetAddressSafe(owner),
|
|
1499
|
+
routes,
|
|
1500
|
+
};
|
|
1501
|
+
}
|
|
1502
|
+
function getNoopIsmConfig(ismAddress) {
|
|
1503
|
+
return { address: contracts_normalizeStarknetAddressSafe(ismAddress) };
|
|
1504
|
+
}
|
|
1505
|
+
async function getAggregationIsmConfig(provider, ismAddress) {
|
|
1506
|
+
const ism = getStarknetContract(StarknetContractName.AGGREGATION_ISM, ismAddress, provider);
|
|
1507
|
+
const [modules, threshold] = await Promise.all([
|
|
1508
|
+
callContract(ism, 'get_modules'),
|
|
1509
|
+
callContract(ism, 'get_threshold'),
|
|
1510
|
+
]);
|
|
1511
|
+
(0,validation/* assert */.v)(Array.isArray(modules), 'Expected Starknet aggregation modules array');
|
|
1512
|
+
return {
|
|
1513
|
+
address: contracts_normalizeStarknetAddressSafe(ismAddress),
|
|
1514
|
+
modules: modules.map(contracts_normalizeStarknetAddressSafe),
|
|
1515
|
+
threshold: toNumber(threshold),
|
|
1516
|
+
};
|
|
1517
|
+
}
|
|
1518
|
+
async function getPausableIsmConfig(provider, ismAddress) {
|
|
1519
|
+
const ism = getStarknetContract(StarknetContractName.PAUSABLE_ISM, ismAddress, provider);
|
|
1520
|
+
const [owner, paused] = await Promise.all([
|
|
1521
|
+
callContract(ism, 'owner'),
|
|
1522
|
+
callContract(ism, 'is_paused'),
|
|
1523
|
+
]);
|
|
1524
|
+
(0,validation/* assert */.v)(typeof paused === 'boolean', 'Expected Starknet paused boolean');
|
|
1525
|
+
return {
|
|
1526
|
+
address: contracts_normalizeStarknetAddressSafe(ismAddress),
|
|
1527
|
+
owner: contracts_normalizeStarknetAddressSafe(owner),
|
|
1528
|
+
paused,
|
|
1529
|
+
};
|
|
1530
|
+
}
|
|
1531
|
+
//# sourceMappingURL=ism-query.js.map
|
|
1532
|
+
;// CONCATENATED MODULE: ../starknet-sdk/dist/ism/aggregation-ism-artifact-reader.js
|
|
1533
|
+
|
|
1534
|
+
|
|
1535
|
+
class StarknetAggregationIsmReader {
|
|
1536
|
+
provider;
|
|
1537
|
+
constructor(provider) {
|
|
1538
|
+
this.provider = provider;
|
|
1539
|
+
}
|
|
1540
|
+
async read(address) {
|
|
1541
|
+
const config = await getAggregationIsmConfig(this.provider.getRawProvider(), address);
|
|
1542
|
+
return {
|
|
1543
|
+
artifactState: dist_artifact/* ArtifactState */.O2.DEPLOYED,
|
|
1544
|
+
config: {
|
|
1545
|
+
type: 'staticAggregationIsm',
|
|
1546
|
+
threshold: config.threshold,
|
|
1547
|
+
modules: config.modules.map((address) => ({
|
|
1548
|
+
artifactState: dist_artifact/* ArtifactState */.O2.UNDERIVED,
|
|
1549
|
+
deployed: { address },
|
|
1550
|
+
})),
|
|
1551
|
+
},
|
|
1552
|
+
deployed: { address: config.address },
|
|
1553
|
+
};
|
|
1554
|
+
}
|
|
1555
|
+
}
|
|
1556
|
+
class StarknetPausableIsmReader {
|
|
1557
|
+
provider;
|
|
1558
|
+
constructor(provider) {
|
|
1559
|
+
this.provider = provider;
|
|
1560
|
+
}
|
|
1561
|
+
async read(address) {
|
|
1562
|
+
const config = await getPausableIsmConfig(this.provider.getRawProvider(), address);
|
|
1563
|
+
return {
|
|
1564
|
+
artifactState: dist_artifact/* ArtifactState */.O2.DEPLOYED,
|
|
1565
|
+
config: {
|
|
1566
|
+
type: 'pausableIsm',
|
|
1567
|
+
owner: config.owner,
|
|
1568
|
+
paused: config.paused,
|
|
1569
|
+
},
|
|
1570
|
+
deployed: { address: config.address },
|
|
1571
|
+
};
|
|
1572
|
+
}
|
|
1573
|
+
}
|
|
1574
|
+
//# sourceMappingURL=aggregation-ism-artifact-reader.js.map
|
|
1575
|
+
;// CONCATENATED MODULE: ../starknet-sdk/dist/ism/ism-tx.js
|
|
1576
|
+
|
|
1577
|
+
|
|
1578
|
+
function getCreateMerkleRootMultisigIsmTx(signer, config) {
|
|
1579
|
+
return {
|
|
1580
|
+
kind: 'deploy',
|
|
1581
|
+
contractName: StarknetContractName.MERKLE_ROOT_MULTISIG_ISM,
|
|
1582
|
+
constructorArgs: [
|
|
1583
|
+
contracts_normalizeStarknetAddressSafe(signer),
|
|
1584
|
+
config.validators.map((validator) => (0,addresses/* addressToBytes32 */.In)(validator)),
|
|
1585
|
+
config.threshold,
|
|
1586
|
+
],
|
|
1587
|
+
};
|
|
1588
|
+
}
|
|
1589
|
+
function getCreateMessageIdMultisigIsmTx(signer, config) {
|
|
1590
|
+
return {
|
|
1591
|
+
kind: 'deploy',
|
|
1592
|
+
contractName: StarknetContractName.MESSAGE_ID_MULTISIG_ISM,
|
|
1593
|
+
constructorArgs: [
|
|
1594
|
+
contracts_normalizeStarknetAddressSafe(signer),
|
|
1595
|
+
config.validators.map((validator) => (0,addresses/* addressToBytes32 */.In)(validator)),
|
|
1596
|
+
config.threshold,
|
|
1597
|
+
],
|
|
1598
|
+
};
|
|
1599
|
+
}
|
|
1600
|
+
function getCreateRoutingIsmTx(signer) {
|
|
1601
|
+
return {
|
|
1602
|
+
kind: 'deploy',
|
|
1603
|
+
contractName: StarknetContractName.ROUTING_ISM,
|
|
1604
|
+
constructorArgs: [contracts_normalizeStarknetAddressSafe(signer)],
|
|
1605
|
+
};
|
|
1606
|
+
}
|
|
1607
|
+
async function getSetRoutingIsmRouteTx(provider, config) {
|
|
1608
|
+
const routing = getStarknetContract(StarknetContractName.ROUTING_ISM, config.ismAddress, provider);
|
|
1609
|
+
return populateInvokeTx(routing, 'set', [
|
|
1610
|
+
config.route.domainId,
|
|
1611
|
+
contracts_normalizeStarknetAddressSafe(config.route.ismAddress),
|
|
1612
|
+
]);
|
|
1613
|
+
}
|
|
1614
|
+
async function getRemoveRoutingIsmRouteTx(provider, config) {
|
|
1615
|
+
const routing = getStarknetContract(StarknetContractName.ROUTING_ISM, config.ismAddress, provider);
|
|
1616
|
+
return populateInvokeTx(routing, 'remove', [config.domainId]);
|
|
1617
|
+
}
|
|
1618
|
+
async function getSetRoutingIsmOwnerTx(provider, config) {
|
|
1619
|
+
const routing = getStarknetContract(StarknetContractName.ROUTING_ISM, config.ismAddress, provider);
|
|
1620
|
+
return populateInvokeTx(routing, 'transfer_ownership', [
|
|
1621
|
+
contracts_normalizeStarknetAddressSafe(config.newOwner),
|
|
1622
|
+
]);
|
|
1623
|
+
}
|
|
1624
|
+
function getCreateNoopIsmTx() {
|
|
1625
|
+
return {
|
|
1626
|
+
kind: 'deploy',
|
|
1627
|
+
contractName: StarknetContractName.NOOP_ISM,
|
|
1628
|
+
constructorArgs: [],
|
|
1629
|
+
};
|
|
1630
|
+
}
|
|
1631
|
+
//# sourceMappingURL=ism-tx.js.map
|
|
1911
1632
|
;// CONCATENATED MODULE: ../starknet-sdk/dist/ism/domain-routing-ism-artifact-manager.js
|
|
1912
1633
|
|
|
1913
1634
|
|
|
1914
1635
|
|
|
1636
|
+
|
|
1637
|
+
|
|
1915
1638
|
class StarknetRoutingIsmReader {
|
|
1916
1639
|
provider;
|
|
1917
1640
|
constructor(provider) {
|
|
1918
1641
|
this.provider = provider;
|
|
1919
1642
|
}
|
|
1920
1643
|
async read(address) {
|
|
1921
|
-
const routing = await this.provider.
|
|
1922
|
-
ismAddress: address,
|
|
1923
|
-
});
|
|
1644
|
+
const routing = await getRoutingIsmConfig(this.provider.getRawProvider(), address);
|
|
1924
1645
|
const domains = {};
|
|
1925
1646
|
for (const route of routing.routes) {
|
|
1926
1647
|
domains[route.domainId] = {
|
|
@@ -1955,25 +1676,21 @@ class StarknetRoutingIsmWriter extends StarknetRoutingIsmReader {
|
|
|
1955
1676
|
};
|
|
1956
1677
|
});
|
|
1957
1678
|
const receipts = [];
|
|
1958
|
-
const createTx =
|
|
1959
|
-
signer: this.signer.getSignerAddress(),
|
|
1960
|
-
routes,
|
|
1961
|
-
});
|
|
1679
|
+
const createTx = getCreateRoutingIsmTx(this.signer.getSignerAddress());
|
|
1962
1680
|
const createReceipt = await this.signer.sendAndConfirmTransaction(createTx);
|
|
1963
1681
|
receipts.push(createReceipt);
|
|
1964
1682
|
const ismAddress = createReceipt.contractAddress;
|
|
1965
1683
|
(0,validation/* assert */.v)(ismAddress, 'failed to get Starknet routing ISM address');
|
|
1684
|
+
const rawProvider = this.signer.getRawProvider();
|
|
1966
1685
|
for (const route of routes) {
|
|
1967
|
-
const tx = await
|
|
1968
|
-
signer: this.signer.getSignerAddress(),
|
|
1686
|
+
const tx = await getSetRoutingIsmRouteTx(rawProvider, {
|
|
1969
1687
|
ismAddress,
|
|
1970
1688
|
route,
|
|
1971
1689
|
});
|
|
1972
1690
|
receipts.push(await this.signer.sendAndConfirmTransaction(tx));
|
|
1973
1691
|
}
|
|
1974
1692
|
if (!(0,addresses/* eqAddressStarknet */.PD)(artifact.config.owner, this.signer.getSignerAddress())) {
|
|
1975
|
-
const ownerTx = await
|
|
1976
|
-
signer: this.signer.getSignerAddress(),
|
|
1693
|
+
const ownerTx = await getSetRoutingIsmOwnerTx(rawProvider, {
|
|
1977
1694
|
ismAddress,
|
|
1978
1695
|
newOwner: artifact.config.owner,
|
|
1979
1696
|
});
|
|
@@ -1994,25 +1711,25 @@ class StarknetRoutingIsmWriter extends StarknetRoutingIsmReader {
|
|
|
1994
1711
|
if ((0,dist_artifact/* isArtifactUnderived */.l2)(domainIsm) || (0,dist_artifact/* isArtifactDeployed */.R)(domainIsm)) {
|
|
1995
1712
|
return {
|
|
1996
1713
|
domainId: Number(domainId),
|
|
1997
|
-
ismAddress:
|
|
1714
|
+
ismAddress: contracts_normalizeStarknetAddressSafe(domainIsm.deployed.address),
|
|
1998
1715
|
};
|
|
1999
1716
|
}
|
|
2000
1717
|
throw new Error(`Routing ISM domain ${domainId} has invalid state`);
|
|
2001
1718
|
});
|
|
2002
1719
|
const actualByDomain = new Map(Object.entries(current.config.domains).map(([domainId, domainIsm]) => [
|
|
2003
1720
|
Number(domainId),
|
|
2004
|
-
|
|
1721
|
+
contracts_normalizeStarknetAddressSafe(domainIsm.deployed.address),
|
|
2005
1722
|
]));
|
|
2006
1723
|
const expectedByDomain = new Map(expectedRoutes.map((route) => [route.domainId, route.ismAddress]));
|
|
2007
1724
|
const updateTxs = [];
|
|
1725
|
+
const rawProvider = this.signer.getRawProvider();
|
|
2008
1726
|
for (const route of expectedRoutes) {
|
|
2009
1727
|
const actualAddress = actualByDomain.get(route.domainId);
|
|
2010
1728
|
if (!actualAddress ||
|
|
2011
1729
|
!(0,addresses/* eqAddressStarknet */.PD)(actualAddress, route.ismAddress)) {
|
|
2012
1730
|
updateTxs.push({
|
|
2013
1731
|
annotation: `Setting routing ISM route ${route.domainId}`,
|
|
2014
|
-
...(await
|
|
2015
|
-
signer: this.signer.getSignerAddress(),
|
|
1732
|
+
...(await getSetRoutingIsmRouteTx(rawProvider, {
|
|
2016
1733
|
ismAddress: artifact.deployed.address,
|
|
2017
1734
|
route,
|
|
2018
1735
|
})),
|
|
@@ -2023,8 +1740,7 @@ class StarknetRoutingIsmWriter extends StarknetRoutingIsmReader {
|
|
|
2023
1740
|
if (!expectedByDomain.has(domainId)) {
|
|
2024
1741
|
updateTxs.push({
|
|
2025
1742
|
annotation: `Removing routing ISM route ${domainId}`,
|
|
2026
|
-
...(await
|
|
2027
|
-
signer: this.signer.getSignerAddress(),
|
|
1743
|
+
...(await getRemoveRoutingIsmRouteTx(rawProvider, {
|
|
2028
1744
|
ismAddress: artifact.deployed.address,
|
|
2029
1745
|
domainId,
|
|
2030
1746
|
})),
|
|
@@ -2034,8 +1750,7 @@ class StarknetRoutingIsmWriter extends StarknetRoutingIsmReader {
|
|
|
2034
1750
|
if (!(0,addresses/* eqAddressStarknet */.PD)(current.config.owner, artifact.config.owner)) {
|
|
2035
1751
|
updateTxs.push({
|
|
2036
1752
|
annotation: `Updating routing ISM owner`,
|
|
2037
|
-
...(await
|
|
2038
|
-
signer: this.signer.getSignerAddress(),
|
|
1753
|
+
...(await getSetRoutingIsmOwnerTx(rawProvider, {
|
|
2039
1754
|
ismAddress: artifact.deployed.address,
|
|
2040
1755
|
newOwner: artifact.config.owner,
|
|
2041
1756
|
})),
|
|
@@ -2049,15 +1764,15 @@ class StarknetRoutingIsmWriter extends StarknetRoutingIsmReader {
|
|
|
2049
1764
|
|
|
2050
1765
|
|
|
2051
1766
|
|
|
1767
|
+
|
|
1768
|
+
|
|
2052
1769
|
class StarknetMerkleRootMultisigIsmReader {
|
|
2053
1770
|
provider;
|
|
2054
1771
|
constructor(provider) {
|
|
2055
1772
|
this.provider = provider;
|
|
2056
1773
|
}
|
|
2057
1774
|
async read(address) {
|
|
2058
|
-
const ism = await this.provider.
|
|
2059
|
-
ismAddress: address,
|
|
2060
|
-
});
|
|
1775
|
+
const ism = await getMerkleRootMultisigIsmConfig(this.provider.getRawProvider(), address);
|
|
2061
1776
|
return {
|
|
2062
1777
|
artifactState: dist_artifact/* ArtifactState */.O2.DEPLOYED,
|
|
2063
1778
|
config: {
|
|
@@ -2076,8 +1791,7 @@ class StarknetMerkleRootMultisigIsmWriter extends StarknetMerkleRootMultisigIsmR
|
|
|
2076
1791
|
this.signer = signer;
|
|
2077
1792
|
}
|
|
2078
1793
|
async create(artifact) {
|
|
2079
|
-
const tx =
|
|
2080
|
-
signer: this.signer.getSignerAddress(),
|
|
1794
|
+
const tx = getCreateMerkleRootMultisigIsmTx(this.signer.getSignerAddress(), {
|
|
2081
1795
|
validators: artifact.config.validators,
|
|
2082
1796
|
threshold: artifact.config.threshold,
|
|
2083
1797
|
});
|
|
@@ -2102,15 +1816,15 @@ class StarknetMerkleRootMultisigIsmWriter extends StarknetMerkleRootMultisigIsmR
|
|
|
2102
1816
|
|
|
2103
1817
|
|
|
2104
1818
|
|
|
1819
|
+
|
|
1820
|
+
|
|
2105
1821
|
class StarknetMessageIdMultisigIsmReader {
|
|
2106
1822
|
provider;
|
|
2107
1823
|
constructor(provider) {
|
|
2108
1824
|
this.provider = provider;
|
|
2109
1825
|
}
|
|
2110
1826
|
async read(address) {
|
|
2111
|
-
const ism = await this.provider.
|
|
2112
|
-
ismAddress: address,
|
|
2113
|
-
});
|
|
1827
|
+
const ism = await getMessageIdMultisigIsmConfig(this.provider.getRawProvider(), address);
|
|
2114
1828
|
return {
|
|
2115
1829
|
artifactState: dist_artifact/* ArtifactState */.O2.DEPLOYED,
|
|
2116
1830
|
config: {
|
|
@@ -2129,8 +1843,7 @@ class StarknetMessageIdMultisigIsmWriter extends StarknetMessageIdMultisigIsmRea
|
|
|
2129
1843
|
this.signer = signer;
|
|
2130
1844
|
}
|
|
2131
1845
|
async create(artifact) {
|
|
2132
|
-
const tx =
|
|
2133
|
-
signer: this.signer.getSignerAddress(),
|
|
1846
|
+
const tx = getCreateMessageIdMultisigIsmTx(this.signer.getSignerAddress(), {
|
|
2134
1847
|
validators: artifact.config.validators,
|
|
2135
1848
|
threshold: artifact.config.threshold,
|
|
2136
1849
|
});
|
|
@@ -2155,13 +1868,17 @@ class StarknetMessageIdMultisigIsmWriter extends StarknetMessageIdMultisigIsmRea
|
|
|
2155
1868
|
|
|
2156
1869
|
|
|
2157
1870
|
|
|
1871
|
+
|
|
1872
|
+
|
|
2158
1873
|
class StarknetTestIsmReader {
|
|
2159
1874
|
provider;
|
|
2160
1875
|
constructor(provider) {
|
|
2161
1876
|
this.provider = provider;
|
|
2162
1877
|
}
|
|
2163
1878
|
async read(address) {
|
|
2164
|
-
|
|
1879
|
+
(0,validation/* assert */.v)((await getIsmType(this.provider.getRawProvider(), address)) ===
|
|
1880
|
+
dist/* AltVM.IsmType */.bx.GO.TEST_ISM, `Expected a verified Starknet noop ISM at ${address}`);
|
|
1881
|
+
const noop = getNoopIsmConfig(address);
|
|
2165
1882
|
return {
|
|
2166
1883
|
artifactState: dist_artifact/* ArtifactState */.O2.DEPLOYED,
|
|
2167
1884
|
config: { type: dist/* AltVM.IsmType */.bx.GO.TEST_ISM },
|
|
@@ -2176,9 +1893,7 @@ class StarknetTestIsmWriter extends StarknetTestIsmReader {
|
|
|
2176
1893
|
this.signer = signer;
|
|
2177
1894
|
}
|
|
2178
1895
|
async create(artifact) {
|
|
2179
|
-
const tx =
|
|
2180
|
-
signer: this.signer.getSignerAddress(),
|
|
2181
|
-
});
|
|
1896
|
+
const tx = getCreateNoopIsmTx();
|
|
2182
1897
|
const receipt = await this.signer.sendAndConfirmTransaction(tx);
|
|
2183
1898
|
const ismAddress = receipt.contractAddress;
|
|
2184
1899
|
(0,validation/* assert */.v)(ismAddress, 'failed to deploy Starknet noop ISM');
|
|
@@ -2206,25 +1921,27 @@ class StarknetTestIsmWriter extends StarknetTestIsmReader {
|
|
|
2206
1921
|
|
|
2207
1922
|
|
|
2208
1923
|
|
|
1924
|
+
|
|
1925
|
+
|
|
2209
1926
|
class StarknetIsmArtifactManager {
|
|
2210
1927
|
provider;
|
|
2211
1928
|
constructor(chainMetadata) {
|
|
2212
|
-
this.provider = StarknetProvider.connect(
|
|
1929
|
+
this.provider = StarknetProvider.connect(chainMetadata);
|
|
2213
1930
|
}
|
|
2214
1931
|
requireStarknetSigner(signer) {
|
|
2215
1932
|
(0,validation/* assert */.v)(signer instanceof StarknetSigner, 'Expected StarknetSigner');
|
|
2216
1933
|
return signer;
|
|
2217
1934
|
}
|
|
2218
1935
|
async readIsm(address) {
|
|
2219
|
-
const type = await this.provider.
|
|
2220
|
-
|
|
2221
|
-
return this.createReader(dist/* AltVM.IsmType */.bx.GO.TEST_ISM).read(address);
|
|
2222
|
-
}
|
|
1936
|
+
const type = await getIsmType(this.provider.getRawProvider(), address);
|
|
1937
|
+
(0,validation/* assert */.v)(type !== dist/* AltVM.IsmType */.bx.GO.CUSTOM, `Unsupported Starknet ISM at ${address}; refusing to report it as testIsm`);
|
|
2223
1938
|
const reader = this.createReader((0,ism/* altVMIsmTypeToProviderSdkType */.EJ)(type));
|
|
2224
1939
|
return reader.read(address);
|
|
2225
1940
|
}
|
|
2226
1941
|
createReader(type) {
|
|
2227
1942
|
const readers = {
|
|
1943
|
+
staticAggregationIsm: () => new StarknetAggregationIsmReader(this.provider),
|
|
1944
|
+
pausableIsm: () => new StarknetPausableIsmReader(this.provider),
|
|
2228
1945
|
testIsm: () => new StarknetTestIsmReader(this.provider),
|
|
2229
1946
|
merkleRootMultisigIsm: () => new StarknetMerkleRootMultisigIsmReader(this.provider),
|
|
2230
1947
|
messageIdMultisigIsm: () => new StarknetMessageIdMultisigIsmReader(this.provider),
|
|
@@ -2248,21 +1965,63 @@ class StarknetIsmArtifactManager {
|
|
|
2248
1965
|
}
|
|
2249
1966
|
}
|
|
2250
1967
|
//# sourceMappingURL=ism-artifact-manager.js.map
|
|
1968
|
+
;// CONCATENATED MODULE: ../starknet-sdk/dist/mailbox/mailbox-tx.js
|
|
1969
|
+
|
|
1970
|
+
|
|
1971
|
+
function getCreateMailboxTx(signer, config) {
|
|
1972
|
+
return {
|
|
1973
|
+
kind: 'deploy',
|
|
1974
|
+
contractName: StarknetContractName.MAILBOX,
|
|
1975
|
+
constructorArgs: [
|
|
1976
|
+
config.domainId,
|
|
1977
|
+
contracts_normalizeStarknetAddressSafe(signer),
|
|
1978
|
+
contracts_normalizeStarknetAddressSafe(config.defaultIsmAddress ?? addresses/* ZERO_ADDRESS_HEX_32 */.qx),
|
|
1979
|
+
contracts_normalizeStarknetAddressSafe(config.defaultHookAddress ?? addresses/* ZERO_ADDRESS_HEX_32 */.qx),
|
|
1980
|
+
contracts_normalizeStarknetAddressSafe(config.requiredHookAddress ?? addresses/* ZERO_ADDRESS_HEX_32 */.qx),
|
|
1981
|
+
],
|
|
1982
|
+
};
|
|
1983
|
+
}
|
|
1984
|
+
async function getSetDefaultIsmTx(provider, config) {
|
|
1985
|
+
const mailbox = getStarknetContract(StarknetContractName.MAILBOX, config.mailboxAddress, provider);
|
|
1986
|
+
return populateInvokeTx(mailbox, 'set_default_ism', [
|
|
1987
|
+
contracts_normalizeStarknetAddressSafe(config.ismAddress),
|
|
1988
|
+
]);
|
|
1989
|
+
}
|
|
1990
|
+
async function getSetDefaultHookTx(provider, config) {
|
|
1991
|
+
const mailbox = getStarknetContract(StarknetContractName.MAILBOX, config.mailboxAddress, provider);
|
|
1992
|
+
return populateInvokeTx(mailbox, 'set_default_hook', [
|
|
1993
|
+
contracts_normalizeStarknetAddressSafe(config.hookAddress),
|
|
1994
|
+
]);
|
|
1995
|
+
}
|
|
1996
|
+
async function getSetRequiredHookTx(provider, config) {
|
|
1997
|
+
const mailbox = getStarknetContract(StarknetContractName.MAILBOX, config.mailboxAddress, provider);
|
|
1998
|
+
return populateInvokeTx(mailbox, 'set_required_hook', [
|
|
1999
|
+
contracts_normalizeStarknetAddressSafe(config.hookAddress),
|
|
2000
|
+
]);
|
|
2001
|
+
}
|
|
2002
|
+
async function getSetMailboxOwnerTx(provider, config) {
|
|
2003
|
+
const mailbox = getStarknetContract(StarknetContractName.MAILBOX, config.mailboxAddress, provider);
|
|
2004
|
+
return populateInvokeTx(mailbox, 'transfer_ownership', [
|
|
2005
|
+
contracts_normalizeStarknetAddressSafe(config.newOwner),
|
|
2006
|
+
]);
|
|
2007
|
+
}
|
|
2008
|
+
//# sourceMappingURL=mailbox-tx.js.map
|
|
2251
2009
|
;// CONCATENATED MODULE: ../starknet-sdk/dist/mailbox/mailbox-artifact-manager.js
|
|
2252
2010
|
|
|
2253
2011
|
|
|
2254
2012
|
|
|
2255
2013
|
|
|
2256
2014
|
|
|
2015
|
+
|
|
2016
|
+
|
|
2017
|
+
|
|
2257
2018
|
class StarknetMailboxReader {
|
|
2258
2019
|
provider;
|
|
2259
2020
|
constructor(provider) {
|
|
2260
2021
|
this.provider = provider;
|
|
2261
2022
|
}
|
|
2262
2023
|
async read(address) {
|
|
2263
|
-
const mailbox = await this.provider.
|
|
2264
|
-
mailboxAddress: address,
|
|
2265
|
-
});
|
|
2024
|
+
const mailbox = await getMailboxConfig(this.provider.getRawProvider(), address);
|
|
2266
2025
|
return {
|
|
2267
2026
|
artifactState: dist_artifact/* ArtifactState */.O2.DEPLOYED,
|
|
2268
2027
|
config: {
|
|
@@ -2270,24 +2029,24 @@ class StarknetMailboxReader {
|
|
|
2270
2029
|
defaultIsm: {
|
|
2271
2030
|
artifactState: dist_artifact/* ArtifactState */.O2.UNDERIVED,
|
|
2272
2031
|
deployed: {
|
|
2273
|
-
address:
|
|
2032
|
+
address: contracts_normalizeStarknetAddressSafe(mailbox.defaultIsm),
|
|
2274
2033
|
},
|
|
2275
2034
|
},
|
|
2276
2035
|
defaultHook: {
|
|
2277
2036
|
artifactState: dist_artifact/* ArtifactState */.O2.UNDERIVED,
|
|
2278
2037
|
deployed: {
|
|
2279
|
-
address:
|
|
2038
|
+
address: contracts_normalizeStarknetAddressSafe(mailbox.defaultHook),
|
|
2280
2039
|
},
|
|
2281
2040
|
},
|
|
2282
2041
|
requiredHook: {
|
|
2283
2042
|
artifactState: dist_artifact/* ArtifactState */.O2.UNDERIVED,
|
|
2284
2043
|
deployed: {
|
|
2285
|
-
address:
|
|
2044
|
+
address: contracts_normalizeStarknetAddressSafe(mailbox.requiredHook),
|
|
2286
2045
|
},
|
|
2287
2046
|
},
|
|
2288
2047
|
},
|
|
2289
2048
|
deployed: {
|
|
2290
|
-
address:
|
|
2049
|
+
address: contracts_normalizeStarknetAddressSafe(mailbox.address),
|
|
2291
2050
|
domainId: mailbox.localDomain,
|
|
2292
2051
|
},
|
|
2293
2052
|
};
|
|
@@ -2302,21 +2061,18 @@ class StarknetMailboxWriter extends StarknetMailboxReader {
|
|
|
2302
2061
|
this.chainMetadata = chainMetadata;
|
|
2303
2062
|
}
|
|
2304
2063
|
getNestedAddress(nested) {
|
|
2305
|
-
return
|
|
2064
|
+
return contracts_normalizeStarknetAddressSafe(nested.deployed.address);
|
|
2306
2065
|
}
|
|
2307
2066
|
async getInitialHookAddress(address, receipts, placeholderRef) {
|
|
2308
2067
|
if (!(0,addresses/* isZeroishAddress */.Hi)(address)) {
|
|
2309
|
-
return
|
|
2068
|
+
return contracts_normalizeStarknetAddressSafe(address);
|
|
2310
2069
|
}
|
|
2311
2070
|
if (!placeholderRef.address) {
|
|
2312
|
-
const tx =
|
|
2313
|
-
signer: this.signer.getSignerAddress(),
|
|
2314
|
-
mailboxAddress: '',
|
|
2315
|
-
});
|
|
2071
|
+
const tx = getCreateNoopHookTx();
|
|
2316
2072
|
const receipt = await this.signer.sendAndConfirmTransaction(tx);
|
|
2317
2073
|
receipts.push(receipt);
|
|
2318
2074
|
(0,validation/* assert */.v)(receipt.contractAddress, 'failed to deploy placeholder Starknet noop hook');
|
|
2319
|
-
placeholderRef.address =
|
|
2075
|
+
placeholderRef.address = contracts_normalizeStarknetAddressSafe(receipt.contractAddress);
|
|
2320
2076
|
}
|
|
2321
2077
|
return placeholderRef.address;
|
|
2322
2078
|
}
|
|
@@ -2326,32 +2082,22 @@ class StarknetMailboxWriter extends StarknetMailboxReader {
|
|
|
2326
2082
|
const placeholderHookRef = {};
|
|
2327
2083
|
const defaultHookAddress = await this.getInitialHookAddress(this.getNestedAddress(artifact.config.defaultHook), receipts, placeholderHookRef);
|
|
2328
2084
|
const requiredHookAddress = await this.getInitialHookAddress(this.getNestedAddress(artifact.config.requiredHook), receipts, placeholderHookRef);
|
|
2329
|
-
const createTx =
|
|
2330
|
-
signer: this.signer.getSignerAddress(),
|
|
2085
|
+
const createTx = getCreateMailboxTx(this.signer.getSignerAddress(), {
|
|
2331
2086
|
domainId: this.chainMetadata.domainId,
|
|
2332
2087
|
defaultIsmAddress,
|
|
2333
2088
|
defaultHookAddress,
|
|
2334
2089
|
requiredHookAddress,
|
|
2335
|
-
proxyAdminAddress: undefined,
|
|
2336
2090
|
});
|
|
2337
2091
|
const createReceipt = await this.signer.sendAndConfirmTransaction(createTx);
|
|
2338
2092
|
receipts.push(createReceipt);
|
|
2339
2093
|
(0,validation/* assert */.v)(createReceipt.contractAddress, 'failed to deploy Starknet mailbox');
|
|
2340
2094
|
const mailboxAddress = createReceipt.contractAddress;
|
|
2341
|
-
if (!(0,addresses/* eqAddressStarknet */.PD)(artifact.config.owner, this.signer.getSignerAddress())) {
|
|
2342
|
-
const tx = await this.signer.getSetMailboxOwnerTransaction({
|
|
2343
|
-
signer: this.signer.getSignerAddress(),
|
|
2344
|
-
mailboxAddress,
|
|
2345
|
-
newOwner: artifact.config.owner,
|
|
2346
|
-
});
|
|
2347
|
-
receipts.push(await this.signer.sendAndConfirmTransaction(tx));
|
|
2348
|
-
}
|
|
2349
2095
|
return [
|
|
2350
2096
|
{
|
|
2351
2097
|
artifactState: dist_artifact/* ArtifactState */.O2.DEPLOYED,
|
|
2352
2098
|
config: artifact.config,
|
|
2353
2099
|
deployed: {
|
|
2354
|
-
address:
|
|
2100
|
+
address: contracts_normalizeStarknetAddressSafe(mailboxAddress),
|
|
2355
2101
|
domainId: this.chainMetadata.domainId,
|
|
2356
2102
|
},
|
|
2357
2103
|
},
|
|
@@ -2368,11 +2114,11 @@ class StarknetMailboxWriter extends StarknetMailboxReader {
|
|
|
2368
2114
|
const currentDefaultIsm = this.getNestedAddress(current.config.defaultIsm);
|
|
2369
2115
|
const currentDefaultHook = this.getNestedAddress(current.config.defaultHook);
|
|
2370
2116
|
const currentRequiredHook = this.getNestedAddress(current.config.requiredHook);
|
|
2117
|
+
const rawProvider = this.signer.getRawProvider();
|
|
2371
2118
|
if (!(0,addresses/* eqAddressStarknet */.PD)(currentDefaultIsm, expectedDefaultIsm)) {
|
|
2372
2119
|
updateTxs.push({
|
|
2373
2120
|
annotation: `Setting mailbox default ISM`,
|
|
2374
|
-
...(await
|
|
2375
|
-
signer: this.signer.getSignerAddress(),
|
|
2121
|
+
...(await getSetDefaultIsmTx(rawProvider, {
|
|
2376
2122
|
mailboxAddress,
|
|
2377
2123
|
ismAddress: expectedDefaultIsm,
|
|
2378
2124
|
})),
|
|
@@ -2381,8 +2127,7 @@ class StarknetMailboxWriter extends StarknetMailboxReader {
|
|
|
2381
2127
|
if (!(0,addresses/* eqAddressStarknet */.PD)(currentDefaultHook, expectedDefaultHook)) {
|
|
2382
2128
|
updateTxs.push({
|
|
2383
2129
|
annotation: `Setting mailbox default hook`,
|
|
2384
|
-
...(await
|
|
2385
|
-
signer: this.signer.getSignerAddress(),
|
|
2130
|
+
...(await getSetDefaultHookTx(rawProvider, {
|
|
2386
2131
|
mailboxAddress,
|
|
2387
2132
|
hookAddress: expectedDefaultHook,
|
|
2388
2133
|
})),
|
|
@@ -2391,8 +2136,7 @@ class StarknetMailboxWriter extends StarknetMailboxReader {
|
|
|
2391
2136
|
if (!(0,addresses/* eqAddressStarknet */.PD)(currentRequiredHook, expectedRequiredHook)) {
|
|
2392
2137
|
updateTxs.push({
|
|
2393
2138
|
annotation: `Setting mailbox required hook`,
|
|
2394
|
-
...(await
|
|
2395
|
-
signer: this.signer.getSignerAddress(),
|
|
2139
|
+
...(await getSetRequiredHookTx(rawProvider, {
|
|
2396
2140
|
mailboxAddress,
|
|
2397
2141
|
hookAddress: expectedRequiredHook,
|
|
2398
2142
|
})),
|
|
@@ -2401,8 +2145,7 @@ class StarknetMailboxWriter extends StarknetMailboxReader {
|
|
|
2401
2145
|
if (!(0,addresses/* eqAddressStarknet */.PD)(current.config.owner, artifact.config.owner)) {
|
|
2402
2146
|
updateTxs.push({
|
|
2403
2147
|
annotation: `Setting mailbox owner`,
|
|
2404
|
-
...(await
|
|
2405
|
-
signer: this.signer.getSignerAddress(),
|
|
2148
|
+
...(await getSetMailboxOwnerTx(rawProvider, {
|
|
2406
2149
|
mailboxAddress,
|
|
2407
2150
|
newOwner: artifact.config.owner,
|
|
2408
2151
|
})),
|
|
@@ -2416,7 +2159,7 @@ class StarknetMailboxArtifactManager {
|
|
|
2416
2159
|
provider;
|
|
2417
2160
|
constructor(chainMetadata) {
|
|
2418
2161
|
this.chainMetadata = chainMetadata;
|
|
2419
|
-
this.provider = StarknetProvider.connect(
|
|
2162
|
+
this.provider = StarknetProvider.connect(chainMetadata);
|
|
2420
2163
|
}
|
|
2421
2164
|
requireStarknetSigner(signer) {
|
|
2422
2165
|
(0,validation/* assert */.v)(signer instanceof StarknetSigner, 'Expected StarknetSigner');
|
|
@@ -2443,6 +2186,19 @@ class StarknetMailboxArtifactManager {
|
|
|
2443
2186
|
}
|
|
2444
2187
|
}
|
|
2445
2188
|
//# sourceMappingURL=mailbox-artifact-manager.js.map
|
|
2189
|
+
;// CONCATENATED MODULE: ../starknet-sdk/dist/validator-announce/validator-announce-tx.js
|
|
2190
|
+
|
|
2191
|
+
function getCreateValidatorAnnounceTx(signer, mailboxAddress) {
|
|
2192
|
+
return {
|
|
2193
|
+
kind: 'deploy',
|
|
2194
|
+
contractName: StarknetContractName.VALIDATOR_ANNOUNCE,
|
|
2195
|
+
constructorArgs: [
|
|
2196
|
+
contracts_normalizeStarknetAddressSafe(mailboxAddress),
|
|
2197
|
+
contracts_normalizeStarknetAddressSafe(signer),
|
|
2198
|
+
],
|
|
2199
|
+
};
|
|
2200
|
+
}
|
|
2201
|
+
//# sourceMappingURL=validator-announce-tx.js.map
|
|
2446
2202
|
;// CONCATENATED MODULE: ../starknet-sdk/dist/validator-announce/validator-announce-artifact-manager.js
|
|
2447
2203
|
|
|
2448
2204
|
|
|
@@ -2450,6 +2206,7 @@ class StarknetMailboxArtifactManager {
|
|
|
2450
2206
|
|
|
2451
2207
|
|
|
2452
2208
|
|
|
2209
|
+
|
|
2453
2210
|
const validator_announce_artifact_manager_STARKNET_STORAGE_ADDRESS_BOUND = (1n << 251n) - 256n;
|
|
2454
2211
|
const validator_announce_artifact_manager_logger = logging/* rootLogger */.Jk.child({
|
|
2455
2212
|
module: 'starknet-validator-announce-artifact-manager',
|
|
@@ -2462,7 +2219,7 @@ async function readStorageAddress(provider, contractAddress, key) {
|
|
|
2462
2219
|
.getStorageAt(contractAddress, `0x${key.toString(16)}`);
|
|
2463
2220
|
return (0,addresses/* isZeroishAddress */.Hi)(value)
|
|
2464
2221
|
? undefined
|
|
2465
|
-
:
|
|
2222
|
+
: contracts_normalizeStarknetAddressSafe(value);
|
|
2466
2223
|
}
|
|
2467
2224
|
catch (error) {
|
|
2468
2225
|
if (!shouldFallbackStorageRead(error)) {
|
|
@@ -2481,7 +2238,7 @@ async function readMailboxAddressFromStorage(provider, contractAddress) {
|
|
|
2481
2238
|
if (candidates.length === 0)
|
|
2482
2239
|
return undefined;
|
|
2483
2240
|
const uniqueCandidates = [
|
|
2484
|
-
...new Set(candidates.map((value) =>
|
|
2241
|
+
...new Set(candidates.map((value) => contracts_normalizeStarknetAddressSafe(value))),
|
|
2485
2242
|
];
|
|
2486
2243
|
return uniqueCandidates.length === 1 ? uniqueCandidates[0] : undefined;
|
|
2487
2244
|
}
|
|
@@ -2491,7 +2248,7 @@ class StarknetValidatorAnnounceReader {
|
|
|
2491
2248
|
this.provider = provider;
|
|
2492
2249
|
}
|
|
2493
2250
|
async read(address) {
|
|
2494
|
-
const normalizedAddress =
|
|
2251
|
+
const normalizedAddress = contracts_normalizeStarknetAddressSafe(address);
|
|
2495
2252
|
const mailboxAddress = await readMailboxAddressFromStorage(this.provider, normalizedAddress);
|
|
2496
2253
|
const config = {
|
|
2497
2254
|
mailboxAddress: mailboxAddress ?? '',
|
|
@@ -2519,10 +2276,7 @@ class StarknetValidatorAnnounceWriter extends StarknetValidatorAnnounceReader {
|
|
|
2519
2276
|
this.signer = signer;
|
|
2520
2277
|
}
|
|
2521
2278
|
async create(artifact) {
|
|
2522
|
-
const tx =
|
|
2523
|
-
signer: this.signer.getSignerAddress(),
|
|
2524
|
-
mailboxAddress: artifact.config.mailboxAddress,
|
|
2525
|
-
});
|
|
2279
|
+
const tx = getCreateValidatorAnnounceTx(this.signer.getSignerAddress(), artifact.config.mailboxAddress);
|
|
2526
2280
|
const receipt = await this.signer.sendAndConfirmTransaction(tx);
|
|
2527
2281
|
const validatorAnnounceId = receipt.contractAddress;
|
|
2528
2282
|
(0,validation/* assert */.v)(validatorAnnounceId, 'failed to get Starknet validator announce address');
|
|
@@ -2531,7 +2285,7 @@ class StarknetValidatorAnnounceWriter extends StarknetValidatorAnnounceReader {
|
|
|
2531
2285
|
artifactState: dist_artifact/* ArtifactState */.O2.DEPLOYED,
|
|
2532
2286
|
config: artifact.config,
|
|
2533
2287
|
deployed: {
|
|
2534
|
-
address:
|
|
2288
|
+
address: contracts_normalizeStarknetAddressSafe(validatorAnnounceId),
|
|
2535
2289
|
},
|
|
2536
2290
|
},
|
|
2537
2291
|
[receipt],
|
|
@@ -2544,7 +2298,7 @@ class StarknetValidatorAnnounceWriter extends StarknetValidatorAnnounceReader {
|
|
|
2544
2298
|
class StarknetValidatorAnnounceArtifactManager {
|
|
2545
2299
|
provider;
|
|
2546
2300
|
constructor(chainMetadata) {
|
|
2547
|
-
this.provider = StarknetProvider.connect(
|
|
2301
|
+
this.provider = StarknetProvider.connect(chainMetadata);
|
|
2548
2302
|
}
|
|
2549
2303
|
requireStarknetSigner(signer) {
|
|
2550
2304
|
(0,validation/* assert */.v)(signer instanceof StarknetSigner, 'Expected StarknetSigner');
|
|
@@ -2571,13 +2325,123 @@ class StarknetValidatorAnnounceArtifactManager {
|
|
|
2571
2325
|
}
|
|
2572
2326
|
}
|
|
2573
2327
|
//# sourceMappingURL=validator-announce-artifact-manager.js.map
|
|
2574
|
-
|
|
2575
|
-
|
|
2328
|
+
;// CONCATENATED MODULE: ../starknet-sdk/dist/warp/warp-tx.js
|
|
2329
|
+
|
|
2330
|
+
|
|
2331
|
+
|
|
2332
|
+
|
|
2333
|
+
function getCreateNativeTokenTx(signer, config) {
|
|
2334
|
+
return {
|
|
2335
|
+
kind: 'deploy',
|
|
2336
|
+
contractName: StarknetContractName.HYP_NATIVE,
|
|
2337
|
+
contractType: runtime/* ContractType */.h$.TOKEN,
|
|
2338
|
+
constructorArgs: [
|
|
2339
|
+
contracts_normalizeStarknetAddressSafe(config.mailboxAddress),
|
|
2340
|
+
contracts_normalizeStarknetAddressSafe(config.feeTokenAddress),
|
|
2341
|
+
contracts_normalizeStarknetAddressSafe(config.defaultHook),
|
|
2342
|
+
contracts_normalizeStarknetAddressSafe(config.defaultIsm),
|
|
2343
|
+
contracts_normalizeStarknetAddressSafe(signer),
|
|
2344
|
+
],
|
|
2345
|
+
};
|
|
2346
|
+
}
|
|
2347
|
+
function getCreateCollateralTokenTx(signer, config) {
|
|
2348
|
+
return {
|
|
2349
|
+
kind: 'deploy',
|
|
2350
|
+
contractName: StarknetContractName.HYP_ERC20_COLLATERAL,
|
|
2351
|
+
contractType: runtime/* ContractType */.h$.TOKEN,
|
|
2352
|
+
constructorArgs: [
|
|
2353
|
+
contracts_normalizeStarknetAddressSafe(config.mailboxAddress),
|
|
2354
|
+
contracts_normalizeStarknetAddressSafe(config.collateralDenom),
|
|
2355
|
+
contracts_normalizeStarknetAddressSafe(signer),
|
|
2356
|
+
contracts_normalizeStarknetAddressSafe(config.defaultHook),
|
|
2357
|
+
contracts_normalizeStarknetAddressSafe(config.defaultIsm),
|
|
2358
|
+
],
|
|
2359
|
+
};
|
|
2360
|
+
}
|
|
2361
|
+
function getCreateSyntheticTokenTx(signer, config) {
|
|
2362
|
+
return {
|
|
2363
|
+
kind: 'deploy',
|
|
2364
|
+
contractName: StarknetContractName.HYP_ERC20,
|
|
2365
|
+
contractType: runtime/* ContractType */.h$.TOKEN,
|
|
2366
|
+
constructorArgs: [
|
|
2367
|
+
config.decimals,
|
|
2368
|
+
contracts_normalizeStarknetAddressSafe(config.mailboxAddress),
|
|
2369
|
+
0, // initial supply
|
|
2370
|
+
config.name,
|
|
2371
|
+
config.denom,
|
|
2372
|
+
contracts_normalizeStarknetAddressSafe(config.defaultHook),
|
|
2373
|
+
contracts_normalizeStarknetAddressSafe(config.defaultIsm),
|
|
2374
|
+
contracts_normalizeStarknetAddressSafe(signer),
|
|
2375
|
+
],
|
|
2376
|
+
};
|
|
2377
|
+
}
|
|
2378
|
+
async function getSetTokenOwnerTx(provider, config) {
|
|
2379
|
+
const token = getStarknetContract(StarknetContractName.HYP_ERC20, config.tokenAddress, provider, runtime/* ContractType */.h$.TOKEN);
|
|
2380
|
+
return populateInvokeTx(token, 'transfer_ownership', [
|
|
2381
|
+
contracts_normalizeStarknetAddressSafe(config.newOwner),
|
|
2382
|
+
]);
|
|
2383
|
+
}
|
|
2384
|
+
async function getSetTokenIsmTx(provider, config) {
|
|
2385
|
+
const token = getStarknetContract(StarknetContractName.HYP_ERC20, config.tokenAddress, provider, runtime/* ContractType */.h$.TOKEN);
|
|
2386
|
+
return populateInvokeTx(token, 'set_interchain_security_module', [
|
|
2387
|
+
contracts_normalizeStarknetAddressSafe(config.ismAddress ?? addresses/* ZERO_ADDRESS_HEX_32 */.qx),
|
|
2388
|
+
]);
|
|
2389
|
+
}
|
|
2390
|
+
async function getSetTokenHookTx(provider, config) {
|
|
2391
|
+
const token = getStarknetContract(StarknetContractName.HYP_ERC20, config.tokenAddress, provider, runtime/* ContractType */.h$.TOKEN);
|
|
2392
|
+
return populateInvokeTx(token, 'set_hook', [
|
|
2393
|
+
contracts_normalizeStarknetAddressSafe(config.hookAddress ?? addresses/* ZERO_ADDRESS_HEX_32 */.qx),
|
|
2394
|
+
]);
|
|
2395
|
+
}
|
|
2396
|
+
async function populateInvokeCall(provider, tokenAddress, method, args = []) {
|
|
2397
|
+
const contract = getStarknetContract(StarknetContractName.HYP_ERC20, tokenAddress, provider, runtime/* ContractType */.h$.TOKEN);
|
|
2398
|
+
const tx = await populateInvokeTx(contract, method, args);
|
|
2399
|
+
(0,validation/* assert */.v)(tx.kind === 'invoke', 'Expected invoke Starknet transaction');
|
|
2400
|
+
return {
|
|
2401
|
+
contractAddress: contracts_normalizeStarknetAddressSafe(tx.contractAddress),
|
|
2402
|
+
entrypoint: tx.entrypoint,
|
|
2403
|
+
calldata: tx.calldata,
|
|
2404
|
+
};
|
|
2405
|
+
}
|
|
2406
|
+
async function getEnrollRemoteRouterTx(provider, config) {
|
|
2407
|
+
const receiverAddress = (0,addresses/* isZeroishAddress */.Hi)(config.remoteRouter.receiverAddress)
|
|
2408
|
+
? addresses/* ZERO_ADDRESS_HEX_32 */.qx
|
|
2409
|
+
: (0,addresses/* ensure0x */.Ho)(config.remoteRouter.receiverAddress);
|
|
2410
|
+
const noneOption = new starknet_dist/* CairoOption */.ci(starknet_dist/* CairoOptionVariant */.RV.None);
|
|
2411
|
+
const domainOption = new starknet_dist/* CairoOption */.ci(starknet_dist/* CairoOptionVariant */.RV.Some, config.remoteRouter.receiverDomainId);
|
|
2412
|
+
const gasOption = new starknet_dist/* CairoOption */.ci(starknet_dist/* CairoOptionVariant */.RV.Some, config.remoteRouter.gas);
|
|
2413
|
+
const [enrollCall, gasCall] = await Promise.all([
|
|
2414
|
+
populateInvokeCall(provider, config.tokenAddress, 'enroll_remote_router', [
|
|
2415
|
+
config.remoteRouter.receiverDomainId,
|
|
2416
|
+
receiverAddress,
|
|
2417
|
+
]),
|
|
2418
|
+
populateInvokeCall(provider, config.tokenAddress, 'set_destination_gas', [
|
|
2419
|
+
noneOption,
|
|
2420
|
+
domainOption,
|
|
2421
|
+
gasOption,
|
|
2422
|
+
]),
|
|
2423
|
+
]);
|
|
2424
|
+
return {
|
|
2425
|
+
kind: 'invoke',
|
|
2426
|
+
contractAddress: enrollCall.contractAddress,
|
|
2427
|
+
entrypoint: enrollCall.entrypoint,
|
|
2428
|
+
calldata: enrollCall.calldata,
|
|
2429
|
+
calls: [enrollCall, gasCall],
|
|
2430
|
+
};
|
|
2431
|
+
}
|
|
2432
|
+
async function getUnenrollRemoteRouterTx(provider, config) {
|
|
2433
|
+
const token = getStarknetContract(StarknetContractName.HYP_ERC20, config.tokenAddress, provider, runtime/* ContractType */.h$.TOKEN);
|
|
2434
|
+
return populateInvokeTx(token, 'unenroll_remote_router', [
|
|
2435
|
+
config.receiverDomainId,
|
|
2436
|
+
]);
|
|
2437
|
+
}
|
|
2438
|
+
//# sourceMappingURL=warp-tx.js.map
|
|
2576
2439
|
;// CONCATENATED MODULE: ../starknet-sdk/dist/warp/token-artifact-manager.js
|
|
2577
2440
|
|
|
2578
2441
|
|
|
2579
2442
|
|
|
2580
2443
|
|
|
2444
|
+
|
|
2581
2445
|
function normalizeGas(gas) {
|
|
2582
2446
|
return BigInt(gas ?? '0').toString();
|
|
2583
2447
|
}
|
|
@@ -2607,7 +2471,7 @@ class StarknetWarpTokenReaderBase {
|
|
|
2607
2471
|
return {
|
|
2608
2472
|
artifactState: dist_artifact/* ArtifactState */.O2.DEPLOYED,
|
|
2609
2473
|
config: this.toConfig(token, remoteRouters),
|
|
2610
|
-
deployed: { address:
|
|
2474
|
+
deployed: { address: contracts_normalizeStarknetAddressSafe(token.address) },
|
|
2611
2475
|
};
|
|
2612
2476
|
}
|
|
2613
2477
|
baseConfig(token, remoteRouters) {
|
|
@@ -2615,15 +2479,15 @@ class StarknetWarpTokenReaderBase {
|
|
|
2615
2479
|
const destinationGas = {};
|
|
2616
2480
|
for (const remoteRouter of remoteRouters.remoteRouters) {
|
|
2617
2481
|
routers[remoteRouter.receiverDomainId] = {
|
|
2618
|
-
address:
|
|
2482
|
+
address: contracts_normalizeStarknetAddressSafe(remoteRouter.receiverAddress),
|
|
2619
2483
|
};
|
|
2620
2484
|
destinationGas[remoteRouter.receiverDomainId] = normalizeGas(remoteRouter.gas);
|
|
2621
2485
|
}
|
|
2622
2486
|
return {
|
|
2623
|
-
owner:
|
|
2624
|
-
mailbox:
|
|
2625
|
-
interchainSecurityModule: (0,dist_artifact/* addressToUnderivedArtifact */.Se)(token.ismAddress,
|
|
2626
|
-
hook: (0,dist_artifact/* addressToUnderivedArtifact */.Se)(token.hookAddress,
|
|
2487
|
+
owner: contracts_normalizeStarknetAddressSafe(token.owner),
|
|
2488
|
+
mailbox: contracts_normalizeStarknetAddressSafe(token.mailboxAddress),
|
|
2489
|
+
interchainSecurityModule: (0,dist_artifact/* addressToUnderivedArtifact */.Se)(token.ismAddress, contracts_normalizeStarknetAddressSafe),
|
|
2490
|
+
hook: (0,dist_artifact/* addressToUnderivedArtifact */.Se)(token.hookAddress, contracts_normalizeStarknetAddressSafe),
|
|
2627
2491
|
remoteRouters: routers,
|
|
2628
2492
|
destinationGas,
|
|
2629
2493
|
};
|
|
@@ -2661,7 +2525,7 @@ class StarknetWarpTokenWriterBase extends StarknetWarpTokenReaderBase {
|
|
|
2661
2525
|
{
|
|
2662
2526
|
artifactState: dist_artifact/* ArtifactState */.O2.DEPLOYED,
|
|
2663
2527
|
config: artifact.config,
|
|
2664
|
-
deployed: { address:
|
|
2528
|
+
deployed: { address: contracts_normalizeStarknetAddressSafe(tokenAddress) },
|
|
2665
2529
|
},
|
|
2666
2530
|
receipts,
|
|
2667
2531
|
];
|
|
@@ -2678,32 +2542,29 @@ class StarknetWarpTokenWriterBase extends StarknetWarpTokenReaderBase {
|
|
|
2678
2542
|
if (!(0,addresses/* eqAddressStarknet */.PD)(currentOwner, expectedConfig.owner)) {
|
|
2679
2543
|
ownerTx = {
|
|
2680
2544
|
annotation: 'Setting warp token owner',
|
|
2681
|
-
...(await this.
|
|
2682
|
-
signer: this.signer.getSignerAddress(),
|
|
2545
|
+
...(await getSetTokenOwnerTx(this.provider.getRawProvider(), {
|
|
2683
2546
|
tokenAddress,
|
|
2684
2547
|
newOwner: expectedConfig.owner,
|
|
2685
2548
|
})),
|
|
2686
2549
|
};
|
|
2687
2550
|
}
|
|
2688
|
-
const currentIsm = (0,dist_artifact/* artifactOnChainToAddress */.wM)(current.config.interchainSecurityModule,
|
|
2689
|
-
const expectedIsm = (0,dist_artifact/* artifactOnChainToAddress */.wM)(expectedConfig.interchainSecurityModule,
|
|
2551
|
+
const currentIsm = (0,dist_artifact/* artifactOnChainToAddress */.wM)(current.config.interchainSecurityModule, contracts_normalizeStarknetAddressSafe);
|
|
2552
|
+
const expectedIsm = (0,dist_artifact/* artifactOnChainToAddress */.wM)(expectedConfig.interchainSecurityModule, contracts_normalizeStarknetAddressSafe);
|
|
2690
2553
|
if (!(0,addresses/* eqAddressStarknet */.PD)(currentIsm ?? addresses/* ZERO_ADDRESS_HEX_32 */.qx, expectedIsm ?? addresses/* ZERO_ADDRESS_HEX_32 */.qx)) {
|
|
2691
2554
|
txs.push({
|
|
2692
2555
|
annotation: 'Setting warp token ISM',
|
|
2693
|
-
...(await this.
|
|
2694
|
-
signer: this.signer.getSignerAddress(),
|
|
2556
|
+
...(await getSetTokenIsmTx(this.provider.getRawProvider(), {
|
|
2695
2557
|
tokenAddress,
|
|
2696
2558
|
ismAddress: expectedIsm,
|
|
2697
2559
|
})),
|
|
2698
2560
|
});
|
|
2699
2561
|
}
|
|
2700
|
-
const currentHook = (0,dist_artifact/* artifactOnChainToAddress */.wM)(current.config.hook,
|
|
2701
|
-
const expectedHook = (0,dist_artifact/* artifactOnChainToAddress */.wM)(expectedConfig.hook,
|
|
2562
|
+
const currentHook = (0,dist_artifact/* artifactOnChainToAddress */.wM)(current.config.hook, contracts_normalizeStarknetAddressSafe);
|
|
2563
|
+
const expectedHook = (0,dist_artifact/* artifactOnChainToAddress */.wM)(expectedConfig.hook, contracts_normalizeStarknetAddressSafe);
|
|
2702
2564
|
if (!(0,addresses/* eqAddressStarknet */.PD)(currentHook ?? addresses/* ZERO_ADDRESS_HEX_32 */.qx, expectedHook ?? addresses/* ZERO_ADDRESS_HEX_32 */.qx)) {
|
|
2703
2565
|
txs.push({
|
|
2704
2566
|
annotation: 'Setting warp token hook',
|
|
2705
|
-
...(await this.
|
|
2706
|
-
signer: this.signer.getSignerAddress(),
|
|
2567
|
+
...(await getSetTokenHookTx(this.provider.getRawProvider(), {
|
|
2707
2568
|
tokenAddress,
|
|
2708
2569
|
hookAddress: expectedHook,
|
|
2709
2570
|
})),
|
|
@@ -2719,8 +2580,7 @@ class StarknetWarpTokenWriterBase extends StarknetWarpTokenReaderBase {
|
|
|
2719
2580
|
for (const domain of routerUpdates.toUnenroll.sort((a, b) => a - b)) {
|
|
2720
2581
|
txs.push({
|
|
2721
2582
|
annotation: `Unenrolling remote router for domain ${domain}`,
|
|
2722
|
-
...(await this.
|
|
2723
|
-
signer: this.signer.getSignerAddress(),
|
|
2583
|
+
...(await getUnenrollRemoteRouterTx(this.provider.getRawProvider(), {
|
|
2724
2584
|
tokenAddress,
|
|
2725
2585
|
receiverDomainId: domain,
|
|
2726
2586
|
})),
|
|
@@ -2729,8 +2589,7 @@ class StarknetWarpTokenWriterBase extends StarknetWarpTokenReaderBase {
|
|
|
2729
2589
|
for (const route of routerUpdates.toEnroll.sort((a, b) => a.domainId - b.domainId)) {
|
|
2730
2590
|
txs.push({
|
|
2731
2591
|
annotation: `Enrolling remote router for domain ${route.domainId}`,
|
|
2732
|
-
...(await this.
|
|
2733
|
-
signer: this.signer.getSignerAddress(),
|
|
2592
|
+
...(await getEnrollRemoteRouterTx(this.provider.getRawProvider(), {
|
|
2734
2593
|
tokenAddress,
|
|
2735
2594
|
remoteRouter: {
|
|
2736
2595
|
receiverDomainId: route.domainId,
|
|
@@ -2746,15 +2605,15 @@ class StarknetWarpTokenWriterBase extends StarknetWarpTokenReaderBase {
|
|
|
2746
2605
|
return txs;
|
|
2747
2606
|
}
|
|
2748
2607
|
preserveUnsetHookAndIsm(current, expected) {
|
|
2749
|
-
const expectedIsm = (0,dist_artifact/* artifactOnChainToAddress */.wM)(expected.interchainSecurityModule,
|
|
2750
|
-
const expectedHook = (0,dist_artifact/* artifactOnChainToAddress */.wM)(expected.hook,
|
|
2608
|
+
const expectedIsm = (0,dist_artifact/* artifactOnChainToAddress */.wM)(expected.interchainSecurityModule, contracts_normalizeStarknetAddressSafe);
|
|
2609
|
+
const expectedHook = (0,dist_artifact/* artifactOnChainToAddress */.wM)(expected.hook, contracts_normalizeStarknetAddressSafe);
|
|
2751
2610
|
return {
|
|
2752
2611
|
...expected,
|
|
2753
2612
|
interchainSecurityModule: (0,addresses/* isEmptyAddress */.Ae)(expectedIsm)
|
|
2754
|
-
? (0,dist_artifact/* addressToUnderivedArtifact */.Se)((0,dist_artifact/* artifactOnChainToAddress */.wM)(current.interchainSecurityModule,
|
|
2613
|
+
? (0,dist_artifact/* addressToUnderivedArtifact */.Se)((0,dist_artifact/* artifactOnChainToAddress */.wM)(current.interchainSecurityModule, contracts_normalizeStarknetAddressSafe))
|
|
2755
2614
|
: expected.interchainSecurityModule,
|
|
2756
2615
|
hook: (0,addresses/* isEmptyAddress */.Ae)(expectedHook)
|
|
2757
|
-
? (0,dist_artifact/* addressToUnderivedArtifact */.Se)((0,dist_artifact/* artifactOnChainToAddress */.wM)(current.hook,
|
|
2616
|
+
? (0,dist_artifact/* addressToUnderivedArtifact */.Se)((0,dist_artifact/* artifactOnChainToAddress */.wM)(current.hook, contracts_normalizeStarknetAddressSafe))
|
|
2758
2617
|
: expected.hook,
|
|
2759
2618
|
};
|
|
2760
2619
|
}
|
|
@@ -2766,19 +2625,17 @@ class StarknetWarpTokenWriterBase extends StarknetWarpTokenReaderBase {
|
|
|
2766
2625
|
async applyPostCreateConfig(tokenAddress, expected, current) {
|
|
2767
2626
|
const receipts = [];
|
|
2768
2627
|
let ownerTx;
|
|
2769
|
-
const expectedIsm = (0,dist_artifact/* artifactOnChainToAddress */.wM)(expected.interchainSecurityModule,
|
|
2628
|
+
const expectedIsm = (0,dist_artifact/* artifactOnChainToAddress */.wM)(expected.interchainSecurityModule, contracts_normalizeStarknetAddressSafe);
|
|
2770
2629
|
if (expectedIsm) {
|
|
2771
|
-
const tx = await this.
|
|
2772
|
-
signer: this.signer.getSignerAddress(),
|
|
2630
|
+
const tx = await getSetTokenIsmTx(this.provider.getRawProvider(), {
|
|
2773
2631
|
tokenAddress,
|
|
2774
2632
|
ismAddress: expectedIsm,
|
|
2775
2633
|
});
|
|
2776
2634
|
receipts.push(await this.signer.sendAndConfirmTransaction(tx));
|
|
2777
2635
|
}
|
|
2778
|
-
const expectedHook = (0,dist_artifact/* artifactOnChainToAddress */.wM)(expected.hook,
|
|
2636
|
+
const expectedHook = (0,dist_artifact/* artifactOnChainToAddress */.wM)(expected.hook, contracts_normalizeStarknetAddressSafe);
|
|
2779
2637
|
if (expectedHook) {
|
|
2780
|
-
const tx = await this.
|
|
2781
|
-
signer: this.signer.getSignerAddress(),
|
|
2638
|
+
const tx = await getSetTokenHookTx(this.provider.getRawProvider(), {
|
|
2782
2639
|
tokenAddress,
|
|
2783
2640
|
hookAddress: expectedHook,
|
|
2784
2641
|
});
|
|
@@ -2789,8 +2646,7 @@ class StarknetWarpTokenWriterBase extends StarknetWarpTokenReaderBase {
|
|
|
2789
2646
|
.sort((a, b) => a - b)) {
|
|
2790
2647
|
const remoteRouter = expected.remoteRouters[domain];
|
|
2791
2648
|
(0,validation/* assert */.v)(remoteRouter, `Missing remote router for Starknet domain ${domain}`);
|
|
2792
|
-
const tx = await this.
|
|
2793
|
-
signer: this.signer.getSignerAddress(),
|
|
2649
|
+
const tx = await getEnrollRemoteRouterTx(this.provider.getRawProvider(), {
|
|
2794
2650
|
tokenAddress,
|
|
2795
2651
|
remoteRouter: {
|
|
2796
2652
|
receiverDomainId: domain,
|
|
@@ -2802,8 +2658,7 @@ class StarknetWarpTokenWriterBase extends StarknetWarpTokenReaderBase {
|
|
|
2802
2658
|
}
|
|
2803
2659
|
const currentOwner = current.owner;
|
|
2804
2660
|
if (!(0,addresses/* eqAddressStarknet */.PD)(currentOwner, expected.owner)) {
|
|
2805
|
-
ownerTx = await this.
|
|
2806
|
-
signer: this.signer.getSignerAddress(),
|
|
2661
|
+
ownerTx = await getSetTokenOwnerTx(this.provider.getRawProvider(), {
|
|
2807
2662
|
tokenAddress,
|
|
2808
2663
|
newOwner: expected.owner,
|
|
2809
2664
|
});
|
|
@@ -2820,13 +2675,15 @@ class StarknetWarpTokenWriterBase extends StarknetWarpTokenReaderBase {
|
|
|
2820
2675
|
|
|
2821
2676
|
|
|
2822
2677
|
|
|
2678
|
+
|
|
2679
|
+
|
|
2823
2680
|
class StarknetCollateralTokenReader extends StarknetWarpTokenReaderBase {
|
|
2824
2681
|
tokenType = 'collateral';
|
|
2825
2682
|
toConfig(token, remoteRouters) {
|
|
2826
2683
|
return {
|
|
2827
2684
|
type: warp/* TokenType */.ks.collateral,
|
|
2828
2685
|
...this.baseConfig(token, remoteRouters),
|
|
2829
|
-
token:
|
|
2686
|
+
token: contracts_normalizeStarknetAddressSafe(token.denom),
|
|
2830
2687
|
name: token.name,
|
|
2831
2688
|
symbol: token.symbol,
|
|
2832
2689
|
decimals: token.decimals,
|
|
@@ -2839,17 +2696,19 @@ class StarknetCollateralTokenWriter extends StarknetWarpTokenWriterBase {
|
|
|
2839
2696
|
return {
|
|
2840
2697
|
type: warp/* TokenType */.ks.collateral,
|
|
2841
2698
|
...this.baseConfig(token, remoteRouters),
|
|
2842
|
-
token:
|
|
2699
|
+
token: contracts_normalizeStarknetAddressSafe(token.denom),
|
|
2843
2700
|
name: token.name,
|
|
2844
2701
|
symbol: token.symbol,
|
|
2845
2702
|
decimals: token.decimals,
|
|
2846
2703
|
};
|
|
2847
2704
|
}
|
|
2848
2705
|
async createToken(artifact) {
|
|
2849
|
-
const
|
|
2850
|
-
|
|
2706
|
+
const mailbox = await getMailboxConfig(this.provider.getRawProvider(), artifact.config.mailbox);
|
|
2707
|
+
const tx = getCreateCollateralTokenTx(this.signer.getSignerAddress(), {
|
|
2851
2708
|
mailboxAddress: artifact.config.mailbox,
|
|
2852
2709
|
collateralDenom: artifact.config.token,
|
|
2710
|
+
defaultHook: mailbox.defaultHook,
|
|
2711
|
+
defaultIsm: mailbox.defaultIsm,
|
|
2853
2712
|
});
|
|
2854
2713
|
return this.signer.sendAndConfirmTransaction(tx);
|
|
2855
2714
|
}
|
|
@@ -2862,6 +2721,8 @@ class StarknetCollateralTokenWriter extends StarknetWarpTokenWriterBase {
|
|
|
2862
2721
|
;// CONCATENATED MODULE: ../starknet-sdk/dist/warp/native-token-artifact-manager.js
|
|
2863
2722
|
|
|
2864
2723
|
|
|
2724
|
+
|
|
2725
|
+
|
|
2865
2726
|
class StarknetNativeTokenReader extends StarknetWarpTokenReaderBase {
|
|
2866
2727
|
tokenType = 'native';
|
|
2867
2728
|
toConfig(token, remoteRouters) {
|
|
@@ -2880,9 +2741,12 @@ class StarknetNativeTokenWriter extends StarknetWarpTokenWriterBase {
|
|
|
2880
2741
|
};
|
|
2881
2742
|
}
|
|
2882
2743
|
async createToken(artifact) {
|
|
2883
|
-
const
|
|
2884
|
-
|
|
2744
|
+
const mailbox = await getMailboxConfig(this.provider.getRawProvider(), artifact.config.mailbox);
|
|
2745
|
+
const tx = getCreateNativeTokenTx(this.signer.getSignerAddress(), {
|
|
2885
2746
|
mailboxAddress: artifact.config.mailbox,
|
|
2747
|
+
feeTokenAddress: this.provider.getFeeTokenAddress(),
|
|
2748
|
+
defaultHook: mailbox.defaultHook,
|
|
2749
|
+
defaultIsm: mailbox.defaultIsm,
|
|
2886
2750
|
});
|
|
2887
2751
|
return this.signer.sendAndConfirmTransaction(tx);
|
|
2888
2752
|
}
|
|
@@ -2892,6 +2756,8 @@ class StarknetNativeTokenWriter extends StarknetWarpTokenWriterBase {
|
|
|
2892
2756
|
|
|
2893
2757
|
|
|
2894
2758
|
|
|
2759
|
+
|
|
2760
|
+
|
|
2895
2761
|
class StarknetSyntheticTokenReader extends StarknetWarpTokenReaderBase {
|
|
2896
2762
|
tokenType = 'synthetic';
|
|
2897
2763
|
toConfig(token, remoteRouters) {
|
|
@@ -2927,12 +2793,14 @@ class StarknetSyntheticTokenWriter extends StarknetWarpTokenWriterBase {
|
|
|
2927
2793
|
(0,validation/* assert */.v)(!expected.metadataUri, 'metadataUri is unsupported for Starknet synthetic warp tokens');
|
|
2928
2794
|
}
|
|
2929
2795
|
async createToken(artifact) {
|
|
2930
|
-
const
|
|
2931
|
-
|
|
2796
|
+
const mailbox = await getMailboxConfig(this.provider.getRawProvider(), artifact.config.mailbox);
|
|
2797
|
+
const tx = getCreateSyntheticTokenTx(this.signer.getSignerAddress(), {
|
|
2932
2798
|
mailboxAddress: artifact.config.mailbox,
|
|
2933
2799
|
name: artifact.config.name,
|
|
2934
2800
|
denom: artifact.config.symbol,
|
|
2935
2801
|
decimals: artifact.config.decimals,
|
|
2802
|
+
defaultHook: mailbox.defaultHook,
|
|
2803
|
+
defaultIsm: mailbox.defaultIsm,
|
|
2936
2804
|
});
|
|
2937
2805
|
return this.signer.sendAndConfirmTransaction(tx);
|
|
2938
2806
|
}
|
|
@@ -2949,7 +2817,7 @@ class StarknetSyntheticTokenWriter extends StarknetWarpTokenWriterBase {
|
|
|
2949
2817
|
class StarknetWarpArtifactManager {
|
|
2950
2818
|
provider;
|
|
2951
2819
|
constructor(chainMetadata) {
|
|
2952
|
-
this.provider = StarknetProvider.connect(
|
|
2820
|
+
this.provider = StarknetProvider.connect(chainMetadata);
|
|
2953
2821
|
}
|
|
2954
2822
|
supportsHookUpdates() {
|
|
2955
2823
|
return true;
|
|
@@ -3002,21 +2870,18 @@ class StarknetWarpArtifactManager {
|
|
|
3002
2870
|
|
|
3003
2871
|
|
|
3004
2872
|
|
|
2873
|
+
// Base router deploy cost in native denom (fri), used to size
|
|
2874
|
+
// getMinGas().WARP_DEPLOY_GAS. The composable per-config breakdown lives on
|
|
2875
|
+
// StarknetProvider.getMinGasForWarpDeploy.
|
|
2876
|
+
const protocol_WARP_DEPLOY_BASE_FRI = BigInt(3e8);
|
|
3005
2877
|
class StarknetProtocolProvider {
|
|
3006
2878
|
async createProvider(chainMetadata) {
|
|
3007
|
-
|
|
3008
|
-
(0,validation/* assert */.v)(rpcUrls.length > 0, 'rpc urls undefined for Starknet');
|
|
3009
|
-
return StarknetProvider.connect(rpcUrls, chainMetadata.chainId, {
|
|
3010
|
-
metadata: chainMetadata,
|
|
3011
|
-
});
|
|
2879
|
+
return StarknetProvider.connect(chainMetadata);
|
|
3012
2880
|
}
|
|
3013
2881
|
async createSigner(chainMetadata, config) {
|
|
3014
|
-
const rpcUrls = (chainMetadata.rpcUrls ?? []).map(({ http }) => http);
|
|
3015
|
-
(0,validation/* assert */.v)(rpcUrls.length > 0, 'rpc urls undefined for Starknet');
|
|
3016
2882
|
(0,validation/* assert */.v)(config.privateKey, 'privateKey missing for Starknet signer');
|
|
3017
2883
|
(0,validation/* assert */.v)(config.accountAddress, 'accountAddress missing for Starknet signer');
|
|
3018
|
-
return StarknetSigner.connectWithSigner(
|
|
3019
|
-
metadata: chainMetadata,
|
|
2884
|
+
return StarknetSigner.connectWithSigner(chainMetadata, config.privateKey, {
|
|
3020
2885
|
accountAddress: config.accountAddress,
|
|
3021
2886
|
});
|
|
3022
2887
|
}
|
|
@@ -3038,27 +2903,26 @@ class StarknetProtocolProvider {
|
|
|
3038
2903
|
createValidatorAnnounceArtifactManager(chainMetadata) {
|
|
3039
2904
|
return new StarknetValidatorAnnounceArtifactManager(chainMetadata);
|
|
3040
2905
|
}
|
|
2906
|
+
createFeeArtifactManager(_chainMetadata, _context) {
|
|
2907
|
+
return null;
|
|
2908
|
+
}
|
|
3041
2909
|
getMinGas() {
|
|
3042
2910
|
return {
|
|
3043
2911
|
CORE_DEPLOY_GAS: BigInt(1e9),
|
|
3044
|
-
WARP_DEPLOY_GAS:
|
|
2912
|
+
WARP_DEPLOY_GAS: protocol_WARP_DEPLOY_BASE_FRI,
|
|
3045
2913
|
TEST_SEND_GAS: BigInt(3e7),
|
|
3046
2914
|
AVS_GAS: BigInt(3e8),
|
|
3047
2915
|
ISM_DEPLOY_GAS: BigInt(5e7),
|
|
2916
|
+
HOOK_DEPLOY_GAS: BigInt(5e7),
|
|
3048
2917
|
};
|
|
3049
2918
|
}
|
|
3050
2919
|
}
|
|
3051
2920
|
//# sourceMappingURL=protocol.js.map
|
|
3052
|
-
;// CONCATENATED MODULE: ../starknet-sdk/dist/
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
2921
|
+
;// CONCATENATED MODULE: ../starknet-sdk/dist/runtime.js
|
|
3058
2922
|
|
|
3059
2923
|
|
|
3060
2924
|
|
|
3061
|
-
//# sourceMappingURL=
|
|
2925
|
+
//# sourceMappingURL=runtime.js.map
|
|
3062
2926
|
|
|
3063
2927
|
/***/ })
|
|
3064
2928
|
|