viem 1.19.8 → 1.19.10
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 +425 -405
- package/README.md +46 -46
- package/_cjs/accounts/utils/signTransaction.js.map +1 -1
- package/_cjs/actions/public/createContractEventFilter.js.map +1 -1
- package/_cjs/actions/public/estimateMaxPriorityFeePerGas.js +1 -1
- package/_cjs/actions/public/estimateMaxPriorityFeePerGas.js.map +1 -1
- package/_cjs/chains/celo/serializers.js +3 -7
- package/_cjs/chains/celo/serializers.js.map +1 -1
- package/_cjs/chains/definitions/confluxESpace.js +2 -0
- package/_cjs/chains/definitions/confluxESpace.js.map +1 -1
- package/_cjs/chains/definitions/confluxESpaceTestnet.js +34 -0
- package/_cjs/chains/definitions/confluxESpaceTestnet.js.map +1 -0
- package/_cjs/chains/definitions/filecoin.js +6 -0
- package/_cjs/chains/definitions/filecoin.js.map +1 -1
- package/_cjs/chains/definitions/pgn.js +38 -0
- package/_cjs/chains/definitions/pgn.js.map +1 -0
- package/_cjs/chains/definitions/pgnTestnet.js +39 -0
- package/_cjs/chains/definitions/pgnTestnet.js.map +1 -0
- package/_cjs/chains/definitions/sapphire.js +33 -0
- package/_cjs/chains/definitions/sapphire.js.map +1 -0
- package/_cjs/chains/definitions/sapphireTestnet.js +28 -0
- package/_cjs/chains/definitions/sapphireTestnet.js.map +1 -0
- package/_cjs/chains/index.js +14 -4
- package/_cjs/chains/index.js.map +1 -1
- package/_cjs/errors/base.js.map +1 -1
- package/_cjs/errors/version.js +1 -1
- package/_cjs/errors/version.js.map +1 -1
- package/_cjs/utils/abi/encodeEventTopics.js.map +1 -1
- package/_cjs/utils/ccip.js +3 -1
- package/_cjs/utils/ccip.js.map +1 -1
- package/_cjs/utils/encoding/toBytes.js +2 -2
- package/_cjs/utils/encoding/toBytes.js.map +1 -1
- package/_cjs/utils/ens/avatar/utils.js +1 -1
- package/_cjs/utils/ens/avatar/utils.js.map +1 -1
- package/_cjs/utils/errors/getContractError.js.map +1 -1
- package/_cjs/utils/errors/getNodeError.js +11 -11
- package/_cjs/utils/errors/getNodeError.js.map +1 -1
- package/_cjs/utils/transaction/getTransactionType.js.map +1 -1
- package/_cjs/utils/transaction/serializeTransaction.js.map +1 -1
- package/_esm/accounts/utils/signTransaction.js.map +1 -1
- package/_esm/actions/ens/getEnsAddress.js +2 -2
- package/_esm/actions/ens/getEnsAvatar.js +2 -2
- package/_esm/actions/ens/getEnsName.js +2 -2
- package/_esm/actions/ens/getEnsResolver.js +2 -2
- package/_esm/actions/ens/getEnsText.js +2 -2
- package/_esm/actions/public/createContractEventFilter.js.map +1 -1
- package/_esm/actions/public/estimateMaxPriorityFeePerGas.js +1 -1
- package/_esm/actions/public/estimateMaxPriorityFeePerGas.js.map +1 -1
- package/_esm/actions/public/getBlock.js +1 -1
- package/_esm/actions/public/getBlockNumber.js +1 -1
- package/_esm/actions/public/getLogs.js +1 -1
- package/_esm/actions/public/getTransaction.js +1 -1
- package/_esm/actions/public/getTransactionConfirmations.js +1 -1
- package/_esm/actions/public/getTransactionReceipt.js +1 -1
- package/_esm/actions/public/readContract.js +1 -1
- package/_esm/actions/public/simulateContract.js +1 -1
- package/_esm/actions/public/waitForTransactionReceipt.js +1 -1
- package/_esm/actions/public/watchBlockNumber.js +1 -1
- package/_esm/actions/public/watchBlocks.js +1 -1
- package/_esm/actions/wallet/deployContract.js +1 -1
- package/_esm/actions/wallet/sendTransaction.js +1 -1
- package/_esm/actions/wallet/writeContract.js +1 -1
- package/_esm/chains/celo/serializers.js +3 -7
- package/_esm/chains/celo/serializers.js.map +1 -1
- package/_esm/chains/definitions/confluxESpace.js +2 -0
- package/_esm/chains/definitions/confluxESpace.js.map +1 -1
- package/_esm/chains/definitions/confluxESpaceTestnet.js +31 -0
- package/_esm/chains/definitions/confluxESpaceTestnet.js.map +1 -0
- package/_esm/chains/definitions/filecoin.js +6 -0
- package/_esm/chains/definitions/filecoin.js.map +1 -1
- package/_esm/chains/definitions/pgn.js +35 -0
- package/_esm/chains/definitions/pgn.js.map +1 -0
- package/_esm/chains/definitions/pgnTestnet.js +36 -0
- package/_esm/chains/definitions/pgnTestnet.js.map +1 -0
- package/_esm/chains/definitions/sapphire.js +30 -0
- package/_esm/chains/definitions/sapphire.js.map +1 -0
- package/_esm/chains/definitions/sapphireTestnet.js +25 -0
- package/_esm/chains/definitions/sapphireTestnet.js.map +1 -0
- package/_esm/chains/index.js +5 -0
- package/_esm/chains/index.js.map +1 -1
- package/_esm/errors/base.js.map +1 -1
- package/_esm/errors/version.js +1 -1
- package/_esm/errors/version.js.map +1 -1
- package/_esm/utils/abi/encodeEventTopics.js.map +1 -1
- package/_esm/utils/ccip.js +3 -1
- package/_esm/utils/ccip.js.map +1 -1
- package/_esm/utils/encoding/toBytes.js +2 -2
- package/_esm/utils/encoding/toBytes.js.map +1 -1
- package/_esm/utils/ens/avatar/utils.js +1 -1
- package/_esm/utils/ens/avatar/utils.js.map +1 -1
- package/_esm/utils/ens/namehash.js +1 -1
- package/_esm/utils/ens/normalize.js +2 -2
- package/_esm/utils/errors/getContractError.js.map +1 -1
- package/_esm/utils/errors/getNodeError.js +11 -11
- package/_esm/utils/errors/getNodeError.js.map +1 -1
- package/_esm/utils/transaction/getTransactionType.js.map +1 -1
- package/_esm/utils/transaction/serializeTransaction.js.map +1 -1
- package/_types/accounts/utils/signTransaction.d.ts.map +1 -1
- package/_types/actions/ens/getEnsAddress.d.ts +2 -2
- package/_types/actions/ens/getEnsAvatar.d.ts +2 -2
- package/_types/actions/ens/getEnsName.d.ts +2 -2
- package/_types/actions/ens/getEnsResolver.d.ts +2 -2
- package/_types/actions/ens/getEnsText.d.ts +2 -2
- package/_types/actions/public/createContractEventFilter.d.ts.map +1 -1
- package/_types/actions/public/estimateMaxPriorityFeePerGas.d.ts.map +1 -1
- package/_types/actions/public/getBlock.d.ts +1 -1
- package/_types/actions/public/getBlockNumber.d.ts +1 -1
- package/_types/actions/public/getLogs.d.ts +1 -1
- package/_types/actions/public/getTransaction.d.ts +1 -1
- package/_types/actions/public/getTransactionConfirmations.d.ts +1 -1
- package/_types/actions/public/getTransactionReceipt.d.ts +1 -1
- package/_types/actions/public/readContract.d.ts +1 -1
- package/_types/actions/public/simulateContract.d.ts +1 -1
- package/_types/actions/public/waitForTransactionReceipt.d.ts +1 -1
- package/_types/actions/public/watchBlockNumber.d.ts +1 -1
- package/_types/actions/public/watchBlocks.d.ts +1 -1
- package/_types/actions/wallet/deployContract.d.ts +1 -1
- package/_types/actions/wallet/sendTransaction.d.ts +1 -1
- package/_types/actions/wallet/writeContract.d.ts +1 -1
- package/_types/chains/celo/serializers.d.ts.map +1 -1
- package/_types/chains/definitions/confluxESpace.d.ts +2 -0
- package/_types/chains/definitions/confluxESpace.d.ts.map +1 -1
- package/_types/chains/definitions/confluxESpaceTestnet.d.ts +34 -0
- package/_types/chains/definitions/confluxESpaceTestnet.d.ts.map +1 -0
- package/_types/chains/definitions/filecoin.d.ts +6 -0
- package/_types/chains/definitions/filecoin.d.ts.map +1 -1
- package/_types/chains/definitions/pgn.d.ts +340 -0
- package/_types/chains/definitions/pgn.d.ts.map +1 -0
- package/_types/chains/definitions/pgnTestnet.d.ts +341 -0
- package/_types/chains/definitions/pgnTestnet.d.ts.map +1 -0
- package/_types/chains/definitions/sapphire.d.ts +33 -0
- package/_types/chains/definitions/sapphire.d.ts.map +1 -0
- package/_types/chains/definitions/sapphireTestnet.d.ts +28 -0
- package/_types/chains/definitions/sapphireTestnet.d.ts.map +1 -0
- package/_types/chains/index.d.ts +5 -0
- package/_types/chains/index.d.ts.map +1 -1
- package/_types/clients/decorators/public.d.ts +21 -21
- package/_types/clients/decorators/wallet.d.ts +3 -3
- package/_types/errors/version.d.ts +1 -1
- package/_types/errors/version.d.ts.map +1 -1
- package/_types/types/contract.d.ts.map +1 -1
- package/_types/types/filter.d.ts.map +1 -1
- package/_types/types/log.d.ts.map +1 -1
- package/_types/types/multicall.d.ts.map +1 -1
- package/_types/types/transaction.d.ts.map +1 -1
- package/_types/types/typedData.d.ts.map +1 -1
- package/_types/types/utils.d.ts.map +1 -1
- package/_types/utils/abi/decodeFunctionResult.d.ts.map +1 -1
- package/_types/utils/abi/encodeErrorResult.d.ts.map +1 -1
- package/_types/utils/abi/encodeEventTopics.d.ts.map +1 -1
- package/_types/utils/abi/encodeFunctionData.d.ts.map +1 -1
- package/_types/utils/abi/encodeFunctionResult.d.ts.map +1 -1
- package/_types/utils/ccip.d.ts.map +1 -1
- package/_types/utils/encoding/fromBytes.d.ts.map +1 -1
- package/_types/utils/encoding/fromHex.d.ts.map +1 -1
- package/_types/utils/ens/avatar/utils.d.ts.map +1 -1
- package/_types/utils/ens/namehash.d.ts +1 -1
- package/_types/utils/ens/normalize.d.ts +2 -2
- package/_types/utils/errors/getNodeError.d.ts.map +1 -1
- package/_types/utils/transaction/getSerializedTransactionType.d.ts.map +1 -1
- package/_types/utils/transaction/getTransactionType.d.ts.map +1 -1
- package/_types/utils/transaction/serializeTransaction.d.ts.map +1 -1
- package/accounts/utils/signTransaction.ts +4 -2
- package/actions/ens/getEnsAddress.ts +3 -3
- package/actions/ens/getEnsAvatar.ts +2 -2
- package/actions/ens/getEnsName.ts +2 -2
- package/actions/ens/getEnsResolver.ts +2 -2
- package/actions/ens/getEnsText.ts +2 -2
- package/actions/public/call.ts +1 -1
- package/actions/public/createContractEventFilter.ts +11 -9
- package/actions/public/estimateMaxPriorityFeePerGas.ts +3 -1
- package/actions/public/getBlock.ts +1 -1
- package/actions/public/getBlockNumber.ts +1 -1
- package/actions/public/getLogs.ts +1 -1
- package/actions/public/getTransaction.ts +1 -1
- package/actions/public/getTransactionConfirmations.ts +1 -1
- package/actions/public/getTransactionReceipt.ts +1 -1
- package/actions/public/readContract.ts +1 -1
- package/actions/public/simulateContract.ts +1 -1
- package/actions/public/verifyHash.ts +1 -1
- package/actions/public/verifyMessage.ts +1 -1
- package/actions/public/verifyTypedData.ts +1 -1
- package/actions/public/waitForTransactionReceipt.ts +1 -1
- package/actions/public/watchBlockNumber.ts +1 -1
- package/actions/public/watchBlocks.ts +1 -1
- package/actions/wallet/deployContract.ts +1 -1
- package/actions/wallet/sendRawTransaction.ts +1 -1
- package/actions/wallet/sendTransaction.ts +1 -1
- package/actions/wallet/writeContract.ts +1 -1
- package/chains/celo/serializers.ts +3 -7
- package/chains/definitions/confluxESpace.ts +2 -0
- package/chains/definitions/confluxESpaceTestnet.ts +31 -0
- package/chains/definitions/filecoin.ts +6 -0
- package/chains/definitions/pgn.ts +38 -0
- package/chains/definitions/pgnTestnet.ts +39 -0
- package/chains/definitions/sapphire.ts +30 -0
- package/chains/definitions/sapphireTestnet.ts +25 -0
- package/chains/index.ts +5 -0
- package/clients/decorators/public.ts +21 -21
- package/clients/decorators/wallet.ts +3 -3
- package/errors/base.ts +2 -2
- package/errors/version.ts +1 -1
- package/package.json +3 -3
- package/types/contract.ts +63 -64
- package/types/filter.ts +12 -12
- package/types/log.ts +4 -4
- package/types/multicall.ts +65 -57
- package/types/transaction.ts +4 -4
- package/types/typedData.ts +12 -12
- package/types/utils.ts +6 -7
- package/utils/abi/decodeFunctionResult.ts +2 -2
- package/utils/abi/encodeErrorResult.ts +2 -2
- package/utils/abi/encodeEventTopics.ts +6 -6
- package/utils/abi/encodeFunctionData.ts +2 -2
- package/utils/abi/encodeFunctionResult.ts +5 -5
- package/utils/ccip.ts +4 -2
- package/utils/encoding/fromBytes.ts +8 -8
- package/utils/encoding/fromHex.ts +8 -8
- package/utils/encoding/toBytes.ts +2 -2
- package/utils/ens/avatar/utils.ts +3 -1
- package/utils/ens/namehash.ts +1 -1
- package/utils/ens/normalize.ts +2 -2
- package/utils/errors/getContractError.ts +2 -2
- package/utils/errors/getNodeError.ts +12 -11
- package/utils/rpc.ts +1 -1
- package/utils/transaction/getSerializedTransactionType.ts +2 -2
- package/utils/transaction/getTransactionType.ts +2 -1
- package/utils/transaction/serializeTransaction.ts +6 -3
package/types/typedData.ts
CHANGED
@@ -42,18 +42,18 @@ export type GetTypedDataMessage<
|
|
42
42
|
> = TPrimaryType extends 'EIP712Domain'
|
43
43
|
? {}
|
44
44
|
: { [key_3: string]: any } extends TMessage // Check if we were able to infer the shape of typed data
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
45
|
+
? {
|
46
|
+
/**
|
47
|
+
* Data to sign
|
48
|
+
*
|
49
|
+
* Use a [const assertion](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-4.html#const-assertions) on {@link types} for type inference.
|
50
|
+
*/
|
51
|
+
message: { [key_4: string]: unknown }
|
52
|
+
}
|
53
|
+
: {
|
54
|
+
/** Data to sign */
|
55
|
+
message: TMessage
|
56
|
+
}
|
57
57
|
|
58
58
|
export type GetTypedDataPrimaryType<
|
59
59
|
TTypedData extends TypedData | { [key: string]: unknown } = TypedData,
|
package/types/utils.ts
CHANGED
@@ -54,7 +54,7 @@ export type IsNever<T> = [T] extends [never] ? true : false
|
|
54
54
|
* type Result = Or<[false, false, false]>
|
55
55
|
* // ^? type Result = false
|
56
56
|
*/
|
57
|
-
export type Or<T extends readonly unknown[]
|
57
|
+
export type Or<T extends readonly unknown[]> = T extends readonly [
|
58
58
|
infer Head,
|
59
59
|
...infer Tail,
|
60
60
|
]
|
@@ -125,12 +125,11 @@ export type MaybeUndefined<
|
|
125
125
|
* @private Helper for `Assign`. This is a workaround for tsc generating errorneous type definitions.
|
126
126
|
*/
|
127
127
|
export type Assign_<T, U> = {
|
128
|
-
[K in
|
129
|
-
|
130
|
-
?
|
131
|
-
|
132
|
-
|
133
|
-
: K]: K extends keyof U ? U[K] : T[K]
|
128
|
+
[K in keyof T as K extends keyof U
|
129
|
+
? U[K] extends void
|
130
|
+
? never
|
131
|
+
: K
|
132
|
+
: K]: K extends keyof U ? U[K] : T[K]
|
134
133
|
}
|
135
134
|
|
136
135
|
/**
|
@@ -37,8 +37,8 @@ export type DecodeFunctionResultParameters<
|
|
37
37
|
} & (TFunctionName extends string
|
38
38
|
? { abi: TAbi } & Partial<GetFunctionArgs<TAbi, TFunctionName>>
|
39
39
|
: _FunctionName extends string
|
40
|
-
|
41
|
-
|
40
|
+
? { abi: [TAbi[number]] } & Partial<GetFunctionArgs<TAbi, _FunctionName>>
|
41
|
+
: never)
|
42
42
|
|
43
43
|
export type DecodeFunctionResultReturnType<
|
44
44
|
TAbi extends Abi | readonly unknown[] = Abi,
|
@@ -39,8 +39,8 @@ export type EncodeErrorResultParameters<
|
|
39
39
|
} & (TErrorName extends string
|
40
40
|
? { abi: TAbi } & GetErrorArgs<TAbi, TErrorName>
|
41
41
|
: _ErrorName extends string
|
42
|
-
|
43
|
-
|
42
|
+
? { abi: [TAbi[number]] } & GetErrorArgs<TAbi, _ErrorName>
|
43
|
+
: never)
|
44
44
|
|
45
45
|
export type EncodeErrorResultErrorType =
|
46
46
|
| GetAbiItemErrorType
|
@@ -39,8 +39,8 @@ export type EncodeEventTopicsParameters<
|
|
39
39
|
} & (TEventName extends string
|
40
40
|
? { abi: TAbi; args?: GetEventArgs<TAbi, TEventName> }
|
41
41
|
: _EventName extends string
|
42
|
-
|
43
|
-
|
42
|
+
? { abi: [TAbi[number]]; args?: GetEventArgs<TAbi, _EventName> }
|
43
|
+
: never)
|
44
44
|
|
45
45
|
export type EncodeEventTopicsErrorType =
|
46
46
|
| AbiEventNotFoundErrorType
|
@@ -82,8 +82,8 @@ export function encodeEventTopics<
|
|
82
82
|
const args_ = Array.isArray(args)
|
83
83
|
? args
|
84
84
|
: Object.values(args).length > 0
|
85
|
-
|
86
|
-
|
85
|
+
? indexedInputs?.map((x: any) => (args as any)[x.name]) ?? []
|
86
|
+
: []
|
87
87
|
|
88
88
|
if (args_.length > 0) {
|
89
89
|
topics =
|
@@ -93,8 +93,8 @@ export function encodeEventTopics<
|
|
93
93
|
encodeArg({ param, value: args_[i][j] }),
|
94
94
|
)
|
95
95
|
: args_[i]
|
96
|
-
|
97
|
-
|
96
|
+
? encodeArg({ param, value: args_[i] })
|
97
|
+
: null,
|
98
98
|
) ?? []
|
99
99
|
}
|
100
100
|
}
|
@@ -36,8 +36,8 @@ export type EncodeFunctionDataParameters<
|
|
36
36
|
} & (TFunctionName extends string
|
37
37
|
? { abi: TAbi } & GetFunctionArgs<TAbi, TFunctionName>
|
38
38
|
: _FunctionName extends string
|
39
|
-
|
40
|
-
|
39
|
+
? { abi: [TAbi[number]] } & GetFunctionArgs<TAbi, _FunctionName>
|
40
|
+
: never)
|
41
41
|
|
42
42
|
export type EncodeFunctionDataErrorType =
|
43
43
|
| AbiFunctionNotFoundErrorType
|
@@ -32,11 +32,11 @@ export type EncodeFunctionResultParameters<
|
|
32
32
|
} & (TFunctionName extends string
|
33
33
|
? { abi: TAbi; result?: ContractFunctionResult<TAbi, TFunctionName> }
|
34
34
|
: _FunctionName extends string
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
35
|
+
? {
|
36
|
+
abi: [TAbi[number]]
|
37
|
+
result?: ContractFunctionResult<TAbi, _FunctionName>
|
38
|
+
}
|
39
|
+
: never)
|
40
40
|
|
41
41
|
export type EncodeFunctionResultErrorType =
|
42
42
|
| AbiFunctionOutputsNotFoundError
|
package/utils/ccip.ts
CHANGED
@@ -52,7 +52,7 @@ export const offchainLookupAbiItem = {
|
|
52
52
|
|
53
53
|
export type OffchainLookupErrorType = ErrorType
|
54
54
|
|
55
|
-
export async function offchainLookup<TChain extends Chain | undefined
|
55
|
+
export async function offchainLookup<TChain extends Chain | undefined>(
|
56
56
|
client: Client<Transport, TChain>,
|
57
57
|
{
|
58
58
|
blockNumber,
|
@@ -140,7 +140,9 @@ export async function ccipFetch({
|
|
140
140
|
if (!response.ok) {
|
141
141
|
error = new HttpRequestError({
|
142
142
|
body,
|
143
|
-
details:
|
143
|
+
details: result?.error
|
144
|
+
? stringify(result.error)
|
145
|
+
: response.statusText,
|
144
146
|
headers: response.headers,
|
145
147
|
status: response.status,
|
146
148
|
url,
|
@@ -27,14 +27,14 @@ export type FromBytesParameters<
|
|
27
27
|
export type FromBytesReturnType<TTo> = TTo extends 'string'
|
28
28
|
? string
|
29
29
|
: TTo extends 'hex'
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
30
|
+
? Hex
|
31
|
+
: TTo extends 'bigint'
|
32
|
+
? bigint
|
33
|
+
: TTo extends 'number'
|
34
|
+
? number
|
35
|
+
: TTo extends 'boolean'
|
36
|
+
? boolean
|
37
|
+
: never
|
38
38
|
|
39
39
|
export type FromBytesErrorType =
|
40
40
|
| BytesToHexErrorType
|
@@ -41,14 +41,14 @@ export type FromHexParameters<
|
|
41
41
|
export type FromHexReturnType<TTo> = TTo extends 'string'
|
42
42
|
? string
|
43
43
|
: TTo extends 'bigint'
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
44
|
+
? bigint
|
45
|
+
: TTo extends 'number'
|
46
|
+
? number
|
47
|
+
: TTo extends 'bytes'
|
48
|
+
? ByteArray
|
49
|
+
: TTo extends 'boolean'
|
50
|
+
? boolean
|
51
|
+
: never
|
52
52
|
|
53
53
|
export type FromHexErrorType =
|
54
54
|
| HexToNumberErrorType
|
@@ -114,9 +114,9 @@ const charCodeMap = {
|
|
114
114
|
function charCodeToBase16(char: number) {
|
115
115
|
if (char >= charCodeMap.zero && char <= charCodeMap.nine)
|
116
116
|
return char - charCodeMap.zero
|
117
|
-
|
117
|
+
if (char >= charCodeMap.A && char <= charCodeMap.F)
|
118
118
|
return char - (charCodeMap.A - 10)
|
119
|
-
|
119
|
+
if (char >= charCodeMap.a && char <= charCodeMap.f)
|
120
120
|
return char - (charCodeMap.a - 10)
|
121
121
|
return undefined
|
122
122
|
}
|
@@ -117,7 +117,9 @@ export function resolveAvatarUri({
|
|
117
117
|
isOnChain: false,
|
118
118
|
isEncoded: false,
|
119
119
|
}
|
120
|
-
}
|
120
|
+
}
|
121
|
+
|
122
|
+
if (protocol === 'ar:/' && target) {
|
121
123
|
return {
|
122
124
|
uri: `${arweaveGateway}/${target}${subtarget || ''}`,
|
123
125
|
isOnChain: false,
|
package/utils/ens/namehash.ts
CHANGED
@@ -28,7 +28,7 @@ export type NamehashErrorType =
|
|
28
28
|
* - Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to [normalize ENS names](https://docs.ens.domains/contract-api-reference/name-processing#normalising-names) with [UTS-46 normalization](https://unicode.org/reports/tr46) before passing them to `namehash`. You can use the built-in [`normalize`](https://viem.sh/docs/ens/utilities/normalize.html) function for this.
|
29
29
|
*
|
30
30
|
* @example
|
31
|
-
* namehash('
|
31
|
+
* namehash('wevm.eth')
|
32
32
|
* '0xf246651c1b9a6b141d19c2604e9a58f567973833990f830d882534a747801359'
|
33
33
|
*
|
34
34
|
* @link https://eips.ethereum.org/EIPS/eip-137
|
package/utils/ens/normalize.ts
CHANGED
@@ -7,8 +7,8 @@ export type NormalizeErrorType = ErrorType
|
|
7
7
|
* @description Normalizes ENS name according to ENSIP-15.
|
8
8
|
*
|
9
9
|
* @example
|
10
|
-
* normalize('
|
11
|
-
* '
|
10
|
+
* normalize('wevm.eth')
|
11
|
+
* 'wevm.eth'
|
12
12
|
*
|
13
13
|
* @see https://docs.ens.domains/contract-api-reference/name-processing#normalising-names
|
14
14
|
* @see https://github.com/ensdomains/docs/blob/9edf9443de4333a0ea7ec658a870672d5d180d53/ens-improvement-proposals/ensip-15-normalization-standard.md
|
@@ -48,8 +48,8 @@ export function getContractError<err extends ErrorType<string>>(
|
|
48
48
|
err instanceof RawContractError
|
49
49
|
? err
|
50
50
|
: err instanceof BaseError
|
51
|
-
|
52
|
-
|
51
|
+
? err.walk((err) => 'data' in (err as Error)) || err.walk()
|
52
|
+
: {}
|
53
53
|
) as RawContractError
|
54
54
|
|
55
55
|
const cause = (() => {
|
@@ -70,36 +70,37 @@ export function getNodeError(
|
|
70
70
|
cause: err,
|
71
71
|
message: executionRevertedError.details,
|
72
72
|
}) as any
|
73
|
-
}
|
73
|
+
}
|
74
|
+
if (ExecutionRevertedError.nodeMessage.test(message))
|
74
75
|
return new ExecutionRevertedError({
|
75
76
|
cause: err,
|
76
77
|
message: err.details,
|
77
78
|
}) as any
|
78
|
-
|
79
|
+
if (FeeCapTooHighError.nodeMessage.test(message))
|
79
80
|
return new FeeCapTooHighError({
|
80
81
|
cause: err,
|
81
82
|
maxFeePerGas: args?.maxFeePerGas,
|
82
83
|
}) as any
|
83
|
-
|
84
|
+
if (FeeCapTooLowError.nodeMessage.test(message))
|
84
85
|
return new FeeCapTooLowError({
|
85
86
|
cause: err,
|
86
87
|
maxFeePerGas: args?.maxFeePerGas,
|
87
88
|
}) as any
|
88
|
-
|
89
|
+
if (NonceTooHighError.nodeMessage.test(message))
|
89
90
|
return new NonceTooHighError({ cause: err, nonce: args?.nonce }) as any
|
90
|
-
|
91
|
+
if (NonceTooLowError.nodeMessage.test(message))
|
91
92
|
return new NonceTooLowError({ cause: err, nonce: args?.nonce }) as any
|
92
|
-
|
93
|
+
if (NonceMaxValueError.nodeMessage.test(message))
|
93
94
|
return new NonceMaxValueError({ cause: err, nonce: args?.nonce }) as any
|
94
|
-
|
95
|
+
if (InsufficientFundsError.nodeMessage.test(message))
|
95
96
|
return new InsufficientFundsError({ cause: err }) as any
|
96
|
-
|
97
|
+
if (IntrinsicGasTooHighError.nodeMessage.test(message))
|
97
98
|
return new IntrinsicGasTooHighError({ cause: err, gas: args?.gas }) as any
|
98
|
-
|
99
|
+
if (IntrinsicGasTooLowError.nodeMessage.test(message))
|
99
100
|
return new IntrinsicGasTooLowError({ cause: err, gas: args?.gas }) as any
|
100
|
-
|
101
|
+
if (TransactionTypeNotSupportedError.nodeMessage.test(message))
|
101
102
|
return new TransactionTypeNotSupportedError({ cause: err }) as any
|
102
|
-
|
103
|
+
if (TipAboveFeeCapError.nodeMessage.test(message))
|
103
104
|
return new TipAboveFeeCapError({
|
104
105
|
cause: err,
|
105
106
|
maxFeePerGas: args?.maxFeePerGas,
|
package/utils/rpc.ts
CHANGED
@@ -63,7 +63,7 @@ export type RpcResponse<TResult = any, TError = any> = {
|
|
63
63
|
///////////////////////////////////////////////////
|
64
64
|
// HTTP
|
65
65
|
|
66
|
-
export type HttpOptions<TBody extends RpcRequest | RpcRequest[] = RpcRequest
|
66
|
+
export type HttpOptions<TBody extends RpcRequest | RpcRequest[] = RpcRequest> =
|
67
67
|
{
|
68
68
|
// The RPC request body.
|
69
69
|
body: TBody
|
@@ -16,8 +16,8 @@ export type GetSerializedTransactionType<
|
|
16
16
|
> = TTransactionSerialized extends TransactionSerializedEIP1559
|
17
17
|
? 'eip1559'
|
18
18
|
: TTransactionSerialized extends TransactionSerializedEIP2930
|
19
|
-
|
20
|
-
|
19
|
+
? 'eip2930'
|
20
|
+
: 'legacy'
|
21
21
|
|
22
22
|
export type GetSerializedTransactionTypeErrorType =
|
23
23
|
| HexToNumberErrorType
|
@@ -12,7 +12,8 @@ import type {
|
|
12
12
|
} from '../../types/transaction.js'
|
13
13
|
|
14
14
|
export type GetTransactionType<
|
15
|
-
TTransactionSerializable extends
|
15
|
+
TTransactionSerializable extends
|
16
|
+
TransactionSerializable = TransactionSerializable,
|
16
17
|
> =
|
17
18
|
| (TTransactionSerializable extends TransactionSerializableLegacy
|
18
19
|
? 'legacy'
|
@@ -39,12 +39,15 @@ import {
|
|
39
39
|
} from './serializeAccessList.js'
|
40
40
|
|
41
41
|
export type SerializedTransactionReturnType<
|
42
|
-
TTransactionSerializable extends
|
43
|
-
|
42
|
+
TTransactionSerializable extends
|
43
|
+
TransactionSerializable = TransactionSerializable,
|
44
|
+
TTransactionType extends
|
45
|
+
TransactionType = GetTransactionType<TTransactionSerializable>,
|
44
46
|
> = TransactionSerialized<TTransactionType>
|
45
47
|
|
46
48
|
export type SerializeTransactionFn<
|
47
|
-
TTransactionSerializable extends
|
49
|
+
TTransactionSerializable extends
|
50
|
+
TransactionSerializable = TransactionSerializable,
|
48
51
|
> = typeof serializeTransaction<TTransactionSerializable>
|
49
52
|
|
50
53
|
export type SerializeTransactionErrorType =
|