tempo.ts 0.0.6 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chains.d.ts +244 -541
- package/dist/chains.d.ts.map +1 -1
- package/dist/chains.js +10 -23
- package/dist/chains.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/ox/SignatureEnvelope.d.ts +245 -0
- package/dist/ox/SignatureEnvelope.d.ts.map +1 -0
- package/dist/ox/SignatureEnvelope.js +437 -0
- package/dist/ox/SignatureEnvelope.js.map +1 -0
- package/dist/ox/Transaction.d.ts +61 -24
- package/dist/ox/Transaction.d.ts.map +1 -1
- package/dist/ox/Transaction.js +63 -18
- package/dist/ox/Transaction.js.map +1 -1
- package/dist/ox/TransactionEnvelopeAA.d.ts +461 -0
- package/dist/ox/TransactionEnvelopeAA.d.ts.map +1 -0
- package/dist/ox/TransactionEnvelopeAA.js +528 -0
- package/dist/ox/TransactionEnvelopeAA.js.map +1 -0
- package/dist/ox/TransactionRequest.d.ts +7 -5
- package/dist/ox/TransactionRequest.d.ts.map +1 -1
- package/dist/ox/TransactionRequest.js +21 -12
- package/dist/ox/TransactionRequest.js.map +1 -1
- package/dist/ox/index.d.ts +5 -4
- package/dist/ox/index.d.ts.map +1 -1
- package/dist/ox/index.js +5 -4
- package/dist/ox/index.js.map +1 -1
- package/dist/prool/Instance.d.ts +0 -4
- package/dist/prool/Instance.d.ts.map +1 -1
- package/dist/prool/Instance.js +7 -7
- package/dist/prool/Instance.js.map +1 -1
- package/dist/prool/index.d.ts +1 -1
- package/dist/prool/index.d.ts.map +1 -1
- package/dist/prool/index.js +1 -1
- package/dist/prool/index.js.map +1 -1
- package/dist/viem/{abis.d.ts → Abis.d.ts} +523 -9
- package/dist/viem/Abis.d.ts.map +1 -0
- package/dist/viem/{abis.js → Abis.js} +321 -9
- package/dist/viem/Abis.js.map +1 -0
- package/dist/viem/{actions → Actions}/amm.d.ts +21 -21
- package/dist/viem/Actions/amm.d.ts.map +1 -0
- package/dist/viem/{actions → Actions}/amm.js +55 -43
- package/dist/viem/Actions/amm.js.map +1 -0
- package/dist/viem/Actions/dex.d.ts +3263 -0
- package/dist/viem/Actions/dex.d.ts.map +1 -0
- package/dist/viem/Actions/dex.js +1357 -0
- package/dist/viem/Actions/dex.js.map +1 -0
- package/dist/viem/{actions → Actions}/fee.d.ts +8 -8
- package/dist/viem/Actions/fee.d.ts.map +1 -0
- package/dist/viem/{actions → Actions}/fee.js +14 -13
- package/dist/viem/Actions/fee.js.map +1 -0
- package/dist/viem/Actions/index.d.ts +6 -0
- package/dist/viem/Actions/index.d.ts.map +1 -0
- package/dist/viem/Actions/index.js +6 -0
- package/dist/viem/Actions/index.js.map +1 -0
- package/dist/viem/{actions → Actions}/policy.d.ts +19 -19
- package/dist/viem/Actions/policy.d.ts.map +1 -0
- package/dist/viem/{actions → Actions}/policy.js +59 -46
- package/dist/viem/Actions/policy.js.map +1 -0
- package/dist/viem/{actions → Actions}/token.d.ts +3275 -698
- package/dist/viem/Actions/token.d.ts.map +1 -0
- package/dist/viem/{actions → Actions}/token.js +458 -84
- package/dist/viem/Actions/token.js.map +1 -0
- package/dist/viem/Addresses.d.ts +9 -0
- package/dist/viem/Addresses.d.ts.map +1 -0
- package/dist/viem/Addresses.js +9 -0
- package/dist/viem/Addresses.js.map +1 -0
- package/dist/viem/{chain.d.ts → Chain.d.ts} +81 -57
- package/dist/viem/Chain.d.ts.map +1 -0
- package/dist/viem/{chain.js → Chain.js} +7 -7
- package/dist/viem/Chain.js.map +1 -0
- package/dist/viem/{client.d.ts → Client.d.ts} +4 -4
- package/dist/viem/Client.d.ts.map +1 -0
- package/dist/viem/{client.js → Client.js} +3 -3
- package/dist/viem/Client.js.map +1 -0
- package/dist/viem/{decorator.d.ts → Decorator.d.ts} +507 -5
- package/dist/viem/Decorator.d.ts.map +1 -0
- package/dist/viem/{decorator.js → Decorator.js} +31 -5
- package/dist/viem/Decorator.js.map +1 -0
- package/dist/viem/{formatters.d.ts → Formatters.d.ts} +2 -2
- package/dist/viem/Formatters.d.ts.map +1 -0
- package/dist/viem/{formatters.js → Formatters.js} +24 -17
- package/dist/viem/Formatters.js.map +1 -0
- package/dist/viem/Tick.d.ts +111 -0
- package/dist/viem/Tick.d.ts.map +1 -0
- package/dist/viem/Tick.js +127 -0
- package/dist/viem/Tick.js.map +1 -0
- package/dist/viem/TokenIds.d.ts +3 -0
- package/dist/viem/TokenIds.d.ts.map +1 -0
- package/dist/viem/TokenIds.js +3 -0
- package/dist/viem/TokenIds.js.map +1 -0
- package/dist/viem/Transaction.d.ts +57 -0
- package/dist/viem/Transaction.d.ts.map +1 -0
- package/dist/viem/Transaction.js +137 -0
- package/dist/viem/Transaction.js.map +1 -0
- package/dist/viem/{transport.d.ts → Transport.d.ts} +3 -3
- package/dist/viem/Transport.d.ts.map +1 -0
- package/dist/viem/{transport.js → Transport.js} +3 -3
- package/dist/viem/Transport.js.map +1 -0
- package/dist/viem/index.d.ts +13 -9
- package/dist/viem/index.d.ts.map +1 -1
- package/dist/viem/index.js +13 -9
- package/dist/viem/index.js.map +1 -1
- package/dist/viem/{types.d.ts → internal/types.d.ts} +3 -3
- package/dist/viem/internal/types.d.ts.map +1 -0
- package/dist/viem/{types.js.map → internal/types.js.map} +1 -1
- package/dist/viem/internal/utils.d.ts.map +1 -0
- package/dist/viem/internal/utils.js.map +1 -0
- package/package.json +87 -101
- package/src/chains.ts +10 -24
- package/src/ox/SignatureEnvelope.test.ts +1252 -0
- package/src/ox/SignatureEnvelope.ts +709 -0
- package/src/ox/Transaction.test.ts +144 -89
- package/src/ox/Transaction.ts +104 -29
- package/src/ox/TransactionEnvelopeAA.test.ts +1533 -0
- package/src/ox/TransactionEnvelopeAA.ts +858 -0
- package/src/ox/TransactionRequest.ts +25 -17
- package/src/ox/index.ts +2 -1
- package/src/prool/Instance.ts +6 -14
- package/src/prool/internal/chain.json +101 -27
- package/src/viem/{abis.ts → Abis.ts} +322 -8
- package/src/viem/{actions → Actions}/amm.test.ts +65 -68
- package/src/viem/{actions → Actions}/amm.ts +72 -60
- package/src/viem/Actions/dex.test.ts +1608 -0
- package/src/viem/Actions/dex.ts +2026 -0
- package/src/viem/{actions → Actions}/fee.test.ts +34 -36
- package/src/viem/{actions → Actions}/fee.ts +18 -17
- package/src/viem/{actions → Actions}/index.ts +1 -0
- package/src/viem/{actions → Actions}/policy.test.ts +2 -2
- package/src/viem/{actions → Actions}/policy.ts +77 -64
- package/src/viem/{actions → Actions}/token.test.ts +419 -64
- package/src/viem/{actions → Actions}/token.ts +751 -145
- package/src/viem/Addresses.ts +9 -0
- package/src/viem/{chain.ts → Chain.ts} +6 -6
- package/src/viem/{client.bench-d.ts → Client.bench-d.ts} +2 -2
- package/src/viem/{client.test.ts → Client.test.ts} +31 -6
- package/src/viem/{client.ts → Client.ts} +1 -1
- package/src/viem/{decorator.bench-d.ts → Decorator.bench-d.ts} +2 -2
- package/src/viem/{decorator.test.ts → Decorator.test.ts} +1 -0
- package/src/viem/{decorator.ts → Decorator.ts} +586 -4
- package/src/viem/{formatters.ts → Formatters.ts} +31 -20
- package/src/viem/Tick.test.ts +281 -0
- package/src/viem/Tick.ts +176 -0
- package/src/viem/TokenIds.ts +2 -0
- package/src/viem/Transaction.ts +303 -0
- package/src/viem/{transport.ts → Transport.ts} +5 -5
- package/src/viem/e2e.test.ts +153 -78
- package/src/viem/index.ts +13 -9
- package/src/viem/{types.ts → internal/types.ts} +3 -3
- package/dist/ox/TransactionEnvelopeFeeToken.d.ts +0 -393
- package/dist/ox/TransactionEnvelopeFeeToken.d.ts.map +0 -1
- package/dist/ox/TransactionEnvelopeFeeToken.js +0 -452
- package/dist/ox/TransactionEnvelopeFeeToken.js.map +0 -1
- package/dist/viem/abis.d.ts.map +0 -1
- package/dist/viem/abis.js.map +0 -1
- package/dist/viem/actions/amm.d.ts.map +0 -1
- package/dist/viem/actions/amm.js.map +0 -1
- package/dist/viem/actions/fee.d.ts.map +0 -1
- package/dist/viem/actions/fee.js.map +0 -1
- package/dist/viem/actions/index.d.ts +0 -5
- package/dist/viem/actions/index.d.ts.map +0 -1
- package/dist/viem/actions/index.js +0 -5
- package/dist/viem/actions/index.js.map +0 -1
- package/dist/viem/actions/policy.d.ts.map +0 -1
- package/dist/viem/actions/policy.js.map +0 -1
- package/dist/viem/actions/token.d.ts.map +0 -1
- package/dist/viem/actions/token.js.map +0 -1
- package/dist/viem/addresses.d.ts +0 -8
- package/dist/viem/addresses.d.ts.map +0 -1
- package/dist/viem/addresses.js +0 -8
- package/dist/viem/addresses.js.map +0 -1
- package/dist/viem/chain.d.ts.map +0 -1
- package/dist/viem/chain.js.map +0 -1
- package/dist/viem/client.d.ts.map +0 -1
- package/dist/viem/client.js.map +0 -1
- package/dist/viem/decorator.d.ts.map +0 -1
- package/dist/viem/decorator.js.map +0 -1
- package/dist/viem/formatters.d.ts.map +0 -1
- package/dist/viem/formatters.js.map +0 -1
- package/dist/viem/transaction.d.ts +0 -54
- package/dist/viem/transaction.d.ts.map +0 -1
- package/dist/viem/transaction.js +0 -108
- package/dist/viem/transaction.js.map +0 -1
- package/dist/viem/transport.d.ts.map +0 -1
- package/dist/viem/transport.js.map +0 -1
- package/dist/viem/types.d.ts.map +0 -1
- package/dist/viem/utils.d.ts.map +0 -1
- package/dist/viem/utils.js.map +0 -1
- package/src/ox/TransactionEnvelopeFeeToken.test.ts +0 -1119
- package/src/ox/TransactionEnvelopeFeeToken.ts +0 -717
- package/src/prool/internal/consensus.toml +0 -32
- package/src/viem/addresses.ts +0 -10
- package/src/viem/transaction.ts +0 -253
- /package/dist/viem/{types.js → internal/types.js} +0 -0
- /package/dist/viem/{utils.d.ts → internal/utils.d.ts} +0 -0
- /package/dist/viem/{utils.js → internal/utils.js} +0 -0
- /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
|
|
35
|
-
import
|
|
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 =
|
|
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 `
|
|
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 =
|
|
149
|
+
const { spender, amount, token = Addresses.defaultFeeToken } = args
|
|
150
150
|
return defineCall({
|
|
151
151
|
address: TokenId.toAddress(token),
|
|
152
|
-
abi:
|
|
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:
|
|
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 =
|
|
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
|
|
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
|
|
310
|
+
const { amount, from, token, ...rest } = parameters
|
|
311
|
+
const call = burnBlocked.call({ amount, from, token })
|
|
311
312
|
return (await action(client, {
|
|
312
|
-
...
|
|
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:
|
|
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:
|
|
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
|
|
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
|
|
510
|
+
const { amount, memo, token, ...rest } = parameters
|
|
511
|
+
const call = burn.call({ amount, memo, token })
|
|
510
512
|
return (await action(client, {
|
|
511
|
-
...
|
|
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:
|
|
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:
|
|
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
|
|
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
|
|
713
|
+
const { policyId, token, ...rest } = parameters
|
|
714
|
+
const call = changeTransferPolicy.call({ policyId, token })
|
|
712
715
|
return (await action(client, {
|
|
713
|
-
...
|
|
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:
|
|
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:
|
|
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
|
|
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 {
|
|
976
|
+
const {
|
|
977
|
+
name,
|
|
978
|
+
symbol,
|
|
979
|
+
currency,
|
|
980
|
+
quoteToken = Addresses.defaultQuoteToken,
|
|
981
|
+
admin,
|
|
982
|
+
} = args
|
|
972
983
|
return defineCall({
|
|
973
|
-
address:
|
|
974
|
-
abi:
|
|
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:
|
|
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
|
|
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 `
|
|
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
|
|
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 =
|
|
1335
|
+
const { account, spender, token = Addresses.defaultFeeToken } = args
|
|
1135
1336
|
return defineCall({
|
|
1136
1337
|
address: TokenId.toAddress(token),
|
|
1137
|
-
abi:
|
|
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 `
|
|
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
|
|
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 =
|
|
1413
|
+
const { account, token = Addresses.defaultFeeToken } = args
|
|
1213
1414
|
return defineCall({
|
|
1214
1415
|
address: TokenId.toAddress(token),
|
|
1215
|
-
abi:
|
|
1416
|
+
abi: Abis.tip20,
|
|
1216
1417
|
functionName: 'balanceOf',
|
|
1217
1418
|
args: [account],
|
|
1218
1419
|
})
|
|
@@ -1248,9 +1449,50 @@ 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 =
|
|
1452
|
+
const { token = Addresses.defaultFeeToken, ...rest } = parameters
|
|
1252
1453
|
const address = TokenId.toAddress(token)
|
|
1253
|
-
const abi =
|
|
1454
|
+
const abi = Abis.tip20
|
|
1455
|
+
|
|
1456
|
+
if (token === TokenId.fromAddress(Addresses.defaultQuoteToken))
|
|
1457
|
+
return multicall(client, {
|
|
1458
|
+
...rest,
|
|
1459
|
+
contracts: [
|
|
1460
|
+
{
|
|
1461
|
+
address,
|
|
1462
|
+
abi,
|
|
1463
|
+
functionName: 'currency',
|
|
1464
|
+
},
|
|
1465
|
+
{
|
|
1466
|
+
address,
|
|
1467
|
+
abi,
|
|
1468
|
+
functionName: 'decimals',
|
|
1469
|
+
},
|
|
1470
|
+
{
|
|
1471
|
+
address,
|
|
1472
|
+
abi,
|
|
1473
|
+
functionName: 'name',
|
|
1474
|
+
},
|
|
1475
|
+
{
|
|
1476
|
+
address,
|
|
1477
|
+
abi,
|
|
1478
|
+
functionName: 'symbol',
|
|
1479
|
+
},
|
|
1480
|
+
{
|
|
1481
|
+
address,
|
|
1482
|
+
abi,
|
|
1483
|
+
functionName: 'totalSupply',
|
|
1484
|
+
},
|
|
1485
|
+
] as const,
|
|
1486
|
+
allowFailure: false,
|
|
1487
|
+
deployless: true,
|
|
1488
|
+
}).then(([currency, decimals, name, symbol, totalSupply]) => ({
|
|
1489
|
+
name,
|
|
1490
|
+
symbol,
|
|
1491
|
+
currency,
|
|
1492
|
+
decimals,
|
|
1493
|
+
totalSupply,
|
|
1494
|
+
}))
|
|
1495
|
+
|
|
1254
1496
|
return multicall(client, {
|
|
1255
1497
|
...rest,
|
|
1256
1498
|
contracts: [
|
|
@@ -1264,6 +1506,11 @@ export async function getMetadata<chain extends Chain | undefined>(
|
|
|
1264
1506
|
abi,
|
|
1265
1507
|
functionName: 'decimals',
|
|
1266
1508
|
},
|
|
1509
|
+
{
|
|
1510
|
+
address,
|
|
1511
|
+
abi,
|
|
1512
|
+
functionName: 'quoteToken',
|
|
1513
|
+
},
|
|
1267
1514
|
{
|
|
1268
1515
|
address,
|
|
1269
1516
|
abi,
|
|
@@ -1301,6 +1548,7 @@ export async function getMetadata<chain extends Chain | undefined>(
|
|
|
1301
1548
|
([
|
|
1302
1549
|
currency,
|
|
1303
1550
|
decimals,
|
|
1551
|
+
quoteToken,
|
|
1304
1552
|
name,
|
|
1305
1553
|
paused,
|
|
1306
1554
|
supplyCap,
|
|
@@ -1312,6 +1560,7 @@ export async function getMetadata<chain extends Chain | undefined>(
|
|
|
1312
1560
|
symbol,
|
|
1313
1561
|
currency,
|
|
1314
1562
|
decimals,
|
|
1563
|
+
quoteToken,
|
|
1315
1564
|
totalSupply,
|
|
1316
1565
|
paused,
|
|
1317
1566
|
supplyCap,
|
|
@@ -1322,27 +1571,56 @@ export async function getMetadata<chain extends Chain | undefined>(
|
|
|
1322
1571
|
|
|
1323
1572
|
export declare namespace getMetadata {
|
|
1324
1573
|
export type Parameters = {
|
|
1325
|
-
/** Address or ID of the TIP20 token. @default `
|
|
1574
|
+
/** Address or ID of the TIP20 token. @default `Addresses.defaultFeeToken` */
|
|
1326
1575
|
token?: TokenId.TokenIdOrAddress | undefined
|
|
1327
1576
|
}
|
|
1328
1577
|
|
|
1329
1578
|
export type ReturnValue = Compute<{
|
|
1330
|
-
/**
|
|
1579
|
+
/**
|
|
1580
|
+
* Currency (e.g. "USD").
|
|
1581
|
+
*/
|
|
1331
1582
|
currency: string
|
|
1332
|
-
/**
|
|
1583
|
+
/**
|
|
1584
|
+
* Decimals of the token.
|
|
1585
|
+
*/
|
|
1333
1586
|
decimals: number
|
|
1334
|
-
/**
|
|
1587
|
+
/**
|
|
1588
|
+
* Quote token.
|
|
1589
|
+
*
|
|
1590
|
+
* Returns `undefined` for the default quote token (`0x20c...0000`).
|
|
1591
|
+
*/
|
|
1592
|
+
quoteToken?: Address | undefined
|
|
1593
|
+
/**
|
|
1594
|
+
* Name of the token.
|
|
1595
|
+
*/
|
|
1335
1596
|
name: string
|
|
1336
|
-
/**
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1597
|
+
/**
|
|
1598
|
+
* Whether the token is paused.
|
|
1599
|
+
*
|
|
1600
|
+
* Returns `undefined` for the default quote token (`0x20c...0000`).
|
|
1601
|
+
*/
|
|
1602
|
+
paused?: boolean | undefined
|
|
1603
|
+
/**
|
|
1604
|
+
* Supply cap.
|
|
1605
|
+
*
|
|
1606
|
+
* Returns `undefined` for the default quote token (`0x20c...0000`).
|
|
1607
|
+
*/
|
|
1608
|
+
supplyCap?: bigint | undefined
|
|
1609
|
+
/**
|
|
1610
|
+
* Symbol of the token.
|
|
1611
|
+
*/
|
|
1341
1612
|
symbol: string
|
|
1342
|
-
/**
|
|
1613
|
+
/**
|
|
1614
|
+
* Total supply of the token.
|
|
1615
|
+
*/
|
|
1343
1616
|
totalSupply: bigint
|
|
1344
|
-
/**
|
|
1345
|
-
|
|
1617
|
+
/**
|
|
1618
|
+
* Transfer policy ID.
|
|
1619
|
+
* 0="always-reject", 1="always-allow", >2=custom policy
|
|
1620
|
+
*
|
|
1621
|
+
* Returns `undefined` for the default quote token (`0x20c...0000`).
|
|
1622
|
+
*/
|
|
1623
|
+
transferPolicyId?: bigint | undefined
|
|
1346
1624
|
}>
|
|
1347
1625
|
}
|
|
1348
1626
|
|
|
@@ -1402,7 +1680,7 @@ export namespace hasRole {
|
|
|
1402
1680
|
}
|
|
1403
1681
|
|
|
1404
1682
|
export type ReturnValue = ReadContractReturnType<
|
|
1405
|
-
typeof
|
|
1683
|
+
typeof Abis.tip20,
|
|
1406
1684
|
'hasRole',
|
|
1407
1685
|
never
|
|
1408
1686
|
>
|
|
@@ -1417,7 +1695,7 @@ export namespace hasRole {
|
|
|
1417
1695
|
const { account, role, token } = args
|
|
1418
1696
|
return defineCall({
|
|
1419
1697
|
address: TokenId.toAddress(token),
|
|
1420
|
-
abi:
|
|
1698
|
+
abi: Abis.tip20,
|
|
1421
1699
|
functionName: 'hasRole',
|
|
1422
1700
|
args: [account, TokenRole.serialize(role)],
|
|
1423
1701
|
})
|
|
@@ -1542,7 +1820,7 @@ export namespace grantRoles {
|
|
|
1542
1820
|
const roleHash = TokenRole.serialize(role)
|
|
1543
1821
|
return defineCall({
|
|
1544
1822
|
address: TokenId.toAddress(token),
|
|
1545
|
-
abi:
|
|
1823
|
+
abi: Abis.tip20,
|
|
1546
1824
|
functionName: 'grantRole',
|
|
1547
1825
|
args: [roleHash, to],
|
|
1548
1826
|
})
|
|
@@ -1556,7 +1834,7 @@ export namespace grantRoles {
|
|
|
1556
1834
|
*/
|
|
1557
1835
|
export function extractEvents(logs: Log[]) {
|
|
1558
1836
|
const events = parseEventLogs({
|
|
1559
|
-
abi:
|
|
1837
|
+
abi: Abis.tip20,
|
|
1560
1838
|
logs,
|
|
1561
1839
|
eventName: 'RoleMembershipUpdated',
|
|
1562
1840
|
})
|
|
@@ -1624,7 +1902,7 @@ export namespace grantRolesSync {
|
|
|
1624
1902
|
export type ReturnValue = {
|
|
1625
1903
|
receipt: TransactionReceipt
|
|
1626
1904
|
value: readonly GetEventArgs<
|
|
1627
|
-
typeof
|
|
1905
|
+
typeof Abis.tip20,
|
|
1628
1906
|
'RoleMembershipUpdated',
|
|
1629
1907
|
{ IndexedOnly: false; Required: true }
|
|
1630
1908
|
>[]
|
|
@@ -1700,7 +1978,6 @@ export namespace mint {
|
|
|
1700
1978
|
const call = mint.call(parameters)
|
|
1701
1979
|
return (await action(client, {
|
|
1702
1980
|
...parameters,
|
|
1703
|
-
gas: 30_000n,
|
|
1704
1981
|
...call,
|
|
1705
1982
|
} as never)) as never
|
|
1706
1983
|
}
|
|
@@ -1751,7 +2028,7 @@ export namespace mint {
|
|
|
1751
2028
|
} as const)
|
|
1752
2029
|
return defineCall({
|
|
1753
2030
|
address: TokenId.toAddress(token),
|
|
1754
|
-
abi:
|
|
2031
|
+
abi: Abis.tip20,
|
|
1755
2032
|
...callArgs,
|
|
1756
2033
|
})
|
|
1757
2034
|
}
|
|
@@ -1764,7 +2041,7 @@ export namespace mint {
|
|
|
1764
2041
|
*/
|
|
1765
2042
|
export function extractEvent(logs: Log[]) {
|
|
1766
2043
|
const [log] = parseEventLogs({
|
|
1767
|
-
abi:
|
|
2044
|
+
abi: Abis.tip20,
|
|
1768
2045
|
logs,
|
|
1769
2046
|
eventName: 'Mint',
|
|
1770
2047
|
})
|
|
@@ -1829,7 +2106,7 @@ export namespace mintSync {
|
|
|
1829
2106
|
|
|
1830
2107
|
export type ReturnValue = Compute<
|
|
1831
2108
|
GetEventArgs<
|
|
1832
|
-
typeof
|
|
2109
|
+
typeof Abis.tip20,
|
|
1833
2110
|
'Mint',
|
|
1834
2111
|
{
|
|
1835
2112
|
IndexedOnly: false
|
|
@@ -1899,9 +2176,10 @@ export namespace pause {
|
|
|
1899
2176
|
client: Client<Transport, chain, account>,
|
|
1900
2177
|
parameters: pause.Parameters<chain, account>,
|
|
1901
2178
|
): Promise<ReturnType<action>> {
|
|
1902
|
-
const
|
|
2179
|
+
const { token, ...rest } = parameters
|
|
2180
|
+
const call = pause.call({ token })
|
|
1903
2181
|
return (await action(client, {
|
|
1904
|
-
...
|
|
2182
|
+
...rest,
|
|
1905
2183
|
...call,
|
|
1906
2184
|
} as never)) as never
|
|
1907
2185
|
}
|
|
@@ -1941,7 +2219,7 @@ export namespace pause {
|
|
|
1941
2219
|
const { token } = args
|
|
1942
2220
|
return defineCall({
|
|
1943
2221
|
address: TokenId.toAddress(token),
|
|
1944
|
-
abi:
|
|
2222
|
+
abi: Abis.tip20,
|
|
1945
2223
|
functionName: 'pause',
|
|
1946
2224
|
args: [],
|
|
1947
2225
|
})
|
|
@@ -1955,7 +2233,7 @@ export namespace pause {
|
|
|
1955
2233
|
*/
|
|
1956
2234
|
export function extractEvent(logs: Log[]) {
|
|
1957
2235
|
const [log] = parseEventLogs({
|
|
1958
|
-
abi:
|
|
2236
|
+
abi: Abis.tip20,
|
|
1959
2237
|
logs,
|
|
1960
2238
|
eventName: 'PauseStateUpdate',
|
|
1961
2239
|
})
|
|
@@ -2017,7 +2295,7 @@ export namespace pauseSync {
|
|
|
2017
2295
|
export type Args = pause.Args
|
|
2018
2296
|
|
|
2019
2297
|
export type ReturnValue = GetEventArgs<
|
|
2020
|
-
typeof
|
|
2298
|
+
typeof Abis.tip20,
|
|
2021
2299
|
'PauseStateUpdate',
|
|
2022
2300
|
{ IndexedOnly: false; Required: true }
|
|
2023
2301
|
> & {
|
|
@@ -2079,7 +2357,7 @@ export namespace permit {
|
|
|
2079
2357
|
signature: Signature.Signature
|
|
2080
2358
|
/** Address of the spender. */
|
|
2081
2359
|
spender: Address
|
|
2082
|
-
/** Address or ID of the TIP20 token. @default `
|
|
2360
|
+
/** Address or ID of the TIP20 token. @default `Addresses.defaultFeeToken` */
|
|
2083
2361
|
token?: TokenId.TokenIdOrAddress | undefined
|
|
2084
2362
|
/** Amount to approve. */
|
|
2085
2363
|
value: bigint
|
|
@@ -2097,9 +2375,18 @@ export namespace permit {
|
|
|
2097
2375
|
client: Client<Transport, chain, account>,
|
|
2098
2376
|
parameters: permit.Parameters<chain, account>,
|
|
2099
2377
|
): Promise<ReturnType<action>> {
|
|
2100
|
-
const
|
|
2378
|
+
const { owner, spender, value, deadline, signature, token, ...rest } =
|
|
2379
|
+
parameters
|
|
2380
|
+
const call = permit.call({
|
|
2381
|
+
owner,
|
|
2382
|
+
spender,
|
|
2383
|
+
value,
|
|
2384
|
+
deadline,
|
|
2385
|
+
signature,
|
|
2386
|
+
token,
|
|
2387
|
+
})
|
|
2101
2388
|
return (await action(client, {
|
|
2102
|
-
...
|
|
2389
|
+
...rest,
|
|
2103
2390
|
...call,
|
|
2104
2391
|
} as never)) as never
|
|
2105
2392
|
}
|
|
@@ -2147,13 +2434,13 @@ export namespace permit {
|
|
|
2147
2434
|
value,
|
|
2148
2435
|
deadline,
|
|
2149
2436
|
signature,
|
|
2150
|
-
token =
|
|
2437
|
+
token = Addresses.defaultFeeToken,
|
|
2151
2438
|
} = args
|
|
2152
2439
|
const { r, s, yParity } = Signature.from(signature)
|
|
2153
2440
|
const v = Signature.yParityToV(yParity)
|
|
2154
2441
|
return defineCall({
|
|
2155
2442
|
address: TokenId.toAddress(token),
|
|
2156
|
-
abi:
|
|
2443
|
+
abi: Abis.tip20,
|
|
2157
2444
|
functionName: 'permit',
|
|
2158
2445
|
args: [
|
|
2159
2446
|
owner,
|
|
@@ -2175,7 +2462,7 @@ export namespace permit {
|
|
|
2175
2462
|
*/
|
|
2176
2463
|
export function extractEvent(logs: Log[]) {
|
|
2177
2464
|
const [log] = parseEventLogs({
|
|
2178
|
-
abi:
|
|
2465
|
+
abi: Abis.tip20,
|
|
2179
2466
|
logs,
|
|
2180
2467
|
eventName: 'Approval',
|
|
2181
2468
|
})
|
|
@@ -2241,7 +2528,7 @@ export namespace permitSync {
|
|
|
2241
2528
|
export type Args = permit.Args
|
|
2242
2529
|
|
|
2243
2530
|
export type ReturnValue = GetEventArgs<
|
|
2244
|
-
typeof
|
|
2531
|
+
typeof Abis.tip20,
|
|
2245
2532
|
'Approval',
|
|
2246
2533
|
{ IndexedOnly: false; Required: true }
|
|
2247
2534
|
> & {
|
|
@@ -2363,7 +2650,7 @@ export namespace renounceRoles {
|
|
|
2363
2650
|
const roleHash = TokenRole.serialize(role)
|
|
2364
2651
|
return defineCall({
|
|
2365
2652
|
address: TokenId.toAddress(token),
|
|
2366
|
-
abi:
|
|
2653
|
+
abi: Abis.tip20,
|
|
2367
2654
|
functionName: 'renounceRole',
|
|
2368
2655
|
args: [roleHash],
|
|
2369
2656
|
})
|
|
@@ -2377,7 +2664,7 @@ export namespace renounceRoles {
|
|
|
2377
2664
|
*/
|
|
2378
2665
|
export function extractEvents(logs: Log[]) {
|
|
2379
2666
|
const events = parseEventLogs({
|
|
2380
|
-
abi:
|
|
2667
|
+
abi: Abis.tip20,
|
|
2381
2668
|
logs,
|
|
2382
2669
|
eventName: 'RoleMembershipUpdated',
|
|
2383
2670
|
})
|
|
@@ -2444,7 +2731,7 @@ export namespace renounceRolesSync {
|
|
|
2444
2731
|
export type ReturnValue = {
|
|
2445
2732
|
receipt: TransactionReceipt
|
|
2446
2733
|
value: readonly GetEventArgs<
|
|
2447
|
-
typeof
|
|
2734
|
+
typeof Abis.tip20,
|
|
2448
2735
|
'RoleMembershipUpdated',
|
|
2449
2736
|
{ IndexedOnly: false; Required: true }
|
|
2450
2737
|
>[]
|
|
@@ -2569,7 +2856,7 @@ export namespace revokeRoles {
|
|
|
2569
2856
|
const roleHash = TokenRole.serialize(role)
|
|
2570
2857
|
return defineCall({
|
|
2571
2858
|
address: TokenId.toAddress(token),
|
|
2572
|
-
abi:
|
|
2859
|
+
abi: Abis.tip20,
|
|
2573
2860
|
functionName: 'revokeRole',
|
|
2574
2861
|
args: [roleHash, from],
|
|
2575
2862
|
})
|
|
@@ -2583,7 +2870,7 @@ export namespace revokeRoles {
|
|
|
2583
2870
|
*/
|
|
2584
2871
|
export function extractEvents(logs: Log[]) {
|
|
2585
2872
|
const events = parseEventLogs({
|
|
2586
|
-
abi:
|
|
2873
|
+
abi: Abis.tip20,
|
|
2587
2874
|
logs,
|
|
2588
2875
|
eventName: 'RoleMembershipUpdated',
|
|
2589
2876
|
})
|
|
@@ -2651,7 +2938,7 @@ export namespace revokeRolesSync {
|
|
|
2651
2938
|
export type ReturnValue = {
|
|
2652
2939
|
receipt: TransactionReceipt
|
|
2653
2940
|
value: readonly GetEventArgs<
|
|
2654
|
-
typeof
|
|
2941
|
+
typeof Abis.tip20,
|
|
2655
2942
|
'RoleMembershipUpdated',
|
|
2656
2943
|
{ IndexedOnly: false; Required: true }
|
|
2657
2944
|
>[]
|
|
@@ -2719,9 +3006,10 @@ export namespace setSupplyCap {
|
|
|
2719
3006
|
client: Client<Transport, chain, account>,
|
|
2720
3007
|
parameters: setSupplyCap.Parameters<chain, account>,
|
|
2721
3008
|
): Promise<ReturnType<action>> {
|
|
2722
|
-
const
|
|
3009
|
+
const { supplyCap, token, ...rest } = parameters
|
|
3010
|
+
const call = setSupplyCap.call({ supplyCap, token })
|
|
2723
3011
|
return (await action(client, {
|
|
2724
|
-
...
|
|
3012
|
+
...rest,
|
|
2725
3013
|
...call,
|
|
2726
3014
|
} as never)) as never
|
|
2727
3015
|
}
|
|
@@ -2762,7 +3050,7 @@ export namespace setSupplyCap {
|
|
|
2762
3050
|
const { token, supplyCap } = args
|
|
2763
3051
|
return defineCall({
|
|
2764
3052
|
address: TokenId.toAddress(token),
|
|
2765
|
-
abi:
|
|
3053
|
+
abi: Abis.tip20,
|
|
2766
3054
|
functionName: 'setSupplyCap',
|
|
2767
3055
|
args: [supplyCap],
|
|
2768
3056
|
})
|
|
@@ -2776,7 +3064,7 @@ export namespace setSupplyCap {
|
|
|
2776
3064
|
*/
|
|
2777
3065
|
export function extractEvent(logs: Log[]) {
|
|
2778
3066
|
const [log] = parseEventLogs({
|
|
2779
|
-
abi:
|
|
3067
|
+
abi: Abis.tip20,
|
|
2780
3068
|
logs,
|
|
2781
3069
|
eventName: 'SupplyCapUpdate',
|
|
2782
3070
|
})
|
|
@@ -2839,7 +3127,7 @@ export namespace setSupplyCapSync {
|
|
|
2839
3127
|
export type Args = setSupplyCap.Args
|
|
2840
3128
|
|
|
2841
3129
|
export type ReturnValue = GetEventArgs<
|
|
2842
|
-
typeof
|
|
3130
|
+
typeof Abis.tip20,
|
|
2843
3131
|
'SupplyCapUpdate',
|
|
2844
3132
|
{ IndexedOnly: false; Required: true }
|
|
2845
3133
|
> & {
|
|
@@ -2911,9 +3199,10 @@ export namespace setRoleAdmin {
|
|
|
2911
3199
|
client: Client<Transport, chain, account>,
|
|
2912
3200
|
parameters: setRoleAdmin.Parameters<chain, account>,
|
|
2913
3201
|
): Promise<ReturnType<action>> {
|
|
2914
|
-
const
|
|
3202
|
+
const { adminRole, role, token, ...rest } = parameters
|
|
3203
|
+
const call = setRoleAdmin.call({ adminRole, role, token })
|
|
2915
3204
|
return (await action(client, {
|
|
2916
|
-
...
|
|
3205
|
+
...rest,
|
|
2917
3206
|
...call,
|
|
2918
3207
|
} as never)) as never
|
|
2919
3208
|
}
|
|
@@ -2957,7 +3246,7 @@ export namespace setRoleAdmin {
|
|
|
2957
3246
|
const adminRoleHash = TokenRole.serialize(adminRole)
|
|
2958
3247
|
return defineCall({
|
|
2959
3248
|
address: TokenId.toAddress(token),
|
|
2960
|
-
abi:
|
|
3249
|
+
abi: Abis.tip20,
|
|
2961
3250
|
functionName: 'setRoleAdmin',
|
|
2962
3251
|
args: [roleHash, adminRoleHash],
|
|
2963
3252
|
})
|
|
@@ -2971,7 +3260,7 @@ export namespace setRoleAdmin {
|
|
|
2971
3260
|
*/
|
|
2972
3261
|
export function extractEvent(logs: Log[]) {
|
|
2973
3262
|
const [log] = parseEventLogs({
|
|
2974
|
-
abi:
|
|
3263
|
+
abi: Abis.tip20,
|
|
2975
3264
|
logs,
|
|
2976
3265
|
eventName: 'RoleAdminUpdated',
|
|
2977
3266
|
})
|
|
@@ -3035,7 +3324,7 @@ export namespace setRoleAdminSync {
|
|
|
3035
3324
|
export type Args = setRoleAdmin.Args
|
|
3036
3325
|
|
|
3037
3326
|
export type ReturnValue = GetEventArgs<
|
|
3038
|
-
typeof
|
|
3327
|
+
typeof Abis.tip20,
|
|
3039
3328
|
'RoleAdminUpdated',
|
|
3040
3329
|
{ IndexedOnly: false; Required: true }
|
|
3041
3330
|
> & {
|
|
@@ -3092,7 +3381,7 @@ export namespace transfer {
|
|
|
3092
3381
|
from?: Address | undefined
|
|
3093
3382
|
/** Memo to include in the transfer. */
|
|
3094
3383
|
memo?: Hex.Hex | undefined
|
|
3095
|
-
/** Address or ID of the TIP20 token. @default `
|
|
3384
|
+
/** Address or ID of the TIP20 token. @default `Addresses.defaultFeeToken` */
|
|
3096
3385
|
token?: TokenId.TokenIdOrAddress | undefined
|
|
3097
3386
|
/** Address to transfer tokens to. */
|
|
3098
3387
|
to: Address
|
|
@@ -3110,9 +3399,10 @@ export namespace transfer {
|
|
|
3110
3399
|
client: Client<Transport, chain, account>,
|
|
3111
3400
|
parameters: transfer.Parameters<chain, account>,
|
|
3112
3401
|
): Promise<ReturnType<action>> {
|
|
3113
|
-
const
|
|
3402
|
+
const { amount, from, memo, token, to, ...rest } = parameters
|
|
3403
|
+
const call = transfer.call({ amount, from, memo, token, to })
|
|
3114
3404
|
return (await action(client, {
|
|
3115
|
-
...
|
|
3405
|
+
...rest,
|
|
3116
3406
|
...call,
|
|
3117
3407
|
} as never)) as never
|
|
3118
3408
|
}
|
|
@@ -3151,7 +3441,7 @@ export namespace transfer {
|
|
|
3151
3441
|
* @returns The call.
|
|
3152
3442
|
*/
|
|
3153
3443
|
export function call(args: Args) {
|
|
3154
|
-
const { amount, from, memo, token =
|
|
3444
|
+
const { amount, from, memo, token = Addresses.defaultFeeToken, to } = args
|
|
3155
3445
|
const callArgs = (() => {
|
|
3156
3446
|
if (memo && from)
|
|
3157
3447
|
return {
|
|
@@ -3175,7 +3465,7 @@ export namespace transfer {
|
|
|
3175
3465
|
})()
|
|
3176
3466
|
return defineCall({
|
|
3177
3467
|
address: TokenId.toAddress(token),
|
|
3178
|
-
abi:
|
|
3468
|
+
abi: Abis.tip20,
|
|
3179
3469
|
...callArgs,
|
|
3180
3470
|
})
|
|
3181
3471
|
}
|
|
@@ -3188,7 +3478,7 @@ export namespace transfer {
|
|
|
3188
3478
|
*/
|
|
3189
3479
|
export function extractEvent(logs: Log[]) {
|
|
3190
3480
|
const [log] = parseEventLogs({
|
|
3191
|
-
abi:
|
|
3481
|
+
abi: Abis.tip20,
|
|
3192
3482
|
logs,
|
|
3193
3483
|
eventName: 'Transfer',
|
|
3194
3484
|
})
|
|
@@ -3251,7 +3541,7 @@ export namespace transferSync {
|
|
|
3251
3541
|
export type Args = transfer.Args
|
|
3252
3542
|
|
|
3253
3543
|
export type ReturnValue = GetEventArgs<
|
|
3254
|
-
typeof
|
|
3544
|
+
typeof Abis.tip20,
|
|
3255
3545
|
'Transfer',
|
|
3256
3546
|
{ IndexedOnly: false; Required: true }
|
|
3257
3547
|
> & {
|
|
@@ -3317,9 +3607,10 @@ export namespace unpause {
|
|
|
3317
3607
|
client: Client<Transport, chain, account>,
|
|
3318
3608
|
parameters: unpause.Parameters<chain, account>,
|
|
3319
3609
|
): Promise<ReturnType<action>> {
|
|
3320
|
-
const
|
|
3610
|
+
const { token, ...rest } = parameters
|
|
3611
|
+
const call = unpause.call({ token })
|
|
3321
3612
|
return (await action(client, {
|
|
3322
|
-
...
|
|
3613
|
+
...rest,
|
|
3323
3614
|
...call,
|
|
3324
3615
|
} as never)) as never
|
|
3325
3616
|
}
|
|
@@ -3359,7 +3650,7 @@ export namespace unpause {
|
|
|
3359
3650
|
const { token } = args
|
|
3360
3651
|
return defineCall({
|
|
3361
3652
|
address: TokenId.toAddress(token),
|
|
3362
|
-
abi:
|
|
3653
|
+
abi: Abis.tip20,
|
|
3363
3654
|
functionName: 'unpause',
|
|
3364
3655
|
args: [],
|
|
3365
3656
|
})
|
|
@@ -3373,7 +3664,7 @@ export namespace unpause {
|
|
|
3373
3664
|
*/
|
|
3374
3665
|
export function extractEvent(logs: Log[]) {
|
|
3375
3666
|
const [log] = parseEventLogs({
|
|
3376
|
-
abi:
|
|
3667
|
+
abi: Abis.tip20,
|
|
3377
3668
|
logs,
|
|
3378
3669
|
eventName: 'PauseStateUpdate',
|
|
3379
3670
|
})
|
|
@@ -3435,7 +3726,7 @@ export namespace unpauseSync {
|
|
|
3435
3726
|
export type Args = unpause.Args
|
|
3436
3727
|
|
|
3437
3728
|
export type ReturnValue = GetEventArgs<
|
|
3438
|
-
typeof
|
|
3729
|
+
typeof Abis.tip20,
|
|
3439
3730
|
'PauseStateUpdate',
|
|
3440
3731
|
{ IndexedOnly: false; Required: true }
|
|
3441
3732
|
> & {
|
|
@@ -3443,6 +3734,201 @@ export namespace unpauseSync {
|
|
|
3443
3734
|
}
|
|
3444
3735
|
}
|
|
3445
3736
|
|
|
3737
|
+
/**
|
|
3738
|
+
* Updates the quote token for a TIP20 token.
|
|
3739
|
+
*
|
|
3740
|
+
* @example
|
|
3741
|
+
* ```ts
|
|
3742
|
+
* import { createClient, http } from 'viem'
|
|
3743
|
+
* import { tempo } from 'tempo.ts/chains'
|
|
3744
|
+
* import * as actions from 'tempo.ts/viem/actions'
|
|
3745
|
+
* import { privateKeyToAccount } from 'viem/accounts'
|
|
3746
|
+
*
|
|
3747
|
+
* const client = createClient({
|
|
3748
|
+
* account: privateKeyToAccount('0x...'),
|
|
3749
|
+
* chain: tempo,
|
|
3750
|
+
* transport: http(),
|
|
3751
|
+
* })
|
|
3752
|
+
*
|
|
3753
|
+
* const result = await actions.token.updateQuoteToken(client, {
|
|
3754
|
+
* token: '0x...',
|
|
3755
|
+
* quoteToken: '0x...',
|
|
3756
|
+
* })
|
|
3757
|
+
* ```
|
|
3758
|
+
*
|
|
3759
|
+
* @param client - Client.
|
|
3760
|
+
* @param parameters - Parameters.
|
|
3761
|
+
* @returns The transaction hash.
|
|
3762
|
+
*/
|
|
3763
|
+
export async function updateQuoteToken<
|
|
3764
|
+
chain extends Chain | undefined,
|
|
3765
|
+
account extends Account | undefined,
|
|
3766
|
+
>(
|
|
3767
|
+
client: Client<Transport, chain, account>,
|
|
3768
|
+
parameters: updateQuoteToken.Parameters<chain, account>,
|
|
3769
|
+
): Promise<updateQuoteToken.ReturnValue> {
|
|
3770
|
+
return updateQuoteToken.inner(writeContract, client, parameters)
|
|
3771
|
+
}
|
|
3772
|
+
|
|
3773
|
+
export namespace updateQuoteToken {
|
|
3774
|
+
export type Parameters<
|
|
3775
|
+
chain extends Chain | undefined = Chain | undefined,
|
|
3776
|
+
account extends Account | undefined = Account | undefined,
|
|
3777
|
+
> = WriteParameters<chain, account> & Args
|
|
3778
|
+
|
|
3779
|
+
export type Args = {
|
|
3780
|
+
/** New quote token address. */
|
|
3781
|
+
quoteToken: TokenId.TokenIdOrAddress
|
|
3782
|
+
/** Address or ID of the TIP20 token. */
|
|
3783
|
+
token: TokenId.TokenIdOrAddress
|
|
3784
|
+
}
|
|
3785
|
+
|
|
3786
|
+
export type ReturnValue = WriteContractReturnType
|
|
3787
|
+
|
|
3788
|
+
/** @internal */
|
|
3789
|
+
export async function inner<
|
|
3790
|
+
action extends typeof writeContract | typeof writeContractSync,
|
|
3791
|
+
chain extends Chain | undefined,
|
|
3792
|
+
account extends Account | undefined,
|
|
3793
|
+
>(
|
|
3794
|
+
action: action,
|
|
3795
|
+
client: Client<Transport, chain, account>,
|
|
3796
|
+
parameters: updateQuoteToken.Parameters<chain, account>,
|
|
3797
|
+
): Promise<ReturnType<action>> {
|
|
3798
|
+
const { quoteToken, token, ...rest } = parameters
|
|
3799
|
+
const call = updateQuoteToken.call({ quoteToken, token })
|
|
3800
|
+
return (await action(client, {
|
|
3801
|
+
...rest,
|
|
3802
|
+
...call,
|
|
3803
|
+
} as never)) as never
|
|
3804
|
+
}
|
|
3805
|
+
|
|
3806
|
+
/**
|
|
3807
|
+
* Defines a call to the `updateQuoteToken` function.
|
|
3808
|
+
*
|
|
3809
|
+
* Can be passed as a parameter to:
|
|
3810
|
+
* - [`estimateContractGas`](https://viem.sh/docs/contract/estimateContractGas): estimate the gas cost of the call
|
|
3811
|
+
* - [`simulateContract`](https://viem.sh/docs/contract/simulateContract): simulate the call
|
|
3812
|
+
* - [`sendCalls`](https://viem.sh/docs/actions/wallet/sendCalls): send multiple calls
|
|
3813
|
+
*
|
|
3814
|
+
* @example
|
|
3815
|
+
* ```ts
|
|
3816
|
+
* import { createClient, http, walletActions } from 'viem'
|
|
3817
|
+
* import { tempo } from 'tempo.ts/chains'
|
|
3818
|
+
* import * as actions from 'tempo.ts/viem/actions'
|
|
3819
|
+
*
|
|
3820
|
+
* const client = createClient({
|
|
3821
|
+
* chain: tempo,
|
|
3822
|
+
* transport: http(),
|
|
3823
|
+
* }).extend(walletActions)
|
|
3824
|
+
*
|
|
3825
|
+
* const { result } = await client.sendCalls({
|
|
3826
|
+
* calls: [
|
|
3827
|
+
* actions.token.updateQuoteToken.call({
|
|
3828
|
+
* token: '0x20c0...babe',
|
|
3829
|
+
* quoteToken: '0x20c0...cafe',
|
|
3830
|
+
* }),
|
|
3831
|
+
* ]
|
|
3832
|
+
* })
|
|
3833
|
+
* ```
|
|
3834
|
+
*
|
|
3835
|
+
* @param args - Arguments.
|
|
3836
|
+
* @returns The call.
|
|
3837
|
+
*/
|
|
3838
|
+
export function call(args: Args) {
|
|
3839
|
+
const { token, quoteToken } = args
|
|
3840
|
+
return defineCall({
|
|
3841
|
+
address: TokenId.toAddress(token),
|
|
3842
|
+
abi: Abis.tip20,
|
|
3843
|
+
functionName: 'updateQuoteToken',
|
|
3844
|
+
args: [TokenId.toAddress(quoteToken)],
|
|
3845
|
+
})
|
|
3846
|
+
}
|
|
3847
|
+
|
|
3848
|
+
/**
|
|
3849
|
+
* Extracts the event from the logs.
|
|
3850
|
+
*
|
|
3851
|
+
* @param logs - Logs.
|
|
3852
|
+
* @returns The event.
|
|
3853
|
+
*/
|
|
3854
|
+
export function extractEvent(logs: Log[]) {
|
|
3855
|
+
const [log] = parseEventLogs({
|
|
3856
|
+
abi: Abis.tip20,
|
|
3857
|
+
logs,
|
|
3858
|
+
eventName: 'UpdateQuoteToken',
|
|
3859
|
+
})
|
|
3860
|
+
if (!log) throw new Error('`UpdateQuoteToken` event not found.')
|
|
3861
|
+
return log
|
|
3862
|
+
}
|
|
3863
|
+
}
|
|
3864
|
+
|
|
3865
|
+
/**
|
|
3866
|
+
* Updates the quote token for a TIP20 token.
|
|
3867
|
+
*
|
|
3868
|
+
* @example
|
|
3869
|
+
* ```ts
|
|
3870
|
+
* import { createClient, http } from 'viem'
|
|
3871
|
+
* import { tempo } from 'tempo.ts/chains'
|
|
3872
|
+
* import * as actions from 'tempo.ts/viem/actions'
|
|
3873
|
+
* import { privateKeyToAccount } from 'viem/accounts'
|
|
3874
|
+
*
|
|
3875
|
+
* const client = createClient({
|
|
3876
|
+
* account: privateKeyToAccount('0x...'),
|
|
3877
|
+
* chain: tempo,
|
|
3878
|
+
* transport: http(),
|
|
3879
|
+
* })
|
|
3880
|
+
*
|
|
3881
|
+
* const result = await actions.token.updateQuoteTokenSync(client, {
|
|
3882
|
+
* token: '0x...',
|
|
3883
|
+
* quoteToken: '0x...',
|
|
3884
|
+
* })
|
|
3885
|
+
* ```
|
|
3886
|
+
*
|
|
3887
|
+
* @param client - Client.
|
|
3888
|
+
* @param parameters - Parameters.
|
|
3889
|
+
* @returns The transaction receipt and event data.
|
|
3890
|
+
*/
|
|
3891
|
+
export async function updateQuoteTokenSync<
|
|
3892
|
+
chain extends Chain | undefined,
|
|
3893
|
+
account extends Account | undefined,
|
|
3894
|
+
>(
|
|
3895
|
+
client: Client<Transport, chain, account>,
|
|
3896
|
+
parameters: updateQuoteTokenSync.Parameters<chain, account>,
|
|
3897
|
+
): Promise<updateQuoteTokenSync.ReturnValue> {
|
|
3898
|
+
const receipt = await updateQuoteToken.inner(
|
|
3899
|
+
writeContractSync,
|
|
3900
|
+
client,
|
|
3901
|
+
parameters,
|
|
3902
|
+
)
|
|
3903
|
+
const { args } = updateQuoteToken.extractEvent(receipt.logs)
|
|
3904
|
+
return {
|
|
3905
|
+
...args,
|
|
3906
|
+
receipt,
|
|
3907
|
+
} as never
|
|
3908
|
+
}
|
|
3909
|
+
|
|
3910
|
+
export namespace updateQuoteTokenSync {
|
|
3911
|
+
export type Parameters<
|
|
3912
|
+
chain extends Chain | undefined = Chain | undefined,
|
|
3913
|
+
account extends Account | undefined = Account | undefined,
|
|
3914
|
+
> = updateQuoteToken.Parameters<chain, account>
|
|
3915
|
+
|
|
3916
|
+
export type Args = updateQuoteToken.Args
|
|
3917
|
+
|
|
3918
|
+
export type ReturnValue = Compute<
|
|
3919
|
+
GetEventArgs<
|
|
3920
|
+
typeof Abis.tip20,
|
|
3921
|
+
'UpdateQuoteToken',
|
|
3922
|
+
{
|
|
3923
|
+
IndexedOnly: false
|
|
3924
|
+
Required: true
|
|
3925
|
+
}
|
|
3926
|
+
> & {
|
|
3927
|
+
receipt: TransactionReceipt
|
|
3928
|
+
}
|
|
3929
|
+
>
|
|
3930
|
+
}
|
|
3931
|
+
|
|
3446
3932
|
/**
|
|
3447
3933
|
* Watches for TIP20 token approval events.
|
|
3448
3934
|
*
|
|
@@ -3475,11 +3961,11 @@ export function watchApprove<
|
|
|
3475
3961
|
client: Client<Transport, chain, account>,
|
|
3476
3962
|
parameters: watchApprove.Parameters,
|
|
3477
3963
|
) {
|
|
3478
|
-
const { onApproval, token =
|
|
3964
|
+
const { onApproval, token = Addresses.defaultFeeToken, ...rest } = parameters
|
|
3479
3965
|
return watchContractEvent(client, {
|
|
3480
3966
|
...rest,
|
|
3481
3967
|
address: TokenId.toAddress(token),
|
|
3482
|
-
abi:
|
|
3968
|
+
abi: Abis.tip20,
|
|
3483
3969
|
eventName: 'Approval',
|
|
3484
3970
|
onLogs: (logs) => {
|
|
3485
3971
|
for (const log of logs) onApproval(log.args, log)
|
|
@@ -3490,7 +3976,7 @@ export function watchApprove<
|
|
|
3490
3976
|
|
|
3491
3977
|
export declare namespace watchApprove {
|
|
3492
3978
|
export type Args = GetEventArgs<
|
|
3493
|
-
typeof
|
|
3979
|
+
typeof Abis.tip20,
|
|
3494
3980
|
'Approval',
|
|
3495
3981
|
{ IndexedOnly: false; Required: true }
|
|
3496
3982
|
>
|
|
@@ -3499,17 +3985,17 @@ export declare namespace watchApprove {
|
|
|
3499
3985
|
bigint,
|
|
3500
3986
|
number,
|
|
3501
3987
|
false,
|
|
3502
|
-
ExtractAbiItem<typeof
|
|
3988
|
+
ExtractAbiItem<typeof Abis.tip20, 'Approval'>,
|
|
3503
3989
|
true
|
|
3504
3990
|
>
|
|
3505
3991
|
|
|
3506
3992
|
export type Parameters = UnionOmit<
|
|
3507
|
-
WatchContractEventParameters<typeof
|
|
3993
|
+
WatchContractEventParameters<typeof Abis.tip20, 'Approval', true>,
|
|
3508
3994
|
'abi' | 'address' | 'batch' | 'eventName' | 'onLogs' | 'strict'
|
|
3509
3995
|
> & {
|
|
3510
3996
|
/** Callback to invoke when tokens are approved. */
|
|
3511
3997
|
onApproval: (args: Args, log: Log) => void
|
|
3512
|
-
/** Address or ID of the TIP20 token. @default `
|
|
3998
|
+
/** Address or ID of the TIP20 token. @default `Addresses.defaultFeeToken` */
|
|
3513
3999
|
token?: TokenId.TokenIdOrAddress | undefined
|
|
3514
4000
|
}
|
|
3515
4001
|
}
|
|
@@ -3543,11 +4029,11 @@ export function watchBurn<
|
|
|
3543
4029
|
chain extends Chain | undefined,
|
|
3544
4030
|
account extends Account | undefined,
|
|
3545
4031
|
>(client: Client<Transport, chain, account>, parameters: watchBurn.Parameters) {
|
|
3546
|
-
const { onBurn, token =
|
|
4032
|
+
const { onBurn, token = Addresses.defaultFeeToken, ...rest } = parameters
|
|
3547
4033
|
return watchContractEvent(client, {
|
|
3548
4034
|
...rest,
|
|
3549
4035
|
address: TokenId.toAddress(token),
|
|
3550
|
-
abi:
|
|
4036
|
+
abi: Abis.tip20,
|
|
3551
4037
|
eventName: 'Burn',
|
|
3552
4038
|
onLogs: (logs) => {
|
|
3553
4039
|
for (const log of logs) onBurn(log.args, log)
|
|
@@ -3558,7 +4044,7 @@ export function watchBurn<
|
|
|
3558
4044
|
|
|
3559
4045
|
export declare namespace watchBurn {
|
|
3560
4046
|
export type Args = GetEventArgs<
|
|
3561
|
-
typeof
|
|
4047
|
+
typeof Abis.tip20,
|
|
3562
4048
|
'Burn',
|
|
3563
4049
|
{ IndexedOnly: false; Required: true }
|
|
3564
4050
|
>
|
|
@@ -3567,17 +4053,17 @@ export declare namespace watchBurn {
|
|
|
3567
4053
|
bigint,
|
|
3568
4054
|
number,
|
|
3569
4055
|
false,
|
|
3570
|
-
ExtractAbiItem<typeof
|
|
4056
|
+
ExtractAbiItem<typeof Abis.tip20, 'Burn'>,
|
|
3571
4057
|
true
|
|
3572
4058
|
>
|
|
3573
4059
|
|
|
3574
4060
|
export type Parameters = UnionOmit<
|
|
3575
|
-
WatchContractEventParameters<typeof
|
|
4061
|
+
WatchContractEventParameters<typeof Abis.tip20, 'Burn', true>,
|
|
3576
4062
|
'abi' | 'address' | 'batch' | 'eventName' | 'onLogs' | 'strict'
|
|
3577
4063
|
> & {
|
|
3578
4064
|
/** Callback to invoke when tokens are burned. */
|
|
3579
4065
|
onBurn: (args: Args, log: Log) => void
|
|
3580
|
-
/** Address or ID of the TIP20 token. @default `
|
|
4066
|
+
/** Address or ID of the TIP20 token. @default `Addresses.defaultFeeToken` */
|
|
3581
4067
|
token?: TokenId.TokenIdOrAddress | undefined
|
|
3582
4068
|
}
|
|
3583
4069
|
}
|
|
@@ -3617,8 +4103,8 @@ export function watchCreate<
|
|
|
3617
4103
|
const { onTokenCreated, ...rest } = parameters
|
|
3618
4104
|
return watchContractEvent(client, {
|
|
3619
4105
|
...rest,
|
|
3620
|
-
address:
|
|
3621
|
-
abi:
|
|
4106
|
+
address: Addresses.tip20Factory,
|
|
4107
|
+
abi: Abis.tip20Factory,
|
|
3622
4108
|
eventName: 'TokenCreated',
|
|
3623
4109
|
onLogs: (logs) => {
|
|
3624
4110
|
for (const log of logs) onTokenCreated(log.args, log)
|
|
@@ -3629,7 +4115,7 @@ export function watchCreate<
|
|
|
3629
4115
|
|
|
3630
4116
|
export declare namespace watchCreate {
|
|
3631
4117
|
export type Args = GetEventArgs<
|
|
3632
|
-
typeof
|
|
4118
|
+
typeof Abis.tip20Factory,
|
|
3633
4119
|
'TokenCreated',
|
|
3634
4120
|
{ IndexedOnly: false; Required: true }
|
|
3635
4121
|
>
|
|
@@ -3638,12 +4124,16 @@ export declare namespace watchCreate {
|
|
|
3638
4124
|
bigint,
|
|
3639
4125
|
number,
|
|
3640
4126
|
false,
|
|
3641
|
-
ExtractAbiItem<typeof
|
|
4127
|
+
ExtractAbiItem<typeof Abis.tip20Factory, 'TokenCreated'>,
|
|
3642
4128
|
true
|
|
3643
4129
|
>
|
|
3644
4130
|
|
|
3645
4131
|
export type Parameters = UnionOmit<
|
|
3646
|
-
WatchContractEventParameters<
|
|
4132
|
+
WatchContractEventParameters<
|
|
4133
|
+
typeof Abis.tip20Factory,
|
|
4134
|
+
'TokenCreated',
|
|
4135
|
+
true
|
|
4136
|
+
>,
|
|
3647
4137
|
'abi' | 'address' | 'batch' | 'eventName' | 'onLogs' | 'strict'
|
|
3648
4138
|
> & {
|
|
3649
4139
|
/** Callback to invoke when a new TIP20 token is created. */
|
|
@@ -3680,11 +4170,11 @@ export function watchMint<
|
|
|
3680
4170
|
chain extends Chain | undefined,
|
|
3681
4171
|
account extends Account | undefined,
|
|
3682
4172
|
>(client: Client<Transport, chain, account>, parameters: watchMint.Parameters) {
|
|
3683
|
-
const { onMint, token =
|
|
4173
|
+
const { onMint, token = Addresses.defaultFeeToken, ...rest } = parameters
|
|
3684
4174
|
return watchContractEvent(client, {
|
|
3685
4175
|
...rest,
|
|
3686
4176
|
address: TokenId.toAddress(token),
|
|
3687
|
-
abi:
|
|
4177
|
+
abi: Abis.tip20,
|
|
3688
4178
|
eventName: 'Mint',
|
|
3689
4179
|
onLogs: (logs) => {
|
|
3690
4180
|
for (const log of logs) onMint(log.args, log)
|
|
@@ -3695,7 +4185,7 @@ export function watchMint<
|
|
|
3695
4185
|
|
|
3696
4186
|
export declare namespace watchMint {
|
|
3697
4187
|
export type Args = GetEventArgs<
|
|
3698
|
-
typeof
|
|
4188
|
+
typeof Abis.tip20,
|
|
3699
4189
|
'Mint',
|
|
3700
4190
|
{ IndexedOnly: false; Required: true }
|
|
3701
4191
|
>
|
|
@@ -3704,17 +4194,17 @@ export declare namespace watchMint {
|
|
|
3704
4194
|
bigint,
|
|
3705
4195
|
number,
|
|
3706
4196
|
false,
|
|
3707
|
-
ExtractAbiItem<typeof
|
|
4197
|
+
ExtractAbiItem<typeof Abis.tip20, 'Mint'>,
|
|
3708
4198
|
true
|
|
3709
4199
|
>
|
|
3710
4200
|
|
|
3711
4201
|
export type Parameters = UnionOmit<
|
|
3712
|
-
WatchContractEventParameters<typeof
|
|
4202
|
+
WatchContractEventParameters<typeof Abis.tip20, 'Mint', true>,
|
|
3713
4203
|
'abi' | 'address' | 'batch' | 'eventName' | 'onLogs' | 'strict'
|
|
3714
4204
|
> & {
|
|
3715
4205
|
/** Callback to invoke when tokens are minted. */
|
|
3716
4206
|
onMint: (args: Args, log: Log) => void
|
|
3717
|
-
/** Address or ID of the TIP20 token. @default `
|
|
4207
|
+
/** Address or ID of the TIP20 token. @default `Addresses.defaultFeeToken` */
|
|
3718
4208
|
token?: TokenId.TokenIdOrAddress | undefined
|
|
3719
4209
|
}
|
|
3720
4210
|
}
|
|
@@ -3751,11 +4241,15 @@ export function watchAdminRole<
|
|
|
3751
4241
|
client: Client<Transport, chain, account>,
|
|
3752
4242
|
parameters: watchAdminRole.Parameters,
|
|
3753
4243
|
) {
|
|
3754
|
-
const {
|
|
4244
|
+
const {
|
|
4245
|
+
onRoleAdminUpdated,
|
|
4246
|
+
token = Addresses.defaultFeeToken,
|
|
4247
|
+
...rest
|
|
4248
|
+
} = parameters
|
|
3755
4249
|
return watchContractEvent(client, {
|
|
3756
4250
|
...rest,
|
|
3757
4251
|
address: TokenId.toAddress(token),
|
|
3758
|
-
abi:
|
|
4252
|
+
abi: Abis.tip20,
|
|
3759
4253
|
eventName: 'RoleAdminUpdated',
|
|
3760
4254
|
onLogs: (logs) => {
|
|
3761
4255
|
for (const log of logs) onRoleAdminUpdated(log.args, log)
|
|
@@ -3766,7 +4260,7 @@ export function watchAdminRole<
|
|
|
3766
4260
|
|
|
3767
4261
|
export declare namespace watchAdminRole {
|
|
3768
4262
|
export type Args = GetEventArgs<
|
|
3769
|
-
typeof
|
|
4263
|
+
typeof Abis.tip20,
|
|
3770
4264
|
'RoleAdminUpdated',
|
|
3771
4265
|
{ IndexedOnly: false; Required: true }
|
|
3772
4266
|
>
|
|
@@ -3775,17 +4269,17 @@ export declare namespace watchAdminRole {
|
|
|
3775
4269
|
bigint,
|
|
3776
4270
|
number,
|
|
3777
4271
|
false,
|
|
3778
|
-
ExtractAbiItem<typeof
|
|
4272
|
+
ExtractAbiItem<typeof Abis.tip20, 'RoleAdminUpdated'>,
|
|
3779
4273
|
true
|
|
3780
4274
|
>
|
|
3781
4275
|
|
|
3782
4276
|
export type Parameters = UnionOmit<
|
|
3783
|
-
WatchContractEventParameters<typeof
|
|
4277
|
+
WatchContractEventParameters<typeof Abis.tip20, 'RoleAdminUpdated', true>,
|
|
3784
4278
|
'abi' | 'address' | 'batch' | 'eventName' | 'onLogs' | 'strict'
|
|
3785
4279
|
> & {
|
|
3786
4280
|
/** Callback to invoke when a role admin is updated. */
|
|
3787
4281
|
onRoleAdminUpdated: (args: Args, log: Log) => void
|
|
3788
|
-
/** Address or ID of the TIP20 token. @default `
|
|
4282
|
+
/** Address or ID of the TIP20 token. @default `Addresses.defaultFeeToken` */
|
|
3789
4283
|
token?: TokenId.TokenIdOrAddress | undefined
|
|
3790
4284
|
}
|
|
3791
4285
|
}
|
|
@@ -3819,11 +4313,15 @@ export function watchRole<
|
|
|
3819
4313
|
chain extends Chain | undefined,
|
|
3820
4314
|
account extends Account | undefined,
|
|
3821
4315
|
>(client: Client<Transport, chain, account>, parameters: watchRole.Parameters) {
|
|
3822
|
-
const {
|
|
4316
|
+
const {
|
|
4317
|
+
onRoleUpdated,
|
|
4318
|
+
token = Addresses.defaultFeeToken,
|
|
4319
|
+
...rest
|
|
4320
|
+
} = parameters
|
|
3823
4321
|
return watchContractEvent(client, {
|
|
3824
4322
|
...rest,
|
|
3825
4323
|
address: TokenId.toAddress(token),
|
|
3826
|
-
abi:
|
|
4324
|
+
abi: Abis.tip20,
|
|
3827
4325
|
eventName: 'RoleMembershipUpdated',
|
|
3828
4326
|
onLogs: (logs) => {
|
|
3829
4327
|
for (const log of logs) {
|
|
@@ -3837,7 +4335,7 @@ export function watchRole<
|
|
|
3837
4335
|
|
|
3838
4336
|
export declare namespace watchRole {
|
|
3839
4337
|
export type Args = GetEventArgs<
|
|
3840
|
-
typeof
|
|
4338
|
+
typeof Abis.tip20,
|
|
3841
4339
|
'RoleMembershipUpdated',
|
|
3842
4340
|
{ IndexedOnly: false; Required: true }
|
|
3843
4341
|
> & {
|
|
@@ -3849,13 +4347,13 @@ export declare namespace watchRole {
|
|
|
3849
4347
|
bigint,
|
|
3850
4348
|
number,
|
|
3851
4349
|
false,
|
|
3852
|
-
ExtractAbiItem<typeof
|
|
4350
|
+
ExtractAbiItem<typeof Abis.tip20, 'RoleMembershipUpdated'>,
|
|
3853
4351
|
true
|
|
3854
4352
|
>
|
|
3855
4353
|
|
|
3856
4354
|
export type Parameters = UnionOmit<
|
|
3857
4355
|
WatchContractEventParameters<
|
|
3858
|
-
typeof
|
|
4356
|
+
typeof Abis.tip20,
|
|
3859
4357
|
'RoleMembershipUpdated',
|
|
3860
4358
|
true
|
|
3861
4359
|
>,
|
|
@@ -3863,7 +4361,7 @@ export declare namespace watchRole {
|
|
|
3863
4361
|
> & {
|
|
3864
4362
|
/** Callback to invoke when a role membership is updated. */
|
|
3865
4363
|
onRoleUpdated: (args: Args, log: Log) => void
|
|
3866
|
-
/** Address or ID of the TIP20 token. @default `
|
|
4364
|
+
/** Address or ID of the TIP20 token. @default `Addresses.defaultFeeToken` */
|
|
3867
4365
|
token?: TokenId.TokenIdOrAddress | undefined
|
|
3868
4366
|
}
|
|
3869
4367
|
}
|
|
@@ -3901,11 +4399,11 @@ export function watchTransfer<
|
|
|
3901
4399
|
client: Client<Transport, chain, account>,
|
|
3902
4400
|
parameters: watchTransfer.Parameters,
|
|
3903
4401
|
) {
|
|
3904
|
-
const { onTransfer, token =
|
|
4402
|
+
const { onTransfer, token = Addresses.defaultFeeToken, ...rest } = parameters
|
|
3905
4403
|
return watchContractEvent(client, {
|
|
3906
4404
|
...rest,
|
|
3907
4405
|
address: TokenId.toAddress(token),
|
|
3908
|
-
abi:
|
|
4406
|
+
abi: Abis.tip20,
|
|
3909
4407
|
eventName: 'Transfer',
|
|
3910
4408
|
onLogs: (logs) => {
|
|
3911
4409
|
for (const log of logs) onTransfer(log.args, log)
|
|
@@ -3916,7 +4414,7 @@ export function watchTransfer<
|
|
|
3916
4414
|
|
|
3917
4415
|
export declare namespace watchTransfer {
|
|
3918
4416
|
export type Args = GetEventArgs<
|
|
3919
|
-
typeof
|
|
4417
|
+
typeof Abis.tip20,
|
|
3920
4418
|
'Transfer',
|
|
3921
4419
|
{ IndexedOnly: false; Required: true }
|
|
3922
4420
|
>
|
|
@@ -3925,17 +4423,125 @@ export declare namespace watchTransfer {
|
|
|
3925
4423
|
bigint,
|
|
3926
4424
|
number,
|
|
3927
4425
|
false,
|
|
3928
|
-
ExtractAbiItem<typeof
|
|
4426
|
+
ExtractAbiItem<typeof Abis.tip20, 'Transfer'>,
|
|
3929
4427
|
true
|
|
3930
4428
|
>
|
|
3931
4429
|
|
|
3932
4430
|
export type Parameters = UnionOmit<
|
|
3933
|
-
WatchContractEventParameters<typeof
|
|
4431
|
+
WatchContractEventParameters<typeof Abis.tip20, 'Transfer', true>,
|
|
3934
4432
|
'abi' | 'address' | 'batch' | 'eventName' | 'onLogs' | 'strict'
|
|
3935
4433
|
> & {
|
|
3936
4434
|
/** Callback to invoke when tokens are transferred. */
|
|
3937
4435
|
onTransfer: (args: Args, log: Log) => void
|
|
3938
|
-
/** Address or ID of the TIP20 token. @default `
|
|
4436
|
+
/** Address or ID of the TIP20 token. @default `Addresses.defaultFeeToken` */
|
|
4437
|
+
token?: TokenId.TokenIdOrAddress | undefined
|
|
4438
|
+
}
|
|
4439
|
+
}
|
|
4440
|
+
|
|
4441
|
+
/**
|
|
4442
|
+
* Watches for TIP20 token quote token update events.
|
|
4443
|
+
*
|
|
4444
|
+
* @example
|
|
4445
|
+
* ```ts
|
|
4446
|
+
* import { createClient, http } from 'viem'
|
|
4447
|
+
* import { tempo } from 'tempo.ts/chains'
|
|
4448
|
+
* import * as actions from 'tempo.ts/viem/actions'
|
|
4449
|
+
*
|
|
4450
|
+
* const client = createClient({
|
|
4451
|
+
* chain: tempo,
|
|
4452
|
+
* transport: http(),
|
|
4453
|
+
* })
|
|
4454
|
+
*
|
|
4455
|
+
* const unwatch = actions.token.watchUpdateQuoteToken(client, {
|
|
4456
|
+
* onUpdateQuoteToken: (args, log) => {
|
|
4457
|
+
* if (args.finalized)
|
|
4458
|
+
* console.log('quote token update finalized:', args.newQuoteToken)
|
|
4459
|
+
* else
|
|
4460
|
+
* console.log('quote token update proposed:', args.newQuoteToken)
|
|
4461
|
+
* },
|
|
4462
|
+
* })
|
|
4463
|
+
* ```
|
|
4464
|
+
*
|
|
4465
|
+
* @param client - Client.
|
|
4466
|
+
* @param parameters - Parameters.
|
|
4467
|
+
* @returns A function to unsubscribe from the event.
|
|
4468
|
+
*/
|
|
4469
|
+
export function watchUpdateQuoteToken<
|
|
4470
|
+
chain extends Chain | undefined,
|
|
4471
|
+
account extends Account | undefined,
|
|
4472
|
+
>(
|
|
4473
|
+
client: Client<Transport, chain, account>,
|
|
4474
|
+
parameters: watchUpdateQuoteToken.Parameters,
|
|
4475
|
+
) {
|
|
4476
|
+
const {
|
|
4477
|
+
onUpdateQuoteToken,
|
|
4478
|
+
token = Addresses.defaultFeeToken,
|
|
4479
|
+
...rest
|
|
4480
|
+
} = parameters
|
|
4481
|
+
const address = TokenId.toAddress(token)
|
|
4482
|
+
|
|
4483
|
+
return watchContractEvent(client, {
|
|
4484
|
+
...rest,
|
|
4485
|
+
address,
|
|
4486
|
+
abi: Abis.tip20,
|
|
4487
|
+
onLogs: (
|
|
4488
|
+
logs: viem_Log<
|
|
4489
|
+
bigint,
|
|
4490
|
+
number,
|
|
4491
|
+
false,
|
|
4492
|
+
ExtractAbiItem<
|
|
4493
|
+
typeof Abis.tip20,
|
|
4494
|
+
'UpdateQuoteToken' | 'QuoteTokenUpdateFinalized'
|
|
4495
|
+
>,
|
|
4496
|
+
true
|
|
4497
|
+
>[],
|
|
4498
|
+
) => {
|
|
4499
|
+
for (const log of logs) {
|
|
4500
|
+
if (
|
|
4501
|
+
log.eventName !== 'UpdateQuoteToken' &&
|
|
4502
|
+
log.eventName !== 'QuoteTokenUpdateFinalized'
|
|
4503
|
+
)
|
|
4504
|
+
continue
|
|
4505
|
+
|
|
4506
|
+
onUpdateQuoteToken(
|
|
4507
|
+
{
|
|
4508
|
+
...log.args,
|
|
4509
|
+
finalized: log.eventName === 'QuoteTokenUpdateFinalized',
|
|
4510
|
+
},
|
|
4511
|
+
log,
|
|
4512
|
+
)
|
|
4513
|
+
}
|
|
4514
|
+
},
|
|
4515
|
+
strict: true,
|
|
4516
|
+
} as never)
|
|
4517
|
+
}
|
|
4518
|
+
|
|
4519
|
+
export declare namespace watchUpdateQuoteToken {
|
|
4520
|
+
export type Args = OneOf<
|
|
4521
|
+
| GetEventArgs<
|
|
4522
|
+
typeof Abis.tip20,
|
|
4523
|
+
'UpdateQuoteToken',
|
|
4524
|
+
{ IndexedOnly: false; Required: true }
|
|
4525
|
+
>
|
|
4526
|
+
| GetEventArgs<
|
|
4527
|
+
typeof Abis.tip20,
|
|
4528
|
+
'QuoteTokenUpdateFinalized',
|
|
4529
|
+
{ IndexedOnly: false; Required: true }
|
|
4530
|
+
>
|
|
4531
|
+
> & {
|
|
4532
|
+
/** Whether the update has been finalized. */
|
|
4533
|
+
finalized: boolean
|
|
4534
|
+
}
|
|
4535
|
+
|
|
4536
|
+
export type Log = viem_Log
|
|
4537
|
+
|
|
4538
|
+
export type Parameters = UnionOmit<
|
|
4539
|
+
WatchContractEventParameters<typeof Abis.tip20, any, true>,
|
|
4540
|
+
'abi' | 'address' | 'batch' | 'eventName' | 'onLogs' | 'strict'
|
|
4541
|
+
> & {
|
|
4542
|
+
/** Callback to invoke when a quote token update is proposed or finalized. */
|
|
4543
|
+
onUpdateQuoteToken: (args: Args, log: Log) => void
|
|
4544
|
+
/** Address or ID of the TIP20 token. @default `Addresses.defaultFeeToken` */
|
|
3939
4545
|
token?: TokenId.TokenIdOrAddress | undefined
|
|
3940
4546
|
}
|
|
3941
4547
|
}
|