tempo.ts 0.1.5 → 0.2.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.
Files changed (297) hide show
  1. package/README.md +33 -2
  2. package/dist/chains.d.ts +509 -115
  3. package/dist/chains.d.ts.map +1 -1
  4. package/dist/chains.js +20 -9
  5. package/dist/chains.js.map +1 -1
  6. package/dist/ox/Order.d.ts +92 -0
  7. package/dist/ox/Order.d.ts.map +1 -0
  8. package/dist/ox/Order.js +88 -0
  9. package/dist/ox/Order.js.map +1 -0
  10. package/dist/ox/OrdersFilters.d.ts +72 -0
  11. package/dist/ox/OrdersFilters.d.ts.map +1 -0
  12. package/dist/ox/OrdersFilters.js +100 -0
  13. package/dist/ox/OrdersFilters.js.map +1 -0
  14. package/dist/ox/Pagination.d.ts +128 -0
  15. package/dist/ox/Pagination.d.ts.map +1 -0
  16. package/dist/ox/Pagination.js +78 -0
  17. package/dist/ox/Pagination.js.map +1 -0
  18. package/dist/ox/PoolId.d.ts +18 -0
  19. package/dist/ox/PoolId.d.ts.map +1 -0
  20. package/dist/ox/PoolId.js +13 -0
  21. package/dist/ox/PoolId.js.map +1 -0
  22. package/dist/ox/RpcSchema.d.ts +32 -0
  23. package/dist/ox/RpcSchema.d.ts.map +1 -0
  24. package/dist/ox/RpcSchema.js +2 -0
  25. package/dist/ox/RpcSchema.js.map +1 -0
  26. package/dist/ox/SignatureEnvelope.d.ts +1 -1
  27. package/dist/ox/SignatureEnvelope.d.ts.map +1 -1
  28. package/dist/ox/SignatureEnvelope.js.map +1 -1
  29. package/dist/{viem → ox}/Tick.d.ts +4 -0
  30. package/dist/ox/Tick.d.ts.map +1 -0
  31. package/dist/ox/Tick.js.map +1 -0
  32. package/dist/ox/Transaction.d.ts.map +1 -1
  33. package/dist/ox/Transaction.js +2 -1
  34. package/dist/ox/Transaction.js.map +1 -1
  35. package/dist/ox/TransactionEnvelopeAA.d.ts +6 -6
  36. package/dist/ox/TransactionEnvelopeAA.d.ts.map +1 -1
  37. package/dist/ox/TransactionEnvelopeAA.js +4 -2
  38. package/dist/ox/TransactionEnvelopeAA.js.map +1 -1
  39. package/dist/ox/TransactionRequest.d.ts +4 -0
  40. package/dist/ox/TransactionRequest.d.ts.map +1 -1
  41. package/dist/ox/TransactionRequest.js.map +1 -1
  42. package/dist/ox/index.d.ts +6 -0
  43. package/dist/ox/index.d.ts.map +1 -1
  44. package/dist/ox/index.js +6 -0
  45. package/dist/ox/index.js.map +1 -1
  46. package/dist/prool/Instance.d.ts.map +1 -1
  47. package/dist/prool/Instance.js +20 -4
  48. package/dist/prool/Instance.js.map +1 -1
  49. package/dist/viem/Abis.d.ts +1469 -1082
  50. package/dist/viem/Abis.d.ts.map +1 -1
  51. package/dist/viem/Abis.js +932 -671
  52. package/dist/viem/Abis.js.map +1 -1
  53. package/dist/viem/Account.d.ts +150 -0
  54. package/dist/viem/Account.d.ts.map +1 -0
  55. package/dist/viem/Account.js +221 -0
  56. package/dist/viem/Account.js.map +1 -0
  57. package/dist/viem/Actions/amm.d.ts +144 -161
  58. package/dist/viem/Actions/amm.d.ts.map +1 -1
  59. package/dist/viem/Actions/amm.js +109 -163
  60. package/dist/viem/Actions/amm.js.map +1 -1
  61. package/dist/viem/Actions/dex.d.ts +920 -664
  62. package/dist/viem/Actions/dex.d.ts.map +1 -1
  63. package/dist/viem/Actions/dex.js +129 -30
  64. package/dist/viem/Actions/dex.js.map +1 -1
  65. package/dist/viem/Actions/faucet.d.ts +34 -0
  66. package/dist/viem/Actions/faucet.d.ts.map +1 -0
  67. package/dist/viem/Actions/faucet.js +33 -0
  68. package/dist/viem/Actions/faucet.js.map +1 -0
  69. package/dist/viem/Actions/fee.d.ts +16 -30
  70. package/dist/viem/Actions/fee.d.ts.map +1 -1
  71. package/dist/viem/Actions/fee.js +13 -13
  72. package/dist/viem/Actions/fee.js.map +1 -1
  73. package/dist/viem/Actions/index.d.ts +2 -0
  74. package/dist/viem/Actions/index.d.ts.map +1 -1
  75. package/dist/viem/Actions/index.js +2 -0
  76. package/dist/viem/Actions/index.js.map +1 -1
  77. package/dist/viem/Actions/policy.d.ts +46 -46
  78. package/dist/viem/Actions/policy.js +46 -46
  79. package/dist/viem/Actions/reward.d.ts +3236 -0
  80. package/dist/viem/Actions/reward.d.ts.map +1 -0
  81. package/dist/viem/Actions/reward.js +725 -0
  82. package/dist/viem/Actions/reward.js.map +1 -0
  83. package/dist/viem/Actions/token.d.ts +4399 -2750
  84. package/dist/viem/Actions/token.d.ts.map +1 -1
  85. package/dist/viem/Actions/token.js +361 -482
  86. package/dist/viem/Actions/token.js.map +1 -1
  87. package/dist/viem/Addresses.d.ts +1 -2
  88. package/dist/viem/Addresses.d.ts.map +1 -1
  89. package/dist/viem/Addresses.js +1 -2
  90. package/dist/viem/Addresses.js.map +1 -1
  91. package/dist/viem/Chain.d.ts +38 -12
  92. package/dist/viem/Chain.d.ts.map +1 -1
  93. package/dist/viem/Chain.js +27 -18
  94. package/dist/viem/Chain.js.map +1 -1
  95. package/dist/viem/Decorator.d.ts +1009 -428
  96. package/dist/viem/Decorator.d.ts.map +1 -1
  97. package/dist/viem/Decorator.js +17 -5
  98. package/dist/viem/Decorator.js.map +1 -1
  99. package/dist/viem/Formatters.d.ts +8 -1
  100. package/dist/viem/Formatters.d.ts.map +1 -1
  101. package/dist/viem/Formatters.js +17 -0
  102. package/dist/viem/Formatters.js.map +1 -1
  103. package/dist/viem/P256.d.ts +2 -0
  104. package/dist/viem/P256.d.ts.map +1 -0
  105. package/dist/viem/P256.js +2 -0
  106. package/dist/viem/P256.js.map +1 -0
  107. package/dist/viem/Secp256k1.d.ts +2 -0
  108. package/dist/viem/Secp256k1.d.ts.map +1 -0
  109. package/dist/viem/Secp256k1.js +2 -0
  110. package/dist/viem/Secp256k1.js.map +1 -0
  111. package/dist/viem/TokenIds.d.ts +1 -2
  112. package/dist/viem/TokenIds.d.ts.map +1 -1
  113. package/dist/viem/TokenIds.js +1 -2
  114. package/dist/viem/TokenIds.js.map +1 -1
  115. package/dist/viem/Transaction.d.ts +1 -1
  116. package/dist/viem/Transaction.d.ts.map +1 -1
  117. package/dist/viem/Transaction.js +46 -5
  118. package/dist/viem/Transaction.js.map +1 -1
  119. package/dist/viem/WebAuthnP256.d.ts +79 -0
  120. package/dist/viem/WebAuthnP256.d.ts.map +1 -0
  121. package/dist/viem/WebAuthnP256.js +95 -0
  122. package/dist/viem/WebAuthnP256.js.map +1 -0
  123. package/dist/viem/WebCryptoP256.d.ts +2 -0
  124. package/dist/viem/WebCryptoP256.d.ts.map +1 -0
  125. package/dist/viem/WebCryptoP256.js +2 -0
  126. package/dist/viem/WebCryptoP256.js.map +1 -0
  127. package/dist/viem/index.d.ts +6 -3
  128. package/dist/viem/index.d.ts.map +1 -1
  129. package/dist/viem/index.js +6 -3
  130. package/dist/viem/index.js.map +1 -1
  131. package/dist/viem/internal/account.d.ts +24 -0
  132. package/dist/viem/internal/account.d.ts.map +1 -0
  133. package/dist/viem/internal/account.js +68 -0
  134. package/dist/viem/internal/account.js.map +1 -0
  135. package/dist/viem/internal/types.d.ts +10 -0
  136. package/dist/viem/internal/types.d.ts.map +1 -1
  137. package/dist/wagmi/Actions/amm.d.ts +428 -0
  138. package/dist/wagmi/Actions/amm.d.ts.map +1 -0
  139. package/dist/wagmi/Actions/amm.js +472 -0
  140. package/dist/wagmi/Actions/amm.js.map +1 -0
  141. package/dist/wagmi/Actions/dex.d.ts +908 -0
  142. package/dist/wagmi/Actions/dex.d.ts.map +1 -0
  143. package/dist/wagmi/Actions/dex.js +1023 -0
  144. package/dist/wagmi/Actions/dex.js.map +1 -0
  145. package/dist/wagmi/Actions/faucet.d.ts +35 -0
  146. package/dist/wagmi/Actions/faucet.d.ts.map +1 -0
  147. package/dist/wagmi/Actions/faucet.js +33 -0
  148. package/dist/wagmi/Actions/faucet.js.map +1 -0
  149. package/dist/wagmi/Actions/fee.d.ts +111 -0
  150. package/dist/wagmi/Actions/fee.d.ts.map +1 -0
  151. package/dist/wagmi/Actions/fee.js +126 -0
  152. package/dist/wagmi/Actions/fee.js.map +1 -0
  153. package/dist/wagmi/Actions/index.d.ts +7 -0
  154. package/dist/wagmi/Actions/index.d.ts.map +1 -0
  155. package/dist/wagmi/Actions/index.js +7 -0
  156. package/dist/wagmi/Actions/index.js.map +1 -0
  157. package/dist/wagmi/Actions/reward.d.ts +348 -0
  158. package/dist/wagmi/Actions/reward.d.ts.map +1 -0
  159. package/dist/wagmi/Actions/reward.js +388 -0
  160. package/dist/wagmi/Actions/reward.js.map +1 -0
  161. package/dist/wagmi/Actions/token.d.ts +1546 -0
  162. package/dist/wagmi/Actions/token.d.ts.map +1 -0
  163. package/dist/wagmi/Actions/token.js +1712 -0
  164. package/dist/wagmi/Actions/token.js.map +1 -0
  165. package/dist/wagmi/Connector.d.ts +81 -0
  166. package/dist/wagmi/Connector.d.ts.map +1 -0
  167. package/dist/wagmi/Connector.js +261 -0
  168. package/dist/wagmi/Connector.js.map +1 -0
  169. package/dist/wagmi/Hooks/amm.d.ts +421 -0
  170. package/dist/wagmi/Hooks/amm.d.ts.map +1 -0
  171. package/dist/wagmi/Hooks/amm.js +504 -0
  172. package/dist/wagmi/Hooks/amm.js.map +1 -0
  173. package/dist/wagmi/Hooks/dex.d.ts +816 -0
  174. package/dist/wagmi/Hooks/dex.d.ts.map +1 -0
  175. package/dist/wagmi/Hooks/dex.js +973 -0
  176. package/dist/wagmi/Hooks/dex.js.map +1 -0
  177. package/dist/wagmi/Hooks/faucet.d.ts +39 -0
  178. package/dist/wagmi/Hooks/faucet.d.ts.map +1 -0
  179. package/dist/wagmi/Hooks/faucet.js +40 -0
  180. package/dist/wagmi/Hooks/faucet.js.map +1 -0
  181. package/dist/wagmi/Hooks/fee.d.ts +97 -0
  182. package/dist/wagmi/Hooks/fee.d.ts.map +1 -0
  183. package/dist/wagmi/Hooks/fee.js +109 -0
  184. package/dist/wagmi/Hooks/fee.js.map +1 -0
  185. package/dist/wagmi/Hooks/index.d.ts +7 -0
  186. package/dist/wagmi/Hooks/index.d.ts.map +1 -0
  187. package/dist/wagmi/Hooks/index.js +7 -0
  188. package/dist/wagmi/Hooks/index.js.map +1 -0
  189. package/dist/wagmi/Hooks/reward.d.ts +307 -0
  190. package/dist/wagmi/Hooks/reward.d.ts.map +1 -0
  191. package/dist/wagmi/Hooks/reward.js +349 -0
  192. package/dist/wagmi/Hooks/reward.js.map +1 -0
  193. package/dist/wagmi/Hooks/token.d.ts +1388 -0
  194. package/dist/wagmi/Hooks/token.d.ts.map +1 -0
  195. package/dist/wagmi/Hooks/token.js +1657 -0
  196. package/dist/wagmi/Hooks/token.js.map +1 -0
  197. package/dist/wagmi/index.d.ts +4 -0
  198. package/dist/wagmi/index.d.ts.map +1 -0
  199. package/dist/wagmi/index.js +4 -0
  200. package/dist/wagmi/index.js.map +1 -0
  201. package/package.json +54 -10
  202. package/src/chains.ts +21 -9
  203. package/src/ox/Order.test.ts +78 -0
  204. package/src/ox/Order.ts +125 -0
  205. package/src/ox/OrdersFilters.test.ts +182 -0
  206. package/src/ox/OrdersFilters.ts +125 -0
  207. package/src/ox/Pagination.test.ts +162 -0
  208. package/src/ox/Pagination.ts +164 -0
  209. package/src/ox/PoolId.test.ts +33 -0
  210. package/src/ox/PoolId.ts +27 -0
  211. package/src/ox/RpcSchema.ts +35 -0
  212. package/src/ox/SignatureEnvelope.ts +3 -1
  213. package/src/{viem → ox}/Tick.test.ts +1 -1
  214. package/src/{viem → ox}/Tick.ts +5 -0
  215. package/src/ox/Transaction.test.ts +1 -1
  216. package/src/ox/Transaction.ts +2 -1
  217. package/src/ox/TransactionEnvelopeAA.test.ts +239 -96
  218. package/src/ox/TransactionEnvelopeAA.ts +9 -7
  219. package/src/ox/TransactionRequest.ts +4 -0
  220. package/src/ox/index.ts +6 -0
  221. package/src/prool/Instance.ts +51 -37
  222. package/src/prool/internal/chain.json +104 -52
  223. package/src/tsconfig.json +9 -0
  224. package/src/viem/Abis.ts +972 -710
  225. package/src/viem/Account.ts +279 -0
  226. package/src/viem/Actions/__snapshots__/dex.test.ts.snap +850 -0
  227. package/src/viem/Actions/amm.test.ts +173 -169
  228. package/src/viem/Actions/amm.ts +131 -203
  229. package/src/viem/Actions/dex.test.ts +563 -484
  230. package/src/viem/Actions/dex.ts +203 -30
  231. package/src/viem/Actions/faucet.ts +50 -0
  232. package/src/viem/Actions/fee.test.ts +23 -34
  233. package/src/viem/Actions/fee.ts +20 -13
  234. package/src/viem/Actions/index.ts +2 -0
  235. package/src/viem/Actions/policy.test.ts +19 -33
  236. package/src/viem/Actions/policy.ts +46 -46
  237. package/src/viem/Actions/reward.test.ts +457 -0
  238. package/src/viem/Actions/reward.ts +999 -0
  239. package/src/viem/Actions/token.test.ts +453 -287
  240. package/src/viem/Actions/token.ts +605 -693
  241. package/src/viem/Addresses.ts +1 -2
  242. package/src/viem/Chain.bench-d.ts +12 -0
  243. package/src/viem/Chain.ts +70 -20
  244. package/src/viem/Decorator.bench-d.ts +1 -1
  245. package/src/viem/Decorator.test.ts +3 -1
  246. package/src/viem/Decorator.ts +1049 -442
  247. package/src/viem/Formatters.ts +31 -5
  248. package/src/viem/P256.ts +1 -0
  249. package/src/viem/Secp256k1.ts +1 -0
  250. package/src/viem/TokenIds.ts +1 -2
  251. package/src/viem/Transaction.ts +53 -7
  252. package/src/viem/WebAuthnP256.ts +140 -0
  253. package/src/viem/WebCryptoP256.ts +1 -0
  254. package/src/viem/e2e.test.ts +1126 -297
  255. package/src/viem/index.ts +6 -3
  256. package/src/viem/internal/account.ts +107 -0
  257. package/src/viem/internal/types.ts +9 -0
  258. package/src/wagmi/Actions/__snapshots__/dex.test.ts.snap +310 -0
  259. package/src/wagmi/Actions/amm.test.ts +198 -0
  260. package/src/wagmi/Actions/amm.ts +691 -0
  261. package/src/wagmi/Actions/dex.test.ts +1507 -0
  262. package/src/wagmi/Actions/dex.ts +1640 -0
  263. package/src/wagmi/Actions/faucet.ts +46 -0
  264. package/src/wagmi/Actions/fee.test.ts +63 -0
  265. package/src/wagmi/Actions/fee.ts +208 -0
  266. package/src/wagmi/Actions/index.ts +6 -0
  267. package/src/wagmi/Actions/reward.test.ts +210 -0
  268. package/src/wagmi/Actions/reward.ts +632 -0
  269. package/src/wagmi/Actions/token.test.ts +1308 -0
  270. package/src/wagmi/Actions/token.ts +2613 -0
  271. package/src/wagmi/Connector.test.ts +53 -0
  272. package/src/wagmi/Connector.ts +390 -0
  273. package/src/wagmi/Hooks/__snapshots__/dex.test.ts.snap +457 -0
  274. package/src/wagmi/Hooks/amm.test.ts +424 -0
  275. package/src/wagmi/Hooks/amm.ts +806 -0
  276. package/src/wagmi/Hooks/dex.test.ts +1017 -0
  277. package/src/wagmi/Hooks/dex.ts +1685 -0
  278. package/src/wagmi/Hooks/faucet.ts +76 -0
  279. package/src/wagmi/Hooks/fee.test.ts +166 -0
  280. package/src/wagmi/Hooks/fee.ts +206 -0
  281. package/src/wagmi/Hooks/index.ts +6 -0
  282. package/src/wagmi/Hooks/reward.test.ts +219 -0
  283. package/src/wagmi/Hooks/reward.ts +672 -0
  284. package/src/wagmi/Hooks/token.test.ts +1670 -0
  285. package/src/wagmi/Hooks/token.ts +2906 -0
  286. package/src/wagmi/index.ts +3 -0
  287. package/src/wagmi/internal/types.ts +16 -0
  288. package/dist/viem/Client.d.ts +0 -27
  289. package/dist/viem/Client.d.ts.map +0 -1
  290. package/dist/viem/Client.js +0 -28
  291. package/dist/viem/Client.js.map +0 -1
  292. package/dist/viem/Tick.d.ts.map +0 -1
  293. package/dist/viem/Tick.js.map +0 -1
  294. package/src/viem/Client.bench-d.ts +0 -8
  295. package/src/viem/Client.test.ts +0 -178
  296. package/src/viem/Client.ts +0 -91
  297. /package/dist/{viem → ox}/Tick.js +0 -0
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  type Account,
3
3
  type Address,
4
+ type BaseErrorType,
4
5
  type Chain,
5
6
  type Client,
6
7
  type ExtractAbiItem,
@@ -38,16 +39,16 @@ import { defineCall } from '../internal/utils.js'
38
39
  * ```ts
39
40
  * import { createClient, http } from 'viem'
40
41
  * import { tempo } from 'tempo.ts/chains'
41
- * import * as actions from 'tempo.ts/viem/actions'
42
+ * import { Actions } from 'tempo.ts/viem'
42
43
  * import { privateKeyToAccount } from 'viem/accounts'
43
44
  *
44
45
  * const client = createClient({
45
46
  * account: privateKeyToAccount('0x...'),
46
- * chain: tempo,
47
+ * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
47
48
  * transport: http(),
48
49
  * })
49
50
  *
50
- * const { address, id } = await actions.fee.getUserToken(client)
51
+ * const { address, id } = await Actions.fee.getUserToken(client)
51
52
  * ```
52
53
  *
53
54
  * @param client - Client.
@@ -115,16 +116,16 @@ export namespace getUserToken {
115
116
  * ```ts
116
117
  * import { createClient, http } from 'viem'
117
118
  * import { tempo } from 'tempo.ts/chains'
118
- * import * as actions from 'tempo.ts/viem/actions'
119
+ * import { Actions } from 'tempo.ts/viem'
119
120
  * import { privateKeyToAccount } from 'viem/accounts'
120
121
  *
121
122
  * const client = createClient({
122
123
  * account: privateKeyToAccount('0x...'),
123
- * chain: tempo,
124
+ * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
124
125
  * transport: http(),
125
126
  * })
126
127
  *
127
- * const hash = await actions.fee.setUserToken(client, {
128
+ * const hash = await Actions.fee.setUserToken(client, {
128
129
  * token: '0x...',
129
130
  * })
130
131
  * ```
@@ -156,6 +157,9 @@ export namespace setUserToken {
156
157
 
157
158
  export type ReturnValue = WriteContractReturnType
158
159
 
160
+ // TODO: exhaustive error type
161
+ export type ErrorType = BaseErrorType
162
+
159
163
  /** @internal */
160
164
  export async function inner<
161
165
  action extends typeof writeContract | typeof writeContractSync,
@@ -186,10 +190,10 @@ export namespace setUserToken {
186
190
  * ```ts
187
191
  * import { createClient, http, walletActions } from 'viem'
188
192
  * import { tempo } from 'tempo.ts/chains'
189
- * import * as actions from 'tempo.ts/viem/actions'
193
+ * import { Actions } from 'tempo.ts/viem'
190
194
  *
191
195
  * const client = createClient({
192
- * chain: tempo,
196
+ * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
193
197
  * transport: http(),
194
198
  * }).extend(walletActions)
195
199
  *
@@ -237,16 +241,16 @@ export namespace setUserToken {
237
241
  * ```ts
238
242
  * import { createClient, http } from 'viem'
239
243
  * import { tempo } from 'tempo.ts/chains'
240
- * import * as actions from 'tempo.ts/viem/actions'
244
+ * import { Actions } from 'tempo.ts/viem'
241
245
  * import { privateKeyToAccount } from 'viem/accounts'
242
246
  *
243
247
  * const client = createClient({
244
248
  * account: privateKeyToAccount('0x...'),
245
- * chain: tempo,
249
+ * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
246
250
  * transport: http(),
247
251
  * })
248
252
  *
249
- * const result = await actions.fee.setUserTokenSync(client, {
253
+ * const result = await Actions.fee.setUserTokenSync(client, {
250
254
  * token: '0x...',
251
255
  * })
252
256
  * ```
@@ -291,6 +295,9 @@ export namespace setUserTokenSync {
291
295
  receipt: TransactionReceipt
292
296
  }
293
297
  >
298
+
299
+ // TODO: exhaustive error type
300
+ export type ErrorType = BaseErrorType
294
301
  }
295
302
 
296
303
  /**
@@ -300,10 +307,10 @@ export namespace setUserTokenSync {
300
307
  * ```ts
301
308
  * import { createClient, http } from 'viem'
302
309
  * import { tempo } from 'tempo.ts/chains'
303
- * import * as actions from 'tempo.ts/viem/actions'
310
+ * import { Actions } from 'tempo.ts/viem'
304
311
  *
305
312
  * const client = createClient({
306
- * chain: tempo,
313
+ * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
307
314
  * transport: http(),
308
315
  * })
309
316
  *
@@ -1,5 +1,7 @@
1
1
  export * as amm from './amm.js'
2
2
  export * as dex from './dex.js'
3
+ export * as faucet from './faucet.js'
3
4
  export * as fee from './fee.js'
4
5
  export * as policy from './policy.js'
6
+ export * as reward from './reward.js'
5
7
  export * as token from './token.js'
@@ -1,28 +1,11 @@
1
1
  import { setTimeout } from 'node:timers/promises'
2
- import { publicActions } from 'viem'
3
- import { mnemonicToAccount } from 'viem/accounts'
4
- import { describe, expect, test } from 'vitest'
5
- import { tempoTest } from '../../../test/viem/config.js'
6
- import { createTempoClient } from '../Client.js'
2
+ import { beforeAll, describe, expect, test } from 'vitest'
3
+ import { accounts, client, rpcUrl } from '../../../test/viem/config.js'
7
4
  import * as actions from './index.js'
8
5
 
9
- const account = mnemonicToAccount(
10
- 'test test test test test test test test test test test junk',
11
- )
12
- const account2 = mnemonicToAccount(
13
- 'test test test test test test test test test test test junk',
14
- { accountIndex: 1 },
15
- )
16
- const account3 = mnemonicToAccount(
17
- 'test test test test test test test test test test test junk',
18
- { accountIndex: 2 },
19
- )
20
-
21
- const client = createTempoClient({
22
- account,
23
- chain: tempoTest,
24
- pollingInterval: 100,
25
- }).extend(publicActions)
6
+ const account = accounts[0]
7
+ const account2 = accounts[1]
8
+ const account3 = accounts[2]
26
9
 
27
10
  describe('create', () => {
28
11
  test('default', async () => {
@@ -58,7 +41,7 @@ describe('create', () => {
58
41
  expect(blacklistReceipt).toBeDefined()
59
42
  expect(blacklistResult).toMatchInlineSnapshot(`
60
43
  {
61
- "policyId": 2n,
44
+ "policyId": 3n,
62
45
  "policyType": 1,
63
46
  "updater": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
64
47
  }
@@ -120,7 +103,7 @@ describe('setAdmin', () => {
120
103
  expect(setAdminResult).toMatchInlineSnapshot(`
121
104
  {
122
105
  "admin": "0x8C8d35429F74ec245F8Ef2f4Fd1e551cFF97d650",
123
- "policyId": 2n,
106
+ "policyId": 4n,
124
107
  "updater": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
125
108
  }
126
109
  `)
@@ -163,7 +146,7 @@ describe('modifyWhitelist', () => {
163
146
  {
164
147
  "account": "0x8C8d35429F74ec245F8Ef2f4Fd1e551cFF97d650",
165
148
  "allowed": true,
166
- "policyId": 2n,
149
+ "policyId": 5n,
167
150
  "updater": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
168
151
  }
169
152
  `)
@@ -189,7 +172,7 @@ describe('modifyWhitelist', () => {
189
172
  {
190
173
  "account": "0x8C8d35429F74ec245F8Ef2f4Fd1e551cFF97d650",
191
174
  "allowed": false,
192
- "policyId": 2n,
175
+ "policyId": 5n,
193
176
  "updater": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
194
177
  }
195
178
  `)
@@ -232,7 +215,7 @@ describe('modifyBlacklist', () => {
232
215
  expect(addBlacklistResult).toMatchInlineSnapshot(`
233
216
  {
234
217
  "account": "0x8C8d35429F74ec245F8Ef2f4Fd1e551cFF97d650",
235
- "policyId": 2n,
218
+ "policyId": 6n,
236
219
  "restricted": true,
237
220
  "updater": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
238
221
  }
@@ -258,7 +241,7 @@ describe('modifyBlacklist', () => {
258
241
  expect(removeBlacklistResult).toMatchInlineSnapshot(`
259
242
  {
260
243
  "account": "0x8C8d35429F74ec245F8Ef2f4Fd1e551cFF97d650",
261
- "policyId": 2n,
244
+ "policyId": 6n,
262
245
  "restricted": false,
263
246
  "updater": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
264
247
  }
@@ -397,13 +380,17 @@ describe('watchCreate', () => {
397
380
  unwatch()
398
381
 
399
382
  expect(logs.length).toBe(1)
400
- expect(logs[0].args.policyId).toBe(2n)
383
+ expect(logs[0].args.policyId).toBeDefined()
401
384
  expect(logs[0].args.updater).toBe(account.address)
402
385
  expect(logs[0].args.type).toBe('whitelist')
403
386
  })
404
387
  })
405
388
 
406
389
  describe('watchAdminUpdated', () => {
390
+ beforeAll(async () => {
391
+ await fetch(`${rpcUrl}/restart`)
392
+ })
393
+
407
394
  test('default', async () => {
408
395
  // create policy
409
396
  const { policyId } = await actions.policy.createSync(client, {
@@ -426,8 +413,7 @@ describe('watchAdminUpdated', () => {
426
413
  await setTimeout(500)
427
414
  unwatch()
428
415
 
429
- expect(logs.length).toBe(1)
430
- expect(logs[0].args.policyId).toBe(2n)
416
+ expect(logs[0].args.policyId).toBeDefined()
431
417
  expect(logs[0].args.updater).toBe(account.address)
432
418
  expect(logs[0].args.admin).toBe(account2.address)
433
419
  })
@@ -465,7 +451,7 @@ describe('watchWhitelistUpdated', () => {
465
451
  unwatch()
466
452
 
467
453
  expect(logs.length).toBe(2)
468
- expect(logs[0].args.policyId).toBe(2n)
454
+ expect(logs[0].args.policyId).toBeDefined()
469
455
  expect(logs[0].args.updater).toBe(account.address)
470
456
  expect(logs[0].args.account).toBe(account2.address)
471
457
  expect(logs[0].args.allowed).toBe(true)
@@ -505,7 +491,7 @@ describe('watchBlacklistUpdated', () => {
505
491
  unwatch()
506
492
 
507
493
  expect(logs.length).toBe(2)
508
- expect(logs[0].args.policyId).toBe(2n)
494
+ expect(logs[0].args.policyId).toBeDefined()
509
495
  expect(logs[0].args.updater).toBe(account.address)
510
496
  expect(logs[0].args.account).toBe(account2.address)
511
497
  expect(logs[0].args.restricted).toBe(true)
@@ -41,16 +41,16 @@ const policyTypeMap = {
41
41
  * ```ts
42
42
  * import { createClient, http } from 'viem'
43
43
  * import { tempo } from 'tempo.ts/chains'
44
- * import * as actions from 'tempo.ts/viem/actions'
44
+ * import { Actions } from 'tempo.ts/viem'
45
45
  * import { privateKeyToAccount } from 'viem/accounts'
46
46
  *
47
47
  * const client = createClient({
48
48
  * account: privateKeyToAccount('0x...'),
49
- * chain: tempo,
49
+ * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
50
50
  * transport: http(),
51
51
  * })
52
52
  *
53
- * const { hash, policyId } = await actions.policy.create(client, {
53
+ * const { hash, policyId } = await Actions.policy.create(client, {
54
54
  * admin: '0x...',
55
55
  * type: 'whitelist',
56
56
  * })
@@ -134,10 +134,10 @@ export namespace create {
134
134
  * ```ts
135
135
  * import { createClient, http, walletActions } from 'viem'
136
136
  * import { tempo } from 'tempo.ts/chains'
137
- * import * as actions from 'tempo.ts/viem/actions'
137
+ * import { Actions } from 'tempo.ts/viem'
138
138
  *
139
139
  * const client = createClient({
140
- * chain: tempo,
140
+ * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
141
141
  * transport: http(),
142
142
  * }).extend(walletActions)
143
143
  *
@@ -204,16 +204,16 @@ export namespace create {
204
204
  * ```ts
205
205
  * import { createClient, http } from 'viem'
206
206
  * import { tempo } from 'tempo.ts/chains'
207
- * import * as actions from 'tempo.ts/viem/actions'
207
+ * import { Actions } from 'tempo.ts/viem'
208
208
  * import { privateKeyToAccount } from 'viem/accounts'
209
209
  *
210
210
  * const client = createClient({
211
211
  * account: privateKeyToAccount('0x...'),
212
- * chain: tempo,
212
+ * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
213
213
  * transport: http(),
214
214
  * })
215
215
  *
216
- * const result = await actions.policy.createSync(client, {
216
+ * const result = await Actions.policy.createSync(client, {
217
217
  * admin: '0x...',
218
218
  * type: 'whitelist',
219
219
  * })
@@ -268,16 +268,16 @@ export namespace createSync {
268
268
  * ```ts
269
269
  * import { createClient, http } from 'viem'
270
270
  * import { tempo } from 'tempo.ts/chains'
271
- * import * as actions from 'tempo.ts/viem/actions'
271
+ * import { Actions } from 'tempo.ts/viem'
272
272
  * import { privateKeyToAccount } from 'viem/accounts'
273
273
  *
274
274
  * const client = createClient({
275
275
  * account: privateKeyToAccount('0x...'),
276
- * chain: tempo,
276
+ * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
277
277
  * transport: http(),
278
278
  * })
279
279
  *
280
- * const hash = await actions.policy.setAdmin(client, {
280
+ * const hash = await Actions.policy.setAdmin(client, {
281
281
  * policyId: 2n,
282
282
  * admin: '0x...',
283
283
  * })
@@ -342,10 +342,10 @@ export namespace setAdmin {
342
342
  * ```ts
343
343
  * import { createClient, http, walletActions } from 'viem'
344
344
  * import { tempo } from 'tempo.ts/chains'
345
- * import * as actions from 'tempo.ts/viem/actions'
345
+ * import { Actions } from 'tempo.ts/viem'
346
346
  *
347
347
  * const client = createClient({
348
- * chain: tempo,
348
+ * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
349
349
  * transport: http(),
350
350
  * }).extend(walletActions)
351
351
  *
@@ -401,16 +401,16 @@ export namespace setAdmin {
401
401
  * ```ts
402
402
  * import { createClient, http } from 'viem'
403
403
  * import { tempo } from 'tempo.ts/chains'
404
- * import * as actions from 'tempo.ts/viem/actions'
404
+ * import { Actions } from 'tempo.ts/viem'
405
405
  * import { privateKeyToAccount } from 'viem/accounts'
406
406
  *
407
407
  * const client = createClient({
408
408
  * account: privateKeyToAccount('0x...'),
409
- * chain: tempo,
409
+ * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
410
410
  * transport: http(),
411
411
  * })
412
412
  *
413
- * const result = await actions.policy.setAdminSync(client, {
413
+ * const result = await Actions.policy.setAdminSync(client, {
414
414
  * policyId: 2n,
415
415
  * admin: '0x...',
416
416
  * })
@@ -465,16 +465,16 @@ export namespace setAdminSync {
465
465
  * ```ts
466
466
  * import { createClient, http } from 'viem'
467
467
  * import { tempo } from 'tempo.ts/chains'
468
- * import * as actions from 'tempo.ts/viem/actions'
468
+ * import { Actions } from 'tempo.ts/viem'
469
469
  * import { privateKeyToAccount } from 'viem/accounts'
470
470
  *
471
471
  * const client = createClient({
472
472
  * account: privateKeyToAccount('0x...'),
473
- * chain: tempo,
473
+ * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
474
474
  * transport: http(),
475
475
  * })
476
476
  *
477
- * const hash = await actions.policy.modifyWhitelist(client, {
477
+ * const hash = await Actions.policy.modifyWhitelist(client, {
478
478
  * policyId: 2n,
479
479
  * account: '0x...',
480
480
  * allowed: true,
@@ -546,10 +546,10 @@ export namespace modifyWhitelist {
546
546
  * ```ts
547
547
  * import { createClient, http, walletActions } from 'viem'
548
548
  * import { tempo } from 'tempo.ts/chains'
549
- * import * as actions from 'tempo.ts/viem/actions'
549
+ * import { Actions } from 'tempo.ts/viem'
550
550
  *
551
551
  * const client = createClient({
552
- * chain: tempo,
552
+ * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
553
553
  * transport: http(),
554
554
  * }).extend(walletActions)
555
555
  *
@@ -607,16 +607,16 @@ export namespace modifyWhitelist {
607
607
  * ```ts
608
608
  * import { createClient, http } from 'viem'
609
609
  * import { tempo } from 'tempo.ts/chains'
610
- * import * as actions from 'tempo.ts/viem/actions'
610
+ * import { Actions } from 'tempo.ts/viem'
611
611
  * import { privateKeyToAccount } from 'viem/accounts'
612
612
  *
613
613
  * const client = createClient({
614
614
  * account: privateKeyToAccount('0x...'),
615
- * chain: tempo,
615
+ * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
616
616
  * transport: http(),
617
617
  * })
618
618
  *
619
- * const result = await actions.policy.modifyWhitelistSync(client, {
619
+ * const result = await Actions.policy.modifyWhitelistSync(client, {
620
620
  * policyId: 2n,
621
621
  * account: '0x...',
622
622
  * allowed: true,
@@ -672,16 +672,16 @@ export namespace modifyWhitelistSync {
672
672
  * ```ts
673
673
  * import { createClient, http } from 'viem'
674
674
  * import { tempo } from 'tempo.ts/chains'
675
- * import * as actions from 'tempo.ts/viem/actions'
675
+ * import { Actions } from 'tempo.ts/viem'
676
676
  * import { privateKeyToAccount } from 'viem/accounts'
677
677
  *
678
678
  * const client = createClient({
679
679
  * account: privateKeyToAccount('0x...'),
680
- * chain: tempo,
680
+ * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
681
681
  * transport: http(),
682
682
  * })
683
683
  *
684
- * const hash = await actions.policy.modifyBlacklist(client, {
684
+ * const hash = await Actions.policy.modifyBlacklist(client, {
685
685
  * policyId: 2n,
686
686
  * account: '0x...',
687
687
  * restricted: true,
@@ -753,10 +753,10 @@ export namespace modifyBlacklist {
753
753
  * ```ts
754
754
  * import { createClient, http, walletActions } from 'viem'
755
755
  * import { tempo } from 'tempo.ts/chains'
756
- * import * as actions from 'tempo.ts/viem/actions'
756
+ * import { Actions } from 'tempo.ts/viem'
757
757
  *
758
758
  * const client = createClient({
759
- * chain: tempo,
759
+ * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
760
760
  * transport: http(),
761
761
  * }).extend(walletActions)
762
762
  *
@@ -814,16 +814,16 @@ export namespace modifyBlacklist {
814
814
  * ```ts
815
815
  * import { createClient, http } from 'viem'
816
816
  * import { tempo } from 'tempo.ts/chains'
817
- * import * as actions from 'tempo.ts/viem/actions'
817
+ * import { Actions } from 'tempo.ts/viem'
818
818
  * import { privateKeyToAccount } from 'viem/accounts'
819
819
  *
820
820
  * const client = createClient({
821
821
  * account: privateKeyToAccount('0x...'),
822
- * chain: tempo,
822
+ * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
823
823
  * transport: http(),
824
824
  * })
825
825
  *
826
- * const result = await actions.policy.modifyBlacklistSync(client, {
826
+ * const result = await Actions.policy.modifyBlacklistSync(client, {
827
827
  * policyId: 2n,
828
828
  * account: '0x...',
829
829
  * restricted: true,
@@ -879,14 +879,14 @@ export namespace modifyBlacklistSync {
879
879
  * ```ts
880
880
  * import { createClient, http } from 'viem'
881
881
  * import { tempo } from 'tempo.ts/chains'
882
- * import * as actions from 'tempo.ts/viem/actions'
882
+ * import { Actions } from 'tempo.ts/viem'
883
883
  *
884
884
  * const client = createClient({
885
- * chain: tempo,
885
+ * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
886
886
  * transport: http(),
887
887
  * })
888
888
  *
889
- * const data = await actions.policy.getData(client, {
889
+ * const data = await Actions.policy.getData(client, {
890
890
  * policyId: 2n,
891
891
  * })
892
892
  * ```
@@ -949,14 +949,14 @@ export namespace getData {
949
949
  * ```ts
950
950
  * import { createClient, http } from 'viem'
951
951
  * import { tempo } from 'tempo.ts/chains'
952
- * import * as actions from 'tempo.ts/viem/actions'
952
+ * import { Actions } from 'tempo.ts/viem'
953
953
  *
954
954
  * const client = createClient({
955
- * chain: tempo,
955
+ * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
956
956
  * transport: http(),
957
957
  * })
958
958
  *
959
- * const authorized = await actions.policy.isAuthorized(client, {
959
+ * const authorized = await Actions.policy.isAuthorized(client, {
960
960
  * policyId: 2n,
961
961
  * user: '0x...',
962
962
  * })
@@ -1017,10 +1017,10 @@ export namespace isAuthorized {
1017
1017
  * ```ts
1018
1018
  * import { createClient, http } from 'viem'
1019
1019
  * import { tempo } from 'tempo.ts/chains'
1020
- * import * as actions from 'tempo.ts/viem/actions'
1020
+ * import { Actions } from 'tempo.ts/viem'
1021
1021
  *
1022
1022
  * const client = createClient({
1023
- * chain: tempo,
1023
+ * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
1024
1024
  * transport: http(),
1025
1025
  * })
1026
1026
  *
@@ -1097,10 +1097,10 @@ export declare namespace watchCreate {
1097
1097
  * ```ts
1098
1098
  * import { createClient, http } from 'viem'
1099
1099
  * import { tempo } from 'tempo.ts/chains'
1100
- * import * as actions from 'tempo.ts/viem/actions'
1100
+ * import { Actions } from 'tempo.ts/viem'
1101
1101
  *
1102
1102
  * const client = createClient({
1103
- * chain: tempo,
1103
+ * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
1104
1104
  * transport: http(),
1105
1105
  * })
1106
1106
  *
@@ -1170,10 +1170,10 @@ export declare namespace watchAdminUpdated {
1170
1170
  * ```ts
1171
1171
  * import { createClient, http } from 'viem'
1172
1172
  * import { tempo } from 'tempo.ts/chains'
1173
- * import * as actions from 'tempo.ts/viem/actions'
1173
+ * import { Actions } from 'tempo.ts/viem'
1174
1174
  *
1175
1175
  * const client = createClient({
1176
- * chain: tempo,
1176
+ * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
1177
1177
  * transport: http(),
1178
1178
  * })
1179
1179
  *
@@ -1243,10 +1243,10 @@ export declare namespace watchWhitelistUpdated {
1243
1243
  * ```ts
1244
1244
  * import { createClient, http } from 'viem'
1245
1245
  * import { tempo } from 'tempo.ts/chains'
1246
- * import * as actions from 'tempo.ts/viem/actions'
1246
+ * import { Actions } from 'tempo.ts/viem'
1247
1247
  *
1248
1248
  * const client = createClient({
1249
- * chain: tempo,
1249
+ * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
1250
1250
  * transport: http(),
1251
1251
  * })
1252
1252
  *