wallet_sendPreparedCalls
Executes a signed and prepared call bundle.
Request
type Request = {
method: 'wallet_sendPreparedCalls',
params: [{
/** Chain ID to send the calls to. */
chainId: `0x${string}`;
/** Data to be forwarded from `wallet_prepareCalls`. */
context: { quote: unknown };
/** Key that signed the digest and produced the signature. */
key: {
publicKey: `0x${string}`;
type: 'address' | 'secp256k1' | 'p256' | 'webauthn-256';
};
/** Signature. */
signature: `0x${string}`;
}]
}
Response
type Response = {
/** ID of the bundle. */
id: string;
}[]
Example
import { Porto } from 'porto'
import { PublicKey, Signature, WebCryptoP256 } from 'ox'
const { provider } = Porto.create()
const { publicKey, privateKey } = await WebCryptoP256.createKeyPair()
const { digest, ...request } = await provider.request({
method: 'wallet_prepareCalls',
params: [{
calls: [{
to: '0xcafebabecafebabecafebabecafebabecafebabe',
value: '0x12345678',
}],
key: {
publicKey: PublicKey.toHex(publicKey),
type: 'p256'
}
}]
})
const signature = await WebCryptoP256.sign({
payload: digest,
privateKey,
})
const response = await provider.request({
method: 'wallet_sendPreparedCalls',
params: [{
...request,
signature: Signature.toHex(signature)
}]
})