@charterlabs/rhinestone-sdk 0.1.12 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +181 -74
- package/dist/src/accounts/index.d.ts +8 -7
- package/dist/src/accounts/index.d.ts.map +1 -1
- package/dist/src/accounts/index.js +65 -172
- package/dist/src/accounts/index.test.js +2 -3
- package/dist/src/accounts/kernel.d.ts +3 -2
- package/dist/src/accounts/kernel.d.ts.map +1 -1
- package/dist/src/accounts/kernel.js +3 -5
- package/dist/src/accounts/kernel.test.js +5 -12
- package/dist/src/accounts/nexus.d.ts +2 -2
- package/dist/src/accounts/nexus.d.ts.map +1 -1
- package/dist/src/accounts/nexus.js +17 -17
- package/dist/src/accounts/nexus.test.js +11 -14
- package/dist/src/accounts/safe.d.ts +2 -2
- package/dist/src/accounts/safe.d.ts.map +1 -1
- package/dist/src/accounts/safe.js +3 -5
- package/dist/src/accounts/safe.test.js +4 -7
- package/dist/src/accounts/signing/common.d.ts +23 -0
- package/dist/src/accounts/signing/common.d.ts.map +1 -0
- package/dist/src/accounts/signing/common.js +113 -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 +51 -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 +39 -0
- package/dist/src/accounts/startale.d.ts +2 -2
- package/dist/src/accounts/startale.d.ts.map +1 -1
- package/dist/src/accounts/startale.js +3 -3
- package/dist/src/accounts/startale.test.js +4 -7
- package/dist/src/actions/index.d.ts +84 -0
- package/dist/src/actions/index.d.ts.map +1 -1
- package/dist/src/actions/index.js +92 -0
- package/dist/src/actions/index.test.js +15 -15
- package/dist/src/actions/smart-session.d.ts +6 -0
- 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 +128 -1
- package/dist/src/execution/compact.d.ts.map +1 -1
- package/dist/src/execution/compact.js +91 -0
- package/dist/src/execution/index.d.ts.map +1 -1
- package/dist/src/execution/index.js +2 -3
- package/dist/src/execution/utils.d.ts +6 -5
- package/dist/src/execution/utils.d.ts.map +1 -1
- package/dist/src/execution/utils.js +37 -17
- package/dist/src/index.d.ts +8 -7
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +89 -31
- package/dist/src/modules/index.d.ts +3 -8
- package/dist/src/modules/index.d.ts.map +1 -1
- package/dist/src/modules/index.js +26 -27
- package/dist/src/modules/index.test.js +1 -4
- package/dist/src/modules/validators/core.d.ts.map +1 -1
- package/dist/src/modules/validators/core.js +19 -14
- package/dist/src/modules/validators/core.test.js +4 -11
- package/dist/src/modules/validators/index.d.ts +1 -2
- package/dist/src/modules/validators/index.d.ts.map +1 -1
- package/dist/src/modules/validators/index.js +1 -13
- package/dist/src/modules/validators/smart-sessions.js +3 -3
- package/dist/src/modules/validators/smart-sessions.test.js +4 -4
- package/dist/src/orchestrator/index.d.ts +1 -2
- package/dist/src/orchestrator/index.d.ts.map +1 -1
- package/dist/src/orchestrator/index.js +1 -3
- 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 +2 -5
- package/dist/src/types.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/src/index.d.ts
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
import type { Address, Chain, Hex, SignedAuthorizationList } from 'viem';
|
|
1
|
+
import type { Address, Chain, HashTypedDataParameters, Hex, SignableMessage, SignedAuthorizationList, TypedData } from 'viem';
|
|
2
2
|
import type { UserOperationReceipt } from 'viem/account-abstraction';
|
|
3
|
-
import { AccountError,
|
|
4
|
-
import { createTransport } from './accounts/utils';
|
|
3
|
+
import { AccountError, Eip7702AccountMustHaveEoaError, Eip7702NotSupportedForAccountError, ExistingEip7702AccountsNotSupportedError, FactoryArgsNotAvailableError, isAccountError, SigningNotSupportedForAccountError, SignMessageNotSupportedByAccountError, SmartSessionsNotEnabledError } from './accounts';
|
|
5
4
|
import { addOwner, changeMultiFactorThreshold, changeThreshold, disableEcdsa, disableMultiFactor, disablePasskeys, enableEcdsa, enableMultiFactor, enablePasskeys, encodeSmartSessionSignature, recover, removeOwner, removeSubValidator, setSubValidator, setUpRecovery } from './actions';
|
|
6
|
-
import { addCredential, generateCredentialId, getCredentialIds, getCredentialInfo, getCredentials, getThreshold, hasCredential, hasCredentialById, removeCredential, setThreshold, WEBAUTHN_VALIDATOR_ABI } from './modules/validators';
|
|
7
5
|
import type { TransactionResult } from './execution';
|
|
8
6
|
import { ExecutionError, IntentFailedError, isExecutionError, OrderPathRequiredForIntentsError, SessionChainRequiredError, SourceChainsNotAvailableForUserOpFlowError, UserOperationRequiredForSmartSessionsError } from './execution';
|
|
9
7
|
import { type SessionDetails } from './execution/smart-session';
|
|
10
8
|
import { type IntentData, type PreparedTransactionData, type SignedTransactionData } from './execution/utils';
|
|
11
|
-
import { AuthenticationRequiredError, InsufficientBalanceError, type IntentCost, type IntentInput, IntentNotFoundError, type IntentOp, type IntentOpStatus, type IntentResult, type IntentRoute, InvalidApiKeyError, InvalidIntentSignatureError, isOrchestratorError, NoPathFoundError, OnlyOneTargetTokenAmountCanBeUnsetError, OrchestratorError, type Portfolio, type SettlementSystem, type SignedIntentOp, TokenNotSupportedError, UnsupportedChainError, UnsupportedChainIdError, UnsupportedTokenError
|
|
12
|
-
import type { Call, RhinestoneAccountConfig, Session, Transaction } from './types';
|
|
9
|
+
import { AuthenticationRequiredError, InsufficientBalanceError, type IntentCost, type IntentInput, IntentNotFoundError, type IntentOp, type IntentOpStatus, type IntentResult, type IntentRoute, InvalidApiKeyError, InvalidIntentSignatureError, isOrchestratorError, NoPathFoundError, OnlyOneTargetTokenAmountCanBeUnsetError, OrchestratorError, type Portfolio, type SettlementSystem, type SignedIntentOp, TokenNotSupportedError, UnsupportedChainError, UnsupportedChainIdError, UnsupportedTokenError } from './orchestrator';
|
|
10
|
+
import type { Call, RhinestoneAccountConfig, Session, SignerSet, Transaction } from './types';
|
|
13
11
|
interface RhinestoneAccount {
|
|
14
12
|
config: RhinestoneAccountConfig;
|
|
15
13
|
deploy: (chain: Chain, session?: Session) => Promise<void>;
|
|
@@ -17,6 +15,8 @@ interface RhinestoneAccount {
|
|
|
17
15
|
prepareTransaction: (transaction: Transaction) => Promise<PreparedTransactionData>;
|
|
18
16
|
signTransaction: (preparedTransaction: PreparedTransactionData) => Promise<SignedTransactionData>;
|
|
19
17
|
signAuthorizations: (preparedTransaction: PreparedTransactionData) => Promise<SignedAuthorizationList>;
|
|
18
|
+
signMessage: (message: SignableMessage, chain: Chain, signers: SignerSet | undefined) => Promise<Hex>;
|
|
19
|
+
signTypedData: <typedData extends TypedData | Record<string, unknown> = TypedData, primaryType extends keyof typedData | 'EIP712Domain' = keyof typedData>(parameters: HashTypedDataParameters<typedData, primaryType>, chain: Chain, signers: SignerSet | undefined) => Promise<Hex>;
|
|
20
20
|
submitTransaction: (signedTransaction: SignedTransactionData, authorizations?: SignedAuthorizationList) => Promise<TransactionResult>;
|
|
21
21
|
sendTransaction: (transaction: Transaction) => Promise<TransactionResult>;
|
|
22
22
|
waitForExecution: (result: TransactionResult, acceptsPreconfirmations?: boolean) => Promise<IntentOpStatus | UserOperationReceipt>;
|
|
@@ -37,6 +37,7 @@ interface RhinestoneAccount {
|
|
|
37
37
|
* @returns account
|
|
38
38
|
*/
|
|
39
39
|
declare function createRhinestoneAccount(config: RhinestoneAccountConfig): Promise<RhinestoneAccount>;
|
|
40
|
-
export { createRhinestoneAccount,
|
|
40
|
+
export { createRhinestoneAccount, addOwner, changeMultiFactorThreshold, changeThreshold, disableEcdsa, disableMultiFactor, disablePasskeys, enableEcdsa, enableMultiFactor, enablePasskeys, encodeSmartSessionSignature, recover, removeOwner, removeSubValidator, setSubValidator, setUpRecovery, isAccountError, AccountError, Eip7702AccountMustHaveEoaError, ExistingEip7702AccountsNotSupportedError, FactoryArgsNotAvailableError, SmartSessionsNotEnabledError, SigningNotSupportedForAccountError, SignMessageNotSupportedByAccountError, Eip7702NotSupportedForAccountError, isExecutionError, IntentFailedError, ExecutionError, SourceChainsNotAvailableForUserOpFlowError, UserOperationRequiredForSmartSessionsError, OrderPathRequiredForIntentsError, SessionChainRequiredError, isOrchestratorError, AuthenticationRequiredError, InsufficientBalanceError, InvalidApiKeyError, InvalidIntentSignatureError, NoPathFoundError, OnlyOneTargetTokenAmountCanBeUnsetError, OrchestratorError, IntentNotFoundError, TokenNotSupportedError, UnsupportedChainError, UnsupportedChainIdError, UnsupportedTokenError, };
|
|
41
41
|
export type { RhinestoneAccount, Session, Call, IntentData, PreparedTransactionData, SignedTransactionData, TransactionResult, IntentCost, IntentInput, IntentOp, IntentOpStatus, IntentResult, IntentRoute, SettlementSystem, SignedIntentOp, Portfolio, };
|
|
42
|
+
export { generateCredentialId, getCredentialIds, hasCredentialById, hasCredential, addCredential, removeCredential, setThreshold, getCredentialInfo, getThreshold, getCredentials, WEBAUTHN_VALIDATOR_ABI, } from './modules/validators/webauthn-contract';
|
|
42
43
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EACP,KAAK,EACL,uBAAuB,EACvB,GAAG,EACH,eAAe,EACf,uBAAuB,EACvB,SAAS,EACV,MAAM,MAAM,CAAA;AACb,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAA;AACpE,OAAO,EACL,YAAY,EAEZ,8BAA8B,EAC9B,kCAAkC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BAAgB,EAChB,uCAAuC,EACvC,iBAAiB,EACjB,mBAAmB,EACnB,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,GACtB,CAAA;AACD,YAAY,EACV,iBAAiB,EACjB,OAAO,EACP,IAAI,EACJ,UAAU,EACV,uBAAuB,EACvB,qBAAqB,EACrB,iBAAiB,EACjB,UAAU,EACV,WAAW,EACX,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,cAAc,EACd,SAAS,GACV,CAAA;AAGD,OAAO,EACL,oBAAoB,EACpB,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,iBAAiB,EACjB,YAAY,EACZ,cAAc,EACd,sBAAsB,GACvB,MAAM,wCAAwC,CAAA"}
|
package/dist/src/index.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.
|
|
3
|
+
exports.removeCredential = exports.addCredential = exports.hasCredential = exports.hasCredentialById = exports.getCredentialIds = exports.generateCredentialId = 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.removeOwner = exports.recover = exports.encodeSmartSessionSignature = exports.enablePasskeys = exports.enableMultiFactor = exports.enableEcdsa = exports.disablePasskeys = exports.disableMultiFactor = exports.disableEcdsa = exports.changeThreshold = exports.changeMultiFactorThreshold = exports.addOwner = void 0;
|
|
4
|
+
exports.WEBAUTHN_VALIDATOR_ABI = exports.getCredentials = exports.getThreshold = exports.getCredentialInfo = exports.setThreshold = void 0;
|
|
5
5
|
exports.createRhinestoneAccount = createRhinestoneAccount;
|
|
6
6
|
const accounts_1 = require("./accounts");
|
|
7
7
|
Object.defineProperty(exports, "AccountError", { enumerable: true, get: function () { return accounts_1.AccountError; } });
|
|
8
|
-
Object.defineProperty(exports, "deployStandaloneWithEoa", { enumerable: true, get: function () { return accounts_1.deployStandaloneWithEoa; } });
|
|
9
8
|
Object.defineProperty(exports, "Eip7702AccountMustHaveEoaError", { enumerable: true, get: function () { return accounts_1.Eip7702AccountMustHaveEoaError; } });
|
|
10
9
|
Object.defineProperty(exports, "Eip7702NotSupportedForAccountError", { enumerable: true, get: function () { return accounts_1.Eip7702NotSupportedForAccountError; } });
|
|
11
10
|
Object.defineProperty(exports, "ExistingEip7702AccountsNotSupportedError", { enumerable: true, get: function () { return accounts_1.ExistingEip7702AccountsNotSupportedError; } });
|
|
@@ -14,8 +13,6 @@ Object.defineProperty(exports, "isAccountError", { enumerable: true, get: functi
|
|
|
14
13
|
Object.defineProperty(exports, "SigningNotSupportedForAccountError", { enumerable: true, get: function () { return accounts_1.SigningNotSupportedForAccountError; } });
|
|
15
14
|
Object.defineProperty(exports, "SignMessageNotSupportedByAccountError", { enumerable: true, get: function () { return accounts_1.SignMessageNotSupportedByAccountError; } });
|
|
16
15
|
Object.defineProperty(exports, "SmartSessionsNotEnabledError", { enumerable: true, get: function () { return accounts_1.SmartSessionsNotEnabledError; } });
|
|
17
|
-
const utils_1 = require("./accounts/utils");
|
|
18
|
-
Object.defineProperty(exports, "createTransport", { enumerable: true, get: function () { return utils_1.createTransport; } });
|
|
19
16
|
const actions_1 = require("./actions");
|
|
20
17
|
Object.defineProperty(exports, "addOwner", { enumerable: true, get: function () { return actions_1.addOwner; } });
|
|
21
18
|
Object.defineProperty(exports, "changeMultiFactorThreshold", { enumerable: true, get: function () { return actions_1.changeMultiFactorThreshold; } });
|
|
@@ -32,18 +29,6 @@ Object.defineProperty(exports, "removeOwner", { enumerable: true, get: function
|
|
|
32
29
|
Object.defineProperty(exports, "removeSubValidator", { enumerable: true, get: function () { return actions_1.removeSubValidator; } });
|
|
33
30
|
Object.defineProperty(exports, "setSubValidator", { enumerable: true, get: function () { return actions_1.setSubValidator; } });
|
|
34
31
|
Object.defineProperty(exports, "setUpRecovery", { enumerable: true, get: function () { return actions_1.setUpRecovery; } });
|
|
35
|
-
const validators_1 = require("./modules/validators");
|
|
36
|
-
Object.defineProperty(exports, "addCredential", { enumerable: true, get: function () { return validators_1.addCredential; } });
|
|
37
|
-
Object.defineProperty(exports, "generateCredentialId", { enumerable: true, get: function () { return validators_1.generateCredentialId; } });
|
|
38
|
-
Object.defineProperty(exports, "getCredentialIds", { enumerable: true, get: function () { return validators_1.getCredentialIds; } });
|
|
39
|
-
Object.defineProperty(exports, "getCredentialInfo", { enumerable: true, get: function () { return validators_1.getCredentialInfo; } });
|
|
40
|
-
Object.defineProperty(exports, "getCredentials", { enumerable: true, get: function () { return validators_1.getCredentials; } });
|
|
41
|
-
Object.defineProperty(exports, "getThreshold", { enumerable: true, get: function () { return validators_1.getThreshold; } });
|
|
42
|
-
Object.defineProperty(exports, "hasCredential", { enumerable: true, get: function () { return validators_1.hasCredential; } });
|
|
43
|
-
Object.defineProperty(exports, "hasCredentialById", { enumerable: true, get: function () { return validators_1.hasCredentialById; } });
|
|
44
|
-
Object.defineProperty(exports, "removeCredential", { enumerable: true, get: function () { return validators_1.removeCredential; } });
|
|
45
|
-
Object.defineProperty(exports, "setThreshold", { enumerable: true, get: function () { return validators_1.setThreshold; } });
|
|
46
|
-
Object.defineProperty(exports, "WEBAUTHN_VALIDATOR_ABI", { enumerable: true, get: function () { return validators_1.WEBAUTHN_VALIDATOR_ABI; } });
|
|
47
32
|
const execution_1 = require("./execution");
|
|
48
33
|
Object.defineProperty(exports, "ExecutionError", { enumerable: true, get: function () { return execution_1.ExecutionError; } });
|
|
49
34
|
Object.defineProperty(exports, "IntentFailedError", { enumerable: true, get: function () { return execution_1.IntentFailedError; } });
|
|
@@ -53,7 +38,7 @@ Object.defineProperty(exports, "SessionChainRequiredError", { enumerable: true,
|
|
|
53
38
|
Object.defineProperty(exports, "SourceChainsNotAvailableForUserOpFlowError", { enumerable: true, get: function () { return execution_1.SourceChainsNotAvailableForUserOpFlowError; } });
|
|
54
39
|
Object.defineProperty(exports, "UserOperationRequiredForSmartSessionsError", { enumerable: true, get: function () { return execution_1.UserOperationRequiredForSmartSessionsError; } });
|
|
55
40
|
const smart_session_1 = require("./execution/smart-session");
|
|
56
|
-
const
|
|
41
|
+
const utils_1 = require("./execution/utils");
|
|
57
42
|
const modules_1 = require("./modules");
|
|
58
43
|
const orchestrator_1 = require("./orchestrator");
|
|
59
44
|
Object.defineProperty(exports, "AuthenticationRequiredError", { enumerable: true, get: function () { return orchestrator_1.AuthenticationRequiredError; } });
|
|
@@ -69,12 +54,6 @@ Object.defineProperty(exports, "TokenNotSupportedError", { enumerable: true, get
|
|
|
69
54
|
Object.defineProperty(exports, "UnsupportedChainError", { enumerable: true, get: function () { return orchestrator_1.UnsupportedChainError; } });
|
|
70
55
|
Object.defineProperty(exports, "UnsupportedChainIdError", { enumerable: true, get: function () { return orchestrator_1.UnsupportedChainIdError; } });
|
|
71
56
|
Object.defineProperty(exports, "UnsupportedTokenError", { enumerable: true, get: function () { return orchestrator_1.UnsupportedTokenError; } });
|
|
72
|
-
Object.defineProperty(exports, "getTokenAddress", { enumerable: true, get: function () { return orchestrator_1.getTokenAddress; } });
|
|
73
|
-
Object.defineProperty(exports, "getTokenSymbol", { enumerable: true, get: function () { return orchestrator_1.getTokenSymbol; } });
|
|
74
|
-
Object.defineProperty(exports, "getWethAddress", { enumerable: true, get: function () { return orchestrator_1.getWethAddress; } });
|
|
75
|
-
Object.defineProperty(exports, "getSupportedTokens", { enumerable: true, get: function () { return orchestrator_1.getSupportedTokens; } });
|
|
76
|
-
Object.defineProperty(exports, "isTokenAddressSupported", { enumerable: true, get: function () { return orchestrator_1.isTokenAddressSupported; } });
|
|
77
|
-
Object.defineProperty(exports, "getOrchestrator", { enumerable: true, get: function () { return orchestrator_1.getOrchestrator; } });
|
|
78
57
|
/**
|
|
79
58
|
* Initialize a Rhinestone account
|
|
80
59
|
* Note: accounts are deployed onchain only when the first transaction is sent.
|
|
@@ -82,23 +61,77 @@ Object.defineProperty(exports, "getOrchestrator", { enumerable: true, get: funct
|
|
|
82
61
|
* @returns account
|
|
83
62
|
*/
|
|
84
63
|
async function createRhinestoneAccount(config) {
|
|
64
|
+
/**
|
|
65
|
+
* Deploys the account on a given chain
|
|
66
|
+
* @param chain Chain to deploy the account on
|
|
67
|
+
* @param session Session to deploy the account on (optional)
|
|
68
|
+
*/
|
|
85
69
|
function deploy(chain, session) {
|
|
86
70
|
return (0, accounts_1.deploy)(config, chain, session);
|
|
87
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* Prepare and sign the EIP-7702 account initialization data
|
|
74
|
+
* @returns init data signature
|
|
75
|
+
*/
|
|
88
76
|
function signEip7702InitData() {
|
|
89
77
|
return (0, accounts_1.signEip7702InitData)(config);
|
|
90
78
|
}
|
|
79
|
+
/**
|
|
80
|
+
* Prepare a transaction data
|
|
81
|
+
* @param transaction Transaction to prepare
|
|
82
|
+
* @returns prepared transaction data
|
|
83
|
+
*/
|
|
91
84
|
function prepareTransaction(transaction) {
|
|
92
|
-
return (0,
|
|
85
|
+
return (0, utils_1.prepareTransaction)(config, transaction);
|
|
93
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* Sign a transaction
|
|
89
|
+
* @param preparedTransaction Prepared transaction data
|
|
90
|
+
* @returns signed transaction data
|
|
91
|
+
* @see {@link prepareTransaction} to prepare the transaction data for signing
|
|
92
|
+
*/
|
|
94
93
|
function signTransaction(preparedTransaction) {
|
|
95
|
-
return (0,
|
|
94
|
+
return (0, utils_1.signTransaction)(config, preparedTransaction);
|
|
96
95
|
}
|
|
96
|
+
/**
|
|
97
|
+
* Sign the required EIP-7702 authorizations for a transaction
|
|
98
|
+
* @param preparedTransaction Prepared transaction data
|
|
99
|
+
* @returns signed authorizations
|
|
100
|
+
* @see {@link prepareTransaction} to prepare the transaction data for signing
|
|
101
|
+
*/
|
|
97
102
|
function signAuthorizations(preparedTransaction) {
|
|
98
|
-
return (0,
|
|
103
|
+
return (0, utils_1.signAuthorizations)(config, preparedTransaction);
|
|
99
104
|
}
|
|
105
|
+
/**
|
|
106
|
+
* Sign a message (EIP-191)
|
|
107
|
+
* @param message Message to sign
|
|
108
|
+
* @param chain Chain to sign the message on
|
|
109
|
+
* @param signers Signers to use for signing
|
|
110
|
+
* @returns signature
|
|
111
|
+
*/
|
|
112
|
+
function signMessage(message, chain, signers) {
|
|
113
|
+
return (0, utils_1.signMessage)(config, message, chain, signers);
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Sign a typed data (EIP-712)
|
|
117
|
+
* @param parameters Typed data parameters
|
|
118
|
+
* @param chain Chain to sign the typed data on
|
|
119
|
+
* @param signers Signers to use for signing
|
|
120
|
+
* @returns signature
|
|
121
|
+
*/
|
|
122
|
+
function signTypedData(parameters, chain, signers) {
|
|
123
|
+
return (0, utils_1.signTypedData)(config, parameters, chain, signers);
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Submit a transaction
|
|
127
|
+
* @param signedTransaction Signed transaction data
|
|
128
|
+
* @param authorizations EIP-7702 authorizations to submit (optional)
|
|
129
|
+
* @returns transaction result object (an intent ID or a UserOp hash)
|
|
130
|
+
* @see {@link signTransaction} to sign the transaction data
|
|
131
|
+
* @see {@link signAuthorizations} to sign the required EIP-7702 authorizations
|
|
132
|
+
*/
|
|
100
133
|
function submitTransaction(signedTransaction, authorizations) {
|
|
101
|
-
return (0,
|
|
134
|
+
return (0, utils_1.submitTransaction)(config, signedTransaction, authorizations ?? []);
|
|
102
135
|
}
|
|
103
136
|
/**
|
|
104
137
|
* Sign and send a transaction
|
|
@@ -142,18 +175,28 @@ async function createRhinestoneAccount(config) {
|
|
|
142
175
|
function getMaxSpendableAmount(chain, tokenAddress, gasUnits) {
|
|
143
176
|
return (0, execution_1.getMaxSpendableAmount)(config, chain, tokenAddress, gasUnits);
|
|
144
177
|
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
178
|
+
/**
|
|
179
|
+
* Get account owners (ECDSA)
|
|
180
|
+
* @param chain Chain to get the owners on
|
|
181
|
+
* @returns Account owners
|
|
182
|
+
*/
|
|
148
183
|
function getOwners(chain) {
|
|
149
184
|
const account = getAddress();
|
|
150
185
|
return (0, modules_1.getOwners)(account, chain, config.provider);
|
|
151
186
|
}
|
|
187
|
+
/**
|
|
188
|
+
* Get account validator modules
|
|
189
|
+
* @param chain Chain to get the validators on
|
|
190
|
+
* @returns List of account validators
|
|
191
|
+
*/
|
|
152
192
|
function getValidators(chain) {
|
|
153
193
|
const accountType = config.account?.type || 'nexus';
|
|
154
194
|
const account = getAddress();
|
|
155
195
|
return (0, modules_1.getValidators)(accountType, account, chain, config.provider);
|
|
156
196
|
}
|
|
197
|
+
function getSessionDetails(sessions, sessionIndex, signature) {
|
|
198
|
+
return (0, smart_session_1.getSessionDetails)(config, sessions, sessionIndex, signature);
|
|
199
|
+
}
|
|
157
200
|
return {
|
|
158
201
|
config,
|
|
159
202
|
deploy,
|
|
@@ -161,6 +204,8 @@ async function createRhinestoneAccount(config) {
|
|
|
161
204
|
prepareTransaction,
|
|
162
205
|
signTransaction,
|
|
163
206
|
signAuthorizations,
|
|
207
|
+
signMessage,
|
|
208
|
+
signTypedData,
|
|
164
209
|
submitTransaction,
|
|
165
210
|
sendTransaction,
|
|
166
211
|
waitForExecution,
|
|
@@ -172,3 +217,16 @@ async function createRhinestoneAccount(config) {
|
|
|
172
217
|
getValidators,
|
|
173
218
|
};
|
|
174
219
|
}
|
|
220
|
+
// WebAuthn Validator contract helpers
|
|
221
|
+
var webauthn_contract_1 = require("./modules/validators/webauthn-contract");
|
|
222
|
+
Object.defineProperty(exports, "generateCredentialId", { enumerable: true, get: function () { return webauthn_contract_1.generateCredentialId; } });
|
|
223
|
+
Object.defineProperty(exports, "getCredentialIds", { enumerable: true, get: function () { return webauthn_contract_1.getCredentialIds; } });
|
|
224
|
+
Object.defineProperty(exports, "hasCredentialById", { enumerable: true, get: function () { return webauthn_contract_1.hasCredentialById; } });
|
|
225
|
+
Object.defineProperty(exports, "hasCredential", { enumerable: true, get: function () { return webauthn_contract_1.hasCredential; } });
|
|
226
|
+
Object.defineProperty(exports, "addCredential", { enumerable: true, get: function () { return webauthn_contract_1.addCredential; } });
|
|
227
|
+
Object.defineProperty(exports, "removeCredential", { enumerable: true, get: function () { return webauthn_contract_1.removeCredential; } });
|
|
228
|
+
Object.defineProperty(exports, "setThreshold", { enumerable: true, get: function () { return webauthn_contract_1.setThreshold; } });
|
|
229
|
+
Object.defineProperty(exports, "getCredentialInfo", { enumerable: true, get: function () { return webauthn_contract_1.getCredentialInfo; } });
|
|
230
|
+
Object.defineProperty(exports, "getThreshold", { enumerable: true, get: function () { return webauthn_contract_1.getThreshold; } });
|
|
231
|
+
Object.defineProperty(exports, "getCredentials", { enumerable: true, get: function () { return webauthn_contract_1.getCredentials; } });
|
|
232
|
+
Object.defineProperty(exports, "WEBAUTHN_VALIDATOR_ABI", { enumerable: true, get: function () { return webauthn_contract_1.WEBAUTHN_VALIDATOR_ABI; } });
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type Chain, type Hex } from 'viem';
|
|
2
2
|
import type { RhinestoneAccountConfig } from '../types';
|
|
3
3
|
import { type Module } from './common';
|
|
4
4
|
import { HOOK_ADDRESS } from './omni-account';
|
|
@@ -7,14 +7,12 @@ import { getOwnerValidator } from './validators';
|
|
|
7
7
|
interface WebAuthnData {
|
|
8
8
|
authenticatorData: Hex;
|
|
9
9
|
clientDataJSON: string;
|
|
10
|
-
challengeIndex: number | bigint;
|
|
11
10
|
typeIndex: number | bigint;
|
|
12
11
|
}
|
|
13
12
|
interface WebauthnValidatorSignature {
|
|
14
|
-
credentialIds: Hex[];
|
|
15
|
-
usePrecompiled?: boolean;
|
|
16
13
|
webauthn: WebAuthnData;
|
|
17
14
|
signature: WebauthnSignature | Hex | Uint8Array;
|
|
15
|
+
usePrecompiled?: boolean;
|
|
18
16
|
}
|
|
19
17
|
interface WebauthnSignature {
|
|
20
18
|
r: bigint;
|
|
@@ -25,12 +23,9 @@ interface ModeleSetup {
|
|
|
25
23
|
executors: Module[];
|
|
26
24
|
fallbacks: Module[];
|
|
27
25
|
hooks: Module[];
|
|
28
|
-
registry: Address;
|
|
29
|
-
attesters: Address[];
|
|
30
|
-
threshold: number;
|
|
31
26
|
}
|
|
32
27
|
declare function getSetup(config: RhinestoneAccountConfig): ModeleSetup;
|
|
33
|
-
declare function getWebauthnValidatorSignature(
|
|
28
|
+
declare function getWebauthnValidatorSignature({ webauthn, signature, usePrecompiled, }: WebauthnValidatorSignature): `0x${string}`;
|
|
34
29
|
declare function isRip7212SupportedNetwork(chain: Chain): boolean;
|
|
35
30
|
export { HOOK_ADDRESS, getSetup, getOwnerValidator, getWebauthnValidatorSignature, getOwners, getValidators, isRip7212SupportedNetwork, };
|
|
36
31
|
//# 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":["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}
|
|
@@ -18,7 +18,6 @@ const core_1 = require("./validators/core");
|
|
|
18
18
|
const SMART_SESSION_COMPATIBILITY_FALLBACK_ADDRESS = '0x12cae64c42f362e7d5a847c2d33388373f629177';
|
|
19
19
|
function getSetup(config) {
|
|
20
20
|
const ownerValidator = (0, validators_1.getOwnerValidator)(config);
|
|
21
|
-
console.log('what validator is being installed', ownerValidator.type);
|
|
22
21
|
const smartSessionValidator = (0, validators_1.getSmartSessionValidator)(config);
|
|
23
22
|
const validators = [ownerValidator];
|
|
24
23
|
if (smartSessionValidator) {
|
|
@@ -60,14 +59,10 @@ function getSetup(config) {
|
|
|
60
59
|
executors,
|
|
61
60
|
fallbacks,
|
|
62
61
|
hooks,
|
|
63
|
-
registry: viem_1.zeroAddress,
|
|
64
|
-
attesters: [],
|
|
65
|
-
threshold: 0,
|
|
66
62
|
};
|
|
67
63
|
}
|
|
68
|
-
function getWebauthnValidatorSignature(
|
|
69
|
-
const {
|
|
70
|
-
const { authenticatorData, clientDataJSON, challengeIndex, typeIndex } = webauthn;
|
|
64
|
+
function getWebauthnValidatorSignature({ webauthn, signature, usePrecompiled = false, }) {
|
|
65
|
+
const { authenticatorData, clientDataJSON, typeIndex } = webauthn;
|
|
71
66
|
let r;
|
|
72
67
|
let s;
|
|
73
68
|
if (typeof signature === 'string' || signature instanceof Uint8Array) {
|
|
@@ -79,31 +74,35 @@ function getWebauthnValidatorSignature(params) {
|
|
|
79
74
|
r = signature.r;
|
|
80
75
|
s = signature.s;
|
|
81
76
|
}
|
|
82
|
-
const auth = [{
|
|
83
|
-
authenticatorData,
|
|
84
|
-
clientDataJSON,
|
|
85
|
-
challengeIndex: BigInt(challengeIndex),
|
|
86
|
-
typeIndex: BigInt(typeIndex),
|
|
87
|
-
r,
|
|
88
|
-
s
|
|
89
|
-
}];
|
|
90
77
|
return (0, viem_1.encodeAbiParameters)([
|
|
91
|
-
{ type: '
|
|
92
|
-
{ type: 'bool', name: 'usePrecompiled' },
|
|
78
|
+
{ type: 'bytes', name: 'authenticatorData' },
|
|
93
79
|
{
|
|
94
|
-
type: '
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
80
|
+
type: 'string',
|
|
81
|
+
name: 'clientDataJSON',
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
type: 'uint256',
|
|
85
|
+
name: 'responseTypeLocation',
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
type: 'uint256',
|
|
89
|
+
name: 'r',
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
type: 'uint256',
|
|
93
|
+
name: 's',
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
type: 'bool',
|
|
97
|
+
name: 'usePrecompiled',
|
|
102
98
|
},
|
|
103
99
|
], [
|
|
104
|
-
|
|
100
|
+
authenticatorData,
|
|
101
|
+
clientDataJSON,
|
|
102
|
+
typeof typeIndex === 'bigint' ? typeIndex : BigInt(typeIndex),
|
|
103
|
+
r,
|
|
104
|
+
s,
|
|
105
105
|
usePrecompiled,
|
|
106
|
-
auth,
|
|
107
106
|
]);
|
|
108
107
|
}
|
|
109
108
|
function isRip7212SupportedNetwork(chain) {
|
|
@@ -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('0x20C008719Ba9D8aA14C7d07D122cd5E965aA8da5');
|
|
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', () => {
|
|
@@ -24,7 +24,6 @@ const index_1 = require("./index");
|
|
|
24
24
|
owners: {
|
|
25
25
|
type: 'passkey',
|
|
26
26
|
account: consts_1.passkeyAccount,
|
|
27
|
-
credentialIds: ['0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef'],
|
|
28
27
|
},
|
|
29
28
|
};
|
|
30
29
|
const setup = (0, index_1.getSetup)(config);
|
|
@@ -91,11 +90,9 @@ const index_1 = require("./index");
|
|
|
91
90
|
(0, vitest_1.describe)('WebAuthn Validator Signature', () => {
|
|
92
91
|
(0, vitest_1.test)('default', () => {
|
|
93
92
|
const signature = (0, index_1.getWebauthnValidatorSignature)({
|
|
94
|
-
credentialIds: ['0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef'],
|
|
95
93
|
webauthn: {
|
|
96
94
|
authenticatorData: '0x49960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d97631d00000000',
|
|
97
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"}',
|
|
98
|
-
challengeIndex: 23n,
|
|
99
96
|
typeIndex: 44941127272049826721201904734628716258498742255959991581049806490182030242267n,
|
|
100
97
|
},
|
|
101
98
|
signature: '0x00000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000001635bc6d0f68ff895cae8a288ecf7542a6a9cd555df784b73e1e2ea7e9104b1db15e9015d280cb19527881c625fee43fd3a405d5b0d199a8c8e6589a7381209e40000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002549960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d97631d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f47b2274797065223a22776562617574686e2e676574222c226368616c6c656e6765223a22746278584e465339585f3442797231634d77714b724947422d5f3330613051685a36793775634d30424f45222c226f726967696e223a22687474703a2f2f6c6f63616c686f73743a33303030222c2263726f73734f726967696e223a66616c73652c20226f746865725f6b6579735f63616e5f62655f61646465645f68657265223a22646f206e6f7420636f6d7061726520636c69656e74446174614a534f4e20616761696e737420612074656d706c6174652e205365652068747470733a2f2f676f6f2e676c2f796162506578227d000000000000000000000000',
|
|
@@ -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,EAKT,MAAM,MAAM,CAAA;AAEb,OAAO,KAAK,EACV,sBAAsB,EACtB,QAAQ,EACR,uBAAuB,EACvB,uBAAuB,EACxB,MAAM,aAAa,CAAA;AAEpB,OAAO,EAA4B,KAAK,MAAM,EAAE,MAAM,WAAW,CAAA;AAEjE,UAAU,SAAS;IACjB,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC3B,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;CACV;AAED,UAAU,kBAAkB;IAC1B,MAAM,EAAE,SAAS,GAAG,GAAG,GAAG,UAAU,CAAA;IACpC,eAAe,EAAE,MAAM,CAAA;CACxB;AAED,QAAA,MAAM,yBAAyB,EAAE,OACa,CAAA;AAC9C,QAAA,MAAM,0BAA0B,EAAE,OACY,CAAA;AAG9C,QAAA,MAAM,8BAA8B,EAAE,OACQ,CAAA;AAO9C,iBAAS,iBAAiB,CAAC,MAAM,EAAE,uBAAuB,UAEzD;AAED,iBAAS,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,GAAG,GAAG,CAiDjD;AAED,iBAAS,YAAY,CAAC,MAAM,EAAE,QAAQ,UAgBrC;AAED,iBAAS,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,CAiBzE;AAED,iBAAS,oBAAoB,CAAC,kBAAkB,EAAE,kBAAkB,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"core.d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BR;AAeD,OAAO,EACL,yBAAyB,EACzB,0BAA0B,EAC1B,8BAA8B,EAC9B,iBAAiB,EACjB,mBAAmB,EACnB,oBAAoB,EACpB,uBAAuB,EACvB,0BAA0B,EAC1B,YAAY,EACZ,gBAAgB,GACjB,CAAA;AACD,YAAY,EAAE,kBAAkB,EAAE,CAAA"}
|
|
@@ -10,7 +10,7 @@ exports.getValidator = getValidator;
|
|
|
10
10
|
exports.getMockSignature = getMockSignature;
|
|
11
11
|
const viem_1 = require("viem");
|
|
12
12
|
const common_1 = require("../common");
|
|
13
|
-
const OWNABLE_VALIDATOR_ADDRESS = '
|
|
13
|
+
const OWNABLE_VALIDATOR_ADDRESS = '0x20C008719Ba9D8aA14C7d07D122cd5E965aA8da5';
|
|
14
14
|
exports.OWNABLE_VALIDATOR_ADDRESS = OWNABLE_VALIDATOR_ADDRESS;
|
|
15
15
|
const WEBAUTHN_VALIDATOR_ADDRESS = '0x0000000000578c4cB0e472a5462da43C495C3F33';
|
|
16
16
|
exports.WEBAUTHN_VALIDATOR_ADDRESS = WEBAUTHN_VALIDATOR_ADDRESS;
|
|
@@ -97,18 +97,15 @@ function getWebAuthnValidator(webAuthnCredential) {
|
|
|
97
97
|
// Distinguish between PublicKey and Hex / byte encoded public key
|
|
98
98
|
if (typeof webAuthnCredential.pubKey === 'string' ||
|
|
99
99
|
webAuthnCredential.pubKey instanceof Uint8Array) {
|
|
100
|
-
console.log('webAuthnCredential.pubKey in the if of webauthn validator');
|
|
101
100
|
// It's a P256Credential
|
|
102
101
|
const { x, y, prefix } = parsePublicKey(webAuthnCredential.pubKey);
|
|
103
102
|
pubKeyX = x;
|
|
104
103
|
pubKeyY = y;
|
|
105
104
|
if (prefix && prefix !== 4) {
|
|
106
|
-
console.log('prefix is not 4');
|
|
107
105
|
throw new Error('Only uncompressed public keys are supported');
|
|
108
106
|
}
|
|
109
107
|
}
|
|
110
108
|
else {
|
|
111
|
-
console.log('webAuthnCredential.pubKey in the else of webauthn validator');
|
|
112
109
|
// It's already a PublicKey
|
|
113
110
|
pubKeyX = webAuthnCredential.pubKey.x;
|
|
114
111
|
pubKeyY = webAuthnCredential.pubKey.y;
|
|
@@ -116,21 +113,29 @@ function getWebAuthnValidator(webAuthnCredential) {
|
|
|
116
113
|
return {
|
|
117
114
|
address: WEBAUTHN_VALIDATOR_ADDRESS,
|
|
118
115
|
initData: (0, viem_1.encodeAbiParameters)([
|
|
119
|
-
{ name: 'threshold', type: 'uint256' },
|
|
120
116
|
{
|
|
121
|
-
name: 'credentials',
|
|
122
|
-
type: 'tuple[]',
|
|
123
117
|
components: [
|
|
124
|
-
{
|
|
125
|
-
|
|
126
|
-
|
|
118
|
+
{
|
|
119
|
+
name: 'pubKeyX',
|
|
120
|
+
type: 'uint256',
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
name: 'pubKeyY',
|
|
124
|
+
type: 'uint256',
|
|
125
|
+
},
|
|
127
126
|
],
|
|
127
|
+
type: 'tuple',
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
type: 'bytes32',
|
|
131
|
+
name: 'authenticatorIdHash',
|
|
128
132
|
},
|
|
129
133
|
], [
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
+
{
|
|
135
|
+
pubKeyX,
|
|
136
|
+
pubKeyY,
|
|
137
|
+
},
|
|
138
|
+
(0, viem_1.keccak256)((0, viem_1.toHex)(webAuthnCredential.authenticatorId)),
|
|
134
139
|
]),
|
|
135
140
|
deInitData: '0x',
|
|
136
141
|
additionalContext: '0x',
|
|
@@ -14,7 +14,7 @@ const core_1 = require("./core");
|
|
|
14
14
|
});
|
|
15
15
|
(0, vitest_1.expect)(validator.type).toEqual(common_1.MODULE_TYPE_ID_VALIDATOR);
|
|
16
16
|
(0, vitest_1.expect)((0, viem_1.isAddress)(validator.address)).toEqual(true);
|
|
17
|
-
(0, vitest_1.expect)(validator.address).toEqual('
|
|
17
|
+
(0, vitest_1.expect)(validator.address).toEqual('0x20C008719Ba9D8aA14C7d07D122cd5E965aA8da5');
|
|
18
18
|
(0, vitest_1.expect)(validator.initData).toEqual('0x000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000001000000000000000000000000f6c02c78ded62973b43bfa523b247da099486936');
|
|
19
19
|
});
|
|
20
20
|
(0, vitest_1.test)('ECDSA: two addresses', () => {
|
|
@@ -24,7 +24,7 @@ const core_1 = require("./core");
|
|
|
24
24
|
});
|
|
25
25
|
(0, vitest_1.expect)(validator.type).toEqual(common_1.MODULE_TYPE_ID_VALIDATOR);
|
|
26
26
|
(0, vitest_1.expect)((0, viem_1.isAddress)(validator.address)).toEqual(true);
|
|
27
|
-
(0, vitest_1.expect)(validator.address).toEqual('
|
|
27
|
+
(0, vitest_1.expect)(validator.address).toEqual('0x20C008719Ba9D8aA14C7d07D122cd5E965aA8da5');
|
|
28
28
|
(0, vitest_1.expect)(validator.initData).toEqual('0x0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000020000000000000000000000006092086a3dc0020cd604a68fcf5d430007d51bb7000000000000000000000000f6c02c78ded62973b43bfa523b247da099486936');
|
|
29
29
|
});
|
|
30
30
|
(0, vitest_1.test)('ECDSA: three addresses, custom threshold', () => {
|
|
@@ -35,24 +35,18 @@ const core_1 = require("./core");
|
|
|
35
35
|
});
|
|
36
36
|
(0, vitest_1.expect)(validator.type).toEqual(common_1.MODULE_TYPE_ID_VALIDATOR);
|
|
37
37
|
(0, vitest_1.expect)((0, viem_1.isAddress)(validator.address)).toEqual(true);
|
|
38
|
-
(0, vitest_1.expect)(validator.address).toEqual('
|
|
38
|
+
(0, vitest_1.expect)(validator.address).toEqual('0x20C008719Ba9D8aA14C7d07D122cd5E965aA8da5');
|
|
39
39
|
(0, vitest_1.expect)(validator.initData).toEqual('0x0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000030000000000000000000000006092086a3dc0020cd604a68fcf5d430007d51bb7000000000000000000000000c27b7578151c5ef713c62c65db09763d57ac3596000000000000000000000000f6c02c78ded62973b43bfa523b247da099486936');
|
|
40
40
|
});
|
|
41
41
|
(0, vitest_1.test)('Passkey', () => {
|
|
42
42
|
const validator = (0, core_1.getValidator)({
|
|
43
43
|
type: 'passkey',
|
|
44
44
|
account: consts_1.passkeyAccount,
|
|
45
|
-
credentialIds: ['0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef'],
|
|
46
45
|
});
|
|
47
46
|
(0, vitest_1.expect)(validator.type).toEqual(common_1.MODULE_TYPE_ID_VALIDATOR);
|
|
48
47
|
(0, vitest_1.expect)((0, viem_1.isAddress)(validator.address)).toEqual(true);
|
|
49
48
|
(0, vitest_1.expect)(validator.address).toEqual('0x0000000000578c4cB0e472a5462da43C495C3F33');
|
|
50
|
-
(0, vitest_1.expect)(validator.initData).toEqual('
|
|
51
|
-
'0000000000000000000000000000000000000000000000000000000000000040' +
|
|
52
|
-
'0000000000000000000000000000000000000000000000000000000000000001' +
|
|
53
|
-
'580a9af0569ad3905b26a703201b358aa0904236642ebe79b22a19d00d373763' +
|
|
54
|
-
'7d46f725a5427ae45a9569259bf67e1e16b187d7b3ad1ed70138c4f0409677d1' +
|
|
55
|
-
'0000000000000000000000000000000000000000000000000000000000000000');
|
|
49
|
+
(0, vitest_1.expect)(validator.initData).toEqual('0x580a9af0569ad3905b26a703201b358aa0904236642ebe79b22a19d00d3737637d46f725a5427ae45a9569259bf67e1e16b187d7b3ad1ed70138c4f0409677d19c9a01073b202db2ed56e604ad11db557d8c3ad75181619597f21b830f2da82a');
|
|
56
50
|
});
|
|
57
51
|
});
|
|
58
52
|
(0, vitest_1.describe)('Mock Signature', () => {
|
|
@@ -74,7 +68,6 @@ const core_1 = require("./core");
|
|
|
74
68
|
const signature = (0, core_1.getMockSignature)({
|
|
75
69
|
type: 'passkey',
|
|
76
70
|
account: consts_1.passkeyAccount,
|
|
77
|
-
credentialIds: ['0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef'],
|
|
78
71
|
});
|
|
79
72
|
// Should have the proper schema
|
|
80
73
|
(0, viem_1.decodeAbiParameters)([
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { getMockSignature, getOwnerValidator } from './core';
|
|
2
2
|
import { encodeSmartSessionSignature, getEnableSessionCall, getPermissionId, getSmartSessionValidator, isSessionEnabled, SMART_SESSION_MODE_ENABLE, SMART_SESSION_MODE_USE, SMART_SESSIONS_VALIDATOR_ADDRESS } from './smart-sessions';
|
|
3
|
-
|
|
4
|
-
export { SMART_SESSION_MODE_USE, SMART_SESSION_MODE_ENABLE, SMART_SESSIONS_VALIDATOR_ADDRESS, getOwnerValidator, getSmartSessionValidator, getEnableSessionCall, encodeSmartSessionSignature, getPermissionId, getMockSignature, isSessionEnabled, addCredential, generateCredentialId, getCredentialIds, getCredentialInfo, getCredentials, getThreshold, hasCredential, hasCredentialById, removeCredential, setThreshold, WEBAUTHN_VALIDATOR_ABI, };
|
|
3
|
+
export { SMART_SESSION_MODE_USE, SMART_SESSION_MODE_ENABLE, SMART_SESSIONS_VALIDATOR_ADDRESS, getOwnerValidator, getSmartSessionValidator, getEnableSessionCall, encodeSmartSessionSignature, getPermissionId, getMockSignature, isSessionEnabled, };
|
|
5
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../modules/validators/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAA;AAC5D,OAAO,EACL,2BAA2B,EAC3B,oBAAoB,EACpB,eAAe,EACf,wBAAwB,EACxB,gBAAgB,EAChB,yBAAyB,EACzB,sBAAsB,EACtB,gCAAgC,EACjC,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../modules/validators/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAA;AAC5D,OAAO,EACL,2BAA2B,EAC3B,oBAAoB,EACpB,eAAe,EACf,wBAAwB,EACxB,gBAAgB,EAChB,yBAAyB,EACzB,sBAAsB,EACtB,gCAAgC,EACjC,MAAM,kBAAkB,CAAA;AAEzB,OAAO,EACL,sBAAsB,EACtB,yBAAyB,EACzB,gCAAgC,EAChC,iBAAiB,EACjB,wBAAwB,EACxB,oBAAoB,EACpB,2BAA2B,EAC3B,eAAe,EACf,gBAAgB,EAChB,gBAAgB,GACjB,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.isSessionEnabled = exports.getMockSignature = exports.getPermissionId = exports.encodeSmartSessionSignature = exports.getEnableSessionCall = exports.getSmartSessionValidator = exports.getOwnerValidator = exports.SMART_SESSIONS_VALIDATOR_ADDRESS = exports.SMART_SESSION_MODE_ENABLE = exports.SMART_SESSION_MODE_USE = void 0;
|
|
4
4
|
const core_1 = require("./core");
|
|
5
5
|
Object.defineProperty(exports, "getMockSignature", { enumerable: true, get: function () { return core_1.getMockSignature; } });
|
|
6
6
|
Object.defineProperty(exports, "getOwnerValidator", { enumerable: true, get: function () { return core_1.getOwnerValidator; } });
|
|
@@ -13,15 +13,3 @@ Object.defineProperty(exports, "isSessionEnabled", { enumerable: true, get: func
|
|
|
13
13
|
Object.defineProperty(exports, "SMART_SESSION_MODE_ENABLE", { enumerable: true, get: function () { return smart_sessions_1.SMART_SESSION_MODE_ENABLE; } });
|
|
14
14
|
Object.defineProperty(exports, "SMART_SESSION_MODE_USE", { enumerable: true, get: function () { return smart_sessions_1.SMART_SESSION_MODE_USE; } });
|
|
15
15
|
Object.defineProperty(exports, "SMART_SESSIONS_VALIDATOR_ADDRESS", { enumerable: true, get: function () { return smart_sessions_1.SMART_SESSIONS_VALIDATOR_ADDRESS; } });
|
|
16
|
-
const webauthn_contract_1 = require("./webauthn-contract");
|
|
17
|
-
Object.defineProperty(exports, "addCredential", { enumerable: true, get: function () { return webauthn_contract_1.addCredential; } });
|
|
18
|
-
Object.defineProperty(exports, "generateCredentialId", { enumerable: true, get: function () { return webauthn_contract_1.generateCredentialId; } });
|
|
19
|
-
Object.defineProperty(exports, "getCredentialIds", { enumerable: true, get: function () { return webauthn_contract_1.getCredentialIds; } });
|
|
20
|
-
Object.defineProperty(exports, "getCredentialInfo", { enumerable: true, get: function () { return webauthn_contract_1.getCredentialInfo; } });
|
|
21
|
-
Object.defineProperty(exports, "getCredentials", { enumerable: true, get: function () { return webauthn_contract_1.getCredentials; } });
|
|
22
|
-
Object.defineProperty(exports, "getThreshold", { enumerable: true, get: function () { return webauthn_contract_1.getThreshold; } });
|
|
23
|
-
Object.defineProperty(exports, "hasCredential", { enumerable: true, get: function () { return webauthn_contract_1.hasCredential; } });
|
|
24
|
-
Object.defineProperty(exports, "hasCredentialById", { enumerable: true, get: function () { return webauthn_contract_1.hasCredentialById; } });
|
|
25
|
-
Object.defineProperty(exports, "removeCredential", { enumerable: true, get: function () { return webauthn_contract_1.removeCredential; } });
|
|
26
|
-
Object.defineProperty(exports, "setThreshold", { enumerable: true, get: function () { return webauthn_contract_1.setThreshold; } });
|
|
27
|
-
Object.defineProperty(exports, "WEBAUTHN_VALIDATOR_ABI", { enumerable: true, get: function () { return webauthn_contract_1.WEBAUTHN_VALIDATOR_ABI; } });
|