thirdweb 5.29.2-nightly-7768067bf4f571a8c8ee6b646a58e2fc5f6bd052-20240614163812 → 5.29.2-nightly-eff710738ce3d4341257e5912311c95b28a34b5d-20240614173600
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/exports/extensions/erc4337.js +7 -1
- package/dist/cjs/exports/extensions/erc4337.js.map +1 -1
- package/dist/cjs/extensions/erc4337/__generated__/IAccountFactory/read/getAccounts.js +122 -0
- package/dist/cjs/extensions/erc4337/__generated__/IAccountFactory/read/getAccounts.js.map +1 -0
- package/dist/cjs/extensions/erc4337/__generated__/IAccountFactory/read/isRegistered.js +115 -0
- package/dist/cjs/extensions/erc4337/__generated__/IAccountFactory/read/isRegistered.js.map +1 -0
- package/dist/cjs/extensions/erc4337/__generated__/IAccountFactory/read/totalAccounts.js +71 -0
- package/dist/cjs/extensions/erc4337/__generated__/IAccountFactory/read/totalAccounts.js.map +1 -0
- package/dist/cjs/version.js +1 -1
- package/dist/esm/exports/extensions/erc4337.js +3 -0
- package/dist/esm/exports/extensions/erc4337.js.map +1 -1
- package/dist/esm/extensions/erc4337/__generated__/IAccountFactory/read/getAccounts.js +114 -0
- package/dist/esm/extensions/erc4337/__generated__/IAccountFactory/read/getAccounts.js.map +1 -0
- package/dist/esm/extensions/erc4337/__generated__/IAccountFactory/read/isRegistered.js +107 -0
- package/dist/esm/extensions/erc4337/__generated__/IAccountFactory/read/isRegistered.js.map +1 -0
- package/dist/esm/extensions/erc4337/__generated__/IAccountFactory/read/totalAccounts.js +65 -0
- package/dist/esm/extensions/erc4337/__generated__/IAccountFactory/read/totalAccounts.js.map +1 -0
- package/dist/esm/version.js +1 -1
- package/dist/types/exports/extensions/erc4337.d.ts +3 -0
- package/dist/types/exports/extensions/erc4337.d.ts.map +1 -1
- package/dist/types/extensions/erc4337/__generated__/IAccountFactory/read/getAccounts.d.ts +92 -0
- package/dist/types/extensions/erc4337/__generated__/IAccountFactory/read/getAccounts.d.ts.map +1 -0
- package/dist/types/extensions/erc4337/__generated__/IAccountFactory/read/isRegistered.d.ts +85 -0
- package/dist/types/extensions/erc4337/__generated__/IAccountFactory/read/isRegistered.d.ts.map +1 -0
- package/dist/types/extensions/erc4337/__generated__/IAccountFactory/read/totalAccounts.d.ts +46 -0
- package/dist/types/extensions/erc4337/__generated__/IAccountFactory/read/totalAccounts.d.ts.map +1 -0
- package/dist/types/version.d.ts +1 -1
- package/package.json +2 -2
- package/src/exports/extensions/erc4337.ts +3 -0
- package/src/extensions/erc4337/__generated__/IAccountFactory/read/getAccounts.ts +135 -0
- package/src/extensions/erc4337/__generated__/IAccountFactory/read/isRegistered.ts +127 -0
- package/src/extensions/erc4337/__generated__/IAccountFactory/read/totalAccounts.ts +74 -0
- package/src/version.ts +1 -1
@@ -0,0 +1,65 @@
|
|
1
|
+
import { readContract } from "../../../../../transaction/read-contract.js";
|
2
|
+
import { decodeAbiParameters } from "viem";
|
3
|
+
import { detectMethod } from "../../../../../utils/bytecode/detectExtension.js";
|
4
|
+
export const FN_SELECTOR = "0x58451f97";
|
5
|
+
const FN_INPUTS = [];
|
6
|
+
const FN_OUTPUTS = [
|
7
|
+
{
|
8
|
+
type: "uint256",
|
9
|
+
},
|
10
|
+
];
|
11
|
+
/**
|
12
|
+
* Checks if the `totalAccounts` method is supported by the given contract.
|
13
|
+
* @param contract The ThirdwebContract.
|
14
|
+
* @returns A promise that resolves to a boolean indicating if the `totalAccounts` method is supported.
|
15
|
+
* @extension ERC4337
|
16
|
+
* @example
|
17
|
+
* ```ts
|
18
|
+
* import { isTotalAccountsSupported } from "thirdweb/extensions/erc4337";
|
19
|
+
*
|
20
|
+
* const supported = await isTotalAccountsSupported(contract);
|
21
|
+
* ```
|
22
|
+
*/
|
23
|
+
export async function isTotalAccountsSupported(contract) {
|
24
|
+
return detectMethod({
|
25
|
+
contract,
|
26
|
+
method: [FN_SELECTOR, FN_INPUTS, FN_OUTPUTS],
|
27
|
+
});
|
28
|
+
}
|
29
|
+
/**
|
30
|
+
* Decodes the result of the totalAccounts function call.
|
31
|
+
* @param result - The hexadecimal result to decode.
|
32
|
+
* @returns The decoded result as per the FN_OUTPUTS definition.
|
33
|
+
* @extension ERC4337
|
34
|
+
* @example
|
35
|
+
* ```ts
|
36
|
+
* import { decodeTotalAccountsResult } from "thirdweb/extensions/erc4337";
|
37
|
+
* const result = decodeTotalAccountsResult("...");
|
38
|
+
* ```
|
39
|
+
*/
|
40
|
+
export function decodeTotalAccountsResult(result) {
|
41
|
+
return decodeAbiParameters(FN_OUTPUTS, result)[0];
|
42
|
+
}
|
43
|
+
/**
|
44
|
+
* Calls the "totalAccounts" function on the contract.
|
45
|
+
* @param options - The options for the totalAccounts function.
|
46
|
+
* @returns The parsed result of the function call.
|
47
|
+
* @extension ERC4337
|
48
|
+
* @example
|
49
|
+
* ```ts
|
50
|
+
* import { totalAccounts } from "thirdweb/extensions/erc4337";
|
51
|
+
*
|
52
|
+
* const result = await totalAccounts({
|
53
|
+
* contract,
|
54
|
+
* });
|
55
|
+
*
|
56
|
+
* ```
|
57
|
+
*/
|
58
|
+
export async function totalAccounts(options) {
|
59
|
+
return readContract({
|
60
|
+
contract: options.contract,
|
61
|
+
method: [FN_SELECTOR, FN_INPUTS, FN_OUTPUTS],
|
62
|
+
params: [],
|
63
|
+
});
|
64
|
+
}
|
65
|
+
//# sourceMappingURL=totalAccounts.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"totalAccounts.js","sourceRoot":"","sources":["../../../../../../../src/extensions/erc4337/__generated__/IAccountFactory/read/totalAccounts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,6CAA6C,CAAC;AAG3E,OAAO,EAAE,mBAAmB,EAAE,MAAM,MAAM,CAAC;AAG3C,OAAO,EAAE,YAAY,EAAE,MAAM,kDAAkD,CAAC;AAEhF,MAAM,CAAC,MAAM,WAAW,GAAG,YAAqB,CAAC;AACjD,MAAM,SAAS,GAAG,EAAW,CAAC;AAC9B,MAAM,UAAU,GAAG;IACjB;QACE,IAAI,EAAE,SAAS;KAChB;CACO,CAAC;AAEX;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC5C,QAA+B;IAE/B,OAAO,YAAY,CAAC;QAClB,QAAQ;QACR,MAAM,EAAE,CAAC,WAAW,EAAE,SAAS,EAAE,UAAU,CAAU;KACtD,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,yBAAyB,CAAC,MAAW;IACnD,OAAO,mBAAmB,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AACpD,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,OAA+B;IACjE,OAAO,YAAY,CAAC;QAClB,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,MAAM,EAAE,CAAC,WAAW,EAAE,SAAS,EAAE,UAAU,CAAU;QACrD,MAAM,EAAE,EAAE;KACX,CAAC,CAAC;AACL,CAAC"}
|
package/dist/esm/version.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
export const version = "5.29.2-nightly-
|
1
|
+
export const version = "5.29.2-nightly-eff710738ce3d4341257e5912311c95b28a34b5d-20240614173600";
|
2
2
|
//# sourceMappingURL=version.js.map
|
@@ -11,6 +11,9 @@ export { isAdmin } from "../../extensions/erc4337/__generated__/IAccountPermissi
|
|
11
11
|
export { adminUpdatedEvent } from "../../extensions/erc4337/__generated__/IAccountPermissions/events/AdminUpdated.js";
|
12
12
|
export { signerPermissionsUpdatedEvent } from "../../extensions/erc4337/__generated__/IAccountPermissions/events/SignerPermissionsUpdated.js";
|
13
13
|
export { getAllAccounts } from "../../extensions/erc4337/__generated__/IAccountFactory/read/getAllAccounts.js";
|
14
|
+
export { getAccounts } from "../../extensions/erc4337/__generated__/IAccountFactory/read/getAccounts.js";
|
15
|
+
export { totalAccounts } from "../../extensions/erc4337/__generated__/IAccountFactory/read/totalAccounts.js";
|
16
|
+
export { isRegistered } from "../../extensions/erc4337/__generated__/IAccountFactory/read/isRegistered.js";
|
14
17
|
export { getAccountsOfSigner, type GetAccountsOfSignerParams, } from "../../extensions/erc4337/__generated__/IAccountFactory/read/getAccountsOfSigner.js";
|
15
18
|
export { getAddress as predictAccountAddress, type GetAddressParams as PredictAccountAddressParams, } from "../../extensions/erc4337/__generated__/IAccountFactory/read/getAddress.js";
|
16
19
|
export { accountDeployedEvent } from "../../extensions/erc4337/__generated__/IEntryPoint/events/AccountDeployed.js";
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"erc4337.d.ts","sourceRoot":"","sources":["../../../../src/exports/extensions/erc4337.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,eAAe,EACpB,QAAQ,GACT,MAAM,8CAA8C,CAAC;AAEtD,OAAO,EACL,KAAK,kBAAkB,EACvB,WAAW,GACZ,MAAM,iDAAiD,CAAC;AAEzD,OAAO,EACL,KAAK,oBAAoB,EACzB,aAAa,GACd,MAAM,mDAAmD,CAAC;AAE3D,OAAO,EACL,KAAK,uBAAuB,EAC5B,gBAAgB,GACjB,MAAM,sDAAsD,CAAC;AAE9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,wFAAwF,CAAC;AAC7H,OAAO,EAAE,YAAY,EAAE,MAAM,iFAAiF,CAAC;AAC/G,OAAO,EAAE,aAAa,EAAE,MAAM,kFAAkF,CAAC;AACjH,OAAO,EACL,uBAAuB,EACvB,KAAK,6BAA6B,GACnC,MAAM,4FAA4F,CAAC;AACpG,OAAO,EACL,cAAc,EACd,KAAK,oBAAoB,GAC1B,MAAM,mFAAmF,CAAC;AAC3F,OAAO,EAAE,OAAO,EAAE,MAAM,4EAA4E,CAAC;AACrG,OAAO,EAAE,iBAAiB,EAAE,MAAM,mFAAmF,CAAC;AACtH,OAAO,EAAE,6BAA6B,EAAE,MAAM,+FAA+F,CAAC;AAG9I,OAAO,EAAE,cAAc,EAAE,MAAM,+EAA+E,CAAC;AAC/G,OAAO,EACL,mBAAmB,EACnB,KAAK,yBAAyB,GAC/B,MAAM,oFAAoF,CAAC;AAC5F,OAAO,EACL,UAAU,IAAI,qBAAqB,EACnC,KAAK,gBAAgB,IAAI,2BAA2B,GACrD,MAAM,2EAA2E,CAAC;AAInF,OAAO,EAAE,oBAAoB,EAAE,MAAM,8EAA8E,CAAC;AACpH,OAAO,EAAE,uBAAuB,EAAE,MAAM,iFAAiF,CAAC;AAC1H,OAAO,EAAE,8BAA8B,EAAE,MAAM,wFAAwF,CAAC;AACxI,OAAO,EACL,aAAa,EACb,KAAK,mBAAmB,GACzB,MAAM,0EAA0E,CAAC;AAClF,OAAO,EACL,gBAAgB,EAChB,KAAK,sBAAsB,GAC5B,MAAM,8EAA8E,CAAC"}
|
1
|
+
{"version":3,"file":"erc4337.d.ts","sourceRoot":"","sources":["../../../../src/exports/extensions/erc4337.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,eAAe,EACpB,QAAQ,GACT,MAAM,8CAA8C,CAAC;AAEtD,OAAO,EACL,KAAK,kBAAkB,EACvB,WAAW,GACZ,MAAM,iDAAiD,CAAC;AAEzD,OAAO,EACL,KAAK,oBAAoB,EACzB,aAAa,GACd,MAAM,mDAAmD,CAAC;AAE3D,OAAO,EACL,KAAK,uBAAuB,EAC5B,gBAAgB,GACjB,MAAM,sDAAsD,CAAC;AAE9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,wFAAwF,CAAC;AAC7H,OAAO,EAAE,YAAY,EAAE,MAAM,iFAAiF,CAAC;AAC/G,OAAO,EAAE,aAAa,EAAE,MAAM,kFAAkF,CAAC;AACjH,OAAO,EACL,uBAAuB,EACvB,KAAK,6BAA6B,GACnC,MAAM,4FAA4F,CAAC;AACpG,OAAO,EACL,cAAc,EACd,KAAK,oBAAoB,GAC1B,MAAM,mFAAmF,CAAC;AAC3F,OAAO,EAAE,OAAO,EAAE,MAAM,4EAA4E,CAAC;AACrG,OAAO,EAAE,iBAAiB,EAAE,MAAM,mFAAmF,CAAC;AACtH,OAAO,EAAE,6BAA6B,EAAE,MAAM,+FAA+F,CAAC;AAG9I,OAAO,EAAE,cAAc,EAAE,MAAM,+EAA+E,CAAC;AAC/G,OAAO,EAAE,WAAW,EAAE,MAAM,4EAA4E,CAAC;AACzG,OAAO,EAAE,aAAa,EAAE,MAAM,8EAA8E,CAAC;AAC7G,OAAO,EAAE,YAAY,EAAE,MAAM,6EAA6E,CAAC;AAC3G,OAAO,EACL,mBAAmB,EACnB,KAAK,yBAAyB,GAC/B,MAAM,oFAAoF,CAAC;AAC5F,OAAO,EACL,UAAU,IAAI,qBAAqB,EACnC,KAAK,gBAAgB,IAAI,2BAA2B,GACrD,MAAM,2EAA2E,CAAC;AAInF,OAAO,EAAE,oBAAoB,EAAE,MAAM,8EAA8E,CAAC;AACpH,OAAO,EAAE,uBAAuB,EAAE,MAAM,iFAAiF,CAAC;AAC1H,OAAO,EAAE,8BAA8B,EAAE,MAAM,wFAAwF,CAAC;AACxI,OAAO,EACL,aAAa,EACb,KAAK,mBAAmB,GACzB,MAAM,0EAA0E,CAAC;AAClF,OAAO,EACL,gBAAgB,EAChB,KAAK,sBAAsB,GAC5B,MAAM,8EAA8E,CAAC"}
|
@@ -0,0 +1,92 @@
|
|
1
|
+
import type { AbiParameterToPrimitiveType } from "abitype";
|
2
|
+
import type { BaseTransactionOptions } from "../../../../../transaction/types.js";
|
3
|
+
import type { Hex } from "../../../../../utils/encoding/hex.js";
|
4
|
+
import type { ThirdwebContract } from "../../../../../contract/contract.js";
|
5
|
+
/**
|
6
|
+
* Represents the parameters for the "getAccounts" function.
|
7
|
+
*/
|
8
|
+
export type GetAccountsParams = {
|
9
|
+
start: AbiParameterToPrimitiveType<{
|
10
|
+
type: "uint256";
|
11
|
+
name: "start";
|
12
|
+
}>;
|
13
|
+
end: AbiParameterToPrimitiveType<{
|
14
|
+
type: "uint256";
|
15
|
+
name: "end";
|
16
|
+
}>;
|
17
|
+
};
|
18
|
+
export declare const FN_SELECTOR: "0xe68a7c3b";
|
19
|
+
/**
|
20
|
+
* Checks if the `getAccounts` method is supported by the given contract.
|
21
|
+
* @param contract The ThirdwebContract.
|
22
|
+
* @returns A promise that resolves to a boolean indicating if the `getAccounts` method is supported.
|
23
|
+
* @extension ERC4337
|
24
|
+
* @example
|
25
|
+
* ```ts
|
26
|
+
* import { isGetAccountsSupported } from "thirdweb/extensions/erc4337";
|
27
|
+
*
|
28
|
+
* const supported = await isGetAccountsSupported(contract);
|
29
|
+
* ```
|
30
|
+
*/
|
31
|
+
export declare function isGetAccountsSupported(contract: ThirdwebContract<any>): Promise<boolean>;
|
32
|
+
/**
|
33
|
+
* Encodes the parameters for the "getAccounts" function.
|
34
|
+
* @param options - The options for the getAccounts function.
|
35
|
+
* @returns The encoded ABI parameters.
|
36
|
+
* @extension ERC4337
|
37
|
+
* @example
|
38
|
+
* ```ts
|
39
|
+
* import { encodeGetAccountsParams } "thirdweb/extensions/erc4337";
|
40
|
+
* const result = encodeGetAccountsParams({
|
41
|
+
* start: ...,
|
42
|
+
* end: ...,
|
43
|
+
* });
|
44
|
+
* ```
|
45
|
+
*/
|
46
|
+
export declare function encodeGetAccountsParams(options: GetAccountsParams): `0x${string}`;
|
47
|
+
/**
|
48
|
+
* Encodes the "getAccounts" function into a Hex string with its parameters.
|
49
|
+
* @param options - The options for the getAccounts function.
|
50
|
+
* @returns The encoded hexadecimal string.
|
51
|
+
* @extension ERC4337
|
52
|
+
* @example
|
53
|
+
* ```ts
|
54
|
+
* import { encodeGetAccounts } "thirdweb/extensions/erc4337";
|
55
|
+
* const result = encodeGetAccounts({
|
56
|
+
* start: ...,
|
57
|
+
* end: ...,
|
58
|
+
* });
|
59
|
+
* ```
|
60
|
+
*/
|
61
|
+
export declare function encodeGetAccounts(options: GetAccountsParams): `0xe68a7c3b${string}`;
|
62
|
+
/**
|
63
|
+
* Decodes the result of the getAccounts function call.
|
64
|
+
* @param result - The hexadecimal result to decode.
|
65
|
+
* @returns The decoded result as per the FN_OUTPUTS definition.
|
66
|
+
* @extension ERC4337
|
67
|
+
* @example
|
68
|
+
* ```ts
|
69
|
+
* import { decodeGetAccountsResult } from "thirdweb/extensions/erc4337";
|
70
|
+
* const result = decodeGetAccountsResult("...");
|
71
|
+
* ```
|
72
|
+
*/
|
73
|
+
export declare function decodeGetAccountsResult(result: Hex): readonly string[];
|
74
|
+
/**
|
75
|
+
* Calls the "getAccounts" function on the contract.
|
76
|
+
* @param options - The options for the getAccounts function.
|
77
|
+
* @returns The parsed result of the function call.
|
78
|
+
* @extension ERC4337
|
79
|
+
* @example
|
80
|
+
* ```ts
|
81
|
+
* import { getAccounts } from "thirdweb/extensions/erc4337";
|
82
|
+
*
|
83
|
+
* const result = await getAccounts({
|
84
|
+
* contract,
|
85
|
+
* start: ...,
|
86
|
+
* end: ...,
|
87
|
+
* });
|
88
|
+
*
|
89
|
+
* ```
|
90
|
+
*/
|
91
|
+
export declare function getAccounts(options: BaseTransactionOptions<GetAccountsParams>): Promise<readonly string[]>;
|
92
|
+
//# sourceMappingURL=getAccounts.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"getAccounts.d.ts","sourceRoot":"","sources":["../../../../../../../src/extensions/erc4337/__generated__/IAccountFactory/read/getAccounts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAC;AAE3D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAGlF,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,sCAAsC,CAAC;AAChE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AAG5E;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,KAAK,EAAE,2BAA2B,CAAC;QAAE,IAAI,EAAE,SAAS,CAAC;QAAC,IAAI,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IACvE,GAAG,EAAE,2BAA2B,CAAC;QAAE,IAAI,EAAE,SAAS,CAAC;QAAC,IAAI,EAAE,KAAK,CAAA;KAAE,CAAC,CAAC;CACpE,CAAC;AAEF,eAAO,MAAM,WAAW,cAAwB,CAAC;AAiBjD;;;;;;;;;;;GAWG;AACH,wBAAsB,sBAAsB,CAAC,QAAQ,EAAE,gBAAgB,CAAC,GAAG,CAAC,oBAK3E;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,iBAAiB,iBAEjE;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,iBAAiB,yBAO3D;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,GAAG,qBAElD;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,WAAW,CAC/B,OAAO,EAAE,sBAAsB,CAAC,iBAAiB,CAAC,8BAOnD"}
|
@@ -0,0 +1,85 @@
|
|
1
|
+
import type { AbiParameterToPrimitiveType } from "abitype";
|
2
|
+
import type { BaseTransactionOptions } from "../../../../../transaction/types.js";
|
3
|
+
import type { Hex } from "../../../../../utils/encoding/hex.js";
|
4
|
+
import type { ThirdwebContract } from "../../../../../contract/contract.js";
|
5
|
+
/**
|
6
|
+
* Represents the parameters for the "isRegistered" function.
|
7
|
+
*/
|
8
|
+
export type IsRegisteredParams = {
|
9
|
+
account: AbiParameterToPrimitiveType<{
|
10
|
+
type: "address";
|
11
|
+
name: "account";
|
12
|
+
}>;
|
13
|
+
};
|
14
|
+
export declare const FN_SELECTOR: "0xc3c5a547";
|
15
|
+
/**
|
16
|
+
* Checks if the `isRegistered` method is supported by the given contract.
|
17
|
+
* @param contract The ThirdwebContract.
|
18
|
+
* @returns A promise that resolves to a boolean indicating if the `isRegistered` method is supported.
|
19
|
+
* @extension ERC4337
|
20
|
+
* @example
|
21
|
+
* ```ts
|
22
|
+
* import { isIsRegisteredSupported } from "thirdweb/extensions/erc4337";
|
23
|
+
*
|
24
|
+
* const supported = await isIsRegisteredSupported(contract);
|
25
|
+
* ```
|
26
|
+
*/
|
27
|
+
export declare function isIsRegisteredSupported(contract: ThirdwebContract<any>): Promise<boolean>;
|
28
|
+
/**
|
29
|
+
* Encodes the parameters for the "isRegistered" function.
|
30
|
+
* @param options - The options for the isRegistered function.
|
31
|
+
* @returns The encoded ABI parameters.
|
32
|
+
* @extension ERC4337
|
33
|
+
* @example
|
34
|
+
* ```ts
|
35
|
+
* import { encodeIsRegisteredParams } "thirdweb/extensions/erc4337";
|
36
|
+
* const result = encodeIsRegisteredParams({
|
37
|
+
* account: ...,
|
38
|
+
* });
|
39
|
+
* ```
|
40
|
+
*/
|
41
|
+
export declare function encodeIsRegisteredParams(options: IsRegisteredParams): `0x${string}`;
|
42
|
+
/**
|
43
|
+
* Encodes the "isRegistered" function into a Hex string with its parameters.
|
44
|
+
* @param options - The options for the isRegistered function.
|
45
|
+
* @returns The encoded hexadecimal string.
|
46
|
+
* @extension ERC4337
|
47
|
+
* @example
|
48
|
+
* ```ts
|
49
|
+
* import { encodeIsRegistered } "thirdweb/extensions/erc4337";
|
50
|
+
* const result = encodeIsRegistered({
|
51
|
+
* account: ...,
|
52
|
+
* });
|
53
|
+
* ```
|
54
|
+
*/
|
55
|
+
export declare function encodeIsRegistered(options: IsRegisteredParams): `0xc3c5a547${string}`;
|
56
|
+
/**
|
57
|
+
* Decodes the result of the isRegistered function call.
|
58
|
+
* @param result - The hexadecimal result to decode.
|
59
|
+
* @returns The decoded result as per the FN_OUTPUTS definition.
|
60
|
+
* @extension ERC4337
|
61
|
+
* @example
|
62
|
+
* ```ts
|
63
|
+
* import { decodeIsRegisteredResult } from "thirdweb/extensions/erc4337";
|
64
|
+
* const result = decodeIsRegisteredResult("...");
|
65
|
+
* ```
|
66
|
+
*/
|
67
|
+
export declare function decodeIsRegisteredResult(result: Hex): boolean;
|
68
|
+
/**
|
69
|
+
* Calls the "isRegistered" function on the contract.
|
70
|
+
* @param options - The options for the isRegistered function.
|
71
|
+
* @returns The parsed result of the function call.
|
72
|
+
* @extension ERC4337
|
73
|
+
* @example
|
74
|
+
* ```ts
|
75
|
+
* import { isRegistered } from "thirdweb/extensions/erc4337";
|
76
|
+
*
|
77
|
+
* const result = await isRegistered({
|
78
|
+
* contract,
|
79
|
+
* account: ...,
|
80
|
+
* });
|
81
|
+
*
|
82
|
+
* ```
|
83
|
+
*/
|
84
|
+
export declare function isRegistered(options: BaseTransactionOptions<IsRegisteredParams>): Promise<boolean>;
|
85
|
+
//# sourceMappingURL=isRegistered.d.ts.map
|
package/dist/types/extensions/erc4337/__generated__/IAccountFactory/read/isRegistered.d.ts.map
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"isRegistered.d.ts","sourceRoot":"","sources":["../../../../../../../src/extensions/erc4337/__generated__/IAccountFactory/read/isRegistered.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAC;AAE3D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAGlF,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,sCAAsC,CAAC;AAChE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AAG5E;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,EAAE,2BAA2B,CAAC;QAAE,IAAI,EAAE,SAAS,CAAC;QAAC,IAAI,EAAE,SAAS,CAAA;KAAE,CAAC,CAAC;CAC5E,CAAC;AAEF,eAAO,MAAM,WAAW,cAAwB,CAAC;AAajD;;;;;;;;;;;GAWG;AACH,wBAAsB,uBAAuB,CAAC,QAAQ,EAAE,gBAAgB,CAAC,GAAG,CAAC,oBAK5E;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,kBAAkB,iBAEnE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,kBAAkB,yBAO7D;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,GAAG,WAEnD;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,YAAY,CAChC,OAAO,EAAE,sBAAsB,CAAC,kBAAkB,CAAC,oBAOpD"}
|
@@ -0,0 +1,46 @@
|
|
1
|
+
import type { BaseTransactionOptions } from "../../../../../transaction/types.js";
|
2
|
+
import type { Hex } from "../../../../../utils/encoding/hex.js";
|
3
|
+
import type { ThirdwebContract } from "../../../../../contract/contract.js";
|
4
|
+
export declare const FN_SELECTOR: "0x58451f97";
|
5
|
+
/**
|
6
|
+
* Checks if the `totalAccounts` method is supported by the given contract.
|
7
|
+
* @param contract The ThirdwebContract.
|
8
|
+
* @returns A promise that resolves to a boolean indicating if the `totalAccounts` method is supported.
|
9
|
+
* @extension ERC4337
|
10
|
+
* @example
|
11
|
+
* ```ts
|
12
|
+
* import { isTotalAccountsSupported } from "thirdweb/extensions/erc4337";
|
13
|
+
*
|
14
|
+
* const supported = await isTotalAccountsSupported(contract);
|
15
|
+
* ```
|
16
|
+
*/
|
17
|
+
export declare function isTotalAccountsSupported(contract: ThirdwebContract<any>): Promise<boolean>;
|
18
|
+
/**
|
19
|
+
* Decodes the result of the totalAccounts function call.
|
20
|
+
* @param result - The hexadecimal result to decode.
|
21
|
+
* @returns The decoded result as per the FN_OUTPUTS definition.
|
22
|
+
* @extension ERC4337
|
23
|
+
* @example
|
24
|
+
* ```ts
|
25
|
+
* import { decodeTotalAccountsResult } from "thirdweb/extensions/erc4337";
|
26
|
+
* const result = decodeTotalAccountsResult("...");
|
27
|
+
* ```
|
28
|
+
*/
|
29
|
+
export declare function decodeTotalAccountsResult(result: Hex): bigint;
|
30
|
+
/**
|
31
|
+
* Calls the "totalAccounts" function on the contract.
|
32
|
+
* @param options - The options for the totalAccounts function.
|
33
|
+
* @returns The parsed result of the function call.
|
34
|
+
* @extension ERC4337
|
35
|
+
* @example
|
36
|
+
* ```ts
|
37
|
+
* import { totalAccounts } from "thirdweb/extensions/erc4337";
|
38
|
+
*
|
39
|
+
* const result = await totalAccounts({
|
40
|
+
* contract,
|
41
|
+
* });
|
42
|
+
*
|
43
|
+
* ```
|
44
|
+
*/
|
45
|
+
export declare function totalAccounts(options: BaseTransactionOptions): Promise<bigint>;
|
46
|
+
//# sourceMappingURL=totalAccounts.d.ts.map
|
package/dist/types/extensions/erc4337/__generated__/IAccountFactory/read/totalAccounts.d.ts.map
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"totalAccounts.d.ts","sourceRoot":"","sources":["../../../../../../../src/extensions/erc4337/__generated__/IAccountFactory/read/totalAccounts.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAGlF,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,sCAAsC,CAAC;AAChE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AAG5E,eAAO,MAAM,WAAW,cAAwB,CAAC;AAQjD;;;;;;;;;;;GAWG;AACH,wBAAsB,wBAAwB,CAC5C,QAAQ,EAAE,gBAAgB,CAAC,GAAG,CAAC,oBAMhC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,GAAG,UAEpD;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE,sBAAsB,mBAMlE"}
|
package/dist/types/version.d.ts
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
export declare const version = "5.29.2-nightly-
|
1
|
+
export declare const version = "5.29.2-nightly-eff710738ce3d4341257e5912311c95b28a34b5d-20240614173600";
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "thirdweb",
|
3
|
-
"version": "5.29.2-nightly-
|
3
|
+
"version": "5.29.2-nightly-eff710738ce3d4341257e5912311c95b28a34b5d-20240614173600",
|
4
4
|
"repository": {
|
5
5
|
"type": "git",
|
6
6
|
"url": "git+https://github.com/thirdweb-dev/js.git#main"
|
@@ -283,7 +283,7 @@
|
|
283
283
|
"scripts": {
|
284
284
|
"bench:compare": "bun run ./benchmarks/run.ts",
|
285
285
|
"bench": "vitest -c ./test/vitest.config.ts bench",
|
286
|
-
"format": "biome format
|
286
|
+
"format": "biome format src/ --write",
|
287
287
|
"lint": "biome check src/",
|
288
288
|
"fix": "biome check src/ --apply",
|
289
289
|
"knip": "knip",
|
@@ -36,6 +36,9 @@ export { signerPermissionsUpdatedEvent } from "../../extensions/erc4337/__genera
|
|
36
36
|
|
37
37
|
// FACTORY
|
38
38
|
export { getAllAccounts } from "../../extensions/erc4337/__generated__/IAccountFactory/read/getAllAccounts.js";
|
39
|
+
export { getAccounts } from "../../extensions/erc4337/__generated__/IAccountFactory/read/getAccounts.js";
|
40
|
+
export { totalAccounts } from "../../extensions/erc4337/__generated__/IAccountFactory/read/totalAccounts.js";
|
41
|
+
export { isRegistered } from "../../extensions/erc4337/__generated__/IAccountFactory/read/isRegistered.js";
|
39
42
|
export {
|
40
43
|
getAccountsOfSigner,
|
41
44
|
type GetAccountsOfSignerParams,
|
@@ -0,0 +1,135 @@
|
|
1
|
+
import type { AbiParameterToPrimitiveType } from "abitype";
|
2
|
+
import { readContract } from "../../../../../transaction/read-contract.js";
|
3
|
+
import type { BaseTransactionOptions } from "../../../../../transaction/types.js";
|
4
|
+
import { encodeAbiParameters } from "../../../../../utils/abi/encodeAbiParameters.js";
|
5
|
+
import { decodeAbiParameters } from "viem";
|
6
|
+
import type { Hex } from "../../../../../utils/encoding/hex.js";
|
7
|
+
import type { ThirdwebContract } from "../../../../../contract/contract.js";
|
8
|
+
import { detectMethod } from "../../../../../utils/bytecode/detectExtension.js";
|
9
|
+
|
10
|
+
/**
|
11
|
+
* Represents the parameters for the "getAccounts" function.
|
12
|
+
*/
|
13
|
+
export type GetAccountsParams = {
|
14
|
+
start: AbiParameterToPrimitiveType<{ type: "uint256"; name: "start" }>;
|
15
|
+
end: AbiParameterToPrimitiveType<{ type: "uint256"; name: "end" }>;
|
16
|
+
};
|
17
|
+
|
18
|
+
export const FN_SELECTOR = "0xe68a7c3b" as const;
|
19
|
+
const FN_INPUTS = [
|
20
|
+
{
|
21
|
+
type: "uint256",
|
22
|
+
name: "start",
|
23
|
+
},
|
24
|
+
{
|
25
|
+
type: "uint256",
|
26
|
+
name: "end",
|
27
|
+
},
|
28
|
+
] as const;
|
29
|
+
const FN_OUTPUTS = [
|
30
|
+
{
|
31
|
+
type: "address[]",
|
32
|
+
},
|
33
|
+
] as const;
|
34
|
+
|
35
|
+
/**
|
36
|
+
* Checks if the `getAccounts` method is supported by the given contract.
|
37
|
+
* @param contract The ThirdwebContract.
|
38
|
+
* @returns A promise that resolves to a boolean indicating if the `getAccounts` method is supported.
|
39
|
+
* @extension ERC4337
|
40
|
+
* @example
|
41
|
+
* ```ts
|
42
|
+
* import { isGetAccountsSupported } from "thirdweb/extensions/erc4337";
|
43
|
+
*
|
44
|
+
* const supported = await isGetAccountsSupported(contract);
|
45
|
+
* ```
|
46
|
+
*/
|
47
|
+
export async function isGetAccountsSupported(contract: ThirdwebContract<any>) {
|
48
|
+
return detectMethod({
|
49
|
+
contract,
|
50
|
+
method: [FN_SELECTOR, FN_INPUTS, FN_OUTPUTS] as const,
|
51
|
+
});
|
52
|
+
}
|
53
|
+
|
54
|
+
/**
|
55
|
+
* Encodes the parameters for the "getAccounts" function.
|
56
|
+
* @param options - The options for the getAccounts function.
|
57
|
+
* @returns The encoded ABI parameters.
|
58
|
+
* @extension ERC4337
|
59
|
+
* @example
|
60
|
+
* ```ts
|
61
|
+
* import { encodeGetAccountsParams } "thirdweb/extensions/erc4337";
|
62
|
+
* const result = encodeGetAccountsParams({
|
63
|
+
* start: ...,
|
64
|
+
* end: ...,
|
65
|
+
* });
|
66
|
+
* ```
|
67
|
+
*/
|
68
|
+
export function encodeGetAccountsParams(options: GetAccountsParams) {
|
69
|
+
return encodeAbiParameters(FN_INPUTS, [options.start, options.end]);
|
70
|
+
}
|
71
|
+
|
72
|
+
/**
|
73
|
+
* Encodes the "getAccounts" function into a Hex string with its parameters.
|
74
|
+
* @param options - The options for the getAccounts function.
|
75
|
+
* @returns The encoded hexadecimal string.
|
76
|
+
* @extension ERC4337
|
77
|
+
* @example
|
78
|
+
* ```ts
|
79
|
+
* import { encodeGetAccounts } "thirdweb/extensions/erc4337";
|
80
|
+
* const result = encodeGetAccounts({
|
81
|
+
* start: ...,
|
82
|
+
* end: ...,
|
83
|
+
* });
|
84
|
+
* ```
|
85
|
+
*/
|
86
|
+
export function encodeGetAccounts(options: GetAccountsParams) {
|
87
|
+
// we do a "manual" concat here to avoid the overhead of the "concatHex" function
|
88
|
+
// we can do this because we know the specific formats of the values
|
89
|
+
return (FN_SELECTOR +
|
90
|
+
encodeGetAccountsParams(options).slice(
|
91
|
+
2,
|
92
|
+
)) as `${typeof FN_SELECTOR}${string}`;
|
93
|
+
}
|
94
|
+
|
95
|
+
/**
|
96
|
+
* Decodes the result of the getAccounts function call.
|
97
|
+
* @param result - The hexadecimal result to decode.
|
98
|
+
* @returns The decoded result as per the FN_OUTPUTS definition.
|
99
|
+
* @extension ERC4337
|
100
|
+
* @example
|
101
|
+
* ```ts
|
102
|
+
* import { decodeGetAccountsResult } from "thirdweb/extensions/erc4337";
|
103
|
+
* const result = decodeGetAccountsResult("...");
|
104
|
+
* ```
|
105
|
+
*/
|
106
|
+
export function decodeGetAccountsResult(result: Hex) {
|
107
|
+
return decodeAbiParameters(FN_OUTPUTS, result)[0];
|
108
|
+
}
|
109
|
+
|
110
|
+
/**
|
111
|
+
* Calls the "getAccounts" function on the contract.
|
112
|
+
* @param options - The options for the getAccounts function.
|
113
|
+
* @returns The parsed result of the function call.
|
114
|
+
* @extension ERC4337
|
115
|
+
* @example
|
116
|
+
* ```ts
|
117
|
+
* import { getAccounts } from "thirdweb/extensions/erc4337";
|
118
|
+
*
|
119
|
+
* const result = await getAccounts({
|
120
|
+
* contract,
|
121
|
+
* start: ...,
|
122
|
+
* end: ...,
|
123
|
+
* });
|
124
|
+
*
|
125
|
+
* ```
|
126
|
+
*/
|
127
|
+
export async function getAccounts(
|
128
|
+
options: BaseTransactionOptions<GetAccountsParams>,
|
129
|
+
) {
|
130
|
+
return readContract({
|
131
|
+
contract: options.contract,
|
132
|
+
method: [FN_SELECTOR, FN_INPUTS, FN_OUTPUTS] as const,
|
133
|
+
params: [options.start, options.end],
|
134
|
+
});
|
135
|
+
}
|
@@ -0,0 +1,127 @@
|
|
1
|
+
import type { AbiParameterToPrimitiveType } from "abitype";
|
2
|
+
import { readContract } from "../../../../../transaction/read-contract.js";
|
3
|
+
import type { BaseTransactionOptions } from "../../../../../transaction/types.js";
|
4
|
+
import { encodeAbiParameters } from "../../../../../utils/abi/encodeAbiParameters.js";
|
5
|
+
import { decodeAbiParameters } from "viem";
|
6
|
+
import type { Hex } from "../../../../../utils/encoding/hex.js";
|
7
|
+
import type { ThirdwebContract } from "../../../../../contract/contract.js";
|
8
|
+
import { detectMethod } from "../../../../../utils/bytecode/detectExtension.js";
|
9
|
+
|
10
|
+
/**
|
11
|
+
* Represents the parameters for the "isRegistered" function.
|
12
|
+
*/
|
13
|
+
export type IsRegisteredParams = {
|
14
|
+
account: AbiParameterToPrimitiveType<{ type: "address"; name: "account" }>;
|
15
|
+
};
|
16
|
+
|
17
|
+
export const FN_SELECTOR = "0xc3c5a547" as const;
|
18
|
+
const FN_INPUTS = [
|
19
|
+
{
|
20
|
+
type: "address",
|
21
|
+
name: "account",
|
22
|
+
},
|
23
|
+
] as const;
|
24
|
+
const FN_OUTPUTS = [
|
25
|
+
{
|
26
|
+
type: "bool",
|
27
|
+
},
|
28
|
+
] as const;
|
29
|
+
|
30
|
+
/**
|
31
|
+
* Checks if the `isRegistered` method is supported by the given contract.
|
32
|
+
* @param contract The ThirdwebContract.
|
33
|
+
* @returns A promise that resolves to a boolean indicating if the `isRegistered` method is supported.
|
34
|
+
* @extension ERC4337
|
35
|
+
* @example
|
36
|
+
* ```ts
|
37
|
+
* import { isIsRegisteredSupported } from "thirdweb/extensions/erc4337";
|
38
|
+
*
|
39
|
+
* const supported = await isIsRegisteredSupported(contract);
|
40
|
+
* ```
|
41
|
+
*/
|
42
|
+
export async function isIsRegisteredSupported(contract: ThirdwebContract<any>) {
|
43
|
+
return detectMethod({
|
44
|
+
contract,
|
45
|
+
method: [FN_SELECTOR, FN_INPUTS, FN_OUTPUTS] as const,
|
46
|
+
});
|
47
|
+
}
|
48
|
+
|
49
|
+
/**
|
50
|
+
* Encodes the parameters for the "isRegistered" function.
|
51
|
+
* @param options - The options for the isRegistered function.
|
52
|
+
* @returns The encoded ABI parameters.
|
53
|
+
* @extension ERC4337
|
54
|
+
* @example
|
55
|
+
* ```ts
|
56
|
+
* import { encodeIsRegisteredParams } "thirdweb/extensions/erc4337";
|
57
|
+
* const result = encodeIsRegisteredParams({
|
58
|
+
* account: ...,
|
59
|
+
* });
|
60
|
+
* ```
|
61
|
+
*/
|
62
|
+
export function encodeIsRegisteredParams(options: IsRegisteredParams) {
|
63
|
+
return encodeAbiParameters(FN_INPUTS, [options.account]);
|
64
|
+
}
|
65
|
+
|
66
|
+
/**
|
67
|
+
* Encodes the "isRegistered" function into a Hex string with its parameters.
|
68
|
+
* @param options - The options for the isRegistered function.
|
69
|
+
* @returns The encoded hexadecimal string.
|
70
|
+
* @extension ERC4337
|
71
|
+
* @example
|
72
|
+
* ```ts
|
73
|
+
* import { encodeIsRegistered } "thirdweb/extensions/erc4337";
|
74
|
+
* const result = encodeIsRegistered({
|
75
|
+
* account: ...,
|
76
|
+
* });
|
77
|
+
* ```
|
78
|
+
*/
|
79
|
+
export function encodeIsRegistered(options: IsRegisteredParams) {
|
80
|
+
// we do a "manual" concat here to avoid the overhead of the "concatHex" function
|
81
|
+
// we can do this because we know the specific formats of the values
|
82
|
+
return (FN_SELECTOR +
|
83
|
+
encodeIsRegisteredParams(options).slice(
|
84
|
+
2,
|
85
|
+
)) as `${typeof FN_SELECTOR}${string}`;
|
86
|
+
}
|
87
|
+
|
88
|
+
/**
|
89
|
+
* Decodes the result of the isRegistered function call.
|
90
|
+
* @param result - The hexadecimal result to decode.
|
91
|
+
* @returns The decoded result as per the FN_OUTPUTS definition.
|
92
|
+
* @extension ERC4337
|
93
|
+
* @example
|
94
|
+
* ```ts
|
95
|
+
* import { decodeIsRegisteredResult } from "thirdweb/extensions/erc4337";
|
96
|
+
* const result = decodeIsRegisteredResult("...");
|
97
|
+
* ```
|
98
|
+
*/
|
99
|
+
export function decodeIsRegisteredResult(result: Hex) {
|
100
|
+
return decodeAbiParameters(FN_OUTPUTS, result)[0];
|
101
|
+
}
|
102
|
+
|
103
|
+
/**
|
104
|
+
* Calls the "isRegistered" function on the contract.
|
105
|
+
* @param options - The options for the isRegistered function.
|
106
|
+
* @returns The parsed result of the function call.
|
107
|
+
* @extension ERC4337
|
108
|
+
* @example
|
109
|
+
* ```ts
|
110
|
+
* import { isRegistered } from "thirdweb/extensions/erc4337";
|
111
|
+
*
|
112
|
+
* const result = await isRegistered({
|
113
|
+
* contract,
|
114
|
+
* account: ...,
|
115
|
+
* });
|
116
|
+
*
|
117
|
+
* ```
|
118
|
+
*/
|
119
|
+
export async function isRegistered(
|
120
|
+
options: BaseTransactionOptions<IsRegisteredParams>,
|
121
|
+
) {
|
122
|
+
return readContract({
|
123
|
+
contract: options.contract,
|
124
|
+
method: [FN_SELECTOR, FN_INPUTS, FN_OUTPUTS] as const,
|
125
|
+
params: [options.account],
|
126
|
+
});
|
127
|
+
}
|