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
package/src/viem/Actions/fee.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
type Account,
|
|
3
3
|
type Address,
|
|
4
|
+
type BaseErrorType,
|
|
4
5
|
type Chain,
|
|
5
6
|
type Client,
|
|
6
7
|
type ExtractAbiItem,
|
|
@@ -38,16 +39,16 @@ import { defineCall } from '../internal/utils.js'
|
|
|
38
39
|
* ```ts
|
|
39
40
|
* import { createClient, http } from 'viem'
|
|
40
41
|
* import { tempo } from 'tempo.ts/chains'
|
|
41
|
-
* import
|
|
42
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
42
43
|
* import { privateKeyToAccount } from 'viem/accounts'
|
|
43
44
|
*
|
|
44
45
|
* const client = createClient({
|
|
45
46
|
* account: privateKeyToAccount('0x...'),
|
|
46
|
-
* chain: tempo
|
|
47
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
47
48
|
* transport: http(),
|
|
48
49
|
* })
|
|
49
50
|
*
|
|
50
|
-
* const { address, id } = await
|
|
51
|
+
* const { address, id } = await Actions.fee.getUserToken(client)
|
|
51
52
|
* ```
|
|
52
53
|
*
|
|
53
54
|
* @param client - Client.
|
|
@@ -115,16 +116,16 @@ export namespace getUserToken {
|
|
|
115
116
|
* ```ts
|
|
116
117
|
* import { createClient, http } from 'viem'
|
|
117
118
|
* import { tempo } from 'tempo.ts/chains'
|
|
118
|
-
* import
|
|
119
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
119
120
|
* import { privateKeyToAccount } from 'viem/accounts'
|
|
120
121
|
*
|
|
121
122
|
* const client = createClient({
|
|
122
123
|
* account: privateKeyToAccount('0x...'),
|
|
123
|
-
* chain: tempo
|
|
124
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
124
125
|
* transport: http(),
|
|
125
126
|
* })
|
|
126
127
|
*
|
|
127
|
-
* const hash = await
|
|
128
|
+
* const hash = await Actions.fee.setUserToken(client, {
|
|
128
129
|
* token: '0x...',
|
|
129
130
|
* })
|
|
130
131
|
* ```
|
|
@@ -156,6 +157,9 @@ export namespace setUserToken {
|
|
|
156
157
|
|
|
157
158
|
export type ReturnValue = WriteContractReturnType
|
|
158
159
|
|
|
160
|
+
// TODO: exhaustive error type
|
|
161
|
+
export type ErrorType = BaseErrorType
|
|
162
|
+
|
|
159
163
|
/** @internal */
|
|
160
164
|
export async function inner<
|
|
161
165
|
action extends typeof writeContract | typeof writeContractSync,
|
|
@@ -186,10 +190,10 @@ export namespace setUserToken {
|
|
|
186
190
|
* ```ts
|
|
187
191
|
* import { createClient, http, walletActions } from 'viem'
|
|
188
192
|
* import { tempo } from 'tempo.ts/chains'
|
|
189
|
-
* import
|
|
193
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
190
194
|
*
|
|
191
195
|
* const client = createClient({
|
|
192
|
-
* chain: tempo
|
|
196
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
193
197
|
* transport: http(),
|
|
194
198
|
* }).extend(walletActions)
|
|
195
199
|
*
|
|
@@ -237,16 +241,16 @@ export namespace setUserToken {
|
|
|
237
241
|
* ```ts
|
|
238
242
|
* import { createClient, http } from 'viem'
|
|
239
243
|
* import { tempo } from 'tempo.ts/chains'
|
|
240
|
-
* import
|
|
244
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
241
245
|
* import { privateKeyToAccount } from 'viem/accounts'
|
|
242
246
|
*
|
|
243
247
|
* const client = createClient({
|
|
244
248
|
* account: privateKeyToAccount('0x...'),
|
|
245
|
-
* chain: tempo
|
|
249
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
246
250
|
* transport: http(),
|
|
247
251
|
* })
|
|
248
252
|
*
|
|
249
|
-
* const result = await
|
|
253
|
+
* const result = await Actions.fee.setUserTokenSync(client, {
|
|
250
254
|
* token: '0x...',
|
|
251
255
|
* })
|
|
252
256
|
* ```
|
|
@@ -291,6 +295,9 @@ export namespace setUserTokenSync {
|
|
|
291
295
|
receipt: TransactionReceipt
|
|
292
296
|
}
|
|
293
297
|
>
|
|
298
|
+
|
|
299
|
+
// TODO: exhaustive error type
|
|
300
|
+
export type ErrorType = BaseErrorType
|
|
294
301
|
}
|
|
295
302
|
|
|
296
303
|
/**
|
|
@@ -300,10 +307,10 @@ export namespace setUserTokenSync {
|
|
|
300
307
|
* ```ts
|
|
301
308
|
* import { createClient, http } from 'viem'
|
|
302
309
|
* import { tempo } from 'tempo.ts/chains'
|
|
303
|
-
* import
|
|
310
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
304
311
|
*
|
|
305
312
|
* const client = createClient({
|
|
306
|
-
* chain: tempo
|
|
313
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
307
314
|
* transport: http(),
|
|
308
315
|
* })
|
|
309
316
|
*
|
|
@@ -1,28 +1,11 @@
|
|
|
1
1
|
import { setTimeout } from 'node:timers/promises'
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { describe, expect, test } from 'vitest'
|
|
5
|
-
import { tempoTest } from '../../../test/viem/config.js'
|
|
6
|
-
import { createTempoClient } from '../Client.js'
|
|
2
|
+
import { beforeAll, describe, expect, test } from 'vitest'
|
|
3
|
+
import { accounts, client, rpcUrl } from '../../../test/viem/config.js'
|
|
7
4
|
import * as actions from './index.js'
|
|
8
5
|
|
|
9
|
-
const account =
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const account2 = mnemonicToAccount(
|
|
13
|
-
'test test test test test test test test test test test junk',
|
|
14
|
-
{ accountIndex: 1 },
|
|
15
|
-
)
|
|
16
|
-
const account3 = mnemonicToAccount(
|
|
17
|
-
'test test test test test test test test test test test junk',
|
|
18
|
-
{ accountIndex: 2 },
|
|
19
|
-
)
|
|
20
|
-
|
|
21
|
-
const client = createTempoClient({
|
|
22
|
-
account,
|
|
23
|
-
chain: tempoTest,
|
|
24
|
-
pollingInterval: 100,
|
|
25
|
-
}).extend(publicActions)
|
|
6
|
+
const account = accounts[0]
|
|
7
|
+
const account2 = accounts[1]
|
|
8
|
+
const account3 = accounts[2]
|
|
26
9
|
|
|
27
10
|
describe('create', () => {
|
|
28
11
|
test('default', async () => {
|
|
@@ -58,7 +41,7 @@ describe('create', () => {
|
|
|
58
41
|
expect(blacklistReceipt).toBeDefined()
|
|
59
42
|
expect(blacklistResult).toMatchInlineSnapshot(`
|
|
60
43
|
{
|
|
61
|
-
"policyId":
|
|
44
|
+
"policyId": 3n,
|
|
62
45
|
"policyType": 1,
|
|
63
46
|
"updater": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
|
|
64
47
|
}
|
|
@@ -120,7 +103,7 @@ describe('setAdmin', () => {
|
|
|
120
103
|
expect(setAdminResult).toMatchInlineSnapshot(`
|
|
121
104
|
{
|
|
122
105
|
"admin": "0x8C8d35429F74ec245F8Ef2f4Fd1e551cFF97d650",
|
|
123
|
-
"policyId":
|
|
106
|
+
"policyId": 4n,
|
|
124
107
|
"updater": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
|
|
125
108
|
}
|
|
126
109
|
`)
|
|
@@ -163,7 +146,7 @@ describe('modifyWhitelist', () => {
|
|
|
163
146
|
{
|
|
164
147
|
"account": "0x8C8d35429F74ec245F8Ef2f4Fd1e551cFF97d650",
|
|
165
148
|
"allowed": true,
|
|
166
|
-
"policyId":
|
|
149
|
+
"policyId": 5n,
|
|
167
150
|
"updater": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
|
|
168
151
|
}
|
|
169
152
|
`)
|
|
@@ -189,7 +172,7 @@ describe('modifyWhitelist', () => {
|
|
|
189
172
|
{
|
|
190
173
|
"account": "0x8C8d35429F74ec245F8Ef2f4Fd1e551cFF97d650",
|
|
191
174
|
"allowed": false,
|
|
192
|
-
"policyId":
|
|
175
|
+
"policyId": 5n,
|
|
193
176
|
"updater": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
|
|
194
177
|
}
|
|
195
178
|
`)
|
|
@@ -232,7 +215,7 @@ describe('modifyBlacklist', () => {
|
|
|
232
215
|
expect(addBlacklistResult).toMatchInlineSnapshot(`
|
|
233
216
|
{
|
|
234
217
|
"account": "0x8C8d35429F74ec245F8Ef2f4Fd1e551cFF97d650",
|
|
235
|
-
"policyId":
|
|
218
|
+
"policyId": 6n,
|
|
236
219
|
"restricted": true,
|
|
237
220
|
"updater": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
|
|
238
221
|
}
|
|
@@ -258,7 +241,7 @@ describe('modifyBlacklist', () => {
|
|
|
258
241
|
expect(removeBlacklistResult).toMatchInlineSnapshot(`
|
|
259
242
|
{
|
|
260
243
|
"account": "0x8C8d35429F74ec245F8Ef2f4Fd1e551cFF97d650",
|
|
261
|
-
"policyId":
|
|
244
|
+
"policyId": 6n,
|
|
262
245
|
"restricted": false,
|
|
263
246
|
"updater": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
|
|
264
247
|
}
|
|
@@ -397,13 +380,17 @@ describe('watchCreate', () => {
|
|
|
397
380
|
unwatch()
|
|
398
381
|
|
|
399
382
|
expect(logs.length).toBe(1)
|
|
400
|
-
expect(logs[0].args.policyId).
|
|
383
|
+
expect(logs[0].args.policyId).toBeDefined()
|
|
401
384
|
expect(logs[0].args.updater).toBe(account.address)
|
|
402
385
|
expect(logs[0].args.type).toBe('whitelist')
|
|
403
386
|
})
|
|
404
387
|
})
|
|
405
388
|
|
|
406
389
|
describe('watchAdminUpdated', () => {
|
|
390
|
+
beforeAll(async () => {
|
|
391
|
+
await fetch(`${rpcUrl}/restart`)
|
|
392
|
+
})
|
|
393
|
+
|
|
407
394
|
test('default', async () => {
|
|
408
395
|
// create policy
|
|
409
396
|
const { policyId } = await actions.policy.createSync(client, {
|
|
@@ -426,8 +413,7 @@ describe('watchAdminUpdated', () => {
|
|
|
426
413
|
await setTimeout(500)
|
|
427
414
|
unwatch()
|
|
428
415
|
|
|
429
|
-
expect(logs.
|
|
430
|
-
expect(logs[0].args.policyId).toBe(2n)
|
|
416
|
+
expect(logs[0].args.policyId).toBeDefined()
|
|
431
417
|
expect(logs[0].args.updater).toBe(account.address)
|
|
432
418
|
expect(logs[0].args.admin).toBe(account2.address)
|
|
433
419
|
})
|
|
@@ -465,7 +451,7 @@ describe('watchWhitelistUpdated', () => {
|
|
|
465
451
|
unwatch()
|
|
466
452
|
|
|
467
453
|
expect(logs.length).toBe(2)
|
|
468
|
-
expect(logs[0].args.policyId).
|
|
454
|
+
expect(logs[0].args.policyId).toBeDefined()
|
|
469
455
|
expect(logs[0].args.updater).toBe(account.address)
|
|
470
456
|
expect(logs[0].args.account).toBe(account2.address)
|
|
471
457
|
expect(logs[0].args.allowed).toBe(true)
|
|
@@ -505,7 +491,7 @@ describe('watchBlacklistUpdated', () => {
|
|
|
505
491
|
unwatch()
|
|
506
492
|
|
|
507
493
|
expect(logs.length).toBe(2)
|
|
508
|
-
expect(logs[0].args.policyId).
|
|
494
|
+
expect(logs[0].args.policyId).toBeDefined()
|
|
509
495
|
expect(logs[0].args.updater).toBe(account.address)
|
|
510
496
|
expect(logs[0].args.account).toBe(account2.address)
|
|
511
497
|
expect(logs[0].args.restricted).toBe(true)
|
|
@@ -41,16 +41,16 @@ const policyTypeMap = {
|
|
|
41
41
|
* ```ts
|
|
42
42
|
* import { createClient, http } from 'viem'
|
|
43
43
|
* import { tempo } from 'tempo.ts/chains'
|
|
44
|
-
* import
|
|
44
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
45
45
|
* import { privateKeyToAccount } from 'viem/accounts'
|
|
46
46
|
*
|
|
47
47
|
* const client = createClient({
|
|
48
48
|
* account: privateKeyToAccount('0x...'),
|
|
49
|
-
* chain: tempo
|
|
49
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
50
50
|
* transport: http(),
|
|
51
51
|
* })
|
|
52
52
|
*
|
|
53
|
-
* const { hash, policyId } = await
|
|
53
|
+
* const { hash, policyId } = await Actions.policy.create(client, {
|
|
54
54
|
* admin: '0x...',
|
|
55
55
|
* type: 'whitelist',
|
|
56
56
|
* })
|
|
@@ -134,10 +134,10 @@ export namespace create {
|
|
|
134
134
|
* ```ts
|
|
135
135
|
* import { createClient, http, walletActions } from 'viem'
|
|
136
136
|
* import { tempo } from 'tempo.ts/chains'
|
|
137
|
-
* import
|
|
137
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
138
138
|
*
|
|
139
139
|
* const client = createClient({
|
|
140
|
-
* chain: tempo
|
|
140
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
141
141
|
* transport: http(),
|
|
142
142
|
* }).extend(walletActions)
|
|
143
143
|
*
|
|
@@ -204,16 +204,16 @@ export namespace create {
|
|
|
204
204
|
* ```ts
|
|
205
205
|
* import { createClient, http } from 'viem'
|
|
206
206
|
* import { tempo } from 'tempo.ts/chains'
|
|
207
|
-
* import
|
|
207
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
208
208
|
* import { privateKeyToAccount } from 'viem/accounts'
|
|
209
209
|
*
|
|
210
210
|
* const client = createClient({
|
|
211
211
|
* account: privateKeyToAccount('0x...'),
|
|
212
|
-
* chain: tempo
|
|
212
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
213
213
|
* transport: http(),
|
|
214
214
|
* })
|
|
215
215
|
*
|
|
216
|
-
* const result = await
|
|
216
|
+
* const result = await Actions.policy.createSync(client, {
|
|
217
217
|
* admin: '0x...',
|
|
218
218
|
* type: 'whitelist',
|
|
219
219
|
* })
|
|
@@ -268,16 +268,16 @@ export namespace createSync {
|
|
|
268
268
|
* ```ts
|
|
269
269
|
* import { createClient, http } from 'viem'
|
|
270
270
|
* import { tempo } from 'tempo.ts/chains'
|
|
271
|
-
* import
|
|
271
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
272
272
|
* import { privateKeyToAccount } from 'viem/accounts'
|
|
273
273
|
*
|
|
274
274
|
* const client = createClient({
|
|
275
275
|
* account: privateKeyToAccount('0x...'),
|
|
276
|
-
* chain: tempo
|
|
276
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
277
277
|
* transport: http(),
|
|
278
278
|
* })
|
|
279
279
|
*
|
|
280
|
-
* const hash = await
|
|
280
|
+
* const hash = await Actions.policy.setAdmin(client, {
|
|
281
281
|
* policyId: 2n,
|
|
282
282
|
* admin: '0x...',
|
|
283
283
|
* })
|
|
@@ -342,10 +342,10 @@ export namespace setAdmin {
|
|
|
342
342
|
* ```ts
|
|
343
343
|
* import { createClient, http, walletActions } from 'viem'
|
|
344
344
|
* import { tempo } from 'tempo.ts/chains'
|
|
345
|
-
* import
|
|
345
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
346
346
|
*
|
|
347
347
|
* const client = createClient({
|
|
348
|
-
* chain: tempo
|
|
348
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
349
349
|
* transport: http(),
|
|
350
350
|
* }).extend(walletActions)
|
|
351
351
|
*
|
|
@@ -401,16 +401,16 @@ export namespace setAdmin {
|
|
|
401
401
|
* ```ts
|
|
402
402
|
* import { createClient, http } from 'viem'
|
|
403
403
|
* import { tempo } from 'tempo.ts/chains'
|
|
404
|
-
* import
|
|
404
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
405
405
|
* import { privateKeyToAccount } from 'viem/accounts'
|
|
406
406
|
*
|
|
407
407
|
* const client = createClient({
|
|
408
408
|
* account: privateKeyToAccount('0x...'),
|
|
409
|
-
* chain: tempo
|
|
409
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
410
410
|
* transport: http(),
|
|
411
411
|
* })
|
|
412
412
|
*
|
|
413
|
-
* const result = await
|
|
413
|
+
* const result = await Actions.policy.setAdminSync(client, {
|
|
414
414
|
* policyId: 2n,
|
|
415
415
|
* admin: '0x...',
|
|
416
416
|
* })
|
|
@@ -465,16 +465,16 @@ export namespace setAdminSync {
|
|
|
465
465
|
* ```ts
|
|
466
466
|
* import { createClient, http } from 'viem'
|
|
467
467
|
* import { tempo } from 'tempo.ts/chains'
|
|
468
|
-
* import
|
|
468
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
469
469
|
* import { privateKeyToAccount } from 'viem/accounts'
|
|
470
470
|
*
|
|
471
471
|
* const client = createClient({
|
|
472
472
|
* account: privateKeyToAccount('0x...'),
|
|
473
|
-
* chain: tempo
|
|
473
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
474
474
|
* transport: http(),
|
|
475
475
|
* })
|
|
476
476
|
*
|
|
477
|
-
* const hash = await
|
|
477
|
+
* const hash = await Actions.policy.modifyWhitelist(client, {
|
|
478
478
|
* policyId: 2n,
|
|
479
479
|
* account: '0x...',
|
|
480
480
|
* allowed: true,
|
|
@@ -546,10 +546,10 @@ export namespace modifyWhitelist {
|
|
|
546
546
|
* ```ts
|
|
547
547
|
* import { createClient, http, walletActions } from 'viem'
|
|
548
548
|
* import { tempo } from 'tempo.ts/chains'
|
|
549
|
-
* import
|
|
549
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
550
550
|
*
|
|
551
551
|
* const client = createClient({
|
|
552
|
-
* chain: tempo
|
|
552
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
553
553
|
* transport: http(),
|
|
554
554
|
* }).extend(walletActions)
|
|
555
555
|
*
|
|
@@ -607,16 +607,16 @@ export namespace modifyWhitelist {
|
|
|
607
607
|
* ```ts
|
|
608
608
|
* import { createClient, http } from 'viem'
|
|
609
609
|
* import { tempo } from 'tempo.ts/chains'
|
|
610
|
-
* import
|
|
610
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
611
611
|
* import { privateKeyToAccount } from 'viem/accounts'
|
|
612
612
|
*
|
|
613
613
|
* const client = createClient({
|
|
614
614
|
* account: privateKeyToAccount('0x...'),
|
|
615
|
-
* chain: tempo
|
|
615
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
616
616
|
* transport: http(),
|
|
617
617
|
* })
|
|
618
618
|
*
|
|
619
|
-
* const result = await
|
|
619
|
+
* const result = await Actions.policy.modifyWhitelistSync(client, {
|
|
620
620
|
* policyId: 2n,
|
|
621
621
|
* account: '0x...',
|
|
622
622
|
* allowed: true,
|
|
@@ -672,16 +672,16 @@ export namespace modifyWhitelistSync {
|
|
|
672
672
|
* ```ts
|
|
673
673
|
* import { createClient, http } from 'viem'
|
|
674
674
|
* import { tempo } from 'tempo.ts/chains'
|
|
675
|
-
* import
|
|
675
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
676
676
|
* import { privateKeyToAccount } from 'viem/accounts'
|
|
677
677
|
*
|
|
678
678
|
* const client = createClient({
|
|
679
679
|
* account: privateKeyToAccount('0x...'),
|
|
680
|
-
* chain: tempo
|
|
680
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
681
681
|
* transport: http(),
|
|
682
682
|
* })
|
|
683
683
|
*
|
|
684
|
-
* const hash = await
|
|
684
|
+
* const hash = await Actions.policy.modifyBlacklist(client, {
|
|
685
685
|
* policyId: 2n,
|
|
686
686
|
* account: '0x...',
|
|
687
687
|
* restricted: true,
|
|
@@ -753,10 +753,10 @@ export namespace modifyBlacklist {
|
|
|
753
753
|
* ```ts
|
|
754
754
|
* import { createClient, http, walletActions } from 'viem'
|
|
755
755
|
* import { tempo } from 'tempo.ts/chains'
|
|
756
|
-
* import
|
|
756
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
757
757
|
*
|
|
758
758
|
* const client = createClient({
|
|
759
|
-
* chain: tempo
|
|
759
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
760
760
|
* transport: http(),
|
|
761
761
|
* }).extend(walletActions)
|
|
762
762
|
*
|
|
@@ -814,16 +814,16 @@ export namespace modifyBlacklist {
|
|
|
814
814
|
* ```ts
|
|
815
815
|
* import { createClient, http } from 'viem'
|
|
816
816
|
* import { tempo } from 'tempo.ts/chains'
|
|
817
|
-
* import
|
|
817
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
818
818
|
* import { privateKeyToAccount } from 'viem/accounts'
|
|
819
819
|
*
|
|
820
820
|
* const client = createClient({
|
|
821
821
|
* account: privateKeyToAccount('0x...'),
|
|
822
|
-
* chain: tempo
|
|
822
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
823
823
|
* transport: http(),
|
|
824
824
|
* })
|
|
825
825
|
*
|
|
826
|
-
* const result = await
|
|
826
|
+
* const result = await Actions.policy.modifyBlacklistSync(client, {
|
|
827
827
|
* policyId: 2n,
|
|
828
828
|
* account: '0x...',
|
|
829
829
|
* restricted: true,
|
|
@@ -879,14 +879,14 @@ export namespace modifyBlacklistSync {
|
|
|
879
879
|
* ```ts
|
|
880
880
|
* import { createClient, http } from 'viem'
|
|
881
881
|
* import { tempo } from 'tempo.ts/chains'
|
|
882
|
-
* import
|
|
882
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
883
883
|
*
|
|
884
884
|
* const client = createClient({
|
|
885
|
-
* chain: tempo
|
|
885
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
886
886
|
* transport: http(),
|
|
887
887
|
* })
|
|
888
888
|
*
|
|
889
|
-
* const data = await
|
|
889
|
+
* const data = await Actions.policy.getData(client, {
|
|
890
890
|
* policyId: 2n,
|
|
891
891
|
* })
|
|
892
892
|
* ```
|
|
@@ -949,14 +949,14 @@ export namespace getData {
|
|
|
949
949
|
* ```ts
|
|
950
950
|
* import { createClient, http } from 'viem'
|
|
951
951
|
* import { tempo } from 'tempo.ts/chains'
|
|
952
|
-
* import
|
|
952
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
953
953
|
*
|
|
954
954
|
* const client = createClient({
|
|
955
|
-
* chain: tempo
|
|
955
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
956
956
|
* transport: http(),
|
|
957
957
|
* })
|
|
958
958
|
*
|
|
959
|
-
* const authorized = await
|
|
959
|
+
* const authorized = await Actions.policy.isAuthorized(client, {
|
|
960
960
|
* policyId: 2n,
|
|
961
961
|
* user: '0x...',
|
|
962
962
|
* })
|
|
@@ -1017,10 +1017,10 @@ export namespace isAuthorized {
|
|
|
1017
1017
|
* ```ts
|
|
1018
1018
|
* import { createClient, http } from 'viem'
|
|
1019
1019
|
* import { tempo } from 'tempo.ts/chains'
|
|
1020
|
-
* import
|
|
1020
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
1021
1021
|
*
|
|
1022
1022
|
* const client = createClient({
|
|
1023
|
-
* chain: tempo
|
|
1023
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
1024
1024
|
* transport: http(),
|
|
1025
1025
|
* })
|
|
1026
1026
|
*
|
|
@@ -1097,10 +1097,10 @@ export declare namespace watchCreate {
|
|
|
1097
1097
|
* ```ts
|
|
1098
1098
|
* import { createClient, http } from 'viem'
|
|
1099
1099
|
* import { tempo } from 'tempo.ts/chains'
|
|
1100
|
-
* import
|
|
1100
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
1101
1101
|
*
|
|
1102
1102
|
* const client = createClient({
|
|
1103
|
-
* chain: tempo
|
|
1103
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
1104
1104
|
* transport: http(),
|
|
1105
1105
|
* })
|
|
1106
1106
|
*
|
|
@@ -1170,10 +1170,10 @@ export declare namespace watchAdminUpdated {
|
|
|
1170
1170
|
* ```ts
|
|
1171
1171
|
* import { createClient, http } from 'viem'
|
|
1172
1172
|
* import { tempo } from 'tempo.ts/chains'
|
|
1173
|
-
* import
|
|
1173
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
1174
1174
|
*
|
|
1175
1175
|
* const client = createClient({
|
|
1176
|
-
* chain: tempo
|
|
1176
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
1177
1177
|
* transport: http(),
|
|
1178
1178
|
* })
|
|
1179
1179
|
*
|
|
@@ -1243,10 +1243,10 @@ export declare namespace watchWhitelistUpdated {
|
|
|
1243
1243
|
* ```ts
|
|
1244
1244
|
* import { createClient, http } from 'viem'
|
|
1245
1245
|
* import { tempo } from 'tempo.ts/chains'
|
|
1246
|
-
* import
|
|
1246
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
1247
1247
|
*
|
|
1248
1248
|
* const client = createClient({
|
|
1249
|
-
* chain: tempo
|
|
1249
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
1250
1250
|
* transport: http(),
|
|
1251
1251
|
* })
|
|
1252
1252
|
*
|