viem 2.22.14 → 2.22.16
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 +20 -0
- package/_cjs/actions/wallet/prepareTransactionRequest.js +19 -12
- package/_cjs/actions/wallet/prepareTransactionRequest.js.map +1 -1
- package/_cjs/chains/definitions/etp.js +23 -0
- package/_cjs/chains/definitions/etp.js.map +1 -0
- package/_cjs/chains/definitions/happychainTestnet.js +33 -0
- package/_cjs/chains/definitions/happychainTestnet.js.map +1 -0
- package/_cjs/chains/definitions/ultra.js +23 -0
- package/_cjs/chains/definitions/ultra.js.map +1 -0
- package/_cjs/chains/index.js +15 -9
- package/_cjs/chains/index.js.map +1 -1
- package/_cjs/errors/version.js +1 -1
- package/_cjs/utils/abi/encodeEventTopics.js +3 -1
- package/_cjs/utils/abi/encodeEventTopics.js.map +1 -1
- package/_cjs/utils/buildRequest.js +1 -2
- package/_cjs/utils/buildRequest.js.map +1 -1
- package/_esm/actions/wallet/prepareTransactionRequest.js +19 -12
- package/_esm/actions/wallet/prepareTransactionRequest.js.map +1 -1
- package/_esm/chains/definitions/etp.js +20 -0
- package/_esm/chains/definitions/etp.js.map +1 -0
- package/_esm/chains/definitions/happychainTestnet.js +30 -0
- package/_esm/chains/definitions/happychainTestnet.js.map +1 -0
- package/_esm/chains/definitions/ultra.js +20 -0
- package/_esm/chains/definitions/ultra.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/utils/abi/encodeEventTopics.js +3 -1
- package/_esm/utils/abi/encodeEventTopics.js.map +1 -1
- package/_esm/utils/buildRequest.js +1 -2
- package/_esm/utils/buildRequest.js.map +1 -1
- package/_types/actions/wallet/prepareTransactionRequest.d.ts +2 -0
- package/_types/actions/wallet/prepareTransactionRequest.d.ts.map +1 -1
- package/_types/chains/definitions/etp.d.ts +37 -0
- package/_types/chains/definitions/etp.d.ts.map +1 -0
- package/_types/chains/definitions/happychainTestnet.d.ts +34 -0
- package/_types/chains/definitions/happychainTestnet.d.ts.map +1 -0
- package/_types/chains/definitions/ultra.d.ts +37 -0
- package/_types/chains/definitions/ultra.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/utils/abi/encodeEventTopics.d.ts.map +1 -1
- package/_types/utils/buildRequest.d.ts.map +1 -1
- package/actions/wallet/prepareTransactionRequest.ts +23 -15
- package/chains/definitions/etp.ts +20 -0
- package/chains/definitions/happychainTestnet.ts +30 -0
- package/chains/definitions/ultra.ts +20 -0
- package/chains/index.ts +3 -0
- package/errors/version.ts +1 -1
- package/package.json +1 -1
- package/utils/abi/encodeEventTopics.ts +3 -1
- package/utils/buildRequest.ts +1 -2
@@ -76,6 +76,9 @@ export const defaultParameters = [
|
|
76
76
|
'type',
|
77
77
|
] as const
|
78
78
|
|
79
|
+
/** @internal */
|
80
|
+
export const eip1559NetworkCache = /*#__PURE__*/ new Map<string, boolean>()
|
81
|
+
|
79
82
|
export type PrepareTransactionRequestParameterType =
|
80
83
|
| 'blobVersionedHashes'
|
81
84
|
| 'chainId'
|
@@ -325,10 +328,13 @@ export async function prepareTransactionRequest<
|
|
325
328
|
request as TransactionSerializable,
|
326
329
|
) as any
|
327
330
|
} catch {
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
typeof block?.baseFeePerGas === 'bigint'
|
331
|
+
let isEip1559Network = eip1559NetworkCache.get(client.uid)
|
332
|
+
if (typeof isEip1559Network === 'undefined') {
|
333
|
+
const block = await getBlock()
|
334
|
+
isEip1559Network = typeof block?.baseFeePerGas === 'bigint'
|
335
|
+
eip1559NetworkCache.set(client.uid, isEip1559Network)
|
336
|
+
}
|
337
|
+
request.type = isEip1559Network ? 'eip1559' : 'legacy'
|
332
338
|
}
|
333
339
|
}
|
334
340
|
|
@@ -369,17 +375,19 @@ export async function prepareTransactionRequest<
|
|
369
375
|
)
|
370
376
|
throw new Eip1559FeesNotSupportedError()
|
371
377
|
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
378
|
+
if (typeof args.gasPrice === 'undefined') {
|
379
|
+
const block = await getBlock()
|
380
|
+
const { gasPrice: gasPrice_ } = await internal_estimateFeesPerGas(
|
381
|
+
client,
|
382
|
+
{
|
383
|
+
block: block as Block,
|
384
|
+
chain,
|
385
|
+
request: request as PrepareTransactionRequestParameters,
|
386
|
+
type: 'legacy',
|
387
|
+
},
|
388
|
+
)
|
389
|
+
request.gasPrice = gasPrice_
|
390
|
+
}
|
383
391
|
}
|
384
392
|
}
|
385
393
|
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import { defineChain } from '../../utils/chain/defineChain.js'
|
2
|
+
|
3
|
+
export const etp = /*#__PURE__*/ defineChain({
|
4
|
+
id: 20_256_789,
|
5
|
+
name: 'ETP Mainnet',
|
6
|
+
nativeCurrency: {
|
7
|
+
decimals: 18,
|
8
|
+
name: 'ETP Chain Native Token',
|
9
|
+
symbol: 'ETP',
|
10
|
+
},
|
11
|
+
rpcUrls: {
|
12
|
+
default: { http: ['https://rpc.etpscan.xyz'] },
|
13
|
+
},
|
14
|
+
blockExplorers: {
|
15
|
+
default: {
|
16
|
+
name: 'ETP Scan',
|
17
|
+
url: 'https://etpscan.xyz',
|
18
|
+
},
|
19
|
+
},
|
20
|
+
})
|
@@ -0,0 +1,30 @@
|
|
1
|
+
import { defineChain } from '../../utils/chain/defineChain.js'
|
2
|
+
|
3
|
+
export const happychainTestnet = /*#__PURE__*/ defineChain({
|
4
|
+
id: 216,
|
5
|
+
name: 'Happychain Testnet',
|
6
|
+
nativeCurrency: {
|
7
|
+
symbol: 'HAPPY',
|
8
|
+
name: 'HAPPY',
|
9
|
+
decimals: 18,
|
10
|
+
},
|
11
|
+
rpcUrls: {
|
12
|
+
default: {
|
13
|
+
http: ['https://happy-testnet-sepolia.rpc.caldera.xyz/http'],
|
14
|
+
webSocket: ['wss://happy-testnet-sepolia.rpc.caldera.xyz/ws'],
|
15
|
+
},
|
16
|
+
},
|
17
|
+
blockExplorers: {
|
18
|
+
default: {
|
19
|
+
name: 'Happy Chain Testnet Explorer',
|
20
|
+
url: 'https://happy-testnet-sepolia.explorer.caldera.xyz/',
|
21
|
+
},
|
22
|
+
},
|
23
|
+
contracts: {
|
24
|
+
multicall3: {
|
25
|
+
address: '0xca11bde05977b3631167028862be2a173976ca11',
|
26
|
+
blockCreated: 1,
|
27
|
+
},
|
28
|
+
},
|
29
|
+
testnet: true,
|
30
|
+
})
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import { defineChain } from '../../utils/chain/defineChain.js'
|
2
|
+
|
3
|
+
export const ultra = /*#__PURE__*/ defineChain({
|
4
|
+
id: 19991,
|
5
|
+
name: 'Ultra EVM',
|
6
|
+
nativeCurrency: {
|
7
|
+
decimals: 18,
|
8
|
+
name: 'Ultra Token',
|
9
|
+
symbol: 'UOS',
|
10
|
+
},
|
11
|
+
rpcUrls: {
|
12
|
+
default: { http: ['https://evm.ultra.eosusa.io'] },
|
13
|
+
},
|
14
|
+
blockExplorers: {
|
15
|
+
default: {
|
16
|
+
name: 'Ultra EVM Explorer',
|
17
|
+
url: 'https://evmexplorer.ultra.io',
|
18
|
+
},
|
19
|
+
},
|
20
|
+
})
|
package/chains/index.ts
CHANGED
@@ -145,6 +145,7 @@ export { eos } from './definitions/eos.js'
|
|
145
145
|
export { eosTestnet } from './definitions/eosTestnet.js'
|
146
146
|
export { etherlink } from './definitions/etherlink.js'
|
147
147
|
export { etherlinkTestnet } from './definitions/etherlinkTestnet.js'
|
148
|
+
export { etp } from './definitions/etp.js'
|
148
149
|
export { evmos } from './definitions/evmos.js'
|
149
150
|
export { evmosTestnet } from './definitions/evmosTestnet.js'
|
150
151
|
export { excelonMainnet } from './definitions/excelonMainnet.js'
|
@@ -196,6 +197,7 @@ export { gravity } from './definitions/gravity.js'
|
|
196
197
|
export { guruNetwork } from './definitions/guruNetwork.js'
|
197
198
|
export { guruTestnet } from './definitions/guruTestnet.js'
|
198
199
|
export { ham } from './definitions/ham.js'
|
200
|
+
export { happychainTestnet } from './definitions/happychainTestnet.js'
|
199
201
|
export { haqqMainnet } from './definitions/haqqMainnet.js'
|
200
202
|
export { haqqTestedge2 } from './definitions/haqqTestedge2.js'
|
201
203
|
export { hardhat } from './definitions/hardhat.js'
|
@@ -467,6 +469,7 @@ export { treasure } from './definitions/treasure.js'
|
|
467
469
|
export { treasureTopaz } from './definitions/treasureTopaz.js'
|
468
470
|
export { tron } from './definitions/tron.js'
|
469
471
|
export { ubiq } from './definitions/ubiq.js'
|
472
|
+
export { ultra } from './definitions/ultra.js'
|
470
473
|
export { ultraTestnet } from './definitions/ultraTestnet.js'
|
471
474
|
export { ultron } from './definitions/ultron.js'
|
472
475
|
export { ultronTestnet } from './definitions/ultronTestnet.js'
|
package/errors/version.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export const version = '2.22.
|
1
|
+
export const version = '2.22.16'
|
package/package.json
CHANGED
@@ -115,7 +115,9 @@ export function encodeEventTopics<
|
|
115
115
|
return args_[i].map((_: any, j: number) =>
|
116
116
|
encodeArg({ param, value: args_[i][j] }),
|
117
117
|
)
|
118
|
-
return args_[i]
|
118
|
+
return typeof args_[i] !== 'undefined' && args_[i] !== null
|
119
|
+
? encodeArg({ param, value: args_[i] })
|
120
|
+
: null
|
119
121
|
}) ?? []
|
120
122
|
}
|
121
123
|
}
|
package/utils/buildRequest.ts
CHANGED
@@ -56,7 +56,6 @@ import type {
|
|
56
56
|
EIP1193RequestOptions,
|
57
57
|
} from '../types/eip1193.js'
|
58
58
|
import { stringToHex } from './encoding/toHex.js'
|
59
|
-
import { keccak256 } from './hash/keccak256.js'
|
60
59
|
import type { CreateBatchSchedulerErrorType } from './promise/createBatchScheduler.js'
|
61
60
|
import { withDedupe } from './promise/withDedupe.js'
|
62
61
|
import { type WithRetryErrorType, withRetry } from './promise/withRetry.js'
|
@@ -120,7 +119,7 @@ export function buildRequest<request extends (args: any) => Promise<any>>(
|
|
120
119
|
})
|
121
120
|
|
122
121
|
const requestId = dedupe
|
123
|
-
?
|
122
|
+
? stringToHex(`${uid}.${stringify(args)}`)
|
124
123
|
: undefined
|
125
124
|
return withDedupe(
|
126
125
|
() =>
|