viem 3.0.0-next.13 → 3.0.0-next.14
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/dist/chains/definitions/arcTestnet.d.ts +5 -5
- package/dist/chains/definitions/arcTestnet.d.ts.map +1 -1
- package/dist/chains/definitions/arcTestnet.js +11 -8
- package/dist/chains/definitions/arcTestnet.js.map +1 -1
- package/dist/chains/definitions/qmsTestnet.d.ts +27 -0
- package/dist/chains/definitions/qmsTestnet.d.ts.map +1 -0
- package/dist/chains/definitions/qmsTestnet.js +23 -0
- package/dist/chains/definitions/qmsTestnet.js.map +1 -0
- package/dist/chains/definitions/tempo.d.ts +1 -1
- package/dist/chains/definitions/tempo.js +1 -1
- package/dist/chains/definitions/tempoModerato.d.ts +2 -2
- package/dist/chains/definitions/tempoModerato.js +2 -2
- package/dist/chains/index.d.ts +1 -0
- package/dist/chains/index.d.ts.map +1 -1
- package/dist/chains/index.js +1 -0
- package/dist/chains/index.js.map +1 -1
- package/dist/core/actions/transaction/waitForReceipt.d.ts +1 -1
- package/dist/core/actions/transaction/waitForReceipt.d.ts.map +1 -1
- package/dist/core/actions/transaction/waitForReceipt.js +5 -2
- package/dist/core/actions/transaction/waitForReceipt.js.map +1 -1
- package/dist/core/actions/wallet/waitForCallsStatus.d.ts.map +1 -1
- package/dist/core/actions/wallet/waitForCallsStatus.js +24 -1
- package/dist/core/actions/wallet/waitForCallsStatus.js.map +1 -1
- package/dist/internal/inference.d.ts +3 -3
- package/dist/internal/inference.d.ts.map +1 -1
- package/dist/tempo/Abis.d.ts +1935 -899
- package/dist/tempo/Abis.d.ts.map +1 -1
- package/dist/tempo/Abis.js +215 -0
- package/dist/tempo/Abis.js.map +1 -1
- package/dist/tempo/Account.d.ts +30 -30
- package/dist/tempo/Account.d.ts.map +1 -1
- package/dist/tempo/Account.js +43 -43
- package/dist/tempo/Account.js.map +1 -1
- package/dist/tempo/Addresses.d.ts +2 -0
- package/dist/tempo/Addresses.d.ts.map +1 -1
- package/dist/tempo/Addresses.js +2 -0
- package/dist/tempo/Addresses.js.map +1 -1
- package/dist/tempo/Decorator.d.ts +33 -10
- package/dist/tempo/Decorator.d.ts.map +1 -1
- package/dist/tempo/Decorator.js +9 -8
- package/dist/tempo/Decorator.js.map +1 -1
- package/dist/tempo/ExecutionError.js +1 -1
- package/dist/tempo/ExecutionError.js.map +1 -1
- package/dist/tempo/KeyAuthorizationManager.d.ts +24 -13
- package/dist/tempo/KeyAuthorizationManager.d.ts.map +1 -1
- package/dist/tempo/KeyAuthorizationManager.js +44 -25
- package/dist/tempo/KeyAuthorizationManager.js.map +1 -1
- package/dist/tempo/Relay.d.ts +61 -12
- package/dist/tempo/Relay.d.ts.map +1 -1
- package/dist/tempo/Relay.js +48 -8
- package/dist/tempo/Relay.js.map +1 -1
- package/dist/tempo/Selectors.d.ts +12 -0
- package/dist/tempo/Selectors.d.ts.map +1 -1
- package/dist/tempo/Selectors.js +12 -0
- package/dist/tempo/Selectors.js.map +1 -1
- package/dist/tempo/Transport.d.ts +19 -6
- package/dist/tempo/Transport.d.ts.map +1 -1
- package/dist/tempo/Transport.js +18 -12
- package/dist/tempo/Transport.js.map +1 -1
- package/dist/tempo/{multisig → accounts}/Config.d.ts +8 -8
- package/dist/tempo/accounts/Config.d.ts.map +1 -0
- package/dist/tempo/{multisig → accounts}/Config.js +14 -14
- package/dist/tempo/{multisig → accounts}/Config.js.map +1 -1
- package/dist/tempo/{multisig → accounts}/Operation.d.ts +8 -8
- package/dist/tempo/{multisig → accounts}/Operation.d.ts.map +1 -1
- package/dist/tempo/{multisig → accounts}/Operation.js +17 -17
- package/dist/tempo/{multisig → accounts}/Operation.js.map +1 -1
- package/dist/tempo/{multisig → accounts}/Signature.d.ts +1 -1
- package/dist/tempo/accounts/Signature.d.ts.map +1 -0
- package/dist/tempo/accounts/Signature.js +9 -0
- package/dist/tempo/accounts/Signature.js.map +1 -0
- package/dist/tempo/actions/accessKey/index.d.ts +1 -0
- package/dist/tempo/actions/accessKey/index.d.ts.map +1 -1
- package/dist/tempo/actions/accessKey/index.js +1 -0
- package/dist/tempo/actions/accessKey/index.js.map +1 -1
- package/dist/tempo/actions/accessKey/prepareAuthorization.d.ts +4 -4
- package/dist/tempo/actions/accessKey/prepareAuthorization.d.ts.map +1 -1
- package/dist/tempo/actions/accessKey/prepareAuthorization.js +10 -10
- package/dist/tempo/actions/accessKey/prepareAuthorization.js.map +1 -1
- package/dist/tempo/actions/accessKey/saveAuthorization.d.ts +40 -0
- package/dist/tempo/actions/accessKey/saveAuthorization.d.ts.map +1 -0
- package/dist/tempo/actions/accessKey/saveAuthorization.js +32 -0
- package/dist/tempo/actions/accessKey/saveAuthorization.js.map +1 -0
- package/dist/tempo/actions/accessKey/signAuthorization.d.ts +17 -13
- package/dist/tempo/actions/accessKey/signAuthorization.d.ts.map +1 -1
- package/dist/tempo/actions/accessKey/signAuthorization.js +43 -30
- package/dist/tempo/actions/accessKey/signAuthorization.js.map +1 -1
- package/dist/tempo/actions/{multisig → accounts}/getConfig.d.ts +5 -5
- package/dist/tempo/actions/accounts/getConfig.d.ts.map +1 -0
- package/dist/tempo/actions/{multisig → accounts}/getConfig.js +5 -5
- package/dist/tempo/actions/accounts/getConfig.js.map +1 -0
- package/dist/tempo/actions/{multisig → accounts}/getConfigCommitment.d.ts +3 -3
- package/dist/tempo/actions/{multisig → accounts}/getConfigCommitment.d.ts.map +1 -1
- package/dist/tempo/actions/{multisig → accounts}/getConfigCommitment.js +2 -2
- package/dist/tempo/actions/{multisig → accounts}/getConfigCommitment.js.map +1 -1
- package/dist/tempo/actions/{multisig → accounts}/getOperation.d.ts +4 -4
- package/dist/tempo/actions/{multisig → accounts}/getOperation.d.ts.map +1 -1
- package/dist/tempo/actions/{multisig → accounts}/getOperation.js +4 -4
- package/dist/tempo/actions/accounts/getOperation.js.map +1 -0
- package/dist/tempo/actions/{multisig → accounts}/index.d.ts.map +1 -1
- package/dist/tempo/actions/{multisig → accounts}/index.js.map +1 -1
- package/dist/tempo/actions/{multisig → accounts}/updateConfig.d.ts +12 -12
- package/dist/tempo/actions/{multisig → accounts}/updateConfig.d.ts.map +1 -1
- package/dist/tempo/actions/{multisig → accounts}/updateConfig.js +16 -21
- package/dist/tempo/actions/{multisig → accounts}/updateConfig.js.map +1 -1
- package/dist/tempo/actions/{multisig → accounts}/updateConfigSync.d.ts +6 -6
- package/dist/tempo/actions/{multisig → accounts}/updateConfigSync.d.ts.map +1 -1
- package/dist/tempo/actions/{multisig → accounts}/updateConfigSync.js +6 -6
- package/dist/tempo/actions/{multisig → accounts}/updateConfigSync.js.map +1 -1
- package/dist/tempo/actions/index.d.ts +2 -2
- package/dist/tempo/actions/index.d.ts.map +1 -1
- package/dist/tempo/actions/index.js +2 -2
- package/dist/tempo/actions/index.js.map +1 -1
- package/dist/tempo/chainConfig.d.ts +16 -16
- package/dist/tempo/chainConfig.d.ts.map +1 -1
- package/dist/tempo/chainConfig.js +52 -52
- package/dist/tempo/chainConfig.js.map +1 -1
- package/dist/tempo/index.d.ts +2 -2
- package/dist/tempo/index.d.ts.map +1 -1
- package/dist/tempo/index.js +2 -2
- package/dist/tempo/index.js.map +1 -1
- package/dist/tempo/internal/relay/accounts.d.ts +15 -0
- package/dist/tempo/internal/relay/accounts.d.ts.map +1 -0
- package/dist/tempo/internal/relay/{multisig.js → accounts.js} +96 -101
- package/dist/tempo/internal/relay/accounts.js.map +1 -0
- package/dist/tempo/internal/relay/feePayer.js +5 -5
- package/dist/tempo/internal/relay/feePayer.js.map +1 -1
- package/dist/tempo/internal/relay/keyAuthorization.d.ts +25 -0
- package/dist/tempo/internal/relay/keyAuthorization.d.ts.map +1 -0
- package/dist/tempo/internal/relay/keyAuthorization.js +339 -0
- package/dist/tempo/internal/relay/keyAuthorization.js.map +1 -0
- package/dist/tempo/internal/relay/plugin.d.ts +6 -3
- package/dist/tempo/internal/relay/plugin.d.ts.map +1 -1
- package/dist/tempo/internal/relay/plugin.js +15 -6
- package/dist/tempo/internal/relay/plugin.js.map +1 -1
- package/dist/tempo/internal/relay/utils.d.ts +8 -0
- package/dist/tempo/internal/relay/utils.d.ts.map +1 -1
- package/dist/utils/RpcClient.d.ts.map +1 -1
- package/dist/utils/RpcClient.js +36 -19
- package/dist/utils/RpcClient.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
- package/src/chains/definitions/arcTestnet.ts +11 -8
- package/src/chains/definitions/qmsTestnet.ts +23 -0
- package/src/chains/definitions/tempo.ts +1 -1
- package/src/chains/definitions/tempoModerato.ts +2 -2
- package/src/chains/index.ts +1 -0
- package/src/core/actions/transaction/waitForReceipt.ts +5 -3
- package/src/core/actions/wallet/waitForCallsStatus.ts +25 -1
- package/src/internal/inference.ts +3 -3
- package/src/tempo/Abis.ts +216 -0
- package/src/tempo/Account.ts +97 -87
- package/src/tempo/Addresses.ts +2 -0
- package/src/tempo/Decorator.ts +55 -28
- package/src/tempo/ExecutionError.ts +1 -1
- package/src/tempo/KeyAuthorizationManager.ts +53 -31
- package/src/tempo/Relay.ts +69 -14
- package/src/tempo/Selectors.ts +13 -0
- package/src/tempo/Transport.ts +46 -20
- package/src/tempo/{multisig → accounts}/Config.ts +21 -21
- package/src/tempo/{multisig → accounts}/Operation.ts +26 -26
- package/src/tempo/{multisig → accounts}/Signature.ts +5 -3
- package/src/tempo/actions/accessKey/index.ts +1 -0
- package/src/tempo/actions/accessKey/prepareAuthorization.ts +16 -15
- package/src/tempo/actions/accessKey/saveAuthorization.ts +51 -0
- package/src/tempo/actions/accessKey/signAuthorization.ts +73 -51
- package/src/tempo/actions/{multisig → accounts}/getConfig.ts +7 -7
- package/src/tempo/actions/{multisig → accounts}/getConfigCommitment.ts +3 -3
- package/src/tempo/actions/{multisig → accounts}/getOperation.ts +6 -6
- package/src/tempo/actions/{multisig → accounts}/updateConfig.ts +21 -26
- package/src/tempo/actions/{multisig → accounts}/updateConfigSync.ts +7 -7
- package/src/tempo/actions/index.ts +2 -3
- package/src/tempo/chainConfig.ts +87 -85
- package/src/tempo/index.ts +4 -4
- package/src/tempo/internal/relay/{multisig.ts → accounts.ts} +121 -121
- package/src/tempo/internal/relay/feePayer.ts +5 -5
- package/src/tempo/internal/relay/keyAuthorization.ts +419 -0
- package/src/tempo/internal/relay/plugin.ts +20 -7
- package/src/utils/RpcClient.ts +38 -21
- package/src/version.ts +1 -1
- package/dist/tempo/actions/multisig/getConfig.d.ts.map +0 -1
- package/dist/tempo/actions/multisig/getConfig.js.map +0 -1
- package/dist/tempo/actions/multisig/getOperation.js.map +0 -1
- package/dist/tempo/internal/relay/multisig.d.ts +0 -4
- package/dist/tempo/internal/relay/multisig.d.ts.map +0 -1
- package/dist/tempo/internal/relay/multisig.js.map +0 -1
- package/dist/tempo/multisig/Config.d.ts.map +0 -1
- package/dist/tempo/multisig/Signature.d.ts.map +0 -1
- package/dist/tempo/multisig/Signature.js +0 -9
- package/dist/tempo/multisig/Signature.js.map +0 -1
- /package/dist/tempo/actions/{multisig → accounts}/index.d.ts +0 -0
- /package/dist/tempo/actions/{multisig → accounts}/index.js +0 -0
- /package/src/tempo/actions/{multisig → accounts}/index.ts +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Address, Errors } from 'ox'
|
|
2
|
-
import {
|
|
2
|
+
import { AccountConfig } from 'ox/tempo'
|
|
3
3
|
import type * as Client from '../../../core/Client.js'
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* Gets the current cached config for a
|
|
6
|
+
* Gets the current cached config for a configurable account.
|
|
7
7
|
*
|
|
8
8
|
* The coordinator reads the account's current onchain commitment and returns
|
|
9
9
|
* the matching config from its store. It returns `null` when the config is not
|
|
@@ -11,7 +11,7 @@ import type * as Client from '../../../core/Client.js'
|
|
|
11
11
|
*
|
|
12
12
|
* @example
|
|
13
13
|
* ```ts
|
|
14
|
-
* const config = await client.
|
|
14
|
+
* const config = await client.accounts.getConfig({
|
|
15
15
|
* address: '0x...',
|
|
16
16
|
* })
|
|
17
17
|
* ```
|
|
@@ -25,21 +25,21 @@ export async function getConfig(
|
|
|
25
25
|
parameters: getConfig.Options,
|
|
26
26
|
): Promise<getConfig.ReturnType> {
|
|
27
27
|
const config = await client.request({
|
|
28
|
-
method: '
|
|
28
|
+
method: 'account_getConfig',
|
|
29
29
|
params: [{ address: parameters.address }],
|
|
30
30
|
})
|
|
31
|
-
return config ?
|
|
31
|
+
return config ? AccountConfig.fromRpc(config as AccountConfig.Rpc) : null
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
export declare namespace getConfig {
|
|
35
35
|
/** Parameters for {@link getConfig}. */
|
|
36
36
|
export type Options = {
|
|
37
|
-
/**
|
|
37
|
+
/** Configurable account address. */
|
|
38
38
|
address: Address.Address
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
/** Return value for {@link getConfig}. */
|
|
42
|
-
export type ReturnType =
|
|
42
|
+
export type ReturnType = AccountConfig.Config | null
|
|
43
43
|
|
|
44
44
|
/** Error type for {@link getConfig}. */
|
|
45
45
|
export type ErrorType = Errors.GlobalErrorType
|
|
@@ -9,7 +9,7 @@ import type { ReadParameters } from '../../internal/types.js'
|
|
|
9
9
|
import { defineCall } from '../../internal/utils.js'
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
* Gets the current configuration commitment for a
|
|
12
|
+
* Gets the current configuration commitment for a configurable account.
|
|
13
13
|
*
|
|
14
14
|
* @example
|
|
15
15
|
* ```ts
|
|
@@ -22,7 +22,7 @@ import { defineCall } from '../../internal/utils.js'
|
|
|
22
22
|
* transport: http(),
|
|
23
23
|
* })
|
|
24
24
|
*
|
|
25
|
-
* const commitment = await Actions.
|
|
25
|
+
* const commitment = await Actions.accounts.getConfigCommitment(client, {
|
|
26
26
|
* account: '0x...',
|
|
27
27
|
* })
|
|
28
28
|
* ```
|
|
@@ -50,7 +50,7 @@ export namespace getConfigCommitment {
|
|
|
50
50
|
export type Options = ReadParameters & Args
|
|
51
51
|
|
|
52
52
|
export type Args = {
|
|
53
|
-
/** Initialized
|
|
53
|
+
/** Initialized configurable account address. */
|
|
54
54
|
account: Address.Address
|
|
55
55
|
}
|
|
56
56
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Errors, Hex } from 'ox'
|
|
2
|
-
import {
|
|
2
|
+
import { AccountOperation } from 'ox/tempo'
|
|
3
3
|
import type * as Client from '../../../core/Client.js'
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* Gets a coordinated
|
|
6
|
+
* Gets a coordinated account operation by its hash.
|
|
7
7
|
*
|
|
8
8
|
* @param client - Client.
|
|
9
9
|
* @param parameters - Parameters.
|
|
@@ -14,23 +14,23 @@ export async function getOperation(
|
|
|
14
14
|
parameters: getOperation.Options,
|
|
15
15
|
): Promise<getOperation.ReturnType> {
|
|
16
16
|
const operation = await client.request({
|
|
17
|
-
method: '
|
|
17
|
+
method: 'account_getOperation',
|
|
18
18
|
params: [parameters.hash],
|
|
19
19
|
})
|
|
20
20
|
return operation
|
|
21
|
-
?
|
|
21
|
+
? AccountOperation.fromRpc(operation as AccountOperation.Rpc)
|
|
22
22
|
: null
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
export declare namespace getOperation {
|
|
26
26
|
/** Parameters for {@link getOperation}. */
|
|
27
27
|
export type Options = {
|
|
28
|
-
/**
|
|
28
|
+
/** Account operation hash. */
|
|
29
29
|
hash: Hex.Hex
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
/** Return value for {@link getOperation}. */
|
|
33
|
-
export type ReturnType =
|
|
33
|
+
export type ReturnType = AccountOperation.Operation | null
|
|
34
34
|
|
|
35
35
|
/** Error type for {@link getOperation}. */
|
|
36
36
|
export type ErrorType = Errors.GlobalErrorType
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import type { Address, Errors } from 'ox'
|
|
2
2
|
import { AbiEvent } from 'ox'
|
|
3
|
-
import {
|
|
3
|
+
import { AccountConfig } from 'ox/tempo'
|
|
4
4
|
import type * as Account from '../../../core/Account.js'
|
|
5
5
|
import type * as Chain from '../../../core/Chain.js'
|
|
6
6
|
import type * as Client from '../../../core/Client.js'
|
|
7
7
|
import { write } from '../../../core/actions/contract/write.js'
|
|
8
8
|
import { writeSync } from '../../../core/actions/contract/writeSync.js'
|
|
9
9
|
import * as Abis from '../../Abis.js'
|
|
10
|
-
import {
|
|
10
|
+
import { type ConfigurableAccount, fromConfig } from '../../Account.js'
|
|
11
11
|
import * as Addresses from '../../Addresses.js'
|
|
12
12
|
import type { WriteParameters } from '../../internal/types.js'
|
|
13
13
|
import { defineCall, dispatchWrite } from '../../internal/utils.js'
|
|
14
14
|
import { getConfig } from './getConfig.js'
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
|
-
* Replaces the current configuration for a
|
|
17
|
+
* Replaces the current configuration for a configurable account.
|
|
18
18
|
*
|
|
19
19
|
* The transaction must be authorized directly by the account's current owner
|
|
20
20
|
* quorum. Local owner-signing flows can include {@link updateConfig.call} in a
|
|
@@ -30,7 +30,7 @@ import { getConfig } from './getConfig.js'
|
|
|
30
30
|
* const owner = Account.fromSecp256k1(
|
|
31
31
|
* '0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80',
|
|
32
32
|
* )
|
|
33
|
-
* const account = Account.
|
|
33
|
+
* const account = Account.fromConfig({
|
|
34
34
|
* address: 'infer',
|
|
35
35
|
* owners: [owner],
|
|
36
36
|
* })
|
|
@@ -44,7 +44,7 @@ import { getConfig } from './getConfig.js'
|
|
|
44
44
|
* to: account.address,
|
|
45
45
|
* })
|
|
46
46
|
*
|
|
47
|
-
* const hash = await Actions.
|
|
47
|
+
* const hash = await Actions.accounts.updateConfig(client, {
|
|
48
48
|
* account,
|
|
49
49
|
* nextConfig: {
|
|
50
50
|
* owners: [{ owner: owner.address, weight: 1 }],
|
|
@@ -70,16 +70,16 @@ export async function updateConfig<
|
|
|
70
70
|
export namespace updateConfig {
|
|
71
71
|
export type Options = WriteParameters & {
|
|
72
72
|
/** Complete current config. Inferred from the account or coordinator when omitted. */
|
|
73
|
-
currentConfig?:
|
|
73
|
+
currentConfig?: AccountConfig.Config | undefined
|
|
74
74
|
/** Replacement owners and threshold. */
|
|
75
|
-
nextConfig: Pick<
|
|
75
|
+
nextConfig: Pick<AccountConfig.Config, 'owners' | 'threshold'>
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
export type Args = {
|
|
79
79
|
/** Complete current config. */
|
|
80
|
-
currentConfig:
|
|
80
|
+
currentConfig: AccountConfig.Config
|
|
81
81
|
/** Replacement owners and threshold. */
|
|
82
|
-
nextConfig: Pick<
|
|
82
|
+
nextConfig: Pick<AccountConfig.Config, 'owners' | 'threshold'>
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
export type ReturnType = write.ReturnType
|
|
@@ -108,9 +108,9 @@ export namespace updateConfig {
|
|
|
108
108
|
if (
|
|
109
109
|
typeof accountValue === 'object' &&
|
|
110
110
|
'source' in accountValue &&
|
|
111
|
-
accountValue.source === '
|
|
111
|
+
accountValue.source === 'configurable'
|
|
112
112
|
)
|
|
113
|
-
return accountValue as
|
|
113
|
+
return accountValue as ConfigurableAccount
|
|
114
114
|
return undefined
|
|
115
115
|
})()
|
|
116
116
|
const config = (() => {
|
|
@@ -126,22 +126,22 @@ export namespace updateConfig {
|
|
|
126
126
|
return undefined
|
|
127
127
|
})()
|
|
128
128
|
const currentConfig = await (async () => {
|
|
129
|
-
if (config) return
|
|
129
|
+
if (config) return AccountConfig.from(config)
|
|
130
130
|
if (!address)
|
|
131
131
|
throw new Error(
|
|
132
|
-
'A
|
|
132
|
+
'A configurable account address or current config is required.',
|
|
133
133
|
)
|
|
134
134
|
const cachedConfig = await getConfig(client, { address })
|
|
135
135
|
if (!cachedConfig)
|
|
136
136
|
throw new Error(
|
|
137
|
-
`No current
|
|
137
|
+
`No current account config is cached for account ${address}. Provide the current config.`,
|
|
138
138
|
)
|
|
139
139
|
return cachedConfig
|
|
140
140
|
})()
|
|
141
141
|
const resolvedAccount = (() => {
|
|
142
142
|
if (account) return { ...account, config: currentConfig }
|
|
143
143
|
if (typeof accountValue === 'object') return accountValue
|
|
144
|
-
if (address) return
|
|
144
|
+
if (address) return fromConfig({ address, ...currentConfig })
|
|
145
145
|
return undefined
|
|
146
146
|
})()
|
|
147
147
|
return dispatchWrite(action, client, {
|
|
@@ -161,11 +161,11 @@ export namespace updateConfig {
|
|
|
161
161
|
*
|
|
162
162
|
* @example
|
|
163
163
|
* ```ts
|
|
164
|
-
* import {
|
|
164
|
+
* import { type AccountConfig, Actions } from 'viem/tempo'
|
|
165
165
|
*
|
|
166
|
-
* declare const currentConfig:
|
|
166
|
+
* declare const currentConfig: AccountConfig.Config
|
|
167
167
|
*
|
|
168
|
-
* const call = Actions.
|
|
168
|
+
* const call = Actions.accounts.updateConfig.call({
|
|
169
169
|
* currentConfig,
|
|
170
170
|
* nextConfig: {
|
|
171
171
|
* owners: [{ owner: '0x...', weight: 1 }],
|
|
@@ -174,17 +174,12 @@ export namespace updateConfig {
|
|
|
174
174
|
* })
|
|
175
175
|
* ```
|
|
176
176
|
*
|
|
177
|
-
* @param args - Current and replacement
|
|
177
|
+
* @param args - Current and replacement account configurations.
|
|
178
178
|
* @returns The call.
|
|
179
179
|
*/
|
|
180
180
|
export function call(args: Args) {
|
|
181
|
-
const currentConfig =
|
|
182
|
-
const nextConfig =
|
|
183
|
-
owners: args.nextConfig.owners,
|
|
184
|
-
salt: currentConfig.salt,
|
|
185
|
-
threshold: args.nextConfig.threshold,
|
|
186
|
-
version: currentConfig.version + 1n,
|
|
187
|
-
})
|
|
181
|
+
const currentConfig = AccountConfig.from(args.currentConfig)
|
|
182
|
+
const nextConfig = AccountConfig.update(currentConfig, args.nextConfig)
|
|
188
183
|
return defineCall({
|
|
189
184
|
address: Addresses.nativeMultisig,
|
|
190
185
|
abi: Abis.nativeMultisig,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Address } from 'ox'
|
|
2
|
-
import {
|
|
2
|
+
import { AccountConfig } from 'ox/tempo'
|
|
3
3
|
import type * as Account from '../../../core/Account.js'
|
|
4
4
|
import type * as Chain from '../../../core/Chain.js'
|
|
5
5
|
import type * as Client from '../../../core/Client.js'
|
|
@@ -8,16 +8,16 @@ import type { TransactionReceipt } from '../../chainConfig.js'
|
|
|
8
8
|
import { updateConfig } from './updateConfig.js'
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* Replaces a
|
|
11
|
+
* Replaces a configurable account configuration and waits for confirmation.
|
|
12
12
|
*
|
|
13
13
|
* @example
|
|
14
14
|
* ```ts
|
|
15
15
|
* import { createWalletClient, custom, type EIP1193Provider } from 'viem'
|
|
16
16
|
* import { tempo } from 'viem/chains'
|
|
17
|
-
* import {
|
|
17
|
+
* import { type AccountConfig, Actions } from 'viem/tempo'
|
|
18
18
|
*
|
|
19
19
|
* declare const provider: EIP1193Provider
|
|
20
|
-
* declare const currentConfig:
|
|
20
|
+
* declare const currentConfig: AccountConfig.Config
|
|
21
21
|
*
|
|
22
22
|
* const client = createWalletClient({
|
|
23
23
|
* account: '0x...',
|
|
@@ -25,7 +25,7 @@ import { updateConfig } from './updateConfig.js'
|
|
|
25
25
|
* transport: custom(provider),
|
|
26
26
|
* })
|
|
27
27
|
*
|
|
28
|
-
* const { receipt } = await Actions.
|
|
28
|
+
* const { receipt } = await Actions.accounts.updateConfigSync(client, {
|
|
29
29
|
* currentConfig,
|
|
30
30
|
* nextConfig: {
|
|
31
31
|
* owners: [{ owner: '0x...', weight: 1 }],
|
|
@@ -55,7 +55,7 @@ export async function updateConfigSync<
|
|
|
55
55
|
const { args } = updateConfig.extractEvent(receipt.logs)
|
|
56
56
|
return {
|
|
57
57
|
account: args.account,
|
|
58
|
-
config:
|
|
58
|
+
config: AccountConfig.from({
|
|
59
59
|
owners: args.owners,
|
|
60
60
|
salt: args.salt,
|
|
61
61
|
threshold: args.threshold,
|
|
@@ -72,7 +72,7 @@ export namespace updateConfigSync {
|
|
|
72
72
|
|
|
73
73
|
export type ReturnType = {
|
|
74
74
|
account: Address.Address
|
|
75
|
-
config:
|
|
75
|
+
config: AccountConfig.Config
|
|
76
76
|
receipt: TransactionReceipt
|
|
77
77
|
}
|
|
78
78
|
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
// biome-ignore lint/performance/noBarrelFile: namespace module
|
|
2
2
|
export * as accessKey from './accessKey/index.js'
|
|
3
|
+
/** Configurable account configuration and approval actions. */
|
|
4
|
+
export * as accounts from './accounts/index.js'
|
|
3
5
|
export * as amm from './amm/index.js'
|
|
4
6
|
export * as channel from './channel/index.js'
|
|
5
7
|
export * as dex from './dex/index.js'
|
|
@@ -15,6 +17,3 @@ export * as validator from './validator/index.js'
|
|
|
15
17
|
export * as virtualAddress from './virtualAddress/index.js'
|
|
16
18
|
export * as wallet from './wallet/index.js'
|
|
17
19
|
export * as zone from './zone/index.js'
|
|
18
|
-
|
|
19
|
-
/** Native multisig configuration and approval actions. */
|
|
20
|
-
export * as multisig from './multisig/index.js'
|