tempo.ts 0.1.5 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -2
- package/dist/chains.d.ts +509 -115
- package/dist/chains.d.ts.map +1 -1
- package/dist/chains.js +20 -9
- package/dist/chains.js.map +1 -1
- package/dist/ox/Order.d.ts +92 -0
- package/dist/ox/Order.d.ts.map +1 -0
- package/dist/ox/Order.js +88 -0
- package/dist/ox/Order.js.map +1 -0
- package/dist/ox/OrdersFilters.d.ts +72 -0
- package/dist/ox/OrdersFilters.d.ts.map +1 -0
- package/dist/ox/OrdersFilters.js +100 -0
- package/dist/ox/OrdersFilters.js.map +1 -0
- package/dist/ox/Pagination.d.ts +128 -0
- package/dist/ox/Pagination.d.ts.map +1 -0
- package/dist/ox/Pagination.js +78 -0
- package/dist/ox/Pagination.js.map +1 -0
- package/dist/ox/PoolId.d.ts +18 -0
- package/dist/ox/PoolId.d.ts.map +1 -0
- package/dist/ox/PoolId.js +13 -0
- package/dist/ox/PoolId.js.map +1 -0
- package/dist/ox/RpcSchema.d.ts +32 -0
- package/dist/ox/RpcSchema.d.ts.map +1 -0
- package/dist/ox/RpcSchema.js +2 -0
- package/dist/ox/RpcSchema.js.map +1 -0
- package/dist/ox/SignatureEnvelope.d.ts +1 -1
- package/dist/ox/SignatureEnvelope.d.ts.map +1 -1
- package/dist/ox/SignatureEnvelope.js.map +1 -1
- package/dist/{viem → ox}/Tick.d.ts +4 -0
- package/dist/ox/Tick.d.ts.map +1 -0
- package/dist/ox/Tick.js.map +1 -0
- package/dist/ox/Transaction.d.ts.map +1 -1
- package/dist/ox/Transaction.js +2 -1
- package/dist/ox/Transaction.js.map +1 -1
- package/dist/ox/TransactionEnvelopeAA.d.ts +6 -6
- package/dist/ox/TransactionEnvelopeAA.d.ts.map +1 -1
- package/dist/ox/TransactionEnvelopeAA.js +4 -2
- package/dist/ox/TransactionEnvelopeAA.js.map +1 -1
- package/dist/ox/TransactionRequest.d.ts +4 -0
- package/dist/ox/TransactionRequest.d.ts.map +1 -1
- package/dist/ox/TransactionRequest.js.map +1 -1
- package/dist/ox/index.d.ts +6 -0
- package/dist/ox/index.d.ts.map +1 -1
- package/dist/ox/index.js +6 -0
- package/dist/ox/index.js.map +1 -1
- package/dist/prool/Instance.d.ts.map +1 -1
- package/dist/prool/Instance.js +20 -4
- package/dist/prool/Instance.js.map +1 -1
- package/dist/viem/Abis.d.ts +1469 -1082
- package/dist/viem/Abis.d.ts.map +1 -1
- package/dist/viem/Abis.js +932 -671
- package/dist/viem/Abis.js.map +1 -1
- package/dist/viem/Account.d.ts +150 -0
- package/dist/viem/Account.d.ts.map +1 -0
- package/dist/viem/Account.js +221 -0
- package/dist/viem/Account.js.map +1 -0
- package/dist/viem/Actions/amm.d.ts +144 -161
- package/dist/viem/Actions/amm.d.ts.map +1 -1
- package/dist/viem/Actions/amm.js +109 -163
- package/dist/viem/Actions/amm.js.map +1 -1
- package/dist/viem/Actions/dex.d.ts +920 -664
- package/dist/viem/Actions/dex.d.ts.map +1 -1
- package/dist/viem/Actions/dex.js +129 -30
- package/dist/viem/Actions/dex.js.map +1 -1
- package/dist/viem/Actions/faucet.d.ts +34 -0
- package/dist/viem/Actions/faucet.d.ts.map +1 -0
- package/dist/viem/Actions/faucet.js +33 -0
- package/dist/viem/Actions/faucet.js.map +1 -0
- package/dist/viem/Actions/fee.d.ts +16 -30
- package/dist/viem/Actions/fee.d.ts.map +1 -1
- package/dist/viem/Actions/fee.js +13 -13
- package/dist/viem/Actions/fee.js.map +1 -1
- package/dist/viem/Actions/index.d.ts +2 -0
- package/dist/viem/Actions/index.d.ts.map +1 -1
- package/dist/viem/Actions/index.js +2 -0
- package/dist/viem/Actions/index.js.map +1 -1
- package/dist/viem/Actions/policy.d.ts +46 -46
- package/dist/viem/Actions/policy.js +46 -46
- package/dist/viem/Actions/reward.d.ts +3236 -0
- package/dist/viem/Actions/reward.d.ts.map +1 -0
- package/dist/viem/Actions/reward.js +725 -0
- package/dist/viem/Actions/reward.js.map +1 -0
- package/dist/viem/Actions/token.d.ts +4399 -2750
- package/dist/viem/Actions/token.d.ts.map +1 -1
- package/dist/viem/Actions/token.js +361 -482
- package/dist/viem/Actions/token.js.map +1 -1
- package/dist/viem/Addresses.d.ts +1 -2
- package/dist/viem/Addresses.d.ts.map +1 -1
- package/dist/viem/Addresses.js +1 -2
- package/dist/viem/Addresses.js.map +1 -1
- package/dist/viem/Chain.d.ts +38 -12
- package/dist/viem/Chain.d.ts.map +1 -1
- package/dist/viem/Chain.js +27 -18
- package/dist/viem/Chain.js.map +1 -1
- package/dist/viem/Decorator.d.ts +1009 -428
- package/dist/viem/Decorator.d.ts.map +1 -1
- package/dist/viem/Decorator.js +17 -5
- package/dist/viem/Decorator.js.map +1 -1
- package/dist/viem/Formatters.d.ts +8 -1
- package/dist/viem/Formatters.d.ts.map +1 -1
- package/dist/viem/Formatters.js +17 -0
- package/dist/viem/Formatters.js.map +1 -1
- package/dist/viem/P256.d.ts +2 -0
- package/dist/viem/P256.d.ts.map +1 -0
- package/dist/viem/P256.js +2 -0
- package/dist/viem/P256.js.map +1 -0
- package/dist/viem/Secp256k1.d.ts +2 -0
- package/dist/viem/Secp256k1.d.ts.map +1 -0
- package/dist/viem/Secp256k1.js +2 -0
- package/dist/viem/Secp256k1.js.map +1 -0
- package/dist/viem/TokenIds.d.ts +1 -2
- package/dist/viem/TokenIds.d.ts.map +1 -1
- package/dist/viem/TokenIds.js +1 -2
- package/dist/viem/TokenIds.js.map +1 -1
- package/dist/viem/Transaction.d.ts +1 -1
- package/dist/viem/Transaction.d.ts.map +1 -1
- package/dist/viem/Transaction.js +46 -5
- package/dist/viem/Transaction.js.map +1 -1
- package/dist/viem/WebAuthnP256.d.ts +79 -0
- package/dist/viem/WebAuthnP256.d.ts.map +1 -0
- package/dist/viem/WebAuthnP256.js +95 -0
- package/dist/viem/WebAuthnP256.js.map +1 -0
- package/dist/viem/WebCryptoP256.d.ts +2 -0
- package/dist/viem/WebCryptoP256.d.ts.map +1 -0
- package/dist/viem/WebCryptoP256.js +2 -0
- package/dist/viem/WebCryptoP256.js.map +1 -0
- package/dist/viem/index.d.ts +6 -3
- package/dist/viem/index.d.ts.map +1 -1
- package/dist/viem/index.js +6 -3
- package/dist/viem/index.js.map +1 -1
- package/dist/viem/internal/account.d.ts +24 -0
- package/dist/viem/internal/account.d.ts.map +1 -0
- package/dist/viem/internal/account.js +68 -0
- package/dist/viem/internal/account.js.map +1 -0
- package/dist/viem/internal/types.d.ts +10 -0
- package/dist/viem/internal/types.d.ts.map +1 -1
- package/dist/wagmi/Actions/amm.d.ts +428 -0
- package/dist/wagmi/Actions/amm.d.ts.map +1 -0
- package/dist/wagmi/Actions/amm.js +472 -0
- package/dist/wagmi/Actions/amm.js.map +1 -0
- package/dist/wagmi/Actions/dex.d.ts +908 -0
- package/dist/wagmi/Actions/dex.d.ts.map +1 -0
- package/dist/wagmi/Actions/dex.js +1023 -0
- package/dist/wagmi/Actions/dex.js.map +1 -0
- package/dist/wagmi/Actions/faucet.d.ts +35 -0
- package/dist/wagmi/Actions/faucet.d.ts.map +1 -0
- package/dist/wagmi/Actions/faucet.js +33 -0
- package/dist/wagmi/Actions/faucet.js.map +1 -0
- package/dist/wagmi/Actions/fee.d.ts +111 -0
- package/dist/wagmi/Actions/fee.d.ts.map +1 -0
- package/dist/wagmi/Actions/fee.js +126 -0
- package/dist/wagmi/Actions/fee.js.map +1 -0
- package/dist/wagmi/Actions/index.d.ts +7 -0
- package/dist/wagmi/Actions/index.d.ts.map +1 -0
- package/dist/wagmi/Actions/index.js +7 -0
- package/dist/wagmi/Actions/index.js.map +1 -0
- package/dist/wagmi/Actions/reward.d.ts +348 -0
- package/dist/wagmi/Actions/reward.d.ts.map +1 -0
- package/dist/wagmi/Actions/reward.js +388 -0
- package/dist/wagmi/Actions/reward.js.map +1 -0
- package/dist/wagmi/Actions/token.d.ts +1546 -0
- package/dist/wagmi/Actions/token.d.ts.map +1 -0
- package/dist/wagmi/Actions/token.js +1712 -0
- package/dist/wagmi/Actions/token.js.map +1 -0
- package/dist/wagmi/Connector.d.ts +81 -0
- package/dist/wagmi/Connector.d.ts.map +1 -0
- package/dist/wagmi/Connector.js +261 -0
- package/dist/wagmi/Connector.js.map +1 -0
- package/dist/wagmi/Hooks/amm.d.ts +421 -0
- package/dist/wagmi/Hooks/amm.d.ts.map +1 -0
- package/dist/wagmi/Hooks/amm.js +504 -0
- package/dist/wagmi/Hooks/amm.js.map +1 -0
- package/dist/wagmi/Hooks/dex.d.ts +816 -0
- package/dist/wagmi/Hooks/dex.d.ts.map +1 -0
- package/dist/wagmi/Hooks/dex.js +973 -0
- package/dist/wagmi/Hooks/dex.js.map +1 -0
- package/dist/wagmi/Hooks/faucet.d.ts +39 -0
- package/dist/wagmi/Hooks/faucet.d.ts.map +1 -0
- package/dist/wagmi/Hooks/faucet.js +40 -0
- package/dist/wagmi/Hooks/faucet.js.map +1 -0
- package/dist/wagmi/Hooks/fee.d.ts +97 -0
- package/dist/wagmi/Hooks/fee.d.ts.map +1 -0
- package/dist/wagmi/Hooks/fee.js +109 -0
- package/dist/wagmi/Hooks/fee.js.map +1 -0
- package/dist/wagmi/Hooks/index.d.ts +7 -0
- package/dist/wagmi/Hooks/index.d.ts.map +1 -0
- package/dist/wagmi/Hooks/index.js +7 -0
- package/dist/wagmi/Hooks/index.js.map +1 -0
- package/dist/wagmi/Hooks/reward.d.ts +307 -0
- package/dist/wagmi/Hooks/reward.d.ts.map +1 -0
- package/dist/wagmi/Hooks/reward.js +349 -0
- package/dist/wagmi/Hooks/reward.js.map +1 -0
- package/dist/wagmi/Hooks/token.d.ts +1388 -0
- package/dist/wagmi/Hooks/token.d.ts.map +1 -0
- package/dist/wagmi/Hooks/token.js +1657 -0
- package/dist/wagmi/Hooks/token.js.map +1 -0
- package/dist/wagmi/index.d.ts +4 -0
- package/dist/wagmi/index.d.ts.map +1 -0
- package/dist/wagmi/index.js +4 -0
- package/dist/wagmi/index.js.map +1 -0
- package/package.json +54 -10
- package/src/chains.ts +21 -9
- package/src/ox/Order.test.ts +78 -0
- package/src/ox/Order.ts +125 -0
- package/src/ox/OrdersFilters.test.ts +182 -0
- package/src/ox/OrdersFilters.ts +125 -0
- package/src/ox/Pagination.test.ts +162 -0
- package/src/ox/Pagination.ts +164 -0
- package/src/ox/PoolId.test.ts +33 -0
- package/src/ox/PoolId.ts +27 -0
- package/src/ox/RpcSchema.ts +35 -0
- package/src/ox/SignatureEnvelope.ts +3 -1
- package/src/{viem → ox}/Tick.test.ts +1 -1
- package/src/{viem → ox}/Tick.ts +5 -0
- package/src/ox/Transaction.test.ts +1 -1
- package/src/ox/Transaction.ts +2 -1
- package/src/ox/TransactionEnvelopeAA.test.ts +239 -96
- package/src/ox/TransactionEnvelopeAA.ts +9 -7
- package/src/ox/TransactionRequest.ts +4 -0
- package/src/ox/index.ts +6 -0
- package/src/prool/Instance.ts +51 -37
- package/src/prool/internal/chain.json +104 -52
- package/src/tsconfig.json +9 -0
- package/src/viem/Abis.ts +972 -710
- package/src/viem/Account.ts +279 -0
- package/src/viem/Actions/__snapshots__/dex.test.ts.snap +850 -0
- package/src/viem/Actions/amm.test.ts +173 -169
- package/src/viem/Actions/amm.ts +131 -203
- package/src/viem/Actions/dex.test.ts +563 -484
- package/src/viem/Actions/dex.ts +203 -30
- package/src/viem/Actions/faucet.ts +50 -0
- package/src/viem/Actions/fee.test.ts +23 -34
- package/src/viem/Actions/fee.ts +20 -13
- package/src/viem/Actions/index.ts +2 -0
- package/src/viem/Actions/policy.test.ts +19 -33
- package/src/viem/Actions/policy.ts +46 -46
- package/src/viem/Actions/reward.test.ts +457 -0
- package/src/viem/Actions/reward.ts +999 -0
- package/src/viem/Actions/token.test.ts +453 -287
- package/src/viem/Actions/token.ts +605 -693
- package/src/viem/Addresses.ts +1 -2
- package/src/viem/Chain.bench-d.ts +12 -0
- package/src/viem/Chain.ts +70 -20
- package/src/viem/Decorator.bench-d.ts +1 -1
- package/src/viem/Decorator.test.ts +3 -1
- package/src/viem/Decorator.ts +1049 -442
- package/src/viem/Formatters.ts +31 -5
- package/src/viem/P256.ts +1 -0
- package/src/viem/Secp256k1.ts +1 -0
- package/src/viem/TokenIds.ts +1 -2
- package/src/viem/Transaction.ts +53 -7
- package/src/viem/WebAuthnP256.ts +140 -0
- package/src/viem/WebCryptoP256.ts +1 -0
- package/src/viem/e2e.test.ts +1126 -297
- package/src/viem/index.ts +6 -3
- package/src/viem/internal/account.ts +107 -0
- package/src/viem/internal/types.ts +9 -0
- package/src/wagmi/Actions/__snapshots__/dex.test.ts.snap +310 -0
- package/src/wagmi/Actions/amm.test.ts +198 -0
- package/src/wagmi/Actions/amm.ts +691 -0
- package/src/wagmi/Actions/dex.test.ts +1507 -0
- package/src/wagmi/Actions/dex.ts +1640 -0
- package/src/wagmi/Actions/faucet.ts +46 -0
- package/src/wagmi/Actions/fee.test.ts +63 -0
- package/src/wagmi/Actions/fee.ts +208 -0
- package/src/wagmi/Actions/index.ts +6 -0
- package/src/wagmi/Actions/reward.test.ts +210 -0
- package/src/wagmi/Actions/reward.ts +632 -0
- package/src/wagmi/Actions/token.test.ts +1308 -0
- package/src/wagmi/Actions/token.ts +2613 -0
- package/src/wagmi/Connector.test.ts +53 -0
- package/src/wagmi/Connector.ts +390 -0
- package/src/wagmi/Hooks/__snapshots__/dex.test.ts.snap +457 -0
- package/src/wagmi/Hooks/amm.test.ts +424 -0
- package/src/wagmi/Hooks/amm.ts +806 -0
- package/src/wagmi/Hooks/dex.test.ts +1017 -0
- package/src/wagmi/Hooks/dex.ts +1685 -0
- package/src/wagmi/Hooks/faucet.ts +76 -0
- package/src/wagmi/Hooks/fee.test.ts +166 -0
- package/src/wagmi/Hooks/fee.ts +206 -0
- package/src/wagmi/Hooks/index.ts +6 -0
- package/src/wagmi/Hooks/reward.test.ts +219 -0
- package/src/wagmi/Hooks/reward.ts +672 -0
- package/src/wagmi/Hooks/token.test.ts +1670 -0
- package/src/wagmi/Hooks/token.ts +2906 -0
- package/src/wagmi/index.ts +3 -0
- package/src/wagmi/internal/types.ts +16 -0
- package/dist/viem/Client.d.ts +0 -27
- package/dist/viem/Client.d.ts.map +0 -1
- package/dist/viem/Client.js +0 -28
- package/dist/viem/Client.js.map +0 -1
- package/dist/viem/Tick.d.ts.map +0 -1
- package/dist/viem/Tick.js.map +0 -1
- package/src/viem/Client.bench-d.ts +0 -8
- package/src/viem/Client.test.ts +0 -178
- package/src/viem/Client.ts +0 -91
- /package/dist/{viem → ox}/Tick.js +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as Hex from 'ox/Hex'
|
|
2
|
-
import * as Signature from 'ox/Signature'
|
|
3
2
|
import {
|
|
4
3
|
type Account,
|
|
5
4
|
type Address,
|
|
5
|
+
type BaseErrorType,
|
|
6
6
|
type Chain,
|
|
7
7
|
type Client,
|
|
8
8
|
type ExtractAbiItem,
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
type Transport,
|
|
17
17
|
type Log as viem_Log,
|
|
18
18
|
type WatchContractEventParameters,
|
|
19
|
+
type WatchContractEventReturnType,
|
|
19
20
|
type WriteContractReturnType,
|
|
20
21
|
} from 'viem'
|
|
21
22
|
import { parseAccount } from 'viem/accounts'
|
|
@@ -47,16 +48,16 @@ import { defineCall } from '../internal/utils.js'
|
|
|
47
48
|
* ```ts
|
|
48
49
|
* import { createClient, http } from 'viem'
|
|
49
50
|
* import { tempo } from 'tempo.ts/chains'
|
|
50
|
-
* import
|
|
51
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
51
52
|
* import { privateKeyToAccount } from 'viem/accounts'
|
|
52
53
|
*
|
|
53
54
|
* const client = createClient({
|
|
54
55
|
* account: privateKeyToAccount('0x...'),
|
|
55
|
-
* chain: tempo
|
|
56
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
56
57
|
* transport: http(),
|
|
57
58
|
* })
|
|
58
59
|
*
|
|
59
|
-
* const result = await
|
|
60
|
+
* const result = await Actions.token.approve(client, {
|
|
60
61
|
* spender: '0x...',
|
|
61
62
|
* amount: 100n,
|
|
62
63
|
* })
|
|
@@ -73,7 +74,7 @@ export async function approve<
|
|
|
73
74
|
client: Client<Transport, chain, account>,
|
|
74
75
|
parameters: approve.Parameters<chain, account>,
|
|
75
76
|
): Promise<approve.ReturnValue> {
|
|
76
|
-
const { token
|
|
77
|
+
const { token, ...rest } = parameters
|
|
77
78
|
return approve.inner(writeContract, client, parameters, { ...rest, token })
|
|
78
79
|
}
|
|
79
80
|
|
|
@@ -88,12 +89,15 @@ export namespace approve {
|
|
|
88
89
|
amount: bigint
|
|
89
90
|
/** Address of the spender. */
|
|
90
91
|
spender: Address
|
|
91
|
-
/** Address or ID of the TIP20 token.
|
|
92
|
-
token
|
|
92
|
+
/** Address or ID of the TIP20 token. */
|
|
93
|
+
token: TokenId.TokenIdOrAddress
|
|
93
94
|
}
|
|
94
95
|
|
|
95
96
|
export type ReturnValue = WriteContractReturnType
|
|
96
97
|
|
|
98
|
+
// TODO: exhaustive error type
|
|
99
|
+
export type ErrorType = BaseErrorType
|
|
100
|
+
|
|
97
101
|
/** @internal */
|
|
98
102
|
export async function inner<
|
|
99
103
|
action extends typeof writeContract | typeof writeContractSync,
|
|
@@ -124,10 +128,10 @@ export namespace approve {
|
|
|
124
128
|
* ```ts
|
|
125
129
|
* import { createClient, http, walletActions } from 'viem'
|
|
126
130
|
* import { tempo } from 'tempo.ts/chains'
|
|
127
|
-
* import
|
|
131
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
128
132
|
*
|
|
129
133
|
* const client = createClient({
|
|
130
|
-
* chain: tempo
|
|
134
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
131
135
|
* transport: http(),
|
|
132
136
|
* }).extend(walletActions)
|
|
133
137
|
*
|
|
@@ -146,7 +150,7 @@ export namespace approve {
|
|
|
146
150
|
* @returns The call.
|
|
147
151
|
*/
|
|
148
152
|
export function call(args: Args) {
|
|
149
|
-
const { spender, amount, token
|
|
153
|
+
const { spender, amount, token } = args
|
|
150
154
|
return defineCall({
|
|
151
155
|
address: TokenId.toAddress(token),
|
|
152
156
|
abi: Abis.tip20,
|
|
@@ -173,16 +177,16 @@ export namespace approve {
|
|
|
173
177
|
* ```ts
|
|
174
178
|
* import { createClient, http } from 'viem'
|
|
175
179
|
* import { tempo } from 'tempo.ts/chains'
|
|
176
|
-
* import
|
|
180
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
177
181
|
* import { privateKeyToAccount } from 'viem/accounts'
|
|
178
182
|
*
|
|
179
183
|
* const client = createClient({
|
|
180
184
|
* account: privateKeyToAccount('0x...'),
|
|
181
|
-
* chain: tempo
|
|
185
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
182
186
|
* transport: http(),
|
|
183
187
|
* })
|
|
184
188
|
*
|
|
185
|
-
* const result = await
|
|
189
|
+
* const result = await Actions.token.approveSync(client, {
|
|
186
190
|
* spender: '0x...',
|
|
187
191
|
* amount: 100n,
|
|
188
192
|
* })
|
|
@@ -199,19 +203,12 @@ export async function approveSync<
|
|
|
199
203
|
client: Client<Transport, chain, account>,
|
|
200
204
|
parameters: approveSync.Parameters<chain, account>,
|
|
201
205
|
): Promise<approveSync.ReturnValue> {
|
|
202
|
-
const {
|
|
203
|
-
throwOnReceiptRevert = true,
|
|
204
|
-
token = Addresses.defaultFeeToken,
|
|
205
|
-
...rest
|
|
206
|
-
} = parameters
|
|
206
|
+
const { throwOnReceiptRevert = true, ...rest } = parameters
|
|
207
207
|
const receipt = await approve.inner(
|
|
208
208
|
writeContractSync,
|
|
209
209
|
client,
|
|
210
210
|
{ ...parameters, throwOnReceiptRevert } as never,
|
|
211
|
-
|
|
212
|
-
...rest,
|
|
213
|
-
token,
|
|
214
|
-
},
|
|
211
|
+
rest,
|
|
215
212
|
)
|
|
216
213
|
const { args } = approve.extractEvent(receipt.logs)
|
|
217
214
|
return {
|
|
@@ -241,6 +238,9 @@ export namespace approveSync {
|
|
|
241
238
|
receipt: TransactionReceipt
|
|
242
239
|
}
|
|
243
240
|
>
|
|
241
|
+
|
|
242
|
+
// TODO: exhaustive error type
|
|
243
|
+
export type ErrorType = BaseErrorType
|
|
244
244
|
}
|
|
245
245
|
|
|
246
246
|
/**
|
|
@@ -250,16 +250,16 @@ export namespace approveSync {
|
|
|
250
250
|
* ```ts
|
|
251
251
|
* import { createClient, http } from 'viem'
|
|
252
252
|
* import { tempo } from 'tempo.ts/chains'
|
|
253
|
-
* import
|
|
253
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
254
254
|
* import { privateKeyToAccount } from 'viem/accounts'
|
|
255
255
|
*
|
|
256
256
|
* const client = createClient({
|
|
257
257
|
* account: privateKeyToAccount('0x...'),
|
|
258
|
-
* chain: tempo
|
|
258
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
259
259
|
* transport: http(),
|
|
260
260
|
* })
|
|
261
261
|
*
|
|
262
|
-
* const result = await
|
|
262
|
+
* const result = await Actions.token.burnBlocked(client, {
|
|
263
263
|
* from: '0x...',
|
|
264
264
|
* amount: 100n,
|
|
265
265
|
* token: '0x...',
|
|
@@ -297,6 +297,9 @@ export namespace burnBlocked {
|
|
|
297
297
|
|
|
298
298
|
export type ReturnValue = WriteContractReturnType
|
|
299
299
|
|
|
300
|
+
// TODO: exhaustive error type
|
|
301
|
+
export type ErrorType = BaseErrorType
|
|
302
|
+
|
|
300
303
|
/** @internal */
|
|
301
304
|
export async function inner<
|
|
302
305
|
action extends typeof writeContract | typeof writeContractSync,
|
|
@@ -327,10 +330,10 @@ export namespace burnBlocked {
|
|
|
327
330
|
* ```ts
|
|
328
331
|
* import { createClient, http, walletActions } from 'viem'
|
|
329
332
|
* import { tempo } from 'tempo.ts/chains'
|
|
330
|
-
* import
|
|
333
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
331
334
|
*
|
|
332
335
|
* const client = createClient({
|
|
333
|
-
* chain: tempo
|
|
336
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
334
337
|
* transport: http(),
|
|
335
338
|
* }).extend(walletActions)
|
|
336
339
|
*
|
|
@@ -382,16 +385,16 @@ export namespace burnBlocked {
|
|
|
382
385
|
* ```ts
|
|
383
386
|
* import { createClient, http } from 'viem'
|
|
384
387
|
* import { tempo } from 'tempo.ts/chains'
|
|
385
|
-
* import
|
|
388
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
386
389
|
* import { privateKeyToAccount } from 'viem/accounts'
|
|
387
390
|
*
|
|
388
391
|
* const client = createClient({
|
|
389
392
|
* account: privateKeyToAccount('0x...'),
|
|
390
|
-
* chain: tempo
|
|
393
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
391
394
|
* transport: http(),
|
|
392
395
|
* })
|
|
393
396
|
*
|
|
394
|
-
* const result = await
|
|
397
|
+
* const result = await Actions.token.burnBlockedSync(client, {
|
|
395
398
|
* from: '0x...',
|
|
396
399
|
* amount: 100n,
|
|
397
400
|
* token: '0x...',
|
|
@@ -442,6 +445,9 @@ export namespace burnBlockedSync {
|
|
|
442
445
|
receipt: TransactionReceipt
|
|
443
446
|
}
|
|
444
447
|
>
|
|
448
|
+
|
|
449
|
+
// TODO: exhaustive error type
|
|
450
|
+
export type ErrorType = BaseErrorType
|
|
445
451
|
}
|
|
446
452
|
|
|
447
453
|
/**
|
|
@@ -451,16 +457,16 @@ export namespace burnBlockedSync {
|
|
|
451
457
|
* ```ts
|
|
452
458
|
* import { createClient, http } from 'viem'
|
|
453
459
|
* import { tempo } from 'tempo.ts/chains'
|
|
454
|
-
* import
|
|
460
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
455
461
|
* import { privateKeyToAccount } from 'viem/accounts'
|
|
456
462
|
*
|
|
457
463
|
* const client = createClient({
|
|
458
464
|
* account: privateKeyToAccount('0x...'),
|
|
459
|
-
* chain: tempo
|
|
465
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
460
466
|
* transport: http(),
|
|
461
467
|
* })
|
|
462
468
|
*
|
|
463
|
-
* const result = await
|
|
469
|
+
* const result = await Actions.token.burn(client, {
|
|
464
470
|
* amount: 100n,
|
|
465
471
|
* token: '0x...',
|
|
466
472
|
* })
|
|
@@ -497,6 +503,9 @@ export namespace burn {
|
|
|
497
503
|
|
|
498
504
|
export type ReturnValue = WriteContractReturnType
|
|
499
505
|
|
|
506
|
+
// TODO: exhaustive error type
|
|
507
|
+
export type ErrorType = BaseErrorType
|
|
508
|
+
|
|
500
509
|
/** @internal */
|
|
501
510
|
export async function inner<
|
|
502
511
|
action extends typeof writeContract | typeof writeContractSync,
|
|
@@ -527,10 +536,10 @@ export namespace burn {
|
|
|
527
536
|
* ```ts
|
|
528
537
|
* import { createClient, http, walletActions } from 'viem'
|
|
529
538
|
* import { tempo } from 'tempo.ts/chains'
|
|
530
|
-
* import
|
|
539
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
531
540
|
*
|
|
532
541
|
* const client = createClient({
|
|
533
|
-
* chain: tempo
|
|
542
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
534
543
|
* transport: http(),
|
|
535
544
|
* }).extend(walletActions)
|
|
536
545
|
*
|
|
@@ -589,16 +598,16 @@ export namespace burn {
|
|
|
589
598
|
* ```ts
|
|
590
599
|
* import { createClient, http } from 'viem'
|
|
591
600
|
* import { tempo } from 'tempo.ts/chains'
|
|
592
|
-
* import
|
|
601
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
593
602
|
* import { privateKeyToAccount } from 'viem/accounts'
|
|
594
603
|
*
|
|
595
604
|
* const client = createClient({
|
|
596
605
|
* account: privateKeyToAccount('0x...'),
|
|
597
|
-
* chain: tempo
|
|
606
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
598
607
|
* transport: http(),
|
|
599
608
|
* })
|
|
600
609
|
*
|
|
601
|
-
* const result = await
|
|
610
|
+
* const result = await Actions.token.burnSync(client, {
|
|
602
611
|
* amount: 100n,
|
|
603
612
|
* token: '0x...',
|
|
604
613
|
* })
|
|
@@ -647,6 +656,9 @@ export namespace burnSync {
|
|
|
647
656
|
receipt: TransactionReceipt
|
|
648
657
|
}
|
|
649
658
|
>
|
|
659
|
+
|
|
660
|
+
// TODO: exhaustive error type
|
|
661
|
+
export type ErrorType = BaseErrorType
|
|
650
662
|
}
|
|
651
663
|
|
|
652
664
|
/**
|
|
@@ -656,16 +668,16 @@ export namespace burnSync {
|
|
|
656
668
|
* ```ts
|
|
657
669
|
* import { createClient, http } from 'viem'
|
|
658
670
|
* import { tempo } from 'tempo.ts/chains'
|
|
659
|
-
* import
|
|
671
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
660
672
|
* import { privateKeyToAccount } from 'viem/accounts'
|
|
661
673
|
*
|
|
662
674
|
* const client = createClient({
|
|
663
675
|
* account: privateKeyToAccount('0x...'),
|
|
664
|
-
* chain: tempo
|
|
676
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
665
677
|
* transport: http(),
|
|
666
678
|
* })
|
|
667
679
|
*
|
|
668
|
-
* const result = await
|
|
680
|
+
* const result = await Actions.token.changeTransferPolicy(client, {
|
|
669
681
|
* token: '0x...',
|
|
670
682
|
* policyId: 1n,
|
|
671
683
|
* })
|
|
@@ -700,6 +712,9 @@ export namespace changeTransferPolicy {
|
|
|
700
712
|
|
|
701
713
|
export type ReturnValue = WriteContractReturnType
|
|
702
714
|
|
|
715
|
+
// TODO: exhaustive error type
|
|
716
|
+
export type ErrorType = BaseErrorType
|
|
717
|
+
|
|
703
718
|
/** @internal */
|
|
704
719
|
export async function inner<
|
|
705
720
|
action extends typeof writeContract | typeof writeContractSync,
|
|
@@ -730,10 +745,10 @@ export namespace changeTransferPolicy {
|
|
|
730
745
|
* ```ts
|
|
731
746
|
* import { createClient, http, walletActions } from 'viem'
|
|
732
747
|
* import { tempo } from 'tempo.ts/chains'
|
|
733
|
-
* import
|
|
748
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
734
749
|
*
|
|
735
750
|
* const client = createClient({
|
|
736
|
-
* chain: tempo
|
|
751
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
737
752
|
* transport: http(),
|
|
738
753
|
* }).extend(walletActions)
|
|
739
754
|
*
|
|
@@ -784,16 +799,16 @@ export namespace changeTransferPolicy {
|
|
|
784
799
|
* ```ts
|
|
785
800
|
* import { createClient, http } from 'viem'
|
|
786
801
|
* import { tempo } from 'tempo.ts/chains'
|
|
787
|
-
* import
|
|
802
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
788
803
|
* import { privateKeyToAccount } from 'viem/accounts'
|
|
789
804
|
*
|
|
790
805
|
* const client = createClient({
|
|
791
806
|
* account: privateKeyToAccount('0x...'),
|
|
792
|
-
* chain: tempo
|
|
807
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
793
808
|
* transport: http(),
|
|
794
809
|
* })
|
|
795
810
|
*
|
|
796
|
-
* const result = await
|
|
811
|
+
* const result = await Actions.token.changeTransferPolicySync(client, {
|
|
797
812
|
* token: '0x...',
|
|
798
813
|
* policyId: 1n,
|
|
799
814
|
* })
|
|
@@ -842,6 +857,9 @@ export namespace changeTransferPolicySync {
|
|
|
842
857
|
receipt: TransactionReceipt
|
|
843
858
|
}
|
|
844
859
|
>
|
|
860
|
+
|
|
861
|
+
// TODO: exhaustive error type
|
|
862
|
+
export type ErrorType = BaseErrorType
|
|
845
863
|
}
|
|
846
864
|
|
|
847
865
|
/**
|
|
@@ -851,16 +869,16 @@ export namespace changeTransferPolicySync {
|
|
|
851
869
|
* ```ts
|
|
852
870
|
* import { createClient, http } from 'viem'
|
|
853
871
|
* import { tempo } from 'tempo.ts/chains'
|
|
854
|
-
* import
|
|
872
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
855
873
|
* import { privateKeyToAccount } from 'viem/accounts'
|
|
856
874
|
*
|
|
857
875
|
* const client = createClient({
|
|
858
876
|
* account: privateKeyToAccount('0x...'),
|
|
859
|
-
* chain: tempo
|
|
877
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
860
878
|
* transport: http(),
|
|
861
879
|
* })
|
|
862
880
|
*
|
|
863
|
-
* const result = await
|
|
881
|
+
* const result = await Actions.token.create(client, {
|
|
864
882
|
* name: 'My Token',
|
|
865
883
|
* symbol: 'MTK',
|
|
866
884
|
* currency: 'USD',
|
|
@@ -906,6 +924,9 @@ export namespace create {
|
|
|
906
924
|
|
|
907
925
|
export type ReturnValue = WriteContractReturnType
|
|
908
926
|
|
|
927
|
+
// TODO: exhaustive error type
|
|
928
|
+
export type ErrorType = BaseErrorType
|
|
929
|
+
|
|
909
930
|
/** @internal */
|
|
910
931
|
export async function inner<
|
|
911
932
|
action extends typeof writeContract | typeof writeContractSync,
|
|
@@ -950,10 +971,10 @@ export namespace create {
|
|
|
950
971
|
* ```ts
|
|
951
972
|
* import { createClient, http, walletActions } from 'viem'
|
|
952
973
|
* import { tempo } from 'tempo.ts/chains'
|
|
953
|
-
* import
|
|
974
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
954
975
|
*
|
|
955
976
|
* const client = createClient({
|
|
956
|
-
* chain: tempo
|
|
977
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
957
978
|
* transport: http(),
|
|
958
979
|
* }).extend(walletActions)
|
|
959
980
|
*
|
|
@@ -977,7 +998,7 @@ export namespace create {
|
|
|
977
998
|
name,
|
|
978
999
|
symbol,
|
|
979
1000
|
currency,
|
|
980
|
-
quoteToken = Addresses.
|
|
1001
|
+
quoteToken = Addresses.linkingUsd,
|
|
981
1002
|
admin,
|
|
982
1003
|
} = args
|
|
983
1004
|
return defineCall({
|
|
@@ -1013,16 +1034,16 @@ export namespace create {
|
|
|
1013
1034
|
* ```ts
|
|
1014
1035
|
* import { createClient, http } from 'viem'
|
|
1015
1036
|
* import { tempo } from 'tempo.ts/chains'
|
|
1016
|
-
* import
|
|
1037
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
1017
1038
|
* import { privateKeyToAccount } from 'viem/accounts'
|
|
1018
1039
|
*
|
|
1019
1040
|
* const client = createClient({
|
|
1020
1041
|
* account: privateKeyToAccount('0x...'),
|
|
1021
|
-
* chain: tempo
|
|
1042
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
1022
1043
|
* transport: http(),
|
|
1023
1044
|
* })
|
|
1024
1045
|
*
|
|
1025
|
-
* const result = await
|
|
1046
|
+
* const result = await Actions.token.createSync(client, {
|
|
1026
1047
|
* name: 'My Token',
|
|
1027
1048
|
* symbol: 'MTK',
|
|
1028
1049
|
* currency: 'USD',
|
|
@@ -1072,196 +1093,9 @@ export namespace createSync {
|
|
|
1072
1093
|
receipt: TransactionReceipt
|
|
1073
1094
|
}
|
|
1074
1095
|
>
|
|
1075
|
-
}
|
|
1076
1096
|
|
|
1077
|
-
|
|
1078
|
-
|
|
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
|
-
>
|
|
1097
|
+
// TODO: exhaustive error type
|
|
1098
|
+
export type ErrorType = BaseErrorType
|
|
1265
1099
|
}
|
|
1266
1100
|
|
|
1267
1101
|
/**
|
|
@@ -1271,16 +1105,16 @@ export namespace finalizeUpdateQuoteTokenSync {
|
|
|
1271
1105
|
* ```ts
|
|
1272
1106
|
* import { createClient, http } from 'viem'
|
|
1273
1107
|
* import { tempo } from 'tempo.ts/chains'
|
|
1274
|
-
* import
|
|
1108
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
1275
1109
|
* import { privateKeyToAccount } from 'viem/accounts'
|
|
1276
1110
|
*
|
|
1277
1111
|
* const client = createClient({
|
|
1278
1112
|
* account: privateKeyToAccount('0x...'),
|
|
1279
|
-
* chain: tempo
|
|
1113
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
1280
1114
|
* transport: http(),
|
|
1281
1115
|
* })
|
|
1282
1116
|
*
|
|
1283
|
-
* const allowance = await
|
|
1117
|
+
* const allowance = await Actions.token.getAllowance(client, {
|
|
1284
1118
|
* spender: '0x...',
|
|
1285
1119
|
* })
|
|
1286
1120
|
* ```
|
|
@@ -1315,8 +1149,8 @@ export namespace getAllowance {
|
|
|
1315
1149
|
account: Address
|
|
1316
1150
|
/** Address of the spender. */
|
|
1317
1151
|
spender: Address
|
|
1318
|
-
/** Address or ID of the TIP20 token.
|
|
1319
|
-
token
|
|
1152
|
+
/** Address or ID of the TIP20 token. */
|
|
1153
|
+
token: TokenId.TokenIdOrAddress
|
|
1320
1154
|
}
|
|
1321
1155
|
|
|
1322
1156
|
export type ReturnValue = ReadContractReturnType<
|
|
@@ -1332,7 +1166,7 @@ export namespace getAllowance {
|
|
|
1332
1166
|
* @returns The call.
|
|
1333
1167
|
*/
|
|
1334
1168
|
export function call(args: Args) {
|
|
1335
|
-
const { account, spender, token
|
|
1169
|
+
const { account, spender, token } = args
|
|
1336
1170
|
return defineCall({
|
|
1337
1171
|
address: TokenId.toAddress(token),
|
|
1338
1172
|
abi: Abis.tip20,
|
|
@@ -1349,16 +1183,16 @@ export namespace getAllowance {
|
|
|
1349
1183
|
* ```ts
|
|
1350
1184
|
* import { createClient, http } from 'viem'
|
|
1351
1185
|
* import { tempo } from 'tempo.ts/chains'
|
|
1352
|
-
* import
|
|
1186
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
1353
1187
|
* import { privateKeyToAccount } from 'viem/accounts'
|
|
1354
1188
|
*
|
|
1355
1189
|
* const client = createClient({
|
|
1356
1190
|
* account: privateKeyToAccount('0x...'),
|
|
1357
|
-
* chain: tempo
|
|
1191
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
1358
1192
|
* transport: http(),
|
|
1359
1193
|
* })
|
|
1360
1194
|
*
|
|
1361
|
-
* const balance = await
|
|
1195
|
+
* const balance = await Actions.token.getBalance(client, {
|
|
1362
1196
|
* token: '0x...',
|
|
1363
1197
|
* })
|
|
1364
1198
|
* ```
|
|
@@ -1372,11 +1206,9 @@ export async function getBalance<
|
|
|
1372
1206
|
account extends Account | undefined,
|
|
1373
1207
|
>(
|
|
1374
1208
|
client: Client<Transport, chain, account>,
|
|
1375
|
-
|
|
1376
|
-
? [getBalance.Parameters<account>] | []
|
|
1377
|
-
: [getBalance.Parameters<account>]
|
|
1209
|
+
parameters: getBalance.Parameters<account>,
|
|
1378
1210
|
): Promise<getBalance.ReturnValue> {
|
|
1379
|
-
const { account = client.account, ...rest } = parameters
|
|
1211
|
+
const { account = client.account, ...rest } = parameters
|
|
1380
1212
|
const address = account ? parseAccount(account).address : undefined
|
|
1381
1213
|
if (!address) throw new Error('account is required.')
|
|
1382
1214
|
return readContract(client, {
|
|
@@ -1393,8 +1225,8 @@ export namespace getBalance {
|
|
|
1393
1225
|
export type Args = {
|
|
1394
1226
|
/** Account address. */
|
|
1395
1227
|
account: Address
|
|
1396
|
-
/** Address or ID of the TIP20 token.
|
|
1397
|
-
token
|
|
1228
|
+
/** Address or ID of the TIP20 token. */
|
|
1229
|
+
token: TokenId.TokenIdOrAddress
|
|
1398
1230
|
}
|
|
1399
1231
|
|
|
1400
1232
|
export type ReturnValue = ReadContractReturnType<
|
|
@@ -1410,7 +1242,7 @@ export namespace getBalance {
|
|
|
1410
1242
|
* @returns The call.
|
|
1411
1243
|
*/
|
|
1412
1244
|
export function call(args: Args) {
|
|
1413
|
-
const { account, token
|
|
1245
|
+
const { account, token } = args
|
|
1414
1246
|
return defineCall({
|
|
1415
1247
|
address: TokenId.toAddress(token),
|
|
1416
1248
|
abi: Abis.tip20,
|
|
@@ -1427,16 +1259,16 @@ export namespace getBalance {
|
|
|
1427
1259
|
* ```ts
|
|
1428
1260
|
* import { createClient, http } from 'viem'
|
|
1429
1261
|
* import { tempo } from 'tempo.ts/chains'
|
|
1430
|
-
* import
|
|
1262
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
1431
1263
|
* import { privateKeyToAccount } from 'viem/accounts'
|
|
1432
1264
|
*
|
|
1433
1265
|
* const client = createClient({
|
|
1434
1266
|
* account: privateKeyToAccount('0x...'),
|
|
1435
|
-
* chain: tempo
|
|
1267
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
1436
1268
|
* transport: http(),
|
|
1437
1269
|
* })
|
|
1438
1270
|
*
|
|
1439
|
-
* const metadata = await
|
|
1271
|
+
* const metadata = await Actions.token.getMetadata(client, {
|
|
1440
1272
|
* token: '0x...',
|
|
1441
1273
|
* })
|
|
1442
1274
|
* ```
|
|
@@ -1447,13 +1279,13 @@ export namespace getBalance {
|
|
|
1447
1279
|
*/
|
|
1448
1280
|
export async function getMetadata<chain extends Chain | undefined>(
|
|
1449
1281
|
client: Client<Transport, chain>,
|
|
1450
|
-
parameters: getMetadata.Parameters
|
|
1282
|
+
parameters: getMetadata.Parameters,
|
|
1451
1283
|
): Promise<getMetadata.ReturnValue> {
|
|
1452
|
-
const { token
|
|
1284
|
+
const { token, ...rest } = parameters
|
|
1453
1285
|
const address = TokenId.toAddress(token)
|
|
1454
1286
|
const abi = Abis.tip20
|
|
1455
1287
|
|
|
1456
|
-
if (TokenId.from(token) === TokenId.fromAddress(Addresses.
|
|
1288
|
+
if (TokenId.from(token) === TokenId.fromAddress(Addresses.linkingUsd))
|
|
1457
1289
|
return multicall(client, {
|
|
1458
1290
|
...rest,
|
|
1459
1291
|
contracts: [
|
|
@@ -1571,8 +1403,8 @@ export async function getMetadata<chain extends Chain | undefined>(
|
|
|
1571
1403
|
|
|
1572
1404
|
export declare namespace getMetadata {
|
|
1573
1405
|
export type Parameters = {
|
|
1574
|
-
/** Address or ID of the TIP20 token.
|
|
1575
|
-
token
|
|
1406
|
+
/** Address or ID of the TIP20 token. */
|
|
1407
|
+
token: TokenId.TokenIdOrAddress
|
|
1576
1408
|
}
|
|
1577
1409
|
|
|
1578
1410
|
export type ReturnValue = Compute<{
|
|
@@ -1624,6 +1456,73 @@ export declare namespace getMetadata {
|
|
|
1624
1456
|
}>
|
|
1625
1457
|
}
|
|
1626
1458
|
|
|
1459
|
+
/**
|
|
1460
|
+
* Gets the admin role for a specific role in a TIP20 token.
|
|
1461
|
+
*
|
|
1462
|
+
* @example
|
|
1463
|
+
* ```ts
|
|
1464
|
+
* import { createClient, http } from 'viem'
|
|
1465
|
+
* import { tempo } from 'tempo.ts/chains'
|
|
1466
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
1467
|
+
*
|
|
1468
|
+
* const client = createClient({
|
|
1469
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
1470
|
+
* transport: http(),
|
|
1471
|
+
* })
|
|
1472
|
+
*
|
|
1473
|
+
* const adminRole = await Actions.token.getRoleAdmin(client, {
|
|
1474
|
+
* role: 'minter',
|
|
1475
|
+
* token: '0x...',
|
|
1476
|
+
* })
|
|
1477
|
+
* ```
|
|
1478
|
+
*
|
|
1479
|
+
* @param client - Client.
|
|
1480
|
+
* @param parameters - Parameters.
|
|
1481
|
+
* @returns The admin role hash.
|
|
1482
|
+
*/
|
|
1483
|
+
export async function getRoleAdmin<chain extends Chain | undefined>(
|
|
1484
|
+
client: Client<Transport, chain>,
|
|
1485
|
+
parameters: getRoleAdmin.Parameters,
|
|
1486
|
+
): Promise<getRoleAdmin.ReturnValue> {
|
|
1487
|
+
return readContract(client, {
|
|
1488
|
+
...parameters,
|
|
1489
|
+
...getRoleAdmin.call(parameters),
|
|
1490
|
+
})
|
|
1491
|
+
}
|
|
1492
|
+
|
|
1493
|
+
export namespace getRoleAdmin {
|
|
1494
|
+
export type Parameters = ReadParameters & Args
|
|
1495
|
+
|
|
1496
|
+
export type Args = {
|
|
1497
|
+
/** Role to get admin for. */
|
|
1498
|
+
role: TokenRole.TokenRole
|
|
1499
|
+
/** Address or ID of the TIP20 token. */
|
|
1500
|
+
token: TokenId.TokenIdOrAddress
|
|
1501
|
+
}
|
|
1502
|
+
|
|
1503
|
+
export type ReturnValue = ReadContractReturnType<
|
|
1504
|
+
typeof Abis.tip20,
|
|
1505
|
+
'getRoleAdmin',
|
|
1506
|
+
never
|
|
1507
|
+
>
|
|
1508
|
+
|
|
1509
|
+
/**
|
|
1510
|
+
* Defines a call to the `getRoleAdmin` function.
|
|
1511
|
+
*
|
|
1512
|
+
* @param args - Arguments.
|
|
1513
|
+
* @returns The call.
|
|
1514
|
+
*/
|
|
1515
|
+
export function call(args: Args) {
|
|
1516
|
+
const { role, token } = args
|
|
1517
|
+
return defineCall({
|
|
1518
|
+
address: TokenId.toAddress(token),
|
|
1519
|
+
abi: Abis.tip20,
|
|
1520
|
+
functionName: 'getRoleAdmin',
|
|
1521
|
+
args: [TokenRole.serialize(role)],
|
|
1522
|
+
})
|
|
1523
|
+
}
|
|
1524
|
+
}
|
|
1525
|
+
|
|
1627
1526
|
/**
|
|
1628
1527
|
* Checks if an account has a specific role for a TIP20 token.
|
|
1629
1528
|
*
|
|
@@ -1631,14 +1530,14 @@ export declare namespace getMetadata {
|
|
|
1631
1530
|
* ```ts
|
|
1632
1531
|
* import { createClient, http } from 'viem'
|
|
1633
1532
|
* import { tempo } from 'tempo.ts/chains'
|
|
1634
|
-
* import
|
|
1533
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
1635
1534
|
*
|
|
1636
1535
|
* const client = createClient({
|
|
1637
|
-
* chain: tempo
|
|
1536
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
1638
1537
|
* transport: http(),
|
|
1639
1538
|
* })
|
|
1640
1539
|
*
|
|
1641
|
-
* const hasRole = await
|
|
1540
|
+
* const hasRole = await Actions.token.hasRole(client, {
|
|
1642
1541
|
* account: '0x...',
|
|
1643
1542
|
* role: 'issuer',
|
|
1644
1543
|
* token: '0x...',
|
|
@@ -1709,16 +1608,16 @@ export namespace hasRole {
|
|
|
1709
1608
|
* ```ts
|
|
1710
1609
|
* import { createClient, http } from 'viem'
|
|
1711
1610
|
* import { tempo } from 'tempo.ts/chains'
|
|
1712
|
-
* import
|
|
1611
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
1713
1612
|
* import { privateKeyToAccount } from 'viem/accounts'
|
|
1714
1613
|
*
|
|
1715
1614
|
* const client = createClient({
|
|
1716
1615
|
* account: privateKeyToAccount('0x...'),
|
|
1717
|
-
* chain: tempo
|
|
1616
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
1718
1617
|
* transport: http(),
|
|
1719
1618
|
* })
|
|
1720
1619
|
*
|
|
1721
|
-
* const result = await
|
|
1620
|
+
* const result = await Actions.token.grantRoles(client, {
|
|
1722
1621
|
* token: '0x...',
|
|
1723
1622
|
* to: '0x...',
|
|
1724
1623
|
* roles: ['issuer'],
|
|
@@ -1760,6 +1659,9 @@ export namespace grantRoles {
|
|
|
1760
1659
|
|
|
1761
1660
|
export type ReturnValue = WriteContractReturnType
|
|
1762
1661
|
|
|
1662
|
+
// TODO: exhaustive error type
|
|
1663
|
+
export type ErrorType = BaseErrorType
|
|
1664
|
+
|
|
1763
1665
|
/** @internal */
|
|
1764
1666
|
export async function inner<
|
|
1765
1667
|
action extends typeof sendTransaction | typeof sendTransactionSync,
|
|
@@ -1794,10 +1696,10 @@ export namespace grantRoles {
|
|
|
1794
1696
|
* ```ts
|
|
1795
1697
|
* import { createClient, http, walletActions } from 'viem'
|
|
1796
1698
|
* import { tempo } from 'tempo.ts/chains'
|
|
1797
|
-
* import
|
|
1699
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
1798
1700
|
*
|
|
1799
1701
|
* const client = createClient({
|
|
1800
|
-
* chain: tempo
|
|
1702
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
1801
1703
|
* transport: http(),
|
|
1802
1704
|
* }).extend(walletActions)
|
|
1803
1705
|
*
|
|
@@ -1851,16 +1753,16 @@ export namespace grantRoles {
|
|
|
1851
1753
|
* ```ts
|
|
1852
1754
|
* import { createClient, http } from 'viem'
|
|
1853
1755
|
* import { tempo } from 'tempo.ts/chains'
|
|
1854
|
-
* import
|
|
1756
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
1855
1757
|
* import { privateKeyToAccount } from 'viem/accounts'
|
|
1856
1758
|
*
|
|
1857
1759
|
* const client = createClient({
|
|
1858
1760
|
* account: privateKeyToAccount('0x...'),
|
|
1859
|
-
* chain: tempo
|
|
1761
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
1860
1762
|
* transport: http(),
|
|
1861
1763
|
* })
|
|
1862
1764
|
*
|
|
1863
|
-
* const result = await
|
|
1765
|
+
* const result = await Actions.token.grantRolesSync(client, {
|
|
1864
1766
|
* token: '0x...',
|
|
1865
1767
|
* to: '0x...',
|
|
1866
1768
|
* roles: ['minter'],
|
|
@@ -1907,6 +1809,9 @@ export namespace grantRolesSync {
|
|
|
1907
1809
|
{ IndexedOnly: false; Required: true }
|
|
1908
1810
|
>[]
|
|
1909
1811
|
}
|
|
1812
|
+
|
|
1813
|
+
// TODO: exhaustive error type
|
|
1814
|
+
export type ErrorType = BaseErrorType
|
|
1910
1815
|
}
|
|
1911
1816
|
|
|
1912
1817
|
/**
|
|
@@ -1916,16 +1821,16 @@ export namespace grantRolesSync {
|
|
|
1916
1821
|
* ```ts
|
|
1917
1822
|
* import { createClient, http } from 'viem'
|
|
1918
1823
|
* import { tempo } from 'tempo.ts/chains'
|
|
1919
|
-
* import
|
|
1824
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
1920
1825
|
* import { privateKeyToAccount } from 'viem/accounts'
|
|
1921
1826
|
*
|
|
1922
1827
|
* const client = createClient({
|
|
1923
1828
|
* account: privateKeyToAccount('0x...'),
|
|
1924
|
-
* chain: tempo
|
|
1829
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
1925
1830
|
* transport: http(),
|
|
1926
1831
|
* })
|
|
1927
1832
|
*
|
|
1928
|
-
* const result = await
|
|
1833
|
+
* const result = await Actions.token.mint(client, {
|
|
1929
1834
|
* to: '0x...',
|
|
1930
1835
|
* amount: 100n,
|
|
1931
1836
|
* token: '0x...',
|
|
@@ -1965,6 +1870,9 @@ export namespace mint {
|
|
|
1965
1870
|
|
|
1966
1871
|
export type ReturnValue = WriteContractReturnType
|
|
1967
1872
|
|
|
1873
|
+
// TODO: exhaustive error type
|
|
1874
|
+
export type ErrorType = BaseErrorType
|
|
1875
|
+
|
|
1968
1876
|
/** @internal */
|
|
1969
1877
|
export async function inner<
|
|
1970
1878
|
action extends typeof writeContract | typeof writeContractSync,
|
|
@@ -1994,10 +1902,10 @@ export namespace mint {
|
|
|
1994
1902
|
* ```ts
|
|
1995
1903
|
* import { createClient, http, walletActions } from 'viem'
|
|
1996
1904
|
* import { tempo } from 'tempo.ts/chains'
|
|
1997
|
-
* import
|
|
1905
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
1998
1906
|
*
|
|
1999
1907
|
* const client = createClient({
|
|
2000
|
-
* chain: tempo
|
|
1908
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
2001
1909
|
* transport: http(),
|
|
2002
1910
|
* }).extend(walletActions)
|
|
2003
1911
|
*
|
|
@@ -2057,16 +1965,16 @@ export namespace mint {
|
|
|
2057
1965
|
* ```ts
|
|
2058
1966
|
* import { createClient, http } from 'viem'
|
|
2059
1967
|
* import { tempo } from 'tempo.ts/chains'
|
|
2060
|
-
* import
|
|
1968
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
2061
1969
|
* import { privateKeyToAccount } from 'viem/accounts'
|
|
2062
1970
|
*
|
|
2063
1971
|
* const client = createClient({
|
|
2064
1972
|
* account: privateKeyToAccount('0x...'),
|
|
2065
|
-
* chain: tempo
|
|
1973
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
2066
1974
|
* transport: http(),
|
|
2067
1975
|
* })
|
|
2068
1976
|
*
|
|
2069
|
-
* const result = await
|
|
1977
|
+
* const result = await Actions.token.mintSync(client, {
|
|
2070
1978
|
* to: '0x...',
|
|
2071
1979
|
* amount: 100n,
|
|
2072
1980
|
* token: '0x...',
|
|
@@ -2114,217 +2022,31 @@ export namespace mintSync {
|
|
|
2114
2022
|
}
|
|
2115
2023
|
> & {
|
|
2116
2024
|
receipt: TransactionReceipt
|
|
2117
|
-
}
|
|
2118
|
-
>
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
* Pauses a TIP20 token.
|
|
2123
|
-
*
|
|
2124
|
-
* @example
|
|
2125
|
-
* ```ts
|
|
2126
|
-
* import { createClient, http } from 'viem'
|
|
2127
|
-
* import { tempo } from 'tempo.ts/chains'
|
|
2128
|
-
* import * as actions from 'tempo.ts/viem/actions'
|
|
2129
|
-
* import { privateKeyToAccount } from 'viem/accounts'
|
|
2130
|
-
*
|
|
2131
|
-
* const client = createClient({
|
|
2132
|
-
* account: privateKeyToAccount('0x...'),
|
|
2133
|
-
* chain: tempo,
|
|
2134
|
-
* transport: http(),
|
|
2135
|
-
* })
|
|
2136
|
-
*
|
|
2137
|
-
* const result = await actions.token.pause(client, {
|
|
2138
|
-
* token: '0x...',
|
|
2139
|
-
* })
|
|
2140
|
-
* ```
|
|
2141
|
-
*
|
|
2142
|
-
* @param client - Client.
|
|
2143
|
-
* @param parameters - Parameters.
|
|
2144
|
-
* @returns The transaction hash.
|
|
2145
|
-
*/
|
|
2146
|
-
export async function pause<
|
|
2147
|
-
chain extends Chain | undefined,
|
|
2148
|
-
account extends Account | undefined,
|
|
2149
|
-
>(
|
|
2150
|
-
client: Client<Transport, chain, account>,
|
|
2151
|
-
parameters: pause.Parameters<chain, account>,
|
|
2152
|
-
): Promise<pause.ReturnValue> {
|
|
2153
|
-
return pause.inner(writeContract, client, parameters)
|
|
2154
|
-
}
|
|
2155
|
-
|
|
2156
|
-
export namespace pause {
|
|
2157
|
-
export type Parameters<
|
|
2158
|
-
chain extends Chain | undefined = Chain | undefined,
|
|
2159
|
-
account extends Account | undefined = Account | undefined,
|
|
2160
|
-
> = WriteParameters<chain, account> & Args
|
|
2161
|
-
|
|
2162
|
-
export type Args = {
|
|
2163
|
-
/** Address or ID of the TIP20 token. */
|
|
2164
|
-
token: TokenId.TokenIdOrAddress
|
|
2165
|
-
}
|
|
2166
|
-
|
|
2167
|
-
export type ReturnValue = WriteContractReturnType
|
|
2168
|
-
|
|
2169
|
-
/** @internal */
|
|
2170
|
-
export async function inner<
|
|
2171
|
-
action extends typeof writeContract | typeof writeContractSync,
|
|
2172
|
-
chain extends Chain | undefined,
|
|
2173
|
-
account extends Account | undefined,
|
|
2174
|
-
>(
|
|
2175
|
-
action: action,
|
|
2176
|
-
client: Client<Transport, chain, account>,
|
|
2177
|
-
parameters: pause.Parameters<chain, account>,
|
|
2178
|
-
): Promise<ReturnType<action>> {
|
|
2179
|
-
const { token, ...rest } = parameters
|
|
2180
|
-
const call = pause.call({ token })
|
|
2181
|
-
return (await action(client, {
|
|
2182
|
-
...rest,
|
|
2183
|
-
...call,
|
|
2184
|
-
} as never)) as never
|
|
2185
|
-
}
|
|
2186
|
-
|
|
2187
|
-
/**
|
|
2188
|
-
* Defines a call to the `pause` function.
|
|
2189
|
-
*
|
|
2190
|
-
* Can be passed as a parameter to:
|
|
2191
|
-
* - [`estimateContractGas`](https://viem.sh/docs/contract/estimateContractGas): estimate the gas cost of the call
|
|
2192
|
-
* - [`simulateContract`](https://viem.sh/docs/contract/simulateContract): simulate the call
|
|
2193
|
-
* - [`sendCalls`](https://viem.sh/docs/actions/wallet/sendCalls): send multiple calls
|
|
2194
|
-
*
|
|
2195
|
-
* @example
|
|
2196
|
-
* ```ts
|
|
2197
|
-
* import { createClient, http, walletActions } from 'viem'
|
|
2198
|
-
* import { tempo } from 'tempo.ts/chains'
|
|
2199
|
-
* import * as actions from 'tempo.ts/viem/actions'
|
|
2200
|
-
*
|
|
2201
|
-
* const client = createClient({
|
|
2202
|
-
* chain: tempo,
|
|
2203
|
-
* transport: http(),
|
|
2204
|
-
* }).extend(walletActions)
|
|
2205
|
-
*
|
|
2206
|
-
* const { result } = await client.sendCalls({
|
|
2207
|
-
* calls: [
|
|
2208
|
-
* actions.token.pause.call({
|
|
2209
|
-
* token: '0x20c0...babe',
|
|
2210
|
-
* }),
|
|
2211
|
-
* ]
|
|
2212
|
-
* })
|
|
2213
|
-
* ```
|
|
2214
|
-
*
|
|
2215
|
-
* @param args - Arguments.
|
|
2216
|
-
* @returns The call.
|
|
2217
|
-
*/
|
|
2218
|
-
export function call(args: Args) {
|
|
2219
|
-
const { token } = args
|
|
2220
|
-
return defineCall({
|
|
2221
|
-
address: TokenId.toAddress(token),
|
|
2222
|
-
abi: Abis.tip20,
|
|
2223
|
-
functionName: 'pause',
|
|
2224
|
-
args: [],
|
|
2225
|
-
})
|
|
2226
|
-
}
|
|
2227
|
-
|
|
2228
|
-
/**
|
|
2229
|
-
* Extracts the event from the logs.
|
|
2230
|
-
*
|
|
2231
|
-
* @param logs - Logs.
|
|
2232
|
-
* @returns The event.
|
|
2233
|
-
*/
|
|
2234
|
-
export function extractEvent(logs: Log[]) {
|
|
2235
|
-
const [log] = parseEventLogs({
|
|
2236
|
-
abi: Abis.tip20,
|
|
2237
|
-
logs,
|
|
2238
|
-
eventName: 'PauseStateUpdate',
|
|
2239
|
-
})
|
|
2240
|
-
if (!log) throw new Error('`PauseStateUpdate` event not found.')
|
|
2241
|
-
return log
|
|
2242
|
-
}
|
|
2243
|
-
}
|
|
2244
|
-
|
|
2245
|
-
/**
|
|
2246
|
-
* Pauses a TIP20 token.
|
|
2247
|
-
*
|
|
2248
|
-
* @example
|
|
2249
|
-
* ```ts
|
|
2250
|
-
* import { createClient, http } from 'viem'
|
|
2251
|
-
* import { tempo } from 'tempo.ts/chains'
|
|
2252
|
-
* import * as actions from 'tempo.ts/viem/actions'
|
|
2253
|
-
* import { privateKeyToAccount } from 'viem/accounts'
|
|
2254
|
-
*
|
|
2255
|
-
* const client = createClient({
|
|
2256
|
-
* account: privateKeyToAccount('0x...'),
|
|
2257
|
-
* chain: tempo,
|
|
2258
|
-
* transport: http(),
|
|
2259
|
-
* })
|
|
2260
|
-
*
|
|
2261
|
-
* const result = await actions.token.pauseSync(client, {
|
|
2262
|
-
* token: '0x...',
|
|
2263
|
-
* })
|
|
2264
|
-
* ```
|
|
2265
|
-
*
|
|
2266
|
-
* @param client - Client.
|
|
2267
|
-
* @param parameters - Parameters.
|
|
2268
|
-
* @returns The transaction receipt and event data.
|
|
2269
|
-
*/
|
|
2270
|
-
export async function pauseSync<
|
|
2271
|
-
chain extends Chain | undefined,
|
|
2272
|
-
account extends Account | undefined,
|
|
2273
|
-
>(
|
|
2274
|
-
client: Client<Transport, chain, account>,
|
|
2275
|
-
parameters: pauseSync.Parameters<chain, account>,
|
|
2276
|
-
): Promise<pauseSync.ReturnValue> {
|
|
2277
|
-
const { throwOnReceiptRevert = true, ...rest } = parameters
|
|
2278
|
-
const receipt = await pause.inner(writeContractSync, client, {
|
|
2279
|
-
...rest,
|
|
2280
|
-
throwOnReceiptRevert,
|
|
2281
|
-
} as never)
|
|
2282
|
-
const { args } = pause.extractEvent(receipt.logs)
|
|
2283
|
-
return {
|
|
2284
|
-
...args,
|
|
2285
|
-
receipt,
|
|
2286
|
-
}
|
|
2287
|
-
}
|
|
2288
|
-
|
|
2289
|
-
export namespace pauseSync {
|
|
2290
|
-
export type Parameters<
|
|
2291
|
-
chain extends Chain | undefined = Chain | undefined,
|
|
2292
|
-
account extends Account | undefined = Account | undefined,
|
|
2293
|
-
> = pause.Parameters<chain, account>
|
|
2294
|
-
|
|
2295
|
-
export type Args = pause.Args
|
|
2296
|
-
|
|
2297
|
-
export type ReturnValue = GetEventArgs<
|
|
2298
|
-
typeof Abis.tip20,
|
|
2299
|
-
'PauseStateUpdate',
|
|
2300
|
-
{ IndexedOnly: false; Required: true }
|
|
2301
|
-
> & {
|
|
2302
|
-
receipt: TransactionReceipt
|
|
2303
|
-
}
|
|
2025
|
+
}
|
|
2026
|
+
>
|
|
2027
|
+
|
|
2028
|
+
// TODO: exhaustive error type
|
|
2029
|
+
export type ErrorType = BaseErrorType
|
|
2304
2030
|
}
|
|
2305
2031
|
|
|
2306
2032
|
/**
|
|
2307
|
-
*
|
|
2033
|
+
* Pauses a TIP20 token.
|
|
2308
2034
|
*
|
|
2309
2035
|
* @example
|
|
2310
2036
|
* ```ts
|
|
2311
2037
|
* import { createClient, http } from 'viem'
|
|
2312
2038
|
* import { tempo } from 'tempo.ts/chains'
|
|
2313
|
-
* import
|
|
2039
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
2314
2040
|
* import { privateKeyToAccount } from 'viem/accounts'
|
|
2315
2041
|
*
|
|
2316
2042
|
* const client = createClient({
|
|
2317
2043
|
* account: privateKeyToAccount('0x...'),
|
|
2318
|
-
* chain: tempo
|
|
2044
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
2319
2045
|
* transport: http(),
|
|
2320
2046
|
* })
|
|
2321
2047
|
*
|
|
2322
|
-
* const result = await
|
|
2323
|
-
*
|
|
2324
|
-
* spender: '0x...',
|
|
2325
|
-
* value: 100n,
|
|
2326
|
-
* deadline: 1234567890n,
|
|
2327
|
-
* signature: { r: 0n, s: 0n, yParity: 0 },
|
|
2048
|
+
* const result = await Actions.token.pause(client, {
|
|
2049
|
+
* token: '0x...',
|
|
2328
2050
|
* })
|
|
2329
2051
|
* ```
|
|
2330
2052
|
*
|
|
@@ -2332,39 +2054,32 @@ export namespace pauseSync {
|
|
|
2332
2054
|
* @param parameters - Parameters.
|
|
2333
2055
|
* @returns The transaction hash.
|
|
2334
2056
|
*/
|
|
2335
|
-
export async function
|
|
2057
|
+
export async function pause<
|
|
2336
2058
|
chain extends Chain | undefined,
|
|
2337
2059
|
account extends Account | undefined,
|
|
2338
2060
|
>(
|
|
2339
2061
|
client: Client<Transport, chain, account>,
|
|
2340
|
-
parameters:
|
|
2341
|
-
): Promise<
|
|
2342
|
-
return
|
|
2062
|
+
parameters: pause.Parameters<chain, account>,
|
|
2063
|
+
): Promise<pause.ReturnValue> {
|
|
2064
|
+
return pause.inner(writeContract, client, parameters)
|
|
2343
2065
|
}
|
|
2344
2066
|
|
|
2345
|
-
export namespace
|
|
2067
|
+
export namespace pause {
|
|
2346
2068
|
export type Parameters<
|
|
2347
2069
|
chain extends Chain | undefined = Chain | undefined,
|
|
2348
2070
|
account extends Account | undefined = Account | undefined,
|
|
2349
2071
|
> = WriteParameters<chain, account> & Args
|
|
2350
2072
|
|
|
2351
2073
|
export type Args = {
|
|
2352
|
-
/**
|
|
2353
|
-
|
|
2354
|
-
/** Address of the owner. */
|
|
2355
|
-
owner: Address
|
|
2356
|
-
/** Signature. */
|
|
2357
|
-
signature: Signature.Signature
|
|
2358
|
-
/** Address of the spender. */
|
|
2359
|
-
spender: Address
|
|
2360
|
-
/** Address or ID of the TIP20 token. @default `Addresses.defaultFeeToken` */
|
|
2361
|
-
token?: TokenId.TokenIdOrAddress | undefined
|
|
2362
|
-
/** Amount to approve. */
|
|
2363
|
-
value: bigint
|
|
2074
|
+
/** Address or ID of the TIP20 token. */
|
|
2075
|
+
token: TokenId.TokenIdOrAddress
|
|
2364
2076
|
}
|
|
2365
2077
|
|
|
2366
2078
|
export type ReturnValue = WriteContractReturnType
|
|
2367
2079
|
|
|
2080
|
+
// TODO: exhaustive error type
|
|
2081
|
+
export type ErrorType = BaseErrorType
|
|
2082
|
+
|
|
2368
2083
|
/** @internal */
|
|
2369
2084
|
export async function inner<
|
|
2370
2085
|
action extends typeof writeContract | typeof writeContractSync,
|
|
@@ -2373,18 +2088,10 @@ export namespace permit {
|
|
|
2373
2088
|
>(
|
|
2374
2089
|
action: action,
|
|
2375
2090
|
client: Client<Transport, chain, account>,
|
|
2376
|
-
parameters:
|
|
2091
|
+
parameters: pause.Parameters<chain, account>,
|
|
2377
2092
|
): Promise<ReturnType<action>> {
|
|
2378
|
-
const {
|
|
2379
|
-
|
|
2380
|
-
const call = permit.call({
|
|
2381
|
-
owner,
|
|
2382
|
-
spender,
|
|
2383
|
-
value,
|
|
2384
|
-
deadline,
|
|
2385
|
-
signature,
|
|
2386
|
-
token,
|
|
2387
|
-
})
|
|
2093
|
+
const { token, ...rest } = parameters
|
|
2094
|
+
const call = pause.call({ token })
|
|
2388
2095
|
return (await action(client, {
|
|
2389
2096
|
...rest,
|
|
2390
2097
|
...call,
|
|
@@ -2392,7 +2099,7 @@ export namespace permit {
|
|
|
2392
2099
|
}
|
|
2393
2100
|
|
|
2394
2101
|
/**
|
|
2395
|
-
* Defines a call to the `
|
|
2102
|
+
* Defines a call to the `pause` function.
|
|
2396
2103
|
*
|
|
2397
2104
|
* Can be passed as a parameter to:
|
|
2398
2105
|
* - [`estimateContractGas`](https://viem.sh/docs/contract/estimateContractGas): estimate the gas cost of the call
|
|
@@ -2403,22 +2110,17 @@ export namespace permit {
|
|
|
2403
2110
|
* ```ts
|
|
2404
2111
|
* import { createClient, http, walletActions } from 'viem'
|
|
2405
2112
|
* import { tempo } from 'tempo.ts/chains'
|
|
2406
|
-
* import
|
|
2113
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
2407
2114
|
*
|
|
2408
2115
|
* const client = createClient({
|
|
2409
|
-
* chain: tempo
|
|
2116
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
2410
2117
|
* transport: http(),
|
|
2411
2118
|
* }).extend(walletActions)
|
|
2412
2119
|
*
|
|
2413
2120
|
* const { result } = await client.sendCalls({
|
|
2414
2121
|
* calls: [
|
|
2415
|
-
* actions.token.
|
|
2416
|
-
*
|
|
2417
|
-
* spender: '0x20c0...babe',
|
|
2418
|
-
* value: 100n,
|
|
2419
|
-
* deadline: 1234567890n,
|
|
2420
|
-
* signature: { r: 0n, s: 0n, yParity: 0 },
|
|
2421
|
-
* token: '0x20c0...cafe',
|
|
2122
|
+
* actions.token.pause.call({
|
|
2123
|
+
* token: '0x20c0...babe',
|
|
2422
2124
|
* }),
|
|
2423
2125
|
* ]
|
|
2424
2126
|
* })
|
|
@@ -2428,29 +2130,12 @@ export namespace permit {
|
|
|
2428
2130
|
* @returns The call.
|
|
2429
2131
|
*/
|
|
2430
2132
|
export function call(args: Args) {
|
|
2431
|
-
const {
|
|
2432
|
-
owner,
|
|
2433
|
-
spender,
|
|
2434
|
-
value,
|
|
2435
|
-
deadline,
|
|
2436
|
-
signature,
|
|
2437
|
-
token = Addresses.defaultFeeToken,
|
|
2438
|
-
} = args
|
|
2439
|
-
const { r, s, yParity } = Signature.from(signature)
|
|
2440
|
-
const v = Signature.yParityToV(yParity)
|
|
2133
|
+
const { token } = args
|
|
2441
2134
|
return defineCall({
|
|
2442
2135
|
address: TokenId.toAddress(token),
|
|
2443
2136
|
abi: Abis.tip20,
|
|
2444
|
-
functionName: '
|
|
2445
|
-
args: [
|
|
2446
|
-
owner,
|
|
2447
|
-
spender,
|
|
2448
|
-
value,
|
|
2449
|
-
deadline,
|
|
2450
|
-
v,
|
|
2451
|
-
Hex.trimLeft(Hex.fromNumber(r!)),
|
|
2452
|
-
Hex.trimLeft(Hex.fromNumber(s!)),
|
|
2453
|
-
],
|
|
2137
|
+
functionName: 'pause',
|
|
2138
|
+
args: [],
|
|
2454
2139
|
})
|
|
2455
2140
|
}
|
|
2456
2141
|
|
|
@@ -2464,35 +2149,31 @@ export namespace permit {
|
|
|
2464
2149
|
const [log] = parseEventLogs({
|
|
2465
2150
|
abi: Abis.tip20,
|
|
2466
2151
|
logs,
|
|
2467
|
-
eventName: '
|
|
2152
|
+
eventName: 'PauseStateUpdate',
|
|
2468
2153
|
})
|
|
2469
|
-
if (!log) throw new Error('`
|
|
2154
|
+
if (!log) throw new Error('`PauseStateUpdate` event not found.')
|
|
2470
2155
|
return log
|
|
2471
2156
|
}
|
|
2472
2157
|
}
|
|
2473
2158
|
|
|
2474
2159
|
/**
|
|
2475
|
-
*
|
|
2160
|
+
* Pauses a TIP20 token.
|
|
2476
2161
|
*
|
|
2477
2162
|
* @example
|
|
2478
2163
|
* ```ts
|
|
2479
2164
|
* import { createClient, http } from 'viem'
|
|
2480
2165
|
* import { tempo } from 'tempo.ts/chains'
|
|
2481
|
-
* import
|
|
2166
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
2482
2167
|
* import { privateKeyToAccount } from 'viem/accounts'
|
|
2483
2168
|
*
|
|
2484
2169
|
* const client = createClient({
|
|
2485
2170
|
* account: privateKeyToAccount('0x...'),
|
|
2486
|
-
* chain: tempo
|
|
2171
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
2487
2172
|
* transport: http(),
|
|
2488
2173
|
* })
|
|
2489
2174
|
*
|
|
2490
|
-
* const result = await
|
|
2491
|
-
*
|
|
2492
|
-
* spender: '0x...',
|
|
2493
|
-
* value: 100n,
|
|
2494
|
-
* deadline: 1234567890n,
|
|
2495
|
-
* signature: { r: 0n, s: 0n, yParity: 0 },
|
|
2175
|
+
* const result = await Actions.token.pauseSync(client, {
|
|
2176
|
+
* token: '0x...',
|
|
2496
2177
|
* })
|
|
2497
2178
|
* ```
|
|
2498
2179
|
*
|
|
@@ -2500,40 +2181,43 @@ export namespace permit {
|
|
|
2500
2181
|
* @param parameters - Parameters.
|
|
2501
2182
|
* @returns The transaction receipt and event data.
|
|
2502
2183
|
*/
|
|
2503
|
-
export async function
|
|
2184
|
+
export async function pauseSync<
|
|
2504
2185
|
chain extends Chain | undefined,
|
|
2505
2186
|
account extends Account | undefined,
|
|
2506
2187
|
>(
|
|
2507
2188
|
client: Client<Transport, chain, account>,
|
|
2508
|
-
parameters:
|
|
2509
|
-
): Promise<
|
|
2189
|
+
parameters: pauseSync.Parameters<chain, account>,
|
|
2190
|
+
): Promise<pauseSync.ReturnValue> {
|
|
2510
2191
|
const { throwOnReceiptRevert = true, ...rest } = parameters
|
|
2511
|
-
const receipt = await
|
|
2192
|
+
const receipt = await pause.inner(writeContractSync, client, {
|
|
2512
2193
|
...rest,
|
|
2513
2194
|
throwOnReceiptRevert,
|
|
2514
2195
|
} as never)
|
|
2515
|
-
const { args } =
|
|
2196
|
+
const { args } = pause.extractEvent(receipt.logs)
|
|
2516
2197
|
return {
|
|
2517
2198
|
...args,
|
|
2518
2199
|
receipt,
|
|
2519
|
-
}
|
|
2200
|
+
}
|
|
2520
2201
|
}
|
|
2521
2202
|
|
|
2522
|
-
export namespace
|
|
2203
|
+
export namespace pauseSync {
|
|
2523
2204
|
export type Parameters<
|
|
2524
2205
|
chain extends Chain | undefined = Chain | undefined,
|
|
2525
2206
|
account extends Account | undefined = Account | undefined,
|
|
2526
|
-
> =
|
|
2207
|
+
> = pause.Parameters<chain, account>
|
|
2527
2208
|
|
|
2528
|
-
export type Args =
|
|
2209
|
+
export type Args = pause.Args
|
|
2529
2210
|
|
|
2530
2211
|
export type ReturnValue = GetEventArgs<
|
|
2531
2212
|
typeof Abis.tip20,
|
|
2532
|
-
'
|
|
2213
|
+
'PauseStateUpdate',
|
|
2533
2214
|
{ IndexedOnly: false; Required: true }
|
|
2534
2215
|
> & {
|
|
2535
2216
|
receipt: TransactionReceipt
|
|
2536
2217
|
}
|
|
2218
|
+
|
|
2219
|
+
// TODO: exhaustive error type
|
|
2220
|
+
export type ErrorType = BaseErrorType
|
|
2537
2221
|
}
|
|
2538
2222
|
|
|
2539
2223
|
/**
|
|
@@ -2543,16 +2227,16 @@ export namespace permitSync {
|
|
|
2543
2227
|
* ```ts
|
|
2544
2228
|
* import { createClient, http } from 'viem'
|
|
2545
2229
|
* import { tempo } from 'tempo.ts/chains'
|
|
2546
|
-
* import
|
|
2230
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
2547
2231
|
* import { privateKeyToAccount } from 'viem/accounts'
|
|
2548
2232
|
*
|
|
2549
2233
|
* const client = createClient({
|
|
2550
2234
|
* account: privateKeyToAccount('0x...'),
|
|
2551
|
-
* chain: tempo
|
|
2235
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
2552
2236
|
* transport: http(),
|
|
2553
2237
|
* })
|
|
2554
2238
|
*
|
|
2555
|
-
* const result = await
|
|
2239
|
+
* const result = await Actions.token.renounceRoles(client, {
|
|
2556
2240
|
* token: '0x...',
|
|
2557
2241
|
* roles: ['minter'],
|
|
2558
2242
|
* })
|
|
@@ -2591,6 +2275,9 @@ export namespace renounceRoles {
|
|
|
2591
2275
|
|
|
2592
2276
|
export type ReturnValue = WriteContractReturnType
|
|
2593
2277
|
|
|
2278
|
+
// TODO: exhaustive error type
|
|
2279
|
+
export type ErrorType = BaseErrorType
|
|
2280
|
+
|
|
2594
2281
|
/** @internal */
|
|
2595
2282
|
export async function inner<
|
|
2596
2283
|
action extends typeof sendTransaction | typeof sendTransactionSync,
|
|
@@ -2625,10 +2312,10 @@ export namespace renounceRoles {
|
|
|
2625
2312
|
* ```ts
|
|
2626
2313
|
* import { createClient, http, walletActions } from 'viem'
|
|
2627
2314
|
* import { tempo } from 'tempo.ts/chains'
|
|
2628
|
-
* import
|
|
2315
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
2629
2316
|
*
|
|
2630
2317
|
* const client = createClient({
|
|
2631
|
-
* chain: tempo
|
|
2318
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
2632
2319
|
* transport: http(),
|
|
2633
2320
|
* }).extend(walletActions)
|
|
2634
2321
|
*
|
|
@@ -2681,16 +2368,16 @@ export namespace renounceRoles {
|
|
|
2681
2368
|
* ```ts
|
|
2682
2369
|
* import { createClient, http } from 'viem'
|
|
2683
2370
|
* import { tempo } from 'tempo.ts/chains'
|
|
2684
|
-
* import
|
|
2371
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
2685
2372
|
* import { privateKeyToAccount } from 'viem/accounts'
|
|
2686
2373
|
*
|
|
2687
2374
|
* const client = createClient({
|
|
2688
2375
|
* account: privateKeyToAccount('0x...'),
|
|
2689
|
-
* chain: tempo
|
|
2376
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
2690
2377
|
* transport: http(),
|
|
2691
2378
|
* })
|
|
2692
2379
|
*
|
|
2693
|
-
* const result = await
|
|
2380
|
+
* const result = await Actions.token.renounceRolesSync(client, {
|
|
2694
2381
|
* token: '0x...',
|
|
2695
2382
|
* roles: ['minter'],
|
|
2696
2383
|
* })
|
|
@@ -2736,6 +2423,9 @@ export namespace renounceRolesSync {
|
|
|
2736
2423
|
{ IndexedOnly: false; Required: true }
|
|
2737
2424
|
>[]
|
|
2738
2425
|
}
|
|
2426
|
+
|
|
2427
|
+
// TODO: exhaustive error type
|
|
2428
|
+
export type ErrorType = BaseErrorType
|
|
2739
2429
|
}
|
|
2740
2430
|
|
|
2741
2431
|
/**
|
|
@@ -2745,16 +2435,16 @@ export namespace renounceRolesSync {
|
|
|
2745
2435
|
* ```ts
|
|
2746
2436
|
* import { createClient, http } from 'viem'
|
|
2747
2437
|
* import { tempo } from 'tempo.ts/chains'
|
|
2748
|
-
* import
|
|
2438
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
2749
2439
|
* import { privateKeyToAccount } from 'viem/accounts'
|
|
2750
2440
|
*
|
|
2751
2441
|
* const client = createClient({
|
|
2752
2442
|
* account: privateKeyToAccount('0x...'),
|
|
2753
|
-
* chain: tempo
|
|
2443
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
2754
2444
|
* transport: http(),
|
|
2755
2445
|
* })
|
|
2756
2446
|
*
|
|
2757
|
-
* const result = await
|
|
2447
|
+
* const result = await Actions.token.revokeRoles(client, {
|
|
2758
2448
|
* token: '0x...',
|
|
2759
2449
|
* from: '0x...',
|
|
2760
2450
|
* roles: ['minter'],
|
|
@@ -2796,6 +2486,9 @@ export namespace revokeRoles {
|
|
|
2796
2486
|
|
|
2797
2487
|
export type ReturnValue = WriteContractReturnType
|
|
2798
2488
|
|
|
2489
|
+
// TODO: exhaustive error type
|
|
2490
|
+
export type ErrorType = BaseErrorType
|
|
2491
|
+
|
|
2799
2492
|
/** @internal */
|
|
2800
2493
|
export async function inner<
|
|
2801
2494
|
action extends typeof sendTransaction | typeof sendTransactionSync,
|
|
@@ -2830,10 +2523,10 @@ export namespace revokeRoles {
|
|
|
2830
2523
|
* ```ts
|
|
2831
2524
|
* import { createClient, http, walletActions } from 'viem'
|
|
2832
2525
|
* import { tempo } from 'tempo.ts/chains'
|
|
2833
|
-
* import
|
|
2526
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
2834
2527
|
*
|
|
2835
2528
|
* const client = createClient({
|
|
2836
|
-
* chain: tempo
|
|
2529
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
2837
2530
|
* transport: http(),
|
|
2838
2531
|
* }).extend(walletActions)
|
|
2839
2532
|
*
|
|
@@ -2887,16 +2580,16 @@ export namespace revokeRoles {
|
|
|
2887
2580
|
* ```ts
|
|
2888
2581
|
* import { createClient, http } from 'viem'
|
|
2889
2582
|
* import { tempo } from 'tempo.ts/chains'
|
|
2890
|
-
* import
|
|
2583
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
2891
2584
|
* import { privateKeyToAccount } from 'viem/accounts'
|
|
2892
2585
|
*
|
|
2893
2586
|
* const client = createClient({
|
|
2894
2587
|
* account: privateKeyToAccount('0x...'),
|
|
2895
|
-
* chain: tempo
|
|
2588
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
2896
2589
|
* transport: http(),
|
|
2897
2590
|
* })
|
|
2898
2591
|
*
|
|
2899
|
-
* const result = await
|
|
2592
|
+
* const result = await Actions.token.revokeRolesSync(client, {
|
|
2900
2593
|
* token: '0x...',
|
|
2901
2594
|
* from: '0x...',
|
|
2902
2595
|
* roles: ['minter'],
|
|
@@ -2943,6 +2636,9 @@ export namespace revokeRolesSync {
|
|
|
2943
2636
|
{ IndexedOnly: false; Required: true }
|
|
2944
2637
|
>[]
|
|
2945
2638
|
}
|
|
2639
|
+
|
|
2640
|
+
// TODO: exhaustive error type
|
|
2641
|
+
export type ErrorType = BaseErrorType
|
|
2946
2642
|
}
|
|
2947
2643
|
|
|
2948
2644
|
/**
|
|
@@ -2952,16 +2648,16 @@ export namespace revokeRolesSync {
|
|
|
2952
2648
|
* ```ts
|
|
2953
2649
|
* import { createClient, http } from 'viem'
|
|
2954
2650
|
* import { tempo } from 'tempo.ts/chains'
|
|
2955
|
-
* import
|
|
2651
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
2956
2652
|
* import { privateKeyToAccount } from 'viem/accounts'
|
|
2957
2653
|
*
|
|
2958
2654
|
* const client = createClient({
|
|
2959
2655
|
* account: privateKeyToAccount('0x...'),
|
|
2960
|
-
* chain: tempo
|
|
2656
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
2961
2657
|
* transport: http(),
|
|
2962
2658
|
* })
|
|
2963
2659
|
*
|
|
2964
|
-
* const result = await
|
|
2660
|
+
* const result = await Actions.token.setSupplyCap(client, {
|
|
2965
2661
|
* token: '0x...',
|
|
2966
2662
|
* supplyCap: 1000000n,
|
|
2967
2663
|
* })
|
|
@@ -2996,6 +2692,9 @@ export namespace setSupplyCap {
|
|
|
2996
2692
|
|
|
2997
2693
|
export type ReturnValue = WriteContractReturnType
|
|
2998
2694
|
|
|
2695
|
+
// TODO: exhaustive error type
|
|
2696
|
+
export type ErrorType = BaseErrorType
|
|
2697
|
+
|
|
2999
2698
|
/** @internal */
|
|
3000
2699
|
export async function inner<
|
|
3001
2700
|
action extends typeof writeContract | typeof writeContractSync,
|
|
@@ -3026,10 +2725,10 @@ export namespace setSupplyCap {
|
|
|
3026
2725
|
* ```ts
|
|
3027
2726
|
* import { createClient, http, walletActions } from 'viem'
|
|
3028
2727
|
* import { tempo } from 'tempo.ts/chains'
|
|
3029
|
-
* import
|
|
2728
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
3030
2729
|
*
|
|
3031
2730
|
* const client = createClient({
|
|
3032
|
-
* chain: tempo
|
|
2731
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
3033
2732
|
* transport: http(),
|
|
3034
2733
|
* }).extend(walletActions)
|
|
3035
2734
|
*
|
|
@@ -3080,16 +2779,16 @@ export namespace setSupplyCap {
|
|
|
3080
2779
|
* ```ts
|
|
3081
2780
|
* import { createClient, http } from 'viem'
|
|
3082
2781
|
* import { tempo } from 'tempo.ts/chains'
|
|
3083
|
-
* import
|
|
2782
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
3084
2783
|
* import { privateKeyToAccount } from 'viem/accounts'
|
|
3085
2784
|
*
|
|
3086
2785
|
* const client = createClient({
|
|
3087
2786
|
* account: privateKeyToAccount('0x...'),
|
|
3088
|
-
* chain: tempo
|
|
2787
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
3089
2788
|
* transport: http(),
|
|
3090
2789
|
* })
|
|
3091
2790
|
*
|
|
3092
|
-
* const result = await
|
|
2791
|
+
* const result = await Actions.token.setSupplyCapSync(client, {
|
|
3093
2792
|
* token: '0x...',
|
|
3094
2793
|
* supplyCap: 1000000n,
|
|
3095
2794
|
* })
|
|
@@ -3133,6 +2832,9 @@ export namespace setSupplyCapSync {
|
|
|
3133
2832
|
> & {
|
|
3134
2833
|
receipt: TransactionReceipt
|
|
3135
2834
|
}
|
|
2835
|
+
|
|
2836
|
+
// TODO: exhaustive error type
|
|
2837
|
+
export type ErrorType = BaseErrorType
|
|
3136
2838
|
}
|
|
3137
2839
|
|
|
3138
2840
|
/**
|
|
@@ -3142,16 +2844,16 @@ export namespace setSupplyCapSync {
|
|
|
3142
2844
|
* ```ts
|
|
3143
2845
|
* import { createClient, http } from 'viem'
|
|
3144
2846
|
* import { tempo } from 'tempo.ts/chains'
|
|
3145
|
-
* import
|
|
2847
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
3146
2848
|
* import { privateKeyToAccount } from 'viem/accounts'
|
|
3147
2849
|
*
|
|
3148
2850
|
* const client = createClient({
|
|
3149
2851
|
* account: privateKeyToAccount('0x...'),
|
|
3150
|
-
* chain: tempo
|
|
2852
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
3151
2853
|
* transport: http(),
|
|
3152
2854
|
* })
|
|
3153
2855
|
*
|
|
3154
|
-
* const result = await
|
|
2856
|
+
* const result = await Actions.token.setRoleAdmin(client, {
|
|
3155
2857
|
* token: '0x...',
|
|
3156
2858
|
* role: 'minter',
|
|
3157
2859
|
* adminRole: 'admin',
|
|
@@ -3189,6 +2891,9 @@ export namespace setRoleAdmin {
|
|
|
3189
2891
|
|
|
3190
2892
|
export type ReturnValue = WriteContractReturnType
|
|
3191
2893
|
|
|
2894
|
+
// TODO: exhaustive error type
|
|
2895
|
+
export type ErrorType = BaseErrorType
|
|
2896
|
+
|
|
3192
2897
|
/** @internal */
|
|
3193
2898
|
export async function inner<
|
|
3194
2899
|
action extends typeof writeContract | typeof writeContractSync,
|
|
@@ -3219,10 +2924,10 @@ export namespace setRoleAdmin {
|
|
|
3219
2924
|
* ```ts
|
|
3220
2925
|
* import { createClient, http, walletActions } from 'viem'
|
|
3221
2926
|
* import { tempo } from 'tempo.ts/chains'
|
|
3222
|
-
* import
|
|
2927
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
3223
2928
|
*
|
|
3224
2929
|
* const client = createClient({
|
|
3225
|
-
* chain: tempo
|
|
2930
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
3226
2931
|
* transport: http(),
|
|
3227
2932
|
* }).extend(walletActions)
|
|
3228
2933
|
*
|
|
@@ -3276,16 +2981,16 @@ export namespace setRoleAdmin {
|
|
|
3276
2981
|
* ```ts
|
|
3277
2982
|
* import { createClient, http } from 'viem'
|
|
3278
2983
|
* import { tempo } from 'tempo.ts/chains'
|
|
3279
|
-
* import
|
|
2984
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
3280
2985
|
* import { privateKeyToAccount } from 'viem/accounts'
|
|
3281
2986
|
*
|
|
3282
2987
|
* const client = createClient({
|
|
3283
2988
|
* account: privateKeyToAccount('0x...'),
|
|
3284
|
-
* chain: tempo
|
|
2989
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
3285
2990
|
* transport: http(),
|
|
3286
2991
|
* })
|
|
3287
2992
|
*
|
|
3288
|
-
* const result = await
|
|
2993
|
+
* const result = await Actions.token.setRoleAdminSync(client, {
|
|
3289
2994
|
* token: '0x...',
|
|
3290
2995
|
* role: 'minter',
|
|
3291
2996
|
* adminRole: 'admin',
|
|
@@ -3330,6 +3035,9 @@ export namespace setRoleAdminSync {
|
|
|
3330
3035
|
> & {
|
|
3331
3036
|
receipt: TransactionReceipt
|
|
3332
3037
|
}
|
|
3038
|
+
|
|
3039
|
+
// TODO: exhaustive error type
|
|
3040
|
+
export type ErrorType = BaseErrorType
|
|
3333
3041
|
}
|
|
3334
3042
|
|
|
3335
3043
|
/**
|
|
@@ -3339,16 +3047,16 @@ export namespace setRoleAdminSync {
|
|
|
3339
3047
|
* ```ts
|
|
3340
3048
|
* import { createClient, http } from 'viem'
|
|
3341
3049
|
* import { tempo } from 'tempo.ts/chains'
|
|
3342
|
-
* import
|
|
3050
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
3343
3051
|
* import { privateKeyToAccount } from 'viem/accounts'
|
|
3344
3052
|
*
|
|
3345
3053
|
* const client = createClient({
|
|
3346
3054
|
* account: privateKeyToAccount('0x...'),
|
|
3347
|
-
* chain: tempo
|
|
3055
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
3348
3056
|
* transport: http(),
|
|
3349
3057
|
* })
|
|
3350
3058
|
*
|
|
3351
|
-
* const result = await
|
|
3059
|
+
* const result = await Actions.token.transfer(client, {
|
|
3352
3060
|
* to: '0x...',
|
|
3353
3061
|
* amount: 100n,
|
|
3354
3062
|
* })
|
|
@@ -3381,14 +3089,17 @@ export namespace transfer {
|
|
|
3381
3089
|
from?: Address | undefined
|
|
3382
3090
|
/** Memo to include in the transfer. */
|
|
3383
3091
|
memo?: Hex.Hex | undefined
|
|
3384
|
-
/** Address or ID of the TIP20 token.
|
|
3385
|
-
token
|
|
3092
|
+
/** Address or ID of the TIP20 token. */
|
|
3093
|
+
token: TokenId.TokenIdOrAddress
|
|
3386
3094
|
/** Address to transfer tokens to. */
|
|
3387
3095
|
to: Address
|
|
3388
3096
|
}
|
|
3389
3097
|
|
|
3390
3098
|
export type ReturnValue = WriteContractReturnType
|
|
3391
3099
|
|
|
3100
|
+
// TODO: exhaustive error type
|
|
3101
|
+
export type ErrorType = BaseErrorType
|
|
3102
|
+
|
|
3392
3103
|
/** @internal */
|
|
3393
3104
|
export async function inner<
|
|
3394
3105
|
action extends typeof writeContract | typeof writeContractSync,
|
|
@@ -3419,10 +3130,10 @@ export namespace transfer {
|
|
|
3419
3130
|
* ```ts
|
|
3420
3131
|
* import { createClient, http, walletActions } from 'viem'
|
|
3421
3132
|
* import { tempo } from 'tempo.ts/chains'
|
|
3422
|
-
* import
|
|
3133
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
3423
3134
|
*
|
|
3424
3135
|
* const client = createClient({
|
|
3425
|
-
* chain: tempo
|
|
3136
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
3426
3137
|
* transport: http(),
|
|
3427
3138
|
* }).extend(walletActions)
|
|
3428
3139
|
*
|
|
@@ -3441,7 +3152,7 @@ export namespace transfer {
|
|
|
3441
3152
|
* @returns The call.
|
|
3442
3153
|
*/
|
|
3443
3154
|
export function call(args: Args) {
|
|
3444
|
-
const { amount, from, memo, token
|
|
3155
|
+
const { amount, from, memo, token, to } = args
|
|
3445
3156
|
const callArgs = (() => {
|
|
3446
3157
|
if (memo && from)
|
|
3447
3158
|
return {
|
|
@@ -3494,16 +3205,16 @@ export namespace transfer {
|
|
|
3494
3205
|
* ```ts
|
|
3495
3206
|
* import { createClient, http } from 'viem'
|
|
3496
3207
|
* import { tempo } from 'tempo.ts/chains'
|
|
3497
|
-
* import
|
|
3208
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
3498
3209
|
* import { privateKeyToAccount } from 'viem/accounts'
|
|
3499
3210
|
*
|
|
3500
3211
|
* const client = createClient({
|
|
3501
3212
|
* account: privateKeyToAccount('0x...'),
|
|
3502
|
-
* chain: tempo
|
|
3213
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
3503
3214
|
* transport: http(),
|
|
3504
3215
|
* })
|
|
3505
3216
|
*
|
|
3506
|
-
* const result = await
|
|
3217
|
+
* const result = await Actions.token.transferSync(client, {
|
|
3507
3218
|
* to: '0x...',
|
|
3508
3219
|
* amount: 100n,
|
|
3509
3220
|
* })
|
|
@@ -3547,6 +3258,9 @@ export namespace transferSync {
|
|
|
3547
3258
|
> & {
|
|
3548
3259
|
receipt: TransactionReceipt
|
|
3549
3260
|
}
|
|
3261
|
+
|
|
3262
|
+
// TODO: exhaustive error type
|
|
3263
|
+
export type ErrorType = BaseErrorType
|
|
3550
3264
|
}
|
|
3551
3265
|
|
|
3552
3266
|
/**
|
|
@@ -3556,16 +3270,16 @@ export namespace transferSync {
|
|
|
3556
3270
|
* ```ts
|
|
3557
3271
|
* import { createClient, http } from 'viem'
|
|
3558
3272
|
* import { tempo } from 'tempo.ts/chains'
|
|
3559
|
-
* import
|
|
3273
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
3560
3274
|
* import { privateKeyToAccount } from 'viem/accounts'
|
|
3561
3275
|
*
|
|
3562
3276
|
* const client = createClient({
|
|
3563
3277
|
* account: privateKeyToAccount('0x...'),
|
|
3564
|
-
* chain: tempo
|
|
3278
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
3565
3279
|
* transport: http(),
|
|
3566
3280
|
* })
|
|
3567
3281
|
*
|
|
3568
|
-
* const result = await
|
|
3282
|
+
* const result = await Actions.token.unpause(client, {
|
|
3569
3283
|
* token: '0x...',
|
|
3570
3284
|
* })
|
|
3571
3285
|
* ```
|
|
@@ -3597,6 +3311,9 @@ export namespace unpause {
|
|
|
3597
3311
|
|
|
3598
3312
|
export type ReturnValue = WriteContractReturnType
|
|
3599
3313
|
|
|
3314
|
+
// TODO: exhaustive error type
|
|
3315
|
+
export type ErrorType = BaseErrorType
|
|
3316
|
+
|
|
3600
3317
|
/** @internal */
|
|
3601
3318
|
export async function inner<
|
|
3602
3319
|
action extends typeof writeContract | typeof writeContractSync,
|
|
@@ -3627,10 +3344,10 @@ export namespace unpause {
|
|
|
3627
3344
|
* ```ts
|
|
3628
3345
|
* import { createClient, http, walletActions } from 'viem'
|
|
3629
3346
|
* import { tempo } from 'tempo.ts/chains'
|
|
3630
|
-
* import
|
|
3347
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
3631
3348
|
*
|
|
3632
3349
|
* const client = createClient({
|
|
3633
|
-
* chain: tempo
|
|
3350
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
3634
3351
|
* transport: http(),
|
|
3635
3352
|
* }).extend(walletActions)
|
|
3636
3353
|
*
|
|
@@ -3680,16 +3397,16 @@ export namespace unpause {
|
|
|
3680
3397
|
* ```ts
|
|
3681
3398
|
* import { createClient, http } from 'viem'
|
|
3682
3399
|
* import { tempo } from 'tempo.ts/chains'
|
|
3683
|
-
* import
|
|
3400
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
3684
3401
|
* import { privateKeyToAccount } from 'viem/accounts'
|
|
3685
3402
|
*
|
|
3686
3403
|
* const client = createClient({
|
|
3687
3404
|
* account: privateKeyToAccount('0x...'),
|
|
3688
|
-
* chain: tempo
|
|
3405
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
3689
3406
|
* transport: http(),
|
|
3690
3407
|
* })
|
|
3691
3408
|
*
|
|
3692
|
-
* const result = await
|
|
3409
|
+
* const result = await Actions.token.unpauseSync(client, {
|
|
3693
3410
|
* token: '0x...',
|
|
3694
3411
|
* })
|
|
3695
3412
|
* ```
|
|
@@ -3732,6 +3449,140 @@ export namespace unpauseSync {
|
|
|
3732
3449
|
> & {
|
|
3733
3450
|
receipt: TransactionReceipt
|
|
3734
3451
|
}
|
|
3452
|
+
|
|
3453
|
+
// TODO: exhaustive error type
|
|
3454
|
+
export type ErrorType = BaseErrorType
|
|
3455
|
+
}
|
|
3456
|
+
|
|
3457
|
+
/**
|
|
3458
|
+
* Updates the quote token for a TIP20 token.
|
|
3459
|
+
*
|
|
3460
|
+
* @example
|
|
3461
|
+
* ```ts
|
|
3462
|
+
* import { createClient, http } from 'viem'
|
|
3463
|
+
* import { tempo } from 'tempo.ts/chains'
|
|
3464
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
3465
|
+
* import { privateKeyToAccount } from 'viem/accounts'
|
|
3466
|
+
*
|
|
3467
|
+
* const client = createClient({
|
|
3468
|
+
* account: privateKeyToAccount('0x...'),
|
|
3469
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
3470
|
+
* transport: http(),
|
|
3471
|
+
* })
|
|
3472
|
+
*
|
|
3473
|
+
* const result = await Actions.token.prepareUpdateQuoteToken(client, {
|
|
3474
|
+
* token: '0x...',
|
|
3475
|
+
* quoteToken: '0x...',
|
|
3476
|
+
* })
|
|
3477
|
+
* ```
|
|
3478
|
+
*
|
|
3479
|
+
* @param client - Client.
|
|
3480
|
+
* @param parameters - Parameters.
|
|
3481
|
+
* @returns The transaction hash.
|
|
3482
|
+
*/
|
|
3483
|
+
export async function prepareUpdateQuoteToken<
|
|
3484
|
+
chain extends Chain | undefined,
|
|
3485
|
+
account extends Account | undefined,
|
|
3486
|
+
>(
|
|
3487
|
+
client: Client<Transport, chain, account>,
|
|
3488
|
+
parameters: prepareUpdateQuoteToken.Parameters<chain, account>,
|
|
3489
|
+
): Promise<prepareUpdateQuoteToken.ReturnValue> {
|
|
3490
|
+
return prepareUpdateQuoteToken.inner(writeContract, client, parameters)
|
|
3491
|
+
}
|
|
3492
|
+
|
|
3493
|
+
export namespace prepareUpdateQuoteToken {
|
|
3494
|
+
export type Parameters<
|
|
3495
|
+
chain extends Chain | undefined = Chain | undefined,
|
|
3496
|
+
account extends Account | undefined = Account | undefined,
|
|
3497
|
+
> = WriteParameters<chain, account> & Args
|
|
3498
|
+
|
|
3499
|
+
export type Args = {
|
|
3500
|
+
/** New quote token address. */
|
|
3501
|
+
quoteToken: TokenId.TokenIdOrAddress
|
|
3502
|
+
/** Address or ID of the TIP20 token. */
|
|
3503
|
+
token: TokenId.TokenIdOrAddress
|
|
3504
|
+
}
|
|
3505
|
+
|
|
3506
|
+
export type ReturnValue = WriteContractReturnType
|
|
3507
|
+
|
|
3508
|
+
// TODO: exhaustive error type
|
|
3509
|
+
export type ErrorType = BaseErrorType
|
|
3510
|
+
|
|
3511
|
+
/** @internal */
|
|
3512
|
+
export async function inner<
|
|
3513
|
+
action extends typeof writeContract | typeof writeContractSync,
|
|
3514
|
+
chain extends Chain | undefined,
|
|
3515
|
+
account extends Account | undefined,
|
|
3516
|
+
>(
|
|
3517
|
+
action: action,
|
|
3518
|
+
client: Client<Transport, chain, account>,
|
|
3519
|
+
parameters: prepareUpdateQuoteToken.Parameters<chain, account>,
|
|
3520
|
+
): Promise<ReturnType<action>> {
|
|
3521
|
+
const { quoteToken, token, ...rest } = parameters
|
|
3522
|
+
const call = prepareUpdateQuoteToken.call({ quoteToken, token })
|
|
3523
|
+
return (await action(client, {
|
|
3524
|
+
...rest,
|
|
3525
|
+
...call,
|
|
3526
|
+
} as never)) as never
|
|
3527
|
+
}
|
|
3528
|
+
|
|
3529
|
+
/**
|
|
3530
|
+
* Defines a call to the `prepareUpdateQuoteToken` function.
|
|
3531
|
+
*
|
|
3532
|
+
* Can be passed as a parameter to:
|
|
3533
|
+
* - [`estimateContractGas`](https://viem.sh/docs/contract/estimateContractGas): estimate the gas cost of the call
|
|
3534
|
+
* - [`simulateContract`](https://viem.sh/docs/contract/simulateContract): simulate the call
|
|
3535
|
+
* - [`sendCalls`](https://viem.sh/docs/actions/wallet/sendCalls): send multiple calls
|
|
3536
|
+
*
|
|
3537
|
+
* @example
|
|
3538
|
+
* ```ts
|
|
3539
|
+
* import { createClient, http, walletActions } from 'viem'
|
|
3540
|
+
* import { tempo } from 'tempo.ts/chains'
|
|
3541
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
3542
|
+
*
|
|
3543
|
+
* const client = createClient({
|
|
3544
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
3545
|
+
* transport: http(),
|
|
3546
|
+
* }).extend(walletActions)
|
|
3547
|
+
*
|
|
3548
|
+
* const { result } = await client.sendCalls({
|
|
3549
|
+
* calls: [
|
|
3550
|
+
* actions.token.prepareUpdateQuoteToken.call({
|
|
3551
|
+
* token: '0x20c0...babe',
|
|
3552
|
+
* quoteToken: '0x20c0...cafe',
|
|
3553
|
+
* }),
|
|
3554
|
+
* ]
|
|
3555
|
+
* })
|
|
3556
|
+
* ```
|
|
3557
|
+
*
|
|
3558
|
+
* @param args - Arguments.
|
|
3559
|
+
* @returns The call.
|
|
3560
|
+
*/
|
|
3561
|
+
export function call(args: Args) {
|
|
3562
|
+
const { token, quoteToken } = args
|
|
3563
|
+
return defineCall({
|
|
3564
|
+
address: TokenId.toAddress(token),
|
|
3565
|
+
abi: Abis.tip20,
|
|
3566
|
+
functionName: 'setNextQuoteToken',
|
|
3567
|
+
args: [TokenId.toAddress(quoteToken)],
|
|
3568
|
+
})
|
|
3569
|
+
}
|
|
3570
|
+
|
|
3571
|
+
/**
|
|
3572
|
+
* Extracts the event from the logs.
|
|
3573
|
+
*
|
|
3574
|
+
* @param logs - Logs.
|
|
3575
|
+
* @returns The event.
|
|
3576
|
+
*/
|
|
3577
|
+
export function extractEvent(logs: Log[]) {
|
|
3578
|
+
const [log] = parseEventLogs({
|
|
3579
|
+
abi: Abis.tip20,
|
|
3580
|
+
logs,
|
|
3581
|
+
eventName: 'NextQuoteTokenSet',
|
|
3582
|
+
})
|
|
3583
|
+
if (!log) throw new Error('`NextQuoteTokenSet` event not found.')
|
|
3584
|
+
return log
|
|
3585
|
+
}
|
|
3735
3586
|
}
|
|
3736
3587
|
|
|
3737
3588
|
/**
|
|
@@ -3741,16 +3592,16 @@ export namespace unpauseSync {
|
|
|
3741
3592
|
* ```ts
|
|
3742
3593
|
* import { createClient, http } from 'viem'
|
|
3743
3594
|
* import { tempo } from 'tempo.ts/chains'
|
|
3744
|
-
* import
|
|
3595
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
3745
3596
|
* import { privateKeyToAccount } from 'viem/accounts'
|
|
3746
3597
|
*
|
|
3747
3598
|
* const client = createClient({
|
|
3748
3599
|
* account: privateKeyToAccount('0x...'),
|
|
3749
|
-
* chain: tempo
|
|
3600
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
3750
3601
|
* transport: http(),
|
|
3751
3602
|
* })
|
|
3752
3603
|
*
|
|
3753
|
-
* const result = await
|
|
3604
|
+
* const result = await Actions.token.prepareUpdateQuoteTokenSync(client, {
|
|
3754
3605
|
* token: '0x...',
|
|
3755
3606
|
* quoteToken: '0x...',
|
|
3756
3607
|
* })
|
|
@@ -3758,6 +3609,75 @@ export namespace unpauseSync {
|
|
|
3758
3609
|
*
|
|
3759
3610
|
* @param client - Client.
|
|
3760
3611
|
* @param parameters - Parameters.
|
|
3612
|
+
* @returns The transaction receipt and event data.
|
|
3613
|
+
*/
|
|
3614
|
+
export async function prepareUpdateQuoteTokenSync<
|
|
3615
|
+
chain extends Chain | undefined,
|
|
3616
|
+
account extends Account | undefined,
|
|
3617
|
+
>(
|
|
3618
|
+
client: Client<Transport, chain, account>,
|
|
3619
|
+
parameters: prepareUpdateQuoteTokenSync.Parameters<chain, account>,
|
|
3620
|
+
): Promise<prepareUpdateQuoteTokenSync.ReturnValue> {
|
|
3621
|
+
const receipt = await prepareUpdateQuoteToken.inner(
|
|
3622
|
+
writeContractSync,
|
|
3623
|
+
client,
|
|
3624
|
+
parameters,
|
|
3625
|
+
)
|
|
3626
|
+
const { args } = prepareUpdateQuoteToken.extractEvent(receipt.logs)
|
|
3627
|
+
return {
|
|
3628
|
+
...args,
|
|
3629
|
+
receipt,
|
|
3630
|
+
} as never
|
|
3631
|
+
}
|
|
3632
|
+
|
|
3633
|
+
export namespace prepareUpdateQuoteTokenSync {
|
|
3634
|
+
export type Parameters<
|
|
3635
|
+
chain extends Chain | undefined = Chain | undefined,
|
|
3636
|
+
account extends Account | undefined = Account | undefined,
|
|
3637
|
+
> = prepareUpdateQuoteToken.Parameters<chain, account>
|
|
3638
|
+
|
|
3639
|
+
export type Args = prepareUpdateQuoteToken.Args
|
|
3640
|
+
|
|
3641
|
+
export type ReturnValue = Compute<
|
|
3642
|
+
GetEventArgs<
|
|
3643
|
+
typeof Abis.tip20,
|
|
3644
|
+
'NextQuoteTokenSet',
|
|
3645
|
+
{
|
|
3646
|
+
IndexedOnly: false
|
|
3647
|
+
Required: true
|
|
3648
|
+
}
|
|
3649
|
+
> & {
|
|
3650
|
+
receipt: TransactionReceipt
|
|
3651
|
+
}
|
|
3652
|
+
>
|
|
3653
|
+
|
|
3654
|
+
// TODO: exhaustive error type
|
|
3655
|
+
export type ErrorType = BaseErrorType
|
|
3656
|
+
}
|
|
3657
|
+
|
|
3658
|
+
/**
|
|
3659
|
+
* Updates the quote token for a TIP20 token.
|
|
3660
|
+
*
|
|
3661
|
+
* @example
|
|
3662
|
+
* ```ts
|
|
3663
|
+
* import { createClient, http } from 'viem'
|
|
3664
|
+
* import { tempo } from 'tempo.ts/chains'
|
|
3665
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
3666
|
+
* import { privateKeyToAccount } from 'viem/accounts'
|
|
3667
|
+
*
|
|
3668
|
+
* const client = createClient({
|
|
3669
|
+
* account: privateKeyToAccount('0x...'),
|
|
3670
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
3671
|
+
* transport: http(),
|
|
3672
|
+
* })
|
|
3673
|
+
*
|
|
3674
|
+
* const result = await Actions.token.updateQuoteToken(client, {
|
|
3675
|
+
* token: '0x...',
|
|
3676
|
+
* })
|
|
3677
|
+
* ```
|
|
3678
|
+
*
|
|
3679
|
+
* @param client - Client.
|
|
3680
|
+
* @param parameters - Parameters.
|
|
3761
3681
|
* @returns The transaction hash.
|
|
3762
3682
|
*/
|
|
3763
3683
|
export async function updateQuoteToken<
|
|
@@ -3777,14 +3697,15 @@ export namespace updateQuoteToken {
|
|
|
3777
3697
|
> = WriteParameters<chain, account> & Args
|
|
3778
3698
|
|
|
3779
3699
|
export type Args = {
|
|
3780
|
-
/** New quote token address. */
|
|
3781
|
-
quoteToken: TokenId.TokenIdOrAddress
|
|
3782
3700
|
/** Address or ID of the TIP20 token. */
|
|
3783
3701
|
token: TokenId.TokenIdOrAddress
|
|
3784
3702
|
}
|
|
3785
3703
|
|
|
3786
3704
|
export type ReturnValue = WriteContractReturnType
|
|
3787
3705
|
|
|
3706
|
+
// TODO: exhaustive error type
|
|
3707
|
+
export type ErrorType = BaseErrorType
|
|
3708
|
+
|
|
3788
3709
|
/** @internal */
|
|
3789
3710
|
export async function inner<
|
|
3790
3711
|
action extends typeof writeContract | typeof writeContractSync,
|
|
@@ -3795,8 +3716,8 @@ export namespace updateQuoteToken {
|
|
|
3795
3716
|
client: Client<Transport, chain, account>,
|
|
3796
3717
|
parameters: updateQuoteToken.Parameters<chain, account>,
|
|
3797
3718
|
): Promise<ReturnType<action>> {
|
|
3798
|
-
const {
|
|
3799
|
-
const call = updateQuoteToken.call({
|
|
3719
|
+
const { token, ...rest } = parameters
|
|
3720
|
+
const call = updateQuoteToken.call({ token })
|
|
3800
3721
|
return (await action(client, {
|
|
3801
3722
|
...rest,
|
|
3802
3723
|
...call,
|
|
@@ -3815,10 +3736,10 @@ export namespace updateQuoteToken {
|
|
|
3815
3736
|
* ```ts
|
|
3816
3737
|
* import { createClient, http, walletActions } from 'viem'
|
|
3817
3738
|
* import { tempo } from 'tempo.ts/chains'
|
|
3818
|
-
* import
|
|
3739
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
3819
3740
|
*
|
|
3820
3741
|
* const client = createClient({
|
|
3821
|
-
* chain: tempo
|
|
3742
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
3822
3743
|
* transport: http(),
|
|
3823
3744
|
* }).extend(walletActions)
|
|
3824
3745
|
*
|
|
@@ -3826,7 +3747,6 @@ export namespace updateQuoteToken {
|
|
|
3826
3747
|
* calls: [
|
|
3827
3748
|
* actions.token.updateQuoteToken.call({
|
|
3828
3749
|
* token: '0x20c0...babe',
|
|
3829
|
-
* quoteToken: '0x20c0...cafe',
|
|
3830
3750
|
* }),
|
|
3831
3751
|
* ]
|
|
3832
3752
|
* })
|
|
@@ -3836,12 +3756,12 @@ export namespace updateQuoteToken {
|
|
|
3836
3756
|
* @returns The call.
|
|
3837
3757
|
*/
|
|
3838
3758
|
export function call(args: Args) {
|
|
3839
|
-
const { token
|
|
3759
|
+
const { token } = args
|
|
3840
3760
|
return defineCall({
|
|
3841
3761
|
address: TokenId.toAddress(token),
|
|
3842
3762
|
abi: Abis.tip20,
|
|
3843
|
-
functionName: '
|
|
3844
|
-
args: [
|
|
3763
|
+
functionName: 'completeQuoteTokenUpdate',
|
|
3764
|
+
args: [],
|
|
3845
3765
|
})
|
|
3846
3766
|
}
|
|
3847
3767
|
|
|
@@ -3855,9 +3775,9 @@ export namespace updateQuoteToken {
|
|
|
3855
3775
|
const [log] = parseEventLogs({
|
|
3856
3776
|
abi: Abis.tip20,
|
|
3857
3777
|
logs,
|
|
3858
|
-
eventName: '
|
|
3778
|
+
eventName: 'QuoteTokenUpdate',
|
|
3859
3779
|
})
|
|
3860
|
-
if (!log) throw new Error('`
|
|
3780
|
+
if (!log) throw new Error('`QuoteTokenUpdateCompleted` event not found.')
|
|
3861
3781
|
return log
|
|
3862
3782
|
}
|
|
3863
3783
|
}
|
|
@@ -3869,18 +3789,17 @@ export namespace updateQuoteToken {
|
|
|
3869
3789
|
* ```ts
|
|
3870
3790
|
* import { createClient, http } from 'viem'
|
|
3871
3791
|
* import { tempo } from 'tempo.ts/chains'
|
|
3872
|
-
* import
|
|
3792
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
3873
3793
|
* import { privateKeyToAccount } from 'viem/accounts'
|
|
3874
3794
|
*
|
|
3875
3795
|
* const client = createClient({
|
|
3876
3796
|
* account: privateKeyToAccount('0x...'),
|
|
3877
|
-
* chain: tempo
|
|
3797
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
3878
3798
|
* transport: http(),
|
|
3879
3799
|
* })
|
|
3880
3800
|
*
|
|
3881
|
-
* const result = await
|
|
3801
|
+
* const result = await Actions.token.updateQuoteTokenSync(client, {
|
|
3882
3802
|
* token: '0x...',
|
|
3883
|
-
* quoteToken: '0x...',
|
|
3884
3803
|
* })
|
|
3885
3804
|
* ```
|
|
3886
3805
|
*
|
|
@@ -3918,7 +3837,7 @@ export namespace updateQuoteTokenSync {
|
|
|
3918
3837
|
export type ReturnValue = Compute<
|
|
3919
3838
|
GetEventArgs<
|
|
3920
3839
|
typeof Abis.tip20,
|
|
3921
|
-
'
|
|
3840
|
+
'QuoteTokenUpdate',
|
|
3922
3841
|
{
|
|
3923
3842
|
IndexedOnly: false
|
|
3924
3843
|
Required: true
|
|
@@ -3927,6 +3846,9 @@ export namespace updateQuoteTokenSync {
|
|
|
3927
3846
|
receipt: TransactionReceipt
|
|
3928
3847
|
}
|
|
3929
3848
|
>
|
|
3849
|
+
|
|
3850
|
+
// TODO: exhaustive error type
|
|
3851
|
+
export type ErrorType = BaseErrorType
|
|
3930
3852
|
}
|
|
3931
3853
|
|
|
3932
3854
|
/**
|
|
@@ -3936,10 +3858,10 @@ export namespace updateQuoteTokenSync {
|
|
|
3936
3858
|
* ```ts
|
|
3937
3859
|
* import { createClient, http } from 'viem'
|
|
3938
3860
|
* import { tempo } from 'tempo.ts/chains'
|
|
3939
|
-
* import
|
|
3861
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
3940
3862
|
*
|
|
3941
3863
|
* const client = createClient({
|
|
3942
|
-
* chain: tempo
|
|
3864
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
3943
3865
|
* transport: http(),
|
|
3944
3866
|
* })
|
|
3945
3867
|
*
|
|
@@ -3961,7 +3883,7 @@ export function watchApprove<
|
|
|
3961
3883
|
client: Client<Transport, chain, account>,
|
|
3962
3884
|
parameters: watchApprove.Parameters,
|
|
3963
3885
|
) {
|
|
3964
|
-
const { onApproval, token
|
|
3886
|
+
const { onApproval, token, ...rest } = parameters
|
|
3965
3887
|
return watchContractEvent(client, {
|
|
3966
3888
|
...rest,
|
|
3967
3889
|
address: TokenId.toAddress(token),
|
|
@@ -3995,8 +3917,8 @@ export declare namespace watchApprove {
|
|
|
3995
3917
|
> & {
|
|
3996
3918
|
/** Callback to invoke when tokens are approved. */
|
|
3997
3919
|
onApproval: (args: Args, log: Log) => void
|
|
3998
|
-
/** Address or ID of the TIP20 token.
|
|
3999
|
-
token
|
|
3920
|
+
/** Address or ID of the TIP20 token. */
|
|
3921
|
+
token: TokenId.TokenIdOrAddress
|
|
4000
3922
|
}
|
|
4001
3923
|
}
|
|
4002
3924
|
|
|
@@ -4007,10 +3929,10 @@ export declare namespace watchApprove {
|
|
|
4007
3929
|
* ```ts
|
|
4008
3930
|
* import { createClient, http } from 'viem'
|
|
4009
3931
|
* import { tempo } from 'tempo.ts/chains'
|
|
4010
|
-
* import
|
|
3932
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
4011
3933
|
*
|
|
4012
3934
|
* const client = createClient({
|
|
4013
|
-
* chain: tempo
|
|
3935
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
4014
3936
|
* transport: http(),
|
|
4015
3937
|
* })
|
|
4016
3938
|
*
|
|
@@ -4029,7 +3951,7 @@ export function watchBurn<
|
|
|
4029
3951
|
chain extends Chain | undefined,
|
|
4030
3952
|
account extends Account | undefined,
|
|
4031
3953
|
>(client: Client<Transport, chain, account>, parameters: watchBurn.Parameters) {
|
|
4032
|
-
const { onBurn, token
|
|
3954
|
+
const { onBurn, token, ...rest } = parameters
|
|
4033
3955
|
return watchContractEvent(client, {
|
|
4034
3956
|
...rest,
|
|
4035
3957
|
address: TokenId.toAddress(token),
|
|
@@ -4063,8 +3985,8 @@ export declare namespace watchBurn {
|
|
|
4063
3985
|
> & {
|
|
4064
3986
|
/** Callback to invoke when tokens are burned. */
|
|
4065
3987
|
onBurn: (args: Args, log: Log) => void
|
|
4066
|
-
/** Address or ID of the TIP20 token.
|
|
4067
|
-
token
|
|
3988
|
+
/** Address or ID of the TIP20 token. */
|
|
3989
|
+
token: TokenId.TokenIdOrAddress
|
|
4068
3990
|
}
|
|
4069
3991
|
}
|
|
4070
3992
|
|
|
@@ -4075,10 +3997,10 @@ export declare namespace watchBurn {
|
|
|
4075
3997
|
* ```ts
|
|
4076
3998
|
* import { createClient, http } from 'viem'
|
|
4077
3999
|
* import { tempo } from 'tempo.ts/chains'
|
|
4078
|
-
* import
|
|
4000
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
4079
4001
|
*
|
|
4080
4002
|
* const client = createClient({
|
|
4081
|
-
* chain: tempo
|
|
4003
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
4082
4004
|
* transport: http(),
|
|
4083
4005
|
* })
|
|
4084
4006
|
*
|
|
@@ -4148,10 +4070,10 @@ export declare namespace watchCreate {
|
|
|
4148
4070
|
* ```ts
|
|
4149
4071
|
* import { createClient, http } from 'viem'
|
|
4150
4072
|
* import { tempo } from 'tempo.ts/chains'
|
|
4151
|
-
* import
|
|
4073
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
4152
4074
|
*
|
|
4153
4075
|
* const client = createClient({
|
|
4154
|
-
* chain: tempo
|
|
4076
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
4155
4077
|
* transport: http(),
|
|
4156
4078
|
* })
|
|
4157
4079
|
*
|
|
@@ -4170,7 +4092,7 @@ export function watchMint<
|
|
|
4170
4092
|
chain extends Chain | undefined,
|
|
4171
4093
|
account extends Account | undefined,
|
|
4172
4094
|
>(client: Client<Transport, chain, account>, parameters: watchMint.Parameters) {
|
|
4173
|
-
const { onMint, token
|
|
4095
|
+
const { onMint, token, ...rest } = parameters
|
|
4174
4096
|
return watchContractEvent(client, {
|
|
4175
4097
|
...rest,
|
|
4176
4098
|
address: TokenId.toAddress(token),
|
|
@@ -4204,9 +4126,11 @@ export declare namespace watchMint {
|
|
|
4204
4126
|
> & {
|
|
4205
4127
|
/** Callback to invoke when tokens are minted. */
|
|
4206
4128
|
onMint: (args: Args, log: Log) => void
|
|
4207
|
-
/** Address or ID of the TIP20 token.
|
|
4208
|
-
token
|
|
4129
|
+
/** Address or ID of the TIP20 token. */
|
|
4130
|
+
token: TokenId.TokenIdOrAddress
|
|
4209
4131
|
}
|
|
4132
|
+
|
|
4133
|
+
export type ReturnValue = WatchContractEventReturnType
|
|
4210
4134
|
}
|
|
4211
4135
|
|
|
4212
4136
|
/**
|
|
@@ -4216,10 +4140,10 @@ export declare namespace watchMint {
|
|
|
4216
4140
|
* ```ts
|
|
4217
4141
|
* import { createClient, http } from 'viem'
|
|
4218
4142
|
* import { tempo } from 'tempo.ts/chains'
|
|
4219
|
-
* import
|
|
4143
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
4220
4144
|
*
|
|
4221
4145
|
* const client = createClient({
|
|
4222
|
-
* chain: tempo
|
|
4146
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
4223
4147
|
* transport: http(),
|
|
4224
4148
|
* })
|
|
4225
4149
|
*
|
|
@@ -4241,11 +4165,7 @@ export function watchAdminRole<
|
|
|
4241
4165
|
client: Client<Transport, chain, account>,
|
|
4242
4166
|
parameters: watchAdminRole.Parameters,
|
|
4243
4167
|
) {
|
|
4244
|
-
const {
|
|
4245
|
-
onRoleAdminUpdated,
|
|
4246
|
-
token = Addresses.defaultFeeToken,
|
|
4247
|
-
...rest
|
|
4248
|
-
} = parameters
|
|
4168
|
+
const { onRoleAdminUpdated, token, ...rest } = parameters
|
|
4249
4169
|
return watchContractEvent(client, {
|
|
4250
4170
|
...rest,
|
|
4251
4171
|
address: TokenId.toAddress(token),
|
|
@@ -4279,8 +4199,8 @@ export declare namespace watchAdminRole {
|
|
|
4279
4199
|
> & {
|
|
4280
4200
|
/** Callback to invoke when a role admin is updated. */
|
|
4281
4201
|
onRoleAdminUpdated: (args: Args, log: Log) => void
|
|
4282
|
-
/** Address or ID of the TIP20 token.
|
|
4283
|
-
token
|
|
4202
|
+
/** Address or ID of the TIP20 token. */
|
|
4203
|
+
token: TokenId.TokenIdOrAddress
|
|
4284
4204
|
}
|
|
4285
4205
|
}
|
|
4286
4206
|
|
|
@@ -4291,10 +4211,10 @@ export declare namespace watchAdminRole {
|
|
|
4291
4211
|
* ```ts
|
|
4292
4212
|
* import { createClient, http } from 'viem'
|
|
4293
4213
|
* import { tempo } from 'tempo.ts/chains'
|
|
4294
|
-
* import
|
|
4214
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
4295
4215
|
*
|
|
4296
4216
|
* const client = createClient({
|
|
4297
|
-
* chain: tempo
|
|
4217
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
4298
4218
|
* transport: http(),
|
|
4299
4219
|
* })
|
|
4300
4220
|
*
|
|
@@ -4313,11 +4233,7 @@ export function watchRole<
|
|
|
4313
4233
|
chain extends Chain | undefined,
|
|
4314
4234
|
account extends Account | undefined,
|
|
4315
4235
|
>(client: Client<Transport, chain, account>, parameters: watchRole.Parameters) {
|
|
4316
|
-
const {
|
|
4317
|
-
onRoleUpdated,
|
|
4318
|
-
token = Addresses.defaultFeeToken,
|
|
4319
|
-
...rest
|
|
4320
|
-
} = parameters
|
|
4236
|
+
const { onRoleUpdated, token, ...rest } = parameters
|
|
4321
4237
|
return watchContractEvent(client, {
|
|
4322
4238
|
...rest,
|
|
4323
4239
|
address: TokenId.toAddress(token),
|
|
@@ -4361,8 +4277,8 @@ export declare namespace watchRole {
|
|
|
4361
4277
|
> & {
|
|
4362
4278
|
/** Callback to invoke when a role membership is updated. */
|
|
4363
4279
|
onRoleUpdated: (args: Args, log: Log) => void
|
|
4364
|
-
/** Address or ID of the TIP20 token.
|
|
4365
|
-
token
|
|
4280
|
+
/** Address or ID of the TIP20 token. */
|
|
4281
|
+
token: TokenId.TokenIdOrAddress
|
|
4366
4282
|
}
|
|
4367
4283
|
}
|
|
4368
4284
|
|
|
@@ -4373,11 +4289,11 @@ export declare namespace watchRole {
|
|
|
4373
4289
|
* ```ts
|
|
4374
4290
|
* import { createClient, http } from 'viem'
|
|
4375
4291
|
* import { tempo } from 'tempo.ts/chains'
|
|
4376
|
-
* import
|
|
4292
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
4377
4293
|
*
|
|
4378
4294
|
* const client = createClient({
|
|
4379
4295
|
* account: privateKeyToAccount('0x...'),
|
|
4380
|
-
* chain: tempo
|
|
4296
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
4381
4297
|
* transport: http(),
|
|
4382
4298
|
* })
|
|
4383
4299
|
*
|
|
@@ -4399,7 +4315,7 @@ export function watchTransfer<
|
|
|
4399
4315
|
client: Client<Transport, chain, account>,
|
|
4400
4316
|
parameters: watchTransfer.Parameters,
|
|
4401
4317
|
) {
|
|
4402
|
-
const { onTransfer, token
|
|
4318
|
+
const { onTransfer, token, ...rest } = parameters
|
|
4403
4319
|
return watchContractEvent(client, {
|
|
4404
4320
|
...rest,
|
|
4405
4321
|
address: TokenId.toAddress(token),
|
|
@@ -4433,8 +4349,8 @@ export declare namespace watchTransfer {
|
|
|
4433
4349
|
> & {
|
|
4434
4350
|
/** Callback to invoke when tokens are transferred. */
|
|
4435
4351
|
onTransfer: (args: Args, log: Log) => void
|
|
4436
|
-
/** Address or ID of the TIP20 token.
|
|
4437
|
-
token
|
|
4352
|
+
/** Address or ID of the TIP20 token. */
|
|
4353
|
+
token: TokenId.TokenIdOrAddress
|
|
4438
4354
|
}
|
|
4439
4355
|
}
|
|
4440
4356
|
|
|
@@ -4445,17 +4361,17 @@ export declare namespace watchTransfer {
|
|
|
4445
4361
|
* ```ts
|
|
4446
4362
|
* import { createClient, http } from 'viem'
|
|
4447
4363
|
* import { tempo } from 'tempo.ts/chains'
|
|
4448
|
-
* import
|
|
4364
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
4449
4365
|
*
|
|
4450
4366
|
* const client = createClient({
|
|
4451
|
-
* chain: tempo
|
|
4367
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
4452
4368
|
* transport: http(),
|
|
4453
4369
|
* })
|
|
4454
4370
|
*
|
|
4455
4371
|
* const unwatch = actions.token.watchUpdateQuoteToken(client, {
|
|
4456
4372
|
* onUpdateQuoteToken: (args, log) => {
|
|
4457
|
-
* if (args.
|
|
4458
|
-
* console.log('quote token update
|
|
4373
|
+
* if (args.completed)
|
|
4374
|
+
* console.log('quote token update completed:', args.newQuoteToken)
|
|
4459
4375
|
* else
|
|
4460
4376
|
* console.log('quote token update proposed:', args.newQuoteToken)
|
|
4461
4377
|
* },
|
|
@@ -4473,11 +4389,7 @@ export function watchUpdateQuoteToken<
|
|
|
4473
4389
|
client: Client<Transport, chain, account>,
|
|
4474
4390
|
parameters: watchUpdateQuoteToken.Parameters,
|
|
4475
4391
|
) {
|
|
4476
|
-
const {
|
|
4477
|
-
onUpdateQuoteToken,
|
|
4478
|
-
token = Addresses.defaultFeeToken,
|
|
4479
|
-
...rest
|
|
4480
|
-
} = parameters
|
|
4392
|
+
const { onUpdateQuoteToken, token, ...rest } = parameters
|
|
4481
4393
|
const address = TokenId.toAddress(token)
|
|
4482
4394
|
|
|
4483
4395
|
return watchContractEvent(client, {
|
|
@@ -4491,22 +4403,22 @@ export function watchUpdateQuoteToken<
|
|
|
4491
4403
|
false,
|
|
4492
4404
|
ExtractAbiItem<
|
|
4493
4405
|
typeof Abis.tip20,
|
|
4494
|
-
'
|
|
4406
|
+
'NextQuoteTokenSet' | 'QuoteTokenUpdate'
|
|
4495
4407
|
>,
|
|
4496
4408
|
true
|
|
4497
4409
|
>[],
|
|
4498
4410
|
) => {
|
|
4499
4411
|
for (const log of logs) {
|
|
4500
4412
|
if (
|
|
4501
|
-
log.eventName !== '
|
|
4502
|
-
log.eventName !== '
|
|
4413
|
+
log.eventName !== 'NextQuoteTokenSet' &&
|
|
4414
|
+
log.eventName !== 'QuoteTokenUpdate'
|
|
4503
4415
|
)
|
|
4504
4416
|
continue
|
|
4505
4417
|
|
|
4506
4418
|
onUpdateQuoteToken(
|
|
4507
4419
|
{
|
|
4508
4420
|
...log.args,
|
|
4509
|
-
|
|
4421
|
+
completed: log.eventName === 'QuoteTokenUpdate',
|
|
4510
4422
|
},
|
|
4511
4423
|
log,
|
|
4512
4424
|
)
|
|
@@ -4520,17 +4432,17 @@ export declare namespace watchUpdateQuoteToken {
|
|
|
4520
4432
|
export type Args = OneOf<
|
|
4521
4433
|
| GetEventArgs<
|
|
4522
4434
|
typeof Abis.tip20,
|
|
4523
|
-
'
|
|
4435
|
+
'NextQuoteTokenSet',
|
|
4524
4436
|
{ IndexedOnly: false; Required: true }
|
|
4525
4437
|
>
|
|
4526
4438
|
| GetEventArgs<
|
|
4527
4439
|
typeof Abis.tip20,
|
|
4528
|
-
'
|
|
4440
|
+
'QuoteTokenUpdate',
|
|
4529
4441
|
{ IndexedOnly: false; Required: true }
|
|
4530
4442
|
>
|
|
4531
4443
|
> & {
|
|
4532
|
-
/** Whether the update has been
|
|
4533
|
-
|
|
4444
|
+
/** Whether the update has been completed. */
|
|
4445
|
+
completed: boolean
|
|
4534
4446
|
}
|
|
4535
4447
|
|
|
4536
4448
|
export type Log = viem_Log
|
|
@@ -4539,9 +4451,9 @@ export declare namespace watchUpdateQuoteToken {
|
|
|
4539
4451
|
WatchContractEventParameters<typeof Abis.tip20, any, true>,
|
|
4540
4452
|
'abi' | 'address' | 'batch' | 'eventName' | 'onLogs' | 'strict'
|
|
4541
4453
|
> & {
|
|
4542
|
-
/** Callback to invoke when a quote token update is proposed or
|
|
4454
|
+
/** Callback to invoke when a quote token update is proposed or completed. */
|
|
4543
4455
|
onUpdateQuoteToken: (args: Args, log: Log) => void
|
|
4544
|
-
/** Address or ID of the TIP20 token.
|
|
4545
|
-
token
|
|
4456
|
+
/** Address or ID of the TIP20 token. */
|
|
4457
|
+
token: TokenId.TokenIdOrAddress
|
|
4546
4458
|
}
|
|
4547
4459
|
}
|