@charterlabs/rhinestone-sdk 0.2.6 → 0.2.7-dev.2
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/index.d.ts +3 -2
- package/dist/src/accounts/index.d.ts.map +1 -1
- package/dist/src/accounts/index.js +41 -8
- 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.test.js +8 -8
- package/dist/src/accounts/nexus.d.ts +1 -2
- package/dist/src/accounts/nexus.d.ts.map +1 -1
- package/dist/src/accounts/nexus.js +43 -73
- package/dist/src/accounts/nexus.test.js +12 -12
- package/dist/src/accounts/safe.test.js +8 -8
- package/dist/src/accounts/signing/common.d.ts +10 -6
- package/dist/src/accounts/signing/common.d.ts.map +1 -1
- package/dist/src/accounts/signing/common.js +29 -9
- package/dist/src/accounts/signing/message.d.ts +2 -2
- package/dist/src/accounts/signing/message.d.ts.map +1 -1
- package/dist/src/accounts/signing/message.js +7 -9
- 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 +2 -2
- package/dist/src/accounts/signing/typedData.d.ts.map +1 -1
- package/dist/src/accounts/signing/typedData.js +7 -9
- package/dist/src/accounts/startale.d.ts.map +1 -1
- package/dist/src/accounts/startale.js +1 -1
- package/dist/src/accounts/startale.test.js +8 -8
- package/dist/src/accounts/utils.d.ts +3 -3
- package/dist/src/accounts/utils.d.ts.map +1 -1
- package/dist/src/accounts/utils.js +3 -40
- package/dist/src/actions/index.d.ts +45 -1
- package/dist/src/actions/index.d.ts.map +1 -1
- package/dist/src/actions/index.js +168 -6
- package/dist/src/actions/index.test.js +16 -16
- package/dist/src/execution/index.d.ts.map +1 -1
- package/dist/src/execution/index.js +3 -6
- package/dist/src/execution/utils.d.ts +1 -1
- package/dist/src/execution/utils.d.ts.map +1 -1
- package/dist/src/execution/utils.js +12 -14
- package/dist/src/index.d.ts +7 -6
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +14 -3
- package/dist/src/modules/index.d.ts +2 -17
- package/dist/src/modules/index.d.ts.map +1 -1
- package/dist/src/modules/index.js +4 -49
- package/dist/src/modules/index.test.js +2 -22
- package/dist/src/modules/omni-account.d.ts +2 -1
- package/dist/src/modules/omni-account.d.ts.map +1 -1
- package/dist/src/modules/omni-account.js +3 -1
- package/dist/src/modules/validators/core.d.ts +2 -3
- package/dist/src/modules/validators/core.d.ts.map +1 -1
- package/dist/src/modules/validators/core.js +45 -43
- package/dist/src/modules/validators/core.test.js +6 -6
- package/dist/src/modules/validators/smart-sessions.test.js +4 -4
- package/dist/src/modules/validators/webauthn-contract.d.ts.map +1 -1
- package/dist/src/orchestrator/client.d.ts +2 -2
- package/dist/src/orchestrator/client.d.ts.map +1 -1
- package/dist/src/orchestrator/consts.d.ts +2 -1
- package/dist/src/orchestrator/consts.d.ts.map +1 -1
- package/dist/src/orchestrator/consts.js +3 -1
- package/dist/src/orchestrator/index.d.ts +1 -1
- package/dist/src/orchestrator/index.d.ts.map +1 -1
- package/dist/src/orchestrator/registry.d.ts +1 -23
- package/dist/src/orchestrator/registry.d.ts.map +1 -1
- package/dist/src/orchestrator/registry.js +22 -24
- package/dist/src/orchestrator/registry.test.js +4 -4
- package/dist/src/orchestrator/types.d.ts +1 -6
- package/dist/src/orchestrator/types.d.ts.map +1 -1
- package/dist/src/types.d.ts +10 -4
- package/dist/src/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/src/orchestrator/registry.json +0 -365
|
@@ -110,7 +110,7 @@ async function waitForExecution(config, result, acceptsPreconfirmations) {
|
|
|
110
110
|
case 'intent': {
|
|
111
111
|
let intentStatus = null;
|
|
112
112
|
while (intentStatus === null || !validStatuses.has(intentStatus.status)) {
|
|
113
|
-
const orchestrator = (0, utils_2.getOrchestratorByChain)(result.targetChain, config.rhinestoneApiKey);
|
|
113
|
+
const orchestrator = (0, utils_2.getOrchestratorByChain)(result.targetChain, config.rhinestoneApiKey, config.useDev);
|
|
114
114
|
intentStatus = await orchestrator.getIntentOpStatus(result.id);
|
|
115
115
|
await new Promise((resolve) => setTimeout(resolve, POLLING_INTERVAL));
|
|
116
116
|
}
|
|
@@ -121,9 +121,6 @@ async function waitForExecution(config, result, acceptsPreconfirmations) {
|
|
|
121
121
|
}
|
|
122
122
|
case 'userop': {
|
|
123
123
|
const targetChain = (0, registry_1.getChainById)(result.chain);
|
|
124
|
-
if (!targetChain) {
|
|
125
|
-
throw new Error(`Unsupported chain ID: ${result.chain}`);
|
|
126
|
-
}
|
|
127
124
|
const publicClient = (0, viem_1.createPublicClient)({
|
|
128
125
|
chain: targetChain,
|
|
129
126
|
transport: (0, utils_1.createTransport)(targetChain, config.provider),
|
|
@@ -138,12 +135,12 @@ async function waitForExecution(config, result, acceptsPreconfirmations) {
|
|
|
138
135
|
}
|
|
139
136
|
async function getMaxSpendableAmount(config, chain, tokenAddress, gasUnits) {
|
|
140
137
|
const address = (0, accounts_1.getAddress)(config);
|
|
141
|
-
const orchestrator = (0, utils_2.getOrchestratorByChain)(chain.id, config.rhinestoneApiKey);
|
|
138
|
+
const orchestrator = (0, utils_2.getOrchestratorByChain)(chain.id, config.rhinestoneApiKey, config.useDev);
|
|
142
139
|
return orchestrator.getMaxTokenAmount(address, chain.id, tokenAddress, gasUnits);
|
|
143
140
|
}
|
|
144
141
|
async function getPortfolio(config, onTestnets) {
|
|
145
142
|
const address = (0, accounts_1.getAddress)(config);
|
|
146
143
|
const chainId = onTestnets ? chains_1.sepolia.id : chains_1.mainnet.id;
|
|
147
|
-
const orchestrator = (0, utils_2.getOrchestratorByChain)(chainId, config.rhinestoneApiKey);
|
|
144
|
+
const orchestrator = (0, utils_2.getOrchestratorByChain)(chainId, config.rhinestoneApiKey, config.useDev);
|
|
148
145
|
return orchestrator.getPortfolio(address);
|
|
149
146
|
}
|
|
@@ -37,7 +37,7 @@ declare function signAuthorizationsInternal(config: RhinestoneAccountConfig, dat
|
|
|
37
37
|
declare function submitTransaction(config: RhinestoneAccountConfig, signedTransaction: SignedTransactionData, authorizations: SignedAuthorizationList): Promise<TransactionResult>;
|
|
38
38
|
declare function prepareTransactionAsIntent(config: RhinestoneAccountConfig, sourceChains: Chain[] | undefined, targetChain: Chain, callInputs: CallInput[], gasLimit: bigint | undefined, tokenRequests: TokenRequest[], accountAddress: Address, isSponsored: boolean, eip7702InitSignature?: Hex): Promise<IntentData>;
|
|
39
39
|
declare function signIntent(config: RhinestoneAccountConfig, targetChain: Chain, intentOp: IntentOp, signers?: SignerSet): Promise<`0x${string}`>;
|
|
40
|
-
declare function getOrchestratorByChain(chainId: number, apiKey: string): import("../orchestrator").Orchestrator;
|
|
40
|
+
declare function getOrchestratorByChain(chainId: number, apiKey: string | undefined, useDev: boolean | undefined): import("../orchestrator").Orchestrator;
|
|
41
41
|
declare function submitIntentInternal(config: RhinestoneAccountConfig, sourceChains: Chain[] | undefined, targetChain: Chain, intentOp: IntentOp, signature: Hex, authorizations: SignedAuthorizationList): Promise<TransactionResult>;
|
|
42
42
|
declare function getValidatorAccount(config: RhinestoneAccountConfig, signers: SignerSet | undefined, publicClient: PublicClient, chain: Chain): Promise<import("viem/account-abstraction").SmartAccount<import("viem/account-abstraction").SmartAccountImplementation<import("viem").Abi, "0.7">> | null | undefined>;
|
|
43
43
|
declare function parseCalls(calls: CallInput[], chainId: number): Call[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../execution/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,KAAK,EAIV,KAAK,uBAAuB,EAC5B,KAAK,GAAG,EAER,KAAK,YAAY,EAEjB,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC5B,KAAK,SAAS,EAGf,MAAM,MAAM,CAAA;AACb,OAAO,EAGL,KAAK,aAAa,EACnB,MAAM,0BAA0B,CAAA;AAuBjC,OAAO,EAGL,KAAK,QAAQ,EACb,KAAK,WAAW,EAGjB,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../execution/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,KAAK,EAIV,KAAK,uBAAuB,EAC5B,KAAK,GAAG,EAER,KAAK,YAAY,EAEjB,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC5B,KAAK,SAAS,EAGf,MAAM,MAAM,CAAA;AACb,OAAO,EAGL,KAAK,aAAa,EACnB,MAAM,0BAA0B,CAAA;AAuBjC,OAAO,EAGL,KAAK,QAAQ,EACb,KAAK,WAAW,EAGjB,MAAM,iBAAiB,CAAA;AAWxB,OAAO,KAAK,EACV,IAAI,EACJ,SAAS,EACT,uBAAuB,EACvB,SAAS,EACT,YAAY,EACZ,WAAW,EACZ,MAAM,UAAU,CAAA;AAQjB,KAAK,iBAAiB,GA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GAAG,SAAS,EAC9B,YAAY,EAAE,YAAY,EAC1B,KAAK,EAAE,KAAK,yKA6Bb;AAmDD,iBAAS,UAAU,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,EAAE,CAM/D;AAmDD,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,kBAAkB,EAClB,0BAA0B,EAC1B,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,sBAAsB,EACtB,UAAU,EACV,0BAA0B,EAC1B,oBAAoB,EACpB,mBAAmB,EACnB,UAAU,GACX,CAAA;AACD,YAAY,EACV,UAAU,EACV,iBAAiB,EACjB,uBAAuB,EACvB,qBAAqB,GACtB,CAAA"}
|
|
@@ -111,9 +111,6 @@ async function signAuthorizationsInternal(config, data) {
|
|
|
111
111
|
for (const chainId in requiredDelegations) {
|
|
112
112
|
const delegation = requiredDelegations[chainId];
|
|
113
113
|
const chain = (0, registry_1.getChainById)(Number(chainId));
|
|
114
|
-
if (!chain) {
|
|
115
|
-
throw new Error(`Chain not supported: ${chainId}`);
|
|
116
|
-
}
|
|
117
114
|
const walletClient = (0, viem_1.createWalletClient)({
|
|
118
115
|
chain,
|
|
119
116
|
account: eoa,
|
|
@@ -238,7 +235,7 @@ async function prepareTransactionAsIntent(config, sourceChains, targetChain, cal
|
|
|
238
235
|
},
|
|
239
236
|
},
|
|
240
237
|
};
|
|
241
|
-
const orchestrator = getOrchestratorByChain(targetChain.id, config.rhinestoneApiKey);
|
|
238
|
+
const orchestrator = getOrchestratorByChain(targetChain.id, config.rhinestoneApiKey, config.useDev);
|
|
242
239
|
const intentRoute = await orchestrator.getIntentRoute(metaIntent);
|
|
243
240
|
return {
|
|
244
241
|
type: 'intent',
|
|
@@ -316,10 +313,12 @@ async function submitUserOp(config, chain, userOp, signature) {
|
|
|
316
313
|
async function submitIntent(config, sourceChains, targetChain, intentOp, signature, authorizations) {
|
|
317
314
|
return submitIntentInternal(config, sourceChains, targetChain, intentOp, signature, authorizations);
|
|
318
315
|
}
|
|
319
|
-
function getOrchestratorByChain(chainId, apiKey) {
|
|
320
|
-
const orchestratorUrl = (
|
|
321
|
-
? consts_1.
|
|
322
|
-
:
|
|
316
|
+
function getOrchestratorByChain(chainId, apiKey, useDev) {
|
|
317
|
+
const orchestratorUrl = (useDev ?? false)
|
|
318
|
+
? consts_1.DEV_ORCHESTRATOR_URL
|
|
319
|
+
: (0, registry_1.isTestnet)(chainId)
|
|
320
|
+
? consts_1.STAGING_ORCHESTRATOR_URL
|
|
321
|
+
: consts_1.PROD_ORCHESTRATOR_URL;
|
|
323
322
|
return (0, orchestrator_1.getOrchestrator)(apiKey, orchestratorUrl);
|
|
324
323
|
}
|
|
325
324
|
async function submitIntentInternal(config, sourceChains, targetChain, intentOp, signature, authorizations) {
|
|
@@ -338,7 +337,7 @@ async function submitIntentInternal(config, sourceChains, targetChain, intentOp,
|
|
|
338
337
|
}))
|
|
339
338
|
: undefined,
|
|
340
339
|
};
|
|
341
|
-
const orchestrator = getOrchestratorByChain(targetChain.id, config.rhinestoneApiKey);
|
|
340
|
+
const orchestrator = getOrchestratorByChain(targetChain.id, config.rhinestoneApiKey, config.useDev);
|
|
342
341
|
const intentResults = await orchestrator.submitIntent(signedIntentOp);
|
|
343
342
|
return {
|
|
344
343
|
type: 'intent',
|
|
@@ -380,11 +379,10 @@ function getValidator(config, signers) {
|
|
|
380
379
|
}
|
|
381
380
|
// Passkeys (WebAuthn)
|
|
382
381
|
if (withOwner.kind === 'passkey') {
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
});
|
|
382
|
+
return (0, core_1.getWebAuthnValidator)(1, withOwner.accounts.map((account) => ({
|
|
383
|
+
pubKey: account.publicKey,
|
|
384
|
+
authenticatorId: account.id,
|
|
385
|
+
})));
|
|
388
386
|
}
|
|
389
387
|
// Multi-factor
|
|
390
388
|
if (withOwner.kind === 'multi-factor') {
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import type { Address, Chain, HashTypedDataParameters, Hex, SignableMessage, SignedAuthorizationList, TypedData } from 'viem';
|
|
1
|
+
import type { Address, Chain, HashTypedDataParameters, Hex, SignableMessage, SignedAuthorizationList, TypedData, Account } from 'viem';
|
|
2
2
|
import type { UserOperationReceipt } from 'viem/account-abstraction';
|
|
3
|
-
import { AccountError, Eip7702AccountMustHaveEoaError, Eip7702NotSupportedForAccountError, ExistingEip7702AccountsNotSupportedError, FactoryArgsNotAvailableError, isAccountError, SigningNotSupportedForAccountError, SignMessageNotSupportedByAccountError, SmartSessionsNotEnabledError } from './accounts';
|
|
4
|
-
import { addOwner, changeMultiFactorThreshold, changeThreshold, disableEcdsa, disableMultiFactor, disablePasskeys, enableEcdsa, enableMultiFactor, enablePasskeys, encodeSmartSessionSignature, recover, removeOwner, removeSubValidator, setSubValidator, setUpRecovery } from './actions';
|
|
3
|
+
import { AccountError, deployStandaloneWithEoa as deployStandaloneWithEoaInternal, Eip7702AccountMustHaveEoaError, Eip7702NotSupportedForAccountError, ExistingEip7702AccountsNotSupportedError, FactoryArgsNotAvailableError, isAccountError, SigningNotSupportedForAccountError, SignMessageNotSupportedByAccountError, SmartSessionsNotEnabledError } from './accounts';
|
|
4
|
+
import { addOwner, addPasskeyOwner, changeMultiFactorThreshold, changePasskeyThreshold, changeThreshold, disableEcdsa, disableMultiFactor, disablePasskeys, enableEcdsa, enableMultiFactor, enablePasskeys, encodeSmartSessionSignature, recover, recoverEcdsaOwnership, recoverPasskeyOwnership, removeOwner, removePasskeyOwner, removeSubValidator, setSubValidator, setUpRecovery } from './actions';
|
|
5
5
|
import type { TransactionResult } from './execution';
|
|
6
6
|
import { ExecutionError, IntentFailedError, isExecutionError, OrderPathRequiredForIntentsError, SessionChainRequiredError, SourceChainsNotAvailableForUserOpFlowError, UserOperationRequiredForSmartSessionsError } from './execution';
|
|
7
7
|
import { type SessionDetails } from './execution/smart-session';
|
|
8
8
|
import { type IntentData, type PreparedTransactionData, type SignedTransactionData } from './execution/utils';
|
|
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';
|
|
9
|
+
import { AuthenticationRequiredError, getSupportedTokens, getTokenAddress, 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
10
|
import type { Call, RhinestoneAccountConfig, Session, SignerSet, Transaction } from './types';
|
|
11
11
|
interface RhinestoneAccount {
|
|
12
12
|
config: RhinestoneAccountConfig;
|
|
13
13
|
deploy: (chain: Chain, session?: Session) => Promise<void>;
|
|
14
|
+
deployStandaloneWithEoa: (chain: Chain, config: RhinestoneAccountConfig, deployer: Account) => Promise<void>;
|
|
14
15
|
signEip7702InitData: () => Promise<Hex>;
|
|
15
16
|
prepareTransaction: (transaction: Transaction) => Promise<PreparedTransactionData>;
|
|
16
17
|
signTransaction: (preparedTransaction: PreparedTransactionData) => Promise<SignedTransactionData>;
|
|
@@ -37,8 +38,8 @@ interface RhinestoneAccount {
|
|
|
37
38
|
* @returns account
|
|
38
39
|
*/
|
|
39
40
|
declare function createRhinestoneAccount(config: RhinestoneAccountConfig): Promise<RhinestoneAccount>;
|
|
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
|
+
export { createRhinestoneAccount, deployStandaloneWithEoaInternal as deployStandaloneWithEoa, addOwner, addPasskeyOwner, changeMultiFactorThreshold, changeThreshold, changePasskeyThreshold, disableEcdsa, disableMultiFactor, disablePasskeys, enableEcdsa, enableMultiFactor, enablePasskeys, encodeSmartSessionSignature, recover, recoverEcdsaOwnership, recoverPasskeyOwnership, removeOwner, removePasskeyOwner, 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, getSupportedTokens, getTokenAddress, };
|
|
41
42
|
export type { RhinestoneAccount, Session, Call, IntentData, PreparedTransactionData, SignedTransactionData, TransactionResult, IntentCost, IntentInput, IntentOp, IntentOpStatus, IntentResult, IntentRoute, SettlementSystem, SignedIntentOp, Portfolio, };
|
|
42
43
|
export { generateCredentialId, getCredentialIds, hasCredentialById, hasCredential, addCredential, removeCredential, setThreshold, getCredentialInfo, getThreshold, getCredentials, WEBAUTHN_VALIDATOR_ABI, } from './modules/validators/webauthn-contract';
|
|
43
|
-
export { getOrchestrator
|
|
44
|
+
export { getOrchestrator } from './orchestrator';
|
|
44
45
|
//# 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,EACV,OAAO,EACP,KAAK,EACL,uBAAuB,EACvB,GAAG,EACH,eAAe,EACf,uBAAuB,EACvB,SAAS,
|
|
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,EACT,OAAO,EACR,MAAM,MAAM,CAAA;AACb,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAA;AACpE,OAAO,EACL,YAAY,EACZ,uBAAuB,IAAI,+BAA+B,EAE1D,8BAA8B,EAC9B,kCAAkC,EAClC,wCAAwC,EACxC,4BAA4B,EAE5B,cAAc,EACd,kCAAkC,EAClC,qCAAqC,EACrC,4BAA4B,EAE7B,MAAM,YAAY,CAAA;AACnB,OAAO,EACL,QAAQ,EACR,eAAe,EACf,0BAA0B,EAC1B,sBAAsB,EACtB,eAAe,EACf,YAAY,E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1C,0CAA0C,EAC1C,gCAAgC,EAChC,yBAAyB,EAEzB,mBAAmB,EACnB,2BAA2B,EAC3B,wBAAwB,EACxB,kBAAkB,EAClB,2BAA2B,EAC3B,gBAAgB,EAChB,uCAAuC,EACvC,iBAAiB,EACjB,mBAAmB,EACnB,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,EAErB,kBAAkB,EAClB,eAAe,GAChB,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;AAG/C,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA"}
|
package/dist/src/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.
|
|
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.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 = exports.deployStandaloneWithEoa = void 0;
|
|
4
|
+
exports.getOrchestrator = exports.WEBAUTHN_VALIDATOR_ABI = exports.getCredentials = exports.getThreshold = exports.getCredentialInfo = exports.setThreshold = exports.removeCredential = exports.addCredential = exports.hasCredential = exports.hasCredentialById = exports.getCredentialIds = exports.generateCredentialId = exports.getTokenAddress = exports.getSupportedTokens = void 0;
|
|
5
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; } });
|
|
8
9
|
Object.defineProperty(exports, "Eip7702AccountMustHaveEoaError", { enumerable: true, get: function () { return accounts_1.Eip7702AccountMustHaveEoaError; } });
|
|
9
10
|
Object.defineProperty(exports, "Eip7702NotSupportedForAccountError", { enumerable: true, get: function () { return accounts_1.Eip7702NotSupportedForAccountError; } });
|
|
10
11
|
Object.defineProperty(exports, "ExistingEip7702AccountsNotSupportedError", { enumerable: true, get: function () { return accounts_1.ExistingEip7702AccountsNotSupportedError; } });
|
|
@@ -15,7 +16,9 @@ Object.defineProperty(exports, "SignMessageNotSupportedByAccountError", { enumer
|
|
|
15
16
|
Object.defineProperty(exports, "SmartSessionsNotEnabledError", { enumerable: true, get: function () { return accounts_1.SmartSessionsNotEnabledError; } });
|
|
16
17
|
const actions_1 = require("./actions");
|
|
17
18
|
Object.defineProperty(exports, "addOwner", { enumerable: true, get: function () { return actions_1.addOwner; } });
|
|
19
|
+
Object.defineProperty(exports, "addPasskeyOwner", { enumerable: true, get: function () { return actions_1.addPasskeyOwner; } });
|
|
18
20
|
Object.defineProperty(exports, "changeMultiFactorThreshold", { enumerable: true, get: function () { return actions_1.changeMultiFactorThreshold; } });
|
|
21
|
+
Object.defineProperty(exports, "changePasskeyThreshold", { enumerable: true, get: function () { return actions_1.changePasskeyThreshold; } });
|
|
19
22
|
Object.defineProperty(exports, "changeThreshold", { enumerable: true, get: function () { return actions_1.changeThreshold; } });
|
|
20
23
|
Object.defineProperty(exports, "disableEcdsa", { enumerable: true, get: function () { return actions_1.disableEcdsa; } });
|
|
21
24
|
Object.defineProperty(exports, "disableMultiFactor", { enumerable: true, get: function () { return actions_1.disableMultiFactor; } });
|
|
@@ -25,7 +28,10 @@ Object.defineProperty(exports, "enableMultiFactor", { enumerable: true, get: fun
|
|
|
25
28
|
Object.defineProperty(exports, "enablePasskeys", { enumerable: true, get: function () { return actions_1.enablePasskeys; } });
|
|
26
29
|
Object.defineProperty(exports, "encodeSmartSessionSignature", { enumerable: true, get: function () { return actions_1.encodeSmartSessionSignature; } });
|
|
27
30
|
Object.defineProperty(exports, "recover", { enumerable: true, get: function () { return actions_1.recover; } });
|
|
31
|
+
Object.defineProperty(exports, "recoverEcdsaOwnership", { enumerable: true, get: function () { return actions_1.recoverEcdsaOwnership; } });
|
|
32
|
+
Object.defineProperty(exports, "recoverPasskeyOwnership", { enumerable: true, get: function () { return actions_1.recoverPasskeyOwnership; } });
|
|
28
33
|
Object.defineProperty(exports, "removeOwner", { enumerable: true, get: function () { return actions_1.removeOwner; } });
|
|
34
|
+
Object.defineProperty(exports, "removePasskeyOwner", { enumerable: true, get: function () { return actions_1.removePasskeyOwner; } });
|
|
29
35
|
Object.defineProperty(exports, "removeSubValidator", { enumerable: true, get: function () { return actions_1.removeSubValidator; } });
|
|
30
36
|
Object.defineProperty(exports, "setSubValidator", { enumerable: true, get: function () { return actions_1.setSubValidator; } });
|
|
31
37
|
Object.defineProperty(exports, "setUpRecovery", { enumerable: true, get: function () { return actions_1.setUpRecovery; } });
|
|
@@ -42,6 +48,8 @@ const utils_1 = require("./execution/utils");
|
|
|
42
48
|
const modules_1 = require("./modules");
|
|
43
49
|
const orchestrator_1 = require("./orchestrator");
|
|
44
50
|
Object.defineProperty(exports, "AuthenticationRequiredError", { enumerable: true, get: function () { return orchestrator_1.AuthenticationRequiredError; } });
|
|
51
|
+
Object.defineProperty(exports, "getSupportedTokens", { enumerable: true, get: function () { return orchestrator_1.getSupportedTokens; } });
|
|
52
|
+
Object.defineProperty(exports, "getTokenAddress", { enumerable: true, get: function () { return orchestrator_1.getTokenAddress; } });
|
|
45
53
|
Object.defineProperty(exports, "InsufficientBalanceError", { enumerable: true, get: function () { return orchestrator_1.InsufficientBalanceError; } });
|
|
46
54
|
Object.defineProperty(exports, "IntentNotFoundError", { enumerable: true, get: function () { return orchestrator_1.IntentNotFoundError; } });
|
|
47
55
|
Object.defineProperty(exports, "InvalidApiKeyError", { enumerable: true, get: function () { return orchestrator_1.InvalidApiKeyError; } });
|
|
@@ -69,6 +77,9 @@ async function createRhinestoneAccount(config) {
|
|
|
69
77
|
function deploy(chain, session) {
|
|
70
78
|
return (0, accounts_1.deploy)(config, chain, session);
|
|
71
79
|
}
|
|
80
|
+
function deployStandaloneWithEoa(chain, config, deployer) {
|
|
81
|
+
return (0, accounts_1.deployStandaloneWithEoa)(chain, config, deployer);
|
|
82
|
+
}
|
|
72
83
|
/**
|
|
73
84
|
* Prepare and sign the EIP-7702 account initialization data
|
|
74
85
|
* @returns init data signature
|
|
@@ -200,6 +211,7 @@ async function createRhinestoneAccount(config) {
|
|
|
200
211
|
return {
|
|
201
212
|
config,
|
|
202
213
|
deploy,
|
|
214
|
+
deployStandaloneWithEoa,
|
|
203
215
|
signEip7702InitData,
|
|
204
216
|
prepareTransaction,
|
|
205
217
|
signTransaction,
|
|
@@ -233,4 +245,3 @@ Object.defineProperty(exports, "WEBAUTHN_VALIDATOR_ABI", { enumerable: true, get
|
|
|
233
245
|
// Orchestrator helpers
|
|
234
246
|
var orchestrator_2 = require("./orchestrator");
|
|
235
247
|
Object.defineProperty(exports, "getOrchestrator", { enumerable: true, get: function () { return orchestrator_2.getOrchestrator; } });
|
|
236
|
-
Object.defineProperty(exports, "getTokenAddress", { enumerable: true, get: function () { return orchestrator_2.getTokenAddress; } });
|
|
@@ -1,23 +1,9 @@
|
|
|
1
|
-
import { type Chain
|
|
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
5
|
import { getOwners, getValidators } from './read';
|
|
6
6
|
import { getOwnerValidator } from './validators';
|
|
7
|
-
interface WebAuthnData {
|
|
8
|
-
authenticatorData: Hex;
|
|
9
|
-
clientDataJSON: string;
|
|
10
|
-
challengeIndex: number | bigint;
|
|
11
|
-
typeIndex: number | bigint;
|
|
12
|
-
}
|
|
13
|
-
interface WebauthnValidatorSignature {
|
|
14
|
-
webauthn: WebAuthnData;
|
|
15
|
-
signature: WebauthnSignature | Hex | Uint8Array;
|
|
16
|
-
}
|
|
17
|
-
interface WebauthnSignature {
|
|
18
|
-
r: bigint;
|
|
19
|
-
s: bigint;
|
|
20
|
-
}
|
|
21
7
|
interface ModeleSetup {
|
|
22
8
|
validators: Module[];
|
|
23
9
|
executors: Module[];
|
|
@@ -25,7 +11,6 @@ interface ModeleSetup {
|
|
|
25
11
|
hooks: Module[];
|
|
26
12
|
}
|
|
27
13
|
declare function getSetup(config: RhinestoneAccountConfig): ModeleSetup;
|
|
28
|
-
declare function getWebauthnValidatorSignature({ webauthn, signature, }: WebauthnValidatorSignature): `0x${string}`;
|
|
29
14
|
declare function isRip7212SupportedNetwork(chain: Chain): boolean;
|
|
30
|
-
export { HOOK_ADDRESS, getSetup, getOwnerValidator,
|
|
15
|
+
export { HOOK_ADDRESS, getSetup, getOwnerValidator, getOwners, getValidators, isRip7212SupportedNetwork, };
|
|
31
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"}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getValidators = exports.getOwners = exports.getOwnerValidator = exports.HOOK_ADDRESS = void 0;
|
|
4
4
|
exports.getSetup = getSetup;
|
|
5
|
-
exports.getWebauthnValidatorSignature = getWebauthnValidatorSignature;
|
|
6
5
|
exports.isRip7212SupportedNetwork = isRip7212SupportedNetwork;
|
|
7
6
|
const viem_1 = require("viem");
|
|
8
7
|
const chains_1 = require("viem/chains");
|
|
@@ -27,9 +26,12 @@ function getSetup(config) {
|
|
|
27
26
|
const socialRecoveryValidator = (0, core_1.getSocialRecoveryValidator)(config.recovery.guardians, config.recovery.threshold);
|
|
28
27
|
validators.push(socialRecoveryValidator);
|
|
29
28
|
}
|
|
29
|
+
const intentExecutorAddress = config.useDev
|
|
30
|
+
? omni_account_1.INTENT_EXECUTOR_ADDRESS_DEV
|
|
31
|
+
: omni_account_1.INTENT_EXECUTOR_ADDRESS;
|
|
30
32
|
const executors = [
|
|
31
33
|
{
|
|
32
|
-
address:
|
|
34
|
+
address: intentExecutorAddress,
|
|
33
35
|
initData: '0x',
|
|
34
36
|
deInitData: '0x',
|
|
35
37
|
additionalContext: '0x',
|
|
@@ -61,44 +63,6 @@ function getSetup(config) {
|
|
|
61
63
|
hooks,
|
|
62
64
|
};
|
|
63
65
|
}
|
|
64
|
-
function getWebauthnValidatorSignature({ webauthn, signature, }) {
|
|
65
|
-
const { authenticatorData, clientDataJSON, challengeIndex, typeIndex } = webauthn;
|
|
66
|
-
let r;
|
|
67
|
-
let s;
|
|
68
|
-
if (typeof signature === 'string' || signature instanceof Uint8Array) {
|
|
69
|
-
const parsedSignature = parseSignature(signature);
|
|
70
|
-
r = parsedSignature.r;
|
|
71
|
-
s = parsedSignature.s;
|
|
72
|
-
}
|
|
73
|
-
else {
|
|
74
|
-
r = signature.r;
|
|
75
|
-
s = signature.s;
|
|
76
|
-
}
|
|
77
|
-
// Return abi-encoded WebAuthnAuth struct (not the full validator payload)
|
|
78
|
-
return (0, viem_1.encodeAbiParameters)([
|
|
79
|
-
{
|
|
80
|
-
components: [
|
|
81
|
-
{ type: 'bytes', name: 'authenticatorData' },
|
|
82
|
-
{ type: 'string', name: 'clientDataJSON' },
|
|
83
|
-
{ type: 'uint256', name: 'challengeIndex' },
|
|
84
|
-
{ type: 'uint256', name: 'typeIndex' },
|
|
85
|
-
{ type: 'uint256', name: 'r' },
|
|
86
|
-
{ type: 'uint256', name: 's' },
|
|
87
|
-
],
|
|
88
|
-
type: 'tuple',
|
|
89
|
-
name: 'auth',
|
|
90
|
-
},
|
|
91
|
-
], [
|
|
92
|
-
{
|
|
93
|
-
authenticatorData,
|
|
94
|
-
clientDataJSON,
|
|
95
|
-
challengeIndex: typeof challengeIndex === 'bigint' ? challengeIndex : BigInt(challengeIndex),
|
|
96
|
-
typeIndex: typeof typeIndex === 'bigint' ? typeIndex : BigInt(typeIndex),
|
|
97
|
-
r,
|
|
98
|
-
s,
|
|
99
|
-
},
|
|
100
|
-
]);
|
|
101
|
-
}
|
|
102
66
|
function isRip7212SupportedNetwork(chain) {
|
|
103
67
|
const supportedChains = [
|
|
104
68
|
chains_1.optimism,
|
|
@@ -111,12 +75,3 @@ function isRip7212SupportedNetwork(chain) {
|
|
|
111
75
|
];
|
|
112
76
|
return supportedChains.includes(chain);
|
|
113
77
|
}
|
|
114
|
-
function parseSignature(signature) {
|
|
115
|
-
const bytes = typeof signature === 'string' ? (0, viem_1.hexToBytes)(signature) : signature;
|
|
116
|
-
const r = bytes.slice(0, 32);
|
|
117
|
-
const s = bytes.slice(32, 64);
|
|
118
|
-
return {
|
|
119
|
-
r: BigInt((0, viem_1.bytesToHex)(r)),
|
|
120
|
-
s: BigInt((0, viem_1.bytesToHex)(s)),
|
|
121
|
-
};
|
|
122
|
-
}
|
|
@@ -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,7 +23,7 @@ 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);
|
|
@@ -87,24 +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
|
-
// describe('WebAuthn Validator Signature', () => {
|
|
91
|
-
// test('default', () => {
|
|
92
|
-
// const signature = getWebauthnValidatorSignature({
|
|
93
|
-
// webauthn: {
|
|
94
|
-
// authenticatorData:
|
|
95
|
-
// '0x49960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d97631d00000000',
|
|
96
|
-
// clientDataJSON:
|
|
97
|
-
// '{"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
|
-
// typeIndex:
|
|
99
|
-
// 44941127272049826721201904734628716258498742255959991581049806490182030242267n,
|
|
100
|
-
// },
|
|
101
|
-
// signature:
|
|
102
|
-
// '0x00000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000001635bc6d0f68ff895cae8a288ecf7542a6a9cd555df784b73e1e2ea7e9104b1db15e9015d280cb19527881c625fee43fd3a405d5b0d199a8c8e6589a7381209e40000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002549960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d97631d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f47b2274797065223a22776562617574686e2e676574222c226368616c6c656e6765223a22746278584e465339585f3442797231634d77714b724947422d5f3330613051685a36793775634d30424f45222c226f726967696e223a22687474703a2f2f6c6f63616c686f73743a33303030222c2263726f73734f726967696e223a66616c73652c20226f746865725f6b6579735f63616e5f62655f61646465645f68657265223a22646f206e6f7420636f6d7061726520636c69656e74446174614a534f4e20616761696e737420612074656d706c6174652e205365652068747470733a2f2f676f6f2e676c2f796162506578227d000000000000000000000000',
|
|
103
|
-
// usePrecompiled: true,
|
|
104
|
-
// })
|
|
105
|
-
// expect(signature).toEqual(
|
|
106
|
-
// '0x00000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000120635bc6d0f68ff895cae8a288ecf7542a6a9cd555df784b73e1e2ea7e9104b1db00000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002549960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d97631d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f47b2274797065223a22776562617574686e2e676574222c226368616c6c656e6765223a22746278584e465339585f3442797231634d77714b724947422d5f3330613051685a36793775634d30424f45222c226f726967696e223a22687474703a2f2f6c6f63616c686f73743a33303030222c2263726f73734f726967696e223a66616c73652c20226f746865725f6b6579735f63616e5f62655f61646465645f68657265223a22646f206e6f7420636f6d7061726520636c69656e74446174614a534f4e20616761696e737420612074656d706c6174652e205365652068747470733a2f2f676f6f2e676c2f796162506578227d000000000000000000000000',
|
|
107
|
-
// )
|
|
108
|
-
// })
|
|
109
|
-
// })
|
|
110
90
|
});
|
|
@@ -3,5 +3,6 @@ declare const HOOK_ADDRESS: Address;
|
|
|
3
3
|
declare const TARGET_MODULE_ADDRESS: Address;
|
|
4
4
|
declare const SAME_CHAIN_MODULE_ADDRESS: Address;
|
|
5
5
|
declare const INTENT_EXECUTOR_ADDRESS: Address;
|
|
6
|
-
|
|
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, };
|
|
7
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,YAAY,EAAE,OAAsD,CAAA;AAC1E,QAAA,MAAM,qBAAqB,EAAE,OACiB,CAAA;AAC9C,QAAA,MAAM,yBAAyB,EAAE,OACa,CAAA;AAE9C,QAAA,MAAM,uBAAuB,EAAE,OACe,CAAA;AAE9C,OAAO,EACL,YAAY,EACZ,qBAAqB,EACrB,yBAAyB,EACzB,uBAAuB,
|
|
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,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.INTENT_EXECUTOR_ADDRESS = exports.SAME_CHAIN_MODULE_ADDRESS = exports.TARGET_MODULE_ADDRESS = exports.HOOK_ADDRESS = void 0;
|
|
3
|
+
exports.INTENT_EXECUTOR_ADDRESS_DEV = exports.INTENT_EXECUTOR_ADDRESS = exports.SAME_CHAIN_MODULE_ADDRESS = exports.TARGET_MODULE_ADDRESS = exports.HOOK_ADDRESS = void 0;
|
|
4
4
|
const HOOK_ADDRESS = '0x0000000000f6Ed8Be424d673c63eeFF8b9267420';
|
|
5
5
|
exports.HOOK_ADDRESS = HOOK_ADDRESS;
|
|
6
6
|
const TARGET_MODULE_ADDRESS = '0x0000000000E5a37279A001301A837a91b5de1D5E';
|
|
@@ -9,3 +9,5 @@ const SAME_CHAIN_MODULE_ADDRESS = '0x000000000043ff16d5776c7F0f65Ec485C17Ca04';
|
|
|
9
9
|
exports.SAME_CHAIN_MODULE_ADDRESS = SAME_CHAIN_MODULE_ADDRESS;
|
|
10
10
|
const INTENT_EXECUTOR_ADDRESS = '0x00000000005aD9ce1f5035FD62CA96CEf16AdAAF';
|
|
11
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;
|
|
@@ -17,10 +17,9 @@ declare function getOwnerValidator(config: RhinestoneAccountConfig): Module;
|
|
|
17
17
|
declare function getMockSignature(ownerSet: OwnerSet): Hex;
|
|
18
18
|
declare function getValidator(owners: OwnerSet): Module;
|
|
19
19
|
declare function getOwnableValidator(threshold: number, owners: Address[]): Module;
|
|
20
|
-
declare function getWebAuthnValidator(
|
|
20
|
+
declare function getWebAuthnValidator(threshold: number, webAuthnCredentials: WebauthnCredential[]): Module;
|
|
21
21
|
declare function getMultiFactorValidator(threshold: number, validators: (OwnableValidatorConfig | WebauthnValidatorConfig | null)[]): Module;
|
|
22
22
|
declare function getSocialRecoveryValidator(guardians: Account[], threshold?: number): Module;
|
|
23
|
-
|
|
24
|
-
export { OWNABLE_VALIDATOR_ADDRESS, WEBAUTHN_VALIDATOR_ADDRESS, MULTI_FACTOR_VALIDATOR_ADDRESS, getOwnerValidator, getOwnableValidator, getWebAuthnValidator, getMultiFactorValidator, getSocialRecoveryValidator, getValidator, getMockSignature, parsePublicKey, };
|
|
23
|
+
export { OWNABLE_VALIDATOR_ADDRESS, WEBAUTHN_VALIDATOR_ADDRESS, MULTI_FACTOR_VALIDATOR_ADDRESS, getOwnerValidator, getOwnableValidator, getWebAuthnValidator, getMultiFactorValidator, getSocialRecoveryValidator, getValidator, getMockSignature, };
|
|
25
24
|
export type { WebauthnCredential };
|
|
26
25
|
//# sourceMappingURL=core.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../modules/validators/core.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,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,MAA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M,EAAE,QAAQ,UAmBrC;AAED,iBAAS,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,CAiBzE;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,iBAAiB,EACjB,mBAAmB,EACnB,oBAAoB,EACpB,uBAAuB,EACvB,0BAA0B,EAC1B,YAAY,EACZ,gBAAgB,GACjB,CAAA;AACD,YAAY,EAAE,kBAAkB,EAAE,CAAA"}
|
|
@@ -8,10 +8,9 @@ exports.getMultiFactorValidator = getMultiFactorValidator;
|
|
|
8
8
|
exports.getSocialRecoveryValidator = getSocialRecoveryValidator;
|
|
9
9
|
exports.getValidator = getValidator;
|
|
10
10
|
exports.getMockSignature = getMockSignature;
|
|
11
|
-
exports.parsePublicKey = parsePublicKey;
|
|
12
11
|
const viem_1 = require("viem");
|
|
13
12
|
const common_1 = require("../common");
|
|
14
|
-
const OWNABLE_VALIDATOR_ADDRESS = '
|
|
13
|
+
const OWNABLE_VALIDATOR_ADDRESS = '0x000000000013fdB5234E4E3162a810F54d9f7E98';
|
|
15
14
|
exports.OWNABLE_VALIDATOR_ADDRESS = OWNABLE_VALIDATOR_ADDRESS;
|
|
16
15
|
const WEBAUTHN_VALIDATOR_ADDRESS = '0x0000000000578c4cB0e472a5462da43C495C3F33';
|
|
17
16
|
exports.WEBAUTHN_VALIDATOR_ADDRESS = WEBAUTHN_VALIDATOR_ADDRESS;
|
|
@@ -19,7 +18,7 @@ const SOCIAL_RECOVERY_VALIDATOR_ADDRESS = '0xA04D053b3C8021e8D5bF641816c42dAA75D
|
|
|
19
18
|
const MULTI_FACTOR_VALIDATOR_ADDRESS = '0xf6bDf42c9BE18cEcA5C06c42A43DAf7FBbe7896b';
|
|
20
19
|
exports.MULTI_FACTOR_VALIDATOR_ADDRESS = MULTI_FACTOR_VALIDATOR_ADDRESS;
|
|
21
20
|
const ECDSA_MOCK_SIGNATURE = '0x81d4b4981670cb18f99f0b4a66446df1bf5b204d24cfcb659bf38ba27a4359b5711649ec2423c5e1247245eba2964679b6a1dbb85c992ae40b9b00c6935b02ff1b';
|
|
22
|
-
const WEBAUTHN_MOCK_SIGNATURE = '
|
|
21
|
+
const WEBAUTHN_MOCK_SIGNATURE = '0x0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001b9b86eb98fda3ed4d797d9e690588dfadf17b329a76a47cec935bebf92d7ddc80000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000001700000000000000000000000000000000000000000000000000000000000000019b2e9410bb6850f9f660a03d609d5a844fb96bcdc87a15139b03ee22c70f469100d2b865a215c3bf786387064effa8fcedcb1d625b5148f8a1236d5e3ff11acf000000000000000000000000000000000000000000000000000000000000002549960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d9763050000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000867b2274797065223a22776562617574686e2e676574222c226368616c6c656e6765223a22396a4546696a75684557724d34534f572d7443684a625545484550343456636a634a2d42716f3166544d38222c226f726967696e223a22687474703a2f2f6c6f63616c686f73743a38303830222c2263726f73734f726967696e223a66616c73657d0000000000000000000000000000000000000000000000000000';
|
|
23
22
|
function getOwnerValidator(config) {
|
|
24
23
|
return getValidator(config.owners);
|
|
25
24
|
}
|
|
@@ -68,10 +67,10 @@ function getValidator(owners) {
|
|
|
68
67
|
case 'ecdsa':
|
|
69
68
|
return getOwnableValidator(owners.threshold ?? 1, owners.accounts.map((account) => account.address));
|
|
70
69
|
case 'passkey':
|
|
71
|
-
return getWebAuthnValidator({
|
|
72
|
-
pubKey:
|
|
73
|
-
authenticatorId:
|
|
74
|
-
});
|
|
70
|
+
return getWebAuthnValidator(owners.threshold ?? 1, owners.accounts.map((account) => ({
|
|
71
|
+
pubKey: account.publicKey,
|
|
72
|
+
authenticatorId: account.id,
|
|
73
|
+
})));
|
|
75
74
|
case 'multi-factor': {
|
|
76
75
|
return getMultiFactorValidator(owners.threshold ?? 1, owners.validators);
|
|
77
76
|
}
|
|
@@ -92,52 +91,55 @@ function getOwnableValidator(threshold, owners) {
|
|
|
92
91
|
type: common_1.MODULE_TYPE_ID_VALIDATOR,
|
|
93
92
|
};
|
|
94
93
|
}
|
|
95
|
-
function getWebAuthnValidator(
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
94
|
+
function getWebAuthnValidator(threshold, webAuthnCredentials) {
|
|
95
|
+
function getPublicKey(webAuthnCredential) {
|
|
96
|
+
if (typeof webAuthnCredential.pubKey === 'string' ||
|
|
97
|
+
webAuthnCredential.pubKey instanceof Uint8Array) {
|
|
98
|
+
// It's a P256Credential
|
|
99
|
+
const { x, y, prefix } = parsePublicKey(webAuthnCredential.pubKey);
|
|
100
|
+
if (prefix && prefix !== 4) {
|
|
101
|
+
throw new Error('Only uncompressed public keys are supported');
|
|
102
|
+
}
|
|
103
|
+
return {
|
|
104
|
+
x,
|
|
105
|
+
y,
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
// It's already a PublicKey
|
|
110
|
+
return webAuthnCredential.pubKey;
|
|
107
111
|
}
|
|
108
112
|
}
|
|
109
|
-
|
|
110
|
-
// It's already a PublicKey
|
|
111
|
-
pubKeyX = webAuthnCredential.pubKey.x;
|
|
112
|
-
pubKeyY = webAuthnCredential.pubKey.y;
|
|
113
|
-
}
|
|
114
|
-
// Encode per WebAuthnValidator.onInstall:
|
|
115
|
-
// abi.decode(data, (uint256 threshold, WebAuthnCredential[] credentials))
|
|
116
|
-
// struct WebAuthnCredential { uint256 pubKeyX; uint256 pubKeyY; bool requireUV; }
|
|
117
|
-
const threshold = 1n;
|
|
118
|
-
const requireUV = true;
|
|
113
|
+
const publicKeys = webAuthnCredentials.map(getPublicKey);
|
|
119
114
|
return {
|
|
120
115
|
address: WEBAUTHN_VALIDATOR_ADDRESS,
|
|
121
116
|
initData: (0, viem_1.encodeAbiParameters)([
|
|
122
|
-
{
|
|
117
|
+
{ name: 'threshold', type: 'uint256' },
|
|
123
118
|
{
|
|
124
|
-
components: [
|
|
125
|
-
{ type: 'uint256', name: 'pubKeyX' },
|
|
126
|
-
{ type: 'uint256', name: 'pubKeyY' },
|
|
127
|
-
{ type: 'bool', name: 'requireUV' },
|
|
128
|
-
],
|
|
129
119
|
name: 'credentials',
|
|
130
120
|
type: 'tuple[]',
|
|
121
|
+
components: [
|
|
122
|
+
{
|
|
123
|
+
name: 'pubKeyX',
|
|
124
|
+
type: 'uint256',
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
name: 'pubKeyY',
|
|
128
|
+
type: 'uint256',
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
name: 'requireUV',
|
|
132
|
+
type: 'bool',
|
|
133
|
+
},
|
|
134
|
+
],
|
|
131
135
|
},
|
|
132
136
|
], [
|
|
133
|
-
threshold,
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
},
|
|
140
|
-
],
|
|
137
|
+
BigInt(threshold),
|
|
138
|
+
publicKeys.map((publicKey) => ({
|
|
139
|
+
pubKeyX: publicKey.x,
|
|
140
|
+
pubKeyY: publicKey.y,
|
|
141
|
+
requireUV: false,
|
|
142
|
+
})),
|
|
141
143
|
]),
|
|
142
144
|
deInitData: '0x',
|
|
143
145
|
additionalContext: '0x',
|