Skip to content

Commit 2e0d110

Browse files
committed
fix(relayer): wrap feeOptions calldata for simulation
1 parent 6ab2179 commit 2e0d110

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

  • packages/services/relayer/src/relayer/rpc-relayer

packages/services/relayer/src/relayer/rpc-relayer/index.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff 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
)

0 commit comments

Comments
 (0)