@hyperlane-xyz/cli 31.2.1 → 32.0.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/bundle/576.index.js +5 -5
- package/bundle/756.index.js +12 -8
- package/bundle/{172.index.js → 773.index.js} +554 -817
- package/bundle/{514.index.js → 79.index.js} +137 -231
- package/bundle/aleo_wasm.wasm +0 -0
- package/bundle/aleo_wasm1.wasm +0 -0
- package/bundle/index.js +2310 -5230
- package/bundle/worker2.js +13 -13
- package/bundle/worker3.js +13 -13
- package/package.json +17 -15
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export const id =
|
|
2
|
-
export const ids = [
|
|
1
|
+
export const id = 773;
|
|
2
|
+
export const ids = [773];
|
|
3
3
|
export const modules = {
|
|
4
4
|
|
|
5
|
-
/***/
|
|
5
|
+
/***/ 5773:
|
|
6
6
|
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
7
7
|
|
|
8
8
|
|
|
@@ -114,9 +114,9 @@ const STARKNET_DEFAULT_FEE_TOKEN_ADDRESSES = {
|
|
|
114
114
|
};
|
|
115
115
|
function getStarknetContract(contractName, address, providerOrAccount, contractType = starknet_dist_0/* ContractType */.h$.CONTRACT) {
|
|
116
116
|
const { abi } = (0,starknet_dist_0/* getCompiledContract */.wm)(contractName, contractType);
|
|
117
|
-
return new starknet_dist/* Contract */.NZ(abi,
|
|
117
|
+
return new starknet_dist/* Contract */.NZ(abi, contracts_normalizeStarknetAddressSafe(address), providerOrAccount);
|
|
118
118
|
}
|
|
119
|
-
function
|
|
119
|
+
function contracts_normalizeStarknetAddressSafe(value) {
|
|
120
120
|
if (typeof value === 'string') {
|
|
121
121
|
if ((0,addresses/* isZeroishAddress */.Hi)(value))
|
|
122
122
|
return addresses/* ZERO_ADDRESS_HEX_32 */.qx;
|
|
@@ -130,13 +130,13 @@ function normalizeStarknetAddressSafe(value) {
|
|
|
130
130
|
return (0,starknet_dist/* addAddressPadding */.N6)((0,addresses/* ensure0x */.Ho)(starknet_dist/* uint256 */.iN.uint256ToBN(value).toString(16)));
|
|
131
131
|
}
|
|
132
132
|
if ('value' in value) {
|
|
133
|
-
return
|
|
133
|
+
return contracts_normalizeStarknetAddressSafe(value['value']);
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
136
|
throw new Error(`Unable to normalize Starknet address: ${describeUnknown(value) || '[unsupported value]'}`);
|
|
137
137
|
}
|
|
138
138
|
function addressToEvmAddress(value) {
|
|
139
|
-
return (0,addresses/* bytes32ToAddress */.ov)(
|
|
139
|
+
return (0,addresses/* bytes32ToAddress */.ov)(contracts_normalizeStarknetAddressSafe(value));
|
|
140
140
|
}
|
|
141
141
|
async function callContract(contract, method, args = []) {
|
|
142
142
|
(0,validation/* assert */.v)(hasAbiMethod(contract, method), `Unable to call ${method} on contract ${contract.address}: method not found in ABI`);
|
|
@@ -162,7 +162,7 @@ async function populateInvokeTx(contract, method, args = []) {
|
|
|
162
162
|
if (isPopulatedInvokeTx(tx)) {
|
|
163
163
|
return {
|
|
164
164
|
kind: 'invoke',
|
|
165
|
-
contractAddress:
|
|
165
|
+
contractAddress: contracts_normalizeStarknetAddressSafe(tx.contractAddress),
|
|
166
166
|
entrypoint: tx.entrypoint,
|
|
167
167
|
calldata: tx.calldata ?? [],
|
|
168
168
|
};
|
|
@@ -171,7 +171,7 @@ async function populateInvokeTx(contract, method, args = []) {
|
|
|
171
171
|
const abi = getContractAbi(contract);
|
|
172
172
|
return {
|
|
173
173
|
kind: 'invoke',
|
|
174
|
-
contractAddress:
|
|
174
|
+
contractAddress: contracts_normalizeStarknetAddressSafe(contract.address),
|
|
175
175
|
entrypoint: method,
|
|
176
176
|
calldata: abi ? new starknet_dist/* CallData */.fP(abi).compile(method, args) : args,
|
|
177
177
|
};
|
|
@@ -245,17 +245,17 @@ function toBigInt(value) {
|
|
|
245
245
|
}
|
|
246
246
|
function getFeeTokenAddress(params) {
|
|
247
247
|
if (params.nativeDenom && !(0,addresses/* isZeroishAddress */.Hi)(params.nativeDenom)) {
|
|
248
|
-
return
|
|
248
|
+
return contracts_normalizeStarknetAddressSafe(params.nativeDenom);
|
|
249
249
|
}
|
|
250
250
|
const token = STARKNET_DEFAULT_FEE_TOKEN_ADDRESSES[params.chainName];
|
|
251
251
|
(0,validation/* assert */.v)(token, `Missing Starknet fee token for chain ${params.chainName}`);
|
|
252
|
-
return
|
|
252
|
+
return contracts_normalizeStarknetAddressSafe(token);
|
|
253
253
|
}
|
|
254
254
|
function normalizeRoutersAddress(value) {
|
|
255
255
|
if (isUint256Like(value)) {
|
|
256
|
-
return
|
|
256
|
+
return contracts_normalizeStarknetAddressSafe(starknet_dist/* num */.bu.toHex(starknet_dist/* uint256 */.iN.uint256ToBN(value)));
|
|
257
257
|
}
|
|
258
|
-
return
|
|
258
|
+
return contracts_normalizeStarknetAddressSafe(value);
|
|
259
259
|
}
|
|
260
260
|
/**
|
|
261
261
|
* Creates a Contract instance using the on-chain ABI fetched from the provider.
|
|
@@ -266,7 +266,7 @@ function normalizeRoutersAddress(value) {
|
|
|
266
266
|
* and Cairo 0 proxies (`implementation` returning a felt).
|
|
267
267
|
*/
|
|
268
268
|
async function getOnChainStarknetContract(provider, address) {
|
|
269
|
-
const normalized =
|
|
269
|
+
const normalized = contracts_normalizeStarknetAddressSafe(address);
|
|
270
270
|
const { abi } = await provider.getClassAt(normalized);
|
|
271
271
|
const contract = new starknet_dist/* Contract */.NZ(abi, normalized, provider);
|
|
272
272
|
const implHash = await resolveImplementationHash(contract);
|
|
@@ -339,13 +339,55 @@ function shouldFallbackStorageRead(error) {
|
|
|
339
339
|
const normalizedMessage = message.toLowerCase();
|
|
340
340
|
return STORAGE_READ_FALLBACK_MESSAGES.some((fragment) => normalizedMessage.includes(fragment));
|
|
341
341
|
}
|
|
342
|
+
function isProbeMiss(error) {
|
|
343
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
344
|
+
return [
|
|
345
|
+
'entry point',
|
|
346
|
+
'entrypoint',
|
|
347
|
+
'viewable method not found in abi',
|
|
348
|
+
'not found in abi',
|
|
349
|
+
'not found in contract',
|
|
350
|
+
'invalid message selector',
|
|
351
|
+
].some((needle) => message.toLowerCase().includes(needle));
|
|
352
|
+
}
|
|
342
353
|
//# sourceMappingURL=contracts.js.map
|
|
354
|
+
;// CONCATENATED MODULE: ../starknet-sdk/dist/mailbox/mailbox-query.js
|
|
355
|
+
|
|
356
|
+
async function getMailboxConfig(provider, mailboxAddress) {
|
|
357
|
+
const mailbox = getStarknetContract(StarknetContractName.MAILBOX, mailboxAddress, provider);
|
|
358
|
+
const [owner, localDomain, defaultIsm, defaultHook, requiredHook, nonce] = await Promise.all([
|
|
359
|
+
callContract(mailbox, 'owner'),
|
|
360
|
+
callContract(mailbox, 'get_local_domain'),
|
|
361
|
+
callContract(mailbox, 'get_default_ism'),
|
|
362
|
+
callContract(mailbox, 'get_default_hook'),
|
|
363
|
+
callContract(mailbox, 'get_required_hook'),
|
|
364
|
+
callContract(mailbox, 'nonce'),
|
|
365
|
+
]);
|
|
366
|
+
return {
|
|
367
|
+
address: contracts_normalizeStarknetAddressSafe(mailboxAddress),
|
|
368
|
+
owner: contracts_normalizeStarknetAddressSafe(owner),
|
|
369
|
+
localDomain: toNumber(localDomain),
|
|
370
|
+
defaultIsm: contracts_normalizeStarknetAddressSafe(defaultIsm),
|
|
371
|
+
defaultHook: contracts_normalizeStarknetAddressSafe(defaultHook),
|
|
372
|
+
requiredHook: contracts_normalizeStarknetAddressSafe(requiredHook),
|
|
373
|
+
nonce: toNumber(nonce),
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
async function isMessageDelivered(provider, mailboxAddress, messageId) {
|
|
377
|
+
const mailbox = getStarknetContract(StarknetContractName.MAILBOX, mailboxAddress, provider);
|
|
378
|
+
const delivered = await callContract(mailbox, 'delivered', [messageId]);
|
|
379
|
+
if (typeof delivered === 'boolean')
|
|
380
|
+
return delivered;
|
|
381
|
+
return toBigInt(delivered) !== 0n;
|
|
382
|
+
}
|
|
383
|
+
//# sourceMappingURL=mailbox-query.js.map
|
|
343
384
|
;// CONCATENATED MODULE: ../starknet-sdk/dist/clients/provider.js
|
|
344
385
|
|
|
345
386
|
|
|
346
387
|
|
|
347
388
|
|
|
348
389
|
|
|
390
|
+
|
|
349
391
|
let tokenTypeByClassHash;
|
|
350
392
|
function getTokenTypeByClassHash() {
|
|
351
393
|
if (tokenTypeByClassHash) {
|
|
@@ -371,17 +413,6 @@ function getTokenTypeByClassHash() {
|
|
|
371
413
|
]));
|
|
372
414
|
return tokenTypeByClassHash;
|
|
373
415
|
}
|
|
374
|
-
function isProbeMiss(error) {
|
|
375
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
376
|
-
return [
|
|
377
|
-
'entry point',
|
|
378
|
-
'entrypoint',
|
|
379
|
-
'viewable method not found in abi',
|
|
380
|
-
'not found in abi',
|
|
381
|
-
'not found in contract',
|
|
382
|
-
'invalid message selector',
|
|
383
|
-
].some((needle) => message.toLowerCase().includes(needle));
|
|
384
|
-
}
|
|
385
416
|
class StarknetProvider {
|
|
386
417
|
provider;
|
|
387
418
|
metadata;
|
|
@@ -418,6 +449,9 @@ class StarknetProvider {
|
|
|
418
449
|
nativeDenom: this.metadata.nativeToken?.denom,
|
|
419
450
|
});
|
|
420
451
|
}
|
|
452
|
+
getFeeTokenAddress() {
|
|
453
|
+
return this.feeTokenAddress;
|
|
454
|
+
}
|
|
421
455
|
parseString(value) {
|
|
422
456
|
if (typeof value === 'string')
|
|
423
457
|
return value;
|
|
@@ -447,7 +481,7 @@ class StarknetProvider {
|
|
|
447
481
|
const tx = await populateInvokeTx(contract, method, args);
|
|
448
482
|
(0,validation/* assert */.v)(tx.kind === 'invoke', 'Expected invoke Starknet transaction');
|
|
449
483
|
return {
|
|
450
|
-
contractAddress:
|
|
484
|
+
contractAddress: contracts_normalizeStarknetAddressSafe(tx.contractAddress),
|
|
451
485
|
entrypoint: tx.entrypoint,
|
|
452
486
|
calldata: tx.calldata,
|
|
453
487
|
};
|
|
@@ -459,7 +493,7 @@ class StarknetProvider {
|
|
|
459
493
|
return value;
|
|
460
494
|
}
|
|
461
495
|
async determineTokenType(tokenAddress) {
|
|
462
|
-
const address =
|
|
496
|
+
const address = contracts_normalizeStarknetAddressSafe(tokenAddress);
|
|
463
497
|
const classHash = await this.provider.getClassHashAt(address);
|
|
464
498
|
const tokenType = getTokenTypeByClassHash().get(BigInt(classHash).toString());
|
|
465
499
|
if (tokenType)
|
|
@@ -492,15 +526,15 @@ class StarknetProvider {
|
|
|
492
526
|
async getTokenMetadata(tokenAddress) {
|
|
493
527
|
const nativeToken = this.metadata.nativeToken;
|
|
494
528
|
if (nativeToken?.denom &&
|
|
495
|
-
|
|
496
|
-
|
|
529
|
+
contracts_normalizeStarknetAddressSafe(tokenAddress) ===
|
|
530
|
+
contracts_normalizeStarknetAddressSafe(nativeToken.denom)) {
|
|
497
531
|
return {
|
|
498
532
|
name: nativeToken.name,
|
|
499
533
|
symbol: nativeToken.symbol,
|
|
500
534
|
decimals: nativeToken.decimals ?? 18,
|
|
501
535
|
};
|
|
502
536
|
}
|
|
503
|
-
const address =
|
|
537
|
+
const address = contracts_normalizeStarknetAddressSafe(tokenAddress);
|
|
504
538
|
const token = await getOnChainStarknetContract(this.provider, address);
|
|
505
539
|
const [name, symbol, decimals] = await Promise.all([
|
|
506
540
|
callContract(token, 'name'),
|
|
@@ -561,27 +595,27 @@ class StarknetProvider {
|
|
|
561
595
|
}
|
|
562
596
|
async getBalance(req) {
|
|
563
597
|
const tokenAddress = req.denom
|
|
564
|
-
?
|
|
598
|
+
? contracts_normalizeStarknetAddressSafe(req.denom)
|
|
565
599
|
: this.feeTokenAddress;
|
|
566
600
|
const token = this.withContract(StarknetContractName.ETHER, tokenAddress, this.provider, starknet_dist_0/* ContractType */.h$.TOKEN);
|
|
567
601
|
let balance;
|
|
568
602
|
try {
|
|
569
603
|
balance = await callContract(token, 'balanceOf', [
|
|
570
|
-
|
|
604
|
+
contracts_normalizeStarknetAddressSafe(req.address),
|
|
571
605
|
]);
|
|
572
606
|
}
|
|
573
607
|
catch (error) {
|
|
574
608
|
if (!isProbeMiss(error))
|
|
575
609
|
throw error;
|
|
576
610
|
balance = await callContract(token, 'balance_of', [
|
|
577
|
-
|
|
611
|
+
contracts_normalizeStarknetAddressSafe(req.address),
|
|
578
612
|
]);
|
|
579
613
|
}
|
|
580
614
|
return toBigInt(this.unwrapBalance(balance));
|
|
581
615
|
}
|
|
582
616
|
async getTotalSupply(req) {
|
|
583
617
|
const tokenAddress = req.denom
|
|
584
|
-
?
|
|
618
|
+
? contracts_normalizeStarknetAddressSafe(req.denom)
|
|
585
619
|
: this.feeTokenAddress;
|
|
586
620
|
const token = this.withContract(StarknetContractName.ETHER, tokenAddress, this.provider, starknet_dist_0/* ContractType */.h$.TOKEN);
|
|
587
621
|
return toBigInt(await callContract(token, 'total_supply'));
|
|
@@ -589,119 +623,12 @@ class StarknetProvider {
|
|
|
589
623
|
async estimateTransactionFee(_req) {
|
|
590
624
|
throw new Error('Starknet transaction fee estimation is unsupported without an account-backed signer');
|
|
591
625
|
}
|
|
592
|
-
// ### QUERY CORE ###
|
|
593
|
-
async getMailbox(req) {
|
|
594
|
-
const mailbox = this.withContract(StarknetContractName.MAILBOX, req.mailboxAddress);
|
|
595
|
-
const [owner, localDomain, defaultIsm, defaultHook, requiredHook, nonce] = await Promise.all([
|
|
596
|
-
callContract(mailbox, 'owner'),
|
|
597
|
-
callContract(mailbox, 'get_local_domain'),
|
|
598
|
-
callContract(mailbox, 'get_default_ism'),
|
|
599
|
-
callContract(mailbox, 'get_default_hook'),
|
|
600
|
-
callContract(mailbox, 'get_required_hook'),
|
|
601
|
-
callContract(mailbox, 'nonce'),
|
|
602
|
-
]);
|
|
603
|
-
return {
|
|
604
|
-
address: normalizeStarknetAddressSafe(req.mailboxAddress),
|
|
605
|
-
owner: normalizeStarknetAddressSafe(owner),
|
|
606
|
-
localDomain: toNumber(localDomain),
|
|
607
|
-
defaultIsm: normalizeStarknetAddressSafe(defaultIsm),
|
|
608
|
-
defaultHook: normalizeStarknetAddressSafe(defaultHook),
|
|
609
|
-
requiredHook: normalizeStarknetAddressSafe(requiredHook),
|
|
610
|
-
nonce: toNumber(nonce),
|
|
611
|
-
};
|
|
612
|
-
}
|
|
613
626
|
async isMessageDelivered(req) {
|
|
614
|
-
|
|
615
|
-
const delivered = await callContract(mailbox, 'delivered', [req.messageId]);
|
|
616
|
-
if (typeof delivered === 'boolean')
|
|
617
|
-
return delivered;
|
|
618
|
-
return toBigInt(delivered) !== 0n;
|
|
619
|
-
}
|
|
620
|
-
async getIsmType(req) {
|
|
621
|
-
try {
|
|
622
|
-
const ism = this.withContract(StarknetContractName.MERKLE_ROOT_MULTISIG_ISM, req.ismAddress);
|
|
623
|
-
const moduleType = await callContract(ism, 'module_type');
|
|
624
|
-
return this.parseIsmVariant(extractEnumVariant(moduleType));
|
|
625
|
-
}
|
|
626
|
-
catch (error) {
|
|
627
|
-
if (!isProbeMiss(error))
|
|
628
|
-
throw error;
|
|
629
|
-
return dist/* AltVM.IsmType */.bx.GO.CUSTOM;
|
|
630
|
-
}
|
|
631
|
-
}
|
|
632
|
-
async getMessageIdMultisigIsm(req) {
|
|
633
|
-
const ism = this.withContract(StarknetContractName.MESSAGE_ID_MULTISIG_ISM, req.ismAddress);
|
|
634
|
-
const [validators, threshold] = await Promise.all([
|
|
635
|
-
callContract(ism, 'get_validators'),
|
|
636
|
-
callContract(ism, 'get_threshold'),
|
|
637
|
-
]);
|
|
638
|
-
(0,validation/* assert */.v)(Array.isArray(validators), 'Expected Starknet validators array');
|
|
639
|
-
return {
|
|
640
|
-
address: normalizeStarknetAddressSafe(req.ismAddress),
|
|
641
|
-
threshold: toNumber(threshold),
|
|
642
|
-
validators: validators.map((v) => addressToEvmAddress(v)),
|
|
643
|
-
};
|
|
644
|
-
}
|
|
645
|
-
async getMerkleRootMultisigIsm(req) {
|
|
646
|
-
const ism = this.withContract(StarknetContractName.MERKLE_ROOT_MULTISIG_ISM, req.ismAddress);
|
|
647
|
-
const [validators, threshold] = await Promise.all([
|
|
648
|
-
callContract(ism, 'get_validators'),
|
|
649
|
-
callContract(ism, 'get_threshold'),
|
|
650
|
-
]);
|
|
651
|
-
(0,validation/* assert */.v)(Array.isArray(validators), 'Expected Starknet validators array');
|
|
652
|
-
return {
|
|
653
|
-
address: normalizeStarknetAddressSafe(req.ismAddress),
|
|
654
|
-
threshold: toNumber(threshold),
|
|
655
|
-
validators: validators.map((v) => addressToEvmAddress(v)),
|
|
656
|
-
};
|
|
657
|
-
}
|
|
658
|
-
async getRoutingIsm(req) {
|
|
659
|
-
const ism = this.withContract(StarknetContractName.ROUTING_ISM, req.ismAddress);
|
|
660
|
-
const [owner, domains] = await Promise.all([
|
|
661
|
-
callContract(ism, 'owner'),
|
|
662
|
-
callContract(ism, 'domains'),
|
|
663
|
-
]);
|
|
664
|
-
(0,validation/* assert */.v)(Array.isArray(domains), 'Expected Starknet routing domains array');
|
|
665
|
-
const routes = await Promise.all(domains.map(async (domainId) => {
|
|
666
|
-
const routeAddress = await callContract(ism, 'module', [domainId]);
|
|
667
|
-
return {
|
|
668
|
-
domainId: toNumber(domainId),
|
|
669
|
-
ismAddress: normalizeStarknetAddressSafe(routeAddress),
|
|
670
|
-
};
|
|
671
|
-
}));
|
|
672
|
-
return {
|
|
673
|
-
address: normalizeStarknetAddressSafe(req.ismAddress),
|
|
674
|
-
owner: normalizeStarknetAddressSafe(owner),
|
|
675
|
-
routes,
|
|
676
|
-
};
|
|
677
|
-
}
|
|
678
|
-
async getNoopIsm(req) {
|
|
679
|
-
return { address: normalizeStarknetAddressSafe(req.ismAddress) };
|
|
680
|
-
}
|
|
681
|
-
async getHookType(req) {
|
|
682
|
-
try {
|
|
683
|
-
const hook = this.withContract(StarknetContractName.HOOK, req.hookAddress);
|
|
684
|
-
const hookType = await callContract(hook, 'hook_type');
|
|
685
|
-
return this.parseHookVariant(extractEnumVariant(hookType));
|
|
686
|
-
}
|
|
687
|
-
catch (error) {
|
|
688
|
-
if (!isProbeMiss(error))
|
|
689
|
-
throw error;
|
|
690
|
-
return dist/* AltVM.HookType */.bx.WD.CUSTOM;
|
|
691
|
-
}
|
|
692
|
-
}
|
|
693
|
-
async getInterchainGasPaymasterHook(_req) {
|
|
694
|
-
throw new Error('interchainGasPaymaster hook type is unsupported on Starknet; use protocolFee hook type');
|
|
695
|
-
}
|
|
696
|
-
async getMerkleTreeHook(req) {
|
|
697
|
-
return { address: normalizeStarknetAddressSafe(req.hookAddress) };
|
|
698
|
-
}
|
|
699
|
-
async getNoopHook(req) {
|
|
700
|
-
return { address: normalizeStarknetAddressSafe(req.hookAddress) };
|
|
627
|
+
return isMessageDelivered(this.provider, req.mailboxAddress, req.messageId);
|
|
701
628
|
}
|
|
702
629
|
// ### QUERY WARP ###
|
|
703
630
|
async getToken(req) {
|
|
704
|
-
const tokenAddress =
|
|
631
|
+
const tokenAddress = contracts_normalizeStarknetAddressSafe(req.tokenAddress);
|
|
705
632
|
const token = this.withContract(StarknetContractName.HYP_ERC20, tokenAddress, this.provider, starknet_dist_0/* ContractType */.h$.TOKEN);
|
|
706
633
|
const tokenType = await this.determineTokenType(tokenAddress);
|
|
707
634
|
const [owner, mailboxAddress, ismAddress, hookAddress] = await Promise.all([
|
|
@@ -727,7 +654,7 @@ class StarknetProvider {
|
|
|
727
654
|
if (tokenType === dist/* AltVM.TokenType */.bx.ks.collateral) {
|
|
728
655
|
const collateral = this.withContract(StarknetContractName.HYP_ERC20_COLLATERAL, tokenAddress, this.provider, starknet_dist_0/* ContractType */.h$.TOKEN);
|
|
729
656
|
const wrapped = await callContract(collateral, 'get_wrapped_token');
|
|
730
|
-
denom =
|
|
657
|
+
denom = contracts_normalizeStarknetAddressSafe(wrapped);
|
|
731
658
|
try {
|
|
732
659
|
const wrappedMeta = await this.getTokenMetadata(denom);
|
|
733
660
|
name = wrappedMeta.name;
|
|
@@ -743,7 +670,7 @@ class StarknetProvider {
|
|
|
743
670
|
const native = this.withContract(StarknetContractName.HYP_NATIVE, tokenAddress, this.provider, starknet_dist_0/* ContractType */.h$.TOKEN);
|
|
744
671
|
try {
|
|
745
672
|
const nativeTokenAddress = await callContract(native, 'native_token');
|
|
746
|
-
denom =
|
|
673
|
+
denom = contracts_normalizeStarknetAddressSafe(nativeTokenAddress);
|
|
747
674
|
}
|
|
748
675
|
catch (error) {
|
|
749
676
|
if (!isProbeMiss(error))
|
|
@@ -756,11 +683,11 @@ class StarknetProvider {
|
|
|
756
683
|
}
|
|
757
684
|
return {
|
|
758
685
|
address: tokenAddress,
|
|
759
|
-
owner:
|
|
686
|
+
owner: contracts_normalizeStarknetAddressSafe(owner),
|
|
760
687
|
tokenType,
|
|
761
|
-
mailboxAddress:
|
|
762
|
-
ismAddress:
|
|
763
|
-
hookAddress:
|
|
688
|
+
mailboxAddress: contracts_normalizeStarknetAddressSafe(mailboxAddress),
|
|
689
|
+
ismAddress: contracts_normalizeStarknetAddressSafe(ismAddress),
|
|
690
|
+
hookAddress: contracts_normalizeStarknetAddressSafe(hookAddress),
|
|
764
691
|
denom,
|
|
765
692
|
name,
|
|
766
693
|
symbol,
|
|
@@ -784,7 +711,7 @@ class StarknetProvider {
|
|
|
784
711
|
};
|
|
785
712
|
}));
|
|
786
713
|
return {
|
|
787
|
-
address:
|
|
714
|
+
address: contracts_normalizeStarknetAddressSafe(req.tokenAddress),
|
|
788
715
|
remoteRouters,
|
|
789
716
|
};
|
|
790
717
|
}
|
|
@@ -809,255 +736,14 @@ class StarknetProvider {
|
|
|
809
736
|
amount: toBigInt(quote),
|
|
810
737
|
};
|
|
811
738
|
}
|
|
812
|
-
// ###
|
|
813
|
-
async getCreateMailboxTransaction(req) {
|
|
814
|
-
return {
|
|
815
|
-
kind: 'deploy',
|
|
816
|
-
contractName: StarknetContractName.MAILBOX,
|
|
817
|
-
constructorArgs: [
|
|
818
|
-
req.domainId,
|
|
819
|
-
normalizeStarknetAddressSafe(req.signer),
|
|
820
|
-
normalizeStarknetAddressSafe(req.defaultIsmAddress ?? addresses/* ZERO_ADDRESS_HEX_32 */.qx),
|
|
821
|
-
normalizeStarknetAddressSafe(req.defaultHookAddress ?? addresses/* ZERO_ADDRESS_HEX_32 */.qx),
|
|
822
|
-
normalizeStarknetAddressSafe(req.requiredHookAddress ?? addresses/* ZERO_ADDRESS_HEX_32 */.qx),
|
|
823
|
-
],
|
|
824
|
-
};
|
|
825
|
-
}
|
|
826
|
-
async getSetDefaultIsmTransaction(req) {
|
|
827
|
-
const mailbox = this.withContract(StarknetContractName.MAILBOX, req.mailboxAddress);
|
|
828
|
-
return populateInvokeTx(mailbox, 'set_default_ism', [
|
|
829
|
-
normalizeStarknetAddressSafe(req.ismAddress),
|
|
830
|
-
]);
|
|
831
|
-
}
|
|
832
|
-
async getSetDefaultHookTransaction(req) {
|
|
833
|
-
const mailbox = this.withContract(StarknetContractName.MAILBOX, req.mailboxAddress);
|
|
834
|
-
return populateInvokeTx(mailbox, 'set_default_hook', [
|
|
835
|
-
normalizeStarknetAddressSafe(req.hookAddress),
|
|
836
|
-
]);
|
|
837
|
-
}
|
|
838
|
-
async getSetRequiredHookTransaction(req) {
|
|
839
|
-
const mailbox = this.withContract(StarknetContractName.MAILBOX, req.mailboxAddress);
|
|
840
|
-
return populateInvokeTx(mailbox, 'set_required_hook', [
|
|
841
|
-
normalizeStarknetAddressSafe(req.hookAddress),
|
|
842
|
-
]);
|
|
843
|
-
}
|
|
844
|
-
async getSetMailboxOwnerTransaction(req) {
|
|
845
|
-
const mailbox = this.withContract(StarknetContractName.MAILBOX, req.mailboxAddress);
|
|
846
|
-
return populateInvokeTx(mailbox, 'transfer_ownership', [
|
|
847
|
-
normalizeStarknetAddressSafe(req.newOwner),
|
|
848
|
-
]);
|
|
849
|
-
}
|
|
850
|
-
async getCreateMerkleRootMultisigIsmTransaction(req) {
|
|
851
|
-
return {
|
|
852
|
-
kind: 'deploy',
|
|
853
|
-
contractName: StarknetContractName.MERKLE_ROOT_MULTISIG_ISM,
|
|
854
|
-
constructorArgs: [
|
|
855
|
-
normalizeStarknetAddressSafe(req.signer),
|
|
856
|
-
req.validators.map((validator) => (0,addresses/* addressToBytes32 */.In)(validator)),
|
|
857
|
-
req.threshold,
|
|
858
|
-
],
|
|
859
|
-
};
|
|
860
|
-
}
|
|
861
|
-
async getCreateMessageIdMultisigIsmTransaction(req) {
|
|
862
|
-
return {
|
|
863
|
-
kind: 'deploy',
|
|
864
|
-
contractName: StarknetContractName.MESSAGE_ID_MULTISIG_ISM,
|
|
865
|
-
constructorArgs: [
|
|
866
|
-
normalizeStarknetAddressSafe(req.signer),
|
|
867
|
-
req.validators.map((validator) => (0,addresses/* addressToBytes32 */.In)(validator)),
|
|
868
|
-
req.threshold,
|
|
869
|
-
],
|
|
870
|
-
};
|
|
871
|
-
}
|
|
872
|
-
async getCreateRoutingIsmTransaction(req) {
|
|
873
|
-
return {
|
|
874
|
-
kind: 'deploy',
|
|
875
|
-
contractName: StarknetContractName.ROUTING_ISM,
|
|
876
|
-
constructorArgs: [normalizeStarknetAddressSafe(req.signer)],
|
|
877
|
-
};
|
|
878
|
-
}
|
|
879
|
-
async getSetRoutingIsmRouteTransaction(req) {
|
|
880
|
-
const routing = this.withContract(StarknetContractName.ROUTING_ISM, req.ismAddress);
|
|
881
|
-
return populateInvokeTx(routing, 'set', [
|
|
882
|
-
req.route.domainId,
|
|
883
|
-
normalizeStarknetAddressSafe(req.route.ismAddress),
|
|
884
|
-
]);
|
|
885
|
-
}
|
|
886
|
-
async getRemoveRoutingIsmRouteTransaction(req) {
|
|
887
|
-
const routing = this.withContract(StarknetContractName.ROUTING_ISM, req.ismAddress);
|
|
888
|
-
return populateInvokeTx(routing, 'remove', [req.domainId]);
|
|
889
|
-
}
|
|
890
|
-
async getSetRoutingIsmOwnerTransaction(req) {
|
|
891
|
-
const routing = this.withContract(StarknetContractName.ROUTING_ISM, req.ismAddress);
|
|
892
|
-
return populateInvokeTx(routing, 'transfer_ownership', [
|
|
893
|
-
normalizeStarknetAddressSafe(req.newOwner),
|
|
894
|
-
]);
|
|
895
|
-
}
|
|
896
|
-
async getCreateNoopIsmTransaction(_req) {
|
|
897
|
-
return {
|
|
898
|
-
kind: 'deploy',
|
|
899
|
-
contractName: StarknetContractName.NOOP_ISM,
|
|
900
|
-
constructorArgs: [],
|
|
901
|
-
};
|
|
902
|
-
}
|
|
903
|
-
async getCreateMerkleTreeHookTransaction(req) {
|
|
904
|
-
return {
|
|
905
|
-
kind: 'deploy',
|
|
906
|
-
contractName: StarknetContractName.MERKLE_TREE_HOOK,
|
|
907
|
-
constructorArgs: [
|
|
908
|
-
normalizeStarknetAddressSafe(req.mailboxAddress),
|
|
909
|
-
normalizeStarknetAddressSafe(req.signer),
|
|
910
|
-
],
|
|
911
|
-
};
|
|
912
|
-
}
|
|
913
|
-
async getCreateInterchainGasPaymasterHookTransaction(_req) {
|
|
914
|
-
throw new Error('interchainGasPaymaster hook type is unsupported on Starknet; use protocolFee hook type');
|
|
915
|
-
}
|
|
916
|
-
async getSetInterchainGasPaymasterHookOwnerTransaction(_req) {
|
|
917
|
-
throw new Error('interchainGasPaymaster hook type is unsupported on Starknet; use protocolFee hook type');
|
|
918
|
-
}
|
|
919
|
-
async getSetDestinationGasConfigTransaction(_req) {
|
|
920
|
-
throw new Error('interchainGasPaymaster hook type is unsupported on Starknet');
|
|
921
|
-
}
|
|
922
|
-
async getRemoveDestinationGasConfigTransaction(_req) {
|
|
923
|
-
throw new Error('interchainGasPaymaster hook type is unsupported on Starknet');
|
|
924
|
-
}
|
|
925
|
-
async getCreateNoopHookTransaction(_req) {
|
|
926
|
-
return {
|
|
927
|
-
kind: 'deploy',
|
|
928
|
-
contractName: StarknetContractName.HOOK,
|
|
929
|
-
constructorArgs: [],
|
|
930
|
-
};
|
|
931
|
-
}
|
|
932
|
-
async getCreateValidatorAnnounceTransaction(req) {
|
|
933
|
-
return {
|
|
934
|
-
kind: 'deploy',
|
|
935
|
-
contractName: StarknetContractName.VALIDATOR_ANNOUNCE,
|
|
936
|
-
constructorArgs: [
|
|
937
|
-
normalizeStarknetAddressSafe(req.mailboxAddress),
|
|
938
|
-
normalizeStarknetAddressSafe(req.signer),
|
|
939
|
-
],
|
|
940
|
-
};
|
|
941
|
-
}
|
|
942
|
-
async getCreateProxyAdminTransaction(_req) {
|
|
943
|
-
throw new Error('Proxy admin unsupported on Starknet');
|
|
944
|
-
}
|
|
945
|
-
async getSetProxyAdminOwnerTransaction(_req) {
|
|
946
|
-
throw new Error('Proxy admin unsupported on Starknet');
|
|
947
|
-
}
|
|
948
|
-
// ### GET WARP TXS ###
|
|
949
|
-
async getCreateNativeTokenTransaction(req) {
|
|
950
|
-
const mailbox = await this.getMailbox({
|
|
951
|
-
mailboxAddress: req.mailboxAddress,
|
|
952
|
-
});
|
|
953
|
-
return {
|
|
954
|
-
kind: 'deploy',
|
|
955
|
-
contractName: StarknetContractName.HYP_NATIVE,
|
|
956
|
-
contractType: starknet_dist_0/* ContractType */.h$.TOKEN,
|
|
957
|
-
constructorArgs: [
|
|
958
|
-
normalizeStarknetAddressSafe(req.mailboxAddress),
|
|
959
|
-
this.feeTokenAddress,
|
|
960
|
-
normalizeStarknetAddressSafe(mailbox.defaultHook),
|
|
961
|
-
normalizeStarknetAddressSafe(mailbox.defaultIsm),
|
|
962
|
-
normalizeStarknetAddressSafe(req.signer),
|
|
963
|
-
],
|
|
964
|
-
};
|
|
965
|
-
}
|
|
966
|
-
async getCreateCollateralTokenTransaction(req) {
|
|
967
|
-
const mailbox = await this.getMailbox({
|
|
968
|
-
mailboxAddress: req.mailboxAddress,
|
|
969
|
-
});
|
|
970
|
-
return {
|
|
971
|
-
kind: 'deploy',
|
|
972
|
-
contractName: StarknetContractName.HYP_ERC20_COLLATERAL,
|
|
973
|
-
contractType: starknet_dist_0/* ContractType */.h$.TOKEN,
|
|
974
|
-
constructorArgs: [
|
|
975
|
-
normalizeStarknetAddressSafe(req.mailboxAddress),
|
|
976
|
-
normalizeStarknetAddressSafe(req.collateralDenom),
|
|
977
|
-
normalizeStarknetAddressSafe(req.signer),
|
|
978
|
-
normalizeStarknetAddressSafe(mailbox.defaultHook),
|
|
979
|
-
normalizeStarknetAddressSafe(mailbox.defaultIsm),
|
|
980
|
-
],
|
|
981
|
-
};
|
|
982
|
-
}
|
|
983
|
-
async getCreateSyntheticTokenTransaction(req) {
|
|
984
|
-
const mailbox = await this.getMailbox({
|
|
985
|
-
mailboxAddress: req.mailboxAddress,
|
|
986
|
-
});
|
|
987
|
-
return {
|
|
988
|
-
kind: 'deploy',
|
|
989
|
-
contractName: StarknetContractName.HYP_ERC20,
|
|
990
|
-
contractType: starknet_dist_0/* ContractType */.h$.TOKEN,
|
|
991
|
-
constructorArgs: [
|
|
992
|
-
req.decimals,
|
|
993
|
-
normalizeStarknetAddressSafe(req.mailboxAddress),
|
|
994
|
-
0,
|
|
995
|
-
req.name,
|
|
996
|
-
req.denom,
|
|
997
|
-
normalizeStarknetAddressSafe(mailbox.defaultHook),
|
|
998
|
-
normalizeStarknetAddressSafe(mailbox.defaultIsm),
|
|
999
|
-
normalizeStarknetAddressSafe(req.signer),
|
|
1000
|
-
],
|
|
1001
|
-
};
|
|
1002
|
-
}
|
|
1003
|
-
async getSetTokenOwnerTransaction(req) {
|
|
1004
|
-
const token = this.withContract(StarknetContractName.HYP_ERC20, req.tokenAddress, this.provider, starknet_dist_0/* ContractType */.h$.TOKEN);
|
|
1005
|
-
return populateInvokeTx(token, 'transfer_ownership', [
|
|
1006
|
-
normalizeStarknetAddressSafe(req.newOwner),
|
|
1007
|
-
]);
|
|
1008
|
-
}
|
|
1009
|
-
async getSetTokenIsmTransaction(req) {
|
|
1010
|
-
const token = this.withContract(StarknetContractName.HYP_ERC20, req.tokenAddress, this.provider, starknet_dist_0/* ContractType */.h$.TOKEN);
|
|
1011
|
-
return populateInvokeTx(token, 'set_interchain_security_module', [
|
|
1012
|
-
normalizeStarknetAddressSafe(req.ismAddress ?? addresses/* ZERO_ADDRESS_HEX_32 */.qx),
|
|
1013
|
-
]);
|
|
1014
|
-
}
|
|
1015
|
-
async getSetTokenHookTransaction(req) {
|
|
1016
|
-
const token = this.withContract(StarknetContractName.HYP_ERC20, req.tokenAddress, this.provider, starknet_dist_0/* ContractType */.h$.TOKEN);
|
|
1017
|
-
return populateInvokeTx(token, 'set_hook', [
|
|
1018
|
-
normalizeStarknetAddressSafe(req.hookAddress ?? addresses/* ZERO_ADDRESS_HEX_32 */.qx),
|
|
1019
|
-
]);
|
|
1020
|
-
}
|
|
1021
|
-
async getEnrollRemoteRouterTransaction(req) {
|
|
1022
|
-
const token = this.withContract(StarknetContractName.HYP_ERC20, req.tokenAddress, this.provider, starknet_dist_0/* ContractType */.h$.TOKEN);
|
|
1023
|
-
const receiverAddress = (0,addresses/* isZeroishAddress */.Hi)(req.remoteRouter.receiverAddress)
|
|
1024
|
-
? addresses/* ZERO_ADDRESS_HEX_32 */.qx
|
|
1025
|
-
: (0,addresses/* ensure0x */.Ho)(req.remoteRouter.receiverAddress);
|
|
1026
|
-
const noneOption = new starknet_dist/* CairoOption */.ci(starknet_dist/* CairoOptionVariant */.RV.None);
|
|
1027
|
-
const domainOption = new starknet_dist/* CairoOption */.ci(starknet_dist/* CairoOptionVariant */.RV.Some, req.remoteRouter.receiverDomainId);
|
|
1028
|
-
const gasOption = new starknet_dist/* CairoOption */.ci(starknet_dist/* CairoOptionVariant */.RV.Some, req.remoteRouter.gas);
|
|
1029
|
-
const [enrollCall, gasCall] = await Promise.all([
|
|
1030
|
-
this.populateInvokeCall(token, 'enroll_remote_router', [
|
|
1031
|
-
req.remoteRouter.receiverDomainId,
|
|
1032
|
-
receiverAddress,
|
|
1033
|
-
]),
|
|
1034
|
-
this.populateInvokeCall(token, 'set_destination_gas', [
|
|
1035
|
-
noneOption,
|
|
1036
|
-
domainOption,
|
|
1037
|
-
gasOption,
|
|
1038
|
-
]),
|
|
1039
|
-
]);
|
|
1040
|
-
return {
|
|
1041
|
-
kind: 'invoke',
|
|
1042
|
-
contractAddress: enrollCall.contractAddress,
|
|
1043
|
-
entrypoint: enrollCall.entrypoint,
|
|
1044
|
-
calldata: enrollCall.calldata,
|
|
1045
|
-
calls: [enrollCall, gasCall],
|
|
1046
|
-
};
|
|
1047
|
-
}
|
|
1048
|
-
async getUnenrollRemoteRouterTransaction(req) {
|
|
1049
|
-
const token = this.withContract(StarknetContractName.HYP_ERC20, req.tokenAddress, this.provider, starknet_dist_0/* ContractType */.h$.TOKEN);
|
|
1050
|
-
return populateInvokeTx(token, 'unenroll_remote_router', [
|
|
1051
|
-
req.receiverDomainId,
|
|
1052
|
-
]);
|
|
1053
|
-
}
|
|
739
|
+
// ### TRANSFER TXS ###
|
|
1054
740
|
async getTransferTransaction(req) {
|
|
1055
741
|
const denom = req.denom
|
|
1056
|
-
?
|
|
742
|
+
? contracts_normalizeStarknetAddressSafe(req.denom)
|
|
1057
743
|
: this.feeTokenAddress;
|
|
1058
744
|
const token = this.withContract(StarknetContractName.ETHER, denom, this.provider, starknet_dist_0/* ContractType */.h$.TOKEN);
|
|
1059
745
|
return populateInvokeTx(token, 'transfer', [
|
|
1060
|
-
|
|
746
|
+
contracts_normalizeStarknetAddressSafe(req.recipient),
|
|
1061
747
|
req.amount,
|
|
1062
748
|
]);
|
|
1063
749
|
}
|
|
@@ -1116,7 +802,7 @@ class StarknetSigner extends StarknetProvider {
|
|
|
1116
802
|
const provider = StarknetProvider.connect(rpcUrls, metadata.chainId, {
|
|
1117
803
|
metadata,
|
|
1118
804
|
});
|
|
1119
|
-
return new StarknetSigner(provider.getRawProvider(), metadata, rpcUrls,
|
|
805
|
+
return new StarknetSigner(provider.getRawProvider(), metadata, rpcUrls, contracts_normalizeStarknetAddressSafe(accountAddress), privateKey);
|
|
1120
806
|
}
|
|
1121
807
|
account;
|
|
1122
808
|
constructor(provider, metadata, rpcUrls, signerAddress, privateKey) {
|
|
@@ -1180,7 +866,7 @@ class StarknetSigner extends StarknetProvider {
|
|
|
1180
866
|
const rawAddress = deployment.address ||
|
|
1181
867
|
StarknetSigner.readStringField(deployment, 'contract_address');
|
|
1182
868
|
(0,validation/* assert */.v)(rawAddress, 'missing Starknet deploy contract address');
|
|
1183
|
-
const address =
|
|
869
|
+
const address = contracts_normalizeStarknetAddressSafe(rawAddress);
|
|
1184
870
|
const receipt = await this.account.waitForTransaction(transactionHash);
|
|
1185
871
|
this.assertSuccessfulReceipt(transactionHash, receipt);
|
|
1186
872
|
return {
|
|
@@ -1235,7 +921,6 @@ class StarknetSigner extends StarknetProvider {
|
|
|
1235
921
|
this.assertSuccessfulReceipt(transactionHash, receipt);
|
|
1236
922
|
return { transactionHash, receipt };
|
|
1237
923
|
}
|
|
1238
|
-
// ### TX CORE ###
|
|
1239
924
|
async estimateTransactionFee(req) {
|
|
1240
925
|
(0,validation/* assert */.v)(req.transaction.kind === 'invoke', 'Starknet transaction fee estimation only supports invoke transactions');
|
|
1241
926
|
const calls = req.transaction.calls ?? [
|
|
@@ -1255,282 +940,6 @@ class StarknetSigner extends StarknetProvider {
|
|
|
1255
940
|
fee: estimate.overall_fee,
|
|
1256
941
|
};
|
|
1257
942
|
}
|
|
1258
|
-
async createMailbox(req) {
|
|
1259
|
-
if (req.proxyAdminAddress) {
|
|
1260
|
-
throw new Error('Proxy admin unsupported on Starknet');
|
|
1261
|
-
}
|
|
1262
|
-
const defaultIsmAddress = req.defaultIsmAddress ?? (await this.createNoopIsm({})).ismAddress;
|
|
1263
|
-
const defaultHookAddress = req.defaultHookAddress ??
|
|
1264
|
-
(await this.createNoopHook({
|
|
1265
|
-
// Hook deployment currently ignores mailboxAddress on Starknet.
|
|
1266
|
-
mailboxAddress: this.signerAddress,
|
|
1267
|
-
})).hookAddress;
|
|
1268
|
-
// Keep required hooks opt-in. Auto-deploying a noop required hook would
|
|
1269
|
-
// change mailbox semantics for callers that intentionally leave it unset.
|
|
1270
|
-
const requiredHookAddress = req.requiredHookAddress;
|
|
1271
|
-
const tx = await this.getCreateMailboxTransaction({
|
|
1272
|
-
signer: this.signerAddress,
|
|
1273
|
-
...req,
|
|
1274
|
-
defaultIsmAddress,
|
|
1275
|
-
defaultHookAddress,
|
|
1276
|
-
requiredHookAddress,
|
|
1277
|
-
});
|
|
1278
|
-
const receipt = await this.sendAndConfirmTransaction(tx);
|
|
1279
|
-
(0,validation/* assert */.v)(receipt.contractAddress, 'failed to get Starknet mailbox address');
|
|
1280
|
-
return { mailboxAddress: receipt.contractAddress };
|
|
1281
|
-
}
|
|
1282
|
-
async setDefaultIsm(req) {
|
|
1283
|
-
const tx = await this.getSetDefaultIsmTransaction({
|
|
1284
|
-
signer: this.signerAddress,
|
|
1285
|
-
...req,
|
|
1286
|
-
});
|
|
1287
|
-
await this.sendAndConfirmTransaction(tx);
|
|
1288
|
-
return { ismAddress: req.ismAddress };
|
|
1289
|
-
}
|
|
1290
|
-
async setDefaultHook(req) {
|
|
1291
|
-
const tx = await this.getSetDefaultHookTransaction({
|
|
1292
|
-
signer: this.signerAddress,
|
|
1293
|
-
...req,
|
|
1294
|
-
});
|
|
1295
|
-
await this.sendAndConfirmTransaction(tx);
|
|
1296
|
-
return { hookAddress: req.hookAddress };
|
|
1297
|
-
}
|
|
1298
|
-
async setRequiredHook(req) {
|
|
1299
|
-
const tx = await this.getSetRequiredHookTransaction({
|
|
1300
|
-
signer: this.signerAddress,
|
|
1301
|
-
...req,
|
|
1302
|
-
});
|
|
1303
|
-
await this.sendAndConfirmTransaction(tx);
|
|
1304
|
-
return { hookAddress: req.hookAddress };
|
|
1305
|
-
}
|
|
1306
|
-
async setMailboxOwner(req) {
|
|
1307
|
-
const tx = await this.getSetMailboxOwnerTransaction({
|
|
1308
|
-
signer: this.signerAddress,
|
|
1309
|
-
...req,
|
|
1310
|
-
});
|
|
1311
|
-
await this.sendAndConfirmTransaction(tx);
|
|
1312
|
-
return { newOwner: req.newOwner };
|
|
1313
|
-
}
|
|
1314
|
-
async createMerkleRootMultisigIsm(req) {
|
|
1315
|
-
const tx = await this.getCreateMerkleRootMultisigIsmTransaction({
|
|
1316
|
-
signer: this.signerAddress,
|
|
1317
|
-
...req,
|
|
1318
|
-
});
|
|
1319
|
-
const receipt = await this.sendAndConfirmTransaction(tx);
|
|
1320
|
-
(0,validation/* assert */.v)(receipt.contractAddress, 'failed to get Starknet ISM address');
|
|
1321
|
-
return { ismAddress: receipt.contractAddress };
|
|
1322
|
-
}
|
|
1323
|
-
async createMessageIdMultisigIsm(req) {
|
|
1324
|
-
const tx = await this.getCreateMessageIdMultisigIsmTransaction({
|
|
1325
|
-
signer: this.signerAddress,
|
|
1326
|
-
...req,
|
|
1327
|
-
});
|
|
1328
|
-
const receipt = await this.sendAndConfirmTransaction(tx);
|
|
1329
|
-
(0,validation/* assert */.v)(receipt.contractAddress, 'failed to get Starknet ISM address');
|
|
1330
|
-
return { ismAddress: receipt.contractAddress };
|
|
1331
|
-
}
|
|
1332
|
-
async createRoutingIsm(req) {
|
|
1333
|
-
const tx = await this.getCreateRoutingIsmTransaction({
|
|
1334
|
-
signer: this.signerAddress,
|
|
1335
|
-
...req,
|
|
1336
|
-
});
|
|
1337
|
-
const receipt = await this.sendAndConfirmTransaction(tx);
|
|
1338
|
-
const ismAddress = receipt.contractAddress;
|
|
1339
|
-
(0,validation/* assert */.v)(ismAddress, 'failed to get Starknet routing ISM address');
|
|
1340
|
-
if (req.routes.length > 0) {
|
|
1341
|
-
const routeTxs = await Promise.all(req.routes.map(async (route) => this.getSetRoutingIsmRouteTransaction({
|
|
1342
|
-
signer: this.signerAddress,
|
|
1343
|
-
ismAddress,
|
|
1344
|
-
route,
|
|
1345
|
-
})));
|
|
1346
|
-
await this.sendAndConfirmBatchTransactions(routeTxs);
|
|
1347
|
-
}
|
|
1348
|
-
return { ismAddress };
|
|
1349
|
-
}
|
|
1350
|
-
async setRoutingIsmRoute(req) {
|
|
1351
|
-
const tx = await this.getSetRoutingIsmRouteTransaction({
|
|
1352
|
-
signer: this.signerAddress,
|
|
1353
|
-
...req,
|
|
1354
|
-
});
|
|
1355
|
-
await this.sendAndConfirmTransaction(tx);
|
|
1356
|
-
return { route: req.route };
|
|
1357
|
-
}
|
|
1358
|
-
async removeRoutingIsmRoute(req) {
|
|
1359
|
-
const tx = await this.getRemoveRoutingIsmRouteTransaction({
|
|
1360
|
-
signer: this.signerAddress,
|
|
1361
|
-
...req,
|
|
1362
|
-
});
|
|
1363
|
-
await this.sendAndConfirmTransaction(tx);
|
|
1364
|
-
return { domainId: req.domainId };
|
|
1365
|
-
}
|
|
1366
|
-
async setRoutingIsmOwner(req) {
|
|
1367
|
-
const tx = await this.getSetRoutingIsmOwnerTransaction({
|
|
1368
|
-
signer: this.signerAddress,
|
|
1369
|
-
...req,
|
|
1370
|
-
});
|
|
1371
|
-
await this.sendAndConfirmTransaction(tx);
|
|
1372
|
-
return { newOwner: req.newOwner };
|
|
1373
|
-
}
|
|
1374
|
-
async createNoopIsm(req) {
|
|
1375
|
-
const tx = await this.getCreateNoopIsmTransaction({
|
|
1376
|
-
signer: this.signerAddress,
|
|
1377
|
-
...req,
|
|
1378
|
-
});
|
|
1379
|
-
const receipt = await this.sendAndConfirmTransaction(tx);
|
|
1380
|
-
(0,validation/* assert */.v)(receipt.contractAddress, 'failed to get Starknet noop ISM address');
|
|
1381
|
-
return { ismAddress: receipt.contractAddress };
|
|
1382
|
-
}
|
|
1383
|
-
async createMerkleTreeHook(req) {
|
|
1384
|
-
const tx = await this.getCreateMerkleTreeHookTransaction({
|
|
1385
|
-
signer: this.signerAddress,
|
|
1386
|
-
...req,
|
|
1387
|
-
});
|
|
1388
|
-
const receipt = await this.sendAndConfirmTransaction(tx);
|
|
1389
|
-
(0,validation/* assert */.v)(receipt.contractAddress, 'failed to get Starknet hook address');
|
|
1390
|
-
return { hookAddress: receipt.contractAddress };
|
|
1391
|
-
}
|
|
1392
|
-
async createInterchainGasPaymasterHook(req) {
|
|
1393
|
-
const tx = await this.getCreateInterchainGasPaymasterHookTransaction({
|
|
1394
|
-
signer: this.signerAddress,
|
|
1395
|
-
...req,
|
|
1396
|
-
});
|
|
1397
|
-
const receipt = await this.sendAndConfirmTransaction(tx);
|
|
1398
|
-
(0,validation/* assert */.v)(receipt.contractAddress, 'failed to get Starknet interchainGasPaymaster hook');
|
|
1399
|
-
return { hookAddress: receipt.contractAddress };
|
|
1400
|
-
}
|
|
1401
|
-
async setInterchainGasPaymasterHookOwner(req) {
|
|
1402
|
-
const tx = await this.getSetInterchainGasPaymasterHookOwnerTransaction({
|
|
1403
|
-
signer: this.signerAddress,
|
|
1404
|
-
...req,
|
|
1405
|
-
});
|
|
1406
|
-
await this.sendAndConfirmTransaction(tx);
|
|
1407
|
-
return { newOwner: req.newOwner };
|
|
1408
|
-
}
|
|
1409
|
-
async setDestinationGasConfig(req) {
|
|
1410
|
-
const tx = await this.getSetDestinationGasConfigTransaction({
|
|
1411
|
-
signer: this.signerAddress,
|
|
1412
|
-
...req,
|
|
1413
|
-
});
|
|
1414
|
-
await this.sendAndConfirmTransaction(tx);
|
|
1415
|
-
return { destinationGasConfig: req.destinationGasConfig };
|
|
1416
|
-
}
|
|
1417
|
-
async removeDestinationGasConfig(req) {
|
|
1418
|
-
const tx = await this.getRemoveDestinationGasConfigTransaction({
|
|
1419
|
-
signer: this.signerAddress,
|
|
1420
|
-
...req,
|
|
1421
|
-
});
|
|
1422
|
-
await this.sendAndConfirmTransaction(tx);
|
|
1423
|
-
return { remoteDomainId: req.remoteDomainId };
|
|
1424
|
-
}
|
|
1425
|
-
async createNoopHook(req) {
|
|
1426
|
-
const tx = await this.getCreateNoopHookTransaction({
|
|
1427
|
-
signer: this.signerAddress,
|
|
1428
|
-
...req,
|
|
1429
|
-
});
|
|
1430
|
-
const receipt = await this.sendAndConfirmTransaction(tx);
|
|
1431
|
-
(0,validation/* assert */.v)(receipt.contractAddress, 'failed to get Starknet noop hook');
|
|
1432
|
-
return { hookAddress: receipt.contractAddress };
|
|
1433
|
-
}
|
|
1434
|
-
async createValidatorAnnounce(req) {
|
|
1435
|
-
const tx = await this.getCreateValidatorAnnounceTransaction({
|
|
1436
|
-
signer: this.signerAddress,
|
|
1437
|
-
...req,
|
|
1438
|
-
});
|
|
1439
|
-
const receipt = await this.sendAndConfirmTransaction(tx);
|
|
1440
|
-
(0,validation/* assert */.v)(receipt.contractAddress, 'failed to get Starknet validator announce address');
|
|
1441
|
-
return { validatorAnnounceId: receipt.contractAddress };
|
|
1442
|
-
}
|
|
1443
|
-
async createProxyAdmin(_req) {
|
|
1444
|
-
throw new Error('Proxy admin unsupported on Starknet');
|
|
1445
|
-
}
|
|
1446
|
-
async setProxyAdminOwner(_req) {
|
|
1447
|
-
throw new Error('Proxy admin unsupported on Starknet');
|
|
1448
|
-
}
|
|
1449
|
-
// ### TX WARP ###
|
|
1450
|
-
async createNativeToken(req) {
|
|
1451
|
-
if (req.proxyAdminAddress) {
|
|
1452
|
-
throw new Error('Proxy admin unsupported on Starknet');
|
|
1453
|
-
}
|
|
1454
|
-
const tx = await this.getCreateNativeTokenTransaction({
|
|
1455
|
-
signer: this.signerAddress,
|
|
1456
|
-
...req,
|
|
1457
|
-
});
|
|
1458
|
-
const receipt = await this.sendAndConfirmTransaction(tx);
|
|
1459
|
-
(0,validation/* assert */.v)(receipt.contractAddress, 'failed to get Starknet warp token');
|
|
1460
|
-
return { tokenAddress: receipt.contractAddress };
|
|
1461
|
-
}
|
|
1462
|
-
async createCollateralToken(req) {
|
|
1463
|
-
if (req.proxyAdminAddress) {
|
|
1464
|
-
throw new Error('Proxy admin unsupported on Starknet');
|
|
1465
|
-
}
|
|
1466
|
-
const tx = await this.getCreateCollateralTokenTransaction({
|
|
1467
|
-
signer: this.signerAddress,
|
|
1468
|
-
...req,
|
|
1469
|
-
});
|
|
1470
|
-
const receipt = await this.sendAndConfirmTransaction(tx);
|
|
1471
|
-
(0,validation/* assert */.v)(receipt.contractAddress, 'failed to get Starknet warp token');
|
|
1472
|
-
return { tokenAddress: receipt.contractAddress };
|
|
1473
|
-
}
|
|
1474
|
-
async createSyntheticToken(req) {
|
|
1475
|
-
if (req.proxyAdminAddress) {
|
|
1476
|
-
throw new Error('Proxy admin unsupported on Starknet');
|
|
1477
|
-
}
|
|
1478
|
-
const tx = await this.getCreateSyntheticTokenTransaction({
|
|
1479
|
-
signer: this.signerAddress,
|
|
1480
|
-
...req,
|
|
1481
|
-
});
|
|
1482
|
-
const receipt = await this.sendAndConfirmTransaction(tx);
|
|
1483
|
-
(0,validation/* assert */.v)(receipt.contractAddress, 'failed to get Starknet warp token');
|
|
1484
|
-
return { tokenAddress: receipt.contractAddress };
|
|
1485
|
-
}
|
|
1486
|
-
async setTokenOwner(req) {
|
|
1487
|
-
const tx = await this.getSetTokenOwnerTransaction({
|
|
1488
|
-
signer: this.signerAddress,
|
|
1489
|
-
...req,
|
|
1490
|
-
});
|
|
1491
|
-
await this.sendAndConfirmTransaction(tx);
|
|
1492
|
-
return { newOwner: req.newOwner };
|
|
1493
|
-
}
|
|
1494
|
-
async setTokenIsm(req) {
|
|
1495
|
-
const tx = await this.getSetTokenIsmTransaction({
|
|
1496
|
-
signer: this.signerAddress,
|
|
1497
|
-
...req,
|
|
1498
|
-
});
|
|
1499
|
-
await this.sendAndConfirmTransaction(tx);
|
|
1500
|
-
return { ismAddress: req.ismAddress ?? addresses/* ZERO_ADDRESS_HEX_32 */.qx };
|
|
1501
|
-
}
|
|
1502
|
-
async setTokenHook(req) {
|
|
1503
|
-
const tx = await this.getSetTokenHookTransaction({
|
|
1504
|
-
signer: this.signerAddress,
|
|
1505
|
-
...req,
|
|
1506
|
-
});
|
|
1507
|
-
await this.sendAndConfirmTransaction(tx);
|
|
1508
|
-
return { hookAddress: req.hookAddress ?? addresses/* ZERO_ADDRESS_HEX_32 */.qx };
|
|
1509
|
-
}
|
|
1510
|
-
async enrollRemoteRouter(req) {
|
|
1511
|
-
const tx = await this.getEnrollRemoteRouterTransaction({
|
|
1512
|
-
signer: this.signerAddress,
|
|
1513
|
-
...req,
|
|
1514
|
-
});
|
|
1515
|
-
await this.sendAndConfirmTransaction(tx);
|
|
1516
|
-
return { receiverDomainId: req.remoteRouter.receiverDomainId };
|
|
1517
|
-
}
|
|
1518
|
-
async unenrollRemoteRouter(req) {
|
|
1519
|
-
const tx = await this.getUnenrollRemoteRouterTransaction({
|
|
1520
|
-
signer: this.signerAddress,
|
|
1521
|
-
...req,
|
|
1522
|
-
});
|
|
1523
|
-
await this.sendAndConfirmTransaction(tx);
|
|
1524
|
-
return { receiverDomainId: req.receiverDomainId };
|
|
1525
|
-
}
|
|
1526
|
-
async transfer(req) {
|
|
1527
|
-
const tx = await this.getTransferTransaction({
|
|
1528
|
-
signer: this.signerAddress,
|
|
1529
|
-
...req,
|
|
1530
|
-
});
|
|
1531
|
-
await this.sendAndConfirmTransaction(tx);
|
|
1532
|
-
return { recipient: req.recipient };
|
|
1533
|
-
}
|
|
1534
943
|
async remoteTransfer(req) {
|
|
1535
944
|
const token = await this.getToken({ tokenAddress: req.tokenAddress });
|
|
1536
945
|
const tokenType = token.tokenType;
|
|
@@ -1542,30 +951,30 @@ class StarknetSigner extends StarknetProvider {
|
|
|
1542
951
|
if (tokenType === dist/* AltVM.TokenType */.bx.ks.native) {
|
|
1543
952
|
const nativeToken = getStarknetContract(StarknetContractName.ETHER, token.denom, this.provider, starknet_dist_0/* ContractType */.h$.TOKEN);
|
|
1544
953
|
batchedTxs.push(await populateInvokeTx(nativeToken, 'approve', [
|
|
1545
|
-
|
|
954
|
+
contracts_normalizeStarknetAddressSafe(req.tokenAddress),
|
|
1546
955
|
toBigInt(req.amount) + toBigInt(req.maxFee.amount),
|
|
1547
956
|
]));
|
|
1548
957
|
}
|
|
1549
958
|
else if (tokenType === dist/* AltVM.TokenType */.bx.ks.collateral) {
|
|
1550
959
|
const collateralToken = getStarknetContract(StarknetContractName.ETHER, token.denom, this.provider, starknet_dist_0/* ContractType */.h$.TOKEN);
|
|
1551
|
-
const collateralDenom =
|
|
1552
|
-
const feeDenom =
|
|
960
|
+
const collateralDenom = contracts_normalizeStarknetAddressSafe(token.denom);
|
|
961
|
+
const feeDenom = contracts_normalizeStarknetAddressSafe(req.maxFee.denom);
|
|
1553
962
|
const approvalAmount = collateralDenom === feeDenom
|
|
1554
963
|
? toBigInt(req.amount) + toBigInt(req.maxFee.amount)
|
|
1555
964
|
: toBigInt(req.amount);
|
|
1556
965
|
batchedTxs.push(await populateInvokeTx(collateralToken, 'approve', [
|
|
1557
|
-
|
|
966
|
+
contracts_normalizeStarknetAddressSafe(req.tokenAddress),
|
|
1558
967
|
approvalAmount,
|
|
1559
968
|
]));
|
|
1560
969
|
}
|
|
1561
970
|
const usesSharedCollateralAndFeeToken = tokenType === dist/* AltVM.TokenType */.bx.ks.collateral &&
|
|
1562
|
-
|
|
1563
|
-
|
|
971
|
+
contracts_normalizeStarknetAddressSafe(token.denom) ===
|
|
972
|
+
contracts_normalizeStarknetAddressSafe(req.maxFee.denom);
|
|
1564
973
|
if (tokenType !== dist/* AltVM.TokenType */.bx.ks.native &&
|
|
1565
974
|
!usesSharedCollateralAndFeeToken) {
|
|
1566
975
|
const feeToken = getStarknetContract(StarknetContractName.ETHER, req.maxFee.denom, this.provider, starknet_dist_0/* ContractType */.h$.TOKEN);
|
|
1567
976
|
batchedTxs.push(await populateInvokeTx(feeToken, 'approve', [
|
|
1568
|
-
|
|
977
|
+
contracts_normalizeStarknetAddressSafe(req.tokenAddress),
|
|
1569
978
|
toBigInt(req.maxFee.amount),
|
|
1570
979
|
]));
|
|
1571
980
|
}
|
|
@@ -1579,6 +988,36 @@ class StarknetSigner extends StarknetProvider {
|
|
|
1579
988
|
}
|
|
1580
989
|
}
|
|
1581
990
|
//# sourceMappingURL=signer.js.map
|
|
991
|
+
;// CONCATENATED MODULE: ../starknet-sdk/dist/hook/hook-query.js
|
|
992
|
+
|
|
993
|
+
|
|
994
|
+
function parseHookVariant(variant) {
|
|
995
|
+
const upper = variant.toUpperCase();
|
|
996
|
+
if (upper.includes('MERKLE_TREE'))
|
|
997
|
+
return dist/* AltVM.HookType */.bx.WD.MERKLE_TREE;
|
|
998
|
+
if (upper.includes('PROTOCOL_FEE'))
|
|
999
|
+
return dist/* AltVM.HookType */.bx.WD.PROTOCOL_FEE;
|
|
1000
|
+
if (upper.includes('INTERCHAIN_GAS_PAYMASTER')) {
|
|
1001
|
+
return dist/* AltVM.HookType */.bx.WD.INTERCHAIN_GAS_PAYMASTER;
|
|
1002
|
+
}
|
|
1003
|
+
return dist/* AltVM.HookType */.bx.WD.CUSTOM;
|
|
1004
|
+
}
|
|
1005
|
+
async function getHookType(provider, hookAddress) {
|
|
1006
|
+
try {
|
|
1007
|
+
const hook = getStarknetContract(StarknetContractName.HOOK, hookAddress, provider);
|
|
1008
|
+
const hookType = await callContract(hook, 'hook_type');
|
|
1009
|
+
return parseHookVariant(extractEnumVariant(hookType));
|
|
1010
|
+
}
|
|
1011
|
+
catch (error) {
|
|
1012
|
+
if (!isProbeMiss(error))
|
|
1013
|
+
throw error;
|
|
1014
|
+
return dist/* AltVM.HookType */.bx.WD.CUSTOM;
|
|
1015
|
+
}
|
|
1016
|
+
}
|
|
1017
|
+
function getMerkleTreeHookConfig(hookAddress) {
|
|
1018
|
+
return { address: normalizeStarknetAddressSafe(hookAddress) };
|
|
1019
|
+
}
|
|
1020
|
+
//# sourceMappingURL=hook-query.js.map
|
|
1582
1021
|
;// CONCATENATED MODULE: ../starknet-sdk/dist/hook/interchain-gas-paymaster-hook-artifact-manager.js
|
|
1583
1022
|
|
|
1584
1023
|
|
|
@@ -1605,17 +1044,38 @@ function createStarknetInterchainGasPaymasterHookWriter() {
|
|
|
1605
1044
|
//# sourceMappingURL=interchain-gas-paymaster-hook-artifact-manager.js.map
|
|
1606
1045
|
// EXTERNAL MODULE: ../provider-sdk/dist/artifact.js
|
|
1607
1046
|
var dist_artifact = __webpack_require__(4287);
|
|
1047
|
+
;// CONCATENATED MODULE: ../starknet-sdk/dist/hook/hook-tx.js
|
|
1048
|
+
|
|
1049
|
+
function getCreateMerkleTreeHookTx(signer, mailboxAddress) {
|
|
1050
|
+
return {
|
|
1051
|
+
kind: 'deploy',
|
|
1052
|
+
contractName: StarknetContractName.MERKLE_TREE_HOOK,
|
|
1053
|
+
constructorArgs: [
|
|
1054
|
+
contracts_normalizeStarknetAddressSafe(mailboxAddress),
|
|
1055
|
+
contracts_normalizeStarknetAddressSafe(signer),
|
|
1056
|
+
],
|
|
1057
|
+
};
|
|
1058
|
+
}
|
|
1059
|
+
function getCreateNoopHookTx() {
|
|
1060
|
+
return {
|
|
1061
|
+
kind: 'deploy',
|
|
1062
|
+
contractName: StarknetContractName.HOOK,
|
|
1063
|
+
constructorArgs: [],
|
|
1064
|
+
};
|
|
1065
|
+
}
|
|
1066
|
+
//# sourceMappingURL=hook-tx.js.map
|
|
1608
1067
|
;// CONCATENATED MODULE: ../starknet-sdk/dist/hook/merkle-tree-hook-artifact-manager.js
|
|
1609
1068
|
|
|
1610
1069
|
|
|
1611
1070
|
|
|
1612
1071
|
|
|
1072
|
+
|
|
1613
1073
|
class StarknetMerkleTreeHookReader {
|
|
1614
1074
|
async read(address) {
|
|
1615
1075
|
return {
|
|
1616
1076
|
artifactState: dist_artifact/* ArtifactState */.O2.DEPLOYED,
|
|
1617
1077
|
config: { type: dist/* AltVM.HookType */.bx.WD.MERKLE_TREE },
|
|
1618
|
-
deployed: { address:
|
|
1078
|
+
deployed: { address: contracts_normalizeStarknetAddressSafe(address) },
|
|
1619
1079
|
};
|
|
1620
1080
|
}
|
|
1621
1081
|
}
|
|
@@ -1628,10 +1088,7 @@ class StarknetMerkleTreeHookWriter extends StarknetMerkleTreeHookReader {
|
|
|
1628
1088
|
this.mailboxAddress = mailboxAddress;
|
|
1629
1089
|
}
|
|
1630
1090
|
async create(artifact) {
|
|
1631
|
-
const tx =
|
|
1632
|
-
signer: this.signer.getSignerAddress(),
|
|
1633
|
-
mailboxAddress: this.mailboxAddress,
|
|
1634
|
-
});
|
|
1091
|
+
const tx = getCreateMerkleTreeHookTx(this.signer.getSignerAddress(), this.mailboxAddress);
|
|
1635
1092
|
const receipt = await this.signer.sendAndConfirmTransaction(tx);
|
|
1636
1093
|
const hookAddress = receipt.contractAddress;
|
|
1637
1094
|
(0,validation/* assert */.v)(hookAddress, 'failed to deploy Starknet merkle tree hook');
|
|
@@ -1711,15 +1168,15 @@ class StarknetProtocolFeeHookReader {
|
|
|
1711
1168
|
this.provider = provider;
|
|
1712
1169
|
}
|
|
1713
1170
|
async read(address) {
|
|
1714
|
-
const normalizedAddress =
|
|
1171
|
+
const normalizedAddress = contracts_normalizeStarknetAddressSafe(address);
|
|
1715
1172
|
const hook = getStarknetContract(StarknetContractName.PROTOCOL_FEE, normalizedAddress, this.provider.getRawProvider());
|
|
1716
1173
|
const [owner, beneficiary, protocolFee] = await Promise.all([
|
|
1717
1174
|
callContract(hook, 'owner'),
|
|
1718
1175
|
callContract(hook, 'get_beneficiary'),
|
|
1719
1176
|
callContract(hook, 'get_protocol_fee'),
|
|
1720
1177
|
]);
|
|
1721
|
-
const ownerAddress =
|
|
1722
|
-
const beneficiaryAddress =
|
|
1178
|
+
const ownerAddress = contracts_normalizeStarknetAddressSafe(owner);
|
|
1179
|
+
const beneficiaryAddress = contracts_normalizeStarknetAddressSafe(beneficiary);
|
|
1723
1180
|
const protocolFeeAmount = toBigInt(protocolFee);
|
|
1724
1181
|
const maxProtocolFee = await readProtocolFeeMaxFromStorage(this.provider, normalizedAddress, protocolFeeAmount);
|
|
1725
1182
|
const config = {
|
|
@@ -1763,8 +1220,8 @@ class StarknetProtocolFeeHookWriter extends StarknetProtocolFeeHookReader {
|
|
|
1763
1220
|
constructorArgs: [
|
|
1764
1221
|
artifact.config.maxProtocolFee,
|
|
1765
1222
|
artifact.config.protocolFee,
|
|
1766
|
-
|
|
1767
|
-
|
|
1223
|
+
contracts_normalizeStarknetAddressSafe(artifact.config.beneficiary),
|
|
1224
|
+
contracts_normalizeStarknetAddressSafe(artifact.config.owner),
|
|
1768
1225
|
tokenAddress,
|
|
1769
1226
|
],
|
|
1770
1227
|
};
|
|
@@ -1775,7 +1232,7 @@ class StarknetProtocolFeeHookWriter extends StarknetProtocolFeeHookReader {
|
|
|
1775
1232
|
artifactState: dist_artifact/* ArtifactState */.O2.DEPLOYED,
|
|
1776
1233
|
config: artifact.config,
|
|
1777
1234
|
deployed: {
|
|
1778
|
-
address:
|
|
1235
|
+
address: contracts_normalizeStarknetAddressSafe(receipt.contractAddress),
|
|
1779
1236
|
},
|
|
1780
1237
|
},
|
|
1781
1238
|
[receipt],
|
|
@@ -1795,7 +1252,7 @@ class StarknetProtocolFeeHookWriter extends StarknetProtocolFeeHookReader {
|
|
|
1795
1252
|
txs.push({
|
|
1796
1253
|
annotation: `Updating protocol fee beneficiary for ${contractAddress}`,
|
|
1797
1254
|
...(await populateInvokeTx(contract, 'set_beneficiary', [
|
|
1798
|
-
|
|
1255
|
+
contracts_normalizeStarknetAddressSafe(artifact.config.beneficiary),
|
|
1799
1256
|
])),
|
|
1800
1257
|
});
|
|
1801
1258
|
}
|
|
@@ -1811,7 +1268,7 @@ class StarknetProtocolFeeHookWriter extends StarknetProtocolFeeHookReader {
|
|
|
1811
1268
|
txs.push({
|
|
1812
1269
|
annotation: `Transferring protocol fee hook ownership for ${contractAddress}`,
|
|
1813
1270
|
...(await populateInvokeTx(contract, 'transfer_ownership', [
|
|
1814
|
-
|
|
1271
|
+
contracts_normalizeStarknetAddressSafe(artifact.config.owner),
|
|
1815
1272
|
])),
|
|
1816
1273
|
});
|
|
1817
1274
|
}
|
|
@@ -1827,7 +1284,7 @@ class StarknetUnknownHookReader {
|
|
|
1827
1284
|
return {
|
|
1828
1285
|
artifactState: dist_artifact/* ArtifactState */.O2.DEPLOYED,
|
|
1829
1286
|
config: { type: 'unknownHook' },
|
|
1830
|
-
deployed: { address:
|
|
1287
|
+
deployed: { address: contracts_normalizeStarknetAddressSafe(address) },
|
|
1831
1288
|
};
|
|
1832
1289
|
}
|
|
1833
1290
|
}
|
|
@@ -1851,6 +1308,7 @@ class StarknetUnknownHookWriter extends StarknetUnknownHookReader {
|
|
|
1851
1308
|
|
|
1852
1309
|
|
|
1853
1310
|
|
|
1311
|
+
|
|
1854
1312
|
class StarknetHookArtifactManager {
|
|
1855
1313
|
chainMetadata;
|
|
1856
1314
|
provider;
|
|
@@ -1859,7 +1317,7 @@ class StarknetHookArtifactManager {
|
|
|
1859
1317
|
this.chainMetadata = chainMetadata;
|
|
1860
1318
|
this.provider = StarknetProvider.connect((chainMetadata.rpcUrls ?? []).map(({ http }) => http), chainMetadata.chainId, { metadata: chainMetadata });
|
|
1861
1319
|
this.mailboxAddress = context?.mailbox
|
|
1862
|
-
?
|
|
1320
|
+
? contracts_normalizeStarknetAddressSafe(context.mailbox)
|
|
1863
1321
|
: '';
|
|
1864
1322
|
}
|
|
1865
1323
|
requireStarknetSigner(signer) {
|
|
@@ -1867,9 +1325,7 @@ class StarknetHookArtifactManager {
|
|
|
1867
1325
|
return signer;
|
|
1868
1326
|
}
|
|
1869
1327
|
async readHook(address) {
|
|
1870
|
-
const hookType = await this.provider.
|
|
1871
|
-
hookAddress: address,
|
|
1872
|
-
});
|
|
1328
|
+
const hookType = await getHookType(this.provider.getRawProvider(), address);
|
|
1873
1329
|
switch (hookType) {
|
|
1874
1330
|
case dist/* AltVM.HookType */.bx.WD.CUSTOM:
|
|
1875
1331
|
return this.createReader('unknownHook').read(address);
|
|
@@ -1913,19 +1369,154 @@ class StarknetHookArtifactManager {
|
|
|
1913
1369
|
//# sourceMappingURL=hook-artifact-manager.js.map
|
|
1914
1370
|
// EXTERNAL MODULE: ../provider-sdk/dist/ism.js
|
|
1915
1371
|
var ism = __webpack_require__(96426);
|
|
1372
|
+
;// CONCATENATED MODULE: ../starknet-sdk/dist/ism/ism-query.js
|
|
1373
|
+
|
|
1374
|
+
|
|
1375
|
+
|
|
1376
|
+
function parseIsmVariant(variant) {
|
|
1377
|
+
const upper = variant.toUpperCase();
|
|
1378
|
+
if (upper.includes('TEST') ||
|
|
1379
|
+
upper.includes('NOOP') ||
|
|
1380
|
+
upper.includes('NULL') ||
|
|
1381
|
+
upper.includes('UNUSED')) {
|
|
1382
|
+
return dist/* AltVM.IsmType */.bx.GO.TEST_ISM;
|
|
1383
|
+
}
|
|
1384
|
+
if (upper.includes('MERKLE_ROOT_MULTISIG')) {
|
|
1385
|
+
return dist/* AltVM.IsmType */.bx.GO.MERKLE_ROOT_MULTISIG;
|
|
1386
|
+
}
|
|
1387
|
+
if (upper.includes('MESSAGE_ID_MULTISIG')) {
|
|
1388
|
+
return dist/* AltVM.IsmType */.bx.GO.MESSAGE_ID_MULTISIG;
|
|
1389
|
+
}
|
|
1390
|
+
if (upper.includes('ROUTING')) {
|
|
1391
|
+
return dist/* AltVM.IsmType */.bx.GO.ROUTING;
|
|
1392
|
+
}
|
|
1393
|
+
return dist/* AltVM.IsmType */.bx.GO.CUSTOM;
|
|
1394
|
+
}
|
|
1395
|
+
async function getIsmType(provider, ismAddress) {
|
|
1396
|
+
try {
|
|
1397
|
+
const ism = getStarknetContract(StarknetContractName.MERKLE_ROOT_MULTISIG_ISM, ismAddress, provider);
|
|
1398
|
+
const moduleType = await callContract(ism, 'module_type');
|
|
1399
|
+
return parseIsmVariant(extractEnumVariant(moduleType));
|
|
1400
|
+
}
|
|
1401
|
+
catch (error) {
|
|
1402
|
+
if (!isProbeMiss(error))
|
|
1403
|
+
throw error;
|
|
1404
|
+
return dist/* AltVM.IsmType */.bx.GO.CUSTOM;
|
|
1405
|
+
}
|
|
1406
|
+
}
|
|
1407
|
+
async function getMultisigIsmConfig(provider, ismAddress, contractName) {
|
|
1408
|
+
const ism = getStarknetContract(contractName, ismAddress, provider);
|
|
1409
|
+
const [validators, threshold] = await Promise.all([
|
|
1410
|
+
callContract(ism, 'get_validators'),
|
|
1411
|
+
callContract(ism, 'get_threshold'),
|
|
1412
|
+
]);
|
|
1413
|
+
(0,validation/* assert */.v)(Array.isArray(validators), 'Expected Starknet validators array');
|
|
1414
|
+
return {
|
|
1415
|
+
address: contracts_normalizeStarknetAddressSafe(ismAddress),
|
|
1416
|
+
threshold: toNumber(threshold),
|
|
1417
|
+
validators: validators.map((v) => addressToEvmAddress(v)),
|
|
1418
|
+
};
|
|
1419
|
+
}
|
|
1420
|
+
async function getMessageIdMultisigIsmConfig(provider, ismAddress) {
|
|
1421
|
+
return getMultisigIsmConfig(provider, ismAddress, StarknetContractName.MESSAGE_ID_MULTISIG_ISM);
|
|
1422
|
+
}
|
|
1423
|
+
async function getMerkleRootMultisigIsmConfig(provider, ismAddress) {
|
|
1424
|
+
return getMultisigIsmConfig(provider, ismAddress, StarknetContractName.MERKLE_ROOT_MULTISIG_ISM);
|
|
1425
|
+
}
|
|
1426
|
+
async function getRoutingIsmConfig(provider, ismAddress) {
|
|
1427
|
+
const ism = getStarknetContract(StarknetContractName.ROUTING_ISM, ismAddress, provider);
|
|
1428
|
+
const [owner, domains] = await Promise.all([
|
|
1429
|
+
callContract(ism, 'owner'),
|
|
1430
|
+
callContract(ism, 'domains'),
|
|
1431
|
+
]);
|
|
1432
|
+
(0,validation/* assert */.v)(Array.isArray(domains), 'Expected Starknet routing domains array');
|
|
1433
|
+
const routes = await Promise.all(domains.map(async (domainId) => {
|
|
1434
|
+
const routeAddress = await callContract(ism, 'module', [domainId]);
|
|
1435
|
+
return {
|
|
1436
|
+
domainId: toNumber(domainId),
|
|
1437
|
+
ismAddress: contracts_normalizeStarknetAddressSafe(routeAddress),
|
|
1438
|
+
};
|
|
1439
|
+
}));
|
|
1440
|
+
return {
|
|
1441
|
+
address: contracts_normalizeStarknetAddressSafe(ismAddress),
|
|
1442
|
+
owner: contracts_normalizeStarknetAddressSafe(owner),
|
|
1443
|
+
routes,
|
|
1444
|
+
};
|
|
1445
|
+
}
|
|
1446
|
+
function getNoopIsmConfig(ismAddress) {
|
|
1447
|
+
return { address: contracts_normalizeStarknetAddressSafe(ismAddress) };
|
|
1448
|
+
}
|
|
1449
|
+
//# sourceMappingURL=ism-query.js.map
|
|
1450
|
+
;// CONCATENATED MODULE: ../starknet-sdk/dist/ism/ism-tx.js
|
|
1451
|
+
|
|
1452
|
+
|
|
1453
|
+
function getCreateMerkleRootMultisigIsmTx(signer, config) {
|
|
1454
|
+
return {
|
|
1455
|
+
kind: 'deploy',
|
|
1456
|
+
contractName: StarknetContractName.MERKLE_ROOT_MULTISIG_ISM,
|
|
1457
|
+
constructorArgs: [
|
|
1458
|
+
contracts_normalizeStarknetAddressSafe(signer),
|
|
1459
|
+
config.validators.map((validator) => (0,addresses/* addressToBytes32 */.In)(validator)),
|
|
1460
|
+
config.threshold,
|
|
1461
|
+
],
|
|
1462
|
+
};
|
|
1463
|
+
}
|
|
1464
|
+
function getCreateMessageIdMultisigIsmTx(signer, config) {
|
|
1465
|
+
return {
|
|
1466
|
+
kind: 'deploy',
|
|
1467
|
+
contractName: StarknetContractName.MESSAGE_ID_MULTISIG_ISM,
|
|
1468
|
+
constructorArgs: [
|
|
1469
|
+
contracts_normalizeStarknetAddressSafe(signer),
|
|
1470
|
+
config.validators.map((validator) => (0,addresses/* addressToBytes32 */.In)(validator)),
|
|
1471
|
+
config.threshold,
|
|
1472
|
+
],
|
|
1473
|
+
};
|
|
1474
|
+
}
|
|
1475
|
+
function getCreateRoutingIsmTx(signer) {
|
|
1476
|
+
return {
|
|
1477
|
+
kind: 'deploy',
|
|
1478
|
+
contractName: StarknetContractName.ROUTING_ISM,
|
|
1479
|
+
constructorArgs: [contracts_normalizeStarknetAddressSafe(signer)],
|
|
1480
|
+
};
|
|
1481
|
+
}
|
|
1482
|
+
async function getSetRoutingIsmRouteTx(provider, config) {
|
|
1483
|
+
const routing = getStarknetContract(StarknetContractName.ROUTING_ISM, config.ismAddress, provider);
|
|
1484
|
+
return populateInvokeTx(routing, 'set', [
|
|
1485
|
+
config.route.domainId,
|
|
1486
|
+
contracts_normalizeStarknetAddressSafe(config.route.ismAddress),
|
|
1487
|
+
]);
|
|
1488
|
+
}
|
|
1489
|
+
async function getRemoveRoutingIsmRouteTx(provider, config) {
|
|
1490
|
+
const routing = getStarknetContract(StarknetContractName.ROUTING_ISM, config.ismAddress, provider);
|
|
1491
|
+
return populateInvokeTx(routing, 'remove', [config.domainId]);
|
|
1492
|
+
}
|
|
1493
|
+
async function getSetRoutingIsmOwnerTx(provider, config) {
|
|
1494
|
+
const routing = getStarknetContract(StarknetContractName.ROUTING_ISM, config.ismAddress, provider);
|
|
1495
|
+
return populateInvokeTx(routing, 'transfer_ownership', [
|
|
1496
|
+
contracts_normalizeStarknetAddressSafe(config.newOwner),
|
|
1497
|
+
]);
|
|
1498
|
+
}
|
|
1499
|
+
function getCreateNoopIsmTx() {
|
|
1500
|
+
return {
|
|
1501
|
+
kind: 'deploy',
|
|
1502
|
+
contractName: StarknetContractName.NOOP_ISM,
|
|
1503
|
+
constructorArgs: [],
|
|
1504
|
+
};
|
|
1505
|
+
}
|
|
1506
|
+
//# sourceMappingURL=ism-tx.js.map
|
|
1916
1507
|
;// CONCATENATED MODULE: ../starknet-sdk/dist/ism/domain-routing-ism-artifact-manager.js
|
|
1917
1508
|
|
|
1918
1509
|
|
|
1919
1510
|
|
|
1511
|
+
|
|
1512
|
+
|
|
1920
1513
|
class StarknetRoutingIsmReader {
|
|
1921
1514
|
provider;
|
|
1922
1515
|
constructor(provider) {
|
|
1923
1516
|
this.provider = provider;
|
|
1924
1517
|
}
|
|
1925
1518
|
async read(address) {
|
|
1926
|
-
const routing = await this.provider.
|
|
1927
|
-
ismAddress: address,
|
|
1928
|
-
});
|
|
1519
|
+
const routing = await getRoutingIsmConfig(this.provider.getRawProvider(), address);
|
|
1929
1520
|
const domains = {};
|
|
1930
1521
|
for (const route of routing.routes) {
|
|
1931
1522
|
domains[route.domainId] = {
|
|
@@ -1960,25 +1551,21 @@ class StarknetRoutingIsmWriter extends StarknetRoutingIsmReader {
|
|
|
1960
1551
|
};
|
|
1961
1552
|
});
|
|
1962
1553
|
const receipts = [];
|
|
1963
|
-
const createTx =
|
|
1964
|
-
signer: this.signer.getSignerAddress(),
|
|
1965
|
-
routes,
|
|
1966
|
-
});
|
|
1554
|
+
const createTx = getCreateRoutingIsmTx(this.signer.getSignerAddress());
|
|
1967
1555
|
const createReceipt = await this.signer.sendAndConfirmTransaction(createTx);
|
|
1968
1556
|
receipts.push(createReceipt);
|
|
1969
1557
|
const ismAddress = createReceipt.contractAddress;
|
|
1970
1558
|
(0,validation/* assert */.v)(ismAddress, 'failed to get Starknet routing ISM address');
|
|
1559
|
+
const rawProvider = this.signer.getRawProvider();
|
|
1971
1560
|
for (const route of routes) {
|
|
1972
|
-
const tx = await
|
|
1973
|
-
signer: this.signer.getSignerAddress(),
|
|
1561
|
+
const tx = await getSetRoutingIsmRouteTx(rawProvider, {
|
|
1974
1562
|
ismAddress,
|
|
1975
1563
|
route,
|
|
1976
1564
|
});
|
|
1977
1565
|
receipts.push(await this.signer.sendAndConfirmTransaction(tx));
|
|
1978
1566
|
}
|
|
1979
1567
|
if (!(0,addresses/* eqAddressStarknet */.PD)(artifact.config.owner, this.signer.getSignerAddress())) {
|
|
1980
|
-
const ownerTx = await
|
|
1981
|
-
signer: this.signer.getSignerAddress(),
|
|
1568
|
+
const ownerTx = await getSetRoutingIsmOwnerTx(rawProvider, {
|
|
1982
1569
|
ismAddress,
|
|
1983
1570
|
newOwner: artifact.config.owner,
|
|
1984
1571
|
});
|
|
@@ -1999,25 +1586,25 @@ class StarknetRoutingIsmWriter extends StarknetRoutingIsmReader {
|
|
|
1999
1586
|
if ((0,dist_artifact/* isArtifactUnderived */.l2)(domainIsm) || (0,dist_artifact/* isArtifactDeployed */.R)(domainIsm)) {
|
|
2000
1587
|
return {
|
|
2001
1588
|
domainId: Number(domainId),
|
|
2002
|
-
ismAddress:
|
|
1589
|
+
ismAddress: contracts_normalizeStarknetAddressSafe(domainIsm.deployed.address),
|
|
2003
1590
|
};
|
|
2004
1591
|
}
|
|
2005
1592
|
throw new Error(`Routing ISM domain ${domainId} has invalid state`);
|
|
2006
1593
|
});
|
|
2007
1594
|
const actualByDomain = new Map(Object.entries(current.config.domains).map(([domainId, domainIsm]) => [
|
|
2008
1595
|
Number(domainId),
|
|
2009
|
-
|
|
1596
|
+
contracts_normalizeStarknetAddressSafe(domainIsm.deployed.address),
|
|
2010
1597
|
]));
|
|
2011
1598
|
const expectedByDomain = new Map(expectedRoutes.map((route) => [route.domainId, route.ismAddress]));
|
|
2012
1599
|
const updateTxs = [];
|
|
1600
|
+
const rawProvider = this.signer.getRawProvider();
|
|
2013
1601
|
for (const route of expectedRoutes) {
|
|
2014
1602
|
const actualAddress = actualByDomain.get(route.domainId);
|
|
2015
1603
|
if (!actualAddress ||
|
|
2016
1604
|
!(0,addresses/* eqAddressStarknet */.PD)(actualAddress, route.ismAddress)) {
|
|
2017
1605
|
updateTxs.push({
|
|
2018
1606
|
annotation: `Setting routing ISM route ${route.domainId}`,
|
|
2019
|
-
...(await
|
|
2020
|
-
signer: this.signer.getSignerAddress(),
|
|
1607
|
+
...(await getSetRoutingIsmRouteTx(rawProvider, {
|
|
2021
1608
|
ismAddress: artifact.deployed.address,
|
|
2022
1609
|
route,
|
|
2023
1610
|
})),
|
|
@@ -2028,8 +1615,7 @@ class StarknetRoutingIsmWriter extends StarknetRoutingIsmReader {
|
|
|
2028
1615
|
if (!expectedByDomain.has(domainId)) {
|
|
2029
1616
|
updateTxs.push({
|
|
2030
1617
|
annotation: `Removing routing ISM route ${domainId}`,
|
|
2031
|
-
...(await
|
|
2032
|
-
signer: this.signer.getSignerAddress(),
|
|
1618
|
+
...(await getRemoveRoutingIsmRouteTx(rawProvider, {
|
|
2033
1619
|
ismAddress: artifact.deployed.address,
|
|
2034
1620
|
domainId,
|
|
2035
1621
|
})),
|
|
@@ -2039,8 +1625,7 @@ class StarknetRoutingIsmWriter extends StarknetRoutingIsmReader {
|
|
|
2039
1625
|
if (!(0,addresses/* eqAddressStarknet */.PD)(current.config.owner, artifact.config.owner)) {
|
|
2040
1626
|
updateTxs.push({
|
|
2041
1627
|
annotation: `Updating routing ISM owner`,
|
|
2042
|
-
...(await
|
|
2043
|
-
signer: this.signer.getSignerAddress(),
|
|
1628
|
+
...(await getSetRoutingIsmOwnerTx(rawProvider, {
|
|
2044
1629
|
ismAddress: artifact.deployed.address,
|
|
2045
1630
|
newOwner: artifact.config.owner,
|
|
2046
1631
|
})),
|
|
@@ -2054,15 +1639,15 @@ class StarknetRoutingIsmWriter extends StarknetRoutingIsmReader {
|
|
|
2054
1639
|
|
|
2055
1640
|
|
|
2056
1641
|
|
|
1642
|
+
|
|
1643
|
+
|
|
2057
1644
|
class StarknetMerkleRootMultisigIsmReader {
|
|
2058
1645
|
provider;
|
|
2059
1646
|
constructor(provider) {
|
|
2060
1647
|
this.provider = provider;
|
|
2061
1648
|
}
|
|
2062
1649
|
async read(address) {
|
|
2063
|
-
const ism = await this.provider.
|
|
2064
|
-
ismAddress: address,
|
|
2065
|
-
});
|
|
1650
|
+
const ism = await getMerkleRootMultisigIsmConfig(this.provider.getRawProvider(), address);
|
|
2066
1651
|
return {
|
|
2067
1652
|
artifactState: dist_artifact/* ArtifactState */.O2.DEPLOYED,
|
|
2068
1653
|
config: {
|
|
@@ -2081,8 +1666,7 @@ class StarknetMerkleRootMultisigIsmWriter extends StarknetMerkleRootMultisigIsmR
|
|
|
2081
1666
|
this.signer = signer;
|
|
2082
1667
|
}
|
|
2083
1668
|
async create(artifact) {
|
|
2084
|
-
const tx =
|
|
2085
|
-
signer: this.signer.getSignerAddress(),
|
|
1669
|
+
const tx = getCreateMerkleRootMultisigIsmTx(this.signer.getSignerAddress(), {
|
|
2086
1670
|
validators: artifact.config.validators,
|
|
2087
1671
|
threshold: artifact.config.threshold,
|
|
2088
1672
|
});
|
|
@@ -2107,15 +1691,15 @@ class StarknetMerkleRootMultisigIsmWriter extends StarknetMerkleRootMultisigIsmR
|
|
|
2107
1691
|
|
|
2108
1692
|
|
|
2109
1693
|
|
|
1694
|
+
|
|
1695
|
+
|
|
2110
1696
|
class StarknetMessageIdMultisigIsmReader {
|
|
2111
1697
|
provider;
|
|
2112
1698
|
constructor(provider) {
|
|
2113
1699
|
this.provider = provider;
|
|
2114
1700
|
}
|
|
2115
1701
|
async read(address) {
|
|
2116
|
-
const ism = await this.provider.
|
|
2117
|
-
ismAddress: address,
|
|
2118
|
-
});
|
|
1702
|
+
const ism = await getMessageIdMultisigIsmConfig(this.provider.getRawProvider(), address);
|
|
2119
1703
|
return {
|
|
2120
1704
|
artifactState: dist_artifact/* ArtifactState */.O2.DEPLOYED,
|
|
2121
1705
|
config: {
|
|
@@ -2134,8 +1718,7 @@ class StarknetMessageIdMultisigIsmWriter extends StarknetMessageIdMultisigIsmRea
|
|
|
2134
1718
|
this.signer = signer;
|
|
2135
1719
|
}
|
|
2136
1720
|
async create(artifact) {
|
|
2137
|
-
const tx =
|
|
2138
|
-
signer: this.signer.getSignerAddress(),
|
|
1721
|
+
const tx = getCreateMessageIdMultisigIsmTx(this.signer.getSignerAddress(), {
|
|
2139
1722
|
validators: artifact.config.validators,
|
|
2140
1723
|
threshold: artifact.config.threshold,
|
|
2141
1724
|
});
|
|
@@ -2160,13 +1743,15 @@ class StarknetMessageIdMultisigIsmWriter extends StarknetMessageIdMultisigIsmRea
|
|
|
2160
1743
|
|
|
2161
1744
|
|
|
2162
1745
|
|
|
1746
|
+
|
|
1747
|
+
|
|
2163
1748
|
class StarknetTestIsmReader {
|
|
2164
1749
|
provider;
|
|
2165
1750
|
constructor(provider) {
|
|
2166
1751
|
this.provider = provider;
|
|
2167
1752
|
}
|
|
2168
1753
|
async read(address) {
|
|
2169
|
-
const noop =
|
|
1754
|
+
const noop = getNoopIsmConfig(address);
|
|
2170
1755
|
return {
|
|
2171
1756
|
artifactState: dist_artifact/* ArtifactState */.O2.DEPLOYED,
|
|
2172
1757
|
config: { type: dist/* AltVM.IsmType */.bx.GO.TEST_ISM },
|
|
@@ -2181,9 +1766,7 @@ class StarknetTestIsmWriter extends StarknetTestIsmReader {
|
|
|
2181
1766
|
this.signer = signer;
|
|
2182
1767
|
}
|
|
2183
1768
|
async create(artifact) {
|
|
2184
|
-
const tx =
|
|
2185
|
-
signer: this.signer.getSignerAddress(),
|
|
2186
|
-
});
|
|
1769
|
+
const tx = getCreateNoopIsmTx();
|
|
2187
1770
|
const receipt = await this.signer.sendAndConfirmTransaction(tx);
|
|
2188
1771
|
const ismAddress = receipt.contractAddress;
|
|
2189
1772
|
(0,validation/* assert */.v)(ismAddress, 'failed to deploy Starknet noop ISM');
|
|
@@ -2211,6 +1794,7 @@ class StarknetTestIsmWriter extends StarknetTestIsmReader {
|
|
|
2211
1794
|
|
|
2212
1795
|
|
|
2213
1796
|
|
|
1797
|
+
|
|
2214
1798
|
class StarknetIsmArtifactManager {
|
|
2215
1799
|
provider;
|
|
2216
1800
|
constructor(chainMetadata) {
|
|
@@ -2221,7 +1805,7 @@ class StarknetIsmArtifactManager {
|
|
|
2221
1805
|
return signer;
|
|
2222
1806
|
}
|
|
2223
1807
|
async readIsm(address) {
|
|
2224
|
-
const type = await this.provider.
|
|
1808
|
+
const type = await getIsmType(this.provider.getRawProvider(), address);
|
|
2225
1809
|
if (type === dist/* AltVM.IsmType */.bx.GO.CUSTOM) {
|
|
2226
1810
|
return this.createReader(dist/* AltVM.IsmType */.bx.GO.TEST_ISM).read(address);
|
|
2227
1811
|
}
|
|
@@ -2253,21 +1837,63 @@ class StarknetIsmArtifactManager {
|
|
|
2253
1837
|
}
|
|
2254
1838
|
}
|
|
2255
1839
|
//# sourceMappingURL=ism-artifact-manager.js.map
|
|
1840
|
+
;// CONCATENATED MODULE: ../starknet-sdk/dist/mailbox/mailbox-tx.js
|
|
1841
|
+
|
|
1842
|
+
|
|
1843
|
+
function getCreateMailboxTx(signer, config) {
|
|
1844
|
+
return {
|
|
1845
|
+
kind: 'deploy',
|
|
1846
|
+
contractName: StarknetContractName.MAILBOX,
|
|
1847
|
+
constructorArgs: [
|
|
1848
|
+
config.domainId,
|
|
1849
|
+
contracts_normalizeStarknetAddressSafe(signer),
|
|
1850
|
+
contracts_normalizeStarknetAddressSafe(config.defaultIsmAddress ?? addresses/* ZERO_ADDRESS_HEX_32 */.qx),
|
|
1851
|
+
contracts_normalizeStarknetAddressSafe(config.defaultHookAddress ?? addresses/* ZERO_ADDRESS_HEX_32 */.qx),
|
|
1852
|
+
contracts_normalizeStarknetAddressSafe(config.requiredHookAddress ?? addresses/* ZERO_ADDRESS_HEX_32 */.qx),
|
|
1853
|
+
],
|
|
1854
|
+
};
|
|
1855
|
+
}
|
|
1856
|
+
async function getSetDefaultIsmTx(provider, config) {
|
|
1857
|
+
const mailbox = getStarknetContract(StarknetContractName.MAILBOX, config.mailboxAddress, provider);
|
|
1858
|
+
return populateInvokeTx(mailbox, 'set_default_ism', [
|
|
1859
|
+
contracts_normalizeStarknetAddressSafe(config.ismAddress),
|
|
1860
|
+
]);
|
|
1861
|
+
}
|
|
1862
|
+
async function getSetDefaultHookTx(provider, config) {
|
|
1863
|
+
const mailbox = getStarknetContract(StarknetContractName.MAILBOX, config.mailboxAddress, provider);
|
|
1864
|
+
return populateInvokeTx(mailbox, 'set_default_hook', [
|
|
1865
|
+
contracts_normalizeStarknetAddressSafe(config.hookAddress),
|
|
1866
|
+
]);
|
|
1867
|
+
}
|
|
1868
|
+
async function getSetRequiredHookTx(provider, config) {
|
|
1869
|
+
const mailbox = getStarknetContract(StarknetContractName.MAILBOX, config.mailboxAddress, provider);
|
|
1870
|
+
return populateInvokeTx(mailbox, 'set_required_hook', [
|
|
1871
|
+
contracts_normalizeStarknetAddressSafe(config.hookAddress),
|
|
1872
|
+
]);
|
|
1873
|
+
}
|
|
1874
|
+
async function getSetMailboxOwnerTx(provider, config) {
|
|
1875
|
+
const mailbox = getStarknetContract(StarknetContractName.MAILBOX, config.mailboxAddress, provider);
|
|
1876
|
+
return populateInvokeTx(mailbox, 'transfer_ownership', [
|
|
1877
|
+
contracts_normalizeStarknetAddressSafe(config.newOwner),
|
|
1878
|
+
]);
|
|
1879
|
+
}
|
|
1880
|
+
//# sourceMappingURL=mailbox-tx.js.map
|
|
2256
1881
|
;// CONCATENATED MODULE: ../starknet-sdk/dist/mailbox/mailbox-artifact-manager.js
|
|
2257
1882
|
|
|
2258
1883
|
|
|
2259
1884
|
|
|
2260
1885
|
|
|
2261
1886
|
|
|
1887
|
+
|
|
1888
|
+
|
|
1889
|
+
|
|
2262
1890
|
class StarknetMailboxReader {
|
|
2263
1891
|
provider;
|
|
2264
1892
|
constructor(provider) {
|
|
2265
1893
|
this.provider = provider;
|
|
2266
1894
|
}
|
|
2267
1895
|
async read(address) {
|
|
2268
|
-
const mailbox = await this.provider.
|
|
2269
|
-
mailboxAddress: address,
|
|
2270
|
-
});
|
|
1896
|
+
const mailbox = await getMailboxConfig(this.provider.getRawProvider(), address);
|
|
2271
1897
|
return {
|
|
2272
1898
|
artifactState: dist_artifact/* ArtifactState */.O2.DEPLOYED,
|
|
2273
1899
|
config: {
|
|
@@ -2275,24 +1901,24 @@ class StarknetMailboxReader {
|
|
|
2275
1901
|
defaultIsm: {
|
|
2276
1902
|
artifactState: dist_artifact/* ArtifactState */.O2.UNDERIVED,
|
|
2277
1903
|
deployed: {
|
|
2278
|
-
address:
|
|
1904
|
+
address: contracts_normalizeStarknetAddressSafe(mailbox.defaultIsm),
|
|
2279
1905
|
},
|
|
2280
1906
|
},
|
|
2281
1907
|
defaultHook: {
|
|
2282
1908
|
artifactState: dist_artifact/* ArtifactState */.O2.UNDERIVED,
|
|
2283
1909
|
deployed: {
|
|
2284
|
-
address:
|
|
1910
|
+
address: contracts_normalizeStarknetAddressSafe(mailbox.defaultHook),
|
|
2285
1911
|
},
|
|
2286
1912
|
},
|
|
2287
1913
|
requiredHook: {
|
|
2288
1914
|
artifactState: dist_artifact/* ArtifactState */.O2.UNDERIVED,
|
|
2289
1915
|
deployed: {
|
|
2290
|
-
address:
|
|
1916
|
+
address: contracts_normalizeStarknetAddressSafe(mailbox.requiredHook),
|
|
2291
1917
|
},
|
|
2292
1918
|
},
|
|
2293
1919
|
},
|
|
2294
1920
|
deployed: {
|
|
2295
|
-
address:
|
|
1921
|
+
address: contracts_normalizeStarknetAddressSafe(mailbox.address),
|
|
2296
1922
|
domainId: mailbox.localDomain,
|
|
2297
1923
|
},
|
|
2298
1924
|
};
|
|
@@ -2307,21 +1933,18 @@ class StarknetMailboxWriter extends StarknetMailboxReader {
|
|
|
2307
1933
|
this.chainMetadata = chainMetadata;
|
|
2308
1934
|
}
|
|
2309
1935
|
getNestedAddress(nested) {
|
|
2310
|
-
return
|
|
1936
|
+
return contracts_normalizeStarknetAddressSafe(nested.deployed.address);
|
|
2311
1937
|
}
|
|
2312
1938
|
async getInitialHookAddress(address, receipts, placeholderRef) {
|
|
2313
1939
|
if (!(0,addresses/* isZeroishAddress */.Hi)(address)) {
|
|
2314
|
-
return
|
|
1940
|
+
return contracts_normalizeStarknetAddressSafe(address);
|
|
2315
1941
|
}
|
|
2316
1942
|
if (!placeholderRef.address) {
|
|
2317
|
-
const tx =
|
|
2318
|
-
signer: this.signer.getSignerAddress(),
|
|
2319
|
-
mailboxAddress: '',
|
|
2320
|
-
});
|
|
1943
|
+
const tx = getCreateNoopHookTx();
|
|
2321
1944
|
const receipt = await this.signer.sendAndConfirmTransaction(tx);
|
|
2322
1945
|
receipts.push(receipt);
|
|
2323
1946
|
(0,validation/* assert */.v)(receipt.contractAddress, 'failed to deploy placeholder Starknet noop hook');
|
|
2324
|
-
placeholderRef.address =
|
|
1947
|
+
placeholderRef.address = contracts_normalizeStarknetAddressSafe(receipt.contractAddress);
|
|
2325
1948
|
}
|
|
2326
1949
|
return placeholderRef.address;
|
|
2327
1950
|
}
|
|
@@ -2331,32 +1954,22 @@ class StarknetMailboxWriter extends StarknetMailboxReader {
|
|
|
2331
1954
|
const placeholderHookRef = {};
|
|
2332
1955
|
const defaultHookAddress = await this.getInitialHookAddress(this.getNestedAddress(artifact.config.defaultHook), receipts, placeholderHookRef);
|
|
2333
1956
|
const requiredHookAddress = await this.getInitialHookAddress(this.getNestedAddress(artifact.config.requiredHook), receipts, placeholderHookRef);
|
|
2334
|
-
const createTx =
|
|
2335
|
-
signer: this.signer.getSignerAddress(),
|
|
1957
|
+
const createTx = getCreateMailboxTx(this.signer.getSignerAddress(), {
|
|
2336
1958
|
domainId: this.chainMetadata.domainId,
|
|
2337
1959
|
defaultIsmAddress,
|
|
2338
1960
|
defaultHookAddress,
|
|
2339
1961
|
requiredHookAddress,
|
|
2340
|
-
proxyAdminAddress: undefined,
|
|
2341
1962
|
});
|
|
2342
1963
|
const createReceipt = await this.signer.sendAndConfirmTransaction(createTx);
|
|
2343
1964
|
receipts.push(createReceipt);
|
|
2344
1965
|
(0,validation/* assert */.v)(createReceipt.contractAddress, 'failed to deploy Starknet mailbox');
|
|
2345
1966
|
const mailboxAddress = createReceipt.contractAddress;
|
|
2346
|
-
if (!(0,addresses/* eqAddressStarknet */.PD)(artifact.config.owner, this.signer.getSignerAddress())) {
|
|
2347
|
-
const tx = await this.signer.getSetMailboxOwnerTransaction({
|
|
2348
|
-
signer: this.signer.getSignerAddress(),
|
|
2349
|
-
mailboxAddress,
|
|
2350
|
-
newOwner: artifact.config.owner,
|
|
2351
|
-
});
|
|
2352
|
-
receipts.push(await this.signer.sendAndConfirmTransaction(tx));
|
|
2353
|
-
}
|
|
2354
1967
|
return [
|
|
2355
1968
|
{
|
|
2356
1969
|
artifactState: dist_artifact/* ArtifactState */.O2.DEPLOYED,
|
|
2357
1970
|
config: artifact.config,
|
|
2358
1971
|
deployed: {
|
|
2359
|
-
address:
|
|
1972
|
+
address: contracts_normalizeStarknetAddressSafe(mailboxAddress),
|
|
2360
1973
|
domainId: this.chainMetadata.domainId,
|
|
2361
1974
|
},
|
|
2362
1975
|
},
|
|
@@ -2373,11 +1986,11 @@ class StarknetMailboxWriter extends StarknetMailboxReader {
|
|
|
2373
1986
|
const currentDefaultIsm = this.getNestedAddress(current.config.defaultIsm);
|
|
2374
1987
|
const currentDefaultHook = this.getNestedAddress(current.config.defaultHook);
|
|
2375
1988
|
const currentRequiredHook = this.getNestedAddress(current.config.requiredHook);
|
|
1989
|
+
const rawProvider = this.signer.getRawProvider();
|
|
2376
1990
|
if (!(0,addresses/* eqAddressStarknet */.PD)(currentDefaultIsm, expectedDefaultIsm)) {
|
|
2377
1991
|
updateTxs.push({
|
|
2378
1992
|
annotation: `Setting mailbox default ISM`,
|
|
2379
|
-
...(await
|
|
2380
|
-
signer: this.signer.getSignerAddress(),
|
|
1993
|
+
...(await getSetDefaultIsmTx(rawProvider, {
|
|
2381
1994
|
mailboxAddress,
|
|
2382
1995
|
ismAddress: expectedDefaultIsm,
|
|
2383
1996
|
})),
|
|
@@ -2386,8 +1999,7 @@ class StarknetMailboxWriter extends StarknetMailboxReader {
|
|
|
2386
1999
|
if (!(0,addresses/* eqAddressStarknet */.PD)(currentDefaultHook, expectedDefaultHook)) {
|
|
2387
2000
|
updateTxs.push({
|
|
2388
2001
|
annotation: `Setting mailbox default hook`,
|
|
2389
|
-
...(await
|
|
2390
|
-
signer: this.signer.getSignerAddress(),
|
|
2002
|
+
...(await getSetDefaultHookTx(rawProvider, {
|
|
2391
2003
|
mailboxAddress,
|
|
2392
2004
|
hookAddress: expectedDefaultHook,
|
|
2393
2005
|
})),
|
|
@@ -2396,8 +2008,7 @@ class StarknetMailboxWriter extends StarknetMailboxReader {
|
|
|
2396
2008
|
if (!(0,addresses/* eqAddressStarknet */.PD)(currentRequiredHook, expectedRequiredHook)) {
|
|
2397
2009
|
updateTxs.push({
|
|
2398
2010
|
annotation: `Setting mailbox required hook`,
|
|
2399
|
-
...(await
|
|
2400
|
-
signer: this.signer.getSignerAddress(),
|
|
2011
|
+
...(await getSetRequiredHookTx(rawProvider, {
|
|
2401
2012
|
mailboxAddress,
|
|
2402
2013
|
hookAddress: expectedRequiredHook,
|
|
2403
2014
|
})),
|
|
@@ -2406,8 +2017,7 @@ class StarknetMailboxWriter extends StarknetMailboxReader {
|
|
|
2406
2017
|
if (!(0,addresses/* eqAddressStarknet */.PD)(current.config.owner, artifact.config.owner)) {
|
|
2407
2018
|
updateTxs.push({
|
|
2408
2019
|
annotation: `Setting mailbox owner`,
|
|
2409
|
-
...(await
|
|
2410
|
-
signer: this.signer.getSignerAddress(),
|
|
2020
|
+
...(await getSetMailboxOwnerTx(rawProvider, {
|
|
2411
2021
|
mailboxAddress,
|
|
2412
2022
|
newOwner: artifact.config.owner,
|
|
2413
2023
|
})),
|
|
@@ -2448,6 +2058,19 @@ class StarknetMailboxArtifactManager {
|
|
|
2448
2058
|
}
|
|
2449
2059
|
}
|
|
2450
2060
|
//# sourceMappingURL=mailbox-artifact-manager.js.map
|
|
2061
|
+
;// CONCATENATED MODULE: ../starknet-sdk/dist/validator-announce/validator-announce-tx.js
|
|
2062
|
+
|
|
2063
|
+
function getCreateValidatorAnnounceTx(signer, mailboxAddress) {
|
|
2064
|
+
return {
|
|
2065
|
+
kind: 'deploy',
|
|
2066
|
+
contractName: StarknetContractName.VALIDATOR_ANNOUNCE,
|
|
2067
|
+
constructorArgs: [
|
|
2068
|
+
contracts_normalizeStarknetAddressSafe(mailboxAddress),
|
|
2069
|
+
contracts_normalizeStarknetAddressSafe(signer),
|
|
2070
|
+
],
|
|
2071
|
+
};
|
|
2072
|
+
}
|
|
2073
|
+
//# sourceMappingURL=validator-announce-tx.js.map
|
|
2451
2074
|
;// CONCATENATED MODULE: ../starknet-sdk/dist/validator-announce/validator-announce-artifact-manager.js
|
|
2452
2075
|
|
|
2453
2076
|
|
|
@@ -2455,6 +2078,7 @@ class StarknetMailboxArtifactManager {
|
|
|
2455
2078
|
|
|
2456
2079
|
|
|
2457
2080
|
|
|
2081
|
+
|
|
2458
2082
|
const validator_announce_artifact_manager_STARKNET_STORAGE_ADDRESS_BOUND = (1n << 251n) - 256n;
|
|
2459
2083
|
const validator_announce_artifact_manager_logger = logging/* rootLogger */.Jk.child({
|
|
2460
2084
|
module: 'starknet-validator-announce-artifact-manager',
|
|
@@ -2467,7 +2091,7 @@ async function readStorageAddress(provider, contractAddress, key) {
|
|
|
2467
2091
|
.getStorageAt(contractAddress, `0x${key.toString(16)}`);
|
|
2468
2092
|
return (0,addresses/* isZeroishAddress */.Hi)(value)
|
|
2469
2093
|
? undefined
|
|
2470
|
-
:
|
|
2094
|
+
: contracts_normalizeStarknetAddressSafe(value);
|
|
2471
2095
|
}
|
|
2472
2096
|
catch (error) {
|
|
2473
2097
|
if (!shouldFallbackStorageRead(error)) {
|
|
@@ -2486,7 +2110,7 @@ async function readMailboxAddressFromStorage(provider, contractAddress) {
|
|
|
2486
2110
|
if (candidates.length === 0)
|
|
2487
2111
|
return undefined;
|
|
2488
2112
|
const uniqueCandidates = [
|
|
2489
|
-
...new Set(candidates.map((value) =>
|
|
2113
|
+
...new Set(candidates.map((value) => contracts_normalizeStarknetAddressSafe(value))),
|
|
2490
2114
|
];
|
|
2491
2115
|
return uniqueCandidates.length === 1 ? uniqueCandidates[0] : undefined;
|
|
2492
2116
|
}
|
|
@@ -2496,7 +2120,7 @@ class StarknetValidatorAnnounceReader {
|
|
|
2496
2120
|
this.provider = provider;
|
|
2497
2121
|
}
|
|
2498
2122
|
async read(address) {
|
|
2499
|
-
const normalizedAddress =
|
|
2123
|
+
const normalizedAddress = contracts_normalizeStarknetAddressSafe(address);
|
|
2500
2124
|
const mailboxAddress = await readMailboxAddressFromStorage(this.provider, normalizedAddress);
|
|
2501
2125
|
const config = {
|
|
2502
2126
|
mailboxAddress: mailboxAddress ?? '',
|
|
@@ -2524,10 +2148,7 @@ class StarknetValidatorAnnounceWriter extends StarknetValidatorAnnounceReader {
|
|
|
2524
2148
|
this.signer = signer;
|
|
2525
2149
|
}
|
|
2526
2150
|
async create(artifact) {
|
|
2527
|
-
const tx =
|
|
2528
|
-
signer: this.signer.getSignerAddress(),
|
|
2529
|
-
mailboxAddress: artifact.config.mailboxAddress,
|
|
2530
|
-
});
|
|
2151
|
+
const tx = getCreateValidatorAnnounceTx(this.signer.getSignerAddress(), artifact.config.mailboxAddress);
|
|
2531
2152
|
const receipt = await this.signer.sendAndConfirmTransaction(tx);
|
|
2532
2153
|
const validatorAnnounceId = receipt.contractAddress;
|
|
2533
2154
|
(0,validation/* assert */.v)(validatorAnnounceId, 'failed to get Starknet validator announce address');
|
|
@@ -2536,7 +2157,7 @@ class StarknetValidatorAnnounceWriter extends StarknetValidatorAnnounceReader {
|
|
|
2536
2157
|
artifactState: dist_artifact/* ArtifactState */.O2.DEPLOYED,
|
|
2537
2158
|
config: artifact.config,
|
|
2538
2159
|
deployed: {
|
|
2539
|
-
address:
|
|
2160
|
+
address: contracts_normalizeStarknetAddressSafe(validatorAnnounceId),
|
|
2540
2161
|
},
|
|
2541
2162
|
},
|
|
2542
2163
|
[receipt],
|
|
@@ -2578,11 +2199,123 @@ class StarknetValidatorAnnounceArtifactManager {
|
|
|
2578
2199
|
//# sourceMappingURL=validator-announce-artifact-manager.js.map
|
|
2579
2200
|
// EXTERNAL MODULE: ../provider-sdk/dist/warp.js
|
|
2580
2201
|
var warp = __webpack_require__(17791);
|
|
2202
|
+
;// CONCATENATED MODULE: ../starknet-sdk/dist/warp/warp-tx.js
|
|
2203
|
+
|
|
2204
|
+
|
|
2205
|
+
|
|
2206
|
+
|
|
2207
|
+
function getCreateNativeTokenTx(signer, config) {
|
|
2208
|
+
return {
|
|
2209
|
+
kind: 'deploy',
|
|
2210
|
+
contractName: StarknetContractName.HYP_NATIVE,
|
|
2211
|
+
contractType: starknet_dist_0/* ContractType */.h$.TOKEN,
|
|
2212
|
+
constructorArgs: [
|
|
2213
|
+
contracts_normalizeStarknetAddressSafe(config.mailboxAddress),
|
|
2214
|
+
contracts_normalizeStarknetAddressSafe(config.feeTokenAddress),
|
|
2215
|
+
contracts_normalizeStarknetAddressSafe(config.defaultHook),
|
|
2216
|
+
contracts_normalizeStarknetAddressSafe(config.defaultIsm),
|
|
2217
|
+
contracts_normalizeStarknetAddressSafe(signer),
|
|
2218
|
+
],
|
|
2219
|
+
};
|
|
2220
|
+
}
|
|
2221
|
+
function getCreateCollateralTokenTx(signer, config) {
|
|
2222
|
+
return {
|
|
2223
|
+
kind: 'deploy',
|
|
2224
|
+
contractName: StarknetContractName.HYP_ERC20_COLLATERAL,
|
|
2225
|
+
contractType: starknet_dist_0/* ContractType */.h$.TOKEN,
|
|
2226
|
+
constructorArgs: [
|
|
2227
|
+
contracts_normalizeStarknetAddressSafe(config.mailboxAddress),
|
|
2228
|
+
contracts_normalizeStarknetAddressSafe(config.collateralDenom),
|
|
2229
|
+
contracts_normalizeStarknetAddressSafe(signer),
|
|
2230
|
+
contracts_normalizeStarknetAddressSafe(config.defaultHook),
|
|
2231
|
+
contracts_normalizeStarknetAddressSafe(config.defaultIsm),
|
|
2232
|
+
],
|
|
2233
|
+
};
|
|
2234
|
+
}
|
|
2235
|
+
function getCreateSyntheticTokenTx(signer, config) {
|
|
2236
|
+
return {
|
|
2237
|
+
kind: 'deploy',
|
|
2238
|
+
contractName: StarknetContractName.HYP_ERC20,
|
|
2239
|
+
contractType: starknet_dist_0/* ContractType */.h$.TOKEN,
|
|
2240
|
+
constructorArgs: [
|
|
2241
|
+
config.decimals,
|
|
2242
|
+
contracts_normalizeStarknetAddressSafe(config.mailboxAddress),
|
|
2243
|
+
0, // initial supply
|
|
2244
|
+
config.name,
|
|
2245
|
+
config.denom,
|
|
2246
|
+
contracts_normalizeStarknetAddressSafe(config.defaultHook),
|
|
2247
|
+
contracts_normalizeStarknetAddressSafe(config.defaultIsm),
|
|
2248
|
+
contracts_normalizeStarknetAddressSafe(signer),
|
|
2249
|
+
],
|
|
2250
|
+
};
|
|
2251
|
+
}
|
|
2252
|
+
async function getSetTokenOwnerTx(provider, config) {
|
|
2253
|
+
const token = getStarknetContract(StarknetContractName.HYP_ERC20, config.tokenAddress, provider, starknet_dist_0/* ContractType */.h$.TOKEN);
|
|
2254
|
+
return populateInvokeTx(token, 'transfer_ownership', [
|
|
2255
|
+
contracts_normalizeStarknetAddressSafe(config.newOwner),
|
|
2256
|
+
]);
|
|
2257
|
+
}
|
|
2258
|
+
async function getSetTokenIsmTx(provider, config) {
|
|
2259
|
+
const token = getStarknetContract(StarknetContractName.HYP_ERC20, config.tokenAddress, provider, starknet_dist_0/* ContractType */.h$.TOKEN);
|
|
2260
|
+
return populateInvokeTx(token, 'set_interchain_security_module', [
|
|
2261
|
+
contracts_normalizeStarknetAddressSafe(config.ismAddress ?? addresses/* ZERO_ADDRESS_HEX_32 */.qx),
|
|
2262
|
+
]);
|
|
2263
|
+
}
|
|
2264
|
+
async function getSetTokenHookTx(provider, config) {
|
|
2265
|
+
const token = getStarknetContract(StarknetContractName.HYP_ERC20, config.tokenAddress, provider, starknet_dist_0/* ContractType */.h$.TOKEN);
|
|
2266
|
+
return populateInvokeTx(token, 'set_hook', [
|
|
2267
|
+
contracts_normalizeStarknetAddressSafe(config.hookAddress ?? addresses/* ZERO_ADDRESS_HEX_32 */.qx),
|
|
2268
|
+
]);
|
|
2269
|
+
}
|
|
2270
|
+
async function populateInvokeCall(provider, tokenAddress, method, args = []) {
|
|
2271
|
+
const contract = getStarknetContract(StarknetContractName.HYP_ERC20, tokenAddress, provider, starknet_dist_0/* ContractType */.h$.TOKEN);
|
|
2272
|
+
const tx = await populateInvokeTx(contract, method, args);
|
|
2273
|
+
(0,validation/* assert */.v)(tx.kind === 'invoke', 'Expected invoke Starknet transaction');
|
|
2274
|
+
return {
|
|
2275
|
+
contractAddress: contracts_normalizeStarknetAddressSafe(tx.contractAddress),
|
|
2276
|
+
entrypoint: tx.entrypoint,
|
|
2277
|
+
calldata: tx.calldata,
|
|
2278
|
+
};
|
|
2279
|
+
}
|
|
2280
|
+
async function getEnrollRemoteRouterTx(provider, config) {
|
|
2281
|
+
const receiverAddress = (0,addresses/* isZeroishAddress */.Hi)(config.remoteRouter.receiverAddress)
|
|
2282
|
+
? addresses/* ZERO_ADDRESS_HEX_32 */.qx
|
|
2283
|
+
: (0,addresses/* ensure0x */.Ho)(config.remoteRouter.receiverAddress);
|
|
2284
|
+
const noneOption = new starknet_dist/* CairoOption */.ci(starknet_dist/* CairoOptionVariant */.RV.None);
|
|
2285
|
+
const domainOption = new starknet_dist/* CairoOption */.ci(starknet_dist/* CairoOptionVariant */.RV.Some, config.remoteRouter.receiverDomainId);
|
|
2286
|
+
const gasOption = new starknet_dist/* CairoOption */.ci(starknet_dist/* CairoOptionVariant */.RV.Some, config.remoteRouter.gas);
|
|
2287
|
+
const [enrollCall, gasCall] = await Promise.all([
|
|
2288
|
+
populateInvokeCall(provider, config.tokenAddress, 'enroll_remote_router', [
|
|
2289
|
+
config.remoteRouter.receiverDomainId,
|
|
2290
|
+
receiverAddress,
|
|
2291
|
+
]),
|
|
2292
|
+
populateInvokeCall(provider, config.tokenAddress, 'set_destination_gas', [
|
|
2293
|
+
noneOption,
|
|
2294
|
+
domainOption,
|
|
2295
|
+
gasOption,
|
|
2296
|
+
]),
|
|
2297
|
+
]);
|
|
2298
|
+
return {
|
|
2299
|
+
kind: 'invoke',
|
|
2300
|
+
contractAddress: enrollCall.contractAddress,
|
|
2301
|
+
entrypoint: enrollCall.entrypoint,
|
|
2302
|
+
calldata: enrollCall.calldata,
|
|
2303
|
+
calls: [enrollCall, gasCall],
|
|
2304
|
+
};
|
|
2305
|
+
}
|
|
2306
|
+
async function getUnenrollRemoteRouterTx(provider, config) {
|
|
2307
|
+
const token = getStarknetContract(StarknetContractName.HYP_ERC20, config.tokenAddress, provider, starknet_dist_0/* ContractType */.h$.TOKEN);
|
|
2308
|
+
return populateInvokeTx(token, 'unenroll_remote_router', [
|
|
2309
|
+
config.receiverDomainId,
|
|
2310
|
+
]);
|
|
2311
|
+
}
|
|
2312
|
+
//# sourceMappingURL=warp-tx.js.map
|
|
2581
2313
|
;// CONCATENATED MODULE: ../starknet-sdk/dist/warp/token-artifact-manager.js
|
|
2582
2314
|
|
|
2583
2315
|
|
|
2584
2316
|
|
|
2585
2317
|
|
|
2318
|
+
|
|
2586
2319
|
function normalizeGas(gas) {
|
|
2587
2320
|
return BigInt(gas ?? '0').toString();
|
|
2588
2321
|
}
|
|
@@ -2612,7 +2345,7 @@ class StarknetWarpTokenReaderBase {
|
|
|
2612
2345
|
return {
|
|
2613
2346
|
artifactState: dist_artifact/* ArtifactState */.O2.DEPLOYED,
|
|
2614
2347
|
config: this.toConfig(token, remoteRouters),
|
|
2615
|
-
deployed: { address:
|
|
2348
|
+
deployed: { address: contracts_normalizeStarknetAddressSafe(token.address) },
|
|
2616
2349
|
};
|
|
2617
2350
|
}
|
|
2618
2351
|
baseConfig(token, remoteRouters) {
|
|
@@ -2620,15 +2353,15 @@ class StarknetWarpTokenReaderBase {
|
|
|
2620
2353
|
const destinationGas = {};
|
|
2621
2354
|
for (const remoteRouter of remoteRouters.remoteRouters) {
|
|
2622
2355
|
routers[remoteRouter.receiverDomainId] = {
|
|
2623
|
-
address:
|
|
2356
|
+
address: contracts_normalizeStarknetAddressSafe(remoteRouter.receiverAddress),
|
|
2624
2357
|
};
|
|
2625
2358
|
destinationGas[remoteRouter.receiverDomainId] = normalizeGas(remoteRouter.gas);
|
|
2626
2359
|
}
|
|
2627
2360
|
return {
|
|
2628
|
-
owner:
|
|
2629
|
-
mailbox:
|
|
2630
|
-
interchainSecurityModule: (0,dist_artifact/* addressToUnderivedArtifact */.Se)(token.ismAddress,
|
|
2631
|
-
hook: (0,dist_artifact/* addressToUnderivedArtifact */.Se)(token.hookAddress,
|
|
2361
|
+
owner: contracts_normalizeStarknetAddressSafe(token.owner),
|
|
2362
|
+
mailbox: contracts_normalizeStarknetAddressSafe(token.mailboxAddress),
|
|
2363
|
+
interchainSecurityModule: (0,dist_artifact/* addressToUnderivedArtifact */.Se)(token.ismAddress, contracts_normalizeStarknetAddressSafe),
|
|
2364
|
+
hook: (0,dist_artifact/* addressToUnderivedArtifact */.Se)(token.hookAddress, contracts_normalizeStarknetAddressSafe),
|
|
2632
2365
|
remoteRouters: routers,
|
|
2633
2366
|
destinationGas,
|
|
2634
2367
|
};
|
|
@@ -2666,7 +2399,7 @@ class StarknetWarpTokenWriterBase extends StarknetWarpTokenReaderBase {
|
|
|
2666
2399
|
{
|
|
2667
2400
|
artifactState: dist_artifact/* ArtifactState */.O2.DEPLOYED,
|
|
2668
2401
|
config: artifact.config,
|
|
2669
|
-
deployed: { address:
|
|
2402
|
+
deployed: { address: contracts_normalizeStarknetAddressSafe(tokenAddress) },
|
|
2670
2403
|
},
|
|
2671
2404
|
receipts,
|
|
2672
2405
|
];
|
|
@@ -2683,32 +2416,29 @@ class StarknetWarpTokenWriterBase extends StarknetWarpTokenReaderBase {
|
|
|
2683
2416
|
if (!(0,addresses/* eqAddressStarknet */.PD)(currentOwner, expectedConfig.owner)) {
|
|
2684
2417
|
ownerTx = {
|
|
2685
2418
|
annotation: 'Setting warp token owner',
|
|
2686
|
-
...(await this.
|
|
2687
|
-
signer: this.signer.getSignerAddress(),
|
|
2419
|
+
...(await getSetTokenOwnerTx(this.provider.getRawProvider(), {
|
|
2688
2420
|
tokenAddress,
|
|
2689
2421
|
newOwner: expectedConfig.owner,
|
|
2690
2422
|
})),
|
|
2691
2423
|
};
|
|
2692
2424
|
}
|
|
2693
|
-
const currentIsm = (0,dist_artifact/* artifactOnChainToAddress */.wM)(current.config.interchainSecurityModule,
|
|
2694
|
-
const expectedIsm = (0,dist_artifact/* artifactOnChainToAddress */.wM)(expectedConfig.interchainSecurityModule,
|
|
2425
|
+
const currentIsm = (0,dist_artifact/* artifactOnChainToAddress */.wM)(current.config.interchainSecurityModule, contracts_normalizeStarknetAddressSafe);
|
|
2426
|
+
const expectedIsm = (0,dist_artifact/* artifactOnChainToAddress */.wM)(expectedConfig.interchainSecurityModule, contracts_normalizeStarknetAddressSafe);
|
|
2695
2427
|
if (!(0,addresses/* eqAddressStarknet */.PD)(currentIsm ?? addresses/* ZERO_ADDRESS_HEX_32 */.qx, expectedIsm ?? addresses/* ZERO_ADDRESS_HEX_32 */.qx)) {
|
|
2696
2428
|
txs.push({
|
|
2697
2429
|
annotation: 'Setting warp token ISM',
|
|
2698
|
-
...(await this.
|
|
2699
|
-
signer: this.signer.getSignerAddress(),
|
|
2430
|
+
...(await getSetTokenIsmTx(this.provider.getRawProvider(), {
|
|
2700
2431
|
tokenAddress,
|
|
2701
2432
|
ismAddress: expectedIsm,
|
|
2702
2433
|
})),
|
|
2703
2434
|
});
|
|
2704
2435
|
}
|
|
2705
|
-
const currentHook = (0,dist_artifact/* artifactOnChainToAddress */.wM)(current.config.hook,
|
|
2706
|
-
const expectedHook = (0,dist_artifact/* artifactOnChainToAddress */.wM)(expectedConfig.hook,
|
|
2436
|
+
const currentHook = (0,dist_artifact/* artifactOnChainToAddress */.wM)(current.config.hook, contracts_normalizeStarknetAddressSafe);
|
|
2437
|
+
const expectedHook = (0,dist_artifact/* artifactOnChainToAddress */.wM)(expectedConfig.hook, contracts_normalizeStarknetAddressSafe);
|
|
2707
2438
|
if (!(0,addresses/* eqAddressStarknet */.PD)(currentHook ?? addresses/* ZERO_ADDRESS_HEX_32 */.qx, expectedHook ?? addresses/* ZERO_ADDRESS_HEX_32 */.qx)) {
|
|
2708
2439
|
txs.push({
|
|
2709
2440
|
annotation: 'Setting warp token hook',
|
|
2710
|
-
...(await this.
|
|
2711
|
-
signer: this.signer.getSignerAddress(),
|
|
2441
|
+
...(await getSetTokenHookTx(this.provider.getRawProvider(), {
|
|
2712
2442
|
tokenAddress,
|
|
2713
2443
|
hookAddress: expectedHook,
|
|
2714
2444
|
})),
|
|
@@ -2724,8 +2454,7 @@ class StarknetWarpTokenWriterBase extends StarknetWarpTokenReaderBase {
|
|
|
2724
2454
|
for (const domain of routerUpdates.toUnenroll.sort((a, b) => a - b)) {
|
|
2725
2455
|
txs.push({
|
|
2726
2456
|
annotation: `Unenrolling remote router for domain ${domain}`,
|
|
2727
|
-
...(await this.
|
|
2728
|
-
signer: this.signer.getSignerAddress(),
|
|
2457
|
+
...(await getUnenrollRemoteRouterTx(this.provider.getRawProvider(), {
|
|
2729
2458
|
tokenAddress,
|
|
2730
2459
|
receiverDomainId: domain,
|
|
2731
2460
|
})),
|
|
@@ -2734,8 +2463,7 @@ class StarknetWarpTokenWriterBase extends StarknetWarpTokenReaderBase {
|
|
|
2734
2463
|
for (const route of routerUpdates.toEnroll.sort((a, b) => a.domainId - b.domainId)) {
|
|
2735
2464
|
txs.push({
|
|
2736
2465
|
annotation: `Enrolling remote router for domain ${route.domainId}`,
|
|
2737
|
-
...(await this.
|
|
2738
|
-
signer: this.signer.getSignerAddress(),
|
|
2466
|
+
...(await getEnrollRemoteRouterTx(this.provider.getRawProvider(), {
|
|
2739
2467
|
tokenAddress,
|
|
2740
2468
|
remoteRouter: {
|
|
2741
2469
|
receiverDomainId: route.domainId,
|
|
@@ -2751,15 +2479,15 @@ class StarknetWarpTokenWriterBase extends StarknetWarpTokenReaderBase {
|
|
|
2751
2479
|
return txs;
|
|
2752
2480
|
}
|
|
2753
2481
|
preserveUnsetHookAndIsm(current, expected) {
|
|
2754
|
-
const expectedIsm = (0,dist_artifact/* artifactOnChainToAddress */.wM)(expected.interchainSecurityModule,
|
|
2755
|
-
const expectedHook = (0,dist_artifact/* artifactOnChainToAddress */.wM)(expected.hook,
|
|
2482
|
+
const expectedIsm = (0,dist_artifact/* artifactOnChainToAddress */.wM)(expected.interchainSecurityModule, contracts_normalizeStarknetAddressSafe);
|
|
2483
|
+
const expectedHook = (0,dist_artifact/* artifactOnChainToAddress */.wM)(expected.hook, contracts_normalizeStarknetAddressSafe);
|
|
2756
2484
|
return {
|
|
2757
2485
|
...expected,
|
|
2758
2486
|
interchainSecurityModule: (0,addresses/* isEmptyAddress */.Ae)(expectedIsm)
|
|
2759
|
-
? (0,dist_artifact/* addressToUnderivedArtifact */.Se)((0,dist_artifact/* artifactOnChainToAddress */.wM)(current.interchainSecurityModule,
|
|
2487
|
+
? (0,dist_artifact/* addressToUnderivedArtifact */.Se)((0,dist_artifact/* artifactOnChainToAddress */.wM)(current.interchainSecurityModule, contracts_normalizeStarknetAddressSafe))
|
|
2760
2488
|
: expected.interchainSecurityModule,
|
|
2761
2489
|
hook: (0,addresses/* isEmptyAddress */.Ae)(expectedHook)
|
|
2762
|
-
? (0,dist_artifact/* addressToUnderivedArtifact */.Se)((0,dist_artifact/* artifactOnChainToAddress */.wM)(current.hook,
|
|
2490
|
+
? (0,dist_artifact/* addressToUnderivedArtifact */.Se)((0,dist_artifact/* artifactOnChainToAddress */.wM)(current.hook, contracts_normalizeStarknetAddressSafe))
|
|
2763
2491
|
: expected.hook,
|
|
2764
2492
|
};
|
|
2765
2493
|
}
|
|
@@ -2771,19 +2499,17 @@ class StarknetWarpTokenWriterBase extends StarknetWarpTokenReaderBase {
|
|
|
2771
2499
|
async applyPostCreateConfig(tokenAddress, expected, current) {
|
|
2772
2500
|
const receipts = [];
|
|
2773
2501
|
let ownerTx;
|
|
2774
|
-
const expectedIsm = (0,dist_artifact/* artifactOnChainToAddress */.wM)(expected.interchainSecurityModule,
|
|
2502
|
+
const expectedIsm = (0,dist_artifact/* artifactOnChainToAddress */.wM)(expected.interchainSecurityModule, contracts_normalizeStarknetAddressSafe);
|
|
2775
2503
|
if (expectedIsm) {
|
|
2776
|
-
const tx = await this.
|
|
2777
|
-
signer: this.signer.getSignerAddress(),
|
|
2504
|
+
const tx = await getSetTokenIsmTx(this.provider.getRawProvider(), {
|
|
2778
2505
|
tokenAddress,
|
|
2779
2506
|
ismAddress: expectedIsm,
|
|
2780
2507
|
});
|
|
2781
2508
|
receipts.push(await this.signer.sendAndConfirmTransaction(tx));
|
|
2782
2509
|
}
|
|
2783
|
-
const expectedHook = (0,dist_artifact/* artifactOnChainToAddress */.wM)(expected.hook,
|
|
2510
|
+
const expectedHook = (0,dist_artifact/* artifactOnChainToAddress */.wM)(expected.hook, contracts_normalizeStarknetAddressSafe);
|
|
2784
2511
|
if (expectedHook) {
|
|
2785
|
-
const tx = await this.
|
|
2786
|
-
signer: this.signer.getSignerAddress(),
|
|
2512
|
+
const tx = await getSetTokenHookTx(this.provider.getRawProvider(), {
|
|
2787
2513
|
tokenAddress,
|
|
2788
2514
|
hookAddress: expectedHook,
|
|
2789
2515
|
});
|
|
@@ -2794,8 +2520,7 @@ class StarknetWarpTokenWriterBase extends StarknetWarpTokenReaderBase {
|
|
|
2794
2520
|
.sort((a, b) => a - b)) {
|
|
2795
2521
|
const remoteRouter = expected.remoteRouters[domain];
|
|
2796
2522
|
(0,validation/* assert */.v)(remoteRouter, `Missing remote router for Starknet domain ${domain}`);
|
|
2797
|
-
const tx = await this.
|
|
2798
|
-
signer: this.signer.getSignerAddress(),
|
|
2523
|
+
const tx = await getEnrollRemoteRouterTx(this.provider.getRawProvider(), {
|
|
2799
2524
|
tokenAddress,
|
|
2800
2525
|
remoteRouter: {
|
|
2801
2526
|
receiverDomainId: domain,
|
|
@@ -2807,8 +2532,7 @@ class StarknetWarpTokenWriterBase extends StarknetWarpTokenReaderBase {
|
|
|
2807
2532
|
}
|
|
2808
2533
|
const currentOwner = current.owner;
|
|
2809
2534
|
if (!(0,addresses/* eqAddressStarknet */.PD)(currentOwner, expected.owner)) {
|
|
2810
|
-
ownerTx = await this.
|
|
2811
|
-
signer: this.signer.getSignerAddress(),
|
|
2535
|
+
ownerTx = await getSetTokenOwnerTx(this.provider.getRawProvider(), {
|
|
2812
2536
|
tokenAddress,
|
|
2813
2537
|
newOwner: expected.owner,
|
|
2814
2538
|
});
|
|
@@ -2825,13 +2549,15 @@ class StarknetWarpTokenWriterBase extends StarknetWarpTokenReaderBase {
|
|
|
2825
2549
|
|
|
2826
2550
|
|
|
2827
2551
|
|
|
2552
|
+
|
|
2553
|
+
|
|
2828
2554
|
class StarknetCollateralTokenReader extends StarknetWarpTokenReaderBase {
|
|
2829
2555
|
tokenType = 'collateral';
|
|
2830
2556
|
toConfig(token, remoteRouters) {
|
|
2831
2557
|
return {
|
|
2832
2558
|
type: warp/* TokenType */.ks.collateral,
|
|
2833
2559
|
...this.baseConfig(token, remoteRouters),
|
|
2834
|
-
token:
|
|
2560
|
+
token: contracts_normalizeStarknetAddressSafe(token.denom),
|
|
2835
2561
|
name: token.name,
|
|
2836
2562
|
symbol: token.symbol,
|
|
2837
2563
|
decimals: token.decimals,
|
|
@@ -2844,17 +2570,19 @@ class StarknetCollateralTokenWriter extends StarknetWarpTokenWriterBase {
|
|
|
2844
2570
|
return {
|
|
2845
2571
|
type: warp/* TokenType */.ks.collateral,
|
|
2846
2572
|
...this.baseConfig(token, remoteRouters),
|
|
2847
|
-
token:
|
|
2573
|
+
token: contracts_normalizeStarknetAddressSafe(token.denom),
|
|
2848
2574
|
name: token.name,
|
|
2849
2575
|
symbol: token.symbol,
|
|
2850
2576
|
decimals: token.decimals,
|
|
2851
2577
|
};
|
|
2852
2578
|
}
|
|
2853
2579
|
async createToken(artifact) {
|
|
2854
|
-
const
|
|
2855
|
-
|
|
2580
|
+
const mailbox = await getMailboxConfig(this.provider.getRawProvider(), artifact.config.mailbox);
|
|
2581
|
+
const tx = getCreateCollateralTokenTx(this.signer.getSignerAddress(), {
|
|
2856
2582
|
mailboxAddress: artifact.config.mailbox,
|
|
2857
2583
|
collateralDenom: artifact.config.token,
|
|
2584
|
+
defaultHook: mailbox.defaultHook,
|
|
2585
|
+
defaultIsm: mailbox.defaultIsm,
|
|
2858
2586
|
});
|
|
2859
2587
|
return this.signer.sendAndConfirmTransaction(tx);
|
|
2860
2588
|
}
|
|
@@ -2867,6 +2595,8 @@ class StarknetCollateralTokenWriter extends StarknetWarpTokenWriterBase {
|
|
|
2867
2595
|
;// CONCATENATED MODULE: ../starknet-sdk/dist/warp/native-token-artifact-manager.js
|
|
2868
2596
|
|
|
2869
2597
|
|
|
2598
|
+
|
|
2599
|
+
|
|
2870
2600
|
class StarknetNativeTokenReader extends StarknetWarpTokenReaderBase {
|
|
2871
2601
|
tokenType = 'native';
|
|
2872
2602
|
toConfig(token, remoteRouters) {
|
|
@@ -2885,9 +2615,12 @@ class StarknetNativeTokenWriter extends StarknetWarpTokenWriterBase {
|
|
|
2885
2615
|
};
|
|
2886
2616
|
}
|
|
2887
2617
|
async createToken(artifact) {
|
|
2888
|
-
const
|
|
2889
|
-
|
|
2618
|
+
const mailbox = await getMailboxConfig(this.provider.getRawProvider(), artifact.config.mailbox);
|
|
2619
|
+
const tx = getCreateNativeTokenTx(this.signer.getSignerAddress(), {
|
|
2890
2620
|
mailboxAddress: artifact.config.mailbox,
|
|
2621
|
+
feeTokenAddress: this.provider.getFeeTokenAddress(),
|
|
2622
|
+
defaultHook: mailbox.defaultHook,
|
|
2623
|
+
defaultIsm: mailbox.defaultIsm,
|
|
2891
2624
|
});
|
|
2892
2625
|
return this.signer.sendAndConfirmTransaction(tx);
|
|
2893
2626
|
}
|
|
@@ -2897,6 +2630,8 @@ class StarknetNativeTokenWriter extends StarknetWarpTokenWriterBase {
|
|
|
2897
2630
|
|
|
2898
2631
|
|
|
2899
2632
|
|
|
2633
|
+
|
|
2634
|
+
|
|
2900
2635
|
class StarknetSyntheticTokenReader extends StarknetWarpTokenReaderBase {
|
|
2901
2636
|
tokenType = 'synthetic';
|
|
2902
2637
|
toConfig(token, remoteRouters) {
|
|
@@ -2932,12 +2667,14 @@ class StarknetSyntheticTokenWriter extends StarknetWarpTokenWriterBase {
|
|
|
2932
2667
|
(0,validation/* assert */.v)(!expected.metadataUri, 'metadataUri is unsupported for Starknet synthetic warp tokens');
|
|
2933
2668
|
}
|
|
2934
2669
|
async createToken(artifact) {
|
|
2935
|
-
const
|
|
2936
|
-
|
|
2670
|
+
const mailbox = await getMailboxConfig(this.provider.getRawProvider(), artifact.config.mailbox);
|
|
2671
|
+
const tx = getCreateSyntheticTokenTx(this.signer.getSignerAddress(), {
|
|
2937
2672
|
mailboxAddress: artifact.config.mailbox,
|
|
2938
2673
|
name: artifact.config.name,
|
|
2939
2674
|
denom: artifact.config.symbol,
|
|
2940
2675
|
decimals: artifact.config.decimals,
|
|
2676
|
+
defaultHook: mailbox.defaultHook,
|
|
2677
|
+
defaultIsm: mailbox.defaultIsm,
|
|
2941
2678
|
});
|
|
2942
2679
|
return this.signer.sendAndConfirmTransaction(tx);
|
|
2943
2680
|
}
|