@rhinestone/sdk 1.0.0-alpha.1 → 1.0.0-alpha.10
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/src/accounts/error.d.ts.map +1 -1
- package/dist/src/accounts/error.js +2 -0
- package/dist/src/accounts/index.d.ts +15 -8
- package/dist/src/accounts/index.d.ts.map +1 -1
- package/dist/src/accounts/index.js +204 -164
- package/dist/src/accounts/index.test.js +2 -2
- package/dist/src/accounts/kernel.d.ts +7 -9
- package/dist/src/accounts/kernel.d.ts.map +1 -1
- package/dist/src/accounts/kernel.js +0 -9
- package/dist/src/accounts/kernel.test.js +6 -6
- package/dist/src/accounts/nexus.d.ts +14 -13
- package/dist/src/accounts/nexus.d.ts.map +1 -1
- package/dist/src/accounts/nexus.js +91 -88
- package/dist/src/accounts/nexus.test.js +10 -10
- package/dist/src/accounts/safe.d.ts +4 -6
- package/dist/src/accounts/safe.d.ts.map +1 -1
- package/dist/src/accounts/safe.js +20 -30
- package/dist/src/accounts/safe.test.js +6 -6
- package/dist/src/accounts/startale.d.ts +20 -0
- package/dist/src/accounts/startale.d.ts.map +1 -0
- package/dist/src/accounts/startale.js +100 -0
- package/dist/src/accounts/startale.test.d.ts +2 -0
- package/dist/src/accounts/startale.test.d.ts.map +1 -0
- package/dist/src/accounts/startale.test.js +97 -0
- package/dist/src/accounts/utils.d.ts +4 -3
- package/dist/src/accounts/utils.d.ts.map +1 -1
- package/dist/src/accounts/utils.js +44 -0
- package/dist/src/actions/index.d.ts +17 -7
- package/dist/src/actions/index.d.ts.map +1 -1
- package/dist/src/actions/index.js +108 -15
- package/dist/src/actions/index.test.js +35 -17
- package/dist/src/actions/smart-session.d.ts +2 -2
- package/dist/src/actions/smart-session.d.ts.map +1 -1
- package/dist/src/execution/compact.d.ts +6 -3
- package/dist/src/execution/compact.d.ts.map +1 -1
- package/dist/src/execution/compact.js +44 -1
- package/dist/src/execution/error.d.ts +2 -9
- package/dist/src/execution/error.d.ts.map +1 -1
- package/dist/src/execution/error.js +4 -13
- package/dist/src/execution/index.d.ts +2 -3
- package/dist/src/execution/index.d.ts.map +1 -1
- package/dist/src/execution/index.js +34 -49
- package/dist/src/execution/smart-session.d.ts +1 -1
- package/dist/src/execution/smart-session.d.ts.map +1 -1
- package/dist/src/execution/smart-session.js +12 -17
- package/dist/src/execution/utils.d.ts +13 -11
- package/dist/src/execution/utils.d.ts.map +1 -1
- package/dist/src/execution/utils.js +141 -85
- package/dist/src/index.d.ts +14 -14
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +24 -20
- package/dist/src/modules/index.d.ts +3 -7
- package/dist/src/modules/index.d.ts.map +1 -1
- package/dist/src/modules/index.js +1 -10
- package/dist/src/modules/index.test.js +2 -2
- package/dist/src/modules/omni-account.d.ts +1 -4
- package/dist/src/modules/omni-account.d.ts.map +1 -1
- package/dist/src/modules/omni-account.js +2 -8
- package/dist/src/modules/read.d.ts +5 -6
- package/dist/src/modules/read.d.ts.map +1 -1
- package/dist/src/modules/read.js +6 -37
- package/dist/src/modules/validators/core.d.ts +6 -7
- package/dist/src/modules/validators/core.d.ts.map +1 -1
- package/dist/src/modules/validators/core.js +83 -8
- package/dist/src/modules/validators/core.test.js +4 -4
- package/dist/src/modules/validators/smart-sessions.d.ts +3 -3
- package/dist/src/modules/validators/smart-sessions.d.ts.map +1 -1
- package/dist/src/modules/validators/smart-sessions.js +7 -6
- package/dist/src/modules/validators/smart-sessions.test.js +4 -4
- package/dist/src/orchestrator/client.d.ts +1 -0
- package/dist/src/orchestrator/client.d.ts.map +1 -1
- package/dist/src/orchestrator/client.js +136 -94
- package/dist/src/orchestrator/consts.d.ts +3 -3
- package/dist/src/orchestrator/consts.d.ts.map +1 -1
- package/dist/src/orchestrator/consts.js +4 -4
- package/dist/src/orchestrator/index.d.ts +2 -2
- package/dist/src/orchestrator/index.d.ts.map +1 -1
- package/dist/src/orchestrator/index.js +1 -7
- package/dist/src/orchestrator/registry.d.ts +31 -12
- package/dist/src/orchestrator/registry.d.ts.map +1 -1
- package/dist/src/orchestrator/registry.js +57 -380
- package/dist/src/orchestrator/registry.json +365 -0
- package/dist/src/orchestrator/registry.test.d.ts.map +1 -0
- package/dist/src/orchestrator/registry.test.js +137 -0
- package/dist/src/orchestrator/types.d.ts +69 -14
- package/dist/src/orchestrator/types.d.ts.map +1 -1
- package/dist/src/orchestrator/utils.d.ts.map +1 -1
- package/dist/src/orchestrator/utils.js +2 -2
- package/dist/src/types.d.ts +41 -21
- package/dist/src/types.d.ts.map +1 -1
- package/dist/test/consts.d.ts +2 -2
- package/dist/test/consts.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/src/actions/registry.d.ts +0 -7
- package/dist/src/actions/registry.d.ts.map +0 -1
- package/dist/src/actions/registry.js +0 -7
- package/dist/src/actions/registry.test.d.ts.map +0 -1
- package/dist/src/actions/registry.test.js +0 -25
- package/dist/src/modules/registry.d.ts +0 -13
- package/dist/src/modules/registry.d.ts.map +0 -1
- package/dist/src/modules/registry.js +0 -67
- /package/dist/src/{actions → orchestrator}/registry.test.d.ts +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getValidators = exports.getOwners = exports.
|
|
3
|
+
exports.getValidators = exports.getOwners = exports.getOwnerValidator = exports.HOOK_ADDRESS = void 0;
|
|
4
4
|
exports.getSetup = getSetup;
|
|
5
5
|
exports.getWebauthnValidatorSignature = getWebauthnValidatorSignature;
|
|
6
6
|
exports.isRip7212SupportedNetwork = isRip7212SupportedNetwork;
|
|
@@ -10,12 +10,8 @@ const common_1 = require("./common");
|
|
|
10
10
|
const omni_account_1 = require("./omni-account");
|
|
11
11
|
Object.defineProperty(exports, "HOOK_ADDRESS", { enumerable: true, get: function () { return omni_account_1.HOOK_ADDRESS; } });
|
|
12
12
|
const read_1 = require("./read");
|
|
13
|
-
Object.defineProperty(exports, "areAttestersTrusted", { enumerable: true, get: function () { return read_1.areAttestersTrusted; } });
|
|
14
13
|
Object.defineProperty(exports, "getOwners", { enumerable: true, get: function () { return read_1.getOwners; } });
|
|
15
14
|
Object.defineProperty(exports, "getValidators", { enumerable: true, get: function () { return read_1.getValidators; } });
|
|
16
|
-
const registry_1 = require("./registry");
|
|
17
|
-
Object.defineProperty(exports, "getTrustAttesterCall", { enumerable: true, get: function () { return registry_1.getTrustAttesterCall; } });
|
|
18
|
-
Object.defineProperty(exports, "getTrustedAttesters", { enumerable: true, get: function () { return registry_1.getTrustedAttesters; } });
|
|
19
15
|
const validators_1 = require("./validators");
|
|
20
16
|
Object.defineProperty(exports, "getOwnerValidator", { enumerable: true, get: function () { return validators_1.getOwnerValidator; } });
|
|
21
17
|
const core_1 = require("./validators/core");
|
|
@@ -58,15 +54,11 @@ function getSetup(config) {
|
|
|
58
54
|
}
|
|
59
55
|
}
|
|
60
56
|
const hooks = [];
|
|
61
|
-
const attesters = (0, registry_1.getAttesters)();
|
|
62
57
|
return {
|
|
63
58
|
validators,
|
|
64
59
|
executors,
|
|
65
60
|
fallbacks,
|
|
66
61
|
hooks,
|
|
67
|
-
registry: omni_account_1.RHINESTONE_MODULE_REGISTRY_ADDRESS,
|
|
68
|
-
attesters: attesters.list,
|
|
69
|
-
threshold: attesters.threshold,
|
|
70
62
|
};
|
|
71
63
|
}
|
|
72
64
|
function getWebauthnValidatorSignature({ webauthn, signature, usePrecompiled = false, }) {
|
|
@@ -118,7 +110,6 @@ function isRip7212SupportedNetwork(chain) {
|
|
|
118
110
|
chains_1.optimism,
|
|
119
111
|
chains_1.optimismSepolia,
|
|
120
112
|
chains_1.polygon,
|
|
121
|
-
chains_1.polygonAmoy,
|
|
122
113
|
chains_1.base,
|
|
123
114
|
chains_1.baseSepolia,
|
|
124
115
|
chains_1.arbitrum,
|
|
@@ -15,7 +15,7 @@ const index_1 = require("./index");
|
|
|
15
15
|
},
|
|
16
16
|
};
|
|
17
17
|
const setup = (0, index_1.getSetup)(config);
|
|
18
|
-
(0, vitest_1.expect)(setup.validators[0].address).toBe('
|
|
18
|
+
(0, vitest_1.expect)(setup.validators[0].address).toBe('0x0000000000E9E6E96Bcaa3c113187CdB7E38AED9');
|
|
19
19
|
(0, vitest_1.expect)(setup.validators[0].type).toBe(1n);
|
|
20
20
|
});
|
|
21
21
|
(0, vitest_1.test)('should use webauthn validator for passkey owners', () => {
|
|
@@ -28,7 +28,7 @@ const index_1 = require("./index");
|
|
|
28
28
|
};
|
|
29
29
|
const setup = (0, index_1.getSetup)(config);
|
|
30
30
|
(0, vitest_1.expect)(setup.validators).toHaveLength(1);
|
|
31
|
-
(0, vitest_1.expect)(setup.validators[0].address).toBe('
|
|
31
|
+
(0, vitest_1.expect)(setup.validators[0].address).toBe('0x0000000000578c4cB0e472a5462da43C495C3F33');
|
|
32
32
|
(0, vitest_1.expect)(setup.validators[0].type).toBe(1n);
|
|
33
33
|
});
|
|
34
34
|
(0, vitest_1.test)('should use smart session validator when sessions are enabled', () => {
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import type { Address } from 'viem';
|
|
2
|
-
declare const OMNI_ACCOUNT_MOCK_ATTESTER_ADDRESS: Address;
|
|
3
|
-
declare const RHINESTONE_MODULE_REGISTRY_ADDRESS: Address;
|
|
4
|
-
declare const RHINESTONE_ATTESTER_ADDRESS: Address;
|
|
5
2
|
declare const HOOK_ADDRESS: Address;
|
|
6
3
|
declare const TARGET_MODULE_ADDRESS: Address;
|
|
7
4
|
declare const SAME_CHAIN_MODULE_ADDRESS: Address;
|
|
8
5
|
declare const INTENT_EXECUTOR_ADDRESS: Address;
|
|
9
|
-
export {
|
|
6
|
+
export { HOOK_ADDRESS, TARGET_MODULE_ADDRESS, SAME_CHAIN_MODULE_ADDRESS, INTENT_EXECUTOR_ADDRESS, };
|
|
10
7
|
//# sourceMappingURL=omni-account.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"omni-account.d.ts","sourceRoot":"","sources":["../../../modules/omni-account.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAEnC,QAAA,MAAM,
|
|
1
|
+
{"version":3,"file":"omni-account.d.ts","sourceRoot":"","sources":["../../../modules/omni-account.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAEnC,QAAA,MAAM,YAAY,EAAE,OAAsD,CAAA;AAC1E,QAAA,MAAM,qBAAqB,EAAE,OACiB,CAAA;AAC9C,QAAA,MAAM,yBAAyB,EAAE,OACa,CAAA;AAE9C,QAAA,MAAM,uBAAuB,EAAE,OACe,CAAA;AAE9C,OAAO,EACL,YAAY,EACZ,qBAAqB,EACrB,yBAAyB,EACzB,uBAAuB,GACxB,CAAA"}
|
|
@@ -1,17 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.INTENT_EXECUTOR_ADDRESS = exports.SAME_CHAIN_MODULE_ADDRESS = exports.TARGET_MODULE_ADDRESS = exports.HOOK_ADDRESS =
|
|
4
|
-
const OMNI_ACCOUNT_MOCK_ATTESTER_ADDRESS = '0x6D0515e8E499468DCe9583626f0cA15b887f9d03';
|
|
5
|
-
exports.OMNI_ACCOUNT_MOCK_ATTESTER_ADDRESS = OMNI_ACCOUNT_MOCK_ATTESTER_ADDRESS;
|
|
6
|
-
const RHINESTONE_MODULE_REGISTRY_ADDRESS = '0x000000000069e2a187aeffb852bf3ccdc95151b2';
|
|
7
|
-
exports.RHINESTONE_MODULE_REGISTRY_ADDRESS = RHINESTONE_MODULE_REGISTRY_ADDRESS;
|
|
8
|
-
const RHINESTONE_ATTESTER_ADDRESS = '0x000000333034E9f539ce08819E12c1b8Cb29084d';
|
|
9
|
-
exports.RHINESTONE_ATTESTER_ADDRESS = RHINESTONE_ATTESTER_ADDRESS;
|
|
3
|
+
exports.INTENT_EXECUTOR_ADDRESS = exports.SAME_CHAIN_MODULE_ADDRESS = exports.TARGET_MODULE_ADDRESS = exports.HOOK_ADDRESS = void 0;
|
|
10
4
|
const HOOK_ADDRESS = '0x0000000000f6Ed8Be424d673c63eeFF8b9267420';
|
|
11
5
|
exports.HOOK_ADDRESS = HOOK_ADDRESS;
|
|
12
6
|
const TARGET_MODULE_ADDRESS = '0x0000000000E5a37279A001301A837a91b5de1D5E';
|
|
13
7
|
exports.TARGET_MODULE_ADDRESS = TARGET_MODULE_ADDRESS;
|
|
14
8
|
const SAME_CHAIN_MODULE_ADDRESS = '0x000000000043ff16d5776c7F0f65Ec485C17Ca04';
|
|
15
9
|
exports.SAME_CHAIN_MODULE_ADDRESS = SAME_CHAIN_MODULE_ADDRESS;
|
|
16
|
-
const INTENT_EXECUTOR_ADDRESS = '
|
|
10
|
+
const INTENT_EXECUTOR_ADDRESS = '0x00000000005aD9ce1f5035FD62CA96CEf16AdAAF';
|
|
17
11
|
exports.INTENT_EXECUTOR_ADDRESS = INTENT_EXECUTOR_ADDRESS;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { Address, Chain } from 'viem';
|
|
2
|
-
import { AccountType } from '../types';
|
|
3
|
-
declare function getValidators(accountType: AccountType, account: Address, chain: Chain): Promise<Address[]>;
|
|
4
|
-
declare function getOwners(account: Address, chain: Chain): Promise<{
|
|
1
|
+
import { type Address, type Chain } from 'viem';
|
|
2
|
+
import type { AccountType, ProviderConfig } from '../types';
|
|
3
|
+
declare function getValidators(accountType: AccountType, account: Address, chain: Chain, provider?: ProviderConfig): Promise<Address[]>;
|
|
4
|
+
declare function getOwners(account: Address, chain: Chain, provider?: ProviderConfig): Promise<{
|
|
5
5
|
accounts: Address[];
|
|
6
6
|
threshold: number;
|
|
7
7
|
} | null>;
|
|
8
|
-
|
|
9
|
-
export { getValidators, getOwners, areAttestersTrusted };
|
|
8
|
+
export { getValidators, getOwners };
|
|
10
9
|
//# sourceMappingURL=read.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../../modules/read.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../../modules/read.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,KAAK,EAAsB,MAAM,MAAM,CAAA;AAEnE,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAG3D,iBAAe,aAAa,CAC1B,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,KAAK,EACZ,QAAQ,CAAC,EAAE,cAAc,GACxB,OAAO,CAAC,OAAO,EAAE,CAAC,CA8CpB;AAED,iBAAe,SAAS,CACtB,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,KAAK,EACZ,QAAQ,CAAC,EAAE,cAAc,GACxB,OAAO,CAAC;IACT,QAAQ,EAAE,OAAO,EAAE,CAAA;IACnB,SAAS,EAAE,MAAM,CAAA;CAClB,GAAG,IAAI,CAAC,CAkER;AAED,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,CAAA"}
|
package/dist/src/modules/read.js
CHANGED
|
@@ -2,18 +2,17 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getValidators = getValidators;
|
|
4
4
|
exports.getOwners = getOwners;
|
|
5
|
-
exports.areAttestersTrusted = areAttestersTrusted;
|
|
6
5
|
const viem_1 = require("viem");
|
|
7
|
-
const
|
|
8
|
-
const registry_1 = require("./registry");
|
|
6
|
+
const utils_1 = require("../accounts/utils");
|
|
9
7
|
const core_1 = require("./validators/core");
|
|
10
|
-
async function getValidators(accountType, account, chain) {
|
|
8
|
+
async function getValidators(accountType, account, chain, provider) {
|
|
11
9
|
const publicClient = (0, viem_1.createPublicClient)({
|
|
12
10
|
chain,
|
|
13
|
-
transport: (0,
|
|
11
|
+
transport: (0, utils_1.createTransport)(chain, provider),
|
|
14
12
|
});
|
|
15
13
|
switch (accountType) {
|
|
16
14
|
case 'safe':
|
|
15
|
+
case 'startale':
|
|
17
16
|
case 'nexus': {
|
|
18
17
|
const validators = await publicClient.readContract({
|
|
19
18
|
abi: [
|
|
@@ -53,10 +52,10 @@ async function getValidators(accountType, account, chain) {
|
|
|
53
52
|
}
|
|
54
53
|
}
|
|
55
54
|
}
|
|
56
|
-
async function getOwners(account, chain) {
|
|
55
|
+
async function getOwners(account, chain, provider) {
|
|
57
56
|
const publicClient = (0, viem_1.createPublicClient)({
|
|
58
57
|
chain,
|
|
59
|
-
transport: (0,
|
|
58
|
+
transport: (0, utils_1.createTransport)(chain, provider),
|
|
60
59
|
});
|
|
61
60
|
const moduleAddress = core_1.OWNABLE_VALIDATOR_ADDRESS;
|
|
62
61
|
const [ownerResult, thresholdResult] = await publicClient.multicall({
|
|
@@ -120,33 +119,3 @@ async function getOwners(account, chain) {
|
|
|
120
119
|
threshold: thresholdResult.result,
|
|
121
120
|
};
|
|
122
121
|
}
|
|
123
|
-
async function areAttestersTrusted(account, chain) {
|
|
124
|
-
const { list: requiredAttesters } = (0, registry_1.getAttesters)();
|
|
125
|
-
const publicClient = (0, viem_1.createPublicClient)({
|
|
126
|
-
chain,
|
|
127
|
-
transport: (0, viem_1.http)(),
|
|
128
|
-
});
|
|
129
|
-
const trustedAttesters = await publicClient.readContract({
|
|
130
|
-
abi: [
|
|
131
|
-
{
|
|
132
|
-
type: 'function',
|
|
133
|
-
name: 'findTrustedAttesters',
|
|
134
|
-
inputs: [
|
|
135
|
-
{
|
|
136
|
-
type: 'address',
|
|
137
|
-
name: 'smartAccount',
|
|
138
|
-
},
|
|
139
|
-
],
|
|
140
|
-
outputs: [
|
|
141
|
-
{
|
|
142
|
-
type: 'address[]',
|
|
143
|
-
},
|
|
144
|
-
],
|
|
145
|
-
},
|
|
146
|
-
],
|
|
147
|
-
functionName: 'findTrustedAttesters',
|
|
148
|
-
address: omni_account_1.RHINESTONE_MODULE_REGISTRY_ADDRESS,
|
|
149
|
-
args: [account],
|
|
150
|
-
});
|
|
151
|
-
return requiredAttesters.every((attester) => trustedAttesters.includes((0, viem_1.getAddress)(attester)));
|
|
152
|
-
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Account, type Address, type Hex } from 'viem';
|
|
2
|
-
import type { OwnerSet, RhinestoneAccountConfig } from '../../types';
|
|
1
|
+
import { type Account, type Address, type Hex } from 'viem';
|
|
2
|
+
import type { OwnableValidatorConfig, OwnerSet, RhinestoneAccountConfig, WebauthnValidatorConfig } from '../../types';
|
|
3
3
|
import { type Module } from '../common';
|
|
4
4
|
interface PublicKey {
|
|
5
5
|
prefix?: number | undefined;
|
|
@@ -12,15 +12,14 @@ interface WebauthnCredential {
|
|
|
12
12
|
}
|
|
13
13
|
declare const OWNABLE_VALIDATOR_ADDRESS: Address;
|
|
14
14
|
declare const WEBAUTHN_VALIDATOR_ADDRESS: Address;
|
|
15
|
+
declare const MULTI_FACTOR_VALIDATOR_ADDRESS: Address;
|
|
15
16
|
declare function getOwnerValidator(config: RhinestoneAccountConfig): Module;
|
|
16
17
|
declare function getMockSignature(ownerSet: OwnerSet): Hex;
|
|
17
18
|
declare function getValidator(owners: OwnerSet): Module;
|
|
18
|
-
declare function getOwnableValidator(
|
|
19
|
-
threshold: number;
|
|
20
|
-
owners: Address[];
|
|
21
|
-
}): Module;
|
|
19
|
+
declare function getOwnableValidator(threshold: number, owners: Address[]): Module;
|
|
22
20
|
declare function getWebAuthnValidator(webAuthnCredential: WebauthnCredential): Module;
|
|
21
|
+
declare function getMultiFactorValidator(threshold: number, validators: (OwnableValidatorConfig | WebauthnValidatorConfig | null)[]): Module;
|
|
23
22
|
declare function getSocialRecoveryValidator(guardians: Account[], threshold?: number): Module;
|
|
24
|
-
export { OWNABLE_VALIDATOR_ADDRESS, WEBAUTHN_VALIDATOR_ADDRESS, getOwnerValidator, getOwnableValidator, getWebAuthnValidator, getSocialRecoveryValidator, getValidator, getMockSignature, };
|
|
23
|
+
export { OWNABLE_VALIDATOR_ADDRESS, WEBAUTHN_VALIDATOR_ADDRESS, MULTI_FACTOR_VALIDATOR_ADDRESS, getOwnerValidator, getOwnableValidator, getWebAuthnValidator, getMultiFactorValidator, getSocialRecoveryValidator, getValidator, getMockSignature, };
|
|
25
24
|
export type { WebauthnCredential };
|
|
26
25
|
//# sourceMappingURL=core.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../modules/validators/core.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../modules/validators/core.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,OAAO,EAKZ,KAAK,GAAG,EAKT,MAAM,MAAM,CAAA;AAEb,OAAO,KAAK,EACV,sBAAsB,EACtB,QAAQ,EACR,uBAAuB,EACvB,uBAAuB,EACxB,MAAM,aAAa,CAAA;AAEpB,OAAO,EAA4B,KAAK,MAAM,EAAE,MAAM,WAAW,CAAA;AAEjE,UAAU,SAAS;IACjB,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC3B,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;CACV;AAED,UAAU,kBAAkB;IAC1B,MAAM,EAAE,SAAS,GAAG,GAAG,GAAG,UAAU,CAAA;IACpC,eAAe,EAAE,MAAM,CAAA;CACxB;AAED,QAAA,MAAM,yBAAyB,EAAE,OACa,CAAA;AAC9C,QAAA,MAAM,0BAA0B,EAAE,OACY,CAAA;AAG9C,QAAA,MAAM,8BAA8B,EAAE,OACQ,CAAA;AAO9C,iBAAS,iBAAiB,CAAC,MAAM,EAAE,uBAAuB,UAEzD;AAED,iBAAS,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,GAAG,GAAG,CAiDjD;AAED,iBAAS,YAAY,CAAC,MAAM,EAAE,QAAQ,UAgBrC;AAED,iBAAS,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,CAiBzE;AAED,iBAAS,oBAAoB,CAAC,kBAAkB,EAAE,kBAAkB,GAAG,MAAM,CAwD5E;AAED,iBAAS,uBAAuB,CAC9B,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,CAAC,sBAAsB,GAAG,uBAAuB,GAAG,IAAI,CAAC,EAAE,GACtE,MAAM,CAgDR;AAED,iBAAS,0BAA0B,CACjC,SAAS,EAAE,OAAO,EAAE,EACpB,SAAS,SAAI,GACZ,MAAM,CAsBR;AAeD,OAAO,EACL,yBAAyB,EACzB,0BAA0B,EAC1B,8BAA8B,EAC9B,iBAAiB,EACjB,mBAAmB,EACnB,oBAAoB,EACpB,uBAAuB,EACvB,0BAA0B,EAC1B,YAAY,EACZ,gBAAgB,GACjB,CAAA;AACD,YAAY,EAAE,kBAAkB,EAAE,CAAA"}
|
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WEBAUTHN_VALIDATOR_ADDRESS = exports.OWNABLE_VALIDATOR_ADDRESS = void 0;
|
|
3
|
+
exports.MULTI_FACTOR_VALIDATOR_ADDRESS = exports.WEBAUTHN_VALIDATOR_ADDRESS = exports.OWNABLE_VALIDATOR_ADDRESS = void 0;
|
|
4
4
|
exports.getOwnerValidator = getOwnerValidator;
|
|
5
5
|
exports.getOwnableValidator = getOwnableValidator;
|
|
6
6
|
exports.getWebAuthnValidator = getWebAuthnValidator;
|
|
7
|
+
exports.getMultiFactorValidator = getMultiFactorValidator;
|
|
7
8
|
exports.getSocialRecoveryValidator = getSocialRecoveryValidator;
|
|
8
9
|
exports.getValidator = getValidator;
|
|
9
10
|
exports.getMockSignature = getMockSignature;
|
|
10
11
|
const viem_1 = require("viem");
|
|
11
12
|
const common_1 = require("../common");
|
|
12
|
-
const OWNABLE_VALIDATOR_ADDRESS = '
|
|
13
|
+
const OWNABLE_VALIDATOR_ADDRESS = '0x0000000000E9E6E96Bcaa3c113187CdB7E38AED9';
|
|
13
14
|
exports.OWNABLE_VALIDATOR_ADDRESS = OWNABLE_VALIDATOR_ADDRESS;
|
|
14
|
-
const WEBAUTHN_VALIDATOR_ADDRESS = '
|
|
15
|
+
const WEBAUTHN_VALIDATOR_ADDRESS = '0x0000000000578c4cB0e472a5462da43C495C3F33';
|
|
15
16
|
exports.WEBAUTHN_VALIDATOR_ADDRESS = WEBAUTHN_VALIDATOR_ADDRESS;
|
|
16
17
|
const SOCIAL_RECOVERY_VALIDATOR_ADDRESS = '0xA04D053b3C8021e8D5bF641816c42dAA75D8b597';
|
|
18
|
+
const MULTI_FACTOR_VALIDATOR_ADDRESS = '0xf6bDf42c9BE18cEcA5C06c42A43DAf7FBbe7896b';
|
|
19
|
+
exports.MULTI_FACTOR_VALIDATOR_ADDRESS = MULTI_FACTOR_VALIDATOR_ADDRESS;
|
|
17
20
|
const ECDSA_MOCK_SIGNATURE = '0x81d4b4981670cb18f99f0b4a66446df1bf5b204d24cfcb659bf38ba27a4359b5711649ec2423c5e1247245eba2964679b6a1dbb85c992ae40b9b00c6935b02ff1b';
|
|
18
21
|
const WEBAUTHN_MOCK_SIGNATURE = '0x00000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000001635bc6d0f68ff895cae8a288ecf7542a6a9cd555df784b73e1e2ea7e9104b1db15e9015d280cb19527881c625fee43fd3a405d5b0d199a8c8e6589a7381209e40000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002549960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d97631d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f47b2274797065223a22776562617574686e2e676574222c226368616c6c656e6765223a22746278584e465339585f3442797231634d77714b724947422d5f3330613051685a36793775634d30424f45222c226f726967696e223a22687474703a2f2f6c6f63616c686f73743a33303030222c2263726f73734f726967696e223a66616c73652c20226f746865725f6b6579735f63616e5f62655f61646465645f68657265223a22646f206e6f7420636f6d7061726520636c69656e74446174614a534f4e20616761696e737420612074656d706c6174652e205365652068747470733a2f2f676f6f2e676c2f796162506578227d000000000000000000000000';
|
|
19
22
|
function getOwnerValidator(config) {
|
|
@@ -28,23 +31,52 @@ function getMockSignature(ownerSet) {
|
|
|
28
31
|
}
|
|
29
32
|
case 'passkey':
|
|
30
33
|
return WEBAUTHN_MOCK_SIGNATURE;
|
|
34
|
+
case 'multi-factor': {
|
|
35
|
+
const mockValidators = ownerSet.validators.map((validator, index) => {
|
|
36
|
+
const validatorModule = getValidator(validator);
|
|
37
|
+
const signature = getMockSignature(validator);
|
|
38
|
+
return {
|
|
39
|
+
packedValidatorAndId: (0, viem_1.encodePacked)(['bytes12', 'address'], [
|
|
40
|
+
(0, viem_1.pad)((0, viem_1.toHex)(index), {
|
|
41
|
+
size: 12,
|
|
42
|
+
}),
|
|
43
|
+
validatorModule.address,
|
|
44
|
+
]),
|
|
45
|
+
data: signature,
|
|
46
|
+
};
|
|
47
|
+
});
|
|
48
|
+
return (0, viem_1.encodeAbiParameters)([
|
|
49
|
+
{
|
|
50
|
+
components: [
|
|
51
|
+
{
|
|
52
|
+
internalType: 'bytes32',
|
|
53
|
+
name: 'packedValidatorAndId',
|
|
54
|
+
type: 'bytes32',
|
|
55
|
+
},
|
|
56
|
+
{ internalType: 'bytes', name: 'data', type: 'bytes' },
|
|
57
|
+
],
|
|
58
|
+
name: 'validators',
|
|
59
|
+
type: 'tuple[]',
|
|
60
|
+
},
|
|
61
|
+
], [mockValidators]);
|
|
62
|
+
}
|
|
31
63
|
}
|
|
32
64
|
}
|
|
33
65
|
function getValidator(owners) {
|
|
34
66
|
switch (owners.type) {
|
|
35
67
|
case 'ecdsa':
|
|
36
|
-
return getOwnableValidator(
|
|
37
|
-
threshold: owners.threshold ?? 1,
|
|
38
|
-
owners: owners.accounts.map((account) => account.address),
|
|
39
|
-
});
|
|
68
|
+
return getOwnableValidator(owners.threshold ?? 1, owners.accounts.map((account) => account.address));
|
|
40
69
|
case 'passkey':
|
|
41
70
|
return getWebAuthnValidator({
|
|
42
71
|
pubKey: owners.account.publicKey,
|
|
43
72
|
authenticatorId: owners.account.id,
|
|
44
73
|
});
|
|
74
|
+
case 'multi-factor': {
|
|
75
|
+
return getMultiFactorValidator(owners.threshold ?? 1, owners.validators);
|
|
76
|
+
}
|
|
45
77
|
}
|
|
46
78
|
}
|
|
47
|
-
function getOwnableValidator(
|
|
79
|
+
function getOwnableValidator(threshold, owners) {
|
|
48
80
|
return {
|
|
49
81
|
address: OWNABLE_VALIDATOR_ADDRESS,
|
|
50
82
|
initData: (0, viem_1.encodeAbiParameters)([
|
|
@@ -110,6 +142,49 @@ function getWebAuthnValidator(webAuthnCredential) {
|
|
|
110
142
|
type: common_1.MODULE_TYPE_ID_VALIDATOR,
|
|
111
143
|
};
|
|
112
144
|
}
|
|
145
|
+
function getMultiFactorValidator(threshold, validators) {
|
|
146
|
+
return {
|
|
147
|
+
address: MULTI_FACTOR_VALIDATOR_ADDRESS,
|
|
148
|
+
initData: (0, viem_1.encodePacked)(['uint8', 'bytes'], [
|
|
149
|
+
threshold,
|
|
150
|
+
(0, viem_1.encodeAbiParameters)([
|
|
151
|
+
{
|
|
152
|
+
components: [
|
|
153
|
+
{
|
|
154
|
+
internalType: 'bytes32',
|
|
155
|
+
name: 'packedValidatorAndId',
|
|
156
|
+
type: 'bytes32',
|
|
157
|
+
},
|
|
158
|
+
{ internalType: 'bytes', name: 'data', type: 'bytes' },
|
|
159
|
+
],
|
|
160
|
+
name: 'validators',
|
|
161
|
+
type: 'tuple[]',
|
|
162
|
+
},
|
|
163
|
+
], [
|
|
164
|
+
validators
|
|
165
|
+
.map((validator, index) => {
|
|
166
|
+
if (validator === null) {
|
|
167
|
+
return null;
|
|
168
|
+
}
|
|
169
|
+
const validatorModule = getValidator(validator);
|
|
170
|
+
return {
|
|
171
|
+
packedValidatorAndId: (0, viem_1.concat)([
|
|
172
|
+
(0, viem_1.pad)((0, viem_1.toHex)(index), {
|
|
173
|
+
size: 12,
|
|
174
|
+
}),
|
|
175
|
+
validatorModule.address,
|
|
176
|
+
]),
|
|
177
|
+
data: validatorModule.initData,
|
|
178
|
+
};
|
|
179
|
+
})
|
|
180
|
+
.filter((validator) => validator !== null),
|
|
181
|
+
]),
|
|
182
|
+
]),
|
|
183
|
+
deInitData: '0x',
|
|
184
|
+
additionalContext: '0x',
|
|
185
|
+
type: common_1.MODULE_TYPE_ID_VALIDATOR,
|
|
186
|
+
};
|
|
187
|
+
}
|
|
113
188
|
function getSocialRecoveryValidator(guardians, threshold = 1) {
|
|
114
189
|
const guardianAddresses = guardians.map((guardian) => guardian.address);
|
|
115
190
|
guardianAddresses.sort();
|
|
@@ -14,7 +14,7 @@ const core_1 = require("./core");
|
|
|
14
14
|
});
|
|
15
15
|
(0, vitest_1.expect)(validator.type).toEqual(common_1.MODULE_TYPE_ID_VALIDATOR);
|
|
16
16
|
(0, vitest_1.expect)((0, viem_1.isAddress)(validator.address)).toEqual(true);
|
|
17
|
-
(0, vitest_1.expect)(validator.address).toEqual('
|
|
17
|
+
(0, vitest_1.expect)(validator.address).toEqual('0x0000000000E9E6E96Bcaa3c113187CdB7E38AED9');
|
|
18
18
|
(0, vitest_1.expect)(validator.initData).toEqual('0x000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000001000000000000000000000000f6c02c78ded62973b43bfa523b247da099486936');
|
|
19
19
|
});
|
|
20
20
|
(0, vitest_1.test)('ECDSA: two addresses', () => {
|
|
@@ -24,7 +24,7 @@ const core_1 = require("./core");
|
|
|
24
24
|
});
|
|
25
25
|
(0, vitest_1.expect)(validator.type).toEqual(common_1.MODULE_TYPE_ID_VALIDATOR);
|
|
26
26
|
(0, vitest_1.expect)((0, viem_1.isAddress)(validator.address)).toEqual(true);
|
|
27
|
-
(0, vitest_1.expect)(validator.address).toEqual('
|
|
27
|
+
(0, vitest_1.expect)(validator.address).toEqual('0x0000000000E9E6E96Bcaa3c113187CdB7E38AED9');
|
|
28
28
|
(0, vitest_1.expect)(validator.initData).toEqual('0x0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000020000000000000000000000006092086a3dc0020cd604a68fcf5d430007d51bb7000000000000000000000000f6c02c78ded62973b43bfa523b247da099486936');
|
|
29
29
|
});
|
|
30
30
|
(0, vitest_1.test)('ECDSA: three addresses, custom threshold', () => {
|
|
@@ -35,7 +35,7 @@ const core_1 = require("./core");
|
|
|
35
35
|
});
|
|
36
36
|
(0, vitest_1.expect)(validator.type).toEqual(common_1.MODULE_TYPE_ID_VALIDATOR);
|
|
37
37
|
(0, vitest_1.expect)((0, viem_1.isAddress)(validator.address)).toEqual(true);
|
|
38
|
-
(0, vitest_1.expect)(validator.address).toEqual('
|
|
38
|
+
(0, vitest_1.expect)(validator.address).toEqual('0x0000000000E9E6E96Bcaa3c113187CdB7E38AED9');
|
|
39
39
|
(0, vitest_1.expect)(validator.initData).toEqual('0x0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000030000000000000000000000006092086a3dc0020cd604a68fcf5d430007d51bb7000000000000000000000000c27b7578151c5ef713c62c65db09763d57ac3596000000000000000000000000f6c02c78ded62973b43bfa523b247da099486936');
|
|
40
40
|
});
|
|
41
41
|
(0, vitest_1.test)('Passkey', () => {
|
|
@@ -45,7 +45,7 @@ const core_1 = require("./core");
|
|
|
45
45
|
});
|
|
46
46
|
(0, vitest_1.expect)(validator.type).toEqual(common_1.MODULE_TYPE_ID_VALIDATOR);
|
|
47
47
|
(0, vitest_1.expect)((0, viem_1.isAddress)(validator.address)).toEqual(true);
|
|
48
|
-
(0, vitest_1.expect)(validator.address).toEqual('
|
|
48
|
+
(0, vitest_1.expect)(validator.address).toEqual('0x0000000000578c4cB0e472a5462da43C495C3F33');
|
|
49
49
|
(0, vitest_1.expect)(validator.initData).toEqual('0x580a9af0569ad3905b26a703201b358aa0904236642ebe79b22a19d00d3737637d46f725a5427ae45a9569259bf67e1e16b187d7b3ad1ed70138c4f0409677d19c9a01073b202db2ed56e604ad11db557d8c3ad75181619597f21b830f2da82a');
|
|
50
50
|
});
|
|
51
51
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Address, type Chain, type Hex, type PublicClient } from 'viem';
|
|
2
|
-
import type { AccountType, RhinestoneAccountConfig, Session } from '../../types';
|
|
2
|
+
import type { AccountType, ProviderConfig, RhinestoneAccountConfig, Session } from '../../types';
|
|
3
3
|
import { type Module } from '../common';
|
|
4
4
|
interface SessionData {
|
|
5
5
|
sessionValidator: Address;
|
|
@@ -82,8 +82,8 @@ declare const SMART_SESSIONS_VALIDATOR_ADDRESS: Address;
|
|
|
82
82
|
declare const SMART_SESSION_MODE_USE = "0x00";
|
|
83
83
|
declare const SMART_SESSION_MODE_ENABLE = "0x01";
|
|
84
84
|
declare const SMART_SESSION_MODE_UNSAFE_ENABLE = "0x02";
|
|
85
|
-
declare function getSessionData(chain: Chain, session: Session): Promise<SessionData>;
|
|
86
|
-
declare function getEnableSessionCall(chain: Chain, session: Session): Promise<{
|
|
85
|
+
declare function getSessionData(chain: Chain, session: Session, provider?: ProviderConfig): Promise<SessionData>;
|
|
86
|
+
declare function getEnableSessionCall(chain: Chain, session: Session, provider?: ProviderConfig): Promise<{
|
|
87
87
|
to: `0x${string}`;
|
|
88
88
|
data: `0x${string}`;
|
|
89
89
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"smart-sessions.d.ts","sourceRoot":"","sources":["../../../../modules/validators/smart-sessions.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,KAAK,EAKV,KAAK,GAAG,
|
|
1
|
+
{"version":3,"file":"smart-sessions.d.ts","sourceRoot":"","sources":["../../../../modules/validators/smart-sessions.ts"],"names":[],"mappings":"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"}
|
|
@@ -9,6 +9,7 @@ exports.getPermissionId = getPermissionId;
|
|
|
9
9
|
exports.isSessionEnabled = isSessionEnabled;
|
|
10
10
|
const solady_1 = require("solady");
|
|
11
11
|
const viem_1 = require("viem");
|
|
12
|
+
const utils_1 = require("../../accounts/utils");
|
|
12
13
|
const orchestrator_1 = require("../../orchestrator");
|
|
13
14
|
const smart_sessions_1 = require("../abi/smart-sessions");
|
|
14
15
|
const common_1 = require("../common");
|
|
@@ -36,8 +37,8 @@ const ACTION_CONDITION_GREATER_THAN_OR_EQUAL = 3;
|
|
|
36
37
|
const ACTION_CONDITION_LESS_THAN_OR_EQUAL = 4;
|
|
37
38
|
const ACTION_CONDITION_NOT_EQUAL = 5;
|
|
38
39
|
const ACTION_CONDITION_IN_RANGE = 6;
|
|
39
|
-
async function getSessionData(chain, session) {
|
|
40
|
-
const { appDomainSeparator, contentsType } = await getSessionAllowedERC7739Content(chain);
|
|
40
|
+
async function getSessionData(chain, session, provider) {
|
|
41
|
+
const { appDomainSeparator, contentsType } = await getSessionAllowedERC7739Content(chain, provider);
|
|
41
42
|
const allowedERC7739Content = [
|
|
42
43
|
{
|
|
43
44
|
appDomainSeparator,
|
|
@@ -46,8 +47,8 @@ async function getSessionData(chain, session) {
|
|
|
46
47
|
];
|
|
47
48
|
return getSmartSessionData(chain, session, allowedERC7739Content);
|
|
48
49
|
}
|
|
49
|
-
async function getEnableSessionCall(chain, session) {
|
|
50
|
-
const { appDomainSeparator, contentsType } = await getSessionAllowedERC7739Content(chain);
|
|
50
|
+
async function getEnableSessionCall(chain, session, provider) {
|
|
51
|
+
const { appDomainSeparator, contentsType } = await getSessionAllowedERC7739Content(chain, provider);
|
|
51
52
|
const allowedERC7739Content = [
|
|
52
53
|
{
|
|
53
54
|
appDomainSeparator,
|
|
@@ -90,10 +91,10 @@ function getOmniAccountActions(chain) {
|
|
|
90
91
|
];
|
|
91
92
|
return omniActions;
|
|
92
93
|
}
|
|
93
|
-
async function getSessionAllowedERC7739Content(chain) {
|
|
94
|
+
async function getSessionAllowedERC7739Content(chain, provider) {
|
|
94
95
|
const publicClient = (0, viem_1.createPublicClient)({
|
|
95
96
|
chain,
|
|
96
|
-
transport: (0,
|
|
97
|
+
transport: (0, utils_1.createTransport)(chain, provider),
|
|
97
98
|
});
|
|
98
99
|
const appDomainSeparator = await publicClient.readContract({
|
|
99
100
|
address: omni_account_1.HOOK_ADDRESS,
|
|
@@ -15,7 +15,7 @@ const smart_sessions_2 = require("./smart-sessions");
|
|
|
15
15
|
type: 'ecdsa',
|
|
16
16
|
accounts: [consts_1.accountA, consts_1.accountB],
|
|
17
17
|
},
|
|
18
|
-
})).toBe('
|
|
18
|
+
})).toBe('0x4ad46f8661acf29090a7635877ff94953e0ea05b0583d32de3839acc49739182');
|
|
19
19
|
});
|
|
20
20
|
(0, vitest_1.test)('with salt', () => {
|
|
21
21
|
(0, vitest_1.expect)((0, smart_sessions_2.getPermissionId)({
|
|
@@ -24,7 +24,7 @@ const smart_sessions_2 = require("./smart-sessions");
|
|
|
24
24
|
accounts: [consts_1.accountA, consts_1.accountB],
|
|
25
25
|
},
|
|
26
26
|
salt: '0x97340e1cfff3319c76ef22b2bc9d3231071d550125d68c9d4a8972823f166320',
|
|
27
|
-
})).toBe('
|
|
27
|
+
})).toBe('0xb1adc169088099c6830120c63cde8d2c7e1b9a82857b35c0527dc2e37ce3e7bd');
|
|
28
28
|
});
|
|
29
29
|
});
|
|
30
30
|
(0, vitest_1.describe)('Smart Session Validator', () => {
|
|
@@ -217,10 +217,10 @@ const smart_sessions_2 = require("./smart-sessions");
|
|
|
217
217
|
});
|
|
218
218
|
(0, vitest_1.describe)('Encode Smart Session Signature', () => {
|
|
219
219
|
(0, vitest_1.test)('use mode', () => {
|
|
220
|
-
const permissionId = '
|
|
220
|
+
const permissionId = '0x4ad46f8661acf29090a7635877ff94953e0ea05b0583d32de3839acc49739182';
|
|
221
221
|
const signature = '0xabcdef';
|
|
222
222
|
const sessionSignature = (0, smart_sessions_2.encodeSmartSessionSignature)(smart_sessions_2.SMART_SESSION_MODE_USE, permissionId, signature);
|
|
223
|
-
(0, vitest_1.expect)(sessionSignature).toEqual('
|
|
223
|
+
(0, vitest_1.expect)(sessionSignature).toEqual('0x004ad46f8661acf29090a7635877ff94953e0ea05b0583d32de3839acc49739182abcdef');
|
|
224
224
|
});
|
|
225
225
|
});
|
|
226
226
|
});
|
|
@@ -16,5 +16,6 @@ export declare class Orchestrator {
|
|
|
16
16
|
submitIntent(signedIntentOp: SignedIntentOp): Promise<IntentResult>;
|
|
17
17
|
getIntentOpStatus(intentId: bigint): Promise<IntentOpStatus>;
|
|
18
18
|
private parseError;
|
|
19
|
+
private parseErrorMessage;
|
|
19
20
|
}
|
|
20
21
|
//# sourceMappingURL=client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../orchestrator/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,OAAO,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../orchestrator/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,OAAO,EAAuB,MAAM,MAAM,CAAA;AAexD,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EACX,cAAc,EACd,YAAY,EACZ,WAAW,EACX,SAAS,EAET,cAAc,EACf,MAAM,SAAS,CAAA;AAGhB,qBAAa,YAAY;IACvB,OAAO,CAAC,SAAS,CAAQ;IACzB,OAAO,CAAC,MAAM,CAAQ;gBAEV,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAKvC,YAAY,CAChB,WAAW,EAAE,OAAO,EACpB,MAAM,CAAC,EAAE;QACP,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;QACnB,MAAM,CAAC,EAAE;YACP,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,EAAE,CAAA;SAC7B,CAAA;KACF,GACA,OAAO,CAAC,SAAS,CAAC;IAmDf,iBAAiB,CACrB,WAAW,EAAE,OAAO,EACpB,kBAAkB,EAAE,MAAM,EAC1B,uBAAuB,EAAE,OAAO,EAChC,mBAAmB,EAAE,MAAM,GAC1B,OAAO,CAAC,MAAM,CAAC;IA0CZ,aAAa,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC;IA0BtD,cAAc,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IAqBxD,YAAY,CAAC,cAAc,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,CAAC;IAqBnE,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAkBlE,OAAO,CAAC,UAAU;IA0ElB,OAAO,CAAC,iBAAiB;CAmD1B"}
|