viem 2.47.10 → 2.47.11
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 +10 -0
- package/_cjs/chains/definitions/fluent.js +26 -0
- package/_cjs/chains/definitions/fluent.js.map +1 -0
- package/_cjs/chains/index.js +13 -11
- package/_cjs/chains/index.js.map +1 -1
- package/_cjs/errors/version.js +1 -1
- package/_cjs/tempo/Abis.js +656 -4
- package/_cjs/tempo/Abis.js.map +1 -1
- package/_cjs/tempo/Account.js +6 -2
- package/_cjs/tempo/Account.js.map +1 -1
- package/_cjs/tempo/actions/accessKey.js +2 -1
- package/_cjs/tempo/actions/accessKey.js.map +1 -1
- package/_cjs/tempo/actions/validator.js +11 -11
- package/_cjs/tempo/actions/validator.js.map +1 -1
- package/_cjs/tempo/index.js +2 -1
- package/_cjs/tempo/index.js.map +1 -1
- package/_cjs/utils/buildRequest.js +2 -0
- package/_cjs/utils/buildRequest.js.map +1 -1
- package/_esm/chains/definitions/fluent.js +23 -0
- package/_esm/chains/definitions/fluent.js.map +1 -0
- package/_esm/chains/index.js +1 -0
- package/_esm/chains/index.js.map +1 -1
- package/_esm/errors/version.js +1 -1
- package/_esm/tempo/Abis.js +655 -3
- package/_esm/tempo/Abis.js.map +1 -1
- package/_esm/tempo/Account.js +6 -2
- package/_esm/tempo/Account.js.map +1 -1
- package/_esm/tempo/actions/accessKey.js +2 -1
- package/_esm/tempo/actions/accessKey.js.map +1 -1
- package/_esm/tempo/actions/validator.js +11 -11
- package/_esm/tempo/actions/validator.js.map +1 -1
- package/_esm/tempo/index.js +1 -1
- package/_esm/tempo/index.js.map +1 -1
- package/_esm/utils/buildRequest.js +5 -0
- package/_esm/utils/buildRequest.js.map +1 -1
- package/_types/chains/definitions/fluent.d.ts +48 -0
- package/_types/chains/definitions/fluent.d.ts.map +1 -0
- package/_types/chains/index.d.ts +1 -0
- package/_types/chains/index.d.ts.map +1 -1
- package/_types/errors/version.d.ts +1 -1
- package/_types/tempo/Abis.d.ts +1072 -35
- package/_types/tempo/Abis.d.ts.map +1 -1
- package/_types/tempo/Account.d.ts +2 -2
- package/_types/tempo/Account.d.ts.map +1 -1
- package/_types/tempo/actions/accessKey.d.ts +539 -0
- package/_types/tempo/actions/accessKey.d.ts.map +1 -1
- package/_types/tempo/actions/policy.d.ts +444 -4
- package/_types/tempo/actions/policy.d.ts.map +1 -1
- package/_types/tempo/actions/validator.d.ts +6 -6
- package/_types/tempo/actions/validator.d.ts.map +1 -1
- package/_types/tempo/index.d.ts +1 -1
- package/_types/tempo/index.d.ts.map +1 -1
- package/_types/utils/buildRequest.d.ts.map +1 -1
- package/chains/definitions/fluent.ts +23 -0
- package/chains/index.ts +1 -0
- package/errors/version.ts +1 -1
- package/package.json +2 -2
- package/tempo/Abis.ts +658 -3
- package/tempo/Account.ts +8 -4
- package/tempo/actions/accessKey.ts +13 -2
- package/tempo/actions/validator.ts +17 -17
- package/tempo/index.ts +1 -1
- package/utils/buildRequest.ts +4 -0
package/tempo/Account.ts
CHANGED
|
@@ -48,7 +48,7 @@ export type RootAccount = Account_base<'root'> & {
|
|
|
48
48
|
key: Pick<AccessKeyAccount, 'accessKeyAddress' | 'keyType'>,
|
|
49
49
|
parameters: Pick<
|
|
50
50
|
KeyAuthorization.KeyAuthorization,
|
|
51
|
-
'chainId' | 'expiry' | 'limits'
|
|
51
|
+
'chainId' | 'expiry' | 'limits' | 'scopes'
|
|
52
52
|
>,
|
|
53
53
|
) => Promise<KeyAuthorization.Signed>
|
|
54
54
|
}
|
|
@@ -381,7 +381,7 @@ export async function signKeyAuthorization(
|
|
|
381
381
|
account: LocalAccount,
|
|
382
382
|
parameters: signKeyAuthorization.Parameters,
|
|
383
383
|
): Promise<signKeyAuthorization.ReturnValue> {
|
|
384
|
-
const { chainId, key, expiry, limits } = parameters
|
|
384
|
+
const { chainId, key, expiry, limits, scopes } = parameters
|
|
385
385
|
const { accessKeyAddress, keyType: type } = key
|
|
386
386
|
|
|
387
387
|
const signature = await account.sign!({
|
|
@@ -390,6 +390,7 @@ export async function signKeyAuthorization(
|
|
|
390
390
|
chainId,
|
|
391
391
|
expiry,
|
|
392
392
|
limits,
|
|
393
|
+
scopes,
|
|
393
394
|
type,
|
|
394
395
|
}),
|
|
395
396
|
})
|
|
@@ -398,6 +399,7 @@ export async function signKeyAuthorization(
|
|
|
398
399
|
chainId,
|
|
399
400
|
expiry,
|
|
400
401
|
limits,
|
|
402
|
+
scopes,
|
|
401
403
|
signature: SignatureEnvelope.from(signature),
|
|
402
404
|
type,
|
|
403
405
|
})
|
|
@@ -406,7 +408,7 @@ export async function signKeyAuthorization(
|
|
|
406
408
|
export declare namespace signKeyAuthorization {
|
|
407
409
|
type Parameters = Pick<
|
|
408
410
|
KeyAuthorization.KeyAuthorization,
|
|
409
|
-
'chainId' | 'expiry' | 'limits'
|
|
411
|
+
'chainId' | 'expiry' | 'limits' | 'scopes'
|
|
410
412
|
> & {
|
|
411
413
|
key: Pick<AccessKeyAccount, 'accessKeyAddress' | 'keyType'>
|
|
412
414
|
}
|
|
@@ -522,7 +524,7 @@ function fromRoot(parameters: fromRoot.Parameters): RootAccount {
|
|
|
522
524
|
...account,
|
|
523
525
|
source: 'root',
|
|
524
526
|
async signKeyAuthorization(key, parameters) {
|
|
525
|
-
const { chainId, expiry, limits } = parameters
|
|
527
|
+
const { chainId, expiry, limits, scopes } = parameters
|
|
526
528
|
const { accessKeyAddress, keyType: type } = key
|
|
527
529
|
|
|
528
530
|
const signature = await account.sign({
|
|
@@ -531,6 +533,7 @@ function fromRoot(parameters: fromRoot.Parameters): RootAccount {
|
|
|
531
533
|
chainId,
|
|
532
534
|
expiry,
|
|
533
535
|
limits,
|
|
536
|
+
scopes,
|
|
534
537
|
type,
|
|
535
538
|
}),
|
|
536
539
|
})
|
|
@@ -539,6 +542,7 @@ function fromRoot(parameters: fromRoot.Parameters): RootAccount {
|
|
|
539
542
|
chainId,
|
|
540
543
|
expiry,
|
|
541
544
|
limits,
|
|
545
|
+
scopes,
|
|
542
546
|
signature: SignatureEnvelope.from(signature),
|
|
543
547
|
type,
|
|
544
548
|
})
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Address } from 'abitype'
|
|
2
|
+
import type { KeyAuthorization } from 'ox/tempo'
|
|
2
3
|
import type { Account } from '../../accounts/types.js'
|
|
3
4
|
import { parseAccount } from '../../accounts/utils/parseAccount.js'
|
|
4
5
|
import { readContract } from '../../actions/public/readContract.js'
|
|
@@ -96,7 +97,11 @@ export namespace authorize {
|
|
|
96
97
|
/** Unix timestamp when the key expires. */
|
|
97
98
|
expiry?: number | undefined
|
|
98
99
|
/** Spending limits per token. */
|
|
99
|
-
limits?:
|
|
100
|
+
limits?:
|
|
101
|
+
| { token: Address; limit: bigint; period?: number | undefined }[]
|
|
102
|
+
| undefined
|
|
103
|
+
/** Call scopes restricting which contracts/selectors this key can call. */
|
|
104
|
+
scopes?: KeyAuthorization.Scope[] | undefined
|
|
100
105
|
}
|
|
101
106
|
|
|
102
107
|
export type ReturnValue = WriteContractReturnType
|
|
@@ -119,6 +124,7 @@ export namespace authorize {
|
|
|
119
124
|
chainId = client.chain?.id,
|
|
120
125
|
expiry,
|
|
121
126
|
limits,
|
|
127
|
+
scopes,
|
|
122
128
|
...rest
|
|
123
129
|
} = parameters
|
|
124
130
|
const account_ = rest.account ?? client.account
|
|
@@ -130,6 +136,7 @@ export namespace authorize {
|
|
|
130
136
|
key: accessKey,
|
|
131
137
|
expiry,
|
|
132
138
|
limits,
|
|
139
|
+
scopes,
|
|
133
140
|
})
|
|
134
141
|
return (await action(client, {
|
|
135
142
|
...rest,
|
|
@@ -875,7 +882,11 @@ export namespace signAuthorization {
|
|
|
875
882
|
/** Unix timestamp when the key expires. */
|
|
876
883
|
expiry?: number | undefined
|
|
877
884
|
/** Spending limits per token. */
|
|
878
|
-
limits?:
|
|
885
|
+
limits?:
|
|
886
|
+
| { token: Address; limit: bigint; period?: number | undefined }[]
|
|
887
|
+
| undefined
|
|
888
|
+
/** Call scopes restricting which contracts/selectors this key can call. */
|
|
889
|
+
scopes?: KeyAuthorization.Scope[] | undefined
|
|
879
890
|
}
|
|
880
891
|
|
|
881
892
|
export type ReturnValue = Awaited<ReturnType<typeof signKeyAuthorization>>
|
|
@@ -155,7 +155,7 @@ export namespace add {
|
|
|
155
155
|
} = args
|
|
156
156
|
return defineCall({
|
|
157
157
|
address: Addresses.validator,
|
|
158
|
-
abi: Abis.
|
|
158
|
+
abi: Abis.validatorConfig,
|
|
159
159
|
args: [
|
|
160
160
|
newValidatorAddress,
|
|
161
161
|
publicKey,
|
|
@@ -329,7 +329,7 @@ export namespace changeOwner {
|
|
|
329
329
|
const { newOwner } = args
|
|
330
330
|
return defineCall({
|
|
331
331
|
address: Addresses.validator,
|
|
332
|
-
abi: Abis.
|
|
332
|
+
abi: Abis.validatorConfig,
|
|
333
333
|
args: [newOwner],
|
|
334
334
|
functionName: 'changeOwner',
|
|
335
335
|
})
|
|
@@ -497,7 +497,7 @@ export namespace changeStatus {
|
|
|
497
497
|
const { validator, active } = args
|
|
498
498
|
return defineCall({
|
|
499
499
|
address: Addresses.validator,
|
|
500
|
-
abi: Abis.
|
|
500
|
+
abi: Abis.validatorConfig,
|
|
501
501
|
args: [validator, active],
|
|
502
502
|
functionName: 'changeValidatorStatus',
|
|
503
503
|
})
|
|
@@ -596,7 +596,7 @@ export namespace getNextFullDkgCeremony {
|
|
|
596
596
|
export type Parameters = ReadParameters
|
|
597
597
|
|
|
598
598
|
export type ReturnValue = ReadContractReturnType<
|
|
599
|
-
typeof Abis.
|
|
599
|
+
typeof Abis.validatorConfig,
|
|
600
600
|
'getNextFullDkgCeremony',
|
|
601
601
|
never
|
|
602
602
|
>
|
|
@@ -630,7 +630,7 @@ export namespace getNextFullDkgCeremony {
|
|
|
630
630
|
export function call() {
|
|
631
631
|
return defineCall({
|
|
632
632
|
address: Addresses.validator,
|
|
633
|
-
abi: Abis.
|
|
633
|
+
abi: Abis.validatorConfig,
|
|
634
634
|
args: [],
|
|
635
635
|
functionName: 'getNextFullDkgCeremony',
|
|
636
636
|
})
|
|
@@ -675,7 +675,7 @@ export namespace getOwner {
|
|
|
675
675
|
export type Parameters = ReadParameters
|
|
676
676
|
|
|
677
677
|
export type ReturnValue = ReadContractReturnType<
|
|
678
|
-
typeof Abis.
|
|
678
|
+
typeof Abis.validatorConfig,
|
|
679
679
|
'owner',
|
|
680
680
|
never
|
|
681
681
|
>
|
|
@@ -709,7 +709,7 @@ export namespace getOwner {
|
|
|
709
709
|
export function call() {
|
|
710
710
|
return defineCall({
|
|
711
711
|
address: Addresses.validator,
|
|
712
|
-
abi: Abis.
|
|
712
|
+
abi: Abis.validatorConfig,
|
|
713
713
|
args: [],
|
|
714
714
|
functionName: 'owner',
|
|
715
715
|
})
|
|
@@ -762,7 +762,7 @@ export namespace get {
|
|
|
762
762
|
}
|
|
763
763
|
|
|
764
764
|
export type ReturnValue = ReadContractReturnType<
|
|
765
|
-
typeof Abis.
|
|
765
|
+
typeof Abis.validatorConfig,
|
|
766
766
|
'validators',
|
|
767
767
|
never
|
|
768
768
|
>
|
|
@@ -800,7 +800,7 @@ export namespace get {
|
|
|
800
800
|
const { validator } = args
|
|
801
801
|
return defineCall({
|
|
802
802
|
address: Addresses.validator,
|
|
803
|
-
abi: Abis.
|
|
803
|
+
abi: Abis.validatorConfig,
|
|
804
804
|
args: [validator],
|
|
805
805
|
functionName: 'validators',
|
|
806
806
|
})
|
|
@@ -853,7 +853,7 @@ export namespace getByIndex {
|
|
|
853
853
|
}
|
|
854
854
|
|
|
855
855
|
export type ReturnValue = ReadContractReturnType<
|
|
856
|
-
typeof Abis.
|
|
856
|
+
typeof Abis.validatorConfig,
|
|
857
857
|
'validatorsArray',
|
|
858
858
|
never
|
|
859
859
|
>
|
|
@@ -892,7 +892,7 @@ export namespace getByIndex {
|
|
|
892
892
|
const { index } = args
|
|
893
893
|
return defineCall({
|
|
894
894
|
address: Addresses.validator,
|
|
895
|
-
abi: Abis.
|
|
895
|
+
abi: Abis.validatorConfig,
|
|
896
896
|
args: [index],
|
|
897
897
|
functionName: 'validatorsArray',
|
|
898
898
|
})
|
|
@@ -937,7 +937,7 @@ export namespace getCount {
|
|
|
937
937
|
export type Parameters = ReadParameters
|
|
938
938
|
|
|
939
939
|
export type ReturnValue = ReadContractReturnType<
|
|
940
|
-
typeof Abis.
|
|
940
|
+
typeof Abis.validatorConfig,
|
|
941
941
|
'validatorCount',
|
|
942
942
|
never
|
|
943
943
|
>
|
|
@@ -971,7 +971,7 @@ export namespace getCount {
|
|
|
971
971
|
export function call() {
|
|
972
972
|
return defineCall({
|
|
973
973
|
address: Addresses.validator,
|
|
974
|
-
abi: Abis.
|
|
974
|
+
abi: Abis.validatorConfig,
|
|
975
975
|
args: [],
|
|
976
976
|
functionName: 'validatorCount',
|
|
977
977
|
})
|
|
@@ -1016,7 +1016,7 @@ export namespace list {
|
|
|
1016
1016
|
export type Parameters = ReadParameters
|
|
1017
1017
|
|
|
1018
1018
|
export type ReturnValue = ReadContractReturnType<
|
|
1019
|
-
typeof Abis.
|
|
1019
|
+
typeof Abis.validatorConfig,
|
|
1020
1020
|
'getValidators',
|
|
1021
1021
|
never
|
|
1022
1022
|
>
|
|
@@ -1050,7 +1050,7 @@ export namespace list {
|
|
|
1050
1050
|
export function call() {
|
|
1051
1051
|
return defineCall({
|
|
1052
1052
|
address: Addresses.validator,
|
|
1053
|
-
abi: Abis.
|
|
1053
|
+
abi: Abis.validatorConfig,
|
|
1054
1054
|
args: [],
|
|
1055
1055
|
functionName: 'getValidators',
|
|
1056
1056
|
})
|
|
@@ -1161,7 +1161,7 @@ export namespace setNextFullDkgCeremony {
|
|
|
1161
1161
|
const { epoch } = args
|
|
1162
1162
|
return defineCall({
|
|
1163
1163
|
address: Addresses.validator,
|
|
1164
|
-
abi: Abis.
|
|
1164
|
+
abi: Abis.validatorConfig,
|
|
1165
1165
|
args: [epoch],
|
|
1166
1166
|
functionName: 'setNextFullDkgCeremony',
|
|
1167
1167
|
})
|
|
@@ -1353,7 +1353,7 @@ export namespace update {
|
|
|
1353
1353
|
args
|
|
1354
1354
|
return defineCall({
|
|
1355
1355
|
address: Addresses.validator,
|
|
1356
|
-
abi: Abis.
|
|
1356
|
+
abi: Abis.validatorConfig,
|
|
1357
1357
|
args: [newValidatorAddress, publicKey, inboundAddress, outboundAddress],
|
|
1358
1358
|
functionName: 'updateValidator',
|
|
1359
1359
|
})
|
package/tempo/index.ts
CHANGED
|
@@ -10,7 +10,7 @@ export type {
|
|
|
10
10
|
TxEnvelopeTempo as z_TxEnvelopeTempo,
|
|
11
11
|
} from 'ox/tempo'
|
|
12
12
|
// biome-ignore lint/performance/noBarrelFile: _
|
|
13
|
-
export { TempoAddress, Tick, TokenId } from 'ox/tempo'
|
|
13
|
+
export { Period, TempoAddress, Tick, TokenId } from 'ox/tempo'
|
|
14
14
|
export * as Abis from './Abis.js'
|
|
15
15
|
export * as Account from './Account.js'
|
|
16
16
|
export * as Addresses from './Addresses.js'
|
package/utils/buildRequest.ts
CHANGED
|
@@ -279,6 +279,10 @@ export function shouldRetry(error: Error) {
|
|
|
279
279
|
if (error.code === -1) return true // Unknown error
|
|
280
280
|
if (error.code === LimitExceededRpcError.code) return true
|
|
281
281
|
if (error.code === InternalRpcError.code) return true
|
|
282
|
+
// Too Many Requests — some providers (e.g. Alchemy in batch mode) return
|
|
283
|
+
// HTTP 200 with a JSON-RPC body of `{ code: 429 }` instead of an HTTP 429,
|
|
284
|
+
// so we need to handle this code in addition to the HTTP status check below.
|
|
285
|
+
if (error.code === 429) return true
|
|
282
286
|
return false
|
|
283
287
|
}
|
|
284
288
|
if (error instanceof HttpRequestError && error.status) {
|