viem 1.2.7 → 1.2.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/dist/cjs/accounts/utils/signTransaction.js.map +1 -1
- package/dist/cjs/actions/public/waitForTransactionReceipt.js +3 -4
- package/dist/cjs/actions/public/waitForTransactionReceipt.js.map +1 -1
- package/dist/cjs/chains/index.js +4 -0
- package/dist/cjs/chains/index.js.map +1 -1
- package/dist/cjs/chains/serializers/celo.js +85 -0
- package/dist/cjs/chains/serializers/celo.js.map +1 -0
- package/dist/cjs/errors/version.js +1 -1
- package/dist/cjs/errors/version.js.map +1 -1
- package/dist/cjs/utils/abi/encodePacked.js.map +1 -1
- package/dist/cjs/utils/ens/avatar/utils.js +2 -1
- package/dist/cjs/utils/ens/avatar/utils.js.map +1 -1
- package/dist/cjs/utils/formatters/extract.js +0 -1
- package/dist/cjs/utils/formatters/extract.js.map +1 -1
- package/dist/cjs/utils/transaction/prepareRequest.js +1 -1
- package/dist/cjs/utils/transaction/prepareRequest.js.map +1 -1
- package/dist/esm/accounts/utils/signTransaction.js.map +1 -1
- package/dist/esm/actions/public/waitForTransactionReceipt.js +3 -4
- package/dist/esm/actions/public/waitForTransactionReceipt.js.map +1 -1
- package/dist/esm/chains/index.js +4 -0
- package/dist/esm/chains/index.js.map +1 -1
- package/dist/esm/chains/serializers/celo.js +93 -0
- package/dist/esm/chains/serializers/celo.js.map +1 -0
- package/dist/esm/errors/version.js +1 -1
- package/dist/esm/errors/version.js.map +1 -1
- package/dist/esm/utils/abi/encodePacked.js.map +1 -1
- package/dist/esm/utils/ens/avatar/utils.js +3 -1
- package/dist/esm/utils/ens/avatar/utils.js.map +1 -1
- package/dist/esm/utils/formatters/extract.js +1 -1
- package/dist/esm/utils/formatters/extract.js.map +1 -1
- package/dist/esm/utils/transaction/prepareRequest.js +1 -1
- package/dist/esm/utils/transaction/prepareRequest.js.map +1 -1
- package/dist/types/accounts/utils/signTransaction.d.ts +1 -1
- package/dist/types/accounts/utils/signTransaction.d.ts.map +1 -1
- package/dist/types/actions/public/waitForTransactionReceipt.d.ts.map +1 -1
- package/dist/types/actions/wallet/deployContract.d.ts +1 -1
- package/dist/types/actions/wallet/deployContract.d.ts.map +1 -1
- package/dist/types/chains/index.d.ts.map +1 -1
- package/dist/types/chains/serializers/celo.d.ts +21 -0
- package/dist/types/chains/serializers/celo.d.ts.map +1 -0
- package/dist/types/errors/version.d.ts +1 -1
- package/dist/types/errors/version.d.ts.map +1 -1
- package/dist/types/types/transaction.d.ts +1 -1
- package/dist/types/types/transaction.d.ts.map +1 -1
- package/dist/types/types/typedData.d.ts +6 -6
- package/dist/types/types/typedData.d.ts.map +1 -1
- package/dist/types/utils/ens/avatar/utils.d.ts +1 -1
- package/dist/types/utils/ens/avatar/utils.d.ts.map +1 -1
- package/dist/types/utils/formatters/extract.d.ts +1 -1
- package/dist/types/utils/formatters/extract.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/accounts/utils/signTransaction.ts +7 -2
- package/src/actions/public/waitForTransactionReceipt.ts +3 -4
- package/src/actions/wallet/deployContract.ts +1 -1
- package/src/chains/index.ts +4 -0
- package/src/chains/serializers/celo.ts +194 -0
- package/src/errors/version.ts +1 -1
- package/src/types/transaction.ts +1 -1
- package/src/types/typedData.ts +6 -6
- package/src/utils/abi/encodePacked.ts +1 -1
- package/src/utils/ens/avatar/utils.ts +3 -1
- package/src/utils/formatters/extract.ts +3 -2
- package/src/utils/transaction/prepareRequest.ts +1 -1
package/src/types/transaction.ts
CHANGED
@@ -35,7 +35,7 @@ export type TransactionReceipt<
|
|
35
35
|
logs: Log<TQuantity, TIndex>[]
|
36
36
|
/** Logs bloom filter */
|
37
37
|
logsBloom: Hex
|
38
|
-
/** `
|
38
|
+
/** `success` if this transaction was successful or `reverted` if it failed */
|
39
39
|
status: TStatus
|
40
40
|
/** Transaction recipient or `null` if deploying a contract */
|
41
41
|
to: Address | null
|
package/src/types/typedData.ts
CHANGED
@@ -15,11 +15,11 @@ export type TypedDataDefinition<
|
|
15
15
|
GetTypedDataDomain<TTypedData, TPrimaryType>
|
16
16
|
|
17
17
|
export type GetTypedDataDomain<
|
18
|
-
TTypedData extends TypedData | { [
|
18
|
+
TTypedData extends TypedData | { [key_1: string]: unknown } = TypedData,
|
19
19
|
TPrimaryType extends string = string,
|
20
20
|
TSchema = TTypedData extends TypedData
|
21
21
|
? TypedDataToPrimitiveTypes<TTypedData>
|
22
|
-
: { [
|
22
|
+
: { [key_2: string]: any },
|
23
23
|
TDomain = TSchema extends { EIP712Domain: infer Domain }
|
24
24
|
? Domain
|
25
25
|
: TypedDataDomain,
|
@@ -32,24 +32,24 @@ export type GetTypedDataDomain<
|
|
32
32
|
}
|
33
33
|
|
34
34
|
export type GetTypedDataMessage<
|
35
|
-
TTypedData extends TypedData | { [
|
35
|
+
TTypedData extends TypedData | { [key_1: string]: unknown } = TypedData,
|
36
36
|
TPrimaryType extends string = string,
|
37
37
|
TSchema = TTypedData extends TypedData
|
38
38
|
? TypedDataToPrimitiveTypes<TTypedData>
|
39
|
-
: { [
|
39
|
+
: { [key_2: string]: any },
|
40
40
|
TMessage = TSchema[TPrimaryType extends keyof TSchema
|
41
41
|
? TPrimaryType
|
42
42
|
: keyof TSchema],
|
43
43
|
> = TPrimaryType extends 'EIP712Domain'
|
44
44
|
? {}
|
45
|
-
: { [
|
45
|
+
: { [key_3: string]: any } extends TMessage // Check if we were able to infer the shape of typed data
|
46
46
|
? {
|
47
47
|
/**
|
48
48
|
* Data to sign
|
49
49
|
*
|
50
50
|
* Use a [const assertion](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-4.html#const-assertions) on {@link types} for type inference.
|
51
51
|
*/
|
52
|
-
message: { [
|
52
|
+
message: { [key_4: string]: unknown }
|
53
53
|
}
|
54
54
|
: {
|
55
55
|
/** Data to sign */
|
@@ -62,7 +62,7 @@ export function encodePacked<
|
|
62
62
|
function encode<TPackedAbiType extends PackedAbiType | unknown>(
|
63
63
|
type: TPackedAbiType,
|
64
64
|
value: EncodePackedValues<[TPackedAbiType]>[0],
|
65
|
-
isArray
|
65
|
+
isArray = false,
|
66
66
|
): Hex {
|
67
67
|
if (type === 'address') {
|
68
68
|
const address = value as Address
|
@@ -40,6 +40,7 @@ export async function isImageUri(uri: string) {
|
|
40
40
|
return false
|
41
41
|
}
|
42
42
|
// fail in NodeJS, since the error is not cors but any other network issue
|
43
|
+
// rome-ignore lint/suspicious/noPrototypeBuiltins:
|
43
44
|
if (!globalThis.hasOwnProperty('Image')) return false
|
44
45
|
// in case of cors, use image api to validate if given url is an actual image
|
45
46
|
return new Promise((resolve) => {
|
@@ -179,7 +180,8 @@ type ParsedNft = {
|
|
179
180
|
tokenID: string
|
180
181
|
}
|
181
182
|
|
182
|
-
export function parseNftUri(
|
183
|
+
export function parseNftUri(uri_: string): ParsedNft {
|
184
|
+
let uri = uri_
|
183
185
|
// parse valid nft spec (CAIP-22/CAIP-29)
|
184
186
|
// @see: https://github.com/ChainAgnostic/CAIPs/tree/master/CAIPs
|
185
187
|
if (uri.startsWith('did:nft:')) {
|
@@ -9,9 +9,10 @@ export function extract(
|
|
9
9
|
) {
|
10
10
|
if (!format) return {}
|
11
11
|
const keys = Object.keys(format({}))
|
12
|
-
return keys.reduce((data, key) => {
|
12
|
+
return keys.reduce((data: Record<string, unknown>, key) => {
|
13
|
+
// rome-ignore lint/suspicious/noPrototypeBuiltins:
|
13
14
|
if (value?.hasOwnProperty(key)) {
|
14
|
-
|
15
|
+
data[key] = value[key]
|
15
16
|
}
|
16
17
|
return data
|
17
18
|
}, {})
|
@@ -72,7 +72,7 @@ export async function prepareRequest<
|
|
72
72
|
blockTag: 'pending',
|
73
73
|
})
|
74
74
|
|
75
|
-
if (block.baseFeePerGas) {
|
75
|
+
if (typeof block.baseFeePerGas === 'bigint') {
|
76
76
|
if (typeof gasPrice !== 'undefined')
|
77
77
|
throw new BaseError('Chain does not support legacy `gasPrice`.')
|
78
78
|
|