@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/dist/actions/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export * from "viem/actions";
|
|
2
|
-
export { sendTransaction, signMessage, signTypedData, writeContract } from "permissionless/actions/smartAccount";
|
|
2
|
+
export { sendTransaction, signMessage, signTypedData, writeContract, } from "permissionless/actions/smartAccount";
|
|
3
3
|
/** Trace Actions */
|
|
4
4
|
export { traceFilter } from "./traceFilter";
|
|
5
5
|
export { traceTransaction } from "./traceTransaction";
|
|
6
|
+
export { traceActions } from "./traceActions";
|
|
7
|
+
export type { TraceActions } from "./traceActions";
|
|
6
8
|
/** Block Range Actions */
|
|
7
9
|
export { fetchByBlockRange } from "./fetchByBlockRange";
|
package/dist/actions/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var smartAccount = require('permissionless/actions/smartAccount');
|
|
|
14
14
|
* NOTE: This method relies on the non-standard 'trace_filter' method of the RPC.
|
|
15
15
|
* It may not be supported by all nodes.
|
|
16
16
|
*
|
|
17
|
-
* @param client The
|
|
17
|
+
* @param client The client instance used to perform the RPC call.
|
|
18
18
|
* @param params The filtering parameters for the trace request (block range, addresses, etc.).
|
|
19
19
|
* @returns A promise that returns an array of trace entries (GenericTraceEntry[])
|
|
20
20
|
* that match the filtering criteria.
|
|
@@ -25,7 +25,7 @@ async function traceFilter(client, params) {
|
|
|
25
25
|
if (typeof params.toAddress === "string")
|
|
26
26
|
params.toAddress = [params.toAddress];
|
|
27
27
|
return await client.request({
|
|
28
|
-
method:
|
|
28
|
+
method: "trace_filter",
|
|
29
29
|
params: [params],
|
|
30
30
|
});
|
|
31
31
|
}
|
|
@@ -41,18 +41,25 @@ async function traceFilter(client, params) {
|
|
|
41
41
|
* NOTE: This method relies on the non-standard 'trace_transaction' method of the RPC.
|
|
42
42
|
* It may not be supported by all nodes.
|
|
43
43
|
*
|
|
44
|
-
* @param client The
|
|
44
|
+
* @param client The client instance used to perform the RPC call.
|
|
45
45
|
* @param params The transaction hash for which to retrieve traces.
|
|
46
46
|
* @returns A promise that returns an array of trace entries (GenericTraceEntry[])
|
|
47
47
|
* for the specified transaction hash.
|
|
48
48
|
*/
|
|
49
49
|
async function traceTransaction(client, params) {
|
|
50
50
|
return await client.request({
|
|
51
|
-
method:
|
|
51
|
+
method: "trace_transaction",
|
|
52
52
|
params: [params],
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
function traceActions() {
|
|
57
|
+
return (client) => ({
|
|
58
|
+
traceFilter: (args) => traceFilter(client, args),
|
|
59
|
+
traceTransaction: (args) => traceTransaction(client, args),
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
56
63
|
function calcBlockRange(fromBlock, rangeSize, direction = "forward") {
|
|
57
64
|
if (direction === "backward")
|
|
58
65
|
return { fromBlock: fromBlock - BigInt(rangeSize), toBlock: fromBlock };
|
|
@@ -161,6 +168,7 @@ Object.defineProperty(exports, "writeContract", {
|
|
|
161
168
|
get: function () { return smartAccount.writeContract; }
|
|
162
169
|
});
|
|
163
170
|
exports.fetchByBlockRange = fetchByBlockRange;
|
|
171
|
+
exports.traceActions = traceActions;
|
|
164
172
|
exports.traceFilter = traceFilter;
|
|
165
173
|
exports.traceTransaction = traceTransaction;
|
|
166
174
|
Object.keys(actions).forEach(function (k) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/actions/traceFilter.ts","../../src/actions/traceTransaction.ts","../../src/actions/fetchByBlockRange.ts"],"sourcesContent":["import type { TraceFilterParameters, TraceFilterReturnType, CoreClient, Hash } from \"../types\";\n\n/**\n * Calls the 'trace_filter' RPC method to retrieve execution traces\n * filtered according to the specified criteria.\n *\n * This function sends a JSON-RPC request to the Ethereum node (or EVM-compatible)\n * via the provided client object and returns the array of trace entries matching\n * the filters.\n * \n * NOTE: This method relies on the non-standard 'trace_filter' method of the RPC.\n * It may not be supported by all nodes.\n *\n * @param client The CoreClient instance used to perform the RPC call.\n * @param params The filtering parameters for the trace request (block range, addresses, etc.).\n * @returns A promise that returns an array of trace entries (GenericTraceEntry[])\n * that match the filtering criteria.\n */\nexport async function traceFilter(client: CoreClient, params: TraceFilterParameters): Promise<TraceFilterReturnType> {\n if (typeof params.fromAddress === \"string\") params.fromAddress = [params.fromAddress];\n if (typeof params.toAddress === \"string\") params.toAddress = [params.toAddress];\n \n return await client.request<{\n method: 'trace_filter',\n Parameters: TraceFilterParameters[],\n ReturnType: TraceFilterReturnType\n }>({\n method: 'trace_filter',\n params: [params],\n });\n}","import type { TraceTransactionParameters, TraceTransactionReturnType, CoreClient, Hash } from \"../types\";\n\n/**\n * Calls the 'trace_transaction' RPC method to retrieve execution traces\n * for a specific transaction hash.\n *\n * This function sends a JSON-RPC request to the Ethereum node (or EVM-compatible)\n * via the provided client object and returns the array of trace entries for\n * the specified transaction hash.\n * \n * NOTE: This method relies on the non-standard 'trace_transaction' method of the RPC.\n * It may not be supported by all nodes.\n * \n * @param client The CoreClient instance used to perform the RPC call.\n * @param params The transaction hash for which to retrieve traces.\n * @returns A promise that returns an array of trace entries (GenericTraceEntry[])\n * for the specified transaction hash.\n */\nexport async function traceTransaction(client: CoreClient, params: TraceTransactionParameters): Promise<TraceTransactionReturnType> {\n return await client.request<{\n method: 'trace_transaction',\n Parameters: TraceTransactionParameters[],\n ReturnType: TraceTransactionReturnType\n }>({\n method: 'trace_transaction',\n params: [params],\n });\n}","import { FetchBlockRangeParameters } from \"../types/BlockRangeFetcher\";\n\nfunction calcBlockRange(fromBlock: bigint, rangeSize: number, direction: \"backward\" | \"forward\" = \"forward\") {\n if (direction === \"backward\") return { fromBlock: fromBlock - BigInt(rangeSize), toBlock: fromBlock };\n return { fromBlock: fromBlock, toBlock: fromBlock + BigInt(rangeSize) };\n};\n\nfunction hasHitBlockLimit(blockNumber: bigint, direction: \"backward\" | \"forward\", blockLimit: bigint) {\n return direction === \"backward\" ? blockNumber < blockLimit : blockNumber > blockLimit;\n};\n\nfunction hasHitItemLimit(items: any[], itemLimit: number) {\n return items.length >= itemLimit;\n};\n\n/**\n * Fetch large amounts of data in batches by exploring with dynamic block ranges.\n * \n * Block ranges automatically adjust based on the provided configuration and how many items are found per batch. \n * If the actual block range returns too many items, the explorer will automatically reduce the range size for the next batch. \n * If the actual block range returns too few items, the explorer will automatically increase the range size for the next batch.\n * \n * This method is optimized to maximize efficiency by fetching items and minimizing the charge on the RPC node by \n * requesting too many items per batch or too many batches per second.\n * \n * Useful for methods like `eth_getLogs` or `trace_filter` that iterate over blocks to find items.\n * \n * @param params - The parameters for creating the explorer.\n */\nexport async function fetchByBlockRange(params: FetchBlockRangeParameters) {\n const options = {\n\n // By how much to increase/decrease the range size if the batch returns few/many items\n dividerOnHigh: 2,\n multiplierOnLow: 1.5,\n multiplierOnZero: 2,\n\n // How to determine if the batch returned few/many items\n highActivityThreshold: 50,\n lowActivityThreshold: 10,\n\n // Limits and init values for the range size\n initialRangeSize: 100,\n maxRangeSize: 100_000,\n minRangeSize: 1,\n\n // \n ...params.options,\n };\n\n let currentBlock = params.fromBlock;\n let rangeSize = options.initialRangeSize;\n let stopped = false;\n\n const stop = () => {\n stopped = true;\n };\n\n const totalItems: any[] = [];\n\n function shouldStop() {\n return hasHitBlockLimit(currentBlock, params.direction, params.toBlock) || hasHitItemLimit(totalItems, params.itemLimit);\n }\n\n while (!stopped && !shouldStop() ) {\n const blockRange = calcBlockRange(currentBlock, rangeSize, params.direction);\n\n // Cap the block range to the overall limits\n if (params.direction === \"forward\") {\n if (blockRange.toBlock > params.toBlock) {\n blockRange.toBlock = params.toBlock;\n }\n } else { // backward\n if (blockRange.fromBlock < params.toBlock) {\n blockRange.fromBlock = params.toBlock;\n }\n }\n\n const batchItems = await params.onBlockRange(blockRange, stop);\n\n totalItems.push(...batchItems);\n\n if (stopped) break;\n\n // Adjust range size based on activity\n if (batchItems.length > options.highActivityThreshold) {\n rangeSize /= options.dividerOnHigh;\n } else if (batchItems.length === 0) {\n rangeSize *= options.multiplierOnZero;\n } else if (batchItems.length <= options.lowActivityThreshold) {\n rangeSize *= options.multiplierOnLow;\n }\n\n // Cap and round the range size\n rangeSize = Math.round(\n Math.max(options.minRangeSize, Math.min(options.maxRangeSize, rangeSize))\n );\n\n // Determine the next block to start from, fixing the \"backward\" direction logic\n if (params.direction === \"backward\") {\n currentBlock = blockRange.fromBlock - 1n;\n } else {\n currentBlock = blockRange.toBlock + 1n;\n }\n }\n\n return totalItems.slice(0, params.itemLimit);\n}\n"],"names":[],"mappings":";;;;;AAEA;;;;;;;;;;;;;;;AAeG;AACI,eAAe,WAAW,CAAC,MAAkB,EAAE,MAA6B,EAAA;AAC/E,IAAA,IAAI,OAAO,MAAM,CAAC,WAAW,KAAK,QAAQ;QAAE,MAAM,CAAC,WAAW,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC;AACrF,IAAA,IAAI,OAAO,MAAM,CAAC,SAAS,KAAK,QAAQ;QAAE,MAAM,CAAC,SAAS,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC;AAE/E,IAAA,OAAO,MAAM,MAAM,CAAC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,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE;AAChC,YAAA,SAAS,IAAI,OAAO,CAAC,gBAAgB;QACzC;aAAO,IAAI,UAAU,CAAC,MAAM,IAAI,OAAO,CAAC,oBAAoB,EAAE;AAC1D,YAAA,SAAS,IAAI,OAAO,CAAC,eAAe;QACxC;;QAGA,SAAS,GAAG,IAAI,CAAC,KAAK,CAClB,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,YAAY,EAAE,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC,CAC5E;;AAGD,QAAA,IAAI,MAAM,CAAC,SAAS,KAAK,UAAU,EAAE;AACjC,YAAA,YAAY,GAAG,UAAU,CAAC,SAAS,GAAG,EAAE;QAC5C;aAAO;AACH,YAAA,YAAY,GAAG,UAAU,CAAC,OAAO,GAAG,EAAE;QAC1C;IACJ;IAEA,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,SAAS,CAAC;AAChD;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/actions/traceFilter.ts","../../src/actions/traceTransaction.ts","../../src/actions/traceActions.ts","../../src/actions/fetchByBlockRange.ts"],"sourcesContent":["import type { Client, Transport, Chain } from \"viem\";\nimport type { TraceFilterParameters, TraceFilterReturnType } from \"../types\";\n\n/**\n * Calls the 'trace_filter' RPC method to retrieve execution traces\n * filtered according to the specified criteria.\n *\n * This function sends a JSON-RPC request to the Ethereum node (or EVM-compatible)\n * via the provided client object and returns the array of trace entries matching\n * the filters.\n *\n * NOTE: This method relies on the non-standard 'trace_filter' method of the RPC.\n * It may not be supported by all nodes.\n *\n * @param client The client instance used to perform the RPC call.\n * @param params The filtering parameters for the trace request (block range, addresses, etc.).\n * @returns A promise that returns an array of trace entries (GenericTraceEntry[])\n * that match the filtering criteria.\n */\nexport async function traceFilter<TChain extends Chain | undefined>(\n client: Client<Transport, TChain>,\n params: TraceFilterParameters,\n): Promise<TraceFilterReturnType> {\n if (typeof params.fromAddress === \"string\")\n params.fromAddress = [params.fromAddress];\n if (typeof params.toAddress === \"string\")\n params.toAddress = [params.toAddress];\n\n return await client.request<{\n method: \"trace_filter\";\n Parameters: TraceFilterParameters[];\n ReturnType: TraceFilterReturnType;\n }>({\n method: \"trace_filter\",\n params: [params],\n });\n}\n","import type { Client, Transport, Chain } from \"viem\";\nimport type {\n TraceTransactionParameters,\n TraceTransactionReturnType,\n} from \"../types\";\n\n/**\n * Calls the 'trace_transaction' RPC method to retrieve execution traces\n * for a specific transaction hash.\n *\n * This function sends a JSON-RPC request to the Ethereum node (or EVM-compatible)\n * via the provided client object and returns the array of trace entries for\n * the specified transaction hash.\n *\n * NOTE: This method relies on the non-standard 'trace_transaction' method of the RPC.\n * It may not be supported by all nodes.\n *\n * @param client The client instance used to perform the RPC call.\n * @param params The transaction hash for which to retrieve traces.\n * @returns A promise that returns an array of trace entries (GenericTraceEntry[])\n * for the specified transaction hash.\n */\nexport async function traceTransaction<TChain extends Chain | undefined>(\n client: Client<Transport, TChain>,\n params: TraceTransactionParameters,\n): Promise<TraceTransactionReturnType> {\n return await client.request<{\n method: \"trace_transaction\";\n Parameters: TraceTransactionParameters[];\n ReturnType: TraceTransactionReturnType;\n }>({\n method: \"trace_transaction\",\n params: [params],\n });\n}\n","import type { Chain, Client, Transport } from \"viem\";\nimport type {\n TraceFilterParameters,\n TraceFilterReturnType,\n TraceTransactionParameters,\n TraceTransactionReturnType,\n} from \"../types\";\nimport { traceFilter } from \"./traceFilter\";\nimport { traceTransaction } from \"./traceTransaction\";\n\nexport type TraceActions = {\n traceFilter: (args: TraceFilterParameters) => Promise<TraceFilterReturnType>;\n traceTransaction: (\n args: TraceTransactionParameters,\n ) => Promise<TraceTransactionReturnType>;\n};\n\nexport function traceActions(): <TChain extends Chain | undefined>(\n client: Client<Transport, TChain>,\n) => TraceActions {\n return (client) => ({\n traceFilter: (args) => traceFilter(client, args),\n traceTransaction: (args) => traceTransaction(client, args),\n });\n}\n","import { FetchBlockRangeParameters } from \"../types/BlockRangeFetcher\";\n\nfunction calcBlockRange(fromBlock: bigint, rangeSize: number, direction: \"backward\" | \"forward\" = \"forward\") {\n if (direction === \"backward\") return { fromBlock: fromBlock - BigInt(rangeSize), toBlock: fromBlock };\n return { fromBlock: fromBlock, toBlock: fromBlock + BigInt(rangeSize) };\n};\n\nfunction hasHitBlockLimit(blockNumber: bigint, direction: \"backward\" | \"forward\", blockLimit: bigint) {\n return direction === \"backward\" ? blockNumber < blockLimit : blockNumber > blockLimit;\n};\n\nfunction hasHitItemLimit(items: any[], itemLimit: number) {\n return items.length >= itemLimit;\n};\n\n/**\n * Fetch large amounts of data in batches by exploring with dynamic block ranges.\n * \n * Block ranges automatically adjust based on the provided configuration and how many items are found per batch. \n * If the actual block range returns too many items, the explorer will automatically reduce the range size for the next batch. \n * If the actual block range returns too few items, the explorer will automatically increase the range size for the next batch.\n * \n * This method is optimized to maximize efficiency by fetching items and minimizing the charge on the RPC node by \n * requesting too many items per batch or too many batches per second.\n * \n * Useful for methods like `eth_getLogs` or `trace_filter` that iterate over blocks to find items.\n * \n * @param params - The parameters for creating the explorer.\n */\nexport async function fetchByBlockRange(params: FetchBlockRangeParameters) {\n const options = {\n\n // By how much to increase/decrease the range size if the batch returns few/many items\n dividerOnHigh: 2,\n multiplierOnLow: 1.5,\n multiplierOnZero: 2,\n\n // How to determine if the batch returned few/many items\n highActivityThreshold: 50,\n lowActivityThreshold: 10,\n\n // Limits and init values for the range size\n initialRangeSize: 100,\n maxRangeSize: 100_000,\n minRangeSize: 1,\n\n // \n ...params.options,\n };\n\n let currentBlock = params.fromBlock;\n let rangeSize = options.initialRangeSize;\n let stopped = false;\n\n const stop = () => {\n stopped = true;\n };\n\n const totalItems: any[] = [];\n\n function shouldStop() {\n return hasHitBlockLimit(currentBlock, params.direction, params.toBlock) || hasHitItemLimit(totalItems, params.itemLimit);\n }\n\n while (!stopped && !shouldStop() ) {\n const blockRange = calcBlockRange(currentBlock, rangeSize, params.direction);\n\n // Cap the block range to the overall limits\n if (params.direction === \"forward\") {\n if (blockRange.toBlock > params.toBlock) {\n blockRange.toBlock = params.toBlock;\n }\n } else { // backward\n if (blockRange.fromBlock < params.toBlock) {\n blockRange.fromBlock = params.toBlock;\n }\n }\n\n const batchItems = await params.onBlockRange(blockRange, stop);\n\n totalItems.push(...batchItems);\n\n if (stopped) break;\n\n // Adjust range size based on activity\n if (batchItems.length > options.highActivityThreshold) {\n rangeSize /= options.dividerOnHigh;\n } else if (batchItems.length === 0) {\n rangeSize *= options.multiplierOnZero;\n } else if (batchItems.length <= options.lowActivityThreshold) {\n rangeSize *= options.multiplierOnLow;\n }\n\n // Cap and round the range size\n rangeSize = Math.round(\n Math.max(options.minRangeSize, Math.min(options.maxRangeSize, rangeSize))\n );\n\n // Determine the next block to start from, fixing the \"backward\" direction logic\n if (params.direction === \"backward\") {\n currentBlock = blockRange.fromBlock - 1n;\n } else {\n currentBlock = blockRange.toBlock + 1n;\n }\n }\n\n return totalItems.slice(0, params.itemLimit);\n}\n"],"names":[],"mappings":";;;;;AAGA;;;;;;;;;;;;;;;AAeG;AACI,eAAe,WAAW,CAC/B,MAAiC,EACjC,MAA6B,EAAA;AAE7B,IAAA,IAAI,OAAO,MAAM,CAAC,WAAW,KAAK,QAAQ;QACxC,MAAM,CAAC,WAAW,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC;AAC3C,IAAA,IAAI,OAAO,MAAM,CAAC,SAAS,KAAK,QAAQ;QACtC,MAAM,CAAC,SAAS,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC;AAEvC,IAAA,OAAO,MAAM,MAAM,CAAC,OAAO,CAIxB;AACD,QAAA,MAAM,EAAE,cAAc;QACtB,MAAM,EAAE,CAAC,MAAM,CAAC;AACjB,KAAA,CAAC;AACJ;;AC9BA;;;;;;;;;;;;;;;AAeG;AACI,eAAe,gBAAgB,CACpC,MAAiC,EACjC,MA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,YAAA,SAAS,IAAI,OAAO,CAAC,aAAa;QACtC;AAAO,aAAA,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE;AAChC,YAAA,SAAS,IAAI,OAAO,CAAC,gBAAgB;QACzC;aAAO,IAAI,UAAU,CAAC,MAAM,IAAI,OAAO,CAAC,oBAAoB,EAAE;AAC1D,YAAA,SAAS,IAAI,OAAO,CAAC,eAAe;QACxC;;QAGA,SAAS,GAAG,IAAI,CAAC,KAAK,CAClB,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,YAAY,EAAE,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC,CAC5E;;AAGD,QAAA,IAAI,MAAM,CAAC,SAAS,KAAK,UAAU,EAAE;AACjC,YAAA,YAAY,GAAG,UAAU,CAAC,SAAS,GAAG,EAAE;QAC5C;aAAO;AACH,YAAA,YAAY,GAAG,UAAU,CAAC,OAAO,GAAG,EAAE;QAC1C;IACJ;IAEA,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,SAAS,CAAC;AAChD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/actions/index.mjs
CHANGED
|
@@ -12,7 +12,7 @@ export { sendTransaction, signMessage, signTypedData, writeContract } from 'perm
|
|
|
12
12
|
* NOTE: This method relies on the non-standard 'trace_filter' method of the RPC.
|
|
13
13
|
* It may not be supported by all nodes.
|
|
14
14
|
*
|
|
15
|
-
* @param client The
|
|
15
|
+
* @param client The client instance used to perform the RPC call.
|
|
16
16
|
* @param params The filtering parameters for the trace request (block range, addresses, etc.).
|
|
17
17
|
* @returns A promise that returns an array of trace entries (GenericTraceEntry[])
|
|
18
18
|
* that match the filtering criteria.
|
|
@@ -23,7 +23,7 @@ async function traceFilter(client, params) {
|
|
|
23
23
|
if (typeof params.toAddress === "string")
|
|
24
24
|
params.toAddress = [params.toAddress];
|
|
25
25
|
return await client.request({
|
|
26
|
-
method:
|
|
26
|
+
method: "trace_filter",
|
|
27
27
|
params: [params],
|
|
28
28
|
});
|
|
29
29
|
}
|
|
@@ -39,18 +39,25 @@ async function traceFilter(client, params) {
|
|
|
39
39
|
* NOTE: This method relies on the non-standard 'trace_transaction' method of the RPC.
|
|
40
40
|
* It may not be supported by all nodes.
|
|
41
41
|
*
|
|
42
|
-
* @param client The
|
|
42
|
+
* @param client The client instance used to perform the RPC call.
|
|
43
43
|
* @param params The transaction hash for which to retrieve traces.
|
|
44
44
|
* @returns A promise that returns an array of trace entries (GenericTraceEntry[])
|
|
45
45
|
* for the specified transaction hash.
|
|
46
46
|
*/
|
|
47
47
|
async function traceTransaction(client, params) {
|
|
48
48
|
return await client.request({
|
|
49
|
-
method:
|
|
49
|
+
method: "trace_transaction",
|
|
50
50
|
params: [params],
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
function traceActions() {
|
|
55
|
+
return (client) => ({
|
|
56
|
+
traceFilter: (args) => traceFilter(client, args),
|
|
57
|
+
traceTransaction: (args) => traceTransaction(client, args),
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
|
|
54
61
|
function calcBlockRange(fromBlock, rangeSize, direction = "forward") {
|
|
55
62
|
if (direction === "backward")
|
|
56
63
|
return { fromBlock: fromBlock - BigInt(rangeSize), toBlock: fromBlock };
|
|
@@ -142,5 +149,5 @@ async function fetchByBlockRange(params) {
|
|
|
142
149
|
return totalItems.slice(0, params.itemLimit);
|
|
143
150
|
}
|
|
144
151
|
|
|
145
|
-
export { fetchByBlockRange, traceFilter, traceTransaction };
|
|
152
|
+
export { fetchByBlockRange, traceActions, traceFilter, traceTransaction };
|
|
146
153
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../src/actions/traceFilter.ts","../../src/actions/traceTransaction.ts","../../src/actions/fetchByBlockRange.ts"],"sourcesContent":["import type { TraceFilterParameters, TraceFilterReturnType, CoreClient, Hash } from \"../types\";\n\n/**\n * Calls the 'trace_filter' RPC method to retrieve execution traces\n * filtered according to the specified criteria.\n *\n * This function sends a JSON-RPC request to the Ethereum node (or EVM-compatible)\n * via the provided client object and returns the array of trace entries matching\n * the filters.\n * \n * NOTE: This method relies on the non-standard 'trace_filter' method of the RPC.\n * It may not be supported by all nodes.\n *\n * @param client The CoreClient instance used to perform the RPC call.\n * @param params The filtering parameters for the trace request (block range, addresses, etc.).\n * @returns A promise that returns an array of trace entries (GenericTraceEntry[])\n * that match the filtering criteria.\n */\nexport async function traceFilter(client: CoreClient, params: TraceFilterParameters): Promise<TraceFilterReturnType> {\n if (typeof params.fromAddress === \"string\") params.fromAddress = [params.fromAddress];\n if (typeof params.toAddress === \"string\") params.toAddress = [params.toAddress];\n \n return await client.request<{\n method: 'trace_filter',\n Parameters: TraceFilterParameters[],\n ReturnType: TraceFilterReturnType\n }>({\n method: 'trace_filter',\n params: [params],\n });\n}","import type { TraceTransactionParameters, TraceTransactionReturnType, CoreClient, Hash } from \"../types\";\n\n/**\n * Calls the 'trace_transaction' RPC method to retrieve execution traces\n * for a specific transaction hash.\n *\n * This function sends a JSON-RPC request to the Ethereum node (or EVM-compatible)\n * via the provided client object and returns the array of trace entries for\n * the specified transaction hash.\n * \n * NOTE: This method relies on the non-standard 'trace_transaction' method of the RPC.\n * It may not be supported by all nodes.\n * \n * @param client The CoreClient instance used to perform the RPC call.\n * @param params The transaction hash for which to retrieve traces.\n * @returns A promise that returns an array of trace entries (GenericTraceEntry[])\n * for the specified transaction hash.\n */\nexport async function traceTransaction(client: CoreClient, params: TraceTransactionParameters): Promise<TraceTransactionReturnType> {\n return await client.request<{\n method: 'trace_transaction',\n Parameters: TraceTransactionParameters[],\n ReturnType: TraceTransactionReturnType\n }>({\n method: 'trace_transaction',\n params: [params],\n });\n}","import { FetchBlockRangeParameters } from \"../types/BlockRangeFetcher\";\n\nfunction calcBlockRange(fromBlock: bigint, rangeSize: number, direction: \"backward\" | \"forward\" = \"forward\") {\n if (direction === \"backward\") return { fromBlock: fromBlock - BigInt(rangeSize), toBlock: fromBlock };\n return { fromBlock: fromBlock, toBlock: fromBlock + BigInt(rangeSize) };\n};\n\nfunction hasHitBlockLimit(blockNumber: bigint, direction: \"backward\" | \"forward\", blockLimit: bigint) {\n return direction === \"backward\" ? blockNumber < blockLimit : blockNumber > blockLimit;\n};\n\nfunction hasHitItemLimit(items: any[], itemLimit: number) {\n return items.length >= itemLimit;\n};\n\n/**\n * Fetch large amounts of data in batches by exploring with dynamic block ranges.\n * \n * Block ranges automatically adjust based on the provided configuration and how many items are found per batch. \n * If the actual block range returns too many items, the explorer will automatically reduce the range size for the next batch. \n * If the actual block range returns too few items, the explorer will automatically increase the range size for the next batch.\n * \n * This method is optimized to maximize efficiency by fetching items and minimizing the charge on the RPC node by \n * requesting too many items per batch or too many batches per second.\n * \n * Useful for methods like `eth_getLogs` or `trace_filter` that iterate over blocks to find items.\n * \n * @param params - The parameters for creating the explorer.\n */\nexport async function fetchByBlockRange(params: FetchBlockRangeParameters) {\n const options = {\n\n // By how much to increase/decrease the range size if the batch returns few/many items\n dividerOnHigh: 2,\n multiplierOnLow: 1.5,\n multiplierOnZero: 2,\n\n // How to determine if the batch returned few/many items\n highActivityThreshold: 50,\n lowActivityThreshold: 10,\n\n // Limits and init values for the range size\n initialRangeSize: 100,\n maxRangeSize: 100_000,\n minRangeSize: 1,\n\n // \n ...params.options,\n };\n\n let currentBlock = params.fromBlock;\n let rangeSize = options.initialRangeSize;\n let stopped = false;\n\n const stop = () => {\n stopped = true;\n };\n\n const totalItems: any[] = [];\n\n function shouldStop() {\n return hasHitBlockLimit(currentBlock, params.direction, params.toBlock) || hasHitItemLimit(totalItems, params.itemLimit);\n }\n\n while (!stopped && !shouldStop() ) {\n const blockRange = calcBlockRange(currentBlock, rangeSize, params.direction);\n\n // Cap the block range to the overall limits\n if (params.direction === \"forward\") {\n if (blockRange.toBlock > params.toBlock) {\n blockRange.toBlock = params.toBlock;\n }\n } else { // backward\n if (blockRange.fromBlock < params.toBlock) {\n blockRange.fromBlock = params.toBlock;\n }\n }\n\n const batchItems = await params.onBlockRange(blockRange, stop);\n\n totalItems.push(...batchItems);\n\n if (stopped) break;\n\n // Adjust range size based on activity\n if (batchItems.length > options.highActivityThreshold) {\n rangeSize /= options.dividerOnHigh;\n } else if (batchItems.length === 0) {\n rangeSize *= options.multiplierOnZero;\n } else if (batchItems.length <= options.lowActivityThreshold) {\n rangeSize *= options.multiplierOnLow;\n }\n\n // Cap and round the range size\n rangeSize = Math.round(\n Math.max(options.minRangeSize, Math.min(options.maxRangeSize, rangeSize))\n );\n\n // Determine the next block to start from, fixing the \"backward\" direction logic\n if (params.direction === \"backward\") {\n currentBlock = blockRange.fromBlock - 1n;\n } else {\n currentBlock = blockRange.toBlock + 1n;\n }\n }\n\n return totalItems.slice(0, params.itemLimit);\n}\n"],"names":[],"mappings":";;;AAEA;;;;;;;;;;;;;;;AAeG;AACI,eAAe,WAAW,CAAC,MAAkB,EAAE,MAA6B,EAAA;AAC/E,IAAA,IAAI,OAAO,MAAM,CAAC,WAAW,KAAK,QAAQ;QAAE,MAAM,CAAC,WAAW,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC;AACrF,IAAA,IAAI,OAAO,MAAM,CAAC,SAAS,KAAK,QAAQ;QAAE,MAAM,CAAC,SAAS,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC;AAE/E,IAAA,OAAO,MAAM,MAAM,CAAC,OAAO,CAIxB;AACC,QAAA,MAAM,EAAE,cAAc;QACtB,MAAM,EAAE,CAAC,MAAM,CAAC;AACnB,KAAA,CAAC;AACN;;AC5BA;;;;;;;;;;;;;;;AAeG;AACI,eAAe,gBAAgB,CAAC,MAAkB,EAAE,MAAkC,EAAA;AACzF,IAAA,OAAO,MAAM,MAAM,CAAC,OAAO,CAIxB;AACC,QAAA,MAAM,EAAE,mBAAmB;QAC3B,MAAM,EAAE,CAAC,MAAM,CAAC;AACnB,KAAA,CA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AO,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC,CAC5E;;AAGD,QAAA,IAAI,MAAM,CAAC,SAAS,KAAK,UAAU,EAAE;AACjC,YAAA,YAAY,GAAG,UAAU,CAAC,SAAS,GAAG,EAAE;QAC5C;aAAO;AACH,YAAA,YAAY,GAAG,UAAU,CAAC,OAAO,GAAG,EAAE;QAC1C;IACJ;IAEA,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,SAAS,CAAC;AAChD;;;;"}
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/actions/traceFilter.ts","../../src/actions/traceTransaction.ts","../../src/actions/traceActions.ts","../../src/actions/fetchByBlockRange.ts"],"sourcesContent":["import type { Client, Transport, Chain } from \"viem\";\nimport type { TraceFilterParameters, TraceFilterReturnType } from \"../types\";\n\n/**\n * Calls the 'trace_filter' RPC method to retrieve execution traces\n * filtered according to the specified criteria.\n *\n * This function sends a JSON-RPC request to the Ethereum node (or EVM-compatible)\n * via the provided client object and returns the array of trace entries matching\n * the filters.\n *\n * NOTE: This method relies on the non-standard 'trace_filter' method of the RPC.\n * It may not be supported by all nodes.\n *\n * @param client The client instance used to perform the RPC call.\n * @param params The filtering parameters for the trace request (block range, addresses, etc.).\n * @returns A promise that returns an array of trace entries (GenericTraceEntry[])\n * that match the filtering criteria.\n */\nexport async function traceFilter<TChain extends Chain | undefined>(\n client: Client<Transport, TChain>,\n params: TraceFilterParameters,\n): Promise<TraceFilterReturnType> {\n if (typeof params.fromAddress === \"string\")\n params.fromAddress = [params.fromAddress];\n if (typeof params.toAddress === \"string\")\n params.toAddress = [params.toAddress];\n\n return await client.request<{\n method: \"trace_filter\";\n Parameters: TraceFilterParameters[];\n ReturnType: TraceFilterReturnType;\n }>({\n method: \"trace_filter\",\n params: [params],\n });\n}\n","import type { Client, Transport, Chain } from \"viem\";\nimport type {\n TraceTransactionParameters,\n TraceTransactionReturnType,\n} from \"../types\";\n\n/**\n * Calls the 'trace_transaction' RPC method to retrieve execution traces\n * for a specific transaction hash.\n *\n * This function sends a JSON-RPC request to the Ethereum node (or EVM-compatible)\n * via the provided client object and returns the array of trace entries for\n * the specified transaction hash.\n *\n * NOTE: This method relies on the non-standard 'trace_transaction' method of the RPC.\n * It may not be supported by all nodes.\n *\n * @param client The client instance used to perform the RPC call.\n * @param params The transaction hash for which to retrieve traces.\n * @returns A promise that returns an array of trace entries (GenericTraceEntry[])\n * for the specified transaction hash.\n */\nexport async function traceTransaction<TChain extends Chain | undefined>(\n client: Client<Transport, TChain>,\n params: TraceTransactionParameters,\n): Promise<TraceTransactionReturnType> {\n return await client.request<{\n method: \"trace_transaction\";\n Parameters: TraceTransactionParameters[];\n ReturnType: TraceTransactionReturnType;\n }>({\n method: \"trace_transaction\",\n params: [params],\n });\n}\n","import type { Chain, Client, Transport } from \"viem\";\nimport type {\n TraceFilterParameters,\n TraceFilterReturnType,\n TraceTransactionParameters,\n TraceTransactionReturnType,\n} from \"../types\";\nimport { traceFilter } from \"./traceFilter\";\nimport { traceTransaction } from \"./traceTransaction\";\n\nexport type TraceActions = {\n traceFilter: (args: TraceFilterParameters) => Promise<TraceFilterReturnType>;\n traceTransaction: (\n args: TraceTransactionParameters,\n ) => Promise<TraceTransactionReturnType>;\n};\n\nexport function traceActions(): <TChain extends Chain | undefined>(\n client: Client<Transport, TChain>,\n) => TraceActions {\n return (client) => ({\n traceFilter: (args) => traceFilter(client, args),\n traceTransaction: (args) => traceTransaction(client, args),\n });\n}\n","import { FetchBlockRangeParameters } from \"../types/BlockRangeFetcher\";\n\nfunction calcBlockRange(fromBlock: bigint, rangeSize: number, direction: \"backward\" | \"forward\" = \"forward\") {\n if (direction === \"backward\") return { fromBlock: fromBlock - BigInt(rangeSize), toBlock: fromBlock };\n return { fromBlock: fromBlock, toBlock: fromBlock + BigInt(rangeSize) };\n};\n\nfunction hasHitBlockLimit(blockNumber: bigint, direction: \"backward\" | \"forward\", blockLimit: bigint) {\n return direction === \"backward\" ? blockNumber < blockLimit : blockNumber > blockLimit;\n};\n\nfunction hasHitItemLimit(items: any[], itemLimit: number) {\n return items.length >= itemLimit;\n};\n\n/**\n * Fetch large amounts of data in batches by exploring with dynamic block ranges.\n * \n * Block ranges automatically adjust based on the provided configuration and how many items are found per batch. \n * If the actual block range returns too many items, the explorer will automatically reduce the range size for the next batch. \n * If the actual block range returns too few items, the explorer will automatically increase the range size for the next batch.\n * \n * This method is optimized to maximize efficiency by fetching items and minimizing the charge on the RPC node by \n * requesting too many items per batch or too many batches per second.\n * \n * Useful for methods like `eth_getLogs` or `trace_filter` that iterate over blocks to find items.\n * \n * @param params - The parameters for creating the explorer.\n */\nexport async function fetchByBlockRange(params: FetchBlockRangeParameters) {\n const options = {\n\n // By how much to increase/decrease the range size if the batch returns few/many items\n dividerOnHigh: 2,\n multiplierOnLow: 1.5,\n multiplierOnZero: 2,\n\n // How to determine if the batch returned few/many items\n highActivityThreshold: 50,\n lowActivityThreshold: 10,\n\n // Limits and init values for the range size\n initialRangeSize: 100,\n maxRangeSize: 100_000,\n minRangeSize: 1,\n\n // \n ...params.options,\n };\n\n let currentBlock = params.fromBlock;\n let rangeSize = options.initialRangeSize;\n let stopped = false;\n\n const stop = () => {\n stopped = true;\n };\n\n const totalItems: any[] = [];\n\n function shouldStop() {\n return hasHitBlockLimit(currentBlock, params.direction, params.toBlock) || hasHitItemLimit(totalItems, params.itemLimit);\n }\n\n while (!stopped && !shouldStop() ) {\n const blockRange = calcBlockRange(currentBlock, rangeSize, params.direction);\n\n // Cap the block range to the overall limits\n if (params.direction === \"forward\") {\n if (blockRange.toBlock > params.toBlock) {\n blockRange.toBlock = params.toBlock;\n }\n } else { // backward\n if (blockRange.fromBlock < params.toBlock) {\n blockRange.fromBlock = params.toBlock;\n }\n }\n\n const batchItems = await params.onBlockRange(blockRange, stop);\n\n totalItems.push(...batchItems);\n\n if (stopped) break;\n\n // Adjust range size based on activity\n if (batchItems.length > options.highActivityThreshold) {\n rangeSize /= options.dividerOnHigh;\n } else if (batchItems.length === 0) {\n rangeSize *= options.multiplierOnZero;\n } else if (batchItems.length <= options.lowActivityThreshold) {\n rangeSize *= options.multiplierOnLow;\n }\n\n // Cap and round the range size\n rangeSize = Math.round(\n Math.max(options.minRangeSize, Math.min(options.maxRangeSize, rangeSize))\n );\n\n // Determine the next block to start from, fixing the \"backward\" direction logic\n if (params.direction === \"backward\") {\n currentBlock = blockRange.fromBlock - 1n;\n } else {\n currentBlock = blockRange.toBlock + 1n;\n }\n }\n\n return totalItems.slice(0, params.itemLimit);\n}\n"],"names":[],"mappings":";;;AAGA;;;;;;;;;;;;;;;AAeG;AACI,eAAe,WAAW,CAC/B,MAAiC,EACjC,MAA6B,EAAA;AAE7B,IAAA,IAAI,OAAO,MAAM,CAAC,WAAW,KAAK,QAAQ;QACxC,MAAM,CAAC,WAAW,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC;AAC3C,IAAA,IAAI,OAAO,MAAM,CAAC,SAAS,KAAK,QAAQ;QACtC,MAAM,CAAC,SAAS,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC;AAEvC,IAAA,OAAO,MAAM,MAAM,CAAC,OAAO,CAIxB;AACD,QAAA,MAAM,EAAE,cAAc;QACtB,MAAM,EAAE,CAAC,MAAM,CAAC;AACjB,KAAA,CAAC;AACJ;;AC9BA;;;;;;;;;;;;;;;AAeG;AACI,eAAe,gBAAgB,CACpC,MAAiC,EACjC,MAAkC,EAAA;AAElC,IAAA,OAAO,MAAM,MAAM,CAAC,OAAO,CAIxB;AACD,QAAA,MAAM,EAAE,mBAAmB;QAC3B,MAAM,EAAE,CAAC,MAAM,CAAC;AACjB,KAAA,CAAC;AACJ;;SCjBgB,YAAY,GAAA;AAG1B,IAAA,OAAO,CAAC,MAAM,MAAM;QAClB,WAAW,EAAE,CAAC,IAAI,KAAK,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC;QAChD,gBAAgB,EAAE,CAAC,IAAI,KAAK,gBAAgB,CAAC,MAAM,EAA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AAE,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC,CAC5E;;AAGD,QAAA,IAAI,MAAM,CAAC,SAAS,KAAK,UAAU,EAAE;AACjC,YAAA,YAAY,GAAG,UAAU,CAAC,SAAS,GAAG,EAAE;QAC5C;aAAO;AACH,YAAA,YAAY,GAAG,UAAU,CAAC,OAAO,GAAG,EAAE;QAC1C;IACJ;IAEA,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,SAAS,CAAC;AAChD;;;;"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Chain, Client, Transport } from "viem";
|
|
2
|
+
import type { TraceFilterParameters, TraceFilterReturnType, TraceTransactionParameters, TraceTransactionReturnType } from "../types";
|
|
3
|
+
export type TraceActions = {
|
|
4
|
+
traceFilter: (args: TraceFilterParameters) => Promise<TraceFilterReturnType>;
|
|
5
|
+
traceTransaction: (args: TraceTransactionParameters) => Promise<TraceTransactionReturnType>;
|
|
6
|
+
};
|
|
7
|
+
export declare function traceActions(): <TChain extends Chain | undefined>(client: Client<Transport, TChain>) => TraceActions;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Client, Transport, Chain } from "viem";
|
|
2
|
+
import type { TraceFilterParameters, TraceFilterReturnType } from "../types";
|
|
2
3
|
/**
|
|
3
4
|
* Calls the 'trace_filter' RPC method to retrieve execution traces
|
|
4
5
|
* filtered according to the specified criteria.
|
|
@@ -10,9 +11,9 @@ import type { TraceFilterParameters, TraceFilterReturnType, CoreClient } from ".
|
|
|
10
11
|
* NOTE: This method relies on the non-standard 'trace_filter' method of the RPC.
|
|
11
12
|
* It may not be supported by all nodes.
|
|
12
13
|
*
|
|
13
|
-
* @param client The
|
|
14
|
+
* @param client The client instance used to perform the RPC call.
|
|
14
15
|
* @param params The filtering parameters for the trace request (block range, addresses, etc.).
|
|
15
16
|
* @returns A promise that returns an array of trace entries (GenericTraceEntry[])
|
|
16
17
|
* that match the filtering criteria.
|
|
17
18
|
*/
|
|
18
|
-
export declare function traceFilter(client:
|
|
19
|
+
export declare function traceFilter<TChain extends Chain | undefined>(client: Client<Transport, TChain>, params: TraceFilterParameters): Promise<TraceFilterReturnType>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Client, Transport, Chain } from "viem";
|
|
2
|
+
import type { TraceTransactionParameters, TraceTransactionReturnType } from "../types";
|
|
2
3
|
/**
|
|
3
4
|
* Calls the 'trace_transaction' RPC method to retrieve execution traces
|
|
4
5
|
* for a specific transaction hash.
|
|
@@ -10,9 +11,9 @@ import type { TraceTransactionParameters, TraceTransactionReturnType, CoreClient
|
|
|
10
11
|
* NOTE: This method relies on the non-standard 'trace_transaction' method of the RPC.
|
|
11
12
|
* It may not be supported by all nodes.
|
|
12
13
|
*
|
|
13
|
-
* @param client The
|
|
14
|
+
* @param client The client instance used to perform the RPC call.
|
|
14
15
|
* @param params The transaction hash for which to retrieve traces.
|
|
15
16
|
* @returns A promise that returns an array of trace entries (GenericTraceEntry[])
|
|
16
17
|
* for the specified transaction hash.
|
|
17
18
|
*/
|
|
18
|
-
export declare function traceTransaction(client:
|
|
19
|
+
export declare function traceTransaction<TChain extends Chain | undefined>(client: Client<Transport, TChain>, params: TraceTransactionParameters): Promise<TraceTransactionReturnType>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { MentaAccountParams } from "../types";
|
|
2
|
+
import type { Client, Transport, Chain, JsonRpcAccount, LocalAccount } from "viem";
|
|
3
|
+
export declare function createMentaAccount<TChain extends Chain | undefined>(client: Client<Transport, TChain, JsonRpcAccount | LocalAccount | undefined>, params: MentaAccountParams): Promise<Client<Transport, undefined, object & {
|
|
4
|
+
client: Client<Transport, Chain | undefined, {
|
|
4
5
|
address: import("abitype").Address;
|
|
5
6
|
nonceManager?: import("viem").NonceManager | undefined;
|
|
6
7
|
sign?: ((parameters: {
|
|
@@ -17,7 +18,7 @@ export declare function createMentaAccount(coreClient: CoreClient, params: Menta
|
|
|
17
18
|
publicKey: import("viem").Hex;
|
|
18
19
|
source: string;
|
|
19
20
|
type: "local";
|
|
20
|
-
} |
|
|
21
|
+
} | JsonRpcAccount | undefined>;
|
|
21
22
|
entryPoint: {
|
|
22
23
|
abi: readonly [{
|
|
23
24
|
readonly inputs: readonly [{
|
|
@@ -1533,7 +1534,7 @@ export declare function createMentaAccount(coreClient: CoreClient, params: Menta
|
|
|
1533
1534
|
account?: import("viem/account-abstraction").SmartAccount | undefined;
|
|
1534
1535
|
} | undefined) => Promise<string>;
|
|
1535
1536
|
installModule: (args: import("permissionless/actions/erc7579").InstallModuleParameters<object & {
|
|
1536
|
-
client:
|
|
1537
|
+
client: Client<Transport, Chain | undefined, {
|
|
1537
1538
|
address: import("abitype").Address;
|
|
1538
1539
|
nonceManager?: import("viem").NonceManager | undefined;
|
|
1539
1540
|
sign?: ((parameters: {
|
|
@@ -1960,7 +1961,7 @@ export declare function createMentaAccount(coreClient: CoreClient, params: Menta
|
|
|
1960
1961
|
publicKey: import("viem").Hex;
|
|
1961
1962
|
source: string;
|
|
1962
1963
|
type: "local";
|
|
1963
|
-
} |
|
|
1964
|
+
} | JsonRpcAccount | undefined>;
|
|
1964
1965
|
entryPoint: {
|
|
1965
1966
|
abi: readonly [{
|
|
1966
1967
|
readonly inputs: readonly [{
|
|
@@ -3883,7 +3884,7 @@ export declare function createMentaAccount(coreClient: CoreClient, params: Menta
|
|
|
3883
3884
|
type: "smart";
|
|
3884
3885
|
}>) => Promise<import("viem").Hash>;
|
|
3885
3886
|
installModules: (args: import("node_modules/permissionless/_types/actions/erc7579/installModules").InstallModulesParameters<object & {
|
|
3886
|
-
client:
|
|
3887
|
+
client: Client<Transport, Chain | undefined, {
|
|
3887
3888
|
address: import("abitype").Address;
|
|
3888
3889
|
nonceManager?: import("viem").NonceManager | undefined;
|
|
3889
3890
|
sign?: ((parameters: {
|
|
@@ -4310,7 +4311,7 @@ export declare function createMentaAccount(coreClient: CoreClient, params: Menta
|
|
|
4310
4311
|
publicKey: import("viem").Hex;
|
|
4311
4312
|
source: string;
|
|
4312
4313
|
type: "local";
|
|
4313
|
-
} |
|
|
4314
|
+
} | JsonRpcAccount | undefined>;
|
|
4314
4315
|
entryPoint: {
|
|
4315
4316
|
abi: readonly [{
|
|
4316
4317
|
readonly inputs: readonly [{
|
|
@@ -6233,7 +6234,7 @@ export declare function createMentaAccount(coreClient: CoreClient, params: Menta
|
|
|
6233
6234
|
type: "smart";
|
|
6234
6235
|
}>) => Promise<import("viem").Hash>;
|
|
6235
6236
|
isModuleInstalled: (args: import("permissionless/actions/erc7579").IsModuleInstalledParameters<object & {
|
|
6236
|
-
client:
|
|
6237
|
+
client: Client<Transport, Chain | undefined, {
|
|
6237
6238
|
address: import("abitype").Address;
|
|
6238
6239
|
nonceManager?: import("viem").NonceManager | undefined;
|
|
6239
6240
|
sign?: ((parameters: {
|
|
@@ -6660,7 +6661,7 @@ export declare function createMentaAccount(coreClient: CoreClient, params: Menta
|
|
|
6660
6661
|
publicKey: import("viem").Hex;
|
|
6661
6662
|
source: string;
|
|
6662
6663
|
type: "local";
|
|
6663
|
-
} |
|
|
6664
|
+
} | JsonRpcAccount | undefined>;
|
|
6664
6665
|
entryPoint: {
|
|
6665
6666
|
abi: readonly [{
|
|
6666
6667
|
readonly inputs: readonly [{
|
|
@@ -8583,7 +8584,7 @@ export declare function createMentaAccount(coreClient: CoreClient, params: Menta
|
|
|
8583
8584
|
type: "smart";
|
|
8584
8585
|
}>) => Promise<boolean>;
|
|
8585
8586
|
supportsExecutionMode: (args: import("permissionless/actions/erc7579").SupportsExecutionModeParameters<object & {
|
|
8586
|
-
client:
|
|
8587
|
+
client: Client<Transport, Chain | undefined, {
|
|
8587
8588
|
address: import("abitype").Address;
|
|
8588
8589
|
nonceManager?: import("viem").NonceManager | undefined;
|
|
8589
8590
|
sign?: ((parameters: {
|
|
@@ -9010,7 +9011,7 @@ export declare function createMentaAccount(coreClient: CoreClient, params: Menta
|
|
|
9010
9011
|
publicKey: import("viem").Hex;
|
|
9011
9012
|
source: string;
|
|
9012
9013
|
type: "local";
|
|
9013
|
-
} |
|
|
9014
|
+
} | JsonRpcAccount | undefined>;
|
|
9014
9015
|
entryPoint: {
|
|
9015
9016
|
abi: readonly [{
|
|
9016
9017
|
readonly inputs: readonly [{
|
|
@@ -10933,7 +10934,7 @@ export declare function createMentaAccount(coreClient: CoreClient, params: Menta
|
|
|
10933
10934
|
type: "smart";
|
|
10934
10935
|
}>) => Promise<boolean>;
|
|
10935
10936
|
supportsModule: (args: import("permissionless/actions/erc7579").SupportsModuleParameters<object & {
|
|
10936
|
-
client:
|
|
10937
|
+
client: Client<Transport, Chain | undefined, {
|
|
10937
10938
|
address: import("abitype").Address;
|
|
10938
10939
|
nonceManager?: import("viem").NonceManager | undefined;
|
|
10939
10940
|
sign?: ((parameters: {
|
|
@@ -11360,7 +11361,7 @@ export declare function createMentaAccount(coreClient: CoreClient, params: Menta
|
|
|
11360
11361
|
publicKey: import("viem").Hex;
|
|
11361
11362
|
source: string;
|
|
11362
11363
|
type: "local";
|
|
11363
|
-
} |
|
|
11364
|
+
} | JsonRpcAccount | undefined>;
|
|
11364
11365
|
entryPoint: {
|
|
11365
11366
|
abi: readonly [{
|
|
11366
11367
|
readonly inputs: readonly [{
|
|
@@ -13283,7 +13284,7 @@ export declare function createMentaAccount(coreClient: CoreClient, params: Menta
|
|
|
13283
13284
|
type: "smart";
|
|
13284
13285
|
}>) => Promise<boolean>;
|
|
13285
13286
|
uninstallModule: (args: import("permissionless/actions/erc7579").UninstallModuleParameters<object & {
|
|
13286
|
-
client:
|
|
13287
|
+
client: Client<Transport, Chain | undefined, {
|
|
13287
13288
|
address: import("abitype").Address;
|
|
13288
13289
|
nonceManager?: import("viem").NonceManager | undefined;
|
|
13289
13290
|
sign?: ((parameters: {
|
|
@@ -13710,7 +13711,7 @@ export declare function createMentaAccount(coreClient: CoreClient, params: Menta
|
|
|
13710
13711
|
publicKey: import("viem").Hex;
|
|
13711
13712
|
source: string;
|
|
13712
13713
|
type: "local";
|
|
13713
|
-
} |
|
|
13714
|
+
} | JsonRpcAccount | undefined>;
|
|
13714
13715
|
entryPoint: {
|
|
13715
13716
|
abi: readonly [{
|
|
13716
13717
|
readonly inputs: readonly [{
|
|
@@ -15633,7 +15634,7 @@ export declare function createMentaAccount(coreClient: CoreClient, params: Menta
|
|
|
15633
15634
|
type: "smart";
|
|
15634
15635
|
}>) => Promise<import("viem").Hash>;
|
|
15635
15636
|
uninstallModules: (args: import("node_modules/permissionless/_types/actions/erc7579/uninstallModules").UninstallModulesParameters<object & {
|
|
15636
|
-
client:
|
|
15637
|
+
client: Client<Transport, Chain | undefined, {
|
|
15637
15638
|
address: import("abitype").Address;
|
|
15638
15639
|
nonceManager?: import("viem").NonceManager | undefined;
|
|
15639
15640
|
sign?: ((parameters: {
|
|
@@ -16060,7 +16061,7 @@ export declare function createMentaAccount(coreClient: CoreClient, params: Menta
|
|
|
16060
16061
|
publicKey: import("viem").Hex;
|
|
16061
16062
|
source: string;
|
|
16062
16063
|
type: "local";
|
|
16063
|
-
} |
|
|
16064
|
+
} | JsonRpcAccount | undefined>;
|
|
16064
16065
|
entryPoint: {
|
|
16065
16066
|
abi: readonly [{
|
|
16066
16067
|
readonly inputs: readonly [{
|
|
@@ -17983,7 +17984,7 @@ export declare function createMentaAccount(coreClient: CoreClient, params: Menta
|
|
|
17983
17984
|
type: "smart";
|
|
17984
17985
|
}>) => Promise<import("viem").Hash>;
|
|
17985
17986
|
} & import("viem/account-abstraction").BundlerActions<object & {
|
|
17986
|
-
client:
|
|
17987
|
+
client: Client<Transport, Chain | undefined, {
|
|
17987
17988
|
address: import("abitype").Address;
|
|
17988
17989
|
nonceManager?: import("viem").NonceManager | undefined;
|
|
17989
17990
|
sign?: ((parameters: {
|
|
@@ -18000,7 +18001,7 @@ export declare function createMentaAccount(coreClient: CoreClient, params: Menta
|
|
|
18000
18001
|
publicKey: import("viem").Hex;
|
|
18001
18002
|
source: string;
|
|
18002
18003
|
type: "local";
|
|
18003
|
-
} |
|
|
18004
|
+
} | JsonRpcAccount | undefined>;
|
|
18004
18005
|
entryPoint: {
|
|
18005
18006
|
abi: readonly [{
|
|
18006
18007
|
readonly inputs: readonly [{
|
|
@@ -19512,7 +19513,7 @@ export declare function createMentaAccount(coreClient: CoreClient, params: Menta
|
|
|
19512
19513
|
isDeployed: () => Promise<boolean>;
|
|
19513
19514
|
type: "smart";
|
|
19514
19515
|
}> & import("permissionless").SmartAccountActions<undefined, object & {
|
|
19515
|
-
client:
|
|
19516
|
+
client: Client<Transport, Chain | undefined, {
|
|
19516
19517
|
address: import("abitype").Address;
|
|
19517
19518
|
nonceManager?: import("viem").NonceManager | undefined;
|
|
19518
19519
|
sign?: ((parameters: {
|
|
@@ -19529,7 +19530,7 @@ export declare function createMentaAccount(coreClient: CoreClient, params: Menta
|
|
|
19529
19530
|
publicKey: import("viem").Hex;
|
|
19530
19531
|
source: string;
|
|
19531
19532
|
type: "local";
|
|
19532
|
-
} |
|
|
19533
|
+
} | JsonRpcAccount | undefined>;
|
|
19533
19534
|
entryPoint: {
|
|
19534
19535
|
abi: readonly [{
|
|
19535
19536
|
readonly inputs: readonly [{
|
package/dist/clients/index.js
CHANGED
|
@@ -5939,8 +5939,8 @@ const getValidatorAddress = (entryPoint, kernelVersion, validatorContractVersion
|
|
|
5939
5939
|
return validatorAddress ?? passKeyValidatorAddress ?? viem.zeroAddress;
|
|
5940
5940
|
};
|
|
5941
5941
|
|
|
5942
|
-
async function createMentaAccount(
|
|
5943
|
-
const validator = await toPasskeyValidator(
|
|
5942
|
+
async function createMentaAccount(client, params) {
|
|
5943
|
+
const validator = await toPasskeyValidator(client, {
|
|
5944
5944
|
webAuthnKey: params.signer,
|
|
5945
5945
|
entryPoint: {
|
|
5946
5946
|
address: accountAbstraction.entryPoint07Address,
|
|
@@ -5951,7 +5951,7 @@ async function createMentaAccount(coreClient, params) {
|
|
|
5951
5951
|
});
|
|
5952
5952
|
const kernel = await accounts$1.toKernelSmartAccount({
|
|
5953
5953
|
owners: [validator],
|
|
5954
|
-
client:
|
|
5954
|
+
client: client,
|
|
5955
5955
|
});
|
|
5956
5956
|
return permissionless.createSmartAccountClient({
|
|
5957
5957
|
account: kernel,
|