@charterlabs/rhinestone-sdk 0.2.7-dev.3 → 0.2.8
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/README.md +46 -8
- package/dist/src/accounts/error.d.ts +38 -3
- package/dist/src/accounts/error.d.ts.map +1 -1
- package/dist/src/accounts/error.js +55 -7
- package/dist/src/accounts/index.d.ts +31 -20
- package/dist/src/accounts/index.d.ts.map +1 -1
- package/dist/src/accounts/index.js +231 -25
- package/dist/src/accounts/index.test.js +2 -4
- package/dist/src/accounts/json-rpc/index.d.ts +5 -0
- package/dist/src/accounts/json-rpc/index.d.ts.map +1 -0
- package/dist/src/accounts/json-rpc/index.js +16 -0
- package/dist/src/accounts/json-rpc/providers.d.ts +4 -0
- package/dist/src/accounts/json-rpc/providers.d.ts.map +1 -0
- package/dist/src/accounts/json-rpc/providers.js +52 -0
- package/dist/src/accounts/kernel.d.ts +1 -1
- package/dist/src/accounts/kernel.d.ts.map +1 -1
- package/dist/src/accounts/kernel.js +29 -1
- package/dist/src/accounts/kernel.test.js +35 -8
- package/dist/src/accounts/nexus.d.ts +4 -3
- package/dist/src/accounts/nexus.d.ts.map +1 -1
- package/dist/src/accounts/nexus.js +82 -14
- package/dist/src/accounts/nexus.test.js +33 -6
- package/dist/src/accounts/passport.d.ts +12 -0
- package/dist/src/accounts/passport.d.ts.map +1 -0
- package/dist/src/accounts/passport.js +173 -0
- package/dist/src/accounts/safe.d.ts.map +1 -1
- package/dist/src/accounts/safe.js +85 -53
- package/dist/src/accounts/safe.test.js +33 -6
- package/dist/src/accounts/signing/common.d.ts +4 -4
- package/dist/src/accounts/signing/common.d.ts.map +1 -1
- package/dist/src/accounts/signing/common.js +21 -9
- package/dist/src/accounts/signing/message.d.ts +1 -1
- package/dist/src/accounts/signing/message.d.ts.map +1 -1
- package/dist/src/accounts/signing/message.js +6 -6
- package/dist/src/accounts/signing/passkeys.d.ts +8 -1
- package/dist/src/accounts/signing/passkeys.d.ts.map +1 -1
- package/dist/src/accounts/signing/passkeys.js +35 -0
- package/dist/src/accounts/signing/passkeys.test.js +15 -0
- package/dist/src/accounts/signing/typedData.d.ts.map +1 -1
- package/dist/src/accounts/signing/typedData.js +2 -2
- package/dist/src/accounts/startale.test.js +0 -4
- package/dist/src/accounts/utils.d.ts +4 -4
- package/dist/src/accounts/utils.d.ts.map +1 -1
- package/dist/src/accounts/utils.js +3 -40
- package/dist/src/accounts/walletClient.d.ts +7 -0
- package/dist/src/accounts/walletClient.d.ts.map +1 -0
- package/dist/src/accounts/walletClient.js +38 -0
- package/dist/src/actions/compact.d.ts +13 -0
- package/dist/src/actions/compact.d.ts.map +1 -0
- package/dist/src/actions/compact.js +210 -0
- package/dist/src/actions/ecdsa.d.ts +35 -0
- package/dist/src/actions/ecdsa.d.ts.map +1 -0
- package/dist/src/actions/ecdsa.js +114 -0
- package/dist/src/actions/ecdsa.test.d.ts +2 -0
- package/dist/src/actions/ecdsa.test.d.ts.map +1 -0
- package/dist/src/actions/ecdsa.test.js +99 -0
- package/dist/src/actions/index.d.ts +23 -166
- package/dist/src/actions/index.d.ts.map +1 -1
- package/dist/src/actions/index.js +25 -544
- package/dist/src/actions/mfa.d.ts +37 -0
- package/dist/src/actions/mfa.d.ts.map +1 -0
- package/dist/src/actions/mfa.js +133 -0
- package/dist/src/actions/passkeys.d.ts +37 -0
- package/dist/src/actions/passkeys.d.ts.map +1 -0
- package/dist/src/actions/passkeys.js +129 -0
- package/dist/src/actions/passkeys.test.d.ts +2 -0
- package/dist/src/actions/passkeys.test.d.ts.map +1 -0
- package/dist/src/actions/passkeys.test.js +54 -0
- package/dist/src/actions/recovery.d.ts +33 -0
- package/dist/src/actions/recovery.d.ts.map +1 -0
- package/dist/src/actions/recovery.js +193 -0
- package/dist/src/actions/recovery.test.d.ts +2 -0
- package/dist/src/actions/recovery.test.d.ts.map +1 -0
- package/dist/src/actions/recovery.test.js +168 -0
- package/dist/src/actions/smart-sessions.d.ts +23 -0
- package/dist/src/actions/smart-sessions.d.ts.map +1 -0
- package/dist/src/actions/{smart-session.js → smart-sessions.js} +13 -0
- package/dist/src/errors/index.d.ts +5 -0
- package/dist/src/errors/index.d.ts.map +1 -0
- package/dist/src/errors/index.js +50 -0
- package/dist/src/execution/compact.d.ts +25 -9
- package/dist/src/execution/compact.d.ts.map +1 -1
- package/dist/src/execution/compact.js +29 -103
- package/dist/src/execution/error.d.ts +6 -6
- package/dist/src/execution/error.d.ts.map +1 -1
- package/dist/src/execution/error.js +13 -13
- package/dist/src/execution/index.d.ts +34 -22
- package/dist/src/execution/index.d.ts.map +1 -1
- package/dist/src/execution/index.js +115 -46
- package/dist/src/execution/multiChainOps.d.ts +40 -0
- package/dist/src/execution/multiChainOps.d.ts.map +1 -0
- package/dist/src/execution/multiChainOps.js +39 -0
- package/dist/src/execution/permit2.d.ts +148 -0
- package/dist/src/execution/permit2.d.ts.map +1 -0
- package/dist/src/execution/permit2.js +291 -0
- package/dist/src/execution/smart-session.d.ts +3 -3
- package/dist/src/execution/smart-session.d.ts.map +1 -1
- package/dist/src/execution/smart-session.js +3 -3
- package/dist/src/execution/types.d.ts +36 -0
- package/dist/src/execution/types.d.ts.map +1 -0
- package/dist/src/execution/types.js +2 -0
- package/dist/src/execution/utils.d.ts +43 -28
- package/dist/src/execution/utils.d.ts.map +1 -1
- package/dist/src/execution/utils.js +269 -99
- package/dist/src/index.d.ts +38 -19
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +121 -69
- package/dist/src/modules/common.d.ts +10 -4
- package/dist/src/modules/common.d.ts.map +1 -1
- package/dist/src/modules/common.js +22 -1
- package/dist/src/modules/index.d.ts +3 -2
- package/dist/src/modules/index.d.ts.map +1 -1
- package/dist/src/modules/index.js +16 -13
- package/dist/src/modules/index.test.js +9 -12
- package/dist/src/modules/read.d.ts.map +1 -1
- package/dist/src/modules/read.js +5 -1
- package/dist/src/modules/validators/core.d.ts +5 -3
- package/dist/src/modules/validators/core.d.ts.map +1 -1
- package/dist/src/modules/validators/core.js +29 -10
- package/dist/src/modules/validators/core.test.js +4 -4
- package/dist/src/modules/validators/smart-sessions.d.ts +4 -4
- package/dist/src/modules/validators/smart-sessions.d.ts.map +1 -1
- package/dist/src/modules/validators/smart-sessions.js +10 -72
- package/dist/src/modules/validators/smart-sessions.test.js +4 -8
- package/dist/src/modules/validators/webauthn-contract.d.ts.map +1 -1
- package/dist/src/orchestrator/client.d.ts +4 -2
- package/dist/src/orchestrator/client.d.ts.map +1 -1
- package/dist/src/orchestrator/client.js +230 -162
- package/dist/src/orchestrator/consts.d.ts +1 -2
- package/dist/src/orchestrator/consts.d.ts.map +1 -1
- package/dist/src/orchestrator/consts.js +1 -3
- package/dist/src/orchestrator/error.d.ts +111 -1
- package/dist/src/orchestrator/error.d.ts.map +1 -1
- package/dist/src/orchestrator/error.js +128 -1
- package/dist/src/orchestrator/index.d.ts +4 -4
- package/dist/src/orchestrator/index.d.ts.map +1 -1
- package/dist/src/orchestrator/index.js +16 -1
- package/dist/src/orchestrator/registry.d.ts +3 -25
- package/dist/src/orchestrator/registry.d.ts.map +1 -1
- package/dist/src/orchestrator/registry.js +82 -46
- package/dist/src/orchestrator/registry.test.js +7 -7
- package/dist/src/orchestrator/types.d.ts +53 -43
- package/dist/src/orchestrator/types.d.ts.map +1 -1
- package/dist/src/types.d.ts +74 -9
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/utils/index.d.ts +3 -0
- package/dist/src/utils/index.d.ts.map +1 -0
- package/dist/src/utils/index.js +5 -0
- package/package.json +73 -2
- package/dist/src/actions/index.test.d.ts +0 -2
- package/dist/src/actions/index.test.d.ts.map +0 -1
- package/dist/src/actions/index.test.js +0 -302
- package/dist/src/actions/smart-session.d.ts +0 -11
- package/dist/src/actions/smart-session.d.ts.map +0 -1
- package/dist/src/orchestrator/registry.json +0 -365
package/dist/src/index.js
CHANGED
|
@@ -1,67 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.getOrchestrator = exports.WEBAUTHN_VALIDATOR_ABI = exports.getCredentials = exports.getThreshold = exports.getCredentialInfo = exports.setThreshold = exports.removeCredential = exports.addCredential = exports.hasCredential = exports.hasCredentialById = exports.getCredentialIds = exports.generateCredentialId = exports.getTokenAddress = exports.getSupportedTokens = void 0;
|
|
5
|
-
exports.createRhinestoneAccount = createRhinestoneAccount;
|
|
3
|
+
exports.getOrchestrator = exports.WEBAUTHN_VALIDATOR_ABI = exports.getCredentials = exports.getThreshold = exports.getCredentialInfo = exports.setThreshold = exports.removeCredential = exports.addCredential = exports.hasCredential = exports.hasCredentialById = exports.getCredentialIds = exports.generateCredentialId = exports.signPermit2Sequential = exports.signPermit2Batch = exports.getPermit2Address = exports.checkERC20AllowanceDirect = exports.deployStandaloneWithEoa = exports.getTokenAddress = exports.getSupportedTokens = exports.walletClientToAccount = exports.RhinestoneSDK = void 0;
|
|
6
4
|
const accounts_1 = require("./accounts");
|
|
7
|
-
Object.defineProperty(exports, "AccountError", { enumerable: true, get: function () { return accounts_1.AccountError; } });
|
|
8
5
|
Object.defineProperty(exports, "deployStandaloneWithEoa", { enumerable: true, get: function () { return accounts_1.deployStandaloneWithEoa; } });
|
|
9
|
-
|
|
10
|
-
Object.defineProperty(exports, "
|
|
11
|
-
Object.defineProperty(exports, "ExistingEip7702AccountsNotSupportedError", { enumerable: true, get: function () { return accounts_1.ExistingEip7702AccountsNotSupportedError; } });
|
|
12
|
-
Object.defineProperty(exports, "FactoryArgsNotAvailableError", { enumerable: true, get: function () { return accounts_1.FactoryArgsNotAvailableError; } });
|
|
13
|
-
Object.defineProperty(exports, "isAccountError", { enumerable: true, get: function () { return accounts_1.isAccountError; } });
|
|
14
|
-
Object.defineProperty(exports, "SigningNotSupportedForAccountError", { enumerable: true, get: function () { return accounts_1.SigningNotSupportedForAccountError; } });
|
|
15
|
-
Object.defineProperty(exports, "SignMessageNotSupportedByAccountError", { enumerable: true, get: function () { return accounts_1.SignMessageNotSupportedByAccountError; } });
|
|
16
|
-
Object.defineProperty(exports, "SmartSessionsNotEnabledError", { enumerable: true, get: function () { return accounts_1.SmartSessionsNotEnabledError; } });
|
|
17
|
-
const actions_1 = require("./actions");
|
|
18
|
-
Object.defineProperty(exports, "addOwner", { enumerable: true, get: function () { return actions_1.addOwner; } });
|
|
19
|
-
Object.defineProperty(exports, "addPasskeyOwner", { enumerable: true, get: function () { return actions_1.addPasskeyOwner; } });
|
|
20
|
-
Object.defineProperty(exports, "changeMultiFactorThreshold", { enumerable: true, get: function () { return actions_1.changeMultiFactorThreshold; } });
|
|
21
|
-
Object.defineProperty(exports, "changePasskeyThreshold", { enumerable: true, get: function () { return actions_1.changePasskeyThreshold; } });
|
|
22
|
-
Object.defineProperty(exports, "changeThreshold", { enumerable: true, get: function () { return actions_1.changeThreshold; } });
|
|
23
|
-
Object.defineProperty(exports, "disableEcdsa", { enumerable: true, get: function () { return actions_1.disableEcdsa; } });
|
|
24
|
-
Object.defineProperty(exports, "disableMultiFactor", { enumerable: true, get: function () { return actions_1.disableMultiFactor; } });
|
|
25
|
-
Object.defineProperty(exports, "disablePasskeys", { enumerable: true, get: function () { return actions_1.disablePasskeys; } });
|
|
26
|
-
Object.defineProperty(exports, "enableEcdsa", { enumerable: true, get: function () { return actions_1.enableEcdsa; } });
|
|
27
|
-
Object.defineProperty(exports, "enableMultiFactor", { enumerable: true, get: function () { return actions_1.enableMultiFactor; } });
|
|
28
|
-
Object.defineProperty(exports, "enablePasskeys", { enumerable: true, get: function () { return actions_1.enablePasskeys; } });
|
|
29
|
-
Object.defineProperty(exports, "encodeSmartSessionSignature", { enumerable: true, get: function () { return actions_1.encodeSmartSessionSignature; } });
|
|
30
|
-
Object.defineProperty(exports, "recover", { enumerable: true, get: function () { return actions_1.recover; } });
|
|
31
|
-
Object.defineProperty(exports, "recoverEcdsaOwnership", { enumerable: true, get: function () { return actions_1.recoverEcdsaOwnership; } });
|
|
32
|
-
Object.defineProperty(exports, "recoverPasskeyOwnership", { enumerable: true, get: function () { return actions_1.recoverPasskeyOwnership; } });
|
|
33
|
-
Object.defineProperty(exports, "removeOwner", { enumerable: true, get: function () { return actions_1.removeOwner; } });
|
|
34
|
-
Object.defineProperty(exports, "removePasskeyOwner", { enumerable: true, get: function () { return actions_1.removePasskeyOwner; } });
|
|
35
|
-
Object.defineProperty(exports, "removeSubValidator", { enumerable: true, get: function () { return actions_1.removeSubValidator; } });
|
|
36
|
-
Object.defineProperty(exports, "setSubValidator", { enumerable: true, get: function () { return actions_1.setSubValidator; } });
|
|
37
|
-
Object.defineProperty(exports, "setUpRecovery", { enumerable: true, get: function () { return actions_1.setUpRecovery; } });
|
|
6
|
+
const walletClient_1 = require("./accounts/walletClient");
|
|
7
|
+
Object.defineProperty(exports, "walletClientToAccount", { enumerable: true, get: function () { return walletClient_1.walletClientToAccount; } });
|
|
38
8
|
const execution_1 = require("./execution");
|
|
39
|
-
|
|
40
|
-
Object.defineProperty(exports, "
|
|
41
|
-
Object.defineProperty(exports, "
|
|
42
|
-
Object.defineProperty(exports, "
|
|
43
|
-
Object.defineProperty(exports, "
|
|
44
|
-
Object.defineProperty(exports, "SourceChainsNotAvailableForUserOpFlowError", { enumerable: true, get: function () { return execution_1.SourceChainsNotAvailableForUserOpFlowError; } });
|
|
45
|
-
Object.defineProperty(exports, "UserOperationRequiredForSmartSessionsError", { enumerable: true, get: function () { return execution_1.UserOperationRequiredForSmartSessionsError; } });
|
|
9
|
+
const permit2_1 = require("./execution/permit2");
|
|
10
|
+
Object.defineProperty(exports, "checkERC20AllowanceDirect", { enumerable: true, get: function () { return permit2_1.checkERC20AllowanceDirect; } });
|
|
11
|
+
Object.defineProperty(exports, "getPermit2Address", { enumerable: true, get: function () { return permit2_1.getPermit2Address; } });
|
|
12
|
+
Object.defineProperty(exports, "signPermit2Batch", { enumerable: true, get: function () { return permit2_1.signPermit2Batch; } });
|
|
13
|
+
Object.defineProperty(exports, "signPermit2Sequential", { enumerable: true, get: function () { return permit2_1.signPermit2Sequential; } });
|
|
46
14
|
const smart_session_1 = require("./execution/smart-session");
|
|
47
15
|
const utils_1 = require("./execution/utils");
|
|
48
16
|
const modules_1 = require("./modules");
|
|
49
17
|
const orchestrator_1 = require("./orchestrator");
|
|
50
|
-
Object.defineProperty(exports, "AuthenticationRequiredError", { enumerable: true, get: function () { return orchestrator_1.AuthenticationRequiredError; } });
|
|
51
18
|
Object.defineProperty(exports, "getSupportedTokens", { enumerable: true, get: function () { return orchestrator_1.getSupportedTokens; } });
|
|
52
19
|
Object.defineProperty(exports, "getTokenAddress", { enumerable: true, get: function () { return orchestrator_1.getTokenAddress; } });
|
|
53
|
-
Object.defineProperty(exports, "InsufficientBalanceError", { enumerable: true, get: function () { return orchestrator_1.InsufficientBalanceError; } });
|
|
54
|
-
Object.defineProperty(exports, "IntentNotFoundError", { enumerable: true, get: function () { return orchestrator_1.IntentNotFoundError; } });
|
|
55
|
-
Object.defineProperty(exports, "InvalidApiKeyError", { enumerable: true, get: function () { return orchestrator_1.InvalidApiKeyError; } });
|
|
56
|
-
Object.defineProperty(exports, "InvalidIntentSignatureError", { enumerable: true, get: function () { return orchestrator_1.InvalidIntentSignatureError; } });
|
|
57
|
-
Object.defineProperty(exports, "isOrchestratorError", { enumerable: true, get: function () { return orchestrator_1.isOrchestratorError; } });
|
|
58
|
-
Object.defineProperty(exports, "NoPathFoundError", { enumerable: true, get: function () { return orchestrator_1.NoPathFoundError; } });
|
|
59
|
-
Object.defineProperty(exports, "OnlyOneTargetTokenAmountCanBeUnsetError", { enumerable: true, get: function () { return orchestrator_1.OnlyOneTargetTokenAmountCanBeUnsetError; } });
|
|
60
|
-
Object.defineProperty(exports, "OrchestratorError", { enumerable: true, get: function () { return orchestrator_1.OrchestratorError; } });
|
|
61
|
-
Object.defineProperty(exports, "TokenNotSupportedError", { enumerable: true, get: function () { return orchestrator_1.TokenNotSupportedError; } });
|
|
62
|
-
Object.defineProperty(exports, "UnsupportedChainError", { enumerable: true, get: function () { return orchestrator_1.UnsupportedChainError; } });
|
|
63
|
-
Object.defineProperty(exports, "UnsupportedChainIdError", { enumerable: true, get: function () { return orchestrator_1.UnsupportedChainIdError; } });
|
|
64
|
-
Object.defineProperty(exports, "UnsupportedTokenError", { enumerable: true, get: function () { return orchestrator_1.UnsupportedTokenError; } });
|
|
65
20
|
/**
|
|
66
21
|
* Initialize a Rhinestone account
|
|
67
22
|
* Note: accounts are deployed onchain only when the first transaction is sent.
|
|
@@ -69,16 +24,36 @@ Object.defineProperty(exports, "UnsupportedTokenError", { enumerable: true, get:
|
|
|
69
24
|
* @returns account
|
|
70
25
|
*/
|
|
71
26
|
async function createRhinestoneAccount(config) {
|
|
27
|
+
// Sanity check for existing (externally created) accounts
|
|
28
|
+
// Ensures we decode the initdata correctly
|
|
29
|
+
(0, accounts_1.checkAddress)(config);
|
|
30
|
+
// Validate that owners field is provided for non-EOA accounts
|
|
31
|
+
if (config.account?.type !== 'eoa' && !config.owners) {
|
|
32
|
+
throw new accounts_1.OwnersFieldRequiredError();
|
|
33
|
+
}
|
|
72
34
|
/**
|
|
73
35
|
* Deploys the account on a given chain
|
|
74
36
|
* @param chain Chain to deploy the account on
|
|
75
37
|
* @param session Session to deploy the account on (optional)
|
|
76
38
|
*/
|
|
77
|
-
function deploy(chain,
|
|
78
|
-
return (0, accounts_1.deploy)(config, chain,
|
|
39
|
+
function deploy(chain, params) {
|
|
40
|
+
return (0, accounts_1.deploy)(config, chain, params);
|
|
79
41
|
}
|
|
80
|
-
|
|
81
|
-
|
|
42
|
+
/**
|
|
43
|
+
* Checks if the account is deployed on a given chain
|
|
44
|
+
* @param chain Chain to check if the account is deployed on
|
|
45
|
+
* @returns true if the account is deployed, false otherwise
|
|
46
|
+
*/
|
|
47
|
+
function isDeployed(chain) {
|
|
48
|
+
return (0, accounts_1.isDeployed)(config, chain);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Sets up the existing account on a given chain
|
|
52
|
+
* by installing the missing modules (if any).
|
|
53
|
+
* @param chain Chain to set up the account on
|
|
54
|
+
*/
|
|
55
|
+
function setup(chain) {
|
|
56
|
+
return (0, accounts_1.setup)(config, chain);
|
|
82
57
|
}
|
|
83
58
|
/**
|
|
84
59
|
* Prepare and sign the EIP-7702 account initialization data
|
|
@@ -87,6 +62,9 @@ async function createRhinestoneAccount(config) {
|
|
|
87
62
|
function signEip7702InitData() {
|
|
88
63
|
return (0, accounts_1.signEip7702InitData)(config);
|
|
89
64
|
}
|
|
65
|
+
function deployStandaloneWithEoa(chain, accountConfig, deployer) {
|
|
66
|
+
return (0, accounts_1.deployStandaloneWithEoa)(chain, accountConfig, deployer);
|
|
67
|
+
}
|
|
90
68
|
/**
|
|
91
69
|
* Prepare a transaction data
|
|
92
70
|
* @param transaction Transaction to prepare
|
|
@@ -137,27 +115,56 @@ async function createRhinestoneAccount(config) {
|
|
|
137
115
|
* Submit a transaction
|
|
138
116
|
* @param signedTransaction Signed transaction data
|
|
139
117
|
* @param authorizations EIP-7702 authorizations to submit (optional)
|
|
140
|
-
* @returns transaction result object (
|
|
118
|
+
* @returns transaction result object (a UserOp hash)
|
|
141
119
|
* @see {@link signTransaction} to sign the transaction data
|
|
142
120
|
* @see {@link signAuthorizations} to sign the required EIP-7702 authorizations
|
|
121
|
+
* @see {@link dryRun} true when intent is not executed onchain (internal use only)
|
|
122
|
+
*/
|
|
123
|
+
function submitTransaction(signedTransaction, authorizations, dryRun) {
|
|
124
|
+
return (0, utils_1.submitTransaction)(config, signedTransaction, authorizations ?? [], dryRun);
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Prepare a user operation data
|
|
128
|
+
* @param transaction User operation to prepare
|
|
129
|
+
* @returns prepared user operation data
|
|
130
|
+
*/
|
|
131
|
+
function prepareUserOperation(transaction) {
|
|
132
|
+
return (0, utils_1.prepareUserOperation)(config, transaction);
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Sign a user operation
|
|
136
|
+
* @param preparedUserOperation Prepared user operation data
|
|
137
|
+
* @returns signed user operation data
|
|
138
|
+
* @see {@link prepareUserOperation} to prepare the user operation data for signing
|
|
143
139
|
*/
|
|
144
|
-
function
|
|
145
|
-
return (0, utils_1.
|
|
140
|
+
function signUserOperation(preparedUserOperation) {
|
|
141
|
+
return (0, utils_1.signUserOperation)(config, preparedUserOperation);
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Submit a transaction
|
|
145
|
+
* @param signedTransaction Signed transaction data
|
|
146
|
+
* @returns transaction result object (a UserOp hash)
|
|
147
|
+
* @see {@link signUserOperation} to sign the user operation data
|
|
148
|
+
*/
|
|
149
|
+
function submitUserOperation(signedUserOperation) {
|
|
150
|
+
return (0, utils_1.submitUserOperation)(config, signedUserOperation);
|
|
146
151
|
}
|
|
147
152
|
/**
|
|
148
153
|
* Sign and send a transaction
|
|
149
154
|
* @param transaction Transaction to send
|
|
150
|
-
* @returns transaction result object (an intent ID
|
|
155
|
+
* @returns transaction result object (an intent ID)
|
|
151
156
|
*/
|
|
152
157
|
function sendTransaction(transaction) {
|
|
153
158
|
return (0, execution_1.sendTransaction)(config, transaction);
|
|
154
159
|
}
|
|
155
160
|
/**
|
|
156
|
-
*
|
|
157
|
-
* @param
|
|
158
|
-
* @
|
|
159
|
-
* @returns intent result or a UserOp receipt
|
|
161
|
+
* Sign and send a user operation
|
|
162
|
+
* @param transaction User operation to send
|
|
163
|
+
* @returns user operation result object (a UserOp hash)
|
|
160
164
|
*/
|
|
165
|
+
function sendUserOperation(transaction) {
|
|
166
|
+
return (0, execution_1.sendUserOperation)(config, transaction);
|
|
167
|
+
}
|
|
161
168
|
function waitForExecution(result, acceptsPreconfirmations = true) {
|
|
162
169
|
return (0, execution_1.waitForExecution)(config, result, acceptsPreconfirmations);
|
|
163
170
|
}
|
|
@@ -183,8 +190,8 @@ async function createRhinestoneAccount(config) {
|
|
|
183
190
|
* @param gasUnits Gas cost estimate for the transaction execution
|
|
184
191
|
* @returns Maximum spendable amount in absolute units
|
|
185
192
|
*/
|
|
186
|
-
function getMaxSpendableAmount(chain, tokenAddress, gasUnits) {
|
|
187
|
-
return (0, execution_1.getMaxSpendableAmount)(config, chain, tokenAddress, gasUnits);
|
|
193
|
+
function getMaxSpendableAmount(chain, tokenAddress, gasUnits, sponsored = false) {
|
|
194
|
+
return (0, execution_1.getMaxSpendableAmount)(config, chain, tokenAddress, gasUnits, sponsored);
|
|
188
195
|
}
|
|
189
196
|
/**
|
|
190
197
|
* Get account owners (ECDSA)
|
|
@@ -201,16 +208,30 @@ async function createRhinestoneAccount(config) {
|
|
|
201
208
|
* @returns List of account validators
|
|
202
209
|
*/
|
|
203
210
|
function getValidators(chain) {
|
|
204
|
-
const accountType = config.
|
|
211
|
+
const accountType = (0, accounts_1.getAccountProvider)(config).type;
|
|
205
212
|
const account = getAddress();
|
|
206
213
|
return (0, modules_1.getValidators)(accountType, account, chain, config.provider);
|
|
207
214
|
}
|
|
208
215
|
function getSessionDetails(sessions, sessionIndex, signature) {
|
|
209
216
|
return (0, smart_session_1.getSessionDetails)(config, sessions, sessionIndex, signature);
|
|
210
217
|
}
|
|
218
|
+
/**
|
|
219
|
+
* Check ERC20 allowance for the account owner and token (using Permit2 as spender)
|
|
220
|
+
* @param tokenAddress The token contract address
|
|
221
|
+
* @param chain The chain to check the allowance on
|
|
222
|
+
* @returns The allowance amount
|
|
223
|
+
*/
|
|
224
|
+
function checkERC20Allowance(tokenAddress, chain) {
|
|
225
|
+
if (!config.provider) {
|
|
226
|
+
throw new Error('Provider configuration is required');
|
|
227
|
+
}
|
|
228
|
+
return (0, permit2_1.checkERC20Allowance)(tokenAddress, chain, config);
|
|
229
|
+
}
|
|
211
230
|
return {
|
|
212
231
|
config,
|
|
213
232
|
deploy,
|
|
233
|
+
isDeployed,
|
|
234
|
+
setup,
|
|
214
235
|
deployStandaloneWithEoa,
|
|
215
236
|
signEip7702InitData,
|
|
216
237
|
prepareTransaction,
|
|
@@ -219,7 +240,11 @@ async function createRhinestoneAccount(config) {
|
|
|
219
240
|
signMessage,
|
|
220
241
|
signTypedData,
|
|
221
242
|
submitTransaction,
|
|
243
|
+
prepareUserOperation,
|
|
244
|
+
signUserOperation,
|
|
245
|
+
submitUserOperation,
|
|
222
246
|
sendTransaction,
|
|
247
|
+
sendUserOperation,
|
|
223
248
|
waitForExecution,
|
|
224
249
|
getAddress,
|
|
225
250
|
getPortfolio,
|
|
@@ -227,9 +252,36 @@ async function createRhinestoneAccount(config) {
|
|
|
227
252
|
getSessionDetails,
|
|
228
253
|
getOwners,
|
|
229
254
|
getValidators,
|
|
255
|
+
checkERC20Allowance,
|
|
230
256
|
};
|
|
231
257
|
}
|
|
232
|
-
|
|
258
|
+
class RhinestoneSDK {
|
|
259
|
+
apiKey;
|
|
260
|
+
endpointUrl;
|
|
261
|
+
provider;
|
|
262
|
+
bundler;
|
|
263
|
+
paymaster;
|
|
264
|
+
constructor(options) {
|
|
265
|
+
this.apiKey = options?.apiKey;
|
|
266
|
+
this.endpointUrl = options?.endpointUrl;
|
|
267
|
+
this.provider = options?.provider;
|
|
268
|
+
this.bundler = options?.bundler;
|
|
269
|
+
this.paymaster = options?.paymaster;
|
|
270
|
+
}
|
|
271
|
+
createAccount(config) {
|
|
272
|
+
const rhinestoneConfig = {
|
|
273
|
+
...config,
|
|
274
|
+
apiKey: this.apiKey,
|
|
275
|
+
endpointUrl: this.endpointUrl,
|
|
276
|
+
provider: this.provider,
|
|
277
|
+
bundler: this.bundler,
|
|
278
|
+
paymaster: this.paymaster,
|
|
279
|
+
};
|
|
280
|
+
return createRhinestoneAccount(rhinestoneConfig);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
exports.RhinestoneSDK = RhinestoneSDK;
|
|
284
|
+
// WebAuthn Validator contract helpers (keep Charter API stable)
|
|
233
285
|
var webauthn_contract_1 = require("./modules/validators/webauthn-contract");
|
|
234
286
|
Object.defineProperty(exports, "generateCredentialId", { enumerable: true, get: function () { return webauthn_contract_1.generateCredentialId; } });
|
|
235
287
|
Object.defineProperty(exports, "getCredentialIds", { enumerable: true, get: function () { return webauthn_contract_1.getCredentialIds; } });
|
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
import type { Address, Hex } from 'viem';
|
|
2
|
-
type
|
|
2
|
+
type ModuleTypeId = typeof MODULE_TYPE_ID_VALIDATOR | typeof MODULE_TYPE_ID_EXECUTOR | typeof MODULE_TYPE_ID_FALLBACK | typeof MODULE_TYPE_ID_HOOK;
|
|
3
|
+
type ModuleType = typeof MODULE_TYPE_VALIDATOR | typeof MODULE_TYPE_EXECUTOR | typeof MODULE_TYPE_FALLBACK | typeof MODULE_TYPE_HOOK;
|
|
3
4
|
interface Module {
|
|
4
5
|
address: Address;
|
|
5
6
|
initData: Hex;
|
|
6
7
|
deInitData: Hex;
|
|
7
8
|
additionalContext: Hex;
|
|
8
|
-
type:
|
|
9
|
+
type: ModuleTypeId;
|
|
9
10
|
}
|
|
10
11
|
declare const MODULE_TYPE_ID_VALIDATOR = 1n;
|
|
11
12
|
declare const MODULE_TYPE_ID_EXECUTOR = 2n;
|
|
12
13
|
declare const MODULE_TYPE_ID_FALLBACK = 3n;
|
|
13
14
|
declare const MODULE_TYPE_ID_HOOK = 4n;
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
declare const MODULE_TYPE_VALIDATOR = "validator";
|
|
16
|
+
declare const MODULE_TYPE_EXECUTOR = "executor";
|
|
17
|
+
declare const MODULE_TYPE_FALLBACK = "fallback";
|
|
18
|
+
declare const MODULE_TYPE_HOOK = "hook";
|
|
19
|
+
declare function toModuleTypeId(type: ModuleType): ModuleTypeId;
|
|
20
|
+
export { MODULE_TYPE_ID_VALIDATOR, MODULE_TYPE_ID_EXECUTOR, MODULE_TYPE_ID_FALLBACK, MODULE_TYPE_ID_HOOK, MODULE_TYPE_VALIDATOR, MODULE_TYPE_EXECUTOR, MODULE_TYPE_FALLBACK, MODULE_TYPE_HOOK, toModuleTypeId, };
|
|
21
|
+
export type { Module, ModuleType, ModuleTypeId };
|
|
16
22
|
//# sourceMappingURL=common.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../modules/common.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AAExC,KAAK,
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../modules/common.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AAExC,KAAK,YAAY,GACb,OAAO,wBAAwB,GAC/B,OAAO,uBAAuB,GAC9B,OAAO,uBAAuB,GAC9B,OAAO,mBAAmB,CAAA;AAE9B,KAAK,UAAU,GACX,OAAO,qBAAqB,GAC5B,OAAO,oBAAoB,GAC3B,OAAO,oBAAoB,GAC3B,OAAO,gBAAgB,CAAA;AAE3B,UAAU,MAAM;IACd,OAAO,EAAE,OAAO,CAAA;IAChB,QAAQ,EAAE,GAAG,CAAA;IACb,UAAU,EAAE,GAAG,CAAA;IACf,iBAAiB,EAAE,GAAG,CAAA;IACtB,IAAI,EAAE,YAAY,CAAA;CACnB;AAED,QAAA,MAAM,wBAAwB,KAAK,CAAA;AACnC,QAAA,MAAM,uBAAuB,KAAK,CAAA;AAClC,QAAA,MAAM,uBAAuB,KAAK,CAAA;AAClC,QAAA,MAAM,mBAAmB,KAAK,CAAA;AAE9B,QAAA,MAAM,qBAAqB,cAAc,CAAA;AACzC,QAAA,MAAM,oBAAoB,aAAa,CAAA;AACvC,QAAA,MAAM,oBAAoB,aAAa,CAAA;AACvC,QAAA,MAAM,gBAAgB,SAAS,CAAA;AAE/B,iBAAS,cAAc,CAAC,IAAI,EAAE,UAAU,GAAG,YAAY,CAWtD;AAED,OAAO,EACL,wBAAwB,EACxB,uBAAuB,EACvB,uBAAuB,EACvB,mBAAmB,EACnB,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,EACpB,gBAAgB,EAChB,cAAc,GACf,CAAA;AACD,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,CAAA"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MODULE_TYPE_ID_HOOK = exports.MODULE_TYPE_ID_FALLBACK = exports.MODULE_TYPE_ID_EXECUTOR = exports.MODULE_TYPE_ID_VALIDATOR = void 0;
|
|
3
|
+
exports.MODULE_TYPE_HOOK = exports.MODULE_TYPE_FALLBACK = exports.MODULE_TYPE_EXECUTOR = exports.MODULE_TYPE_VALIDATOR = exports.MODULE_TYPE_ID_HOOK = exports.MODULE_TYPE_ID_FALLBACK = exports.MODULE_TYPE_ID_EXECUTOR = exports.MODULE_TYPE_ID_VALIDATOR = void 0;
|
|
4
|
+
exports.toModuleTypeId = toModuleTypeId;
|
|
4
5
|
const MODULE_TYPE_ID_VALIDATOR = 1n;
|
|
5
6
|
exports.MODULE_TYPE_ID_VALIDATOR = MODULE_TYPE_ID_VALIDATOR;
|
|
6
7
|
const MODULE_TYPE_ID_EXECUTOR = 2n;
|
|
@@ -9,3 +10,23 @@ const MODULE_TYPE_ID_FALLBACK = 3n;
|
|
|
9
10
|
exports.MODULE_TYPE_ID_FALLBACK = MODULE_TYPE_ID_FALLBACK;
|
|
10
11
|
const MODULE_TYPE_ID_HOOK = 4n;
|
|
11
12
|
exports.MODULE_TYPE_ID_HOOK = MODULE_TYPE_ID_HOOK;
|
|
13
|
+
const MODULE_TYPE_VALIDATOR = 'validator';
|
|
14
|
+
exports.MODULE_TYPE_VALIDATOR = MODULE_TYPE_VALIDATOR;
|
|
15
|
+
const MODULE_TYPE_EXECUTOR = 'executor';
|
|
16
|
+
exports.MODULE_TYPE_EXECUTOR = MODULE_TYPE_EXECUTOR;
|
|
17
|
+
const MODULE_TYPE_FALLBACK = 'fallback';
|
|
18
|
+
exports.MODULE_TYPE_FALLBACK = MODULE_TYPE_FALLBACK;
|
|
19
|
+
const MODULE_TYPE_HOOK = 'hook';
|
|
20
|
+
exports.MODULE_TYPE_HOOK = MODULE_TYPE_HOOK;
|
|
21
|
+
function toModuleTypeId(type) {
|
|
22
|
+
switch (type) {
|
|
23
|
+
case MODULE_TYPE_VALIDATOR:
|
|
24
|
+
return MODULE_TYPE_ID_VALIDATOR;
|
|
25
|
+
case MODULE_TYPE_EXECUTOR:
|
|
26
|
+
return MODULE_TYPE_ID_EXECUTOR;
|
|
27
|
+
case MODULE_TYPE_FALLBACK:
|
|
28
|
+
return MODULE_TYPE_ID_FALLBACK;
|
|
29
|
+
case MODULE_TYPE_HOOK:
|
|
30
|
+
return MODULE_TYPE_ID_HOOK;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Chain } from 'viem';
|
|
2
|
-
import type { RhinestoneAccountConfig } from '../types';
|
|
2
|
+
import type { RhinestoneAccountConfig, RhinestoneConfig } from '../types';
|
|
3
3
|
import { type Module } from './common';
|
|
4
4
|
import { HOOK_ADDRESS } from './omni-account';
|
|
5
5
|
import { getOwners, getValidators } from './read';
|
|
@@ -11,6 +11,7 @@ interface ModeleSetup {
|
|
|
11
11
|
hooks: Module[];
|
|
12
12
|
}
|
|
13
13
|
declare function getSetup(config: RhinestoneAccountConfig): ModeleSetup;
|
|
14
|
+
declare function getIntentExecutor(config: RhinestoneConfig): Module;
|
|
14
15
|
declare function isRip7212SupportedNetwork(chain: Chain): boolean;
|
|
15
|
-
export { HOOK_ADDRESS, getSetup, getOwnerValidator, getOwners, getValidators, isRip7212SupportedNetwork, };
|
|
16
|
+
export { HOOK_ADDRESS, getSetup, getOwnerValidator, getOwners, getIntentExecutor, getValidators, isRip7212SupportedNetwork, };
|
|
16
17
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../modules/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,KAAK,EAAuB,MAAM,MAAM,CAAA;AAWpE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../modules/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,KAAK,EAAuB,MAAM,MAAM,CAAA;AAWpE,OAAO,KAAK,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAEzE,OAAO,EAGL,KAAK,MAAM,EACZ,MAAM,UAAU,CAAA;AACjB,OAAO,EACL,YAAY,EAGb,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAA;AACjD,OAAO,EAAE,iBAAiB,EAA4B,MAAM,cAAc,CAAA;AAM1E,UAAU,WAAW;IACnB,UAAU,EAAE,MAAM,EAAE,CAAA;IACpB,SAAS,EAAE,MAAM,EAAE,CAAA;IACnB,SAAS,EAAE,MAAM,EAAE,CAAA;IACnB,KAAK,EAAE,MAAM,EAAE,CAAA;CAChB;AAED,iBAAS,QAAQ,CAAC,MAAM,EAAE,uBAAuB,GAAG,WAAW,CAiD9D;AAED,iBAAS,iBAAiB,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CAW3D;AAED,iBAAS,yBAAyB,CAAC,KAAK,EAAE,KAAK,WAW9C;AAED,OAAO,EACL,YAAY,EACZ,QAAQ,EACR,iBAAiB,EACjB,SAAS,EACT,iBAAiB,EACjB,aAAa,EACb,yBAAyB,GAC1B,CAAA"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getValidators = exports.getOwners = exports.getOwnerValidator = exports.HOOK_ADDRESS = void 0;
|
|
4
4
|
exports.getSetup = getSetup;
|
|
5
|
+
exports.getIntentExecutor = getIntentExecutor;
|
|
5
6
|
exports.isRip7212SupportedNetwork = isRip7212SupportedNetwork;
|
|
6
7
|
const viem_1 = require("viem");
|
|
7
8
|
const chains_1 = require("viem/chains");
|
|
@@ -14,7 +15,7 @@ Object.defineProperty(exports, "getValidators", { enumerable: true, get: functio
|
|
|
14
15
|
const validators_1 = require("./validators");
|
|
15
16
|
Object.defineProperty(exports, "getOwnerValidator", { enumerable: true, get: function () { return validators_1.getOwnerValidator; } });
|
|
16
17
|
const core_1 = require("./validators/core");
|
|
17
|
-
const SMART_SESSION_COMPATIBILITY_FALLBACK_ADDRESS = '
|
|
18
|
+
const SMART_SESSION_COMPATIBILITY_FALLBACK_ADDRESS = '0x000000000052e9685932845660777DF43C2dC496';
|
|
18
19
|
function getSetup(config) {
|
|
19
20
|
const ownerValidator = (0, validators_1.getOwnerValidator)(config);
|
|
20
21
|
const smartSessionValidator = (0, validators_1.getSmartSessionValidator)(config);
|
|
@@ -26,18 +27,8 @@ function getSetup(config) {
|
|
|
26
27
|
const socialRecoveryValidator = (0, core_1.getSocialRecoveryValidator)(config.recovery.guardians, config.recovery.threshold);
|
|
27
28
|
validators.push(socialRecoveryValidator);
|
|
28
29
|
}
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
: omni_account_1.INTENT_EXECUTOR_ADDRESS;
|
|
32
|
-
const executors = [
|
|
33
|
-
{
|
|
34
|
-
address: intentExecutorAddress,
|
|
35
|
-
initData: '0x',
|
|
36
|
-
deInitData: '0x',
|
|
37
|
-
additionalContext: '0x',
|
|
38
|
-
type: common_1.MODULE_TYPE_ID_EXECUTOR,
|
|
39
|
-
},
|
|
40
|
-
];
|
|
30
|
+
const intentExecutor = getIntentExecutor(config);
|
|
31
|
+
const executors = [intentExecutor];
|
|
41
32
|
const fallbacks = [];
|
|
42
33
|
// Some accounts (e.g. Safe) need a fallback method to support smart sessions
|
|
43
34
|
if (config.sessions) {
|
|
@@ -63,6 +54,18 @@ function getSetup(config) {
|
|
|
63
54
|
hooks,
|
|
64
55
|
};
|
|
65
56
|
}
|
|
57
|
+
function getIntentExecutor(config) {
|
|
58
|
+
const intentExecutorAddress = config.endpointUrl
|
|
59
|
+
? omni_account_1.INTENT_EXECUTOR_ADDRESS_DEV
|
|
60
|
+
: omni_account_1.INTENT_EXECUTOR_ADDRESS;
|
|
61
|
+
return {
|
|
62
|
+
address: intentExecutorAddress,
|
|
63
|
+
initData: '0x',
|
|
64
|
+
deInitData: '0x',
|
|
65
|
+
additionalContext: '0x',
|
|
66
|
+
type: common_1.MODULE_TYPE_ID_EXECUTOR,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
66
69
|
function isRip7212SupportedNetwork(chain) {
|
|
67
70
|
const supportedChains = [
|
|
68
71
|
chains_1.optimism,
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const vitest_1 = require("vitest");
|
|
4
4
|
const consts_1 = require("../../test/consts");
|
|
5
|
+
const common_1 = require("./common");
|
|
5
6
|
const index_1 = require("./index");
|
|
6
7
|
(0, vitest_1.describe)('Modules', () => {
|
|
7
8
|
(0, vitest_1.describe)('Setup', () => {
|
|
8
9
|
(0, vitest_1.test)('should use ownable validator for ECDSA owners', () => {
|
|
9
10
|
const config = {
|
|
10
|
-
rhinestoneApiKey: consts_1.MOCK_API_KEY,
|
|
11
11
|
owners: {
|
|
12
12
|
type: 'ecdsa',
|
|
13
13
|
accounts: [consts_1.accountA],
|
|
@@ -15,12 +15,11 @@ 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('
|
|
19
|
-
(0, vitest_1.expect)(setup.validators[0].type).toBe(
|
|
18
|
+
(0, vitest_1.expect)(setup.validators[0].address).toBe('0x000000000013fdb5234e4e3162a810f54d9f7e98');
|
|
19
|
+
(0, vitest_1.expect)(setup.validators[0].type).toBe(common_1.MODULE_TYPE_ID_VALIDATOR);
|
|
20
20
|
});
|
|
21
21
|
(0, vitest_1.test)('should use webauthn validator for passkey owners', () => {
|
|
22
22
|
const config = {
|
|
23
|
-
rhinestoneApiKey: consts_1.MOCK_API_KEY,
|
|
24
23
|
owners: {
|
|
25
24
|
type: 'passkey',
|
|
26
25
|
accounts: [consts_1.passkeyAccount],
|
|
@@ -28,12 +27,11 @@ const index_1 = require("./index");
|
|
|
28
27
|
};
|
|
29
28
|
const setup = (0, index_1.getSetup)(config);
|
|
30
29
|
(0, vitest_1.expect)(setup.validators).toHaveLength(1);
|
|
31
|
-
(0, vitest_1.expect)(setup.validators[0].address).toBe('
|
|
32
|
-
(0, vitest_1.expect)(setup.validators[0].type).toBe(
|
|
30
|
+
(0, vitest_1.expect)(setup.validators[0].address).toBe('0x0000000000578c4cb0e472a5462da43c495c3f33');
|
|
31
|
+
(0, vitest_1.expect)(setup.validators[0].type).toBe(common_1.MODULE_TYPE_ID_VALIDATOR);
|
|
33
32
|
});
|
|
34
33
|
(0, vitest_1.test)('should use smart session validator when sessions are enabled', () => {
|
|
35
34
|
const config = {
|
|
36
|
-
rhinestoneApiKey: consts_1.MOCK_API_KEY,
|
|
37
35
|
owners: {
|
|
38
36
|
type: 'ecdsa',
|
|
39
37
|
accounts: [consts_1.accountA],
|
|
@@ -50,15 +48,14 @@ const index_1 = require("./index");
|
|
|
50
48
|
],
|
|
51
49
|
};
|
|
52
50
|
const setup = (0, index_1.getSetup)(config);
|
|
53
|
-
const smartSessionValidator = setup.validators.find((validator) => validator.address === '
|
|
51
|
+
const smartSessionValidator = setup.validators.find((validator) => validator.address === '0x00000000008bdaba73cd9815d79069c247eb4bda');
|
|
54
52
|
if (!smartSessionValidator) {
|
|
55
53
|
return;
|
|
56
54
|
}
|
|
57
|
-
(0, vitest_1.expect)(smartSessionValidator.type).toBe(
|
|
55
|
+
(0, vitest_1.expect)(smartSessionValidator.type).toBe(common_1.MODULE_TYPE_ID_VALIDATOR);
|
|
58
56
|
});
|
|
59
57
|
(0, vitest_1.test)('should use smart session compatibility fallback for safe accounts with sessions', () => {
|
|
60
58
|
const config = {
|
|
61
|
-
rhinestoneApiKey: consts_1.MOCK_API_KEY,
|
|
62
59
|
owners: {
|
|
63
60
|
type: 'ecdsa',
|
|
64
61
|
accounts: [consts_1.accountA],
|
|
@@ -78,12 +75,12 @@ const index_1 = require("./index");
|
|
|
78
75
|
},
|
|
79
76
|
};
|
|
80
77
|
const setup = (0, index_1.getSetup)(config);
|
|
81
|
-
const smartSessionFallback = setup.fallbacks.find((fallback) => fallback.address === '
|
|
78
|
+
const smartSessionFallback = setup.fallbacks.find((fallback) => fallback.address === '0x000000000052e9685932845660777DF43C2dC496');
|
|
82
79
|
(0, vitest_1.expect)(smartSessionFallback).toBeDefined();
|
|
83
80
|
if (!smartSessionFallback) {
|
|
84
81
|
return;
|
|
85
82
|
}
|
|
86
|
-
(0, vitest_1.expect)(smartSessionFallback.type).toBe(
|
|
83
|
+
(0, vitest_1.expect)(smartSessionFallback.type).toBe(common_1.MODULE_TYPE_ID_FALLBACK);
|
|
87
84
|
});
|
|
88
85
|
vitest_1.test.todo('using the omni account should install the necessary modules');
|
|
89
86
|
});
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,CAkDpB;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
|
@@ -13,7 +13,8 @@ async function getValidators(accountType, account, chain, provider) {
|
|
|
13
13
|
switch (accountType) {
|
|
14
14
|
case 'safe':
|
|
15
15
|
case 'startale':
|
|
16
|
-
case 'nexus':
|
|
16
|
+
case 'nexus':
|
|
17
|
+
case 'passport': {
|
|
17
18
|
const validators = await publicClient.readContract({
|
|
18
19
|
abi: [
|
|
19
20
|
{
|
|
@@ -47,6 +48,9 @@ async function getValidators(accountType, account, chain, provider) {
|
|
|
47
48
|
});
|
|
48
49
|
return validators[0];
|
|
49
50
|
}
|
|
51
|
+
case 'eoa': {
|
|
52
|
+
return [];
|
|
53
|
+
}
|
|
50
54
|
case 'kernel': {
|
|
51
55
|
throw new Error('Kernel not supported');
|
|
52
56
|
}
|
|
@@ -13,13 +13,15 @@ interface WebauthnCredential {
|
|
|
13
13
|
declare const OWNABLE_VALIDATOR_ADDRESS: Address;
|
|
14
14
|
declare const WEBAUTHN_VALIDATOR_ADDRESS: Address;
|
|
15
15
|
declare const MULTI_FACTOR_VALIDATOR_ADDRESS: Address;
|
|
16
|
+
declare const WEBAUTHN_V0_VALIDATOR_ADDRESS: Address;
|
|
16
17
|
declare function getOwnerValidator(config: RhinestoneAccountConfig): Module;
|
|
17
18
|
declare function getMockSignature(ownerSet: OwnerSet): Hex;
|
|
18
19
|
declare function getValidator(owners: OwnerSet): Module;
|
|
19
|
-
declare function getOwnableValidator(threshold: number, owners: Address[]): Module;
|
|
20
|
-
declare function getWebAuthnValidator(threshold: number, webAuthnCredentials: WebauthnCredential[]): Module;
|
|
20
|
+
declare function getOwnableValidator(threshold: number, owners: Address[], address?: Address): Module;
|
|
21
|
+
declare function getWebAuthnValidator(threshold: number, webAuthnCredentials: WebauthnCredential[], address?: Address): Module;
|
|
21
22
|
declare function getMultiFactorValidator(threshold: number, validators: (OwnableValidatorConfig | WebauthnValidatorConfig | null)[]): Module;
|
|
22
23
|
declare function getSocialRecoveryValidator(guardians: Account[], threshold?: number): Module;
|
|
23
|
-
|
|
24
|
+
declare function supportsEip712(validator: Module): boolean;
|
|
25
|
+
export { OWNABLE_VALIDATOR_ADDRESS, WEBAUTHN_VALIDATOR_ADDRESS, MULTI_FACTOR_VALIDATOR_ADDRESS, WEBAUTHN_V0_VALIDATOR_ADDRESS, getOwnerValidator, getOwnableValidator, getWebAuthnValidator, getMultiFactorValidator, getSocialRecoveryValidator, getValidator, getMockSignature, supportsEip712, };
|
|
24
26
|
export type { WebauthnCredential };
|
|
25
27
|
//# 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,KAAK,OAAO,EACZ,KAAK,OAAO,EAKZ,KAAK,GAAG,EAIT,MAAM,MAAM,CAAA;
|
|
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,EAIT,MAAM,MAAM,CAAA;AAGb,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,QAAA,MAAM,6BAA6B,EAAE,OACS,CAAA;AAO9C,iBAAS,iBAAiB,CAAC,MAAM,EAAE,uBAAuB,UAKzD;AAED,iBAAS,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,GAAG,GAAG,CAiDjD;AAED,iBAAS,YAAY,CAAC,MAAM,EAAE,QAAQ,UAoBrC;AAED,iBAAS,mBAAmB,CAC1B,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,OAAO,EAAE,EACjB,OAAO,CAAC,EAAE,OAAO,GAChB,MAAM,CAiBR;AAED,iBAAS,oBAAoB,CAC3B,SAAS,EAAE,MAAM,EACjB,mBAAmB,EAAE,kBAAkB,EAAE,EACzC,OAAO,CAAC,EAAE,OAAO,GAChB,MAAM,CA4DR;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,iBAAS,cAAc,CAAC,SAAS,EAAE,MAAM,WAQxC;AAED,OAAO,EACL,yBAAyB,EACzB,0BAA0B,EAC1B,8BAA8B,EAC9B,6BAA6B,EAC7B,iBAAiB,EACjB,mBAAmB,EACnB,oBAAoB,EACpB,uBAAuB,EACvB,0BAA0B,EAC1B,YAAY,EACZ,gBAAgB,EAChB,cAAc,GACf,CAAA;AACD,YAAY,EAAE,kBAAkB,EAAE,CAAA"}
|