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,347 +0,0 @@
1
- import type {
2
- Account,
3
- Address,
4
- Chain,
5
- Client,
6
- ExtractAbiItem,
7
- GetEventArgs,
8
- ReadContractReturnType,
9
- Transport,
10
- Log as viem_Log,
11
- WatchContractEventParameters,
12
- } from 'viem'
13
- import { readContract, watchContractEvent } from 'viem/actions'
14
- import type { UnionOmit } from '../../internal/types.js'
15
- import * as Abis from '../Abis.js'
16
- import * as Addresses from '../Addresses.js'
17
- import type { ReadParameters } from '../internal/types.js'
18
- import { defineCall } from '../internal/utils.js'
19
-
20
- /**
21
- * Gets the nonce for an account and nonce key.
22
- *
23
- * @example
24
- * ```ts
25
- * import { createClient, http } from 'viem'
26
- * import { tempo } from 'tempo.ts/chains'
27
- * import { Actions } from 'tempo.ts/viem'
28
- *
29
- * const client = createClient({
30
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
31
- * transport: http(),
32
- * })
33
- *
34
- * const nonce = await Actions.nonce.getNonce(client, {
35
- * account: '0x...',
36
- * nonceKey: 1n,
37
- * })
38
- * ```
39
- *
40
- * @param client - Client.
41
- * @param parameters - Parameters.
42
- * @returns The nonce value.
43
- */
44
- export async function getNonce<
45
- chain extends Chain | undefined,
46
- account extends Account | undefined,
47
- >(
48
- client: Client<Transport, chain, account>,
49
- parameters: getNonce.Parameters,
50
- ): Promise<getNonce.ReturnValue> {
51
- const { account, nonceKey, ...rest } = parameters
52
- return readContract(client, {
53
- ...rest,
54
- ...getNonce.call({ account, nonceKey }),
55
- })
56
- }
57
-
58
- export namespace getNonce {
59
- export type Parameters = ReadParameters & Args
60
-
61
- export type Args = {
62
- /** Account address. */
63
- account: Address
64
- /** Nonce key (must be > 0, key 0 is reserved for protocol nonces). */
65
- nonceKey: bigint
66
- }
67
-
68
- export type ReturnValue = ReadContractReturnType<
69
- typeof Abis.nonce,
70
- 'getNonce',
71
- never
72
- >
73
-
74
- /**
75
- * Defines a call to the `getNonce` function.
76
- *
77
- * Can be passed as a parameter to:
78
- * - [`estimateContractGas`](https://viem.sh/docs/contract/estimateContractGas): estimate the gas cost of the call
79
- * - [`simulateContract`](https://viem.sh/docs/contract/simulateContract): simulate the call
80
- * - [`multicall`](https://viem.sh/docs/contract/multicall): execute multiple calls in parallel
81
- *
82
- * @example
83
- * ```ts
84
- * import { createClient, http } from 'viem'
85
- * import { tempo } from 'tempo.ts/chains'
86
- * import { Actions } from 'tempo.ts/viem'
87
- *
88
- * const client = createClient({
89
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
90
- * transport: http(),
91
- * })
92
- *
93
- * const result = await client.multicall({
94
- * contracts: [
95
- * Actions.nonce.getNonce.call({ account: '0x...', nonceKey: 1n }),
96
- * Actions.nonce.getNonce.call({ account: '0x...', nonceKey: 2n }),
97
- * ],
98
- * })
99
- * ```
100
- *
101
- * @param args - Arguments.
102
- * @returns The call.
103
- */
104
- export function call(args: Args) {
105
- const { account, nonceKey } = args
106
- return defineCall({
107
- address: Addresses.nonceManager,
108
- abi: Abis.nonce,
109
- args: [account, nonceKey],
110
- functionName: 'getNonce',
111
- })
112
- }
113
- }
114
-
115
- /**
116
- * Gets the number of active nonce keys for an account.
117
- *
118
- * @example
119
- * ```ts
120
- * import { createClient, http } from 'viem'
121
- * import { tempo } from 'tempo.ts/chains'
122
- * import { Actions } from 'tempo.ts/viem'
123
- *
124
- * const client = createClient({
125
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
126
- * transport: http(),
127
- * })
128
- *
129
- * const count = await Actions.nonce.getNonceKeyCount(client, {
130
- * account: '0x...',
131
- * })
132
- * ```
133
- *
134
- * @param client - Client.
135
- * @param parameters - Parameters.
136
- * @returns The number of active nonce keys.
137
- */
138
- export async function getNonceKeyCount<
139
- chain extends Chain | undefined,
140
- account extends Account | undefined,
141
- >(
142
- client: Client<Transport, chain, account>,
143
- parameters: getNonceKeyCount.Parameters,
144
- ): Promise<getNonceKeyCount.ReturnValue> {
145
- const { account, ...rest } = parameters
146
- return readContract(client, {
147
- ...rest,
148
- ...getNonceKeyCount.call({ account }),
149
- })
150
- }
151
-
152
- export namespace getNonceKeyCount {
153
- export type Parameters = ReadParameters & Args
154
-
155
- export type Args = {
156
- /** Account address. */
157
- account: Address
158
- }
159
-
160
- export type ReturnValue = ReadContractReturnType<
161
- typeof Abis.nonce,
162
- 'getActiveNonceKeyCount',
163
- never
164
- >
165
-
166
- /**
167
- * Defines a call to the `getNonceKeyCount` function.
168
- *
169
- * Can be passed as a parameter to:
170
- * - [`estimateContractGas`](https://viem.sh/docs/contract/estimateContractGas): estimate the gas cost of the call
171
- * - [`simulateContract`](https://viem.sh/docs/contract/simulateContract): simulate the call
172
- * - [`multicall`](https://viem.sh/docs/contract/multicall): execute multiple calls in parallel
173
- *
174
- * @example
175
- * ```ts
176
- * import { createClient, http } from 'viem'
177
- * import { tempo } from 'tempo.ts/chains'
178
- * import { Actions } from 'tempo.ts/viem'
179
- *
180
- * const client = createClient({
181
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
182
- * transport: http(),
183
- * })
184
- *
185
- * const result = await client.multicall({
186
- * contracts: [
187
- * Actions.nonce.getNonceKeyCount.call({ account: '0x...' }),
188
- * Actions.nonce.getNonceKeyCount.call({ account: '0x...' }),
189
- * ],
190
- * })
191
- * ```
192
- *
193
- * @param args - Arguments.
194
- * @returns The call.
195
- */
196
- export function call(args: Args) {
197
- const { account } = args
198
- return defineCall({
199
- address: Addresses.nonceManager,
200
- abi: Abis.nonce,
201
- args: [account],
202
- functionName: 'getActiveNonceKeyCount',
203
- })
204
- }
205
- }
206
-
207
- /**
208
- * Watches for nonce incremented events.
209
- *
210
- * @example
211
- * ```ts
212
- * import { createClient, http } from 'viem'
213
- * import { tempo } from 'tempo.ts/chains'
214
- * import { Actions } from 'tempo.ts/viem'
215
- *
216
- * const client = createClient({
217
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
218
- * transport: http(),
219
- * })
220
- *
221
- * const unwatch = Actions.nonce.watchNonceIncremented(client, {
222
- * onNonceIncremented: (args, log) => {
223
- * console.log('Nonce incremented:', args)
224
- * },
225
- * })
226
- * ```
227
- *
228
- * @param client - Client.
229
- * @param parameters - Parameters.
230
- * @returns A function to unsubscribe from the event.
231
- */
232
- export function watchNonceIncremented<
233
- chain extends Chain | undefined,
234
- account extends Account | undefined,
235
- >(
236
- client: Client<Transport, chain, account>,
237
- parameters: watchNonceIncremented.Parameters,
238
- ) {
239
- const { onNonceIncremented, ...rest } = parameters
240
- return watchContractEvent(client, {
241
- ...rest,
242
- address: Addresses.nonceManager,
243
- abi: Abis.nonce,
244
- eventName: 'NonceIncremented',
245
- onLogs: (logs) => {
246
- for (const log of logs) onNonceIncremented(log.args, log)
247
- },
248
- strict: true,
249
- })
250
- }
251
-
252
- export declare namespace watchNonceIncremented {
253
- export type Args = GetEventArgs<
254
- typeof Abis.nonce,
255
- 'NonceIncremented',
256
- { IndexedOnly: false; Required: true }
257
- >
258
-
259
- export type Log = viem_Log<
260
- bigint,
261
- number,
262
- false,
263
- ExtractAbiItem<typeof Abis.nonce, 'NonceIncremented'>,
264
- true
265
- >
266
-
267
- export type Parameters = UnionOmit<
268
- WatchContractEventParameters<typeof Abis.nonce, 'NonceIncremented', true>,
269
- 'abi' | 'address' | 'batch' | 'eventName' | 'onLogs' | 'strict'
270
- > & {
271
- /** Callback to invoke when a nonce is incremented. */
272
- onNonceIncremented: (args: Args, log: Log) => void
273
- }
274
- }
275
-
276
- /**
277
- * Watches for active key count changed events.
278
- *
279
- * @example
280
- * ```ts
281
- * import { createClient, http } from 'viem'
282
- * import { tempo } from 'tempo.ts/chains'
283
- * import { Actions } from 'tempo.ts/viem'
284
- *
285
- * const client = createClient({
286
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
287
- * transport: http(),
288
- * })
289
- *
290
- * const unwatch = Actions.nonce.watchActiveKeyCountChanged(client, {
291
- * onActiveKeyCountChanged: (args, log) => {
292
- * console.log('Active key count changed:', args)
293
- * },
294
- * })
295
- * ```
296
- *
297
- * @param client - Client.
298
- * @param parameters - Parameters.
299
- * @returns A function to unsubscribe from the event.
300
- */
301
- export function watchActiveKeyCountChanged<
302
- chain extends Chain | undefined,
303
- account extends Account | undefined,
304
- >(
305
- client: Client<Transport, chain, account>,
306
- parameters: watchActiveKeyCountChanged.Parameters,
307
- ) {
308
- const { onActiveKeyCountChanged, ...rest } = parameters
309
- return watchContractEvent(client, {
310
- ...rest,
311
- address: Addresses.nonceManager,
312
- abi: Abis.nonce,
313
- eventName: 'ActiveKeyCountChanged',
314
- onLogs: (logs) => {
315
- for (const log of logs) onActiveKeyCountChanged(log.args, log)
316
- },
317
- strict: true,
318
- })
319
- }
320
-
321
- export declare namespace watchActiveKeyCountChanged {
322
- export type Args = GetEventArgs<
323
- typeof Abis.nonce,
324
- 'ActiveKeyCountChanged',
325
- { IndexedOnly: false; Required: true }
326
- >
327
-
328
- export type Log = viem_Log<
329
- bigint,
330
- number,
331
- false,
332
- ExtractAbiItem<typeof Abis.nonce, 'ActiveKeyCountChanged'>,
333
- true
334
- >
335
-
336
- export type Parameters = UnionOmit<
337
- WatchContractEventParameters<
338
- typeof Abis.nonce,
339
- 'ActiveKeyCountChanged',
340
- true
341
- >,
342
- 'abi' | 'address' | 'batch' | 'eventName' | 'onLogs' | 'strict'
343
- > & {
344
- /** Callback to invoke when the active key count changes. */
345
- onActiveKeyCountChanged: (args: Args, log: Log) => void
346
- }
347
- }