tempo.ts 0.10.5 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -0
- package/README.md +0 -41
- package/dist/viem/Account.d.ts +8 -3
- package/dist/viem/Account.d.ts.map +1 -1
- package/dist/viem/Account.js +9 -2
- package/dist/viem/Account.js.map +1 -1
- package/dist/viem/Actions/amm.d.ts +1 -1
- package/dist/viem/Actions/amm.d.ts.map +1 -1
- package/dist/viem/Actions/amm.js +1 -2
- package/dist/viem/Actions/amm.js.map +1 -1
- package/dist/viem/Actions/dex.d.ts +0 -35
- package/dist/viem/Actions/dex.d.ts.map +1 -1
- package/dist/viem/Actions/dex.js +0 -43
- package/dist/viem/Actions/dex.js.map +1 -1
- package/dist/viem/Actions/fee.d.ts +1 -1
- package/dist/viem/Actions/fee.d.ts.map +1 -1
- package/dist/viem/Actions/fee.js +1 -1
- package/dist/viem/Actions/fee.js.map +1 -1
- package/dist/viem/Actions/nonce.d.ts.map +1 -1
- package/dist/viem/Actions/nonce.js +6 -4
- package/dist/viem/Actions/nonce.js.map +1 -1
- package/dist/viem/Actions/token.d.ts +1 -2
- package/dist/viem/Actions/token.d.ts.map +1 -1
- package/dist/viem/Actions/token.js +1 -2
- package/dist/viem/Actions/token.js.map +1 -1
- package/dist/viem/Chain.d.ts +34 -34
- package/dist/viem/Chain.d.ts.map +1 -1
- package/dist/viem/Chain.js +2 -0
- package/dist/viem/Chain.js.map +1 -1
- package/dist/viem/Formatters.d.ts.map +1 -1
- package/dist/viem/Formatters.js +5 -3
- package/dist/viem/Formatters.js.map +1 -1
- package/dist/viem/Transaction.d.ts +8 -5
- package/dist/viem/Transaction.d.ts.map +1 -1
- package/dist/viem/Transaction.js +13 -3
- package/dist/viem/Transaction.js.map +1 -1
- package/dist/viem/internal/types.d.ts +1 -1
- package/dist/viem/internal/types.d.ts.map +1 -1
- package/dist/wagmi/Actions/dex.d.ts +1 -45
- package/dist/wagmi/Actions/dex.d.ts.map +1 -1
- package/dist/wagmi/Actions/dex.js +0 -55
- package/dist/wagmi/Actions/dex.js.map +1 -1
- package/dist/wagmi/Connector.d.ts +1 -1
- package/dist/wagmi/Connector.d.ts.map +1 -1
- package/dist/wagmi/Connector.js +1 -2
- package/dist/wagmi/Connector.js.map +1 -1
- package/dist/wagmi/Hooks/dex.d.ts +3 -46
- package/dist/wagmi/Hooks/dex.d.ts.map +1 -1
- package/dist/wagmi/Hooks/dex.js +2 -54
- package/dist/wagmi/Hooks/dex.js.map +1 -1
- package/dist/wagmi/index.d.ts +1 -1
- package/dist/wagmi/index.d.ts.map +1 -1
- package/dist/wagmi/index.js +1 -1
- package/dist/wagmi/index.js.map +1 -1
- package/package.json +5 -23
- package/src/viem/Account.test.ts +1 -1
- package/src/viem/Account.ts +11 -2
- package/src/viem/Actions/account.ts +1 -1
- package/src/viem/Actions/amm.ts +1 -2
- package/src/viem/Actions/dex.test.ts +1 -195
- package/src/viem/Actions/dex.ts +0 -53
- package/src/viem/Actions/fee.test.ts +2 -2
- package/src/viem/Actions/fee.ts +1 -1
- package/src/viem/Actions/nonce.test.ts +27 -14
- package/src/viem/Actions/nonce.ts +6 -4
- package/src/viem/Actions/token.test.ts +18 -52
- package/src/viem/Actions/token.ts +1 -2
- package/src/viem/Chain.ts +3 -1
- package/src/viem/Decorator.ts +0 -30
- package/src/viem/Formatters.ts +9 -3
- package/src/viem/Transaction.ts +23 -7
- package/src/viem/e2e.test.ts +19 -0
- package/src/viem/index.ts +12 -1
- package/src/viem/internal/types.ts +1 -1
- package/src/wagmi/Actions/dex.test.ts +0 -26
- package/src/wagmi/Actions/dex.ts +1 -111
- package/src/wagmi/Actions/nonce.test.ts +8 -4
- package/src/wagmi/Actions/token.test.ts +2 -2
- package/src/wagmi/Connector.ts +1 -2
- package/src/wagmi/Hooks/dex.test.ts +0 -26
- package/src/wagmi/Hooks/dex.ts +1 -88
- package/src/wagmi/Hooks/nonce.test.ts +3 -3
- package/src/wagmi/index.ts +4 -1
- package/dist/chains.d.ts +0 -73
- package/dist/chains.d.ts.map +0 -1
- package/dist/chains.js +0 -51
- package/dist/chains.js.map +0 -1
- package/dist/ox/AuthorizationTempo.d.ts +0 -450
- package/dist/ox/AuthorizationTempo.d.ts.map +0 -1
- package/dist/ox/AuthorizationTempo.js +0 -433
- package/dist/ox/AuthorizationTempo.js.map +0 -1
- package/dist/ox/KeyAuthorization.d.ts +0 -356
- package/dist/ox/KeyAuthorization.d.ts.map +0 -1
- package/dist/ox/KeyAuthorization.js +0 -359
- package/dist/ox/KeyAuthorization.js.map +0 -1
- package/dist/ox/Order.d.ts +0 -92
- package/dist/ox/Order.d.ts.map +0 -1
- package/dist/ox/Order.js +0 -88
- package/dist/ox/Order.js.map +0 -1
- package/dist/ox/OrdersFilters.d.ts +0 -72
- package/dist/ox/OrdersFilters.d.ts.map +0 -1
- package/dist/ox/OrdersFilters.js +0 -100
- package/dist/ox/OrdersFilters.js.map +0 -1
- package/dist/ox/Pagination.d.ts +0 -128
- package/dist/ox/Pagination.d.ts.map +0 -1
- package/dist/ox/Pagination.js +0 -78
- package/dist/ox/Pagination.js.map +0 -1
- package/dist/ox/PoolId.d.ts +0 -18
- package/dist/ox/PoolId.d.ts.map +0 -1
- package/dist/ox/PoolId.js +0 -13
- package/dist/ox/PoolId.js.map +0 -1
- package/dist/ox/RpcSchema.d.ts +0 -32
- package/dist/ox/RpcSchema.d.ts.map +0 -1
- package/dist/ox/RpcSchema.js +0 -2
- package/dist/ox/RpcSchema.js.map +0 -1
- package/dist/ox/SignatureEnvelope.d.ts +0 -260
- package/dist/ox/SignatureEnvelope.d.ts.map +0 -1
- package/dist/ox/SignatureEnvelope.js +0 -477
- package/dist/ox/SignatureEnvelope.js.map +0 -1
- package/dist/ox/Tick.d.ts +0 -115
- package/dist/ox/Tick.d.ts.map +0 -1
- package/dist/ox/Tick.js +0 -127
- package/dist/ox/Tick.js.map +0 -1
- package/dist/ox/TokenId.d.ts +0 -25
- package/dist/ox/TokenId.d.ts.map +0 -1
- package/dist/ox/TokenId.js +0 -41
- package/dist/ox/TokenId.js.map +0 -1
- package/dist/ox/TokenRole.d.ts +0 -11
- package/dist/ox/TokenRole.d.ts.map +0 -1
- package/dist/ox/TokenRole.js +0 -22
- package/dist/ox/TokenRole.js.map +0 -1
- package/dist/ox/Transaction.d.ts +0 -201
- package/dist/ox/Transaction.d.ts.map +0 -1
- package/dist/ox/Transaction.js +0 -167
- package/dist/ox/Transaction.js.map +0 -1
- package/dist/ox/TransactionEnvelopeTempo.d.ts +0 -470
- package/dist/ox/TransactionEnvelopeTempo.d.ts.map +0 -1
- package/dist/ox/TransactionEnvelopeTempo.js +0 -547
- package/dist/ox/TransactionEnvelopeTempo.js.map +0 -1
- package/dist/ox/TransactionReceipt.d.ts +0 -155
- package/dist/ox/TransactionReceipt.d.ts.map +0 -1
- package/dist/ox/TransactionReceipt.js +0 -136
- package/dist/ox/TransactionReceipt.js.map +0 -1
- package/dist/ox/TransactionRequest.d.ts +0 -76
- package/dist/ox/TransactionRequest.d.ts.map +0 -1
- package/dist/ox/TransactionRequest.js +0 -93
- package/dist/ox/TransactionRequest.js.map +0 -1
- package/dist/ox/index.d.ts +0 -14
- package/dist/ox/index.d.ts.map +0 -1
- package/dist/ox/index.js +0 -14
- package/dist/ox/index.js.map +0 -1
- package/dist/prool/Instance.d.ts +0 -101
- package/dist/prool/Instance.d.ts.map +0 -1
- package/dist/prool/Instance.js +0 -136
- package/dist/prool/Instance.js.map +0 -1
- package/dist/prool/chain.json +0 -238
- package/dist/prool/index.d.ts +0 -2
- package/dist/prool/index.d.ts.map +0 -1
- package/dist/prool/index.js +0 -2
- package/dist/prool/index.js.map +0 -1
- package/dist/viem/Actions/account.d.ts +0 -40
- package/dist/viem/Actions/account.d.ts.map +0 -1
- package/dist/viem/Actions/account.js +0 -86
- package/dist/viem/Actions/account.js.map +0 -1
- package/dist/viem/Actions/index.d.ts +0 -10
- package/dist/viem/Actions/index.d.ts.map +0 -1
- package/dist/viem/Actions/index.js +0 -10
- package/dist/viem/Actions/index.js.map +0 -1
- package/dist/viem/Decorator.d.ts +0 -2810
- package/dist/viem/Decorator.d.ts.map +0 -1
- package/dist/viem/Decorator.js +0 -138
- package/dist/viem/Decorator.js.map +0 -1
- package/dist/viem/P256.d.ts +0 -2
- package/dist/viem/P256.d.ts.map +0 -1
- package/dist/viem/P256.js +0 -2
- package/dist/viem/P256.js.map +0 -1
- package/dist/viem/Secp256k1.d.ts +0 -2
- package/dist/viem/Secp256k1.d.ts.map +0 -1
- package/dist/viem/Secp256k1.js +0 -2
- package/dist/viem/Secp256k1.js.map +0 -1
- package/dist/viem/TokenIds.d.ts +0 -2
- package/dist/viem/TokenIds.d.ts.map +0 -1
- package/dist/viem/TokenIds.js +0 -2
- package/dist/viem/TokenIds.js.map +0 -1
- package/dist/viem/index.d.ts +0 -17
- package/dist/viem/index.d.ts.map +0 -1
- package/dist/viem/index.js +0 -17
- package/dist/viem/index.js.map +0 -1
- package/src/ox/AuthorizationTempo.test.ts +0 -1256
- package/src/ox/AuthorizationTempo.ts +0 -648
- package/src/ox/KeyAuthorization.test.ts +0 -1332
- package/src/ox/KeyAuthorization.ts +0 -540
- package/src/ox/Order.test.ts +0 -78
- package/src/ox/Order.ts +0 -125
- package/src/ox/OrdersFilters.test.ts +0 -182
- package/src/ox/OrdersFilters.ts +0 -125
- package/src/ox/Pagination.test.ts +0 -162
- package/src/ox/Pagination.ts +0 -164
- package/src/ox/PoolId.test.ts +0 -33
- package/src/ox/PoolId.ts +0 -27
- package/src/ox/RpcSchema.ts +0 -35
- package/src/ox/SignatureEnvelope.test.ts +0 -1876
- package/src/ox/SignatureEnvelope.ts +0 -791
- package/src/ox/Tick.test.ts +0 -281
- package/src/ox/Tick.ts +0 -181
- package/src/ox/TokenId.test.ts +0 -40
- package/src/ox/TokenId.ts +0 -50
- package/src/ox/TokenRole.test.ts +0 -16
- package/src/ox/TokenRole.ts +0 -27
- package/src/ox/Transaction.test.ts +0 -523
- package/src/ox/Transaction.ts +0 -332
- package/src/ox/TransactionEnvelopeTempo.test.ts +0 -1352
- package/src/ox/TransactionEnvelopeTempo.ts +0 -905
- package/src/ox/TransactionReceipt.ts +0 -190
- package/src/ox/TransactionRequest.ts +0 -147
- package/src/ox/e2e.test.ts +0 -1393
- package/src/ox/index.ts +0 -13
- package/src/prool/Instance.test.ts +0 -43
- package/src/prool/Instance.ts +0 -247
- package/src/prool/chain.json +0 -238
- package/src/prool/index.ts +0 -1
- package/src/viem/Actions/__snapshots__/dex.test.ts.snap +0 -850
- package/src/wagmi/Actions/__snapshots__/dex.test.ts.snap +0 -310
- package/src/wagmi/Hooks/__snapshots__/dex.test.ts.snap +0 -457
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { setTimeout } from 'node:timers/promises'
|
|
2
2
|
import { Hex } from 'ox'
|
|
3
|
-
import { TokenRole } from 'tempo
|
|
3
|
+
import { TokenRole } from 'ox/tempo'
|
|
4
4
|
import { Abis, Addresses, TokenIds } from 'tempo.ts/viem'
|
|
5
5
|
import { parseUnits } from 'viem'
|
|
6
6
|
import { getCode, writeContractSync } from 'viem/actions'
|
|
@@ -325,7 +325,7 @@ describe('getMetadata', () => {
|
|
|
325
325
|
"quoteToken": "0x20C0000000000000000000000000000000000000",
|
|
326
326
|
"supplyCap": 340282366920938463463374607431768211455n,
|
|
327
327
|
"symbol": "AlphaUSD",
|
|
328
|
-
"totalSupply":
|
|
328
|
+
"totalSupply": 202914184810805067765n,
|
|
329
329
|
"transferPolicyId": 1n,
|
|
330
330
|
}
|
|
331
331
|
`)
|
|
@@ -369,7 +369,7 @@ describe('getMetadata', () => {
|
|
|
369
369
|
"decimals": 6,
|
|
370
370
|
"name": "pathUSD",
|
|
371
371
|
"symbol": "pathUSD",
|
|
372
|
-
"totalSupply":
|
|
372
|
+
"totalSupply": 184467440737095516150n,
|
|
373
373
|
}
|
|
374
374
|
`)
|
|
375
375
|
}
|
|
@@ -385,7 +385,7 @@ describe('getMetadata', () => {
|
|
|
385
385
|
"decimals": 6,
|
|
386
386
|
"name": "pathUSD",
|
|
387
387
|
"symbol": "pathUSD",
|
|
388
|
-
"totalSupply":
|
|
388
|
+
"totalSupply": 184467440737095516150n,
|
|
389
389
|
}
|
|
390
390
|
`)
|
|
391
391
|
}
|
|
@@ -1930,43 +1930,9 @@ describe('watchCreate', () => {
|
|
|
1930
1930
|
symbol: 'WATCH2',
|
|
1931
1931
|
})
|
|
1932
1932
|
|
|
1933
|
-
await setTimeout(
|
|
1933
|
+
await setTimeout(500)
|
|
1934
1934
|
|
|
1935
1935
|
expect(receivedTokens).toHaveLength(2)
|
|
1936
|
-
|
|
1937
|
-
const {
|
|
1938
|
-
token: token1,
|
|
1939
|
-
tokenId: tokenId1,
|
|
1940
|
-
...rest1
|
|
1941
|
-
} = receivedTokens.at(0)!.args
|
|
1942
|
-
expect(rest1).toMatchInlineSnapshot(`
|
|
1943
|
-
{
|
|
1944
|
-
"admin": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
|
|
1945
|
-
"currency": "USD",
|
|
1946
|
-
"name": "Watch Test Token 1",
|
|
1947
|
-
"quoteToken": "0x20C0000000000000000000000000000000000000",
|
|
1948
|
-
"symbol": "WATCH1",
|
|
1949
|
-
}
|
|
1950
|
-
`)
|
|
1951
|
-
expect(token1).toBeDefined()
|
|
1952
|
-
expect(tokenId1).toBeDefined()
|
|
1953
|
-
|
|
1954
|
-
const {
|
|
1955
|
-
token: token2,
|
|
1956
|
-
tokenId: tokenId2,
|
|
1957
|
-
...rest2
|
|
1958
|
-
} = receivedTokens.at(1)!.args
|
|
1959
|
-
expect(rest2).toMatchInlineSnapshot(`
|
|
1960
|
-
{
|
|
1961
|
-
"admin": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
|
|
1962
|
-
"currency": "USD",
|
|
1963
|
-
"name": "Watch Test Token 2",
|
|
1964
|
-
"quoteToken": "0x20C0000000000000000000000000000000000000",
|
|
1965
|
-
"symbol": "WATCH2",
|
|
1966
|
-
}
|
|
1967
|
-
`)
|
|
1968
|
-
expect(token2).toBeDefined()
|
|
1969
|
-
expect(tokenId2).toBeDefined()
|
|
1970
1936
|
} finally {
|
|
1971
1937
|
// Clean up watcher
|
|
1972
1938
|
if (unwatch) unwatch()
|
|
@@ -2027,7 +1993,7 @@ describe('watchCreate', () => {
|
|
|
2027
1993
|
symbol: 'FWATCH3',
|
|
2028
1994
|
})
|
|
2029
1995
|
|
|
2030
|
-
await setTimeout(
|
|
1996
|
+
await setTimeout(500)
|
|
2031
1997
|
|
|
2032
1998
|
// Should only receive 1 event (for targetTokenId)
|
|
2033
1999
|
expect(receivedTokens).toHaveLength(1)
|
|
@@ -2100,7 +2066,7 @@ describe('watchMint', () => {
|
|
|
2100
2066
|
amount: parseUnits('50', 6),
|
|
2101
2067
|
})
|
|
2102
2068
|
|
|
2103
|
-
await setTimeout(
|
|
2069
|
+
await setTimeout(500)
|
|
2104
2070
|
|
|
2105
2071
|
expect(receivedMints).toHaveLength(2)
|
|
2106
2072
|
|
|
@@ -2177,7 +2143,7 @@ describe('watchMint', () => {
|
|
|
2177
2143
|
amount: parseUnits('75', 6),
|
|
2178
2144
|
})
|
|
2179
2145
|
|
|
2180
|
-
await setTimeout(
|
|
2146
|
+
await setTimeout(500)
|
|
2181
2147
|
|
|
2182
2148
|
// Should only receive 2 events (for account2)
|
|
2183
2149
|
expect(receivedMints).toHaveLength(2)
|
|
@@ -2245,7 +2211,7 @@ describe('watchApprove', () => {
|
|
|
2245
2211
|
amount: parseUnits('50', 6),
|
|
2246
2212
|
})
|
|
2247
2213
|
|
|
2248
|
-
await setTimeout(
|
|
2214
|
+
await setTimeout(500)
|
|
2249
2215
|
|
|
2250
2216
|
expect(receivedApprovals).toHaveLength(2)
|
|
2251
2217
|
|
|
@@ -2317,7 +2283,7 @@ describe('watchApprove', () => {
|
|
|
2317
2283
|
amount: parseUnits('75', 6),
|
|
2318
2284
|
})
|
|
2319
2285
|
|
|
2320
|
-
await setTimeout(
|
|
2286
|
+
await setTimeout(500)
|
|
2321
2287
|
|
|
2322
2288
|
// Should only receive 2 events (for account2)
|
|
2323
2289
|
expect(receivedApprovals).toHaveLength(2)
|
|
@@ -2421,7 +2387,7 @@ describe('watchBurn', () => {
|
|
|
2421
2387
|
amount: parseUnits('25', 6),
|
|
2422
2388
|
})
|
|
2423
2389
|
|
|
2424
|
-
await setTimeout(
|
|
2390
|
+
await setTimeout(500)
|
|
2425
2391
|
|
|
2426
2392
|
expect(receivedBurns).toHaveLength(2)
|
|
2427
2393
|
|
|
@@ -2524,7 +2490,7 @@ describe('watchBurn', () => {
|
|
|
2524
2490
|
amount: parseUnits('75', 6),
|
|
2525
2491
|
})
|
|
2526
2492
|
|
|
2527
|
-
await setTimeout(
|
|
2493
|
+
await setTimeout(500)
|
|
2528
2494
|
|
|
2529
2495
|
// Should only receive 2 events (from clientWithAccount.account)
|
|
2530
2496
|
expect(receivedBurns).toHaveLength(2)
|
|
@@ -2605,7 +2571,7 @@ describe('watchAdminRole', () => {
|
|
|
2605
2571
|
adminRole: 'unpause',
|
|
2606
2572
|
})
|
|
2607
2573
|
|
|
2608
|
-
await setTimeout(
|
|
2574
|
+
await setTimeout(500)
|
|
2609
2575
|
|
|
2610
2576
|
expect(receivedAdminUpdates).toHaveLength(2)
|
|
2611
2577
|
|
|
@@ -2668,7 +2634,7 @@ describe('watchRole', () => {
|
|
|
2668
2634
|
from: account2.address,
|
|
2669
2635
|
})
|
|
2670
2636
|
|
|
2671
|
-
await setTimeout(
|
|
2637
|
+
await setTimeout(500)
|
|
2672
2638
|
|
|
2673
2639
|
expect(receivedRoleUpdates).toHaveLength(3)
|
|
2674
2640
|
|
|
@@ -2740,7 +2706,7 @@ describe('watchRole', () => {
|
|
|
2740
2706
|
from: account2.address,
|
|
2741
2707
|
})
|
|
2742
2708
|
|
|
2743
|
-
await setTimeout(
|
|
2709
|
+
await setTimeout(500)
|
|
2744
2710
|
|
|
2745
2711
|
// Should only receive 2 events (for account2)
|
|
2746
2712
|
expect(receivedRoleUpdates).toHaveLength(2)
|
|
@@ -2909,7 +2875,7 @@ describe('watchTransfer', () => {
|
|
|
2909
2875
|
amount: parseUnits('75', 6),
|
|
2910
2876
|
})
|
|
2911
2877
|
|
|
2912
|
-
await setTimeout(
|
|
2878
|
+
await setTimeout(500)
|
|
2913
2879
|
|
|
2914
2880
|
// Should only receive 2 events (to account2)
|
|
2915
2881
|
expect(receivedTransfers).toHaveLength(2)
|
|
@@ -2986,7 +2952,7 @@ describe('watchUpdateQuoteToken', () => {
|
|
|
2986
2952
|
token: address,
|
|
2987
2953
|
})
|
|
2988
2954
|
|
|
2989
|
-
await setTimeout(
|
|
2955
|
+
await setTimeout(500)
|
|
2990
2956
|
|
|
2991
2957
|
// Should receive 2 events: one for update, one for finalized
|
|
2992
2958
|
expect(receivedUpdates).toHaveLength(2)
|
|
@@ -3050,7 +3016,7 @@ describe('watchUpdateQuoteToken', () => {
|
|
|
3050
3016
|
quoteToken: quoteTokenAddress,
|
|
3051
3017
|
})
|
|
3052
3018
|
|
|
3053
|
-
await setTimeout(
|
|
3019
|
+
await setTimeout(500)
|
|
3054
3020
|
|
|
3055
3021
|
// Should only receive 1 event (not finalized)
|
|
3056
3022
|
expect(receivedUpdates).toHaveLength(1)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as Hex from 'ox/Hex'
|
|
2
|
+
import { TokenId, TokenRole } from 'ox/tempo'
|
|
2
3
|
import {
|
|
3
4
|
type Account,
|
|
4
5
|
type Address,
|
|
@@ -30,8 +31,6 @@ import {
|
|
|
30
31
|
writeContractSync,
|
|
31
32
|
} from 'viem/actions'
|
|
32
33
|
import type { Compute, OneOf, UnionOmit } from '../../internal/types.js'
|
|
33
|
-
import * as TokenId from '../../ox/TokenId.js'
|
|
34
|
-
import * as TokenRole from '../../ox/TokenRole.js'
|
|
35
34
|
import * as Abis from '../Abis.js'
|
|
36
35
|
import * as Addresses from '../Addresses.js'
|
|
37
36
|
import type {
|
package/src/viem/Chain.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as Hex from 'ox/Hex'
|
|
2
|
+
import { TokenId } from 'ox/tempo'
|
|
2
3
|
import {
|
|
3
4
|
defineTransaction,
|
|
4
5
|
defineTransactionReceipt,
|
|
@@ -7,7 +8,6 @@ import {
|
|
|
7
8
|
type Chain as viem_Chain,
|
|
8
9
|
} from 'viem'
|
|
9
10
|
import type { IsUndefined } from '../internal/types.js'
|
|
10
|
-
import type * as TokenId from '../ox/TokenId.js'
|
|
11
11
|
import * as Formatters from './Formatters.js'
|
|
12
12
|
import * as Transaction from './Transaction.js'
|
|
13
13
|
|
|
@@ -133,6 +133,8 @@ export function define<const chain extends viem_Chain>(
|
|
|
133
133
|
) as never
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
+
export { TokenId }
|
|
137
|
+
|
|
136
138
|
export declare namespace define {
|
|
137
139
|
type Properties = {
|
|
138
140
|
/**
|
package/src/viem/Decorator.ts
CHANGED
|
@@ -630,35 +630,6 @@ export type Decorator<
|
|
|
630
630
|
getOrder: (
|
|
631
631
|
parameters: dexActions.getOrder.Parameters,
|
|
632
632
|
) => Promise<dexActions.getOrder.ReturnValue>
|
|
633
|
-
/**
|
|
634
|
-
* Gets paginated orders from the orderbook.
|
|
635
|
-
*
|
|
636
|
-
* @example
|
|
637
|
-
* ```ts
|
|
638
|
-
* import { createClient, http } from 'viem'
|
|
639
|
-
* import { tempo } from 'tempo.ts/chains'
|
|
640
|
-
* import { tempoActions } from 'tempo.ts/viem'
|
|
641
|
-
*
|
|
642
|
-
* const client = createClient({
|
|
643
|
-
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
644
|
-
* transport: http(),
|
|
645
|
-
* }).extend(tempoActions())
|
|
646
|
-
*
|
|
647
|
-
* const { orders, nextCursor } = await client.dex.getOrders({
|
|
648
|
-
* limit: 100,
|
|
649
|
-
* filters: {
|
|
650
|
-
* baseToken: '0x20c0...',
|
|
651
|
-
* isBid: true,
|
|
652
|
-
* }
|
|
653
|
-
* })
|
|
654
|
-
* ```
|
|
655
|
-
*
|
|
656
|
-
* @param parameters - Parameters.
|
|
657
|
-
* @returns Paginated orders and next cursor.
|
|
658
|
-
*/
|
|
659
|
-
getOrders: (
|
|
660
|
-
parameters?: dexActions.getOrders.Parameters,
|
|
661
|
-
) => Promise<dexActions.getOrders.ReturnValue>
|
|
662
633
|
/**
|
|
663
634
|
* Gets the price level information at a specific tick.
|
|
664
635
|
*
|
|
@@ -3055,7 +3026,6 @@ export function decorator() {
|
|
|
3055
3026
|
getBalance: (parameters) => dexActions.getBalance(client, parameters),
|
|
3056
3027
|
getBuyQuote: (parameters) => dexActions.getBuyQuote(client, parameters),
|
|
3057
3028
|
getOrder: (parameters) => dexActions.getOrder(client, parameters),
|
|
3058
|
-
getOrders: (parameters) => dexActions.getOrders(client, parameters),
|
|
3059
3029
|
getTickLevel: (parameters) =>
|
|
3060
3030
|
dexActions.getTickLevel(client, parameters),
|
|
3061
3031
|
getSellQuote: (parameters) =>
|
package/src/viem/Formatters.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
// TODO: Find opportunities to make this file less duplicated + more simplified with Viem v3.
|
|
2
2
|
|
|
3
3
|
import * as Hex from 'ox/Hex'
|
|
4
|
+
import {
|
|
5
|
+
Transaction as ox_Transaction,
|
|
6
|
+
TransactionRequest as ox_TransactionRequest,
|
|
7
|
+
} from 'ox/tempo'
|
|
4
8
|
import {
|
|
5
9
|
type Chain,
|
|
6
10
|
type Account as viem_Account,
|
|
@@ -10,8 +14,6 @@ import {
|
|
|
10
14
|
} from 'viem'
|
|
11
15
|
import { type Address, parseAccount } from 'viem/accounts'
|
|
12
16
|
import type { UnionOmit } from '../internal/types.js'
|
|
13
|
-
import * as ox_Transaction from '../ox/Transaction.js'
|
|
14
|
-
import * as ox_TransactionRequest from '../ox/TransactionRequest.js'
|
|
15
17
|
import type { Account } from './Account.js'
|
|
16
18
|
import type { GetFeeTokenParameter } from './internal/types.js'
|
|
17
19
|
import {
|
|
@@ -91,7 +93,11 @@ export function formatTransactionRequest<chain extends Chain | undefined>(
|
|
|
91
93
|
if (action)
|
|
92
94
|
request.calls = request.calls ?? [
|
|
93
95
|
{
|
|
94
|
-
to:
|
|
96
|
+
to:
|
|
97
|
+
r.to ||
|
|
98
|
+
(!r.data || r.data === '0x'
|
|
99
|
+
? '0x0000000000000000000000000000000000000000'
|
|
100
|
+
: undefined),
|
|
95
101
|
value: r.value,
|
|
96
102
|
data: r.data,
|
|
97
103
|
},
|
package/src/viem/Transaction.ts
CHANGED
|
@@ -3,6 +3,13 @@
|
|
|
3
3
|
import * as Hex from 'ox/Hex'
|
|
4
4
|
import * as Secp256k1 from 'ox/Secp256k1'
|
|
5
5
|
import * as Signature from 'ox/Signature'
|
|
6
|
+
import {
|
|
7
|
+
type AuthorizationTempo,
|
|
8
|
+
type KeyAuthorization,
|
|
9
|
+
type TransactionReceipt as ox_TransactionReceipt,
|
|
10
|
+
SignatureEnvelope,
|
|
11
|
+
TxEnvelopeTempo as TxTempo,
|
|
12
|
+
} from 'ox/tempo'
|
|
6
13
|
import {
|
|
7
14
|
type AccessList,
|
|
8
15
|
type Account,
|
|
@@ -27,11 +34,6 @@ import {
|
|
|
27
34
|
type TransactionType as viem_TransactionType,
|
|
28
35
|
} from 'viem'
|
|
29
36
|
import type { ExactPartial, OneOf, PartialBy } from '../internal/types.js'
|
|
30
|
-
import type * as AuthorizationTempo from '../ox/AuthorizationTempo.js'
|
|
31
|
-
import type * as KeyAuthorization from '../ox/KeyAuthorization.js'
|
|
32
|
-
import * as SignatureEnvelope from '../ox/SignatureEnvelope.js'
|
|
33
|
-
import * as TxTempo from '../ox/TransactionEnvelopeTempo.js'
|
|
34
|
-
import type * as ox_TransactionReceipt from '../ox/TransactionReceipt.js'
|
|
35
37
|
|
|
36
38
|
export type Transaction<
|
|
37
39
|
bigintType = bigint,
|
|
@@ -294,7 +296,11 @@ async function serializeTempo(
|
|
|
294
296
|
? rest.calls
|
|
295
297
|
: [
|
|
296
298
|
{
|
|
297
|
-
to:
|
|
299
|
+
to:
|
|
300
|
+
rest.to ||
|
|
301
|
+
(!rest.data || rest.data === '0x'
|
|
302
|
+
? '0x0000000000000000000000000000000000000000'
|
|
303
|
+
: undefined),
|
|
298
304
|
value: rest.value,
|
|
299
305
|
data: rest.data,
|
|
300
306
|
},
|
|
@@ -311,7 +317,7 @@ async function serializeTempo(
|
|
|
311
317
|
: undefined,
|
|
312
318
|
type: 'tempo',
|
|
313
319
|
...(nonce ? { nonce: BigInt(nonce) } : {}),
|
|
314
|
-
} satisfies TxTempo.
|
|
320
|
+
} satisfies TxTempo.TxEnvelopeTempo
|
|
315
321
|
|
|
316
322
|
if (signature && typeof transaction.feePayer === 'object') {
|
|
317
323
|
const tx = TxTempo.from(transaction_ox, {
|
|
@@ -364,3 +370,13 @@ async function serializeTempo(
|
|
|
364
370
|
},
|
|
365
371
|
)
|
|
366
372
|
}
|
|
373
|
+
|
|
374
|
+
// Export types required for inference.
|
|
375
|
+
export {
|
|
376
|
+
/** @deprecated */
|
|
377
|
+
KeyAuthorization as z_KeyAuthorization,
|
|
378
|
+
/** @deprecated */
|
|
379
|
+
SignatureEnvelope as z_SignatureEnvelope,
|
|
380
|
+
/** @deprecated */
|
|
381
|
+
TxEnvelopeTempo as z_TxEnvelopeTempo,
|
|
382
|
+
} from 'ox/tempo'
|
package/src/viem/e2e.test.ts
CHANGED
|
@@ -270,6 +270,25 @@ describe('sendTransaction', () => {
|
|
|
270
270
|
expect(receipt).toBeDefined()
|
|
271
271
|
}
|
|
272
272
|
})
|
|
273
|
+
|
|
274
|
+
test('behavior: deploy contract', async () => {
|
|
275
|
+
const account = accounts[0]
|
|
276
|
+
const receipt = await client.sendTransactionSync({
|
|
277
|
+
account,
|
|
278
|
+
data: '0x608060405234801561001057600080fd5b50610ee0806100206000396000f3fe6080604052600436106100f35760003560e01c80634d2301cc1161008a578063a8b0574e11610059578063a8b0574e1461025a578063bce38bd714610275578063c3077fa914610288578063ee82ac5e1461029b57600080fd5b80634d2301cc146101ec57806372425d9d1461022157806382ad56cb1461023457806386d516e81461024757600080fd5b80633408e470116100c65780633408e47014610191578063399542e9146101a45780633e64a696146101c657806342cbb15c146101d957600080fd5b80630f28c97d146100f8578063174dea711461011a578063252dba421461013a57806327e86d6e1461015b575b600080fd5b34801561010457600080fd5b50425b6040519081526020015b60405180910390f35b61012d610128366004610a85565b6102ba565b6040516101119190610bbe565b61014d610148366004610a85565b6104ef565b604051610111929190610bd8565b34801561016757600080fd5b50437fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0140610107565b34801561019d57600080fd5b5046610107565b6101b76101b2366004610c60565b610690565b60405161011193929190610cba565b3480156101d257600080fd5b5048610107565b3480156101e557600080fd5b5043610107565b3480156101f857600080fd5b50610107610207366004610ce2565b73ffffffffffffffffffffffffffffffffffffffff163190565b34801561022d57600080fd5b5044610107565b61012d610242366004610a85565b6106ab565b34801561025357600080fd5b5045610107565b34801561026657600080fd5b50604051418152602001610111565b61012d610283366004610c60565b61085a565b6101b7610296366004610a85565b610a1a565b3480156102a757600080fd5b506101076102b6366004610d18565b4090565b60606000828067ffffffffffffffff8111156102d8576102d8610d31565b60405190808252806020026020018201604052801561031e57816020015b6040805180820190915260008152606060208201528152602001906001900390816102f65790505b5092503660005b8281101561047757600085828151811061034157610341610d60565b6020026020010151905087878381811061035d5761035d610d60565b905060200281019061036f9190610d8f565b6040810135958601959093506103886020850185610ce2565b73ffffffffffffffffffffffffffffffffffffffff16816103ac6060870187610dcd565b6040516103ba929190610e32565b60006040518083038185875af1925050503d80600081146103f7576040519150601f19603f3d011682016040523d82523d6000602084013e6103fc565b606091505b50602080850191909152901515808452908501351761046d577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260846000fd5b5050600101610325565b508234146104e6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f4d756c746963616c6c333a2076616c7565206d69736d6174636800000000000060448201526064015b60405180910390fd5b50505092915050565b436060828067ffffffffffffffff81111561050c5761050c610d31565b60405190808252806020026020018201604052801561053f57816020015b606081526020019060019003908161052a5790505b5091503660005b8281101561068657600087878381811061056257610562610d60565b90506020028101906105749190610e42565b92506105836020840184610ce2565b73ffffffffffffffffffffffffffffffffffffffff166105a66020850185610dcd565b6040516105b4929190610e32565b6000604051808303816000865af19150503d80600081146105f1576040519150601f19603f3d011682016040523d82523d6000602084013e6105f6565b606091505b5086848151811061060957610609610d60565b602090810291909101015290508061067d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060448201526064016104dd565b50600101610546565b5050509250929050565b43804060606106a086868661085a565b905093509350939050565b6060818067ffffffffffffffff8111156106c7576106c7610d31565b60405190808252806020026020018201604052801561070d57816020015b6040805180820190915260008152606060208201528152602001906001900390816106e55790505b5091503660005b828110156104e657600084828151811061073057610730610d60565b6020026020010151905086868381811061074c5761074c610d60565b905060200281019061075e9190610e76565b925061076d6020840184610ce2565b73ffffffffffffffffffffffffffffffffffffffff166107906040850185610dcd565b60405161079e929190610e32565b6000604051808303816000865af19150503d80600081146107db576040519150601f19603f3d011682016040523d82523d6000602084013e6107e0565b606091505b506020808401919091529015158083529084013517610851577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260646000fd5b50600101610714565b6060818067ffffffffffffffff81111561087657610876610d31565b6040519080825280602002602001820160405280156108bc57816020015b6040805180820190915260008152606060208201528152602001906001900390816108945790505b5091503660005b82811015610a105760008482815181106108df576108df610d60565b602002602001015190508686838181106108fb576108fb610d60565b905060200281019061090d9190610e42565b925061091c6020840184610ce2565b73ffffffffffffffffffffffffffffffffffffffff1661093f6020850185610dcd565b60405161094d929190610e32565b6000604051808303816000865af19150503d806000811461098a576040519150601f19603f3d011682016040523d82523d6000602084013e61098f565b606091505b506020830152151581528715610a07578051610a07576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060448201526064016104dd565b506001016108c3565b5050509392505050565b6000806060610a2b60018686610690565b919790965090945092505050565b60008083601f840112610a4b57600080fd5b50813567ffffffffffffffff811115610a6357600080fd5b6020830191508360208260051b8501011115610a7e57600080fd5b9250929050565b60008060208385031215610a9857600080fd5b823567ffffffffffffffff811115610aaf57600080fd5b610abb85828601610a39565b90969095509350505050565b6000815180845260005b81811015610aed57602081850181015186830182015201610ad1565b81811115610aff576000602083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600082825180855260208086019550808260051b84010181860160005b84811015610bb1578583037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe001895281518051151584528401516040858501819052610b9d81860183610ac7565b9a86019a9450505090830190600101610b4f565b5090979650505050505050565b602081526000610bd16020830184610b32565b9392505050565b600060408201848352602060408185015281855180845260608601915060608160051b870101935082870160005b82811015610c52577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa0888703018452610c40868351610ac7565b95509284019290840190600101610c06565b509398975050505050505050565b600080600060408486031215610c7557600080fd5b83358015158114610c8557600080fd5b9250602084013567ffffffffffffffff811115610ca157600080fd5b610cad86828701610a39565b9497909650939450505050565b838152826020820152606060408201526000610cd96060830184610b32565b95945050505050565b600060208284031215610cf457600080fd5b813573ffffffffffffffffffffffffffffffffffffffff81168114610bd157600080fd5b600060208284031215610d2a57600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600082357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81833603018112610dc357600080fd5b9190910192915050565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112610e0257600080fd5b83018035915067ffffffffffffffff821115610e1d57600080fd5b602001915036819003821315610a7e57600080fd5b8183823760009101908152919050565b600082357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc1833603018112610dc357600080fd5b600082357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa1833603018112610dc357600080fdfea2646970667358221220bb2b5c71a328032f97c676ae39a1ec2148d3e5d6f73d95e9b17910152d61f16264736f6c634300080c0033',
|
|
279
|
+
})
|
|
280
|
+
expect(receipt.contractAddress).toBeDefined()
|
|
281
|
+
})
|
|
282
|
+
|
|
283
|
+
test('behavior: deploy contract + `feeToken` (tempo tx)', async () => {
|
|
284
|
+
const account = accounts[0]
|
|
285
|
+
const receipt = await client.sendTransactionSync({
|
|
286
|
+
account,
|
|
287
|
+
feeToken: 1n,
|
|
288
|
+
data: '0x608060405234801561001057600080fd5b50610ee0806100206000396000f3fe6080604052600436106100f35760003560e01c80634d2301cc1161008a578063a8b0574e11610059578063a8b0574e1461025a578063bce38bd714610275578063c3077fa914610288578063ee82ac5e1461029b57600080fd5b80634d2301cc146101ec57806372425d9d1461022157806382ad56cb1461023457806386d516e81461024757600080fd5b80633408e470116100c65780633408e47014610191578063399542e9146101a45780633e64a696146101c657806342cbb15c146101d957600080fd5b80630f28c97d146100f8578063174dea711461011a578063252dba421461013a57806327e86d6e1461015b575b600080fd5b34801561010457600080fd5b50425b6040519081526020015b60405180910390f35b61012d610128366004610a85565b6102ba565b6040516101119190610bbe565b61014d610148366004610a85565b6104ef565b604051610111929190610bd8565b34801561016757600080fd5b50437fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0140610107565b34801561019d57600080fd5b5046610107565b6101b76101b2366004610c60565b610690565b60405161011193929190610cba565b3480156101d257600080fd5b5048610107565b3480156101e557600080fd5b5043610107565b3480156101f857600080fd5b50610107610207366004610ce2565b73ffffffffffffffffffffffffffffffffffffffff163190565b34801561022d57600080fd5b5044610107565b61012d610242366004610a85565b6106ab565b34801561025357600080fd5b5045610107565b34801561026657600080fd5b50604051418152602001610111565b61012d610283366004610c60565b61085a565b6101b7610296366004610a85565b610a1a565b3480156102a757600080fd5b506101076102b6366004610d18565b4090565b60606000828067ffffffffffffffff8111156102d8576102d8610d31565b60405190808252806020026020018201604052801561031e57816020015b6040805180820190915260008152606060208201528152602001906001900390816102f65790505b5092503660005b8281101561047757600085828151811061034157610341610d60565b6020026020010151905087878381811061035d5761035d610d60565b905060200281019061036f9190610d8f565b6040810135958601959093506103886020850185610ce2565b73ffffffffffffffffffffffffffffffffffffffff16816103ac6060870187610dcd565b6040516103ba929190610e32565b60006040518083038185875af1925050503d80600081146103f7576040519150601f19603f3d011682016040523d82523d6000602084013e6103fc565b606091505b50602080850191909152901515808452908501351761046d577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260846000fd5b5050600101610325565b508234146104e6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f4d756c746963616c6c333a2076616c7565206d69736d6174636800000000000060448201526064015b60405180910390fd5b50505092915050565b436060828067ffffffffffffffff81111561050c5761050c610d31565b60405190808252806020026020018201604052801561053f57816020015b606081526020019060019003908161052a5790505b5091503660005b8281101561068657600087878381811061056257610562610d60565b90506020028101906105749190610e42565b92506105836020840184610ce2565b73ffffffffffffffffffffffffffffffffffffffff166105a66020850185610dcd565b6040516105b4929190610e32565b6000604051808303816000865af19150503d80600081146105f1576040519150601f19603f3d011682016040523d82523d6000602084013e6105f6565b606091505b5086848151811061060957610609610d60565b602090810291909101015290508061067d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060448201526064016104dd565b50600101610546565b5050509250929050565b43804060606106a086868661085a565b905093509350939050565b6060818067ffffffffffffffff8111156106c7576106c7610d31565b60405190808252806020026020018201604052801561070d57816020015b6040805180820190915260008152606060208201528152602001906001900390816106e55790505b5091503660005b828110156104e657600084828151811061073057610730610d60565b6020026020010151905086868381811061074c5761074c610d60565b905060200281019061075e9190610e76565b925061076d6020840184610ce2565b73ffffffffffffffffffffffffffffffffffffffff166107906040850185610dcd565b60405161079e929190610e32565b6000604051808303816000865af19150503d80600081146107db576040519150601f19603f3d011682016040523d82523d6000602084013e6107e0565b606091505b506020808401919091529015158083529084013517610851577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260646000fd5b50600101610714565b6060818067ffffffffffffffff81111561087657610876610d31565b6040519080825280602002602001820160405280156108bc57816020015b6040805180820190915260008152606060208201528152602001906001900390816108945790505b5091503660005b82811015610a105760008482815181106108df576108df610d60565b602002602001015190508686838181106108fb576108fb610d60565b905060200281019061090d9190610e42565b925061091c6020840184610ce2565b73ffffffffffffffffffffffffffffffffffffffff1661093f6020850185610dcd565b60405161094d929190610e32565b6000604051808303816000865af19150503d806000811461098a576040519150601f19603f3d011682016040523d82523d6000602084013e61098f565b606091505b506020830152151581528715610a07578051610a07576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060448201526064016104dd565b506001016108c3565b5050509392505050565b6000806060610a2b60018686610690565b919790965090945092505050565b60008083601f840112610a4b57600080fd5b50813567ffffffffffffffff811115610a6357600080fd5b6020830191508360208260051b8501011115610a7e57600080fd5b9250929050565b60008060208385031215610a9857600080fd5b823567ffffffffffffffff811115610aaf57600080fd5b610abb85828601610a39565b90969095509350505050565b6000815180845260005b81811015610aed57602081850181015186830182015201610ad1565b81811115610aff576000602083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600082825180855260208086019550808260051b84010181860160005b84811015610bb1578583037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe001895281518051151584528401516040858501819052610b9d81860183610ac7565b9a86019a9450505090830190600101610b4f565b5090979650505050505050565b602081526000610bd16020830184610b32565b9392505050565b600060408201848352602060408185015281855180845260608601915060608160051b870101935082870160005b82811015610c52577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa0888703018452610c40868351610ac7565b95509284019290840190600101610c06565b509398975050505050505050565b600080600060408486031215610c7557600080fd5b83358015158114610c8557600080fd5b9250602084013567ffffffffffffffff811115610ca157600080fd5b610cad86828701610a39565b9497909650939450505050565b838152826020820152606060408201526000610cd96060830184610b32565b95945050505050565b600060208284031215610cf457600080fd5b813573ffffffffffffffffffffffffffffffffffffffff81168114610bd157600080fd5b600060208284031215610d2a57600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600082357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81833603018112610dc357600080fd5b9190910192915050565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112610e0257600080fd5b83018035915067ffffffffffffffff821115610e1d57600080fd5b602001915036819003821315610a7e57600080fd5b8183823760009101908152919050565b600082357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc1833603018112610dc357600080fd5b600082357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa1833603018112610dc357600080fdfea2646970667358221220bb2b5c71a328032f97c676ae39a1ec2148d3e5d6f73d95e9b17910152d61f16264736f6c634300080c0033',
|
|
289
|
+
})
|
|
290
|
+
expect(receipt.contractAddress).toBeDefined()
|
|
291
|
+
})
|
|
273
292
|
})
|
|
274
293
|
|
|
275
294
|
describe('p256', () => {
|
package/src/viem/index.ts
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
// Export types required for inference.
|
|
2
|
+
export type {
|
|
3
|
+
/** @deprecated */
|
|
4
|
+
KeyAuthorization as z_KeyAuthorization,
|
|
5
|
+
/** @deprecated */
|
|
6
|
+
SignatureEnvelope as z_SignatureEnvelope,
|
|
7
|
+
/** @deprecated */
|
|
8
|
+
TokenId as z_TokenId,
|
|
9
|
+
/** @deprecated */
|
|
10
|
+
TxEnvelopeTempo as z_TxEnvelopeTempo,
|
|
11
|
+
} from 'ox/tempo'
|
|
12
|
+
export { Tick } from 'ox/tempo'
|
|
2
13
|
export * as Abis from './Abis.js'
|
|
3
14
|
export * as Account from './Account.js'
|
|
4
15
|
export * as Actions from './Actions/index.js'
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { TokenId } from 'ox/tempo'
|
|
1
2
|
import type {
|
|
2
3
|
Account,
|
|
3
4
|
Address,
|
|
@@ -10,7 +11,6 @@ import type {
|
|
|
10
11
|
MaybeRequired,
|
|
11
12
|
UnionPick,
|
|
12
13
|
} from '../../internal/types.js'
|
|
13
|
-
import type * as TokenId from '../../ox/TokenId.js'
|
|
14
14
|
import type { TransactionRequestTempo } from '../Transaction.js'
|
|
15
15
|
|
|
16
16
|
export type GetAccountParameter<
|
|
@@ -7,7 +7,6 @@ import { addresses } from '../../../test/config.js'
|
|
|
7
7
|
import { accounts } from '../../../test/viem/config.js'
|
|
8
8
|
import {
|
|
9
9
|
config,
|
|
10
|
-
queryClient,
|
|
11
10
|
setupOrders,
|
|
12
11
|
setupTokenPair,
|
|
13
12
|
} from '../../../test/wagmi/config.js'
|
|
@@ -453,31 +452,6 @@ describe('getOrder', () => {
|
|
|
453
452
|
})
|
|
454
453
|
})
|
|
455
454
|
|
|
456
|
-
describe('getOrders', () => {
|
|
457
|
-
test('default', async () => {
|
|
458
|
-
const response = await Actions.dex.getOrders(config, {
|
|
459
|
-
limit: 10,
|
|
460
|
-
})
|
|
461
|
-
|
|
462
|
-
expect(response).matchSnapshot()
|
|
463
|
-
})
|
|
464
|
-
|
|
465
|
-
describe('infiniteQueryOptions', () => {
|
|
466
|
-
test('default', async () => {
|
|
467
|
-
const options = Actions.dex.getOrders.infiniteQueryOptions(config, {
|
|
468
|
-
limit: 5,
|
|
469
|
-
query: {
|
|
470
|
-
pages: 2,
|
|
471
|
-
},
|
|
472
|
-
})
|
|
473
|
-
|
|
474
|
-
const result = await queryClient.fetchInfiniteQuery(options)
|
|
475
|
-
|
|
476
|
-
expect(result).matchSnapshot()
|
|
477
|
-
})
|
|
478
|
-
})
|
|
479
|
-
})
|
|
480
|
-
|
|
481
455
|
describe('getOrderbook', () => {
|
|
482
456
|
test('default', async () => {
|
|
483
457
|
const { base, quote } = await setupTokenPair()
|
package/src/wagmi/Actions/dex.ts
CHANGED
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
import type * as Query from '@tanstack/query-core'
|
|
2
2
|
import { type Config, getConnectorClient } from '@wagmi/core'
|
|
3
3
|
import type { ChainIdParameter, ConnectorParameter } from '@wagmi/core/internal'
|
|
4
|
-
import type * as Hex from 'ox/Hex'
|
|
5
4
|
import type { Account } from 'viem'
|
|
6
|
-
import type {
|
|
7
|
-
PartialBy,
|
|
8
|
-
RequiredBy,
|
|
9
|
-
UnionOmit,
|
|
10
|
-
UnionRequiredBy,
|
|
11
|
-
} from '../../internal/types.js'
|
|
5
|
+
import type { PartialBy, RequiredBy, UnionOmit } from '../../internal/types.js'
|
|
12
6
|
import * as viem_Actions from '../../viem/Actions/dex.js'
|
|
13
7
|
|
|
14
8
|
/**
|
|
@@ -624,110 +618,6 @@ export namespace getOrder {
|
|
|
624
618
|
}
|
|
625
619
|
}
|
|
626
620
|
|
|
627
|
-
/**
|
|
628
|
-
* Gets paginated orders from the orderbook.
|
|
629
|
-
*
|
|
630
|
-
* @example
|
|
631
|
-
* ```ts
|
|
632
|
-
* import { createConfig, http } from '@wagmi/core'
|
|
633
|
-
* import { tempo } from 'tempo.ts/chains'
|
|
634
|
-
* import { Actions } from 'tempo.ts/wagmi'
|
|
635
|
-
*
|
|
636
|
-
* const config = createConfig({
|
|
637
|
-
* chains: [tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })],
|
|
638
|
-
* transports: {
|
|
639
|
-
* [tempo.id]: http(),
|
|
640
|
-
* },
|
|
641
|
-
* })
|
|
642
|
-
*
|
|
643
|
-
* const { orders, nextCursor } = await Actions.dex.getOrders(config, {
|
|
644
|
-
* limit: 100,
|
|
645
|
-
* filters: {
|
|
646
|
-
* baseToken: '0x20c0...',
|
|
647
|
-
* isBid: true,
|
|
648
|
-
* }
|
|
649
|
-
* })
|
|
650
|
-
* ```
|
|
651
|
-
*
|
|
652
|
-
* @param config - Config.
|
|
653
|
-
* @param parameters - Parameters.
|
|
654
|
-
* @returns Paginated orders and next cursor.
|
|
655
|
-
*/
|
|
656
|
-
export function getOrders<config extends Config>(
|
|
657
|
-
config: config,
|
|
658
|
-
parameters: getOrders.Parameters<config> = {},
|
|
659
|
-
): Promise<getOrders.ReturnValue> {
|
|
660
|
-
const { chainId, ...rest } = parameters
|
|
661
|
-
const client = config.getClient({ chainId })
|
|
662
|
-
return viem_Actions.getOrders(client, rest)
|
|
663
|
-
}
|
|
664
|
-
|
|
665
|
-
export namespace getOrders {
|
|
666
|
-
export type Parameters<config extends Config> = ChainIdParameter<config> &
|
|
667
|
-
viem_Actions.getOrders.Parameters
|
|
668
|
-
|
|
669
|
-
export type ReturnValue = viem_Actions.getOrders.ReturnValue
|
|
670
|
-
|
|
671
|
-
export function queryKey<config extends Config>(
|
|
672
|
-
parameters: Parameters<config>,
|
|
673
|
-
) {
|
|
674
|
-
return ['getOrders', parameters] as const
|
|
675
|
-
}
|
|
676
|
-
|
|
677
|
-
export type QueryKey<config extends Config> = ReturnType<
|
|
678
|
-
typeof queryKey<config>
|
|
679
|
-
>
|
|
680
|
-
|
|
681
|
-
export function infiniteQueryOptions<
|
|
682
|
-
config extends Config,
|
|
683
|
-
selectData = ReturnValue,
|
|
684
|
-
>(
|
|
685
|
-
config: Config,
|
|
686
|
-
parameters: infiniteQueryOptions.Parameters<config, selectData>,
|
|
687
|
-
): infiniteQueryOptions.ReturnValue<config, selectData> {
|
|
688
|
-
const { cursor, query, ...rest } = parameters
|
|
689
|
-
return {
|
|
690
|
-
pages: 1,
|
|
691
|
-
...query,
|
|
692
|
-
getNextPageParam: (x) => x.nextCursor,
|
|
693
|
-
initialPageParam: cursor ?? undefined,
|
|
694
|
-
queryKey: queryKey(rest),
|
|
695
|
-
async queryFn({ queryKey, pageParam: cursor }) {
|
|
696
|
-
const [, parameters] = queryKey
|
|
697
|
-
return await getOrders(config, { ...parameters, cursor })
|
|
698
|
-
},
|
|
699
|
-
}
|
|
700
|
-
}
|
|
701
|
-
|
|
702
|
-
export declare namespace infiniteQueryOptions {
|
|
703
|
-
export type Parameters<
|
|
704
|
-
config extends Config,
|
|
705
|
-
selectData = getOrders.ReturnValue,
|
|
706
|
-
> = getOrders.Parameters<config> & {
|
|
707
|
-
query?:
|
|
708
|
-
| Omit<
|
|
709
|
-
ReturnValue<config, selectData>,
|
|
710
|
-
'initialPageParam' | 'queryKey' | 'queryFn'
|
|
711
|
-
>
|
|
712
|
-
| undefined
|
|
713
|
-
}
|
|
714
|
-
|
|
715
|
-
export type ReturnValue<
|
|
716
|
-
config extends Config,
|
|
717
|
-
selectData = getOrders.ReturnValue,
|
|
718
|
-
> = UnionRequiredBy<
|
|
719
|
-
Query.FetchInfiniteQueryOptions<
|
|
720
|
-
getOrders.ReturnValue,
|
|
721
|
-
Query.DefaultError,
|
|
722
|
-
selectData,
|
|
723
|
-
getOrders.QueryKey<config>,
|
|
724
|
-
Hex.Hex | undefined
|
|
725
|
-
>,
|
|
726
|
-
'queryKey' | 'queryFn'
|
|
727
|
-
>
|
|
728
|
-
}
|
|
729
|
-
}
|
|
730
|
-
|
|
731
621
|
/**
|
|
732
622
|
* Gets orderbook information for a trading pair.
|
|
733
623
|
*
|
|
@@ -21,7 +21,7 @@ describe('getNonce', () => {
|
|
|
21
21
|
account: account.address,
|
|
22
22
|
nonceKey: 1n,
|
|
23
23
|
})
|
|
24
|
-
expect(result).toBe(
|
|
24
|
+
expect(result).toBe(0n)
|
|
25
25
|
})
|
|
26
26
|
|
|
27
27
|
describe('queryOptions', () => {
|
|
@@ -31,7 +31,7 @@ describe('getNonce', () => {
|
|
|
31
31
|
nonceKey: 1n,
|
|
32
32
|
})
|
|
33
33
|
const result = await queryClient.fetchQuery(options)
|
|
34
|
-
expect(result).toBe(
|
|
34
|
+
expect(result).toBe(0n)
|
|
35
35
|
})
|
|
36
36
|
})
|
|
37
37
|
})
|
|
@@ -112,6 +112,10 @@ describe('watchActiveKeyCountChanged', () => {
|
|
|
112
112
|
},
|
|
113
113
|
})
|
|
114
114
|
|
|
115
|
+
const priorKeyCount = await getNonceKeyCount(config, {
|
|
116
|
+
account: account.address,
|
|
117
|
+
})
|
|
118
|
+
|
|
115
119
|
// First use of nonceKey 10 should increment active key count
|
|
116
120
|
await token.transferSync(config, {
|
|
117
121
|
to: account2.address,
|
|
@@ -134,8 +138,8 @@ describe('watchActiveKeyCountChanged', () => {
|
|
|
134
138
|
|
|
135
139
|
expect(events).toHaveLength(2)
|
|
136
140
|
expect(events[0]?.account).toBe(account.address)
|
|
137
|
-
expect(events[0]?.newCount).toBe(1n)
|
|
138
|
-
expect(events[1]?.newCount).toBe(2n)
|
|
141
|
+
expect(events[0]?.newCount - priorKeyCount).toBe(1n)
|
|
142
|
+
expect(events[1]?.newCount - priorKeyCount).toBe(2n)
|
|
139
143
|
unwatch()
|
|
140
144
|
})
|
|
141
145
|
})
|
|
@@ -74,7 +74,7 @@ describe('getMetadata', () => {
|
|
|
74
74
|
"quoteToken": "0x20C0000000000000000000000000000000000000",
|
|
75
75
|
"supplyCap": 340282366920938463463374607431768211455n,
|
|
76
76
|
"symbol": "AlphaUSD",
|
|
77
|
-
"totalSupply":
|
|
77
|
+
"totalSupply": 202914184810805067765n,
|
|
78
78
|
"transferPolicyId": 1n,
|
|
79
79
|
}
|
|
80
80
|
`)
|
|
@@ -96,7 +96,7 @@ describe('getMetadata', () => {
|
|
|
96
96
|
"quoteToken": "0x20C0000000000000000000000000000000000000",
|
|
97
97
|
"supplyCap": 340282366920938463463374607431768211455n,
|
|
98
98
|
"symbol": "AlphaUSD",
|
|
99
|
-
"totalSupply":
|
|
99
|
+
"totalSupply": 202914184810805067765n,
|
|
100
100
|
"transferPolicyId": 1n,
|
|
101
101
|
}
|
|
102
102
|
`)
|