@rhinestone/sdk 1.0.40 → 1.0.41-alpha.0
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/package.json +1 -1
- package/dist/src/accounts/error.d.ts +0 -114
- package/dist/src/accounts/error.d.ts.map +0 -1
- package/dist/src/accounts/error.js +0 -174
- package/dist/src/accounts/index.d.ts +0 -50
- package/dist/src/accounts/index.d.ts.map +0 -1
- package/dist/src/accounts/index.js +0 -669
- package/dist/src/accounts/index.test.d.ts +0 -2
- package/dist/src/accounts/index.test.d.ts.map +0 -1
- package/dist/src/accounts/index.test.js +0 -33
- package/dist/src/accounts/json-rpc/index.d.ts +0 -5
- package/dist/src/accounts/json-rpc/index.d.ts.map +0 -1
- package/dist/src/accounts/json-rpc/index.js +0 -20
- package/dist/src/accounts/json-rpc/index.test.d.ts +0 -2
- package/dist/src/accounts/json-rpc/index.test.d.ts.map +0 -1
- package/dist/src/accounts/json-rpc/index.test.js +0 -33
- package/dist/src/accounts/json-rpc/providers.d.ts +0 -5
- package/dist/src/accounts/json-rpc/providers.d.ts.map +0 -1
- package/dist/src/accounts/json-rpc/providers.js +0 -22
- package/dist/src/accounts/json-rpc/providers.test.d.ts +0 -2
- package/dist/src/accounts/json-rpc/providers.test.d.ts.map +0 -1
- package/dist/src/accounts/json-rpc/providers.test.js +0 -43
- package/dist/src/accounts/kernel.d.ts +0 -29
- package/dist/src/accounts/kernel.d.ts.map +0 -1
- package/dist/src/accounts/kernel.js +0 -297
- package/dist/src/accounts/kernel.test.d.ts +0 -2
- package/dist/src/accounts/kernel.test.d.ts.map +0 -1
- package/dist/src/accounts/kernel.test.js +0 -132
- package/dist/src/accounts/nexus.d.ts +0 -35
- package/dist/src/accounts/nexus.d.ts.map +0 -1
- package/dist/src/accounts/nexus.js +0 -471
- package/dist/src/accounts/nexus.test.d.ts +0 -2
- package/dist/src/accounts/nexus.test.d.ts.map +0 -1
- package/dist/src/accounts/nexus.test.js +0 -118
- package/dist/src/accounts/passport.d.ts +0 -12
- package/dist/src/accounts/passport.d.ts.map +0 -1
- package/dist/src/accounts/passport.js +0 -173
- package/dist/src/accounts/safe.d.ts +0 -35
- package/dist/src/accounts/safe.d.ts.map +0 -1
- package/dist/src/accounts/safe.js +0 -365
- package/dist/src/accounts/safe.test.d.ts +0 -2
- package/dist/src/accounts/safe.test.d.ts.map +0 -1
- package/dist/src/accounts/safe.test.js +0 -118
- package/dist/src/accounts/signing/common.d.ts +0 -27
- package/dist/src/accounts/signing/common.d.ts.map +0 -1
- package/dist/src/accounts/signing/common.js +0 -183
- package/dist/src/accounts/signing/message.d.ts +0 -5
- package/dist/src/accounts/signing/message.d.ts.map +0 -1
- package/dist/src/accounts/signing/message.js +0 -47
- package/dist/src/accounts/signing/passkeys.d.ts +0 -36
- package/dist/src/accounts/signing/passkeys.d.ts.map +0 -1
- package/dist/src/accounts/signing/passkeys.js +0 -125
- package/dist/src/accounts/signing/passkeys.test.d.ts +0 -2
- package/dist/src/accounts/signing/passkeys.test.d.ts.map +0 -1
- package/dist/src/accounts/signing/passkeys.test.js +0 -88
- package/dist/src/accounts/signing/typedData.d.ts +0 -5
- package/dist/src/accounts/signing/typedData.d.ts.map +0 -1
- package/dist/src/accounts/signing/typedData.js +0 -35
- package/dist/src/accounts/startale.d.ts +0 -27
- package/dist/src/accounts/startale.d.ts.map +0 -1
- package/dist/src/accounts/startale.js +0 -116
- package/dist/src/accounts/startale.test.d.ts +0 -2
- package/dist/src/accounts/startale.test.d.ts.map +0 -1
- package/dist/src/accounts/startale.test.js +0 -92
- package/dist/src/accounts/utils.d.ts +0 -33
- package/dist/src/accounts/utils.d.ts.map +0 -1
- package/dist/src/accounts/utils.js +0 -201
- package/dist/src/accounts/utils.test.d.ts +0 -2
- package/dist/src/accounts/utils.test.d.ts.map +0 -1
- package/dist/src/accounts/utils.test.js +0 -49
- package/dist/src/accounts/walletClient.d.ts +0 -34
- package/dist/src/accounts/walletClient.d.ts.map +0 -1
- package/dist/src/accounts/walletClient.js +0 -121
- package/dist/src/actions/compact.d.ts +0 -13
- package/dist/src/actions/compact.d.ts.map +0 -1
- package/dist/src/actions/compact.js +0 -210
- package/dist/src/actions/deployment.d.ts +0 -19
- package/dist/src/actions/deployment.d.ts.map +0 -1
- package/dist/src/actions/deployment.js +0 -78
- package/dist/src/actions/ecdsa.d.ts +0 -35
- package/dist/src/actions/ecdsa.d.ts.map +0 -1
- package/dist/src/actions/ecdsa.js +0 -114
- package/dist/src/actions/ecdsa.test.d.ts +0 -2
- package/dist/src/actions/ecdsa.test.d.ts.map +0 -1
- package/dist/src/actions/ecdsa.test.js +0 -99
- package/dist/src/actions/index.d.ts +0 -17
- package/dist/src/actions/index.d.ts.map +0 -1
- package/dist/src/actions/index.js +0 -53
- package/dist/src/actions/mfa.d.ts +0 -37
- package/dist/src/actions/mfa.d.ts.map +0 -1
- package/dist/src/actions/mfa.js +0 -133
- package/dist/src/actions/passkeys.d.ts +0 -37
- package/dist/src/actions/passkeys.d.ts.map +0 -1
- package/dist/src/actions/passkeys.js +0 -129
- package/dist/src/actions/passkeys.test.d.ts +0 -2
- package/dist/src/actions/passkeys.test.d.ts.map +0 -1
- package/dist/src/actions/passkeys.test.js +0 -54
- package/dist/src/actions/recovery.d.ts +0 -33
- package/dist/src/actions/recovery.d.ts.map +0 -1
- package/dist/src/actions/recovery.js +0 -193
- package/dist/src/actions/recovery.test.d.ts +0 -2
- package/dist/src/actions/recovery.test.d.ts.map +0 -1
- package/dist/src/actions/recovery.test.js +0 -168
- package/dist/src/actions/smart-sessions.d.ts +0 -14
- package/dist/src/actions/smart-sessions.d.ts.map +0 -1
- package/dist/src/actions/smart-sessions.js +0 -16
- package/dist/src/errors/index.d.ts +0 -5
- package/dist/src/errors/index.d.ts.map +0 -1
- package/dist/src/errors/index.js +0 -53
- package/dist/src/execution/compact.d.ts +0 -151
- package/dist/src/execution/compact.d.ts.map +0 -1
- package/dist/src/execution/compact.js +0 -122
- package/dist/src/execution/error.d.ts +0 -61
- package/dist/src/execution/error.d.ts.map +0 -1
- package/dist/src/execution/error.js +0 -87
- package/dist/src/execution/index.d.ts +0 -41
- package/dist/src/execution/index.d.ts.map +0 -1
- package/dist/src/execution/index.js +0 -233
- package/dist/src/execution/permit2.d.ts +0 -148
- package/dist/src/execution/permit2.d.ts.map +0 -1
- package/dist/src/execution/permit2.js +0 -291
- package/dist/src/execution/singleChainOps.d.ts +0 -28
- package/dist/src/execution/singleChainOps.d.ts.map +0 -1
- package/dist/src/execution/singleChainOps.js +0 -32
- package/dist/src/execution/smart-session.d.ts +0 -13
- package/dist/src/execution/smart-session.d.ts.map +0 -1
- package/dist/src/execution/smart-session.js +0 -178
- package/dist/src/execution/types.d.ts +0 -36
- package/dist/src/execution/types.d.ts.map +0 -1
- package/dist/src/execution/types.js +0 -2
- package/dist/src/execution/utils.d.ts +0 -83
- package/dist/src/execution/utils.d.ts.map +0 -1
- package/dist/src/execution/utils.js +0 -705
- package/dist/src/index.d.ts +0 -74
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/index.js +0 -317
- package/dist/src/modules/abi/smart-sessions.d.ts +0 -104
- package/dist/src/modules/abi/smart-sessions.d.ts.map +0 -1
- package/dist/src/modules/abi/smart-sessions.js +0 -131
- package/dist/src/modules/chain-abstraction.d.ts +0 -5
- package/dist/src/modules/chain-abstraction.d.ts.map +0 -1
- package/dist/src/modules/chain-abstraction.js +0 -7
- package/dist/src/modules/common.d.ts +0 -30
- package/dist/src/modules/common.d.ts.map +0 -1
- package/dist/src/modules/common.js +0 -42
- package/dist/src/modules/index.d.ts +0 -10
- package/dist/src/modules/index.d.ts.map +0 -1
- package/dist/src/modules/index.js +0 -94
- package/dist/src/modules/index.test.d.ts +0 -2
- package/dist/src/modules/index.test.d.ts.map +0 -1
- package/dist/src/modules/index.test.js +0 -81
- package/dist/src/modules/legacy.d.ts +0 -10
- package/dist/src/modules/legacy.d.ts.map +0 -1
- package/dist/src/modules/legacy.js +0 -65
- package/dist/src/modules/read.d.ts +0 -9
- package/dist/src/modules/read.d.ts.map +0 -1
- package/dist/src/modules/read.js +0 -125
- package/dist/src/modules/validators/core.d.ts +0 -29
- package/dist/src/modules/validators/core.d.ts.map +0 -1
- package/dist/src/modules/validators/core.js +0 -278
- package/dist/src/modules/validators/core.test.d.ts +0 -2
- package/dist/src/modules/validators/core.test.d.ts.map +0 -1
- package/dist/src/modules/validators/core.test.js +0 -101
- package/dist/src/modules/validators/index.d.ts +0 -4
- package/dist/src/modules/validators/index.d.ts.map +0 -1
- package/dist/src/modules/validators/index.js +0 -15
- package/dist/src/modules/validators/smart-sessions.d.ts +0 -96
- package/dist/src/modules/validators/smart-sessions.d.ts.map +0 -1
- package/dist/src/modules/validators/smart-sessions.js +0 -497
- package/dist/src/modules/validators/smart-sessions.test.d.ts +0 -2
- package/dist/src/modules/validators/smart-sessions.test.d.ts.map +0 -1
- package/dist/src/modules/validators/smart-sessions.test.js +0 -219
- package/dist/src/orchestrator/client.d.ts +0 -27
- package/dist/src/orchestrator/client.d.ts.map +0 -1
- package/dist/src/orchestrator/client.js +0 -354
- package/dist/src/orchestrator/consts.d.ts +0 -5
- package/dist/src/orchestrator/consts.d.ts.map +0 -1
- package/dist/src/orchestrator/consts.js +0 -9
- package/dist/src/orchestrator/error.d.ts +0 -232
- package/dist/src/orchestrator/error.d.ts.map +0 -1
- package/dist/src/orchestrator/error.js +0 -268
- package/dist/src/orchestrator/index.d.ts +0 -10
- package/dist/src/orchestrator/index.d.ts.map +0 -1
- package/dist/src/orchestrator/index.js +0 -57
- package/dist/src/orchestrator/registry.d.ts +0 -22
- package/dist/src/orchestrator/registry.d.ts.map +0 -1
- package/dist/src/orchestrator/registry.js +0 -121
- package/dist/src/orchestrator/registry.test.d.ts +0 -2
- package/dist/src/orchestrator/registry.test.d.ts.map +0 -1
- package/dist/src/orchestrator/registry.test.js +0 -150
- package/dist/src/orchestrator/types.d.ts +0 -295
- package/dist/src/orchestrator/types.d.ts.map +0 -1
- package/dist/src/orchestrator/types.js +0 -17
- package/dist/src/orchestrator/utils.d.ts +0 -3
- package/dist/src/orchestrator/utils.d.ts.map +0 -1
- package/dist/src/orchestrator/utils.js +0 -24
- package/dist/src/types.d.ts +0 -278
- package/dist/src/types.d.ts.map +0 -1
- package/dist/src/types.js +0 -2
- package/dist/src/utils/index.d.ts +0 -26
- package/dist/src/utils/index.d.ts.map +0 -1
- package/dist/src/utils/index.js +0 -63
- package/dist/test/consts.d.ts +0 -10
- package/dist/test/consts.d.ts.map +0 -1
- package/dist/test/consts.js +0 -22
- package/dist/test/utils/utils.d.ts +0 -5
- package/dist/test/utils/utils.d.ts.map +0 -1
- package/dist/test/utils/utils.js +0 -20
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const vitest_1 = require("vitest");
|
|
4
|
-
const consts_1 = require("../../test/consts");
|
|
5
|
-
const _1 = require(".");
|
|
6
|
-
(0, vitest_1.describe)('Accounts', () => {
|
|
7
|
-
(0, vitest_1.describe)('Get Address', () => {
|
|
8
|
-
(0, vitest_1.test)('Nexus, ECDSA owner', () => {
|
|
9
|
-
const address = (0, _1.getAddress)({
|
|
10
|
-
owners: {
|
|
11
|
-
type: 'ecdsa',
|
|
12
|
-
accounts: [consts_1.accountA, consts_1.accountB],
|
|
13
|
-
threshold: 1,
|
|
14
|
-
},
|
|
15
|
-
});
|
|
16
|
-
(0, vitest_1.expect)(address).toEqual('0x0681de31e060b384F0b08A3bAC99E9bDFf302474');
|
|
17
|
-
});
|
|
18
|
-
(0, vitest_1.test)('Safe, passkey owner with a session', () => {
|
|
19
|
-
const address = (0, _1.getAddress)({
|
|
20
|
-
owners: {
|
|
21
|
-
type: 'passkey',
|
|
22
|
-
accounts: [consts_1.passkeyAccount],
|
|
23
|
-
},
|
|
24
|
-
});
|
|
25
|
-
(0, vitest_1.expect)(address).toEqual('0x894b88C04B4DE6AbDdcE81E8bdc91927E37d6ceD');
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
(0, vitest_1.describe)('Sign', () => {
|
|
29
|
-
vitest_1.test.todo('With ECDSA, single key');
|
|
30
|
-
vitest_1.test.todo('With ECDSA, multisig');
|
|
31
|
-
vitest_1.test.todo('With Passkey');
|
|
32
|
-
});
|
|
33
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../accounts/json-rpc/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,KAAK,EAAQ,KAAK,SAAS,EAAE,MAAM,MAAM,CAAA;AAEvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAGjD,iBAAS,eAAe,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,EAAE,cAAc,GAAG,SAAS,CAkB3E;AAED,OAAO,EAAE,eAAe,EAAE,CAAA"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createTransport = createTransport;
|
|
4
|
-
const viem_1 = require("viem");
|
|
5
|
-
const providers_1 = require("./providers");
|
|
6
|
-
function createTransport(chain, provider) {
|
|
7
|
-
if (!provider) {
|
|
8
|
-
return (0, viem_1.http)();
|
|
9
|
-
}
|
|
10
|
-
switch (provider.type) {
|
|
11
|
-
case 'alchemy': {
|
|
12
|
-
const alchemyUrl = (0, providers_1.getAlchemyUrl)(chain.id, provider.apiKey);
|
|
13
|
-
return (0, viem_1.http)(alchemyUrl);
|
|
14
|
-
}
|
|
15
|
-
case 'custom': {
|
|
16
|
-
const customUrl = (0, providers_1.getCustomUrl)(chain.id, provider.urls);
|
|
17
|
-
return (0, viem_1.http)(customUrl);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../../../accounts/json-rpc/index.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const chains_1 = require("viem/chains");
|
|
4
|
-
const vitest_1 = require("vitest");
|
|
5
|
-
const index_1 = require("./index");
|
|
6
|
-
(0, vitest_1.describe)('JSON-RPC', () => {
|
|
7
|
-
(0, vitest_1.describe)('createTransport', () => {
|
|
8
|
-
(0, vitest_1.test)('Alchemy', () => {
|
|
9
|
-
const transport = (0, index_1.createTransport)(chains_1.base, {
|
|
10
|
-
type: 'alchemy',
|
|
11
|
-
apiKey: '123',
|
|
12
|
-
});
|
|
13
|
-
(0, vitest_1.expect)(transport).toBeDefined();
|
|
14
|
-
});
|
|
15
|
-
(0, vitest_1.test)('Custom', () => {
|
|
16
|
-
const transport = (0, index_1.createTransport)(chains_1.mainnet, {
|
|
17
|
-
type: 'custom',
|
|
18
|
-
urls: {
|
|
19
|
-
[chains_1.mainnet.id]: 'https://my-rpc.example.com',
|
|
20
|
-
},
|
|
21
|
-
});
|
|
22
|
-
(0, vitest_1.expect)(transport).toBeDefined();
|
|
23
|
-
});
|
|
24
|
-
(0, vitest_1.test)('Custom throws error when URL not configured for chain', () => {
|
|
25
|
-
(0, vitest_1.expect)(() => (0, index_1.createTransport)(chains_1.mainnet, {
|
|
26
|
-
type: 'custom',
|
|
27
|
-
urls: {
|
|
28
|
-
[chains_1.base.id]: 'https://my-rpc.example.com',
|
|
29
|
-
},
|
|
30
|
-
})).toThrow('No custom provider URL configured for chain 1');
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
});
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { SupportedChain } from '../../orchestrator';
|
|
2
|
-
declare function getAlchemyUrl(chainId: SupportedChain, apiKey: string): string;
|
|
3
|
-
declare function getCustomUrl(chainId: number, urls: Record<number, string>): string;
|
|
4
|
-
export { getAlchemyUrl, getCustomUrl };
|
|
5
|
-
//# sourceMappingURL=providers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"providers.d.ts","sourceRoot":"","sources":["../../../../accounts/json-rpc/providers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAExD,iBAAS,aAAa,CAAC,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAStE;AAED,iBAAS,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAM3E;AAED,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,CAAA"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getAlchemyUrl = getAlchemyUrl;
|
|
4
|
-
exports.getCustomUrl = getCustomUrl;
|
|
5
|
-
const shared_configs_1 = require("@rhinestone/shared-configs");
|
|
6
|
-
function getAlchemyUrl(chainId, apiKey) {
|
|
7
|
-
const urlTemplate = shared_configs_1.providerRegistry.Alchemy.url_template;
|
|
8
|
-
const chainParam = shared_configs_1.providerRegistry.Alchemy.chain_mapping[chainId];
|
|
9
|
-
if (!chainParam) {
|
|
10
|
-
throw new Error(`Unsupported chain: ${chainId}`);
|
|
11
|
-
}
|
|
12
|
-
return urlTemplate
|
|
13
|
-
.replace('{{chain_param}}', chainParam)
|
|
14
|
-
.replace('\$\{ALCHEMY_API_KEY\}', apiKey);
|
|
15
|
-
}
|
|
16
|
-
function getCustomUrl(chainId, urls) {
|
|
17
|
-
const url = urls[chainId];
|
|
18
|
-
if (!url) {
|
|
19
|
-
throw new Error(`No custom provider URL configured for chain ${chainId}`);
|
|
20
|
-
}
|
|
21
|
-
return url;
|
|
22
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"providers.test.d.ts","sourceRoot":"","sources":["../../../../accounts/json-rpc/providers.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const chains_1 = require("viem/chains");
|
|
4
|
-
const vitest_1 = require("vitest");
|
|
5
|
-
const providers_1 = require("./providers");
|
|
6
|
-
(0, vitest_1.describe)('Providers', () => {
|
|
7
|
-
(0, vitest_1.describe)('Alchemy', () => {
|
|
8
|
-
(0, vitest_1.test)('Network', () => {
|
|
9
|
-
const mockApiKey = '123';
|
|
10
|
-
(0, vitest_1.expect)((0, providers_1.getAlchemyUrl)(chains_1.arbitrum.id, mockApiKey)).toBe('https://arb-mainnet.g.alchemy.com/v2/123');
|
|
11
|
-
(0, vitest_1.expect)((0, providers_1.getAlchemyUrl)(chains_1.sepolia.id, mockApiKey)).toBe('https://eth-sepolia.g.alchemy.com/v2/123');
|
|
12
|
-
(0, vitest_1.expect)((0, providers_1.getAlchemyUrl)(chains_1.polygon.id, mockApiKey)).toBe('https://polygon-mainnet.g.alchemy.com/v2/123');
|
|
13
|
-
});
|
|
14
|
-
});
|
|
15
|
-
(0, vitest_1.describe)('Custom', () => {
|
|
16
|
-
(0, vitest_1.test)('Returns URL for configured chain', () => {
|
|
17
|
-
const urls = {
|
|
18
|
-
[chains_1.arbitrum.id]: 'https://my-rpc.example.com/mainnet',
|
|
19
|
-
[chains_1.sepolia.id]: 'https://my-rpc.example.com/sepolia',
|
|
20
|
-
};
|
|
21
|
-
(0, vitest_1.expect)((0, providers_1.getCustomUrl)(chains_1.arbitrum.id, urls)).toBe('https://my-rpc.example.com/mainnet');
|
|
22
|
-
(0, vitest_1.expect)((0, providers_1.getCustomUrl)(chains_1.sepolia.id, urls)).toBe('https://my-rpc.example.com/sepolia');
|
|
23
|
-
});
|
|
24
|
-
(0, vitest_1.test)('Throws error when chain not configured', () => {
|
|
25
|
-
const urls = {
|
|
26
|
-
[chains_1.arbitrum.id]: 'https://my-rpc.example.com/mainnet',
|
|
27
|
-
};
|
|
28
|
-
(0, vitest_1.expect)(() => (0, providers_1.getCustomUrl)(chains_1.sepolia.id, urls)).toThrow('No custom provider URL configured for chain 11155111');
|
|
29
|
-
});
|
|
30
|
-
(0, vitest_1.test)('Accepts HTTP URLs', () => {
|
|
31
|
-
const urls = {
|
|
32
|
-
[chains_1.arbitrum.id]: 'http://localhost:8545',
|
|
33
|
-
};
|
|
34
|
-
(0, vitest_1.expect)((0, providers_1.getCustomUrl)(chains_1.arbitrum.id, urls)).toBe('http://localhost:8545');
|
|
35
|
-
});
|
|
36
|
-
(0, vitest_1.test)('Accepts HTTPS URLs', () => {
|
|
37
|
-
const urls = {
|
|
38
|
-
[chains_1.arbitrum.id]: 'https://my-rpc.example.com',
|
|
39
|
-
};
|
|
40
|
-
(0, vitest_1.expect)((0, providers_1.getCustomUrl)(chains_1.arbitrum.id, urls)).toBe('https://my-rpc.example.com');
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
});
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { type Abi, type Address, type Chain, type Hex, type PublicClient } from 'viem';
|
|
2
|
-
import { type SmartAccount, type SmartAccountImplementation } from 'viem/account-abstraction';
|
|
3
|
-
import { type Module } from '../modules/common';
|
|
4
|
-
import type { EnableSessionData } from '../modules/validators/smart-sessions';
|
|
5
|
-
import type { OwnerSet, RhinestoneAccountConfig, Session } from '../types';
|
|
6
|
-
import { type ValidatorConfig } from './utils';
|
|
7
|
-
declare function getDeployArgs(config: RhinestoneAccountConfig): {
|
|
8
|
-
factory: `0x${string}`;
|
|
9
|
-
factoryData: `0x${string}`;
|
|
10
|
-
implementation: `0x${string}`;
|
|
11
|
-
initializationCallData: `0x${string}`;
|
|
12
|
-
salt: `0x${string}`;
|
|
13
|
-
} | null;
|
|
14
|
-
declare function getAddress(config: RhinestoneAccountConfig): `0x${string}`;
|
|
15
|
-
declare function getEip712Domain(config: RhinestoneAccountConfig, chain: Chain): {
|
|
16
|
-
name: string;
|
|
17
|
-
version: string;
|
|
18
|
-
chainId: number;
|
|
19
|
-
verifyingContract: `0x${string}`;
|
|
20
|
-
salt: "0x0000000000000000000000000000000000000000000000000000000000000000";
|
|
21
|
-
};
|
|
22
|
-
declare function getInstallData(module: Module): Hex[];
|
|
23
|
-
declare function packSignature(signature: Hex, validator: ValidatorConfig, transformSignature?: (signature: Hex) => Hex): Promise<`0x${string}`>;
|
|
24
|
-
declare function wrapMessageHash(messageHash: Hex, accountAddress: Hex): Hex;
|
|
25
|
-
declare function getSmartAccount(client: PublicClient, address: Address, owners: OwnerSet, validatorAddress: Address, sign: (hash: Hex) => Promise<Hex>): Promise<SmartAccount<SmartAccountImplementation<Abi, "0.7">>>;
|
|
26
|
-
declare function getSessionSmartAccount(client: PublicClient, address: Address, session: Session, validatorAddress: Address, enableData: EnableSessionData | null, sign: (hash: Hex) => Promise<Hex>): Promise<SmartAccount<SmartAccountImplementation<Abi, "0.7">>>;
|
|
27
|
-
declare function getGuardianSmartAccount(client: PublicClient, address: Address, guardians: OwnerSet, validatorAddress: Address, sign: (hash: Hex) => Promise<Hex>): Promise<SmartAccount<SmartAccountImplementation<Abi, "0.7">>>;
|
|
28
|
-
export { getEip712Domain, getInstallData, getAddress, getDeployArgs, getSmartAccount, getSessionSmartAccount, getGuardianSmartAccount, packSignature, wrapMessageHash, };
|
|
29
|
-
//# sourceMappingURL=kernel.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"kernel.d.ts","sourceRoot":"","sources":["../../../accounts/kernel.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,GAAG,EACR,KAAK,OAAO,EACZ,KAAK,KAAK,EASV,KAAK,GAAG,EAER,KAAK,YAAY,EAMlB,MAAM,MAAM,CAAA;AACb,OAAO,EAIL,KAAK,YAAY,EACjB,KAAK,0BAA0B,EAEhC,MAAM,0BAA0B,CAAA;AAGjC,OAAO,EAKL,KAAK,MAAM,EACZ,MAAM,mBAAmB,CAAA;AAQ1B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAA;AAC7E,OAAO,KAAK,EAEV,QAAQ,EACR,uBAAuB,EACvB,OAAO,EACR,MAAM,UAAU,CAAA;AAKjB,OAAO,EAAoC,KAAK,eAAe,EAAE,MAAM,SAAS,CAAA;AAgBhF,iBAAS,aAAa,CAAC,MAAM,EAAE,uBAAuB;;;;;;SAmFrD;AAED,iBAAS,UAAU,CAAC,MAAM,EAAE,uBAAuB,iBAalD;AAED,iBAAS,eAAe,CAAC,MAAM,EAAE,uBAAuB,EAAE,KAAK,EAAE,KAAK;;;;;;EAarE;AAED,iBAAS,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG,EAAE,CAsE7C;AAED,iBAAe,aAAa,CAC1B,SAAS,EAAE,GAAG,EACd,SAAS,EAAE,eAAe,EAC1B,kBAAkB,GAAE,CAAC,SAAS,EAAE,GAAG,KAAK,GAA8B,0BAYvE;AAED,iBAAS,eAAe,CAAC,WAAW,EAAE,GAAG,EAAE,cAAc,EAAE,GAAG,GAAG,GAAG,CAoBnE;AAED,iBAAe,eAAe,CAC5B,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,QAAQ,EAChB,gBAAgB,EAAE,OAAO,EACzB,IAAI,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,iEAYlC;AAED,iBAAe,sBAAsB,CACnC,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,gBAAgB,EAAE,OAAO,EACzB,UAAU,EAAE,iBAAiB,GAAG,IAAI,EACpC,IAAI,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,iEA0ClC;AAED,iBAAe,uBAAuB,CACpC,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,QAAQ,EACnB,gBAAgB,EAAE,OAAO,EACzB,IAAI,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,iEAclC;AA+ED,OAAO,EACL,eAAe,EACf,cAAc,EACd,UAAU,EACV,aAAa,EACb,eAAe,EACf,sBAAsB,EACtB,uBAAuB,EACvB,aAAa,EACb,eAAe,GAChB,CAAA"}
|
|
@@ -1,297 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getEip712Domain = getEip712Domain;
|
|
4
|
-
exports.getInstallData = getInstallData;
|
|
5
|
-
exports.getAddress = getAddress;
|
|
6
|
-
exports.getDeployArgs = getDeployArgs;
|
|
7
|
-
exports.getSmartAccount = getSmartAccount;
|
|
8
|
-
exports.getSessionSmartAccount = getSessionSmartAccount;
|
|
9
|
-
exports.getGuardianSmartAccount = getGuardianSmartAccount;
|
|
10
|
-
exports.packSignature = packSignature;
|
|
11
|
-
exports.wrapMessageHash = wrapMessageHash;
|
|
12
|
-
const viem_1 = require("viem");
|
|
13
|
-
const account_abstraction_1 = require("viem/account-abstraction");
|
|
14
|
-
const modules_1 = require("../modules");
|
|
15
|
-
const common_1 = require("../modules/common");
|
|
16
|
-
const validators_1 = require("../modules/validators");
|
|
17
|
-
const error_1 = require("./error");
|
|
18
|
-
const utils_1 = require("./utils");
|
|
19
|
-
const KERNEL_META_FACTORY_ADDRESS = '0xd703aae79538628d27099b8c4f621be4ccd142d5';
|
|
20
|
-
const KERNEL_IMPLEMENTATION_ADDRESS = '0xd6CEDDe84be40893d153Be9d467CD6aD37875b28';
|
|
21
|
-
const KERNEL_FACTORY_ADDRESS = '0x2577507b78c2008Ff367261CB6285d44ba5eF2E9';
|
|
22
|
-
const KERNEL_BYTECODE = '0x603d3d8160223d3973d6cedde84be40893d153be9d467cd6ad37875b2860095155f3363d3d373d3d363d7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc545af43d6000803e6038573d6000fd5b3d6000f3';
|
|
23
|
-
const KERNEL_VERSION = '0.3.3';
|
|
24
|
-
function getDeployArgs(config) {
|
|
25
|
-
if (config.initData) {
|
|
26
|
-
if (!('factory' in config.initData)) {
|
|
27
|
-
return null;
|
|
28
|
-
}
|
|
29
|
-
const factoryData = (0, viem_1.decodeFunctionData)({
|
|
30
|
-
abi: (0, viem_1.parseAbi)([
|
|
31
|
-
'function deployWithFactory(address factory,bytes createData,bytes32 salt)',
|
|
32
|
-
]),
|
|
33
|
-
data: config.initData.factoryData,
|
|
34
|
-
});
|
|
35
|
-
if (factoryData.functionName !== 'deployWithFactory') {
|
|
36
|
-
throw new error_1.AccountConfigurationNotSupportedError('Invalid factory data', 'kernel');
|
|
37
|
-
}
|
|
38
|
-
const factory = factoryData.args[0];
|
|
39
|
-
const createData = factoryData.args[1];
|
|
40
|
-
const salt = factoryData.args[2];
|
|
41
|
-
const implementation = factory === KERNEL_FACTORY_ADDRESS
|
|
42
|
-
? KERNEL_IMPLEMENTATION_ADDRESS
|
|
43
|
-
: viem_1.zeroAddress;
|
|
44
|
-
if (implementation === viem_1.zeroAddress) {
|
|
45
|
-
throw new error_1.AccountConfigurationNotSupportedError('Unsupported Kernel implementation', 'kernel');
|
|
46
|
-
}
|
|
47
|
-
return {
|
|
48
|
-
factory: config.initData.factory,
|
|
49
|
-
factoryData: config.initData.factoryData,
|
|
50
|
-
implementation,
|
|
51
|
-
initializationCallData: createData,
|
|
52
|
-
salt,
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
const account = config.account;
|
|
56
|
-
const salt = account?.salt ?? viem_1.zeroHash;
|
|
57
|
-
const moduleSetup = (0, modules_1.getSetup)(config);
|
|
58
|
-
const rootValidator = (0, viem_1.concat)(['0x01', moduleSetup.validators[0].address]);
|
|
59
|
-
const hook = viem_1.zeroAddress;
|
|
60
|
-
const validatorData = moduleSetup.validators[0].initData;
|
|
61
|
-
const hookData = '0x';
|
|
62
|
-
// Install modules via init config
|
|
63
|
-
const spareValidators = moduleSetup.validators.slice(1);
|
|
64
|
-
const initConfig = [];
|
|
65
|
-
for (const module of spareValidators) {
|
|
66
|
-
initConfig.push(...getInstallData(module));
|
|
67
|
-
}
|
|
68
|
-
for (const module of moduleSetup.executors) {
|
|
69
|
-
initConfig.push(...getInstallData(module));
|
|
70
|
-
}
|
|
71
|
-
for (const module of moduleSetup.fallbacks) {
|
|
72
|
-
initConfig.push(...getInstallData(module));
|
|
73
|
-
}
|
|
74
|
-
for (const module of moduleSetup.hooks) {
|
|
75
|
-
initConfig.push(...getInstallData(module));
|
|
76
|
-
}
|
|
77
|
-
const initializationCallData = (0, viem_1.encodeFunctionData)({
|
|
78
|
-
abi: (0, viem_1.parseAbi)(['function initialize(bytes21,address,bytes,bytes,bytes[])']),
|
|
79
|
-
functionName: 'initialize',
|
|
80
|
-
args: [rootValidator, hook, validatorData, hookData, initConfig],
|
|
81
|
-
});
|
|
82
|
-
const factoryData = (0, viem_1.encodeFunctionData)({
|
|
83
|
-
abi: (0, viem_1.parseAbi)(['function deployWithFactory(address,bytes,bytes32)']),
|
|
84
|
-
functionName: 'deployWithFactory',
|
|
85
|
-
args: [KERNEL_FACTORY_ADDRESS, initializationCallData, salt],
|
|
86
|
-
});
|
|
87
|
-
return {
|
|
88
|
-
factory: KERNEL_META_FACTORY_ADDRESS,
|
|
89
|
-
factoryData,
|
|
90
|
-
salt,
|
|
91
|
-
implementation: KERNEL_IMPLEMENTATION_ADDRESS,
|
|
92
|
-
initializationCallData,
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
function getAddress(config) {
|
|
96
|
-
const deployArgs = getDeployArgs(config);
|
|
97
|
-
if (!deployArgs) {
|
|
98
|
-
throw new Error('Cannot derive address: deploy args not available');
|
|
99
|
-
}
|
|
100
|
-
const { salt, initializationCallData } = deployArgs;
|
|
101
|
-
const actualSalt = (0, viem_1.keccak256)((0, viem_1.concat)([initializationCallData, salt]));
|
|
102
|
-
return (0, viem_1.getContractAddress)({
|
|
103
|
-
from: KERNEL_FACTORY_ADDRESS,
|
|
104
|
-
opcode: 'CREATE2',
|
|
105
|
-
bytecode: KERNEL_BYTECODE,
|
|
106
|
-
salt: actualSalt,
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
function getEip712Domain(config, chain) {
|
|
110
|
-
if (config.initData) {
|
|
111
|
-
throw new error_1.Eip712DomainNotAvailableError('Existing Kernel accounts are not yet supported');
|
|
112
|
-
}
|
|
113
|
-
return {
|
|
114
|
-
name: 'Kernel',
|
|
115
|
-
version: KERNEL_VERSION,
|
|
116
|
-
chainId: chain.id,
|
|
117
|
-
verifyingContract: getAddress(config),
|
|
118
|
-
salt: viem_1.zeroHash,
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
function getInstallData(module) {
|
|
122
|
-
const HOOK_INSTALLED_ADDRESS = '0x0000000000000000000000000000000000000001';
|
|
123
|
-
switch (module.type) {
|
|
124
|
-
case common_1.MODULE_TYPE_ID_VALIDATOR: {
|
|
125
|
-
const data = (0, viem_1.encodeAbiParameters)([{ type: 'bytes' }, { type: 'bytes' }, { type: 'bytes' }], [module.initData, '0x', '0x']);
|
|
126
|
-
const initData = (0, viem_1.concat)([HOOK_INSTALLED_ADDRESS, data]);
|
|
127
|
-
const validatorId = (0, viem_1.concat)(['0x01', module.address]);
|
|
128
|
-
return [
|
|
129
|
-
(0, viem_1.encodeFunctionData)({
|
|
130
|
-
abi: (0, viem_1.parseAbi)(['function installModule(uint256,address,bytes)']),
|
|
131
|
-
functionName: 'installModule',
|
|
132
|
-
args: [module.type, module.address, initData],
|
|
133
|
-
}),
|
|
134
|
-
(0, viem_1.encodeFunctionData)({
|
|
135
|
-
abi: (0, viem_1.parseAbi)(['function grantAccess(bytes21,bytes4,bool)']),
|
|
136
|
-
functionName: 'grantAccess',
|
|
137
|
-
args: [validatorId, '0xe9ae5c53', true],
|
|
138
|
-
}),
|
|
139
|
-
];
|
|
140
|
-
}
|
|
141
|
-
case common_1.MODULE_TYPE_ID_EXECUTOR: {
|
|
142
|
-
const data = (0, viem_1.encodeAbiParameters)([{ type: 'bytes' }, { type: 'bytes' }], [module.initData, '0x']);
|
|
143
|
-
const initData = (0, viem_1.concat)([viem_1.zeroAddress, data]);
|
|
144
|
-
return [
|
|
145
|
-
(0, viem_1.encodeFunctionData)({
|
|
146
|
-
abi: (0, viem_1.parseAbi)(['function installModule(uint256,address,bytes)']),
|
|
147
|
-
functionName: 'installModule',
|
|
148
|
-
args: [module.type, module.address, initData],
|
|
149
|
-
}),
|
|
150
|
-
];
|
|
151
|
-
}
|
|
152
|
-
case common_1.MODULE_TYPE_ID_FALLBACK: {
|
|
153
|
-
const [selector, flags, selectorData] = (0, viem_1.decodeAbiParameters)([
|
|
154
|
-
{ name: 'selector', type: 'bytes4' },
|
|
155
|
-
{ name: 'flags', type: 'bytes1' },
|
|
156
|
-
{ name: 'data', type: 'bytes' },
|
|
157
|
-
], module.initData);
|
|
158
|
-
const data = (0, viem_1.encodeAbiParameters)([{ type: 'bytes' }, { type: 'bytes' }], [(0, viem_1.concat)([flags, selectorData]), '0x']);
|
|
159
|
-
const initData = (0, viem_1.concat)([selector, HOOK_INSTALLED_ADDRESS, data]);
|
|
160
|
-
return [
|
|
161
|
-
(0, viem_1.encodeFunctionData)({
|
|
162
|
-
abi: (0, viem_1.parseAbi)(['function installModule(uint256,address,bytes)']),
|
|
163
|
-
functionName: 'installModule',
|
|
164
|
-
args: [module.type, module.address, initData],
|
|
165
|
-
}),
|
|
166
|
-
];
|
|
167
|
-
}
|
|
168
|
-
case common_1.MODULE_TYPE_ID_HOOK: {
|
|
169
|
-
return [
|
|
170
|
-
(0, viem_1.encodeFunctionData)({
|
|
171
|
-
abi: (0, viem_1.parseAbi)(['function installModule(uint256,address,bytes)']),
|
|
172
|
-
functionName: 'installModule',
|
|
173
|
-
args: [module.type, module.address, module.initData],
|
|
174
|
-
}),
|
|
175
|
-
];
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
async function packSignature(signature, validator, transformSignature = (signature) => signature) {
|
|
180
|
-
const vId = validator.isRoot ? '0x00' : (0, viem_1.concat)(['0x01', validator.address]);
|
|
181
|
-
const magicValueSigReplayable = (0, viem_1.keccak256)((0, viem_1.toHex)('kernel.replayable.signature'));
|
|
182
|
-
const packedSig = (0, viem_1.concat)([
|
|
183
|
-
vId,
|
|
184
|
-
magicValueSigReplayable,
|
|
185
|
-
transformSignature(signature),
|
|
186
|
-
]);
|
|
187
|
-
return packedSig;
|
|
188
|
-
}
|
|
189
|
-
function wrapMessageHash(messageHash, accountAddress) {
|
|
190
|
-
const _domainSeparator = (0, viem_1.domainSeparator)({
|
|
191
|
-
domain: {
|
|
192
|
-
name: 'Kernel',
|
|
193
|
-
version: KERNEL_VERSION,
|
|
194
|
-
chainId: 0,
|
|
195
|
-
verifyingContract: accountAddress,
|
|
196
|
-
},
|
|
197
|
-
});
|
|
198
|
-
const kernelTypeHash = (0, viem_1.keccak256)((0, viem_1.stringToHex)('Kernel(bytes32 hash)'));
|
|
199
|
-
const wrappedMessageHash = (0, viem_1.keccak256)((0, viem_1.encodeAbiParameters)([{ type: 'bytes32' }, { type: 'bytes32' }], [kernelTypeHash, messageHash]));
|
|
200
|
-
const digest = (0, viem_1.keccak256)((0, viem_1.concatHex)(['0x1901', _domainSeparator, wrappedMessageHash]));
|
|
201
|
-
return digest;
|
|
202
|
-
}
|
|
203
|
-
async function getSmartAccount(client, address, owners, validatorAddress, sign) {
|
|
204
|
-
return getBaseSmartAccount(address, client, validatorAddress, 'root', async () => {
|
|
205
|
-
return (0, validators_1.getMockSignature)(owners);
|
|
206
|
-
}, sign);
|
|
207
|
-
}
|
|
208
|
-
async function getSessionSmartAccount(client, address, session, validatorAddress, enableData, sign) {
|
|
209
|
-
return await getBaseSmartAccount(address, client, validatorAddress, 'validator', async () => {
|
|
210
|
-
const dummyOpSignature = (0, validators_1.getMockSignature)(session.owners);
|
|
211
|
-
if (enableData) {
|
|
212
|
-
return (0, validators_1.encodeSmartSessionSignature)(validators_1.SMART_SESSION_MODE_ENABLE, (0, validators_1.getPermissionId)(session), dummyOpSignature, enableData);
|
|
213
|
-
}
|
|
214
|
-
return (0, validators_1.encodeSmartSessionSignature)(validators_1.SMART_SESSION_MODE_USE, (0, validators_1.getPermissionId)(session), dummyOpSignature);
|
|
215
|
-
}, async (hash) => {
|
|
216
|
-
const signature = await sign(hash);
|
|
217
|
-
if (enableData) {
|
|
218
|
-
return (0, validators_1.encodeSmartSessionSignature)(validators_1.SMART_SESSION_MODE_ENABLE, (0, validators_1.getPermissionId)(session), signature, enableData);
|
|
219
|
-
}
|
|
220
|
-
return (0, validators_1.encodeSmartSessionSignature)(validators_1.SMART_SESSION_MODE_USE, (0, validators_1.getPermissionId)(session), signature);
|
|
221
|
-
});
|
|
222
|
-
}
|
|
223
|
-
async function getGuardianSmartAccount(client, address, guardians, validatorAddress, sign) {
|
|
224
|
-
return await getBaseSmartAccount(address, client, validatorAddress, 'validator', async () => {
|
|
225
|
-
return (0, validators_1.getMockSignature)(guardians);
|
|
226
|
-
}, async (hash) => {
|
|
227
|
-
return await sign(hash);
|
|
228
|
-
});
|
|
229
|
-
}
|
|
230
|
-
async function getBaseSmartAccount(address, client, validatorAddress, validatorType, getStubSignature, signUserOperation) {
|
|
231
|
-
return await (0, account_abstraction_1.toSmartAccount)({
|
|
232
|
-
client,
|
|
233
|
-
entryPoint: {
|
|
234
|
-
abi: account_abstraction_1.entryPoint07Abi,
|
|
235
|
-
address: account_abstraction_1.entryPoint07Address,
|
|
236
|
-
version: '0.7',
|
|
237
|
-
},
|
|
238
|
-
async decodeCalls() {
|
|
239
|
-
throw new Error('Not implemented');
|
|
240
|
-
},
|
|
241
|
-
async encodeCalls(calls) {
|
|
242
|
-
return (0, utils_1.encode7579Calls)({
|
|
243
|
-
mode: {
|
|
244
|
-
type: calls.length > 1 ? 'batchcall' : 'call',
|
|
245
|
-
revertOnError: false,
|
|
246
|
-
selector: '0x',
|
|
247
|
-
context: '0x',
|
|
248
|
-
},
|
|
249
|
-
callData: calls,
|
|
250
|
-
});
|
|
251
|
-
},
|
|
252
|
-
async getAddress() {
|
|
253
|
-
return address;
|
|
254
|
-
},
|
|
255
|
-
async getFactoryArgs() {
|
|
256
|
-
return {};
|
|
257
|
-
},
|
|
258
|
-
async getNonce() {
|
|
259
|
-
// Default mode
|
|
260
|
-
const mode = '0x00';
|
|
261
|
-
const type = validatorType === 'root' ? '0x00' : '0x01';
|
|
262
|
-
const identifier = validatorAddress;
|
|
263
|
-
const nonceKey = '0x0000';
|
|
264
|
-
const key = (0, viem_1.concat)([mode, type, identifier, nonceKey]);
|
|
265
|
-
return (0, utils_1.getAccountNonce)(client, {
|
|
266
|
-
address,
|
|
267
|
-
entryPointAddress: account_abstraction_1.entryPoint07Address,
|
|
268
|
-
key: BigInt(key),
|
|
269
|
-
});
|
|
270
|
-
},
|
|
271
|
-
async getStubSignature() {
|
|
272
|
-
return getStubSignature();
|
|
273
|
-
},
|
|
274
|
-
async signMessage() {
|
|
275
|
-
throw new Error('Not implemented');
|
|
276
|
-
},
|
|
277
|
-
async signTypedData() {
|
|
278
|
-
throw new Error('Not implemented');
|
|
279
|
-
},
|
|
280
|
-
async signUserOperation(parameters) {
|
|
281
|
-
const { chainId = client.chain?.id, ...userOperation } = parameters;
|
|
282
|
-
if (!chainId)
|
|
283
|
-
throw new Error('Chain id not found');
|
|
284
|
-
const hash = (0, account_abstraction_1.getUserOperationHash)({
|
|
285
|
-
userOperation: {
|
|
286
|
-
...userOperation,
|
|
287
|
-
sender: userOperation.sender ?? (await this.getAddress()),
|
|
288
|
-
signature: '0x',
|
|
289
|
-
},
|
|
290
|
-
entryPointAddress: account_abstraction_1.entryPoint07Address,
|
|
291
|
-
entryPointVersion: '0.7',
|
|
292
|
-
chainId: chainId,
|
|
293
|
-
});
|
|
294
|
-
return await signUserOperation(hash);
|
|
295
|
-
},
|
|
296
|
-
});
|
|
297
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"kernel.test.d.ts","sourceRoot":"","sources":["../../../accounts/kernel.test.ts"],"names":[],"mappings":""}
|