@rhinestone/sdk 1.0.0-alpha.2 → 1.0.0-alpha.21
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/custom.d.ts +18 -0
- package/dist/src/accounts/custom.d.ts.map +1 -0
- package/dist/src/accounts/custom.js +121 -0
- package/dist/src/accounts/custom.test.d.ts +2 -0
- package/dist/src/accounts/custom.test.d.ts.map +1 -0
- package/dist/src/accounts/custom.test.js +64 -0
- 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 +22 -13
- package/dist/src/accounts/index.d.ts.map +1 -1
- package/dist/src/accounts/index.js +192 -186
- package/dist/src/accounts/index.test.js +3 -3
- 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/index.test.d.ts +2 -0
- package/dist/src/accounts/json-rpc/index.test.d.ts.map +1 -0
- package/dist/src/accounts/json-rpc/index.test.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 +14 -0
- package/dist/src/accounts/json-rpc/providers.test.d.ts +2 -0
- package/dist/src/accounts/json-rpc/providers.test.d.ts.map +1 -0
- package/dist/src/accounts/json-rpc/providers.test.js +15 -0
- package/dist/src/accounts/kernel.d.ts +9 -10
- package/dist/src/accounts/kernel.d.ts.map +1 -1
- package/dist/src/accounts/kernel.js +3 -14
- package/dist/src/accounts/kernel.test.js +10 -15
- 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 +121 -93
- package/dist/src/accounts/nexus.test.js +13 -14
- package/dist/src/accounts/safe.d.ts +5 -7
- package/dist/src/accounts/safe.d.ts.map +1 -1
- package/dist/src/accounts/safe.js +25 -35
- package/dist/src/accounts/safe.test.js +9 -10
- package/dist/src/accounts/signing/common.d.ts +27 -0
- package/dist/src/accounts/signing/common.d.ts.map +1 -0
- package/dist/src/accounts/signing/common.js +142 -0
- package/dist/src/accounts/signing/message.d.ts +5 -0
- package/dist/src/accounts/signing/message.d.ts.map +1 -0
- package/dist/src/accounts/signing/message.js +47 -0
- package/dist/src/accounts/signing/passkeys.d.ts +29 -0
- package/dist/src/accounts/signing/passkeys.d.ts.map +1 -0
- package/dist/src/accounts/signing/passkeys.js +90 -0
- package/dist/src/accounts/signing/passkeys.test.d.ts +2 -0
- package/dist/src/accounts/signing/passkeys.test.d.ts.map +1 -0
- package/dist/src/accounts/signing/passkeys.test.js +73 -0
- package/dist/src/accounts/signing/typedData.d.ts +5 -0
- package/dist/src/accounts/signing/typedData.d.ts.map +1 -0
- package/dist/src/accounts/signing/typedData.js +35 -0
- 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 +96 -0
- package/dist/src/accounts/utils.d.ts +2 -1
- package/dist/src/accounts/utils.d.ts.map +1 -1
- package/dist/src/accounts/utils.js +7 -0
- package/dist/src/actions/index.d.ts +145 -7
- package/dist/src/actions/index.d.ts.map +1 -1
- package/dist/src/actions/index.js +373 -23
- package/dist/src/actions/index.test.js +35 -17
- package/dist/src/actions/smart-session.d.ts +8 -2
- package/dist/src/actions/smart-session.d.ts.map +1 -1
- package/dist/src/actions/smart-session.js +6 -0
- package/dist/src/execution/compact.d.ts +130 -3
- package/dist/src/execution/compact.d.ts.map +1 -1
- package/dist/src/execution/compact.js +94 -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 +3 -4
- package/dist/src/execution/index.d.ts.map +1 -1
- package/dist/src/execution/index.js +35 -80
- 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 +19 -14
- package/dist/src/execution/utils.d.ts.map +1 -1
- package/dist/src/execution/utils.js +222 -97
- package/dist/src/index.d.ts +17 -15
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +108 -21
- package/dist/src/modules/index.d.ts +3 -22
- package/dist/src/modules/index.d.ts.map +1 -1
- package/dist/src/modules/index.js +5 -65
- package/dist/src/modules/index.test.js +3 -17
- package/dist/src/modules/omni-account.d.ts +2 -4
- package/dist/src/modules/omni-account.d.ts.map +1 -1
- package/dist/src/modules/omni-account.js +4 -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 +7 -37
- package/dist/src/modules/validators/core.d.ts +8 -8
- package/dist/src/modules/validators/core.d.ts.map +1 -1
- package/dist/src/modules/validators/core.js +126 -42
- package/dist/src/modules/validators/core.test.js +7 -7
- 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 +10 -9
- package/dist/src/modules/validators/smart-sessions.test.js +4 -4
- package/dist/src/orchestrator/client.d.ts +5 -3
- package/dist/src/orchestrator/client.d.ts.map +1 -1
- package/dist/src/orchestrator/client.js +159 -95
- package/dist/src/orchestrator/consts.d.ts +3 -2
- package/dist/src/orchestrator/consts.d.ts.map +1 -1
- package/dist/src/orchestrator/consts.js +4 -2
- package/dist/src/orchestrator/index.d.ts +3 -4
- package/dist/src/orchestrator/index.d.ts.map +1 -1
- package/dist/src/orchestrator/index.js +1 -9
- package/dist/src/orchestrator/registry.d.ts +10 -13
- package/dist/src/orchestrator/registry.d.ts.map +1 -1
- package/dist/src/orchestrator/registry.js +75 -395
- 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 +78 -16
- package/dist/src/orchestrator/types.d.ts.map +1 -1
- package/dist/src/orchestrator/utils.d.ts +1 -3
- package/dist/src/orchestrator/utils.d.ts.map +1 -1
- package/dist/src/orchestrator/utils.js +0 -102
- package/dist/src/types.d.ts +69 -26
- 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 +2 -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
package/dist/src/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UnsupportedTokenError = exports.UnsupportedChainIdError = exports.UnsupportedChainError = exports.TokenNotSupportedError = exports.IntentNotFoundError = exports.OrchestratorError = exports.OnlyOneTargetTokenAmountCanBeUnsetError = exports.NoPathFoundError = exports.InvalidIntentSignatureError = exports.InvalidApiKeyError = exports.InsufficientBalanceError = exports.AuthenticationRequiredError = exports.isOrchestratorError = exports.SessionChainRequiredError = exports.OrderPathRequiredForIntentsError = exports.UserOperationRequiredForSmartSessionsError = exports.
|
|
3
|
+
exports.getSupportedTokens = exports.UnsupportedTokenError = exports.UnsupportedChainIdError = exports.UnsupportedChainError = exports.TokenNotSupportedError = exports.IntentNotFoundError = exports.OrchestratorError = exports.OnlyOneTargetTokenAmountCanBeUnsetError = exports.NoPathFoundError = exports.InvalidIntentSignatureError = exports.InvalidApiKeyError = exports.InsufficientBalanceError = exports.AuthenticationRequiredError = exports.isOrchestratorError = exports.SessionChainRequiredError = exports.OrderPathRequiredForIntentsError = exports.UserOperationRequiredForSmartSessionsError = exports.SourceChainsNotAvailableForUserOpFlowError = exports.ExecutionError = exports.IntentFailedError = exports.isExecutionError = exports.Eip7702NotSupportedForAccountError = exports.SignMessageNotSupportedByAccountError = exports.SigningNotSupportedForAccountError = exports.SmartSessionsNotEnabledError = exports.FactoryArgsNotAvailableError = exports.ExistingEip7702AccountsNotSupportedError = exports.Eip7702AccountMustHaveEoaError = exports.AccountError = exports.isAccountError = exports.setUpRecovery = exports.setSubValidator = exports.removeSubValidator = exports.removePasskeyOwner = exports.removeOwner = exports.recoverPasskeyOwnership = exports.recoverEcdsaOwnership = exports.recover = exports.encodeSmartSessionSignature = exports.enablePasskeys = exports.enableMultiFactor = exports.enableEcdsa = exports.disablePasskeys = exports.disableMultiFactor = exports.disableEcdsa = exports.changePasskeyThreshold = exports.changeThreshold = exports.changeMultiFactorThreshold = exports.addPasskeyOwner = exports.addOwner = void 0;
|
|
4
|
+
exports.getTokenAddress = void 0;
|
|
4
5
|
exports.createRhinestoneAccount = createRhinestoneAccount;
|
|
5
6
|
const accounts_1 = require("./accounts");
|
|
6
7
|
Object.defineProperty(exports, "AccountError", { enumerable: true, get: function () { return accounts_1.AccountError; } });
|
|
@@ -14,30 +15,40 @@ Object.defineProperty(exports, "SignMessageNotSupportedByAccountError", { enumer
|
|
|
14
15
|
Object.defineProperty(exports, "SmartSessionsNotEnabledError", { enumerable: true, get: function () { return accounts_1.SmartSessionsNotEnabledError; } });
|
|
15
16
|
const actions_1 = require("./actions");
|
|
16
17
|
Object.defineProperty(exports, "addOwner", { enumerable: true, get: function () { return actions_1.addOwner; } });
|
|
18
|
+
Object.defineProperty(exports, "addPasskeyOwner", { enumerable: true, get: function () { return actions_1.addPasskeyOwner; } });
|
|
19
|
+
Object.defineProperty(exports, "changeMultiFactorThreshold", { enumerable: true, get: function () { return actions_1.changeMultiFactorThreshold; } });
|
|
20
|
+
Object.defineProperty(exports, "changePasskeyThreshold", { enumerable: true, get: function () { return actions_1.changePasskeyThreshold; } });
|
|
17
21
|
Object.defineProperty(exports, "changeThreshold", { enumerable: true, get: function () { return actions_1.changeThreshold; } });
|
|
18
22
|
Object.defineProperty(exports, "disableEcdsa", { enumerable: true, get: function () { return actions_1.disableEcdsa; } });
|
|
23
|
+
Object.defineProperty(exports, "disableMultiFactor", { enumerable: true, get: function () { return actions_1.disableMultiFactor; } });
|
|
19
24
|
Object.defineProperty(exports, "disablePasskeys", { enumerable: true, get: function () { return actions_1.disablePasskeys; } });
|
|
20
25
|
Object.defineProperty(exports, "enableEcdsa", { enumerable: true, get: function () { return actions_1.enableEcdsa; } });
|
|
26
|
+
Object.defineProperty(exports, "enableMultiFactor", { enumerable: true, get: function () { return actions_1.enableMultiFactor; } });
|
|
21
27
|
Object.defineProperty(exports, "enablePasskeys", { enumerable: true, get: function () { return actions_1.enablePasskeys; } });
|
|
22
28
|
Object.defineProperty(exports, "encodeSmartSessionSignature", { enumerable: true, get: function () { return actions_1.encodeSmartSessionSignature; } });
|
|
23
29
|
Object.defineProperty(exports, "recover", { enumerable: true, get: function () { return actions_1.recover; } });
|
|
30
|
+
Object.defineProperty(exports, "recoverEcdsaOwnership", { enumerable: true, get: function () { return actions_1.recoverEcdsaOwnership; } });
|
|
31
|
+
Object.defineProperty(exports, "recoverPasskeyOwnership", { enumerable: true, get: function () { return actions_1.recoverPasskeyOwnership; } });
|
|
24
32
|
Object.defineProperty(exports, "removeOwner", { enumerable: true, get: function () { return actions_1.removeOwner; } });
|
|
33
|
+
Object.defineProperty(exports, "removePasskeyOwner", { enumerable: true, get: function () { return actions_1.removePasskeyOwner; } });
|
|
34
|
+
Object.defineProperty(exports, "removeSubValidator", { enumerable: true, get: function () { return actions_1.removeSubValidator; } });
|
|
35
|
+
Object.defineProperty(exports, "setSubValidator", { enumerable: true, get: function () { return actions_1.setSubValidator; } });
|
|
25
36
|
Object.defineProperty(exports, "setUpRecovery", { enumerable: true, get: function () { return actions_1.setUpRecovery; } });
|
|
26
|
-
Object.defineProperty(exports, "trustAttester", { enumerable: true, get: function () { return actions_1.trustAttester; } });
|
|
27
37
|
const execution_1 = require("./execution");
|
|
28
38
|
Object.defineProperty(exports, "ExecutionError", { enumerable: true, get: function () { return execution_1.ExecutionError; } });
|
|
29
39
|
Object.defineProperty(exports, "IntentFailedError", { enumerable: true, get: function () { return execution_1.IntentFailedError; } });
|
|
30
40
|
Object.defineProperty(exports, "isExecutionError", { enumerable: true, get: function () { return execution_1.isExecutionError; } });
|
|
31
41
|
Object.defineProperty(exports, "OrderPathRequiredForIntentsError", { enumerable: true, get: function () { return execution_1.OrderPathRequiredForIntentsError; } });
|
|
32
42
|
Object.defineProperty(exports, "SessionChainRequiredError", { enumerable: true, get: function () { return execution_1.SessionChainRequiredError; } });
|
|
33
|
-
Object.defineProperty(exports, "
|
|
34
|
-
Object.defineProperty(exports, "SourceTargetChainMismatchError", { enumerable: true, get: function () { return execution_1.SourceTargetChainMismatchError; } });
|
|
43
|
+
Object.defineProperty(exports, "SourceChainsNotAvailableForUserOpFlowError", { enumerable: true, get: function () { return execution_1.SourceChainsNotAvailableForUserOpFlowError; } });
|
|
35
44
|
Object.defineProperty(exports, "UserOperationRequiredForSmartSessionsError", { enumerable: true, get: function () { return execution_1.UserOperationRequiredForSmartSessionsError; } });
|
|
36
45
|
const smart_session_1 = require("./execution/smart-session");
|
|
37
46
|
const utils_1 = require("./execution/utils");
|
|
38
47
|
const modules_1 = require("./modules");
|
|
39
48
|
const orchestrator_1 = require("./orchestrator");
|
|
40
49
|
Object.defineProperty(exports, "AuthenticationRequiredError", { enumerable: true, get: function () { return orchestrator_1.AuthenticationRequiredError; } });
|
|
50
|
+
Object.defineProperty(exports, "getSupportedTokens", { enumerable: true, get: function () { return orchestrator_1.getSupportedTokens; } });
|
|
51
|
+
Object.defineProperty(exports, "getTokenAddress", { enumerable: true, get: function () { return orchestrator_1.getTokenAddress; } });
|
|
41
52
|
Object.defineProperty(exports, "InsufficientBalanceError", { enumerable: true, get: function () { return orchestrator_1.InsufficientBalanceError; } });
|
|
42
53
|
Object.defineProperty(exports, "IntentNotFoundError", { enumerable: true, get: function () { return orchestrator_1.IntentNotFoundError; } });
|
|
43
54
|
Object.defineProperty(exports, "InvalidApiKeyError", { enumerable: true, get: function () { return orchestrator_1.InvalidApiKeyError; } });
|
|
@@ -57,17 +68,87 @@ Object.defineProperty(exports, "UnsupportedTokenError", { enumerable: true, get:
|
|
|
57
68
|
* @returns account
|
|
58
69
|
*/
|
|
59
70
|
async function createRhinestoneAccount(config) {
|
|
71
|
+
/**
|
|
72
|
+
* Deploys the account on a given chain
|
|
73
|
+
* @param chain Chain to deploy the account on
|
|
74
|
+
* @param session Session to deploy the account on (optional)
|
|
75
|
+
*/
|
|
60
76
|
function deploy(chain, session) {
|
|
61
77
|
return (0, accounts_1.deploy)(config, chain, session);
|
|
62
78
|
}
|
|
79
|
+
/**
|
|
80
|
+
* Prepare and sign the EIP-7702 account initialization data
|
|
81
|
+
* @returns init data signature
|
|
82
|
+
*/
|
|
83
|
+
function signEip7702InitData() {
|
|
84
|
+
return (0, accounts_1.signEip7702InitData)(config);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Prepare a transaction data
|
|
88
|
+
* @param transaction Transaction to prepare
|
|
89
|
+
* @returns prepared transaction data
|
|
90
|
+
*/
|
|
63
91
|
function prepareTransaction(transaction) {
|
|
64
92
|
return (0, utils_1.prepareTransaction)(config, transaction);
|
|
65
93
|
}
|
|
94
|
+
/**
|
|
95
|
+
* Sign a transaction
|
|
96
|
+
* @param preparedTransaction Prepared transaction data
|
|
97
|
+
* @returns signed transaction data
|
|
98
|
+
* @see {@link prepareTransaction} to prepare the transaction data for signing
|
|
99
|
+
*/
|
|
66
100
|
function signTransaction(preparedTransaction) {
|
|
67
101
|
return (0, utils_1.signTransaction)(config, preparedTransaction);
|
|
68
102
|
}
|
|
69
|
-
|
|
70
|
-
|
|
103
|
+
/**
|
|
104
|
+
* Sign the required EIP-7702 authorizations for a transaction
|
|
105
|
+
* @param preparedTransaction Prepared transaction data
|
|
106
|
+
* @returns signed authorizations
|
|
107
|
+
* @see {@link prepareTransaction} to prepare the transaction data for signing
|
|
108
|
+
*/
|
|
109
|
+
function signAuthorizations(preparedTransaction) {
|
|
110
|
+
return (0, utils_1.signAuthorizations)(config, preparedTransaction);
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Sign a message (EIP-191)
|
|
114
|
+
* @param message Message to sign
|
|
115
|
+
* @param chain Chain to sign the message on
|
|
116
|
+
* @param signers Signers to use for signing
|
|
117
|
+
* @returns signature
|
|
118
|
+
*/
|
|
119
|
+
function signMessage(message, chain, signers) {
|
|
120
|
+
return (0, utils_1.signMessage)(config, message, chain, signers);
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Sign a typed data (EIP-712)
|
|
124
|
+
* @param parameters Typed data parameters
|
|
125
|
+
* @param chain Chain to sign the typed data on
|
|
126
|
+
* @param signers Signers to use for signing
|
|
127
|
+
* @returns signature
|
|
128
|
+
*/
|
|
129
|
+
function signTypedData(parameters, chain, signers) {
|
|
130
|
+
return (0, utils_1.signTypedData)(config, parameters, chain, signers);
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Submit a transaction
|
|
134
|
+
* @param signedTransaction Signed transaction data
|
|
135
|
+
* @param authorizations EIP-7702 authorizations to submit (optional)
|
|
136
|
+
* @returns transaction result object (an intent ID or a UserOp hash)
|
|
137
|
+
* @see {@link signTransaction} to sign the transaction data
|
|
138
|
+
* @see {@link signAuthorizations} to sign the required EIP-7702 authorizations
|
|
139
|
+
*/
|
|
140
|
+
function submitTransaction(signedTransaction, authorizations) {
|
|
141
|
+
return (0, utils_1.submitTransaction)(config, signedTransaction, authorizations ?? []);
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Simulate a transaction
|
|
145
|
+
* @param signedTransaction Signed transaction data
|
|
146
|
+
* @param authorizations EIP-7702 authorizations to simulate (optional)
|
|
147
|
+
* @returns simulation result
|
|
148
|
+
* @see {@link sendTransaction} to send the transaction
|
|
149
|
+
*/
|
|
150
|
+
function simulateTransaction(signedTransaction, authorizations) {
|
|
151
|
+
return (0, utils_1.simulateTransaction)(config, signedTransaction, authorizations ?? []);
|
|
71
152
|
}
|
|
72
153
|
/**
|
|
73
154
|
* Sign and send a transaction
|
|
@@ -108,43 +189,49 @@ async function createRhinestoneAccount(config) {
|
|
|
108
189
|
* @param gasUnits Gas cost estimate for the transaction execution
|
|
109
190
|
* @returns Maximum spendable amount in absolute units
|
|
110
191
|
*/
|
|
111
|
-
function getMaxSpendableAmount(chain, tokenAddress, gasUnits) {
|
|
112
|
-
return (0, execution_1.getMaxSpendableAmount)(config, chain, tokenAddress, gasUnits);
|
|
113
|
-
}
|
|
114
|
-
function getSessionDetails(sessions, sessionIndex, signature) {
|
|
115
|
-
return (0, smart_session_1.getSessionDetails)(config, sessions, sessionIndex, signature);
|
|
116
|
-
}
|
|
117
|
-
function areAttestersTrusted(chain) {
|
|
118
|
-
const account = getAddress();
|
|
119
|
-
return (0, modules_1.areAttestersTrusted)(account, chain);
|
|
192
|
+
function getMaxSpendableAmount(chain, tokenAddress, gasUnits, sponsored = false) {
|
|
193
|
+
return (0, execution_1.getMaxSpendableAmount)(config, chain, tokenAddress, gasUnits, sponsored);
|
|
120
194
|
}
|
|
195
|
+
/**
|
|
196
|
+
* Get account owners (ECDSA)
|
|
197
|
+
* @param chain Chain to get the owners on
|
|
198
|
+
* @returns Account owners
|
|
199
|
+
*/
|
|
121
200
|
function getOwners(chain) {
|
|
122
201
|
const account = getAddress();
|
|
123
|
-
return (0, modules_1.getOwners)(account, chain);
|
|
202
|
+
return (0, modules_1.getOwners)(account, chain, config.provider);
|
|
124
203
|
}
|
|
204
|
+
/**
|
|
205
|
+
* Get account validator modules
|
|
206
|
+
* @param chain Chain to get the validators on
|
|
207
|
+
* @returns List of account validators
|
|
208
|
+
*/
|
|
125
209
|
function getValidators(chain) {
|
|
126
210
|
const accountType = config.account?.type || 'nexus';
|
|
127
211
|
const account = getAddress();
|
|
128
|
-
return (0, modules_1.getValidators)(accountType, account, chain);
|
|
212
|
+
return (0, modules_1.getValidators)(accountType, account, chain, config.provider);
|
|
129
213
|
}
|
|
130
|
-
|
|
131
|
-
return (0,
|
|
214
|
+
function getSessionDetails(sessions, sessionIndex, signature) {
|
|
215
|
+
return (0, smart_session_1.getSessionDetails)(config, sessions, sessionIndex, signature);
|
|
132
216
|
}
|
|
133
217
|
return {
|
|
134
218
|
config,
|
|
135
219
|
deploy,
|
|
220
|
+
signEip7702InitData,
|
|
136
221
|
prepareTransaction,
|
|
137
222
|
signTransaction,
|
|
223
|
+
signAuthorizations,
|
|
224
|
+
signMessage,
|
|
225
|
+
signTypedData,
|
|
138
226
|
submitTransaction,
|
|
227
|
+
simulateTransaction,
|
|
139
228
|
sendTransaction,
|
|
140
229
|
waitForExecution,
|
|
141
230
|
getAddress,
|
|
142
231
|
getPortfolio,
|
|
143
232
|
getMaxSpendableAmount,
|
|
144
233
|
getSessionDetails,
|
|
145
|
-
areAttestersTrusted,
|
|
146
234
|
getOwners,
|
|
147
235
|
getValidators,
|
|
148
|
-
deposit,
|
|
149
236
|
};
|
|
150
237
|
}
|
|
@@ -1,35 +1,16 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type Chain } from 'viem';
|
|
2
2
|
import type { RhinestoneAccountConfig } from '../types';
|
|
3
3
|
import { type Module } from './common';
|
|
4
4
|
import { HOOK_ADDRESS } from './omni-account';
|
|
5
|
-
import {
|
|
6
|
-
import { getTrustAttesterCall, getTrustedAttesters } from './registry';
|
|
5
|
+
import { getOwners, getValidators } from './read';
|
|
7
6
|
import { getOwnerValidator } from './validators';
|
|
8
|
-
interface WebAuthnData {
|
|
9
|
-
authenticatorData: Hex;
|
|
10
|
-
clientDataJSON: string;
|
|
11
|
-
typeIndex: number | bigint;
|
|
12
|
-
}
|
|
13
|
-
interface WebauthnValidatorSignature {
|
|
14
|
-
webauthn: WebAuthnData;
|
|
15
|
-
signature: WebauthnSignature | Hex | Uint8Array;
|
|
16
|
-
usePrecompiled?: boolean;
|
|
17
|
-
}
|
|
18
|
-
interface WebauthnSignature {
|
|
19
|
-
r: bigint;
|
|
20
|
-
s: bigint;
|
|
21
|
-
}
|
|
22
7
|
interface ModeleSetup {
|
|
23
8
|
validators: Module[];
|
|
24
9
|
executors: Module[];
|
|
25
10
|
fallbacks: Module[];
|
|
26
11
|
hooks: Module[];
|
|
27
|
-
registry: Address;
|
|
28
|
-
attesters: Address[];
|
|
29
|
-
threshold: number;
|
|
30
12
|
}
|
|
31
13
|
declare function getSetup(config: RhinestoneAccountConfig): ModeleSetup;
|
|
32
|
-
declare function getWebauthnValidatorSignature({ webauthn, signature, usePrecompiled, }: WebauthnValidatorSignature): `0x${string}`;
|
|
33
14
|
declare function isRip7212SupportedNetwork(chain: Chain): boolean;
|
|
34
|
-
export { HOOK_ADDRESS, getSetup,
|
|
15
|
+
export { HOOK_ADDRESS, getSetup, getOwnerValidator, getOwners, getValidators, isRip7212SupportedNetwork, };
|
|
35
16
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../modules/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
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;AAEvD,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,CA2D9D;AAED,iBAAS,yBAAyB,CAAC,KAAK,EAAE,KAAK,WAW9C;AAED,OAAO,EACL,YAAY,EACZ,QAAQ,EACR,iBAAiB,EACjB,SAAS,EACT,aAAa,EACb,yBAAyB,GAC1B,CAAA"}
|
|
@@ -1,8 +1,7 @@
|
|
|
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
|
-
exports.getWebauthnValidatorSignature = getWebauthnValidatorSignature;
|
|
6
5
|
exports.isRip7212SupportedNetwork = isRip7212SupportedNetwork;
|
|
7
6
|
const viem_1 = require("viem");
|
|
8
7
|
const chains_1 = require("viem/chains");
|
|
@@ -10,12 +9,8 @@ const common_1 = require("./common");
|
|
|
10
9
|
const omni_account_1 = require("./omni-account");
|
|
11
10
|
Object.defineProperty(exports, "HOOK_ADDRESS", { enumerable: true, get: function () { return omni_account_1.HOOK_ADDRESS; } });
|
|
12
11
|
const read_1 = require("./read");
|
|
13
|
-
Object.defineProperty(exports, "areAttestersTrusted", { enumerable: true, get: function () { return read_1.areAttestersTrusted; } });
|
|
14
12
|
Object.defineProperty(exports, "getOwners", { enumerable: true, get: function () { return read_1.getOwners; } });
|
|
15
13
|
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
14
|
const validators_1 = require("./validators");
|
|
20
15
|
Object.defineProperty(exports, "getOwnerValidator", { enumerable: true, get: function () { return validators_1.getOwnerValidator; } });
|
|
21
16
|
const core_1 = require("./validators/core");
|
|
@@ -31,9 +26,12 @@ function getSetup(config) {
|
|
|
31
26
|
const socialRecoveryValidator = (0, core_1.getSocialRecoveryValidator)(config.recovery.guardians, config.recovery.threshold);
|
|
32
27
|
validators.push(socialRecoveryValidator);
|
|
33
28
|
}
|
|
29
|
+
const intentExecutorAddress = config.useDev
|
|
30
|
+
? omni_account_1.INTENT_EXECUTOR_ADDRESS_DEV
|
|
31
|
+
: omni_account_1.INTENT_EXECUTOR_ADDRESS;
|
|
34
32
|
const executors = [
|
|
35
33
|
{
|
|
36
|
-
address:
|
|
34
|
+
address: intentExecutorAddress,
|
|
37
35
|
initData: '0x',
|
|
38
36
|
deInitData: '0x',
|
|
39
37
|
additionalContext: '0x',
|
|
@@ -58,67 +56,18 @@ function getSetup(config) {
|
|
|
58
56
|
}
|
|
59
57
|
}
|
|
60
58
|
const hooks = [];
|
|
61
|
-
const attesters = (0, registry_1.getAttesters)();
|
|
62
59
|
return {
|
|
63
60
|
validators,
|
|
64
61
|
executors,
|
|
65
62
|
fallbacks,
|
|
66
63
|
hooks,
|
|
67
|
-
registry: omni_account_1.RHINESTONE_MODULE_REGISTRY_ADDRESS,
|
|
68
|
-
attesters: attesters.list,
|
|
69
|
-
threshold: attesters.threshold,
|
|
70
64
|
};
|
|
71
65
|
}
|
|
72
|
-
function getWebauthnValidatorSignature({ webauthn, signature, usePrecompiled = false, }) {
|
|
73
|
-
const { authenticatorData, clientDataJSON, typeIndex } = webauthn;
|
|
74
|
-
let r;
|
|
75
|
-
let s;
|
|
76
|
-
if (typeof signature === 'string' || signature instanceof Uint8Array) {
|
|
77
|
-
const parsedSignature = parseSignature(signature);
|
|
78
|
-
r = parsedSignature.r;
|
|
79
|
-
s = parsedSignature.s;
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
r = signature.r;
|
|
83
|
-
s = signature.s;
|
|
84
|
-
}
|
|
85
|
-
return (0, viem_1.encodeAbiParameters)([
|
|
86
|
-
{ type: 'bytes', name: 'authenticatorData' },
|
|
87
|
-
{
|
|
88
|
-
type: 'string',
|
|
89
|
-
name: 'clientDataJSON',
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
type: 'uint256',
|
|
93
|
-
name: 'responseTypeLocation',
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
type: 'uint256',
|
|
97
|
-
name: 'r',
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
type: 'uint256',
|
|
101
|
-
name: 's',
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
type: 'bool',
|
|
105
|
-
name: 'usePrecompiled',
|
|
106
|
-
},
|
|
107
|
-
], [
|
|
108
|
-
authenticatorData,
|
|
109
|
-
clientDataJSON,
|
|
110
|
-
typeof typeIndex === 'bigint' ? typeIndex : BigInt(typeIndex),
|
|
111
|
-
r,
|
|
112
|
-
s,
|
|
113
|
-
usePrecompiled,
|
|
114
|
-
]);
|
|
115
|
-
}
|
|
116
66
|
function isRip7212SupportedNetwork(chain) {
|
|
117
67
|
const supportedChains = [
|
|
118
68
|
chains_1.optimism,
|
|
119
69
|
chains_1.optimismSepolia,
|
|
120
70
|
chains_1.polygon,
|
|
121
|
-
chains_1.polygonAmoy,
|
|
122
71
|
chains_1.base,
|
|
123
72
|
chains_1.baseSepolia,
|
|
124
73
|
chains_1.arbitrum,
|
|
@@ -126,12 +75,3 @@ function isRip7212SupportedNetwork(chain) {
|
|
|
126
75
|
];
|
|
127
76
|
return supportedChains.includes(chain);
|
|
128
77
|
}
|
|
129
|
-
function parseSignature(signature) {
|
|
130
|
-
const bytes = typeof signature === 'string' ? (0, viem_1.hexToBytes)(signature) : signature;
|
|
131
|
-
const r = bytes.slice(0, 32);
|
|
132
|
-
const s = bytes.slice(32, 64);
|
|
133
|
-
return {
|
|
134
|
-
r: BigInt((0, viem_1.bytesToHex)(r)),
|
|
135
|
-
s: BigInt((0, viem_1.bytesToHex)(s)),
|
|
136
|
-
};
|
|
137
|
-
}
|
|
@@ -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('0x000000000013fdB5234E4E3162a810F54d9f7E98');
|
|
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', () => {
|
|
@@ -23,12 +23,12 @@ const index_1 = require("./index");
|
|
|
23
23
|
rhinestoneApiKey: consts_1.MOCK_API_KEY,
|
|
24
24
|
owners: {
|
|
25
25
|
type: 'passkey',
|
|
26
|
-
|
|
26
|
+
accounts: [consts_1.passkeyAccount],
|
|
27
27
|
},
|
|
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', () => {
|
|
@@ -87,18 +87,4 @@ const index_1 = require("./index");
|
|
|
87
87
|
});
|
|
88
88
|
vitest_1.test.todo('using the omni account should install the necessary modules');
|
|
89
89
|
});
|
|
90
|
-
(0, vitest_1.describe)('WebAuthn Validator Signature', () => {
|
|
91
|
-
(0, vitest_1.test)('default', () => {
|
|
92
|
-
const signature = (0, index_1.getWebauthnValidatorSignature)({
|
|
93
|
-
webauthn: {
|
|
94
|
-
authenticatorData: '0x49960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d97631d00000000',
|
|
95
|
-
clientDataJSON: '{"type":"webauthn.get","challenge":"tbxXNFS9X_4Byr1cMwqKrIGB-_30a0QhZ6y7ucM0BOE","origin":"http://localhost:3000","crossOrigin":false, "other_keys_can_be_added_here":"do not compare clientDataJSON against a template. See https://goo.gl/yabPex"}',
|
|
96
|
-
typeIndex: 44941127272049826721201904734628716258498742255959991581049806490182030242267n,
|
|
97
|
-
},
|
|
98
|
-
signature: '0x00000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000001635bc6d0f68ff895cae8a288ecf7542a6a9cd555df784b73e1e2ea7e9104b1db15e9015d280cb19527881c625fee43fd3a405d5b0d199a8c8e6589a7381209e40000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002549960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d97631d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f47b2274797065223a22776562617574686e2e676574222c226368616c6c656e6765223a22746278584e465339585f3442797231634d77714b724947422d5f3330613051685a36793775634d30424f45222c226f726967696e223a22687474703a2f2f6c6f63616c686f73743a33303030222c2263726f73734f726967696e223a66616c73652c20226f746865725f6b6579735f63616e5f62655f61646465645f68657265223a22646f206e6f7420636f6d7061726520636c69656e74446174614a534f4e20616761696e737420612074656d706c6174652e205365652068747470733a2f2f676f6f2e676c2f796162506578227d000000000000000000000000',
|
|
99
|
-
usePrecompiled: true,
|
|
100
|
-
});
|
|
101
|
-
(0, vitest_1.expect)(signature).toEqual('0x00000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000120635bc6d0f68ff895cae8a288ecf7542a6a9cd555df784b73e1e2ea7e9104b1db00000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002549960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d97631d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f47b2274797065223a22776562617574686e2e676574222c226368616c6c656e6765223a22746278584e465339585f3442797231634d77714b724947422d5f3330613051685a36793775634d30424f45222c226f726967696e223a22687474703a2f2f6c6f63616c686f73743a33303030222c2263726f73734f726967696e223a66616c73652c20226f746865725f6b6579735f63616e5f62655f61646465645f68657265223a22646f206e6f7420636f6d7061726520636c69656e74446174614a534f4e20616761696e737420612074656d706c6174652e205365652068747470733a2f2f676f6f2e676c2f796162506578227d000000000000000000000000');
|
|
102
|
-
});
|
|
103
|
-
});
|
|
104
90
|
});
|
|
@@ -1,10 +1,8 @@
|
|
|
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
|
-
|
|
6
|
+
declare const INTENT_EXECUTOR_ADDRESS_DEV: Address;
|
|
7
|
+
export { HOOK_ADDRESS, TARGET_MODULE_ADDRESS, SAME_CHAIN_MODULE_ADDRESS, INTENT_EXECUTOR_ADDRESS, INTENT_EXECUTOR_ADDRESS_DEV, };
|
|
10
8
|
//# 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;AAC9C,QAAA,MAAM,2BAA2B,EAAE,OACW,CAAA;AAE9C,OAAO,EACL,YAAY,EACZ,qBAAqB,EACrB,yBAAyB,EACzB,uBAAuB,EACvB,2BAA2B,GAC5B,CAAA"}
|
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
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_DEV = 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;
|
|
12
|
+
const INTENT_EXECUTOR_ADDRESS_DEV = '0xbf9b5b917a83f8adac17b0752846d41d8d7b7e17';
|
|
13
|
+
exports.INTENT_EXECUTOR_ADDRESS_DEV = INTENT_EXECUTOR_ADDRESS_DEV;
|
|
@@ -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,CA+CpB;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,18 @@
|
|
|
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) {
|
|
14
|
+
case 'custom':
|
|
16
15
|
case 'safe':
|
|
16
|
+
case 'startale':
|
|
17
17
|
case 'nexus': {
|
|
18
18
|
const validators = await publicClient.readContract({
|
|
19
19
|
abi: [
|
|
@@ -53,10 +53,10 @@ async function getValidators(accountType, account, chain) {
|
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
-
async function getOwners(account, chain) {
|
|
56
|
+
async function getOwners(account, chain, provider) {
|
|
57
57
|
const publicClient = (0, viem_1.createPublicClient)({
|
|
58
58
|
chain,
|
|
59
|
-
transport: (0,
|
|
59
|
+
transport: (0, utils_1.createTransport)(chain, provider),
|
|
60
60
|
});
|
|
61
61
|
const moduleAddress = core_1.OWNABLE_VALIDATOR_ADDRESS;
|
|
62
62
|
const [ownerResult, thresholdResult] = await publicClient.multicall({
|
|
@@ -120,33 +120,3 @@ async function getOwners(account, chain) {
|
|
|
120
120
|
threshold: thresholdResult.result,
|
|
121
121
|
};
|
|
122
122
|
}
|
|
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,15 @@ 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;
|
|
16
|
+
declare const OWNABLE_V0_VALIDATOR_ADDRESS: Address;
|
|
15
17
|
declare function getOwnerValidator(config: RhinestoneAccountConfig): Module;
|
|
16
18
|
declare function getMockSignature(ownerSet: OwnerSet): Hex;
|
|
17
19
|
declare function getValidator(owners: OwnerSet): Module;
|
|
18
|
-
declare function getOwnableValidator(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}): Module;
|
|
22
|
-
declare function getWebAuthnValidator(webAuthnCredential: WebauthnCredential): Module;
|
|
20
|
+
declare function getOwnableValidator(threshold: number, owners: Address[], address?: Address): Module;
|
|
21
|
+
declare function getWebAuthnValidator(threshold: number, webAuthnCredentials: WebauthnCredential[]): Module;
|
|
22
|
+
declare function getMultiFactorValidator(threshold: number, validators: (OwnableValidatorConfig | WebauthnValidatorConfig | null)[]): Module;
|
|
23
23
|
declare function getSocialRecoveryValidator(guardians: Account[], threshold?: number): Module;
|
|
24
|
-
export { OWNABLE_VALIDATOR_ADDRESS, WEBAUTHN_VALIDATOR_ADDRESS, getOwnerValidator, getOwnableValidator, getWebAuthnValidator, getSocialRecoveryValidator, getValidator, getMockSignature, };
|
|
24
|
+
export { OWNABLE_VALIDATOR_ADDRESS, WEBAUTHN_VALIDATOR_ADDRESS, MULTI_FACTOR_VALIDATOR_ADDRESS, OWNABLE_V0_VALIDATOR_ADDRESS, getOwnerValidator, getOwnableValidator, getWebAuthnValidator, getMultiFactorValidator, getSocialRecoveryValidator, getValidator, getMockSignature, };
|
|
25
25
|
export type { WebauthnCredential };
|
|
26
26
|
//# 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,EAIT,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;AAE9C,QAAA,MAAM,4BAA4B,EAAE,OACU,CAAA;AAO9C,iBAAS,iBAAiB,CAAC,MAAM,EAAE,uBAAuB,UAEzD;AAED,iBAAS,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,GAAG,GAAG,CAkDjD;AAED,iBAAS,YAAY,CAAC,MAAM,EAAE,QAAQ,UAyBrC;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,GACxC,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,OAAO,EACL,yBAAyB,EACzB,0BAA0B,EAC1B,8BAA8B,EAC9B,4BAA4B,EAC5B,iBAAiB,EACjB,mBAAmB,EACnB,oBAAoB,EACpB,uBAAuB,EACvB,0BAA0B,EAC1B,YAAY,EACZ,gBAAgB,GACjB,CAAA;AACD,YAAY,EAAE,kBAAkB,EAAE,CAAA"}
|