viem 2.55.19 → 2.56.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/CHANGELOG.md +63 -0
- package/_cjs/chains/definitions/berachainBepolia.js +1 -1
- package/_cjs/errors/version.js +1 -1
- package/_cjs/errors/version.js.map +1 -1
- package/_cjs/tempo/Abis.js +4851 -2166
- package/_cjs/tempo/Abis.js.map +1 -1
- package/_cjs/tempo/Addresses.js +31 -1
- package/_cjs/tempo/Addresses.js.map +1 -1
- package/_cjs/tempo/Decorator.js +3 -2
- package/_cjs/tempo/Decorator.js.map +1 -1
- package/_cjs/tempo/Selectors.js +197 -61
- package/_cjs/tempo/Selectors.js.map +1 -1
- package/_cjs/tempo/Storage.js +6 -6
- package/_cjs/tempo/Storage.js.map +1 -1
- package/_cjs/tempo/Transport.js +21 -0
- package/_cjs/tempo/Transport.js.map +1 -1
- package/_cjs/tempo/Zone.js +51 -0
- package/_cjs/tempo/Zone.js.map +1 -0
- package/_cjs/tempo/actions/earn/deployment.js +59 -21
- package/_cjs/tempo/actions/earn/deployment.js.map +1 -1
- package/_cjs/tempo/actions/earn.js +2 -3
- package/_cjs/tempo/actions/earn.js.map +1 -1
- package/_cjs/tempo/actions/zone.js +65 -28
- package/_cjs/tempo/actions/zone.js.map +1 -1
- package/_cjs/tempo/index.js +3 -3
- package/_cjs/tempo/index.js.map +1 -1
- package/_esm/chains/definitions/berachainBepolia.js +1 -1
- package/_esm/errors/version.js +1 -1
- package/_esm/errors/version.js.map +1 -1
- package/_esm/tempo/Abis.js +5419 -2732
- package/_esm/tempo/Abis.js.map +1 -1
- package/_esm/tempo/Addresses.js +36 -0
- package/_esm/tempo/Addresses.js.map +1 -1
- package/_esm/tempo/Decorator.js +3 -2
- package/_esm/tempo/Decorator.js.map +1 -1
- package/_esm/tempo/Selectors.js +197 -61
- package/_esm/tempo/Selectors.js.map +1 -1
- package/_esm/tempo/Storage.js +7 -7
- package/_esm/tempo/Storage.js.map +1 -1
- package/_esm/tempo/Transport.js +37 -0
- package/_esm/tempo/Transport.js.map +1 -1
- package/_esm/tempo/Zone.js +48 -0
- package/_esm/tempo/Zone.js.map +1 -0
- package/_esm/tempo/actions/earn/deployment.js +66 -25
- package/_esm/tempo/actions/earn/deployment.js.map +1 -1
- package/_esm/tempo/actions/earn.js +2 -3
- package/_esm/tempo/actions/earn.js.map +1 -1
- package/_esm/tempo/actions/zone.js +111 -66
- package/_esm/tempo/actions/zone.js.map +1 -1
- package/_esm/tempo/index.js +2 -2
- package/_esm/tempo/index.js.map +1 -1
- package/_types/chains/definitions/berachainBepolia.d.ts +1 -1
- package/_types/errors/version.d.ts +1 -1
- package/_types/errors/version.d.ts.map +1 -1
- package/_types/tempo/Abis.d.ts +31049 -6004
- package/_types/tempo/Abis.d.ts.map +1 -1
- package/_types/tempo/Addresses.d.ts +11 -0
- package/_types/tempo/Addresses.d.ts.map +1 -1
- package/_types/tempo/Decorator.d.ts +30 -22
- package/_types/tempo/Decorator.d.ts.map +1 -1
- package/_types/tempo/Selectors.d.ts +196 -60
- package/_types/tempo/Selectors.d.ts.map +1 -1
- package/_types/tempo/Storage.d.ts +1 -1
- package/_types/tempo/Storage.d.ts.map +1 -1
- package/_types/tempo/Transport.d.ts +24 -0
- package/_types/tempo/Transport.d.ts.map +1 -1
- package/_types/tempo/Zone.d.ts +6824 -0
- package/_types/tempo/Zone.d.ts.map +1 -0
- package/_types/tempo/actions/channel.d.ts +72 -0
- package/_types/tempo/actions/channel.d.ts.map +1 -1
- package/_types/tempo/actions/dex.d.ts +260 -0
- package/_types/tempo/actions/dex.d.ts.map +1 -1
- package/_types/tempo/actions/earn/deployment.d.ts +86 -278
- package/_types/tempo/actions/earn/deployment.d.ts.map +1 -1
- package/_types/tempo/actions/earn.d.ts +540 -16
- package/_types/tempo/actions/earn.d.ts.map +1 -1
- package/_types/tempo/actions/policy.d.ts +108 -0
- package/_types/tempo/actions/policy.d.ts.map +1 -1
- package/_types/tempo/actions/receivePolicy.d.ts +27 -0
- package/_types/tempo/actions/receivePolicy.d.ts.map +1 -1
- package/_types/tempo/actions/zone.d.ts +165 -82
- package/_types/tempo/actions/zone.d.ts.map +1 -1
- package/_types/tempo/index.d.ts +8 -2
- package/_types/tempo/index.d.ts.map +1 -1
- package/chains/definitions/berachainBepolia.ts +1 -1
- package/errors/version.ts +1 -1
- package/package.json +1 -6
- package/tempo/Abis.ts +5408 -2710
- package/tempo/Addresses.ts +40 -0
- package/tempo/Decorator.ts +39 -28
- package/tempo/Selectors.ts +218 -71
- package/tempo/Storage.ts +5 -8
- package/tempo/Transport.ts +57 -0
- package/tempo/Zone.ts +60 -0
- package/tempo/actions/earn/deployment.ts +74 -30
- package/tempo/actions/earn.ts +2 -3
- package/tempo/actions/zone.ts +188 -84
- package/tempo/index.ts +19 -6
- package/_cjs/tempo/zones/Abis.js +0 -213
- package/_cjs/tempo/zones/Abis.js.map +0 -1
- package/_cjs/tempo/zones/Addresses.js +0 -17
- package/_cjs/tempo/zones/Addresses.js.map +0 -1
- package/_cjs/tempo/zones/index.js +0 -13
- package/_cjs/tempo/zones/index.js.map +0 -1
- package/_cjs/tempo/zones/transport.js +0 -24
- package/_cjs/tempo/zones/transport.js.map +0 -1
- package/_cjs/tempo/zones/zone.js +0 -82
- package/_cjs/tempo/zones/zone.js.map +0 -1
- package/_esm/tempo/zones/Abis.js +0 -210
- package/_esm/tempo/zones/Abis.js.map +0 -1
- package/_esm/tempo/zones/Addresses.js +0 -14
- package/_esm/tempo/zones/Addresses.js.map +0 -1
- package/_esm/tempo/zones/index.js +0 -6
- package/_esm/tempo/zones/index.js.map +0 -1
- package/_esm/tempo/zones/transport.js +0 -39
- package/_esm/tempo/zones/transport.js.map +0 -1
- package/_esm/tempo/zones/zone.js +0 -78
- package/_esm/tempo/zones/zone.js.map +0 -1
- package/_types/tempo/zones/Abis.d.ts +0 -383
- package/_types/tempo/zones/Abis.d.ts.map +0 -1
- package/_types/tempo/zones/Addresses.d.ts +0 -13
- package/_types/tempo/zones/Addresses.d.ts.map +0 -1
- package/_types/tempo/zones/index.d.ts +0 -5
- package/_types/tempo/zones/index.d.ts.map +0 -1
- package/_types/tempo/zones/transport.d.ts +0 -26
- package/_types/tempo/zones/transport.d.ts.map +0 -1
- package/_types/tempo/zones/zone.d.ts +0 -3176
- package/_types/tempo/zones/zone.d.ts.map +0 -1
- package/tempo/zones/Abis.ts +0 -211
- package/tempo/zones/Addresses.ts +0 -15
- package/tempo/zones/index.ts +0 -10
- package/tempo/zones/package.json +0 -6
- package/tempo/zones/transport.ts +0 -58
- package/tempo/zones/zone.ts +0 -113
package/tempo/Addresses.ts
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
import * as Hex from 'ox/Hex'
|
|
2
|
+
import { ZoneId } from 'ox/tempo'
|
|
3
|
+
|
|
4
|
+
const legacyZoneChainIdBase = 4_217_000_000
|
|
5
|
+
const legacyZoneChainIdLimit = 4_218_000_000
|
|
6
|
+
const mainnetZoneChainIdBase = ZoneId.toChainId(0)
|
|
7
|
+
const testnetZoneChainIdBase = ZoneId.toChainId(0, 42_431)
|
|
8
|
+
const zoneChainIdLimit = 2 ** 31
|
|
9
|
+
|
|
1
10
|
export const accountImplementation =
|
|
2
11
|
'0x7702c00000000000000000000000000000000000'
|
|
3
12
|
export const accountKeychain = '0xaAAAaaAA00000000000000000000000000000000'
|
|
@@ -16,4 +25,35 @@ export const tip20Factory = '0x20fc000000000000000000000000000000000000'
|
|
|
16
25
|
export const tip403Registry = '0x403c000000000000000000000000000000000000'
|
|
17
26
|
export const validator = '0xcccccccc00000000000000000000000000000000'
|
|
18
27
|
export const validatorV2 = '0xcccccccc00000000000000000000000000000001'
|
|
28
|
+
export const zoneFactory = '0x5aF2000000000000000000000000000000000000'
|
|
29
|
+
export const zoneMessenger = '0x5A4d000000000000000000000000000000000000'
|
|
19
30
|
export const zoneOutbox = '0x1c00000000000000000000000000000000000002'
|
|
31
|
+
export const zonePortalImplementation =
|
|
32
|
+
'0x5AD1000000000000000000000000000000000000'
|
|
33
|
+
export const zoneVerifier = '0x5a56000000000000000000000000000000000000'
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Returns the Zone portal address for a Zone ID or chain ID.
|
|
37
|
+
*
|
|
38
|
+
* @param id - Zone ID or chain ID.
|
|
39
|
+
* @returns The Zone portal address.
|
|
40
|
+
*/
|
|
41
|
+
export function zonePortal(id: number): `0x${string}` {
|
|
42
|
+
const zoneId = normalizeZoneId(id)
|
|
43
|
+
|
|
44
|
+
// TODO: Remove legacy Zone portal address compatibility.
|
|
45
|
+
if (zoneId === 6) return '0x7069DeC4E64Fd07334A0933eDe836C17259c9B23'
|
|
46
|
+
if (zoneId === 7) return '0x3F5296303400B56271b476F5A0B9cBF74350D6Ac'
|
|
47
|
+
const suffix = Hex.fromNumber(zoneId, { size: 8 }).slice(2)
|
|
48
|
+
return `0x5ad000000000000000000000${suffix}`
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function normalizeZoneId(id: number) {
|
|
52
|
+
if (id >= legacyZoneChainIdBase && id < legacyZoneChainIdLimit)
|
|
53
|
+
return id - legacyZoneChainIdBase
|
|
54
|
+
if (id >= testnetZoneChainIdBase && id < zoneChainIdLimit)
|
|
55
|
+
return ZoneId.fromChainId(id, 42_431)
|
|
56
|
+
if (id >= mainnetZoneChainIdBase && id < testnetZoneChainIdBase)
|
|
57
|
+
return ZoneId.fromChainId(id)
|
|
58
|
+
return id
|
|
59
|
+
}
|
package/tempo/Decorator.ts
CHANGED
|
@@ -1764,14 +1764,14 @@ type DecoratorBase<
|
|
|
1764
1764
|
createStackSync: (
|
|
1765
1765
|
parameters: earnActions.createStackSync.Parameters<chain, account>,
|
|
1766
1766
|
) => Promise<earnActions.createStackSync.ReturnValue>
|
|
1767
|
-
/** Binds an
|
|
1768
|
-
|
|
1769
|
-
parameters: earnActions.
|
|
1770
|
-
) => Promise<earnActions.
|
|
1771
|
-
/** Binds an
|
|
1772
|
-
|
|
1773
|
-
parameters: earnActions.
|
|
1774
|
-
) => Promise<earnActions.
|
|
1767
|
+
/** Binds an engine to its EarnVault. */
|
|
1768
|
+
bindEngine: (
|
|
1769
|
+
parameters: earnActions.bindEngine.Parameters<chain, account>,
|
|
1770
|
+
) => Promise<earnActions.bindEngine.ReturnValue>
|
|
1771
|
+
/** Binds an engine and waits for confirmation. */
|
|
1772
|
+
bindEngineSync: (
|
|
1773
|
+
parameters: earnActions.bindEngineSync.Parameters<chain, account>,
|
|
1774
|
+
) => Promise<earnActions.bindEngineSync.ReturnValue>
|
|
1775
1775
|
/** Deploys and binds a complete, resumable ERC-4626 Earn stack. */
|
|
1776
1776
|
deployErc4626StackSync: (
|
|
1777
1777
|
parameters: earnActions.deployErc4626StackSync.Parameters<chain, account>,
|
|
@@ -5511,17 +5511,32 @@ type DecoratorBase<
|
|
|
5511
5511
|
getEncryptionKey: (
|
|
5512
5512
|
parameters: zoneActions.getEncryptionKey.Parameters,
|
|
5513
5513
|
) => Promise<zoneActions.getEncryptionKey.ReturnValue>
|
|
5514
|
+
/**
|
|
5515
|
+
* Gets metadata and configuration for a zone portal.
|
|
5516
|
+
*
|
|
5517
|
+
* @example
|
|
5518
|
+
* ```ts
|
|
5519
|
+
* const info = await client.zone.getPortalInfo({
|
|
5520
|
+
* zoneId: 7,
|
|
5521
|
+
* })
|
|
5522
|
+
* ```
|
|
5523
|
+
*
|
|
5524
|
+
* @param parameters - Parameters.
|
|
5525
|
+
* @returns The portal metadata and configuration.
|
|
5526
|
+
*/
|
|
5527
|
+
getPortalInfo: (
|
|
5528
|
+
parameters: zoneActions.getPortalInfo.Parameters,
|
|
5529
|
+
) => Promise<zoneActions.getPortalInfo.ReturnValue>
|
|
5514
5530
|
/**
|
|
5515
5531
|
* Returns the authenticated account address and authorization token expiry.
|
|
5516
5532
|
*
|
|
5517
5533
|
* @example
|
|
5518
5534
|
* ```ts
|
|
5519
5535
|
* import { createClient } from 'viem'
|
|
5520
|
-
* import { http,
|
|
5521
|
-
* import { tempoActions } from 'viem/tempo'
|
|
5536
|
+
* import { http, tempoActions, Zone } from 'viem/tempo'
|
|
5522
5537
|
*
|
|
5523
5538
|
* const client = createClient({
|
|
5524
|
-
* chain:
|
|
5539
|
+
* chain: Zone.a,
|
|
5525
5540
|
* transport: http(),
|
|
5526
5541
|
* }).extend(tempoActions())
|
|
5527
5542
|
*
|
|
@@ -5537,11 +5552,10 @@ type DecoratorBase<
|
|
|
5537
5552
|
* @example
|
|
5538
5553
|
* ```ts
|
|
5539
5554
|
* import { createClient } from 'viem'
|
|
5540
|
-
* import { http,
|
|
5541
|
-
* import { tempoActions } from 'viem/tempo'
|
|
5555
|
+
* import { http, tempoActions, Zone } from 'viem/tempo'
|
|
5542
5556
|
*
|
|
5543
5557
|
* const client = createClient({
|
|
5544
|
-
* chain:
|
|
5558
|
+
* chain: Zone.a,
|
|
5545
5559
|
* transport: http(),
|
|
5546
5560
|
* }).extend(tempoActions())
|
|
5547
5561
|
*
|
|
@@ -5560,11 +5574,10 @@ type DecoratorBase<
|
|
|
5560
5574
|
* @example
|
|
5561
5575
|
* ```ts
|
|
5562
5576
|
* import { createClient } from 'viem'
|
|
5563
|
-
* import { http,
|
|
5564
|
-
* import { tempoActions } from 'viem/tempo'
|
|
5577
|
+
* import { http, tempoActions, Zone } from 'viem/tempo'
|
|
5565
5578
|
*
|
|
5566
5579
|
* const client = createClient({
|
|
5567
|
-
* chain:
|
|
5580
|
+
* chain: Zone.a,
|
|
5568
5581
|
* transport: http(),
|
|
5569
5582
|
* }).extend(tempoActions())
|
|
5570
5583
|
*
|
|
@@ -5591,12 +5604,11 @@ type DecoratorBase<
|
|
|
5591
5604
|
* ```ts
|
|
5592
5605
|
* import { createClient } from 'viem'
|
|
5593
5606
|
* import { privateKeyToAccount } from 'viem/accounts'
|
|
5594
|
-
* import { http,
|
|
5595
|
-
* import { tempoActions } from 'viem/tempo'
|
|
5607
|
+
* import { http, tempoActions, Zone } from 'viem/tempo'
|
|
5596
5608
|
*
|
|
5597
5609
|
* const client = createClient({
|
|
5598
5610
|
* account: privateKeyToAccount('0x...'),
|
|
5599
|
-
* chain:
|
|
5611
|
+
* chain: Zone.a,
|
|
5600
5612
|
* transport: http(),
|
|
5601
5613
|
* }).extend(tempoActions())
|
|
5602
5614
|
*
|
|
@@ -5635,12 +5647,11 @@ type DecoratorBase<
|
|
|
5635
5647
|
* ```ts
|
|
5636
5648
|
* import { createClient } from 'viem'
|
|
5637
5649
|
* import { privateKeyToAccount } from 'viem/accounts'
|
|
5638
|
-
* import { http,
|
|
5639
|
-
* import { tempoActions } from 'viem/tempo'
|
|
5650
|
+
* import { http, tempoActions, Zone } from 'viem/tempo'
|
|
5640
5651
|
*
|
|
5641
5652
|
* const client = createClient({
|
|
5642
5653
|
* account: privateKeyToAccount('0x...'),
|
|
5643
|
-
* chain:
|
|
5654
|
+
* chain: Zone.a,
|
|
5644
5655
|
* transport: http(),
|
|
5645
5656
|
* }).extend(tempoActions())
|
|
5646
5657
|
*
|
|
@@ -5705,12 +5716,11 @@ type DecoratorBase<
|
|
|
5705
5716
|
* ```ts
|
|
5706
5717
|
* import { createClient } from 'viem'
|
|
5707
5718
|
* import { privateKeyToAccount } from 'viem/accounts'
|
|
5708
|
-
* import { http,
|
|
5709
|
-
* import { tempoActions } from 'viem/tempo'
|
|
5719
|
+
* import { http, tempoActions, Zone } from 'viem/tempo'
|
|
5710
5720
|
*
|
|
5711
5721
|
* const client = createClient({
|
|
5712
5722
|
* account: privateKeyToAccount('0x...'),
|
|
5713
|
-
* chain:
|
|
5723
|
+
* chain: Zone.a,
|
|
5714
5724
|
* transport: http(),
|
|
5715
5725
|
* }).extend(tempoActions())
|
|
5716
5726
|
*
|
|
@@ -5966,8 +5976,8 @@ export function decorator() {
|
|
|
5966
5976
|
'watchOrderPlaced',
|
|
5967
5977
|
]),
|
|
5968
5978
|
earn: bindActions(client, earnActions, [
|
|
5969
|
-
'
|
|
5970
|
-
'
|
|
5979
|
+
'bindEngine',
|
|
5980
|
+
'bindEngineSync',
|
|
5971
5981
|
'configureExitSafePolicy',
|
|
5972
5982
|
'createErc4626Engine',
|
|
5973
5983
|
'createErc4626EngineSync',
|
|
@@ -6144,6 +6154,7 @@ export function decorator() {
|
|
|
6144
6154
|
'encryptedDepositSync',
|
|
6145
6155
|
'getAuthorizationTokenInfo',
|
|
6146
6156
|
'getEncryptionKey',
|
|
6157
|
+
'getPortalInfo',
|
|
6147
6158
|
'getWithdrawalFee',
|
|
6148
6159
|
'getZoneInfo',
|
|
6149
6160
|
'requestWithdrawal',
|
package/tempo/Selectors.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Generated with `pnpm gen:abis`. Do not modify manually.
|
|
1
|
+
// Generated with `pnpm gen:tempo-abis`. Do not modify manually.
|
|
2
2
|
|
|
3
3
|
import type { Abi, ExtractAbiFunctionNames } from 'abitype'
|
|
4
4
|
import type { Hex } from '../types/misc.js'
|
|
@@ -56,6 +56,11 @@ export const nativeMultisig = {
|
|
|
56
56
|
updateConfig: '0xe175d479',
|
|
57
57
|
} as const satisfies FunctionSelectors<typeof Abis.nativeMultisig>
|
|
58
58
|
|
|
59
|
+
export const currentCommittee = {
|
|
60
|
+
getCommitteeMembers: '0xb2a275f9',
|
|
61
|
+
setCommitteeMembers: '0x229bdd9c',
|
|
62
|
+
} as const satisfies FunctionSelectors<typeof Abis.currentCommittee>
|
|
63
|
+
|
|
59
64
|
export const nonce = {
|
|
60
65
|
getNonce: '0x89535803',
|
|
61
66
|
} as const satisfies FunctionSelectors<typeof Abis.nonce>
|
|
@@ -82,6 +87,8 @@ export const stablecoinDex = {
|
|
|
82
87
|
PRICE_SCALE: '0xc33f59d3',
|
|
83
88
|
TICK_SPACING: '0x46ca626b',
|
|
84
89
|
balanceOf: '0xf7888aec',
|
|
90
|
+
bookIndexForKey: '0x61285475',
|
|
91
|
+
bookKeyForIndex: '0x3c047a7a',
|
|
85
92
|
books: '0x0c0dee70',
|
|
86
93
|
cancel: '0x81649d06',
|
|
87
94
|
cancelStaleOrder: '0x928b0e7f',
|
|
@@ -95,6 +102,8 @@ export const stablecoinDex = {
|
|
|
95
102
|
priceToTick: '0x87b4e352',
|
|
96
103
|
quoteSwapExactAmountIn: '0xe7c98f1a',
|
|
97
104
|
quoteSwapExactAmountOut: '0x1576fa0e',
|
|
105
|
+
setBookIndex: '0xaecbd005',
|
|
106
|
+
storageCredits: '0x4d65338b',
|
|
98
107
|
swapExactAmountIn: '0xf8856c0f',
|
|
99
108
|
swapExactAmountOut: '0xf0122b75',
|
|
100
109
|
tickToPrice: '0x269a311d',
|
|
@@ -109,6 +118,62 @@ export const storageCredits = {
|
|
|
109
118
|
setMode: '0x21175b4a',
|
|
110
119
|
} as const satisfies FunctionSelectors<typeof Abis.storageCredits>
|
|
111
120
|
|
|
121
|
+
export const feeManager = {
|
|
122
|
+
collectedFees: '0x4c97f766',
|
|
123
|
+
distributeFees: '0xa6c07924',
|
|
124
|
+
setUserToken: '0xe7897444',
|
|
125
|
+
setValidatorToken: '0xb60d2ddb',
|
|
126
|
+
userTokens: '0xed498fa8',
|
|
127
|
+
validatorTokens: '0x6dc54a7a',
|
|
128
|
+
} as const satisfies FunctionSelectors<typeof Abis.feeManager>
|
|
129
|
+
|
|
130
|
+
export const feeAmm = {
|
|
131
|
+
M: '0x693f917e',
|
|
132
|
+
MIN_LIQUIDITY: '0x21b77d63',
|
|
133
|
+
N: '0xc9e525df',
|
|
134
|
+
SCALE: '0xeced5526',
|
|
135
|
+
burn: '0xfa291e53',
|
|
136
|
+
getPool: '0x531aa03e',
|
|
137
|
+
getPoolId: '0x2ef61c21',
|
|
138
|
+
liquidityBalances: '0x4fb5bf7f',
|
|
139
|
+
mint: '0xf1aa8cb8',
|
|
140
|
+
pools: '0xb5217bb4',
|
|
141
|
+
rebalanceSwap: '0x1bd94ac7',
|
|
142
|
+
totalSupply: '0xb524abcf',
|
|
143
|
+
} as const satisfies FunctionSelectors<typeof Abis.feeAmm>
|
|
144
|
+
|
|
145
|
+
export const tip20ChannelReserve = {
|
|
146
|
+
CLOSE_GRACE_PERIOD: '0x956c8327',
|
|
147
|
+
VOUCHER_TYPEHASH: '0x94739e87',
|
|
148
|
+
close: '0x73b57f74',
|
|
149
|
+
computeChannelId: '0x185eeeac',
|
|
150
|
+
domainSeparator: '0xf698da25',
|
|
151
|
+
getChannel: '0xeef95313',
|
|
152
|
+
getChannelState: '0xd18da8b1',
|
|
153
|
+
getChannelStatesBatch: '0xd1f4cda2',
|
|
154
|
+
getVoucherDigest: '0xf3b349e8',
|
|
155
|
+
open: '0xedc53b00',
|
|
156
|
+
requestClose: '0x675402e5',
|
|
157
|
+
settle: '0x97fb5104',
|
|
158
|
+
storageCredits: '0x4d65338b',
|
|
159
|
+
topUp: '0xdc48471e',
|
|
160
|
+
withdraw: '0x41e2c664',
|
|
161
|
+
} as const satisfies FunctionSelectors<typeof Abis.tip20ChannelReserve>
|
|
162
|
+
|
|
163
|
+
export const tip20Factory = {
|
|
164
|
+
createToken: {
|
|
165
|
+
'createToken(string,string,string,address,address,bytes32)': '0x68130445',
|
|
166
|
+
'createToken(string,string,string,address,address,bytes32,string)':
|
|
167
|
+
'0x5323d222',
|
|
168
|
+
},
|
|
169
|
+
getTokenAddress: '0x9ed7cd64',
|
|
170
|
+
isTIP20: '0x35ec42c9',
|
|
171
|
+
} as const satisfies FunctionSelectors<
|
|
172
|
+
typeof Abis.tip20Factory,
|
|
173
|
+
'createToken'
|
|
174
|
+
> &
|
|
175
|
+
OverloadedFunctionSelectors<'createToken'>
|
|
176
|
+
|
|
112
177
|
export const tip20 = {
|
|
113
178
|
BURN_BLOCKED_ROLE: '0x32ad9be8',
|
|
114
179
|
DOMAIN_SEPARATOR: '0x3644e515',
|
|
@@ -162,37 +227,6 @@ export const tip20 = {
|
|
|
162
227
|
userRewardInfo: '0x360b8ed9',
|
|
163
228
|
} as const satisfies FunctionSelectors<typeof Abis.tip20>
|
|
164
229
|
|
|
165
|
-
export const tip20ChannelReserve = {
|
|
166
|
-
CLOSE_GRACE_PERIOD: '0x956c8327',
|
|
167
|
-
VOUCHER_TYPEHASH: '0x94739e87',
|
|
168
|
-
close: '0x73b57f74',
|
|
169
|
-
computeChannelId: '0x185eeeac',
|
|
170
|
-
domainSeparator: '0xf698da25',
|
|
171
|
-
getChannel: '0xeef95313',
|
|
172
|
-
getChannelState: '0xd18da8b1',
|
|
173
|
-
getChannelStatesBatch: '0xd1f4cda2',
|
|
174
|
-
getVoucherDigest: '0xf3b349e8',
|
|
175
|
-
open: '0xedc53b00',
|
|
176
|
-
requestClose: '0x675402e5',
|
|
177
|
-
settle: '0x97fb5104',
|
|
178
|
-
topUp: '0xdc48471e',
|
|
179
|
-
withdraw: '0x41e2c664',
|
|
180
|
-
} as const satisfies FunctionSelectors<typeof Abis.tip20ChannelReserve>
|
|
181
|
-
|
|
182
|
-
export const tip20Factory = {
|
|
183
|
-
createToken: {
|
|
184
|
-
'createToken(string,string,string,address,address,bytes32)': '0x68130445',
|
|
185
|
-
'createToken(string,string,string,address,address,bytes32,string)':
|
|
186
|
-
'0x5323d222',
|
|
187
|
-
},
|
|
188
|
-
getTokenAddress: '0x9ed7cd64',
|
|
189
|
-
isTIP20: '0x35ec42c9',
|
|
190
|
-
} as const satisfies FunctionSelectors<
|
|
191
|
-
typeof Abis.tip20Factory,
|
|
192
|
-
'createToken'
|
|
193
|
-
> &
|
|
194
|
-
OverloadedFunctionSelectors<'createToken'>
|
|
195
|
-
|
|
196
230
|
export const tip403Registry = {
|
|
197
231
|
compoundPolicyData: '0xb6266019',
|
|
198
232
|
createCompoundPolicy: '0x5da414ee',
|
|
@@ -202,6 +236,7 @@ export const tip403Registry = {
|
|
|
202
236
|
isAuthorizedMintRecipient: '0xb389e305',
|
|
203
237
|
isAuthorizedRecipient: '0x6fbc13d6',
|
|
204
238
|
isAuthorizedSender: '0x14abd81d',
|
|
239
|
+
migrateTransferPolicyIds: '0xa783dc99',
|
|
205
240
|
modifyPolicyBlacklist: '0xc62b27d4',
|
|
206
241
|
modifyPolicyWhitelist: '0x71ec67a3',
|
|
207
242
|
policyData: '0x50214329',
|
|
@@ -210,48 +245,10 @@ export const tip403Registry = {
|
|
|
210
245
|
receivePolicy: '0xe111e611',
|
|
211
246
|
setPolicyAdmin: '0x25f7d376',
|
|
212
247
|
setReceivePolicy: '0xdda03d86',
|
|
248
|
+
tokenTransferPolicyId: '0x23143aff',
|
|
213
249
|
validateReceivePolicy: '0xb72b0c59',
|
|
214
250
|
} as const satisfies FunctionSelectors<typeof Abis.tip403Registry>
|
|
215
251
|
|
|
216
|
-
export const feeManager = {
|
|
217
|
-
collectedFees: '0x4c97f766',
|
|
218
|
-
distributeFees: '0xa6c07924',
|
|
219
|
-
setUserToken: '0xe7897444',
|
|
220
|
-
setValidatorToken: '0xb60d2ddb',
|
|
221
|
-
userTokens: '0xed498fa8',
|
|
222
|
-
validatorTokens: '0x6dc54a7a',
|
|
223
|
-
} as const satisfies FunctionSelectors<typeof Abis.feeManager>
|
|
224
|
-
|
|
225
|
-
export const feeAmm = {
|
|
226
|
-
M: '0x693f917e',
|
|
227
|
-
MIN_LIQUIDITY: '0x21b77d63',
|
|
228
|
-
N: '0xc9e525df',
|
|
229
|
-
SCALE: '0xeced5526',
|
|
230
|
-
burn: '0xfa291e53',
|
|
231
|
-
getPool: '0x531aa03e',
|
|
232
|
-
getPoolId: '0x2ef61c21',
|
|
233
|
-
liquidityBalances: '0x4fb5bf7f',
|
|
234
|
-
mint: '0xf1aa8cb8',
|
|
235
|
-
pools: '0xb5217bb4',
|
|
236
|
-
rebalanceSwap: '0x1bd94ac7',
|
|
237
|
-
totalSupply: '0xb524abcf',
|
|
238
|
-
} as const satisfies FunctionSelectors<typeof Abis.feeAmm>
|
|
239
|
-
|
|
240
|
-
export const validatorConfig = {
|
|
241
|
-
addValidator: '0xffb4822e',
|
|
242
|
-
changeOwner: '0xa6f9dae1',
|
|
243
|
-
changeValidatorStatus: '0xa1b3f4a9',
|
|
244
|
-
changeValidatorStatusByIndex: '0x5aa3d0e1',
|
|
245
|
-
getNextFullDkgCeremony: '0x281a69ec',
|
|
246
|
-
getValidators: '0xb7ab4db5',
|
|
247
|
-
owner: '0x8da5cb5b',
|
|
248
|
-
setNextFullDkgCeremony: '0xc3576d46',
|
|
249
|
-
updateValidator: '0x09970c76',
|
|
250
|
-
validatorCount: '0x0f43a677',
|
|
251
|
-
validators: '0xfa52c7d8',
|
|
252
|
-
validatorsArray: '0x031fadbd',
|
|
253
|
-
} as const satisfies FunctionSelectors<typeof Abis.validatorConfig>
|
|
254
|
-
|
|
255
252
|
export const validatorConfigV2 = {
|
|
256
253
|
addValidator: '0x6dcf616a',
|
|
257
254
|
deactivateValidator: '0x8f289544',
|
|
@@ -273,3 +270,153 @@ export const validatorConfigV2 = {
|
|
|
273
270
|
validatorByPublicKey: '0x1b425d5e',
|
|
274
271
|
validatorCount: '0x0f43a677',
|
|
275
272
|
} as const satisfies FunctionSelectors<typeof Abis.validatorConfigV2>
|
|
273
|
+
|
|
274
|
+
export const validatorConfig = {
|
|
275
|
+
addValidator: '0xffb4822e',
|
|
276
|
+
changeOwner: '0xa6f9dae1',
|
|
277
|
+
changeValidatorStatus: '0xa1b3f4a9',
|
|
278
|
+
changeValidatorStatusByIndex: '0x5aa3d0e1',
|
|
279
|
+
getNextFullDkgCeremony: '0x281a69ec',
|
|
280
|
+
getValidators: '0xb7ab4db5',
|
|
281
|
+
owner: '0x8da5cb5b',
|
|
282
|
+
setNextFullDkgCeremony: '0xc3576d46',
|
|
283
|
+
updateValidator: '0x09970c76',
|
|
284
|
+
validatorCount: '0x0f43a677',
|
|
285
|
+
validators: '0xfa52c7d8',
|
|
286
|
+
validatorsArray: '0x031fadbd',
|
|
287
|
+
} as const satisfies FunctionSelectors<typeof Abis.validatorConfig>
|
|
288
|
+
|
|
289
|
+
export const zoneFactory = {
|
|
290
|
+
createZone: {
|
|
291
|
+
'createZone((address,address,address,address,(bytes32,bytes32,uint64),string))':
|
|
292
|
+
'0x2d45796a',
|
|
293
|
+
'createZone((address,bool,bool,address[],address[],address,address[],uint8,string))':
|
|
294
|
+
'0x89677d9e',
|
|
295
|
+
},
|
|
296
|
+
isZonePortal: '0x01b290d3',
|
|
297
|
+
nextZoneId: '0x266db436',
|
|
298
|
+
owner: '0x8da5cb5b',
|
|
299
|
+
transferOwnership: '0xf2fde38b',
|
|
300
|
+
verifier: '0x2b7ac3f3',
|
|
301
|
+
zones: '0x90b7f6fd',
|
|
302
|
+
} as const satisfies FunctionSelectors<typeof Abis.zoneFactory, 'createZone'> &
|
|
303
|
+
OverloadedFunctionSelectors<'createZone'>
|
|
304
|
+
|
|
305
|
+
export const zonePortal = {
|
|
306
|
+
FIXED_DEPOSIT_GAS: '0xf706cfbf',
|
|
307
|
+
MAX_DEPOSITS_PER_TEMPO_BLOCK: '0x1bf00ca8',
|
|
308
|
+
MAX_GAS_FEE_RATE: '0xf490ca96',
|
|
309
|
+
MAX_TOKENS_ENABLED_PER_TEMPO_BLOCK: '0x3fcf7df4',
|
|
310
|
+
MAX_TOKEN_METADATA_BYTES: '0x996329a2',
|
|
311
|
+
MAX_WITHDRAWAL_GAS_LIMIT: '0x86f47e55',
|
|
312
|
+
abdicate: '0xbf4c5411',
|
|
313
|
+
abdicationEffectiveAt: '0x04a3b098',
|
|
314
|
+
acceptAdmin: '0x0e18b681',
|
|
315
|
+
admin: '0xf851a440',
|
|
316
|
+
areDepositsActive: '0x37f981d8',
|
|
317
|
+
blockHash: '0xf22a195e',
|
|
318
|
+
bouncebackGas: '0xfb2f1206',
|
|
319
|
+
calculateBouncebackFee: '0x83a146b3',
|
|
320
|
+
calculateDepositFee: '0x8976248d',
|
|
321
|
+
claimRefund: '0xbffa55d5',
|
|
322
|
+
currentDepositQueueHash: '0x45c5d2fb',
|
|
323
|
+
deliverWithdrawal: '0x005d97ef',
|
|
324
|
+
deposit: {
|
|
325
|
+
'deposit(address,address,uint128,bytes32,address)': '0x09a0a234',
|
|
326
|
+
'deposit(address,uint128,uint256,(bytes32,uint8,bytes,bytes12,bytes16),address)':
|
|
327
|
+
'0x03dd6f34',
|
|
328
|
+
},
|
|
329
|
+
depositCount: '0x2dfdf0b5',
|
|
330
|
+
depositEncrypted: '0xb01f22e4',
|
|
331
|
+
enableToken: '0xc690908a',
|
|
332
|
+
enabledTokenAt: '0xb02690f2',
|
|
333
|
+
enabledTokenCount: '0xe4717849',
|
|
334
|
+
encryptionKeyAt: '0x9a97784b',
|
|
335
|
+
encryptionKeyAtBlock: '0x39dc015d',
|
|
336
|
+
encryptionKeyCount: '0x4256ce38',
|
|
337
|
+
hasRole: '0x95a8c58d',
|
|
338
|
+
initialize: '0x86829b82',
|
|
339
|
+
isAccessEnforced: '0x71649b6e',
|
|
340
|
+
isEncryptionKeyValid: '0x9ecd4cc0',
|
|
341
|
+
isGatewayOpen: '0x1b32199b',
|
|
342
|
+
isSequencer: '0x6d46e987',
|
|
343
|
+
isTokenEnabled: '0x748538d9',
|
|
344
|
+
lastProcessedDepositNumber: '0xe84abe69',
|
|
345
|
+
lastSyncedTempoBlockNumber: '0xbe2a63ee',
|
|
346
|
+
leader: '0x40eedabb',
|
|
347
|
+
leaderActivationTempoBlock: '0xb83c755f',
|
|
348
|
+
leaderEpoch: '0x3a6b889b',
|
|
349
|
+
maxTempoGasRate: '0x8d8bd5fb',
|
|
350
|
+
messenger: '0x3cb747bf',
|
|
351
|
+
pause: '0x8456cb59',
|
|
352
|
+
pauseDeposits: '0x27c71b50',
|
|
353
|
+
pauseExpiry: '0xf125af6b',
|
|
354
|
+
paused: '0x5c975abb',
|
|
355
|
+
pendingAdmin: '0x26782247',
|
|
356
|
+
processWithdrawals: '0x91aa3f04',
|
|
357
|
+
refunds: '0x857e85f8',
|
|
358
|
+
resume: '0x046f7da2',
|
|
359
|
+
resumeDeposits: '0x00ebfdb4',
|
|
360
|
+
rpcUrl: '0x959f47c3',
|
|
361
|
+
sequencerAt: '0x129c8240',
|
|
362
|
+
sequencerCount: '0x84b71123',
|
|
363
|
+
sequencerEncryptionKey: '0x3488ce0d',
|
|
364
|
+
sequencerSetVersion: '0x83888ecc',
|
|
365
|
+
sequencerThreshold: '0x1950dd11',
|
|
366
|
+
setAccessMode: '0xf6087442',
|
|
367
|
+
setAllowedAccount: '0x90f59598',
|
|
368
|
+
setBouncebackGas: '0xe09eae10',
|
|
369
|
+
setGateway: '0x10cea857',
|
|
370
|
+
setGatewayMode: '0x0f3804b8',
|
|
371
|
+
setLeader: '0x4fdf2ec2',
|
|
372
|
+
setMaxTempoGasRate: '0x78d8599e',
|
|
373
|
+
setPauseGuardian: '0x35577962',
|
|
374
|
+
setRpcUrl: '0x652ef10b',
|
|
375
|
+
setSequencerEncryptionKey: '0xef10b187',
|
|
376
|
+
setSequencerSet: '0x86012b45',
|
|
377
|
+
setZoneGasRate: '0x0e86bbdc',
|
|
378
|
+
submitBatch: '0x78fb159b',
|
|
379
|
+
tokenConfig: '0xfe136c4e',
|
|
380
|
+
tokenEnablementHash: '0xb456c0dd',
|
|
381
|
+
transferAdmin: '0x75829def',
|
|
382
|
+
verifier: '0x2b7ac3f3',
|
|
383
|
+
withdrawalBatchIndex: '0x2c37826e',
|
|
384
|
+
withdrawalQueueHead: '0x94ce88b0',
|
|
385
|
+
withdrawalQueueSlot: '0xcfaabb4d',
|
|
386
|
+
withdrawalQueueTail: '0x8081a8b2',
|
|
387
|
+
zoneGasRate: '0xecf79a4e',
|
|
388
|
+
zoneHeight: '0x430f8b4f',
|
|
389
|
+
zoneId: '0xd179978a',
|
|
390
|
+
} as const satisfies FunctionSelectors<typeof Abis.zonePortal, 'deposit'> &
|
|
391
|
+
OverloadedFunctionSelectors<'deposit'>
|
|
392
|
+
|
|
393
|
+
export const zoneOutbox = {
|
|
394
|
+
AUTHENTICATED_WITHDRAWAL_CIPHERTEXT_LENGTH: '0x43c3cb83',
|
|
395
|
+
MAX_CALLBACK_DATA_SIZE: '0x53a8d739',
|
|
396
|
+
MAX_WITHDRAWAL_GAS_LIMIT: '0x86f47e55',
|
|
397
|
+
REVEAL_TO_KEY_LENGTH: '0x378fa8fa',
|
|
398
|
+
WITHDRAWAL_BASE_GAS: '0xc9b6ca9b',
|
|
399
|
+
calculateWithdrawalFee: '0x7b9c9aa4',
|
|
400
|
+
consumeFallbackRecipient: '0xa3a124c3',
|
|
401
|
+
enqueueDepositBounceBack: '0xe2e3ee5c',
|
|
402
|
+
finalizeWithdrawalBatch: '0xce7025e9',
|
|
403
|
+
getPendingWithdrawals: '0xc37fc8a8',
|
|
404
|
+
lastBatch: '0x48aa4108',
|
|
405
|
+
lastFallbackNonce: '0x3d1c5a93',
|
|
406
|
+
lastFinalizedTimestamp: '0x413e9cde',
|
|
407
|
+
maxWithdrawalsPerBlock: '0x545525f1',
|
|
408
|
+
nextWithdrawalIndex: '0xbba9282e',
|
|
409
|
+
pendingWithdrawalsCount: '0xd93af1d2',
|
|
410
|
+
requestWithdrawal: '0xb3b200aa',
|
|
411
|
+
setMaxWithdrawalsPerBlock: '0xb9d1fd68',
|
|
412
|
+
setTempoGasRate: '0x79fa3289',
|
|
413
|
+
tempoGasRate: '0x34065272',
|
|
414
|
+
} as const satisfies FunctionSelectors<typeof Abis.zoneOutbox>
|
|
415
|
+
|
|
416
|
+
export const zoneMessenger = {
|
|
417
|
+
relayMessage: '0x11da5261',
|
|
418
|
+
} as const satisfies FunctionSelectors<typeof Abis.zoneMessenger>
|
|
419
|
+
|
|
420
|
+
export const zoneVerifier = {
|
|
421
|
+
verify: '0x7106a43e',
|
|
422
|
+
} as const satisfies FunctionSelectors<typeof Abis.zoneVerifier>
|
package/tempo/Storage.ts
CHANGED
|
@@ -13,7 +13,7 @@ export type Storage = {
|
|
|
13
13
|
*
|
|
14
14
|
* @example
|
|
15
15
|
* ```ts
|
|
16
|
-
* import
|
|
16
|
+
* import { Storage } from 'viem/tempo'
|
|
17
17
|
*
|
|
18
18
|
* const storage = Storage.from(Storage.memory(), { key: 'tempo' })
|
|
19
19
|
* await storage.setItem('foo', 'bar')
|
|
@@ -107,12 +107,9 @@ let _default: Storage | undefined
|
|
|
107
107
|
*/
|
|
108
108
|
export function defaultStorage(): Storage {
|
|
109
109
|
if (_default) return _default
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
)
|
|
115
|
-
_default = session()
|
|
116
|
-
else _default = memory()
|
|
110
|
+
try {
|
|
111
|
+
if (globalThis.sessionStorage) _default = session()
|
|
112
|
+
} catch {}
|
|
113
|
+
_default ??= memory()
|
|
117
114
|
return _default
|
|
118
115
|
}
|
package/tempo/Transport.ts
CHANGED
|
@@ -12,10 +12,67 @@ import {
|
|
|
12
12
|
createTransport,
|
|
13
13
|
type Transport,
|
|
14
14
|
} from '../clients/transports/createTransport.js'
|
|
15
|
+
import {
|
|
16
|
+
type HttpTransport,
|
|
17
|
+
type HttpTransportConfig,
|
|
18
|
+
http as http_,
|
|
19
|
+
} from '../clients/transports/http.js'
|
|
15
20
|
import type { Chain } from '../types/chain.js'
|
|
16
21
|
import type { ChainConfig } from './chainConfig.js'
|
|
22
|
+
import type { Storage } from './Storage.js'
|
|
23
|
+
import * as Storage_ from './Storage.js'
|
|
17
24
|
import * as Transaction from './Transaction.js'
|
|
18
25
|
|
|
26
|
+
export type HttpConfig = Omit<
|
|
27
|
+
HttpTransportConfig,
|
|
28
|
+
'batch' | 'raw' | 'rpcSchema'
|
|
29
|
+
> & {
|
|
30
|
+
/** Storage for reading Zone authorization tokens. Defaults to sessionStorage (web) or memory (server). */
|
|
31
|
+
storage?: Storage | undefined
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Creates an HTTP transport with support for Zone authentication tokens.
|
|
36
|
+
*
|
|
37
|
+
* Reads the authorization token from Storage and injects the
|
|
38
|
+
* `X-Authorization-Token` header on every request.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```ts
|
|
42
|
+
* import { createPublicClient } from 'viem'
|
|
43
|
+
* import { http, Zone } from 'viem/tempo'
|
|
44
|
+
*
|
|
45
|
+
* const client = createPublicClient({
|
|
46
|
+
* chain: Zone.a,
|
|
47
|
+
* transport: http(),
|
|
48
|
+
* })
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
export function http(
|
|
52
|
+
url?: string | undefined,
|
|
53
|
+
config: HttpConfig = {},
|
|
54
|
+
): HttpTransport {
|
|
55
|
+
const { storage: storage_, onFetchRequest, ...rest } = config
|
|
56
|
+
const storage = storage_ ?? Storage_.defaultStorage()
|
|
57
|
+
|
|
58
|
+
return (config) =>
|
|
59
|
+
http_(url, {
|
|
60
|
+
...rest,
|
|
61
|
+
async onFetchRequest(request, init) {
|
|
62
|
+
const next = (await onFetchRequest?.(request, init)) ?? init
|
|
63
|
+
const headers = new Headers(next.headers)
|
|
64
|
+
|
|
65
|
+
const chainId = config.chain?.id
|
|
66
|
+
if (chainId) {
|
|
67
|
+
const token = (await storage.getItem(`auth:token:${chainId}`)) ?? null
|
|
68
|
+
if (token) headers.set('X-Authorization-Token', token)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return { ...next, headers }
|
|
72
|
+
},
|
|
73
|
+
})(config)
|
|
74
|
+
}
|
|
75
|
+
|
|
19
76
|
type RelayProxyParameters = {
|
|
20
77
|
/** Policy for how the relay should handle sponsored transactions. Defaults to `'sign-only'`. */
|
|
21
78
|
policy?: 'sign-only' | 'sign-and-broadcast' | undefined
|