tempo.ts 0.0.5 → 0.1.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 (195) hide show
  1. package/dist/chains.d.ts +244 -541
  2. package/dist/chains.d.ts.map +1 -1
  3. package/dist/chains.js +10 -23
  4. package/dist/chains.js.map +1 -1
  5. package/dist/index.js.map +1 -1
  6. package/dist/ox/SignatureEnvelope.d.ts +245 -0
  7. package/dist/ox/SignatureEnvelope.d.ts.map +1 -0
  8. package/dist/ox/SignatureEnvelope.js +437 -0
  9. package/dist/ox/SignatureEnvelope.js.map +1 -0
  10. package/dist/ox/Transaction.d.ts +61 -24
  11. package/dist/ox/Transaction.d.ts.map +1 -1
  12. package/dist/ox/Transaction.js +63 -18
  13. package/dist/ox/Transaction.js.map +1 -1
  14. package/dist/ox/TransactionEnvelopeAA.d.ts +461 -0
  15. package/dist/ox/TransactionEnvelopeAA.d.ts.map +1 -0
  16. package/dist/ox/TransactionEnvelopeAA.js +528 -0
  17. package/dist/ox/TransactionEnvelopeAA.js.map +1 -0
  18. package/dist/ox/TransactionRequest.d.ts +7 -5
  19. package/dist/ox/TransactionRequest.d.ts.map +1 -1
  20. package/dist/ox/TransactionRequest.js +21 -12
  21. package/dist/ox/TransactionRequest.js.map +1 -1
  22. package/dist/ox/index.d.ts +5 -4
  23. package/dist/ox/index.d.ts.map +1 -1
  24. package/dist/ox/index.js +5 -4
  25. package/dist/ox/index.js.map +1 -1
  26. package/dist/prool/Instance.d.ts +0 -4
  27. package/dist/prool/Instance.d.ts.map +1 -1
  28. package/dist/prool/Instance.js +7 -7
  29. package/dist/prool/Instance.js.map +1 -1
  30. package/dist/prool/index.d.ts +1 -1
  31. package/dist/prool/index.d.ts.map +1 -1
  32. package/dist/prool/index.js +1 -1
  33. package/dist/prool/index.js.map +1 -1
  34. package/dist/viem/{abis.d.ts → Abis.d.ts} +523 -9
  35. package/dist/viem/Abis.d.ts.map +1 -0
  36. package/dist/viem/{abis.js → Abis.js} +321 -9
  37. package/dist/viem/Abis.js.map +1 -0
  38. package/dist/viem/{actions → Actions}/amm.d.ts +21 -21
  39. package/dist/viem/Actions/amm.d.ts.map +1 -0
  40. package/dist/viem/{actions → Actions}/amm.js +55 -43
  41. package/dist/viem/Actions/amm.js.map +1 -0
  42. package/dist/viem/Actions/dex.d.ts +3263 -0
  43. package/dist/viem/Actions/dex.d.ts.map +1 -0
  44. package/dist/viem/Actions/dex.js +1357 -0
  45. package/dist/viem/Actions/dex.js.map +1 -0
  46. package/dist/viem/{actions → Actions}/fee.d.ts +8 -8
  47. package/dist/viem/Actions/fee.d.ts.map +1 -0
  48. package/dist/viem/{actions → Actions}/fee.js +14 -13
  49. package/dist/viem/Actions/fee.js.map +1 -0
  50. package/dist/viem/Actions/index.d.ts +6 -0
  51. package/dist/viem/Actions/index.d.ts.map +1 -0
  52. package/dist/viem/Actions/index.js +6 -0
  53. package/dist/viem/Actions/index.js.map +1 -0
  54. package/dist/viem/{actions → Actions}/policy.d.ts +19 -19
  55. package/dist/viem/Actions/policy.d.ts.map +1 -0
  56. package/dist/viem/{actions → Actions}/policy.js +59 -46
  57. package/dist/viem/Actions/policy.js.map +1 -0
  58. package/dist/viem/{actions → Actions}/token.d.ts +3251 -707
  59. package/dist/viem/Actions/token.d.ts.map +1 -0
  60. package/dist/viem/{actions → Actions}/token.js +420 -88
  61. package/dist/viem/Actions/token.js.map +1 -0
  62. package/dist/viem/Addresses.d.ts +9 -0
  63. package/dist/viem/Addresses.d.ts.map +1 -0
  64. package/dist/viem/Addresses.js +9 -0
  65. package/dist/viem/Addresses.js.map +1 -0
  66. package/dist/viem/{chain.d.ts → Chain.d.ts} +81 -57
  67. package/dist/viem/Chain.d.ts.map +1 -0
  68. package/dist/viem/{chain.js → Chain.js} +7 -7
  69. package/dist/viem/Chain.js.map +1 -0
  70. package/dist/viem/{client.d.ts → Client.d.ts} +4 -4
  71. package/dist/viem/Client.d.ts.map +1 -0
  72. package/dist/viem/{client.js → Client.js} +3 -3
  73. package/dist/viem/Client.js.map +1 -0
  74. package/dist/viem/{decorator.d.ts → Decorator.d.ts} +507 -5
  75. package/dist/viem/Decorator.d.ts.map +1 -0
  76. package/dist/viem/{decorator.js → Decorator.js} +31 -5
  77. package/dist/viem/Decorator.js.map +1 -0
  78. package/dist/viem/{formatters.d.ts → Formatters.d.ts} +2 -2
  79. package/dist/viem/Formatters.d.ts.map +1 -0
  80. package/dist/viem/{formatters.js → Formatters.js} +24 -17
  81. package/dist/viem/Formatters.js.map +1 -0
  82. package/dist/viem/Tick.d.ts +111 -0
  83. package/dist/viem/Tick.d.ts.map +1 -0
  84. package/dist/viem/Tick.js +127 -0
  85. package/dist/viem/Tick.js.map +1 -0
  86. package/dist/viem/TokenIds.d.ts +3 -0
  87. package/dist/viem/TokenIds.d.ts.map +1 -0
  88. package/dist/viem/TokenIds.js +3 -0
  89. package/dist/viem/TokenIds.js.map +1 -0
  90. package/dist/viem/Transaction.d.ts +57 -0
  91. package/dist/viem/Transaction.d.ts.map +1 -0
  92. package/dist/viem/Transaction.js +137 -0
  93. package/dist/viem/Transaction.js.map +1 -0
  94. package/dist/viem/{transport.d.ts → Transport.d.ts} +3 -3
  95. package/dist/viem/Transport.d.ts.map +1 -0
  96. package/dist/viem/{transport.js → Transport.js} +3 -3
  97. package/dist/viem/Transport.js.map +1 -0
  98. package/dist/viem/index.d.ts +13 -9
  99. package/dist/viem/index.d.ts.map +1 -1
  100. package/dist/viem/index.js +13 -9
  101. package/dist/viem/index.js.map +1 -1
  102. package/dist/viem/{types.d.ts → internal/types.d.ts} +3 -3
  103. package/dist/viem/internal/types.d.ts.map +1 -0
  104. package/dist/viem/{types.js.map → internal/types.js.map} +1 -1
  105. package/dist/viem/internal/utils.d.ts.map +1 -0
  106. package/dist/viem/internal/utils.js.map +1 -0
  107. package/package.json +87 -101
  108. package/src/chains.ts +10 -24
  109. package/src/ox/SignatureEnvelope.test.ts +1252 -0
  110. package/src/ox/SignatureEnvelope.ts +709 -0
  111. package/src/ox/Transaction.test.ts +144 -89
  112. package/src/ox/Transaction.ts +104 -29
  113. package/src/ox/TransactionEnvelopeAA.test.ts +1533 -0
  114. package/src/ox/TransactionEnvelopeAA.ts +858 -0
  115. package/src/ox/TransactionRequest.ts +25 -17
  116. package/src/ox/index.ts +2 -1
  117. package/src/prool/Instance.ts +6 -14
  118. package/src/prool/internal/chain.json +101 -27
  119. package/src/viem/{abis.ts → Abis.ts} +322 -8
  120. package/src/viem/{actions → Actions}/amm.test.ts +65 -68
  121. package/src/viem/{actions → Actions}/amm.ts +72 -60
  122. package/src/viem/Actions/dex.test.ts +1608 -0
  123. package/src/viem/Actions/dex.ts +2026 -0
  124. package/src/viem/{actions → Actions}/fee.test.ts +34 -36
  125. package/src/viem/{actions → Actions}/fee.ts +18 -17
  126. package/src/viem/{actions → Actions}/index.ts +1 -0
  127. package/src/viem/{actions → Actions}/policy.test.ts +2 -2
  128. package/src/viem/{actions → Actions}/policy.ts +77 -64
  129. package/src/viem/{actions → Actions}/token.test.ts +406 -67
  130. package/src/viem/{actions → Actions}/token.ts +675 -144
  131. package/src/viem/Addresses.ts +9 -0
  132. package/src/viem/{chain.ts → Chain.ts} +6 -6
  133. package/src/viem/{client.bench-d.ts → Client.bench-d.ts} +2 -2
  134. package/src/viem/{client.test.ts → Client.test.ts} +31 -6
  135. package/src/viem/{client.ts → Client.ts} +1 -1
  136. package/src/viem/{decorator.bench-d.ts → Decorator.bench-d.ts} +2 -2
  137. package/src/viem/{decorator.test.ts → Decorator.test.ts} +1 -0
  138. package/src/viem/{decorator.ts → Decorator.ts} +586 -4
  139. package/src/viem/{formatters.ts → Formatters.ts} +31 -20
  140. package/src/viem/Tick.test.ts +281 -0
  141. package/src/viem/Tick.ts +176 -0
  142. package/src/viem/TokenIds.ts +2 -0
  143. package/src/viem/Transaction.ts +303 -0
  144. package/src/viem/{transport.ts → Transport.ts} +5 -5
  145. package/src/viem/e2e.test.ts +153 -78
  146. package/src/viem/index.ts +13 -9
  147. package/src/viem/{types.ts → internal/types.ts} +3 -3
  148. package/dist/ox/TransactionEnvelopeFeeToken.d.ts +0 -393
  149. package/dist/ox/TransactionEnvelopeFeeToken.d.ts.map +0 -1
  150. package/dist/ox/TransactionEnvelopeFeeToken.js +0 -452
  151. package/dist/ox/TransactionEnvelopeFeeToken.js.map +0 -1
  152. package/dist/viem/abis.d.ts.map +0 -1
  153. package/dist/viem/abis.js.map +0 -1
  154. package/dist/viem/actions/amm.d.ts.map +0 -1
  155. package/dist/viem/actions/amm.js.map +0 -1
  156. package/dist/viem/actions/fee.d.ts.map +0 -1
  157. package/dist/viem/actions/fee.js.map +0 -1
  158. package/dist/viem/actions/index.d.ts +0 -5
  159. package/dist/viem/actions/index.d.ts.map +0 -1
  160. package/dist/viem/actions/index.js +0 -5
  161. package/dist/viem/actions/index.js.map +0 -1
  162. package/dist/viem/actions/policy.d.ts.map +0 -1
  163. package/dist/viem/actions/policy.js.map +0 -1
  164. package/dist/viem/actions/token.d.ts.map +0 -1
  165. package/dist/viem/actions/token.js.map +0 -1
  166. package/dist/viem/addresses.d.ts +0 -8
  167. package/dist/viem/addresses.d.ts.map +0 -1
  168. package/dist/viem/addresses.js +0 -8
  169. package/dist/viem/addresses.js.map +0 -1
  170. package/dist/viem/chain.d.ts.map +0 -1
  171. package/dist/viem/chain.js.map +0 -1
  172. package/dist/viem/client.d.ts.map +0 -1
  173. package/dist/viem/client.js.map +0 -1
  174. package/dist/viem/decorator.d.ts.map +0 -1
  175. package/dist/viem/decorator.js.map +0 -1
  176. package/dist/viem/formatters.d.ts.map +0 -1
  177. package/dist/viem/formatters.js.map +0 -1
  178. package/dist/viem/transaction.d.ts +0 -54
  179. package/dist/viem/transaction.d.ts.map +0 -1
  180. package/dist/viem/transaction.js +0 -108
  181. package/dist/viem/transaction.js.map +0 -1
  182. package/dist/viem/transport.d.ts.map +0 -1
  183. package/dist/viem/transport.js.map +0 -1
  184. package/dist/viem/types.d.ts.map +0 -1
  185. package/dist/viem/utils.d.ts.map +0 -1
  186. package/dist/viem/utils.js.map +0 -1
  187. package/src/ox/TransactionEnvelopeFeeToken.test.ts +0 -1119
  188. package/src/ox/TransactionEnvelopeFeeToken.ts +0 -717
  189. package/src/prool/internal/consensus.toml +0 -32
  190. package/src/viem/addresses.ts +0 -10
  191. package/src/viem/transaction.ts +0 -253
  192. /package/dist/viem/{types.js → internal/types.js} +0 -0
  193. /package/dist/viem/{utils.d.ts → internal/utils.d.ts} +0 -0
  194. /package/dist/viem/{utils.js → internal/utils.js} +0 -0
  195. /package/src/viem/{utils.ts → internal/utils.ts} +0 -0
@@ -14,7 +14,6 @@ import {
14
14
  type SendTransactionSyncParameters,
15
15
  type TransactionReceipt,
16
16
  type Transport,
17
- type ValueOf,
18
17
  type Log as viem_Log,
19
18
  type WatchContractEventParameters,
20
19
  type WriteContractReturnType,
@@ -29,23 +28,17 @@ import {
29
28
  writeContract,
30
29
  writeContractSync,
31
30
  } from 'viem/actions'
32
- import type { Compute, UnionOmit } from '../../internal/types.js'
31
+ import type { Compute, OneOf, UnionOmit } from '../../internal/types.js'
33
32
  import * as TokenId from '../../ox/TokenId.js'
34
33
  import * as TokenRole from '../../ox/TokenRole.js'
35
- import { tip20Abi, tip20FactoryAbi } from '../abis.js'
36
- import { tip20FactoryAddress, usdAddress } from '../addresses.js'
34
+ import * as Abis from '../Abis.js'
35
+ import * as Addresses from '../Addresses.js'
37
36
  import type {
38
37
  GetAccountParameter,
39
38
  ReadParameters,
40
39
  WriteParameters,
41
- } from '../types.js'
42
- import { defineCall } from '../utils.js'
43
-
44
- const transferPolicy = {
45
- 0: 'always-reject',
46
- 1: 'always-allow',
47
- } as const
48
- type TransferPolicy = ValueOf<typeof transferPolicy>
40
+ } from '../internal/types.js'
41
+ import { defineCall } from '../internal/utils.js'
49
42
 
50
43
  /**
51
44
  * Approves a spender to transfer TIP20 tokens on behalf of the caller.
@@ -80,7 +73,7 @@ export async function approve<
80
73
  client: Client<Transport, chain, account>,
81
74
  parameters: approve.Parameters<chain, account>,
82
75
  ): Promise<approve.ReturnValue> {
83
- const { token = usdAddress, ...rest } = parameters
76
+ const { token = Addresses.defaultFeeToken, ...rest } = parameters
84
77
  return approve.inner(writeContract, client, parameters, { ...rest, token })
85
78
  }
86
79
 
@@ -95,7 +88,7 @@ export namespace approve {
95
88
  amount: bigint
96
89
  /** Address of the spender. */
97
90
  spender: Address
98
- /** Address or ID of the TIP20 token. @default `usdAddress` */
91
+ /** Address or ID of the TIP20 token. @default `Addresses.defaultFeeToken` */
99
92
  token?: TokenId.TokenIdOrAddress | undefined
100
93
  }
101
94
 
@@ -153,10 +146,10 @@ export namespace approve {
153
146
  * @returns The call.
154
147
  */
155
148
  export function call(args: Args) {
156
- const { spender, amount, token = usdAddress } = args
149
+ const { spender, amount, token = Addresses.defaultFeeToken } = args
157
150
  return defineCall({
158
151
  address: TokenId.toAddress(token),
159
- abi: tip20Abi,
152
+ abi: Abis.tip20,
160
153
  functionName: 'approve',
161
154
  args: [spender, amount],
162
155
  })
@@ -164,7 +157,7 @@ export namespace approve {
164
157
 
165
158
  export function extractEvent(logs: Log[]) {
166
159
  const [log] = parseEventLogs({
167
- abi: tip20Abi,
160
+ abi: Abis.tip20,
168
161
  logs,
169
162
  eventName: 'Approval',
170
163
  })
@@ -208,7 +201,7 @@ export async function approveSync<
208
201
  ): Promise<approveSync.ReturnValue> {
209
202
  const {
210
203
  throwOnReceiptRevert = true,
211
- token = usdAddress,
204
+ token = Addresses.defaultFeeToken,
212
205
  ...rest
213
206
  } = parameters
214
207
  const receipt = await approve.inner(
@@ -237,7 +230,7 @@ export namespace approveSync {
237
230
 
238
231
  export type ReturnValue = Compute<
239
232
  GetEventArgs<
240
- typeof tip20Abi,
233
+ typeof Abis.tip20,
241
234
  'Approval',
242
235
  {
243
236
  IndexedOnly: false
@@ -314,9 +307,10 @@ export namespace burnBlocked {
314
307
  client: Client<Transport, chain, account>,
315
308
  parameters: burnBlocked.Parameters<chain, account>,
316
309
  ): Promise<ReturnType<action>> {
317
- const call = burnBlocked.call(parameters)
310
+ const { amount, from, token, ...rest } = parameters
311
+ const call = burnBlocked.call({ amount, from, token })
318
312
  return (await action(client, {
319
- ...parameters,
313
+ ...rest,
320
314
  ...call,
321
315
  } as never)) as never
322
316
  }
@@ -358,7 +352,7 @@ export namespace burnBlocked {
358
352
  const { from, amount, token } = args
359
353
  return defineCall({
360
354
  address: TokenId.toAddress(token),
361
- abi: tip20Abi,
355
+ abi: Abis.tip20,
362
356
  functionName: 'burnBlocked',
363
357
  args: [from, amount],
364
358
  })
@@ -372,7 +366,7 @@ export namespace burnBlocked {
372
366
  */
373
367
  export function extractEvent(logs: Log[]) {
374
368
  const [log] = parseEventLogs({
375
- abi: tip20Abi,
369
+ abi: Abis.tip20,
376
370
  logs,
377
371
  eventName: 'BurnBlocked',
378
372
  })
@@ -437,7 +431,7 @@ export namespace burnBlockedSync {
437
431
 
438
432
  export type ReturnValue = Compute<
439
433
  GetEventArgs<
440
- typeof tip20Abi,
434
+ typeof Abis.tip20,
441
435
  'BurnBlocked',
442
436
  {
443
437
  IndexedOnly: false
@@ -513,9 +507,10 @@ export namespace burn {
513
507
  client: Client<Transport, chain, account>,
514
508
  parameters: burn.Parameters<chain, account>,
515
509
  ): Promise<ReturnType<action>> {
516
- const call = burn.call(parameters)
510
+ const { amount, memo, token, ...rest } = parameters
511
+ const call = burn.call({ amount, memo, token })
517
512
  return (await action(client, {
518
- ...parameters,
513
+ ...rest,
519
514
  ...call,
520
515
  } as never)) as never
521
516
  }
@@ -565,7 +560,7 @@ export namespace burn {
565
560
  } as const)
566
561
  return defineCall({
567
562
  address: TokenId.toAddress(token),
568
- abi: tip20Abi,
563
+ abi: Abis.tip20,
569
564
  ...callArgs,
570
565
  })
571
566
  }
@@ -578,7 +573,7 @@ export namespace burn {
578
573
  */
579
574
  export function extractEvent(logs: Log[]) {
580
575
  const [log] = parseEventLogs({
581
- abi: tip20Abi,
576
+ abi: Abis.tip20,
582
577
  logs,
583
578
  eventName: 'Burn',
584
579
  })
@@ -642,7 +637,7 @@ export namespace burnSync {
642
637
 
643
638
  export type ReturnValue = Compute<
644
639
  GetEventArgs<
645
- typeof tip20Abi,
640
+ typeof Abis.tip20,
646
641
  'Burn',
647
642
  {
648
643
  IndexedOnly: false
@@ -715,9 +710,10 @@ export namespace changeTransferPolicy {
715
710
  client: Client<Transport, chain, account>,
716
711
  parameters: changeTransferPolicy.Parameters<chain, account>,
717
712
  ): Promise<ReturnType<action>> {
718
- const call = changeTransferPolicy.call(parameters)
713
+ const { policyId, token, ...rest } = parameters
714
+ const call = changeTransferPolicy.call({ policyId, token })
719
715
  return (await action(client, {
720
- ...parameters,
716
+ ...rest,
721
717
  ...call,
722
718
  } as never)) as never
723
719
  }
@@ -758,7 +754,7 @@ export namespace changeTransferPolicy {
758
754
  const { token, policyId } = args
759
755
  return defineCall({
760
756
  address: TokenId.toAddress(token),
761
- abi: tip20Abi,
757
+ abi: Abis.tip20,
762
758
  functionName: 'changeTransferPolicyId',
763
759
  args: [policyId],
764
760
  })
@@ -772,7 +768,7 @@ export namespace changeTransferPolicy {
772
768
  */
773
769
  export function extractEvent(logs: Log[]) {
774
770
  const [log] = parseEventLogs({
775
- abi: tip20Abi,
771
+ abi: Abis.tip20,
776
772
  logs,
777
773
  eventName: 'TransferPolicyUpdate',
778
774
  })
@@ -836,7 +832,7 @@ export namespace changeTransferPolicySync {
836
832
 
837
833
  export type ReturnValue = Compute<
838
834
  GetEventArgs<
839
- typeof tip20Abi,
835
+ typeof Abis.tip20,
840
836
  'TransferPolicyUpdate',
841
837
  {
842
838
  IndexedOnly: false
@@ -902,6 +898,8 @@ export namespace create {
902
898
  currency: string
903
899
  /** Token name. */
904
900
  name: string
901
+ /** quote token. */
902
+ quoteToken?: TokenId.TokenIdOrAddress | undefined
905
903
  /** Token symbol. */
906
904
  symbol: string
907
905
  }
@@ -975,11 +973,17 @@ export namespace create {
975
973
  * @returns The call.
976
974
  */
977
975
  export function call(args: Args) {
978
- const { name, symbol, currency, admin } = args
976
+ const {
977
+ name,
978
+ symbol,
979
+ currency,
980
+ quoteToken = Addresses.defaultQuoteToken,
981
+ admin,
982
+ } = args
979
983
  return defineCall({
980
- address: tip20FactoryAddress,
981
- abi: tip20FactoryAbi,
982
- args: [name, symbol, currency, admin],
984
+ address: Addresses.tip20Factory,
985
+ abi: Abis.tip20Factory,
986
+ args: [name, symbol, currency, TokenId.toAddress(quoteToken), admin],
983
987
  functionName: 'createToken',
984
988
  })
985
989
  }
@@ -992,7 +996,7 @@ export namespace create {
992
996
  */
993
997
  export function extractEvent(logs: Log[]) {
994
998
  const [log] = parseEventLogs({
995
- abi: tip20FactoryAbi,
999
+ abi: Abis.tip20Factory,
996
1000
  logs,
997
1001
  eventName: 'TokenCreated',
998
1002
  strict: true,
@@ -1060,7 +1064,7 @@ export namespace createSync {
1060
1064
 
1061
1065
  export type ReturnValue = Compute<
1062
1066
  GetEventArgs<
1063
- typeof tip20FactoryAbi,
1067
+ typeof Abis.tip20Factory,
1064
1068
  'TokenCreated',
1065
1069
  { IndexedOnly: false; Required: true }
1066
1070
  > & {
@@ -1070,6 +1074,196 @@ export namespace createSync {
1070
1074
  >
1071
1075
  }
1072
1076
 
1077
+ /**
1078
+ * Finalizes the quote token update for a TIP20 token.
1079
+ *
1080
+ * @example
1081
+ * ```ts
1082
+ * import { createClient, http } from 'viem'
1083
+ * import { tempo } from 'tempo.ts/chains'
1084
+ * import * as actions from 'tempo.ts/viem/actions'
1085
+ * import { privateKeyToAccount } from 'viem/accounts'
1086
+ *
1087
+ * const client = createClient({
1088
+ * account: privateKeyToAccount('0x...'),
1089
+ * chain: tempo,
1090
+ * transport: http(),
1091
+ * })
1092
+ *
1093
+ * const result = await actions.token.finalizeUpdateQuoteToken(client, {
1094
+ * token: '0x...',
1095
+ * })
1096
+ * ```
1097
+ *
1098
+ * @param client - Client.
1099
+ * @param parameters - Parameters.
1100
+ * @returns The transaction hash.
1101
+ */
1102
+ export async function finalizeUpdateQuoteToken<
1103
+ chain extends Chain | undefined,
1104
+ account extends Account | undefined,
1105
+ >(
1106
+ client: Client<Transport, chain, account>,
1107
+ parameters: finalizeUpdateQuoteToken.Parameters<chain, account>,
1108
+ ): Promise<finalizeUpdateQuoteToken.ReturnValue> {
1109
+ return finalizeUpdateQuoteToken.inner(writeContract, client, parameters)
1110
+ }
1111
+
1112
+ export namespace finalizeUpdateQuoteToken {
1113
+ export type Parameters<
1114
+ chain extends Chain | undefined = Chain | undefined,
1115
+ account extends Account | undefined = Account | undefined,
1116
+ > = WriteParameters<chain, account> & Args
1117
+
1118
+ export type Args = {
1119
+ /** Address or ID of the TIP20 token. */
1120
+ token: TokenId.TokenIdOrAddress
1121
+ }
1122
+
1123
+ export type ReturnValue = WriteContractReturnType
1124
+
1125
+ /** @internal */
1126
+ export async function inner<
1127
+ action extends typeof writeContract | typeof writeContractSync,
1128
+ chain extends Chain | undefined,
1129
+ account extends Account | undefined,
1130
+ >(
1131
+ action: action,
1132
+ client: Client<Transport, chain, account>,
1133
+ parameters: finalizeUpdateQuoteToken.Parameters<chain, account>,
1134
+ ): Promise<ReturnType<action>> {
1135
+ const { token, ...rest } = parameters
1136
+ const call = finalizeUpdateQuoteToken.call({ token })
1137
+ return (await action(client, {
1138
+ ...rest,
1139
+ ...call,
1140
+ } as never)) as never
1141
+ }
1142
+
1143
+ /**
1144
+ * Defines a call to the `finalizeQuoteTokenUpdate` function.
1145
+ *
1146
+ * Can be passed as a parameter to:
1147
+ * - [`estimateContractGas`](https://viem.sh/docs/contract/estimateContractGas): estimate the gas cost of the call
1148
+ * - [`simulateContract`](https://viem.sh/docs/contract/simulateContract): simulate the call
1149
+ * - [`sendCalls`](https://viem.sh/docs/actions/wallet/sendCalls): send multiple calls
1150
+ *
1151
+ * @example
1152
+ * ```ts
1153
+ * import { createClient, http, walletActions } from 'viem'
1154
+ * import { tempo } from 'tempo.ts/chains'
1155
+ * import * as actions from 'tempo.ts/viem/actions'
1156
+ *
1157
+ * const client = createClient({
1158
+ * chain: tempo,
1159
+ * transport: http(),
1160
+ * }).extend(walletActions)
1161
+ *
1162
+ * const { result } = await client.sendCalls({
1163
+ * calls: [
1164
+ * actions.token.finalizeUpdateQuoteToken.call({
1165
+ * token: '0x20c0...babe',
1166
+ * }),
1167
+ * ]
1168
+ * })
1169
+ * ```
1170
+ *
1171
+ * @param args - Arguments.
1172
+ * @returns The call.
1173
+ */
1174
+ export function call(args: Args) {
1175
+ const { token } = args
1176
+ return defineCall({
1177
+ address: TokenId.toAddress(token),
1178
+ abi: Abis.tip20,
1179
+ functionName: 'finalizeQuoteTokenUpdate',
1180
+ args: [],
1181
+ })
1182
+ }
1183
+
1184
+ /**
1185
+ * Extracts the event from the logs.
1186
+ *
1187
+ * @param logs - Logs.
1188
+ * @returns The event.
1189
+ */
1190
+ export function extractEvent(logs: Log[]) {
1191
+ const [log] = parseEventLogs({
1192
+ abi: Abis.tip20,
1193
+ logs,
1194
+ eventName: 'QuoteTokenUpdateFinalized',
1195
+ })
1196
+ if (!log) throw new Error('`QuoteTokenUpdateFinalized` event not found.')
1197
+ return log
1198
+ }
1199
+ }
1200
+
1201
+ /**
1202
+ * Finalizes the quote token update for a TIP20 token.
1203
+ *
1204
+ * @example
1205
+ * ```ts
1206
+ * import { createClient, http } from 'viem'
1207
+ * import { tempo } from 'tempo.ts/chains'
1208
+ * import * as actions from 'tempo.ts/viem/actions'
1209
+ * import { privateKeyToAccount } from 'viem/accounts'
1210
+ *
1211
+ * const client = createClient({
1212
+ * account: privateKeyToAccount('0x...'),
1213
+ * chain: tempo,
1214
+ * transport: http(),
1215
+ * })
1216
+ *
1217
+ * const result = await actions.token.finalizeUpdateQuoteTokenSync(client, {
1218
+ * token: '0x...',
1219
+ * })
1220
+ * ```
1221
+ *
1222
+ * @param client - Client.
1223
+ * @param parameters - Parameters.
1224
+ * @returns The transaction receipt and event data.
1225
+ */
1226
+ export async function finalizeUpdateQuoteTokenSync<
1227
+ chain extends Chain | undefined,
1228
+ account extends Account | undefined,
1229
+ >(
1230
+ client: Client<Transport, chain, account>,
1231
+ parameters: finalizeUpdateQuoteTokenSync.Parameters<chain, account>,
1232
+ ): Promise<finalizeUpdateQuoteTokenSync.ReturnValue> {
1233
+ const receipt = await finalizeUpdateQuoteToken.inner(
1234
+ writeContractSync,
1235
+ client,
1236
+ parameters,
1237
+ )
1238
+ const { args } = finalizeUpdateQuoteToken.extractEvent(receipt.logs)
1239
+ return {
1240
+ ...args,
1241
+ receipt,
1242
+ } as never
1243
+ }
1244
+
1245
+ export namespace finalizeUpdateQuoteTokenSync {
1246
+ export type Parameters<
1247
+ chain extends Chain | undefined = Chain | undefined,
1248
+ account extends Account | undefined = Account | undefined,
1249
+ > = finalizeUpdateQuoteToken.Parameters<chain, account>
1250
+
1251
+ export type Args = finalizeUpdateQuoteToken.Args
1252
+
1253
+ export type ReturnValue = Compute<
1254
+ GetEventArgs<
1255
+ typeof Abis.tip20,
1256
+ 'QuoteTokenUpdateFinalized',
1257
+ {
1258
+ IndexedOnly: false
1259
+ Required: true
1260
+ }
1261
+ > & {
1262
+ receipt: TransactionReceipt
1263
+ }
1264
+ >
1265
+ }
1266
+
1073
1267
  /**
1074
1268
  * Gets TIP20 token allowance.
1075
1269
  *
@@ -1121,12 +1315,12 @@ export namespace getAllowance {
1121
1315
  account: Address
1122
1316
  /** Address of the spender. */
1123
1317
  spender: Address
1124
- /** Address or ID of the TIP20 token. @default `usdAddress` */
1318
+ /** Address or ID of the TIP20 token. @default `Addresses.defaultFeeToken` */
1125
1319
  token?: TokenId.TokenIdOrAddress | undefined
1126
1320
  }
1127
1321
 
1128
1322
  export type ReturnValue = ReadContractReturnType<
1129
- typeof tip20Abi,
1323
+ typeof Abis.tip20,
1130
1324
  'allowance',
1131
1325
  never
1132
1326
  >
@@ -1138,10 +1332,10 @@ export namespace getAllowance {
1138
1332
  * @returns The call.
1139
1333
  */
1140
1334
  export function call(args: Args) {
1141
- const { account, spender, token = usdAddress } = args
1335
+ const { account, spender, token = Addresses.defaultFeeToken } = args
1142
1336
  return defineCall({
1143
1337
  address: TokenId.toAddress(token),
1144
- abi: tip20Abi,
1338
+ abi: Abis.tip20,
1145
1339
  functionName: 'allowance',
1146
1340
  args: [account, spender],
1147
1341
  })
@@ -1199,12 +1393,12 @@ export namespace getBalance {
1199
1393
  export type Args = {
1200
1394
  /** Account address. */
1201
1395
  account: Address
1202
- /** Address or ID of the TIP20 token. @default `usdAddress` */
1396
+ /** Address or ID of the TIP20 token. @default `Addresses.defaultFeeToken` */
1203
1397
  token?: TokenId.TokenIdOrAddress | undefined
1204
1398
  }
1205
1399
 
1206
1400
  export type ReturnValue = ReadContractReturnType<
1207
- typeof tip20Abi,
1401
+ typeof Abis.tip20,
1208
1402
  'balanceOf',
1209
1403
  never
1210
1404
  >
@@ -1216,10 +1410,10 @@ export namespace getBalance {
1216
1410
  * @returns The call.
1217
1411
  */
1218
1412
  export function call(args: Args) {
1219
- const { account, token = usdAddress } = args
1413
+ const { account, token = Addresses.defaultFeeToken } = args
1220
1414
  return defineCall({
1221
1415
  address: TokenId.toAddress(token),
1222
- abi: tip20Abi,
1416
+ abi: Abis.tip20,
1223
1417
  functionName: 'balanceOf',
1224
1418
  args: [account],
1225
1419
  })
@@ -1255,9 +1449,9 @@ export async function getMetadata<chain extends Chain | undefined>(
1255
1449
  client: Client<Transport, chain>,
1256
1450
  parameters: getMetadata.Parameters = {},
1257
1451
  ): Promise<getMetadata.ReturnValue> {
1258
- const { token = usdAddress, ...rest } = parameters
1452
+ const { token = Addresses.defaultFeeToken, ...rest } = parameters
1259
1453
  const address = TokenId.toAddress(token)
1260
- const abi = tip20Abi
1454
+ const abi = Abis.tip20
1261
1455
  return multicall(client, {
1262
1456
  ...rest,
1263
1457
  contracts: [
@@ -1271,6 +1465,11 @@ export async function getMetadata<chain extends Chain | undefined>(
1271
1465
  abi,
1272
1466
  functionName: 'decimals',
1273
1467
  },
1468
+ {
1469
+ address,
1470
+ abi,
1471
+ functionName: 'quoteToken',
1472
+ },
1274
1473
  {
1275
1474
  address,
1276
1475
  abi,
@@ -1308,6 +1507,7 @@ export async function getMetadata<chain extends Chain | undefined>(
1308
1507
  ([
1309
1508
  currency,
1310
1509
  decimals,
1510
+ quoteToken,
1311
1511
  name,
1312
1512
  paused,
1313
1513
  supplyCap,
@@ -1319,18 +1519,18 @@ export async function getMetadata<chain extends Chain | undefined>(
1319
1519
  symbol,
1320
1520
  currency,
1321
1521
  decimals,
1522
+ quoteToken,
1322
1523
  totalSupply,
1323
1524
  paused,
1324
1525
  supplyCap,
1325
- transferPolicy:
1326
- transferPolicy[Number(transferPolicyId) as keyof typeof transferPolicy],
1526
+ transferPolicyId,
1327
1527
  }),
1328
1528
  )
1329
1529
  }
1330
1530
 
1331
1531
  export declare namespace getMetadata {
1332
1532
  export type Parameters = {
1333
- /** Address or ID of the TIP20 token. @default `usdAddress` */
1533
+ /** Address or ID of the TIP20 token. @default `Addresses.defaultFeeToken` */
1334
1534
  token?: TokenId.TokenIdOrAddress | undefined
1335
1535
  }
1336
1536
 
@@ -1339,6 +1539,8 @@ export declare namespace getMetadata {
1339
1539
  currency: string
1340
1540
  /** Decimals. */
1341
1541
  decimals: number
1542
+ /** quote token. */
1543
+ quoteToken: Address
1342
1544
  /** Name. */
1343
1545
  name: string
1344
1546
  /** Whether the token is paused. */
@@ -1349,8 +1551,8 @@ export declare namespace getMetadata {
1349
1551
  symbol: string
1350
1552
  /** Total supply. */
1351
1553
  totalSupply: bigint
1352
- /** Transfer policy. */
1353
- transferPolicy: TransferPolicy
1554
+ /** Transfer policy ID. 0="always-reject", 1="always-allow", >2=custom policy */
1555
+ transferPolicyId: bigint
1354
1556
  }>
1355
1557
  }
1356
1558
 
@@ -1410,7 +1612,7 @@ export namespace hasRole {
1410
1612
  }
1411
1613
 
1412
1614
  export type ReturnValue = ReadContractReturnType<
1413
- typeof tip20Abi,
1615
+ typeof Abis.tip20,
1414
1616
  'hasRole',
1415
1617
  never
1416
1618
  >
@@ -1425,7 +1627,7 @@ export namespace hasRole {
1425
1627
  const { account, role, token } = args
1426
1628
  return defineCall({
1427
1629
  address: TokenId.toAddress(token),
1428
- abi: tip20Abi,
1630
+ abi: Abis.tip20,
1429
1631
  functionName: 'hasRole',
1430
1632
  args: [account, TokenRole.serialize(role)],
1431
1633
  })
@@ -1550,7 +1752,7 @@ export namespace grantRoles {
1550
1752
  const roleHash = TokenRole.serialize(role)
1551
1753
  return defineCall({
1552
1754
  address: TokenId.toAddress(token),
1553
- abi: tip20Abi,
1755
+ abi: Abis.tip20,
1554
1756
  functionName: 'grantRole',
1555
1757
  args: [roleHash, to],
1556
1758
  })
@@ -1564,7 +1766,7 @@ export namespace grantRoles {
1564
1766
  */
1565
1767
  export function extractEvents(logs: Log[]) {
1566
1768
  const events = parseEventLogs({
1567
- abi: tip20Abi,
1769
+ abi: Abis.tip20,
1568
1770
  logs,
1569
1771
  eventName: 'RoleMembershipUpdated',
1570
1772
  })
@@ -1632,7 +1834,7 @@ export namespace grantRolesSync {
1632
1834
  export type ReturnValue = {
1633
1835
  receipt: TransactionReceipt
1634
1836
  value: readonly GetEventArgs<
1635
- typeof tip20Abi,
1837
+ typeof Abis.tip20,
1636
1838
  'RoleMembershipUpdated',
1637
1839
  { IndexedOnly: false; Required: true }
1638
1840
  >[]
@@ -1759,7 +1961,7 @@ export namespace mint {
1759
1961
  } as const)
1760
1962
  return defineCall({
1761
1963
  address: TokenId.toAddress(token),
1762
- abi: tip20Abi,
1964
+ abi: Abis.tip20,
1763
1965
  ...callArgs,
1764
1966
  })
1765
1967
  }
@@ -1772,7 +1974,7 @@ export namespace mint {
1772
1974
  */
1773
1975
  export function extractEvent(logs: Log[]) {
1774
1976
  const [log] = parseEventLogs({
1775
- abi: tip20Abi,
1977
+ abi: Abis.tip20,
1776
1978
  logs,
1777
1979
  eventName: 'Mint',
1778
1980
  })
@@ -1837,7 +2039,7 @@ export namespace mintSync {
1837
2039
 
1838
2040
  export type ReturnValue = Compute<
1839
2041
  GetEventArgs<
1840
- typeof tip20Abi,
2042
+ typeof Abis.tip20,
1841
2043
  'Mint',
1842
2044
  {
1843
2045
  IndexedOnly: false
@@ -1907,9 +2109,10 @@ export namespace pause {
1907
2109
  client: Client<Transport, chain, account>,
1908
2110
  parameters: pause.Parameters<chain, account>,
1909
2111
  ): Promise<ReturnType<action>> {
1910
- const call = pause.call(parameters)
2112
+ const { token, ...rest } = parameters
2113
+ const call = pause.call({ token })
1911
2114
  return (await action(client, {
1912
- ...parameters,
2115
+ ...rest,
1913
2116
  ...call,
1914
2117
  } as never)) as never
1915
2118
  }
@@ -1949,7 +2152,7 @@ export namespace pause {
1949
2152
  const { token } = args
1950
2153
  return defineCall({
1951
2154
  address: TokenId.toAddress(token),
1952
- abi: tip20Abi,
2155
+ abi: Abis.tip20,
1953
2156
  functionName: 'pause',
1954
2157
  args: [],
1955
2158
  })
@@ -1963,7 +2166,7 @@ export namespace pause {
1963
2166
  */
1964
2167
  export function extractEvent(logs: Log[]) {
1965
2168
  const [log] = parseEventLogs({
1966
- abi: tip20Abi,
2169
+ abi: Abis.tip20,
1967
2170
  logs,
1968
2171
  eventName: 'PauseStateUpdate',
1969
2172
  })
@@ -2025,7 +2228,7 @@ export namespace pauseSync {
2025
2228
  export type Args = pause.Args
2026
2229
 
2027
2230
  export type ReturnValue = GetEventArgs<
2028
- typeof tip20Abi,
2231
+ typeof Abis.tip20,
2029
2232
  'PauseStateUpdate',
2030
2233
  { IndexedOnly: false; Required: true }
2031
2234
  > & {
@@ -2087,7 +2290,7 @@ export namespace permit {
2087
2290
  signature: Signature.Signature
2088
2291
  /** Address of the spender. */
2089
2292
  spender: Address
2090
- /** Address or ID of the TIP20 token. @default `usdAddress` */
2293
+ /** Address or ID of the TIP20 token. @default `Addresses.defaultFeeToken` */
2091
2294
  token?: TokenId.TokenIdOrAddress | undefined
2092
2295
  /** Amount to approve. */
2093
2296
  value: bigint
@@ -2105,9 +2308,18 @@ export namespace permit {
2105
2308
  client: Client<Transport, chain, account>,
2106
2309
  parameters: permit.Parameters<chain, account>,
2107
2310
  ): Promise<ReturnType<action>> {
2108
- const call = permit.call(parameters)
2311
+ const { owner, spender, value, deadline, signature, token, ...rest } =
2312
+ parameters
2313
+ const call = permit.call({
2314
+ owner,
2315
+ spender,
2316
+ value,
2317
+ deadline,
2318
+ signature,
2319
+ token,
2320
+ })
2109
2321
  return (await action(client, {
2110
- ...parameters,
2322
+ ...rest,
2111
2323
  ...call,
2112
2324
  } as never)) as never
2113
2325
  }
@@ -2155,13 +2367,13 @@ export namespace permit {
2155
2367
  value,
2156
2368
  deadline,
2157
2369
  signature,
2158
- token = usdAddress,
2370
+ token = Addresses.defaultFeeToken,
2159
2371
  } = args
2160
2372
  const { r, s, yParity } = Signature.from(signature)
2161
2373
  const v = Signature.yParityToV(yParity)
2162
2374
  return defineCall({
2163
2375
  address: TokenId.toAddress(token),
2164
- abi: tip20Abi,
2376
+ abi: Abis.tip20,
2165
2377
  functionName: 'permit',
2166
2378
  args: [
2167
2379
  owner,
@@ -2183,7 +2395,7 @@ export namespace permit {
2183
2395
  */
2184
2396
  export function extractEvent(logs: Log[]) {
2185
2397
  const [log] = parseEventLogs({
2186
- abi: tip20Abi,
2398
+ abi: Abis.tip20,
2187
2399
  logs,
2188
2400
  eventName: 'Approval',
2189
2401
  })
@@ -2249,7 +2461,7 @@ export namespace permitSync {
2249
2461
  export type Args = permit.Args
2250
2462
 
2251
2463
  export type ReturnValue = GetEventArgs<
2252
- typeof tip20Abi,
2464
+ typeof Abis.tip20,
2253
2465
  'Approval',
2254
2466
  { IndexedOnly: false; Required: true }
2255
2467
  > & {
@@ -2371,7 +2583,7 @@ export namespace renounceRoles {
2371
2583
  const roleHash = TokenRole.serialize(role)
2372
2584
  return defineCall({
2373
2585
  address: TokenId.toAddress(token),
2374
- abi: tip20Abi,
2586
+ abi: Abis.tip20,
2375
2587
  functionName: 'renounceRole',
2376
2588
  args: [roleHash],
2377
2589
  })
@@ -2385,7 +2597,7 @@ export namespace renounceRoles {
2385
2597
  */
2386
2598
  export function extractEvents(logs: Log[]) {
2387
2599
  const events = parseEventLogs({
2388
- abi: tip20Abi,
2600
+ abi: Abis.tip20,
2389
2601
  logs,
2390
2602
  eventName: 'RoleMembershipUpdated',
2391
2603
  })
@@ -2452,7 +2664,7 @@ export namespace renounceRolesSync {
2452
2664
  export type ReturnValue = {
2453
2665
  receipt: TransactionReceipt
2454
2666
  value: readonly GetEventArgs<
2455
- typeof tip20Abi,
2667
+ typeof Abis.tip20,
2456
2668
  'RoleMembershipUpdated',
2457
2669
  { IndexedOnly: false; Required: true }
2458
2670
  >[]
@@ -2577,7 +2789,7 @@ export namespace revokeRoles {
2577
2789
  const roleHash = TokenRole.serialize(role)
2578
2790
  return defineCall({
2579
2791
  address: TokenId.toAddress(token),
2580
- abi: tip20Abi,
2792
+ abi: Abis.tip20,
2581
2793
  functionName: 'revokeRole',
2582
2794
  args: [roleHash, from],
2583
2795
  })
@@ -2591,7 +2803,7 @@ export namespace revokeRoles {
2591
2803
  */
2592
2804
  export function extractEvents(logs: Log[]) {
2593
2805
  const events = parseEventLogs({
2594
- abi: tip20Abi,
2806
+ abi: Abis.tip20,
2595
2807
  logs,
2596
2808
  eventName: 'RoleMembershipUpdated',
2597
2809
  })
@@ -2659,7 +2871,7 @@ export namespace revokeRolesSync {
2659
2871
  export type ReturnValue = {
2660
2872
  receipt: TransactionReceipt
2661
2873
  value: readonly GetEventArgs<
2662
- typeof tip20Abi,
2874
+ typeof Abis.tip20,
2663
2875
  'RoleMembershipUpdated',
2664
2876
  { IndexedOnly: false; Required: true }
2665
2877
  >[]
@@ -2727,9 +2939,10 @@ export namespace setSupplyCap {
2727
2939
  client: Client<Transport, chain, account>,
2728
2940
  parameters: setSupplyCap.Parameters<chain, account>,
2729
2941
  ): Promise<ReturnType<action>> {
2730
- const call = setSupplyCap.call(parameters)
2942
+ const { supplyCap, token, ...rest } = parameters
2943
+ const call = setSupplyCap.call({ supplyCap, token })
2731
2944
  return (await action(client, {
2732
- ...parameters,
2945
+ ...rest,
2733
2946
  ...call,
2734
2947
  } as never)) as never
2735
2948
  }
@@ -2770,7 +2983,7 @@ export namespace setSupplyCap {
2770
2983
  const { token, supplyCap } = args
2771
2984
  return defineCall({
2772
2985
  address: TokenId.toAddress(token),
2773
- abi: tip20Abi,
2986
+ abi: Abis.tip20,
2774
2987
  functionName: 'setSupplyCap',
2775
2988
  args: [supplyCap],
2776
2989
  })
@@ -2784,7 +2997,7 @@ export namespace setSupplyCap {
2784
2997
  */
2785
2998
  export function extractEvent(logs: Log[]) {
2786
2999
  const [log] = parseEventLogs({
2787
- abi: tip20Abi,
3000
+ abi: Abis.tip20,
2788
3001
  logs,
2789
3002
  eventName: 'SupplyCapUpdate',
2790
3003
  })
@@ -2847,7 +3060,7 @@ export namespace setSupplyCapSync {
2847
3060
  export type Args = setSupplyCap.Args
2848
3061
 
2849
3062
  export type ReturnValue = GetEventArgs<
2850
- typeof tip20Abi,
3063
+ typeof Abis.tip20,
2851
3064
  'SupplyCapUpdate',
2852
3065
  { IndexedOnly: false; Required: true }
2853
3066
  > & {
@@ -2919,9 +3132,10 @@ export namespace setRoleAdmin {
2919
3132
  client: Client<Transport, chain, account>,
2920
3133
  parameters: setRoleAdmin.Parameters<chain, account>,
2921
3134
  ): Promise<ReturnType<action>> {
2922
- const call = setRoleAdmin.call(parameters)
3135
+ const { adminRole, role, token, ...rest } = parameters
3136
+ const call = setRoleAdmin.call({ adminRole, role, token })
2923
3137
  return (await action(client, {
2924
- ...parameters,
3138
+ ...rest,
2925
3139
  ...call,
2926
3140
  } as never)) as never
2927
3141
  }
@@ -2965,7 +3179,7 @@ export namespace setRoleAdmin {
2965
3179
  const adminRoleHash = TokenRole.serialize(adminRole)
2966
3180
  return defineCall({
2967
3181
  address: TokenId.toAddress(token),
2968
- abi: tip20Abi,
3182
+ abi: Abis.tip20,
2969
3183
  functionName: 'setRoleAdmin',
2970
3184
  args: [roleHash, adminRoleHash],
2971
3185
  })
@@ -2979,7 +3193,7 @@ export namespace setRoleAdmin {
2979
3193
  */
2980
3194
  export function extractEvent(logs: Log[]) {
2981
3195
  const [log] = parseEventLogs({
2982
- abi: tip20Abi,
3196
+ abi: Abis.tip20,
2983
3197
  logs,
2984
3198
  eventName: 'RoleAdminUpdated',
2985
3199
  })
@@ -3043,7 +3257,7 @@ export namespace setRoleAdminSync {
3043
3257
  export type Args = setRoleAdmin.Args
3044
3258
 
3045
3259
  export type ReturnValue = GetEventArgs<
3046
- typeof tip20Abi,
3260
+ typeof Abis.tip20,
3047
3261
  'RoleAdminUpdated',
3048
3262
  { IndexedOnly: false; Required: true }
3049
3263
  > & {
@@ -3100,7 +3314,7 @@ export namespace transfer {
3100
3314
  from?: Address | undefined
3101
3315
  /** Memo to include in the transfer. */
3102
3316
  memo?: Hex.Hex | undefined
3103
- /** Address or ID of the TIP20 token. @default `usdAddress` */
3317
+ /** Address or ID of the TIP20 token. @default `Addresses.defaultFeeToken` */
3104
3318
  token?: TokenId.TokenIdOrAddress | undefined
3105
3319
  /** Address to transfer tokens to. */
3106
3320
  to: Address
@@ -3118,9 +3332,10 @@ export namespace transfer {
3118
3332
  client: Client<Transport, chain, account>,
3119
3333
  parameters: transfer.Parameters<chain, account>,
3120
3334
  ): Promise<ReturnType<action>> {
3121
- const call = transfer.call(parameters)
3335
+ const { amount, from, memo, token, to, ...rest } = parameters
3336
+ const call = transfer.call({ amount, from, memo, token, to })
3122
3337
  return (await action(client, {
3123
- ...parameters,
3338
+ ...rest,
3124
3339
  ...call,
3125
3340
  } as never)) as never
3126
3341
  }
@@ -3159,7 +3374,7 @@ export namespace transfer {
3159
3374
  * @returns The call.
3160
3375
  */
3161
3376
  export function call(args: Args) {
3162
- const { amount, from, memo, token = usdAddress, to } = args
3377
+ const { amount, from, memo, token = Addresses.defaultFeeToken, to } = args
3163
3378
  const callArgs = (() => {
3164
3379
  if (memo && from)
3165
3380
  return {
@@ -3183,7 +3398,7 @@ export namespace transfer {
3183
3398
  })()
3184
3399
  return defineCall({
3185
3400
  address: TokenId.toAddress(token),
3186
- abi: tip20Abi,
3401
+ abi: Abis.tip20,
3187
3402
  ...callArgs,
3188
3403
  })
3189
3404
  }
@@ -3196,7 +3411,7 @@ export namespace transfer {
3196
3411
  */
3197
3412
  export function extractEvent(logs: Log[]) {
3198
3413
  const [log] = parseEventLogs({
3199
- abi: tip20Abi,
3414
+ abi: Abis.tip20,
3200
3415
  logs,
3201
3416
  eventName: 'Transfer',
3202
3417
  })
@@ -3259,7 +3474,7 @@ export namespace transferSync {
3259
3474
  export type Args = transfer.Args
3260
3475
 
3261
3476
  export type ReturnValue = GetEventArgs<
3262
- typeof tip20Abi,
3477
+ typeof Abis.tip20,
3263
3478
  'Transfer',
3264
3479
  { IndexedOnly: false; Required: true }
3265
3480
  > & {
@@ -3325,9 +3540,10 @@ export namespace unpause {
3325
3540
  client: Client<Transport, chain, account>,
3326
3541
  parameters: unpause.Parameters<chain, account>,
3327
3542
  ): Promise<ReturnType<action>> {
3328
- const call = unpause.call(parameters)
3543
+ const { token, ...rest } = parameters
3544
+ const call = unpause.call({ token })
3329
3545
  return (await action(client, {
3330
- ...parameters,
3546
+ ...rest,
3331
3547
  ...call,
3332
3548
  } as never)) as never
3333
3549
  }
@@ -3367,7 +3583,7 @@ export namespace unpause {
3367
3583
  const { token } = args
3368
3584
  return defineCall({
3369
3585
  address: TokenId.toAddress(token),
3370
- abi: tip20Abi,
3586
+ abi: Abis.tip20,
3371
3587
  functionName: 'unpause',
3372
3588
  args: [],
3373
3589
  })
@@ -3381,7 +3597,7 @@ export namespace unpause {
3381
3597
  */
3382
3598
  export function extractEvent(logs: Log[]) {
3383
3599
  const [log] = parseEventLogs({
3384
- abi: tip20Abi,
3600
+ abi: Abis.tip20,
3385
3601
  logs,
3386
3602
  eventName: 'PauseStateUpdate',
3387
3603
  })
@@ -3443,7 +3659,7 @@ export namespace unpauseSync {
3443
3659
  export type Args = unpause.Args
3444
3660
 
3445
3661
  export type ReturnValue = GetEventArgs<
3446
- typeof tip20Abi,
3662
+ typeof Abis.tip20,
3447
3663
  'PauseStateUpdate',
3448
3664
  { IndexedOnly: false; Required: true }
3449
3665
  > & {
@@ -3451,6 +3667,201 @@ export namespace unpauseSync {
3451
3667
  }
3452
3668
  }
3453
3669
 
3670
+ /**
3671
+ * Updates the quote token for a TIP20 token.
3672
+ *
3673
+ * @example
3674
+ * ```ts
3675
+ * import { createClient, http } from 'viem'
3676
+ * import { tempo } from 'tempo.ts/chains'
3677
+ * import * as actions from 'tempo.ts/viem/actions'
3678
+ * import { privateKeyToAccount } from 'viem/accounts'
3679
+ *
3680
+ * const client = createClient({
3681
+ * account: privateKeyToAccount('0x...'),
3682
+ * chain: tempo,
3683
+ * transport: http(),
3684
+ * })
3685
+ *
3686
+ * const result = await actions.token.updateQuoteToken(client, {
3687
+ * token: '0x...',
3688
+ * quoteToken: '0x...',
3689
+ * })
3690
+ * ```
3691
+ *
3692
+ * @param client - Client.
3693
+ * @param parameters - Parameters.
3694
+ * @returns The transaction hash.
3695
+ */
3696
+ export async function updateQuoteToken<
3697
+ chain extends Chain | undefined,
3698
+ account extends Account | undefined,
3699
+ >(
3700
+ client: Client<Transport, chain, account>,
3701
+ parameters: updateQuoteToken.Parameters<chain, account>,
3702
+ ): Promise<updateQuoteToken.ReturnValue> {
3703
+ return updateQuoteToken.inner(writeContract, client, parameters)
3704
+ }
3705
+
3706
+ export namespace updateQuoteToken {
3707
+ export type Parameters<
3708
+ chain extends Chain | undefined = Chain | undefined,
3709
+ account extends Account | undefined = Account | undefined,
3710
+ > = WriteParameters<chain, account> & Args
3711
+
3712
+ export type Args = {
3713
+ /** New quote token address. */
3714
+ quoteToken: TokenId.TokenIdOrAddress
3715
+ /** Address or ID of the TIP20 token. */
3716
+ token: TokenId.TokenIdOrAddress
3717
+ }
3718
+
3719
+ export type ReturnValue = WriteContractReturnType
3720
+
3721
+ /** @internal */
3722
+ export async function inner<
3723
+ action extends typeof writeContract | typeof writeContractSync,
3724
+ chain extends Chain | undefined,
3725
+ account extends Account | undefined,
3726
+ >(
3727
+ action: action,
3728
+ client: Client<Transport, chain, account>,
3729
+ parameters: updateQuoteToken.Parameters<chain, account>,
3730
+ ): Promise<ReturnType<action>> {
3731
+ const { quoteToken, token, ...rest } = parameters
3732
+ const call = updateQuoteToken.call({ quoteToken, token })
3733
+ return (await action(client, {
3734
+ ...rest,
3735
+ ...call,
3736
+ } as never)) as never
3737
+ }
3738
+
3739
+ /**
3740
+ * Defines a call to the `updateQuoteToken` function.
3741
+ *
3742
+ * Can be passed as a parameter to:
3743
+ * - [`estimateContractGas`](https://viem.sh/docs/contract/estimateContractGas): estimate the gas cost of the call
3744
+ * - [`simulateContract`](https://viem.sh/docs/contract/simulateContract): simulate the call
3745
+ * - [`sendCalls`](https://viem.sh/docs/actions/wallet/sendCalls): send multiple calls
3746
+ *
3747
+ * @example
3748
+ * ```ts
3749
+ * import { createClient, http, walletActions } from 'viem'
3750
+ * import { tempo } from 'tempo.ts/chains'
3751
+ * import * as actions from 'tempo.ts/viem/actions'
3752
+ *
3753
+ * const client = createClient({
3754
+ * chain: tempo,
3755
+ * transport: http(),
3756
+ * }).extend(walletActions)
3757
+ *
3758
+ * const { result } = await client.sendCalls({
3759
+ * calls: [
3760
+ * actions.token.updateQuoteToken.call({
3761
+ * token: '0x20c0...babe',
3762
+ * quoteToken: '0x20c0...cafe',
3763
+ * }),
3764
+ * ]
3765
+ * })
3766
+ * ```
3767
+ *
3768
+ * @param args - Arguments.
3769
+ * @returns The call.
3770
+ */
3771
+ export function call(args: Args) {
3772
+ const { token, quoteToken } = args
3773
+ return defineCall({
3774
+ address: TokenId.toAddress(token),
3775
+ abi: Abis.tip20,
3776
+ functionName: 'updateQuoteToken',
3777
+ args: [TokenId.toAddress(quoteToken)],
3778
+ })
3779
+ }
3780
+
3781
+ /**
3782
+ * Extracts the event from the logs.
3783
+ *
3784
+ * @param logs - Logs.
3785
+ * @returns The event.
3786
+ */
3787
+ export function extractEvent(logs: Log[]) {
3788
+ const [log] = parseEventLogs({
3789
+ abi: Abis.tip20,
3790
+ logs,
3791
+ eventName: 'UpdateQuoteToken',
3792
+ })
3793
+ if (!log) throw new Error('`UpdateQuoteToken` event not found.')
3794
+ return log
3795
+ }
3796
+ }
3797
+
3798
+ /**
3799
+ * Updates the quote token for a TIP20 token.
3800
+ *
3801
+ * @example
3802
+ * ```ts
3803
+ * import { createClient, http } from 'viem'
3804
+ * import { tempo } from 'tempo.ts/chains'
3805
+ * import * as actions from 'tempo.ts/viem/actions'
3806
+ * import { privateKeyToAccount } from 'viem/accounts'
3807
+ *
3808
+ * const client = createClient({
3809
+ * account: privateKeyToAccount('0x...'),
3810
+ * chain: tempo,
3811
+ * transport: http(),
3812
+ * })
3813
+ *
3814
+ * const result = await actions.token.updateQuoteTokenSync(client, {
3815
+ * token: '0x...',
3816
+ * quoteToken: '0x...',
3817
+ * })
3818
+ * ```
3819
+ *
3820
+ * @param client - Client.
3821
+ * @param parameters - Parameters.
3822
+ * @returns The transaction receipt and event data.
3823
+ */
3824
+ export async function updateQuoteTokenSync<
3825
+ chain extends Chain | undefined,
3826
+ account extends Account | undefined,
3827
+ >(
3828
+ client: Client<Transport, chain, account>,
3829
+ parameters: updateQuoteTokenSync.Parameters<chain, account>,
3830
+ ): Promise<updateQuoteTokenSync.ReturnValue> {
3831
+ const receipt = await updateQuoteToken.inner(
3832
+ writeContractSync,
3833
+ client,
3834
+ parameters,
3835
+ )
3836
+ const { args } = updateQuoteToken.extractEvent(receipt.logs)
3837
+ return {
3838
+ ...args,
3839
+ receipt,
3840
+ } as never
3841
+ }
3842
+
3843
+ export namespace updateQuoteTokenSync {
3844
+ export type Parameters<
3845
+ chain extends Chain | undefined = Chain | undefined,
3846
+ account extends Account | undefined = Account | undefined,
3847
+ > = updateQuoteToken.Parameters<chain, account>
3848
+
3849
+ export type Args = updateQuoteToken.Args
3850
+
3851
+ export type ReturnValue = Compute<
3852
+ GetEventArgs<
3853
+ typeof Abis.tip20,
3854
+ 'UpdateQuoteToken',
3855
+ {
3856
+ IndexedOnly: false
3857
+ Required: true
3858
+ }
3859
+ > & {
3860
+ receipt: TransactionReceipt
3861
+ }
3862
+ >
3863
+ }
3864
+
3454
3865
  /**
3455
3866
  * Watches for TIP20 token approval events.
3456
3867
  *
@@ -3483,11 +3894,11 @@ export function watchApprove<
3483
3894
  client: Client<Transport, chain, account>,
3484
3895
  parameters: watchApprove.Parameters,
3485
3896
  ) {
3486
- const { onApproval, token = usdAddress, ...rest } = parameters
3897
+ const { onApproval, token = Addresses.defaultFeeToken, ...rest } = parameters
3487
3898
  return watchContractEvent(client, {
3488
3899
  ...rest,
3489
3900
  address: TokenId.toAddress(token),
3490
- abi: tip20Abi,
3901
+ abi: Abis.tip20,
3491
3902
  eventName: 'Approval',
3492
3903
  onLogs: (logs) => {
3493
3904
  for (const log of logs) onApproval(log.args, log)
@@ -3498,7 +3909,7 @@ export function watchApprove<
3498
3909
 
3499
3910
  export declare namespace watchApprove {
3500
3911
  export type Args = GetEventArgs<
3501
- typeof tip20Abi,
3912
+ typeof Abis.tip20,
3502
3913
  'Approval',
3503
3914
  { IndexedOnly: false; Required: true }
3504
3915
  >
@@ -3507,17 +3918,17 @@ export declare namespace watchApprove {
3507
3918
  bigint,
3508
3919
  number,
3509
3920
  false,
3510
- ExtractAbiItem<typeof tip20Abi, 'Approval'>,
3921
+ ExtractAbiItem<typeof Abis.tip20, 'Approval'>,
3511
3922
  true
3512
3923
  >
3513
3924
 
3514
3925
  export type Parameters = UnionOmit<
3515
- WatchContractEventParameters<typeof tip20Abi, 'Approval', true>,
3926
+ WatchContractEventParameters<typeof Abis.tip20, 'Approval', true>,
3516
3927
  'abi' | 'address' | 'batch' | 'eventName' | 'onLogs' | 'strict'
3517
3928
  > & {
3518
3929
  /** Callback to invoke when tokens are approved. */
3519
3930
  onApproval: (args: Args, log: Log) => void
3520
- /** Address or ID of the TIP20 token. @default `usdAddress` */
3931
+ /** Address or ID of the TIP20 token. @default `Addresses.defaultFeeToken` */
3521
3932
  token?: TokenId.TokenIdOrAddress | undefined
3522
3933
  }
3523
3934
  }
@@ -3551,11 +3962,11 @@ export function watchBurn<
3551
3962
  chain extends Chain | undefined,
3552
3963
  account extends Account | undefined,
3553
3964
  >(client: Client<Transport, chain, account>, parameters: watchBurn.Parameters) {
3554
- const { onBurn, token = usdAddress, ...rest } = parameters
3965
+ const { onBurn, token = Addresses.defaultFeeToken, ...rest } = parameters
3555
3966
  return watchContractEvent(client, {
3556
3967
  ...rest,
3557
3968
  address: TokenId.toAddress(token),
3558
- abi: tip20Abi,
3969
+ abi: Abis.tip20,
3559
3970
  eventName: 'Burn',
3560
3971
  onLogs: (logs) => {
3561
3972
  for (const log of logs) onBurn(log.args, log)
@@ -3566,7 +3977,7 @@ export function watchBurn<
3566
3977
 
3567
3978
  export declare namespace watchBurn {
3568
3979
  export type Args = GetEventArgs<
3569
- typeof tip20Abi,
3980
+ typeof Abis.tip20,
3570
3981
  'Burn',
3571
3982
  { IndexedOnly: false; Required: true }
3572
3983
  >
@@ -3575,17 +3986,17 @@ export declare namespace watchBurn {
3575
3986
  bigint,
3576
3987
  number,
3577
3988
  false,
3578
- ExtractAbiItem<typeof tip20Abi, 'Burn'>,
3989
+ ExtractAbiItem<typeof Abis.tip20, 'Burn'>,
3579
3990
  true
3580
3991
  >
3581
3992
 
3582
3993
  export type Parameters = UnionOmit<
3583
- WatchContractEventParameters<typeof tip20Abi, 'Burn', true>,
3994
+ WatchContractEventParameters<typeof Abis.tip20, 'Burn', true>,
3584
3995
  'abi' | 'address' | 'batch' | 'eventName' | 'onLogs' | 'strict'
3585
3996
  > & {
3586
3997
  /** Callback to invoke when tokens are burned. */
3587
3998
  onBurn: (args: Args, log: Log) => void
3588
- /** Address or ID of the TIP20 token. @default `usdAddress` */
3999
+ /** Address or ID of the TIP20 token. @default `Addresses.defaultFeeToken` */
3589
4000
  token?: TokenId.TokenIdOrAddress | undefined
3590
4001
  }
3591
4002
  }
@@ -3625,8 +4036,8 @@ export function watchCreate<
3625
4036
  const { onTokenCreated, ...rest } = parameters
3626
4037
  return watchContractEvent(client, {
3627
4038
  ...rest,
3628
- address: tip20FactoryAddress,
3629
- abi: tip20FactoryAbi,
4039
+ address: Addresses.tip20Factory,
4040
+ abi: Abis.tip20Factory,
3630
4041
  eventName: 'TokenCreated',
3631
4042
  onLogs: (logs) => {
3632
4043
  for (const log of logs) onTokenCreated(log.args, log)
@@ -3637,7 +4048,7 @@ export function watchCreate<
3637
4048
 
3638
4049
  export declare namespace watchCreate {
3639
4050
  export type Args = GetEventArgs<
3640
- typeof tip20FactoryAbi,
4051
+ typeof Abis.tip20Factory,
3641
4052
  'TokenCreated',
3642
4053
  { IndexedOnly: false; Required: true }
3643
4054
  >
@@ -3646,12 +4057,16 @@ export declare namespace watchCreate {
3646
4057
  bigint,
3647
4058
  number,
3648
4059
  false,
3649
- ExtractAbiItem<typeof tip20FactoryAbi, 'TokenCreated'>,
4060
+ ExtractAbiItem<typeof Abis.tip20Factory, 'TokenCreated'>,
3650
4061
  true
3651
4062
  >
3652
4063
 
3653
4064
  export type Parameters = UnionOmit<
3654
- WatchContractEventParameters<typeof tip20FactoryAbi, 'TokenCreated', true>,
4065
+ WatchContractEventParameters<
4066
+ typeof Abis.tip20Factory,
4067
+ 'TokenCreated',
4068
+ true
4069
+ >,
3655
4070
  'abi' | 'address' | 'batch' | 'eventName' | 'onLogs' | 'strict'
3656
4071
  > & {
3657
4072
  /** Callback to invoke when a new TIP20 token is created. */
@@ -3688,11 +4103,11 @@ export function watchMint<
3688
4103
  chain extends Chain | undefined,
3689
4104
  account extends Account | undefined,
3690
4105
  >(client: Client<Transport, chain, account>, parameters: watchMint.Parameters) {
3691
- const { onMint, token = usdAddress, ...rest } = parameters
4106
+ const { onMint, token = Addresses.defaultFeeToken, ...rest } = parameters
3692
4107
  return watchContractEvent(client, {
3693
4108
  ...rest,
3694
4109
  address: TokenId.toAddress(token),
3695
- abi: tip20Abi,
4110
+ abi: Abis.tip20,
3696
4111
  eventName: 'Mint',
3697
4112
  onLogs: (logs) => {
3698
4113
  for (const log of logs) onMint(log.args, log)
@@ -3703,7 +4118,7 @@ export function watchMint<
3703
4118
 
3704
4119
  export declare namespace watchMint {
3705
4120
  export type Args = GetEventArgs<
3706
- typeof tip20Abi,
4121
+ typeof Abis.tip20,
3707
4122
  'Mint',
3708
4123
  { IndexedOnly: false; Required: true }
3709
4124
  >
@@ -3712,17 +4127,17 @@ export declare namespace watchMint {
3712
4127
  bigint,
3713
4128
  number,
3714
4129
  false,
3715
- ExtractAbiItem<typeof tip20Abi, 'Mint'>,
4130
+ ExtractAbiItem<typeof Abis.tip20, 'Mint'>,
3716
4131
  true
3717
4132
  >
3718
4133
 
3719
4134
  export type Parameters = UnionOmit<
3720
- WatchContractEventParameters<typeof tip20Abi, 'Mint', true>,
4135
+ WatchContractEventParameters<typeof Abis.tip20, 'Mint', true>,
3721
4136
  'abi' | 'address' | 'batch' | 'eventName' | 'onLogs' | 'strict'
3722
4137
  > & {
3723
4138
  /** Callback to invoke when tokens are minted. */
3724
4139
  onMint: (args: Args, log: Log) => void
3725
- /** Address or ID of the TIP20 token. @default `usdAddress` */
4140
+ /** Address or ID of the TIP20 token. @default `Addresses.defaultFeeToken` */
3726
4141
  token?: TokenId.TokenIdOrAddress | undefined
3727
4142
  }
3728
4143
  }
@@ -3759,11 +4174,15 @@ export function watchAdminRole<
3759
4174
  client: Client<Transport, chain, account>,
3760
4175
  parameters: watchAdminRole.Parameters,
3761
4176
  ) {
3762
- const { onRoleAdminUpdated, token = usdAddress, ...rest } = parameters
4177
+ const {
4178
+ onRoleAdminUpdated,
4179
+ token = Addresses.defaultFeeToken,
4180
+ ...rest
4181
+ } = parameters
3763
4182
  return watchContractEvent(client, {
3764
4183
  ...rest,
3765
4184
  address: TokenId.toAddress(token),
3766
- abi: tip20Abi,
4185
+ abi: Abis.tip20,
3767
4186
  eventName: 'RoleAdminUpdated',
3768
4187
  onLogs: (logs) => {
3769
4188
  for (const log of logs) onRoleAdminUpdated(log.args, log)
@@ -3774,7 +4193,7 @@ export function watchAdminRole<
3774
4193
 
3775
4194
  export declare namespace watchAdminRole {
3776
4195
  export type Args = GetEventArgs<
3777
- typeof tip20Abi,
4196
+ typeof Abis.tip20,
3778
4197
  'RoleAdminUpdated',
3779
4198
  { IndexedOnly: false; Required: true }
3780
4199
  >
@@ -3783,17 +4202,17 @@ export declare namespace watchAdminRole {
3783
4202
  bigint,
3784
4203
  number,
3785
4204
  false,
3786
- ExtractAbiItem<typeof tip20Abi, 'RoleAdminUpdated'>,
4205
+ ExtractAbiItem<typeof Abis.tip20, 'RoleAdminUpdated'>,
3787
4206
  true
3788
4207
  >
3789
4208
 
3790
4209
  export type Parameters = UnionOmit<
3791
- WatchContractEventParameters<typeof tip20Abi, 'RoleAdminUpdated', true>,
4210
+ WatchContractEventParameters<typeof Abis.tip20, 'RoleAdminUpdated', true>,
3792
4211
  'abi' | 'address' | 'batch' | 'eventName' | 'onLogs' | 'strict'
3793
4212
  > & {
3794
4213
  /** Callback to invoke when a role admin is updated. */
3795
4214
  onRoleAdminUpdated: (args: Args, log: Log) => void
3796
- /** Address or ID of the TIP20 token. @default `usdAddress` */
4215
+ /** Address or ID of the TIP20 token. @default `Addresses.defaultFeeToken` */
3797
4216
  token?: TokenId.TokenIdOrAddress | undefined
3798
4217
  }
3799
4218
  }
@@ -3827,11 +4246,15 @@ export function watchRole<
3827
4246
  chain extends Chain | undefined,
3828
4247
  account extends Account | undefined,
3829
4248
  >(client: Client<Transport, chain, account>, parameters: watchRole.Parameters) {
3830
- const { onRoleUpdated, token = usdAddress, ...rest } = parameters
4249
+ const {
4250
+ onRoleUpdated,
4251
+ token = Addresses.defaultFeeToken,
4252
+ ...rest
4253
+ } = parameters
3831
4254
  return watchContractEvent(client, {
3832
4255
  ...rest,
3833
4256
  address: TokenId.toAddress(token),
3834
- abi: tip20Abi,
4257
+ abi: Abis.tip20,
3835
4258
  eventName: 'RoleMembershipUpdated',
3836
4259
  onLogs: (logs) => {
3837
4260
  for (const log of logs) {
@@ -3845,7 +4268,7 @@ export function watchRole<
3845
4268
 
3846
4269
  export declare namespace watchRole {
3847
4270
  export type Args = GetEventArgs<
3848
- typeof tip20Abi,
4271
+ typeof Abis.tip20,
3849
4272
  'RoleMembershipUpdated',
3850
4273
  { IndexedOnly: false; Required: true }
3851
4274
  > & {
@@ -3857,13 +4280,13 @@ export declare namespace watchRole {
3857
4280
  bigint,
3858
4281
  number,
3859
4282
  false,
3860
- ExtractAbiItem<typeof tip20Abi, 'RoleMembershipUpdated'>,
4283
+ ExtractAbiItem<typeof Abis.tip20, 'RoleMembershipUpdated'>,
3861
4284
  true
3862
4285
  >
3863
4286
 
3864
4287
  export type Parameters = UnionOmit<
3865
4288
  WatchContractEventParameters<
3866
- typeof tip20Abi,
4289
+ typeof Abis.tip20,
3867
4290
  'RoleMembershipUpdated',
3868
4291
  true
3869
4292
  >,
@@ -3871,7 +4294,7 @@ export declare namespace watchRole {
3871
4294
  > & {
3872
4295
  /** Callback to invoke when a role membership is updated. */
3873
4296
  onRoleUpdated: (args: Args, log: Log) => void
3874
- /** Address or ID of the TIP20 token. @default `usdAddress` */
4297
+ /** Address or ID of the TIP20 token. @default `Addresses.defaultFeeToken` */
3875
4298
  token?: TokenId.TokenIdOrAddress | undefined
3876
4299
  }
3877
4300
  }
@@ -3909,11 +4332,11 @@ export function watchTransfer<
3909
4332
  client: Client<Transport, chain, account>,
3910
4333
  parameters: watchTransfer.Parameters,
3911
4334
  ) {
3912
- const { onTransfer, token = usdAddress, ...rest } = parameters
4335
+ const { onTransfer, token = Addresses.defaultFeeToken, ...rest } = parameters
3913
4336
  return watchContractEvent(client, {
3914
4337
  ...rest,
3915
4338
  address: TokenId.toAddress(token),
3916
- abi: tip20Abi,
4339
+ abi: Abis.tip20,
3917
4340
  eventName: 'Transfer',
3918
4341
  onLogs: (logs) => {
3919
4342
  for (const log of logs) onTransfer(log.args, log)
@@ -3924,7 +4347,7 @@ export function watchTransfer<
3924
4347
 
3925
4348
  export declare namespace watchTransfer {
3926
4349
  export type Args = GetEventArgs<
3927
- typeof tip20Abi,
4350
+ typeof Abis.tip20,
3928
4351
  'Transfer',
3929
4352
  { IndexedOnly: false; Required: true }
3930
4353
  >
@@ -3933,17 +4356,125 @@ export declare namespace watchTransfer {
3933
4356
  bigint,
3934
4357
  number,
3935
4358
  false,
3936
- ExtractAbiItem<typeof tip20Abi, 'Transfer'>,
4359
+ ExtractAbiItem<typeof Abis.tip20, 'Transfer'>,
3937
4360
  true
3938
4361
  >
3939
4362
 
3940
4363
  export type Parameters = UnionOmit<
3941
- WatchContractEventParameters<typeof tip20Abi, 'Transfer', true>,
4364
+ WatchContractEventParameters<typeof Abis.tip20, 'Transfer', true>,
3942
4365
  'abi' | 'address' | 'batch' | 'eventName' | 'onLogs' | 'strict'
3943
4366
  > & {
3944
4367
  /** Callback to invoke when tokens are transferred. */
3945
4368
  onTransfer: (args: Args, log: Log) => void
3946
- /** Address or ID of the TIP20 token. @default `usdAddress` */
4369
+ /** Address or ID of the TIP20 token. @default `Addresses.defaultFeeToken` */
4370
+ token?: TokenId.TokenIdOrAddress | undefined
4371
+ }
4372
+ }
4373
+
4374
+ /**
4375
+ * Watches for TIP20 token quote token update events.
4376
+ *
4377
+ * @example
4378
+ * ```ts
4379
+ * import { createClient, http } from 'viem'
4380
+ * import { tempo } from 'tempo.ts/chains'
4381
+ * import * as actions from 'tempo.ts/viem/actions'
4382
+ *
4383
+ * const client = createClient({
4384
+ * chain: tempo,
4385
+ * transport: http(),
4386
+ * })
4387
+ *
4388
+ * const unwatch = actions.token.watchUpdateQuoteToken(client, {
4389
+ * onUpdateQuoteToken: (args, log) => {
4390
+ * if (args.finalized)
4391
+ * console.log('quote token update finalized:', args.newQuoteToken)
4392
+ * else
4393
+ * console.log('quote token update proposed:', args.newQuoteToken)
4394
+ * },
4395
+ * })
4396
+ * ```
4397
+ *
4398
+ * @param client - Client.
4399
+ * @param parameters - Parameters.
4400
+ * @returns A function to unsubscribe from the event.
4401
+ */
4402
+ export function watchUpdateQuoteToken<
4403
+ chain extends Chain | undefined,
4404
+ account extends Account | undefined,
4405
+ >(
4406
+ client: Client<Transport, chain, account>,
4407
+ parameters: watchUpdateQuoteToken.Parameters,
4408
+ ) {
4409
+ const {
4410
+ onUpdateQuoteToken,
4411
+ token = Addresses.defaultFeeToken,
4412
+ ...rest
4413
+ } = parameters
4414
+ const address = TokenId.toAddress(token)
4415
+
4416
+ return watchContractEvent(client, {
4417
+ ...rest,
4418
+ address,
4419
+ abi: Abis.tip20,
4420
+ onLogs: (
4421
+ logs: viem_Log<
4422
+ bigint,
4423
+ number,
4424
+ false,
4425
+ ExtractAbiItem<
4426
+ typeof Abis.tip20,
4427
+ 'UpdateQuoteToken' | 'QuoteTokenUpdateFinalized'
4428
+ >,
4429
+ true
4430
+ >[],
4431
+ ) => {
4432
+ for (const log of logs) {
4433
+ if (
4434
+ log.eventName !== 'UpdateQuoteToken' &&
4435
+ log.eventName !== 'QuoteTokenUpdateFinalized'
4436
+ )
4437
+ continue
4438
+
4439
+ onUpdateQuoteToken(
4440
+ {
4441
+ ...log.args,
4442
+ finalized: log.eventName === 'QuoteTokenUpdateFinalized',
4443
+ },
4444
+ log,
4445
+ )
4446
+ }
4447
+ },
4448
+ strict: true,
4449
+ } as never)
4450
+ }
4451
+
4452
+ export declare namespace watchUpdateQuoteToken {
4453
+ export type Args = OneOf<
4454
+ | GetEventArgs<
4455
+ typeof Abis.tip20,
4456
+ 'UpdateQuoteToken',
4457
+ { IndexedOnly: false; Required: true }
4458
+ >
4459
+ | GetEventArgs<
4460
+ typeof Abis.tip20,
4461
+ 'QuoteTokenUpdateFinalized',
4462
+ { IndexedOnly: false; Required: true }
4463
+ >
4464
+ > & {
4465
+ /** Whether the update has been finalized. */
4466
+ finalized: boolean
4467
+ }
4468
+
4469
+ export type Log = viem_Log
4470
+
4471
+ export type Parameters = UnionOmit<
4472
+ WatchContractEventParameters<typeof Abis.tip20, any, true>,
4473
+ 'abi' | 'address' | 'batch' | 'eventName' | 'onLogs' | 'strict'
4474
+ > & {
4475
+ /** Callback to invoke when a quote token update is proposed or finalized. */
4476
+ onUpdateQuoteToken: (args: Args, log: Log) => void
4477
+ /** Address or ID of the TIP20 token. @default `Addresses.defaultFeeToken` */
3947
4478
  token?: TokenId.TokenIdOrAddress | undefined
3948
4479
  }
3949
4480
  }