@0xtorch/evm 0.0.43 → 0.0.45
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/_cjs/index.js +5 -1
- package/_cjs/index.js.map +1 -1
- package/_cjs/types/address.js +34 -0
- package/_cjs/types/address.js.map +1 -0
- package/_esm/index.js +1 -0
- package/_esm/index.js.map +1 -1
- package/_esm/types/address.js +31 -0
- package/_esm/types/address.js.map +1 -0
- package/_types/analyzer/json/schemas/generator.d.ts +19509 -37953
- package/_types/analyzer/json/schemas/generator.d.ts.map +1 -1
- package/_types/analyzer/json/schemas/index.d.ts +18 -18
- package/_types/decoder/tests.d.ts +2 -1
- package/_types/decoder/tests.d.ts.map +1 -1
- package/_types/index.d.ts +2 -0
- package/_types/index.d.ts.map +1 -1
- package/_types/types/address.d.ts +52 -0
- package/_types/types/address.d.ts.map +1 -0
- package/_types/types/log.d.ts +14 -12
- package/_types/types/log.d.ts.map +1 -1
- package/index.ts +2 -0
- package/package.json +3 -3
- package/types/address.ts +36 -0
package/_types/types/log.d.ts
CHANGED
|
@@ -15,24 +15,25 @@ type LogDecoded = {
|
|
|
15
15
|
export type DecodedLog = z.infer<typeof decodedLogSchema> & {
|
|
16
16
|
readonly type: 'DecodedLog';
|
|
17
17
|
};
|
|
18
|
-
export declare const parsedLogSchema: z.ZodObject<{
|
|
18
|
+
export declare const parsedLogSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
19
19
|
address: z.ZodEffects<z.ZodString, `0x${Lowercase<string>}`, string>;
|
|
20
|
-
transactionHash: z.ZodEffects<z.ZodString, `0x${string}`, string>;
|
|
21
|
-
data: z.ZodEffects<z.ZodString, `0x${string}`, string>;
|
|
22
20
|
blockHash: z.ZodEffects<z.ZodString, `0x${string}`, string>;
|
|
23
21
|
blockNumber: z.ZodBigInt;
|
|
22
|
+
data: z.ZodEffects<z.ZodString, `0x${string}`, string>;
|
|
24
23
|
logIndex: z.ZodNumber;
|
|
24
|
+
transactionHash: z.ZodEffects<z.ZodString, `0x${string}`, string>;
|
|
25
25
|
transactionIndex: z.ZodNumber;
|
|
26
26
|
removed: z.ZodBoolean;
|
|
27
27
|
topics: z.ZodArray<z.ZodEffects<z.ZodString, `0x${string}`, string>, "many">;
|
|
28
|
+
}, {
|
|
28
29
|
eventName: z.ZodString;
|
|
29
30
|
args: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
30
|
-
}
|
|
31
|
+
}>, "strip", z.ZodTypeAny, {
|
|
31
32
|
address: `0x${Lowercase<string>}`;
|
|
32
33
|
transactionHash: `0x${string}`;
|
|
33
|
-
data: `0x${string}`;
|
|
34
34
|
blockHash: `0x${string}`;
|
|
35
35
|
blockNumber: bigint;
|
|
36
|
+
data: `0x${string}`;
|
|
36
37
|
logIndex: number;
|
|
37
38
|
transactionIndex: number;
|
|
38
39
|
removed: boolean;
|
|
@@ -42,9 +43,9 @@ export declare const parsedLogSchema: z.ZodObject<{
|
|
|
42
43
|
}, {
|
|
43
44
|
address: string;
|
|
44
45
|
transactionHash: string;
|
|
45
|
-
data: string;
|
|
46
46
|
blockHash: string;
|
|
47
47
|
blockNumber: bigint;
|
|
48
|
+
data: string;
|
|
48
49
|
logIndex: number;
|
|
49
50
|
transactionIndex: number;
|
|
50
51
|
removed: boolean;
|
|
@@ -52,16 +53,17 @@ export declare const parsedLogSchema: z.ZodObject<{
|
|
|
52
53
|
eventName: string;
|
|
53
54
|
args: Record<string, unknown>;
|
|
54
55
|
}>;
|
|
55
|
-
export declare const decodedLogSchema: z.ZodObject<{
|
|
56
|
+
export declare const decodedLogSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
56
57
|
address: z.ZodEffects<z.ZodString, `0x${Lowercase<string>}`, string>;
|
|
57
|
-
transactionHash: z.ZodEffects<z.ZodString, `0x${string}`, string>;
|
|
58
|
-
data: z.ZodEffects<z.ZodString, `0x${string}`, string>;
|
|
59
58
|
blockHash: z.ZodEffects<z.ZodString, `0x${string}`, string>;
|
|
60
59
|
blockNumber: z.ZodBigInt;
|
|
60
|
+
data: z.ZodEffects<z.ZodString, `0x${string}`, string>;
|
|
61
61
|
logIndex: z.ZodNumber;
|
|
62
|
+
transactionHash: z.ZodEffects<z.ZodString, `0x${string}`, string>;
|
|
62
63
|
transactionIndex: z.ZodNumber;
|
|
63
64
|
removed: z.ZodBoolean;
|
|
64
65
|
topics: z.ZodArray<z.ZodEffects<z.ZodString, `0x${string}`, string>, "many">;
|
|
66
|
+
}, {
|
|
65
67
|
eventName: z.ZodString;
|
|
66
68
|
args: z.ZodArray<z.ZodObject<{
|
|
67
69
|
indexed: z.ZodBoolean;
|
|
@@ -79,12 +81,12 @@ export declare const decodedLogSchema: z.ZodObject<{
|
|
|
79
81
|
name: string;
|
|
80
82
|
value?: unknown;
|
|
81
83
|
}>, "many">;
|
|
82
|
-
}
|
|
84
|
+
}>, "strip", z.ZodTypeAny, {
|
|
83
85
|
address: `0x${Lowercase<string>}`;
|
|
84
86
|
transactionHash: `0x${string}`;
|
|
85
|
-
data: `0x${string}`;
|
|
86
87
|
blockHash: `0x${string}`;
|
|
87
88
|
blockNumber: bigint;
|
|
89
|
+
data: `0x${string}`;
|
|
88
90
|
logIndex: number;
|
|
89
91
|
transactionIndex: number;
|
|
90
92
|
removed: boolean;
|
|
@@ -99,9 +101,9 @@ export declare const decodedLogSchema: z.ZodObject<{
|
|
|
99
101
|
}, {
|
|
100
102
|
address: string;
|
|
101
103
|
transactionHash: string;
|
|
102
|
-
data: string;
|
|
103
104
|
blockHash: string;
|
|
104
105
|
blockNumber: bigint;
|
|
106
|
+
data: string;
|
|
105
107
|
logIndex: number;
|
|
106
108
|
transactionIndex: number;
|
|
107
109
|
removed: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../types/log.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AAC/B,OAAO,EAAE,CA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C,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAA;CAC1B,CAAA;AAED,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,GAAG;IAC1D,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAA;CAC5B,CAAA;AA+BD,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAG1B,CAAA;AAEF,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAU3B,CAAA"}
|
package/index.ts
CHANGED
|
@@ -118,6 +118,8 @@ export type {
|
|
|
118
118
|
TransactionFull,
|
|
119
119
|
TransactionSource,
|
|
120
120
|
} from './types'
|
|
121
|
+
export { evmAddressPremitiveSchema, evmAddressSchema } from './types/address'
|
|
122
|
+
export type { EvmAddress, EvmAddressPrimitive } from './types/address'
|
|
121
123
|
export {
|
|
122
124
|
createErc1155NftId,
|
|
123
125
|
createErc721NftId,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0xtorch/evm",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.45",
|
|
4
4
|
"description": "Cryptorch EVM extension",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cryptorch",
|
|
@@ -38,10 +38,10 @@
|
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@0xtorch/big-decimal": "^0.0.10",
|
|
41
|
-
"@0xtorch/core": "^0.0.
|
|
41
|
+
"@0xtorch/core": "^0.0.33",
|
|
42
42
|
"@supercharge/promise-pool": "^3.1.1",
|
|
43
43
|
"viem": "^2.17.3",
|
|
44
|
-
"zod": "^3.
|
|
44
|
+
"zod": "^3.23.8"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"typescript": "^5.3.3"
|
package/types/address.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Abi as AbiSchema } from 'abitype/zod'
|
|
2
|
+
import type { Abi } from 'viem'
|
|
3
|
+
import { z } from 'zod'
|
|
4
|
+
import { isHex, toLowerHex } from './hex'
|
|
5
|
+
|
|
6
|
+
export const evmAddressPremitiveSchema = z.object({
|
|
7
|
+
chainId: z.number().int(),
|
|
8
|
+
address: z.string().regex(/^0x[\dA-Fa-f]{40}$/),
|
|
9
|
+
label: z.string().optional(),
|
|
10
|
+
isSpam: z.boolean().optional(),
|
|
11
|
+
appId: z.string().optional(),
|
|
12
|
+
abi: z.string().optional(),
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
export const evmAddressSchema = evmAddressPremitiveSchema.extend({
|
|
16
|
+
address: z
|
|
17
|
+
.string()
|
|
18
|
+
.regex(/^0x[\dA-Fa-f]{40}$/)
|
|
19
|
+
.transform((v) => (isHex(v) ? toLowerHex(v) : '0x')),
|
|
20
|
+
abi: z
|
|
21
|
+
.string()
|
|
22
|
+
.transform((value, context): Abi => {
|
|
23
|
+
try {
|
|
24
|
+
const abi = AbiSchema.parse(JSON.parse(value))
|
|
25
|
+
return abi
|
|
26
|
+
} catch {
|
|
27
|
+
context.addIssue({ code: 'custom', message: 'Invalid ABI format' })
|
|
28
|
+
return z.NEVER
|
|
29
|
+
}
|
|
30
|
+
})
|
|
31
|
+
.optional(),
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
export type EvmAddressPrimitive = z.infer<typeof evmAddressPremitiveSchema>
|
|
35
|
+
|
|
36
|
+
export type EvmAddress = z.infer<typeof evmAddressSchema>
|