tempo.ts 0.11.1 → 0.12.1
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 +67 -4
- package/README.md +3 -34
- package/dist/server/Handler.d.ts +14 -14
- package/dist/server/Handler.d.ts.map +1 -1
- package/dist/server/Handler.js +16 -17
- package/dist/server/Handler.js.map +1 -1
- package/dist/wagmi/Actions/amm.d.ts +51 -51
- package/dist/wagmi/Actions/amm.d.ts.map +1 -1
- package/dist/wagmi/Actions/amm.js +37 -37
- package/dist/wagmi/Actions/amm.js.map +1 -1
- package/dist/wagmi/Actions/dex.d.ts +129 -129
- package/dist/wagmi/Actions/dex.d.ts.map +1 -1
- package/dist/wagmi/Actions/dex.js +73 -73
- package/dist/wagmi/Actions/dex.js.map +1 -1
- package/dist/wagmi/Actions/faucet.d.ts +9 -9
- package/dist/wagmi/Actions/faucet.d.ts.map +1 -1
- package/dist/wagmi/Actions/faucet.js +7 -7
- package/dist/wagmi/Actions/faucet.js.map +1 -1
- package/dist/wagmi/Actions/fee.d.ts +17 -17
- package/dist/wagmi/Actions/fee.d.ts.map +1 -1
- package/dist/wagmi/Actions/fee.js +10 -10
- package/dist/wagmi/Actions/fee.js.map +1 -1
- package/dist/wagmi/Actions/nonce.d.ts +9 -79
- package/dist/wagmi/Actions/nonce.d.ts.map +1 -1
- package/dist/wagmi/Actions/nonce.js +7 -89
- package/dist/wagmi/Actions/nonce.js.map +1 -1
- package/dist/wagmi/Actions/policy.d.ts +69 -70
- package/dist/wagmi/Actions/policy.d.ts.map +1 -1
- package/dist/wagmi/Actions/policy.js +43 -43
- package/dist/wagmi/Actions/policy.js.map +1 -1
- package/dist/wagmi/Actions/reward.d.ts +51 -51
- package/dist/wagmi/Actions/reward.d.ts.map +1 -1
- package/dist/wagmi/Actions/reward.js +31 -31
- package/dist/wagmi/Actions/reward.js.map +1 -1
- package/dist/wagmi/Actions/token.d.ts +238 -238
- package/dist/wagmi/Actions/token.d.ts.map +1 -1
- package/dist/wagmi/Actions/token.js +136 -136
- package/dist/wagmi/Actions/token.js.map +1 -1
- package/dist/wagmi/Connector.d.ts +2 -1
- package/dist/wagmi/Connector.d.ts.map +1 -1
- package/dist/wagmi/Connector.js +83 -22
- package/dist/wagmi/Connector.js.map +1 -1
- package/dist/wagmi/Hooks/nonce.d.ts +1 -52
- package/dist/wagmi/Hooks/nonce.d.ts.map +1 -1
- package/dist/wagmi/Hooks/nonce.js +1 -70
- package/dist/wagmi/Hooks/nonce.js.map +1 -1
- package/dist/wagmi/Hooks/policy.d.ts +0 -1
- package/dist/wagmi/Hooks/policy.d.ts.map +1 -1
- package/dist/wagmi/Hooks/policy.js.map +1 -1
- package/dist/wagmi/KeyManager.d.ts +6 -3
- package/dist/wagmi/KeyManager.d.ts.map +1 -1
- package/dist/wagmi/KeyManager.js +9 -4
- package/dist/wagmi/KeyManager.js.map +1 -1
- package/package.json +3 -13
- package/src/server/Handler.test.ts +2 -2
- package/src/server/Handler.ts +16 -17
- package/src/wagmi/Actions/amm.ts +63 -63
- package/src/wagmi/Actions/dex.test.ts +1 -1
- package/src/wagmi/Actions/dex.ts +153 -153
- package/src/wagmi/Actions/faucet.ts +11 -11
- package/src/wagmi/Actions/fee.ts +20 -20
- package/src/wagmi/Actions/nonce.test.ts +1 -64
- package/src/wagmi/Actions/nonce.ts +10 -142
- package/src/wagmi/Actions/policy.ts +83 -85
- package/src/wagmi/Actions/reward.ts +64 -61
- package/src/wagmi/Actions/token.ts +287 -283
- package/src/wagmi/Connector.ts +105 -31
- package/src/wagmi/Hooks/dex.test.ts +1 -1
- package/src/wagmi/Hooks/fee.test.ts +0 -6
- package/src/wagmi/Hooks/nonce.test.ts +1 -66
- package/src/wagmi/Hooks/nonce.ts +1 -114
- package/src/wagmi/Hooks/policy.ts +0 -2
- package/src/wagmi/KeyManager.ts +18 -5
- package/dist/chains.d.ts +0 -73
- package/dist/chains.d.ts.map +0 -1
- package/dist/chains.js +0 -51
- package/dist/chains.js.map +0 -1
- package/dist/viem/Abis.d.ts +0 -2649
- package/dist/viem/Abis.d.ts.map +0 -1
- package/dist/viem/Abis.js +0 -1677
- package/dist/viem/Abis.js.map +0 -1
- package/dist/viem/Account.d.ts +0 -244
- package/dist/viem/Account.d.ts.map +0 -1
- package/dist/viem/Account.js +0 -382
- package/dist/viem/Account.js.map +0 -1
- package/dist/viem/Actions/account.d.ts +0 -40
- package/dist/viem/Actions/account.d.ts.map +0 -1
- package/dist/viem/Actions/account.js +0 -86
- package/dist/viem/Actions/account.js.map +0 -1
- package/dist/viem/Actions/amm.d.ts +0 -1991
- package/dist/viem/Actions/amm.d.ts.map +0 -1
- package/dist/viem/Actions/amm.js +0 -814
- package/dist/viem/Actions/amm.js.map +0 -1
- package/dist/viem/Actions/dex.d.ts +0 -3900
- package/dist/viem/Actions/dex.d.ts.map +0 -1
- package/dist/viem/Actions/dex.js +0 -1414
- package/dist/viem/Actions/dex.js.map +0 -1
- package/dist/viem/Actions/faucet.d.ts +0 -69
- package/dist/viem/Actions/faucet.d.ts.map +0 -1
- package/dist/viem/Actions/faucet.js +0 -73
- package/dist/viem/Actions/faucet.js.map +0 -1
- package/dist/viem/Actions/fee.d.ts +0 -360
- package/dist/viem/Actions/fee.d.ts.map +0 -1
- package/dist/viem/Actions/fee.js +0 -237
- package/dist/viem/Actions/fee.js.map +0 -1
- package/dist/viem/Actions/index.d.ts +0 -10
- package/dist/viem/Actions/index.d.ts.map +0 -1
- package/dist/viem/Actions/index.js +0 -10
- package/dist/viem/Actions/index.js.map +0 -1
- package/dist/viem/Actions/nonce.d.ts +0 -257
- package/dist/viem/Actions/nonce.d.ts.map +0 -1
- package/dist/viem/Actions/nonce.js +0 -228
- package/dist/viem/Actions/nonce.js.map +0 -1
- package/dist/viem/Actions/policy.d.ts +0 -1680
- package/dist/viem/Actions/policy.d.ts.map +0 -1
- package/dist/viem/Actions/policy.js +0 -875
- package/dist/viem/Actions/policy.js.map +0 -1
- package/dist/viem/Actions/reward.d.ts +0 -2422
- package/dist/viem/Actions/reward.d.ts.map +0 -1
- package/dist/viem/Actions/reward.js +0 -651
- package/dist/viem/Actions/reward.js.map +0 -1
- package/dist/viem/Actions/token.d.ts +0 -16007
- package/dist/viem/Actions/token.d.ts.map +0 -1
- package/dist/viem/Actions/token.js +0 -2936
- package/dist/viem/Actions/token.js.map +0 -1
- package/dist/viem/Addresses.d.ts +0 -9
- package/dist/viem/Addresses.d.ts.map +0 -1
- package/dist/viem/Addresses.js +0 -9
- package/dist/viem/Addresses.js.map +0 -1
- package/dist/viem/Chain.d.ts +0 -451
- package/dist/viem/Chain.d.ts.map +0 -1
- package/dist/viem/Chain.js +0 -96
- package/dist/viem/Chain.js.map +0 -1
- package/dist/viem/Decorator.d.ts +0 -2783
- package/dist/viem/Decorator.d.ts.map +0 -1
- package/dist/viem/Decorator.js +0 -137
- package/dist/viem/Decorator.js.map +0 -1
- package/dist/viem/Formatters.d.ts +0 -10
- package/dist/viem/Formatters.d.ts.map +0 -1
- package/dist/viem/Formatters.js +0 -104
- package/dist/viem/Formatters.js.map +0 -1
- package/dist/viem/P256.d.ts +0 -2
- package/dist/viem/P256.d.ts.map +0 -1
- package/dist/viem/P256.js +0 -2
- package/dist/viem/P256.js.map +0 -1
- package/dist/viem/Secp256k1.d.ts +0 -2
- package/dist/viem/Secp256k1.d.ts.map +0 -1
- package/dist/viem/Secp256k1.js +0 -2
- package/dist/viem/Secp256k1.js.map +0 -1
- package/dist/viem/Storage.d.ts +0 -24
- package/dist/viem/Storage.d.ts.map +0 -1
- package/dist/viem/Storage.js +0 -68
- package/dist/viem/Storage.js.map +0 -1
- package/dist/viem/TokenIds.d.ts +0 -2
- package/dist/viem/TokenIds.d.ts.map +0 -1
- package/dist/viem/TokenIds.js +0 -2
- package/dist/viem/TokenIds.js.map +0 -1
- package/dist/viem/Transaction.d.ts +0 -76
- package/dist/viem/Transaction.d.ts.map +0 -1
- package/dist/viem/Transaction.js +0 -176
- package/dist/viem/Transaction.js.map +0 -1
- package/dist/viem/Transport.d.ts +0 -33
- package/dist/viem/Transport.d.ts.map +0 -1
- package/dist/viem/Transport.js +0 -138
- package/dist/viem/Transport.js.map +0 -1
- package/dist/viem/WebAuthnP256.d.ts +0 -82
- package/dist/viem/WebAuthnP256.d.ts.map +0 -1
- package/dist/viem/WebAuthnP256.js +0 -97
- package/dist/viem/WebAuthnP256.js.map +0 -1
- package/dist/viem/WebCryptoP256.d.ts +0 -2
- package/dist/viem/WebCryptoP256.d.ts.map +0 -1
- package/dist/viem/WebCryptoP256.js +0 -2
- package/dist/viem/WebCryptoP256.js.map +0 -1
- package/dist/viem/index.d.ts +0 -26
- package/dist/viem/index.d.ts.map +0 -1
- package/dist/viem/index.js +0 -17
- package/dist/viem/index.js.map +0 -1
- package/dist/viem/internal/types.d.ts +0 -20
- package/dist/viem/internal/types.d.ts.map +0 -1
- package/dist/viem/internal/types.js +0 -2
- package/dist/viem/internal/types.js.map +0 -1
- package/dist/viem/internal/utils.d.ts +0 -14
- package/dist/viem/internal/utils.d.ts.map +0 -1
- package/dist/viem/internal/utils.js +0 -33
- package/dist/viem/internal/utils.js.map +0 -1
- package/src/chains.ts +0 -54
- package/src/viem/Abis.ts +0 -1688
- package/src/viem/Account.test.ts +0 -444
- package/src/viem/Account.ts +0 -601
- package/src/viem/Actions/account.test.ts +0 -414
- package/src/viem/Actions/account.ts +0 -106
- package/src/viem/Actions/amm.test.ts +0 -381
- package/src/viem/Actions/amm.ts +0 -1227
- package/src/viem/Actions/dex.test.ts +0 -1549
- package/src/viem/Actions/dex.ts +0 -2150
- package/src/viem/Actions/faucet.ts +0 -121
- package/src/viem/Actions/fee.test.ts +0 -259
- package/src/viem/Actions/fee.ts +0 -372
- package/src/viem/Actions/index.ts +0 -9
- package/src/viem/Actions/nonce.test.ts +0 -206
- package/src/viem/Actions/nonce.ts +0 -347
- package/src/viem/Actions/policy.test.ts +0 -534
- package/src/viem/Actions/policy.ts +0 -1335
- package/src/viem/Actions/reward.test.ts +0 -434
- package/src/viem/Actions/reward.ts +0 -944
- package/src/viem/Actions/token.test.ts +0 -3029
- package/src/viem/Actions/token.ts +0 -4458
- package/src/viem/Addresses.ts +0 -9
- package/src/viem/Chain.bench-d.ts +0 -12
- package/src/viem/Chain.test.ts +0 -168
- package/src/viem/Chain.ts +0 -157
- package/src/viem/Decorator.bench-d.ts +0 -11
- package/src/viem/Decorator.test.ts +0 -39
- package/src/viem/Decorator.ts +0 -3179
- package/src/viem/Formatters.ts +0 -164
- package/src/viem/P256.ts +0 -1
- package/src/viem/Secp256k1.ts +0 -1
- package/src/viem/Storage.ts +0 -110
- package/src/viem/TokenIds.ts +0 -1
- package/src/viem/Transaction.ts +0 -382
- package/src/viem/Transport.ts +0 -191
- package/src/viem/WebAuthnP256.ts +0 -146
- package/src/viem/WebCryptoP256.ts +0 -1
- package/src/viem/e2e.test.ts +0 -1602
- package/src/viem/index.ts +0 -30
- package/src/viem/internal/types.ts +0 -69
- package/src/viem/internal/utils.ts +0 -58
- package/src/wagmi/internal/types.ts +0 -16
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Config } from '@wagmi/core'
|
|
2
2
|
import type { ChainIdParameter, UnionCompute } from '@wagmi/core/internal'
|
|
3
|
-
import
|
|
3
|
+
import { Actions } from 'viem/tempo'
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Funds an account with an initial amount of set token(s)
|
|
@@ -9,11 +9,11 @@ import * as viem_Actions from '../../viem/Actions/faucet.js'
|
|
|
9
9
|
* @example
|
|
10
10
|
* ```ts
|
|
11
11
|
* import { createConfig, http } from '@wagmi/core'
|
|
12
|
-
* import { tempo } from '
|
|
12
|
+
* import { tempo } from 'viem/chains'
|
|
13
13
|
* import { Actions } from 'tempo.ts/wagmi'
|
|
14
14
|
*
|
|
15
15
|
* const config = createConfig({
|
|
16
|
-
* chains: [
|
|
16
|
+
* chains: [tempoTestnet],
|
|
17
17
|
* transports: {
|
|
18
18
|
* [tempo.id]: http(),
|
|
19
19
|
* },
|
|
@@ -34,15 +34,15 @@ export async function fund<config extends Config>(
|
|
|
34
34
|
): Promise<fund.ReturnValue> {
|
|
35
35
|
const { chainId, ...rest } = parameters
|
|
36
36
|
const client = config.getClient({ chainId })
|
|
37
|
-
return
|
|
37
|
+
return Actions.faucet.fund(client, rest)
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
export declare namespace fund {
|
|
41
41
|
export type Parameters<config extends Config> = UnionCompute<
|
|
42
|
-
ChainIdParameter<config> &
|
|
42
|
+
ChainIdParameter<config> & Actions.faucet.fund.Parameters
|
|
43
43
|
>
|
|
44
44
|
|
|
45
|
-
export type ReturnValue =
|
|
45
|
+
export type ReturnValue = Actions.faucet.fund.ReturnValue
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
/**
|
|
@@ -52,11 +52,11 @@ export declare namespace fund {
|
|
|
52
52
|
* @example
|
|
53
53
|
* ```ts
|
|
54
54
|
* import { createConfig, http } from '@wagmi/core'
|
|
55
|
-
* import { tempo } from '
|
|
55
|
+
* import { tempo } from 'viem/chains'
|
|
56
56
|
* import { Actions } from 'tempo.ts/wagmi'
|
|
57
57
|
*
|
|
58
58
|
* const config = createConfig({
|
|
59
|
-
* chains: [
|
|
59
|
+
* chains: [tempoTestnet],
|
|
60
60
|
* transports: {
|
|
61
61
|
* [tempo.id]: http(),
|
|
62
62
|
* },
|
|
@@ -77,13 +77,13 @@ export async function fundSync<config extends Config>(
|
|
|
77
77
|
): Promise<fundSync.ReturnValue> {
|
|
78
78
|
const { chainId, ...rest } = parameters
|
|
79
79
|
const client = config.getClient({ chainId })
|
|
80
|
-
return
|
|
80
|
+
return Actions.faucet.fundSync(client, rest)
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
export declare namespace fundSync {
|
|
84
84
|
export type Parameters<config extends Config> = UnionCompute<
|
|
85
|
-
ChainIdParameter<config> &
|
|
85
|
+
ChainIdParameter<config> & Actions.faucet.fundSync.Parameters
|
|
86
86
|
>
|
|
87
87
|
|
|
88
|
-
export type ReturnValue =
|
|
88
|
+
export type ReturnValue = Actions.faucet.fundSync.ReturnValue
|
|
89
89
|
}
|
package/src/wagmi/Actions/fee.ts
CHANGED
|
@@ -2,8 +2,8 @@ import type * as Query from '@tanstack/query-core'
|
|
|
2
2
|
import { type Config, getConnectorClient } from '@wagmi/core'
|
|
3
3
|
import type { ChainIdParameter, ConnectorParameter } from '@wagmi/core/internal'
|
|
4
4
|
import type { Account } from 'viem'
|
|
5
|
+
import { Actions } from 'viem/tempo'
|
|
5
6
|
import type { PartialBy, RequiredBy, UnionOmit } from '../../internal/types.js'
|
|
6
|
-
import * as viem_Actions from '../../viem/Actions/fee.js'
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Gets the user's default fee token.
|
|
@@ -11,11 +11,11 @@ import * as viem_Actions from '../../viem/Actions/fee.js'
|
|
|
11
11
|
* @example
|
|
12
12
|
* ```ts
|
|
13
13
|
* import { createConfig, http } from '@wagmi/core'
|
|
14
|
-
* import { tempo } from '
|
|
14
|
+
* import { tempo } from 'viem/chains'
|
|
15
15
|
* import { Actions } from 'tempo.ts/wagmi'
|
|
16
16
|
*
|
|
17
17
|
* const config = createConfig({
|
|
18
|
-
* chains: [
|
|
18
|
+
* chains: [tempoTestnet],
|
|
19
19
|
* transports: {
|
|
20
20
|
* [tempo.id]: http(),
|
|
21
21
|
* },
|
|
@@ -36,14 +36,14 @@ export function getUserToken<config extends Config>(
|
|
|
36
36
|
): Promise<getUserToken.ReturnValue> {
|
|
37
37
|
const { chainId, ...rest } = parameters
|
|
38
38
|
const client = config.getClient({ chainId })
|
|
39
|
-
return
|
|
39
|
+
return Actions.fee.getUserToken(client, rest)
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
export namespace getUserToken {
|
|
43
43
|
export type Parameters<config extends Config> = ChainIdParameter<config> &
|
|
44
|
-
|
|
44
|
+
Actions.fee.getUserToken.Parameters
|
|
45
45
|
|
|
46
|
-
export type ReturnValue =
|
|
46
|
+
export type ReturnValue = Actions.fee.getUserToken.ReturnValue
|
|
47
47
|
|
|
48
48
|
export function queryKey<config extends Config>(
|
|
49
49
|
parameters: PartialBy<Parameters<config>, 'account'>,
|
|
@@ -102,11 +102,11 @@ export namespace getUserToken {
|
|
|
102
102
|
* @example
|
|
103
103
|
* ```ts
|
|
104
104
|
* import { createConfig, http } from '@wagmi/core'
|
|
105
|
-
* import { tempo } from '
|
|
105
|
+
* import { tempo } from 'viem/chains'
|
|
106
106
|
* import { Actions } from 'tempo.ts/wagmi'
|
|
107
107
|
*
|
|
108
108
|
* const config = createConfig({
|
|
109
|
-
* chains: [
|
|
109
|
+
* chains: [tempoTestnet],
|
|
110
110
|
* transports: {
|
|
111
111
|
* [tempo.id]: http(),
|
|
112
112
|
* },
|
|
@@ -124,7 +124,7 @@ export namespace getUserToken {
|
|
|
124
124
|
export async function setUserToken<config extends Config>(
|
|
125
125
|
config: config,
|
|
126
126
|
parameters: setUserToken.Parameters<config>,
|
|
127
|
-
): Promise<
|
|
127
|
+
): Promise<Actions.fee.setUserToken.ReturnValue> {
|
|
128
128
|
const { account, chainId, connector } = parameters
|
|
129
129
|
|
|
130
130
|
const client = await getConnectorClient(config, {
|
|
@@ -134,20 +134,20 @@ export async function setUserToken<config extends Config>(
|
|
|
134
134
|
connector,
|
|
135
135
|
})
|
|
136
136
|
|
|
137
|
-
return
|
|
137
|
+
return Actions.fee.setUserToken(client, parameters as never)
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
export declare namespace setUserToken {
|
|
141
141
|
export type Parameters<config extends Config> = ChainIdParameter<config> &
|
|
142
142
|
ConnectorParameter &
|
|
143
143
|
UnionOmit<
|
|
144
|
-
|
|
144
|
+
Actions.fee.setUserToken.Parameters<config['chains'][number], Account>,
|
|
145
145
|
'chain'
|
|
146
146
|
>
|
|
147
147
|
|
|
148
|
-
export type ReturnValue =
|
|
148
|
+
export type ReturnValue = Actions.fee.setUserToken.ReturnValue
|
|
149
149
|
|
|
150
|
-
export type ErrorType =
|
|
150
|
+
export type ErrorType = Actions.fee.setUserToken.ErrorType
|
|
151
151
|
}
|
|
152
152
|
|
|
153
153
|
/**
|
|
@@ -159,11 +159,11 @@ export declare namespace setUserToken {
|
|
|
159
159
|
* @example
|
|
160
160
|
* ```ts
|
|
161
161
|
* import { createConfig, http } from '@wagmi/core'
|
|
162
|
-
* import { tempo } from '
|
|
162
|
+
* import { tempo } from 'viem/chains'
|
|
163
163
|
* import { Actions } from 'tempo.ts/wagmi'
|
|
164
164
|
*
|
|
165
165
|
* const config = createConfig({
|
|
166
|
-
* chains: [
|
|
166
|
+
* chains: [tempoTestnet],
|
|
167
167
|
* transports: {
|
|
168
168
|
* [tempo.id]: http(),
|
|
169
169
|
* },
|
|
@@ -181,7 +181,7 @@ export declare namespace setUserToken {
|
|
|
181
181
|
export async function setUserTokenSync<config extends Config>(
|
|
182
182
|
config: config,
|
|
183
183
|
parameters: setUserTokenSync.Parameters<config>,
|
|
184
|
-
): Promise<
|
|
184
|
+
): Promise<Actions.fee.setUserTokenSync.ReturnValue> {
|
|
185
185
|
const { account, chainId, connector } = parameters
|
|
186
186
|
|
|
187
187
|
const client = await getConnectorClient(config, {
|
|
@@ -191,21 +191,21 @@ export async function setUserTokenSync<config extends Config>(
|
|
|
191
191
|
connector,
|
|
192
192
|
})
|
|
193
193
|
|
|
194
|
-
return
|
|
194
|
+
return Actions.fee.setUserTokenSync(client, parameters as never)
|
|
195
195
|
}
|
|
196
196
|
|
|
197
197
|
export declare namespace setUserTokenSync {
|
|
198
198
|
export type Parameters<config extends Config> = ChainIdParameter<config> &
|
|
199
199
|
ConnectorParameter &
|
|
200
200
|
UnionOmit<
|
|
201
|
-
|
|
201
|
+
Actions.fee.setUserTokenSync.Parameters<
|
|
202
202
|
config['chains'][number],
|
|
203
203
|
Account
|
|
204
204
|
>,
|
|
205
205
|
'chain'
|
|
206
206
|
>
|
|
207
207
|
|
|
208
|
-
export type ReturnValue =
|
|
208
|
+
export type ReturnValue = Actions.fee.setUserTokenSync.ReturnValue
|
|
209
209
|
|
|
210
|
-
export type ErrorType =
|
|
210
|
+
export type ErrorType = Actions.fee.setUserTokenSync.ErrorType
|
|
211
211
|
}
|
|
@@ -6,7 +6,7 @@ import { config, queryClient } from '../../../test/wagmi/config.js'
|
|
|
6
6
|
import * as nonce from './nonce.js'
|
|
7
7
|
import * as token from './token.js'
|
|
8
8
|
|
|
9
|
-
const {
|
|
9
|
+
const { getNonce } = nonce
|
|
10
10
|
|
|
11
11
|
const account = accounts[0]
|
|
12
12
|
const account2 = accounts[1]
|
|
@@ -36,24 +36,6 @@ describe('getNonce', () => {
|
|
|
36
36
|
})
|
|
37
37
|
})
|
|
38
38
|
|
|
39
|
-
describe('getNonceKeyCount', () => {
|
|
40
|
-
test('default', async () => {
|
|
41
|
-
const result = await getNonceKeyCount(config, {
|
|
42
|
-
account: account.address,
|
|
43
|
-
})
|
|
44
|
-
expect(result).toBe(0n)
|
|
45
|
-
})
|
|
46
|
-
|
|
47
|
-
describe('queryOptions', () => {
|
|
48
|
-
test('default', async () => {
|
|
49
|
-
const options = getNonceKeyCount.queryOptions(config, {
|
|
50
|
-
account: account.address,
|
|
51
|
-
})
|
|
52
|
-
expect(await queryClient.fetchQuery(options)).toBe(0n)
|
|
53
|
-
})
|
|
54
|
-
})
|
|
55
|
-
})
|
|
56
|
-
|
|
57
39
|
describe('watchNonceIncremented', () => {
|
|
58
40
|
test('default', async () => {
|
|
59
41
|
await connect(config, {
|
|
@@ -98,48 +80,3 @@ describe('watchNonceIncremented', () => {
|
|
|
98
80
|
unwatch()
|
|
99
81
|
})
|
|
100
82
|
})
|
|
101
|
-
|
|
102
|
-
describe('watchActiveKeyCountChanged', () => {
|
|
103
|
-
test('default', async () => {
|
|
104
|
-
await connect(config, {
|
|
105
|
-
connector: config.connectors[0]!,
|
|
106
|
-
})
|
|
107
|
-
|
|
108
|
-
const events: any[] = []
|
|
109
|
-
const unwatch = nonce.watchActiveKeyCountChanged(config, {
|
|
110
|
-
onActiveKeyCountChanged: (args) => {
|
|
111
|
-
events.push(args)
|
|
112
|
-
},
|
|
113
|
-
})
|
|
114
|
-
|
|
115
|
-
const priorKeyCount = await getNonceKeyCount(config, {
|
|
116
|
-
account: account.address,
|
|
117
|
-
})
|
|
118
|
-
|
|
119
|
-
// First use of nonceKey 10 should increment active key count
|
|
120
|
-
await token.transferSync(config, {
|
|
121
|
-
to: account2.address,
|
|
122
|
-
amount: 1n,
|
|
123
|
-
token: 1n,
|
|
124
|
-
nonceKey: 10n,
|
|
125
|
-
nonce: 0,
|
|
126
|
-
})
|
|
127
|
-
|
|
128
|
-
// First use of nonceKey 11 should increment again
|
|
129
|
-
await token.transferSync(config, {
|
|
130
|
-
to: account2.address,
|
|
131
|
-
amount: 1n,
|
|
132
|
-
token: 1n,
|
|
133
|
-
nonceKey: 11n,
|
|
134
|
-
nonce: 0,
|
|
135
|
-
})
|
|
136
|
-
|
|
137
|
-
await new Promise((resolve) => setTimeout(resolve, 1000))
|
|
138
|
-
|
|
139
|
-
expect(events).toHaveLength(2)
|
|
140
|
-
expect(events[0]?.account).toBe(account.address)
|
|
141
|
-
expect(events[0]?.newCount - priorKeyCount).toBe(1n)
|
|
142
|
-
expect(events[1]?.newCount - priorKeyCount).toBe(2n)
|
|
143
|
-
unwatch()
|
|
144
|
-
})
|
|
145
|
-
})
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type * as Query from '@tanstack/query-core'
|
|
2
2
|
import type { Config } from '@wagmi/core'
|
|
3
3
|
import type { ChainIdParameter } from '@wagmi/core/internal'
|
|
4
|
+
import { Actions } from 'viem/tempo'
|
|
4
5
|
import type { PartialBy, RequiredBy } from '../../internal/types.js'
|
|
5
|
-
import * as viem_Actions from '../../viem/Actions/nonce.js'
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Gets the nonce for an account and nonce key.
|
|
@@ -10,11 +10,11 @@ import * as viem_Actions from '../../viem/Actions/nonce.js'
|
|
|
10
10
|
* @example
|
|
11
11
|
* ```ts
|
|
12
12
|
* import { createConfig, http } from '@wagmi/core'
|
|
13
|
-
* import { tempo } from '
|
|
13
|
+
* import { tempo } from 'viem/chains'
|
|
14
14
|
* import { Actions } from 'tempo.ts/wagmi'
|
|
15
15
|
*
|
|
16
16
|
* const config = createConfig({
|
|
17
|
-
* chains: [
|
|
17
|
+
* chains: [tempoTestnet],
|
|
18
18
|
* transports: {
|
|
19
19
|
* [tempo.id]: http(),
|
|
20
20
|
* },
|
|
@@ -36,14 +36,14 @@ export function getNonce<config extends Config>(
|
|
|
36
36
|
): Promise<getNonce.ReturnValue> {
|
|
37
37
|
const { chainId, ...rest } = parameters
|
|
38
38
|
const client = config.getClient({ chainId })
|
|
39
|
-
return
|
|
39
|
+
return Actions.nonce.getNonce(client, rest)
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
export namespace getNonce {
|
|
43
43
|
export type Parameters<config extends Config> = ChainIdParameter<config> &
|
|
44
|
-
|
|
44
|
+
Actions.nonce.getNonce.Parameters
|
|
45
45
|
|
|
46
|
-
export type ReturnValue =
|
|
46
|
+
export type ReturnValue = Actions.nonce.getNonce.ReturnValue
|
|
47
47
|
|
|
48
48
|
export function queryKey<config extends Config>(
|
|
49
49
|
parameters: PartialBy<Parameters<config>, 'account' | 'nonceKey'>,
|
|
@@ -97,108 +97,17 @@ export namespace getNonce {
|
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
/**
|
|
101
|
-
* Gets the number of active nonce keys for an account.
|
|
102
|
-
*
|
|
103
|
-
* @example
|
|
104
|
-
* ```ts
|
|
105
|
-
* import { createConfig, http } from '@wagmi/core'
|
|
106
|
-
* import { tempo } from 'tempo.ts/chains'
|
|
107
|
-
* import { Actions } from 'tempo.ts/wagmi'
|
|
108
|
-
*
|
|
109
|
-
* const config = createConfig({
|
|
110
|
-
* chains: [tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })],
|
|
111
|
-
* transports: {
|
|
112
|
-
* [tempo.id]: http(),
|
|
113
|
-
* },
|
|
114
|
-
* })
|
|
115
|
-
*
|
|
116
|
-
* const count = await Actions.nonce.getNonceKeyCount(config, {
|
|
117
|
-
* account: '0x...',
|
|
118
|
-
* })
|
|
119
|
-
* ```
|
|
120
|
-
*
|
|
121
|
-
* @param config - Config.
|
|
122
|
-
* @param parameters - Parameters.
|
|
123
|
-
* @returns The number of active nonce keys.
|
|
124
|
-
*/
|
|
125
|
-
export function getNonceKeyCount<config extends Config>(
|
|
126
|
-
config: config,
|
|
127
|
-
parameters: getNonceKeyCount.Parameters<config>,
|
|
128
|
-
): Promise<getNonceKeyCount.ReturnValue> {
|
|
129
|
-
const { chainId, ...rest } = parameters
|
|
130
|
-
const client = config.getClient({ chainId })
|
|
131
|
-
return viem_Actions.getNonceKeyCount(client, rest)
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
export namespace getNonceKeyCount {
|
|
135
|
-
export type Parameters<config extends Config> = ChainIdParameter<config> &
|
|
136
|
-
viem_Actions.getNonceKeyCount.Parameters
|
|
137
|
-
|
|
138
|
-
export type ReturnValue = viem_Actions.getNonceKeyCount.ReturnValue
|
|
139
|
-
|
|
140
|
-
export function queryKey<config extends Config>(
|
|
141
|
-
parameters: PartialBy<Parameters<config>, 'account'>,
|
|
142
|
-
) {
|
|
143
|
-
return ['getNonceKeyCount', parameters] as const
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
export type QueryKey<config extends Config> = ReturnType<
|
|
147
|
-
typeof queryKey<config>
|
|
148
|
-
>
|
|
149
|
-
|
|
150
|
-
export function queryOptions<config extends Config, selectData = ReturnValue>(
|
|
151
|
-
config: Config,
|
|
152
|
-
parameters: queryOptions.Parameters<config, selectData>,
|
|
153
|
-
): queryOptions.ReturnValue<config, selectData> {
|
|
154
|
-
const { query, ...rest } = parameters
|
|
155
|
-
return {
|
|
156
|
-
...query,
|
|
157
|
-
queryKey: queryKey(rest),
|
|
158
|
-
async queryFn({ queryKey }) {
|
|
159
|
-
const [, { account, ...parameters }] = queryKey
|
|
160
|
-
if (!account) throw new Error('account is required.')
|
|
161
|
-
return await getNonceKeyCount(config, { account, ...parameters })
|
|
162
|
-
},
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
export declare namespace queryOptions {
|
|
167
|
-
export type Parameters<
|
|
168
|
-
config extends Config,
|
|
169
|
-
selectData = getNonceKeyCount.ReturnValue,
|
|
170
|
-
> = PartialBy<getNonceKeyCount.Parameters<config>, 'account'> & {
|
|
171
|
-
query?:
|
|
172
|
-
| Omit<ReturnValue<config, selectData>, 'queryKey' | 'queryFn'>
|
|
173
|
-
| undefined
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
export type ReturnValue<
|
|
177
|
-
config extends Config,
|
|
178
|
-
selectData = getNonceKeyCount.ReturnValue,
|
|
179
|
-
> = RequiredBy<
|
|
180
|
-
Query.QueryOptions<
|
|
181
|
-
getNonceKeyCount.ReturnValue,
|
|
182
|
-
Query.DefaultError,
|
|
183
|
-
selectData,
|
|
184
|
-
getNonceKeyCount.QueryKey<config>
|
|
185
|
-
>,
|
|
186
|
-
'queryKey' | 'queryFn'
|
|
187
|
-
>
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
|
|
191
100
|
/**
|
|
192
101
|
* Watches for nonce incremented events.
|
|
193
102
|
*
|
|
194
103
|
* @example
|
|
195
104
|
* ```ts
|
|
196
105
|
* import { createConfig, http } from '@wagmi/core'
|
|
197
|
-
* import { tempo } from '
|
|
106
|
+
* import { tempo } from 'viem/chains'
|
|
198
107
|
* import { Actions } from 'tempo.ts/wagmi'
|
|
199
108
|
*
|
|
200
109
|
* const config = createConfig({
|
|
201
|
-
* chains: [
|
|
110
|
+
* chains: [tempoTestnet],
|
|
202
111
|
* transports: {
|
|
203
112
|
* [tempo.id]: http(),
|
|
204
113
|
* },
|
|
@@ -221,51 +130,10 @@ export function watchNonceIncremented<config extends Config>(
|
|
|
221
130
|
): () => void {
|
|
222
131
|
const { chainId, ...rest } = parameters
|
|
223
132
|
const client = config.getClient({ chainId })
|
|
224
|
-
return
|
|
133
|
+
return Actions.nonce.watchNonceIncremented(client, rest)
|
|
225
134
|
}
|
|
226
135
|
|
|
227
136
|
export declare namespace watchNonceIncremented {
|
|
228
137
|
export type Parameters<config extends Config> = ChainIdParameter<config> &
|
|
229
|
-
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
/**
|
|
233
|
-
* Watches for active key count changed events.
|
|
234
|
-
*
|
|
235
|
-
* @example
|
|
236
|
-
* ```ts
|
|
237
|
-
* import { createConfig, http } from '@wagmi/core'
|
|
238
|
-
* import { tempo } from 'tempo.ts/chains'
|
|
239
|
-
* import { Actions } from 'tempo.ts/wagmi'
|
|
240
|
-
*
|
|
241
|
-
* const config = createConfig({
|
|
242
|
-
* chains: [tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })],
|
|
243
|
-
* transports: {
|
|
244
|
-
* [tempo.id]: http(),
|
|
245
|
-
* },
|
|
246
|
-
* })
|
|
247
|
-
*
|
|
248
|
-
* const unwatch = Actions.nonce.watchActiveKeyCountChanged(config, {
|
|
249
|
-
* onActiveKeyCountChanged: (args, log) => {
|
|
250
|
-
* console.log('Active key count changed:', args)
|
|
251
|
-
* },
|
|
252
|
-
* })
|
|
253
|
-
* ```
|
|
254
|
-
*
|
|
255
|
-
* @param config - Config.
|
|
256
|
-
* @param parameters - Parameters.
|
|
257
|
-
* @returns A function to unsubscribe from the event.
|
|
258
|
-
*/
|
|
259
|
-
export function watchActiveKeyCountChanged<config extends Config>(
|
|
260
|
-
config: config,
|
|
261
|
-
parameters: watchActiveKeyCountChanged.Parameters<config>,
|
|
262
|
-
): () => void {
|
|
263
|
-
const { chainId, ...rest } = parameters
|
|
264
|
-
const client = config.getClient({ chainId })
|
|
265
|
-
return viem_Actions.watchActiveKeyCountChanged(client, rest)
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
export declare namespace watchActiveKeyCountChanged {
|
|
269
|
-
export type Parameters<config extends Config> = ChainIdParameter<config> &
|
|
270
|
-
viem_Actions.watchActiveKeyCountChanged.Parameters
|
|
138
|
+
Actions.nonce.watchNonceIncremented.Parameters
|
|
271
139
|
}
|