@charterlabs/rhinestone-sdk 0.2.7-dev.3 → 0.2.7-dev.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/accounts/error.d.ts +38 -3
- package/dist/src/accounts/error.d.ts.map +1 -1
- package/dist/src/accounts/error.js +55 -7
- package/dist/src/accounts/index.d.ts +28 -20
- package/dist/src/accounts/index.d.ts.map +1 -1
- package/dist/src/accounts/index.js +196 -21
- package/dist/src/accounts/index.test.js +2 -4
- package/dist/src/accounts/json-rpc/index.d.ts +5 -0
- package/dist/src/accounts/json-rpc/index.d.ts.map +1 -0
- package/dist/src/accounts/json-rpc/index.js +16 -0
- package/dist/src/accounts/json-rpc/providers.d.ts +4 -0
- package/dist/src/accounts/json-rpc/providers.d.ts.map +1 -0
- package/dist/src/accounts/json-rpc/providers.js +52 -0
- package/dist/src/accounts/kernel.d.ts +1 -1
- package/dist/src/accounts/kernel.d.ts.map +1 -1
- package/dist/src/accounts/kernel.js +29 -1
- package/dist/src/accounts/kernel.test.js +35 -8
- package/dist/src/accounts/nexus.d.ts +4 -3
- package/dist/src/accounts/nexus.d.ts.map +1 -1
- package/dist/src/accounts/nexus.js +82 -14
- package/dist/src/accounts/nexus.test.js +33 -6
- package/dist/src/accounts/safe.d.ts.map +1 -1
- package/dist/src/accounts/safe.js +85 -53
- package/dist/src/accounts/safe.test.js +33 -6
- package/dist/src/accounts/signing/common.d.ts +4 -4
- package/dist/src/accounts/signing/common.d.ts.map +1 -1
- package/dist/src/accounts/signing/common.js +21 -9
- package/dist/src/accounts/signing/message.d.ts +1 -1
- package/dist/src/accounts/signing/message.d.ts.map +1 -1
- package/dist/src/accounts/signing/message.js +6 -6
- package/dist/src/accounts/signing/passkeys.d.ts +8 -1
- package/dist/src/accounts/signing/passkeys.d.ts.map +1 -1
- package/dist/src/accounts/signing/passkeys.js +35 -0
- package/dist/src/accounts/signing/passkeys.test.js +15 -0
- package/dist/src/accounts/signing/typedData.d.ts.map +1 -1
- package/dist/src/accounts/signing/typedData.js +2 -2
- package/dist/src/accounts/startale.test.js +0 -4
- package/dist/src/accounts/utils.d.ts +4 -4
- package/dist/src/accounts/utils.d.ts.map +1 -1
- package/dist/src/accounts/utils.js +3 -40
- package/dist/src/accounts/walletClient.d.ts +7 -0
- package/dist/src/accounts/walletClient.d.ts.map +1 -0
- package/dist/src/accounts/walletClient.js +38 -0
- package/dist/src/actions/compact.d.ts +13 -0
- package/dist/src/actions/compact.d.ts.map +1 -0
- package/dist/src/actions/compact.js +210 -0
- package/dist/src/actions/ecdsa.d.ts +35 -0
- package/dist/src/actions/ecdsa.d.ts.map +1 -0
- package/dist/src/actions/ecdsa.js +114 -0
- package/dist/src/actions/ecdsa.test.d.ts +2 -0
- package/dist/src/actions/ecdsa.test.d.ts.map +1 -0
- package/dist/src/actions/ecdsa.test.js +99 -0
- package/dist/src/actions/index.d.ts +23 -166
- package/dist/src/actions/index.d.ts.map +1 -1
- package/dist/src/actions/index.js +25 -544
- package/dist/src/actions/mfa.d.ts +37 -0
- package/dist/src/actions/mfa.d.ts.map +1 -0
- package/dist/src/actions/mfa.js +133 -0
- package/dist/src/actions/passkeys.d.ts +37 -0
- package/dist/src/actions/passkeys.d.ts.map +1 -0
- package/dist/src/actions/passkeys.js +129 -0
- package/dist/src/actions/passkeys.test.d.ts +2 -0
- package/dist/src/actions/passkeys.test.d.ts.map +1 -0
- package/dist/src/actions/passkeys.test.js +54 -0
- package/dist/src/actions/recovery.d.ts +33 -0
- package/dist/src/actions/recovery.d.ts.map +1 -0
- package/dist/src/actions/recovery.js +193 -0
- package/dist/src/actions/recovery.test.d.ts +2 -0
- package/dist/src/actions/recovery.test.d.ts.map +1 -0
- package/dist/src/actions/recovery.test.js +168 -0
- package/dist/src/errors/index.d.ts +5 -0
- package/dist/src/errors/index.d.ts.map +1 -0
- package/dist/src/errors/index.js +35 -0
- package/dist/src/execution/compact.d.ts +24 -8
- package/dist/src/execution/compact.d.ts.map +1 -1
- package/dist/src/execution/compact.js +29 -103
- package/dist/src/execution/error.d.ts +2 -9
- package/dist/src/execution/error.d.ts.map +1 -1
- package/dist/src/execution/error.js +4 -13
- package/dist/src/execution/index.d.ts +33 -22
- package/dist/src/execution/index.d.ts.map +1 -1
- package/dist/src/execution/index.js +57 -41
- package/dist/src/execution/permit2.d.ts +148 -0
- package/dist/src/execution/permit2.d.ts.map +1 -0
- package/dist/src/execution/permit2.js +282 -0
- package/dist/src/execution/smart-session.d.ts +3 -3
- package/dist/src/execution/smart-session.d.ts.map +1 -1
- package/dist/src/execution/types.d.ts +35 -0
- package/dist/src/execution/types.d.ts.map +1 -0
- package/dist/src/execution/types.js +2 -0
- package/dist/src/execution/utils.d.ts +36 -28
- package/dist/src/execution/utils.d.ts.map +1 -1
- package/dist/src/execution/utils.js +245 -91
- package/dist/src/index.d.ts +37 -19
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +130 -66
- package/dist/src/modules/common.d.ts +10 -4
- package/dist/src/modules/common.d.ts.map +1 -1
- package/dist/src/modules/common.js +22 -1
- package/dist/src/modules/index.d.ts +3 -2
- package/dist/src/modules/index.d.ts.map +1 -1
- package/dist/src/modules/index.js +16 -13
- package/dist/src/modules/index.test.js +8 -11
- package/dist/src/modules/read.d.ts.map +1 -1
- package/dist/src/modules/read.js +4 -0
- package/dist/src/modules/validators/core.d.ts +5 -3
- package/dist/src/modules/validators/core.d.ts.map +1 -1
- package/dist/src/modules/validators/core.js +29 -10
- package/dist/src/modules/validators/core.test.js +4 -4
- package/dist/src/modules/validators/smart-sessions.test.js +0 -3
- package/dist/src/modules/validators/webauthn-contract.d.ts.map +1 -1
- package/dist/src/orchestrator/client.d.ts +2 -1
- package/dist/src/orchestrator/client.d.ts.map +1 -1
- package/dist/src/orchestrator/client.js +36 -14
- package/dist/src/orchestrator/consts.d.ts +1 -2
- package/dist/src/orchestrator/consts.d.ts.map +1 -1
- package/dist/src/orchestrator/consts.js +1 -3
- package/dist/src/orchestrator/registry.d.ts +3 -25
- package/dist/src/orchestrator/registry.d.ts.map +1 -1
- package/dist/src/orchestrator/registry.js +82 -46
- package/dist/src/orchestrator/registry.test.js +7 -7
- package/dist/src/orchestrator/types.d.ts +35 -31
- package/dist/src/orchestrator/types.d.ts.map +1 -1
- package/dist/src/types.d.ts +64 -9
- package/dist/src/types.d.ts.map +1 -1
- package/package.json +73 -2
- package/dist/src/actions/index.test.d.ts +0 -2
- package/dist/src/actions/index.test.d.ts.map +0 -1
- package/dist/src/actions/index.test.js +0 -302
- package/dist/src/orchestrator/registry.json +0 -365
package/dist/src/index.d.ts
CHANGED
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import type { Address, Chain, HashTypedDataParameters, Hex, SignableMessage, SignedAuthorizationList, TypedData, Account } from 'viem';
|
|
2
2
|
import type { UserOperationReceipt } from 'viem/account-abstraction';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
3
|
+
import { deployStandaloneWithEoa as deployStandaloneWithEoaInternal } from './accounts';
|
|
4
|
+
import { walletClientToAccount } from './accounts/walletClient';
|
|
5
|
+
import { encodeSmartSessionSignature } from './actions/smart-session';
|
|
6
|
+
import { type TransactionResult, type TransactionStatus, type UserOperationResult } from './execution';
|
|
7
|
+
import { type BatchPermit2Result, checkERC20AllowanceDirect, getPermit2Address, type MultiChainPermit2Config, type MultiChainPermit2Result, signPermit2Batch, signPermit2Sequential } from './execution/permit2';
|
|
7
8
|
import { type SessionDetails } from './execution/smart-session';
|
|
8
|
-
import { type
|
|
9
|
-
import {
|
|
10
|
-
import type { Call, RhinestoneAccountConfig, Session, SignerSet, Transaction } from './types';
|
|
9
|
+
import { type IntentRoute, type PreparedTransactionData, type PreparedUserOperationData, type SignedTransactionData, type SignedUserOperationData } from './execution/utils';
|
|
10
|
+
import { getSupportedTokens, getTokenAddress, type IntentCost, type IntentInput, type IntentOp, type IntentOpStatus, type IntentResult, type Portfolio, type SettlementSystem, type SignedIntentOp } from './orchestrator';
|
|
11
|
+
import type { AccountProviderConfig, AccountType, BundlerConfig, Call, CallInput, MultiFactorValidatorConfig, OwnableValidatorConfig, OwnerSet, PaymasterConfig, Policy, ProviderConfig, Recovery, RhinestoneAccountConfig, Session, SignerSet, TokenRequest, TokenSymbol, Transaction, UniversalActionPolicyParamCondition, UserOperationTransaction, WebauthnValidatorConfig } from './types';
|
|
11
12
|
interface RhinestoneAccount {
|
|
12
13
|
config: RhinestoneAccountConfig;
|
|
13
|
-
deploy: (chain: Chain, session?: Session) => Promise<
|
|
14
|
+
deploy: (chain: Chain, session?: Session) => Promise<boolean>;
|
|
15
|
+
isDeployed: (chain: Chain) => Promise<boolean>;
|
|
16
|
+
setup: (chain: Chain) => Promise<boolean>;
|
|
14
17
|
deployStandaloneWithEoa: (chain: Chain, config: RhinestoneAccountConfig, deployer: Account) => Promise<void>;
|
|
15
18
|
signEip7702InitData: () => Promise<Hex>;
|
|
16
19
|
prepareTransaction: (transaction: Transaction) => Promise<PreparedTransactionData>;
|
|
@@ -19,27 +22,42 @@ interface RhinestoneAccount {
|
|
|
19
22
|
signMessage: (message: SignableMessage, chain: Chain, signers: SignerSet | undefined) => Promise<Hex>;
|
|
20
23
|
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>;
|
|
21
24
|
submitTransaction: (signedTransaction: SignedTransactionData, authorizations?: SignedAuthorizationList) => Promise<TransactionResult>;
|
|
25
|
+
simulateTransaction: (signedTransaction: SignedTransactionData, authorizations?: SignedAuthorizationList) => Promise<IntentResult>;
|
|
22
26
|
sendTransaction: (transaction: Transaction) => Promise<TransactionResult>;
|
|
23
|
-
|
|
27
|
+
prepareUserOperation: (transaction: UserOperationTransaction) => Promise<PreparedUserOperationData>;
|
|
28
|
+
signUserOperation: (preparedUserOperation: PreparedUserOperationData) => Promise<SignedUserOperationData>;
|
|
29
|
+
submitUserOperation: (signedUserOperation: SignedUserOperationData) => Promise<UserOperationResult>;
|
|
30
|
+
sendUserOperation: (transaction: UserOperationTransaction) => Promise<UserOperationResult>;
|
|
31
|
+
waitForExecution(result: TransactionResult, acceptsPreconfirmations?: boolean): Promise<TransactionStatus>;
|
|
32
|
+
waitForExecution(result: UserOperationResult, acceptsPreconfirmations?: boolean): Promise<UserOperationReceipt>;
|
|
24
33
|
getAddress: () => Address;
|
|
25
34
|
getPortfolio: (onTestnets?: boolean) => Promise<Portfolio>;
|
|
26
|
-
getMaxSpendableAmount: (chain: Chain, tokenAddress: Address, gasUnits: bigint) => Promise<bigint>;
|
|
35
|
+
getMaxSpendableAmount: (chain: Chain, tokenAddress: Address, gasUnits: bigint, sponsored?: boolean) => Promise<bigint>;
|
|
27
36
|
getSessionDetails: (sessions: Session[], sessionIndex: number, signature?: Hex) => Promise<SessionDetails>;
|
|
28
37
|
getOwners: (chain: Chain) => Promise<{
|
|
29
38
|
accounts: Address[];
|
|
30
39
|
threshold: number;
|
|
31
40
|
} | null>;
|
|
32
41
|
getValidators: (chain: Chain) => Promise<Address[]>;
|
|
42
|
+
checkERC20Allowance: (tokenAddress: Address, chain: Chain) => Promise<bigint>;
|
|
33
43
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
44
|
+
declare class RhinestoneSDK {
|
|
45
|
+
private apiKey?;
|
|
46
|
+
private endpointUrl?;
|
|
47
|
+
private provider?;
|
|
48
|
+
private bundler?;
|
|
49
|
+
private paymaster?;
|
|
50
|
+
constructor(options?: {
|
|
51
|
+
apiKey?: string;
|
|
52
|
+
endpointUrl?: string;
|
|
53
|
+
provider?: ProviderConfig;
|
|
54
|
+
bundler?: BundlerConfig;
|
|
55
|
+
paymaster?: PaymasterConfig;
|
|
56
|
+
});
|
|
57
|
+
createAccount(config: RhinestoneAccountConfig): Promise<RhinestoneAccount>;
|
|
58
|
+
}
|
|
59
|
+
export { RhinestoneSDK, walletClientToAccount, encodeSmartSessionSignature, getSupportedTokens, getTokenAddress, deployStandaloneWithEoaInternal as deployStandaloneWithEoa, checkERC20AllowanceDirect, getPermit2Address, signPermit2Batch, signPermit2Sequential, };
|
|
60
|
+
export type { RhinestoneAccount, AccountType, RhinestoneAccountConfig, AccountProviderConfig, ProviderConfig, BundlerConfig, PaymasterConfig, Transaction, TokenSymbol, CallInput, Call, TokenRequest, OwnerSet, OwnableValidatorConfig, WebauthnValidatorConfig, MultiFactorValidatorConfig, SignerSet, Session, Recovery, Policy, UniversalActionPolicyParamCondition, PreparedTransactionData, SignedTransactionData, TransactionResult, PreparedUserOperationData, SignedUserOperationData, UserOperationResult, IntentCost, IntentInput, IntentOp, IntentOpStatus, IntentRoute, SettlementSystem, SignedIntentOp, Portfolio, MultiChainPermit2Config, MultiChainPermit2Result, BatchPermit2Result, };
|
|
43
61
|
export { generateCredentialId, getCredentialIds, hasCredentialById, hasCredential, addCredential, removeCredential, setThreshold, getCredentialInfo, getThreshold, getCredentials, WEBAUTHN_VALIDATOR_ABI, } from './modules/validators/webauthn-contract';
|
|
44
62
|
export { getOrchestrator } from './orchestrator';
|
|
45
63
|
//# 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,EACT,OAAO,EACR,MAAM,MAAM,CAAA;AACb,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAA;AACpE,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AA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ACrB,cAAc,EACd,aAAa,EACb,eAAe,EACf,WAAW,EACX,WAAW,EACX,SAAS,EACT,IAAI,EACJ,YAAY,EACZ,QAAQ,EACR,sBAAsB,EACtB,uBAAuB,EACvB,0BAA0B,EAC1B,SAAS,EACT,OAAO,EACP,QAAQ,EACR,MAAM,EACN,mCAAmC,EACnC,uBAAuB,EACvB,qBAAqB,EACrB,iBAAiB,EACjB,yBAAyB,EACzB,uBAAuB,EACvB,mBAAmB,EACnB,UAAU,EACV,WAAW,EACX,QAAQ,EACR,cAAc,EACd,WAAW,EACX,gBAAgB,EAChB,cAAc,EACd,SAAS,EAET,uBAAuB,EACvB,uBAAuB,EACvB,kBAAkB,GACnB,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,67 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.getOrchestrator = exports.WEBAUTHN_VALIDATOR_ABI = exports.getCredentials = exports.getThreshold = exports.getCredentialInfo = exports.setThreshold = exports.removeCredential = exports.addCredential = exports.hasCredential = exports.hasCredentialById = exports.getCredentialIds = exports.generateCredentialId = exports.getTokenAddress = exports.getSupportedTokens = void 0;
|
|
5
|
-
exports.createRhinestoneAccount = createRhinestoneAccount;
|
|
3
|
+
exports.getOrchestrator = exports.WEBAUTHN_VALIDATOR_ABI = exports.getCredentials = exports.getThreshold = exports.getCredentialInfo = exports.setThreshold = exports.removeCredential = exports.addCredential = exports.hasCredential = exports.hasCredentialById = exports.getCredentialIds = exports.generateCredentialId = exports.signPermit2Sequential = exports.signPermit2Batch = exports.getPermit2Address = exports.checkERC20AllowanceDirect = exports.deployStandaloneWithEoa = exports.getTokenAddress = exports.getSupportedTokens = exports.encodeSmartSessionSignature = exports.walletClientToAccount = exports.RhinestoneSDK = void 0;
|
|
6
4
|
const accounts_1 = require("./accounts");
|
|
7
|
-
Object.defineProperty(exports, "AccountError", { enumerable: true, get: function () { return accounts_1.AccountError; } });
|
|
8
5
|
Object.defineProperty(exports, "deployStandaloneWithEoa", { enumerable: true, get: function () { return accounts_1.deployStandaloneWithEoa; } });
|
|
9
|
-
|
|
10
|
-
Object.defineProperty(exports, "
|
|
11
|
-
|
|
12
|
-
Object.defineProperty(exports, "
|
|
13
|
-
Object.defineProperty(exports, "isAccountError", { enumerable: true, get: function () { return accounts_1.isAccountError; } });
|
|
14
|
-
Object.defineProperty(exports, "SigningNotSupportedForAccountError", { enumerable: true, get: function () { return accounts_1.SigningNotSupportedForAccountError; } });
|
|
15
|
-
Object.defineProperty(exports, "SignMessageNotSupportedByAccountError", { enumerable: true, get: function () { return accounts_1.SignMessageNotSupportedByAccountError; } });
|
|
16
|
-
Object.defineProperty(exports, "SmartSessionsNotEnabledError", { enumerable: true, get: function () { return accounts_1.SmartSessionsNotEnabledError; } });
|
|
17
|
-
const actions_1 = require("./actions");
|
|
18
|
-
Object.defineProperty(exports, "addOwner", { enumerable: true, get: function () { return actions_1.addOwner; } });
|
|
19
|
-
Object.defineProperty(exports, "addPasskeyOwner", { enumerable: true, get: function () { return actions_1.addPasskeyOwner; } });
|
|
20
|
-
Object.defineProperty(exports, "changeMultiFactorThreshold", { enumerable: true, get: function () { return actions_1.changeMultiFactorThreshold; } });
|
|
21
|
-
Object.defineProperty(exports, "changePasskeyThreshold", { enumerable: true, get: function () { return actions_1.changePasskeyThreshold; } });
|
|
22
|
-
Object.defineProperty(exports, "changeThreshold", { enumerable: true, get: function () { return actions_1.changeThreshold; } });
|
|
23
|
-
Object.defineProperty(exports, "disableEcdsa", { enumerable: true, get: function () { return actions_1.disableEcdsa; } });
|
|
24
|
-
Object.defineProperty(exports, "disableMultiFactor", { enumerable: true, get: function () { return actions_1.disableMultiFactor; } });
|
|
25
|
-
Object.defineProperty(exports, "disablePasskeys", { enumerable: true, get: function () { return actions_1.disablePasskeys; } });
|
|
26
|
-
Object.defineProperty(exports, "enableEcdsa", { enumerable: true, get: function () { return actions_1.enableEcdsa; } });
|
|
27
|
-
Object.defineProperty(exports, "enableMultiFactor", { enumerable: true, get: function () { return actions_1.enableMultiFactor; } });
|
|
28
|
-
Object.defineProperty(exports, "enablePasskeys", { enumerable: true, get: function () { return actions_1.enablePasskeys; } });
|
|
29
|
-
Object.defineProperty(exports, "encodeSmartSessionSignature", { enumerable: true, get: function () { return actions_1.encodeSmartSessionSignature; } });
|
|
30
|
-
Object.defineProperty(exports, "recover", { enumerable: true, get: function () { return actions_1.recover; } });
|
|
31
|
-
Object.defineProperty(exports, "recoverEcdsaOwnership", { enumerable: true, get: function () { return actions_1.recoverEcdsaOwnership; } });
|
|
32
|
-
Object.defineProperty(exports, "recoverPasskeyOwnership", { enumerable: true, get: function () { return actions_1.recoverPasskeyOwnership; } });
|
|
33
|
-
Object.defineProperty(exports, "removeOwner", { enumerable: true, get: function () { return actions_1.removeOwner; } });
|
|
34
|
-
Object.defineProperty(exports, "removePasskeyOwner", { enumerable: true, get: function () { return actions_1.removePasskeyOwner; } });
|
|
35
|
-
Object.defineProperty(exports, "removeSubValidator", { enumerable: true, get: function () { return actions_1.removeSubValidator; } });
|
|
36
|
-
Object.defineProperty(exports, "setSubValidator", { enumerable: true, get: function () { return actions_1.setSubValidator; } });
|
|
37
|
-
Object.defineProperty(exports, "setUpRecovery", { enumerable: true, get: function () { return actions_1.setUpRecovery; } });
|
|
6
|
+
const walletClient_1 = require("./accounts/walletClient");
|
|
7
|
+
Object.defineProperty(exports, "walletClientToAccount", { enumerable: true, get: function () { return walletClient_1.walletClientToAccount; } });
|
|
8
|
+
const smart_session_1 = require("./actions/smart-session");
|
|
9
|
+
Object.defineProperty(exports, "encodeSmartSessionSignature", { enumerable: true, get: function () { return smart_session_1.encodeSmartSessionSignature; } });
|
|
38
10
|
const execution_1 = require("./execution");
|
|
39
|
-
|
|
40
|
-
Object.defineProperty(exports, "
|
|
41
|
-
Object.defineProperty(exports, "
|
|
42
|
-
Object.defineProperty(exports, "
|
|
43
|
-
Object.defineProperty(exports, "
|
|
44
|
-
|
|
45
|
-
Object.defineProperty(exports, "UserOperationRequiredForSmartSessionsError", { enumerable: true, get: function () { return execution_1.UserOperationRequiredForSmartSessionsError; } });
|
|
46
|
-
const smart_session_1 = require("./execution/smart-session");
|
|
11
|
+
const permit2_1 = require("./execution/permit2");
|
|
12
|
+
Object.defineProperty(exports, "checkERC20AllowanceDirect", { enumerable: true, get: function () { return permit2_1.checkERC20AllowanceDirect; } });
|
|
13
|
+
Object.defineProperty(exports, "getPermit2Address", { enumerable: true, get: function () { return permit2_1.getPermit2Address; } });
|
|
14
|
+
Object.defineProperty(exports, "signPermit2Batch", { enumerable: true, get: function () { return permit2_1.signPermit2Batch; } });
|
|
15
|
+
Object.defineProperty(exports, "signPermit2Sequential", { enumerable: true, get: function () { return permit2_1.signPermit2Sequential; } });
|
|
16
|
+
const smart_session_2 = require("./execution/smart-session");
|
|
47
17
|
const utils_1 = require("./execution/utils");
|
|
48
18
|
const modules_1 = require("./modules");
|
|
49
19
|
const orchestrator_1 = require("./orchestrator");
|
|
50
|
-
Object.defineProperty(exports, "AuthenticationRequiredError", { enumerable: true, get: function () { return orchestrator_1.AuthenticationRequiredError; } });
|
|
51
20
|
Object.defineProperty(exports, "getSupportedTokens", { enumerable: true, get: function () { return orchestrator_1.getSupportedTokens; } });
|
|
52
21
|
Object.defineProperty(exports, "getTokenAddress", { enumerable: true, get: function () { return orchestrator_1.getTokenAddress; } });
|
|
53
|
-
Object.defineProperty(exports, "InsufficientBalanceError", { enumerable: true, get: function () { return orchestrator_1.InsufficientBalanceError; } });
|
|
54
|
-
Object.defineProperty(exports, "IntentNotFoundError", { enumerable: true, get: function () { return orchestrator_1.IntentNotFoundError; } });
|
|
55
|
-
Object.defineProperty(exports, "InvalidApiKeyError", { enumerable: true, get: function () { return orchestrator_1.InvalidApiKeyError; } });
|
|
56
|
-
Object.defineProperty(exports, "InvalidIntentSignatureError", { enumerable: true, get: function () { return orchestrator_1.InvalidIntentSignatureError; } });
|
|
57
|
-
Object.defineProperty(exports, "isOrchestratorError", { enumerable: true, get: function () { return orchestrator_1.isOrchestratorError; } });
|
|
58
|
-
Object.defineProperty(exports, "NoPathFoundError", { enumerable: true, get: function () { return orchestrator_1.NoPathFoundError; } });
|
|
59
|
-
Object.defineProperty(exports, "OnlyOneTargetTokenAmountCanBeUnsetError", { enumerable: true, get: function () { return orchestrator_1.OnlyOneTargetTokenAmountCanBeUnsetError; } });
|
|
60
|
-
Object.defineProperty(exports, "OrchestratorError", { enumerable: true, get: function () { return orchestrator_1.OrchestratorError; } });
|
|
61
|
-
Object.defineProperty(exports, "TokenNotSupportedError", { enumerable: true, get: function () { return orchestrator_1.TokenNotSupportedError; } });
|
|
62
|
-
Object.defineProperty(exports, "UnsupportedChainError", { enumerable: true, get: function () { return orchestrator_1.UnsupportedChainError; } });
|
|
63
|
-
Object.defineProperty(exports, "UnsupportedChainIdError", { enumerable: true, get: function () { return orchestrator_1.UnsupportedChainIdError; } });
|
|
64
|
-
Object.defineProperty(exports, "UnsupportedTokenError", { enumerable: true, get: function () { return orchestrator_1.UnsupportedTokenError; } });
|
|
65
22
|
/**
|
|
66
23
|
* Initialize a Rhinestone account
|
|
67
24
|
* Note: accounts are deployed onchain only when the first transaction is sent.
|
|
@@ -69,6 +26,13 @@ Object.defineProperty(exports, "UnsupportedTokenError", { enumerable: true, get:
|
|
|
69
26
|
* @returns account
|
|
70
27
|
*/
|
|
71
28
|
async function createRhinestoneAccount(config) {
|
|
29
|
+
// Sanity check for existing (externally created) accounts
|
|
30
|
+
// Ensures we decode the initdata correctly
|
|
31
|
+
(0, accounts_1.checkAddress)(config);
|
|
32
|
+
// Validate that owners field is provided for non-EOA accounts
|
|
33
|
+
if (config.account?.type !== 'eoa' && !config.owners) {
|
|
34
|
+
throw new accounts_1.OwnersFieldRequiredError();
|
|
35
|
+
}
|
|
72
36
|
/**
|
|
73
37
|
* Deploys the account on a given chain
|
|
74
38
|
* @param chain Chain to deploy the account on
|
|
@@ -77,8 +41,21 @@ async function createRhinestoneAccount(config) {
|
|
|
77
41
|
function deploy(chain, session) {
|
|
78
42
|
return (0, accounts_1.deploy)(config, chain, session);
|
|
79
43
|
}
|
|
80
|
-
|
|
81
|
-
|
|
44
|
+
/**
|
|
45
|
+
* Checks if the account is deployed on a given chain
|
|
46
|
+
* @param chain Chain to check if the account is deployed on
|
|
47
|
+
* @returns true if the account is deployed, false otherwise
|
|
48
|
+
*/
|
|
49
|
+
function isDeployed(chain) {
|
|
50
|
+
return (0, accounts_1.isDeployed)(config, chain);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Sets up the existing account on a given chain
|
|
54
|
+
* by installing the missing modules (if any).
|
|
55
|
+
* @param chain Chain to set up the account on
|
|
56
|
+
*/
|
|
57
|
+
function setup(chain) {
|
|
58
|
+
return (0, accounts_1.setup)(config, chain);
|
|
82
59
|
}
|
|
83
60
|
/**
|
|
84
61
|
* Prepare and sign the EIP-7702 account initialization data
|
|
@@ -87,6 +64,9 @@ async function createRhinestoneAccount(config) {
|
|
|
87
64
|
function signEip7702InitData() {
|
|
88
65
|
return (0, accounts_1.signEip7702InitData)(config);
|
|
89
66
|
}
|
|
67
|
+
function deployStandaloneWithEoa(chain, accountConfig, deployer) {
|
|
68
|
+
return (0, accounts_1.deployStandaloneWithEoa)(chain, accountConfig, deployer);
|
|
69
|
+
}
|
|
90
70
|
/**
|
|
91
71
|
* Prepare a transaction data
|
|
92
72
|
* @param transaction Transaction to prepare
|
|
@@ -137,27 +117,65 @@ async function createRhinestoneAccount(config) {
|
|
|
137
117
|
* Submit a transaction
|
|
138
118
|
* @param signedTransaction Signed transaction data
|
|
139
119
|
* @param authorizations EIP-7702 authorizations to submit (optional)
|
|
140
|
-
* @returns transaction result object (
|
|
120
|
+
* @returns transaction result object (a UserOp hash)
|
|
141
121
|
* @see {@link signTransaction} to sign the transaction data
|
|
142
122
|
* @see {@link signAuthorizations} to sign the required EIP-7702 authorizations
|
|
143
123
|
*/
|
|
144
124
|
function submitTransaction(signedTransaction, authorizations) {
|
|
145
125
|
return (0, utils_1.submitTransaction)(config, signedTransaction, authorizations ?? []);
|
|
146
126
|
}
|
|
127
|
+
/**
|
|
128
|
+
* Prepare a user operation data
|
|
129
|
+
* @param transaction User operation to prepare
|
|
130
|
+
* @returns prepared user operation data
|
|
131
|
+
*/
|
|
132
|
+
function prepareUserOperation(transaction) {
|
|
133
|
+
return (0, utils_1.prepareUserOperation)(config, transaction);
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Sign a user operation
|
|
137
|
+
* @param preparedUserOperation Prepared user operation data
|
|
138
|
+
* @returns signed user operation data
|
|
139
|
+
* @see {@link prepareUserOperation} to prepare the user operation data for signing
|
|
140
|
+
*/
|
|
141
|
+
function signUserOperation(preparedUserOperation) {
|
|
142
|
+
return (0, utils_1.signUserOperation)(config, preparedUserOperation);
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Submit a transaction
|
|
146
|
+
* @param signedTransaction Signed transaction data
|
|
147
|
+
* @returns transaction result object (a UserOp hash)
|
|
148
|
+
* @see {@link signUserOperation} to sign the user operation data
|
|
149
|
+
*/
|
|
150
|
+
function submitUserOperation(signedUserOperation) {
|
|
151
|
+
return (0, utils_1.submitUserOperation)(config, signedUserOperation);
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Simulate a transaction
|
|
155
|
+
* @param signedTransaction Signed transaction data
|
|
156
|
+
* @param authorizations EIP-7702 authorizations to simulate (optional)
|
|
157
|
+
* @returns simulation result
|
|
158
|
+
* @see {@link sendTransaction} to send the transaction
|
|
159
|
+
*/
|
|
160
|
+
function simulateTransaction(signedTransaction, authorizations) {
|
|
161
|
+
return (0, utils_1.simulateTransaction)(config, signedTransaction, authorizations ?? []);
|
|
162
|
+
}
|
|
147
163
|
/**
|
|
148
164
|
* Sign and send a transaction
|
|
149
165
|
* @param transaction Transaction to send
|
|
150
|
-
* @returns transaction result object (an intent ID
|
|
166
|
+
* @returns transaction result object (an intent ID)
|
|
151
167
|
*/
|
|
152
168
|
function sendTransaction(transaction) {
|
|
153
169
|
return (0, execution_1.sendTransaction)(config, transaction);
|
|
154
170
|
}
|
|
155
171
|
/**
|
|
156
|
-
*
|
|
157
|
-
* @param
|
|
158
|
-
* @
|
|
159
|
-
* @returns intent result or a UserOp receipt
|
|
172
|
+
* Sign and send a user operation
|
|
173
|
+
* @param transaction User operation to send
|
|
174
|
+
* @returns user operation result object (a UserOp hash)
|
|
160
175
|
*/
|
|
176
|
+
function sendUserOperation(transaction) {
|
|
177
|
+
return (0, execution_1.sendUserOperation)(config, transaction);
|
|
178
|
+
}
|
|
161
179
|
function waitForExecution(result, acceptsPreconfirmations = true) {
|
|
162
180
|
return (0, execution_1.waitForExecution)(config, result, acceptsPreconfirmations);
|
|
163
181
|
}
|
|
@@ -183,8 +201,8 @@ async function createRhinestoneAccount(config) {
|
|
|
183
201
|
* @param gasUnits Gas cost estimate for the transaction execution
|
|
184
202
|
* @returns Maximum spendable amount in absolute units
|
|
185
203
|
*/
|
|
186
|
-
function getMaxSpendableAmount(chain, tokenAddress, gasUnits) {
|
|
187
|
-
return (0, execution_1.getMaxSpendableAmount)(config, chain, tokenAddress, gasUnits);
|
|
204
|
+
function getMaxSpendableAmount(chain, tokenAddress, gasUnits, sponsored = false) {
|
|
205
|
+
return (0, execution_1.getMaxSpendableAmount)(config, chain, tokenAddress, gasUnits, sponsored);
|
|
188
206
|
}
|
|
189
207
|
/**
|
|
190
208
|
* Get account owners (ECDSA)
|
|
@@ -206,11 +224,25 @@ async function createRhinestoneAccount(config) {
|
|
|
206
224
|
return (0, modules_1.getValidators)(accountType, account, chain, config.provider);
|
|
207
225
|
}
|
|
208
226
|
function getSessionDetails(sessions, sessionIndex, signature) {
|
|
209
|
-
return (0,
|
|
227
|
+
return (0, smart_session_2.getSessionDetails)(config, sessions, sessionIndex, signature);
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Check ERC20 allowance for the account owner and token (using Permit2 as spender)
|
|
231
|
+
* @param tokenAddress The token contract address
|
|
232
|
+
* @param chain The chain to check the allowance on
|
|
233
|
+
* @returns The allowance amount
|
|
234
|
+
*/
|
|
235
|
+
function checkERC20Allowance(tokenAddress, chain) {
|
|
236
|
+
if (!config.provider) {
|
|
237
|
+
throw new Error('Provider configuration is required');
|
|
238
|
+
}
|
|
239
|
+
return (0, permit2_1.checkERC20Allowance)(tokenAddress, chain, config);
|
|
210
240
|
}
|
|
211
241
|
return {
|
|
212
242
|
config,
|
|
213
243
|
deploy,
|
|
244
|
+
isDeployed,
|
|
245
|
+
setup,
|
|
214
246
|
deployStandaloneWithEoa,
|
|
215
247
|
signEip7702InitData,
|
|
216
248
|
prepareTransaction,
|
|
@@ -219,7 +251,12 @@ async function createRhinestoneAccount(config) {
|
|
|
219
251
|
signMessage,
|
|
220
252
|
signTypedData,
|
|
221
253
|
submitTransaction,
|
|
254
|
+
simulateTransaction,
|
|
255
|
+
prepareUserOperation,
|
|
256
|
+
signUserOperation,
|
|
257
|
+
submitUserOperation,
|
|
222
258
|
sendTransaction,
|
|
259
|
+
sendUserOperation,
|
|
223
260
|
waitForExecution,
|
|
224
261
|
getAddress,
|
|
225
262
|
getPortfolio,
|
|
@@ -227,9 +264,36 @@ async function createRhinestoneAccount(config) {
|
|
|
227
264
|
getSessionDetails,
|
|
228
265
|
getOwners,
|
|
229
266
|
getValidators,
|
|
267
|
+
checkERC20Allowance,
|
|
230
268
|
};
|
|
231
269
|
}
|
|
232
|
-
|
|
270
|
+
class RhinestoneSDK {
|
|
271
|
+
apiKey;
|
|
272
|
+
endpointUrl;
|
|
273
|
+
provider;
|
|
274
|
+
bundler;
|
|
275
|
+
paymaster;
|
|
276
|
+
constructor(options) {
|
|
277
|
+
this.apiKey = options?.apiKey;
|
|
278
|
+
this.endpointUrl = options?.endpointUrl;
|
|
279
|
+
this.provider = options?.provider;
|
|
280
|
+
this.bundler = options?.bundler;
|
|
281
|
+
this.paymaster = options?.paymaster;
|
|
282
|
+
}
|
|
283
|
+
createAccount(config) {
|
|
284
|
+
const rhinestoneConfig = {
|
|
285
|
+
...config,
|
|
286
|
+
apiKey: this.apiKey,
|
|
287
|
+
endpointUrl: this.endpointUrl,
|
|
288
|
+
provider: this.provider,
|
|
289
|
+
bundler: this.bundler,
|
|
290
|
+
paymaster: this.paymaster,
|
|
291
|
+
};
|
|
292
|
+
return createRhinestoneAccount(rhinestoneConfig);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
exports.RhinestoneSDK = RhinestoneSDK;
|
|
296
|
+
// WebAuthn Validator contract helpers (keep Charter API stable)
|
|
233
297
|
var webauthn_contract_1 = require("./modules/validators/webauthn-contract");
|
|
234
298
|
Object.defineProperty(exports, "generateCredentialId", { enumerable: true, get: function () { return webauthn_contract_1.generateCredentialId; } });
|
|
235
299
|
Object.defineProperty(exports, "getCredentialIds", { enumerable: true, get: function () { return webauthn_contract_1.getCredentialIds; } });
|
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
import type { Address, Hex } from 'viem';
|
|
2
|
-
type
|
|
2
|
+
type ModuleTypeId = typeof MODULE_TYPE_ID_VALIDATOR | typeof MODULE_TYPE_ID_EXECUTOR | typeof MODULE_TYPE_ID_FALLBACK | typeof MODULE_TYPE_ID_HOOK;
|
|
3
|
+
type ModuleType = typeof MODULE_TYPE_VALIDATOR | typeof MODULE_TYPE_EXECUTOR | typeof MODULE_TYPE_FALLBACK | typeof MODULE_TYPE_HOOK;
|
|
3
4
|
interface Module {
|
|
4
5
|
address: Address;
|
|
5
6
|
initData: Hex;
|
|
6
7
|
deInitData: Hex;
|
|
7
8
|
additionalContext: Hex;
|
|
8
|
-
type:
|
|
9
|
+
type: ModuleTypeId;
|
|
9
10
|
}
|
|
10
11
|
declare const MODULE_TYPE_ID_VALIDATOR = 1n;
|
|
11
12
|
declare const MODULE_TYPE_ID_EXECUTOR = 2n;
|
|
12
13
|
declare const MODULE_TYPE_ID_FALLBACK = 3n;
|
|
13
14
|
declare const MODULE_TYPE_ID_HOOK = 4n;
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
declare const MODULE_TYPE_VALIDATOR = "validator";
|
|
16
|
+
declare const MODULE_TYPE_EXECUTOR = "executor";
|
|
17
|
+
declare const MODULE_TYPE_FALLBACK = "fallback";
|
|
18
|
+
declare const MODULE_TYPE_HOOK = "hook";
|
|
19
|
+
declare function toModuleTypeId(type: ModuleType): ModuleTypeId;
|
|
20
|
+
export { MODULE_TYPE_ID_VALIDATOR, MODULE_TYPE_ID_EXECUTOR, MODULE_TYPE_ID_FALLBACK, MODULE_TYPE_ID_HOOK, MODULE_TYPE_VALIDATOR, MODULE_TYPE_EXECUTOR, MODULE_TYPE_FALLBACK, MODULE_TYPE_HOOK, toModuleTypeId, };
|
|
21
|
+
export type { Module, ModuleType, ModuleTypeId };
|
|
16
22
|
//# sourceMappingURL=common.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../modules/common.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AAExC,KAAK,
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../modules/common.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AAExC,KAAK,YAAY,GACb,OAAO,wBAAwB,GAC/B,OAAO,uBAAuB,GAC9B,OAAO,uBAAuB,GAC9B,OAAO,mBAAmB,CAAA;AAE9B,KAAK,UAAU,GACX,OAAO,qBAAqB,GAC5B,OAAO,oBAAoB,GAC3B,OAAO,oBAAoB,GAC3B,OAAO,gBAAgB,CAAA;AAE3B,UAAU,MAAM;IACd,OAAO,EAAE,OAAO,CAAA;IAChB,QAAQ,EAAE,GAAG,CAAA;IACb,UAAU,EAAE,GAAG,CAAA;IACf,iBAAiB,EAAE,GAAG,CAAA;IACtB,IAAI,EAAE,YAAY,CAAA;CACnB;AAED,QAAA,MAAM,wBAAwB,KAAK,CAAA;AACnC,QAAA,MAAM,uBAAuB,KAAK,CAAA;AAClC,QAAA,MAAM,uBAAuB,KAAK,CAAA;AAClC,QAAA,MAAM,mBAAmB,KAAK,CAAA;AAE9B,QAAA,MAAM,qBAAqB,cAAc,CAAA;AACzC,QAAA,MAAM,oBAAoB,aAAa,CAAA;AACvC,QAAA,MAAM,oBAAoB,aAAa,CAAA;AACvC,QAAA,MAAM,gBAAgB,SAAS,CAAA;AAE/B,iBAAS,cAAc,CAAC,IAAI,EAAE,UAAU,GAAG,YAAY,CAWtD;AAED,OAAO,EACL,wBAAwB,EACxB,uBAAuB,EACvB,uBAAuB,EACvB,mBAAmB,EACnB,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,EACpB,gBAAgB,EAChB,cAAc,GACf,CAAA;AACD,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,CAAA"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MODULE_TYPE_ID_HOOK = exports.MODULE_TYPE_ID_FALLBACK = exports.MODULE_TYPE_ID_EXECUTOR = exports.MODULE_TYPE_ID_VALIDATOR = void 0;
|
|
3
|
+
exports.MODULE_TYPE_HOOK = exports.MODULE_TYPE_FALLBACK = exports.MODULE_TYPE_EXECUTOR = exports.MODULE_TYPE_VALIDATOR = exports.MODULE_TYPE_ID_HOOK = exports.MODULE_TYPE_ID_FALLBACK = exports.MODULE_TYPE_ID_EXECUTOR = exports.MODULE_TYPE_ID_VALIDATOR = void 0;
|
|
4
|
+
exports.toModuleTypeId = toModuleTypeId;
|
|
4
5
|
const MODULE_TYPE_ID_VALIDATOR = 1n;
|
|
5
6
|
exports.MODULE_TYPE_ID_VALIDATOR = MODULE_TYPE_ID_VALIDATOR;
|
|
6
7
|
const MODULE_TYPE_ID_EXECUTOR = 2n;
|
|
@@ -9,3 +10,23 @@ const MODULE_TYPE_ID_FALLBACK = 3n;
|
|
|
9
10
|
exports.MODULE_TYPE_ID_FALLBACK = MODULE_TYPE_ID_FALLBACK;
|
|
10
11
|
const MODULE_TYPE_ID_HOOK = 4n;
|
|
11
12
|
exports.MODULE_TYPE_ID_HOOK = MODULE_TYPE_ID_HOOK;
|
|
13
|
+
const MODULE_TYPE_VALIDATOR = 'validator';
|
|
14
|
+
exports.MODULE_TYPE_VALIDATOR = MODULE_TYPE_VALIDATOR;
|
|
15
|
+
const MODULE_TYPE_EXECUTOR = 'executor';
|
|
16
|
+
exports.MODULE_TYPE_EXECUTOR = MODULE_TYPE_EXECUTOR;
|
|
17
|
+
const MODULE_TYPE_FALLBACK = 'fallback';
|
|
18
|
+
exports.MODULE_TYPE_FALLBACK = MODULE_TYPE_FALLBACK;
|
|
19
|
+
const MODULE_TYPE_HOOK = 'hook';
|
|
20
|
+
exports.MODULE_TYPE_HOOK = MODULE_TYPE_HOOK;
|
|
21
|
+
function toModuleTypeId(type) {
|
|
22
|
+
switch (type) {
|
|
23
|
+
case MODULE_TYPE_VALIDATOR:
|
|
24
|
+
return MODULE_TYPE_ID_VALIDATOR;
|
|
25
|
+
case MODULE_TYPE_EXECUTOR:
|
|
26
|
+
return MODULE_TYPE_ID_EXECUTOR;
|
|
27
|
+
case MODULE_TYPE_FALLBACK:
|
|
28
|
+
return MODULE_TYPE_ID_FALLBACK;
|
|
29
|
+
case MODULE_TYPE_HOOK:
|
|
30
|
+
return MODULE_TYPE_ID_HOOK;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Chain } from 'viem';
|
|
2
|
-
import type { RhinestoneAccountConfig } from '../types';
|
|
2
|
+
import type { RhinestoneAccountConfig, RhinestoneConfig } from '../types';
|
|
3
3
|
import { type Module } from './common';
|
|
4
4
|
import { HOOK_ADDRESS } from './omni-account';
|
|
5
5
|
import { getOwners, getValidators } from './read';
|
|
@@ -11,6 +11,7 @@ interface ModeleSetup {
|
|
|
11
11
|
hooks: Module[];
|
|
12
12
|
}
|
|
13
13
|
declare function getSetup(config: RhinestoneAccountConfig): ModeleSetup;
|
|
14
|
+
declare function getIntentExecutor(config: RhinestoneConfig): Module;
|
|
14
15
|
declare function isRip7212SupportedNetwork(chain: Chain): boolean;
|
|
15
|
-
export { HOOK_ADDRESS, getSetup, getOwnerValidator, getOwners, getValidators, isRip7212SupportedNetwork, };
|
|
16
|
+
export { HOOK_ADDRESS, getSetup, getOwnerValidator, getOwners, getIntentExecutor, getValidators, isRip7212SupportedNetwork, };
|
|
16
17
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../modules/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,KAAK,EAAuB,MAAM,MAAM,CAAA;AAWpE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../modules/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,KAAK,EAAuB,MAAM,MAAM,CAAA;AAWpE,OAAO,KAAK,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAEzE,OAAO,EAGL,KAAK,MAAM,EACZ,MAAM,UAAU,CAAA;AACjB,OAAO,EACL,YAAY,EAGb,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAA;AACjD,OAAO,EAAE,iBAAiB,EAA4B,MAAM,cAAc,CAAA;AAM1E,UAAU,WAAW;IACnB,UAAU,EAAE,MAAM,EAAE,CAAA;IACpB,SAAS,EAAE,MAAM,EAAE,CAAA;IACnB,SAAS,EAAE,MAAM,EAAE,CAAA;IACnB,KAAK,EAAE,MAAM,EAAE,CAAA;CAChB;AAED,iBAAS,QAAQ,CAAC,MAAM,EAAE,uBAAuB,GAAG,WAAW,CAiD9D;AAED,iBAAS,iBAAiB,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CAW3D;AAED,iBAAS,yBAAyB,CAAC,KAAK,EAAE,KAAK,WAW9C;AAED,OAAO,EACL,YAAY,EACZ,QAAQ,EACR,iBAAiB,EACjB,SAAS,EACT,iBAAiB,EACjB,aAAa,EACb,yBAAyB,GAC1B,CAAA"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getValidators = exports.getOwners = exports.getOwnerValidator = exports.HOOK_ADDRESS = void 0;
|
|
4
4
|
exports.getSetup = getSetup;
|
|
5
|
+
exports.getIntentExecutor = getIntentExecutor;
|
|
5
6
|
exports.isRip7212SupportedNetwork = isRip7212SupportedNetwork;
|
|
6
7
|
const viem_1 = require("viem");
|
|
7
8
|
const chains_1 = require("viem/chains");
|
|
@@ -14,7 +15,7 @@ Object.defineProperty(exports, "getValidators", { enumerable: true, get: functio
|
|
|
14
15
|
const validators_1 = require("./validators");
|
|
15
16
|
Object.defineProperty(exports, "getOwnerValidator", { enumerable: true, get: function () { return validators_1.getOwnerValidator; } });
|
|
16
17
|
const core_1 = require("./validators/core");
|
|
17
|
-
const SMART_SESSION_COMPATIBILITY_FALLBACK_ADDRESS = '
|
|
18
|
+
const SMART_SESSION_COMPATIBILITY_FALLBACK_ADDRESS = '0x000000000052e9685932845660777DF43C2dC496';
|
|
18
19
|
function getSetup(config) {
|
|
19
20
|
const ownerValidator = (0, validators_1.getOwnerValidator)(config);
|
|
20
21
|
const smartSessionValidator = (0, validators_1.getSmartSessionValidator)(config);
|
|
@@ -26,18 +27,8 @@ function getSetup(config) {
|
|
|
26
27
|
const socialRecoveryValidator = (0, core_1.getSocialRecoveryValidator)(config.recovery.guardians, config.recovery.threshold);
|
|
27
28
|
validators.push(socialRecoveryValidator);
|
|
28
29
|
}
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
: omni_account_1.INTENT_EXECUTOR_ADDRESS;
|
|
32
|
-
const executors = [
|
|
33
|
-
{
|
|
34
|
-
address: intentExecutorAddress,
|
|
35
|
-
initData: '0x',
|
|
36
|
-
deInitData: '0x',
|
|
37
|
-
additionalContext: '0x',
|
|
38
|
-
type: common_1.MODULE_TYPE_ID_EXECUTOR,
|
|
39
|
-
},
|
|
40
|
-
];
|
|
30
|
+
const intentExecutor = getIntentExecutor(config);
|
|
31
|
+
const executors = [intentExecutor];
|
|
41
32
|
const fallbacks = [];
|
|
42
33
|
// Some accounts (e.g. Safe) need a fallback method to support smart sessions
|
|
43
34
|
if (config.sessions) {
|
|
@@ -63,6 +54,18 @@ function getSetup(config) {
|
|
|
63
54
|
hooks,
|
|
64
55
|
};
|
|
65
56
|
}
|
|
57
|
+
function getIntentExecutor(config) {
|
|
58
|
+
const intentExecutorAddress = config.endpointUrl
|
|
59
|
+
? omni_account_1.INTENT_EXECUTOR_ADDRESS_DEV
|
|
60
|
+
: omni_account_1.INTENT_EXECUTOR_ADDRESS;
|
|
61
|
+
return {
|
|
62
|
+
address: intentExecutorAddress,
|
|
63
|
+
initData: '0x',
|
|
64
|
+
deInitData: '0x',
|
|
65
|
+
additionalContext: '0x',
|
|
66
|
+
type: common_1.MODULE_TYPE_ID_EXECUTOR,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
66
69
|
function isRip7212SupportedNetwork(chain) {
|
|
67
70
|
const supportedChains = [
|
|
68
71
|
chains_1.optimism,
|