Skip to content

Commit 777fa34

Browse files
committed
fix: wallet_watchAsset type
1 parent 72122f1 commit 777fa34

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

.changeset/chilled-nails-rhyme.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"viem": patch
3+
---
4+
5+
Fixed wallet_watchAsset type.

src/actions/wallet/watchAsset.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export async function watchAsset<
4242
): Promise<WatchAssetReturnType> {
4343
const added = await client.request({
4444
method: 'wallet_watchAsset',
45-
params: [params],
45+
params,
4646
})
4747
return added
4848
}

src/types/eip1193.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ export type WatchAssetParams = {
126126
/** The number of token decimals */
127127
decimals: number
128128
/** A string url of the token logo */
129-
image: string
129+
image?: string
130130
}
131131
}
132132

@@ -1049,7 +1049,7 @@ export type WalletRequests = {
10491049
* */
10501050
request(args: {
10511051
method: 'wallet_watchAsset'
1052-
params: [WatchAssetParams]
1052+
params: WatchAssetParams
10531053
}): Promise<boolean>
10541054
}
10551055

src/utils/rpc.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ type Subscription<TResult, TError> = {
3838
)
3939
}
4040

41-
type RpcRequest = { method: string; params?: any[] }
41+
type RpcRequest = { method: string; params?: any }
4242

4343
export type RpcResponse<TResult = any, TError = any> = {
4444
jsonrpc: `${number}`

0 commit comments

Comments
 (0)