viem 2.58.2 → 2.58.3
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 +16 -0
- package/_cjs/actions/public/createEventFilter.js +2 -12
- package/_cjs/actions/public/createEventFilter.js.map +1 -1
- package/_cjs/actions/public/estimateFeesPerGas.js +16 -16
- package/_cjs/actions/public/estimateFeesPerGas.js.map +1 -1
- package/_cjs/actions/public/getLogs.js +6 -12
- package/_cjs/actions/public/getLogs.js.map +1 -1
- package/_cjs/actions/public/internal/encodeEventFilterTopics.js +19 -0
- package/_cjs/actions/public/internal/encodeEventFilterTopics.js.map +1 -0
- package/_cjs/actions/public/simulateBlocks.js +1 -0
- package/_cjs/actions/public/simulateBlocks.js.map +1 -1
- package/_cjs/actions/public/watchEvent.js +2 -12
- package/_cjs/actions/public/watchEvent.js.map +1 -1
- package/_cjs/celo/parsers.js +8 -2
- package/_cjs/celo/parsers.js.map +1 -1
- package/_cjs/errors/version.js +1 -1
- package/_cjs/tempo/actions/simulate.js +1 -0
- package/_cjs/tempo/actions/simulate.js.map +1 -1
- package/_cjs/tempo/internal/replacement.js.map +1 -1
- package/_cjs/utils/ccip.js +6 -2
- package/_cjs/utils/ccip.js.map +1 -1
- package/_cjs/utils/siwe/validateSiweMessage.js +1 -1
- package/_cjs/utils/siwe/validateSiweMessage.js.map +1 -1
- package/_cjs/utils/stateOverride.js +5 -2
- package/_cjs/utils/stateOverride.js.map +1 -1
- package/_cjs/utils/transaction/parseTransaction.js +1 -0
- package/_cjs/utils/transaction/parseTransaction.js.map +1 -1
- package/_esm/actions/public/createEventFilter.js +2 -13
- package/_esm/actions/public/createEventFilter.js.map +1 -1
- package/_esm/actions/public/estimateFeesPerGas.js +16 -16
- package/_esm/actions/public/estimateFeesPerGas.js.map +1 -1
- package/_esm/actions/public/getLogs.js +6 -13
- package/_esm/actions/public/getLogs.js.map +1 -1
- package/_esm/actions/public/internal/encodeEventFilterTopics.js +22 -0
- package/_esm/actions/public/internal/encodeEventFilterTopics.js.map +1 -0
- package/_esm/actions/public/simulateBlocks.js +1 -0
- package/_esm/actions/public/simulateBlocks.js.map +1 -1
- package/_esm/actions/public/watchEvent.js +2 -13
- package/_esm/actions/public/watchEvent.js.map +1 -1
- package/_esm/celo/parsers.js +9 -3
- package/_esm/celo/parsers.js.map +1 -1
- package/_esm/errors/version.js +1 -1
- package/_esm/tempo/actions/simulate.js +1 -0
- package/_esm/tempo/actions/simulate.js.map +1 -1
- package/_esm/tempo/internal/replacement.js +3 -1
- package/_esm/tempo/internal/replacement.js.map +1 -1
- package/_esm/utils/ccip.js +7 -2
- package/_esm/utils/ccip.js.map +1 -1
- package/_esm/utils/siwe/validateSiweMessage.js +2 -1
- package/_esm/utils/siwe/validateSiweMessage.js.map +1 -1
- package/_esm/utils/stateOverride.js +5 -2
- package/_esm/utils/stateOverride.js.map +1 -1
- package/_esm/utils/transaction/parseTransaction.js +1 -1
- package/_esm/utils/transaction/parseTransaction.js.map +1 -1
- package/_types/actions/public/createEventFilter.d.ts +1 -1
- package/_types/actions/public/createEventFilter.d.ts.map +1 -1
- package/_types/actions/public/getLogs.d.ts +1 -1
- package/_types/actions/public/getLogs.d.ts.map +1 -1
- package/_types/actions/public/internal/encodeEventFilterTopics.d.ts +14 -0
- package/_types/actions/public/internal/encodeEventFilterTopics.d.ts.map +1 -0
- package/_types/actions/public/simulateBlocks.d.ts.map +1 -1
- package/_types/actions/public/watchEvent.d.ts.map +1 -1
- package/_types/celo/parsers.d.ts.map +1 -1
- package/_types/errors/version.d.ts +1 -1
- package/_types/tempo/actions/simulate.d.ts.map +1 -1
- package/_types/tempo/internal/replacement.d.ts +3 -1
- package/_types/tempo/internal/replacement.d.ts.map +1 -1
- package/_types/utils/ccip.d.ts.map +1 -1
- package/_types/utils/siwe/validateSiweMessage.d.ts.map +1 -1
- package/_types/utils/stateOverride.d.ts.map +1 -1
- package/_types/utils/transaction/parseTransaction.d.ts +4 -1
- package/_types/utils/transaction/parseTransaction.d.ts.map +1 -1
- package/actions/public/createEventFilter.ts +4 -19
- package/actions/public/estimateFeesPerGas.ts +18 -18
- package/actions/public/getLogs.ts +8 -19
- package/actions/public/internal/encodeEventFilterTopics.ts +32 -0
- package/actions/public/simulateBlocks.ts +1 -0
- package/actions/public/watchEvent.ts +2 -18
- package/celo/parsers.ts +13 -2
- package/errors/version.ts +1 -1
- package/package.json +1 -1
- package/tempo/actions/simulate.ts +1 -0
- package/tempo/internal/replacement.ts +3 -1
- package/utils/ccip.ts +6 -2
- package/utils/siwe/validateSiweMessage.ts +2 -1
- package/utils/stateOverride.ts +4 -2
- package/utils/transaction/parseTransaction.ts +1 -1
package/utils/ccip.ts
CHANGED
|
@@ -304,10 +304,14 @@ export async function ccipRequest({
|
|
|
304
304
|
)
|
|
305
305
|
|
|
306
306
|
let result: any
|
|
307
|
+
let message: string | undefined
|
|
307
308
|
if (
|
|
308
309
|
response.headers.get('Content-Type')?.startsWith('application/json')
|
|
309
310
|
) {
|
|
310
|
-
|
|
311
|
+
const json = JSON.parse(responseBody)
|
|
312
|
+
result = json.data
|
|
313
|
+
// EIP-3668 gateways describe 4xx and 5xx errors as `{ message: string }`.
|
|
314
|
+
if (typeof json.message === 'string') message = json.message
|
|
311
315
|
} else {
|
|
312
316
|
result = responseBody
|
|
313
317
|
}
|
|
@@ -317,7 +321,7 @@ export async function ccipRequest({
|
|
|
317
321
|
body,
|
|
318
322
|
details: result?.error
|
|
319
323
|
? stringify(result.error)
|
|
320
|
-
: response.statusText,
|
|
324
|
+
: (message ?? response.statusText),
|
|
321
325
|
headers: response.headers,
|
|
322
326
|
status: response.status,
|
|
323
327
|
url,
|
|
@@ -55,7 +55,8 @@ export function validateSiweMessage(
|
|
|
55
55
|
|
|
56
56
|
if (domain && message.domain !== domain) return false
|
|
57
57
|
if (nonce && message.nonce !== nonce) return false
|
|
58
|
-
if
|
|
58
|
+
// EIP-4361: if `scheme` is not specified, HTTPS is assumed by default.
|
|
59
|
+
if (scheme && (message.scheme ?? 'https') !== scheme) return false
|
|
59
60
|
|
|
60
61
|
// EIP-4361 requires `nonce = 8*( ALPHA / DIGIT )` and `version = "1"`.
|
|
61
62
|
if (message.nonce !== undefined && !nonceRegex.test(message.nonce))
|
package/utils/stateOverride.ts
CHANGED
|
@@ -90,11 +90,13 @@ export function serializeStateOverride(
|
|
|
90
90
|
): RpcStateOverride | undefined {
|
|
91
91
|
if (!parameters) return undefined
|
|
92
92
|
const rpcStateOverride: RpcStateOverride = {}
|
|
93
|
+
const addresses = new Set<string>()
|
|
93
94
|
for (const { address, ...accountState } of parameters) {
|
|
94
95
|
if (!isAddress(address, { strict: false }))
|
|
95
96
|
throw new InvalidAddressError({ address })
|
|
96
|
-
|
|
97
|
-
|
|
97
|
+
const key = address.toLowerCase()
|
|
98
|
+
if (addresses.has(key)) throw new AccountStateConflictError({ address })
|
|
99
|
+
addresses.add(key)
|
|
98
100
|
rpcStateOverride[address] = serializeAccountStateOverride(accountState)
|
|
99
101
|
}
|
|
100
102
|
return rpcStateOverride
|
|
@@ -624,7 +624,7 @@ type ParseEIP155SignatureErrorType =
|
|
|
624
624
|
| PadHexErrorType
|
|
625
625
|
| ErrorType
|
|
626
626
|
|
|
627
|
-
function parseEIP155Signature(
|
|
627
|
+
export function parseEIP155Signature(
|
|
628
628
|
transactionArray: RecursiveArray<Hex>,
|
|
629
629
|
): Signature & { yParity: number } {
|
|
630
630
|
const signature = transactionArray.slice(-3)
|