thirdweb 5.29.2-nightly-7768067bf4f571a8c8ee6b646a58e2fc5f6bd052-20240614163812 → 5.29.2-nightly-fb6a07d4b84ba8ea6389ca04c73625f670a0d9c4-20240614172741
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
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.simulateHandleOp = exports.getUserOpHash = exports.userOperationRevertReasonEvent = exports.userOperationEventEvent = exports.accountDeployedEvent = exports.predictAccountAddress = exports.getAccountsOfSigner = exports.getAllAccounts = exports.signerPermissionsUpdatedEvent = exports.adminUpdatedEvent = exports.isAdmin = exports.isActiveSigner = exports.getPermissionsForSigner = exports.getAllSigners = exports.getAllAdmins = exports.getAllActiveSigners = exports.removeSessionKey = exports.addSessionKey = exports.removeAdmin = exports.addAdmin = void 0;
|
3
|
+
exports.simulateHandleOp = exports.getUserOpHash = exports.userOperationRevertReasonEvent = exports.userOperationEventEvent = exports.accountDeployedEvent = exports.predictAccountAddress = exports.getAccountsOfSigner = exports.isRegistered = exports.totalAccounts = exports.getAccounts = exports.getAllAccounts = exports.signerPermissionsUpdatedEvent = exports.adminUpdatedEvent = exports.isAdmin = exports.isActiveSigner = exports.getPermissionsForSigner = exports.getAllSigners = exports.getAllAdmins = exports.getAllActiveSigners = exports.removeSessionKey = exports.addSessionKey = exports.removeAdmin = exports.addAdmin = void 0;
|
4
4
|
// ACCOUNT
|
5
5
|
var addAdmin_js_1 = require("../../extensions/erc4337/account/addAdmin.js");
|
6
6
|
Object.defineProperty(exports, "addAdmin", { enumerable: true, get: function () { return addAdmin_js_1.addAdmin; } });
|
@@ -29,6 +29,12 @@ Object.defineProperty(exports, "signerPermissionsUpdatedEvent", { enumerable: tr
|
|
29
29
|
// FACTORY
|
30
30
|
var getAllAccounts_js_1 = require("../../extensions/erc4337/__generated__/IAccountFactory/read/getAllAccounts.js");
|
31
31
|
Object.defineProperty(exports, "getAllAccounts", { enumerable: true, get: function () { return getAllAccounts_js_1.getAllAccounts; } });
|
32
|
+
var getAccounts_js_1 = require("../../extensions/erc4337/__generated__/IAccountFactory/read/getAccounts.js");
|
33
|
+
Object.defineProperty(exports, "getAccounts", { enumerable: true, get: function () { return getAccounts_js_1.getAccounts; } });
|
34
|
+
var totalAccounts_js_1 = require("../../extensions/erc4337/__generated__/IAccountFactory/read/totalAccounts.js");
|
35
|
+
Object.defineProperty(exports, "totalAccounts", { enumerable: true, get: function () { return totalAccounts_js_1.totalAccounts; } });
|
36
|
+
var isRegistered_js_1 = require("../../extensions/erc4337/__generated__/IAccountFactory/read/isRegistered.js");
|
37
|
+
Object.defineProperty(exports, "isRegistered", { enumerable: true, get: function () { return isRegistered_js_1.isRegistered; } });
|
32
38
|
var getAccountsOfSigner_js_1 = require("../../extensions/erc4337/__generated__/IAccountFactory/read/getAccountsOfSigner.js");
|
33
39
|
Object.defineProperty(exports, "getAccountsOfSigner", { enumerable: true, get: function () { return getAccountsOfSigner_js_1.getAccountsOfSigner; } });
|
34
40
|
var getAddress_js_1 = require("../../extensions/erc4337/__generated__/IAccountFactory/read/getAddress.js");
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"erc4337.js","sourceRoot":"","sources":["../../../../src/exports/extensions/erc4337.ts"],"names":[],"mappings":";;;AAAA,UAAU;AACV,4EAGsD;AADpD,uGAAA,QAAQ,OAAA;A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oG;AAFlG,qIAAA,uBAAuB,OAAA;AAGzB,uHAG2F;AAFzF,mHAAA,cAAc,OAAA;AAGhB,yGAAqG;AAA5F,qGAAA,OAAO,OAAA;AAChB,qHAAsH;AAA7G,oHAAA,iBAAiB,OAAA;AAC1B,6IAA8I;AAArI,4IAAA,6BAA6B,OAAA;AAEtC,UAAU;AACV,mHAA+G;AAAtG,mHAAA,cAAc,OAAA;AACvB,6GAAyG;AAAhG,6GAAA,WAAW,OAAA;AACpB,iHAA6G;AAApG,iHAAA,aAAa,OAAA;AACtB,+GAA2G;AAAlG,+GAAA,YAAY,OAAA;AACrB,6HAG4F;AAF1F,6HAAA,mBAAmB,OAAA;AAGrB,2GAGmF;AAFjF,sHAAA,UAAU,OAAyB;AAIrC,aAAa;AAEb,mHAAoH;AAA3G,0HAAA,oBAAoB,OAAA;AAC7B,yHAA0H;AAAjH,gIAAA,uBAAuB,OAAA;AAChC,uIAAwI;AAA/H,8IAAA,8BAA8B,OAAA;AACvC,6GAGkF;AAFhF,iHAAA,aAAa,OAAA;AAGf,oHAGsF;AAFpF,uHAAA,gBAAgB,OAAA"}
|
@@ -0,0 +1,122 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.getAccounts = exports.decodeGetAccountsResult = exports.encodeGetAccounts = exports.encodeGetAccountsParams = exports.isGetAccountsSupported = exports.FN_SELECTOR = void 0;
|
4
|
+
const read_contract_js_1 = require("../../../../../transaction/read-contract.js");
|
5
|
+
const encodeAbiParameters_js_1 = require("../../../../../utils/abi/encodeAbiParameters.js");
|
6
|
+
const viem_1 = require("viem");
|
7
|
+
const detectExtension_js_1 = require("../../../../../utils/bytecode/detectExtension.js");
|
8
|
+
exports.FN_SELECTOR = "0xe68a7c3b";
|
9
|
+
const FN_INPUTS = [
|
10
|
+
{
|
11
|
+
type: "uint256",
|
12
|
+
name: "start",
|
13
|
+
},
|
14
|
+
{
|
15
|
+
type: "uint256",
|
16
|
+
name: "end",
|
17
|
+
},
|
18
|
+
];
|
19
|
+
const FN_OUTPUTS = [
|
20
|
+
{
|
21
|
+
type: "address[]",
|
22
|
+
},
|
23
|
+
];
|
24
|
+
/**
|
25
|
+
* Checks if the `getAccounts` method is supported by the given contract.
|
26
|
+
* @param contract The ThirdwebContract.
|
27
|
+
* @returns A promise that resolves to a boolean indicating if the `getAccounts` method is supported.
|
28
|
+
* @extension ERC4337
|
29
|
+
* @example
|
30
|
+
* ```ts
|
31
|
+
* import { isGetAccountsSupported } from "thirdweb/extensions/erc4337";
|
32
|
+
*
|
33
|
+
* const supported = await isGetAccountsSupported(contract);
|
34
|
+
* ```
|
35
|
+
*/
|
36
|
+
async function isGetAccountsSupported(contract) {
|
37
|
+
return (0, detectExtension_js_1.detectMethod)({
|
38
|
+
contract,
|
39
|
+
method: [exports.FN_SELECTOR, FN_INPUTS, FN_OUTPUTS],
|
40
|
+
});
|
41
|
+
}
|
42
|
+
exports.isGetAccountsSupported = isGetAccountsSupported;
|
43
|
+
/**
|
44
|
+
* Encodes the parameters for the "getAccounts" function.
|
45
|
+
* @param options - The options for the getAccounts function.
|
46
|
+
* @returns The encoded ABI parameters.
|
47
|
+
* @extension ERC4337
|
48
|
+
* @example
|
49
|
+
* ```ts
|
50
|
+
* import { encodeGetAccountsParams } "thirdweb/extensions/erc4337";
|
51
|
+
* const result = encodeGetAccountsParams({
|
52
|
+
* start: ...,
|
53
|
+
* end: ...,
|
54
|
+
* });
|
55
|
+
* ```
|
56
|
+
*/
|
57
|
+
function encodeGetAccountsParams(options) {
|
58
|
+
return (0, encodeAbiParameters_js_1.encodeAbiParameters)(FN_INPUTS, [options.start, options.end]);
|
59
|
+
}
|
60
|
+
exports.encodeGetAccountsParams = encodeGetAccountsParams;
|
61
|
+
/**
|
62
|
+
* Encodes the "getAccounts" function into a Hex string with its parameters.
|
63
|
+
* @param options - The options for the getAccounts function.
|
64
|
+
* @returns The encoded hexadecimal string.
|
65
|
+
* @extension ERC4337
|
66
|
+
* @example
|
67
|
+
* ```ts
|
68
|
+
* import { encodeGetAccounts } "thirdweb/extensions/erc4337";
|
69
|
+
* const result = encodeGetAccounts({
|
70
|
+
* start: ...,
|
71
|
+
* end: ...,
|
72
|
+
* });
|
73
|
+
* ```
|
74
|
+
*/
|
75
|
+
function encodeGetAccounts(options) {
|
76
|
+
// we do a "manual" concat here to avoid the overhead of the "concatHex" function
|
77
|
+
// we can do this because we know the specific formats of the values
|
78
|
+
return (exports.FN_SELECTOR +
|
79
|
+
encodeGetAccountsParams(options).slice(2));
|
80
|
+
}
|
81
|
+
exports.encodeGetAccounts = encodeGetAccounts;
|
82
|
+
/**
|
83
|
+
* Decodes the result of the getAccounts function call.
|
84
|
+
* @param result - The hexadecimal result to decode.
|
85
|
+
* @returns The decoded result as per the FN_OUTPUTS definition.
|
86
|
+
* @extension ERC4337
|
87
|
+
* @example
|
88
|
+
* ```ts
|
89
|
+
* import { decodeGetAccountsResult } from "thirdweb/extensions/erc4337";
|
90
|
+
* const result = decodeGetAccountsResult("...");
|
91
|
+
* ```
|
92
|
+
*/
|
93
|
+
function decodeGetAccountsResult(result) {
|
94
|
+
return (0, viem_1.decodeAbiParameters)(FN_OUTPUTS, result)[0];
|
95
|
+
}
|
96
|
+
exports.decodeGetAccountsResult = decodeGetAccountsResult;
|
97
|
+
/**
|
98
|
+
* Calls the "getAccounts" function on the contract.
|
99
|
+
* @param options - The options for the getAccounts function.
|
100
|
+
* @returns The parsed result of the function call.
|
101
|
+
* @extension ERC4337
|
102
|
+
* @example
|
103
|
+
* ```ts
|
104
|
+
* import { getAccounts } from "thirdweb/extensions/erc4337";
|
105
|
+
*
|
106
|
+
* const result = await getAccounts({
|
107
|
+
* contract,
|
108
|
+
* start: ...,
|
109
|
+
* end: ...,
|
110
|
+
* });
|
111
|
+
*
|
112
|
+
* ```
|
113
|
+
*/
|
114
|
+
async function getAccounts(options) {
|
115
|
+
return (0, read_contract_js_1.readContract)({
|
116
|
+
contract: options.contract,
|
117
|
+
method: [exports.FN_SELECTOR, FN_INPUTS, FN_OUTPUTS],
|
118
|
+
params: [options.start, options.end],
|
119
|
+
});
|
120
|
+
}
|
121
|
+
exports.getAccounts = getAccounts;
|
122
|
+
//# sourceMappingURL=getAccounts.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"getAccounts.js","sourceRoot":"","sources":["../../../../../../../src/extensions/erc4337/__generated__/IAccountFactory/read/getAccounts.ts"],"names":[],"mappings":";;;AACA,kFAA2E;AAE3E,4FAAsF;AACtF,+BAA2C;AAG3C,yFAAgF;AAUnE,QAAA,WAAW,GAAG,YAAqB,CAAC;AACjD,MAAM,SAAS,GAAG;IAChB;QACE,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,OAAO;KACd;IACD;QACE,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,KAAK;KACZ;CACO,CAAC;AACX,MAAM,UAAU,GAAG;IACjB;QACE,IAAI,EAAE,WAAW;KAClB;CACO,CAAC;AAEX;;;;;;;;;;;GAWG;AACI,KAAK,UAAU,sBAAsB,CAAC,QAA+B;IAC1E,OAAO,IAAA,iCAAY,EAAC;QAClB,QAAQ;QACR,MAAM,EAAE,CAAC,mBAAW,EAAE,SAAS,EAAE,UAAU,CAAU;KACtD,CAAC,CAAC;AACL,CAAC;AALD,wDAKC;AAED;;;;;;;;;;;;;GAaG;AACH,SAAgB,uBAAuB,CAAC,OAA0B;IAChE,OAAO,IAAA,4CAAmB,EAAC,SAAS,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;AACtE,CAAC;AAFD,0DAEC;AAED;;;;;;;;;;;;;GAaG;AACH,SAAgB,iBAAiB,CAAC,OAA0B;IAC1D,iFAAiF;IACjF,oEAAoE;IACpE,OAAO,CAAC,mBAAW;QACjB,uBAAuB,CAAC,OAAO,CAAC,CAAC,KAAK,CACpC,CAAC,CACF,CAAqC,CAAC;AAC3C,CAAC;AAPD,8CAOC;AAED;;;;;;;;;;GAUG;AACH,SAAgB,uBAAuB,CAAC,MAAW;IACjD,OAAO,IAAA,0BAAmB,EAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AACpD,CAAC;AAFD,0DAEC;AAED;;;;;;;;;;;;;;;;GAgBG;AACI,KAAK,UAAU,WAAW,CAC/B,OAAkD;IAElD,OAAO,IAAA,+BAAY,EAAC;QAClB,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,MAAM,EAAE,CAAC,mBAAW,EAAE,SAAS,EAAE,UAAU,CAAU;QACrD,MAAM,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC;KACrC,CAAC,CAAC;AACL,CAAC;AARD,kCAQC"}
|
@@ -0,0 +1,115 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.isRegistered = exports.decodeIsRegisteredResult = exports.encodeIsRegistered = exports.encodeIsRegisteredParams = exports.isIsRegisteredSupported = exports.FN_SELECTOR = void 0;
|
4
|
+
const read_contract_js_1 = require("../../../../../transaction/read-contract.js");
|
5
|
+
const encodeAbiParameters_js_1 = require("../../../../../utils/abi/encodeAbiParameters.js");
|
6
|
+
const viem_1 = require("viem");
|
7
|
+
const detectExtension_js_1 = require("../../../../../utils/bytecode/detectExtension.js");
|
8
|
+
exports.FN_SELECTOR = "0xc3c5a547";
|
9
|
+
const FN_INPUTS = [
|
10
|
+
{
|
11
|
+
type: "address",
|
12
|
+
name: "account",
|
13
|
+
},
|
14
|
+
];
|
15
|
+
const FN_OUTPUTS = [
|
16
|
+
{
|
17
|
+
type: "bool",
|
18
|
+
},
|
19
|
+
];
|
20
|
+
/**
|
21
|
+
* Checks if the `isRegistered` method is supported by the given contract.
|
22
|
+
* @param contract The ThirdwebContract.
|
23
|
+
* @returns A promise that resolves to a boolean indicating if the `isRegistered` method is supported.
|
24
|
+
* @extension ERC4337
|
25
|
+
* @example
|
26
|
+
* ```ts
|
27
|
+
* import { isIsRegisteredSupported } from "thirdweb/extensions/erc4337";
|
28
|
+
*
|
29
|
+
* const supported = await isIsRegisteredSupported(contract);
|
30
|
+
* ```
|
31
|
+
*/
|
32
|
+
async function isIsRegisteredSupported(contract) {
|
33
|
+
return (0, detectExtension_js_1.detectMethod)({
|
34
|
+
contract,
|
35
|
+
method: [exports.FN_SELECTOR, FN_INPUTS, FN_OUTPUTS],
|
36
|
+
});
|
37
|
+
}
|
38
|
+
exports.isIsRegisteredSupported = isIsRegisteredSupported;
|
39
|
+
/**
|
40
|
+
* Encodes the parameters for the "isRegistered" function.
|
41
|
+
* @param options - The options for the isRegistered function.
|
42
|
+
* @returns The encoded ABI parameters.
|
43
|
+
* @extension ERC4337
|
44
|
+
* @example
|
45
|
+
* ```ts
|
46
|
+
* import { encodeIsRegisteredParams } "thirdweb/extensions/erc4337";
|
47
|
+
* const result = encodeIsRegisteredParams({
|
48
|
+
* account: ...,
|
49
|
+
* });
|
50
|
+
* ```
|
51
|
+
*/
|
52
|
+
function encodeIsRegisteredParams(options) {
|
53
|
+
return (0, encodeAbiParameters_js_1.encodeAbiParameters)(FN_INPUTS, [options.account]);
|
54
|
+
}
|
55
|
+
exports.encodeIsRegisteredParams = encodeIsRegisteredParams;
|
56
|
+
/**
|
57
|
+
* Encodes the "isRegistered" function into a Hex string with its parameters.
|
58
|
+
* @param options - The options for the isRegistered function.
|
59
|
+
* @returns The encoded hexadecimal string.
|
60
|
+
* @extension ERC4337
|
61
|
+
* @example
|
62
|
+
* ```ts
|
63
|
+
* import { encodeIsRegistered } "thirdweb/extensions/erc4337";
|
64
|
+
* const result = encodeIsRegistered({
|
65
|
+
* account: ...,
|
66
|
+
* });
|
67
|
+
* ```
|
68
|
+
*/
|
69
|
+
function encodeIsRegistered(options) {
|
70
|
+
// we do a "manual" concat here to avoid the overhead of the "concatHex" function
|
71
|
+
// we can do this because we know the specific formats of the values
|
72
|
+
return (exports.FN_SELECTOR +
|
73
|
+
encodeIsRegisteredParams(options).slice(2));
|
74
|
+
}
|
75
|
+
exports.encodeIsRegistered = encodeIsRegistered;
|
76
|
+
/**
|
77
|
+
* Decodes the result of the isRegistered function call.
|
78
|
+
* @param result - The hexadecimal result to decode.
|
79
|
+
* @returns The decoded result as per the FN_OUTPUTS definition.
|
80
|
+
* @extension ERC4337
|
81
|
+
* @example
|
82
|
+
* ```ts
|
83
|
+
* import { decodeIsRegisteredResult } from "thirdweb/extensions/erc4337";
|
84
|
+
* const result = decodeIsRegisteredResult("...");
|
85
|
+
* ```
|
86
|
+
*/
|
87
|
+
function decodeIsRegisteredResult(result) {
|
88
|
+
return (0, viem_1.decodeAbiParameters)(FN_OUTPUTS, result)[0];
|
89
|
+
}
|
90
|
+
exports.decodeIsRegisteredResult = decodeIsRegisteredResult;
|
91
|
+
/**
|
92
|
+
* Calls the "isRegistered" function on the contract.
|
93
|
+
* @param options - The options for the isRegistered function.
|
94
|
+
* @returns The parsed result of the function call.
|
95
|
+
* @extension ERC4337
|
96
|
+
* @example
|
97
|
+
* ```ts
|
98
|
+
* import { isRegistered } from "thirdweb/extensions/erc4337";
|
99
|
+
*
|
100
|
+
* const result = await isRegistered({
|
101
|
+
* contract,
|
102
|
+
* account: ...,
|
103
|
+
* });
|
104
|
+
*
|
105
|
+
* ```
|
106
|
+
*/
|
107
|
+
async function isRegistered(options) {
|
108
|
+
return (0, read_contract_js_1.readContract)({
|
109
|
+
contract: options.contract,
|
110
|
+
method: [exports.FN_SELECTOR, FN_INPUTS, FN_OUTPUTS],
|
111
|
+
params: [options.account],
|
112
|
+
});
|
113
|
+
}
|
114
|
+
exports.isRegistered = isRegistered;
|
115
|
+
//# sourceMappingURL=isRegistered.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"isRegistered.js","sourceRoot":"","sources":["../../../../../../../src/extensions/erc4337/__generated__/IAccountFactory/read/isRegistered.ts"],"names":[],"mappings":";;;AACA,kFAA2E;AAE3E,4FAA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AC1B,CAAC,CAAC;AACL,CAAC;AARD,oCAQC"}
|
@@ -0,0 +1,71 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.totalAccounts = exports.decodeTotalAccountsResult = exports.isTotalAccountsSupported = exports.FN_SELECTOR = void 0;
|
4
|
+
const read_contract_js_1 = require("../../../../../transaction/read-contract.js");
|
5
|
+
const viem_1 = require("viem");
|
6
|
+
const detectExtension_js_1 = require("../../../../../utils/bytecode/detectExtension.js");
|
7
|
+
exports.FN_SELECTOR = "0x58451f97";
|
8
|
+
const FN_INPUTS = [];
|
9
|
+
const FN_OUTPUTS = [
|
10
|
+
{
|
11
|
+
type: "uint256",
|
12
|
+
},
|
13
|
+
];
|
14
|
+
/**
|
15
|
+
* Checks if the `totalAccounts` method is supported by the given contract.
|
16
|
+
* @param contract The ThirdwebContract.
|
17
|
+
* @returns A promise that resolves to a boolean indicating if the `totalAccounts` method is supported.
|
18
|
+
* @extension ERC4337
|
19
|
+
* @example
|
20
|
+
* ```ts
|
21
|
+
* import { isTotalAccountsSupported } from "thirdweb/extensions/erc4337";
|
22
|
+
*
|
23
|
+
* const supported = await isTotalAccountsSupported(contract);
|
24
|
+
* ```
|
25
|
+
*/
|
26
|
+
async function isTotalAccountsSupported(contract) {
|
27
|
+
return (0, detectExtension_js_1.detectMethod)({
|
28
|
+
contract,
|
29
|
+
method: [exports.FN_SELECTOR, FN_INPUTS, FN_OUTPUTS],
|
30
|
+
});
|
31
|
+
}
|
32
|
+
exports.isTotalAccountsSupported = isTotalAccountsSupported;
|
33
|
+
/**
|
34
|
+
* Decodes the result of the totalAccounts function call.
|
35
|
+
* @param result - The hexadecimal result to decode.
|
36
|
+
* @returns The decoded result as per the FN_OUTPUTS definition.
|
37
|
+
* @extension ERC4337
|
38
|
+
* @example
|
39
|
+
* ```ts
|
40
|
+
* import { decodeTotalAccountsResult } from "thirdweb/extensions/erc4337";
|
41
|
+
* const result = decodeTotalAccountsResult("...");
|
42
|
+
* ```
|
43
|
+
*/
|
44
|
+
function decodeTotalAccountsResult(result) {
|
45
|
+
return (0, viem_1.decodeAbiParameters)(FN_OUTPUTS, result)[0];
|
46
|
+
}
|
47
|
+
exports.decodeTotalAccountsResult = decodeTotalAccountsResult;
|
48
|
+
/**
|
49
|
+
* Calls the "totalAccounts" function on the contract.
|
50
|
+
* @param options - The options for the totalAccounts function.
|
51
|
+
* @returns The parsed result of the function call.
|
52
|
+
* @extension ERC4337
|
53
|
+
* @example
|
54
|
+
* ```ts
|
55
|
+
* import { totalAccounts } from "thirdweb/extensions/erc4337";
|
56
|
+
*
|
57
|
+
* const result = await totalAccounts({
|
58
|
+
* contract,
|
59
|
+
* });
|
60
|
+
*
|
61
|
+
* ```
|
62
|
+
*/
|
63
|
+
async function totalAccounts(options) {
|
64
|
+
return (0, read_contract_js_1.readContract)({
|
65
|
+
contract: options.contract,
|
66
|
+
method: [exports.FN_SELECTOR, FN_INPUTS, FN_OUTPUTS],
|
67
|
+
params: [],
|
68
|
+
});
|
69
|
+
}
|
70
|
+
exports.totalAccounts = totalAccounts;
|
71
|
+
//# 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,kFAA2E;AAG3E,+BAA2C;AAG3C,yFAAgF;AAEnE,QAAA,WAAW,GAAG,YAAqB,CAAC;AACjD,MAAM,SAAS,GAAG,EAAW,CAAC;AAC9B,MAAM,UAAU,GAAG;IACjB;QACE,IAAI,EAAE,SAAS;KAChB;CACO,CAAC;AAEX;;;;;;;;;;;GAWG;AACI,KAAK,UAAU,wBAAwB,CAC5C,QAA+B;IAE/B,OAAO,IAAA,iCAAY,EAAC;QAClB,QAAQ;QACR,MAAM,EAAE,CAAC,mBAAW,EAAE,SAAS,EAAE,UAAU,CAAU;KACtD,CAAC,CAAC;AACL,CAAC;AAPD,4DAOC;AAED;;;;;;;;;;GAUG;AACH,SAAgB,yBAAyB,CAAC,MAAW;IACnD,OAAO,IAAA,0BAAmB,EAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AACpD,CAAC;AAFD,8DAEC;AAED;;;;;;;;;;;;;;GAcG;AACI,KAAK,UAAU,aAAa,CAAC,OAA+B;IACjE,OAAO,IAAA,+BAAY,EAAC;QAClB,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,MAAM,EAAE,CAAC,mBAAW,EAAE,SAAS,EAAE,UAAU,CAAU;QACrD,MAAM,EAAE,EAAE;KACX,CAAC,CAAC;AACL,CAAC;AAND,sCAMC"}
|
package/dist/cjs/version.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.version = void 0;
|
4
|
-
exports.version = "5.29.2-nightly-
|
4
|
+
exports.version = "5.29.2-nightly-fb6a07d4b84ba8ea6389ca04c73625f670a0d9c4-20240614172741";
|
5
5
|
//# sourceMappingURL=version.js.map
|
@@ -13,6 +13,9 @@ export { adminUpdatedEvent } from "../../extensions/erc4337/__generated__/IAccou
|
|
13
13
|
export { signerPermissionsUpdatedEvent } from "../../extensions/erc4337/__generated__/IAccountPermissions/events/SignerPermissionsUpdated.js";
|
14
14
|
// FACTORY
|
15
15
|
export { getAllAccounts } from "../../extensions/erc4337/__generated__/IAccountFactory/read/getAllAccounts.js";
|
16
|
+
export { getAccounts } from "../../extensions/erc4337/__generated__/IAccountFactory/read/getAccounts.js";
|
17
|
+
export { totalAccounts } from "../../extensions/erc4337/__generated__/IAccountFactory/read/totalAccounts.js";
|
18
|
+
export { isRegistered } from "../../extensions/erc4337/__generated__/IAccountFactory/read/isRegistered.js";
|
16
19
|
export { getAccountsOfSigner, } from "../../extensions/erc4337/__generated__/IAccountFactory/read/getAccountsOfSigner.js";
|
17
20
|
export { getAddress as predictAccountAddress, } from "../../extensions/erc4337/__generated__/IAccountFactory/read/getAddress.js";
|
18
21
|
// ENTRYPOINT
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"erc4337.js","sourceRoot":"","sources":["../../../../src/exports/extensions/erc4337.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,OAAO,EAEL,QAAQ,GACT,MAAM,8CAA8C,CAAC;AAEtD,OAAO,EAEL,WAAW,GACZ,MAAM,iDAAiD,CAAC;AAEzD,OAAO,EAEL,aAAa,GACd,MAAM,mDAAmD,CAAC;AAE3D,OAAO,EAEL,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,GAExB,MAAM,4FAA4F,CAAC;AACpG,OAAO,EACL,cAAc,GAEf,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;AAE9I,UAAU;AACV,OAAO,EAAE,cAAc,EAAE,MAAM,+EAA+E,CAAC;AAC/G,OAAO,EACL,mBAAmB,GAEpB,MAAM,oFAAoF,CAAC;AAC5F,OAAO,EACL,UAAU,IAAI,qBAAqB,GAEpC,MAAM,2EAA2E,CAAC;AAEnF,aAAa;AAEb,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,GAEd,MAAM,0EAA0E,CA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C;AAC1H,OAAO,EAAE,8BAA8B,EAAE,MAAM,wFAAwF,CAAC;AACxI,OAAO,EACL,aAAa,GAEd,MAAM,0EAA0E,CAAC;AAClF,OAAO,EACL,gBAAgB,GAEjB,MAAM,8EAA8E,CAAC"}
|
@@ -0,0 +1,114 @@
|
|
1
|
+
import { readContract } from "../../../../../transaction/read-contract.js";
|
2
|
+
import { encodeAbiParameters } from "../../../../../utils/abi/encodeAbiParameters.js";
|
3
|
+
import { decodeAbiParameters } from "viem";
|
4
|
+
import { detectMethod } from "../../../../../utils/bytecode/detectExtension.js";
|
5
|
+
export const FN_SELECTOR = "0xe68a7c3b";
|
6
|
+
const FN_INPUTS = [
|
7
|
+
{
|
8
|
+
type: "uint256",
|
9
|
+
name: "start",
|
10
|
+
},
|
11
|
+
{
|
12
|
+
type: "uint256",
|
13
|
+
name: "end",
|
14
|
+
},
|
15
|
+
];
|
16
|
+
const FN_OUTPUTS = [
|
17
|
+
{
|
18
|
+
type: "address[]",
|
19
|
+
},
|
20
|
+
];
|
21
|
+
/**
|
22
|
+
* Checks if the `getAccounts` method is supported by the given contract.
|
23
|
+
* @param contract The ThirdwebContract.
|
24
|
+
* @returns A promise that resolves to a boolean indicating if the `getAccounts` method is supported.
|
25
|
+
* @extension ERC4337
|
26
|
+
* @example
|
27
|
+
* ```ts
|
28
|
+
* import { isGetAccountsSupported } from "thirdweb/extensions/erc4337";
|
29
|
+
*
|
30
|
+
* const supported = await isGetAccountsSupported(contract);
|
31
|
+
* ```
|
32
|
+
*/
|
33
|
+
export async function isGetAccountsSupported(contract) {
|
34
|
+
return detectMethod({
|
35
|
+
contract,
|
36
|
+
method: [FN_SELECTOR, FN_INPUTS, FN_OUTPUTS],
|
37
|
+
});
|
38
|
+
}
|
39
|
+
/**
|
40
|
+
* Encodes the parameters for the "getAccounts" function.
|
41
|
+
* @param options - The options for the getAccounts function.
|
42
|
+
* @returns The encoded ABI parameters.
|
43
|
+
* @extension ERC4337
|
44
|
+
* @example
|
45
|
+
* ```ts
|
46
|
+
* import { encodeGetAccountsParams } "thirdweb/extensions/erc4337";
|
47
|
+
* const result = encodeGetAccountsParams({
|
48
|
+
* start: ...,
|
49
|
+
* end: ...,
|
50
|
+
* });
|
51
|
+
* ```
|
52
|
+
*/
|
53
|
+
export function encodeGetAccountsParams(options) {
|
54
|
+
return encodeAbiParameters(FN_INPUTS, [options.start, options.end]);
|
55
|
+
}
|
56
|
+
/**
|
57
|
+
* Encodes the "getAccounts" function into a Hex string with its parameters.
|
58
|
+
* @param options - The options for the getAccounts function.
|
59
|
+
* @returns The encoded hexadecimal string.
|
60
|
+
* @extension ERC4337
|
61
|
+
* @example
|
62
|
+
* ```ts
|
63
|
+
* import { encodeGetAccounts } "thirdweb/extensions/erc4337";
|
64
|
+
* const result = encodeGetAccounts({
|
65
|
+
* start: ...,
|
66
|
+
* end: ...,
|
67
|
+
* });
|
68
|
+
* ```
|
69
|
+
*/
|
70
|
+
export function encodeGetAccounts(options) {
|
71
|
+
// we do a "manual" concat here to avoid the overhead of the "concatHex" function
|
72
|
+
// we can do this because we know the specific formats of the values
|
73
|
+
return (FN_SELECTOR +
|
74
|
+
encodeGetAccountsParams(options).slice(2));
|
75
|
+
}
|
76
|
+
/**
|
77
|
+
* Decodes the result of the getAccounts function call.
|
78
|
+
* @param result - The hexadecimal result to decode.
|
79
|
+
* @returns The decoded result as per the FN_OUTPUTS definition.
|
80
|
+
* @extension ERC4337
|
81
|
+
* @example
|
82
|
+
* ```ts
|
83
|
+
* import { decodeGetAccountsResult } from "thirdweb/extensions/erc4337";
|
84
|
+
* const result = decodeGetAccountsResult("...");
|
85
|
+
* ```
|
86
|
+
*/
|
87
|
+
export function decodeGetAccountsResult(result) {
|
88
|
+
return decodeAbiParameters(FN_OUTPUTS, result)[0];
|
89
|
+
}
|
90
|
+
/**
|
91
|
+
* Calls the "getAccounts" function on the contract.
|
92
|
+
* @param options - The options for the getAccounts function.
|
93
|
+
* @returns The parsed result of the function call.
|
94
|
+
* @extension ERC4337
|
95
|
+
* @example
|
96
|
+
* ```ts
|
97
|
+
* import { getAccounts } from "thirdweb/extensions/erc4337";
|
98
|
+
*
|
99
|
+
* const result = await getAccounts({
|
100
|
+
* contract,
|
101
|
+
* start: ...,
|
102
|
+
* end: ...,
|
103
|
+
* });
|
104
|
+
*
|
105
|
+
* ```
|
106
|
+
*/
|
107
|
+
export async function getAccounts(options) {
|
108
|
+
return readContract({
|
109
|
+
contract: options.contract,
|
110
|
+
method: [FN_SELECTOR, FN_INPUTS, FN_OUTPUTS],
|
111
|
+
params: [options.start, options.end],
|
112
|
+
});
|
113
|
+
}
|
114
|
+
//# sourceMappingURL=getAccounts.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"getAccounts.js","sourceRoot":"","sources":["../../../../../../../src/extensions/erc4337/__generated__/IAccountFactory/read/getAccounts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,6CAA6C,CAAC;AAE3E,OAAO,EAAE,mBAAmB,EAAE,MAAM,iDAAiD,CAAC;AACtF,OAAO,EAAE,mBAAmB,EAAE,MAAM,MAAM,CAAC;AAG3C,OAAO,EAAE,YAAY,EAAE,MAAM,kDAAkD,CAAC;AAUhF,MAAM,CAAC,MAAM,WAAW,GAAG,YAAqB,CAAC;AACjD,MAAM,SAAS,GAAG;IAChB;QACE,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,OAAO;KACd;IACD;QACE,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,KAAK;KACZ;CACO,CAAC;AACX,MAAM,UAAU,GAAG;IACjB;QACE,IAAI,EAAE,WAAW;KAClB;CACO,CAAC;AAEX;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAAC,QAA+B;IAC1E,OAAO,YAAY,CAAC;QAClB,QAAQ;QACR,MAAM,EAAE,CAAC,WAAW,EAAE,SAAS,EAAE,UAAU,CAAU;KACtD,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,uBAAuB,CAAC,OAA0B;IAChE,OAAO,mBAAmB,CAAC,SAAS,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;AACtE,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAA0B;IAC1D,iFAAiF;IACjF,oEAAoE;IACpE,OAAO,CAAC,WAAW;QACjB,uBAAuB,CAAC,OAAO,CAAC,CAAC,KAAK,CACpC,CAAC,CACF,CAAqC,CAAC;AAC3C,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,uBAAuB,CAAC,MAAW;IACjD,OAAO,mBAAmB,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AACpD,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,OAAkD;IAElD,OAAO,YAAY,CAAC;QAClB,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,MAAM,EAAE,CAAC,WAAW,EAAE,SAAS,EAAE,UAAU,CAAU;QACrD,MAAM,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC;KACrC,CAAC,CAAC;AACL,CAAC"}
|
@@ -0,0 +1,107 @@
|
|
1
|
+
import { readContract } from "../../../../../transaction/read-contract.js";
|
2
|
+
import { encodeAbiParameters } from "../../../../../utils/abi/encodeAbiParameters.js";
|
3
|
+
import { decodeAbiParameters } from "viem";
|
4
|
+
import { detectMethod } from "../../../../../utils/bytecode/detectExtension.js";
|
5
|
+
export const FN_SELECTOR = "0xc3c5a547";
|
6
|
+
const FN_INPUTS = [
|
7
|
+
{
|
8
|
+
type: "address",
|
9
|
+
name: "account",
|
10
|
+
},
|
11
|
+
];
|
12
|
+
const FN_OUTPUTS = [
|
13
|
+
{
|
14
|
+
type: "bool",
|
15
|
+
},
|
16
|
+
];
|
17
|
+
/**
|
18
|
+
* Checks if the `isRegistered` method is supported by the given contract.
|
19
|
+
* @param contract The ThirdwebContract.
|
20
|
+
* @returns A promise that resolves to a boolean indicating if the `isRegistered` method is supported.
|
21
|
+
* @extension ERC4337
|
22
|
+
* @example
|
23
|
+
* ```ts
|
24
|
+
* import { isIsRegisteredSupported } from "thirdweb/extensions/erc4337";
|
25
|
+
*
|
26
|
+
* const supported = await isIsRegisteredSupported(contract);
|
27
|
+
* ```
|
28
|
+
*/
|
29
|
+
export async function isIsRegisteredSupported(contract) {
|
30
|
+
return detectMethod({
|
31
|
+
contract,
|
32
|
+
method: [FN_SELECTOR, FN_INPUTS, FN_OUTPUTS],
|
33
|
+
});
|
34
|
+
}
|
35
|
+
/**
|
36
|
+
* Encodes the parameters for the "isRegistered" function.
|
37
|
+
* @param options - The options for the isRegistered function.
|
38
|
+
* @returns The encoded ABI parameters.
|
39
|
+
* @extension ERC4337
|
40
|
+
* @example
|
41
|
+
* ```ts
|
42
|
+
* import { encodeIsRegisteredParams } "thirdweb/extensions/erc4337";
|
43
|
+
* const result = encodeIsRegisteredParams({
|
44
|
+
* account: ...,
|
45
|
+
* });
|
46
|
+
* ```
|
47
|
+
*/
|
48
|
+
export function encodeIsRegisteredParams(options) {
|
49
|
+
return encodeAbiParameters(FN_INPUTS, [options.account]);
|
50
|
+
}
|
51
|
+
/**
|
52
|
+
* Encodes the "isRegistered" function into a Hex string with its parameters.
|
53
|
+
* @param options - The options for the isRegistered function.
|
54
|
+
* @returns The encoded hexadecimal string.
|
55
|
+
* @extension ERC4337
|
56
|
+
* @example
|
57
|
+
* ```ts
|
58
|
+
* import { encodeIsRegistered } "thirdweb/extensions/erc4337";
|
59
|
+
* const result = encodeIsRegistered({
|
60
|
+
* account: ...,
|
61
|
+
* });
|
62
|
+
* ```
|
63
|
+
*/
|
64
|
+
export function encodeIsRegistered(options) {
|
65
|
+
// we do a "manual" concat here to avoid the overhead of the "concatHex" function
|
66
|
+
// we can do this because we know the specific formats of the values
|
67
|
+
return (FN_SELECTOR +
|
68
|
+
encodeIsRegisteredParams(options).slice(2));
|
69
|
+
}
|
70
|
+
/**
|
71
|
+
* Decodes the result of the isRegistered function call.
|
72
|
+
* @param result - The hexadecimal result to decode.
|
73
|
+
* @returns The decoded result as per the FN_OUTPUTS definition.
|
74
|
+
* @extension ERC4337
|
75
|
+
* @example
|
76
|
+
* ```ts
|
77
|
+
* import { decodeIsRegisteredResult } from "thirdweb/extensions/erc4337";
|
78
|
+
* const result = decodeIsRegisteredResult("...");
|
79
|
+
* ```
|
80
|
+
*/
|
81
|
+
export function decodeIsRegisteredResult(result) {
|
82
|
+
return decodeAbiParameters(FN_OUTPUTS, result)[0];
|
83
|
+
}
|
84
|
+
/**
|
85
|
+
* Calls the "isRegistered" function on the contract.
|
86
|
+
* @param options - The options for the isRegistered function.
|
87
|
+
* @returns The parsed result of the function call.
|
88
|
+
* @extension ERC4337
|
89
|
+
* @example
|
90
|
+
* ```ts
|
91
|
+
* import { isRegistered } from "thirdweb/extensions/erc4337";
|
92
|
+
*
|
93
|
+
* const result = await isRegistered({
|
94
|
+
* contract,
|
95
|
+
* account: ...,
|
96
|
+
* });
|
97
|
+
*
|
98
|
+
* ```
|
99
|
+
*/
|
100
|
+
export async function isRegistered(options) {
|
101
|
+
return readContract({
|
102
|
+
contract: options.contract,
|
103
|
+
method: [FN_SELECTOR, FN_INPUTS, FN_OUTPUTS],
|
104
|
+
params: [options.account],
|
105
|
+
});
|
106
|
+
}
|
107
|
+
//# sourceMappingURL=isRegistered.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"isRegistered.js","sourceRoot":"","sources":["../../../../../../../src/extensions/erc4337/__generated__/IAccountFactory/read/isRegistered.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,6CAA6C,CAAC;AAE3E,OAAO,EAAE,mBAAmB,EAAE,MAAM,iDAAiD,CAAC;AACtF,OAAO,EAAE,m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