From 6e28131a8b9ab53ad1330c61df64d3b7fb799652 Mon Sep 17 00:00:00 2001 From: "moxey.eth" Date: Tue, 7 May 2024 09:51:21 +1000 Subject: [PATCH] fix: `wallet_sendCalls` types --- .changeset/witty-fans-worry.md | 5 +++++ src/types/eip1193.ts | 21 +++++++++++++-------- src/types/transaction.ts | 2 +- 3 files changed, 19 insertions(+), 9 deletions(-) create mode 100644 .changeset/witty-fans-worry.md diff --git a/.changeset/witty-fans-worry.md b/.changeset/witty-fans-worry.md new file mode 100644 index 0000000000..f4fb18b306 --- /dev/null +++ b/.changeset/witty-fans-worry.md @@ -0,0 +1,5 @@ +--- +"viem": patch +--- + +Fixed types for `wallet_sendCalls`. diff --git a/src/types/eip1193.ts b/src/types/eip1193.ts index 84584249bd..caf2e8eb5f 100644 --- a/src/types/eip1193.ts +++ b/src/types/eip1193.ts @@ -16,7 +16,7 @@ import type { RpcTransactionRequest as TransactionRequest, RpcUncle as Uncle, } from './rpc.js' -import type { ExactPartial, Prettify } from './utils.js' +import type { ExactPartial, OneOf, Prettify } from './utils.js' ////////////////////////////////////////////////// // Provider @@ -155,15 +155,20 @@ export type WalletSendCallsParameters< quantity extends Quantity | bigint = Quantity, > = [ { - version: string + calls: OneOf< + | { + to: Address + data?: Hex | undefined + value?: quantity | undefined + } + | { + data: Hex + } + >[] + capabilities?: capabilities | undefined chainId: chainId from: Address - calls: { - to: Address - data: Hex - value: quantity - }[] - capabilities?: capabilities | undefined + version: string }, ] diff --git a/src/types/transaction.ts b/src/types/transaction.ts index 4746b961c3..ff6f07ca3b 100644 --- a/src/types/transaction.ts +++ b/src/types/transaction.ts @@ -157,7 +157,7 @@ export type TransactionEIP4844< /** EIP-2930 Access List. */ accessList: AccessList /** List of versioned blob hashes associated with the transaction's blobs. */ - blobVersionedHashes: Hex[] + blobVersionedHashes: readonly Hex[] /** Chain ID that this transaction is valid on. */ chainId: TIndex type: TType