viem 2.55.18 → 2.56.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 +67 -0
- package/_cjs/chains/definitions/berachainBepolia.js +1 -1
- package/_cjs/chains/definitions/morphTachyon.js +25 -0
- package/_cjs/chains/definitions/morphTachyon.js.map +1 -0
- package/_cjs/chains/definitions/morphTachyonTestnet.js +26 -0
- package/_cjs/chains/definitions/morphTachyonTestnet.js.map +1 -0
- package/_cjs/chains/definitions/ynxTestnet.js +26 -0
- package/_cjs/chains/definitions/ynxTestnet.js.map +1 -0
- package/_cjs/chains/index.js +13 -7
- package/_cjs/chains/index.js.map +1 -1
- package/_cjs/errors/version.js +1 -1
- package/_cjs/errors/version.js.map +1 -1
- package/_cjs/tempo/Abis.js +5314 -2528
- package/_cjs/tempo/Abis.js.map +1 -1
- package/_cjs/tempo/Account.js +188 -16
- package/_cjs/tempo/Account.js.map +1 -1
- package/_cjs/tempo/Addresses.js +32 -1
- package/_cjs/tempo/Addresses.js.map +1 -1
- package/_cjs/tempo/Decorator.js +11 -2
- package/_cjs/tempo/Decorator.js.map +1 -1
- package/_cjs/tempo/Formatters.js +1 -1
- package/_cjs/tempo/Formatters.js.map +1 -1
- package/_cjs/tempo/Selectors.js +203 -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/Transaction.js +31 -10
- package/_cjs/tempo/Transaction.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/accessKey.js +49 -8
- package/_cjs/tempo/actions/accessKey.js.map +1 -1
- 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/index.js +2 -1
- package/_cjs/tempo/actions/index.js.map +1 -1
- package/_cjs/tempo/actions/multisig.js +95 -0
- package/_cjs/tempo/actions/multisig.js.map +1 -0
- package/_cjs/tempo/actions/zone.js +65 -28
- package/_cjs/tempo/actions/zone.js.map +1 -1
- package/_cjs/tempo/chainConfig.js +58 -29
- package/_cjs/tempo/chainConfig.js.map +1 -1
- package/_cjs/tempo/index.js +3 -3
- package/_cjs/tempo/index.js.map +1 -1
- package/_cjs/tempo/internal/multisig.js +56 -0
- package/_cjs/tempo/internal/multisig.js.map +1 -0
- package/_esm/chains/definitions/berachainBepolia.js +1 -1
- package/_esm/chains/definitions/morphTachyon.js +22 -0
- package/_esm/chains/definitions/morphTachyon.js.map +1 -0
- package/_esm/chains/definitions/morphTachyonTestnet.js +23 -0
- package/_esm/chains/definitions/morphTachyonTestnet.js.map +1 -0
- package/_esm/chains/definitions/ynxTestnet.js +23 -0
- package/_esm/chains/definitions/ynxTestnet.js.map +1 -0
- package/_esm/chains/index.js +3 -0
- package/_esm/chains/index.js.map +1 -1
- package/_esm/errors/version.js +1 -1
- package/_esm/errors/version.js.map +1 -1
- package/_esm/tempo/Abis.js +5302 -2514
- package/_esm/tempo/Abis.js.map +1 -1
- package/_esm/tempo/Account.js +196 -66
- package/_esm/tempo/Account.js.map +1 -1
- package/_esm/tempo/Addresses.js +37 -0
- package/_esm/tempo/Addresses.js.map +1 -1
- package/_esm/tempo/Decorator.js +11 -2
- package/_esm/tempo/Decorator.js.map +1 -1
- package/_esm/tempo/Formatters.js +3 -6
- package/_esm/tempo/Formatters.js.map +1 -1
- package/_esm/tempo/Selectors.js +203 -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/Transaction.js +31 -10
- package/_esm/tempo/Transaction.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/accessKey.js +65 -23
- package/_esm/tempo/actions/accessKey.js.map +1 -1
- 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/index.js +1 -0
- package/_esm/tempo/actions/index.js.map +1 -1
- package/_esm/tempo/actions/multisig.js +245 -0
- package/_esm/tempo/actions/multisig.js.map +1 -0
- package/_esm/tempo/actions/zone.js +111 -66
- package/_esm/tempo/actions/zone.js.map +1 -1
- package/_esm/tempo/chainConfig.js +65 -35
- package/_esm/tempo/chainConfig.js.map +1 -1
- package/_esm/tempo/index.js +2 -2
- package/_esm/tempo/index.js.map +1 -1
- package/_esm/tempo/internal/multisig.js +56 -0
- package/_esm/tempo/internal/multisig.js.map +1 -0
- package/_types/chains/definitions/berachainBepolia.d.ts +1 -1
- package/_types/chains/definitions/morphTachyon.d.ts +51 -0
- package/_types/chains/definitions/morphTachyon.d.ts.map +1 -0
- package/_types/chains/definitions/morphTachyonTestnet.d.ts +51 -0
- package/_types/chains/definitions/morphTachyonTestnet.d.ts.map +1 -0
- package/_types/chains/definitions/tempo.d.ts +30 -2
- package/_types/chains/definitions/tempo.d.ts.map +1 -1
- package/_types/chains/definitions/tempoDevnet.d.ts +30 -2
- package/_types/chains/definitions/tempoDevnet.d.ts.map +1 -1
- package/_types/chains/definitions/tempoLocalnet.d.ts +30 -2
- package/_types/chains/definitions/tempoLocalnet.d.ts.map +1 -1
- package/_types/chains/definitions/tempoModerato.d.ts +30 -2
- package/_types/chains/definitions/tempoModerato.d.ts.map +1 -1
- package/_types/chains/definitions/ynxTestnet.d.ts +51 -0
- package/_types/chains/definitions/ynxTestnet.d.ts.map +1 -0
- package/_types/chains/index.d.ts +3 -0
- package/_types/chains/index.d.ts.map +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 +31485 -6119
- package/_types/tempo/Abis.d.ts.map +1 -1
- package/_types/tempo/Account.d.ts +42 -26
- package/_types/tempo/Account.d.ts.map +1 -1
- package/_types/tempo/Addresses.d.ts +12 -0
- package/_types/tempo/Addresses.d.ts.map +1 -1
- package/_types/tempo/Decorator.d.ts +62 -22
- package/_types/tempo/Decorator.d.ts.map +1 -1
- package/_types/tempo/Formatters.d.ts.map +1 -1
- package/_types/tempo/Selectors.d.ts +202 -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/Transaction.d.ts +17 -2
- package/_types/tempo/Transaction.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/accessKey.d.ts +35 -17
- package/_types/tempo/actions/accessKey.d.ts.map +1 -1
- 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/index.d.ts +1 -0
- package/_types/tempo/actions/index.d.ts.map +1 -1
- package/_types/tempo/actions/multisig.d.ts +472 -0
- package/_types/tempo/actions/multisig.d.ts.map +1 -0
- 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/chainConfig.d.ts +15 -1
- package/_types/tempo/chainConfig.d.ts.map +1 -1
- package/_types/tempo/index.d.ts +3 -2
- package/_types/tempo/index.d.ts.map +1 -1
- package/_types/tempo/internal/multisig.d.ts +13 -0
- package/_types/tempo/internal/multisig.d.ts.map +1 -0
- package/chains/definitions/berachainBepolia.ts +1 -1
- package/chains/definitions/morphTachyon.ts +22 -0
- package/chains/definitions/morphTachyonTestnet.ts +23 -0
- package/chains/definitions/ynxTestnet.ts +23 -0
- package/chains/index.ts +3 -0
- package/errors/version.ts +1 -1
- package/package.json +2 -7
- package/tempo/Abis.ts +5337 -2537
- package/tempo/Account.ts +329 -51
- package/tempo/Addresses.ts +41 -0
- package/tempo/Decorator.ts +89 -28
- package/tempo/Formatters.ts +4 -5
- package/tempo/Selectors.ts +225 -71
- package/tempo/Storage.ts +5 -8
- package/tempo/Transaction.ts +52 -12
- package/tempo/Transport.ts +57 -0
- package/tempo/Zone.ts +60 -0
- package/tempo/actions/accessKey.ts +128 -32
- package/tempo/actions/earn/deployment.ts +74 -30
- package/tempo/actions/earn.ts +2 -3
- package/tempo/actions/index.ts +1 -0
- package/tempo/actions/multisig.ts +356 -0
- package/tempo/actions/zone.ts +188 -84
- package/tempo/chainConfig.ts +82 -35
- package/tempo/index.ts +12 -6
- package/tempo/internal/multisig.ts +72 -0
- 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 -3092
- 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/chainConfig.ts
CHANGED
|
@@ -15,9 +15,14 @@ import { keccak256 } from '../utils/hash/keccak256.js'
|
|
|
15
15
|
import type { SerializeTransactionFn } from '../utils/transaction/serializeTransaction.js'
|
|
16
16
|
import type { Account, MultisigAccount } from './Account.js'
|
|
17
17
|
import { getMetadata } from './actions/accessKey.js'
|
|
18
|
+
import * as multisig from './actions/multisig.js'
|
|
18
19
|
import * as Formatters from './Formatters.js'
|
|
19
20
|
import type { Hardfork } from './Hardfork.js'
|
|
20
21
|
import * as Concurrent from './internal/concurrent.js'
|
|
22
|
+
import {
|
|
23
|
+
createMultisigStateResolver,
|
|
24
|
+
getMultisigOwnerStates,
|
|
25
|
+
} from './internal/multisig.js'
|
|
21
26
|
import * as Transaction from './Transaction.js'
|
|
22
27
|
|
|
23
28
|
const maxExpirySecs = 25
|
|
@@ -60,7 +65,10 @@ export const chainConfig = {
|
|
|
60
65
|
| undefined
|
|
61
66
|
feePayerSignature?: Transaction.TransactionSerializableTempo['feePayerSignature']
|
|
62
67
|
from?: Address | undefined
|
|
63
|
-
|
|
68
|
+
keyData?: Hex.Hex | undefined
|
|
69
|
+
keyType?: 'p256' | 'secp256k1' | 'webAuthn' | undefined
|
|
70
|
+
multisig?: Address | MultisigConfig.Config | undefined
|
|
71
|
+
multisigOwnerStates?: Transaction.TransactionRequestTempo['multisigOwnerStates']
|
|
64
72
|
signatures?: readonly unknown[] | undefined
|
|
65
73
|
}
|
|
66
74
|
|
|
@@ -82,36 +90,88 @@ export const chainConfig = {
|
|
|
82
90
|
return request as unknown as typeof r
|
|
83
91
|
}
|
|
84
92
|
|
|
85
|
-
// Native multisig (TIP-1061). The transaction sender is the
|
|
86
|
-
// multisig
|
|
87
|
-
//
|
|
88
|
-
//
|
|
89
|
-
// serializer auto-detects bootstrap (`init`) from `nonce == 0`.
|
|
93
|
+
// Native multisig (TIP-1061). The transaction sender is the stable
|
|
94
|
+
// multisig address, not a signing account. Initial configs support
|
|
95
|
+
// bootstrap; initialized accounts can be reconstructed from their
|
|
96
|
+
// address and resolved through the multisig precompile.
|
|
90
97
|
//
|
|
91
98
|
// The config is taken from an explicit `multisig` field, or inferred from
|
|
92
99
|
// a multisig account (so callers can just pass `account` to
|
|
93
100
|
// `prepareTransactionRequest` without also passing `multisig`).
|
|
94
|
-
const
|
|
101
|
+
const multisigIdentity =
|
|
95
102
|
request.multisig ??
|
|
96
103
|
(request.account?.source === 'multisig'
|
|
97
|
-
? (request.account as MultisigAccount).config
|
|
104
|
+
? ((request.account as MultisigAccount).config ??
|
|
105
|
+
request.account.address)
|
|
98
106
|
: undefined)
|
|
99
|
-
if (
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
107
|
+
if (multisigIdentity) {
|
|
108
|
+
const initialConfig =
|
|
109
|
+
typeof multisigIdentity === 'string'
|
|
110
|
+
? undefined
|
|
111
|
+
: MultisigConfig.from(multisigIdentity)
|
|
112
|
+
const multisigAddress =
|
|
113
|
+
typeof multisigIdentity === 'string'
|
|
114
|
+
? multisigIdentity
|
|
115
|
+
: MultisigConfig.getAddress(initialConfig!)
|
|
116
|
+
request.multisig = initialConfig ?? multisigIdentity
|
|
117
|
+
request.from = multisigAddress
|
|
118
|
+
// Key types are not part of the config, so conservatively model every
|
|
119
|
+
// approval as a maximum-size WebAuthn signature.
|
|
120
|
+
if (typeof request.keyType === 'undefined') {
|
|
121
|
+
request.keyType = 'webAuthn'
|
|
122
|
+
if (typeof request.keyData === 'undefined') request.keyData = '0x0578'
|
|
123
|
+
}
|
|
124
|
+
const getState = createMultisigStateResolver((account) =>
|
|
125
|
+
getAction(client, multisig.getConfig, 'getConfig')({ account }),
|
|
126
|
+
)
|
|
127
|
+
const ownerStates =
|
|
128
|
+
request.account?.source === 'multisig'
|
|
129
|
+
? getMultisigOwnerStates(
|
|
130
|
+
request.account as MultisigAccount,
|
|
131
|
+
getState,
|
|
132
|
+
)
|
|
133
|
+
: undefined
|
|
134
|
+
const state = ownerStates
|
|
135
|
+
? (await ownerStates)[0]!
|
|
136
|
+
: await getState(multisigAddress)
|
|
137
|
+
if (!initialConfig && !state.initialized)
|
|
138
|
+
throw new Error(
|
|
139
|
+
'Cannot prepare an uninitialized multisig account from an address. Provide its initial config instead.',
|
|
140
|
+
)
|
|
141
|
+
if (typeof request.multisigVersion === 'undefined')
|
|
142
|
+
request.multisigVersion = state.version
|
|
143
|
+
const authorizationSignature = request.keyAuthorization?.signature
|
|
144
|
+
if (
|
|
145
|
+
authorizationSignature?.type === 'multisig' &&
|
|
146
|
+
typeof authorizationSignature.init !== 'undefined'
|
|
147
|
+
)
|
|
148
|
+
request.keyAuthorization = {
|
|
149
|
+
...request.keyAuthorization!,
|
|
150
|
+
signature: SignatureEnvelope.from({
|
|
151
|
+
initialConfig: authorizationSignature.init,
|
|
152
|
+
signatures: authorizationSignature.signatures,
|
|
153
|
+
}),
|
|
154
|
+
}
|
|
155
|
+
const keyAuthorizationSignature = request.keyAuthorization?.signature
|
|
156
|
+
const keyAuthorizationInitializes =
|
|
157
|
+
keyAuthorizationSignature?.type === 'multisig' &&
|
|
158
|
+
typeof keyAuthorizationSignature.init !== 'undefined'
|
|
159
|
+
if (initialConfig && !keyAuthorizationInitializes)
|
|
160
|
+
request.multisigInit = {
|
|
161
|
+
salt: initialConfig.salt ?? MultisigConfig.zeroSalt,
|
|
162
|
+
threshold: Number(initialConfig.threshold),
|
|
163
|
+
owners: initialConfig.owners.map((owner) => ({
|
|
164
|
+
owner: owner.owner,
|
|
165
|
+
weight: Number(owner.weight),
|
|
166
|
+
})),
|
|
167
|
+
}
|
|
168
|
+
if (ownerStates) {
|
|
169
|
+
const states = await ownerStates
|
|
170
|
+
if (states.length > 0) request.multisigOwnerStates = states
|
|
110
171
|
}
|
|
111
|
-
request.multisigSignatureCount ??= inferMultisigSignatureCount(config)
|
|
112
172
|
// A non-multisig `account` (e.g. the client's default) isn't the sender,
|
|
113
173
|
// so drop it: core then fills nonce/gas/fees for the multisig sender via
|
|
114
|
-
// `request.from`. A multisig account *is* the sender
|
|
174
|
+
// `request.from`. A multisig account *is* the sender, so keep it so the
|
|
115
175
|
// prepared request can be sent without re-passing `account`.
|
|
116
176
|
if (request.account?.source !== 'multisig') delete request.account
|
|
117
177
|
}
|
|
@@ -121,7 +181,7 @@ export const chainConfig = {
|
|
|
121
181
|
const useExpiringNonce = await (async () => {
|
|
122
182
|
if (request.nonceKey === 'expiring' || request.nonceKey === maxUint256)
|
|
123
183
|
return true
|
|
124
|
-
if (
|
|
184
|
+
if (multisigIdentity) return false
|
|
125
185
|
if (request.feePayer && typeof request.nonceKey === 'undefined')
|
|
126
186
|
return true
|
|
127
187
|
const account = request.account as
|
|
@@ -286,16 +346,3 @@ export const chainConfig = {
|
|
|
286
346
|
} as const satisfies viem_ChainConfig & { blockTime: number }
|
|
287
347
|
|
|
288
348
|
export type ChainConfig = typeof chainConfig
|
|
289
|
-
|
|
290
|
-
function inferMultisigSignatureCount(config: MultisigConfig.Config) {
|
|
291
|
-
const threshold = Number(config.threshold)
|
|
292
|
-
const weights = config.owners
|
|
293
|
-
.map((owner) => Number(owner.weight))
|
|
294
|
-
.sort((a, b) => b - a)
|
|
295
|
-
let total = 0
|
|
296
|
-
for (const [index, weight] of weights.entries()) {
|
|
297
|
-
total += weight
|
|
298
|
-
if (total >= threshold) return index + 1
|
|
299
|
-
}
|
|
300
|
-
return weights.length
|
|
301
|
-
}
|
package/tempo/index.ts
CHANGED
|
@@ -35,11 +35,10 @@ export {
|
|
|
35
35
|
type FallbackTransportErrorType,
|
|
36
36
|
fallback,
|
|
37
37
|
} from '../clients/transports/fallback.js'
|
|
38
|
-
export {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
http,
|
|
38
|
+
export type {
|
|
39
|
+
HttpTransport,
|
|
40
|
+
HttpTransportConfig,
|
|
41
|
+
HttpTransportErrorType,
|
|
43
42
|
} from '../clients/transports/http.js'
|
|
44
43
|
export {
|
|
45
44
|
type WebSocketTransport,
|
|
@@ -106,6 +105,13 @@ export type {
|
|
|
106
105
|
} from './Transaction.js'
|
|
107
106
|
export * as Transaction from './Transaction.js'
|
|
108
107
|
export * as Transport from './Transport.js'
|
|
109
|
-
export {
|
|
108
|
+
export {
|
|
109
|
+
type HttpConfig,
|
|
110
|
+
http,
|
|
111
|
+
walletNamespaceCompat,
|
|
112
|
+
withFeePayer,
|
|
113
|
+
withRelay,
|
|
114
|
+
} from './Transport.js'
|
|
110
115
|
export * as WebAuthnP256 from './WebAuthnP256.js'
|
|
111
116
|
export * as WebCryptoP256 from './WebCryptoP256.js'
|
|
117
|
+
export * as Zone from './Zone.js'
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { Address } from 'abitype'
|
|
2
|
+
import type { MultisigConfig } from 'ox/tempo'
|
|
3
|
+
import { BaseError } from '../../errors/base.js'
|
|
4
|
+
import { ContractFunctionRevertedError } from '../../errors/contract.js'
|
|
5
|
+
import type { MultisigAccount } from '../Account.js'
|
|
6
|
+
import type { MultisigOwnerState } from '../Transaction.js'
|
|
7
|
+
|
|
8
|
+
/** @internal */
|
|
9
|
+
export function createMultisigStateResolver(
|
|
10
|
+
getConfig: (account: Address) => Promise<{
|
|
11
|
+
owners: MultisigConfig.Config['owners']
|
|
12
|
+
threshold: MultisigConfig.Config['threshold']
|
|
13
|
+
version: bigint
|
|
14
|
+
}>,
|
|
15
|
+
) {
|
|
16
|
+
// Cache only within one operation because config versions can change between requests.
|
|
17
|
+
const cache = new Map<Address, Promise<MultisigOwnerState>>()
|
|
18
|
+
return (account: Address): Promise<MultisigOwnerState> => {
|
|
19
|
+
const address = account.toLowerCase() as Address
|
|
20
|
+
const cached = cache.get(address)
|
|
21
|
+
if (cached) return cached
|
|
22
|
+
|
|
23
|
+
const state = (async () => {
|
|
24
|
+
try {
|
|
25
|
+
const config = await getConfig(account)
|
|
26
|
+
return {
|
|
27
|
+
account,
|
|
28
|
+
config: { owners: config.owners, threshold: config.threshold },
|
|
29
|
+
initialized: true,
|
|
30
|
+
version: config.version,
|
|
31
|
+
}
|
|
32
|
+
} catch (error) {
|
|
33
|
+
const cause =
|
|
34
|
+
error instanceof BaseError
|
|
35
|
+
? error.walk(
|
|
36
|
+
(error) => error instanceof ContractFunctionRevertedError,
|
|
37
|
+
)
|
|
38
|
+
: undefined
|
|
39
|
+
if (
|
|
40
|
+
!(cause instanceof ContractFunctionRevertedError) ||
|
|
41
|
+
cause.data?.errorName !== 'NotMultisigAccount'
|
|
42
|
+
)
|
|
43
|
+
throw error
|
|
44
|
+
return { account, initialized: false, version: 0n }
|
|
45
|
+
}
|
|
46
|
+
})()
|
|
47
|
+
cache.set(address, state)
|
|
48
|
+
return state
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** @internal */
|
|
53
|
+
export function getMultisigOwnerStates(
|
|
54
|
+
account: MultisigAccount,
|
|
55
|
+
getState: (account: Address) => Promise<MultisigOwnerState>,
|
|
56
|
+
): Promise<readonly MultisigOwnerState[]> {
|
|
57
|
+
// Collect locally first so all config reads start in one latency wave.
|
|
58
|
+
const owners: MultisigAccount[] = [account]
|
|
59
|
+
const seen = new Set<Address>([account.address.toLowerCase() as Address])
|
|
60
|
+
const visit = (account: MultisigAccount) => {
|
|
61
|
+
for (const owner of account.owners) {
|
|
62
|
+
if (owner.source !== 'multisig') continue
|
|
63
|
+
const address = owner.address.toLowerCase() as Address
|
|
64
|
+
if (seen.has(address)) continue
|
|
65
|
+
seen.add(address)
|
|
66
|
+
owners.push(owner as MultisigAccount)
|
|
67
|
+
visit(owner as MultisigAccount)
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
visit(account)
|
|
71
|
+
return Promise.all(owners.map((owner) => getState(owner.address)))
|
|
72
|
+
}
|
package/_cjs/tempo/zones/Abis.js
DELETED
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.zoneOutbox = exports.zonePortal = exports.zoneFactory = void 0;
|
|
4
|
-
exports.zoneFactory = [
|
|
5
|
-
{
|
|
6
|
-
type: 'event',
|
|
7
|
-
name: 'ZoneCreated',
|
|
8
|
-
inputs: [
|
|
9
|
-
{ name: 'zoneId', type: 'uint32', indexed: true },
|
|
10
|
-
{ name: 'portal', type: 'address', indexed: true },
|
|
11
|
-
{ name: 'initialToken', type: 'address', indexed: false },
|
|
12
|
-
{ name: 'accessMode', type: 'bool', indexed: false },
|
|
13
|
-
{ name: 'gatewayMode', type: 'bool', indexed: false },
|
|
14
|
-
{ name: 'admin', type: 'address', indexed: false },
|
|
15
|
-
{ name: 'sequencers', type: 'address[]', indexed: false },
|
|
16
|
-
{ name: 'threshold', type: 'uint8', indexed: false },
|
|
17
|
-
{ name: 'verifier', type: 'address', indexed: false },
|
|
18
|
-
],
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
type: 'event',
|
|
22
|
-
name: 'ZoneCreated',
|
|
23
|
-
inputs: [
|
|
24
|
-
{ name: 'zoneId', type: 'uint32', indexed: true },
|
|
25
|
-
{ name: 'portal', type: 'address', indexed: true },
|
|
26
|
-
{ name: 'messenger', type: 'address', indexed: true },
|
|
27
|
-
{ name: 'initialToken', type: 'address', indexed: false },
|
|
28
|
-
{ name: 'admin', type: 'address', indexed: false },
|
|
29
|
-
{ name: 'sequencer', type: 'address', indexed: false },
|
|
30
|
-
{ name: 'verifier', type: 'address', indexed: false },
|
|
31
|
-
{ name: 'genesisBlockHash', type: 'bytes32', indexed: false },
|
|
32
|
-
{ name: 'genesisTempoBlockHash', type: 'bytes32', indexed: false },
|
|
33
|
-
{
|
|
34
|
-
name: 'genesisTempoBlockNumber',
|
|
35
|
-
type: 'uint64',
|
|
36
|
-
indexed: false,
|
|
37
|
-
},
|
|
38
|
-
],
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
type: 'function',
|
|
42
|
-
name: 'createZone',
|
|
43
|
-
stateMutability: 'nonpayable',
|
|
44
|
-
inputs: [
|
|
45
|
-
{
|
|
46
|
-
name: 'params',
|
|
47
|
-
type: 'tuple',
|
|
48
|
-
components: [
|
|
49
|
-
{ name: 'initialToken', type: 'address' },
|
|
50
|
-
{ name: 'accessMode', type: 'bool' },
|
|
51
|
-
{ name: 'gatewayMode', type: 'bool' },
|
|
52
|
-
{ name: 'allowedAccounts', type: 'address[]' },
|
|
53
|
-
{ name: 'zoneGateways', type: 'address[]' },
|
|
54
|
-
{ name: 'admin', type: 'address' },
|
|
55
|
-
{ name: 'sequencers', type: 'address[]' },
|
|
56
|
-
{ name: 'threshold', type: 'uint8' },
|
|
57
|
-
{ name: 'rpcUrl', type: 'string' },
|
|
58
|
-
],
|
|
59
|
-
},
|
|
60
|
-
],
|
|
61
|
-
outputs: [
|
|
62
|
-
{ name: 'zoneId', type: 'uint32' },
|
|
63
|
-
{ name: 'portal', type: 'address' },
|
|
64
|
-
],
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
type: 'function',
|
|
68
|
-
name: 'createZone',
|
|
69
|
-
stateMutability: 'nonpayable',
|
|
70
|
-
inputs: [
|
|
71
|
-
{
|
|
72
|
-
name: 'params',
|
|
73
|
-
type: 'tuple',
|
|
74
|
-
components: [
|
|
75
|
-
{ name: 'initialToken', type: 'address' },
|
|
76
|
-
{ name: 'admin', type: 'address' },
|
|
77
|
-
{ name: 'sequencer', type: 'address' },
|
|
78
|
-
{ name: 'verifier', type: 'address' },
|
|
79
|
-
{
|
|
80
|
-
name: 'zoneParams',
|
|
81
|
-
type: 'tuple',
|
|
82
|
-
components: [
|
|
83
|
-
{ name: 'genesisBlockHash', type: 'bytes32' },
|
|
84
|
-
{ name: 'genesisTempoBlockHash', type: 'bytes32' },
|
|
85
|
-
{ name: 'genesisTempoBlockNumber', type: 'uint64' },
|
|
86
|
-
],
|
|
87
|
-
},
|
|
88
|
-
{ name: 'rpcUrl', type: 'string' },
|
|
89
|
-
],
|
|
90
|
-
},
|
|
91
|
-
],
|
|
92
|
-
outputs: [
|
|
93
|
-
{ name: 'zoneId', type: 'uint32' },
|
|
94
|
-
{ name: 'portal', type: 'address' },
|
|
95
|
-
],
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
type: 'function',
|
|
99
|
-
name: 'verifier',
|
|
100
|
-
stateMutability: 'view',
|
|
101
|
-
inputs: [],
|
|
102
|
-
outputs: [{ name: '', type: 'address' }],
|
|
103
|
-
},
|
|
104
|
-
];
|
|
105
|
-
exports.zonePortal = [
|
|
106
|
-
{
|
|
107
|
-
name: 'WithdrawalProcessed',
|
|
108
|
-
type: 'event',
|
|
109
|
-
inputs: [
|
|
110
|
-
{ name: 'to', type: 'address', indexed: true },
|
|
111
|
-
{ name: 'senderTag', type: 'bytes32', indexed: true },
|
|
112
|
-
{ name: 'token', type: 'address', indexed: false },
|
|
113
|
-
{ name: 'amount', type: 'uint128', indexed: false },
|
|
114
|
-
{ name: 'callbackSuccess', type: 'bool', indexed: false },
|
|
115
|
-
],
|
|
116
|
-
},
|
|
117
|
-
{
|
|
118
|
-
name: 'deposit',
|
|
119
|
-
type: 'function',
|
|
120
|
-
stateMutability: 'nonpayable',
|
|
121
|
-
inputs: [
|
|
122
|
-
{ name: '_token', type: 'address' },
|
|
123
|
-
{ name: 'to', type: 'address' },
|
|
124
|
-
{ name: 'amount', type: 'uint128' },
|
|
125
|
-
{ name: 'memo', type: 'bytes32' },
|
|
126
|
-
{ name: 'tempoRefundRecipient', type: 'address' },
|
|
127
|
-
],
|
|
128
|
-
outputs: [{ name: '', type: 'bytes32' }],
|
|
129
|
-
},
|
|
130
|
-
{
|
|
131
|
-
name: 'depositEncrypted',
|
|
132
|
-
type: 'function',
|
|
133
|
-
stateMutability: 'nonpayable',
|
|
134
|
-
inputs: [
|
|
135
|
-
{ name: 'token', type: 'address' },
|
|
136
|
-
{ name: 'amount', type: 'uint128' },
|
|
137
|
-
{ name: 'keyIndex', type: 'uint256' },
|
|
138
|
-
{
|
|
139
|
-
name: 'encrypted',
|
|
140
|
-
type: 'tuple',
|
|
141
|
-
components: [
|
|
142
|
-
{ name: 'ephemeralPubkeyX', type: 'bytes32' },
|
|
143
|
-
{ name: 'ephemeralPubkeyYParity', type: 'uint8' },
|
|
144
|
-
{ name: 'ciphertext', type: 'bytes' },
|
|
145
|
-
{ name: 'nonce', type: 'bytes12' },
|
|
146
|
-
{ name: 'tag', type: 'bytes16' },
|
|
147
|
-
],
|
|
148
|
-
},
|
|
149
|
-
{ name: 'tempoRefundRecipient', type: 'address' },
|
|
150
|
-
],
|
|
151
|
-
outputs: [{ name: '', type: 'bytes32' }],
|
|
152
|
-
},
|
|
153
|
-
{
|
|
154
|
-
name: 'sequencerEncryptionKey',
|
|
155
|
-
type: 'function',
|
|
156
|
-
stateMutability: 'view',
|
|
157
|
-
inputs: [],
|
|
158
|
-
outputs: [
|
|
159
|
-
{ name: 'x', type: 'bytes32' },
|
|
160
|
-
{ name: 'yParity', type: 'uint8' },
|
|
161
|
-
],
|
|
162
|
-
},
|
|
163
|
-
{
|
|
164
|
-
name: 'encryptionKeyCount',
|
|
165
|
-
type: 'function',
|
|
166
|
-
stateMutability: 'view',
|
|
167
|
-
inputs: [],
|
|
168
|
-
outputs: [{ name: '', type: 'uint256' }],
|
|
169
|
-
},
|
|
170
|
-
];
|
|
171
|
-
exports.zoneOutbox = [
|
|
172
|
-
{
|
|
173
|
-
name: 'WithdrawalRequested',
|
|
174
|
-
type: 'event',
|
|
175
|
-
inputs: [
|
|
176
|
-
{ name: 'withdrawalIndex', type: 'uint64', indexed: true },
|
|
177
|
-
{ name: 'sender', type: 'address', indexed: true },
|
|
178
|
-
{ name: 'token', type: 'address', indexed: false },
|
|
179
|
-
{ name: 'to', type: 'address', indexed: false },
|
|
180
|
-
{ name: 'amount', type: 'uint128', indexed: false },
|
|
181
|
-
{ name: 'fee', type: 'uint128', indexed: false },
|
|
182
|
-
{ name: 'memo', type: 'bytes32', indexed: false },
|
|
183
|
-
{ name: 'gasLimit', type: 'uint64', indexed: false },
|
|
184
|
-
{ name: 'fallbackNonce', type: 'uint64', indexed: false },
|
|
185
|
-
{ name: 'data', type: 'bytes', indexed: false },
|
|
186
|
-
{ name: 'revealTo', type: 'bytes', indexed: false },
|
|
187
|
-
],
|
|
188
|
-
},
|
|
189
|
-
{
|
|
190
|
-
name: 'requestWithdrawal',
|
|
191
|
-
type: 'function',
|
|
192
|
-
stateMutability: 'nonpayable',
|
|
193
|
-
inputs: [
|
|
194
|
-
{ name: 'token', type: 'address' },
|
|
195
|
-
{ name: 'to', type: 'address' },
|
|
196
|
-
{ name: 'amount', type: 'uint128' },
|
|
197
|
-
{ name: 'memo', type: 'bytes32' },
|
|
198
|
-
{ name: 'gasLimit', type: 'uint64' },
|
|
199
|
-
{ name: 'fallbackRecipient', type: 'address' },
|
|
200
|
-
{ name: 'data', type: 'bytes' },
|
|
201
|
-
{ name: 'revealTo', type: 'bytes' },
|
|
202
|
-
],
|
|
203
|
-
outputs: [],
|
|
204
|
-
},
|
|
205
|
-
{
|
|
206
|
-
name: 'calculateWithdrawalFee',
|
|
207
|
-
type: 'function',
|
|
208
|
-
stateMutability: 'view',
|
|
209
|
-
inputs: [{ name: 'gasLimit', type: 'uint64' }],
|
|
210
|
-
outputs: [{ name: 'fee', type: 'uint128' }],
|
|
211
|
-
},
|
|
212
|
-
];
|
|
213
|
-
//# sourceMappingURL=Abis.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Abis.js","sourceRoot":"","sources":["../../../tempo/zones/Abis.ts"],"names":[],"mappings":";;;AAAa,QAAA,WAAW,GAAG;IACzB;QACE,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,aAAa;QACnB,MAAM,EAAE;YACN,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE;YACjD,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE;YAClD,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE;YACzD,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE;YACpD,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE;YACrD,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,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E,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;KAC5C;CACO,CAAA"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.portal = exports.messenger = void 0;
|
|
4
|
-
const tempoModerato_js_1 = require("../../chains/definitions/tempoModerato.js");
|
|
5
|
-
exports.messenger = {
|
|
6
|
-
[tempoModerato_js_1.tempoModerato.id]: {
|
|
7
|
-
1: '0x254356112cCf6f32fAd84F16CC5E0A0cCA17Beb7',
|
|
8
|
-
},
|
|
9
|
-
};
|
|
10
|
-
exports.portal = {
|
|
11
|
-
[tempoModerato_js_1.tempoModerato.id]: {
|
|
12
|
-
1: '0x59831A17340EE14FE136d751EfbeA8b630470fD2',
|
|
13
|
-
6: '0x7069DeC4E64Fd07334A0933eDe836C17259c9B23',
|
|
14
|
-
7: '0x3F5296303400B56271b476F5A0B9cBF74350D6Ac',
|
|
15
|
-
},
|
|
16
|
-
};
|
|
17
|
-
//# sourceMappingURL=Addresses.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Addresses.js","sourceRoot":"","sources":["../../../tempo/zones/Addresses.ts"],"names":[],"mappings":";;;AAAA,gFAAyE;AAE5D,QAAA,SAAS,GAAG;IACvB,CAAC,gCAAa,CAAC,EAAE,CAAC,EAAE;QAClB,CAAC,EAAE,4CAA4C;KAChD;CAC+D,CAAA;AAErD,QAAA,MAAM,GAAG;IACpB,CAAC,gCAAa,CAAC,EAAE,CAAC,EAAE;QAClB,CAAC,EAAE,4CAA4C;QAC/C,CAAC,EAAE,4CAA4C;QAC/C,CAAC,EAAE,4CAA4C;KAChD;CAC+D,CAAA"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.zoneModerato = exports.zone = exports.getPortalAddress = exports.from = exports.http = exports.Addresses = exports.Abis = void 0;
|
|
4
|
-
exports.Abis = require("./Abis.js");
|
|
5
|
-
exports.Addresses = require("./Addresses.js");
|
|
6
|
-
var transport_js_1 = require("./transport.js");
|
|
7
|
-
Object.defineProperty(exports, "http", { enumerable: true, get: function () { return transport_js_1.http; } });
|
|
8
|
-
var zone_js_1 = require("./zone.js");
|
|
9
|
-
Object.defineProperty(exports, "from", { enumerable: true, get: function () { return zone_js_1.from; } });
|
|
10
|
-
Object.defineProperty(exports, "getPortalAddress", { enumerable: true, get: function () { return zone_js_1.getPortalAddress; } });
|
|
11
|
-
Object.defineProperty(exports, "zone", { enumerable: true, get: function () { return zone_js_1.zone; } });
|
|
12
|
-
Object.defineProperty(exports, "zoneModerato", { enumerable: true, get: function () { return zone_js_1.zoneModerato; } });
|
|
13
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../tempo/zones/index.ts"],"names":[],"mappings":";;;AACA,oCAAiC;AACjC,8CAA2C;AAC3C,+CAA0D;AAAjD,oGAAA,IAAI,OAAA;AACb,qCAKkB;AAJhB,+FAAA,IAAI,OAAA;AACJ,2GAAA,gBAAgB,OAAA;AAChB,+FAAA,IAAI,OAAA;AACJ,uGAAA,YAAY,OAAA"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.http = http;
|
|
4
|
-
const http_js_1 = require("../../clients/transports/http.js");
|
|
5
|
-
const Storage_ = require("../Storage.js");
|
|
6
|
-
function http(url, config = {}) {
|
|
7
|
-
const { storage: storage_, onFetchRequest, ...rest } = config;
|
|
8
|
-
const storage = storage_ ?? Storage_.defaultStorage();
|
|
9
|
-
return (config) => (0, http_js_1.http)(url, {
|
|
10
|
-
...rest,
|
|
11
|
-
async onFetchRequest(request, init) {
|
|
12
|
-
const next = (await onFetchRequest?.(request, init)) ?? init;
|
|
13
|
-
const headers = new Headers(next.headers);
|
|
14
|
-
const chainId = config.chain?.id;
|
|
15
|
-
if (chainId) {
|
|
16
|
-
const token = (await storage.getItem(`auth:token:${chainId}`)) ?? null;
|
|
17
|
-
if (token)
|
|
18
|
-
headers.set('X-Authorization-Token', token);
|
|
19
|
-
}
|
|
20
|
-
return { ...next, headers };
|
|
21
|
-
},
|
|
22
|
-
})(config);
|
|
23
|
-
}
|
|
24
|
-
//# sourceMappingURL=transport.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transport.js","sourceRoot":"","sources":["../../../tempo/zones/transport.ts"],"names":[],"mappings":";;AAkCA,oBAuBC;AAzDD,8DAIyC;AAEzC,0CAAyC;AA4BzC,SAAgB,IAAI,CAClB,GAAwB,EACxB,SAAyB,EAAE;IAE3B,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAA;IAC7D,MAAM,OAAO,GAAG,QAAQ,IAAI,QAAQ,CAAC,cAAc,EAAE,CAAA;IAErD,OAAO,CAAC,MAAM,EAAE,EAAE,CAChB,IAAA,cAAK,EAAC,GAAG,EAAE;QACT,GAAG,IAAI;QACP,KAAK,CAAC,cAAc,CAAC,OAAO,EAAE,IAAI;YAChC,MAAM,IAAI,GAAG,CAAC,MAAM,cAAc,EAAE,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,IAAI,IAAI,CAAA;YAC5D,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;YAEzC,MAAM,OAAO,GAAG,MAAM,CAAC,KAAK,EAAE,EAAE,CAAA;YAChC,IAAI,OAAO,EAAE,CAAC;gBACZ,MAAM,KAAK,GAAG,CAAC,MAAM,OAAO,CAAC,OAAO,CAAC,cAAc,OAAO,EAAE,CAAC,CAAC,IAAI,IAAI,CAAA;gBACtE,IAAI,KAAK;oBAAE,OAAO,CAAC,GAAG,CAAC,uBAAuB,EAAE,KAAK,CAAC,CAAA;YACxD,CAAC;YAED,OAAO,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,CAAA;QAC7B,CAAC;KACF,CAAC,CAAC,MAAM,CAAC,CAAA;AACd,CAAC"}
|
package/_cjs/tempo/zones/zone.js
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.zoneModerato = exports.zone = void 0;
|
|
4
|
-
exports.getPortalAddress = getPortalAddress;
|
|
5
|
-
exports.from = from;
|
|
6
|
-
const tempo_1 = require("ox/tempo");
|
|
7
|
-
const tempo_js_1 = require("../../chains/definitions/tempo.js");
|
|
8
|
-
const tempoModerato_js_1 = require("../../chains/definitions/tempoModerato.js");
|
|
9
|
-
const defineChain_js_1 = require("../../utils/chain/defineChain.js");
|
|
10
|
-
const chainConfig_js_1 = require("../chainConfig.js");
|
|
11
|
-
const Addresses = require("./Addresses.js");
|
|
12
|
-
function getPortalAddress(chainId, zoneId) {
|
|
13
|
-
const address = Addresses.portal[chainId]?.[zoneId];
|
|
14
|
-
if (!address)
|
|
15
|
-
throw new Error(`No portal address configured for zone ${zoneId} on chain ${chainId}.`);
|
|
16
|
-
return address;
|
|
17
|
-
}
|
|
18
|
-
const overrides = {
|
|
19
|
-
[tempoModerato_js_1.tempoModerato.id]: {
|
|
20
|
-
1: {
|
|
21
|
-
contracts: {
|
|
22
|
-
messenger: {
|
|
23
|
-
[tempoModerato_js_1.tempoModerato.id]: {
|
|
24
|
-
address: Addresses.messenger[tempoModerato_js_1.tempoModerato.id][1],
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
portal: {
|
|
28
|
-
[tempoModerato_js_1.tempoModerato.id]: {
|
|
29
|
-
address: Addresses.portal[tempoModerato_js_1.tempoModerato.id][1],
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
name: 'Zone E',
|
|
34
|
-
rpcUrl: 'https://rpc-zone-e.testnet.tempo.xyz',
|
|
35
|
-
},
|
|
36
|
-
6: {
|
|
37
|
-
name: 'Zone A',
|
|
38
|
-
rpcUrl: 'https://rpc-zone-a.testnet.tempo.xyz',
|
|
39
|
-
},
|
|
40
|
-
7: {
|
|
41
|
-
name: 'Zone B',
|
|
42
|
-
rpcUrl: 'https://rpc-zone-b.testnet.tempo.xyz',
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
};
|
|
46
|
-
exports.zone = from({
|
|
47
|
-
sourceId: tempo_js_1.tempo.id,
|
|
48
|
-
rpcHost: 'tempo.xyz',
|
|
49
|
-
});
|
|
50
|
-
exports.zoneModerato = from({
|
|
51
|
-
sourceId: tempoModerato_js_1.tempoModerato.id,
|
|
52
|
-
rpcHost: 'tempoxyz.dev',
|
|
53
|
-
});
|
|
54
|
-
function from(options) {
|
|
55
|
-
return (id) => {
|
|
56
|
-
const chainId = tempo_1.ZoneId.toChainId(id);
|
|
57
|
-
const paddedId = String(id).padStart(3, '0');
|
|
58
|
-
const override = overrides[options.sourceId]?.[id];
|
|
59
|
-
return (0, defineChain_js_1.defineChain)({
|
|
60
|
-
...chainConfig_js_1.chainConfig,
|
|
61
|
-
...(override?.contracts ? { contracts: override.contracts } : {}),
|
|
62
|
-
id: chainId,
|
|
63
|
-
name: override?.name ?? `Tempo Zone ${paddedId}`,
|
|
64
|
-
nativeCurrency: {
|
|
65
|
-
name: 'USD',
|
|
66
|
-
symbol: 'USD',
|
|
67
|
-
decimals: 6,
|
|
68
|
-
},
|
|
69
|
-
rpcUrls: {
|
|
70
|
-
default: {
|
|
71
|
-
http: [
|
|
72
|
-
override?.rpcUrl ??
|
|
73
|
-
`https://rpc-zone-${paddedId}.${options.rpcHost}`,
|
|
74
|
-
],
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
sourceId: options.sourceId,
|
|
78
|
-
supportsTransactionReplacementDetection: false,
|
|
79
|
-
});
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
//# sourceMappingURL=zone.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"zone.js","sourceRoot":"","sources":["../../../tempo/zones/zone.ts"],"names":[],"mappings":";;;AAOA,4CAYC;AAqDD,oBA+BC;AAvGD,oCAAiC;AACjC,gEAAyD;AACzD,gFAAyE;AACzE,qEAA8D;AAC9D,sDAA+C;AAC/C,4CAA2C;AAE3C,SAAgB,gBAAgB,CAC9B,OAAe,EACf,MAAc;IAEd,MAAM,OAAO,GACX,SAAS,CAAC,MACX,CAAC,OAAO,CAAC,EAAE,CAAC,MAAM,CAAC,CAAA;IACpB,IAAI,CAAC,OAAO;QACV,MAAM,IAAI,KAAK,CACb,yCAAyC,MAAM,aAAa,OAAO,GAAG,CACvE,CAAA;IACH,OAAO,OAAO,CAAA;AAChB,CAAC;AAaD,MAAM,SAAS,GAAG;IAChB,CAAC,gCAAa,CAAC,EAAE,CAAC,EAAE;QAClB,CAAC,EAAE;YACD,SAAS,EAAE;gBACT,SAAS,EAAE;oBACT,CAAC,gCAAa,CAAC,EAAE,CAAC,EAAE;wBAClB,OAAO,EAAE,SAAS,CAAC,SAAS,CAAC,gCAAa,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;qBAClD;iBACF;gBACD,MAAM,EAAE;oBACN,CAAC,gCAAa,CAAC,EAAE,CAAC,EAAE;wBAClB,OAAO,EAAE,SAAS,CAAC,MAAM,CAAC,gCAAa,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;qBAC/C;iBACF;aACF;YACD,IAAI,EAAE,QAAQ;YACd,MAAM,EAAE,sCAAsC;SAC/C;QACD,CAAC,EAAE;YACD,IAAI,EAAE,QAAQ;YACd,MAAM,EAAE,sCAAsC;SAC/C;QACD,CAAC,EAAE;YACD,IAAI,EAAE,QAAQ;YACd,MAAM,EAAE,sCAAsC;SAC/C;KACF;CAC0D,CAAA;AAEhD,QAAA,IAAI,GAAiB,IAA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