@@ -52,12 +52,17 @@ type InternalAccount = {
5252} ;
5353
5454type SnapKeyring = {
55- submitRequest : ( request : Record < string , Json > ) => Promise < Json > ;
56- resolveAccountAddress : ( options : {
57- snapId : SnapId ;
55+ submitRequest : ( request : {
56+ id : string ;
57+ method : string ;
58+ params ?: Json [ ] | Record < string , Json > ;
5859 scope : Caip2ChainId ;
59- request : Json ;
60- } ) => Promise < { address : CaipAccountId } | null > ;
60+ } ) => Promise < Json > ;
61+ resolveAccountAddress : (
62+ snapId : SnapId ,
63+ scope : Caip2ChainId ,
64+ request : Json ,
65+ ) => Promise < { address : CaipAccountId } | null > ;
6166} ;
6267
6368// Expecting a bound function that calls KeyringController.withKeyring selecting the Snap keyring
@@ -140,13 +145,8 @@ export class MultichainRouter {
140145 request : JsonRpcRequest ,
141146 ) {
142147 try {
143- // TODO: Decide if we should call this using another abstraction.
144148 const result = ( await this . #withSnapKeyring( async ( keyring ) =>
145- keyring . resolveAccountAddress ( {
146- snapId,
147- request,
148- scope,
149- } ) ,
149+ keyring . resolveAccountAddress ( snapId , scope , request ) ,
150150 ) ) as { address : CaipAccountId } | null ;
151151 const address = result ?. address ;
152152 return address ? parseCaipAccountId ( address ) . address : null ;
@@ -263,15 +263,12 @@ export class MultichainRouter {
263263 request ,
264264 ) ;
265265 if ( accountSnap ) {
266- // TODO: Decide on API for this.
267266 return this . #withSnapKeyring( async ( keyring ) =>
268267 keyring . submitRequest ( {
269268 id : accountSnap . accountId ,
270269 scope,
271- request : {
272- method,
273- params : params as JsonRpcParams ,
274- } ,
270+ method,
271+ params : params as JsonRpcParams ,
275272 } ) ,
276273 ) ;
277274 }
0 commit comments