@@ -36,6 +36,7 @@ import {
3636import {
3737 MsgCreateIgpEncodeObject ,
3838 MsgCreateMerkleTreeHookEncodeObject ,
39+ MsgCreateNoopHookEncodeObject ,
3940 MsgSetDestinationGasConfigEncodeObject ,
4041 MsgSetIgpOwnerEncodeObject ,
4142} from '../hyperlane/post_dispatch/messages.js' ;
@@ -65,6 +66,9 @@ export class CosmosNativeProvider implements AltVM.IProvider<EncodeObject> {
6566 private readonly cometClient : CometClient ;
6667 private readonly rpcUrls : string [ ] ;
6768
69+ private static NULL_ADDRESS =
70+ '0x0000000000000000000000000000000000000000000000000000000000000000' ;
71+
6872 static async connect (
6973 rpcUrls : string [ ] ,
7074 _chainId : string | number ,
@@ -113,11 +117,15 @@ export class CosmosNativeProvider implements AltVM.IProvider<EncodeObject> {
113117 }
114118
115119 async getBalance ( req : AltVM . ReqGetBalance ) : Promise < bigint > {
120+ assert ( req . denom , `denom required by ${ CosmosNativeProvider . name } ` ) ;
121+
116122 const coin = await this . query . bank . balance ( req . address , req . denom ) ;
117123 return BigInt ( coin . amount ) ;
118124 }
119125
120126 async getTotalSupply ( req : AltVM . ReqGetTotalSupply ) : Promise < bigint > {
127+ assert ( req . denom , `denom required by ${ CosmosNativeProvider . name } ` ) ;
128+
121129 const coin = await this . query . bank . supplyOf ( req . denom ) ;
122130 return BigInt ( coin . amount ) ;
123131 }
@@ -174,6 +182,10 @@ export class CosmosNativeProvider implements AltVM.IProvider<EncodeObject> {
174182 } ) ;
175183 assert ( mailbox , `found no mailbox for id ${ req . mailboxAddress } ` ) ;
176184
185+ if ( mailbox . default_ism === CosmosNativeProvider . NULL_ADDRESS ) {
186+ mailbox . default_ism = '' ;
187+ }
188+
177189 return {
178190 address : mailbox . id ,
179191 owner : mailbox . owner ,
@@ -353,6 +365,17 @@ export class CosmosNativeProvider implements AltVM.IProvider<EncodeObject> {
353365 } ;
354366 }
355367
368+ async getNoopHook ( req : AltVM . ReqGetNoopHook ) : Promise < AltVM . ResGetNoopHook > {
369+ const { noop_hook } = await this . query . postDispatch . NoopHook ( {
370+ id : req . hookAddress ,
371+ } ) ;
372+ assert ( noop_hook , `found no noop hook for id ${ req . hookAddress } ` ) ;
373+
374+ return {
375+ address : noop_hook . id ,
376+ } ;
377+ }
378+
356379 // ### QUERY WARP ###
357380
358381 async getToken ( req : AltVM . ReqGetToken ) : Promise < AltVM . ResGetToken > {
@@ -447,7 +470,6 @@ export class CosmosNativeProvider implements AltVM.IProvider<EncodeObject> {
447470 typeUrl : R . MsgCreateMailbox . proto . type ,
448471 value : R . MsgCreateMailbox . proto . converter . create ( {
449472 local_domain : req . domainId ,
450- default_ism : req . defaultIsmAddress ,
451473 owner : req . signer ,
452474 } ) ,
453475 } ;
@@ -660,16 +682,41 @@ export class CosmosNativeProvider implements AltVM.IProvider<EncodeObject> {
660682 } ;
661683 }
662684
685+ async getRemoveDestinationGasConfigTransaction (
686+ _req : AltVM . ReqRemoveDestinationGasConfig ,
687+ ) : Promise < EncodeObject > {
688+ throw new Error (
689+ `RemoveDestinationGasConfig is currently not supported on Cosmos Native` ,
690+ ) ;
691+ }
692+
693+ async getCreateNoopHookTransaction (
694+ req : AltVM . ReqCreateNoopHook ,
695+ ) : Promise < MsgCreateNoopHookEncodeObject > {
696+ return {
697+ typeUrl : R . MsgCreateNoopHook . proto . type ,
698+ value : R . MsgCreateNoopHook . proto . converter . create ( {
699+ owner : req . signer ,
700+ } ) ,
701+ } ;
702+ }
703+
663704 async getCreateValidatorAnnounceTransaction (
664705 _req : AltVM . ReqCreateValidatorAnnounce ,
665- ) : Promise < any > {
706+ ) : Promise < EncodeObject > {
666707 throw new Error (
667708 'Cosmos Native does not support populateCreateValidatorAnnounce' ,
668709 ) ;
669710 }
670711
671712 // ### GET WARP TXS ###
672713
714+ async getCreateNativeTokenTransaction (
715+ _req : AltVM . ReqCreateNativeToken ,
716+ ) : Promise < EncodeObject > {
717+ throw new Error ( `Native Token is not supported on Cosmos Native` ) ;
718+ }
719+
673720 async getCreateCollateralTokenTransaction (
674721 req : AltVM . ReqCreateCollateralToken ,
675722 ) : Promise < MsgCreateCollateralTokenEncodeObject > {
@@ -755,6 +802,8 @@ export class CosmosNativeProvider implements AltVM.IProvider<EncodeObject> {
755802 async getTransferTransaction (
756803 req : AltVM . ReqTransfer ,
757804 ) : Promise < MsgSendEncodeObject > {
805+ assert ( req . denom , `denom required by ${ CosmosNativeProvider . name } ` ) ;
806+
758807 return {
759808 typeUrl : '/cosmos.bank.v1beta1.MsgSend' ,
760809 value : {
0 commit comments