Skip to content

Commit c499b22

Browse files
committed
add writeContract
1 parent ea9a428 commit c499b22

File tree

8 files changed

+238
-1252
lines changed

8 files changed

+238
-1252
lines changed

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Simple WalletConnect v2 integration package for Vue3 apps.
1515
- [Connect wallet button](#connect-wallet-button)
1616
- [Multicall](#multicall)
1717
- [ReadContract](#readcontract)
18+
- [WriteContract](#writecontract)
1819
- [Demo](#demo)
1920
- [Example](#example)
2021
- [Faq](#faq)
@@ -123,6 +124,18 @@ let data = await readContract({
123124
*/
124125
```
125126

127+
## WriteContract
128+
129+
```js
130+
import {erc20ABI, writeContract} from '@kolirt/vue-web3-auth'
131+
132+
let data = await writeContract({
133+
abi: erc20ABI,
134+
address: '0x55d398326f99059fF775485246999027B3197955',
135+
functionName: 'approve',
136+
args: ['0x685B1ded8013785d6623CC18D214320b6Bb64759', 100]
137+
})
138+
```
126139

127140
# Demo
128141
[Demo here](https://kolirt.github.io/vue-web3-auth/).

dist/vue-web3-auth.d.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,15 @@ export declare function createWeb3Auth(options: Options): Plugin_2;
3030
export declare function disconnect(): Promise<void>;
3131

3232
export declare const erc20ABI: ({
33-
inputs: never[];
34-
payable: boolean;
33+
inputs: {
34+
internalType: string;
35+
name: string;
36+
type: string;
37+
}[];
3538
stateMutability: string;
3639
type: string;
3740
anonymous?: undefined;
3841
name?: undefined;
39-
constant?: undefined;
4042
outputs?: undefined;
4143
} | {
4244
anonymous: boolean;
@@ -48,12 +50,9 @@ export declare const erc20ABI: ({
4850
}[];
4951
name: string;
5052
type: string;
51-
payable?: undefined;
5253
stateMutability?: undefined;
53-
constant?: undefined;
5454
outputs?: undefined;
5555
} | {
56-
constant: boolean;
5756
inputs: {
5857
internalType: string;
5958
name: string;
@@ -65,7 +64,6 @@ export declare const erc20ABI: ({
6564
name: string;
6665
type: string;
6766
}[];
68-
payable: boolean;
6967
stateMutability: string;
7068
type: string;
7169
anonymous?: undefined;
@@ -133,7 +131,7 @@ declare type MulticallArgs = {
133131
});
134132

135133
declare type MulticallContract = {
136-
abi: {};
134+
abi: any;
137135
contractAddress: string;
138136
calls: [string, Array<any>?][];
139137
};
@@ -150,7 +148,7 @@ export declare type Options = {
150148
};
151149

152150
declare type ReadContract = {
153-
chain?: number;
151+
chainId?: number;
154152
address: `0x${string}`;
155153
abi: any;
156154
functionName: string;

0 commit comments

Comments
 (0)