File tree Expand file tree Collapse file tree
packages/services/relayer/src/relayer/rpc-relayer Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -137,15 +137,23 @@ export class RpcRelayer implements Relayer {
137137 to : Address . Address ,
138138 calls : Payload . Call [ ] ,
139139 ) : Promise < { options : FeeOption [ ] ; quote ?: FeeQuote } > {
140+ // NOTE: The relayer backend simulates a call to `to` with calldata `data`.
141+ // For undeployed wallets, `to` may be the guest module, so `data` must be valid
142+ // calldata for the guest module (i.e. execute(payload, stubSig)), not the raw
143+ // v3 payload bytes.
140144 const callsStruct : Payload . Calls = { type : 'call' , space : 0n , nonce : 0n , calls : calls }
141- const data = Payload . encode ( callsStruct )
145+
146+ const execute = AbiFunction . from ( 'function execute(bytes calldata _payload, bytes calldata _signature)' )
147+ const payload = Payload . encode ( callsStruct , to )
148+ const stubSignature = '0x0001'
149+ const data = AbiFunction . encodeData ( execute , [ Bytes . toHex ( payload ) , stubSignature ] )
142150
143151 try {
144152 const result = await this . client . feeOptions (
145153 {
146154 wallet,
147155 to,
148- data : Bytes . toHex ( data ) ,
156+ data,
149157 } ,
150158 { ...( this . projectAccessKey ? { 'X-Access-Key' : this . projectAccessKey } : undefined ) } ,
151159 )
You can’t perform that action at this time.
0 commit comments