Skip to content

Commit dadaff9

Browse files
committed
fix: mailbox creation
1 parent 0c7357c commit dadaff9

4 files changed

Lines changed: 15 additions & 7 deletions

File tree

typescript/aleo-sdk/scripts/generate-artifacts.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export function loadProgramsInDeployOrder(
8080
programName: string,
8181
coreSalt: string,
8282
warpSalt?: string,
83-
): { id: string, program: string }[] {
83+
): { id: string; program: string }[] {
8484
const visited = new Set<string>();
8585
let programs: Program[] = [];
8686

typescript/cosmos-sdk/src/clients/provider.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,11 +466,17 @@ export class CosmosNativeProvider implements AltVM.IProvider<EncodeObject> {
466466
async getCreateMailboxTransaction(
467467
req: AltVM.ReqCreateMailbox,
468468
): Promise<MsgCreateMailboxEncodeObject> {
469+
assert(
470+
req.defaultIsmAddress,
471+
`default ism address needed in cosmos native`,
472+
);
473+
469474
return {
470475
typeUrl: R.MsgCreateMailbox.proto.type,
471476
value: R.MsgCreateMailbox.proto.converter.create({
472477
local_domain: req.domainId,
473478
owner: req.signer,
479+
default_ism: req.defaultIsmAddress,
474480
}),
475481
};
476482
}

typescript/sdk/src/core/AltVMCoreModule.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,7 @@ export class AltVMCoreModule<PT extends ProtocolType> extends HyperlaneModule<
111111
const chainName = multiProvider.getChainName(chain);
112112
const domainId = multiProvider.getDomainId(chain);
113113

114-
// 1. Deploy Mailbox with initial configuration
115-
const mailbox = await signer.createMailbox({
116-
domainId: domainId,
117-
});
118-
119-
// 2. Deploy default ISM
114+
// 1. Deploy default ISM
120115
const ismModule = await AltVMIsmModule.create({
121116
chain: chainName,
122117
config: config.defaultIsm,
@@ -129,6 +124,12 @@ export class AltVMCoreModule<PT extends ProtocolType> extends HyperlaneModule<
129124

130125
const { deployedIsm: defaultIsm } = ismModule.serialize();
131126

127+
// 2. Deploy Mailbox with initial configuration
128+
const mailbox = await signer.createMailbox({
129+
domainId: domainId,
130+
defaultIsmAddress: defaultIsm,
131+
});
132+
132133
// 3. Deploy default hook
133134
const defaultHookModule = await AltVMHookModule.create({
134135
chain: chainName,

typescript/utils/src/altvm.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ export type ResQuoteRemoteTransfer = { denom: string; amount: bigint };
191191
export type ReqCreateMailbox = {
192192
signer: string;
193193
domainId: number;
194+
defaultIsmAddress?: string;
194195
};
195196
export type ResCreateMailbox = { mailboxAddress: string };
196197

0 commit comments

Comments
 (0)