viem 2.46.2 → 2.47.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 +48 -0
- package/_cjs/actions/index.js +5 -3
- package/_cjs/actions/index.js.map +1 -1
- package/_cjs/actions/public/getDelegation.js +21 -0
- package/_cjs/actions/public/getDelegation.js.map +1 -0
- package/_cjs/actions/public/simulateCalls.js +1 -1
- package/_cjs/actions/public/simulateCalls.js.map +1 -1
- package/_cjs/actions/wallet/prepareTransactionRequest.js +12 -4
- package/_cjs/actions/wallet/prepareTransactionRequest.js.map +1 -1
- package/_cjs/actions/wallet/sendRawTransactionSync.js +1 -2
- package/_cjs/actions/wallet/sendRawTransactionSync.js.map +1 -1
- package/_cjs/chains/definitions/krown.js +26 -0
- package/_cjs/chains/definitions/krown.js.map +1 -0
- package/_cjs/chains/definitions/polygon.js +1 -1
- package/_cjs/chains/definitions/polygon.js.map +1 -1
- package/_cjs/chains/definitions/saigon.js +3 -3
- package/_cjs/chains/definitions/saigon.js.map +1 -1
- package/_cjs/chains/definitions/sei.js +3 -3
- package/_cjs/chains/definitions/sei.js.map +1 -1
- package/_cjs/chains/definitions/seiTestnet.js +3 -2
- package/_cjs/chains/definitions/seiTestnet.js.map +1 -1
- package/_cjs/chains/index.js +7 -7
- package/_cjs/chains/index.js.map +1 -1
- package/_cjs/clients/decorators/public.js +2 -0
- package/_cjs/clients/decorators/public.js.map +1 -1
- package/_cjs/errors/version.js +1 -1
- package/_cjs/index.js.map +1 -1
- package/_cjs/tempo/Account.js +28 -15
- package/_cjs/tempo/Account.js.map +1 -1
- package/_cjs/tempo/Addresses.js +2 -1
- package/_cjs/tempo/Addresses.js.map +1 -1
- package/_cjs/tempo/Decorator.js +11 -0
- package/_cjs/tempo/Decorator.js.map +1 -1
- package/_cjs/tempo/actions/accessKey.js +251 -0
- package/_cjs/tempo/actions/accessKey.js.map +1 -0
- package/_cjs/tempo/actions/index.js +2 -1
- package/_cjs/tempo/actions/index.js.map +1 -1
- package/_cjs/tempo/index.js +2 -1
- package/_cjs/tempo/index.js.map +1 -1
- package/_cjs/utils/abi/parseEventLogs.js +8 -6
- package/_cjs/utils/abi/parseEventLogs.js.map +1 -1
- package/_esm/actions/index.js +1 -0
- package/_esm/actions/index.js.map +1 -1
- package/_esm/actions/public/getDelegation.js +43 -0
- package/_esm/actions/public/getDelegation.js.map +1 -0
- package/_esm/actions/public/simulateCalls.js +1 -1
- package/_esm/actions/public/simulateCalls.js.map +1 -1
- package/_esm/actions/wallet/prepareTransactionRequest.js +12 -4
- package/_esm/actions/wallet/prepareTransactionRequest.js.map +1 -1
- package/_esm/actions/wallet/sendRawTransactionSync.js +1 -2
- package/_esm/actions/wallet/sendRawTransactionSync.js.map +1 -1
- package/_esm/chains/definitions/krown.js +23 -0
- package/_esm/chains/definitions/krown.js.map +1 -0
- package/_esm/chains/definitions/polygon.js +1 -1
- package/_esm/chains/definitions/polygon.js.map +1 -1
- package/_esm/chains/definitions/saigon.js +3 -3
- package/_esm/chains/definitions/saigon.js.map +1 -1
- package/_esm/chains/definitions/sei.js +3 -3
- package/_esm/chains/definitions/sei.js.map +1 -1
- package/_esm/chains/definitions/seiTestnet.js +3 -2
- package/_esm/chains/definitions/seiTestnet.js.map +1 -1
- package/_esm/chains/index.js +1 -1
- package/_esm/chains/index.js.map +1 -1
- package/_esm/clients/decorators/public.js +2 -0
- package/_esm/clients/decorators/public.js.map +1 -1
- package/_esm/errors/version.js +1 -1
- package/_esm/index.js.map +1 -1
- package/_esm/tempo/Account.js +28 -16
- package/_esm/tempo/Account.js.map +1 -1
- package/_esm/tempo/Addresses.js +1 -0
- package/_esm/tempo/Addresses.js.map +1 -1
- package/_esm/tempo/Decorator.js +11 -0
- package/_esm/tempo/Decorator.js.map +1 -1
- package/_esm/tempo/actions/accessKey.js +562 -0
- package/_esm/tempo/actions/accessKey.js.map +1 -0
- package/_esm/tempo/actions/index.js +1 -0
- package/_esm/tempo/actions/index.js.map +1 -1
- package/_esm/tempo/index.js +1 -1
- package/_esm/tempo/index.js.map +1 -1
- package/_esm/utils/abi/parseEventLogs.js +11 -6
- package/_esm/utils/abi/parseEventLogs.js.map +1 -1
- package/_types/actions/index.d.ts +1 -0
- package/_types/actions/index.d.ts.map +1 -1
- package/_types/actions/public/getDelegation.d.ts +46 -0
- package/_types/actions/public/getDelegation.d.ts.map +1 -0
- package/_types/actions/wallet/prepareTransactionRequest.d.ts.map +1 -1
- package/_types/actions/wallet/sendRawTransactionSync.d.ts +1 -1
- package/_types/actions/wallet/sendRawTransactionSync.d.ts.map +1 -1
- package/_types/chains/definitions/abstract.d.ts +1 -0
- package/_types/chains/definitions/abstract.d.ts.map +1 -1
- package/_types/chains/definitions/abstractTestnet.d.ts +1 -0
- package/_types/chains/definitions/abstractTestnet.d.ts.map +1 -1
- package/_types/chains/definitions/ancient8.d.ts +1 -0
- package/_types/chains/definitions/ancient8.d.ts.map +1 -1
- package/_types/chains/definitions/ancient8Sepolia.d.ts +1 -0
- package/_types/chains/definitions/ancient8Sepolia.d.ts.map +1 -1
- package/_types/chains/definitions/base.d.ts +2 -0
- package/_types/chains/definitions/base.d.ts.map +1 -1
- package/_types/chains/definitions/baseGoerli.d.ts +1 -0
- package/_types/chains/definitions/baseGoerli.d.ts.map +1 -1
- package/_types/chains/definitions/baseSepolia.d.ts +2 -0
- package/_types/chains/definitions/baseSepolia.d.ts.map +1 -1
- package/_types/chains/definitions/blast.d.ts +1 -0
- package/_types/chains/definitions/blast.d.ts.map +1 -1
- package/_types/chains/definitions/bob.d.ts +1 -0
- package/_types/chains/definitions/bob.d.ts.map +1 -1
- package/_types/chains/definitions/bobSepolia.d.ts +1 -0
- package/_types/chains/definitions/bobSepolia.d.ts.map +1 -1
- package/_types/chains/definitions/codex.d.ts +1 -0
- package/_types/chains/definitions/codex.d.ts.map +1 -1
- package/_types/chains/definitions/codexTestnet.d.ts +1 -0
- package/_types/chains/definitions/codexTestnet.d.ts.map +1 -1
- package/_types/chains/definitions/dchain.d.ts +1 -0
- package/_types/chains/definitions/dchain.d.ts.map +1 -1
- package/_types/chains/definitions/dchainTestnet.d.ts +1 -0
- package/_types/chains/definitions/dchainTestnet.d.ts.map +1 -1
- package/_types/chains/definitions/elysiumTestnet.d.ts +1 -0
- package/_types/chains/definitions/elysiumTestnet.d.ts.map +1 -1
- package/_types/chains/definitions/fraxtal.d.ts +1 -0
- package/_types/chains/definitions/fraxtal.d.ts.map +1 -1
- package/_types/chains/definitions/fraxtalTestnet.d.ts +1 -0
- package/_types/chains/definitions/fraxtalTestnet.d.ts.map +1 -1
- package/_types/chains/definitions/funkiMainnet.d.ts +1 -0
- package/_types/chains/definitions/funkiMainnet.d.ts.map +1 -1
- package/_types/chains/definitions/funkiSepolia.d.ts +1 -0
- package/_types/chains/definitions/funkiSepolia.d.ts.map +1 -1
- package/_types/chains/definitions/garnet.d.ts +1 -0
- package/_types/chains/definitions/garnet.d.ts.map +1 -1
- package/_types/chains/definitions/giwaSepolia.d.ts +2 -0
- package/_types/chains/definitions/giwaSepolia.d.ts.map +1 -1
- package/_types/chains/definitions/ink.d.ts +1 -0
- package/_types/chains/definitions/ink.d.ts.map +1 -1
- package/_types/chains/definitions/inkSepolia.d.ts +1 -0
- package/_types/chains/definitions/inkSepolia.d.ts.map +1 -1
- package/_types/chains/definitions/{seiDevnet.d.ts → krown.d.ts} +10 -10
- package/_types/chains/definitions/krown.d.ts.map +1 -0
- package/_types/chains/definitions/lisk.d.ts +1 -0
- package/_types/chains/definitions/lisk.d.ts.map +1 -1
- package/_types/chains/definitions/liskSepolia.d.ts +1 -0
- package/_types/chains/definitions/liskSepolia.d.ts.map +1 -1
- package/_types/chains/definitions/metalL2.d.ts +1 -0
- package/_types/chains/definitions/metalL2.d.ts.map +1 -1
- package/_types/chains/definitions/mode.d.ts +1 -0
- package/_types/chains/definitions/mode.d.ts.map +1 -1
- package/_types/chains/definitions/modeTestnet.d.ts +1 -0
- package/_types/chains/definitions/modeTestnet.d.ts.map +1 -1
- package/_types/chains/definitions/optimism.d.ts +1 -0
- package/_types/chains/definitions/optimism.d.ts.map +1 -1
- package/_types/chains/definitions/optimismGoerli.d.ts +1 -0
- package/_types/chains/definitions/optimismGoerli.d.ts.map +1 -1
- package/_types/chains/definitions/optimismSepolia.d.ts +1 -0
- package/_types/chains/definitions/optimismSepolia.d.ts.map +1 -1
- package/_types/chains/definitions/pgn.d.ts +1 -0
- package/_types/chains/definitions/pgn.d.ts.map +1 -1
- package/_types/chains/definitions/pgnTestnet.d.ts +1 -0
- package/_types/chains/definitions/pgnTestnet.d.ts.map +1 -1
- package/_types/chains/definitions/playfiAlbireo.d.ts +1 -0
- package/_types/chains/definitions/playfiAlbireo.d.ts.map +1 -1
- package/_types/chains/definitions/polygon.d.ts +1 -1
- package/_types/chains/definitions/pyrope.d.ts +1 -0
- package/_types/chains/definitions/pyrope.d.ts.map +1 -1
- package/_types/chains/definitions/redstone.d.ts +1 -0
- package/_types/chains/definitions/redstone.d.ts.map +1 -1
- package/_types/chains/definitions/rss3.d.ts +1 -0
- package/_types/chains/definitions/rss3.d.ts.map +1 -1
- package/_types/chains/definitions/rss3Sepolia.d.ts +1 -0
- package/_types/chains/definitions/rss3Sepolia.d.ts.map +1 -1
- package/_types/chains/definitions/saigon.d.ts +3 -3
- package/_types/chains/definitions/sei.d.ts +3 -3
- package/_types/chains/definitions/seiTestnet.d.ts +3 -2
- package/_types/chains/definitions/seiTestnet.d.ts.map +1 -1
- package/_types/chains/definitions/shape.d.ts +1 -0
- package/_types/chains/definitions/shape.d.ts.map +1 -1
- package/_types/chains/definitions/shapeSepolia.d.ts +1 -0
- package/_types/chains/definitions/shapeSepolia.d.ts.map +1 -1
- package/_types/chains/definitions/snax.d.ts +1 -0
- package/_types/chains/definitions/snax.d.ts.map +1 -1
- package/_types/chains/definitions/snaxTestnet.d.ts +1 -0
- package/_types/chains/definitions/snaxTestnet.d.ts.map +1 -1
- package/_types/chains/definitions/soneium.d.ts +1 -0
- package/_types/chains/definitions/soneium.d.ts.map +1 -1
- package/_types/chains/definitions/soneiumMinato.d.ts +1 -0
- package/_types/chains/definitions/soneiumMinato.d.ts.map +1 -1
- package/_types/chains/definitions/sophon.d.ts +1 -0
- package/_types/chains/definitions/sophon.d.ts.map +1 -1
- package/_types/chains/definitions/sophonTestnet.d.ts +1 -0
- package/_types/chains/definitions/sophonTestnet.d.ts.map +1 -1
- package/_types/chains/definitions/superseed.d.ts +1 -0
- package/_types/chains/definitions/superseed.d.ts.map +1 -1
- package/_types/chains/definitions/superseedSepolia.d.ts +1 -0
- package/_types/chains/definitions/superseedSepolia.d.ts.map +1 -1
- package/_types/chains/definitions/swellchain.d.ts +1 -0
- package/_types/chains/definitions/swellchain.d.ts.map +1 -1
- package/_types/chains/definitions/swellchainTestnet.d.ts +1 -0
- package/_types/chains/definitions/swellchainTestnet.d.ts.map +1 -1
- package/_types/chains/definitions/tempo.d.ts +2 -0
- package/_types/chains/definitions/tempo.d.ts.map +1 -1
- package/_types/chains/definitions/tempoAndantino.d.ts +2 -0
- package/_types/chains/definitions/tempoAndantino.d.ts.map +1 -1
- package/_types/chains/definitions/tempoDevnet.d.ts +2 -0
- package/_types/chains/definitions/tempoDevnet.d.ts.map +1 -1
- package/_types/chains/definitions/tempoLocalnet.d.ts +2 -0
- package/_types/chains/definitions/tempoLocalnet.d.ts.map +1 -1
- package/_types/chains/definitions/tempoModerato.d.ts +2 -0
- package/_types/chains/definitions/tempoModerato.d.ts.map +1 -1
- package/_types/chains/definitions/treasure.d.ts +1 -0
- package/_types/chains/definitions/treasure.d.ts.map +1 -1
- package/_types/chains/definitions/treasureTopaz.d.ts +1 -0
- package/_types/chains/definitions/treasureTopaz.d.ts.map +1 -1
- package/_types/chains/definitions/unichain.d.ts +1 -0
- package/_types/chains/definitions/unichain.d.ts.map +1 -1
- package/_types/chains/definitions/unichainSepolia.d.ts +1 -0
- package/_types/chains/definitions/unichainSepolia.d.ts.map +1 -1
- package/_types/chains/definitions/worldchain.d.ts +1 -0
- package/_types/chains/definitions/worldchain.d.ts.map +1 -1
- package/_types/chains/definitions/worldchainSepolia.d.ts +1 -0
- package/_types/chains/definitions/worldchainSepolia.d.ts.map +1 -1
- package/_types/chains/definitions/zircuit.d.ts +1 -0
- package/_types/chains/definitions/zircuit.d.ts.map +1 -1
- package/_types/chains/definitions/zircuitGarfieldTestnet.d.ts +1 -0
- package/_types/chains/definitions/zircuitGarfieldTestnet.d.ts.map +1 -1
- package/_types/chains/definitions/zircuitTestnet.d.ts +1 -0
- package/_types/chains/definitions/zircuitTestnet.d.ts.map +1 -1
- package/_types/chains/definitions/zksync.d.ts +1 -0
- package/_types/chains/definitions/zksync.d.ts.map +1 -1
- package/_types/chains/definitions/zksyncInMemoryNode.d.ts +1 -0
- package/_types/chains/definitions/zksyncInMemoryNode.d.ts.map +1 -1
- package/_types/chains/definitions/zksyncLocalCustomHyperchain.d.ts +1 -0
- package/_types/chains/definitions/zksyncLocalCustomHyperchain.d.ts.map +1 -1
- package/_types/chains/definitions/zksyncLocalHyperchain.d.ts +1 -0
- package/_types/chains/definitions/zksyncLocalHyperchain.d.ts.map +1 -1
- package/_types/chains/definitions/zksyncLocalNode.d.ts +1 -0
- package/_types/chains/definitions/zksyncLocalNode.d.ts.map +1 -1
- package/_types/chains/definitions/zksyncSepoliaTestnet.d.ts +1 -0
- package/_types/chains/definitions/zksyncSepoliaTestnet.d.ts.map +1 -1
- package/_types/chains/definitions/zora.d.ts +1 -0
- package/_types/chains/definitions/zora.d.ts.map +1 -1
- package/_types/chains/definitions/zoraSepolia.d.ts +1 -0
- package/_types/chains/definitions/zoraSepolia.d.ts.map +1 -1
- package/_types/chains/definitions/zoraTestnet.d.ts +1 -0
- package/_types/chains/definitions/zoraTestnet.d.ts.map +1 -1
- package/_types/chains/index.d.ts +1 -1
- package/_types/chains/index.d.ts.map +1 -1
- package/_types/clients/decorators/public.d.ts +22 -0
- package/_types/clients/decorators/public.d.ts.map +1 -1
- package/_types/errors/version.d.ts +1 -1
- package/_types/index.d.ts +1 -0
- package/_types/index.d.ts.map +1 -1
- package/_types/op-stack/chainConfig.d.ts +1 -0
- package/_types/op-stack/chainConfig.d.ts.map +1 -1
- package/_types/op-stack/formatters.d.ts +1 -0
- package/_types/op-stack/formatters.d.ts.map +1 -1
- package/_types/tempo/Account.d.ts +20 -17
- package/_types/tempo/Account.d.ts.map +1 -1
- package/_types/tempo/Addresses.d.ts +1 -0
- package/_types/tempo/Addresses.d.ts.map +1 -1
- package/_types/tempo/Decorator.d.ts +340 -122
- package/_types/tempo/Decorator.d.ts.map +1 -1
- package/_types/tempo/WebAuthnP256.d.ts +2 -2
- package/_types/tempo/WebAuthnP256.d.ts.map +1 -1
- package/_types/tempo/actions/accessKey.d.ts +1174 -0
- package/_types/tempo/actions/accessKey.d.ts.map +1 -0
- package/_types/tempo/actions/index.d.ts +1 -0
- package/_types/tempo/actions/index.d.ts.map +1 -1
- package/_types/tempo/chainConfig.d.ts +1 -0
- package/_types/tempo/chainConfig.d.ts.map +1 -1
- package/_types/tempo/index.d.ts +1 -1
- package/_types/tempo/index.d.ts.map +1 -1
- package/_types/types/eip1193.d.ts +2 -2
- package/_types/types/eip1193.d.ts.map +1 -1
- package/_types/types/transaction.d.ts +2 -0
- package/_types/types/transaction.d.ts.map +1 -1
- package/_types/utils/abi/parseEventLogs.d.ts.map +1 -1
- package/_types/zksync/chainConfig.d.ts +1 -0
- package/_types/zksync/chainConfig.d.ts.map +1 -1
- package/_types/zksync/formatters.d.ts +1 -0
- package/_types/zksync/formatters.d.ts.map +1 -1
- package/actions/index.ts +6 -0
- package/actions/public/getDelegation.ts +80 -0
- package/actions/public/simulateCalls.ts +1 -1
- package/actions/wallet/prepareTransactionRequest.ts +12 -4
- package/actions/wallet/sendRawTransactionSync.ts +2 -5
- package/chains/definitions/krown.ts +23 -0
- package/chains/definitions/polygon.ts +1 -1
- package/chains/definitions/saigon.ts +3 -3
- package/chains/definitions/sei.ts +3 -3
- package/chains/definitions/seiTestnet.ts +3 -2
- package/chains/index.ts +1 -1
- package/clients/decorators/public.ts +29 -0
- package/errors/version.ts +1 -1
- package/index.ts +5 -0
- package/package.json +2 -2
- package/tempo/Account.ts +58 -39
- package/tempo/Addresses.ts +1 -0
- package/tempo/Decorator.ts +373 -122
- package/tempo/WebAuthnP256.ts +5 -2
- package/tempo/actions/accessKey.ts +857 -0
- package/tempo/actions/index.ts +1 -0
- package/tempo/index.ts +1 -1
- package/types/eip1193.ts +2 -2
- package/types/transaction.ts +2 -0
- package/utils/abi/parseEventLogs.ts +13 -6
- package/_cjs/chains/definitions/seiDevnet.js +0 -22
- package/_cjs/chains/definitions/seiDevnet.js.map +0 -1
- package/_esm/chains/definitions/seiDevnet.js +0 -19
- package/_esm/chains/definitions/seiDevnet.js.map +0 -1
- package/_types/chains/definitions/seiDevnet.d.ts.map +0 -1
- package/chains/definitions/seiDevnet.ts +0 -19
|
@@ -0,0 +1,1174 @@
|
|
|
1
|
+
import type { Address } from 'abitype';
|
|
2
|
+
import type { Account } from '../../accounts/types.js';
|
|
3
|
+
import type { ReadContractReturnType } from '../../actions/public/readContract.js';
|
|
4
|
+
import { sendTransaction } from '../../actions/wallet/sendTransaction.js';
|
|
5
|
+
import { sendTransactionSync } from '../../actions/wallet/sendTransactionSync.js';
|
|
6
|
+
import type { WriteContractReturnType } from '../../actions/wallet/writeContract.js';
|
|
7
|
+
import { writeContract } from '../../actions/wallet/writeContract.js';
|
|
8
|
+
import { writeContractSync } from '../../actions/wallet/writeContractSync.js';
|
|
9
|
+
import type { Client } from '../../clients/createClient.js';
|
|
10
|
+
import type { Transport } from '../../clients/transports/createTransport.js';
|
|
11
|
+
import type { BaseErrorType } from '../../errors/base.js';
|
|
12
|
+
import type { Chain } from '../../types/chain.js';
|
|
13
|
+
import type { GetEventArgs } from '../../types/contract.js';
|
|
14
|
+
import type { Log } from '../../types/log.js';
|
|
15
|
+
import type { Compute } from '../../types/utils.js';
|
|
16
|
+
import * as Abis from '../Abis.js';
|
|
17
|
+
import type { AccessKeyAccount } from '../Account.js';
|
|
18
|
+
import { signKeyAuthorization } from '../Account.js';
|
|
19
|
+
import type { GetAccountParameter, ReadParameters, WriteParameters } from '../internal/types.js';
|
|
20
|
+
import type { TransactionReceipt } from '../Transaction.js';
|
|
21
|
+
/**
|
|
22
|
+
* Authorizes an access key by signing a key authorization and sending a transaction.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts
|
|
26
|
+
* import { createClient, http } from 'viem'
|
|
27
|
+
* import { tempo } from 'viem/chains'
|
|
28
|
+
* import { Actions, Account } from 'viem/tempo'
|
|
29
|
+
* import { generatePrivateKey } from 'viem/accounts'
|
|
30
|
+
*
|
|
31
|
+
* const account = Account.from({ privateKey: '0x...' })
|
|
32
|
+
* const client = createClient({
|
|
33
|
+
* account,
|
|
34
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
|
|
35
|
+
* transport: http(),
|
|
36
|
+
* })
|
|
37
|
+
*
|
|
38
|
+
* const accessKey = Account.fromP256(generatePrivateKey(), {
|
|
39
|
+
* access: account,
|
|
40
|
+
* })
|
|
41
|
+
*
|
|
42
|
+
* const hash = await Actions.accessKey.authorize(client, {
|
|
43
|
+
* accessKey,
|
|
44
|
+
* expiry: Math.floor((Date.now() + 30_000) / 1000),
|
|
45
|
+
* })
|
|
46
|
+
* ```
|
|
47
|
+
*
|
|
48
|
+
* @param client - Client.
|
|
49
|
+
* @param parameters - Parameters.
|
|
50
|
+
* @returns The transaction hash.
|
|
51
|
+
*/
|
|
52
|
+
export declare function authorize<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, parameters: authorize.Parameters<chain, account>): Promise<authorize.ReturnValue>;
|
|
53
|
+
export declare namespace authorize {
|
|
54
|
+
type Parameters<chain extends Chain | undefined = Chain | undefined, account extends Account | undefined = Account | undefined> = WriteParameters<chain, account> & Args;
|
|
55
|
+
type Args = {
|
|
56
|
+
/** The access key to authorize. */
|
|
57
|
+
accessKey: Pick<AccessKeyAccount, 'accessKeyAddress' | 'keyType'>;
|
|
58
|
+
/** The chain ID. */
|
|
59
|
+
chainId?: number | undefined;
|
|
60
|
+
/** Unix timestamp when the key expires. */
|
|
61
|
+
expiry?: number | undefined;
|
|
62
|
+
/** Spending limits per token. */
|
|
63
|
+
limits?: {
|
|
64
|
+
token: Address;
|
|
65
|
+
limit: bigint;
|
|
66
|
+
}[] | undefined;
|
|
67
|
+
};
|
|
68
|
+
type ReturnValue = WriteContractReturnType;
|
|
69
|
+
type ErrorType = BaseErrorType;
|
|
70
|
+
/** @internal */
|
|
71
|
+
function inner<action extends typeof sendTransaction | typeof sendTransactionSync, chain extends Chain | undefined, account extends Account | undefined>(action: action, client: Client<Transport, chain, account>, parameters: authorize.Parameters<chain, account>): Promise<ReturnType<action>>;
|
|
72
|
+
function extractEvent(logs: Log[]): Log<bigint, number, false, undefined, true, readonly [{
|
|
73
|
+
readonly name: "authorizeKey";
|
|
74
|
+
readonly type: "function";
|
|
75
|
+
readonly stateMutability: "nonpayable";
|
|
76
|
+
readonly inputs: readonly [{
|
|
77
|
+
readonly type: "address";
|
|
78
|
+
readonly name: "keyId";
|
|
79
|
+
}, {
|
|
80
|
+
readonly type: "uint8";
|
|
81
|
+
readonly name: "signatureType";
|
|
82
|
+
}, {
|
|
83
|
+
readonly type: "uint64";
|
|
84
|
+
readonly name: "expiry";
|
|
85
|
+
}, {
|
|
86
|
+
readonly type: "bool";
|
|
87
|
+
readonly name: "enforceLimits";
|
|
88
|
+
}, {
|
|
89
|
+
readonly type: "tuple[]";
|
|
90
|
+
readonly name: "limits";
|
|
91
|
+
readonly components: readonly [{
|
|
92
|
+
readonly type: "address";
|
|
93
|
+
readonly name: "token";
|
|
94
|
+
}, {
|
|
95
|
+
readonly type: "uint256";
|
|
96
|
+
readonly name: "amount";
|
|
97
|
+
}];
|
|
98
|
+
}];
|
|
99
|
+
readonly outputs: readonly [];
|
|
100
|
+
}, {
|
|
101
|
+
readonly name: "revokeKey";
|
|
102
|
+
readonly type: "function";
|
|
103
|
+
readonly stateMutability: "nonpayable";
|
|
104
|
+
readonly inputs: readonly [{
|
|
105
|
+
readonly type: "address";
|
|
106
|
+
readonly name: "keyId";
|
|
107
|
+
}];
|
|
108
|
+
readonly outputs: readonly [];
|
|
109
|
+
}, {
|
|
110
|
+
readonly name: "updateSpendingLimit";
|
|
111
|
+
readonly type: "function";
|
|
112
|
+
readonly stateMutability: "nonpayable";
|
|
113
|
+
readonly inputs: readonly [{
|
|
114
|
+
readonly type: "address";
|
|
115
|
+
readonly name: "keyId";
|
|
116
|
+
}, {
|
|
117
|
+
readonly type: "address";
|
|
118
|
+
readonly name: "token";
|
|
119
|
+
}, {
|
|
120
|
+
readonly type: "uint256";
|
|
121
|
+
readonly name: "newLimit";
|
|
122
|
+
}];
|
|
123
|
+
readonly outputs: readonly [];
|
|
124
|
+
}, {
|
|
125
|
+
readonly name: "getKey";
|
|
126
|
+
readonly type: "function";
|
|
127
|
+
readonly stateMutability: "view";
|
|
128
|
+
readonly inputs: readonly [{
|
|
129
|
+
readonly type: "address";
|
|
130
|
+
readonly name: "account";
|
|
131
|
+
}, {
|
|
132
|
+
readonly type: "address";
|
|
133
|
+
readonly name: "keyId";
|
|
134
|
+
}];
|
|
135
|
+
readonly outputs: readonly [{
|
|
136
|
+
readonly type: "tuple";
|
|
137
|
+
readonly components: readonly [{
|
|
138
|
+
readonly type: "uint8";
|
|
139
|
+
readonly name: "signatureType";
|
|
140
|
+
}, {
|
|
141
|
+
readonly type: "address";
|
|
142
|
+
readonly name: "keyId";
|
|
143
|
+
}, {
|
|
144
|
+
readonly type: "uint64";
|
|
145
|
+
readonly name: "expiry";
|
|
146
|
+
}, {
|
|
147
|
+
readonly type: "bool";
|
|
148
|
+
readonly name: "enforceLimits";
|
|
149
|
+
}, {
|
|
150
|
+
readonly type: "bool";
|
|
151
|
+
readonly name: "isRevoked";
|
|
152
|
+
}];
|
|
153
|
+
}];
|
|
154
|
+
}, {
|
|
155
|
+
readonly name: "getRemainingLimit";
|
|
156
|
+
readonly type: "function";
|
|
157
|
+
readonly stateMutability: "view";
|
|
158
|
+
readonly inputs: readonly [{
|
|
159
|
+
readonly type: "address";
|
|
160
|
+
readonly name: "account";
|
|
161
|
+
}, {
|
|
162
|
+
readonly type: "address";
|
|
163
|
+
readonly name: "keyId";
|
|
164
|
+
}, {
|
|
165
|
+
readonly type: "address";
|
|
166
|
+
readonly name: "token";
|
|
167
|
+
}];
|
|
168
|
+
readonly outputs: readonly [{
|
|
169
|
+
readonly type: "uint256";
|
|
170
|
+
}];
|
|
171
|
+
}, {
|
|
172
|
+
readonly name: "getTransactionKey";
|
|
173
|
+
readonly type: "function";
|
|
174
|
+
readonly stateMutability: "view";
|
|
175
|
+
readonly inputs: readonly [];
|
|
176
|
+
readonly outputs: readonly [{
|
|
177
|
+
readonly type: "address";
|
|
178
|
+
}];
|
|
179
|
+
}, {
|
|
180
|
+
readonly name: "KeyAuthorized";
|
|
181
|
+
readonly type: "event";
|
|
182
|
+
readonly inputs: readonly [{
|
|
183
|
+
readonly type: "address";
|
|
184
|
+
readonly name: "account";
|
|
185
|
+
readonly indexed: true;
|
|
186
|
+
}, {
|
|
187
|
+
readonly type: "address";
|
|
188
|
+
readonly name: "publicKey";
|
|
189
|
+
readonly indexed: true;
|
|
190
|
+
}, {
|
|
191
|
+
readonly type: "uint8";
|
|
192
|
+
readonly name: "signatureType";
|
|
193
|
+
}, {
|
|
194
|
+
readonly type: "uint64";
|
|
195
|
+
readonly name: "expiry";
|
|
196
|
+
}];
|
|
197
|
+
}, {
|
|
198
|
+
readonly name: "KeyRevoked";
|
|
199
|
+
readonly type: "event";
|
|
200
|
+
readonly inputs: readonly [{
|
|
201
|
+
readonly type: "address";
|
|
202
|
+
readonly name: "account";
|
|
203
|
+
readonly indexed: true;
|
|
204
|
+
}, {
|
|
205
|
+
readonly type: "address";
|
|
206
|
+
readonly name: "publicKey";
|
|
207
|
+
readonly indexed: true;
|
|
208
|
+
}];
|
|
209
|
+
}, {
|
|
210
|
+
readonly name: "SpendingLimitUpdated";
|
|
211
|
+
readonly type: "event";
|
|
212
|
+
readonly inputs: readonly [{
|
|
213
|
+
readonly type: "address";
|
|
214
|
+
readonly name: "account";
|
|
215
|
+
readonly indexed: true;
|
|
216
|
+
}, {
|
|
217
|
+
readonly type: "address";
|
|
218
|
+
readonly name: "publicKey";
|
|
219
|
+
readonly indexed: true;
|
|
220
|
+
}, {
|
|
221
|
+
readonly type: "address";
|
|
222
|
+
readonly name: "token";
|
|
223
|
+
readonly indexed: true;
|
|
224
|
+
}, {
|
|
225
|
+
readonly type: "uint256";
|
|
226
|
+
readonly name: "newLimit";
|
|
227
|
+
}];
|
|
228
|
+
}, {
|
|
229
|
+
readonly name: "UnauthorizedCaller";
|
|
230
|
+
readonly type: "error";
|
|
231
|
+
readonly inputs: readonly [];
|
|
232
|
+
}, {
|
|
233
|
+
readonly name: "KeyAlreadyExists";
|
|
234
|
+
readonly type: "error";
|
|
235
|
+
readonly inputs: readonly [];
|
|
236
|
+
}, {
|
|
237
|
+
readonly name: "KeyNotFound";
|
|
238
|
+
readonly type: "error";
|
|
239
|
+
readonly inputs: readonly [];
|
|
240
|
+
}, {
|
|
241
|
+
readonly name: "KeyExpired";
|
|
242
|
+
readonly type: "error";
|
|
243
|
+
readonly inputs: readonly [];
|
|
244
|
+
}, {
|
|
245
|
+
readonly name: "SpendingLimitExceeded";
|
|
246
|
+
readonly type: "error";
|
|
247
|
+
readonly inputs: readonly [];
|
|
248
|
+
}, {
|
|
249
|
+
readonly name: "InvalidSignatureType";
|
|
250
|
+
readonly type: "error";
|
|
251
|
+
readonly inputs: readonly [];
|
|
252
|
+
}, {
|
|
253
|
+
readonly name: "ZeroPublicKey";
|
|
254
|
+
readonly type: "error";
|
|
255
|
+
readonly inputs: readonly [];
|
|
256
|
+
}, {
|
|
257
|
+
readonly name: "ExpiryInPast";
|
|
258
|
+
readonly type: "error";
|
|
259
|
+
readonly inputs: readonly [];
|
|
260
|
+
}, {
|
|
261
|
+
readonly name: "KeyAlreadyRevoked";
|
|
262
|
+
readonly type: "error";
|
|
263
|
+
readonly inputs: readonly [];
|
|
264
|
+
}], "KeyAuthorized">;
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Authorizes an access key and waits for the transaction receipt.
|
|
268
|
+
*
|
|
269
|
+
* @example
|
|
270
|
+
* ```ts
|
|
271
|
+
* import { createClient, http } from 'viem'
|
|
272
|
+
* import { tempo } from 'viem/chains'
|
|
273
|
+
* import { Actions, Account } from 'viem/tempo'
|
|
274
|
+
* import { generatePrivateKey } from 'viem/accounts'
|
|
275
|
+
*
|
|
276
|
+
* const account = Account.from({ privateKey: '0x...' })
|
|
277
|
+
* const client = createClient({
|
|
278
|
+
* account,
|
|
279
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
|
|
280
|
+
* transport: http(),
|
|
281
|
+
* })
|
|
282
|
+
*
|
|
283
|
+
* const accessKey = Account.fromP256(generatePrivateKey(), {
|
|
284
|
+
* access: account,
|
|
285
|
+
* })
|
|
286
|
+
*
|
|
287
|
+
* const { receipt, ...result } = await Actions.accessKey.authorizeSync(client, {
|
|
288
|
+
* accessKey,
|
|
289
|
+
* expiry: Math.floor((Date.now() + 30_000) / 1000),
|
|
290
|
+
* })
|
|
291
|
+
* ```
|
|
292
|
+
*
|
|
293
|
+
* @param client - Client.
|
|
294
|
+
* @param parameters - Parameters.
|
|
295
|
+
* @returns The transaction receipt and event data.
|
|
296
|
+
*/
|
|
297
|
+
export declare function authorizeSync<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, parameters: authorizeSync.Parameters<chain, account>): Promise<authorizeSync.ReturnValue>;
|
|
298
|
+
export declare namespace authorizeSync {
|
|
299
|
+
type Parameters<chain extends Chain | undefined = Chain | undefined, account extends Account | undefined = Account | undefined> = authorize.Parameters<chain, account>;
|
|
300
|
+
type Args = authorize.Args;
|
|
301
|
+
type ReturnValue = Compute<GetEventArgs<typeof Abis.accountKeychain, 'KeyAuthorized', {
|
|
302
|
+
IndexedOnly: false;
|
|
303
|
+
Required: true;
|
|
304
|
+
}> & {
|
|
305
|
+
receipt: TransactionReceipt;
|
|
306
|
+
}>;
|
|
307
|
+
type ErrorType = BaseErrorType;
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Revokes an authorized access key.
|
|
311
|
+
*
|
|
312
|
+
* @example
|
|
313
|
+
* ```ts
|
|
314
|
+
* import { createClient, http } from 'viem'
|
|
315
|
+
* import { tempo } from 'viem/chains'
|
|
316
|
+
* import { Actions } from 'viem/tempo'
|
|
317
|
+
* import { privateKeyToAccount } from 'viem/accounts'
|
|
318
|
+
*
|
|
319
|
+
* const client = createClient({
|
|
320
|
+
* account: privateKeyToAccount('0x...'),
|
|
321
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
|
|
322
|
+
* transport: http(),
|
|
323
|
+
* })
|
|
324
|
+
*
|
|
325
|
+
* const hash = await Actions.accessKey.revoke(client, {
|
|
326
|
+
* accessKey: '0x...',
|
|
327
|
+
* })
|
|
328
|
+
* ```
|
|
329
|
+
*
|
|
330
|
+
* @param client - Client.
|
|
331
|
+
* @param parameters - Parameters.
|
|
332
|
+
* @returns The transaction hash.
|
|
333
|
+
*/
|
|
334
|
+
export declare function revoke<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, parameters: revoke.Parameters<chain, account>): Promise<revoke.ReturnValue>;
|
|
335
|
+
export declare namespace revoke {
|
|
336
|
+
type Parameters<chain extends Chain | undefined = Chain | undefined, account extends Account | undefined = Account | undefined> = WriteParameters<chain, account> & Args;
|
|
337
|
+
type Args = {
|
|
338
|
+
/** The access key to revoke. */
|
|
339
|
+
accessKey: Address | AccessKeyAccount;
|
|
340
|
+
};
|
|
341
|
+
type ReturnValue = WriteContractReturnType;
|
|
342
|
+
type ErrorType = BaseErrorType;
|
|
343
|
+
/** @internal */
|
|
344
|
+
function inner<action extends typeof writeContract | typeof writeContractSync, chain extends Chain | undefined, account extends Account | undefined>(action: action, client: Client<Transport, chain, account>, parameters: revoke.Parameters<chain, account>): Promise<ReturnType<action>>;
|
|
345
|
+
/**
|
|
346
|
+
* Defines a call to the `revokeKey` function.
|
|
347
|
+
*
|
|
348
|
+
* Can be passed as a parameter to:
|
|
349
|
+
* - [`estimateContractGas`](https://viem.sh/docs/contract/estimateContractGas): estimate the gas cost of the call
|
|
350
|
+
* - [`simulateContract`](https://viem.sh/docs/contract/simulateContract): simulate the call
|
|
351
|
+
* - [`sendCalls`](https://viem.sh/docs/actions/wallet/sendCalls): send multiple calls
|
|
352
|
+
*
|
|
353
|
+
* @example
|
|
354
|
+
* ```ts
|
|
355
|
+
* import { createClient, http, walletActions } from 'viem'
|
|
356
|
+
* import { tempo } from 'viem/chains'
|
|
357
|
+
* import { Actions } from 'viem/tempo'
|
|
358
|
+
*
|
|
359
|
+
* const client = createClient({
|
|
360
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
|
|
361
|
+
* transport: http(),
|
|
362
|
+
* }).extend(walletActions)
|
|
363
|
+
*
|
|
364
|
+
* const hash = await client.sendTransaction({
|
|
365
|
+
* calls: [
|
|
366
|
+
* Actions.accessKey.revoke.call({ accessKey: '0x...' }),
|
|
367
|
+
* ],
|
|
368
|
+
* })
|
|
369
|
+
* ```
|
|
370
|
+
*
|
|
371
|
+
* @param args - Arguments.
|
|
372
|
+
* @returns The call.
|
|
373
|
+
*/
|
|
374
|
+
function call(args: Args): {
|
|
375
|
+
abi: [{
|
|
376
|
+
readonly name: "revokeKey";
|
|
377
|
+
readonly type: "function";
|
|
378
|
+
readonly stateMutability: "nonpayable";
|
|
379
|
+
readonly inputs: readonly [{
|
|
380
|
+
readonly type: "address";
|
|
381
|
+
readonly name: "keyId";
|
|
382
|
+
}];
|
|
383
|
+
readonly outputs: readonly [];
|
|
384
|
+
}];
|
|
385
|
+
functionName: "revokeKey";
|
|
386
|
+
} & {
|
|
387
|
+
args: readonly [`0x${string}`];
|
|
388
|
+
} & {
|
|
389
|
+
address: Address;
|
|
390
|
+
} & {
|
|
391
|
+
data: import("../../index.js").Hex;
|
|
392
|
+
to: Address;
|
|
393
|
+
};
|
|
394
|
+
function extractEvent(logs: Log[]): Log<bigint, number, false, undefined, true, readonly [{
|
|
395
|
+
readonly name: "authorizeKey";
|
|
396
|
+
readonly type: "function";
|
|
397
|
+
readonly stateMutability: "nonpayable";
|
|
398
|
+
readonly inputs: readonly [{
|
|
399
|
+
readonly type: "address";
|
|
400
|
+
readonly name: "keyId";
|
|
401
|
+
}, {
|
|
402
|
+
readonly type: "uint8";
|
|
403
|
+
readonly name: "signatureType";
|
|
404
|
+
}, {
|
|
405
|
+
readonly type: "uint64";
|
|
406
|
+
readonly name: "expiry";
|
|
407
|
+
}, {
|
|
408
|
+
readonly type: "bool";
|
|
409
|
+
readonly name: "enforceLimits";
|
|
410
|
+
}, {
|
|
411
|
+
readonly type: "tuple[]";
|
|
412
|
+
readonly name: "limits";
|
|
413
|
+
readonly components: readonly [{
|
|
414
|
+
readonly type: "address";
|
|
415
|
+
readonly name: "token";
|
|
416
|
+
}, {
|
|
417
|
+
readonly type: "uint256";
|
|
418
|
+
readonly name: "amount";
|
|
419
|
+
}];
|
|
420
|
+
}];
|
|
421
|
+
readonly outputs: readonly [];
|
|
422
|
+
}, {
|
|
423
|
+
readonly name: "revokeKey";
|
|
424
|
+
readonly type: "function";
|
|
425
|
+
readonly stateMutability: "nonpayable";
|
|
426
|
+
readonly inputs: readonly [{
|
|
427
|
+
readonly type: "address";
|
|
428
|
+
readonly name: "keyId";
|
|
429
|
+
}];
|
|
430
|
+
readonly outputs: readonly [];
|
|
431
|
+
}, {
|
|
432
|
+
readonly name: "updateSpendingLimit";
|
|
433
|
+
readonly type: "function";
|
|
434
|
+
readonly stateMutability: "nonpayable";
|
|
435
|
+
readonly inputs: readonly [{
|
|
436
|
+
readonly type: "address";
|
|
437
|
+
readonly name: "keyId";
|
|
438
|
+
}, {
|
|
439
|
+
readonly type: "address";
|
|
440
|
+
readonly name: "token";
|
|
441
|
+
}, {
|
|
442
|
+
readonly type: "uint256";
|
|
443
|
+
readonly name: "newLimit";
|
|
444
|
+
}];
|
|
445
|
+
readonly outputs: readonly [];
|
|
446
|
+
}, {
|
|
447
|
+
readonly name: "getKey";
|
|
448
|
+
readonly type: "function";
|
|
449
|
+
readonly stateMutability: "view";
|
|
450
|
+
readonly inputs: readonly [{
|
|
451
|
+
readonly type: "address";
|
|
452
|
+
readonly name: "account";
|
|
453
|
+
}, {
|
|
454
|
+
readonly type: "address";
|
|
455
|
+
readonly name: "keyId";
|
|
456
|
+
}];
|
|
457
|
+
readonly outputs: readonly [{
|
|
458
|
+
readonly type: "tuple";
|
|
459
|
+
readonly components: readonly [{
|
|
460
|
+
readonly type: "uint8";
|
|
461
|
+
readonly name: "signatureType";
|
|
462
|
+
}, {
|
|
463
|
+
readonly type: "address";
|
|
464
|
+
readonly name: "keyId";
|
|
465
|
+
}, {
|
|
466
|
+
readonly type: "uint64";
|
|
467
|
+
readonly name: "expiry";
|
|
468
|
+
}, {
|
|
469
|
+
readonly type: "bool";
|
|
470
|
+
readonly name: "enforceLimits";
|
|
471
|
+
}, {
|
|
472
|
+
readonly type: "bool";
|
|
473
|
+
readonly name: "isRevoked";
|
|
474
|
+
}];
|
|
475
|
+
}];
|
|
476
|
+
}, {
|
|
477
|
+
readonly name: "getRemainingLimit";
|
|
478
|
+
readonly type: "function";
|
|
479
|
+
readonly stateMutability: "view";
|
|
480
|
+
readonly inputs: readonly [{
|
|
481
|
+
readonly type: "address";
|
|
482
|
+
readonly name: "account";
|
|
483
|
+
}, {
|
|
484
|
+
readonly type: "address";
|
|
485
|
+
readonly name: "keyId";
|
|
486
|
+
}, {
|
|
487
|
+
readonly type: "address";
|
|
488
|
+
readonly name: "token";
|
|
489
|
+
}];
|
|
490
|
+
readonly outputs: readonly [{
|
|
491
|
+
readonly type: "uint256";
|
|
492
|
+
}];
|
|
493
|
+
}, {
|
|
494
|
+
readonly name: "getTransactionKey";
|
|
495
|
+
readonly type: "function";
|
|
496
|
+
readonly stateMutability: "view";
|
|
497
|
+
readonly inputs: readonly [];
|
|
498
|
+
readonly outputs: readonly [{
|
|
499
|
+
readonly type: "address";
|
|
500
|
+
}];
|
|
501
|
+
}, {
|
|
502
|
+
readonly name: "KeyAuthorized";
|
|
503
|
+
readonly type: "event";
|
|
504
|
+
readonly inputs: readonly [{
|
|
505
|
+
readonly type: "address";
|
|
506
|
+
readonly name: "account";
|
|
507
|
+
readonly indexed: true;
|
|
508
|
+
}, {
|
|
509
|
+
readonly type: "address";
|
|
510
|
+
readonly name: "publicKey";
|
|
511
|
+
readonly indexed: true;
|
|
512
|
+
}, {
|
|
513
|
+
readonly type: "uint8";
|
|
514
|
+
readonly name: "signatureType";
|
|
515
|
+
}, {
|
|
516
|
+
readonly type: "uint64";
|
|
517
|
+
readonly name: "expiry";
|
|
518
|
+
}];
|
|
519
|
+
}, {
|
|
520
|
+
readonly name: "KeyRevoked";
|
|
521
|
+
readonly type: "event";
|
|
522
|
+
readonly inputs: readonly [{
|
|
523
|
+
readonly type: "address";
|
|
524
|
+
readonly name: "account";
|
|
525
|
+
readonly indexed: true;
|
|
526
|
+
}, {
|
|
527
|
+
readonly type: "address";
|
|
528
|
+
readonly name: "publicKey";
|
|
529
|
+
readonly indexed: true;
|
|
530
|
+
}];
|
|
531
|
+
}, {
|
|
532
|
+
readonly name: "SpendingLimitUpdated";
|
|
533
|
+
readonly type: "event";
|
|
534
|
+
readonly inputs: readonly [{
|
|
535
|
+
readonly type: "address";
|
|
536
|
+
readonly name: "account";
|
|
537
|
+
readonly indexed: true;
|
|
538
|
+
}, {
|
|
539
|
+
readonly type: "address";
|
|
540
|
+
readonly name: "publicKey";
|
|
541
|
+
readonly indexed: true;
|
|
542
|
+
}, {
|
|
543
|
+
readonly type: "address";
|
|
544
|
+
readonly name: "token";
|
|
545
|
+
readonly indexed: true;
|
|
546
|
+
}, {
|
|
547
|
+
readonly type: "uint256";
|
|
548
|
+
readonly name: "newLimit";
|
|
549
|
+
}];
|
|
550
|
+
}, {
|
|
551
|
+
readonly name: "UnauthorizedCaller";
|
|
552
|
+
readonly type: "error";
|
|
553
|
+
readonly inputs: readonly [];
|
|
554
|
+
}, {
|
|
555
|
+
readonly name: "KeyAlreadyExists";
|
|
556
|
+
readonly type: "error";
|
|
557
|
+
readonly inputs: readonly [];
|
|
558
|
+
}, {
|
|
559
|
+
readonly name: "KeyNotFound";
|
|
560
|
+
readonly type: "error";
|
|
561
|
+
readonly inputs: readonly [];
|
|
562
|
+
}, {
|
|
563
|
+
readonly name: "KeyExpired";
|
|
564
|
+
readonly type: "error";
|
|
565
|
+
readonly inputs: readonly [];
|
|
566
|
+
}, {
|
|
567
|
+
readonly name: "SpendingLimitExceeded";
|
|
568
|
+
readonly type: "error";
|
|
569
|
+
readonly inputs: readonly [];
|
|
570
|
+
}, {
|
|
571
|
+
readonly name: "InvalidSignatureType";
|
|
572
|
+
readonly type: "error";
|
|
573
|
+
readonly inputs: readonly [];
|
|
574
|
+
}, {
|
|
575
|
+
readonly name: "ZeroPublicKey";
|
|
576
|
+
readonly type: "error";
|
|
577
|
+
readonly inputs: readonly [];
|
|
578
|
+
}, {
|
|
579
|
+
readonly name: "ExpiryInPast";
|
|
580
|
+
readonly type: "error";
|
|
581
|
+
readonly inputs: readonly [];
|
|
582
|
+
}, {
|
|
583
|
+
readonly name: "KeyAlreadyRevoked";
|
|
584
|
+
readonly type: "error";
|
|
585
|
+
readonly inputs: readonly [];
|
|
586
|
+
}], "KeyRevoked">;
|
|
587
|
+
}
|
|
588
|
+
/**
|
|
589
|
+
* Revokes an authorized access key and waits for the transaction receipt.
|
|
590
|
+
*
|
|
591
|
+
* @example
|
|
592
|
+
* ```ts
|
|
593
|
+
* import { createClient, http } from 'viem'
|
|
594
|
+
* import { tempo } from 'viem/chains'
|
|
595
|
+
* import { Actions } from 'viem/tempo'
|
|
596
|
+
* import { privateKeyToAccount } from 'viem/accounts'
|
|
597
|
+
*
|
|
598
|
+
* const client = createClient({
|
|
599
|
+
* account: privateKeyToAccount('0x...'),
|
|
600
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
|
|
601
|
+
* transport: http(),
|
|
602
|
+
* })
|
|
603
|
+
*
|
|
604
|
+
* const result = await Actions.accessKey.revokeSync(client, {
|
|
605
|
+
* accessKey: '0x...',
|
|
606
|
+
* })
|
|
607
|
+
* ```
|
|
608
|
+
*
|
|
609
|
+
* @param client - Client.
|
|
610
|
+
* @param parameters - Parameters.
|
|
611
|
+
* @returns The transaction receipt and event data.
|
|
612
|
+
*/
|
|
613
|
+
export declare function revokeSync<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, parameters: revokeSync.Parameters<chain, account>): Promise<revokeSync.ReturnValue>;
|
|
614
|
+
export declare namespace revokeSync {
|
|
615
|
+
type Parameters<chain extends Chain | undefined = Chain | undefined, account extends Account | undefined = Account | undefined> = revoke.Parameters<chain, account>;
|
|
616
|
+
type Args = revoke.Args;
|
|
617
|
+
type ReturnValue = Compute<GetEventArgs<typeof Abis.accountKeychain, 'KeyRevoked', {
|
|
618
|
+
IndexedOnly: false;
|
|
619
|
+
Required: true;
|
|
620
|
+
}> & {
|
|
621
|
+
receipt: TransactionReceipt;
|
|
622
|
+
}>;
|
|
623
|
+
type ErrorType = BaseErrorType;
|
|
624
|
+
}
|
|
625
|
+
/**
|
|
626
|
+
* Updates the spending limit for a specific token on an authorized access key.
|
|
627
|
+
*
|
|
628
|
+
* @example
|
|
629
|
+
* ```ts
|
|
630
|
+
* import { createClient, http } from 'viem'
|
|
631
|
+
* import { tempo } from 'viem/chains'
|
|
632
|
+
* import { Actions } from 'viem/tempo'
|
|
633
|
+
* import { privateKeyToAccount } from 'viem/accounts'
|
|
634
|
+
*
|
|
635
|
+
* const client = createClient({
|
|
636
|
+
* account: privateKeyToAccount('0x...'),
|
|
637
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
|
|
638
|
+
* transport: http(),
|
|
639
|
+
* })
|
|
640
|
+
*
|
|
641
|
+
* const hash = await Actions.accessKey.updateLimit(client, {
|
|
642
|
+
* accessKey: '0x...',
|
|
643
|
+
* token: '0x...',
|
|
644
|
+
* limit: 1000000000000000000n,
|
|
645
|
+
* })
|
|
646
|
+
* ```
|
|
647
|
+
*
|
|
648
|
+
* @param client - Client.
|
|
649
|
+
* @param parameters - Parameters.
|
|
650
|
+
* @returns The transaction hash.
|
|
651
|
+
*/
|
|
652
|
+
export declare function updateLimit<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, parameters: updateLimit.Parameters<chain, account>): Promise<updateLimit.ReturnValue>;
|
|
653
|
+
export declare namespace updateLimit {
|
|
654
|
+
type Parameters<chain extends Chain | undefined = Chain | undefined, account extends Account | undefined = Account | undefined> = WriteParameters<chain, account> & Args;
|
|
655
|
+
type Args = {
|
|
656
|
+
/** The access key to update. */
|
|
657
|
+
accessKey: Address | AccessKeyAccount;
|
|
658
|
+
/** The token address. */
|
|
659
|
+
token: Address;
|
|
660
|
+
/** The new spending limit. */
|
|
661
|
+
limit: bigint;
|
|
662
|
+
};
|
|
663
|
+
type ReturnValue = WriteContractReturnType;
|
|
664
|
+
type ErrorType = BaseErrorType;
|
|
665
|
+
/** @internal */
|
|
666
|
+
function inner<action extends typeof writeContract | typeof writeContractSync, chain extends Chain | undefined, account extends Account | undefined>(action: action, client: Client<Transport, chain, account>, parameters: updateLimit.Parameters<chain, account>): Promise<ReturnType<action>>;
|
|
667
|
+
/**
|
|
668
|
+
* Defines a call to the `updateSpendingLimit` function.
|
|
669
|
+
*
|
|
670
|
+
* Can be passed as a parameter to:
|
|
671
|
+
* - [`estimateContractGas`](https://viem.sh/docs/contract/estimateContractGas): estimate the gas cost of the call
|
|
672
|
+
* - [`simulateContract`](https://viem.sh/docs/contract/simulateContract): simulate the call
|
|
673
|
+
* - [`sendCalls`](https://viem.sh/docs/actions/wallet/sendCalls): send multiple calls
|
|
674
|
+
*
|
|
675
|
+
* @example
|
|
676
|
+
* ```ts
|
|
677
|
+
* import { createClient, http, walletActions } from 'viem'
|
|
678
|
+
* import { tempo } from 'viem/chains'
|
|
679
|
+
* import { Actions } from 'viem/tempo'
|
|
680
|
+
*
|
|
681
|
+
* const client = createClient({
|
|
682
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
|
|
683
|
+
* transport: http(),
|
|
684
|
+
* }).extend(walletActions)
|
|
685
|
+
*
|
|
686
|
+
* const hash = await client.sendTransaction({
|
|
687
|
+
* calls: [
|
|
688
|
+
* Actions.accessKey.updateLimit.call({
|
|
689
|
+
* accessKey: '0x...',
|
|
690
|
+
* token: '0x...',
|
|
691
|
+
* limit: 1000000000000000000n,
|
|
692
|
+
* }),
|
|
693
|
+
* ],
|
|
694
|
+
* })
|
|
695
|
+
* ```
|
|
696
|
+
*
|
|
697
|
+
* @param args - Arguments.
|
|
698
|
+
* @returns The call.
|
|
699
|
+
*/
|
|
700
|
+
function call(args: Args): {
|
|
701
|
+
abi: [{
|
|
702
|
+
readonly name: "updateSpendingLimit";
|
|
703
|
+
readonly type: "function";
|
|
704
|
+
readonly stateMutability: "nonpayable";
|
|
705
|
+
readonly inputs: readonly [{
|
|
706
|
+
readonly type: "address";
|
|
707
|
+
readonly name: "keyId";
|
|
708
|
+
}, {
|
|
709
|
+
readonly type: "address";
|
|
710
|
+
readonly name: "token";
|
|
711
|
+
}, {
|
|
712
|
+
readonly type: "uint256";
|
|
713
|
+
readonly name: "newLimit";
|
|
714
|
+
}];
|
|
715
|
+
readonly outputs: readonly [];
|
|
716
|
+
}];
|
|
717
|
+
functionName: "updateSpendingLimit";
|
|
718
|
+
} & {
|
|
719
|
+
args: readonly [`0x${string}`, token: `0x${string}`, newLimit: bigint];
|
|
720
|
+
} & {
|
|
721
|
+
address: Address;
|
|
722
|
+
} & {
|
|
723
|
+
data: import("../../index.js").Hex;
|
|
724
|
+
to: Address;
|
|
725
|
+
};
|
|
726
|
+
function extractEvent(logs: Log[]): Log<bigint, number, false, undefined, true, readonly [{
|
|
727
|
+
readonly name: "authorizeKey";
|
|
728
|
+
readonly type: "function";
|
|
729
|
+
readonly stateMutability: "nonpayable";
|
|
730
|
+
readonly inputs: readonly [{
|
|
731
|
+
readonly type: "address";
|
|
732
|
+
readonly name: "keyId";
|
|
733
|
+
}, {
|
|
734
|
+
readonly type: "uint8";
|
|
735
|
+
readonly name: "signatureType";
|
|
736
|
+
}, {
|
|
737
|
+
readonly type: "uint64";
|
|
738
|
+
readonly name: "expiry";
|
|
739
|
+
}, {
|
|
740
|
+
readonly type: "bool";
|
|
741
|
+
readonly name: "enforceLimits";
|
|
742
|
+
}, {
|
|
743
|
+
readonly type: "tuple[]";
|
|
744
|
+
readonly name: "limits";
|
|
745
|
+
readonly components: readonly [{
|
|
746
|
+
readonly type: "address";
|
|
747
|
+
readonly name: "token";
|
|
748
|
+
}, {
|
|
749
|
+
readonly type: "uint256";
|
|
750
|
+
readonly name: "amount";
|
|
751
|
+
}];
|
|
752
|
+
}];
|
|
753
|
+
readonly outputs: readonly [];
|
|
754
|
+
}, {
|
|
755
|
+
readonly name: "revokeKey";
|
|
756
|
+
readonly type: "function";
|
|
757
|
+
readonly stateMutability: "nonpayable";
|
|
758
|
+
readonly inputs: readonly [{
|
|
759
|
+
readonly type: "address";
|
|
760
|
+
readonly name: "keyId";
|
|
761
|
+
}];
|
|
762
|
+
readonly outputs: readonly [];
|
|
763
|
+
}, {
|
|
764
|
+
readonly name: "updateSpendingLimit";
|
|
765
|
+
readonly type: "function";
|
|
766
|
+
readonly stateMutability: "nonpayable";
|
|
767
|
+
readonly inputs: readonly [{
|
|
768
|
+
readonly type: "address";
|
|
769
|
+
readonly name: "keyId";
|
|
770
|
+
}, {
|
|
771
|
+
readonly type: "address";
|
|
772
|
+
readonly name: "token";
|
|
773
|
+
}, {
|
|
774
|
+
readonly type: "uint256";
|
|
775
|
+
readonly name: "newLimit";
|
|
776
|
+
}];
|
|
777
|
+
readonly outputs: readonly [];
|
|
778
|
+
}, {
|
|
779
|
+
readonly name: "getKey";
|
|
780
|
+
readonly type: "function";
|
|
781
|
+
readonly stateMutability: "view";
|
|
782
|
+
readonly inputs: readonly [{
|
|
783
|
+
readonly type: "address";
|
|
784
|
+
readonly name: "account";
|
|
785
|
+
}, {
|
|
786
|
+
readonly type: "address";
|
|
787
|
+
readonly name: "keyId";
|
|
788
|
+
}];
|
|
789
|
+
readonly outputs: readonly [{
|
|
790
|
+
readonly type: "tuple";
|
|
791
|
+
readonly components: readonly [{
|
|
792
|
+
readonly type: "uint8";
|
|
793
|
+
readonly name: "signatureType";
|
|
794
|
+
}, {
|
|
795
|
+
readonly type: "address";
|
|
796
|
+
readonly name: "keyId";
|
|
797
|
+
}, {
|
|
798
|
+
readonly type: "uint64";
|
|
799
|
+
readonly name: "expiry";
|
|
800
|
+
}, {
|
|
801
|
+
readonly type: "bool";
|
|
802
|
+
readonly name: "enforceLimits";
|
|
803
|
+
}, {
|
|
804
|
+
readonly type: "bool";
|
|
805
|
+
readonly name: "isRevoked";
|
|
806
|
+
}];
|
|
807
|
+
}];
|
|
808
|
+
}, {
|
|
809
|
+
readonly name: "getRemainingLimit";
|
|
810
|
+
readonly type: "function";
|
|
811
|
+
readonly stateMutability: "view";
|
|
812
|
+
readonly inputs: readonly [{
|
|
813
|
+
readonly type: "address";
|
|
814
|
+
readonly name: "account";
|
|
815
|
+
}, {
|
|
816
|
+
readonly type: "address";
|
|
817
|
+
readonly name: "keyId";
|
|
818
|
+
}, {
|
|
819
|
+
readonly type: "address";
|
|
820
|
+
readonly name: "token";
|
|
821
|
+
}];
|
|
822
|
+
readonly outputs: readonly [{
|
|
823
|
+
readonly type: "uint256";
|
|
824
|
+
}];
|
|
825
|
+
}, {
|
|
826
|
+
readonly name: "getTransactionKey";
|
|
827
|
+
readonly type: "function";
|
|
828
|
+
readonly stateMutability: "view";
|
|
829
|
+
readonly inputs: readonly [];
|
|
830
|
+
readonly outputs: readonly [{
|
|
831
|
+
readonly type: "address";
|
|
832
|
+
}];
|
|
833
|
+
}, {
|
|
834
|
+
readonly name: "KeyAuthorized";
|
|
835
|
+
readonly type: "event";
|
|
836
|
+
readonly inputs: readonly [{
|
|
837
|
+
readonly type: "address";
|
|
838
|
+
readonly name: "account";
|
|
839
|
+
readonly indexed: true;
|
|
840
|
+
}, {
|
|
841
|
+
readonly type: "address";
|
|
842
|
+
readonly name: "publicKey";
|
|
843
|
+
readonly indexed: true;
|
|
844
|
+
}, {
|
|
845
|
+
readonly type: "uint8";
|
|
846
|
+
readonly name: "signatureType";
|
|
847
|
+
}, {
|
|
848
|
+
readonly type: "uint64";
|
|
849
|
+
readonly name: "expiry";
|
|
850
|
+
}];
|
|
851
|
+
}, {
|
|
852
|
+
readonly name: "KeyRevoked";
|
|
853
|
+
readonly type: "event";
|
|
854
|
+
readonly inputs: readonly [{
|
|
855
|
+
readonly type: "address";
|
|
856
|
+
readonly name: "account";
|
|
857
|
+
readonly indexed: true;
|
|
858
|
+
}, {
|
|
859
|
+
readonly type: "address";
|
|
860
|
+
readonly name: "publicKey";
|
|
861
|
+
readonly indexed: true;
|
|
862
|
+
}];
|
|
863
|
+
}, {
|
|
864
|
+
readonly name: "SpendingLimitUpdated";
|
|
865
|
+
readonly type: "event";
|
|
866
|
+
readonly inputs: readonly [{
|
|
867
|
+
readonly type: "address";
|
|
868
|
+
readonly name: "account";
|
|
869
|
+
readonly indexed: true;
|
|
870
|
+
}, {
|
|
871
|
+
readonly type: "address";
|
|
872
|
+
readonly name: "publicKey";
|
|
873
|
+
readonly indexed: true;
|
|
874
|
+
}, {
|
|
875
|
+
readonly type: "address";
|
|
876
|
+
readonly name: "token";
|
|
877
|
+
readonly indexed: true;
|
|
878
|
+
}, {
|
|
879
|
+
readonly type: "uint256";
|
|
880
|
+
readonly name: "newLimit";
|
|
881
|
+
}];
|
|
882
|
+
}, {
|
|
883
|
+
readonly name: "UnauthorizedCaller";
|
|
884
|
+
readonly type: "error";
|
|
885
|
+
readonly inputs: readonly [];
|
|
886
|
+
}, {
|
|
887
|
+
readonly name: "KeyAlreadyExists";
|
|
888
|
+
readonly type: "error";
|
|
889
|
+
readonly inputs: readonly [];
|
|
890
|
+
}, {
|
|
891
|
+
readonly name: "KeyNotFound";
|
|
892
|
+
readonly type: "error";
|
|
893
|
+
readonly inputs: readonly [];
|
|
894
|
+
}, {
|
|
895
|
+
readonly name: "KeyExpired";
|
|
896
|
+
readonly type: "error";
|
|
897
|
+
readonly inputs: readonly [];
|
|
898
|
+
}, {
|
|
899
|
+
readonly name: "SpendingLimitExceeded";
|
|
900
|
+
readonly type: "error";
|
|
901
|
+
readonly inputs: readonly [];
|
|
902
|
+
}, {
|
|
903
|
+
readonly name: "InvalidSignatureType";
|
|
904
|
+
readonly type: "error";
|
|
905
|
+
readonly inputs: readonly [];
|
|
906
|
+
}, {
|
|
907
|
+
readonly name: "ZeroPublicKey";
|
|
908
|
+
readonly type: "error";
|
|
909
|
+
readonly inputs: readonly [];
|
|
910
|
+
}, {
|
|
911
|
+
readonly name: "ExpiryInPast";
|
|
912
|
+
readonly type: "error";
|
|
913
|
+
readonly inputs: readonly [];
|
|
914
|
+
}, {
|
|
915
|
+
readonly name: "KeyAlreadyRevoked";
|
|
916
|
+
readonly type: "error";
|
|
917
|
+
readonly inputs: readonly [];
|
|
918
|
+
}], "SpendingLimitUpdated">;
|
|
919
|
+
}
|
|
920
|
+
/**
|
|
921
|
+
* Updates the spending limit and waits for the transaction receipt.
|
|
922
|
+
*
|
|
923
|
+
* @example
|
|
924
|
+
* ```ts
|
|
925
|
+
* import { createClient, http } from 'viem'
|
|
926
|
+
* import { tempo } from 'viem/chains'
|
|
927
|
+
* import { Actions } from 'viem/tempo'
|
|
928
|
+
* import { privateKeyToAccount } from 'viem/accounts'
|
|
929
|
+
*
|
|
930
|
+
* const client = createClient({
|
|
931
|
+
* account: privateKeyToAccount('0x...'),
|
|
932
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
|
|
933
|
+
* transport: http(),
|
|
934
|
+
* })
|
|
935
|
+
*
|
|
936
|
+
* const result = await Actions.accessKey.updateLimitSync(client, {
|
|
937
|
+
* accessKey: '0x...',
|
|
938
|
+
* token: '0x...',
|
|
939
|
+
* limit: 1000000000000000000n,
|
|
940
|
+
* })
|
|
941
|
+
* ```
|
|
942
|
+
*
|
|
943
|
+
* @param client - Client.
|
|
944
|
+
* @param parameters - Parameters.
|
|
945
|
+
* @returns The transaction receipt and event data.
|
|
946
|
+
*/
|
|
947
|
+
export declare function updateLimitSync<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, parameters: updateLimitSync.Parameters<chain, account>): Promise<updateLimitSync.ReturnValue>;
|
|
948
|
+
export declare namespace updateLimitSync {
|
|
949
|
+
type Parameters<chain extends Chain | undefined = Chain | undefined, account extends Account | undefined = Account | undefined> = updateLimit.Parameters<chain, account>;
|
|
950
|
+
type Args = updateLimit.Args;
|
|
951
|
+
type ReturnValue = {
|
|
952
|
+
/** The account that owns the key. */
|
|
953
|
+
account: Address;
|
|
954
|
+
/** The access key address. */
|
|
955
|
+
publicKey: Address;
|
|
956
|
+
/** The token address. */
|
|
957
|
+
token: Address;
|
|
958
|
+
/** The new spending limit. */
|
|
959
|
+
limit: bigint;
|
|
960
|
+
/** The transaction receipt. */
|
|
961
|
+
receipt: TransactionReceipt;
|
|
962
|
+
};
|
|
963
|
+
type ErrorType = BaseErrorType;
|
|
964
|
+
}
|
|
965
|
+
/**
|
|
966
|
+
* Gets access key information.
|
|
967
|
+
*
|
|
968
|
+
* @example
|
|
969
|
+
* ```ts
|
|
970
|
+
* import { createClient, http } from 'viem'
|
|
971
|
+
* import { tempo } from 'viem/chains'
|
|
972
|
+
* import { Actions } from 'viem/tempo'
|
|
973
|
+
*
|
|
974
|
+
* const client = createClient({
|
|
975
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
|
|
976
|
+
* transport: http(),
|
|
977
|
+
* })
|
|
978
|
+
*
|
|
979
|
+
* const key = await Actions.accessKey.getMetadata(client, {
|
|
980
|
+
* account: '0x...',
|
|
981
|
+
* accessKey: '0x...',
|
|
982
|
+
* })
|
|
983
|
+
* ```
|
|
984
|
+
*
|
|
985
|
+
* @param client - Client.
|
|
986
|
+
* @param parameters - Parameters.
|
|
987
|
+
* @returns The key information.
|
|
988
|
+
*/
|
|
989
|
+
export declare function getMetadata<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, parameters: getMetadata.Parameters<account>): Promise<getMetadata.ReturnValue>;
|
|
990
|
+
export declare namespace getMetadata {
|
|
991
|
+
type Parameters<account extends Account | undefined = Account | undefined> = ReadParameters & GetAccountParameter<account> & Pick<Args, 'accessKey'>;
|
|
992
|
+
type Args = {
|
|
993
|
+
/** Account address. */
|
|
994
|
+
account: Address;
|
|
995
|
+
/** The access key. */
|
|
996
|
+
accessKey: Address | AccessKeyAccount;
|
|
997
|
+
};
|
|
998
|
+
type ReturnValue = {
|
|
999
|
+
/** The access key address. */
|
|
1000
|
+
address: Address;
|
|
1001
|
+
/** The key type. */
|
|
1002
|
+
keyType: 'secp256k1' | 'p256' | 'webAuthn';
|
|
1003
|
+
/** The expiry timestamp. */
|
|
1004
|
+
expiry: bigint;
|
|
1005
|
+
/** The spending policy. */
|
|
1006
|
+
spendPolicy: 'limited' | 'unlimited';
|
|
1007
|
+
/** Whether the key is revoked. */
|
|
1008
|
+
isRevoked: boolean;
|
|
1009
|
+
};
|
|
1010
|
+
/**
|
|
1011
|
+
* Defines a call to the `getKey` function.
|
|
1012
|
+
*
|
|
1013
|
+
* @param args - Arguments.
|
|
1014
|
+
* @returns The call.
|
|
1015
|
+
*/
|
|
1016
|
+
function call(args: Args): {
|
|
1017
|
+
abi: [{
|
|
1018
|
+
readonly name: "getKey";
|
|
1019
|
+
readonly type: "function";
|
|
1020
|
+
readonly stateMutability: "view";
|
|
1021
|
+
readonly inputs: readonly [{
|
|
1022
|
+
readonly type: "address";
|
|
1023
|
+
readonly name: "account";
|
|
1024
|
+
}, {
|
|
1025
|
+
readonly type: "address";
|
|
1026
|
+
readonly name: "keyId";
|
|
1027
|
+
}];
|
|
1028
|
+
readonly outputs: readonly [{
|
|
1029
|
+
readonly type: "tuple";
|
|
1030
|
+
readonly components: readonly [{
|
|
1031
|
+
readonly type: "uint8";
|
|
1032
|
+
readonly name: "signatureType";
|
|
1033
|
+
}, {
|
|
1034
|
+
readonly type: "address";
|
|
1035
|
+
readonly name: "keyId";
|
|
1036
|
+
}, {
|
|
1037
|
+
readonly type: "uint64";
|
|
1038
|
+
readonly name: "expiry";
|
|
1039
|
+
}, {
|
|
1040
|
+
readonly type: "bool";
|
|
1041
|
+
readonly name: "enforceLimits";
|
|
1042
|
+
}, {
|
|
1043
|
+
readonly type: "bool";
|
|
1044
|
+
readonly name: "isRevoked";
|
|
1045
|
+
}];
|
|
1046
|
+
}];
|
|
1047
|
+
}];
|
|
1048
|
+
functionName: "getKey";
|
|
1049
|
+
} & {
|
|
1050
|
+
args: readonly [account: `0x${string}`, `0x${string}`];
|
|
1051
|
+
} & {
|
|
1052
|
+
address: Address;
|
|
1053
|
+
} & {
|
|
1054
|
+
data: import("../../index.js").Hex;
|
|
1055
|
+
to: Address;
|
|
1056
|
+
};
|
|
1057
|
+
}
|
|
1058
|
+
/**
|
|
1059
|
+
* Gets the remaining spending limit for a key-token pair.
|
|
1060
|
+
*
|
|
1061
|
+
* @example
|
|
1062
|
+
* ```ts
|
|
1063
|
+
* import { createClient, http } from 'viem'
|
|
1064
|
+
* import { tempo } from 'viem/chains'
|
|
1065
|
+
* import { Actions } from 'viem/tempo'
|
|
1066
|
+
*
|
|
1067
|
+
* const client = createClient({
|
|
1068
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
|
|
1069
|
+
* transport: http(),
|
|
1070
|
+
* })
|
|
1071
|
+
*
|
|
1072
|
+
* const remaining = await Actions.accessKey.getRemainingLimit(client, {
|
|
1073
|
+
* account: '0x...',
|
|
1074
|
+
* accessKey: '0x...',
|
|
1075
|
+
* token: '0x...',
|
|
1076
|
+
* })
|
|
1077
|
+
* ```
|
|
1078
|
+
*
|
|
1079
|
+
* @param client - Client.
|
|
1080
|
+
* @param parameters - Parameters.
|
|
1081
|
+
* @returns The remaining spending amount.
|
|
1082
|
+
*/
|
|
1083
|
+
export declare function getRemainingLimit<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, parameters: getRemainingLimit.Parameters<account>): Promise<getRemainingLimit.ReturnValue>;
|
|
1084
|
+
export declare namespace getRemainingLimit {
|
|
1085
|
+
type Parameters<account extends Account | undefined = Account | undefined> = ReadParameters & GetAccountParameter<account> & Pick<Args, 'accessKey' | 'token'>;
|
|
1086
|
+
type Args = {
|
|
1087
|
+
/** Account address. */
|
|
1088
|
+
account: Address;
|
|
1089
|
+
/** The access key. */
|
|
1090
|
+
accessKey: Address | AccessKeyAccount;
|
|
1091
|
+
/** The token address. */
|
|
1092
|
+
token: Address;
|
|
1093
|
+
};
|
|
1094
|
+
type ReturnValue = ReadContractReturnType<typeof Abis.accountKeychain, 'getRemainingLimit', never>;
|
|
1095
|
+
/**
|
|
1096
|
+
* Defines a call to the `getRemainingLimit` function.
|
|
1097
|
+
*
|
|
1098
|
+
* @param args - Arguments.
|
|
1099
|
+
* @returns The call.
|
|
1100
|
+
*/
|
|
1101
|
+
function call(args: Args): {
|
|
1102
|
+
abi: [{
|
|
1103
|
+
readonly name: "getRemainingLimit";
|
|
1104
|
+
readonly type: "function";
|
|
1105
|
+
readonly stateMutability: "view";
|
|
1106
|
+
readonly inputs: readonly [{
|
|
1107
|
+
readonly type: "address";
|
|
1108
|
+
readonly name: "account";
|
|
1109
|
+
}, {
|
|
1110
|
+
readonly type: "address";
|
|
1111
|
+
readonly name: "keyId";
|
|
1112
|
+
}, {
|
|
1113
|
+
readonly type: "address";
|
|
1114
|
+
readonly name: "token";
|
|
1115
|
+
}];
|
|
1116
|
+
readonly outputs: readonly [{
|
|
1117
|
+
readonly type: "uint256";
|
|
1118
|
+
}];
|
|
1119
|
+
}];
|
|
1120
|
+
functionName: "getRemainingLimit";
|
|
1121
|
+
} & {
|
|
1122
|
+
args: readonly [account: `0x${string}`, `0x${string}`, token: `0x${string}`];
|
|
1123
|
+
} & {
|
|
1124
|
+
address: Address;
|
|
1125
|
+
} & {
|
|
1126
|
+
data: import("../../index.js").Hex;
|
|
1127
|
+
to: Address;
|
|
1128
|
+
};
|
|
1129
|
+
}
|
|
1130
|
+
/**
|
|
1131
|
+
* Signs a key authorization for an access key.
|
|
1132
|
+
*
|
|
1133
|
+
* @example
|
|
1134
|
+
* ```ts
|
|
1135
|
+
* import { generatePrivateKey } from 'viem/accounts'
|
|
1136
|
+
* import { Account, Actions } from 'viem/tempo'
|
|
1137
|
+
*
|
|
1138
|
+
* const account = Account.from({ privateKey: '0x...' })
|
|
1139
|
+
* const accessKey = Account.fromP256(generatePrivateKey(), {
|
|
1140
|
+
* access: account,
|
|
1141
|
+
* })
|
|
1142
|
+
*
|
|
1143
|
+
* const keyAuthorization = await Actions.accessKey.signAuthorization(
|
|
1144
|
+
* client,
|
|
1145
|
+
* {
|
|
1146
|
+
* account,
|
|
1147
|
+
* accessKey,
|
|
1148
|
+
* expiry: Math.floor((Date.now() + 30_000) / 1000),
|
|
1149
|
+
* },
|
|
1150
|
+
* )
|
|
1151
|
+
* ```
|
|
1152
|
+
*
|
|
1153
|
+
* @param client - Client.
|
|
1154
|
+
* @param parameters - Parameters.
|
|
1155
|
+
* @returns The signed key authorization.
|
|
1156
|
+
*/
|
|
1157
|
+
export declare function signAuthorization<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, parameters: signAuthorization.Parameters<account>): Promise<signAuthorization.ReturnValue>;
|
|
1158
|
+
export declare namespace signAuthorization {
|
|
1159
|
+
type Parameters<account extends Account | undefined = Account | undefined> = GetAccountParameter<account> & {
|
|
1160
|
+
/** The access key to authorize. */
|
|
1161
|
+
accessKey: Pick<AccessKeyAccount, 'accessKeyAddress' | 'keyType'>;
|
|
1162
|
+
/** The chain ID. */
|
|
1163
|
+
chainId?: number | undefined;
|
|
1164
|
+
/** Unix timestamp when the key expires. */
|
|
1165
|
+
expiry?: number | undefined;
|
|
1166
|
+
/** Spending limits per token. */
|
|
1167
|
+
limits?: {
|
|
1168
|
+
token: Address;
|
|
1169
|
+
limit: bigint;
|
|
1170
|
+
}[] | undefined;
|
|
1171
|
+
};
|
|
1172
|
+
type ReturnValue = Awaited<ReturnType<typeof signKeyAuthorization>>;
|
|
1173
|
+
}
|
|
1174
|
+
//# sourceMappingURL=accessKey.d.ts.map
|