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
@@ -3,15 +3,11 @@ import * as Signature from 'ox/Signature';
3
3
  import { encodeFunctionData, parseEventLogs, } from 'viem';
4
4
  import { parseAccount } from 'viem/accounts';
5
5
  import { multicall, readContract, sendTransaction, sendTransactionSync, watchContractEvent, writeContract, writeContractSync, } from 'viem/actions';
6
- import * as TokenId from "../../ox/TokenId.js";
7
- import * as TokenRole from "../../ox/TokenRole.js";
8
- import { tip20Abi, tip20FactoryAbi } from "../abis.js";
9
- import { tip20FactoryAddress, usdAddress } from "../addresses.js";
10
- import { defineCall } from "../utils.js";
11
- const transferPolicy = {
12
- 0: 'always-reject',
13
- 1: 'always-allow',
14
- };
6
+ import * as TokenId from '../../ox/TokenId.js';
7
+ import * as TokenRole from '../../ox/TokenRole.js';
8
+ import * as Abis from '../Abis.js';
9
+ import * as Addresses from '../Addresses.js';
10
+ import { defineCall } from '../internal/utils.js';
15
11
  /**
16
12
  * Approves a spender to transfer TIP20 tokens on behalf of the caller.
17
13
  *
@@ -39,7 +35,7 @@ const transferPolicy = {
39
35
  * @returns The transaction hash.
40
36
  */
41
37
  export async function approve(client, parameters) {
42
- const { token = usdAddress, ...rest } = parameters;
38
+ const { token = Addresses.defaultFeeToken, ...rest } = parameters;
43
39
  return approve.inner(writeContract, client, parameters, { ...rest, token });
44
40
  }
45
41
  (function (approve) {
@@ -86,10 +82,10 @@ export async function approve(client, parameters) {
86
82
  * @returns The call.
87
83
  */
88
84
  function call(args) {
89
- const { spender, amount, token = usdAddress } = args;
85
+ const { spender, amount, token = Addresses.defaultFeeToken } = args;
90
86
  return defineCall({
91
87
  address: TokenId.toAddress(token),
92
- abi: tip20Abi,
88
+ abi: Abis.tip20,
93
89
  functionName: 'approve',
94
90
  args: [spender, amount],
95
91
  });
@@ -97,7 +93,7 @@ export async function approve(client, parameters) {
97
93
  approve.call = call;
98
94
  function extractEvent(logs) {
99
95
  const [log] = parseEventLogs({
100
- abi: tip20Abi,
96
+ abi: Abis.tip20,
101
97
  logs,
102
98
  eventName: 'Approval',
103
99
  });
@@ -134,7 +130,7 @@ export async function approve(client, parameters) {
134
130
  * @returns The transaction receipt and event data.
135
131
  */
136
132
  export async function approveSync(client, parameters) {
137
- const { throwOnReceiptRevert = true, token = usdAddress, ...rest } = parameters;
133
+ const { throwOnReceiptRevert = true, token = Addresses.defaultFeeToken, ...rest } = parameters;
138
134
  const receipt = await approve.inner(writeContractSync, client, { ...parameters, throwOnReceiptRevert }, {
139
135
  ...rest,
140
136
  token,
@@ -178,9 +174,10 @@ export async function burnBlocked(client, parameters) {
178
174
  (function (burnBlocked) {
179
175
  /** @internal */
180
176
  async function inner(action, client, parameters) {
181
- const call = burnBlocked.call(parameters);
177
+ const { amount, from, token, ...rest } = parameters;
178
+ const call = burnBlocked.call({ amount, from, token });
182
179
  return (await action(client, {
183
- ...parameters,
180
+ ...rest,
184
181
  ...call,
185
182
  }));
186
183
  }
@@ -222,7 +219,7 @@ export async function burnBlocked(client, parameters) {
222
219
  const { from, amount, token } = args;
223
220
  return defineCall({
224
221
  address: TokenId.toAddress(token),
225
- abi: tip20Abi,
222
+ abi: Abis.tip20,
226
223
  functionName: 'burnBlocked',
227
224
  args: [from, amount],
228
225
  });
@@ -236,7 +233,7 @@ export async function burnBlocked(client, parameters) {
236
233
  */
237
234
  function extractEvent(logs) {
238
235
  const [log] = parseEventLogs({
239
- abi: tip20Abi,
236
+ abi: Abis.tip20,
240
237
  logs,
241
238
  eventName: 'BurnBlocked',
242
239
  });
@@ -317,9 +314,10 @@ export async function burn(client, parameters) {
317
314
  (function (burn) {
318
315
  /** @internal */
319
316
  async function inner(action, client, parameters) {
320
- const call = burn.call(parameters);
317
+ const { amount, memo, token, ...rest } = parameters;
318
+ const call = burn.call({ amount, memo, token });
321
319
  return (await action(client, {
322
- ...parameters,
320
+ ...rest,
323
321
  ...call,
324
322
  }));
325
323
  }
@@ -369,7 +367,7 @@ export async function burn(client, parameters) {
369
367
  };
370
368
  return defineCall({
371
369
  address: TokenId.toAddress(token),
372
- abi: tip20Abi,
370
+ abi: Abis.tip20,
373
371
  ...callArgs,
374
372
  });
375
373
  }
@@ -382,7 +380,7 @@ export async function burn(client, parameters) {
382
380
  */
383
381
  function extractEvent(logs) {
384
382
  const [log] = parseEventLogs({
385
- abi: tip20Abi,
383
+ abi: Abis.tip20,
386
384
  logs,
387
385
  eventName: 'Burn',
388
386
  });
@@ -462,9 +460,10 @@ export async function changeTransferPolicy(client, parameters) {
462
460
  (function (changeTransferPolicy) {
463
461
  /** @internal */
464
462
  async function inner(action, client, parameters) {
465
- const call = changeTransferPolicy.call(parameters);
463
+ const { policyId, token, ...rest } = parameters;
464
+ const call = changeTransferPolicy.call({ policyId, token });
466
465
  return (await action(client, {
467
- ...parameters,
466
+ ...rest,
468
467
  ...call,
469
468
  }));
470
469
  }
@@ -505,7 +504,7 @@ export async function changeTransferPolicy(client, parameters) {
505
504
  const { token, policyId } = args;
506
505
  return defineCall({
507
506
  address: TokenId.toAddress(token),
508
- abi: tip20Abi,
507
+ abi: Abis.tip20,
509
508
  functionName: 'changeTransferPolicyId',
510
509
  args: [policyId],
511
510
  });
@@ -519,7 +518,7 @@ export async function changeTransferPolicy(client, parameters) {
519
518
  */
520
519
  function extractEvent(logs) {
521
520
  const [log] = parseEventLogs({
522
- abi: tip20Abi,
521
+ abi: Abis.tip20,
523
522
  logs,
524
523
  eventName: 'TransferPolicyUpdate',
525
524
  });
@@ -648,11 +647,11 @@ export async function create(client, parameters) {
648
647
  * @returns The call.
649
648
  */
650
649
  function call(args) {
651
- const { name, symbol, currency, admin } = args;
650
+ const { name, symbol, currency, quoteToken = Addresses.defaultQuoteToken, admin, } = args;
652
651
  return defineCall({
653
- address: tip20FactoryAddress,
654
- abi: tip20FactoryAbi,
655
- args: [name, symbol, currency, admin],
652
+ address: Addresses.tip20Factory,
653
+ abi: Abis.tip20Factory,
654
+ args: [name, symbol, currency, TokenId.toAddress(quoteToken), admin],
656
655
  functionName: 'createToken',
657
656
  });
658
657
  }
@@ -665,7 +664,7 @@ export async function create(client, parameters) {
665
664
  */
666
665
  function extractEvent(logs) {
667
666
  const [log] = parseEventLogs({
668
- abi: tip20FactoryAbi,
667
+ abi: Abis.tip20Factory,
669
668
  logs,
670
669
  eventName: 'TokenCreated',
671
670
  strict: true,
@@ -715,6 +714,137 @@ export async function createSync(client, parameters) {
715
714
  receipt,
716
715
  };
717
716
  }
717
+ /**
718
+ * Finalizes the quote token update for a TIP20 token.
719
+ *
720
+ * @example
721
+ * ```ts
722
+ * import { createClient, http } from 'viem'
723
+ * import { tempo } from 'tempo.ts/chains'
724
+ * import * as actions from 'tempo.ts/viem/actions'
725
+ * import { privateKeyToAccount } from 'viem/accounts'
726
+ *
727
+ * const client = createClient({
728
+ * account: privateKeyToAccount('0x...'),
729
+ * chain: tempo,
730
+ * transport: http(),
731
+ * })
732
+ *
733
+ * const result = await actions.token.finalizeUpdateQuoteToken(client, {
734
+ * token: '0x...',
735
+ * })
736
+ * ```
737
+ *
738
+ * @param client - Client.
739
+ * @param parameters - Parameters.
740
+ * @returns The transaction hash.
741
+ */
742
+ export async function finalizeUpdateQuoteToken(client, parameters) {
743
+ return finalizeUpdateQuoteToken.inner(writeContract, client, parameters);
744
+ }
745
+ (function (finalizeUpdateQuoteToken) {
746
+ /** @internal */
747
+ async function inner(action, client, parameters) {
748
+ const { token, ...rest } = parameters;
749
+ const call = finalizeUpdateQuoteToken.call({ token });
750
+ return (await action(client, {
751
+ ...rest,
752
+ ...call,
753
+ }));
754
+ }
755
+ finalizeUpdateQuoteToken.inner = inner;
756
+ /**
757
+ * Defines a call to the `finalizeQuoteTokenUpdate` function.
758
+ *
759
+ * Can be passed as a parameter to:
760
+ * - [`estimateContractGas`](https://viem.sh/docs/contract/estimateContractGas): estimate the gas cost of the call
761
+ * - [`simulateContract`](https://viem.sh/docs/contract/simulateContract): simulate the call
762
+ * - [`sendCalls`](https://viem.sh/docs/actions/wallet/sendCalls): send multiple calls
763
+ *
764
+ * @example
765
+ * ```ts
766
+ * import { createClient, http, walletActions } from 'viem'
767
+ * import { tempo } from 'tempo.ts/chains'
768
+ * import * as actions from 'tempo.ts/viem/actions'
769
+ *
770
+ * const client = createClient({
771
+ * chain: tempo,
772
+ * transport: http(),
773
+ * }).extend(walletActions)
774
+ *
775
+ * const { result } = await client.sendCalls({
776
+ * calls: [
777
+ * actions.token.finalizeUpdateQuoteToken.call({
778
+ * token: '0x20c0...babe',
779
+ * }),
780
+ * ]
781
+ * })
782
+ * ```
783
+ *
784
+ * @param args - Arguments.
785
+ * @returns The call.
786
+ */
787
+ function call(args) {
788
+ const { token } = args;
789
+ return defineCall({
790
+ address: TokenId.toAddress(token),
791
+ abi: Abis.tip20,
792
+ functionName: 'finalizeQuoteTokenUpdate',
793
+ args: [],
794
+ });
795
+ }
796
+ finalizeUpdateQuoteToken.call = call;
797
+ /**
798
+ * Extracts the event from the logs.
799
+ *
800
+ * @param logs - Logs.
801
+ * @returns The event.
802
+ */
803
+ function extractEvent(logs) {
804
+ const [log] = parseEventLogs({
805
+ abi: Abis.tip20,
806
+ logs,
807
+ eventName: 'QuoteTokenUpdateFinalized',
808
+ });
809
+ if (!log)
810
+ throw new Error('`QuoteTokenUpdateFinalized` event not found.');
811
+ return log;
812
+ }
813
+ finalizeUpdateQuoteToken.extractEvent = extractEvent;
814
+ })(finalizeUpdateQuoteToken || (finalizeUpdateQuoteToken = {}));
815
+ /**
816
+ * Finalizes the quote token update for a TIP20 token.
817
+ *
818
+ * @example
819
+ * ```ts
820
+ * import { createClient, http } from 'viem'
821
+ * import { tempo } from 'tempo.ts/chains'
822
+ * import * as actions from 'tempo.ts/viem/actions'
823
+ * import { privateKeyToAccount } from 'viem/accounts'
824
+ *
825
+ * const client = createClient({
826
+ * account: privateKeyToAccount('0x...'),
827
+ * chain: tempo,
828
+ * transport: http(),
829
+ * })
830
+ *
831
+ * const result = await actions.token.finalizeUpdateQuoteTokenSync(client, {
832
+ * token: '0x...',
833
+ * })
834
+ * ```
835
+ *
836
+ * @param client - Client.
837
+ * @param parameters - Parameters.
838
+ * @returns The transaction receipt and event data.
839
+ */
840
+ export async function finalizeUpdateQuoteTokenSync(client, parameters) {
841
+ const receipt = await finalizeUpdateQuoteToken.inner(writeContractSync, client, parameters);
842
+ const { args } = finalizeUpdateQuoteToken.extractEvent(receipt.logs);
843
+ return {
844
+ ...args,
845
+ receipt,
846
+ };
847
+ }
718
848
  /**
719
849
  * Gets TIP20 token allowance.
720
850
  *
@@ -758,10 +888,10 @@ export async function getAllowance(client, parameters) {
758
888
  * @returns The call.
759
889
  */
760
890
  function call(args) {
761
- const { account, spender, token = usdAddress } = args;
891
+ const { account, spender, token = Addresses.defaultFeeToken } = args;
762
892
  return defineCall({
763
893
  address: TokenId.toAddress(token),
764
- abi: tip20Abi,
894
+ abi: Abis.tip20,
765
895
  functionName: 'allowance',
766
896
  args: [account, spender],
767
897
  });
@@ -811,10 +941,10 @@ export async function getBalance(client, ...parameters) {
811
941
  * @returns The call.
812
942
  */
813
943
  function call(args) {
814
- const { account, token = usdAddress } = args;
944
+ const { account, token = Addresses.defaultFeeToken } = args;
815
945
  return defineCall({
816
946
  address: TokenId.toAddress(token),
817
- abi: tip20Abi,
947
+ abi: Abis.tip20,
818
948
  functionName: 'balanceOf',
819
949
  args: [account],
820
950
  });
@@ -847,9 +977,9 @@ export async function getBalance(client, ...parameters) {
847
977
  * @returns The token metadata.
848
978
  */
849
979
  export async function getMetadata(client, parameters = {}) {
850
- const { token = usdAddress, ...rest } = parameters;
980
+ const { token = Addresses.defaultFeeToken, ...rest } = parameters;
851
981
  const address = TokenId.toAddress(token);
852
- const abi = tip20Abi;
982
+ const abi = Abis.tip20;
853
983
  return multicall(client, {
854
984
  ...rest,
855
985
  contracts: [
@@ -863,6 +993,11 @@ export async function getMetadata(client, parameters = {}) {
863
993
  abi,
864
994
  functionName: 'decimals',
865
995
  },
996
+ {
997
+ address,
998
+ abi,
999
+ functionName: 'quoteToken',
1000
+ },
866
1001
  {
867
1002
  address,
868
1003
  abi,
@@ -896,15 +1031,16 @@ export async function getMetadata(client, parameters = {}) {
896
1031
  ],
897
1032
  allowFailure: false,
898
1033
  deployless: true,
899
- }).then(([currency, decimals, name, paused, supplyCap, symbol, totalSupply, transferPolicyId,]) => ({
1034
+ }).then(([currency, decimals, quoteToken, name, paused, supplyCap, symbol, totalSupply, transferPolicyId,]) => ({
900
1035
  name,
901
1036
  symbol,
902
1037
  currency,
903
1038
  decimals,
1039
+ quoteToken,
904
1040
  totalSupply,
905
1041
  paused,
906
1042
  supplyCap,
907
- transferPolicy: transferPolicy[Number(transferPolicyId)],
1043
+ transferPolicyId,
908
1044
  }));
909
1045
  }
910
1046
  /**
@@ -953,7 +1089,7 @@ export async function hasRole(client, parameters) {
953
1089
  const { account, role, token } = args;
954
1090
  return defineCall({
955
1091
  address: TokenId.toAddress(token),
956
- abi: tip20Abi,
1092
+ abi: Abis.tip20,
957
1093
  functionName: 'hasRole',
958
1094
  args: [account, TokenRole.serialize(role)],
959
1095
  });
@@ -1043,7 +1179,7 @@ export async function grantRoles(client, parameters) {
1043
1179
  const roleHash = TokenRole.serialize(role);
1044
1180
  return defineCall({
1045
1181
  address: TokenId.toAddress(token),
1046
- abi: tip20Abi,
1182
+ abi: Abis.tip20,
1047
1183
  functionName: 'grantRole',
1048
1184
  args: [roleHash, to],
1049
1185
  });
@@ -1057,7 +1193,7 @@ export async function grantRoles(client, parameters) {
1057
1193
  */
1058
1194
  function extractEvents(logs) {
1059
1195
  const events = parseEventLogs({
1060
- abi: tip20Abi,
1196
+ abi: Abis.tip20,
1061
1197
  logs,
1062
1198
  eventName: 'RoleMembershipUpdated',
1063
1199
  });
@@ -1194,7 +1330,7 @@ export async function mint(client, parameters) {
1194
1330
  };
1195
1331
  return defineCall({
1196
1332
  address: TokenId.toAddress(token),
1197
- abi: tip20Abi,
1333
+ abi: Abis.tip20,
1198
1334
  ...callArgs,
1199
1335
  });
1200
1336
  }
@@ -1207,7 +1343,7 @@ export async function mint(client, parameters) {
1207
1343
  */
1208
1344
  function extractEvent(logs) {
1209
1345
  const [log] = parseEventLogs({
1210
- abi: tip20Abi,
1346
+ abi: Abis.tip20,
1211
1347
  logs,
1212
1348
  eventName: 'Mint',
1213
1349
  });
@@ -1287,9 +1423,10 @@ export async function pause(client, parameters) {
1287
1423
  (function (pause) {
1288
1424
  /** @internal */
1289
1425
  async function inner(action, client, parameters) {
1290
- const call = pause.call(parameters);
1426
+ const { token, ...rest } = parameters;
1427
+ const call = pause.call({ token });
1291
1428
  return (await action(client, {
1292
- ...parameters,
1429
+ ...rest,
1293
1430
  ...call,
1294
1431
  }));
1295
1432
  }
@@ -1329,7 +1466,7 @@ export async function pause(client, parameters) {
1329
1466
  const { token } = args;
1330
1467
  return defineCall({
1331
1468
  address: TokenId.toAddress(token),
1332
- abi: tip20Abi,
1469
+ abi: Abis.tip20,
1333
1470
  functionName: 'pause',
1334
1471
  args: [],
1335
1472
  });
@@ -1343,7 +1480,7 @@ export async function pause(client, parameters) {
1343
1480
  */
1344
1481
  function extractEvent(logs) {
1345
1482
  const [log] = parseEventLogs({
1346
- abi: tip20Abi,
1483
+ abi: Abis.tip20,
1347
1484
  logs,
1348
1485
  eventName: 'PauseStateUpdate',
1349
1486
  });
@@ -1425,9 +1562,17 @@ export async function permit(client, parameters) {
1425
1562
  (function (permit) {
1426
1563
  /** @internal */
1427
1564
  async function inner(action, client, parameters) {
1428
- const call = permit.call(parameters);
1565
+ const { owner, spender, value, deadline, signature, token, ...rest } = parameters;
1566
+ const call = permit.call({
1567
+ owner,
1568
+ spender,
1569
+ value,
1570
+ deadline,
1571
+ signature,
1572
+ token,
1573
+ });
1429
1574
  return (await action(client, {
1430
- ...parameters,
1575
+ ...rest,
1431
1576
  ...call,
1432
1577
  }));
1433
1578
  }
@@ -1469,12 +1614,12 @@ export async function permit(client, parameters) {
1469
1614
  * @returns The call.
1470
1615
  */
1471
1616
  function call(args) {
1472
- const { owner, spender, value, deadline, signature, token = usdAddress, } = args;
1617
+ const { owner, spender, value, deadline, signature, token = Addresses.defaultFeeToken, } = args;
1473
1618
  const { r, s, yParity } = Signature.from(signature);
1474
1619
  const v = Signature.yParityToV(yParity);
1475
1620
  return defineCall({
1476
1621
  address: TokenId.toAddress(token),
1477
- abi: tip20Abi,
1622
+ abi: Abis.tip20,
1478
1623
  functionName: 'permit',
1479
1624
  args: [
1480
1625
  owner,
@@ -1496,7 +1641,7 @@ export async function permit(client, parameters) {
1496
1641
  */
1497
1642
  function extractEvent(logs) {
1498
1643
  const [log] = parseEventLogs({
1499
- abi: tip20Abi,
1644
+ abi: Abis.tip20,
1500
1645
  logs,
1501
1646
  eventName: 'Approval',
1502
1647
  });
@@ -1628,7 +1773,7 @@ export async function renounceRoles(client, parameters) {
1628
1773
  const roleHash = TokenRole.serialize(role);
1629
1774
  return defineCall({
1630
1775
  address: TokenId.toAddress(token),
1631
- abi: tip20Abi,
1776
+ abi: Abis.tip20,
1632
1777
  functionName: 'renounceRole',
1633
1778
  args: [roleHash],
1634
1779
  });
@@ -1642,7 +1787,7 @@ export async function renounceRoles(client, parameters) {
1642
1787
  */
1643
1788
  function extractEvents(logs) {
1644
1789
  const events = parseEventLogs({
1645
- abi: tip20Abi,
1790
+ abi: Abis.tip20,
1646
1791
  logs,
1647
1792
  eventName: 'RoleMembershipUpdated',
1648
1793
  });
@@ -1774,7 +1919,7 @@ export async function revokeRoles(client, parameters) {
1774
1919
  const roleHash = TokenRole.serialize(role);
1775
1920
  return defineCall({
1776
1921
  address: TokenId.toAddress(token),
1777
- abi: tip20Abi,
1922
+ abi: Abis.tip20,
1778
1923
  functionName: 'revokeRole',
1779
1924
  args: [roleHash, from],
1780
1925
  });
@@ -1788,7 +1933,7 @@ export async function revokeRoles(client, parameters) {
1788
1933
  */
1789
1934
  function extractEvents(logs) {
1790
1935
  const events = parseEventLogs({
1791
- abi: tip20Abi,
1936
+ abi: Abis.tip20,
1792
1937
  logs,
1793
1938
  eventName: 'RoleMembershipUpdated',
1794
1939
  });
@@ -1870,9 +2015,10 @@ export async function setSupplyCap(client, parameters) {
1870
2015
  (function (setSupplyCap) {
1871
2016
  /** @internal */
1872
2017
  async function inner(action, client, parameters) {
1873
- const call = setSupplyCap.call(parameters);
2018
+ const { supplyCap, token, ...rest } = parameters;
2019
+ const call = setSupplyCap.call({ supplyCap, token });
1874
2020
  return (await action(client, {
1875
- ...parameters,
2021
+ ...rest,
1876
2022
  ...call,
1877
2023
  }));
1878
2024
  }
@@ -1913,7 +2059,7 @@ export async function setSupplyCap(client, parameters) {
1913
2059
  const { token, supplyCap } = args;
1914
2060
  return defineCall({
1915
2061
  address: TokenId.toAddress(token),
1916
- abi: tip20Abi,
2062
+ abi: Abis.tip20,
1917
2063
  functionName: 'setSupplyCap',
1918
2064
  args: [supplyCap],
1919
2065
  });
@@ -1927,7 +2073,7 @@ export async function setSupplyCap(client, parameters) {
1927
2073
  */
1928
2074
  function extractEvent(logs) {
1929
2075
  const [log] = parseEventLogs({
1930
- abi: tip20Abi,
2076
+ abi: Abis.tip20,
1931
2077
  logs,
1932
2078
  eventName: 'SupplyCapUpdate',
1933
2079
  });
@@ -2008,9 +2154,10 @@ export async function setRoleAdmin(client, parameters) {
2008
2154
  (function (setRoleAdmin) {
2009
2155
  /** @internal */
2010
2156
  async function inner(action, client, parameters) {
2011
- const call = setRoleAdmin.call(parameters);
2157
+ const { adminRole, role, token, ...rest } = parameters;
2158
+ const call = setRoleAdmin.call({ adminRole, role, token });
2012
2159
  return (await action(client, {
2013
- ...parameters,
2160
+ ...rest,
2014
2161
  ...call,
2015
2162
  }));
2016
2163
  }
@@ -2054,7 +2201,7 @@ export async function setRoleAdmin(client, parameters) {
2054
2201
  const adminRoleHash = TokenRole.serialize(adminRole);
2055
2202
  return defineCall({
2056
2203
  address: TokenId.toAddress(token),
2057
- abi: tip20Abi,
2204
+ abi: Abis.tip20,
2058
2205
  functionName: 'setRoleAdmin',
2059
2206
  args: [roleHash, adminRoleHash],
2060
2207
  });
@@ -2068,7 +2215,7 @@ export async function setRoleAdmin(client, parameters) {
2068
2215
  */
2069
2216
  function extractEvent(logs) {
2070
2217
  const [log] = parseEventLogs({
2071
- abi: tip20Abi,
2218
+ abi: Abis.tip20,
2072
2219
  logs,
2073
2220
  eventName: 'RoleAdminUpdated',
2074
2221
  });
@@ -2149,9 +2296,10 @@ export async function transfer(client, parameters) {
2149
2296
  (function (transfer) {
2150
2297
  /** @internal */
2151
2298
  async function inner(action, client, parameters) {
2152
- const call = transfer.call(parameters);
2299
+ const { amount, from, memo, token, to, ...rest } = parameters;
2300
+ const call = transfer.call({ amount, from, memo, token, to });
2153
2301
  return (await action(client, {
2154
- ...parameters,
2302
+ ...rest,
2155
2303
  ...call,
2156
2304
  }));
2157
2305
  }
@@ -2190,7 +2338,7 @@ export async function transfer(client, parameters) {
2190
2338
  * @returns The call.
2191
2339
  */
2192
2340
  function call(args) {
2193
- const { amount, from, memo, token = usdAddress, to } = args;
2341
+ const { amount, from, memo, token = Addresses.defaultFeeToken, to } = args;
2194
2342
  const callArgs = (() => {
2195
2343
  if (memo && from)
2196
2344
  return {
@@ -2214,7 +2362,7 @@ export async function transfer(client, parameters) {
2214
2362
  })();
2215
2363
  return defineCall({
2216
2364
  address: TokenId.toAddress(token),
2217
- abi: tip20Abi,
2365
+ abi: Abis.tip20,
2218
2366
  ...callArgs,
2219
2367
  });
2220
2368
  }
@@ -2227,7 +2375,7 @@ export async function transfer(client, parameters) {
2227
2375
  */
2228
2376
  function extractEvent(logs) {
2229
2377
  const [log] = parseEventLogs({
2230
- abi: tip20Abi,
2378
+ abi: Abis.tip20,
2231
2379
  logs,
2232
2380
  eventName: 'Transfer',
2233
2381
  });
@@ -2306,9 +2454,10 @@ export async function unpause(client, parameters) {
2306
2454
  (function (unpause) {
2307
2455
  /** @internal */
2308
2456
  async function inner(action, client, parameters) {
2309
- const call = unpause.call(parameters);
2457
+ const { token, ...rest } = parameters;
2458
+ const call = unpause.call({ token });
2310
2459
  return (await action(client, {
2311
- ...parameters,
2460
+ ...rest,
2312
2461
  ...call,
2313
2462
  }));
2314
2463
  }
@@ -2348,7 +2497,7 @@ export async function unpause(client, parameters) {
2348
2497
  const { token } = args;
2349
2498
  return defineCall({
2350
2499
  address: TokenId.toAddress(token),
2351
- abi: tip20Abi,
2500
+ abi: Abis.tip20,
2352
2501
  functionName: 'unpause',
2353
2502
  args: [],
2354
2503
  });
@@ -2362,7 +2511,7 @@ export async function unpause(client, parameters) {
2362
2511
  */
2363
2512
  function extractEvent(logs) {
2364
2513
  const [log] = parseEventLogs({
2365
- abi: tip20Abi,
2514
+ abi: Abis.tip20,
2366
2515
  logs,
2367
2516
  eventName: 'PauseStateUpdate',
2368
2517
  });
@@ -2409,6 +2558,140 @@ export async function unpauseSync(client, parameters) {
2409
2558
  receipt,
2410
2559
  };
2411
2560
  }
2561
+ /**
2562
+ * Updates the quote token for a TIP20 token.
2563
+ *
2564
+ * @example
2565
+ * ```ts
2566
+ * import { createClient, http } from 'viem'
2567
+ * import { tempo } from 'tempo.ts/chains'
2568
+ * import * as actions from 'tempo.ts/viem/actions'
2569
+ * import { privateKeyToAccount } from 'viem/accounts'
2570
+ *
2571
+ * const client = createClient({
2572
+ * account: privateKeyToAccount('0x...'),
2573
+ * chain: tempo,
2574
+ * transport: http(),
2575
+ * })
2576
+ *
2577
+ * const result = await actions.token.updateQuoteToken(client, {
2578
+ * token: '0x...',
2579
+ * quoteToken: '0x...',
2580
+ * })
2581
+ * ```
2582
+ *
2583
+ * @param client - Client.
2584
+ * @param parameters - Parameters.
2585
+ * @returns The transaction hash.
2586
+ */
2587
+ export async function updateQuoteToken(client, parameters) {
2588
+ return updateQuoteToken.inner(writeContract, client, parameters);
2589
+ }
2590
+ (function (updateQuoteToken) {
2591
+ /** @internal */
2592
+ async function inner(action, client, parameters) {
2593
+ const { quoteToken, token, ...rest } = parameters;
2594
+ const call = updateQuoteToken.call({ quoteToken, token });
2595
+ return (await action(client, {
2596
+ ...rest,
2597
+ ...call,
2598
+ }));
2599
+ }
2600
+ updateQuoteToken.inner = inner;
2601
+ /**
2602
+ * Defines a call to the `updateQuoteToken` function.
2603
+ *
2604
+ * Can be passed as a parameter to:
2605
+ * - [`estimateContractGas`](https://viem.sh/docs/contract/estimateContractGas): estimate the gas cost of the call
2606
+ * - [`simulateContract`](https://viem.sh/docs/contract/simulateContract): simulate the call
2607
+ * - [`sendCalls`](https://viem.sh/docs/actions/wallet/sendCalls): send multiple calls
2608
+ *
2609
+ * @example
2610
+ * ```ts
2611
+ * import { createClient, http, walletActions } from 'viem'
2612
+ * import { tempo } from 'tempo.ts/chains'
2613
+ * import * as actions from 'tempo.ts/viem/actions'
2614
+ *
2615
+ * const client = createClient({
2616
+ * chain: tempo,
2617
+ * transport: http(),
2618
+ * }).extend(walletActions)
2619
+ *
2620
+ * const { result } = await client.sendCalls({
2621
+ * calls: [
2622
+ * actions.token.updateQuoteToken.call({
2623
+ * token: '0x20c0...babe',
2624
+ * quoteToken: '0x20c0...cafe',
2625
+ * }),
2626
+ * ]
2627
+ * })
2628
+ * ```
2629
+ *
2630
+ * @param args - Arguments.
2631
+ * @returns The call.
2632
+ */
2633
+ function call(args) {
2634
+ const { token, quoteToken } = args;
2635
+ return defineCall({
2636
+ address: TokenId.toAddress(token),
2637
+ abi: Abis.tip20,
2638
+ functionName: 'updateQuoteToken',
2639
+ args: [TokenId.toAddress(quoteToken)],
2640
+ });
2641
+ }
2642
+ updateQuoteToken.call = call;
2643
+ /**
2644
+ * Extracts the event from the logs.
2645
+ *
2646
+ * @param logs - Logs.
2647
+ * @returns The event.
2648
+ */
2649
+ function extractEvent(logs) {
2650
+ const [log] = parseEventLogs({
2651
+ abi: Abis.tip20,
2652
+ logs,
2653
+ eventName: 'UpdateQuoteToken',
2654
+ });
2655
+ if (!log)
2656
+ throw new Error('`UpdateQuoteToken` event not found.');
2657
+ return log;
2658
+ }
2659
+ updateQuoteToken.extractEvent = extractEvent;
2660
+ })(updateQuoteToken || (updateQuoteToken = {}));
2661
+ /**
2662
+ * Updates the quote token for a TIP20 token.
2663
+ *
2664
+ * @example
2665
+ * ```ts
2666
+ * import { createClient, http } from 'viem'
2667
+ * import { tempo } from 'tempo.ts/chains'
2668
+ * import * as actions from 'tempo.ts/viem/actions'
2669
+ * import { privateKeyToAccount } from 'viem/accounts'
2670
+ *
2671
+ * const client = createClient({
2672
+ * account: privateKeyToAccount('0x...'),
2673
+ * chain: tempo,
2674
+ * transport: http(),
2675
+ * })
2676
+ *
2677
+ * const result = await actions.token.updateQuoteTokenSync(client, {
2678
+ * token: '0x...',
2679
+ * quoteToken: '0x...',
2680
+ * })
2681
+ * ```
2682
+ *
2683
+ * @param client - Client.
2684
+ * @param parameters - Parameters.
2685
+ * @returns The transaction receipt and event data.
2686
+ */
2687
+ export async function updateQuoteTokenSync(client, parameters) {
2688
+ const receipt = await updateQuoteToken.inner(writeContractSync, client, parameters);
2689
+ const { args } = updateQuoteToken.extractEvent(receipt.logs);
2690
+ return {
2691
+ ...args,
2692
+ receipt,
2693
+ };
2694
+ }
2412
2695
  /**
2413
2696
  * Watches for TIP20 token approval events.
2414
2697
  *
@@ -2435,11 +2718,11 @@ export async function unpauseSync(client, parameters) {
2435
2718
  * @returns A function to unsubscribe from the event.
2436
2719
  */
2437
2720
  export function watchApprove(client, parameters) {
2438
- const { onApproval, token = usdAddress, ...rest } = parameters;
2721
+ const { onApproval, token = Addresses.defaultFeeToken, ...rest } = parameters;
2439
2722
  return watchContractEvent(client, {
2440
2723
  ...rest,
2441
2724
  address: TokenId.toAddress(token),
2442
- abi: tip20Abi,
2725
+ abi: Abis.tip20,
2443
2726
  eventName: 'Approval',
2444
2727
  onLogs: (logs) => {
2445
2728
  for (const log of logs)
@@ -2474,11 +2757,11 @@ export function watchApprove(client, parameters) {
2474
2757
  * @returns A function to unsubscribe from the event.
2475
2758
  */
2476
2759
  export function watchBurn(client, parameters) {
2477
- const { onBurn, token = usdAddress, ...rest } = parameters;
2760
+ const { onBurn, token = Addresses.defaultFeeToken, ...rest } = parameters;
2478
2761
  return watchContractEvent(client, {
2479
2762
  ...rest,
2480
2763
  address: TokenId.toAddress(token),
2481
- abi: tip20Abi,
2764
+ abi: Abis.tip20,
2482
2765
  eventName: 'Burn',
2483
2766
  onLogs: (logs) => {
2484
2767
  for (const log of logs)
@@ -2516,8 +2799,8 @@ export function watchCreate(client, parameters) {
2516
2799
  const { onTokenCreated, ...rest } = parameters;
2517
2800
  return watchContractEvent(client, {
2518
2801
  ...rest,
2519
- address: tip20FactoryAddress,
2520
- abi: tip20FactoryAbi,
2802
+ address: Addresses.tip20Factory,
2803
+ abi: Abis.tip20Factory,
2521
2804
  eventName: 'TokenCreated',
2522
2805
  onLogs: (logs) => {
2523
2806
  for (const log of logs)
@@ -2552,11 +2835,11 @@ export function watchCreate(client, parameters) {
2552
2835
  * @returns A function to unsubscribe from the event.
2553
2836
  */
2554
2837
  export function watchMint(client, parameters) {
2555
- const { onMint, token = usdAddress, ...rest } = parameters;
2838
+ const { onMint, token = Addresses.defaultFeeToken, ...rest } = parameters;
2556
2839
  return watchContractEvent(client, {
2557
2840
  ...rest,
2558
2841
  address: TokenId.toAddress(token),
2559
- abi: tip20Abi,
2842
+ abi: Abis.tip20,
2560
2843
  eventName: 'Mint',
2561
2844
  onLogs: (logs) => {
2562
2845
  for (const log of logs)
@@ -2591,11 +2874,11 @@ export function watchMint(client, parameters) {
2591
2874
  * @returns A function to unsubscribe from the event.
2592
2875
  */
2593
2876
  export function watchAdminRole(client, parameters) {
2594
- const { onRoleAdminUpdated, token = usdAddress, ...rest } = parameters;
2877
+ const { onRoleAdminUpdated, token = Addresses.defaultFeeToken, ...rest } = parameters;
2595
2878
  return watchContractEvent(client, {
2596
2879
  ...rest,
2597
2880
  address: TokenId.toAddress(token),
2598
- abi: tip20Abi,
2881
+ abi: Abis.tip20,
2599
2882
  eventName: 'RoleAdminUpdated',
2600
2883
  onLogs: (logs) => {
2601
2884
  for (const log of logs)
@@ -2630,11 +2913,11 @@ export function watchAdminRole(client, parameters) {
2630
2913
  * @returns A function to unsubscribe from the event.
2631
2914
  */
2632
2915
  export function watchRole(client, parameters) {
2633
- const { onRoleUpdated, token = usdAddress, ...rest } = parameters;
2916
+ const { onRoleUpdated, token = Addresses.defaultFeeToken, ...rest } = parameters;
2634
2917
  return watchContractEvent(client, {
2635
2918
  ...rest,
2636
2919
  address: TokenId.toAddress(token),
2637
- abi: tip20Abi,
2920
+ abi: Abis.tip20,
2638
2921
  eventName: 'RoleMembershipUpdated',
2639
2922
  onLogs: (logs) => {
2640
2923
  for (const log of logs) {
@@ -2672,11 +2955,11 @@ export function watchRole(client, parameters) {
2672
2955
  * @returns A function to unsubscribe from the event.
2673
2956
  */
2674
2957
  export function watchTransfer(client, parameters) {
2675
- const { onTransfer, token = usdAddress, ...rest } = parameters;
2958
+ const { onTransfer, token = Addresses.defaultFeeToken, ...rest } = parameters;
2676
2959
  return watchContractEvent(client, {
2677
2960
  ...rest,
2678
2961
  address: TokenId.toAddress(token),
2679
- abi: tip20Abi,
2962
+ abi: Abis.tip20,
2680
2963
  eventName: 'Transfer',
2681
2964
  onLogs: (logs) => {
2682
2965
  for (const log of logs)
@@ -2685,4 +2968,53 @@ export function watchTransfer(client, parameters) {
2685
2968
  strict: true,
2686
2969
  });
2687
2970
  }
2971
+ /**
2972
+ * Watches for TIP20 token quote token update events.
2973
+ *
2974
+ * @example
2975
+ * ```ts
2976
+ * import { createClient, http } from 'viem'
2977
+ * import { tempo } from 'tempo.ts/chains'
2978
+ * import * as actions from 'tempo.ts/viem/actions'
2979
+ *
2980
+ * const client = createClient({
2981
+ * chain: tempo,
2982
+ * transport: http(),
2983
+ * })
2984
+ *
2985
+ * const unwatch = actions.token.watchUpdateQuoteToken(client, {
2986
+ * onUpdateQuoteToken: (args, log) => {
2987
+ * if (args.finalized)
2988
+ * console.log('quote token update finalized:', args.newQuoteToken)
2989
+ * else
2990
+ * console.log('quote token update proposed:', args.newQuoteToken)
2991
+ * },
2992
+ * })
2993
+ * ```
2994
+ *
2995
+ * @param client - Client.
2996
+ * @param parameters - Parameters.
2997
+ * @returns A function to unsubscribe from the event.
2998
+ */
2999
+ export function watchUpdateQuoteToken(client, parameters) {
3000
+ const { onUpdateQuoteToken, token = Addresses.defaultFeeToken, ...rest } = parameters;
3001
+ const address = TokenId.toAddress(token);
3002
+ return watchContractEvent(client, {
3003
+ ...rest,
3004
+ address,
3005
+ abi: Abis.tip20,
3006
+ onLogs: (logs) => {
3007
+ for (const log of logs) {
3008
+ if (log.eventName !== 'UpdateQuoteToken' &&
3009
+ log.eventName !== 'QuoteTokenUpdateFinalized')
3010
+ continue;
3011
+ onUpdateQuoteToken({
3012
+ ...log.args,
3013
+ finalized: log.eventName === 'QuoteTokenUpdateFinalized',
3014
+ }, log);
3015
+ }
3016
+ },
3017
+ strict: true,
3018
+ });
3019
+ }
2688
3020
  //# sourceMappingURL=token.js.map