permissionless 0.2.22 → 0.2.23
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/CHANGELOG.md +6 -0
- package/_cjs/accounts/etherspot/abi/EtherspotBootstrapAbi.js +97 -0
- package/_cjs/accounts/etherspot/abi/EtherspotBootstrapAbi.js.map +1 -0
- package/_cjs/accounts/etherspot/constants.js +20 -0
- package/_cjs/accounts/etherspot/constants.js.map +1 -0
- package/_cjs/accounts/etherspot/toEtherspotSmartAccount.js +186 -0
- package/_cjs/accounts/etherspot/toEtherspotSmartAccount.js.map +1 -0
- package/_cjs/accounts/etherspot/utils/getInitMSAData.js +46 -0
- package/_cjs/accounts/etherspot/utils/getInitMSAData.js.map +1 -0
- package/_cjs/accounts/etherspot/utils/getNonceKey.js +19 -0
- package/_cjs/accounts/etherspot/utils/getNonceKey.js.map +1 -0
- package/_cjs/accounts/etherspot/utils/wrapMessageHash.js +22 -0
- package/_cjs/accounts/etherspot/utils/wrapMessageHash.js.map +1 -0
- package/_cjs/accounts/index.js +3 -1
- package/_cjs/accounts/index.js.map +1 -1
- package/_cjs/actions/etherspot/getUserOperationGasPrice.js +15 -0
- package/_cjs/actions/etherspot/getUserOperationGasPrice.js.map +1 -0
- package/_cjs/actions/etherspot.js +6 -0
- package/_cjs/actions/etherspot.js.map +1 -0
- package/_cjs/types/etherspot.js +3 -0
- package/_cjs/types/etherspot.js.map +1 -0
- package/_esm/accounts/etherspot/abi/EtherspotBootstrapAbi.js +94 -0
- package/_esm/accounts/etherspot/abi/EtherspotBootstrapAbi.js.map +1 -0
- package/_esm/accounts/etherspot/constants.js +17 -0
- package/_esm/accounts/etherspot/constants.js.map +1 -0
- package/_esm/accounts/etherspot/toEtherspotSmartAccount.js +212 -0
- package/_esm/accounts/etherspot/toEtherspotSmartAccount.js.map +1 -0
- package/_esm/accounts/etherspot/utils/getInitMSAData.js +42 -0
- package/_esm/accounts/etherspot/utils/getInitMSAData.js.map +1 -0
- package/_esm/accounts/etherspot/utils/getNonceKey.js +15 -0
- package/_esm/accounts/etherspot/utils/getNonceKey.js.map +1 -0
- package/_esm/accounts/etherspot/utils/wrapMessageHash.js +18 -0
- package/_esm/accounts/etherspot/utils/wrapMessageHash.js.map +1 -0
- package/_esm/accounts/index.js +2 -1
- package/_esm/accounts/index.js.map +1 -1
- package/_esm/actions/etherspot/getUserOperationGasPrice.js +17 -0
- package/_esm/actions/etherspot/getUserOperationGasPrice.js.map +1 -0
- package/_esm/actions/etherspot.js +3 -0
- package/_esm/actions/etherspot.js.map +1 -0
- package/_esm/types/etherspot.js +2 -0
- package/_esm/types/etherspot.js.map +1 -0
- package/_types/accounts/etherspot/abi/EtherspotBootstrapAbi.d.ts +28 -0
- package/_types/accounts/etherspot/abi/EtherspotBootstrapAbi.d.ts.map +1 -0
- package/_types/accounts/etherspot/constants.d.ts +18 -0
- package/_types/accounts/etherspot/constants.d.ts.map +1 -0
- package/_types/accounts/etherspot/toEtherspotSmartAccount.d.ts +24 -0
- package/_types/accounts/etherspot/toEtherspotSmartAccount.d.ts.map +1 -0
- package/_types/accounts/etherspot/utils/getInitMSAData.d.ts +3 -0
- package/_types/accounts/etherspot/utils/getInitMSAData.d.ts.map +1 -0
- package/_types/accounts/etherspot/utils/getNonceKey.d.ts +3 -0
- package/_types/accounts/etherspot/utils/getNonceKey.d.ts.map +1 -0
- package/_types/accounts/etherspot/utils/wrapMessageHash.d.ts +8 -0
- package/_types/accounts/etherspot/utils/wrapMessageHash.d.ts.map +1 -0
- package/_types/accounts/index.d.ts +2 -1
- package/_types/accounts/index.d.ts.map +1 -1
- package/_types/actions/etherspot/getUserOperationGasPrice.d.ts +14 -0
- package/_types/actions/etherspot/getUserOperationGasPrice.d.ts.map +1 -0
- package/_types/actions/etherspot.d.ts +3 -0
- package/_types/actions/etherspot.d.ts.map +1 -0
- package/_types/types/etherspot.d.ts +13 -0
- package/_types/types/etherspot.d.ts.map +1 -0
- package/accounts/etherspot/abi/EtherspotBootstrapAbi.ts +94 -0
- package/accounts/etherspot/constants.ts +27 -0
- package/accounts/etherspot/toEtherspotSmartAccount.ts +360 -0
- package/accounts/etherspot/utils/getInitMSAData.ts +56 -0
- package/accounts/etherspot/utils/getNonceKey.ts +21 -0
- package/accounts/etherspot/utils/wrapMessageHash.ts +42 -0
- package/accounts/index.ts +12 -1
- package/actions/etherspot/getUserOperationGasPrice.ts +32 -0
- package/actions/etherspot.ts +6 -0
- package/package.json +6 -1
- package/types/etherspot.ts +12 -0
package/CHANGELOG.md
CHANGED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EtherspotOnInstallAbi = exports.EtherspotBootstrapAbi = void 0;
|
|
4
|
+
exports.EtherspotBootstrapAbi = [
|
|
5
|
+
{
|
|
6
|
+
inputs: [
|
|
7
|
+
{
|
|
8
|
+
components: [
|
|
9
|
+
{
|
|
10
|
+
internalType: "address",
|
|
11
|
+
name: "module",
|
|
12
|
+
type: "address"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
internalType: "bytes",
|
|
16
|
+
name: "data",
|
|
17
|
+
type: "bytes"
|
|
18
|
+
}
|
|
19
|
+
],
|
|
20
|
+
internalType: "struct BootstrapConfig[]",
|
|
21
|
+
name: "$valdiators",
|
|
22
|
+
type: "tuple[]"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
components: [
|
|
26
|
+
{
|
|
27
|
+
internalType: "address",
|
|
28
|
+
name: "module",
|
|
29
|
+
type: "address"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
internalType: "bytes",
|
|
33
|
+
name: "data",
|
|
34
|
+
type: "bytes"
|
|
35
|
+
}
|
|
36
|
+
],
|
|
37
|
+
internalType: "struct BootstrapConfig[]",
|
|
38
|
+
name: "$executors",
|
|
39
|
+
type: "tuple[]"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
components: [
|
|
43
|
+
{
|
|
44
|
+
internalType: "address",
|
|
45
|
+
name: "module",
|
|
46
|
+
type: "address"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
internalType: "bytes",
|
|
50
|
+
name: "data",
|
|
51
|
+
type: "bytes"
|
|
52
|
+
}
|
|
53
|
+
],
|
|
54
|
+
internalType: "struct BootstrapConfig",
|
|
55
|
+
name: "_hook",
|
|
56
|
+
type: "tuple"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
components: [
|
|
60
|
+
{
|
|
61
|
+
internalType: "address",
|
|
62
|
+
name: "module",
|
|
63
|
+
type: "address"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
internalType: "bytes",
|
|
67
|
+
name: "data",
|
|
68
|
+
type: "bytes"
|
|
69
|
+
}
|
|
70
|
+
],
|
|
71
|
+
internalType: "struct BootstrapConfig[]",
|
|
72
|
+
name: "_fallbacks",
|
|
73
|
+
type: "tuple[]"
|
|
74
|
+
}
|
|
75
|
+
],
|
|
76
|
+
name: "initMSA",
|
|
77
|
+
outputs: [],
|
|
78
|
+
stateMutability: "nonpayable",
|
|
79
|
+
type: "function"
|
|
80
|
+
}
|
|
81
|
+
];
|
|
82
|
+
exports.EtherspotOnInstallAbi = [
|
|
83
|
+
{
|
|
84
|
+
inputs: [
|
|
85
|
+
{
|
|
86
|
+
internalType: "bytes",
|
|
87
|
+
name: "data",
|
|
88
|
+
type: "bytes"
|
|
89
|
+
}
|
|
90
|
+
],
|
|
91
|
+
name: "onInstall",
|
|
92
|
+
outputs: [],
|
|
93
|
+
stateMutability: "nonpayable",
|
|
94
|
+
type: "function"
|
|
95
|
+
}
|
|
96
|
+
];
|
|
97
|
+
//# sourceMappingURL=EtherspotBootstrapAbi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EtherspotBootstrapAbi.js","sourceRoot":"","sources":["../../../../accounts/etherspot/abi/EtherspotBootstrapAbi.ts"],"names":[],"mappings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SAAS;QACf,OAAO,EAAE,EAAE;QACX,eAAe,EAAE,YAAY;QAC7B,IAAI,EAAE,UAAU;KACnB;CACJ,CAAA;AAEY,QAAA,qBAAqB,GAAG;IACjC;QACI,MAAM,EAAE;YACJ;gBACI,YAAY,EAAE,OAAO;gBACrB,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,OAAO;aAChB;SACJ;QACD,IAAI,EAAE,WAAW;QACjB,OAAO,EAAE,EAAE;QACX,eAAe,EAAE,YAAY;QAC7B,IAAI,EAAE,UAAU;KACnB;CACK,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEFAULT_CONTRACT_ADDRESS = exports.VALIDATOR_MODE = exports.VALIDATOR_TYPE = exports.DUMMY_ECDSA_SIGNATURE = void 0;
|
|
4
|
+
exports.DUMMY_ECDSA_SIGNATURE = "0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c";
|
|
5
|
+
exports.VALIDATOR_TYPE = {
|
|
6
|
+
ROOT: "0x00",
|
|
7
|
+
VALIDATOR: "0x01",
|
|
8
|
+
PERMISSION: "0x02"
|
|
9
|
+
};
|
|
10
|
+
var VALIDATOR_MODE;
|
|
11
|
+
(function (VALIDATOR_MODE) {
|
|
12
|
+
VALIDATOR_MODE["DEFAULT"] = "0x00";
|
|
13
|
+
VALIDATOR_MODE["ENABLE"] = "0x01";
|
|
14
|
+
})(VALIDATOR_MODE || (exports.VALIDATOR_MODE = VALIDATOR_MODE = {}));
|
|
15
|
+
exports.DEFAULT_CONTRACT_ADDRESS = {
|
|
16
|
+
metaFactoryAddress: "0x93FB56A4a0B7160fbf8903d251Cc7A3fb9bA0933",
|
|
17
|
+
bootstrapAddress: "0x1baCB2F1ef4fD02f02e32cCF70888D9Caeb5f066",
|
|
18
|
+
validatorAddress: "0x7aCEE15c9FFc1e8f287C26E0f4C8244A0729F557"
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../accounts/etherspot/constants.ts"],"names":[],"mappings":";;;AAEa,QAAA,qBAAqB,GAC9B,sIAAsI,CAAA;AAE7H,QAAA,cAAc,GAAG;IAC1B,IAAI,EAAE,MAAM;IACZ,SAAS,EAAE,MAAM;IACjB,UAAU,EAAE,MAAM;CACZ,CAAA;AAEV,IAAY,cAGX;AAHD,WAAY,cAAc;IACtB,kCAAgB,CAAA;IAChB,iCAAe,CAAA;AACnB,CAAC,EAHW,cAAc,8BAAd,cAAc,QAGzB;AAQY,QAAA,wBAAwB,GAAqB;IACtD,kBAAkB,EAAE,4CAA4C;IAChE,gBAAgB,EAAE,4CAA4C;IAC9D,gBAAgB,EAAE,4CAA4C;CACjE,CAAA"}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toEtherspotSmartAccount = toEtherspotSmartAccount;
|
|
4
|
+
const viem_1 = require("viem");
|
|
5
|
+
const account_abstraction_1 = require("viem/account-abstraction");
|
|
6
|
+
const actions_1 = require("viem/actions");
|
|
7
|
+
const utils_1 = require("viem/utils");
|
|
8
|
+
const getAccountNonce_js_1 = require("../../actions/public/getAccountNonce.js");
|
|
9
|
+
const getSenderAddress_js_1 = require("../../actions/public/getSenderAddress.js");
|
|
10
|
+
const encode7579Calls_js_1 = require("../../utils/encode7579Calls.js");
|
|
11
|
+
const index_js_1 = require("../../utils/index.js");
|
|
12
|
+
const constants_js_1 = require("./constants.js");
|
|
13
|
+
const getInitMSAData_js_1 = require("./utils/getInitMSAData.js");
|
|
14
|
+
const getNonceKey_js_1 = require("./utils/getNonceKey.js");
|
|
15
|
+
const createAccountAbi = [
|
|
16
|
+
{
|
|
17
|
+
inputs: [
|
|
18
|
+
{
|
|
19
|
+
internalType: "bytes32",
|
|
20
|
+
name: "salt",
|
|
21
|
+
type: "bytes32"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
internalType: "bytes",
|
|
25
|
+
name: "initCode",
|
|
26
|
+
type: "bytes"
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
name: "createAccount",
|
|
30
|
+
outputs: [
|
|
31
|
+
{
|
|
32
|
+
internalType: "address",
|
|
33
|
+
name: "",
|
|
34
|
+
type: "address"
|
|
35
|
+
}
|
|
36
|
+
],
|
|
37
|
+
stateMutability: "payable",
|
|
38
|
+
type: "function"
|
|
39
|
+
}
|
|
40
|
+
];
|
|
41
|
+
const getDefaultAddresses = ({ validatorAddress: _validatorAddress, metaFactoryAddress: _metaFactoryAddress, bootstrapAddress: _bootstrapAddress }) => {
|
|
42
|
+
const addresses = constants_js_1.DEFAULT_CONTRACT_ADDRESS;
|
|
43
|
+
const validatorAddress = _validatorAddress ?? addresses.validatorAddress;
|
|
44
|
+
const metaFactoryAddress = _metaFactoryAddress ?? addresses?.metaFactoryAddress ?? viem_1.zeroAddress;
|
|
45
|
+
const bootstrapAddress = _bootstrapAddress ?? addresses.bootstrapAddress ?? viem_1.zeroAddress;
|
|
46
|
+
return {
|
|
47
|
+
validatorAddress,
|
|
48
|
+
metaFactoryAddress,
|
|
49
|
+
bootstrapAddress
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
const getInitialisationData = ({ owner, validatorAddress, bootstrapAddress }) => {
|
|
53
|
+
const initMSAData = (0, getInitMSAData_js_1.getInitMSAData)(validatorAddress);
|
|
54
|
+
const initCode = (0, viem_1.encodeAbiParameters)([{ type: "address" }, { type: "address" }, { type: "bytes" }], [owner, bootstrapAddress, initMSAData]);
|
|
55
|
+
return initCode;
|
|
56
|
+
};
|
|
57
|
+
const getAccountInitCode = async ({ owner, index, validatorAddress, bootstrapAddress }) => {
|
|
58
|
+
if (!owner)
|
|
59
|
+
throw new Error("Owner account not found");
|
|
60
|
+
const initialisationData = getInitialisationData({
|
|
61
|
+
validatorAddress,
|
|
62
|
+
owner,
|
|
63
|
+
bootstrapAddress
|
|
64
|
+
});
|
|
65
|
+
return (0, viem_1.encodeFunctionData)({
|
|
66
|
+
abi: createAccountAbi,
|
|
67
|
+
functionName: "createAccount",
|
|
68
|
+
args: [(0, viem_1.toHex)(index, { size: 32 }), initialisationData]
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
async function toEtherspotSmartAccount(parameters) {
|
|
72
|
+
const { client, owners, address, index = BigInt(0), metaFactoryAddress: _metaFactoryAddress, validatorAddress: _validatorAddress, bootstrapAddress: _bootstrapAddress } = parameters;
|
|
73
|
+
const localOwner = await (0, index_js_1.toOwner)({ owner: owners[0] });
|
|
74
|
+
const entryPoint = {
|
|
75
|
+
address: parameters.entryPoint?.address ?? account_abstraction_1.entryPoint07Address,
|
|
76
|
+
abi: account_abstraction_1.entryPoint07Abi,
|
|
77
|
+
version: parameters.entryPoint?.version ?? "0.7"
|
|
78
|
+
};
|
|
79
|
+
const { validatorAddress, metaFactoryAddress, bootstrapAddress } = getDefaultAddresses({
|
|
80
|
+
validatorAddress: _validatorAddress,
|
|
81
|
+
metaFactoryAddress: _metaFactoryAddress,
|
|
82
|
+
bootstrapAddress: _bootstrapAddress
|
|
83
|
+
});
|
|
84
|
+
const generateInitCode = () => getAccountInitCode({
|
|
85
|
+
owner: localOwner.address,
|
|
86
|
+
index,
|
|
87
|
+
validatorAddress,
|
|
88
|
+
bootstrapAddress
|
|
89
|
+
});
|
|
90
|
+
let accountAddress = address;
|
|
91
|
+
let chainId;
|
|
92
|
+
const getMemoizedChainId = async () => {
|
|
93
|
+
if (chainId)
|
|
94
|
+
return chainId;
|
|
95
|
+
chainId = client.chain
|
|
96
|
+
? client.chain.id
|
|
97
|
+
: await (0, utils_1.getAction)(client, actions_1.getChainId, "getChainId")({});
|
|
98
|
+
return chainId;
|
|
99
|
+
};
|
|
100
|
+
const getFactoryArgs = async () => {
|
|
101
|
+
return {
|
|
102
|
+
factory: metaFactoryAddress,
|
|
103
|
+
factoryData: await generateInitCode()
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
return (0, account_abstraction_1.toSmartAccount)({
|
|
107
|
+
client,
|
|
108
|
+
entryPoint,
|
|
109
|
+
getFactoryArgs,
|
|
110
|
+
async getAddress() {
|
|
111
|
+
if (accountAddress)
|
|
112
|
+
return accountAddress;
|
|
113
|
+
const { factory, factoryData } = await getFactoryArgs();
|
|
114
|
+
accountAddress = await (0, getSenderAddress_js_1.getSenderAddress)(client, {
|
|
115
|
+
factory,
|
|
116
|
+
factoryData,
|
|
117
|
+
entryPointAddress: entryPoint.address
|
|
118
|
+
});
|
|
119
|
+
return accountAddress;
|
|
120
|
+
},
|
|
121
|
+
async encodeCalls(calls) {
|
|
122
|
+
return (0, encode7579Calls_js_1.encode7579Calls)({
|
|
123
|
+
mode: {
|
|
124
|
+
type: calls.length > 1 ? "batchcall" : "call",
|
|
125
|
+
revertOnError: false,
|
|
126
|
+
selector: "0x",
|
|
127
|
+
context: "0x"
|
|
128
|
+
},
|
|
129
|
+
callData: calls
|
|
130
|
+
});
|
|
131
|
+
},
|
|
132
|
+
async getNonce(_args) {
|
|
133
|
+
return (0, getAccountNonce_js_1.getAccountNonce)(client, {
|
|
134
|
+
address: await this.getAddress(),
|
|
135
|
+
entryPointAddress: entryPoint.address,
|
|
136
|
+
key: (0, getNonceKey_js_1.getNonceKeyWithEncoding)(validatorAddress, parameters.nonceKey ?? 0n)
|
|
137
|
+
});
|
|
138
|
+
},
|
|
139
|
+
async getStubSignature() {
|
|
140
|
+
return constants_js_1.DUMMY_ECDSA_SIGNATURE;
|
|
141
|
+
},
|
|
142
|
+
async sign({ hash }) {
|
|
143
|
+
return this.signMessage({ message: hash });
|
|
144
|
+
},
|
|
145
|
+
async signMessage({ message }) {
|
|
146
|
+
let signature = await localOwner.signMessage({
|
|
147
|
+
message
|
|
148
|
+
});
|
|
149
|
+
const potentiallyIncorrectV = Number.parseInt(signature.slice(-2), 16);
|
|
150
|
+
if (![27, 28].includes(potentiallyIncorrectV)) {
|
|
151
|
+
const correctV = potentiallyIncorrectV + 27;
|
|
152
|
+
signature = (signature.slice(0, -2) +
|
|
153
|
+
correctV.toString(16));
|
|
154
|
+
}
|
|
155
|
+
return (0, viem_1.encodePacked)(["address", "bytes"], [validatorAddress, signature]);
|
|
156
|
+
},
|
|
157
|
+
async signTypedData(typedData) {
|
|
158
|
+
let signature = await localOwner.signTypedData(typedData);
|
|
159
|
+
const potentiallyIncorrectV = Number.parseInt(signature.slice(-2), 16);
|
|
160
|
+
if (![27, 28].includes(potentiallyIncorrectV)) {
|
|
161
|
+
const correctV = potentiallyIncorrectV + 27;
|
|
162
|
+
signature = (signature.slice(0, -2) +
|
|
163
|
+
correctV.toString(16));
|
|
164
|
+
}
|
|
165
|
+
return (0, viem_1.encodePacked)(["address", "bytes"], [validatorAddress, signature]);
|
|
166
|
+
},
|
|
167
|
+
async signUserOperation(parameters) {
|
|
168
|
+
const { chainId = await getMemoizedChainId(), ...userOperation } = parameters;
|
|
169
|
+
const hash = (0, account_abstraction_1.getUserOperationHash)({
|
|
170
|
+
userOperation: {
|
|
171
|
+
...userOperation,
|
|
172
|
+
sender: userOperation.sender ?? (await this.getAddress()),
|
|
173
|
+
signature: "0x"
|
|
174
|
+
},
|
|
175
|
+
entryPointAddress: entryPoint.address,
|
|
176
|
+
entryPointVersion: entryPoint.version,
|
|
177
|
+
chainId: chainId
|
|
178
|
+
});
|
|
179
|
+
const signature = await localOwner.signMessage({
|
|
180
|
+
message: { raw: hash }
|
|
181
|
+
});
|
|
182
|
+
return signature;
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
//# sourceMappingURL=toEtherspotSmartAccount.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toEtherspotSmartAccount.js","sourceRoot":"","sources":["../../../accounts/etherspot/toEtherspotSmartAccount.ts"],"names":[],"mappings":";;AAwMA,0DA+JC;AAvWD,+BAiBa;AACb,kEAQiC;AACjC,0CAAyC;AACzC,sCAAsC;AACtC,gFAAyE;AACzE,kFAA2E;AAC3E,uEAAgE;AAChE,mDAA8C;AAC9C,iDAIuB;AACvB,iEAA0D;AAC1D,2DAAgE;AAKhE,MAAM,gBAAgB,GAAG;IACrB;QACI,MAAM,EAAE;YACJ;gBACI,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,SAAS;aAClB;YACD;gBACI,YAAY,EAAE,OAAO;gBACrB,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,OAAO;aAChB;SACJ;QACD,IAAI,EAAE,eAAe;QACrB,OAAO,EAAE;YACL;gBACI,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,EAAE;gBACR,IAAI,EAAE,SAAS;aAClB;SACJ;QACD,eAAe,EAAE,SAAS;QAC1B,IAAI,EAAE,UAAU;KACnB;CACK,CAAA;AAUV,MAAM,mBAAmB,GAAG,CAAC,EACzB,gBAAgB,EAAE,iBAAiB,EACnC,kBAAkB,EAAE,mBAAmB,EACvC,gBAAgB,EAAE,iBAAiB,EACX,EAAoB,EAAE;IAC9C,MAAM,SAAS,GAAG,uCAAwB,CAAA;IAC1C,MAAM,gBAAgB,GAAG,iBAAiB,IAAI,SAAS,CAAC,gBAAgB,CAAA;IACxE,MAAM,kBAAkB,GACpB,mBAAmB,IAAI,SAAS,EAAE,kBAAkB,IAAI,kBAAW,CAAA;IACvE,MAAM,gBAAgB,GAClB,iBAAiB,IAAI,SAAS,CAAC,gBAAgB,IAAI,kBAAW,CAAA;IAElE,OAAO;QACH,gBAAgB;QAChB,kBAAkB;QAClB,gBAAgB;KACnB,CAAA;AACL,CAAC,CAAA;AAQD,MAAM,qBAAqB,GAAG,CAAC,EAC3B,KAAK,EACL,gBAAgB,EAChB,gB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AAI,GAAG,IAAA,0CAAoB,EAAC;gBAC9B,aAAa,EAAE;oBACX,GAAG,aAAa;oBAChB,MAAM,EAAE,aAAa,CAAC,MAAM,IAAI,CAAC,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC;oBACzD,SAAS,EAAE,IAAI;iBACkB;gBACrC,iBAAiB,EAAE,UAAU,CAAC,OAAO;gBACrC,iBAAiB,EAAE,UAAU,CAAC,OAAO;gBACrC,OAAO,EAAE,OAAO;aACnB,CAAC,CAAA;YAEF,MAAM,SAAS,GAAG,MAAM,UAAU,CAAC,WAAW,CAAC;gBAC3C,OAAO,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE;aACzB,CAAC,CAAA;YAEF,OAAO,SAAS,CAAA;QACpB,CAAC;KACJ,CAAkE,CAAA;AACvE,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getInitMSAData = void 0;
|
|
4
|
+
const viem_1 = require("viem");
|
|
5
|
+
const EtherspotBootstrapAbi_js_1 = require("../abi/EtherspotBootstrapAbi.js");
|
|
6
|
+
const getInitMSAData = (ecdsaValidatorAddress) => {
|
|
7
|
+
const validators = makeBootstrapConfig(ecdsaValidatorAddress, "0x");
|
|
8
|
+
const executors = makeBootstrapConfig(viem_1.zeroAddress, "0x");
|
|
9
|
+
const hook = _makeBootstrapConfig(viem_1.zeroAddress, "0x");
|
|
10
|
+
const fallbacks = makeBootstrapConfig(viem_1.zeroAddress, "0x");
|
|
11
|
+
const initMSAData = (0, viem_1.encodeFunctionData)({
|
|
12
|
+
abi: EtherspotBootstrapAbi_js_1.EtherspotBootstrapAbi,
|
|
13
|
+
functionName: "initMSA",
|
|
14
|
+
args: [validators, executors, hook, fallbacks]
|
|
15
|
+
});
|
|
16
|
+
return initMSAData;
|
|
17
|
+
};
|
|
18
|
+
exports.getInitMSAData = getInitMSAData;
|
|
19
|
+
const _makeBootstrapConfig = (module, data) => {
|
|
20
|
+
const config = {
|
|
21
|
+
module: "",
|
|
22
|
+
data: ""
|
|
23
|
+
};
|
|
24
|
+
config.module = module;
|
|
25
|
+
config.data = (0, viem_1.encodeFunctionData)({
|
|
26
|
+
abi: EtherspotBootstrapAbi_js_1.EtherspotOnInstallAbi,
|
|
27
|
+
functionName: "onInstall",
|
|
28
|
+
args: [data]
|
|
29
|
+
});
|
|
30
|
+
return config;
|
|
31
|
+
};
|
|
32
|
+
const makeBootstrapConfig = (module, data) => {
|
|
33
|
+
const config = [];
|
|
34
|
+
const data1 = (0, viem_1.encodeFunctionData)({
|
|
35
|
+
abi: EtherspotBootstrapAbi_js_1.EtherspotOnInstallAbi,
|
|
36
|
+
functionName: "onInstall",
|
|
37
|
+
args: [data]
|
|
38
|
+
});
|
|
39
|
+
const newConfig = {
|
|
40
|
+
module: module,
|
|
41
|
+
data: data1
|
|
42
|
+
};
|
|
43
|
+
config.push(newConfig);
|
|
44
|
+
return config;
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=getInitMSAData.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getInitMSAData.js","sourceRoot":"","sources":["../../../../accounts/etherspot/utils/getInitMSAData.ts"],"names":[],"mappings":";;;AAAA,+BAAoE;AACpE,8EAGwC;AAEjC,MAAM,cAAc,GAAG,CAAC,qBAA8B,EAAE,EAAE;IAC7D,MAAM,UAAU,GAAG,mBAAmB,CAAC,qBAAqB,EAAE,IAAI,CAAC,CAAA;IACnE,MAAM,SAAS,GAAG,mBAAmB,CAAC,kBAAW,EAAE,IAAI,CAAC,CAAA;IACxD,MAAM,IAAI,GAAG,oBAAoB,CAAC,kBAAW,EAAE,IAAI,CAAC,CAAA;IACpD,MAAM,SAAS,GAAG,mBAAmB,CAAC,kBAAW,EAAE,IAAI,CAAC,CAAA;IACxD,MAAM,WAAW,GAAG,IAAA,yBAAkB,EAAC;QACnC,GAAG,EAAE,gDAAqB;QAC1B,YAAY,EAAE,SAAS;QACvB,IAAI,EAAE,CAAC,UAAU,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,CAAC;KACjD,CAAC,CAAA;IAEF,OAAO,WAAW,CAAA;AACtB,CAAC,CAAA;AAZY,QAAA,cAAc,kBAY1B;AAED,MAAM,oBAAoB,GAAG,CAAC,MAAc,EAAE,IAAY,EAAE,EAAE;IAC1D,MAAM,MAAM,GAAG;QACX,MAAM,EAAE,EAAE;QACV,IAAI,EAAE,EAAE;KACX,CAAA;IAED,MAAM,CAAC,MAAM,GAAG,MAAM,CAAA;IAEtB,MAAM,CAAC,IAAI,GAAG,IAAA,yBAAkB,EAAC;QAC7B,GAAG,EAAE,gDAAqB;QAC1B,YAAY,EAAE,WAAW;QACzB,IAAI,EAAE,CAAC,IAAqB,CAAC;KAChC,CAAC,CAAA;IAEF,OAAO,MAAM,CAAA;AACjB,CAAC,CAAA;AAED,MAAM,mBAAmB,GAAG,CAAC,MAAc,EAAE,IAAY,EAAE,EAAE;IACzD,MAAM,MAAM,GAGN,EAAE,CAAA;IAER,MAAM,KAAK,GAAG,IAAA,yBAAkB,EAAC;QAC7B,GAAG,EAAE,gDAAqB;QAC1B,YAAY,EAAE,WAAW;QACzB,IAAI,EAAE,CAAC,IAAqB,CAAC;KAChC,CAAC,CAAA;IAEF,MAAM,SAAS,GAAG;QACd,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,KAAK;KACd,CAAA;IACD,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;IACtB,OAAO,MAAM,CAAA;AACjB,CAAC,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getNonceKeyWithEncoding = void 0;
|
|
4
|
+
const viem_1 = require("viem");
|
|
5
|
+
const constants_js_1 = require("../constants.js");
|
|
6
|
+
const getNonceKeyWithEncoding = (validatorAddress, nonceKey = 0n) => {
|
|
7
|
+
const validatorMode = constants_js_1.VALIDATOR_MODE.DEFAULT;
|
|
8
|
+
const validatorType = constants_js_1.VALIDATOR_TYPE.ROOT;
|
|
9
|
+
const encoding = (0, viem_1.pad)((0, viem_1.concatHex)([
|
|
10
|
+
validatorAddress,
|
|
11
|
+
validatorMode,
|
|
12
|
+
validatorType,
|
|
13
|
+
(0, viem_1.toHex)(nonceKey, { size: 2 })
|
|
14
|
+
]), { size: 24 });
|
|
15
|
+
const encodedNonceKey = BigInt(encoding);
|
|
16
|
+
return encodedNonceKey;
|
|
17
|
+
};
|
|
18
|
+
exports.getNonceKeyWithEncoding = getNonceKeyWithEncoding;
|
|
19
|
+
//# sourceMappingURL=getNonceKey.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getNonceKey.js","sourceRoot":"","sources":["../../../../accounts/etherspot/utils/getNonceKey.ts"],"names":[],"mappings":";;;AAAA,+BAA0D;AAC1D,kDAAgE;AAEzD,MAAM,uBAAuB,GAAG,CACnC,gBAAyB,EACzB,QAAQ,GAAG,EAAE,EACf,EAAE;IACA,MAAM,aAAa,GAAG,6BAAc,CAAC,OAAO,CAAA;IAC5C,MAAM,aAAa,GAAG,6BAAc,CAAC,IAAI,CAAA;IACzC,MAAM,QAAQ,GAAG,IAAA,UAAG,EAChB,IAAA,gBAAS,EAAC;QACN,gBAAgB;QAChB,aAAa;QACb,aAAa;QACb,IAAA,YAAK,EAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;KAC/B,CAAC,EACF,EAAE,IAAI,EAAE,EAAE,EAAE,CACf,CAAA;IACD,MAAM,eAAe,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAA;IACxC,OAAO,eAAe,CAAA;AAC1B,CAAC,CAAA;AAjBY,QAAA,uBAAuB,2BAiBnC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.wrapMessageHash = void 0;
|
|
4
|
+
const viem_1 = require("viem");
|
|
5
|
+
const viem_2 = require("viem");
|
|
6
|
+
const wrapMessageHash = (messageHash, { accountAddress, chainId }) => {
|
|
7
|
+
const _domainSeparator = (0, viem_2.domainSeparator)({
|
|
8
|
+
domain: {
|
|
9
|
+
name: "ModularEtherspotWallet",
|
|
10
|
+
chainId,
|
|
11
|
+
verifyingContract: accountAddress
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
const wrappedMessageHash = (0, viem_1.keccak256)((0, viem_1.encodeAbiParameters)([{ type: "bytes32" }, { type: "bytes32" }], [
|
|
15
|
+
(0, viem_1.keccak256)((0, viem_1.stringToHex)("ModularEtherspotWallet(bytes32 hash)")),
|
|
16
|
+
messageHash
|
|
17
|
+
]));
|
|
18
|
+
const digest = (0, viem_1.keccak256)((0, viem_1.concatHex)(["0x1901", _domainSeparator, wrappedMessageHash]));
|
|
19
|
+
return digest;
|
|
20
|
+
};
|
|
21
|
+
exports.wrapMessageHash = wrapMessageHash;
|
|
22
|
+
//# sourceMappingURL=wrapMessageHash.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wrapMessageHash.js","sourceRoot":"","sources":["../../../../accounts/etherspot/utils/wrapMessageHash.ts"],"names":[],"mappings":";;;AAAA,+BAMa;AACb,+BAAoD;AAO7C,MAAM,eAAe,GAAG,CAC3B,WAAgB,EAChB,EAAE,cAAc,EAAE,OAAO,EAAyB,EACpD,EAAE;IACA,MAAM,gBAAgB,GAAG,IAAA,sBAAe,EAAC;QACrC,MAAM,EAAE;YACJ,IAAI,EAAE,wBAAwB;YAC9B,OAAO;YACP,iBAAiB,EAAE,cAAc;SACpC;KACJ,CAAC,CAAA;IAEF,MAAM,kBAAkB,GAAG,IAAA,gBAAS,EAChC,IAAA,0BAAmB,EACf,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,EAC1C;QACI,IAAA,gBAAS,EAAC,IAAA,kBAAW,EAAC,sCAAsC,CAAC,CAAC;QAC9D,WAAW;KACd,CACJ,CACJ,CAAA;IAED,MAAM,MAAM,GAAG,IAAA,gBAAS,EACpB,IAAA,gBAAS,EAAC,CAAC,QAAQ,EAAE,gBAAgB,EAAE,kBAAkB,CAAC,CAAC,CAC9D,CAAA;IAED,OAAO,MAAM,CAAA;AACjB,CAAC,CAAA;AA3BY,QAAA,eAAe,mBA2B3B"}
|
package/_cjs/accounts/index.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toThirdwebSmartAccount = exports.toBiconomySmartAccount = exports.toNexusSmartAccount = exports.toKernelSmartAccount = exports.toEcdsaKernelSmartAccount = exports.toSafeSmartAccount = exports.toTrustSmartAccount = exports.toLightSmartAccount = exports.toSimpleSmartAccount = void 0;
|
|
3
|
+
exports.toEtherspotSmartAccount = exports.toThirdwebSmartAccount = exports.toBiconomySmartAccount = exports.toNexusSmartAccount = exports.toKernelSmartAccount = exports.toEcdsaKernelSmartAccount = exports.toSafeSmartAccount = exports.toTrustSmartAccount = exports.toLightSmartAccount = exports.toSimpleSmartAccount = void 0;
|
|
4
4
|
const toSimpleSmartAccount_js_1 = require("./simple/toSimpleSmartAccount.js");
|
|
5
5
|
Object.defineProperty(exports, "toSimpleSmartAccount", { enumerable: true, get: function () { return toSimpleSmartAccount_js_1.toSimpleSmartAccount; } });
|
|
6
6
|
const toLightSmartAccount_js_1 = require("./light/toLightSmartAccount.js");
|
|
7
7
|
Object.defineProperty(exports, "toLightSmartAccount", { enumerable: true, get: function () { return toLightSmartAccount_js_1.toLightSmartAccount; } });
|
|
8
8
|
const toTrustSmartAccount_js_1 = require("./trust/toTrustSmartAccount.js");
|
|
9
9
|
Object.defineProperty(exports, "toTrustSmartAccount", { enumerable: true, get: function () { return toTrustSmartAccount_js_1.toTrustSmartAccount; } });
|
|
10
|
+
const toEtherspotSmartAccount_js_1 = require("./etherspot/toEtherspotSmartAccount.js");
|
|
11
|
+
Object.defineProperty(exports, "toEtherspotSmartAccount", { enumerable: true, get: function () { return toEtherspotSmartAccount_js_1.toEtherspotSmartAccount; } });
|
|
10
12
|
const toSafeSmartAccount_js_1 = require("./safe/toSafeSmartAccount.js");
|
|
11
13
|
Object.defineProperty(exports, "toSafeSmartAccount", { enumerable: true, get: function () { return toSafeSmartAccount_js_1.toSafeSmartAccount; } });
|
|
12
14
|
const toEcdsaKernelSmartAccount_js_1 = require("./kernel/toEcdsaKernelSmartAccount.js");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../accounts/index.ts"],"names":[],"mappings":";;;AAAA,8EAKyC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../accounts/index.ts"],"names":[],"mappings":";;;AAAA,8EAKyC;AAwErC,qGAzEA,8CAAoB,OAyEA;AAtExB,2EAMuC;AAqEnC,oGAtEA,4CAAmB,OAsEA;AAnEvB,2EAKuC;AAkEnC,oGAnEA,4CAAmB,OAmEA;AAhEvB,uFAK+C;AAyF3C,wGA1FA,oDAAuB,OA0FA;AAvF3B,wEAMqC;AAwDjC,mGAzDA,0CAAkB,OAyDA;AAtDtB,wFAK8C;AAqD1C,0GAtDA,wDAAyB,OAsDA;AAnD7B,8EAMyC;AAkDrC,qGAnDA,8CAAoB,OAmDA;AAhDxB,oFAK6C;AAmDzC,uGApDA,kDAAsB,OAoDA;AAjD1B,2EAKuC;AAwCnC,oGAzCA,4CAAmB,OAyCA;AAtCvB,oFAK6C;AAyCzC,uGA1CA,kDAAsB,OA0CA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getUserOperationGasPrice = void 0;
|
|
4
|
+
const getUserOperationGasPrice = async (client) => {
|
|
5
|
+
const gasPrice = await client.request({
|
|
6
|
+
method: "skandha_getGasPrice",
|
|
7
|
+
params: []
|
|
8
|
+
});
|
|
9
|
+
return {
|
|
10
|
+
maxFeePerGas: BigInt(gasPrice.maxFeePerGas),
|
|
11
|
+
maxPriorityFeePerGas: BigInt(gasPrice.maxPriorityFeePerGas)
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
exports.getUserOperationGasPrice = getUserOperationGasPrice;
|
|
15
|
+
//# sourceMappingURL=getUserOperationGasPrice.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getUserOperationGasPrice.js","sourceRoot":"","sources":["../../../actions/etherspot/getUserOperationGasPrice.ts"],"names":[],"mappings":";;;AAcO,MAAM,wBAAwB,GAAG,KAAK,EACzC,MAKC,EACqC,EAAE;IACxC,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC;QAClC,MAAM,EAAE,qBAAqB;QAC7B,MAAM,EAAE,EAAE;KACb,CAAC,CAAA;IAEF,OAAO;QACH,YAAY,EAAE,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC;QAC3C,oBAAoB,EAAE,MAAM,CAAC,QAAQ,CAAC,oBAAoB,CAAC;KAC9D,CAAA;AACL,CAAC,CAAA;AAjBY,QAAA,wBAAwB,4BAiBpC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getUserOperationGasPrice = void 0;
|
|
4
|
+
const getUserOperationGasPrice_js_1 = require("./etherspot/getUserOperationGasPrice.js");
|
|
5
|
+
Object.defineProperty(exports, "getUserOperationGasPrice", { enumerable: true, get: function () { return getUserOperationGasPrice_js_1.getUserOperationGasPrice; } });
|
|
6
|
+
//# sourceMappingURL=etherspot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"etherspot.js","sourceRoot":"","sources":["../../actions/etherspot.ts"],"names":[],"mappings":";;;AAAA,yFAGgD;AAEH,yGAHzC,sDAAwB,OAGyC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"etherspot.js","sourceRoot":"","sources":["../../types/etherspot.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
export const EtherspotBootstrapAbi = [
|
|
2
|
+
{
|
|
3
|
+
inputs: [
|
|
4
|
+
{
|
|
5
|
+
components: [
|
|
6
|
+
{
|
|
7
|
+
internalType: "address",
|
|
8
|
+
name: "module",
|
|
9
|
+
type: "address"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
internalType: "bytes",
|
|
13
|
+
name: "data",
|
|
14
|
+
type: "bytes"
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
internalType: "struct BootstrapConfig[]",
|
|
18
|
+
name: "$valdiators",
|
|
19
|
+
type: "tuple[]"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
components: [
|
|
23
|
+
{
|
|
24
|
+
internalType: "address",
|
|
25
|
+
name: "module",
|
|
26
|
+
type: "address"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
internalType: "bytes",
|
|
30
|
+
name: "data",
|
|
31
|
+
type: "bytes"
|
|
32
|
+
}
|
|
33
|
+
],
|
|
34
|
+
internalType: "struct BootstrapConfig[]",
|
|
35
|
+
name: "$executors",
|
|
36
|
+
type: "tuple[]"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
components: [
|
|
40
|
+
{
|
|
41
|
+
internalType: "address",
|
|
42
|
+
name: "module",
|
|
43
|
+
type: "address"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
internalType: "bytes",
|
|
47
|
+
name: "data",
|
|
48
|
+
type: "bytes"
|
|
49
|
+
}
|
|
50
|
+
],
|
|
51
|
+
internalType: "struct BootstrapConfig",
|
|
52
|
+
name: "_hook",
|
|
53
|
+
type: "tuple"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
components: [
|
|
57
|
+
{
|
|
58
|
+
internalType: "address",
|
|
59
|
+
name: "module",
|
|
60
|
+
type: "address"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
internalType: "bytes",
|
|
64
|
+
name: "data",
|
|
65
|
+
type: "bytes"
|
|
66
|
+
}
|
|
67
|
+
],
|
|
68
|
+
internalType: "struct BootstrapConfig[]",
|
|
69
|
+
name: "_fallbacks",
|
|
70
|
+
type: "tuple[]"
|
|
71
|
+
}
|
|
72
|
+
],
|
|
73
|
+
name: "initMSA",
|
|
74
|
+
outputs: [],
|
|
75
|
+
stateMutability: "nonpayable",
|
|
76
|
+
type: "function"
|
|
77
|
+
}
|
|
78
|
+
];
|
|
79
|
+
export const EtherspotOnInstallAbi = [
|
|
80
|
+
{
|
|
81
|
+
inputs: [
|
|
82
|
+
{
|
|
83
|
+
internalType: "bytes",
|
|
84
|
+
name: "data",
|
|
85
|
+
type: "bytes"
|
|
86
|
+
}
|
|
87
|
+
],
|
|
88
|
+
name: "onInstall",
|
|
89
|
+
outputs: [],
|
|
90
|
+
stateMutability: "nonpayable",
|
|
91
|
+
type: "function"
|
|
92
|
+
}
|
|
93
|
+
];
|
|
94
|
+
//# sourceMappingURL=EtherspotBootstrapAbi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EtherspotBootstrapAbi.js","sourceRoot":"","sources":["../../../../accounts/etherspot/abi/EtherspotBootstrapAbi.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACjC;QACI,MAAM,EAAE;YACJ;gBACI,UAAU,EAAE;oBACR;wBACI,YAAY,EAAE,SAAS;wBACvB,IAAI,EAAE,QAAQ;wBACd,IAAI,EAAE,SAAS;qBAClB;oBACD;wBACI,YAAY,EAAE,OAAO;wBACrB,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,OAAO;qBAChB;iBACJ;gBACD,YAAY,EAAE,0BAA0B;gBACxC,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QACX,eAAe,EAAE,YAAY;QAC7B,IAAI,EAAE,UAAU;KACnB;CACK,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export const DUMMY_ECDSA_SIGNATURE = "0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c";
|
|
2
|
+
export const VALIDATOR_TYPE = {
|
|
3
|
+
ROOT: "0x00",
|
|
4
|
+
VALIDATOR: "0x01",
|
|
5
|
+
PERMISSION: "0x02"
|
|
6
|
+
};
|
|
7
|
+
export var VALIDATOR_MODE;
|
|
8
|
+
(function (VALIDATOR_MODE) {
|
|
9
|
+
VALIDATOR_MODE["DEFAULT"] = "0x00";
|
|
10
|
+
VALIDATOR_MODE["ENABLE"] = "0x01";
|
|
11
|
+
})(VALIDATOR_MODE || (VALIDATOR_MODE = {}));
|
|
12
|
+
export const DEFAULT_CONTRACT_ADDRESS = {
|
|
13
|
+
metaFactoryAddress: "0x93FB56A4a0B7160fbf8903d251Cc7A3fb9bA0933", // modularEtherspotWalletFactory
|
|
14
|
+
bootstrapAddress: "0x1baCB2F1ef4fD02f02e32cCF70888D9Caeb5f066",
|
|
15
|
+
validatorAddress: "0x7aCEE15c9FFc1e8f287C26E0f4C8244A0729F557" // multipleOwnerECDSAValidator
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../accounts/etherspot/constants.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,qBAAqB,GAC9B,sIAAsI,CAAA;AAE1I,MAAM,CAAC,MAAM,cAAc,GAAG;IAC1B,IAAI,EAAE,MAAM;IACZ,SAAS,EAAE,MAAM;IACjB,UAAU,EAAE,MAAM;CACZ,CAAA;AAEV,MAAM,CAAN,IAAY,cAGX;AAHD,WAAY,cAAc;IACtB,kCAAgB,CAAA;IAChB,iCAAe,CAAA;AACnB,CAAC,EAHW,cAAc,KAAd,cAAc,QAGzB;AAQD,MAAM,CAAC,MAAM,wBAAwB,GAAqB;IACtD,kBAAkB,EAAE,4CAA4C,EAAE,gCAAgC;IAClG,gBAAgB,EAAE,4CAA4C;IAC9D,gBAAgB,EAAE,4CAA4C,CAAC,8BAA8B;CAChG,CAAA"}
|