tempo.ts 0.0.6 → 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 +3250 -700
  59. package/dist/viem/Actions/token.d.ts.map +1 -0
  60. package/dist/viem/{actions → Actions}/token.js +419 -83
  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 +403 -64
  130. package/src/viem/{actions → Actions}/token.ts +672 -133
  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
@@ -28,17 +28,17 @@ import {
28
28
  writeContract,
29
29
  writeContractSync,
30
30
  } from 'viem/actions'
31
- import type { Compute, UnionOmit } from '../../internal/types.js'
31
+ import type { Compute, OneOf, UnionOmit } from '../../internal/types.js'
32
32
  import * as TokenId from '../../ox/TokenId.js'
33
33
  import * as TokenRole from '../../ox/TokenRole.js'
34
- import { tip20Abi, tip20FactoryAbi } from '../abis.js'
35
- import { tip20FactoryAddress, usdAddress } from '../addresses.js'
34
+ import * as Abis from '../Abis.js'
35
+ import * as Addresses from '../Addresses.js'
36
36
  import type {
37
37
  GetAccountParameter,
38
38
  ReadParameters,
39
39
  WriteParameters,
40
- } from '../types.js'
41
- import { defineCall } from '../utils.js'
40
+ } from '../internal/types.js'
41
+ import { defineCall } from '../internal/utils.js'
42
42
 
43
43
  /**
44
44
  * Approves a spender to transfer TIP20 tokens on behalf of the caller.
@@ -73,7 +73,7 @@ export async function approve<
73
73
  client: Client<Transport, chain, account>,
74
74
  parameters: approve.Parameters<chain, account>,
75
75
  ): Promise<approve.ReturnValue> {
76
- const { token = usdAddress, ...rest } = parameters
76
+ const { token = Addresses.defaultFeeToken, ...rest } = parameters
77
77
  return approve.inner(writeContract, client, parameters, { ...rest, token })
78
78
  }
79
79
 
@@ -88,7 +88,7 @@ export namespace approve {
88
88
  amount: bigint
89
89
  /** Address of the spender. */
90
90
  spender: Address
91
- /** Address or ID of the TIP20 token. @default `usdAddress` */
91
+ /** Address or ID of the TIP20 token. @default `Addresses.defaultFeeToken` */
92
92
  token?: TokenId.TokenIdOrAddress | undefined
93
93
  }
94
94
 
@@ -146,10 +146,10 @@ export namespace approve {
146
146
  * @returns The call.
147
147
  */
148
148
  export function call(args: Args) {
149
- const { spender, amount, token = usdAddress } = args
149
+ const { spender, amount, token = Addresses.defaultFeeToken } = args
150
150
  return defineCall({
151
151
  address: TokenId.toAddress(token),
152
- abi: tip20Abi,
152
+ abi: Abis.tip20,
153
153
  functionName: 'approve',
154
154
  args: [spender, amount],
155
155
  })
@@ -157,7 +157,7 @@ export namespace approve {
157
157
 
158
158
  export function extractEvent(logs: Log[]) {
159
159
  const [log] = parseEventLogs({
160
- abi: tip20Abi,
160
+ abi: Abis.tip20,
161
161
  logs,
162
162
  eventName: 'Approval',
163
163
  })
@@ -201,7 +201,7 @@ export async function approveSync<
201
201
  ): Promise<approveSync.ReturnValue> {
202
202
  const {
203
203
  throwOnReceiptRevert = true,
204
- token = usdAddress,
204
+ token = Addresses.defaultFeeToken,
205
205
  ...rest
206
206
  } = parameters
207
207
  const receipt = await approve.inner(
@@ -230,7 +230,7 @@ export namespace approveSync {
230
230
 
231
231
  export type ReturnValue = Compute<
232
232
  GetEventArgs<
233
- typeof tip20Abi,
233
+ typeof Abis.tip20,
234
234
  'Approval',
235
235
  {
236
236
  IndexedOnly: false
@@ -307,9 +307,10 @@ export namespace burnBlocked {
307
307
  client: Client<Transport, chain, account>,
308
308
  parameters: burnBlocked.Parameters<chain, account>,
309
309
  ): Promise<ReturnType<action>> {
310
- const call = burnBlocked.call(parameters)
310
+ const { amount, from, token, ...rest } = parameters
311
+ const call = burnBlocked.call({ amount, from, token })
311
312
  return (await action(client, {
312
- ...parameters,
313
+ ...rest,
313
314
  ...call,
314
315
  } as never)) as never
315
316
  }
@@ -351,7 +352,7 @@ export namespace burnBlocked {
351
352
  const { from, amount, token } = args
352
353
  return defineCall({
353
354
  address: TokenId.toAddress(token),
354
- abi: tip20Abi,
355
+ abi: Abis.tip20,
355
356
  functionName: 'burnBlocked',
356
357
  args: [from, amount],
357
358
  })
@@ -365,7 +366,7 @@ export namespace burnBlocked {
365
366
  */
366
367
  export function extractEvent(logs: Log[]) {
367
368
  const [log] = parseEventLogs({
368
- abi: tip20Abi,
369
+ abi: Abis.tip20,
369
370
  logs,
370
371
  eventName: 'BurnBlocked',
371
372
  })
@@ -430,7 +431,7 @@ export namespace burnBlockedSync {
430
431
 
431
432
  export type ReturnValue = Compute<
432
433
  GetEventArgs<
433
- typeof tip20Abi,
434
+ typeof Abis.tip20,
434
435
  'BurnBlocked',
435
436
  {
436
437
  IndexedOnly: false
@@ -506,9 +507,10 @@ export namespace burn {
506
507
  client: Client<Transport, chain, account>,
507
508
  parameters: burn.Parameters<chain, account>,
508
509
  ): Promise<ReturnType<action>> {
509
- const call = burn.call(parameters)
510
+ const { amount, memo, token, ...rest } = parameters
511
+ const call = burn.call({ amount, memo, token })
510
512
  return (await action(client, {
511
- ...parameters,
513
+ ...rest,
512
514
  ...call,
513
515
  } as never)) as never
514
516
  }
@@ -558,7 +560,7 @@ export namespace burn {
558
560
  } as const)
559
561
  return defineCall({
560
562
  address: TokenId.toAddress(token),
561
- abi: tip20Abi,
563
+ abi: Abis.tip20,
562
564
  ...callArgs,
563
565
  })
564
566
  }
@@ -571,7 +573,7 @@ export namespace burn {
571
573
  */
572
574
  export function extractEvent(logs: Log[]) {
573
575
  const [log] = parseEventLogs({
574
- abi: tip20Abi,
576
+ abi: Abis.tip20,
575
577
  logs,
576
578
  eventName: 'Burn',
577
579
  })
@@ -635,7 +637,7 @@ export namespace burnSync {
635
637
 
636
638
  export type ReturnValue = Compute<
637
639
  GetEventArgs<
638
- typeof tip20Abi,
640
+ typeof Abis.tip20,
639
641
  'Burn',
640
642
  {
641
643
  IndexedOnly: false
@@ -708,9 +710,10 @@ export namespace changeTransferPolicy {
708
710
  client: Client<Transport, chain, account>,
709
711
  parameters: changeTransferPolicy.Parameters<chain, account>,
710
712
  ): Promise<ReturnType<action>> {
711
- const call = changeTransferPolicy.call(parameters)
713
+ const { policyId, token, ...rest } = parameters
714
+ const call = changeTransferPolicy.call({ policyId, token })
712
715
  return (await action(client, {
713
- ...parameters,
716
+ ...rest,
714
717
  ...call,
715
718
  } as never)) as never
716
719
  }
@@ -751,7 +754,7 @@ export namespace changeTransferPolicy {
751
754
  const { token, policyId } = args
752
755
  return defineCall({
753
756
  address: TokenId.toAddress(token),
754
- abi: tip20Abi,
757
+ abi: Abis.tip20,
755
758
  functionName: 'changeTransferPolicyId',
756
759
  args: [policyId],
757
760
  })
@@ -765,7 +768,7 @@ export namespace changeTransferPolicy {
765
768
  */
766
769
  export function extractEvent(logs: Log[]) {
767
770
  const [log] = parseEventLogs({
768
- abi: tip20Abi,
771
+ abi: Abis.tip20,
769
772
  logs,
770
773
  eventName: 'TransferPolicyUpdate',
771
774
  })
@@ -829,7 +832,7 @@ export namespace changeTransferPolicySync {
829
832
 
830
833
  export type ReturnValue = Compute<
831
834
  GetEventArgs<
832
- typeof tip20Abi,
835
+ typeof Abis.tip20,
833
836
  'TransferPolicyUpdate',
834
837
  {
835
838
  IndexedOnly: false
@@ -895,6 +898,8 @@ export namespace create {
895
898
  currency: string
896
899
  /** Token name. */
897
900
  name: string
901
+ /** quote token. */
902
+ quoteToken?: TokenId.TokenIdOrAddress | undefined
898
903
  /** Token symbol. */
899
904
  symbol: string
900
905
  }
@@ -968,11 +973,17 @@ export namespace create {
968
973
  * @returns The call.
969
974
  */
970
975
  export function call(args: Args) {
971
- const { name, symbol, currency, admin } = args
976
+ const {
977
+ name,
978
+ symbol,
979
+ currency,
980
+ quoteToken = Addresses.defaultQuoteToken,
981
+ admin,
982
+ } = args
972
983
  return defineCall({
973
- address: tip20FactoryAddress,
974
- abi: tip20FactoryAbi,
975
- args: [name, symbol, currency, admin],
984
+ address: Addresses.tip20Factory,
985
+ abi: Abis.tip20Factory,
986
+ args: [name, symbol, currency, TokenId.toAddress(quoteToken), admin],
976
987
  functionName: 'createToken',
977
988
  })
978
989
  }
@@ -985,7 +996,7 @@ export namespace create {
985
996
  */
986
997
  export function extractEvent(logs: Log[]) {
987
998
  const [log] = parseEventLogs({
988
- abi: tip20FactoryAbi,
999
+ abi: Abis.tip20Factory,
989
1000
  logs,
990
1001
  eventName: 'TokenCreated',
991
1002
  strict: true,
@@ -1053,7 +1064,7 @@ export namespace createSync {
1053
1064
 
1054
1065
  export type ReturnValue = Compute<
1055
1066
  GetEventArgs<
1056
- typeof tip20FactoryAbi,
1067
+ typeof Abis.tip20Factory,
1057
1068
  'TokenCreated',
1058
1069
  { IndexedOnly: false; Required: true }
1059
1070
  > & {
@@ -1063,6 +1074,196 @@ export namespace createSync {
1063
1074
  >
1064
1075
  }
1065
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
+
1066
1267
  /**
1067
1268
  * Gets TIP20 token allowance.
1068
1269
  *
@@ -1114,12 +1315,12 @@ export namespace getAllowance {
1114
1315
  account: Address
1115
1316
  /** Address of the spender. */
1116
1317
  spender: Address
1117
- /** Address or ID of the TIP20 token. @default `usdAddress` */
1318
+ /** Address or ID of the TIP20 token. @default `Addresses.defaultFeeToken` */
1118
1319
  token?: TokenId.TokenIdOrAddress | undefined
1119
1320
  }
1120
1321
 
1121
1322
  export type ReturnValue = ReadContractReturnType<
1122
- typeof tip20Abi,
1323
+ typeof Abis.tip20,
1123
1324
  'allowance',
1124
1325
  never
1125
1326
  >
@@ -1131,10 +1332,10 @@ export namespace getAllowance {
1131
1332
  * @returns The call.
1132
1333
  */
1133
1334
  export function call(args: Args) {
1134
- const { account, spender, token = usdAddress } = args
1335
+ const { account, spender, token = Addresses.defaultFeeToken } = args
1135
1336
  return defineCall({
1136
1337
  address: TokenId.toAddress(token),
1137
- abi: tip20Abi,
1338
+ abi: Abis.tip20,
1138
1339
  functionName: 'allowance',
1139
1340
  args: [account, spender],
1140
1341
  })
@@ -1192,12 +1393,12 @@ export namespace getBalance {
1192
1393
  export type Args = {
1193
1394
  /** Account address. */
1194
1395
  account: Address
1195
- /** Address or ID of the TIP20 token. @default `usdAddress` */
1396
+ /** Address or ID of the TIP20 token. @default `Addresses.defaultFeeToken` */
1196
1397
  token?: TokenId.TokenIdOrAddress | undefined
1197
1398
  }
1198
1399
 
1199
1400
  export type ReturnValue = ReadContractReturnType<
1200
- typeof tip20Abi,
1401
+ typeof Abis.tip20,
1201
1402
  'balanceOf',
1202
1403
  never
1203
1404
  >
@@ -1209,10 +1410,10 @@ export namespace getBalance {
1209
1410
  * @returns The call.
1210
1411
  */
1211
1412
  export function call(args: Args) {
1212
- const { account, token = usdAddress } = args
1413
+ const { account, token = Addresses.defaultFeeToken } = args
1213
1414
  return defineCall({
1214
1415
  address: TokenId.toAddress(token),
1215
- abi: tip20Abi,
1416
+ abi: Abis.tip20,
1216
1417
  functionName: 'balanceOf',
1217
1418
  args: [account],
1218
1419
  })
@@ -1248,9 +1449,9 @@ export async function getMetadata<chain extends Chain | undefined>(
1248
1449
  client: Client<Transport, chain>,
1249
1450
  parameters: getMetadata.Parameters = {},
1250
1451
  ): Promise<getMetadata.ReturnValue> {
1251
- const { token = usdAddress, ...rest } = parameters
1452
+ const { token = Addresses.defaultFeeToken, ...rest } = parameters
1252
1453
  const address = TokenId.toAddress(token)
1253
- const abi = tip20Abi
1454
+ const abi = Abis.tip20
1254
1455
  return multicall(client, {
1255
1456
  ...rest,
1256
1457
  contracts: [
@@ -1264,6 +1465,11 @@ export async function getMetadata<chain extends Chain | undefined>(
1264
1465
  abi,
1265
1466
  functionName: 'decimals',
1266
1467
  },
1468
+ {
1469
+ address,
1470
+ abi,
1471
+ functionName: 'quoteToken',
1472
+ },
1267
1473
  {
1268
1474
  address,
1269
1475
  abi,
@@ -1301,6 +1507,7 @@ export async function getMetadata<chain extends Chain | undefined>(
1301
1507
  ([
1302
1508
  currency,
1303
1509
  decimals,
1510
+ quoteToken,
1304
1511
  name,
1305
1512
  paused,
1306
1513
  supplyCap,
@@ -1312,6 +1519,7 @@ export async function getMetadata<chain extends Chain | undefined>(
1312
1519
  symbol,
1313
1520
  currency,
1314
1521
  decimals,
1522
+ quoteToken,
1315
1523
  totalSupply,
1316
1524
  paused,
1317
1525
  supplyCap,
@@ -1322,7 +1530,7 @@ export async function getMetadata<chain extends Chain | undefined>(
1322
1530
 
1323
1531
  export declare namespace getMetadata {
1324
1532
  export type Parameters = {
1325
- /** Address or ID of the TIP20 token. @default `usdAddress` */
1533
+ /** Address or ID of the TIP20 token. @default `Addresses.defaultFeeToken` */
1326
1534
  token?: TokenId.TokenIdOrAddress | undefined
1327
1535
  }
1328
1536
 
@@ -1331,6 +1539,8 @@ export declare namespace getMetadata {
1331
1539
  currency: string
1332
1540
  /** Decimals. */
1333
1541
  decimals: number
1542
+ /** quote token. */
1543
+ quoteToken: Address
1334
1544
  /** Name. */
1335
1545
  name: string
1336
1546
  /** Whether the token is paused. */
@@ -1402,7 +1612,7 @@ export namespace hasRole {
1402
1612
  }
1403
1613
 
1404
1614
  export type ReturnValue = ReadContractReturnType<
1405
- typeof tip20Abi,
1615
+ typeof Abis.tip20,
1406
1616
  'hasRole',
1407
1617
  never
1408
1618
  >
@@ -1417,7 +1627,7 @@ export namespace hasRole {
1417
1627
  const { account, role, token } = args
1418
1628
  return defineCall({
1419
1629
  address: TokenId.toAddress(token),
1420
- abi: tip20Abi,
1630
+ abi: Abis.tip20,
1421
1631
  functionName: 'hasRole',
1422
1632
  args: [account, TokenRole.serialize(role)],
1423
1633
  })
@@ -1542,7 +1752,7 @@ export namespace grantRoles {
1542
1752
  const roleHash = TokenRole.serialize(role)
1543
1753
  return defineCall({
1544
1754
  address: TokenId.toAddress(token),
1545
- abi: tip20Abi,
1755
+ abi: Abis.tip20,
1546
1756
  functionName: 'grantRole',
1547
1757
  args: [roleHash, to],
1548
1758
  })
@@ -1556,7 +1766,7 @@ export namespace grantRoles {
1556
1766
  */
1557
1767
  export function extractEvents(logs: Log[]) {
1558
1768
  const events = parseEventLogs({
1559
- abi: tip20Abi,
1769
+ abi: Abis.tip20,
1560
1770
  logs,
1561
1771
  eventName: 'RoleMembershipUpdated',
1562
1772
  })
@@ -1624,7 +1834,7 @@ export namespace grantRolesSync {
1624
1834
  export type ReturnValue = {
1625
1835
  receipt: TransactionReceipt
1626
1836
  value: readonly GetEventArgs<
1627
- typeof tip20Abi,
1837
+ typeof Abis.tip20,
1628
1838
  'RoleMembershipUpdated',
1629
1839
  { IndexedOnly: false; Required: true }
1630
1840
  >[]
@@ -1751,7 +1961,7 @@ export namespace mint {
1751
1961
  } as const)
1752
1962
  return defineCall({
1753
1963
  address: TokenId.toAddress(token),
1754
- abi: tip20Abi,
1964
+ abi: Abis.tip20,
1755
1965
  ...callArgs,
1756
1966
  })
1757
1967
  }
@@ -1764,7 +1974,7 @@ export namespace mint {
1764
1974
  */
1765
1975
  export function extractEvent(logs: Log[]) {
1766
1976
  const [log] = parseEventLogs({
1767
- abi: tip20Abi,
1977
+ abi: Abis.tip20,
1768
1978
  logs,
1769
1979
  eventName: 'Mint',
1770
1980
  })
@@ -1829,7 +2039,7 @@ export namespace mintSync {
1829
2039
 
1830
2040
  export type ReturnValue = Compute<
1831
2041
  GetEventArgs<
1832
- typeof tip20Abi,
2042
+ typeof Abis.tip20,
1833
2043
  'Mint',
1834
2044
  {
1835
2045
  IndexedOnly: false
@@ -1899,9 +2109,10 @@ export namespace pause {
1899
2109
  client: Client<Transport, chain, account>,
1900
2110
  parameters: pause.Parameters<chain, account>,
1901
2111
  ): Promise<ReturnType<action>> {
1902
- const call = pause.call(parameters)
2112
+ const { token, ...rest } = parameters
2113
+ const call = pause.call({ token })
1903
2114
  return (await action(client, {
1904
- ...parameters,
2115
+ ...rest,
1905
2116
  ...call,
1906
2117
  } as never)) as never
1907
2118
  }
@@ -1941,7 +2152,7 @@ export namespace pause {
1941
2152
  const { token } = args
1942
2153
  return defineCall({
1943
2154
  address: TokenId.toAddress(token),
1944
- abi: tip20Abi,
2155
+ abi: Abis.tip20,
1945
2156
  functionName: 'pause',
1946
2157
  args: [],
1947
2158
  })
@@ -1955,7 +2166,7 @@ export namespace pause {
1955
2166
  */
1956
2167
  export function extractEvent(logs: Log[]) {
1957
2168
  const [log] = parseEventLogs({
1958
- abi: tip20Abi,
2169
+ abi: Abis.tip20,
1959
2170
  logs,
1960
2171
  eventName: 'PauseStateUpdate',
1961
2172
  })
@@ -2017,7 +2228,7 @@ export namespace pauseSync {
2017
2228
  export type Args = pause.Args
2018
2229
 
2019
2230
  export type ReturnValue = GetEventArgs<
2020
- typeof tip20Abi,
2231
+ typeof Abis.tip20,
2021
2232
  'PauseStateUpdate',
2022
2233
  { IndexedOnly: false; Required: true }
2023
2234
  > & {
@@ -2079,7 +2290,7 @@ export namespace permit {
2079
2290
  signature: Signature.Signature
2080
2291
  /** Address of the spender. */
2081
2292
  spender: Address
2082
- /** Address or ID of the TIP20 token. @default `usdAddress` */
2293
+ /** Address or ID of the TIP20 token. @default `Addresses.defaultFeeToken` */
2083
2294
  token?: TokenId.TokenIdOrAddress | undefined
2084
2295
  /** Amount to approve. */
2085
2296
  value: bigint
@@ -2097,9 +2308,18 @@ export namespace permit {
2097
2308
  client: Client<Transport, chain, account>,
2098
2309
  parameters: permit.Parameters<chain, account>,
2099
2310
  ): Promise<ReturnType<action>> {
2100
- 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
+ })
2101
2321
  return (await action(client, {
2102
- ...parameters,
2322
+ ...rest,
2103
2323
  ...call,
2104
2324
  } as never)) as never
2105
2325
  }
@@ -2147,13 +2367,13 @@ export namespace permit {
2147
2367
  value,
2148
2368
  deadline,
2149
2369
  signature,
2150
- token = usdAddress,
2370
+ token = Addresses.defaultFeeToken,
2151
2371
  } = args
2152
2372
  const { r, s, yParity } = Signature.from(signature)
2153
2373
  const v = Signature.yParityToV(yParity)
2154
2374
  return defineCall({
2155
2375
  address: TokenId.toAddress(token),
2156
- abi: tip20Abi,
2376
+ abi: Abis.tip20,
2157
2377
  functionName: 'permit',
2158
2378
  args: [
2159
2379
  owner,
@@ -2175,7 +2395,7 @@ export namespace permit {
2175
2395
  */
2176
2396
  export function extractEvent(logs: Log[]) {
2177
2397
  const [log] = parseEventLogs({
2178
- abi: tip20Abi,
2398
+ abi: Abis.tip20,
2179
2399
  logs,
2180
2400
  eventName: 'Approval',
2181
2401
  })
@@ -2241,7 +2461,7 @@ export namespace permitSync {
2241
2461
  export type Args = permit.Args
2242
2462
 
2243
2463
  export type ReturnValue = GetEventArgs<
2244
- typeof tip20Abi,
2464
+ typeof Abis.tip20,
2245
2465
  'Approval',
2246
2466
  { IndexedOnly: false; Required: true }
2247
2467
  > & {
@@ -2363,7 +2583,7 @@ export namespace renounceRoles {
2363
2583
  const roleHash = TokenRole.serialize(role)
2364
2584
  return defineCall({
2365
2585
  address: TokenId.toAddress(token),
2366
- abi: tip20Abi,
2586
+ abi: Abis.tip20,
2367
2587
  functionName: 'renounceRole',
2368
2588
  args: [roleHash],
2369
2589
  })
@@ -2377,7 +2597,7 @@ export namespace renounceRoles {
2377
2597
  */
2378
2598
  export function extractEvents(logs: Log[]) {
2379
2599
  const events = parseEventLogs({
2380
- abi: tip20Abi,
2600
+ abi: Abis.tip20,
2381
2601
  logs,
2382
2602
  eventName: 'RoleMembershipUpdated',
2383
2603
  })
@@ -2444,7 +2664,7 @@ export namespace renounceRolesSync {
2444
2664
  export type ReturnValue = {
2445
2665
  receipt: TransactionReceipt
2446
2666
  value: readonly GetEventArgs<
2447
- typeof tip20Abi,
2667
+ typeof Abis.tip20,
2448
2668
  'RoleMembershipUpdated',
2449
2669
  { IndexedOnly: false; Required: true }
2450
2670
  >[]
@@ -2569,7 +2789,7 @@ export namespace revokeRoles {
2569
2789
  const roleHash = TokenRole.serialize(role)
2570
2790
  return defineCall({
2571
2791
  address: TokenId.toAddress(token),
2572
- abi: tip20Abi,
2792
+ abi: Abis.tip20,
2573
2793
  functionName: 'revokeRole',
2574
2794
  args: [roleHash, from],
2575
2795
  })
@@ -2583,7 +2803,7 @@ export namespace revokeRoles {
2583
2803
  */
2584
2804
  export function extractEvents(logs: Log[]) {
2585
2805
  const events = parseEventLogs({
2586
- abi: tip20Abi,
2806
+ abi: Abis.tip20,
2587
2807
  logs,
2588
2808
  eventName: 'RoleMembershipUpdated',
2589
2809
  })
@@ -2651,7 +2871,7 @@ export namespace revokeRolesSync {
2651
2871
  export type ReturnValue = {
2652
2872
  receipt: TransactionReceipt
2653
2873
  value: readonly GetEventArgs<
2654
- typeof tip20Abi,
2874
+ typeof Abis.tip20,
2655
2875
  'RoleMembershipUpdated',
2656
2876
  { IndexedOnly: false; Required: true }
2657
2877
  >[]
@@ -2719,9 +2939,10 @@ export namespace setSupplyCap {
2719
2939
  client: Client<Transport, chain, account>,
2720
2940
  parameters: setSupplyCap.Parameters<chain, account>,
2721
2941
  ): Promise<ReturnType<action>> {
2722
- const call = setSupplyCap.call(parameters)
2942
+ const { supplyCap, token, ...rest } = parameters
2943
+ const call = setSupplyCap.call({ supplyCap, token })
2723
2944
  return (await action(client, {
2724
- ...parameters,
2945
+ ...rest,
2725
2946
  ...call,
2726
2947
  } as never)) as never
2727
2948
  }
@@ -2762,7 +2983,7 @@ export namespace setSupplyCap {
2762
2983
  const { token, supplyCap } = args
2763
2984
  return defineCall({
2764
2985
  address: TokenId.toAddress(token),
2765
- abi: tip20Abi,
2986
+ abi: Abis.tip20,
2766
2987
  functionName: 'setSupplyCap',
2767
2988
  args: [supplyCap],
2768
2989
  })
@@ -2776,7 +2997,7 @@ export namespace setSupplyCap {
2776
2997
  */
2777
2998
  export function extractEvent(logs: Log[]) {
2778
2999
  const [log] = parseEventLogs({
2779
- abi: tip20Abi,
3000
+ abi: Abis.tip20,
2780
3001
  logs,
2781
3002
  eventName: 'SupplyCapUpdate',
2782
3003
  })
@@ -2839,7 +3060,7 @@ export namespace setSupplyCapSync {
2839
3060
  export type Args = setSupplyCap.Args
2840
3061
 
2841
3062
  export type ReturnValue = GetEventArgs<
2842
- typeof tip20Abi,
3063
+ typeof Abis.tip20,
2843
3064
  'SupplyCapUpdate',
2844
3065
  { IndexedOnly: false; Required: true }
2845
3066
  > & {
@@ -2911,9 +3132,10 @@ export namespace setRoleAdmin {
2911
3132
  client: Client<Transport, chain, account>,
2912
3133
  parameters: setRoleAdmin.Parameters<chain, account>,
2913
3134
  ): Promise<ReturnType<action>> {
2914
- const call = setRoleAdmin.call(parameters)
3135
+ const { adminRole, role, token, ...rest } = parameters
3136
+ const call = setRoleAdmin.call({ adminRole, role, token })
2915
3137
  return (await action(client, {
2916
- ...parameters,
3138
+ ...rest,
2917
3139
  ...call,
2918
3140
  } as never)) as never
2919
3141
  }
@@ -2957,7 +3179,7 @@ export namespace setRoleAdmin {
2957
3179
  const adminRoleHash = TokenRole.serialize(adminRole)
2958
3180
  return defineCall({
2959
3181
  address: TokenId.toAddress(token),
2960
- abi: tip20Abi,
3182
+ abi: Abis.tip20,
2961
3183
  functionName: 'setRoleAdmin',
2962
3184
  args: [roleHash, adminRoleHash],
2963
3185
  })
@@ -2971,7 +3193,7 @@ export namespace setRoleAdmin {
2971
3193
  */
2972
3194
  export function extractEvent(logs: Log[]) {
2973
3195
  const [log] = parseEventLogs({
2974
- abi: tip20Abi,
3196
+ abi: Abis.tip20,
2975
3197
  logs,
2976
3198
  eventName: 'RoleAdminUpdated',
2977
3199
  })
@@ -3035,7 +3257,7 @@ export namespace setRoleAdminSync {
3035
3257
  export type Args = setRoleAdmin.Args
3036
3258
 
3037
3259
  export type ReturnValue = GetEventArgs<
3038
- typeof tip20Abi,
3260
+ typeof Abis.tip20,
3039
3261
  'RoleAdminUpdated',
3040
3262
  { IndexedOnly: false; Required: true }
3041
3263
  > & {
@@ -3092,7 +3314,7 @@ export namespace transfer {
3092
3314
  from?: Address | undefined
3093
3315
  /** Memo to include in the transfer. */
3094
3316
  memo?: Hex.Hex | undefined
3095
- /** Address or ID of the TIP20 token. @default `usdAddress` */
3317
+ /** Address or ID of the TIP20 token. @default `Addresses.defaultFeeToken` */
3096
3318
  token?: TokenId.TokenIdOrAddress | undefined
3097
3319
  /** Address to transfer tokens to. */
3098
3320
  to: Address
@@ -3110,9 +3332,10 @@ export namespace transfer {
3110
3332
  client: Client<Transport, chain, account>,
3111
3333
  parameters: transfer.Parameters<chain, account>,
3112
3334
  ): Promise<ReturnType<action>> {
3113
- const call = transfer.call(parameters)
3335
+ const { amount, from, memo, token, to, ...rest } = parameters
3336
+ const call = transfer.call({ amount, from, memo, token, to })
3114
3337
  return (await action(client, {
3115
- ...parameters,
3338
+ ...rest,
3116
3339
  ...call,
3117
3340
  } as never)) as never
3118
3341
  }
@@ -3151,7 +3374,7 @@ export namespace transfer {
3151
3374
  * @returns The call.
3152
3375
  */
3153
3376
  export function call(args: Args) {
3154
- const { amount, from, memo, token = usdAddress, to } = args
3377
+ const { amount, from, memo, token = Addresses.defaultFeeToken, to } = args
3155
3378
  const callArgs = (() => {
3156
3379
  if (memo && from)
3157
3380
  return {
@@ -3175,7 +3398,7 @@ export namespace transfer {
3175
3398
  })()
3176
3399
  return defineCall({
3177
3400
  address: TokenId.toAddress(token),
3178
- abi: tip20Abi,
3401
+ abi: Abis.tip20,
3179
3402
  ...callArgs,
3180
3403
  })
3181
3404
  }
@@ -3188,7 +3411,7 @@ export namespace transfer {
3188
3411
  */
3189
3412
  export function extractEvent(logs: Log[]) {
3190
3413
  const [log] = parseEventLogs({
3191
- abi: tip20Abi,
3414
+ abi: Abis.tip20,
3192
3415
  logs,
3193
3416
  eventName: 'Transfer',
3194
3417
  })
@@ -3251,7 +3474,7 @@ export namespace transferSync {
3251
3474
  export type Args = transfer.Args
3252
3475
 
3253
3476
  export type ReturnValue = GetEventArgs<
3254
- typeof tip20Abi,
3477
+ typeof Abis.tip20,
3255
3478
  'Transfer',
3256
3479
  { IndexedOnly: false; Required: true }
3257
3480
  > & {
@@ -3317,9 +3540,10 @@ export namespace unpause {
3317
3540
  client: Client<Transport, chain, account>,
3318
3541
  parameters: unpause.Parameters<chain, account>,
3319
3542
  ): Promise<ReturnType<action>> {
3320
- const call = unpause.call(parameters)
3543
+ const { token, ...rest } = parameters
3544
+ const call = unpause.call({ token })
3321
3545
  return (await action(client, {
3322
- ...parameters,
3546
+ ...rest,
3323
3547
  ...call,
3324
3548
  } as never)) as never
3325
3549
  }
@@ -3359,7 +3583,7 @@ export namespace unpause {
3359
3583
  const { token } = args
3360
3584
  return defineCall({
3361
3585
  address: TokenId.toAddress(token),
3362
- abi: tip20Abi,
3586
+ abi: Abis.tip20,
3363
3587
  functionName: 'unpause',
3364
3588
  args: [],
3365
3589
  })
@@ -3373,7 +3597,7 @@ export namespace unpause {
3373
3597
  */
3374
3598
  export function extractEvent(logs: Log[]) {
3375
3599
  const [log] = parseEventLogs({
3376
- abi: tip20Abi,
3600
+ abi: Abis.tip20,
3377
3601
  logs,
3378
3602
  eventName: 'PauseStateUpdate',
3379
3603
  })
@@ -3435,7 +3659,7 @@ export namespace unpauseSync {
3435
3659
  export type Args = unpause.Args
3436
3660
 
3437
3661
  export type ReturnValue = GetEventArgs<
3438
- typeof tip20Abi,
3662
+ typeof Abis.tip20,
3439
3663
  'PauseStateUpdate',
3440
3664
  { IndexedOnly: false; Required: true }
3441
3665
  > & {
@@ -3443,6 +3667,201 @@ export namespace unpauseSync {
3443
3667
  }
3444
3668
  }
3445
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
+
3446
3865
  /**
3447
3866
  * Watches for TIP20 token approval events.
3448
3867
  *
@@ -3475,11 +3894,11 @@ export function watchApprove<
3475
3894
  client: Client<Transport, chain, account>,
3476
3895
  parameters: watchApprove.Parameters,
3477
3896
  ) {
3478
- const { onApproval, token = usdAddress, ...rest } = parameters
3897
+ const { onApproval, token = Addresses.defaultFeeToken, ...rest } = parameters
3479
3898
  return watchContractEvent(client, {
3480
3899
  ...rest,
3481
3900
  address: TokenId.toAddress(token),
3482
- abi: tip20Abi,
3901
+ abi: Abis.tip20,
3483
3902
  eventName: 'Approval',
3484
3903
  onLogs: (logs) => {
3485
3904
  for (const log of logs) onApproval(log.args, log)
@@ -3490,7 +3909,7 @@ export function watchApprove<
3490
3909
 
3491
3910
  export declare namespace watchApprove {
3492
3911
  export type Args = GetEventArgs<
3493
- typeof tip20Abi,
3912
+ typeof Abis.tip20,
3494
3913
  'Approval',
3495
3914
  { IndexedOnly: false; Required: true }
3496
3915
  >
@@ -3499,17 +3918,17 @@ export declare namespace watchApprove {
3499
3918
  bigint,
3500
3919
  number,
3501
3920
  false,
3502
- ExtractAbiItem<typeof tip20Abi, 'Approval'>,
3921
+ ExtractAbiItem<typeof Abis.tip20, 'Approval'>,
3503
3922
  true
3504
3923
  >
3505
3924
 
3506
3925
  export type Parameters = UnionOmit<
3507
- WatchContractEventParameters<typeof tip20Abi, 'Approval', true>,
3926
+ WatchContractEventParameters<typeof Abis.tip20, 'Approval', true>,
3508
3927
  'abi' | 'address' | 'batch' | 'eventName' | 'onLogs' | 'strict'
3509
3928
  > & {
3510
3929
  /** Callback to invoke when tokens are approved. */
3511
3930
  onApproval: (args: Args, log: Log) => void
3512
- /** Address or ID of the TIP20 token. @default `usdAddress` */
3931
+ /** Address or ID of the TIP20 token. @default `Addresses.defaultFeeToken` */
3513
3932
  token?: TokenId.TokenIdOrAddress | undefined
3514
3933
  }
3515
3934
  }
@@ -3543,11 +3962,11 @@ export function watchBurn<
3543
3962
  chain extends Chain | undefined,
3544
3963
  account extends Account | undefined,
3545
3964
  >(client: Client<Transport, chain, account>, parameters: watchBurn.Parameters) {
3546
- const { onBurn, token = usdAddress, ...rest } = parameters
3965
+ const { onBurn, token = Addresses.defaultFeeToken, ...rest } = parameters
3547
3966
  return watchContractEvent(client, {
3548
3967
  ...rest,
3549
3968
  address: TokenId.toAddress(token),
3550
- abi: tip20Abi,
3969
+ abi: Abis.tip20,
3551
3970
  eventName: 'Burn',
3552
3971
  onLogs: (logs) => {
3553
3972
  for (const log of logs) onBurn(log.args, log)
@@ -3558,7 +3977,7 @@ export function watchBurn<
3558
3977
 
3559
3978
  export declare namespace watchBurn {
3560
3979
  export type Args = GetEventArgs<
3561
- typeof tip20Abi,
3980
+ typeof Abis.tip20,
3562
3981
  'Burn',
3563
3982
  { IndexedOnly: false; Required: true }
3564
3983
  >
@@ -3567,17 +3986,17 @@ export declare namespace watchBurn {
3567
3986
  bigint,
3568
3987
  number,
3569
3988
  false,
3570
- ExtractAbiItem<typeof tip20Abi, 'Burn'>,
3989
+ ExtractAbiItem<typeof Abis.tip20, 'Burn'>,
3571
3990
  true
3572
3991
  >
3573
3992
 
3574
3993
  export type Parameters = UnionOmit<
3575
- WatchContractEventParameters<typeof tip20Abi, 'Burn', true>,
3994
+ WatchContractEventParameters<typeof Abis.tip20, 'Burn', true>,
3576
3995
  'abi' | 'address' | 'batch' | 'eventName' | 'onLogs' | 'strict'
3577
3996
  > & {
3578
3997
  /** Callback to invoke when tokens are burned. */
3579
3998
  onBurn: (args: Args, log: Log) => void
3580
- /** Address or ID of the TIP20 token. @default `usdAddress` */
3999
+ /** Address or ID of the TIP20 token. @default `Addresses.defaultFeeToken` */
3581
4000
  token?: TokenId.TokenIdOrAddress | undefined
3582
4001
  }
3583
4002
  }
@@ -3617,8 +4036,8 @@ export function watchCreate<
3617
4036
  const { onTokenCreated, ...rest } = parameters
3618
4037
  return watchContractEvent(client, {
3619
4038
  ...rest,
3620
- address: tip20FactoryAddress,
3621
- abi: tip20FactoryAbi,
4039
+ address: Addresses.tip20Factory,
4040
+ abi: Abis.tip20Factory,
3622
4041
  eventName: 'TokenCreated',
3623
4042
  onLogs: (logs) => {
3624
4043
  for (const log of logs) onTokenCreated(log.args, log)
@@ -3629,7 +4048,7 @@ export function watchCreate<
3629
4048
 
3630
4049
  export declare namespace watchCreate {
3631
4050
  export type Args = GetEventArgs<
3632
- typeof tip20FactoryAbi,
4051
+ typeof Abis.tip20Factory,
3633
4052
  'TokenCreated',
3634
4053
  { IndexedOnly: false; Required: true }
3635
4054
  >
@@ -3638,12 +4057,16 @@ export declare namespace watchCreate {
3638
4057
  bigint,
3639
4058
  number,
3640
4059
  false,
3641
- ExtractAbiItem<typeof tip20FactoryAbi, 'TokenCreated'>,
4060
+ ExtractAbiItem<typeof Abis.tip20Factory, 'TokenCreated'>,
3642
4061
  true
3643
4062
  >
3644
4063
 
3645
4064
  export type Parameters = UnionOmit<
3646
- WatchContractEventParameters<typeof tip20FactoryAbi, 'TokenCreated', true>,
4065
+ WatchContractEventParameters<
4066
+ typeof Abis.tip20Factory,
4067
+ 'TokenCreated',
4068
+ true
4069
+ >,
3647
4070
  'abi' | 'address' | 'batch' | 'eventName' | 'onLogs' | 'strict'
3648
4071
  > & {
3649
4072
  /** Callback to invoke when a new TIP20 token is created. */
@@ -3680,11 +4103,11 @@ export function watchMint<
3680
4103
  chain extends Chain | undefined,
3681
4104
  account extends Account | undefined,
3682
4105
  >(client: Client<Transport, chain, account>, parameters: watchMint.Parameters) {
3683
- const { onMint, token = usdAddress, ...rest } = parameters
4106
+ const { onMint, token = Addresses.defaultFeeToken, ...rest } = parameters
3684
4107
  return watchContractEvent(client, {
3685
4108
  ...rest,
3686
4109
  address: TokenId.toAddress(token),
3687
- abi: tip20Abi,
4110
+ abi: Abis.tip20,
3688
4111
  eventName: 'Mint',
3689
4112
  onLogs: (logs) => {
3690
4113
  for (const log of logs) onMint(log.args, log)
@@ -3695,7 +4118,7 @@ export function watchMint<
3695
4118
 
3696
4119
  export declare namespace watchMint {
3697
4120
  export type Args = GetEventArgs<
3698
- typeof tip20Abi,
4121
+ typeof Abis.tip20,
3699
4122
  'Mint',
3700
4123
  { IndexedOnly: false; Required: true }
3701
4124
  >
@@ -3704,17 +4127,17 @@ export declare namespace watchMint {
3704
4127
  bigint,
3705
4128
  number,
3706
4129
  false,
3707
- ExtractAbiItem<typeof tip20Abi, 'Mint'>,
4130
+ ExtractAbiItem<typeof Abis.tip20, 'Mint'>,
3708
4131
  true
3709
4132
  >
3710
4133
 
3711
4134
  export type Parameters = UnionOmit<
3712
- WatchContractEventParameters<typeof tip20Abi, 'Mint', true>,
4135
+ WatchContractEventParameters<typeof Abis.tip20, 'Mint', true>,
3713
4136
  'abi' | 'address' | 'batch' | 'eventName' | 'onLogs' | 'strict'
3714
4137
  > & {
3715
4138
  /** Callback to invoke when tokens are minted. */
3716
4139
  onMint: (args: Args, log: Log) => void
3717
- /** Address or ID of the TIP20 token. @default `usdAddress` */
4140
+ /** Address or ID of the TIP20 token. @default `Addresses.defaultFeeToken` */
3718
4141
  token?: TokenId.TokenIdOrAddress | undefined
3719
4142
  }
3720
4143
  }
@@ -3751,11 +4174,15 @@ export function watchAdminRole<
3751
4174
  client: Client<Transport, chain, account>,
3752
4175
  parameters: watchAdminRole.Parameters,
3753
4176
  ) {
3754
- const { onRoleAdminUpdated, token = usdAddress, ...rest } = parameters
4177
+ const {
4178
+ onRoleAdminUpdated,
4179
+ token = Addresses.defaultFeeToken,
4180
+ ...rest
4181
+ } = parameters
3755
4182
  return watchContractEvent(client, {
3756
4183
  ...rest,
3757
4184
  address: TokenId.toAddress(token),
3758
- abi: tip20Abi,
4185
+ abi: Abis.tip20,
3759
4186
  eventName: 'RoleAdminUpdated',
3760
4187
  onLogs: (logs) => {
3761
4188
  for (const log of logs) onRoleAdminUpdated(log.args, log)
@@ -3766,7 +4193,7 @@ export function watchAdminRole<
3766
4193
 
3767
4194
  export declare namespace watchAdminRole {
3768
4195
  export type Args = GetEventArgs<
3769
- typeof tip20Abi,
4196
+ typeof Abis.tip20,
3770
4197
  'RoleAdminUpdated',
3771
4198
  { IndexedOnly: false; Required: true }
3772
4199
  >
@@ -3775,17 +4202,17 @@ export declare namespace watchAdminRole {
3775
4202
  bigint,
3776
4203
  number,
3777
4204
  false,
3778
- ExtractAbiItem<typeof tip20Abi, 'RoleAdminUpdated'>,
4205
+ ExtractAbiItem<typeof Abis.tip20, 'RoleAdminUpdated'>,
3779
4206
  true
3780
4207
  >
3781
4208
 
3782
4209
  export type Parameters = UnionOmit<
3783
- WatchContractEventParameters<typeof tip20Abi, 'RoleAdminUpdated', true>,
4210
+ WatchContractEventParameters<typeof Abis.tip20, 'RoleAdminUpdated', true>,
3784
4211
  'abi' | 'address' | 'batch' | 'eventName' | 'onLogs' | 'strict'
3785
4212
  > & {
3786
4213
  /** Callback to invoke when a role admin is updated. */
3787
4214
  onRoleAdminUpdated: (args: Args, log: Log) => void
3788
- /** Address or ID of the TIP20 token. @default `usdAddress` */
4215
+ /** Address or ID of the TIP20 token. @default `Addresses.defaultFeeToken` */
3789
4216
  token?: TokenId.TokenIdOrAddress | undefined
3790
4217
  }
3791
4218
  }
@@ -3819,11 +4246,15 @@ export function watchRole<
3819
4246
  chain extends Chain | undefined,
3820
4247
  account extends Account | undefined,
3821
4248
  >(client: Client<Transport, chain, account>, parameters: watchRole.Parameters) {
3822
- const { onRoleUpdated, token = usdAddress, ...rest } = parameters
4249
+ const {
4250
+ onRoleUpdated,
4251
+ token = Addresses.defaultFeeToken,
4252
+ ...rest
4253
+ } = parameters
3823
4254
  return watchContractEvent(client, {
3824
4255
  ...rest,
3825
4256
  address: TokenId.toAddress(token),
3826
- abi: tip20Abi,
4257
+ abi: Abis.tip20,
3827
4258
  eventName: 'RoleMembershipUpdated',
3828
4259
  onLogs: (logs) => {
3829
4260
  for (const log of logs) {
@@ -3837,7 +4268,7 @@ export function watchRole<
3837
4268
 
3838
4269
  export declare namespace watchRole {
3839
4270
  export type Args = GetEventArgs<
3840
- typeof tip20Abi,
4271
+ typeof Abis.tip20,
3841
4272
  'RoleMembershipUpdated',
3842
4273
  { IndexedOnly: false; Required: true }
3843
4274
  > & {
@@ -3849,13 +4280,13 @@ export declare namespace watchRole {
3849
4280
  bigint,
3850
4281
  number,
3851
4282
  false,
3852
- ExtractAbiItem<typeof tip20Abi, 'RoleMembershipUpdated'>,
4283
+ ExtractAbiItem<typeof Abis.tip20, 'RoleMembershipUpdated'>,
3853
4284
  true
3854
4285
  >
3855
4286
 
3856
4287
  export type Parameters = UnionOmit<
3857
4288
  WatchContractEventParameters<
3858
- typeof tip20Abi,
4289
+ typeof Abis.tip20,
3859
4290
  'RoleMembershipUpdated',
3860
4291
  true
3861
4292
  >,
@@ -3863,7 +4294,7 @@ export declare namespace watchRole {
3863
4294
  > & {
3864
4295
  /** Callback to invoke when a role membership is updated. */
3865
4296
  onRoleUpdated: (args: Args, log: Log) => void
3866
- /** Address or ID of the TIP20 token. @default `usdAddress` */
4297
+ /** Address or ID of the TIP20 token. @default `Addresses.defaultFeeToken` */
3867
4298
  token?: TokenId.TokenIdOrAddress | undefined
3868
4299
  }
3869
4300
  }
@@ -3901,11 +4332,11 @@ export function watchTransfer<
3901
4332
  client: Client<Transport, chain, account>,
3902
4333
  parameters: watchTransfer.Parameters,
3903
4334
  ) {
3904
- const { onTransfer, token = usdAddress, ...rest } = parameters
4335
+ const { onTransfer, token = Addresses.defaultFeeToken, ...rest } = parameters
3905
4336
  return watchContractEvent(client, {
3906
4337
  ...rest,
3907
4338
  address: TokenId.toAddress(token),
3908
- abi: tip20Abi,
4339
+ abi: Abis.tip20,
3909
4340
  eventName: 'Transfer',
3910
4341
  onLogs: (logs) => {
3911
4342
  for (const log of logs) onTransfer(log.args, log)
@@ -3916,7 +4347,7 @@ export function watchTransfer<
3916
4347
 
3917
4348
  export declare namespace watchTransfer {
3918
4349
  export type Args = GetEventArgs<
3919
- typeof tip20Abi,
4350
+ typeof Abis.tip20,
3920
4351
  'Transfer',
3921
4352
  { IndexedOnly: false; Required: true }
3922
4353
  >
@@ -3925,17 +4356,125 @@ export declare namespace watchTransfer {
3925
4356
  bigint,
3926
4357
  number,
3927
4358
  false,
3928
- ExtractAbiItem<typeof tip20Abi, 'Transfer'>,
4359
+ ExtractAbiItem<typeof Abis.tip20, 'Transfer'>,
3929
4360
  true
3930
4361
  >
3931
4362
 
3932
4363
  export type Parameters = UnionOmit<
3933
- WatchContractEventParameters<typeof tip20Abi, 'Transfer', true>,
4364
+ WatchContractEventParameters<typeof Abis.tip20, 'Transfer', true>,
3934
4365
  'abi' | 'address' | 'batch' | 'eventName' | 'onLogs' | 'strict'
3935
4366
  > & {
3936
4367
  /** Callback to invoke when tokens are transferred. */
3937
4368
  onTransfer: (args: Args, log: Log) => void
3938
- /** 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` */
3939
4478
  token?: TokenId.TokenIdOrAddress | undefined
3940
4479
  }
3941
4480
  }