@vlayer/sdk 0.1.0-nightly-20241022-004c3c4 → 0.1.0-nightly-20241023-a7e98bb
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +1 -1
- package/src/api/helpers.ts +7 -7
package/package.json
CHANGED
package/src/api/helpers.ts
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
import {
|
2
2
|
type Abi,
|
3
3
|
type Address,
|
4
|
+
type Chain,
|
4
5
|
type ContractFunctionArgs,
|
5
6
|
type ContractFunctionName,
|
6
7
|
createTestClient,
|
@@ -132,20 +133,19 @@ export async function writeContract<
|
|
132
133
|
functionName: F,
|
133
134
|
args: ContractFunctionArgs<T, "payable" | "nonpayable", F>,
|
134
135
|
sender?: Address,
|
135
|
-
|
136
|
+
chain: Chain = foundry,
|
136
137
|
) {
|
137
|
-
const ethClient = createAnvilClient(
|
138
|
+
const ethClient = createAnvilClient(chain.id);
|
138
139
|
const selectedSender = sender || (await ethClient.getAddresses())[0];
|
139
140
|
|
140
141
|
const txHash = await ethClient.writeContract({
|
141
|
-
abi,
|
142
|
+
abi: abi as Abi,
|
142
143
|
address,
|
143
144
|
functionName,
|
144
|
-
args,
|
145
|
+
args: args as readonly unknown[],
|
146
|
+
chain,
|
145
147
|
account: selectedSender,
|
146
|
-
|
147
|
-
} as any);
|
148
|
-
// TODO: fix any to viem type
|
148
|
+
});
|
149
149
|
|
150
150
|
const txReceipt = await ethClient.waitForTransactionReceipt({ hash: txHash });
|
151
151
|
|