viem 2.58.4 → 2.58.7
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 +40 -0
- package/_cjs/account-abstraction/actions/bundler/prepareUserOperation.js +6 -1
- package/_cjs/account-abstraction/actions/bundler/prepareUserOperation.js.map +1 -1
- package/_cjs/account-abstraction/errors/bundler.js +38 -228
- package/_cjs/account-abstraction/errors/bundler.js.map +1 -1
- package/_cjs/account-abstraction/errors/userOperation.js +1 -6
- package/_cjs/account-abstraction/errors/userOperation.js.map +1 -1
- package/_cjs/account-abstraction/utils/formatters/userOperation.js +11 -1
- package/_cjs/account-abstraction/utils/formatters/userOperation.js.map +1 -1
- package/_cjs/actions/public/estimateContractGas.js +7 -1
- package/_cjs/actions/public/estimateContractGas.js.map +1 -1
- package/_cjs/actions/public/simulateBlocks.js +6 -1
- package/_cjs/actions/public/simulateBlocks.js.map +1 -1
- package/_cjs/actions/public/simulateContract.js +7 -1
- package/_cjs/actions/public/simulateContract.js.map +1 -1
- package/_cjs/actions/wallet/sendCalls.js +8 -1
- package/_cjs/actions/wallet/sendCalls.js.map +1 -1
- package/_cjs/actions/wallet/sendTransaction.js +8 -2
- package/_cjs/actions/wallet/sendTransaction.js.map +1 -1
- package/_cjs/actions/wallet/sendTransactionSync.js +8 -2
- package/_cjs/actions/wallet/sendTransactionSync.js.map +1 -1
- package/_cjs/chains/definitions/primiumTestnet.js +29 -0
- package/_cjs/chains/definitions/primiumTestnet.js.map +1 -0
- package/_cjs/chains/definitions/sevenChain.js +26 -0
- package/_cjs/chains/definitions/sevenChain.js.map +1 -0
- package/_cjs/chains/definitions/tsxBastion.js +33 -0
- package/_cjs/chains/definitions/tsxBastion.js.map +1 -0
- package/_cjs/chains/definitions/tsxHorizon.js +33 -0
- package/_cjs/chains/definitions/tsxHorizon.js.map +1 -0
- package/_cjs/chains/definitions/tsxTestnet.js +34 -0
- package/_cjs/chains/definitions/tsxTestnet.js.map +1 -0
- package/_cjs/chains/index.js +16 -6
- package/_cjs/chains/index.js.map +1 -1
- package/_cjs/constants/abis.js +50 -1
- package/_cjs/constants/abis.js.map +1 -1
- package/_cjs/errors/abi.js +9 -54
- package/_cjs/errors/abi.js.map +1 -1
- package/_cjs/errors/base.js +6 -36
- package/_cjs/errors/base.js.map +1 -1
- package/_cjs/errors/calls.js +1 -6
- package/_cjs/errors/calls.js.map +1 -1
- package/_cjs/errors/contract.js +14 -84
- package/_cjs/errors/contract.js.map +1 -1
- package/_cjs/errors/estimateGas.js +1 -6
- package/_cjs/errors/estimateGas.js.map +1 -1
- package/_cjs/errors/node.js +12 -72
- package/_cjs/errors/node.js.map +1 -1
- package/_cjs/errors/request.js +14 -84
- package/_cjs/errors/request.js.map +1 -1
- package/_cjs/errors/rpc.js +29 -174
- package/_cjs/errors/rpc.js.map +1 -1
- package/_cjs/errors/transaction.js +5 -30
- package/_cjs/errors/transaction.js.map +1 -1
- package/_cjs/errors/version.js +1 -1
- package/_cjs/experimental/erc7811/actions/getAssets.js +6 -1
- package/_cjs/experimental/erc7811/actions/getAssets.js.map +1 -1
- package/_cjs/tempo/Account.js +1 -6
- package/_cjs/tempo/Account.js.map +1 -1
- package/_cjs/tempo/Client.js.map +1 -1
- package/_cjs/tempo/Gateway.js +6 -36
- package/_cjs/tempo/Gateway.js.map +1 -1
- package/_cjs/tempo/actions/accessKey.js +17 -102
- package/_cjs/tempo/actions/accessKey.js.map +1 -1
- package/_cjs/tempo/actions/accounts.js.map +1 -1
- package/_cjs/tempo/actions/amm.js +5 -30
- package/_cjs/tempo/actions/amm.js.map +1 -1
- package/_cjs/tempo/actions/channel.js +10 -60
- package/_cjs/tempo/actions/channel.js.map +1 -1
- package/_cjs/tempo/actions/dex.js +29 -174
- package/_cjs/tempo/actions/dex.js.map +1 -1
- package/_cjs/tempo/actions/earn/deployment.js +3 -18
- package/_cjs/tempo/actions/earn/deployment.js.map +1 -1
- package/_cjs/tempo/actions/fee.js +3 -18
- package/_cjs/tempo/actions/fee.js.map +1 -1
- package/_cjs/tempo/actions/nonce.js +3 -18
- package/_cjs/tempo/actions/nonce.js.map +1 -1
- package/_cjs/tempo/actions/policy.js +1 -6
- package/_cjs/tempo/actions/policy.js.map +1 -1
- package/_cjs/tempo/actions/simulate.js +6 -1
- package/_cjs/tempo/actions/simulate.js.map +1 -1
- package/_cjs/tempo/actions/token.js +25 -150
- package/_cjs/tempo/actions/token.js.map +1 -1
- package/_cjs/tempo/chainConfig.js +20 -2
- package/_cjs/tempo/chainConfig.js.map +1 -1
- package/_cjs/tempo/errors.js +5 -30
- package/_cjs/tempo/errors.js.map +1 -1
- package/_cjs/types/eip1193.js +3 -18
- package/_cjs/types/eip1193.js.map +1 -1
- package/_cjs/utils/formatters/feeHistory.js +5 -0
- package/_cjs/utils/formatters/feeHistory.js.map +1 -1
- package/_cjs/utils/lru.js +1 -6
- package/_cjs/utils/lru.js.map +1 -1
- package/_cjs/utils/signature/serializeErc8010Signature.js +3 -1
- package/_cjs/utils/signature/serializeErc8010Signature.js.map +1 -1
- package/_cjs/utils/signature/toPrefixedMessage.js +3 -1
- package/_cjs/utils/signature/toPrefixedMessage.js.map +1 -1
- package/_cjs/utils/unit/Value.js +2 -12
- package/_cjs/utils/unit/Value.js.map +1 -1
- package/_esm/account-abstraction/actions/bundler/prepareUserOperation.js +6 -1
- package/_esm/account-abstraction/actions/bundler/prepareUserOperation.js.map +1 -1
- package/_esm/account-abstraction/errors/bundler.js +38 -228
- package/_esm/account-abstraction/errors/bundler.js.map +1 -1
- package/_esm/account-abstraction/errors/userOperation.js +1 -6
- package/_esm/account-abstraction/errors/userOperation.js.map +1 -1
- package/_esm/account-abstraction/utils/formatters/userOperation.js +11 -1
- package/_esm/account-abstraction/utils/formatters/userOperation.js.map +1 -1
- package/_esm/actions/public/estimateContractGas.js +7 -1
- package/_esm/actions/public/estimateContractGas.js.map +1 -1
- package/_esm/actions/public/simulateBlocks.js +6 -1
- package/_esm/actions/public/simulateBlocks.js.map +1 -1
- package/_esm/actions/public/simulateContract.js +7 -1
- package/_esm/actions/public/simulateContract.js.map +1 -1
- package/_esm/actions/wallet/sendCalls.js +8 -1
- package/_esm/actions/wallet/sendCalls.js.map +1 -1
- package/_esm/actions/wallet/sendTransaction.js +8 -2
- package/_esm/actions/wallet/sendTransaction.js.map +1 -1
- package/_esm/actions/wallet/sendTransactionSync.js +8 -2
- package/_esm/actions/wallet/sendTransactionSync.js.map +1 -1
- package/_esm/chains/definitions/primiumTestnet.js +26 -0
- package/_esm/chains/definitions/primiumTestnet.js.map +1 -0
- package/_esm/chains/definitions/sevenChain.js +23 -0
- package/_esm/chains/definitions/sevenChain.js.map +1 -0
- package/_esm/chains/definitions/tsxBastion.js +30 -0
- package/_esm/chains/definitions/tsxBastion.js.map +1 -0
- package/_esm/chains/definitions/tsxHorizon.js +30 -0
- package/_esm/chains/definitions/tsxHorizon.js.map +1 -0
- package/_esm/chains/definitions/tsxTestnet.js +31 -0
- package/_esm/chains/definitions/tsxTestnet.js.map +1 -0
- package/_esm/chains/index.js +5 -0
- package/_esm/chains/index.js.map +1 -1
- package/_esm/constants/abis.js +50 -1
- package/_esm/constants/abis.js.map +1 -1
- package/_esm/errors/abi.js +9 -54
- package/_esm/errors/abi.js.map +1 -1
- package/_esm/errors/base.js +6 -36
- package/_esm/errors/base.js.map +1 -1
- package/_esm/errors/calls.js +1 -6
- package/_esm/errors/calls.js.map +1 -1
- package/_esm/errors/contract.js +14 -84
- package/_esm/errors/contract.js.map +1 -1
- package/_esm/errors/estimateGas.js +1 -6
- package/_esm/errors/estimateGas.js.map +1 -1
- package/_esm/errors/node.js +12 -72
- package/_esm/errors/node.js.map +1 -1
- package/_esm/errors/request.js +16 -86
- package/_esm/errors/request.js.map +1 -1
- package/_esm/errors/rpc.js +29 -174
- package/_esm/errors/rpc.js.map +1 -1
- package/_esm/errors/transaction.js +5 -30
- package/_esm/errors/transaction.js.map +1 -1
- package/_esm/errors/version.js +1 -1
- package/_esm/experimental/erc7811/actions/getAssets.js +6 -1
- package/_esm/experimental/erc7811/actions/getAssets.js.map +1 -1
- package/_esm/tempo/Account.js +2 -7
- package/_esm/tempo/Account.js.map +1 -1
- package/_esm/tempo/Client.js +2 -1
- package/_esm/tempo/Client.js.map +1 -1
- package/_esm/tempo/Gateway.js +12 -42
- package/_esm/tempo/Gateway.js.map +1 -1
- package/_esm/tempo/actions/accessKey.js +34 -119
- package/_esm/tempo/actions/accessKey.js.map +1 -1
- package/_esm/tempo/actions/accounts.js +1 -2
- package/_esm/tempo/actions/accounts.js.map +1 -1
- package/_esm/tempo/actions/amm.js +10 -35
- package/_esm/tempo/actions/amm.js.map +1 -1
- package/_esm/tempo/actions/channel.js +20 -70
- package/_esm/tempo/actions/channel.js.map +1 -1
- package/_esm/tempo/actions/dex.js +58 -203
- package/_esm/tempo/actions/dex.js.map +1 -1
- package/_esm/tempo/actions/earn/deployment.js +3 -18
- package/_esm/tempo/actions/earn/deployment.js.map +1 -1
- package/_esm/tempo/actions/fee.js +6 -21
- package/_esm/tempo/actions/fee.js.map +1 -1
- package/_esm/tempo/actions/nonce.js +6 -21
- package/_esm/tempo/actions/nonce.js.map +1 -1
- package/_esm/tempo/actions/policy.js +2 -7
- package/_esm/tempo/actions/policy.js.map +1 -1
- package/_esm/tempo/actions/simulate.js +6 -1
- package/_esm/tempo/actions/simulate.js.map +1 -1
- package/_esm/tempo/actions/token.js +50 -175
- package/_esm/tempo/actions/token.js.map +1 -1
- package/_esm/tempo/chainConfig.js +26 -2
- package/_esm/tempo/chainConfig.js.map +1 -1
- package/_esm/tempo/errors.js +10 -35
- package/_esm/tempo/errors.js.map +1 -1
- package/_esm/types/eip1193.js +3 -18
- package/_esm/types/eip1193.js.map +1 -1
- package/_esm/utils/formatters/feeHistory.js +5 -0
- package/_esm/utils/formatters/feeHistory.js.map +1 -1
- package/_esm/utils/lru.js +1 -6
- package/_esm/utils/lru.js.map +1 -1
- package/_esm/utils/signature/serializeErc8010Signature.js +3 -1
- package/_esm/utils/signature/serializeErc8010Signature.js.map +1 -1
- package/_esm/utils/signature/toPrefixedMessage.js +4 -1
- package/_esm/utils/signature/toPrefixedMessage.js.map +1 -1
- package/_esm/utils/unit/Value.js +2 -12
- package/_esm/utils/unit/Value.js.map +1 -1
- package/_types/account-abstraction/actions/bundler/prepareUserOperation.d.ts.map +1 -1
- package/_types/account-abstraction/utils/formatters/userOperation.d.ts.map +1 -1
- package/_types/actions/public/estimateContractGas.d.ts.map +1 -1
- package/_types/actions/public/simulateBlocks.d.ts.map +1 -1
- package/_types/actions/public/simulateContract.d.ts.map +1 -1
- package/_types/actions/wallet/sendCalls.d.ts.map +1 -1
- package/_types/actions/wallet/sendTransaction.d.ts.map +1 -1
- package/_types/actions/wallet/sendTransactionSync.d.ts.map +1 -1
- package/_types/chains/definitions/primiumTestnet.d.ts +52 -0
- package/_types/chains/definitions/primiumTestnet.d.ts.map +1 -0
- package/_types/chains/definitions/sevenChain.d.ts +54 -0
- package/_types/chains/definitions/sevenChain.d.ts.map +1 -0
- package/_types/chains/definitions/tsxBastion.d.ts +52 -0
- package/_types/chains/definitions/tsxBastion.d.ts.map +1 -0
- package/_types/chains/definitions/tsxHorizon.d.ts +52 -0
- package/_types/chains/definitions/tsxHorizon.d.ts.map +1 -0
- package/_types/chains/definitions/tsxTestnet.d.ts +52 -0
- package/_types/chains/definitions/tsxTestnet.d.ts.map +1 -0
- package/_types/chains/index.d.ts +5 -0
- package/_types/chains/index.d.ts.map +1 -1
- package/_types/constants/abis.d.ts +36 -1
- package/_types/constants/abis.d.ts.map +1 -1
- package/_types/errors/version.d.ts +1 -1
- package/_types/tempo/Account.d.ts +0 -1
- package/_types/tempo/Account.d.ts.map +1 -1
- package/_types/tempo/Client.d.ts +2 -1
- package/_types/tempo/Client.d.ts.map +1 -1
- package/_types/tempo/actions/accounts.d.ts +1 -2
- package/_types/tempo/actions/accounts.d.ts.map +1 -1
- package/_types/tempo/actions/simulate.d.ts.map +1 -1
- package/_types/tempo/chainConfig.d.ts.map +1 -1
- package/_types/types/block.d.ts +2 -0
- package/_types/types/block.d.ts.map +1 -1
- package/_types/types/eip1193.d.ts +1 -1
- package/_types/types/eip1193.d.ts.map +1 -1
- package/_types/types/fee.d.ts +7 -0
- package/_types/types/fee.d.ts.map +1 -1
- package/_types/utils/formatters/feeHistory.d.ts.map +1 -1
- package/_types/utils/signature/serializeErc8010Signature.d.ts.map +1 -1
- package/_types/utils/signature/toPrefixedMessage.d.ts.map +1 -1
- package/account-abstraction/actions/bundler/prepareUserOperation.ts +6 -1
- package/account-abstraction/utils/formatters/userOperation.ts +12 -1
- package/actions/public/estimateContractGas.ts +7 -1
- package/actions/public/simulateBlocks.ts +6 -1
- package/actions/public/simulateContract.ts +7 -1
- package/actions/wallet/sendCalls.ts +8 -1
- package/actions/wallet/sendTransaction.ts +8 -2
- package/actions/wallet/sendTransactionSync.ts +8 -2
- package/chains/definitions/primiumTestnet.ts +26 -0
- package/chains/definitions/sevenChain.ts +23 -0
- package/chains/definitions/tsxBastion.ts +30 -0
- package/chains/definitions/tsxHorizon.ts +30 -0
- package/chains/definitions/tsxTestnet.ts +31 -0
- package/chains/index.ts +5 -0
- package/constants/abis.ts +50 -1
- package/errors/version.ts +1 -1
- package/experimental/erc7811/actions/getAssets.ts +8 -1
- package/package.json +1 -1
- package/tempo/Account.ts +0 -1
- package/tempo/Client.ts +2 -1
- package/tempo/actions/accounts.ts +1 -2
- package/tempo/actions/simulate.ts +6 -1
- package/tempo/chainConfig.ts +41 -2
- package/types/block.ts +2 -0
- package/types/eip1193.ts +1 -1
- package/types/fee.ts +7 -0
- package/utils/formatters/feeHistory.ts +5 -0
- package/utils/signature/serializeErc8010Signature.ts +4 -1
- package/utils/signature/toPrefixedMessage.ts +5 -1
|
@@ -208,7 +208,14 @@ function formatRequest(
|
|
|
208
208
|
|
|
209
209
|
return {
|
|
210
210
|
account: account.address,
|
|
211
|
-
assetFilter: assets
|
|
211
|
+
assetFilter: assets
|
|
212
|
+
? Object.fromEntries(
|
|
213
|
+
Object.entries(assets).map(([chainId, filter]) => [
|
|
214
|
+
numberToHex(Number(chainId)),
|
|
215
|
+
filter,
|
|
216
|
+
]),
|
|
217
|
+
)
|
|
218
|
+
: undefined,
|
|
212
219
|
assetTypeFilter: assetTypes,
|
|
213
220
|
chainFilter: chainIds?.map((chainId) => numberToHex(chainId)),
|
|
214
221
|
}
|
package/package.json
CHANGED
package/tempo/Account.ts
CHANGED
package/tempo/Client.ts
CHANGED
|
@@ -107,7 +107,8 @@ export type CreateClientErrorType = ErrorType
|
|
|
107
107
|
* client can be created with `createClient()`. Pass `testnet` to use the
|
|
108
108
|
* Tempo testnet, or `chain` to override the chain entirely. Pass `feeToken`
|
|
109
109
|
* to set a default fee token for every transaction. Use `withRelay` with a
|
|
110
|
-
* `Relay.accounts` plugin to
|
|
110
|
+
* `Relay.accounts` plugin, or `http` to a relay that serves the `account_*`
|
|
111
|
+
* methods, to coordinate owner approvals.
|
|
111
112
|
*
|
|
112
113
|
* @example
|
|
113
114
|
* ```ts
|
|
@@ -34,7 +34,7 @@ import type * as Transaction from '../Transaction.js'
|
|
|
34
34
|
*
|
|
35
35
|
* The precompile validates the config and derives the address from its hash.
|
|
36
36
|
* To derive the address locally, use
|
|
37
|
-
* `AccountConfig.getAddress` or `Account.fromConfig
|
|
37
|
+
* `AccountConfig.getAddress` or `Account.fromConfig` with an initial config.
|
|
38
38
|
*
|
|
39
39
|
* @example
|
|
40
40
|
* ```ts
|
|
@@ -297,7 +297,6 @@ export declare namespace getOperation {
|
|
|
297
297
|
* '0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80',
|
|
298
298
|
* )
|
|
299
299
|
* const account = Account.fromConfig({
|
|
300
|
-
* address: 'infer',
|
|
301
300
|
* owners: [owner],
|
|
302
301
|
* })
|
|
303
302
|
* const client = createClient({
|
|
@@ -150,7 +150,12 @@ export async function simulateBlocks<
|
|
|
150
150
|
...call,
|
|
151
151
|
account,
|
|
152
152
|
data: call.dataSuffix
|
|
153
|
-
? concat([
|
|
153
|
+
? concat([
|
|
154
|
+
data || '0x',
|
|
155
|
+
call.dataSuffix.length % 2
|
|
156
|
+
? `0x0${call.dataSuffix.slice(2)}`
|
|
157
|
+
: call.dataSuffix,
|
|
158
|
+
])
|
|
154
159
|
: data,
|
|
155
160
|
from: call.from ?? account?.address,
|
|
156
161
|
} as const
|
package/tempo/chainConfig.ts
CHANGED
|
@@ -16,6 +16,10 @@ import type { Client } from '../clients/createClient.js'
|
|
|
16
16
|
import { maxUint256 } from '../constants/number.js'
|
|
17
17
|
import { BaseError } from '../errors/base.js'
|
|
18
18
|
import { ContractFunctionRevertedError } from '../errors/contract.js'
|
|
19
|
+
import {
|
|
20
|
+
MethodNotFoundRpcError,
|
|
21
|
+
MethodNotSupportedRpcError,
|
|
22
|
+
} from '../errors/rpc.js'
|
|
19
23
|
import type { Chain, ChainConfig as viem_ChainConfig } from '../types/chain.js'
|
|
20
24
|
import type { RpcBlock } from '../types/rpc.js'
|
|
21
25
|
import { isAddressEqual } from '../utils/address/isAddressEqual.js'
|
|
@@ -262,7 +266,10 @@ export const chainConfig = {
|
|
|
262
266
|
const coordinated =
|
|
263
267
|
(!!configurableIdentity || !!delegate) &&
|
|
264
268
|
!!request.owner &&
|
|
265
|
-
(
|
|
269
|
+
(await supportsAccounts(
|
|
270
|
+
client,
|
|
271
|
+
configurableIdentity?.account ?? delegate!.address,
|
|
272
|
+
))
|
|
266
273
|
if (configurableIdentity) {
|
|
267
274
|
const { account, local } = configurableIdentity
|
|
268
275
|
if (!configurableIdentity.config && !coordinated)
|
|
@@ -289,7 +296,7 @@ export const chainConfig = {
|
|
|
289
296
|
if (delegate) {
|
|
290
297
|
const config =
|
|
291
298
|
delegate.config ??
|
|
292
|
-
((client.
|
|
299
|
+
((await supportsAccounts(client, delegate.address))
|
|
293
300
|
? await getAction(
|
|
294
301
|
client,
|
|
295
302
|
getConfig,
|
|
@@ -657,6 +664,38 @@ async function isRegistered(client: Client, key: KeyAuthorizationManager.Key) {
|
|
|
657
664
|
)
|
|
658
665
|
}
|
|
659
666
|
|
|
667
|
+
/** Whether each transport serves the `account_*` methods, by transport. */
|
|
668
|
+
const accountsSupport = new WeakMap<object, Promise<boolean>>()
|
|
669
|
+
|
|
670
|
+
/**
|
|
671
|
+
* Whether the client's transport serves the `account_*` methods. Relay transports advertise
|
|
672
|
+
* them; other transports, such as `http` to a relay with `Relay.accounts`, answer one
|
|
673
|
+
* `account_getConfig` probe. Only a definitive answer is cached.
|
|
674
|
+
*/
|
|
675
|
+
async function supportsAccounts(client: Client, address: Address) {
|
|
676
|
+
const { transport } = client
|
|
677
|
+
if ((transport as { accounts?: boolean }).accounts === true) return true
|
|
678
|
+
const cached = accountsSupport.get(transport)
|
|
679
|
+
if (cached) return cached
|
|
680
|
+
const supported = getAction(
|
|
681
|
+
client,
|
|
682
|
+
getConfig,
|
|
683
|
+
'getConfig',
|
|
684
|
+
)({ address }).then(
|
|
685
|
+
() => true,
|
|
686
|
+
(error) => {
|
|
687
|
+
if (
|
|
688
|
+
!(error instanceof MethodNotFoundRpcError) &&
|
|
689
|
+
!(error instanceof MethodNotSupportedRpcError)
|
|
690
|
+
)
|
|
691
|
+
accountsSupport.delete(transport)
|
|
692
|
+
return false
|
|
693
|
+
},
|
|
694
|
+
)
|
|
695
|
+
accountsSupport.set(transport, supported)
|
|
696
|
+
return supported
|
|
697
|
+
}
|
|
698
|
+
|
|
660
699
|
/**
|
|
661
700
|
* Returns whether a request uses an expiring nonce: when asked for, when sponsored,
|
|
662
701
|
* or when another request for the same sender is in flight.
|
package/types/block.ts
CHANGED
|
@@ -46,6 +46,8 @@ export type Block<
|
|
|
46
46
|
parentHash: Hash
|
|
47
47
|
/** Root of the this block’s receipts trie */
|
|
48
48
|
receiptsRoot: Hex
|
|
49
|
+
/** Hash of the execution layer requests ([EIP-7685](https://eips.ethereum.org/EIPS/eip-7685)) */
|
|
50
|
+
requestsHash?: Hash | undefined
|
|
49
51
|
sealFields: Hex[]
|
|
50
52
|
/** SHA3 of the uncles data in this block */
|
|
51
53
|
sha3Uncles: Hash
|
package/types/eip1193.ts
CHANGED
package/types/fee.ts
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import type { OneOf } from './utils.js'
|
|
2
2
|
|
|
3
3
|
export type FeeHistory<quantity = bigint> = {
|
|
4
|
+
/**
|
|
5
|
+
* An array of block base fees per blob gas (in wei). This includes the next block after
|
|
6
|
+
* the newest of the returned range, because this value can be derived from the newest block.
|
|
7
|
+
* Zeroes are returned for pre-EIP-4844 blocks. */
|
|
8
|
+
baseFeePerBlobGas?: readonly quantity[] | undefined
|
|
4
9
|
/**
|
|
5
10
|
* An array of block base fees per gas (in wei). This includes the next block after
|
|
6
11
|
* the newest of the returned range, because this value can be derived from the newest block.
|
|
7
12
|
* Zeroes are returned for pre-EIP-1559 blocks. */
|
|
8
13
|
baseFeePerGas: quantity[]
|
|
14
|
+
/** An array of block blob gas used ratios. These are calculated as the ratio of blobGasUsed and the max blob gas per block. */
|
|
15
|
+
blobGasUsedRatio?: readonly number[] | undefined
|
|
9
16
|
/** An array of block gas used ratios. These are calculated as the ratio of gasUsed and gasLimit. */
|
|
10
17
|
gasUsedRatio: number[]
|
|
11
18
|
/** Lowest number block of the returned range. */
|
|
@@ -5,8 +5,13 @@ import type { RpcFeeHistory } from '../../types/rpc.js'
|
|
|
5
5
|
export type FormatFeeHistoryErrorType = ErrorType
|
|
6
6
|
|
|
7
7
|
export function formatFeeHistory(feeHistory: RpcFeeHistory): FeeHistory {
|
|
8
|
+
const { baseFeePerBlobGas, blobGasUsedRatio } = feeHistory
|
|
8
9
|
return {
|
|
10
|
+
...(baseFeePerBlobGas && {
|
|
11
|
+
baseFeePerBlobGas: baseFeePerBlobGas.map((value) => BigInt(value)),
|
|
12
|
+
}),
|
|
9
13
|
baseFeePerGas: feeHistory.baseFeePerGas.map((value) => BigInt(value)),
|
|
14
|
+
...(blobGasUsedRatio && { blobGasUsedRatio }),
|
|
10
15
|
gasUsedRatio: feeHistory.gasUsedRatio,
|
|
11
16
|
oldestBlock: BigInt(feeHistory.oldestBlock),
|
|
12
17
|
reward: feeHistory.reward?.map((reward) =>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Address } from 'abitype'
|
|
2
2
|
import { SignatureErc8010 } from 'ox/erc8010'
|
|
3
|
+
import * as Signature from 'ox/Signature'
|
|
3
4
|
import type { ErrorType } from '../../errors/utils.js'
|
|
4
5
|
import type { SignedAuthorization } from '../../types/authorization.js'
|
|
5
6
|
import type { ByteArray, Hex } from '../../types/misc.js'
|
|
@@ -42,7 +43,9 @@ export function serializeErc8010Signature<to extends To = 'hex'>(
|
|
|
42
43
|
nonce: BigInt(parameters.authorization.nonce),
|
|
43
44
|
r: BigInt(parameters.authorization.r),
|
|
44
45
|
s: BigInt(parameters.authorization.s),
|
|
45
|
-
yParity:
|
|
46
|
+
yParity:
|
|
47
|
+
parameters.authorization.yParity ??
|
|
48
|
+
Signature.vToYParity(Number(parameters.authorization.v)),
|
|
46
49
|
},
|
|
47
50
|
data,
|
|
48
51
|
signature,
|
|
@@ -19,7 +19,11 @@ export type ToPrefixedMessageErrorType =
|
|
|
19
19
|
export function toPrefixedMessage(message_: SignableMessage): Hex {
|
|
20
20
|
const message = (() => {
|
|
21
21
|
if (typeof message_ === 'string') return stringToHex(message_)
|
|
22
|
-
|
|
22
|
+
// Odd-length hex is left-padded to whole bytes, matching `hexToBytes`.
|
|
23
|
+
if (typeof message_.raw === 'string')
|
|
24
|
+
return message_.raw.length % 2
|
|
25
|
+
? (`0x0${message_.raw.slice(2)}` as Hex)
|
|
26
|
+
: message_.raw
|
|
23
27
|
return bytesToHex(message_.raw)
|
|
24
28
|
})()
|
|
25
29
|
const prefix = stringToHex(`${presignMessagePrefix}${size(message)}`)
|