@0xtorch/evm 0.0.44 → 0.0.46

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.
@@ -10,39 +10,42 @@ export declare const evmAddressPremitiveSchema: z.ZodObject<{
10
10
  }, "strip", z.ZodTypeAny, {
11
11
  chainId: number;
12
12
  address: string;
13
+ abi?: string | undefined;
13
14
  label?: string | undefined;
14
15
  isSpam?: boolean | undefined;
15
16
  appId?: string | undefined;
16
- abi?: string | undefined;
17
17
  }, {
18
18
  chainId: number;
19
19
  address: string;
20
+ abi?: string | undefined;
20
21
  label?: string | undefined;
21
22
  isSpam?: boolean | undefined;
22
23
  appId?: string | undefined;
23
- abi?: string | undefined;
24
24
  }>;
25
- export declare const evmAddressSchema: z.ZodObject<{
25
+ export declare const evmAddressSchema: z.ZodObject<z.objectUtil.extendShape<{
26
26
  chainId: z.ZodNumber;
27
+ address: z.ZodString;
27
28
  label: z.ZodOptional<z.ZodString>;
28
29
  isSpam: z.ZodOptional<z.ZodBoolean>;
29
30
  appId: z.ZodOptional<z.ZodString>;
31
+ abi: z.ZodOptional<z.ZodString>;
32
+ }, {
30
33
  address: z.ZodEffects<z.ZodString, `0x${Lowercase<string>}`, string>;
31
34
  abi: z.ZodOptional<z.ZodEffects<z.ZodString, Abi, string>>;
32
- }, "strip", z.ZodTypeAny, {
35
+ }>, "strip", z.ZodTypeAny, {
33
36
  chainId: number;
34
37
  address: `0x${Lowercase<string>}`;
38
+ abi?: Abi | undefined;
35
39
  label?: string | undefined;
36
40
  isSpam?: boolean | undefined;
37
41
  appId?: string | undefined;
38
- abi?: Abi | undefined;
39
42
  }, {
40
43
  chainId: number;
41
44
  address: string;
45
+ abi?: string | undefined;
42
46
  label?: string | undefined;
43
47
  isSpam?: boolean | undefined;
44
48
  appId?: string | undefined;
45
- abi?: string | undefined;
46
49
  }>;
47
50
  export type EvmAddressPrimitive = z.infer<typeof evmAddressPremitiveSchema>;
48
51
  export type EvmAddress = z.infer<typeof evmAddressSchema>;
@@ -1 +1 @@
1
- {"version":3,"file":"address.d.ts","sourceRoot":"","sources":["../../types/address.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AAC/B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;EAOpC,CAAA;AAEF,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;EAiB3B,CAAA;AAEF,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAA;AAE3E,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAA"}
1
+ {"version":3,"file":"address.d.ts","sourceRoot":"","sources":["../../types/address.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AAC/B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;EAOpC,CAAA;AAEF,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;EAiB3B,CAAA;AAEF,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAA;AAE3E,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAA"}
@@ -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
- }, "strip", z.ZodTypeAny, {
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
- }, "strip", z.ZodTypeAny, {
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,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAGrC,MAAM,MAAM,OAAO,GAAG,WAAW,GAAG,UAAU,CAAA;AAE9C,KAAK,WAAW,GAAG;IACjB,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAA;IAC5B,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM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,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"}
Binary file
Binary file
Binary file
@@ -3,6 +3,7 @@ import type { AbiEvent } from 'abitype'
3
3
  import type {
4
4
  Abi,
5
5
  ContractFunctionName,
6
+ createPublicClient,
6
7
  GetLogsReturnType,
7
8
  MulticallParameters,
8
9
  MulticallReturnType,
@@ -24,6 +25,7 @@ import {
24
25
  multicall,
25
26
  readContract,
26
27
  } from '../externals/viem'
28
+ import { createViemClient as createViemMiddleware } from '../externals/viem/middleware'
27
29
  import { defineClient } from './defineClient'
28
30
 
29
31
  type CreateViemClientParameters<TChain extends ViemChain> = {
@@ -37,6 +39,21 @@ export const createViemClient = <TChain extends ViemChain>({
37
39
  }: CreateViemClientParameters<TChain>) =>
38
40
  defineClient({
39
41
  httpRpcCount: httpRpcs.length,
42
+ call: async <T>(
43
+ caller: (client: ReturnType<typeof createPublicClient>) => Promise<T>,
44
+ config:
45
+ | {
46
+ readonly timeout?: number
47
+ readonly logger?: Logger
48
+ }
49
+ | undefined,
50
+ ) =>
51
+ createViemMiddleware(chain, httpRpcs).wrapper<T>(
52
+ caller,
53
+ undefined,
54
+ config?.timeout,
55
+ config?.logger,
56
+ ),
40
57
  estimateFeesPerGas: async (type, config) =>
41
58
  estimateFeesPerGas({ chain, httpRpcs, type }, config),
42
59
  getBalance: async (address, config) =>
package/clients/types.ts CHANGED
@@ -4,6 +4,7 @@ import type {
4
4
  Abi,
5
5
  Block,
6
6
  ContractFunctionName,
7
+ createPublicClient,
7
8
  FeeValues,
8
9
  GetLogsReturnType,
9
10
  MulticallParameters,
@@ -17,7 +18,7 @@ import type { Hex, LowerHex } from '../types'
17
18
 
18
19
  export type Client = {
19
20
  readonly httpRpcCount: number
20
- // TODO 主要関数を定義する
21
+ readonly call: FunctionCall
21
22
  readonly estimateFeesPerGas: FunctionEstimateFeesPerGas
22
23
  readonly getBalance: FunctionGetBalance
23
24
  readonly getBlock: FunctionGetBlock
@@ -30,6 +31,16 @@ export type Client = {
30
31
  readonly readContract: FunctionReadContract
31
32
  }
32
33
 
34
+ type PublicClient = ReturnType<typeof createPublicClient>
35
+
36
+ type FunctionCall = <T>(
37
+ caller: (client: PublicClient) => Promise<T>,
38
+ config?: {
39
+ readonly timeout?: number
40
+ readonly logger?: Logger
41
+ },
42
+ ) => Promise<T>
43
+
33
44
  type FunctionEstimateFeesPerGas = (
34
45
  type?: 'legacy' | 'eip1559',
35
46
  config?: {
package/decoder/tests.ts CHANGED
@@ -6,6 +6,9 @@ import { toLowerHex } from '../types'
6
6
 
7
7
  const dummyClient: Client = {
8
8
  httpRpcCount: 0,
9
+ call: () => {
10
+ throw new Error('Not implemented')
11
+ },
9
12
  estimateFeesPerGas: () => {
10
13
  throw new Error('Not implemented')
11
14
  },
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xtorch/evm",
3
- "version": "0.0.44",
3
+ "version": "0.0.46",
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.32",
41
+ "@0xtorch/core": "^0.0.33",
42
42
  "@supercharge/promise-pool": "^3.1.1",
43
43
  "viem": "^2.17.3",
44
- "zod": "^3.22.4"
44
+ "zod": "^3.23.8"
45
45
  },
46
46
  "peerDependencies": {
47
47
  "typescript": "^5.3.3"