tempo.ts 0.11.0 → 0.12.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.
Files changed (196) hide show
  1. package/CHANGELOG.md +67 -4
  2. package/README.md +3 -34
  3. package/dist/server/Handler.d.ts +14 -14
  4. package/dist/server/Handler.d.ts.map +1 -1
  5. package/dist/server/Handler.js +16 -17
  6. package/dist/server/Handler.js.map +1 -1
  7. package/dist/wagmi/Actions/amm.d.ts +51 -51
  8. package/dist/wagmi/Actions/amm.d.ts.map +1 -1
  9. package/dist/wagmi/Actions/amm.js +37 -37
  10. package/dist/wagmi/Actions/amm.js.map +1 -1
  11. package/dist/wagmi/Actions/dex.d.ts +129 -129
  12. package/dist/wagmi/Actions/dex.d.ts.map +1 -1
  13. package/dist/wagmi/Actions/dex.js +73 -73
  14. package/dist/wagmi/Actions/dex.js.map +1 -1
  15. package/dist/wagmi/Actions/faucet.d.ts +9 -9
  16. package/dist/wagmi/Actions/faucet.d.ts.map +1 -1
  17. package/dist/wagmi/Actions/faucet.js +7 -7
  18. package/dist/wagmi/Actions/faucet.js.map +1 -1
  19. package/dist/wagmi/Actions/fee.d.ts +17 -17
  20. package/dist/wagmi/Actions/fee.d.ts.map +1 -1
  21. package/dist/wagmi/Actions/fee.js +10 -10
  22. package/dist/wagmi/Actions/fee.js.map +1 -1
  23. package/dist/wagmi/Actions/nonce.d.ts +9 -79
  24. package/dist/wagmi/Actions/nonce.d.ts.map +1 -1
  25. package/dist/wagmi/Actions/nonce.js +7 -89
  26. package/dist/wagmi/Actions/nonce.js.map +1 -1
  27. package/dist/wagmi/Actions/policy.d.ts +69 -70
  28. package/dist/wagmi/Actions/policy.d.ts.map +1 -1
  29. package/dist/wagmi/Actions/policy.js +43 -43
  30. package/dist/wagmi/Actions/policy.js.map +1 -1
  31. package/dist/wagmi/Actions/reward.d.ts +51 -51
  32. package/dist/wagmi/Actions/reward.d.ts.map +1 -1
  33. package/dist/wagmi/Actions/reward.js +31 -31
  34. package/dist/wagmi/Actions/reward.js.map +1 -1
  35. package/dist/wagmi/Actions/token.d.ts +238 -238
  36. package/dist/wagmi/Actions/token.d.ts.map +1 -1
  37. package/dist/wagmi/Actions/token.js +136 -136
  38. package/dist/wagmi/Actions/token.js.map +1 -1
  39. package/dist/wagmi/Connector.d.ts +2 -1
  40. package/dist/wagmi/Connector.d.ts.map +1 -1
  41. package/dist/wagmi/Connector.js +83 -22
  42. package/dist/wagmi/Connector.js.map +1 -1
  43. package/dist/wagmi/Hooks/nonce.d.ts +1 -52
  44. package/dist/wagmi/Hooks/nonce.d.ts.map +1 -1
  45. package/dist/wagmi/Hooks/nonce.js +1 -70
  46. package/dist/wagmi/Hooks/nonce.js.map +1 -1
  47. package/dist/wagmi/Hooks/policy.d.ts +0 -1
  48. package/dist/wagmi/Hooks/policy.d.ts.map +1 -1
  49. package/dist/wagmi/Hooks/policy.js.map +1 -1
  50. package/dist/wagmi/KeyManager.d.ts +6 -3
  51. package/dist/wagmi/KeyManager.d.ts.map +1 -1
  52. package/dist/wagmi/KeyManager.js +9 -4
  53. package/dist/wagmi/KeyManager.js.map +1 -1
  54. package/package.json +2 -2
  55. package/src/server/Handler.test.ts +2 -2
  56. package/src/server/Handler.ts +16 -17
  57. package/src/wagmi/Actions/amm.ts +63 -63
  58. package/src/wagmi/Actions/dex.test.ts +1 -1
  59. package/src/wagmi/Actions/dex.ts +153 -153
  60. package/src/wagmi/Actions/faucet.ts +11 -11
  61. package/src/wagmi/Actions/fee.ts +20 -20
  62. package/src/wagmi/Actions/nonce.test.ts +1 -64
  63. package/src/wagmi/Actions/nonce.ts +10 -142
  64. package/src/wagmi/Actions/policy.ts +83 -85
  65. package/src/wagmi/Actions/reward.ts +64 -61
  66. package/src/wagmi/Actions/token.ts +287 -283
  67. package/src/wagmi/Connector.ts +105 -31
  68. package/src/wagmi/Hooks/dex.test.ts +1 -1
  69. package/src/wagmi/Hooks/fee.test.ts +0 -6
  70. package/src/wagmi/Hooks/nonce.test.ts +1 -66
  71. package/src/wagmi/Hooks/nonce.ts +1 -114
  72. package/src/wagmi/Hooks/policy.ts +0 -2
  73. package/src/wagmi/KeyManager.ts +18 -5
  74. package/dist/viem/Abis.d.ts +0 -2649
  75. package/dist/viem/Abis.d.ts.map +0 -1
  76. package/dist/viem/Abis.js +0 -1677
  77. package/dist/viem/Abis.js.map +0 -1
  78. package/dist/viem/Account.d.ts +0 -244
  79. package/dist/viem/Account.d.ts.map +0 -1
  80. package/dist/viem/Account.js +0 -382
  81. package/dist/viem/Account.js.map +0 -1
  82. package/dist/viem/Actions/amm.d.ts +0 -1991
  83. package/dist/viem/Actions/amm.d.ts.map +0 -1
  84. package/dist/viem/Actions/amm.js +0 -814
  85. package/dist/viem/Actions/amm.js.map +0 -1
  86. package/dist/viem/Actions/dex.d.ts +0 -3900
  87. package/dist/viem/Actions/dex.d.ts.map +0 -1
  88. package/dist/viem/Actions/dex.js +0 -1414
  89. package/dist/viem/Actions/dex.js.map +0 -1
  90. package/dist/viem/Actions/faucet.d.ts +0 -69
  91. package/dist/viem/Actions/faucet.d.ts.map +0 -1
  92. package/dist/viem/Actions/faucet.js +0 -73
  93. package/dist/viem/Actions/faucet.js.map +0 -1
  94. package/dist/viem/Actions/fee.d.ts +0 -360
  95. package/dist/viem/Actions/fee.d.ts.map +0 -1
  96. package/dist/viem/Actions/fee.js +0 -237
  97. package/dist/viem/Actions/fee.js.map +0 -1
  98. package/dist/viem/Actions/nonce.d.ts +0 -257
  99. package/dist/viem/Actions/nonce.d.ts.map +0 -1
  100. package/dist/viem/Actions/nonce.js +0 -228
  101. package/dist/viem/Actions/nonce.js.map +0 -1
  102. package/dist/viem/Actions/policy.d.ts +0 -1680
  103. package/dist/viem/Actions/policy.d.ts.map +0 -1
  104. package/dist/viem/Actions/policy.js +0 -875
  105. package/dist/viem/Actions/policy.js.map +0 -1
  106. package/dist/viem/Actions/reward.d.ts +0 -2422
  107. package/dist/viem/Actions/reward.d.ts.map +0 -1
  108. package/dist/viem/Actions/reward.js +0 -651
  109. package/dist/viem/Actions/reward.js.map +0 -1
  110. package/dist/viem/Actions/token.d.ts +0 -16007
  111. package/dist/viem/Actions/token.d.ts.map +0 -1
  112. package/dist/viem/Actions/token.js +0 -2936
  113. package/dist/viem/Actions/token.js.map +0 -1
  114. package/dist/viem/Addresses.d.ts +0 -9
  115. package/dist/viem/Addresses.d.ts.map +0 -1
  116. package/dist/viem/Addresses.js +0 -9
  117. package/dist/viem/Addresses.js.map +0 -1
  118. package/dist/viem/Chain.d.ts +0 -451
  119. package/dist/viem/Chain.d.ts.map +0 -1
  120. package/dist/viem/Chain.js +0 -96
  121. package/dist/viem/Chain.js.map +0 -1
  122. package/dist/viem/Formatters.d.ts +0 -10
  123. package/dist/viem/Formatters.d.ts.map +0 -1
  124. package/dist/viem/Formatters.js +0 -104
  125. package/dist/viem/Formatters.js.map +0 -1
  126. package/dist/viem/Storage.d.ts +0 -24
  127. package/dist/viem/Storage.d.ts.map +0 -1
  128. package/dist/viem/Storage.js +0 -68
  129. package/dist/viem/Storage.js.map +0 -1
  130. package/dist/viem/Transaction.d.ts +0 -76
  131. package/dist/viem/Transaction.d.ts.map +0 -1
  132. package/dist/viem/Transaction.js +0 -176
  133. package/dist/viem/Transaction.js.map +0 -1
  134. package/dist/viem/Transport.d.ts +0 -33
  135. package/dist/viem/Transport.d.ts.map +0 -1
  136. package/dist/viem/Transport.js +0 -138
  137. package/dist/viem/Transport.js.map +0 -1
  138. package/dist/viem/WebAuthnP256.d.ts +0 -82
  139. package/dist/viem/WebAuthnP256.d.ts.map +0 -1
  140. package/dist/viem/WebAuthnP256.js +0 -97
  141. package/dist/viem/WebAuthnP256.js.map +0 -1
  142. package/dist/viem/WebCryptoP256.d.ts +0 -2
  143. package/dist/viem/WebCryptoP256.d.ts.map +0 -1
  144. package/dist/viem/WebCryptoP256.js +0 -2
  145. package/dist/viem/WebCryptoP256.js.map +0 -1
  146. package/dist/viem/internal/types.d.ts +0 -20
  147. package/dist/viem/internal/types.d.ts.map +0 -1
  148. package/dist/viem/internal/types.js +0 -2
  149. package/dist/viem/internal/types.js.map +0 -1
  150. package/dist/viem/internal/utils.d.ts +0 -14
  151. package/dist/viem/internal/utils.d.ts.map +0 -1
  152. package/dist/viem/internal/utils.js +0 -33
  153. package/dist/viem/internal/utils.js.map +0 -1
  154. package/src/chains.ts +0 -54
  155. package/src/viem/Abis.ts +0 -1688
  156. package/src/viem/Account.test.ts +0 -444
  157. package/src/viem/Account.ts +0 -601
  158. package/src/viem/Actions/account.test.ts +0 -414
  159. package/src/viem/Actions/account.ts +0 -106
  160. package/src/viem/Actions/amm.test.ts +0 -381
  161. package/src/viem/Actions/amm.ts +0 -1227
  162. package/src/viem/Actions/dex.test.ts +0 -1549
  163. package/src/viem/Actions/dex.ts +0 -2150
  164. package/src/viem/Actions/faucet.ts +0 -121
  165. package/src/viem/Actions/fee.test.ts +0 -259
  166. package/src/viem/Actions/fee.ts +0 -372
  167. package/src/viem/Actions/index.ts +0 -9
  168. package/src/viem/Actions/nonce.test.ts +0 -206
  169. package/src/viem/Actions/nonce.ts +0 -347
  170. package/src/viem/Actions/policy.test.ts +0 -534
  171. package/src/viem/Actions/policy.ts +0 -1335
  172. package/src/viem/Actions/reward.test.ts +0 -434
  173. package/src/viem/Actions/reward.ts +0 -944
  174. package/src/viem/Actions/token.test.ts +0 -3029
  175. package/src/viem/Actions/token.ts +0 -4458
  176. package/src/viem/Addresses.ts +0 -9
  177. package/src/viem/Chain.bench-d.ts +0 -12
  178. package/src/viem/Chain.test.ts +0 -168
  179. package/src/viem/Chain.ts +0 -157
  180. package/src/viem/Decorator.bench-d.ts +0 -11
  181. package/src/viem/Decorator.test.ts +0 -39
  182. package/src/viem/Decorator.ts +0 -3179
  183. package/src/viem/Formatters.ts +0 -164
  184. package/src/viem/P256.ts +0 -1
  185. package/src/viem/Secp256k1.ts +0 -1
  186. package/src/viem/Storage.ts +0 -110
  187. package/src/viem/TokenIds.ts +0 -1
  188. package/src/viem/Transaction.ts +0 -382
  189. package/src/viem/Transport.ts +0 -191
  190. package/src/viem/WebAuthnP256.ts +0 -146
  191. package/src/viem/WebCryptoP256.ts +0 -1
  192. package/src/viem/e2e.test.ts +0 -1602
  193. package/src/viem/index.ts +0 -30
  194. package/src/viem/internal/types.ts +0 -69
  195. package/src/viem/internal/utils.ts +0 -58
  196. 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 * as viem_Actions from '../../viem/Actions/faucet.js'
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 'tempo.ts/chains'
12
+ * import { tempo } from 'viem/chains'
13
13
  * import { Actions } from 'tempo.ts/wagmi'
14
14
  *
15
15
  * const config = createConfig({
16
- * chains: [tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })],
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 viem_Actions.fund(client, rest)
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> & viem_Actions.fund.Parameters
42
+ ChainIdParameter<config> & Actions.faucet.fund.Parameters
43
43
  >
44
44
 
45
- export type ReturnValue = viem_Actions.fund.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 'tempo.ts/chains'
55
+ * import { tempo } from 'viem/chains'
56
56
  * import { Actions } from 'tempo.ts/wagmi'
57
57
  *
58
58
  * const config = createConfig({
59
- * chains: [tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })],
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 viem_Actions.fundSync(client, rest)
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> & viem_Actions.fundSync.Parameters
85
+ ChainIdParameter<config> & Actions.faucet.fundSync.Parameters
86
86
  >
87
87
 
88
- export type ReturnValue = viem_Actions.fundSync.ReturnValue
88
+ export type ReturnValue = Actions.faucet.fundSync.ReturnValue
89
89
  }
@@ -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 'tempo.ts/chains'
14
+ * import { tempo } from 'viem/chains'
15
15
  * import { Actions } from 'tempo.ts/wagmi'
16
16
  *
17
17
  * const config = createConfig({
18
- * chains: [tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })],
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 viem_Actions.getUserToken(client, rest)
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
- viem_Actions.getUserToken.Parameters
44
+ Actions.fee.getUserToken.Parameters
45
45
 
46
- export type ReturnValue = viem_Actions.getUserToken.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 'tempo.ts/chains'
105
+ * import { tempo } from 'viem/chains'
106
106
  * import { Actions } from 'tempo.ts/wagmi'
107
107
  *
108
108
  * const config = createConfig({
109
- * chains: [tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })],
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<viem_Actions.setUserToken.ReturnValue> {
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 viem_Actions.setUserToken(client, parameters as never)
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
- viem_Actions.setUserToken.Parameters<config['chains'][number], Account>,
144
+ Actions.fee.setUserToken.Parameters<config['chains'][number], Account>,
145
145
  'chain'
146
146
  >
147
147
 
148
- export type ReturnValue = viem_Actions.setUserToken.ReturnValue
148
+ export type ReturnValue = Actions.fee.setUserToken.ReturnValue
149
149
 
150
- export type ErrorType = viem_Actions.setUserToken.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 'tempo.ts/chains'
162
+ * import { tempo } from 'viem/chains'
163
163
  * import { Actions } from 'tempo.ts/wagmi'
164
164
  *
165
165
  * const config = createConfig({
166
- * chains: [tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })],
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<viem_Actions.setUserTokenSync.ReturnValue> {
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 viem_Actions.setUserTokenSync(client, parameters as never)
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
- viem_Actions.setUserTokenSync.Parameters<
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 = viem_Actions.setUserTokenSync.ReturnValue
208
+ export type ReturnValue = Actions.fee.setUserTokenSync.ReturnValue
209
209
 
210
- export type ErrorType = viem_Actions.setUserTokenSync.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 { getNonceKeyCount, getNonce } = nonce
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 'tempo.ts/chains'
13
+ * import { tempo } from 'viem/chains'
14
14
  * import { Actions } from 'tempo.ts/wagmi'
15
15
  *
16
16
  * const config = createConfig({
17
- * chains: [tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })],
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 viem_Actions.getNonce(client, rest)
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
- viem_Actions.getNonce.Parameters
44
+ Actions.nonce.getNonce.Parameters
45
45
 
46
- export type ReturnValue = viem_Actions.getNonce.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 'tempo.ts/chains'
106
+ * import { tempo } from 'viem/chains'
198
107
  * import { Actions } from 'tempo.ts/wagmi'
199
108
  *
200
109
  * const config = createConfig({
201
- * chains: [tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })],
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 viem_Actions.watchNonceIncremented(client, rest)
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
- viem_Actions.watchNonceIncremented.Parameters
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
  }