@mentaproject/core 0.5.12 → 0.5.15
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/actions/index.d.ts +3 -1
- package/dist/actions/index.js +12 -4
- package/dist/actions/index.js.map +1 -1
- package/dist/actions/index.mjs +12 -5
- package/dist/actions/index.mjs.map +1 -1
- package/dist/actions/traceActions.d.ts +7 -0
- package/dist/actions/traceFilter.d.ts +4 -3
- package/dist/actions/traceTransaction.d.ts +4 -3
- package/dist/clients/createMentaAccount.d.ts +23 -22
- package/dist/clients/index.js +3 -3
- package/dist/clients/index.js.map +1 -1
- package/dist/clients/index.mjs +3 -3
- package/dist/clients/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/actions/index.ts +7 -2
- package/src/actions/traceActions.ts +25 -0
- package/src/actions/traceFilter.ts +22 -16
- package/src/actions/traceTransaction.ts +21 -14
- package/src/clients/createMentaAccount.ts +12 -5
package/package.json
CHANGED
package/src/actions/index.ts
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
export * from "viem/actions";
|
|
2
2
|
|
|
3
3
|
export {
|
|
4
|
-
|
|
4
|
+
sendTransaction,
|
|
5
|
+
signMessage,
|
|
6
|
+
signTypedData,
|
|
7
|
+
writeContract,
|
|
5
8
|
} from "permissionless/actions/smartAccount";
|
|
6
9
|
|
|
7
10
|
/** Trace Actions */
|
|
8
11
|
export { traceFilter } from "./traceFilter";
|
|
9
12
|
export { traceTransaction } from "./traceTransaction";
|
|
13
|
+
export { traceActions } from "./traceActions";
|
|
14
|
+
export type { TraceActions } from "./traceActions";
|
|
10
15
|
|
|
11
16
|
/** Block Range Actions */
|
|
12
|
-
export { fetchByBlockRange } from "./fetchByBlockRange";
|
|
17
|
+
export { fetchByBlockRange } from "./fetchByBlockRange";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Chain, Client, Transport } from "viem";
|
|
2
|
+
import type {
|
|
3
|
+
TraceFilterParameters,
|
|
4
|
+
TraceFilterReturnType,
|
|
5
|
+
TraceTransactionParameters,
|
|
6
|
+
TraceTransactionReturnType,
|
|
7
|
+
} from "../types";
|
|
8
|
+
import { traceFilter } from "./traceFilter";
|
|
9
|
+
import { traceTransaction } from "./traceTransaction";
|
|
10
|
+
|
|
11
|
+
export type TraceActions = {
|
|
12
|
+
traceFilter: (args: TraceFilterParameters) => Promise<TraceFilterReturnType>;
|
|
13
|
+
traceTransaction: (
|
|
14
|
+
args: TraceTransactionParameters,
|
|
15
|
+
) => Promise<TraceTransactionReturnType>;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export function traceActions(): <TChain extends Chain | undefined>(
|
|
19
|
+
client: Client<Transport, TChain>,
|
|
20
|
+
) => TraceActions {
|
|
21
|
+
return (client) => ({
|
|
22
|
+
traceFilter: (args) => traceFilter(client, args),
|
|
23
|
+
traceTransaction: (args) => traceTransaction(client, args),
|
|
24
|
+
});
|
|
25
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { Client, Transport, Chain } from "viem";
|
|
2
|
+
import type { TraceFilterParameters, TraceFilterReturnType } from "../types";
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Calls the 'trace_filter' RPC method to retrieve execution traces
|
|
@@ -7,25 +8,30 @@ import type { TraceFilterParameters, TraceFilterReturnType, CoreClient, Hash }
|
|
|
7
8
|
* This function sends a JSON-RPC request to the Ethereum node (or EVM-compatible)
|
|
8
9
|
* via the provided client object and returns the array of trace entries matching
|
|
9
10
|
* the filters.
|
|
10
|
-
*
|
|
11
|
+
*
|
|
11
12
|
* NOTE: This method relies on the non-standard 'trace_filter' method of the RPC.
|
|
12
13
|
* It may not be supported by all nodes.
|
|
13
14
|
*
|
|
14
|
-
* @param client The
|
|
15
|
+
* @param client The client instance used to perform the RPC call.
|
|
15
16
|
* @param params The filtering parameters for the trace request (block range, addresses, etc.).
|
|
16
17
|
* @returns A promise that returns an array of trace entries (GenericTraceEntry[])
|
|
17
18
|
* that match the filtering criteria.
|
|
18
19
|
*/
|
|
19
|
-
export async function traceFilter
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
20
|
+
export async function traceFilter<TChain extends Chain | undefined>(
|
|
21
|
+
client: Client<Transport, TChain>,
|
|
22
|
+
params: TraceFilterParameters,
|
|
23
|
+
): Promise<TraceFilterReturnType> {
|
|
24
|
+
if (typeof params.fromAddress === "string")
|
|
25
|
+
params.fromAddress = [params.fromAddress];
|
|
26
|
+
if (typeof params.toAddress === "string")
|
|
27
|
+
params.toAddress = [params.toAddress];
|
|
28
|
+
|
|
29
|
+
return await client.request<{
|
|
30
|
+
method: "trace_filter";
|
|
31
|
+
Parameters: TraceFilterParameters[];
|
|
32
|
+
ReturnType: TraceFilterReturnType;
|
|
33
|
+
}>({
|
|
34
|
+
method: "trace_filter",
|
|
35
|
+
params: [params],
|
|
36
|
+
});
|
|
37
|
+
}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { Client, Transport, Chain } from "viem";
|
|
2
|
+
import type {
|
|
3
|
+
TraceTransactionParameters,
|
|
4
|
+
TraceTransactionReturnType,
|
|
5
|
+
} from "../types";
|
|
2
6
|
|
|
3
7
|
/**
|
|
4
8
|
* Calls the 'trace_transaction' RPC method to retrieve execution traces
|
|
@@ -7,22 +11,25 @@ import type { TraceTransactionParameters, TraceTransactionReturnType, CoreClien
|
|
|
7
11
|
* This function sends a JSON-RPC request to the Ethereum node (or EVM-compatible)
|
|
8
12
|
* via the provided client object and returns the array of trace entries for
|
|
9
13
|
* the specified transaction hash.
|
|
10
|
-
*
|
|
14
|
+
*
|
|
11
15
|
* NOTE: This method relies on the non-standard 'trace_transaction' method of the RPC.
|
|
12
16
|
* It may not be supported by all nodes.
|
|
13
|
-
*
|
|
14
|
-
* @param client The
|
|
17
|
+
*
|
|
18
|
+
* @param client The client instance used to perform the RPC call.
|
|
15
19
|
* @param params The transaction hash for which to retrieve traces.
|
|
16
20
|
* @returns A promise that returns an array of trace entries (GenericTraceEntry[])
|
|
17
21
|
* for the specified transaction hash.
|
|
18
22
|
*/
|
|
19
|
-
export async function traceTransaction
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
export async function traceTransaction<TChain extends Chain | undefined>(
|
|
24
|
+
client: Client<Transport, TChain>,
|
|
25
|
+
params: TraceTransactionParameters,
|
|
26
|
+
): Promise<TraceTransactionReturnType> {
|
|
27
|
+
return await client.request<{
|
|
28
|
+
method: "trace_transaction";
|
|
29
|
+
Parameters: TraceTransactionParameters[];
|
|
30
|
+
ReturnType: TraceTransactionReturnType;
|
|
31
|
+
}>({
|
|
32
|
+
method: "trace_transaction",
|
|
33
|
+
params: [params],
|
|
34
|
+
});
|
|
35
|
+
}
|
|
@@ -2,17 +2,24 @@ import {
|
|
|
2
2
|
PasskeyValidatorContractVersion,
|
|
3
3
|
toPasskeyValidator,
|
|
4
4
|
} from "@zerodev/passkey-validator";
|
|
5
|
-
import {
|
|
5
|
+
import { MentaAccountParams } from "../types";
|
|
6
6
|
import { entryPoint07Address } from "../account-abstraction";
|
|
7
7
|
import { toKernelSmartAccount } from "permissionless/accounts";
|
|
8
8
|
import { createSmartAccountClient } from "permissionless";
|
|
9
9
|
import { erc7579Actions } from "permissionless/actions/erc7579";
|
|
10
|
+
import type {
|
|
11
|
+
Client,
|
|
12
|
+
Transport,
|
|
13
|
+
Chain,
|
|
14
|
+
JsonRpcAccount,
|
|
15
|
+
LocalAccount,
|
|
16
|
+
} from "viem";
|
|
10
17
|
|
|
11
|
-
export async function createMentaAccount(
|
|
12
|
-
|
|
18
|
+
export async function createMentaAccount<TChain extends Chain | undefined>(
|
|
19
|
+
client: Client<Transport, TChain, JsonRpcAccount | LocalAccount | undefined>,
|
|
13
20
|
params: MentaAccountParams,
|
|
14
21
|
) {
|
|
15
|
-
const validator = await toPasskeyValidator(
|
|
22
|
+
const validator = await toPasskeyValidator(client, {
|
|
16
23
|
webAuthnKey: params.signer,
|
|
17
24
|
entryPoint: {
|
|
18
25
|
address: entryPoint07Address,
|
|
@@ -24,7 +31,7 @@ export async function createMentaAccount(
|
|
|
24
31
|
|
|
25
32
|
const kernel = await toKernelSmartAccount({
|
|
26
33
|
owners: [validator],
|
|
27
|
-
client:
|
|
34
|
+
client: client,
|
|
28
35
|
});
|
|
29
36
|
|
|
30
37
|
return createSmartAccountClient({
|