viem 2.14.1 → 2.15.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +20 -0
- package/_cjs/accounts/hdKeyToAccount.js +2 -2
- package/_cjs/accounts/hdKeyToAccount.js.map +1 -1
- package/_cjs/accounts/index.js +4 -1
- package/_cjs/accounts/index.js.map +1 -1
- package/_cjs/accounts/mnemonicToAccount.js.map +1 -1
- package/_cjs/accounts/privateKeyToAccount.js +3 -1
- package/_cjs/accounts/privateKeyToAccount.js.map +1 -1
- package/_cjs/accounts/toAccount.js +1 -0
- package/_cjs/accounts/toAccount.js.map +1 -1
- package/_cjs/actions/public/getBlock.js +2 -2
- package/_cjs/actions/public/getBlock.js.map +1 -1
- package/_cjs/actions/public/getBlockTransactionCount.js +2 -2
- package/_cjs/actions/public/getBlockTransactionCount.js.map +1 -1
- package/_cjs/actions/public/getChainId.js +1 -1
- package/_cjs/actions/public/getChainId.js.map +1 -1
- package/_cjs/actions/public/getCode.js +1 -1
- package/_cjs/actions/public/getCode.js.map +1 -1
- package/_cjs/actions/public/getFeeHistory.js +1 -1
- package/_cjs/actions/public/getFeeHistory.js.map +1 -1
- package/_cjs/actions/public/getTransaction.js +3 -3
- package/_cjs/actions/public/getTransaction.js.map +1 -1
- package/_cjs/actions/public/getTransactionConfirmations.js +1 -1
- package/_cjs/actions/public/getTransactionCount.js +1 -1
- package/_cjs/actions/public/getTransactionCount.js.map +1 -1
- package/_cjs/actions/public/getTransactionReceipt.js +1 -1
- package/_cjs/actions/public/getTransactionReceipt.js.map +1 -1
- package/_cjs/actions/wallet/addChain.js +1 -1
- package/_cjs/actions/wallet/addChain.js.map +1 -1
- package/_cjs/actions/wallet/getAddresses.js +1 -1
- package/_cjs/actions/wallet/getAddresses.js.map +1 -1
- package/_cjs/actions/wallet/getPermissions.js +1 -1
- package/_cjs/actions/wallet/getPermissions.js.map +1 -1
- package/_cjs/actions/wallet/prepareTransactionRequest.js +30 -13
- package/_cjs/actions/wallet/prepareTransactionRequest.js.map +1 -1
- package/_cjs/actions/wallet/requestAddresses.js +1 -1
- package/_cjs/actions/wallet/requestAddresses.js.map +1 -1
- package/_cjs/chains/definitions/berachainTestnetbArtio.js +24 -0
- package/_cjs/chains/definitions/berachainTestnetbArtio.js.map +1 -0
- package/_cjs/chains/definitions/confluxESpace.js +2 -2
- package/_cjs/chains/definitions/confluxESpaceTestnet.js +2 -2
- package/_cjs/chains/definitions/mode.js +15 -0
- package/_cjs/chains/definitions/mode.js.map +1 -1
- package/_cjs/chains/index.js +8 -6
- package/_cjs/chains/index.js.map +1 -1
- package/_cjs/clients/transports/createTransport.js +12 -2
- package/_cjs/clients/transports/createTransport.js.map +1 -1
- package/_cjs/errors/version.js +1 -1
- package/_cjs/experimental/erc7715/actions/issuePermissions.js +1 -1
- package/_cjs/experimental/erc7715/actions/issuePermissions.js.map +1 -1
- package/_cjs/index.js +4 -1
- package/_cjs/index.js.map +1 -1
- package/_cjs/nonce/index.js +8 -0
- package/_cjs/nonce/index.js.map +1 -0
- package/_cjs/utils/buildRequest.js +10 -3
- package/_cjs/utils/buildRequest.js.map +1 -1
- package/_cjs/utils/index.js +4 -1
- package/_cjs/utils/index.js.map +1 -1
- package/_cjs/utils/nonceManager.js +73 -0
- package/_cjs/utils/nonceManager.js.map +1 -0
- package/_cjs/utils/promise/withDedupe.js +16 -0
- package/_cjs/utils/promise/withDedupe.js.map +1 -0
- package/_esm/accounts/hdKeyToAccount.js +2 -2
- package/_esm/accounts/hdKeyToAccount.js.map +1 -1
- package/_esm/accounts/index.js +1 -0
- package/_esm/accounts/index.js.map +1 -1
- package/_esm/accounts/mnemonicToAccount.js.map +1 -1
- package/_esm/accounts/privateKeyToAccount.js +3 -1
- package/_esm/accounts/privateKeyToAccount.js.map +1 -1
- package/_esm/accounts/toAccount.js +1 -0
- package/_esm/accounts/toAccount.js.map +1 -1
- package/_esm/actions/public/getBlock.js +2 -2
- package/_esm/actions/public/getBlock.js.map +1 -1
- package/_esm/actions/public/getBlockTransactionCount.js +2 -2
- package/_esm/actions/public/getBlockTransactionCount.js.map +1 -1
- package/_esm/actions/public/getChainId.js +1 -1
- package/_esm/actions/public/getChainId.js.map +1 -1
- package/_esm/actions/public/getCode.js +1 -1
- package/_esm/actions/public/getCode.js.map +1 -1
- package/_esm/actions/public/getFeeHistory.js +1 -1
- package/_esm/actions/public/getFeeHistory.js.map +1 -1
- package/_esm/actions/public/getTransaction.js +3 -3
- package/_esm/actions/public/getTransaction.js.map +1 -1
- package/_esm/actions/public/getTransactionConfirmations.js +1 -1
- package/_esm/actions/public/getTransactionCount.js +1 -1
- package/_esm/actions/public/getTransactionCount.js.map +1 -1
- package/_esm/actions/public/getTransactionReceipt.js +1 -1
- package/_esm/actions/public/getTransactionReceipt.js.map +1 -1
- package/_esm/actions/wallet/addChain.js +1 -1
- package/_esm/actions/wallet/addChain.js.map +1 -1
- package/_esm/actions/wallet/getAddresses.js +1 -1
- package/_esm/actions/wallet/getAddresses.js.map +1 -1
- package/_esm/actions/wallet/getPermissions.js +1 -1
- package/_esm/actions/wallet/getPermissions.js.map +1 -1
- package/_esm/actions/wallet/prepareTransactionRequest.js +31 -14
- package/_esm/actions/wallet/prepareTransactionRequest.js.map +1 -1
- package/_esm/actions/wallet/requestAddresses.js +1 -1
- package/_esm/actions/wallet/requestAddresses.js.map +1 -1
- package/_esm/chains/definitions/berachainTestnetbArtio.js +21 -0
- package/_esm/chains/definitions/berachainTestnetbArtio.js.map +1 -0
- package/_esm/chains/definitions/confluxESpace.js +2 -2
- package/_esm/chains/definitions/confluxESpaceTestnet.js +2 -2
- package/_esm/chains/definitions/mode.js +15 -0
- package/_esm/chains/definitions/mode.js.map +1 -1
- package/_esm/chains/index.js +1 -0
- package/_esm/chains/index.js.map +1 -1
- package/_esm/clients/transports/createTransport.js +12 -2
- package/_esm/clients/transports/createTransport.js.map +1 -1
- package/_esm/errors/version.js +1 -1
- package/_esm/experimental/erc7715/actions/issuePermissions.js +1 -1
- package/_esm/experimental/erc7715/actions/issuePermissions.js.map +1 -1
- package/_esm/index.js +1 -0
- package/_esm/index.js.map +1 -1
- package/_esm/nonce/index.js +3 -0
- package/_esm/nonce/index.js.map +1 -0
- package/_esm/utils/buildRequest.js +10 -3
- package/_esm/utils/buildRequest.js.map +1 -1
- package/_esm/utils/index.js +1 -0
- package/_esm/utils/index.js.map +1 -1
- package/_esm/utils/nonceManager.js +84 -0
- package/_esm/utils/nonceManager.js.map +1 -0
- package/_esm/utils/promise/withDedupe.js +14 -0
- package/_esm/utils/promise/withDedupe.js.map +1 -0
- package/_types/accounts/hdKeyToAccount.d.ts +3 -2
- package/_types/accounts/hdKeyToAccount.d.ts.map +1 -1
- package/_types/accounts/index.d.ts +4 -3
- package/_types/accounts/index.d.ts.map +1 -1
- package/_types/accounts/mnemonicToAccount.d.ts +2 -1
- package/_types/accounts/mnemonicToAccount.d.ts.map +1 -1
- package/_types/accounts/privateKeyToAccount.d.ts +5 -1
- package/_types/accounts/privateKeyToAccount.d.ts.map +1 -1
- package/_types/accounts/toAccount.d.ts.map +1 -1
- package/_types/accounts/types.d.ts +2 -0
- package/_types/accounts/types.d.ts.map +1 -1
- package/_types/actions/public/getBlock.d.ts.map +1 -1
- package/_types/actions/public/getBlockTransactionCount.d.ts.map +1 -1
- package/_types/actions/public/getChainId.d.ts.map +1 -1
- package/_types/actions/public/getCode.d.ts.map +1 -1
- package/_types/actions/public/getFeeHistory.d.ts.map +1 -1
- package/_types/actions/public/getTransaction.d.ts.map +1 -1
- package/_types/actions/public/getTransactionCount.d.ts.map +1 -1
- package/_types/actions/public/getTransactionReceipt.d.ts.map +1 -1
- package/_types/actions/wallet/getAddresses.d.ts.map +1 -1
- package/_types/actions/wallet/getPermissions.d.ts.map +1 -1
- package/_types/actions/wallet/prepareTransactionRequest.d.ts.map +1 -1
- package/_types/chains/definitions/berachainTestnetbArtio.d.ts +35 -0
- package/_types/chains/definitions/berachainTestnetbArtio.d.ts.map +1 -0
- package/_types/chains/definitions/confluxESpace.d.ts +2 -2
- package/_types/chains/definitions/confluxESpaceTestnet.d.ts +2 -2
- package/_types/chains/definitions/mode.d.ts +15 -0
- package/_types/chains/definitions/mode.d.ts.map +1 -1
- package/_types/chains/index.d.ts +1 -0
- package/_types/chains/index.d.ts.map +1 -1
- package/_types/clients/transports/createTransport.d.ts.map +1 -1
- package/_types/errors/version.d.ts +1 -1
- package/_types/experimental/erc7715/actions/issuePermissions.d.ts.map +1 -1
- package/_types/index.d.ts +1 -0
- package/_types/index.d.ts.map +1 -1
- package/_types/nonce/index.d.ts +2 -0
- package/_types/nonce/index.d.ts.map +1 -0
- package/_types/types/eip1193.d.ts +3 -0
- package/_types/types/eip1193.d.ts.map +1 -1
- package/_types/utils/buildRequest.d.ts.map +1 -1
- package/_types/utils/index.d.ts +1 -0
- package/_types/utils/index.d.ts.map +1 -1
- package/_types/utils/nonceManager.d.ts +51 -0
- package/_types/utils/nonceManager.d.ts.map +1 -0
- package/_types/utils/promise/withDedupe.d.ts +11 -0
- package/_types/utils/promise/withDedupe.d.ts.map +1 -0
- package/accounts/hdKeyToAccount.ts +11 -2
- package/accounts/index.ts +10 -0
- package/accounts/mnemonicToAccount.ts +3 -0
- package/accounts/privateKeyToAccount.ts +11 -1
- package/accounts/toAccount.ts +1 -0
- package/accounts/types.ts +2 -0
- package/actions/public/getBlock.ts +14 -8
- package/actions/public/getBlockTransactionCount.ts +14 -8
- package/actions/public/getChainId.ts +6 -3
- package/actions/public/getCode.ts +7 -4
- package/actions/public/getFeeHistory.ts +11 -8
- package/actions/public/getTransaction.ts +21 -12
- package/actions/public/getTransactionConfirmations.ts +1 -1
- package/actions/public/getTransactionCount.ts +7 -4
- package/actions/public/getTransactionReceipt.ts +7 -4
- package/actions/wallet/addChain.ts +1 -1
- package/actions/wallet/getAddresses.ts +4 -1
- package/actions/wallet/getPermissions.ts +4 -1
- package/actions/wallet/prepareTransactionRequest.ts +31 -16
- package/actions/wallet/requestAddresses.ts +1 -1
- package/chains/definitions/berachainTestnetbArtio.ts +21 -0
- package/chains/definitions/confluxESpace.ts +2 -2
- package/chains/definitions/confluxESpaceTestnet.ts +2 -2
- package/chains/definitions/mode.ts +15 -0
- package/chains/index.ts +1 -0
- package/clients/transports/createTransport.ts +12 -2
- package/errors/version.ts +1 -1
- package/experimental/erc7715/actions/issuePermissions.ts +7 -4
- package/index.ts +7 -0
- package/nonce/index.ts +9 -0
- package/nonce/package.json +6 -0
- package/package.json +6 -1
- package/types/eip1193.ts +4 -0
- package/utils/buildRequest.ts +104 -88
- package/utils/index.ts +7 -0
- package/utils/nonceManager.ts +132 -0
- package/utils/promise/withDedupe.ts +21 -0
@@ -41,8 +41,11 @@ export async function getChainId<
|
|
41
41
|
TChain extends Chain | undefined,
|
42
42
|
TAccount extends Account | undefined,
|
43
43
|
>(client: Client<Transport, TChain, TAccount>): Promise<GetChainIdReturnType> {
|
44
|
-
const chainIdHex = await client.request(
|
45
|
-
|
46
|
-
|
44
|
+
const chainIdHex = await client.request(
|
45
|
+
{
|
46
|
+
method: 'eth_chainId',
|
47
|
+
},
|
48
|
+
{ dedupe: true },
|
49
|
+
)
|
47
50
|
return hexToNumber(chainIdHex)
|
48
51
|
}
|
@@ -61,10 +61,13 @@ export async function getCode<TChain extends Chain | undefined>(
|
|
61
61
|
): Promise<GetCodeReturnType> {
|
62
62
|
const blockNumberHex =
|
63
63
|
blockNumber !== undefined ? numberToHex(blockNumber) : undefined
|
64
|
-
const hex = await client.request(
|
65
|
-
|
66
|
-
|
67
|
-
|
64
|
+
const hex = await client.request(
|
65
|
+
{
|
66
|
+
method: 'eth_getCode',
|
67
|
+
params: [address, blockNumberHex || blockTag],
|
68
|
+
},
|
69
|
+
{ dedupe: Boolean(blockNumberHex) },
|
70
|
+
)
|
68
71
|
if (hex === '0x') return undefined
|
69
72
|
return hex
|
70
73
|
}
|
@@ -78,13 +78,16 @@ export async function getFeeHistory<TChain extends Chain | undefined>(
|
|
78
78
|
}: GetFeeHistoryParameters,
|
79
79
|
): Promise<GetFeeHistoryReturnType> {
|
80
80
|
const blockNumberHex = blockNumber ? numberToHex(blockNumber) : undefined
|
81
|
-
const feeHistory = await client.request(
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
81
|
+
const feeHistory = await client.request(
|
82
|
+
{
|
83
|
+
method: 'eth_feeHistory',
|
84
|
+
params: [
|
85
|
+
numberToHex(blockCount),
|
86
|
+
blockNumberHex || blockTag,
|
87
|
+
rewardPercentiles,
|
88
|
+
],
|
89
|
+
},
|
90
|
+
{ dedupe: Boolean(blockNumberHex) },
|
91
|
+
)
|
89
92
|
return formatFeeHistory(feeHistory)
|
90
93
|
}
|
@@ -108,20 +108,29 @@ export async function getTransaction<
|
|
108
108
|
|
109
109
|
let transaction: RpcTransaction | null = null
|
110
110
|
if (hash) {
|
111
|
-
transaction = await client.request(
|
112
|
-
|
113
|
-
|
114
|
-
|
111
|
+
transaction = await client.request(
|
112
|
+
{
|
113
|
+
method: 'eth_getTransactionByHash',
|
114
|
+
params: [hash],
|
115
|
+
},
|
116
|
+
{ dedupe: true },
|
117
|
+
)
|
115
118
|
} else if (blockHash) {
|
116
|
-
transaction = await client.request(
|
117
|
-
|
118
|
-
|
119
|
-
|
119
|
+
transaction = await client.request(
|
120
|
+
{
|
121
|
+
method: 'eth_getTransactionByBlockHashAndIndex',
|
122
|
+
params: [blockHash, numberToHex(index)],
|
123
|
+
},
|
124
|
+
{ dedupe: true },
|
125
|
+
)
|
120
126
|
} else if (blockNumberHex || blockTag) {
|
121
|
-
transaction = await client.request(
|
122
|
-
|
123
|
-
|
124
|
-
|
127
|
+
transaction = await client.request(
|
128
|
+
{
|
129
|
+
method: 'eth_getTransactionByBlockNumberAndIndex',
|
130
|
+
params: [blockNumberHex || blockTag, numberToHex(index)],
|
131
|
+
},
|
132
|
+
{ dedupe: Boolean(blockNumberHex) },
|
133
|
+
)
|
125
134
|
}
|
126
135
|
|
127
136
|
if (!transaction)
|
@@ -69,7 +69,7 @@ export async function getTransactionConfirmations<
|
|
69
69
|
const [blockNumber, transaction] = await Promise.all([
|
70
70
|
getAction(client, getBlockNumber, 'getBlockNumber')({}),
|
71
71
|
hash
|
72
|
-
? getAction(client, getTransaction, '
|
72
|
+
? getAction(client, getTransaction, 'getTransaction')({ hash })
|
73
73
|
: undefined,
|
74
74
|
])
|
75
75
|
const transactionBlockNumber =
|
@@ -69,9 +69,12 @@ export async function getTransactionCount<
|
|
69
69
|
client: Client<Transport, TChain, TAccount>,
|
70
70
|
{ address, blockTag = 'latest', blockNumber }: GetTransactionCountParameters,
|
71
71
|
): Promise<GetTransactionCountReturnType> {
|
72
|
-
const count = await client.request(
|
73
|
-
|
74
|
-
|
75
|
-
|
72
|
+
const count = await client.request(
|
73
|
+
{
|
74
|
+
method: 'eth_getTransactionCount',
|
75
|
+
params: [address, blockNumber ? numberToHex(blockNumber) : blockTag],
|
76
|
+
},
|
77
|
+
{ dedupe: Boolean(blockNumber) },
|
78
|
+
)
|
76
79
|
return hexToNumber(count)
|
77
80
|
}
|
@@ -55,10 +55,13 @@ export async function getTransactionReceipt<TChain extends Chain | undefined>(
|
|
55
55
|
client: Client<Transport, TChain>,
|
56
56
|
{ hash }: GetTransactionReceiptParameters,
|
57
57
|
) {
|
58
|
-
const receipt = await client.request(
|
59
|
-
|
60
|
-
|
61
|
-
|
58
|
+
const receipt = await client.request(
|
59
|
+
{
|
60
|
+
method: 'eth_getTransactionReceipt',
|
61
|
+
params: [hash],
|
62
|
+
},
|
63
|
+
{ dedupe: true },
|
64
|
+
)
|
62
65
|
|
63
66
|
if (!receipt) throw new TransactionReceiptNotFoundError({ hash })
|
64
67
|
|
@@ -45,6 +45,9 @@ export async function getAddresses<
|
|
45
45
|
client: Client<Transport, TChain, TAccount>,
|
46
46
|
): Promise<GetAddressesReturnType> {
|
47
47
|
if (client.account?.type === 'local') return [client.account.address]
|
48
|
-
const addresses = await client.request(
|
48
|
+
const addresses = await client.request(
|
49
|
+
{ method: 'eth_accounts' },
|
50
|
+
{ dedupe: true },
|
51
|
+
)
|
49
52
|
return addresses.map((address) => checksumAddress(address))
|
50
53
|
}
|
@@ -34,6 +34,9 @@ export async function getPermissions<
|
|
34
34
|
TChain extends Chain | undefined,
|
35
35
|
TAccount extends Account | undefined = undefined,
|
36
36
|
>(client: Client<Transport, TChain, TAccount>) {
|
37
|
-
const permissions = await client.request(
|
37
|
+
const permissions = await client.request(
|
38
|
+
{ method: 'wallet_getPermissions' },
|
39
|
+
{ dedupe: true },
|
40
|
+
)
|
38
41
|
return permissions
|
39
42
|
}
|
@@ -63,7 +63,7 @@ import {
|
|
63
63
|
type GetTransactionType,
|
64
64
|
getTransactionType,
|
65
65
|
} from '../../utils/transaction/getTransactionType.js'
|
66
|
-
import { getChainId } from '../public/getChainId.js'
|
66
|
+
import { getChainId as getChainId_ } from '../public/getChainId.js'
|
67
67
|
|
68
68
|
export const defaultParameters = [
|
69
69
|
'blobVersionedHashes',
|
@@ -243,7 +243,6 @@ export async function prepareTransactionRequest<
|
|
243
243
|
account: account_ = client.account,
|
244
244
|
blobs,
|
245
245
|
chain,
|
246
|
-
chainId,
|
247
246
|
gas,
|
248
247
|
kzg,
|
249
248
|
nonce,
|
@@ -265,6 +264,16 @@ export async function prepareTransactionRequest<
|
|
265
264
|
return block
|
266
265
|
}
|
267
266
|
|
267
|
+
let chainId: number | undefined
|
268
|
+
async function getChainId(): Promise<number> {
|
269
|
+
if (chainId) return chainId
|
270
|
+
if (chain) return chain.id
|
271
|
+
if (typeof args.chainId !== 'undefined') return args.chainId
|
272
|
+
const chainId_ = await getAction(client, getChainId_, 'getChainId')({})
|
273
|
+
chainId = chainId_
|
274
|
+
return chainId
|
275
|
+
}
|
276
|
+
|
268
277
|
if (
|
269
278
|
(parameters.includes('blobVersionedHashes') ||
|
270
279
|
parameters.includes('sidecars')) &&
|
@@ -292,21 +301,27 @@ export async function prepareTransactionRequest<
|
|
292
301
|
}
|
293
302
|
}
|
294
303
|
|
295
|
-
if (parameters.includes('chainId'))
|
296
|
-
if (chain) request.chainId = chain.id
|
297
|
-
else if (typeof chainId !== 'undefined') request.chainId = chainId
|
298
|
-
else request.chainId = await getAction(client, getChainId, 'getChainId')({})
|
299
|
-
}
|
304
|
+
if (parameters.includes('chainId')) request.chainId = await getChainId()
|
300
305
|
|
301
|
-
if (parameters.includes('nonce') && typeof nonce === 'undefined' && account)
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
}
|
306
|
+
if (parameters.includes('nonce') && typeof nonce === 'undefined' && account) {
|
307
|
+
if (account.nonceManager) {
|
308
|
+
const chainId = await getChainId()
|
309
|
+
request.nonce = await account.nonceManager.consume({
|
310
|
+
address: account.address,
|
311
|
+
chainId,
|
312
|
+
client,
|
313
|
+
})
|
314
|
+
} else {
|
315
|
+
request.nonce = await getAction(
|
316
|
+
client,
|
317
|
+
getTransactionCount,
|
318
|
+
'getTransactionCount',
|
319
|
+
)({
|
320
|
+
address: account.address,
|
321
|
+
blockTag: 'pending',
|
322
|
+
})
|
323
|
+
}
|
324
|
+
}
|
310
325
|
|
311
326
|
if (
|
312
327
|
(parameters.includes('fees') || parameters.includes('type')) &&
|
@@ -44,7 +44,7 @@ export async function requestAddresses<
|
|
44
44
|
): Promise<RequestAddressesReturnType> {
|
45
45
|
const addresses = await client.request(
|
46
46
|
{ method: 'eth_requestAccounts' },
|
47
|
-
{ retryCount: 0 },
|
47
|
+
{ dedupe: true, retryCount: 0 },
|
48
48
|
)
|
49
49
|
return addresses.map((address) => getAddress(address))
|
50
50
|
}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import { defineChain } from '../../utils/chain/defineChain.js'
|
2
|
+
|
3
|
+
export const berachainTestnetbArtio = /*#__PURE__*/ defineChain({
|
4
|
+
id: 80084,
|
5
|
+
name: 'Berachain bArtio',
|
6
|
+
nativeCurrency: {
|
7
|
+
decimals: 18,
|
8
|
+
name: 'BERA Token',
|
9
|
+
symbol: 'BERA',
|
10
|
+
},
|
11
|
+
rpcUrls: {
|
12
|
+
default: { http: ['https://bartio.rpc.berachain.com'] },
|
13
|
+
},
|
14
|
+
blockExplorers: {
|
15
|
+
default: {
|
16
|
+
name: 'Berachain bArtio Beratrail',
|
17
|
+
url: 'https://bartio.beratrail.io',
|
18
|
+
},
|
19
|
+
},
|
20
|
+
testnet: true,
|
21
|
+
})
|
@@ -6,8 +6,8 @@ export const confluxESpace = /*#__PURE__*/ defineChain({
|
|
6
6
|
nativeCurrency: { name: 'Conflux', symbol: 'CFX', decimals: 18 },
|
7
7
|
rpcUrls: {
|
8
8
|
default: {
|
9
|
-
http: ['https://evm.confluxrpc.
|
10
|
-
webSocket: ['wss://evm.confluxrpc.
|
9
|
+
http: ['https://evm.confluxrpc.com'],
|
10
|
+
webSocket: ['wss://evm.confluxrpc.com/ws'],
|
11
11
|
},
|
12
12
|
},
|
13
13
|
blockExplorers: {
|
@@ -8,8 +8,8 @@ export const confluxESpaceTestnet = /*#__PURE__*/ defineChain({
|
|
8
8
|
nativeCurrency: { name: 'Conflux', symbol: 'CFX', decimals: 18 },
|
9
9
|
rpcUrls: {
|
10
10
|
default: {
|
11
|
-
http: ['https://evmtestnet.confluxrpc.
|
12
|
-
webSocket: ['wss://evmtestnet.confluxrpc.
|
11
|
+
http: ['https://evmtestnet.confluxrpc.com'],
|
12
|
+
webSocket: ['wss://evmtestnet.confluxrpc.com/ws'],
|
13
13
|
},
|
14
14
|
},
|
15
15
|
blockExplorers: {
|
@@ -22,6 +22,21 @@ export const mode = /*#__PURE__*/ defineChain({
|
|
22
22
|
address: '0xca11bde05977b3631167028862be2a173976ca11',
|
23
23
|
blockCreated: 2465882,
|
24
24
|
},
|
25
|
+
l2OutputOracle: {
|
26
|
+
[sourceId]: {
|
27
|
+
address: '0x4317ba146D4933D889518a3e5E11Fe7a53199b04',
|
28
|
+
},
|
29
|
+
},
|
30
|
+
portal: {
|
31
|
+
[sourceId]: {
|
32
|
+
address: '0x8B34b14c7c7123459Cf3076b8Cb929BE097d0C07',
|
33
|
+
},
|
34
|
+
},
|
35
|
+
l1StandardBridge: {
|
36
|
+
[sourceId]: {
|
37
|
+
address: '0x735aDBbE72226BD52e818E7181953f42E3b0FF21',
|
38
|
+
},
|
39
|
+
},
|
25
40
|
},
|
26
41
|
sourceId,
|
27
42
|
})
|
package/chains/index.ts
CHANGED
@@ -29,6 +29,7 @@ export { beamTestnet } from './definitions/beamTestnet.js'
|
|
29
29
|
export { bearNetworkChainMainnet } from './definitions/bearNetworkChainMainnet.js'
|
30
30
|
export { bearNetworkChainTestnet } from './definitions/bearNetworkChainTestnet.js'
|
31
31
|
export { berachainTestnet } from './definitions/berachainTestnet.js'
|
32
|
+
export { berachainTestnetbArtio } from './definitions/berachainTestnetbArtio.js'
|
32
33
|
export { bevmMainnet } from './definitions/bevmMainnet.js'
|
33
34
|
export { bitkub } from './definitions/bitkub.js'
|
34
35
|
export { bitkubTestnet } from './definitions/bitkubTestnet.js'
|
@@ -2,6 +2,7 @@ import type { ErrorType } from '../../errors/utils.js'
|
|
2
2
|
import type { Chain } from '../../types/chain.js'
|
3
3
|
import type { EIP1193RequestFn } from '../../types/eip1193.js'
|
4
4
|
import { buildRequest } from '../../utils/buildRequest.js'
|
5
|
+
import { uid as uid_ } from '../../utils/uid.js'
|
5
6
|
import type { ClientConfig } from '../createClient.js'
|
6
7
|
|
7
8
|
export type TransportConfig<
|
@@ -61,9 +62,18 @@ export function createTransport<
|
|
61
62
|
}: TransportConfig<TType>,
|
62
63
|
value?: TRpcAttributes | undefined,
|
63
64
|
): ReturnType<Transport<TType, TRpcAttributes>> {
|
65
|
+
const uid = uid_()
|
64
66
|
return {
|
65
|
-
config: {
|
66
|
-
|
67
|
+
config: {
|
68
|
+
key,
|
69
|
+
name,
|
70
|
+
request,
|
71
|
+
retryCount,
|
72
|
+
retryDelay,
|
73
|
+
timeout,
|
74
|
+
type,
|
75
|
+
},
|
76
|
+
request: buildRequest(request, { retryCount, retryDelay, uid }),
|
67
77
|
value,
|
68
78
|
}
|
69
79
|
}
|
package/errors/version.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export const version = '2.
|
1
|
+
export const version = '2.15.0'
|
@@ -84,10 +84,13 @@ export async function issuePermissions(
|
|
84
84
|
parameters: IssuePermissionsParameters,
|
85
85
|
): Promise<IssuePermissionsReturnType> {
|
86
86
|
const { expiry, permissions, signer } = parameters
|
87
|
-
const result = await client.request(
|
88
|
-
|
89
|
-
|
90
|
-
|
87
|
+
const result = await client.request(
|
88
|
+
{
|
89
|
+
method: 'wallet_issuePermissions',
|
90
|
+
params: [parseParameters({ expiry, permissions, signer })],
|
91
|
+
},
|
92
|
+
{ retryCount: 0 },
|
93
|
+
)
|
91
94
|
return parseResult(result) as IssuePermissionsReturnType
|
92
95
|
}
|
93
96
|
|
package/index.ts
CHANGED
@@ -1655,3 +1655,10 @@ export {
|
|
1655
1655
|
domainSeparator,
|
1656
1656
|
getTypesForEIP712Domain,
|
1657
1657
|
} from './utils/typedData.js'
|
1658
|
+
export {
|
1659
|
+
type CreateNonceManagerParameters,
|
1660
|
+
type NonceManager,
|
1661
|
+
type NonceManagerSource,
|
1662
|
+
createNonceManager,
|
1663
|
+
nonceManager,
|
1664
|
+
} from './utils/nonceManager.js'
|
package/nonce/index.ts
ADDED
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "viem",
|
3
3
|
"description": "TypeScript Interface for Ethereum",
|
4
|
-
"version": "2.
|
4
|
+
"version": "2.15.0",
|
5
5
|
"main": "./_cjs/index.js",
|
6
6
|
"module": "./_esm/index.js",
|
7
7
|
"types": "./_types/index.d.ts",
|
@@ -64,6 +64,11 @@
|
|
64
64
|
"import": "./_esm/node/index.js",
|
65
65
|
"default": "./_cjs/node/index.js"
|
66
66
|
},
|
67
|
+
"./nonce": {
|
68
|
+
"types": "./_types/nonce/index.d.ts",
|
69
|
+
"import": "./_esm/nonce/index.js",
|
70
|
+
"default": "./_cjs/nonce/index.js"
|
71
|
+
},
|
67
72
|
"./op-stack": {
|
68
73
|
"types": "./_types/op-stack/index.d.ts",
|
69
74
|
"import": "./_esm/op-stack/index.js",
|
package/types/eip1193.ts
CHANGED
@@ -1519,10 +1519,14 @@ export type EIP1193Parameters<
|
|
1519
1519
|
}
|
1520
1520
|
|
1521
1521
|
export type EIP1193RequestOptions = {
|
1522
|
+
// Deduplicate in-flight requests.
|
1523
|
+
dedupe?: boolean | undefined
|
1522
1524
|
// The base delay (in ms) between retries.
|
1523
1525
|
retryDelay?: number | undefined
|
1524
1526
|
// The max number of times to retry.
|
1525
1527
|
retryCount?: number | undefined
|
1528
|
+
/** Unique identifier for the request. */
|
1529
|
+
uid?: string | undefined
|
1526
1530
|
}
|
1527
1531
|
|
1528
1532
|
type DerivedRpcSchema<
|