viem 2.44.1 → 2.44.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -0
- package/_cjs/actions/wallet/sendTransaction.js +6 -5
- package/_cjs/actions/wallet/sendTransaction.js.map +1 -1
- package/_cjs/actions/wallet/sendTransactionSync.js +6 -5
- package/_cjs/actions/wallet/sendTransactionSync.js.map +1 -1
- package/_cjs/chains/definitions/adi.js +26 -0
- package/_cjs/chains/definitions/adi.js.map +1 -0
- package/_cjs/chains/definitions/tempo.js +28 -0
- package/_cjs/chains/definitions/tempo.js.map +1 -0
- package/_cjs/chains/definitions/zkXPLA.js +28 -0
- package/_cjs/chains/definitions/zkXPLA.js.map +1 -0
- package/_cjs/chains/definitions/zkXPLATestnet.js +28 -0
- package/_cjs/chains/definitions/zkXPLATestnet.js.map +1 -0
- package/_cjs/chains/index.js +22 -14
- package/_cjs/chains/index.js.map +1 -1
- package/_cjs/errors/version.js +1 -1
- package/_cjs/tempo/Abis.js +2 -2
- package/_cjs/tempo/Abis.js.map +1 -1
- package/_cjs/tempo/Addresses.js +2 -1
- package/_cjs/tempo/Addresses.js.map +1 -1
- package/_cjs/tempo/Decorator.js +19 -0
- package/_cjs/tempo/Decorator.js.map +1 -1
- package/_cjs/tempo/Transport.js +1 -1
- package/_cjs/tempo/Transport.js.map +1 -1
- package/_cjs/tempo/actions/fee.js +91 -0
- package/_cjs/tempo/actions/fee.js.map +1 -1
- package/_cjs/tempo/actions/index.js +2 -1
- package/_cjs/tempo/actions/index.js.map +1 -1
- package/_cjs/tempo/actions/validator.js +308 -0
- package/_cjs/tempo/actions/validator.js.map +1 -0
- package/_cjs/utils/abi/decodeEventLog.js +29 -12
- package/_cjs/utils/abi/decodeEventLog.js.map +1 -1
- package/_cjs/utils/encoding/fromHex.js +11 -1
- package/_cjs/utils/encoding/fromHex.js.map +1 -1
- package/_cjs/utils/rpc/http.js +25 -1
- package/_cjs/utils/rpc/http.js.map +1 -1
- package/_esm/actions/wallet/sendTransaction.js +6 -5
- package/_esm/actions/wallet/sendTransaction.js.map +1 -1
- package/_esm/actions/wallet/sendTransactionSync.js +6 -5
- package/_esm/actions/wallet/sendTransactionSync.js.map +1 -1
- package/_esm/chains/definitions/adi.js +23 -0
- package/_esm/chains/definitions/adi.js.map +1 -0
- package/_esm/chains/definitions/tempo.js +25 -0
- package/_esm/chains/definitions/tempo.js.map +1 -0
- package/_esm/chains/definitions/zkXPLA.js +25 -0
- package/_esm/chains/definitions/zkXPLA.js.map +1 -0
- package/_esm/chains/definitions/zkXPLATestnet.js +25 -0
- package/_esm/chains/definitions/zkXPLATestnet.js.map +1 -0
- package/_esm/chains/index.js +4 -0
- package/_esm/chains/index.js.map +1 -1
- package/_esm/errors/version.js +1 -1
- package/_esm/tempo/Abis.js +1 -1
- package/_esm/tempo/Abis.js.map +1 -1
- package/_esm/tempo/Account.js +6 -6
- package/_esm/tempo/Addresses.js +1 -0
- package/_esm/tempo/Addresses.js.map +1 -1
- package/_esm/tempo/Decorator.js +19 -0
- package/_esm/tempo/Decorator.js.map +1 -1
- package/_esm/tempo/Transport.js +1 -1
- package/_esm/tempo/Transport.js.map +1 -1
- package/_esm/tempo/WebAuthnP256.js +2 -2
- package/_esm/tempo/actions/amm.js +28 -28
- package/_esm/tempo/actions/dex.js +68 -68
- package/_esm/tempo/actions/faucet.js +4 -4
- package/_esm/tempo/actions/fee.js +236 -10
- package/_esm/tempo/actions/fee.js.map +1 -1
- package/_esm/tempo/actions/index.js +1 -0
- package/_esm/tempo/actions/index.js.map +1 -1
- package/_esm/tempo/actions/nonce.js +4 -4
- package/_esm/tempo/actions/policy.js +36 -36
- package/_esm/tempo/actions/reward.js +28 -28
- package/_esm/tempo/actions/token.js +122 -122
- package/_esm/tempo/actions/validator.js +1017 -0
- package/_esm/tempo/actions/validator.js.map +1 -0
- package/_esm/utils/abi/decodeEventLog.js +34 -13
- package/_esm/utils/abi/decodeEventLog.js.map +1 -1
- package/_esm/utils/encoding/fromHex.js +12 -2
- package/_esm/utils/encoding/fromHex.js.map +1 -1
- package/_esm/utils/rpc/http.js +26 -1
- package/_esm/utils/rpc/http.js.map +1 -1
- package/_types/actions/wallet/sendTransaction.d.ts +4 -1
- package/_types/actions/wallet/sendTransaction.d.ts.map +1 -1
- package/_types/actions/wallet/sendTransactionSync.d.ts +2 -0
- package/_types/actions/wallet/sendTransactionSync.d.ts.map +1 -1
- package/_types/chains/definitions/adi.d.ts +48 -0
- package/_types/chains/definitions/adi.d.ts.map +1 -0
- package/_types/chains/definitions/tempo.d.ts +916 -0
- package/_types/chains/definitions/tempo.d.ts.map +1 -0
- package/_types/chains/definitions/zkXPLA.d.ts +50 -0
- package/_types/chains/definitions/zkXPLA.d.ts.map +1 -0
- package/_types/chains/definitions/zkXPLATestnet.d.ts +50 -0
- package/_types/chains/definitions/zkXPLATestnet.d.ts.map +1 -0
- package/_types/chains/index.d.ts +4 -0
- package/_types/chains/index.d.ts.map +1 -1
- package/_types/errors/version.d.ts +1 -1
- package/_types/tempo/Abis.d.ts +1 -1
- package/_types/tempo/Abis.d.ts.map +1 -1
- package/_types/tempo/Account.d.ts +6 -6
- package/_types/tempo/Addresses.d.ts +1 -0
- package/_types/tempo/Addresses.d.ts.map +1 -1
- package/_types/tempo/Decorator.d.ts +607 -208
- package/_types/tempo/Decorator.d.ts.map +1 -1
- package/_types/tempo/Transport.d.ts.map +1 -1
- package/_types/tempo/WebAuthnP256.d.ts +2 -2
- package/_types/tempo/actions/amm.d.ts +28 -28
- package/_types/tempo/actions/dex.d.ts +68 -68
- package/_types/tempo/actions/faucet.d.ts +4 -4
- package/_types/tempo/actions/fee.d.ts +380 -10
- package/_types/tempo/actions/fee.d.ts.map +1 -1
- package/_types/tempo/actions/index.d.ts +1 -0
- package/_types/tempo/actions/index.d.ts.map +1 -1
- package/_types/tempo/actions/nonce.d.ts +4 -4
- package/_types/tempo/actions/policy.d.ts +36 -36
- package/_types/tempo/actions/reward.d.ts +28 -28
- package/_types/tempo/actions/token.d.ts +122 -122
- package/_types/tempo/actions/validator.d.ts +1174 -0
- package/_types/tempo/actions/validator.d.ts.map +1 -0
- package/_types/utils/abi/decodeEventLog.d.ts.map +1 -1
- package/_types/utils/encoding/fromHex.d.ts +2 -2
- package/_types/utils/encoding/fromHex.d.ts.map +1 -1
- package/_types/utils/rpc/http.d.ts +8 -1
- package/_types/utils/rpc/http.d.ts.map +1 -1
- package/actions/wallet/sendTransaction.ts +10 -5
- package/actions/wallet/sendTransactionSync.ts +8 -4
- package/chains/definitions/adi.ts +23 -0
- package/chains/definitions/tempo.ts +25 -0
- package/chains/definitions/zkXPLA.ts +25 -0
- package/chains/definitions/zkXPLATestnet.ts +25 -0
- package/chains/index.ts +4 -0
- package/errors/version.ts +1 -1
- package/package.json +1 -1
- package/tempo/Abis.ts +1 -1
- package/tempo/Account.ts +6 -6
- package/tempo/Addresses.ts +1 -0
- package/tempo/Decorator.ts +672 -208
- package/tempo/Transport.ts +4 -1
- package/tempo/WebAuthnP256.ts +2 -2
- package/tempo/actions/amm.ts +28 -28
- package/tempo/actions/dex.ts +68 -68
- package/tempo/actions/faucet.ts +4 -4
- package/tempo/actions/fee.ts +346 -10
- package/tempo/actions/index.ts +1 -0
- package/tempo/actions/nonce.ts +4 -4
- package/tempo/actions/policy.ts +36 -36
- package/tempo/actions/reward.ts +28 -28
- package/tempo/actions/token.ts +122 -122
- package/tempo/actions/validator.ts +1417 -0
- package/utils/abi/decodeEventLog.ts +38 -14
- package/utils/encoding/fromHex.ts +17 -2
- package/utils/rpc/http.ts +31 -1
|
@@ -0,0 +1,1017 @@
|
|
|
1
|
+
import { readContract } from '../../actions/public/readContract.js';
|
|
2
|
+
import { writeContract } from '../../actions/wallet/writeContract.js';
|
|
3
|
+
import { writeContractSync } from '../../actions/wallet/writeContractSync.js';
|
|
4
|
+
import * as Abis from '../Abis.js';
|
|
5
|
+
import * as Addresses from '../Addresses.js';
|
|
6
|
+
import { defineCall } from '../internal/utils.js';
|
|
7
|
+
/**
|
|
8
|
+
* Adds a new validator (owner only).
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* import { createClient, http } from 'viem'
|
|
13
|
+
* import { tempo } from 'viem/chains'
|
|
14
|
+
* import { Actions } from 'viem/tempo'
|
|
15
|
+
* import { privateKeyToAccount } from 'viem/accounts'
|
|
16
|
+
*
|
|
17
|
+
* const client = createClient({
|
|
18
|
+
* account: privateKeyToAccount('0x...'),
|
|
19
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
|
|
20
|
+
* transport: http(),
|
|
21
|
+
* })
|
|
22
|
+
*
|
|
23
|
+
* const hash = await Actions.validator.add(client, {
|
|
24
|
+
* newValidatorAddress: '0x...',
|
|
25
|
+
* publicKey: '0x...',
|
|
26
|
+
* active: true,
|
|
27
|
+
* inboundAddress: '192.168.1.1:8080',
|
|
28
|
+
* outboundAddress: '192.168.1.1:8080',
|
|
29
|
+
* })
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* @param client - Client.
|
|
33
|
+
* @param parameters - Parameters.
|
|
34
|
+
* @returns The transaction hash.
|
|
35
|
+
*/
|
|
36
|
+
export async function add(client, parameters) {
|
|
37
|
+
return add.inner(writeContract, client, parameters);
|
|
38
|
+
}
|
|
39
|
+
(function (add) {
|
|
40
|
+
/** @internal */
|
|
41
|
+
async function inner(action, client, parameters) {
|
|
42
|
+
const { newValidatorAddress, publicKey, active, inboundAddress, outboundAddress, ...rest } = parameters;
|
|
43
|
+
const callData = add.call({
|
|
44
|
+
newValidatorAddress,
|
|
45
|
+
publicKey,
|
|
46
|
+
active,
|
|
47
|
+
inboundAddress,
|
|
48
|
+
outboundAddress,
|
|
49
|
+
});
|
|
50
|
+
return (await action(client, {
|
|
51
|
+
...rest,
|
|
52
|
+
...callData,
|
|
53
|
+
}));
|
|
54
|
+
}
|
|
55
|
+
add.inner = inner;
|
|
56
|
+
/**
|
|
57
|
+
* Defines a call to the `addValidator` function.
|
|
58
|
+
*
|
|
59
|
+
* Can be passed as a parameter to:
|
|
60
|
+
* - [`estimateContractGas`](https://viem.sh/docs/contract/estimateContractGas): estimate the gas cost of the call
|
|
61
|
+
* - [`simulateContract`](https://viem.sh/docs/contract/simulateContract): simulate the call
|
|
62
|
+
* - [`sendCalls`](https://viem.sh/docs/actions/wallet/sendCalls): send multiple calls
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```ts
|
|
66
|
+
* import { createClient, http, walletActions } from 'viem'
|
|
67
|
+
* import { tempo } from 'viem/chains'
|
|
68
|
+
* import { Actions } from 'viem/tempo'
|
|
69
|
+
*
|
|
70
|
+
* const client = createClient({
|
|
71
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
|
|
72
|
+
* transport: http(),
|
|
73
|
+
* }).extend(walletActions)
|
|
74
|
+
*
|
|
75
|
+
* const { result } = await client.sendCalls({
|
|
76
|
+
* calls: [
|
|
77
|
+
* Actions.validator.add.call({
|
|
78
|
+
* newValidatorAddress: '0x...',
|
|
79
|
+
* publicKey: '0x...',
|
|
80
|
+
* active: true,
|
|
81
|
+
* inboundAddress: '192.168.1.1:8080',
|
|
82
|
+
* outboundAddress: '192.168.1.1:8080',
|
|
83
|
+
* }),
|
|
84
|
+
* ],
|
|
85
|
+
* })
|
|
86
|
+
* ```
|
|
87
|
+
*
|
|
88
|
+
* @param args - Arguments.
|
|
89
|
+
* @returns The call.
|
|
90
|
+
*/
|
|
91
|
+
function call(args) {
|
|
92
|
+
const { newValidatorAddress, publicKey, active, inboundAddress, outboundAddress, } = args;
|
|
93
|
+
return defineCall({
|
|
94
|
+
address: Addresses.validator,
|
|
95
|
+
abi: Abis.validator,
|
|
96
|
+
args: [
|
|
97
|
+
newValidatorAddress,
|
|
98
|
+
publicKey,
|
|
99
|
+
active,
|
|
100
|
+
inboundAddress,
|
|
101
|
+
outboundAddress,
|
|
102
|
+
],
|
|
103
|
+
functionName: 'addValidator',
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
add.call = call;
|
|
107
|
+
})(add || (add = {}));
|
|
108
|
+
/**
|
|
109
|
+
* Adds a new validator (owner only) and waits for the transaction receipt.
|
|
110
|
+
*
|
|
111
|
+
* @example
|
|
112
|
+
* ```ts
|
|
113
|
+
* import { createClient, http } from 'viem'
|
|
114
|
+
* import { tempo } from 'viem/chains'
|
|
115
|
+
* import { Actions } from 'viem/tempo'
|
|
116
|
+
* import { privateKeyToAccount } from 'viem/accounts'
|
|
117
|
+
*
|
|
118
|
+
* const client = createClient({
|
|
119
|
+
* account: privateKeyToAccount('0x...'),
|
|
120
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
|
|
121
|
+
* transport: http(),
|
|
122
|
+
* })
|
|
123
|
+
*
|
|
124
|
+
* const { receipt } = await Actions.validator.addSync(client, {
|
|
125
|
+
* newValidatorAddress: '0x...',
|
|
126
|
+
* publicKey: '0x...',
|
|
127
|
+
* active: true,
|
|
128
|
+
* inboundAddress: '192.168.1.1:8080',
|
|
129
|
+
* outboundAddress: '192.168.1.1:8080',
|
|
130
|
+
* })
|
|
131
|
+
* ```
|
|
132
|
+
*
|
|
133
|
+
* @param client - Client.
|
|
134
|
+
* @param parameters - Parameters.
|
|
135
|
+
* @returns The transaction receipt.
|
|
136
|
+
*/
|
|
137
|
+
export async function addSync(client, parameters) {
|
|
138
|
+
const { throwOnReceiptRevert = true, ...rest } = parameters;
|
|
139
|
+
const receipt = await add.inner(writeContractSync, client, {
|
|
140
|
+
...rest,
|
|
141
|
+
throwOnReceiptRevert,
|
|
142
|
+
});
|
|
143
|
+
return { receipt };
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Changes the owner of the validator config precompile.
|
|
147
|
+
*
|
|
148
|
+
* @example
|
|
149
|
+
* ```ts
|
|
150
|
+
* import { createClient, http } from 'viem'
|
|
151
|
+
* import { tempo } from 'viem/chains'
|
|
152
|
+
* import { Actions } from 'viem/tempo'
|
|
153
|
+
* import { privateKeyToAccount } from 'viem/accounts'
|
|
154
|
+
*
|
|
155
|
+
* const client = createClient({
|
|
156
|
+
* account: privateKeyToAccount('0x...'),
|
|
157
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
|
|
158
|
+
* transport: http(),
|
|
159
|
+
* })
|
|
160
|
+
*
|
|
161
|
+
* const hash = await Actions.validator.changeOwner(client, {
|
|
162
|
+
* newOwner: '0x...',
|
|
163
|
+
* })
|
|
164
|
+
* ```
|
|
165
|
+
*
|
|
166
|
+
* @param client - Client.
|
|
167
|
+
* @param parameters - Parameters.
|
|
168
|
+
* @returns The transaction hash.
|
|
169
|
+
*/
|
|
170
|
+
export async function changeOwner(client, parameters) {
|
|
171
|
+
return changeOwner.inner(writeContract, client, parameters);
|
|
172
|
+
}
|
|
173
|
+
(function (changeOwner) {
|
|
174
|
+
/** @internal */
|
|
175
|
+
async function inner(action, client, parameters) {
|
|
176
|
+
const { newOwner, ...rest } = parameters;
|
|
177
|
+
const callData = changeOwner.call({ newOwner });
|
|
178
|
+
return (await action(client, {
|
|
179
|
+
...rest,
|
|
180
|
+
...callData,
|
|
181
|
+
}));
|
|
182
|
+
}
|
|
183
|
+
changeOwner.inner = inner;
|
|
184
|
+
/**
|
|
185
|
+
* Defines a call to the `changeOwner` function.
|
|
186
|
+
*
|
|
187
|
+
* Can be passed as a parameter to:
|
|
188
|
+
* - [`estimateContractGas`](https://viem.sh/docs/contract/estimateContractGas): estimate the gas cost of the call
|
|
189
|
+
* - [`simulateContract`](https://viem.sh/docs/contract/simulateContract): simulate the call
|
|
190
|
+
* - [`sendCalls`](https://viem.sh/docs/actions/wallet/sendCalls): send multiple calls
|
|
191
|
+
*
|
|
192
|
+
* @example
|
|
193
|
+
* ```ts
|
|
194
|
+
* import { createClient, http, walletActions } from 'viem'
|
|
195
|
+
* import { tempo } from 'viem/chains'
|
|
196
|
+
* import { Actions } from 'viem/tempo'
|
|
197
|
+
*
|
|
198
|
+
* const client = createClient({
|
|
199
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
|
|
200
|
+
* transport: http(),
|
|
201
|
+
* }).extend(walletActions)
|
|
202
|
+
*
|
|
203
|
+
* const { result } = await client.sendCalls({
|
|
204
|
+
* calls: [
|
|
205
|
+
* Actions.validator.changeOwner.call({
|
|
206
|
+
* newOwner: '0x...',
|
|
207
|
+
* }),
|
|
208
|
+
* ],
|
|
209
|
+
* })
|
|
210
|
+
* ```
|
|
211
|
+
*
|
|
212
|
+
* @param args - Arguments.
|
|
213
|
+
* @returns The call.
|
|
214
|
+
*/
|
|
215
|
+
function call(args) {
|
|
216
|
+
const { newOwner } = args;
|
|
217
|
+
return defineCall({
|
|
218
|
+
address: Addresses.validator,
|
|
219
|
+
abi: Abis.validator,
|
|
220
|
+
args: [newOwner],
|
|
221
|
+
functionName: 'changeOwner',
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
changeOwner.call = call;
|
|
225
|
+
})(changeOwner || (changeOwner = {}));
|
|
226
|
+
/**
|
|
227
|
+
* Changes the owner and waits for the transaction receipt.
|
|
228
|
+
*
|
|
229
|
+
* @example
|
|
230
|
+
* ```ts
|
|
231
|
+
* import { createClient, http } from 'viem'
|
|
232
|
+
* import { tempo } from 'viem/chains'
|
|
233
|
+
* import { Actions } from 'viem/tempo'
|
|
234
|
+
* import { privateKeyToAccount } from 'viem/accounts'
|
|
235
|
+
*
|
|
236
|
+
* const client = createClient({
|
|
237
|
+
* account: privateKeyToAccount('0x...'),
|
|
238
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
|
|
239
|
+
* transport: http(),
|
|
240
|
+
* })
|
|
241
|
+
*
|
|
242
|
+
* const { receipt } = await Actions.validator.changeOwnerSync(client, {
|
|
243
|
+
* newOwner: '0x...',
|
|
244
|
+
* })
|
|
245
|
+
* ```
|
|
246
|
+
*
|
|
247
|
+
* @param client - Client.
|
|
248
|
+
* @param parameters - Parameters.
|
|
249
|
+
* @returns The transaction receipt.
|
|
250
|
+
*/
|
|
251
|
+
export async function changeOwnerSync(client, parameters) {
|
|
252
|
+
const { throwOnReceiptRevert = true, ...rest } = parameters;
|
|
253
|
+
const receipt = await changeOwner.inner(writeContractSync, client, {
|
|
254
|
+
...rest,
|
|
255
|
+
throwOnReceiptRevert,
|
|
256
|
+
});
|
|
257
|
+
return { receipt };
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Changes validator active status (owner only).
|
|
261
|
+
*
|
|
262
|
+
* @example
|
|
263
|
+
* ```ts
|
|
264
|
+
* import { createClient, http } from 'viem'
|
|
265
|
+
* import { tempo } from 'viem/chains'
|
|
266
|
+
* import { Actions } from 'viem/tempo'
|
|
267
|
+
* import { privateKeyToAccount } from 'viem/accounts'
|
|
268
|
+
*
|
|
269
|
+
* const client = createClient({
|
|
270
|
+
* account: privateKeyToAccount('0x...'),
|
|
271
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
|
|
272
|
+
* transport: http(),
|
|
273
|
+
* })
|
|
274
|
+
*
|
|
275
|
+
* const hash = await Actions.validator.changeStatus(client, {
|
|
276
|
+
* validator: '0x...',
|
|
277
|
+
* active: false,
|
|
278
|
+
* })
|
|
279
|
+
* ```
|
|
280
|
+
*
|
|
281
|
+
* @param client - Client.
|
|
282
|
+
* @param parameters - Parameters.
|
|
283
|
+
* @returns The transaction hash.
|
|
284
|
+
*/
|
|
285
|
+
export async function changeStatus(client, parameters) {
|
|
286
|
+
return changeStatus.inner(writeContract, client, parameters);
|
|
287
|
+
}
|
|
288
|
+
(function (changeStatus) {
|
|
289
|
+
/** @internal */
|
|
290
|
+
async function inner(action, client, parameters) {
|
|
291
|
+
const { validator, active, ...rest } = parameters;
|
|
292
|
+
const callData = changeStatus.call({ validator, active });
|
|
293
|
+
return (await action(client, {
|
|
294
|
+
...rest,
|
|
295
|
+
...callData,
|
|
296
|
+
}));
|
|
297
|
+
}
|
|
298
|
+
changeStatus.inner = inner;
|
|
299
|
+
/**
|
|
300
|
+
* Defines a call to the `changeValidatorStatus` function.
|
|
301
|
+
*
|
|
302
|
+
* Can be passed as a parameter to:
|
|
303
|
+
* - [`estimateContractGas`](https://viem.sh/docs/contract/estimateContractGas): estimate the gas cost of the call
|
|
304
|
+
* - [`simulateContract`](https://viem.sh/docs/contract/simulateContract): simulate the call
|
|
305
|
+
* - [`sendCalls`](https://viem.sh/docs/actions/wallet/sendCalls): send multiple calls
|
|
306
|
+
*
|
|
307
|
+
* @example
|
|
308
|
+
* ```ts
|
|
309
|
+
* import { createClient, http, walletActions } from 'viem'
|
|
310
|
+
* import { tempo } from 'viem/chains'
|
|
311
|
+
* import { Actions } from 'viem/tempo'
|
|
312
|
+
*
|
|
313
|
+
* const client = createClient({
|
|
314
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
|
|
315
|
+
* transport: http(),
|
|
316
|
+
* }).extend(walletActions)
|
|
317
|
+
*
|
|
318
|
+
* const { result } = await client.sendCalls({
|
|
319
|
+
* calls: [
|
|
320
|
+
* Actions.validator.changeStatus.call({
|
|
321
|
+
* validator: '0x...',
|
|
322
|
+
* active: false,
|
|
323
|
+
* }),
|
|
324
|
+
* ],
|
|
325
|
+
* })
|
|
326
|
+
* ```
|
|
327
|
+
*
|
|
328
|
+
* @param args - Arguments.
|
|
329
|
+
* @returns The call.
|
|
330
|
+
*/
|
|
331
|
+
function call(args) {
|
|
332
|
+
const { validator, active } = args;
|
|
333
|
+
return defineCall({
|
|
334
|
+
address: Addresses.validator,
|
|
335
|
+
abi: Abis.validator,
|
|
336
|
+
args: [validator, active],
|
|
337
|
+
functionName: 'changeValidatorStatus',
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
changeStatus.call = call;
|
|
341
|
+
})(changeStatus || (changeStatus = {}));
|
|
342
|
+
/**
|
|
343
|
+
* Changes validator active status and waits for the transaction receipt.
|
|
344
|
+
*
|
|
345
|
+
* @example
|
|
346
|
+
* ```ts
|
|
347
|
+
* import { createClient, http } from 'viem'
|
|
348
|
+
* import { tempo } from 'viem/chains'
|
|
349
|
+
* import { Actions } from 'viem/tempo'
|
|
350
|
+
* import { privateKeyToAccount } from 'viem/accounts'
|
|
351
|
+
*
|
|
352
|
+
* const client = createClient({
|
|
353
|
+
* account: privateKeyToAccount('0x...'),
|
|
354
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
|
|
355
|
+
* transport: http(),
|
|
356
|
+
* })
|
|
357
|
+
*
|
|
358
|
+
* const { receipt } = await Actions.validator.changeStatusSync(client, {
|
|
359
|
+
* validator: '0x...',
|
|
360
|
+
* active: false,
|
|
361
|
+
* })
|
|
362
|
+
* ```
|
|
363
|
+
*
|
|
364
|
+
* @param client - Client.
|
|
365
|
+
* @param parameters - Parameters.
|
|
366
|
+
* @returns The transaction receipt.
|
|
367
|
+
*/
|
|
368
|
+
export async function changeStatusSync(client, parameters) {
|
|
369
|
+
const { throwOnReceiptRevert = true, ...rest } = parameters;
|
|
370
|
+
const receipt = await changeStatus.inner(writeContractSync, client, {
|
|
371
|
+
...rest,
|
|
372
|
+
throwOnReceiptRevert,
|
|
373
|
+
});
|
|
374
|
+
return { receipt };
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* Gets the next epoch for a full DKG ceremony.
|
|
378
|
+
*
|
|
379
|
+
* @example
|
|
380
|
+
* ```ts
|
|
381
|
+
* import { createClient, http } from 'viem'
|
|
382
|
+
* import { tempo } from 'viem/chains'
|
|
383
|
+
* import { Actions } from 'viem/tempo'
|
|
384
|
+
*
|
|
385
|
+
* const client = createClient({
|
|
386
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
|
|
387
|
+
* transport: http(),
|
|
388
|
+
* })
|
|
389
|
+
*
|
|
390
|
+
* const epoch = await Actions.validator.getNextFullDkgCeremony(client)
|
|
391
|
+
* ```
|
|
392
|
+
*
|
|
393
|
+
* @param client - Client.
|
|
394
|
+
* @param parameters - Parameters.
|
|
395
|
+
* @returns The epoch number for the next full DKG ceremony.
|
|
396
|
+
*/
|
|
397
|
+
export async function getNextFullDkgCeremony(client, parameters = {}) {
|
|
398
|
+
return readContract(client, {
|
|
399
|
+
...parameters,
|
|
400
|
+
...getNextFullDkgCeremony.call(),
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
(function (getNextFullDkgCeremony) {
|
|
404
|
+
/**
|
|
405
|
+
* Defines a call to the `getNextFullDkgCeremony` function.
|
|
406
|
+
*
|
|
407
|
+
* Can be passed as a parameter to:
|
|
408
|
+
* - [`estimateContractGas`](https://viem.sh/docs/contract/estimateContractGas): estimate the gas cost of the call
|
|
409
|
+
* - [`simulateContract`](https://viem.sh/docs/contract/simulateContract): simulate the call
|
|
410
|
+
* - [`multicall`](https://viem.sh/docs/contract/multicall): execute multiple calls in parallel
|
|
411
|
+
*
|
|
412
|
+
* @example
|
|
413
|
+
* ```ts
|
|
414
|
+
* import { createClient, http } from 'viem'
|
|
415
|
+
* import { tempo } from 'viem/chains'
|
|
416
|
+
* import { Actions } from 'viem/tempo'
|
|
417
|
+
*
|
|
418
|
+
* const client = createClient({
|
|
419
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
|
|
420
|
+
* transport: http(),
|
|
421
|
+
* })
|
|
422
|
+
*
|
|
423
|
+
* const result = await client.multicall({
|
|
424
|
+
* contracts: [Actions.validator.getNextFullDkgCeremony.call()],
|
|
425
|
+
* })
|
|
426
|
+
* ```
|
|
427
|
+
*
|
|
428
|
+
* @returns The call.
|
|
429
|
+
*/
|
|
430
|
+
function call() {
|
|
431
|
+
return defineCall({
|
|
432
|
+
address: Addresses.validator,
|
|
433
|
+
abi: Abis.validator,
|
|
434
|
+
args: [],
|
|
435
|
+
functionName: 'getNextFullDkgCeremony',
|
|
436
|
+
});
|
|
437
|
+
}
|
|
438
|
+
getNextFullDkgCeremony.call = call;
|
|
439
|
+
})(getNextFullDkgCeremony || (getNextFullDkgCeremony = {}));
|
|
440
|
+
/**
|
|
441
|
+
* Gets the contract owner.
|
|
442
|
+
*
|
|
443
|
+
* @example
|
|
444
|
+
* ```ts
|
|
445
|
+
* import { createClient, http } from 'viem'
|
|
446
|
+
* import { tempo } from 'viem/chains'
|
|
447
|
+
* import { Actions } from 'viem/tempo'
|
|
448
|
+
*
|
|
449
|
+
* const client = createClient({
|
|
450
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
|
|
451
|
+
* transport: http(),
|
|
452
|
+
* })
|
|
453
|
+
*
|
|
454
|
+
* const owner = await Actions.validator.getOwner(client)
|
|
455
|
+
* ```
|
|
456
|
+
*
|
|
457
|
+
* @param client - Client.
|
|
458
|
+
* @param parameters - Parameters.
|
|
459
|
+
* @returns The owner address.
|
|
460
|
+
*/
|
|
461
|
+
export async function getOwner(client, parameters = {}) {
|
|
462
|
+
return readContract(client, {
|
|
463
|
+
...parameters,
|
|
464
|
+
...getOwner.call(),
|
|
465
|
+
});
|
|
466
|
+
}
|
|
467
|
+
(function (getOwner) {
|
|
468
|
+
/**
|
|
469
|
+
* Defines a call to the `owner` function.
|
|
470
|
+
*
|
|
471
|
+
* Can be passed as a parameter to:
|
|
472
|
+
* - [`estimateContractGas`](https://viem.sh/docs/contract/estimateContractGas): estimate the gas cost of the call
|
|
473
|
+
* - [`simulateContract`](https://viem.sh/docs/contract/simulateContract): simulate the call
|
|
474
|
+
* - [`multicall`](https://viem.sh/docs/contract/multicall): execute multiple calls in parallel
|
|
475
|
+
*
|
|
476
|
+
* @example
|
|
477
|
+
* ```ts
|
|
478
|
+
* import { createClient, http } from 'viem'
|
|
479
|
+
* import { tempo } from 'viem/chains'
|
|
480
|
+
* import { Actions } from 'viem/tempo'
|
|
481
|
+
*
|
|
482
|
+
* const client = createClient({
|
|
483
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
|
|
484
|
+
* transport: http(),
|
|
485
|
+
* })
|
|
486
|
+
*
|
|
487
|
+
* const result = await client.multicall({
|
|
488
|
+
* contracts: [Actions.validator.getOwner.call()],
|
|
489
|
+
* })
|
|
490
|
+
* ```
|
|
491
|
+
*
|
|
492
|
+
* @returns The call.
|
|
493
|
+
*/
|
|
494
|
+
function call() {
|
|
495
|
+
return defineCall({
|
|
496
|
+
address: Addresses.validator,
|
|
497
|
+
abi: Abis.validator,
|
|
498
|
+
args: [],
|
|
499
|
+
functionName: 'owner',
|
|
500
|
+
});
|
|
501
|
+
}
|
|
502
|
+
getOwner.call = call;
|
|
503
|
+
})(getOwner || (getOwner = {}));
|
|
504
|
+
/**
|
|
505
|
+
* Gets validator information by address.
|
|
506
|
+
*
|
|
507
|
+
* @example
|
|
508
|
+
* ```ts
|
|
509
|
+
* import { createClient, http } from 'viem'
|
|
510
|
+
* import { tempo } from 'viem/chains'
|
|
511
|
+
* import { Actions } from 'viem/tempo'
|
|
512
|
+
*
|
|
513
|
+
* const client = createClient({
|
|
514
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
|
|
515
|
+
* transport: http(),
|
|
516
|
+
* })
|
|
517
|
+
*
|
|
518
|
+
* const validator = await Actions.validator.get(client, {
|
|
519
|
+
* validator: '0x...',
|
|
520
|
+
* })
|
|
521
|
+
* ```
|
|
522
|
+
*
|
|
523
|
+
* @param client - Client.
|
|
524
|
+
* @param parameters - Parameters.
|
|
525
|
+
* @returns The validator information.
|
|
526
|
+
*/
|
|
527
|
+
export async function get(client, parameters) {
|
|
528
|
+
const { validator, ...rest } = parameters;
|
|
529
|
+
return readContract(client, {
|
|
530
|
+
...rest,
|
|
531
|
+
...get.call({ validator }),
|
|
532
|
+
});
|
|
533
|
+
}
|
|
534
|
+
(function (get) {
|
|
535
|
+
/**
|
|
536
|
+
* Defines a call to the `validators` function.
|
|
537
|
+
*
|
|
538
|
+
* Can be passed as a parameter to:
|
|
539
|
+
* - [`estimateContractGas`](https://viem.sh/docs/contract/estimateContractGas): estimate the gas cost of the call
|
|
540
|
+
* - [`simulateContract`](https://viem.sh/docs/contract/simulateContract): simulate the call
|
|
541
|
+
* - [`multicall`](https://viem.sh/docs/contract/multicall): execute multiple calls in parallel
|
|
542
|
+
*
|
|
543
|
+
* @example
|
|
544
|
+
* ```ts
|
|
545
|
+
* import { createClient, http } from 'viem'
|
|
546
|
+
* import { tempo } from 'viem/chains'
|
|
547
|
+
* import { Actions } from 'viem/tempo'
|
|
548
|
+
*
|
|
549
|
+
* const client = createClient({
|
|
550
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
|
|
551
|
+
* transport: http(),
|
|
552
|
+
* })
|
|
553
|
+
*
|
|
554
|
+
* const result = await client.multicall({
|
|
555
|
+
* contracts: [
|
|
556
|
+
* Actions.validator.get.call({ validator: '0x...' }),
|
|
557
|
+
* ],
|
|
558
|
+
* })
|
|
559
|
+
* ```
|
|
560
|
+
*
|
|
561
|
+
* @param args - Arguments.
|
|
562
|
+
* @returns The call.
|
|
563
|
+
*/
|
|
564
|
+
function call(args) {
|
|
565
|
+
const { validator } = args;
|
|
566
|
+
return defineCall({
|
|
567
|
+
address: Addresses.validator,
|
|
568
|
+
abi: Abis.validator,
|
|
569
|
+
args: [validator],
|
|
570
|
+
functionName: 'validators',
|
|
571
|
+
});
|
|
572
|
+
}
|
|
573
|
+
get.call = call;
|
|
574
|
+
})(get || (get = {}));
|
|
575
|
+
/**
|
|
576
|
+
* Gets validator address by index.
|
|
577
|
+
*
|
|
578
|
+
* @example
|
|
579
|
+
* ```ts
|
|
580
|
+
* import { createClient, http } from 'viem'
|
|
581
|
+
* import { tempo } from 'viem/chains'
|
|
582
|
+
* import { Actions } from 'viem/tempo'
|
|
583
|
+
*
|
|
584
|
+
* const client = createClient({
|
|
585
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
|
|
586
|
+
* transport: http(),
|
|
587
|
+
* })
|
|
588
|
+
*
|
|
589
|
+
* const validatorAddress = await Actions.validator.getByIndex(client, {
|
|
590
|
+
* index: 0n,
|
|
591
|
+
* })
|
|
592
|
+
* ```
|
|
593
|
+
*
|
|
594
|
+
* @param client - Client.
|
|
595
|
+
* @param parameters - Parameters.
|
|
596
|
+
* @returns The validator address at the given index.
|
|
597
|
+
*/
|
|
598
|
+
export async function getByIndex(client, parameters) {
|
|
599
|
+
const { index, ...rest } = parameters;
|
|
600
|
+
return readContract(client, {
|
|
601
|
+
...rest,
|
|
602
|
+
...getByIndex.call({ index }),
|
|
603
|
+
});
|
|
604
|
+
}
|
|
605
|
+
(function (getByIndex) {
|
|
606
|
+
/**
|
|
607
|
+
* Defines a call to the `validatorsArray` function.
|
|
608
|
+
*
|
|
609
|
+
* Can be passed as a parameter to:
|
|
610
|
+
* - [`estimateContractGas`](https://viem.sh/docs/contract/estimateContractGas): estimate the gas cost of the call
|
|
611
|
+
* - [`simulateContract`](https://viem.sh/docs/contract/simulateContract): simulate the call
|
|
612
|
+
* - [`multicall`](https://viem.sh/docs/contract/multicall): execute multiple calls in parallel
|
|
613
|
+
*
|
|
614
|
+
* @example
|
|
615
|
+
* ```ts
|
|
616
|
+
* import { createClient, http } from 'viem'
|
|
617
|
+
* import { tempo } from 'viem/chains'
|
|
618
|
+
* import { Actions } from 'viem/tempo'
|
|
619
|
+
*
|
|
620
|
+
* const client = createClient({
|
|
621
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
|
|
622
|
+
* transport: http(),
|
|
623
|
+
* })
|
|
624
|
+
*
|
|
625
|
+
* const result = await client.multicall({
|
|
626
|
+
* contracts: [
|
|
627
|
+
* Actions.validator.getByIndex.call({ index: 0n }),
|
|
628
|
+
* Actions.validator.getByIndex.call({ index: 1n }),
|
|
629
|
+
* ],
|
|
630
|
+
* })
|
|
631
|
+
* ```
|
|
632
|
+
*
|
|
633
|
+
* @param args - Arguments.
|
|
634
|
+
* @returns The call.
|
|
635
|
+
*/
|
|
636
|
+
function call(args) {
|
|
637
|
+
const { index } = args;
|
|
638
|
+
return defineCall({
|
|
639
|
+
address: Addresses.validator,
|
|
640
|
+
abi: Abis.validator,
|
|
641
|
+
args: [index],
|
|
642
|
+
functionName: 'validatorsArray',
|
|
643
|
+
});
|
|
644
|
+
}
|
|
645
|
+
getByIndex.call = call;
|
|
646
|
+
})(getByIndex || (getByIndex = {}));
|
|
647
|
+
/**
|
|
648
|
+
* Gets the total number of validators.
|
|
649
|
+
*
|
|
650
|
+
* @example
|
|
651
|
+
* ```ts
|
|
652
|
+
* import { createClient, http } from 'viem'
|
|
653
|
+
* import { tempo } from 'viem/chains'
|
|
654
|
+
* import { Actions } from 'viem/tempo'
|
|
655
|
+
*
|
|
656
|
+
* const client = createClient({
|
|
657
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
|
|
658
|
+
* transport: http(),
|
|
659
|
+
* })
|
|
660
|
+
*
|
|
661
|
+
* const count = await Actions.validator.getCount(client)
|
|
662
|
+
* ```
|
|
663
|
+
*
|
|
664
|
+
* @param client - Client.
|
|
665
|
+
* @param parameters - Parameters.
|
|
666
|
+
* @returns The total number of validators.
|
|
667
|
+
*/
|
|
668
|
+
export async function getCount(client, parameters = {}) {
|
|
669
|
+
return readContract(client, {
|
|
670
|
+
...parameters,
|
|
671
|
+
...getCount.call(),
|
|
672
|
+
});
|
|
673
|
+
}
|
|
674
|
+
(function (getCount) {
|
|
675
|
+
/**
|
|
676
|
+
* Defines a call to the `validatorCount` function.
|
|
677
|
+
*
|
|
678
|
+
* Can be passed as a parameter to:
|
|
679
|
+
* - [`estimateContractGas`](https://viem.sh/docs/contract/estimateContractGas): estimate the gas cost of the call
|
|
680
|
+
* - [`simulateContract`](https://viem.sh/docs/contract/simulateContract): simulate the call
|
|
681
|
+
* - [`multicall`](https://viem.sh/docs/contract/multicall): execute multiple calls in parallel
|
|
682
|
+
*
|
|
683
|
+
* @example
|
|
684
|
+
* ```ts
|
|
685
|
+
* import { createClient, http } from 'viem'
|
|
686
|
+
* import { tempo } from 'viem/chains'
|
|
687
|
+
* import { Actions } from 'viem/tempo'
|
|
688
|
+
*
|
|
689
|
+
* const client = createClient({
|
|
690
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
|
|
691
|
+
* transport: http(),
|
|
692
|
+
* })
|
|
693
|
+
*
|
|
694
|
+
* const result = await client.multicall({
|
|
695
|
+
* contracts: [Actions.validator.getCount.call()],
|
|
696
|
+
* })
|
|
697
|
+
* ```
|
|
698
|
+
*
|
|
699
|
+
* @returns The call.
|
|
700
|
+
*/
|
|
701
|
+
function call() {
|
|
702
|
+
return defineCall({
|
|
703
|
+
address: Addresses.validator,
|
|
704
|
+
abi: Abis.validator,
|
|
705
|
+
args: [],
|
|
706
|
+
functionName: 'validatorCount',
|
|
707
|
+
});
|
|
708
|
+
}
|
|
709
|
+
getCount.call = call;
|
|
710
|
+
})(getCount || (getCount = {}));
|
|
711
|
+
/**
|
|
712
|
+
* Gets the complete set of validators.
|
|
713
|
+
*
|
|
714
|
+
* @example
|
|
715
|
+
* ```ts
|
|
716
|
+
* import { createClient, http } from 'viem'
|
|
717
|
+
* import { tempo } from 'viem/chains'
|
|
718
|
+
* import { Actions } from 'viem/tempo'
|
|
719
|
+
*
|
|
720
|
+
* const client = createClient({
|
|
721
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
|
|
722
|
+
* transport: http(),
|
|
723
|
+
* })
|
|
724
|
+
*
|
|
725
|
+
* const validators = await Actions.validator.list(client)
|
|
726
|
+
* ```
|
|
727
|
+
*
|
|
728
|
+
* @param client - Client.
|
|
729
|
+
* @param parameters - Parameters.
|
|
730
|
+
* @returns Array of all validators with their information.
|
|
731
|
+
*/
|
|
732
|
+
export async function list(client, parameters = {}) {
|
|
733
|
+
return readContract(client, {
|
|
734
|
+
...parameters,
|
|
735
|
+
...list.call(),
|
|
736
|
+
});
|
|
737
|
+
}
|
|
738
|
+
(function (list) {
|
|
739
|
+
/**
|
|
740
|
+
* Defines a call to the `getValidators` function.
|
|
741
|
+
*
|
|
742
|
+
* Can be passed as a parameter to:
|
|
743
|
+
* - [`estimateContractGas`](https://viem.sh/docs/contract/estimateContractGas): estimate the gas cost of the call
|
|
744
|
+
* - [`simulateContract`](https://viem.sh/docs/contract/simulateContract): simulate the call
|
|
745
|
+
* - [`multicall`](https://viem.sh/docs/contract/multicall): execute multiple calls in parallel
|
|
746
|
+
*
|
|
747
|
+
* @example
|
|
748
|
+
* ```ts
|
|
749
|
+
* import { createClient, http } from 'viem'
|
|
750
|
+
* import { tempo } from 'viem/chains'
|
|
751
|
+
* import { Actions } from 'viem/tempo'
|
|
752
|
+
*
|
|
753
|
+
* const client = createClient({
|
|
754
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
|
|
755
|
+
* transport: http(),
|
|
756
|
+
* })
|
|
757
|
+
*
|
|
758
|
+
* const result = await client.multicall({
|
|
759
|
+
* contracts: [Actions.validator.list.call()],
|
|
760
|
+
* })
|
|
761
|
+
* ```
|
|
762
|
+
*
|
|
763
|
+
* @returns The call.
|
|
764
|
+
*/
|
|
765
|
+
function call() {
|
|
766
|
+
return defineCall({
|
|
767
|
+
address: Addresses.validator,
|
|
768
|
+
abi: Abis.validator,
|
|
769
|
+
args: [],
|
|
770
|
+
functionName: 'getValidators',
|
|
771
|
+
});
|
|
772
|
+
}
|
|
773
|
+
list.call = call;
|
|
774
|
+
})(list || (list = {}));
|
|
775
|
+
/**
|
|
776
|
+
* Sets the next epoch for a full DKG ceremony.
|
|
777
|
+
*
|
|
778
|
+
* @example
|
|
779
|
+
* ```ts
|
|
780
|
+
* import { createClient, http } from 'viem'
|
|
781
|
+
* import { tempo } from 'viem/chains'
|
|
782
|
+
* import { Actions } from 'viem/tempo'
|
|
783
|
+
* import { privateKeyToAccount } from 'viem/accounts'
|
|
784
|
+
*
|
|
785
|
+
* const client = createClient({
|
|
786
|
+
* account: privateKeyToAccount('0x...'),
|
|
787
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
|
|
788
|
+
* transport: http(),
|
|
789
|
+
* })
|
|
790
|
+
*
|
|
791
|
+
* const hash = await Actions.validator.setNextFullDkgCeremony(client, {
|
|
792
|
+
* epoch: 100n,
|
|
793
|
+
* })
|
|
794
|
+
* ```
|
|
795
|
+
*
|
|
796
|
+
* @param client - Client.
|
|
797
|
+
* @param parameters - Parameters.
|
|
798
|
+
* @returns The transaction hash.
|
|
799
|
+
*/
|
|
800
|
+
export async function setNextFullDkgCeremony(client, parameters) {
|
|
801
|
+
return setNextFullDkgCeremony.inner(writeContract, client, parameters);
|
|
802
|
+
}
|
|
803
|
+
(function (setNextFullDkgCeremony) {
|
|
804
|
+
/** @internal */
|
|
805
|
+
async function inner(action, client, parameters) {
|
|
806
|
+
const { epoch, ...rest } = parameters;
|
|
807
|
+
const callData = setNextFullDkgCeremony.call({ epoch });
|
|
808
|
+
return (await action(client, {
|
|
809
|
+
...rest,
|
|
810
|
+
...callData,
|
|
811
|
+
}));
|
|
812
|
+
}
|
|
813
|
+
setNextFullDkgCeremony.inner = inner;
|
|
814
|
+
/**
|
|
815
|
+
* Defines a call to the `setNextFullDkgCeremony` function.
|
|
816
|
+
*
|
|
817
|
+
* Can be passed as a parameter to:
|
|
818
|
+
* - [`estimateContractGas`](https://viem.sh/docs/contract/estimateContractGas): estimate the gas cost of the call
|
|
819
|
+
* - [`simulateContract`](https://viem.sh/docs/contract/simulateContract): simulate the call
|
|
820
|
+
* - [`sendCalls`](https://viem.sh/docs/actions/wallet/sendCalls): send multiple calls
|
|
821
|
+
*
|
|
822
|
+
* @example
|
|
823
|
+
* ```ts
|
|
824
|
+
* import { createClient, http, walletActions } from 'viem'
|
|
825
|
+
* import { tempo } from 'viem/chains'
|
|
826
|
+
* import { Actions } from 'viem/tempo'
|
|
827
|
+
*
|
|
828
|
+
* const client = createClient({
|
|
829
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
|
|
830
|
+
* transport: http(),
|
|
831
|
+
* }).extend(walletActions)
|
|
832
|
+
*
|
|
833
|
+
* const { result } = await client.sendCalls({
|
|
834
|
+
* calls: [
|
|
835
|
+
* Actions.validator.setNextFullDkgCeremony.call({
|
|
836
|
+
* epoch: 100n,
|
|
837
|
+
* }),
|
|
838
|
+
* ],
|
|
839
|
+
* })
|
|
840
|
+
* ```
|
|
841
|
+
*
|
|
842
|
+
* @param args - Arguments.
|
|
843
|
+
* @returns The call.
|
|
844
|
+
*/
|
|
845
|
+
function call(args) {
|
|
846
|
+
const { epoch } = args;
|
|
847
|
+
return defineCall({
|
|
848
|
+
address: Addresses.validator,
|
|
849
|
+
abi: Abis.validator,
|
|
850
|
+
args: [epoch],
|
|
851
|
+
functionName: 'setNextFullDkgCeremony',
|
|
852
|
+
});
|
|
853
|
+
}
|
|
854
|
+
setNextFullDkgCeremony.call = call;
|
|
855
|
+
})(setNextFullDkgCeremony || (setNextFullDkgCeremony = {}));
|
|
856
|
+
/**
|
|
857
|
+
* Sets the next epoch for a full DKG ceremony and waits for the transaction receipt.
|
|
858
|
+
*
|
|
859
|
+
* @example
|
|
860
|
+
* ```ts
|
|
861
|
+
* import { createClient, http } from 'viem'
|
|
862
|
+
* import { tempo } from 'viem/chains'
|
|
863
|
+
* import { Actions } from 'viem/tempo'
|
|
864
|
+
* import { privateKeyToAccount } from 'viem/accounts'
|
|
865
|
+
*
|
|
866
|
+
* const client = createClient({
|
|
867
|
+
* account: privateKeyToAccount('0x...'),
|
|
868
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
|
|
869
|
+
* transport: http(),
|
|
870
|
+
* })
|
|
871
|
+
*
|
|
872
|
+
* const { receipt } = await Actions.validator.setNextFullDkgCeremonySync(client, {
|
|
873
|
+
* epoch: 100n,
|
|
874
|
+
* })
|
|
875
|
+
* ```
|
|
876
|
+
*
|
|
877
|
+
* @param client - Client.
|
|
878
|
+
* @param parameters - Parameters.
|
|
879
|
+
* @returns The transaction receipt.
|
|
880
|
+
*/
|
|
881
|
+
export async function setNextFullDkgCeremonySync(client, parameters) {
|
|
882
|
+
const { throwOnReceiptRevert = true, ...rest } = parameters;
|
|
883
|
+
const receipt = await setNextFullDkgCeremony.inner(writeContractSync, client, {
|
|
884
|
+
...rest,
|
|
885
|
+
throwOnReceiptRevert,
|
|
886
|
+
});
|
|
887
|
+
return { receipt };
|
|
888
|
+
}
|
|
889
|
+
/**
|
|
890
|
+
* Updates validator information (only callable by the validator themselves).
|
|
891
|
+
*
|
|
892
|
+
* @example
|
|
893
|
+
* ```ts
|
|
894
|
+
* import { createClient, http } from 'viem'
|
|
895
|
+
* import { tempo } from 'viem/chains'
|
|
896
|
+
* import { Actions } from 'viem/tempo'
|
|
897
|
+
* import { privateKeyToAccount } from 'viem/accounts'
|
|
898
|
+
*
|
|
899
|
+
* const client = createClient({
|
|
900
|
+
* account: privateKeyToAccount('0x...'),
|
|
901
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
|
|
902
|
+
* transport: http(),
|
|
903
|
+
* })
|
|
904
|
+
*
|
|
905
|
+
* const hash = await Actions.validator.update(client, {
|
|
906
|
+
* newValidatorAddress: '0x...',
|
|
907
|
+
* publicKey: '0x...',
|
|
908
|
+
* inboundAddress: '192.168.1.1:8080',
|
|
909
|
+
* outboundAddress: '192.168.1.1:8080',
|
|
910
|
+
* })
|
|
911
|
+
* ```
|
|
912
|
+
*
|
|
913
|
+
* @param client - Client.
|
|
914
|
+
* @param parameters - Parameters.
|
|
915
|
+
* @returns The transaction hash.
|
|
916
|
+
*/
|
|
917
|
+
export async function update(client, parameters) {
|
|
918
|
+
return update.inner(writeContract, client, parameters);
|
|
919
|
+
}
|
|
920
|
+
(function (update) {
|
|
921
|
+
/** @internal */
|
|
922
|
+
async function inner(action, client, parameters) {
|
|
923
|
+
const { newValidatorAddress, publicKey, inboundAddress, outboundAddress, ...rest } = parameters;
|
|
924
|
+
const callData = update.call({
|
|
925
|
+
newValidatorAddress,
|
|
926
|
+
publicKey,
|
|
927
|
+
inboundAddress,
|
|
928
|
+
outboundAddress,
|
|
929
|
+
});
|
|
930
|
+
return (await action(client, {
|
|
931
|
+
...rest,
|
|
932
|
+
...callData,
|
|
933
|
+
}));
|
|
934
|
+
}
|
|
935
|
+
update.inner = inner;
|
|
936
|
+
/**
|
|
937
|
+
* Defines a call to the `updateValidator` function.
|
|
938
|
+
*
|
|
939
|
+
* Can be passed as a parameter to:
|
|
940
|
+
* - [`estimateContractGas`](https://viem.sh/docs/contract/estimateContractGas): estimate the gas cost of the call
|
|
941
|
+
* - [`simulateContract`](https://viem.sh/docs/contract/simulateContract): simulate the call
|
|
942
|
+
* - [`sendCalls`](https://viem.sh/docs/actions/wallet/sendCalls): send multiple calls
|
|
943
|
+
*
|
|
944
|
+
* @example
|
|
945
|
+
* ```ts
|
|
946
|
+
* import { createClient, http, walletActions } from 'viem'
|
|
947
|
+
* import { tempo } from 'viem/chains'
|
|
948
|
+
* import { Actions } from 'viem/tempo'
|
|
949
|
+
*
|
|
950
|
+
* const client = createClient({
|
|
951
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
|
|
952
|
+
* transport: http(),
|
|
953
|
+
* }).extend(walletActions)
|
|
954
|
+
*
|
|
955
|
+
* const { result } = await client.sendCalls({
|
|
956
|
+
* calls: [
|
|
957
|
+
* Actions.validator.update.call({
|
|
958
|
+
* newValidatorAddress: '0x...',
|
|
959
|
+
* publicKey: '0x...',
|
|
960
|
+
* inboundAddress: '192.168.1.1:8080',
|
|
961
|
+
* outboundAddress: '192.168.1.1:8080',
|
|
962
|
+
* }),
|
|
963
|
+
* ],
|
|
964
|
+
* })
|
|
965
|
+
* ```
|
|
966
|
+
*
|
|
967
|
+
* @param args - Arguments.
|
|
968
|
+
* @returns The call.
|
|
969
|
+
*/
|
|
970
|
+
function call(args) {
|
|
971
|
+
const { newValidatorAddress, publicKey, inboundAddress, outboundAddress } = args;
|
|
972
|
+
return defineCall({
|
|
973
|
+
address: Addresses.validator,
|
|
974
|
+
abi: Abis.validator,
|
|
975
|
+
args: [newValidatorAddress, publicKey, inboundAddress, outboundAddress],
|
|
976
|
+
functionName: 'updateValidator',
|
|
977
|
+
});
|
|
978
|
+
}
|
|
979
|
+
update.call = call;
|
|
980
|
+
})(update || (update = {}));
|
|
981
|
+
/**
|
|
982
|
+
* Updates validator information and waits for the transaction receipt.
|
|
983
|
+
*
|
|
984
|
+
* @example
|
|
985
|
+
* ```ts
|
|
986
|
+
* import { createClient, http } from 'viem'
|
|
987
|
+
* import { tempo } from 'viem/chains'
|
|
988
|
+
* import { Actions } from 'viem/tempo'
|
|
989
|
+
* import { privateKeyToAccount } from 'viem/accounts'
|
|
990
|
+
*
|
|
991
|
+
* const client = createClient({
|
|
992
|
+
* account: privateKeyToAccount('0x...'),
|
|
993
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
|
|
994
|
+
* transport: http(),
|
|
995
|
+
* })
|
|
996
|
+
*
|
|
997
|
+
* const { receipt } = await Actions.validator.updateSync(client, {
|
|
998
|
+
* newValidatorAddress: '0x...',
|
|
999
|
+
* publicKey: '0x...',
|
|
1000
|
+
* inboundAddress: '192.168.1.1:8080',
|
|
1001
|
+
* outboundAddress: '192.168.1.1:8080',
|
|
1002
|
+
* })
|
|
1003
|
+
* ```
|
|
1004
|
+
*
|
|
1005
|
+
* @param client - Client.
|
|
1006
|
+
* @param parameters - Parameters.
|
|
1007
|
+
* @returns The transaction receipt.
|
|
1008
|
+
*/
|
|
1009
|
+
export async function updateSync(client, parameters) {
|
|
1010
|
+
const { throwOnReceiptRevert = true, ...rest } = parameters;
|
|
1011
|
+
const receipt = await update.inner(writeContractSync, client, {
|
|
1012
|
+
...rest,
|
|
1013
|
+
throwOnReceiptRevert,
|
|
1014
|
+
});
|
|
1015
|
+
return { receipt };
|
|
1016
|
+
}
|
|
1017
|
+
//# sourceMappingURL=validator.js.map
|