viem 2.44.2 → 2.45.0
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 +36 -0
- package/_cjs/account-abstraction/actions/bundler/prepareUserOperation.js +4 -2
- package/_cjs/account-abstraction/actions/bundler/prepareUserOperation.js.map +1 -1
- package/_cjs/account-abstraction/actions/bundler/sendUserOperation.js.map +1 -1
- package/_cjs/account-abstraction/clients/createBundlerClient.js +8 -2
- package/_cjs/account-abstraction/clients/createBundlerClient.js.map +1 -1
- package/_cjs/actions/public/estimateContractGas.js +3 -1
- package/_cjs/actions/public/estimateContractGas.js.map +1 -1
- package/_cjs/actions/public/simulateContract.js +3 -1
- package/_cjs/actions/public/simulateContract.js.map +1 -1
- package/_cjs/actions/wallet/sendCalls.js +17 -1
- package/_cjs/actions/wallet/sendCalls.js.map +1 -1
- package/_cjs/actions/wallet/sendTransaction.js +11 -7
- package/_cjs/actions/wallet/sendTransaction.js.map +1 -1
- package/_cjs/actions/wallet/sendTransactionSync.js +11 -7
- package/_cjs/actions/wallet/sendTransactionSync.js.map +1 -1
- package/_cjs/actions/wallet/writeContract.js +2 -2
- package/_cjs/actions/wallet/writeContract.js.map +1 -1
- package/_cjs/chains/definitions/megaeth.js +33 -0
- package/_cjs/chains/definitions/megaeth.js.map +1 -0
- package/_cjs/chains/definitions/megaethTestnet.js +6 -1
- package/_cjs/chains/definitions/megaethTestnet.js.map +1 -1
- package/_cjs/chains/definitions/rise.js +28 -0
- package/_cjs/chains/definitions/rise.js.map +1 -0
- package/_cjs/chains/definitions/stable.js +35 -0
- package/_cjs/chains/definitions/stable.js.map +1 -0
- package/_cjs/chains/definitions/stableTestnet.js +10 -3
- package/_cjs/chains/definitions/stableTestnet.js.map +1 -1
- package/_cjs/chains/index.js +13 -7
- package/_cjs/chains/index.js.map +1 -1
- package/_cjs/clients/createClient.js +2 -1
- package/_cjs/clients/createClient.js.map +1 -1
- package/_cjs/clients/createWalletClient.js.map +1 -1
- package/_cjs/errors/version.js +1 -1
- package/_cjs/index.js.map +1 -1
- package/_cjs/op-stack/index.js +9 -1
- package/_cjs/op-stack/index.js.map +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/types/dataSuffix.js +3 -0
- package/_cjs/types/dataSuffix.js.map +1 -0
- package/_cjs/utils/abi/decodeEventLog.js +29 -12
- package/_cjs/utils/abi/decodeEventLog.js.map +1 -1
- package/_esm/account-abstraction/actions/bundler/prepareUserOperation.js +4 -2
- package/_esm/account-abstraction/actions/bundler/prepareUserOperation.js.map +1 -1
- package/_esm/account-abstraction/actions/bundler/sendUserOperation.js.map +1 -1
- package/_esm/account-abstraction/clients/createBundlerClient.js +8 -2
- package/_esm/account-abstraction/clients/createBundlerClient.js.map +1 -1
- package/_esm/actions/public/estimateContractGas.js +3 -1
- package/_esm/actions/public/estimateContractGas.js.map +1 -1
- package/_esm/actions/public/simulateContract.js +3 -1
- package/_esm/actions/public/simulateContract.js.map +1 -1
- package/_esm/actions/wallet/sendCalls.js +17 -1
- package/_esm/actions/wallet/sendCalls.js.map +1 -1
- package/_esm/actions/wallet/sendTransaction.js +11 -7
- package/_esm/actions/wallet/sendTransaction.js.map +1 -1
- package/_esm/actions/wallet/sendTransactionSync.js +11 -7
- package/_esm/actions/wallet/sendTransactionSync.js.map +1 -1
- package/_esm/actions/wallet/writeContract.js +2 -2
- package/_esm/actions/wallet/writeContract.js.map +1 -1
- package/_esm/chains/definitions/megaeth.js +30 -0
- package/_esm/chains/definitions/megaeth.js.map +1 -0
- package/_esm/chains/definitions/megaethTestnet.js +6 -1
- package/_esm/chains/definitions/megaethTestnet.js.map +1 -1
- package/_esm/chains/definitions/rise.js +25 -0
- package/_esm/chains/definitions/rise.js.map +1 -0
- package/_esm/chains/definitions/stable.js +32 -0
- package/_esm/chains/definitions/stable.js.map +1 -0
- package/_esm/chains/definitions/stableTestnet.js +10 -3
- package/_esm/chains/definitions/stableTestnet.js.map +1 -1
- package/_esm/chains/index.js +3 -0
- package/_esm/chains/index.js.map +1 -1
- package/_esm/clients/createClient.js +2 -1
- package/_esm/clients/createClient.js.map +1 -1
- package/_esm/clients/createWalletClient.js.map +1 -1
- package/_esm/errors/version.js +1 -1
- package/_esm/index.js.map +1 -1
- package/_esm/op-stack/index.js +4 -0
- package/_esm/op-stack/index.js.map +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/types/dataSuffix.js +2 -0
- package/_esm/types/dataSuffix.js.map +1 -0
- package/_esm/utils/abi/decodeEventLog.js +34 -13
- package/_esm/utils/abi/decodeEventLog.js.map +1 -1
- package/_types/account-abstraction/actions/bundler/prepareUserOperation.d.ts +2 -0
- package/_types/account-abstraction/actions/bundler/prepareUserOperation.d.ts.map +1 -1
- package/_types/account-abstraction/actions/bundler/sendUserOperation.d.ts +2 -0
- package/_types/account-abstraction/actions/bundler/sendUserOperation.d.ts.map +1 -1
- package/_types/account-abstraction/clients/createBundlerClient.d.ts +4 -0
- package/_types/account-abstraction/clients/createBundlerClient.d.ts.map +1 -1
- package/_types/actions/public/estimateContractGas.d.ts.map +1 -1
- package/_types/actions/public/simulateContract.d.ts.map +1 -1
- package/_types/actions/wallet/sendCalls.d.ts.map +1 -1
- package/_types/actions/wallet/sendTransaction.d.ts +7 -2
- package/_types/actions/wallet/sendTransaction.d.ts.map +1 -1
- package/_types/actions/wallet/sendTransactionSync.d.ts +5 -0
- package/_types/actions/wallet/sendTransactionSync.d.ts.map +1 -1
- package/_types/actions/wallet/writeContract.d.ts.map +1 -1
- package/_types/chains/definitions/megaeth.d.ts +46 -0
- package/_types/chains/definitions/megaeth.d.ts.map +1 -0
- package/_types/chains/definitions/megaethTestnet.d.ts +6 -1
- package/_types/chains/definitions/megaethTestnet.d.ts.map +1 -1
- package/_types/chains/definitions/rise.d.ts +46 -0
- package/_types/chains/definitions/rise.d.ts.map +1 -0
- package/_types/chains/definitions/stable.d.ts +47 -0
- package/_types/chains/definitions/stable.d.ts.map +1 -0
- package/_types/chains/definitions/stableTestnet.d.ts +10 -13
- package/_types/chains/definitions/stableTestnet.d.ts.map +1 -1
- package/_types/chains/index.d.ts +3 -0
- package/_types/chains/index.d.ts.map +1 -1
- package/_types/clients/createClient.d.ts +5 -0
- package/_types/clients/createClient.d.ts.map +1 -1
- package/_types/clients/createWalletClient.d.ts +1 -1
- package/_types/clients/createWalletClient.d.ts.map +1 -1
- package/_types/errors/version.d.ts +1 -1
- package/_types/index.d.ts +2 -1
- package/_types/index.d.ts.map +1 -1
- package/_types/op-stack/index.d.ts +4 -0
- package/_types/op-stack/index.d.ts.map +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/types/dataSuffix.d.ts +16 -0
- package/_types/types/dataSuffix.d.ts.map +1 -0
- package/_types/utils/abi/decodeEventLog.d.ts.map +1 -1
- package/account-abstraction/actions/bundler/prepareUserOperation.ts +7 -1
- package/account-abstraction/actions/bundler/sendUserOperation.ts +2 -0
- package/account-abstraction/clients/createBundlerClient.ts +12 -1
- package/actions/public/estimateContractGas.ts +11 -2
- package/actions/public/simulateContract.ts +11 -2
- package/actions/wallet/sendCalls.ts +18 -1
- package/actions/wallet/sendTransaction.ts +19 -8
- package/actions/wallet/sendTransactionSync.ts +17 -7
- package/actions/wallet/writeContract.ts +1 -2
- package/chains/definitions/megaeth.ts +30 -0
- package/chains/definitions/megaethTestnet.ts +6 -1
- package/chains/definitions/rise.ts +25 -0
- package/chains/definitions/stable.ts +32 -0
- package/chains/definitions/stableTestnet.ts +10 -3
- package/chains/index.ts +3 -0
- package/clients/createClient.ts +7 -0
- package/clients/createWalletClient.ts +1 -0
- package/errors/version.ts +1 -1
- package/index.ts +2 -0
- package/op-stack/index.ts +24 -0
- 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/types/dataSuffix.ts +18 -0
- package/utils/abi/decodeEventLog.ts +38 -14
package/tempo/actions/fee.ts
CHANGED
|
@@ -33,8 +33,8 @@ import type { TransactionReceipt } from '../Transaction.js'
|
|
|
33
33
|
* @example
|
|
34
34
|
* ```ts
|
|
35
35
|
* import { createClient, http } from 'viem'
|
|
36
|
-
* import { tempo } from '
|
|
37
|
-
* import { Actions } from 'tempo
|
|
36
|
+
* import { tempo } from 'viem/chains'
|
|
37
|
+
* import { Actions } from 'viem/tempo'
|
|
38
38
|
* import { privateKeyToAccount } from 'viem/accounts'
|
|
39
39
|
*
|
|
40
40
|
* const client = createClient({
|
|
@@ -111,8 +111,8 @@ export namespace getUserToken {
|
|
|
111
111
|
* @example
|
|
112
112
|
* ```ts
|
|
113
113
|
* import { createClient, http } from 'viem'
|
|
114
|
-
* import { tempo } from '
|
|
115
|
-
* import { Actions } from 'tempo
|
|
114
|
+
* import { tempo } from 'viem/chains'
|
|
115
|
+
* import { Actions } from 'viem/tempo'
|
|
116
116
|
* import { privateKeyToAccount } from 'viem/accounts'
|
|
117
117
|
*
|
|
118
118
|
* const client = createClient({
|
|
@@ -185,8 +185,8 @@ export namespace setUserToken {
|
|
|
185
185
|
* @example
|
|
186
186
|
* ```ts
|
|
187
187
|
* import { createClient, http, walletActions } from 'viem'
|
|
188
|
-
* import { tempo } from '
|
|
189
|
-
* import { Actions } from 'tempo
|
|
188
|
+
* import { tempo } from 'viem/chains'
|
|
189
|
+
* import { Actions } from 'viem/tempo'
|
|
190
190
|
*
|
|
191
191
|
* const client = createClient({
|
|
192
192
|
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
@@ -236,8 +236,8 @@ export namespace setUserToken {
|
|
|
236
236
|
* @example
|
|
237
237
|
* ```ts
|
|
238
238
|
* import { createClient, http } from 'viem'
|
|
239
|
-
* import { tempo } from '
|
|
240
|
-
* import { Actions } from 'tempo
|
|
239
|
+
* import { tempo } from 'viem/chains'
|
|
240
|
+
* import { Actions } from 'viem/tempo'
|
|
241
241
|
* import { privateKeyToAccount } from 'viem/accounts'
|
|
242
242
|
*
|
|
243
243
|
* const client = createClient({
|
|
@@ -302,8 +302,8 @@ export namespace setUserTokenSync {
|
|
|
302
302
|
* @example
|
|
303
303
|
* ```ts
|
|
304
304
|
* import { createClient, http } from 'viem'
|
|
305
|
-
* import { tempo } from '
|
|
306
|
-
* import { Actions } from 'tempo
|
|
305
|
+
* import { tempo } from 'viem/chains'
|
|
306
|
+
* import { Actions } from 'viem/tempo'
|
|
307
307
|
*
|
|
308
308
|
* const client = createClient({
|
|
309
309
|
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
@@ -364,3 +364,339 @@ export declare namespace watchSetUserToken {
|
|
|
364
364
|
onUserTokenSet: (args: Args, log: Log) => void
|
|
365
365
|
}
|
|
366
366
|
}
|
|
367
|
+
|
|
368
|
+
/**
|
|
369
|
+
* Gets the validator's preferred fee token.
|
|
370
|
+
*
|
|
371
|
+
* @example
|
|
372
|
+
* ```ts
|
|
373
|
+
* import { createClient, http } from 'viem'
|
|
374
|
+
* import { tempo } from 'viem/chains'
|
|
375
|
+
* import { Actions } from 'viem/tempo'
|
|
376
|
+
*
|
|
377
|
+
* const client = createClient({
|
|
378
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
379
|
+
* transport: http(),
|
|
380
|
+
* })
|
|
381
|
+
*
|
|
382
|
+
* const { address, id } = await Actions.fee.getValidatorToken(client, {
|
|
383
|
+
* validator: '0x...',
|
|
384
|
+
* })
|
|
385
|
+
* ```
|
|
386
|
+
*
|
|
387
|
+
* @param client - Client.
|
|
388
|
+
* @param parameters - Parameters.
|
|
389
|
+
* @returns The validator's preferred fee token, or null if not set.
|
|
390
|
+
*/
|
|
391
|
+
export async function getValidatorToken<
|
|
392
|
+
chain extends Chain | undefined,
|
|
393
|
+
account extends Account | undefined,
|
|
394
|
+
>(
|
|
395
|
+
client: Client<Transport, chain, account>,
|
|
396
|
+
parameters: getValidatorToken.Parameters,
|
|
397
|
+
): Promise<getValidatorToken.ReturnValue> {
|
|
398
|
+
const { validator, ...rest } = parameters
|
|
399
|
+
const address = await readContract(client, {
|
|
400
|
+
...rest,
|
|
401
|
+
...getValidatorToken.call({ validator }),
|
|
402
|
+
})
|
|
403
|
+
if (address === zeroAddress) return null
|
|
404
|
+
return {
|
|
405
|
+
address,
|
|
406
|
+
id: TokenId.fromAddress(address),
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
export namespace getValidatorToken {
|
|
411
|
+
export type Parameters = ReadParameters & Args
|
|
412
|
+
|
|
413
|
+
export type Args = {
|
|
414
|
+
/** Validator address. */
|
|
415
|
+
validator: Address
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
export type ReturnValue = Compute<{
|
|
419
|
+
address: Address
|
|
420
|
+
id: bigint
|
|
421
|
+
} | null>
|
|
422
|
+
|
|
423
|
+
/**
|
|
424
|
+
* Defines a call to the `validatorTokens` function.
|
|
425
|
+
*
|
|
426
|
+
* @param args - Arguments.
|
|
427
|
+
* @returns The call.
|
|
428
|
+
*/
|
|
429
|
+
export function call(args: Args) {
|
|
430
|
+
const { validator } = args
|
|
431
|
+
return defineCall({
|
|
432
|
+
address: Addresses.feeManager,
|
|
433
|
+
abi: Abis.feeManager,
|
|
434
|
+
args: [validator],
|
|
435
|
+
functionName: 'validatorTokens',
|
|
436
|
+
})
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
/**
|
|
441
|
+
* Sets the validator's preferred fee token.
|
|
442
|
+
*
|
|
443
|
+
* @example
|
|
444
|
+
* ```ts
|
|
445
|
+
* import { createClient, http } from 'viem'
|
|
446
|
+
* import { tempo } from 'viem/chains'
|
|
447
|
+
* import { Actions } from 'viem/tempo'
|
|
448
|
+
* import { privateKeyToAccount } from 'viem/accounts'
|
|
449
|
+
*
|
|
450
|
+
* const client = createClient({
|
|
451
|
+
* account: privateKeyToAccount('0x...'),
|
|
452
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
453
|
+
* transport: http(),
|
|
454
|
+
* })
|
|
455
|
+
*
|
|
456
|
+
* const hash = await Actions.fee.setValidatorToken(client, {
|
|
457
|
+
* token: '0x...',
|
|
458
|
+
* })
|
|
459
|
+
* ```
|
|
460
|
+
*
|
|
461
|
+
* @param client - Client.
|
|
462
|
+
* @param parameters - Parameters.
|
|
463
|
+
* @returns The transaction hash.
|
|
464
|
+
*/
|
|
465
|
+
export async function setValidatorToken<
|
|
466
|
+
chain extends Chain | undefined,
|
|
467
|
+
account extends Account | undefined,
|
|
468
|
+
>(
|
|
469
|
+
client: Client<Transport, chain, account>,
|
|
470
|
+
parameters: setValidatorToken.Parameters<chain, account>,
|
|
471
|
+
): Promise<setValidatorToken.ReturnValue> {
|
|
472
|
+
return setValidatorToken.inner(writeContract, client, parameters)
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
export namespace setValidatorToken {
|
|
476
|
+
export type Parameters<
|
|
477
|
+
chain extends Chain | undefined = Chain | undefined,
|
|
478
|
+
account extends Account | undefined = Account | undefined,
|
|
479
|
+
> = WriteParameters<chain, account> & Args
|
|
480
|
+
|
|
481
|
+
export type Args = {
|
|
482
|
+
/** Address or ID of the TIP20 token. */
|
|
483
|
+
token: TokenId.TokenIdOrAddress
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
export type ReturnValue = WriteContractReturnType
|
|
487
|
+
|
|
488
|
+
// TODO: exhaustive error type
|
|
489
|
+
export type ErrorType = BaseErrorType
|
|
490
|
+
|
|
491
|
+
/** @internal */
|
|
492
|
+
export async function inner<
|
|
493
|
+
action extends typeof writeContract | typeof writeContractSync,
|
|
494
|
+
chain extends Chain | undefined,
|
|
495
|
+
account extends Account | undefined,
|
|
496
|
+
>(
|
|
497
|
+
action: action,
|
|
498
|
+
client: Client<Transport, chain, account>,
|
|
499
|
+
parameters: setValidatorToken.Parameters<chain, account>,
|
|
500
|
+
): Promise<ReturnType<action>> {
|
|
501
|
+
const { token, ...rest } = parameters
|
|
502
|
+
const call = setValidatorToken.call({ token })
|
|
503
|
+
return (await action(client, {
|
|
504
|
+
...rest,
|
|
505
|
+
...call,
|
|
506
|
+
} as never)) as never
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
/**
|
|
510
|
+
* Defines a call to the `setValidatorToken` function.
|
|
511
|
+
*
|
|
512
|
+
* Can be passed as a parameter to:
|
|
513
|
+
* - [`estimateContractGas`](https://viem.sh/docs/contract/estimateContractGas): estimate the gas cost of the call
|
|
514
|
+
* - [`simulateContract`](https://viem.sh/docs/contract/simulateContract): simulate the call
|
|
515
|
+
* - [`sendCalls`](https://viem.sh/docs/actions/wallet/sendCalls): send multiple calls
|
|
516
|
+
*
|
|
517
|
+
* @example
|
|
518
|
+
* ```ts
|
|
519
|
+
* import { createClient, http, walletActions } from 'viem'
|
|
520
|
+
* import { tempo } from 'viem/chains'
|
|
521
|
+
* import { Actions } from 'viem/tempo'
|
|
522
|
+
*
|
|
523
|
+
* const client = createClient({
|
|
524
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
525
|
+
* transport: http(),
|
|
526
|
+
* }).extend(walletActions)
|
|
527
|
+
*
|
|
528
|
+
* const { result } = await client.sendCalls({
|
|
529
|
+
* calls: [
|
|
530
|
+
* actions.fee.setValidatorToken.call({
|
|
531
|
+
* token: '0x20c0...beef',
|
|
532
|
+
* }),
|
|
533
|
+
* actions.fee.setValidatorToken.call({
|
|
534
|
+
* token: '0x20c0...babe',
|
|
535
|
+
* }),
|
|
536
|
+
* ]
|
|
537
|
+
* })
|
|
538
|
+
* ```
|
|
539
|
+
*
|
|
540
|
+
* @param args - Arguments.
|
|
541
|
+
* @returns The call.
|
|
542
|
+
*/
|
|
543
|
+
export function call(args: Args) {
|
|
544
|
+
const { token } = args
|
|
545
|
+
return defineCall({
|
|
546
|
+
address: Addresses.feeManager,
|
|
547
|
+
abi: Abis.feeManager,
|
|
548
|
+
functionName: 'setValidatorToken',
|
|
549
|
+
args: [TokenId.toAddress(token)],
|
|
550
|
+
})
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
export function extractEvent(logs: Log[]) {
|
|
554
|
+
const [log] = parseEventLogs({
|
|
555
|
+
abi: Abis.feeManager,
|
|
556
|
+
logs,
|
|
557
|
+
eventName: 'ValidatorTokenSet',
|
|
558
|
+
strict: true,
|
|
559
|
+
})
|
|
560
|
+
if (!log) throw new Error('`ValidatorTokenSet` event not found.')
|
|
561
|
+
return log
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
/**
|
|
566
|
+
* Sets the validator's preferred fee token.
|
|
567
|
+
*
|
|
568
|
+
* @example
|
|
569
|
+
* ```ts
|
|
570
|
+
* import { createClient, http } from 'viem'
|
|
571
|
+
* import { tempo } from 'viem/chains'
|
|
572
|
+
* import { Actions } from 'viem/tempo'
|
|
573
|
+
* import { privateKeyToAccount } from 'viem/accounts'
|
|
574
|
+
*
|
|
575
|
+
* const client = createClient({
|
|
576
|
+
* account: privateKeyToAccount('0x...'),
|
|
577
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
578
|
+
* transport: http(),
|
|
579
|
+
* })
|
|
580
|
+
*
|
|
581
|
+
* const result = await Actions.fee.setValidatorTokenSync(client, {
|
|
582
|
+
* token: '0x...',
|
|
583
|
+
* })
|
|
584
|
+
* ```
|
|
585
|
+
*
|
|
586
|
+
* @param client - Client.
|
|
587
|
+
* @param parameters - Parameters.
|
|
588
|
+
* @returns The transaction receipt and event data.
|
|
589
|
+
*/
|
|
590
|
+
export async function setValidatorTokenSync<
|
|
591
|
+
chain extends Chain | undefined,
|
|
592
|
+
account extends Account | undefined,
|
|
593
|
+
>(
|
|
594
|
+
client: Client<Transport, chain, account>,
|
|
595
|
+
parameters: setValidatorTokenSync.Parameters<chain, account>,
|
|
596
|
+
): Promise<setValidatorTokenSync.ReturnValue> {
|
|
597
|
+
const { throwOnReceiptRevert = true, ...rest } = parameters
|
|
598
|
+
const receipt = await setValidatorToken.inner(writeContractSync, client, {
|
|
599
|
+
...rest,
|
|
600
|
+
throwOnReceiptRevert,
|
|
601
|
+
} as never)
|
|
602
|
+
const { args } = setValidatorToken.extractEvent(receipt.logs)
|
|
603
|
+
return {
|
|
604
|
+
...args,
|
|
605
|
+
receipt,
|
|
606
|
+
} as never
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
export namespace setValidatorTokenSync {
|
|
610
|
+
export type Parameters<
|
|
611
|
+
chain extends Chain | undefined = Chain | undefined,
|
|
612
|
+
account extends Account | undefined = Account | undefined,
|
|
613
|
+
> = setValidatorToken.Parameters<chain, account>
|
|
614
|
+
|
|
615
|
+
export type Args = setValidatorToken.Args
|
|
616
|
+
|
|
617
|
+
export type ReturnValue = Compute<
|
|
618
|
+
GetEventArgs<
|
|
619
|
+
typeof Abis.feeManager,
|
|
620
|
+
'ValidatorTokenSet',
|
|
621
|
+
{ IndexedOnly: false; Required: true }
|
|
622
|
+
> & {
|
|
623
|
+
receipt: TransactionReceipt
|
|
624
|
+
}
|
|
625
|
+
>
|
|
626
|
+
|
|
627
|
+
// TODO: exhaustive error type
|
|
628
|
+
export type ErrorType = BaseErrorType
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
/**
|
|
632
|
+
* Watches for validator token set events.
|
|
633
|
+
*
|
|
634
|
+
* @example
|
|
635
|
+
* ```ts
|
|
636
|
+
* import { createClient, http } from 'viem'
|
|
637
|
+
* import { tempo } from 'viem/chains'
|
|
638
|
+
* import { Actions } from 'viem/tempo'
|
|
639
|
+
*
|
|
640
|
+
* const client = createClient({
|
|
641
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
642
|
+
* transport: http(),
|
|
643
|
+
* })
|
|
644
|
+
*
|
|
645
|
+
* const unwatch = actions.fee.watchSetValidatorToken(client, {
|
|
646
|
+
* onValidatorTokenSet: (args, log) => {
|
|
647
|
+
* console.log('Validator token set:', args)
|
|
648
|
+
* },
|
|
649
|
+
* })
|
|
650
|
+
* ```
|
|
651
|
+
*
|
|
652
|
+
* @param client - Client.
|
|
653
|
+
* @param parameters - Parameters.
|
|
654
|
+
* @returns A function to unsubscribe from the event.
|
|
655
|
+
*/
|
|
656
|
+
export function watchSetValidatorToken<
|
|
657
|
+
chain extends Chain | undefined,
|
|
658
|
+
account extends Account | undefined,
|
|
659
|
+
>(
|
|
660
|
+
client: Client<Transport, chain, account>,
|
|
661
|
+
parameters: watchSetValidatorToken.Parameters,
|
|
662
|
+
) {
|
|
663
|
+
const { onValidatorTokenSet, ...rest } = parameters
|
|
664
|
+
return watchContractEvent(client, {
|
|
665
|
+
...rest,
|
|
666
|
+
address: Addresses.feeManager,
|
|
667
|
+
abi: Abis.feeManager,
|
|
668
|
+
eventName: 'ValidatorTokenSet',
|
|
669
|
+
onLogs: (logs) => {
|
|
670
|
+
for (const log of logs) onValidatorTokenSet(log.args, log)
|
|
671
|
+
},
|
|
672
|
+
strict: true,
|
|
673
|
+
})
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
export declare namespace watchSetValidatorToken {
|
|
677
|
+
export type Args = GetEventArgs<
|
|
678
|
+
typeof Abis.feeManager,
|
|
679
|
+
'ValidatorTokenSet',
|
|
680
|
+
{ IndexedOnly: false; Required: true }
|
|
681
|
+
>
|
|
682
|
+
|
|
683
|
+
export type Log = viem_Log<
|
|
684
|
+
bigint,
|
|
685
|
+
number,
|
|
686
|
+
false,
|
|
687
|
+
ExtractAbiItem<typeof Abis.feeManager, 'ValidatorTokenSet'>,
|
|
688
|
+
true
|
|
689
|
+
>
|
|
690
|
+
|
|
691
|
+
export type Parameters = UnionOmit<
|
|
692
|
+
WatchContractEventParameters<
|
|
693
|
+
typeof Abis.feeManager,
|
|
694
|
+
'ValidatorTokenSet',
|
|
695
|
+
true
|
|
696
|
+
>,
|
|
697
|
+
'abi' | 'address' | 'batch' | 'eventName' | 'onLogs' | 'strict'
|
|
698
|
+
> & {
|
|
699
|
+
/** Callback to invoke when a validator token is set. */
|
|
700
|
+
onValidatorTokenSet: (args: Args, log: Log) => void
|
|
701
|
+
}
|
|
702
|
+
}
|
package/tempo/actions/index.ts
CHANGED
package/tempo/actions/nonce.ts
CHANGED
|
@@ -21,8 +21,8 @@ import { defineCall } from '../internal/utils.js'
|
|
|
21
21
|
* @example
|
|
22
22
|
* ```ts
|
|
23
23
|
* import { createClient, http } from 'viem'
|
|
24
|
-
* import { tempo } from '
|
|
25
|
-
* import { Actions } from 'tempo
|
|
24
|
+
* import { tempo } from 'viem/chains'
|
|
25
|
+
* import { Actions } from 'viem/tempo'
|
|
26
26
|
*
|
|
27
27
|
* const client = createClient({
|
|
28
28
|
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
|
|
@@ -80,8 +80,8 @@ export namespace getNonce {
|
|
|
80
80
|
* @example
|
|
81
81
|
* ```ts
|
|
82
82
|
* import { createClient, http } from 'viem'
|
|
83
|
-
* import { tempo } from '
|
|
84
|
-
* import { Actions } from 'tempo
|
|
83
|
+
* import { tempo } from 'viem/chains'
|
|
84
|
+
* import { Actions } from 'viem/tempo'
|
|
85
85
|
*
|
|
86
86
|
* const client = createClient({
|
|
87
87
|
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
|
package/tempo/actions/policy.ts
CHANGED
|
@@ -35,8 +35,8 @@ const policyTypeMap = {
|
|
|
35
35
|
* @example
|
|
36
36
|
* ```ts
|
|
37
37
|
* import { createClient, http } from 'viem'
|
|
38
|
-
* import { tempo } from '
|
|
39
|
-
* import { Actions } from 'tempo
|
|
38
|
+
* import { tempo } from 'viem/chains'
|
|
39
|
+
* import { Actions } from 'viem/tempo'
|
|
40
40
|
* import { privateKeyToAccount } from 'viem/accounts'
|
|
41
41
|
*
|
|
42
42
|
* const client = createClient({
|
|
@@ -131,8 +131,8 @@ export namespace create {
|
|
|
131
131
|
* @example
|
|
132
132
|
* ```ts
|
|
133
133
|
* import { createClient, http, walletActions } from 'viem'
|
|
134
|
-
* import { tempo } from '
|
|
135
|
-
* import { Actions } from 'tempo
|
|
134
|
+
* import { tempo } from 'viem/chains'
|
|
135
|
+
* import { Actions } from 'viem/tempo'
|
|
136
136
|
*
|
|
137
137
|
* const client = createClient({
|
|
138
138
|
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
@@ -201,8 +201,8 @@ export namespace create {
|
|
|
201
201
|
* @example
|
|
202
202
|
* ```ts
|
|
203
203
|
* import { createClient, http } from 'viem'
|
|
204
|
-
* import { tempo } from '
|
|
205
|
-
* import { Actions } from 'tempo
|
|
204
|
+
* import { tempo } from 'viem/chains'
|
|
205
|
+
* import { Actions } from 'viem/tempo'
|
|
206
206
|
* import { privateKeyToAccount } from 'viem/accounts'
|
|
207
207
|
*
|
|
208
208
|
* const client = createClient({
|
|
@@ -268,8 +268,8 @@ export namespace createSync {
|
|
|
268
268
|
* @example
|
|
269
269
|
* ```ts
|
|
270
270
|
* import { createClient, http } from 'viem'
|
|
271
|
-
* import { tempo } from '
|
|
272
|
-
* import { Actions } from 'tempo
|
|
271
|
+
* import { tempo } from 'viem/chains'
|
|
272
|
+
* import { Actions } from 'viem/tempo'
|
|
273
273
|
* import { privateKeyToAccount } from 'viem/accounts'
|
|
274
274
|
*
|
|
275
275
|
* const client = createClient({
|
|
@@ -345,8 +345,8 @@ export namespace setAdmin {
|
|
|
345
345
|
* @example
|
|
346
346
|
* ```ts
|
|
347
347
|
* import { createClient, http, walletActions } from 'viem'
|
|
348
|
-
* import { tempo } from '
|
|
349
|
-
* import { Actions } from 'tempo
|
|
348
|
+
* import { tempo } from 'viem/chains'
|
|
349
|
+
* import { Actions } from 'viem/tempo'
|
|
350
350
|
*
|
|
351
351
|
* const client = createClient({
|
|
352
352
|
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
@@ -404,8 +404,8 @@ export namespace setAdmin {
|
|
|
404
404
|
* @example
|
|
405
405
|
* ```ts
|
|
406
406
|
* import { createClient, http } from 'viem'
|
|
407
|
-
* import { tempo } from '
|
|
408
|
-
* import { Actions } from 'tempo
|
|
407
|
+
* import { tempo } from 'viem/chains'
|
|
408
|
+
* import { Actions } from 'viem/tempo'
|
|
409
409
|
* import { privateKeyToAccount } from 'viem/accounts'
|
|
410
410
|
*
|
|
411
411
|
* const client = createClient({
|
|
@@ -471,8 +471,8 @@ export namespace setAdminSync {
|
|
|
471
471
|
* @example
|
|
472
472
|
* ```ts
|
|
473
473
|
* import { createClient, http } from 'viem'
|
|
474
|
-
* import { tempo } from '
|
|
475
|
-
* import { Actions } from 'tempo
|
|
474
|
+
* import { tempo } from 'viem/chains'
|
|
475
|
+
* import { Actions } from 'viem/tempo'
|
|
476
476
|
* import { privateKeyToAccount } from 'viem/accounts'
|
|
477
477
|
*
|
|
478
478
|
* const client = createClient({
|
|
@@ -555,8 +555,8 @@ export namespace modifyWhitelist {
|
|
|
555
555
|
* @example
|
|
556
556
|
* ```ts
|
|
557
557
|
* import { createClient, http, walletActions } from 'viem'
|
|
558
|
-
* import { tempo } from '
|
|
559
|
-
* import { Actions } from 'tempo
|
|
558
|
+
* import { tempo } from 'viem/chains'
|
|
559
|
+
* import { Actions } from 'viem/tempo'
|
|
560
560
|
*
|
|
561
561
|
* const client = createClient({
|
|
562
562
|
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
@@ -616,8 +616,8 @@ export namespace modifyWhitelist {
|
|
|
616
616
|
* @example
|
|
617
617
|
* ```ts
|
|
618
618
|
* import { createClient, http } from 'viem'
|
|
619
|
-
* import { tempo } from '
|
|
620
|
-
* import { Actions } from 'tempo
|
|
619
|
+
* import { tempo } from 'viem/chains'
|
|
620
|
+
* import { Actions } from 'viem/tempo'
|
|
621
621
|
* import { privateKeyToAccount } from 'viem/accounts'
|
|
622
622
|
*
|
|
623
623
|
* const client = createClient({
|
|
@@ -684,8 +684,8 @@ export namespace modifyWhitelistSync {
|
|
|
684
684
|
* @example
|
|
685
685
|
* ```ts
|
|
686
686
|
* import { createClient, http } from 'viem'
|
|
687
|
-
* import { tempo } from '
|
|
688
|
-
* import { Actions } from 'tempo
|
|
687
|
+
* import { tempo } from 'viem/chains'
|
|
688
|
+
* import { Actions } from 'viem/tempo'
|
|
689
689
|
* import { privateKeyToAccount } from 'viem/accounts'
|
|
690
690
|
*
|
|
691
691
|
* const client = createClient({
|
|
@@ -768,8 +768,8 @@ export namespace modifyBlacklist {
|
|
|
768
768
|
* @example
|
|
769
769
|
* ```ts
|
|
770
770
|
* import { createClient, http, walletActions } from 'viem'
|
|
771
|
-
* import { tempo } from '
|
|
772
|
-
* import { Actions } from 'tempo
|
|
771
|
+
* import { tempo } from 'viem/chains'
|
|
772
|
+
* import { Actions } from 'viem/tempo'
|
|
773
773
|
*
|
|
774
774
|
* const client = createClient({
|
|
775
775
|
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
@@ -829,8 +829,8 @@ export namespace modifyBlacklist {
|
|
|
829
829
|
* @example
|
|
830
830
|
* ```ts
|
|
831
831
|
* import { createClient, http } from 'viem'
|
|
832
|
-
* import { tempo } from '
|
|
833
|
-
* import { Actions } from 'tempo
|
|
832
|
+
* import { tempo } from 'viem/chains'
|
|
833
|
+
* import { Actions } from 'viem/tempo'
|
|
834
834
|
* import { privateKeyToAccount } from 'viem/accounts'
|
|
835
835
|
*
|
|
836
836
|
* const client = createClient({
|
|
@@ -897,8 +897,8 @@ export namespace modifyBlacklistSync {
|
|
|
897
897
|
* @example
|
|
898
898
|
* ```ts
|
|
899
899
|
* import { createClient, http } from 'viem'
|
|
900
|
-
* import { tempo } from '
|
|
901
|
-
* import { Actions } from 'tempo
|
|
900
|
+
* import { tempo } from 'viem/chains'
|
|
901
|
+
* import { Actions } from 'viem/tempo'
|
|
902
902
|
*
|
|
903
903
|
* const client = createClient({
|
|
904
904
|
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
@@ -967,8 +967,8 @@ export namespace getData {
|
|
|
967
967
|
* @example
|
|
968
968
|
* ```ts
|
|
969
969
|
* import { createClient, http } from 'viem'
|
|
970
|
-
* import { tempo } from '
|
|
971
|
-
* import { Actions } from 'tempo
|
|
970
|
+
* import { tempo } from 'viem/chains'
|
|
971
|
+
* import { Actions } from 'viem/tempo'
|
|
972
972
|
*
|
|
973
973
|
* const client = createClient({
|
|
974
974
|
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
@@ -1035,8 +1035,8 @@ export namespace isAuthorized {
|
|
|
1035
1035
|
* @example
|
|
1036
1036
|
* ```ts
|
|
1037
1037
|
* import { createClient, http } from 'viem'
|
|
1038
|
-
* import { tempo } from '
|
|
1039
|
-
* import { Actions } from 'tempo
|
|
1038
|
+
* import { tempo } from 'viem/chains'
|
|
1039
|
+
* import { Actions } from 'viem/tempo'
|
|
1040
1040
|
*
|
|
1041
1041
|
* const client = createClient({
|
|
1042
1042
|
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
@@ -1115,8 +1115,8 @@ export declare namespace watchCreate {
|
|
|
1115
1115
|
* @example
|
|
1116
1116
|
* ```ts
|
|
1117
1117
|
* import { createClient, http } from 'viem'
|
|
1118
|
-
* import { tempo } from '
|
|
1119
|
-
* import { Actions } from 'tempo
|
|
1118
|
+
* import { tempo } from 'viem/chains'
|
|
1119
|
+
* import { Actions } from 'viem/tempo'
|
|
1120
1120
|
*
|
|
1121
1121
|
* const client = createClient({
|
|
1122
1122
|
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
@@ -1188,8 +1188,8 @@ export declare namespace watchAdminUpdated {
|
|
|
1188
1188
|
* @example
|
|
1189
1189
|
* ```ts
|
|
1190
1190
|
* import { createClient, http } from 'viem'
|
|
1191
|
-
* import { tempo } from '
|
|
1192
|
-
* import { Actions } from 'tempo
|
|
1191
|
+
* import { tempo } from 'viem/chains'
|
|
1192
|
+
* import { Actions } from 'viem/tempo'
|
|
1193
1193
|
*
|
|
1194
1194
|
* const client = createClient({
|
|
1195
1195
|
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
@@ -1261,8 +1261,8 @@ export declare namespace watchWhitelistUpdated {
|
|
|
1261
1261
|
* @example
|
|
1262
1262
|
* ```ts
|
|
1263
1263
|
* import { createClient, http } from 'viem'
|
|
1264
|
-
* import { tempo } from '
|
|
1265
|
-
* import { Actions } from 'tempo
|
|
1264
|
+
* import { tempo } from 'viem/chains'
|
|
1265
|
+
* import { Actions } from 'viem/tempo'
|
|
1266
1266
|
*
|
|
1267
1267
|
* const client = createClient({
|
|
1268
1268
|
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|