@rhinestone/sdk 1.0.0-alpha.9 → 1.0.0-beta.38
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 +30 -15
- package/dist/src/accounts/index.d.ts.map +1 -1
- package/dist/src/accounts/index.js +284 -140
- package/dist/src/accounts/index.test.js +3 -5
- 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.map +1 -0
- package/dist/src/accounts/json-rpc/index.test.js +16 -0
- package/dist/src/accounts/json-rpc/providers.d.ts +4 -0
- package/dist/src/accounts/json-rpc/providers.d.ts.map +1 -0
- package/dist/src/accounts/json-rpc/providers.js +14 -0
- package/dist/src/accounts/json-rpc/providers.test.d.ts +2 -0
- package/dist/src/accounts/json-rpc/providers.test.d.ts.map +1 -0
- package/dist/src/accounts/json-rpc/providers.test.js +15 -0
- package/dist/src/accounts/kernel.d.ts +4 -3
- package/dist/src/accounts/kernel.d.ts.map +1 -1
- package/dist/src/accounts/kernel.js +32 -6
- package/dist/src/accounts/kernel.test.js +41 -19
- package/dist/src/accounts/nexus.d.ts +11 -4
- package/dist/src/accounts/nexus.d.ts.map +1 -1
- package/dist/src/accounts/nexus.js +182 -25
- package/dist/src/accounts/nexus.test.js +44 -18
- package/dist/src/accounts/safe.d.ts +2 -2
- package/dist/src/accounts/safe.d.ts.map +1 -1
- package/dist/src/accounts/safe.js +88 -58
- package/dist/src/accounts/safe.test.js +40 -14
- package/dist/src/accounts/signing/common.d.ts +27 -0
- package/dist/src/accounts/signing/common.d.ts.map +1 -0
- package/dist/src/accounts/signing/common.js +145 -0
- package/dist/src/accounts/signing/message.d.ts +5 -0
- package/dist/src/accounts/signing/message.d.ts.map +1 -0
- package/dist/src/accounts/signing/message.js +47 -0
- package/dist/src/accounts/signing/passkeys.d.ts +36 -0
- package/dist/src/accounts/signing/passkeys.d.ts.map +1 -0
- package/dist/src/accounts/signing/passkeys.js +125 -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 +88 -0
- package/dist/src/accounts/signing/typedData.d.ts +5 -0
- package/dist/src/accounts/signing/typedData.d.ts.map +1 -0
- package/dist/src/accounts/signing/typedData.js +35 -0
- package/dist/src/accounts/startale.d.ts +2 -2
- package/dist/src/accounts/startale.d.ts.map +1 -1
- package/dist/src/accounts/startale.js +3 -3
- package/dist/src/accounts/startale.test.js +9 -14
- 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 -38
- package/dist/src/actions/index.d.ts.map +1 -1
- package/dist/src/actions/index.js +29 -294
- package/dist/src/actions/mfa.d.ts +37 -0
- package/dist/src/actions/mfa.d.ts.map +1 -0
- package/dist/src/actions/mfa.js +133 -0
- package/dist/src/actions/passkeys.d.ts +37 -0
- package/dist/src/actions/passkeys.d.ts.map +1 -0
- package/dist/src/actions/passkeys.js +129 -0
- package/dist/src/actions/passkeys.test.d.ts +2 -0
- package/dist/src/actions/passkeys.test.d.ts.map +1 -0
- package/dist/src/actions/passkeys.test.js +54 -0
- package/dist/src/actions/recovery.d.ts +33 -0
- package/dist/src/actions/recovery.d.ts.map +1 -0
- package/dist/src/actions/recovery.js +193 -0
- package/dist/src/actions/recovery.test.d.ts +2 -0
- package/dist/src/actions/recovery.test.d.ts.map +1 -0
- package/dist/src/actions/recovery.test.js +168 -0
- package/dist/src/actions/smart-session.d.ts +6 -0
- package/dist/src/actions/smart-session.d.ts.map +1 -1
- package/dist/src/actions/smart-session.js +6 -0
- package/dist/src/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 +150 -7
- package/dist/src/execution/compact.d.ts.map +1 -1
- package/dist/src/execution/compact.js +112 -95
- 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 +34 -22
- package/dist/src/execution/index.d.ts.map +1 -1
- package/dist/src/execution/index.js +62 -42
- 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 -27
- package/dist/src/execution/utils.d.ts.map +1 -1
- package/dist/src/execution/utils.js +357 -103
- package/dist/src/index.d.ts +41 -22
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +199 -65
- 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 +4 -18
- package/dist/src/modules/index.d.ts.map +1 -1
- package/dist/src/modules/index.js +15 -63
- package/dist/src/modules/index.test.js +9 -26
- 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/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 +64 -41
- package/dist/src/modules/validators/core.test.js +7 -7
- package/dist/src/modules/validators/smart-sessions.js +3 -3
- package/dist/src/modules/validators/smart-sessions.test.js +4 -7
- package/dist/src/orchestrator/client.d.ts +4 -4
- package/dist/src/orchestrator/client.d.ts.map +1 -1
- package/dist/src/orchestrator/client.js +30 -15
- package/dist/src/orchestrator/index.d.ts +2 -3
- package/dist/src/orchestrator/index.d.ts.map +1 -1
- package/dist/src/orchestrator/index.js +1 -3
- 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 +37 -33
- package/dist/src/orchestrator/registry.test.js +7 -7
- package/dist/src/orchestrator/types.d.ts +97 -29
- package/dist/src/orchestrator/types.d.ts.map +1 -1
- package/dist/src/orchestrator/utils.d.ts +1 -3
- package/dist/src/orchestrator/utils.d.ts.map +1 -1
- package/dist/src/orchestrator/utils.js +0 -102
- package/dist/src/types.d.ts +74 -10
- package/dist/src/types.d.ts.map +1 -1
- package/package.json +72 -1
- 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/{actions → accounts/json-rpc}/index.test.d.ts +0 -0
package/dist/src/index.d.ts
CHANGED
|
@@ -1,39 +1,58 @@
|
|
|
1
|
-
import type { Address, Chain, Hex } from 'viem';
|
|
1
|
+
import type { Address, Chain, HashTypedDataParameters, Hex, SignableMessage, SignedAuthorizationList, TypedData } from 'viem';
|
|
2
2
|
import type { UserOperationReceipt } from 'viem/account-abstraction';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import type
|
|
7
|
-
import { ExecutionError, IntentFailedError, isExecutionError, OrderPathRequiredForIntentsError, SessionChainRequiredError, SourceChainsNotAvailableForUserOpFlowError, UserOperationRequiredForSmartSessionsError } from './execution';
|
|
3
|
+
import { walletClientToAccount } from './accounts/walletClient';
|
|
4
|
+
import { encodeSmartSessionSignature } from './actions/smart-session';
|
|
5
|
+
import { type TransactionResult, type TransactionStatus, type UserOperationResult } from './execution';
|
|
6
|
+
import { type BatchPermit2Result, checkERC20AllowanceDirect, getPermit2Address, type MultiChainPermit2Config, type MultiChainPermit2Result, signPermit2Batch, signPermit2Sequential } from './execution/permit2';
|
|
8
7
|
import { type SessionDetails } from './execution/smart-session';
|
|
9
|
-
import { type
|
|
10
|
-
import {
|
|
11
|
-
import type { Call, RhinestoneAccountConfig, Session, Transaction } from './types';
|
|
8
|
+
import { type IntentRoute, type PreparedTransactionData, type PreparedUserOperationData, type SignedTransactionData, type SignedUserOperationData } from './execution/utils';
|
|
9
|
+
import { getSupportedTokens, getTokenAddress, type IntentCost, type IntentInput, type IntentOp, type IntentOpStatus, type Portfolio, type SettlementSystem, type SignedIntentOp } from './orchestrator';
|
|
10
|
+
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';
|
|
12
11
|
interface RhinestoneAccount {
|
|
13
12
|
config: RhinestoneAccountConfig;
|
|
14
|
-
deploy: (chain: Chain, session?: Session) => Promise<
|
|
13
|
+
deploy: (chain: Chain, session?: Session) => Promise<boolean>;
|
|
14
|
+
isDeployed: (chain: Chain) => Promise<boolean>;
|
|
15
|
+
setup: (chain: Chain) => Promise<boolean>;
|
|
16
|
+
signEip7702InitData: () => Promise<Hex>;
|
|
15
17
|
prepareTransaction: (transaction: Transaction) => Promise<PreparedTransactionData>;
|
|
16
18
|
signTransaction: (preparedTransaction: PreparedTransactionData) => Promise<SignedTransactionData>;
|
|
17
|
-
|
|
19
|
+
signAuthorizations: (preparedTransaction: PreparedTransactionData) => Promise<SignedAuthorizationList>;
|
|
20
|
+
signMessage: (message: SignableMessage, chain: Chain, signers: SignerSet | undefined) => Promise<Hex>;
|
|
21
|
+
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>;
|
|
22
|
+
submitTransaction: (signedTransaction: SignedTransactionData, authorizations?: SignedAuthorizationList) => Promise<TransactionResult>;
|
|
18
23
|
sendTransaction: (transaction: Transaction) => Promise<TransactionResult>;
|
|
19
|
-
|
|
24
|
+
prepareUserOperation: (transaction: UserOperationTransaction) => Promise<PreparedUserOperationData>;
|
|
25
|
+
signUserOperation: (preparedUserOperation: PreparedUserOperationData) => Promise<SignedUserOperationData>;
|
|
26
|
+
submitUserOperation: (signedUserOperation: SignedUserOperationData) => Promise<UserOperationResult>;
|
|
27
|
+
sendUserOperation: (transaction: UserOperationTransaction) => Promise<UserOperationResult>;
|
|
28
|
+
waitForExecution(result: TransactionResult, acceptsPreconfirmations?: boolean): Promise<TransactionStatus>;
|
|
29
|
+
waitForExecution(result: UserOperationResult, acceptsPreconfirmations?: boolean): Promise<UserOperationReceipt>;
|
|
20
30
|
getAddress: () => Address;
|
|
21
31
|
getPortfolio: (onTestnets?: boolean) => Promise<Portfolio>;
|
|
22
|
-
getMaxSpendableAmount: (chain: Chain, tokenAddress: Address, gasUnits: bigint) => Promise<bigint>;
|
|
32
|
+
getMaxSpendableAmount: (chain: Chain, tokenAddress: Address, gasUnits: bigint, sponsored?: boolean) => Promise<bigint>;
|
|
23
33
|
getSessionDetails: (sessions: Session[], sessionIndex: number, signature?: Hex) => Promise<SessionDetails>;
|
|
24
34
|
getOwners: (chain: Chain) => Promise<{
|
|
25
35
|
accounts: Address[];
|
|
26
36
|
threshold: number;
|
|
27
37
|
} | null>;
|
|
28
38
|
getValidators: (chain: Chain) => Promise<Address[]>;
|
|
39
|
+
checkERC20Allowance: (tokenAddress: Address, chain: Chain) => Promise<bigint>;
|
|
29
40
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
41
|
+
declare class RhinestoneSDK {
|
|
42
|
+
private apiKey?;
|
|
43
|
+
private endpointUrl?;
|
|
44
|
+
private provider?;
|
|
45
|
+
private bundler?;
|
|
46
|
+
private paymaster?;
|
|
47
|
+
constructor(options?: {
|
|
48
|
+
apiKey?: string;
|
|
49
|
+
endpointUrl?: string;
|
|
50
|
+
provider?: ProviderConfig;
|
|
51
|
+
bundler?: BundlerConfig;
|
|
52
|
+
paymaster?: PaymasterConfig;
|
|
53
|
+
});
|
|
54
|
+
createAccount(config: RhinestoneAccountConfig): Promise<RhinestoneAccount>;
|
|
55
|
+
}
|
|
56
|
+
export { RhinestoneSDK, walletClientToAccount, encodeSmartSessionSignature, getSupportedTokens, getTokenAddress, checkERC20AllowanceDirect, getPermit2Address, signPermit2Batch, signPermit2Sequential, };
|
|
57
|
+
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, };
|
|
39
58
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EACP,KAAK,EACL,uBAAuB,EACvB,GAAG,EACH,eAAe,EACf,uBAAuB,EACvB,SAAS,EACV,MAAM,MAAM,CAAA;AACb,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAA;AAUpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AAC/D,OAAO,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAA;AACrE,OAAO,EAKL,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EAEzB,MAAM,aAAa,CAAA;AACpB,OAAO,EACL,KAAK,kBAAkB,EACvB,yBAAyB,EAEzB,iBAAiB,EACjB,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC5B,gBAAgB,EAChB,qBAAqB,EACtB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAEL,KAAK,cAAc,EACpB,MAAM,2BAA2B,CAAA;AAClC,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,uBAAuB,EAC5B,KAAK,yBAAyB,EAG9B,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAQ7B,MAAM,mBAAmB,CAAA;AAK1B,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,QAAQ,EACb,KAAK,cAAc,EACnB,KAAK,SAAS,EACd,KAAK,gBA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e,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"}
|
package/dist/src/index.js
CHANGED
|
@@ -1,60 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.createRhinestoneAccount = createRhinestoneAccount;
|
|
3
|
+
exports.signPermit2Sequential = exports.signPermit2Batch = exports.getPermit2Address = exports.checkERC20AllowanceDirect = exports.getTokenAddress = exports.getSupportedTokens = exports.encodeSmartSessionSignature = exports.walletClientToAccount = exports.RhinestoneSDK = void 0;
|
|
5
4
|
const accounts_1 = require("./accounts");
|
|
6
|
-
|
|
7
|
-
Object.defineProperty(exports, "
|
|
8
|
-
|
|
9
|
-
Object.defineProperty(exports, "
|
|
10
|
-
Object.defineProperty(exports, "FactoryArgsNotAvailableError", { enumerable: true, get: function () { return accounts_1.FactoryArgsNotAvailableError; } });
|
|
11
|
-
Object.defineProperty(exports, "isAccountError", { enumerable: true, get: function () { return accounts_1.isAccountError; } });
|
|
12
|
-
Object.defineProperty(exports, "SigningNotSupportedForAccountError", { enumerable: true, get: function () { return accounts_1.SigningNotSupportedForAccountError; } });
|
|
13
|
-
Object.defineProperty(exports, "SignMessageNotSupportedByAccountError", { enumerable: true, get: function () { return accounts_1.SignMessageNotSupportedByAccountError; } });
|
|
14
|
-
Object.defineProperty(exports, "SmartSessionsNotEnabledError", { enumerable: true, get: function () { return accounts_1.SmartSessionsNotEnabledError; } });
|
|
15
|
-
const utils_1 = require("./accounts/utils");
|
|
16
|
-
Object.defineProperty(exports, "createTransport", { enumerable: true, get: function () { return utils_1.createTransport; } });
|
|
17
|
-
const actions_1 = require("./actions");
|
|
18
|
-
Object.defineProperty(exports, "addOwner", { enumerable: true, get: function () { return actions_1.addOwner; } });
|
|
19
|
-
Object.defineProperty(exports, "changeMultiFactorThreshold", { enumerable: true, get: function () { return actions_1.changeMultiFactorThreshold; } });
|
|
20
|
-
Object.defineProperty(exports, "changeThreshold", { enumerable: true, get: function () { return actions_1.changeThreshold; } });
|
|
21
|
-
Object.defineProperty(exports, "disableEcdsa", { enumerable: true, get: function () { return actions_1.disableEcdsa; } });
|
|
22
|
-
Object.defineProperty(exports, "disableMultiFactor", { enumerable: true, get: function () { return actions_1.disableMultiFactor; } });
|
|
23
|
-
Object.defineProperty(exports, "disablePasskeys", { enumerable: true, get: function () { return actions_1.disablePasskeys; } });
|
|
24
|
-
Object.defineProperty(exports, "enableEcdsa", { enumerable: true, get: function () { return actions_1.enableEcdsa; } });
|
|
25
|
-
Object.defineProperty(exports, "enableMultiFactor", { enumerable: true, get: function () { return actions_1.enableMultiFactor; } });
|
|
26
|
-
Object.defineProperty(exports, "enablePasskeys", { enumerable: true, get: function () { return actions_1.enablePasskeys; } });
|
|
27
|
-
Object.defineProperty(exports, "encodeSmartSessionSignature", { enumerable: true, get: function () { return actions_1.encodeSmartSessionSignature; } });
|
|
28
|
-
Object.defineProperty(exports, "recover", { enumerable: true, get: function () { return actions_1.recover; } });
|
|
29
|
-
Object.defineProperty(exports, "removeOwner", { enumerable: true, get: function () { return actions_1.removeOwner; } });
|
|
30
|
-
Object.defineProperty(exports, "removeSubValidator", { enumerable: true, get: function () { return actions_1.removeSubValidator; } });
|
|
31
|
-
Object.defineProperty(exports, "setSubValidator", { enumerable: true, get: function () { return actions_1.setSubValidator; } });
|
|
32
|
-
Object.defineProperty(exports, "setUpRecovery", { enumerable: true, get: function () { return actions_1.setUpRecovery; } });
|
|
5
|
+
const walletClient_1 = require("./accounts/walletClient");
|
|
6
|
+
Object.defineProperty(exports, "walletClientToAccount", { enumerable: true, get: function () { return walletClient_1.walletClientToAccount; } });
|
|
7
|
+
const smart_session_1 = require("./actions/smart-session");
|
|
8
|
+
Object.defineProperty(exports, "encodeSmartSessionSignature", { enumerable: true, get: function () { return smart_session_1.encodeSmartSessionSignature; } });
|
|
33
9
|
const execution_1 = require("./execution");
|
|
34
|
-
|
|
35
|
-
Object.defineProperty(exports, "
|
|
36
|
-
Object.defineProperty(exports, "
|
|
37
|
-
Object.defineProperty(exports, "
|
|
38
|
-
Object.defineProperty(exports, "
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
const smart_session_1 = require("./execution/smart-session");
|
|
42
|
-
const utils_2 = require("./execution/utils");
|
|
10
|
+
const permit2_1 = require("./execution/permit2");
|
|
11
|
+
Object.defineProperty(exports, "checkERC20AllowanceDirect", { enumerable: true, get: function () { return permit2_1.checkERC20AllowanceDirect; } });
|
|
12
|
+
Object.defineProperty(exports, "getPermit2Address", { enumerable: true, get: function () { return permit2_1.getPermit2Address; } });
|
|
13
|
+
Object.defineProperty(exports, "signPermit2Batch", { enumerable: true, get: function () { return permit2_1.signPermit2Batch; } });
|
|
14
|
+
Object.defineProperty(exports, "signPermit2Sequential", { enumerable: true, get: function () { return permit2_1.signPermit2Sequential; } });
|
|
15
|
+
const smart_session_2 = require("./execution/smart-session");
|
|
16
|
+
const utils_1 = require("./execution/utils");
|
|
43
17
|
const modules_1 = require("./modules");
|
|
44
18
|
const orchestrator_1 = require("./orchestrator");
|
|
45
|
-
Object.defineProperty(exports, "
|
|
46
|
-
Object.defineProperty(exports, "
|
|
47
|
-
Object.defineProperty(exports, "IntentNotFoundError", { enumerable: true, get: function () { return orchestrator_1.IntentNotFoundError; } });
|
|
48
|
-
Object.defineProperty(exports, "InvalidApiKeyError", { enumerable: true, get: function () { return orchestrator_1.InvalidApiKeyError; } });
|
|
49
|
-
Object.defineProperty(exports, "InvalidIntentSignatureError", { enumerable: true, get: function () { return orchestrator_1.InvalidIntentSignatureError; } });
|
|
50
|
-
Object.defineProperty(exports, "isOrchestratorError", { enumerable: true, get: function () { return orchestrator_1.isOrchestratorError; } });
|
|
51
|
-
Object.defineProperty(exports, "NoPathFoundError", { enumerable: true, get: function () { return orchestrator_1.NoPathFoundError; } });
|
|
52
|
-
Object.defineProperty(exports, "OnlyOneTargetTokenAmountCanBeUnsetError", { enumerable: true, get: function () { return orchestrator_1.OnlyOneTargetTokenAmountCanBeUnsetError; } });
|
|
53
|
-
Object.defineProperty(exports, "OrchestratorError", { enumerable: true, get: function () { return orchestrator_1.OrchestratorError; } });
|
|
54
|
-
Object.defineProperty(exports, "TokenNotSupportedError", { enumerable: true, get: function () { return orchestrator_1.TokenNotSupportedError; } });
|
|
55
|
-
Object.defineProperty(exports, "UnsupportedChainError", { enumerable: true, get: function () { return orchestrator_1.UnsupportedChainError; } });
|
|
56
|
-
Object.defineProperty(exports, "UnsupportedChainIdError", { enumerable: true, get: function () { return orchestrator_1.UnsupportedChainIdError; } });
|
|
57
|
-
Object.defineProperty(exports, "UnsupportedTokenError", { enumerable: true, get: function () { return orchestrator_1.UnsupportedTokenError; } });
|
|
19
|
+
Object.defineProperty(exports, "getSupportedTokens", { enumerable: true, get: function () { return orchestrator_1.getSupportedTokens; } });
|
|
20
|
+
Object.defineProperty(exports, "getTokenAddress", { enumerable: true, get: function () { return orchestrator_1.getTokenAddress; } });
|
|
58
21
|
/**
|
|
59
22
|
* Initialize a Rhinestone account
|
|
60
23
|
* Note: accounts are deployed onchain only when the first transaction is sent.
|
|
@@ -62,32 +25,144 @@ Object.defineProperty(exports, "UnsupportedTokenError", { enumerable: true, get:
|
|
|
62
25
|
* @returns account
|
|
63
26
|
*/
|
|
64
27
|
async function createRhinestoneAccount(config) {
|
|
28
|
+
// Sanity check for existing (externally created) accounts
|
|
29
|
+
// Ensures we decode the initdata correctly
|
|
30
|
+
(0, accounts_1.checkAddress)(config);
|
|
31
|
+
// Validate that owners field is provided for non-EOA accounts
|
|
32
|
+
if (config.account?.type !== 'eoa' && !config.owners) {
|
|
33
|
+
throw new accounts_1.OwnersFieldRequiredError();
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Deploys the account on a given chain
|
|
37
|
+
* @param chain Chain to deploy the account on
|
|
38
|
+
* @param session Session to deploy the account on (optional)
|
|
39
|
+
*/
|
|
65
40
|
function deploy(chain, session) {
|
|
66
41
|
return (0, accounts_1.deploy)(config, chain, session);
|
|
67
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Checks if the account is deployed on a given chain
|
|
45
|
+
* @param chain Chain to check if the account is deployed on
|
|
46
|
+
* @returns true if the account is deployed, false otherwise
|
|
47
|
+
*/
|
|
48
|
+
function isDeployed(chain) {
|
|
49
|
+
return (0, accounts_1.isDeployed)(config, chain);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Sets up the existing account on a given chain
|
|
53
|
+
* by installing the missing modules (if any).
|
|
54
|
+
* @param chain Chain to set up the account on
|
|
55
|
+
*/
|
|
56
|
+
function setup(chain) {
|
|
57
|
+
return (0, accounts_1.setup)(config, chain);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Prepare and sign the EIP-7702 account initialization data
|
|
61
|
+
* @returns init data signature
|
|
62
|
+
*/
|
|
63
|
+
function signEip7702InitData() {
|
|
64
|
+
return (0, accounts_1.signEip7702InitData)(config);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Prepare a transaction data
|
|
68
|
+
* @param transaction Transaction to prepare
|
|
69
|
+
* @returns prepared transaction data
|
|
70
|
+
*/
|
|
68
71
|
function prepareTransaction(transaction) {
|
|
69
|
-
return (0,
|
|
72
|
+
return (0, utils_1.prepareTransaction)(config, transaction);
|
|
70
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* Sign a transaction
|
|
76
|
+
* @param preparedTransaction Prepared transaction data
|
|
77
|
+
* @returns signed transaction data
|
|
78
|
+
* @see {@link prepareTransaction} to prepare the transaction data for signing
|
|
79
|
+
*/
|
|
71
80
|
function signTransaction(preparedTransaction) {
|
|
72
|
-
return (0,
|
|
81
|
+
return (0, utils_1.signTransaction)(config, preparedTransaction);
|
|
73
82
|
}
|
|
74
|
-
|
|
75
|
-
|
|
83
|
+
/**
|
|
84
|
+
* Sign the required EIP-7702 authorizations for a transaction
|
|
85
|
+
* @param preparedTransaction Prepared transaction data
|
|
86
|
+
* @returns signed authorizations
|
|
87
|
+
* @see {@link prepareTransaction} to prepare the transaction data for signing
|
|
88
|
+
*/
|
|
89
|
+
function signAuthorizations(preparedTransaction) {
|
|
90
|
+
return (0, utils_1.signAuthorizations)(config, preparedTransaction);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Sign a message (EIP-191)
|
|
94
|
+
* @param message Message to sign
|
|
95
|
+
* @param chain Chain to sign the message on
|
|
96
|
+
* @param signers Signers to use for signing
|
|
97
|
+
* @returns signature
|
|
98
|
+
*/
|
|
99
|
+
function signMessage(message, chain, signers) {
|
|
100
|
+
return (0, utils_1.signMessage)(config, message, chain, signers);
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Sign a typed data (EIP-712)
|
|
104
|
+
* @param parameters Typed data parameters
|
|
105
|
+
* @param chain Chain to sign the typed data on
|
|
106
|
+
* @param signers Signers to use for signing
|
|
107
|
+
* @returns signature
|
|
108
|
+
*/
|
|
109
|
+
function signTypedData(parameters, chain, signers) {
|
|
110
|
+
return (0, utils_1.signTypedData)(config, parameters, chain, signers);
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Submit a transaction
|
|
114
|
+
* @param signedTransaction Signed transaction data
|
|
115
|
+
* @param authorizations EIP-7702 authorizations to submit (optional)
|
|
116
|
+
* @returns transaction result object (a UserOp hash)
|
|
117
|
+
* @see {@link signTransaction} to sign the transaction data
|
|
118
|
+
* @see {@link signAuthorizations} to sign the required EIP-7702 authorizations
|
|
119
|
+
* @see {@link dryRun} true when intent is not executed onchain (internal use only)
|
|
120
|
+
*/
|
|
121
|
+
function submitTransaction(signedTransaction, authorizations, dryRun) {
|
|
122
|
+
return (0, utils_1.submitTransaction)(config, signedTransaction, authorizations ?? [], dryRun);
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Prepare a user operation data
|
|
126
|
+
* @param transaction User operation to prepare
|
|
127
|
+
* @returns prepared user operation data
|
|
128
|
+
*/
|
|
129
|
+
function prepareUserOperation(transaction) {
|
|
130
|
+
return (0, utils_1.prepareUserOperation)(config, transaction);
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Sign a user operation
|
|
134
|
+
* @param preparedUserOperation Prepared user operation data
|
|
135
|
+
* @returns signed user operation data
|
|
136
|
+
* @see {@link prepareUserOperation} to prepare the user operation data for signing
|
|
137
|
+
*/
|
|
138
|
+
function signUserOperation(preparedUserOperation) {
|
|
139
|
+
return (0, utils_1.signUserOperation)(config, preparedUserOperation);
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Submit a transaction
|
|
143
|
+
* @param signedTransaction Signed transaction data
|
|
144
|
+
* @returns transaction result object (a UserOp hash)
|
|
145
|
+
* @see {@link signUserOperation} to sign the user operation data
|
|
146
|
+
*/
|
|
147
|
+
function submitUserOperation(signedUserOperation) {
|
|
148
|
+
return (0, utils_1.submitUserOperation)(config, signedUserOperation);
|
|
76
149
|
}
|
|
77
150
|
/**
|
|
78
151
|
* Sign and send a transaction
|
|
79
152
|
* @param transaction Transaction to send
|
|
80
|
-
* @returns transaction result object (an intent ID
|
|
153
|
+
* @returns transaction result object (an intent ID)
|
|
81
154
|
*/
|
|
82
155
|
function sendTransaction(transaction) {
|
|
83
156
|
return (0, execution_1.sendTransaction)(config, transaction);
|
|
84
157
|
}
|
|
85
158
|
/**
|
|
86
|
-
*
|
|
87
|
-
* @param
|
|
88
|
-
* @
|
|
89
|
-
* @returns intent result or a UserOp receipt
|
|
159
|
+
* Sign and send a user operation
|
|
160
|
+
* @param transaction User operation to send
|
|
161
|
+
* @returns user operation result object (a UserOp hash)
|
|
90
162
|
*/
|
|
163
|
+
function sendUserOperation(transaction) {
|
|
164
|
+
return (0, execution_1.sendUserOperation)(config, transaction);
|
|
165
|
+
}
|
|
91
166
|
function waitForExecution(result, acceptsPreconfirmations = true) {
|
|
92
167
|
return (0, execution_1.waitForExecution)(config, result, acceptsPreconfirmations);
|
|
93
168
|
}
|
|
@@ -113,28 +188,60 @@ async function createRhinestoneAccount(config) {
|
|
|
113
188
|
* @param gasUnits Gas cost estimate for the transaction execution
|
|
114
189
|
* @returns Maximum spendable amount in absolute units
|
|
115
190
|
*/
|
|
116
|
-
function getMaxSpendableAmount(chain, tokenAddress, gasUnits) {
|
|
117
|
-
return (0, execution_1.getMaxSpendableAmount)(config, chain, tokenAddress, gasUnits);
|
|
118
|
-
}
|
|
119
|
-
function getSessionDetails(sessions, sessionIndex, signature) {
|
|
120
|
-
return (0, smart_session_1.getSessionDetails)(config, sessions, sessionIndex, signature);
|
|
191
|
+
function getMaxSpendableAmount(chain, tokenAddress, gasUnits, sponsored = false) {
|
|
192
|
+
return (0, execution_1.getMaxSpendableAmount)(config, chain, tokenAddress, gasUnits, sponsored);
|
|
121
193
|
}
|
|
194
|
+
/**
|
|
195
|
+
* Get account owners (ECDSA)
|
|
196
|
+
* @param chain Chain to get the owners on
|
|
197
|
+
* @returns Account owners
|
|
198
|
+
*/
|
|
122
199
|
function getOwners(chain) {
|
|
123
200
|
const account = getAddress();
|
|
124
201
|
return (0, modules_1.getOwners)(account, chain, config.provider);
|
|
125
202
|
}
|
|
203
|
+
/**
|
|
204
|
+
* Get account validator modules
|
|
205
|
+
* @param chain Chain to get the validators on
|
|
206
|
+
* @returns List of account validators
|
|
207
|
+
*/
|
|
126
208
|
function getValidators(chain) {
|
|
127
209
|
const accountType = config.account?.type || 'nexus';
|
|
128
210
|
const account = getAddress();
|
|
129
211
|
return (0, modules_1.getValidators)(accountType, account, chain, config.provider);
|
|
130
212
|
}
|
|
213
|
+
function getSessionDetails(sessions, sessionIndex, signature) {
|
|
214
|
+
return (0, smart_session_2.getSessionDetails)(config, sessions, sessionIndex, signature);
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Check ERC20 allowance for the account owner and token (using Permit2 as spender)
|
|
218
|
+
* @param tokenAddress The token contract address
|
|
219
|
+
* @param chain The chain to check the allowance on
|
|
220
|
+
* @returns The allowance amount
|
|
221
|
+
*/
|
|
222
|
+
function checkERC20Allowance(tokenAddress, chain) {
|
|
223
|
+
if (!config.provider) {
|
|
224
|
+
throw new Error('Provider configuration is required');
|
|
225
|
+
}
|
|
226
|
+
return (0, permit2_1.checkERC20Allowance)(tokenAddress, chain, config);
|
|
227
|
+
}
|
|
131
228
|
return {
|
|
132
229
|
config,
|
|
133
230
|
deploy,
|
|
231
|
+
isDeployed,
|
|
232
|
+
setup,
|
|
233
|
+
signEip7702InitData,
|
|
134
234
|
prepareTransaction,
|
|
135
235
|
signTransaction,
|
|
236
|
+
signAuthorizations,
|
|
237
|
+
signMessage,
|
|
238
|
+
signTypedData,
|
|
136
239
|
submitTransaction,
|
|
240
|
+
prepareUserOperation,
|
|
241
|
+
signUserOperation,
|
|
242
|
+
submitUserOperation,
|
|
137
243
|
sendTransaction,
|
|
244
|
+
sendUserOperation,
|
|
138
245
|
waitForExecution,
|
|
139
246
|
getAddress,
|
|
140
247
|
getPortfolio,
|
|
@@ -142,5 +249,32 @@ async function createRhinestoneAccount(config) {
|
|
|
142
249
|
getSessionDetails,
|
|
143
250
|
getOwners,
|
|
144
251
|
getValidators,
|
|
252
|
+
checkERC20Allowance,
|
|
145
253
|
};
|
|
146
254
|
}
|
|
255
|
+
class RhinestoneSDK {
|
|
256
|
+
apiKey;
|
|
257
|
+
endpointUrl;
|
|
258
|
+
provider;
|
|
259
|
+
bundler;
|
|
260
|
+
paymaster;
|
|
261
|
+
constructor(options) {
|
|
262
|
+
this.apiKey = options?.apiKey;
|
|
263
|
+
this.endpointUrl = options?.endpointUrl;
|
|
264
|
+
this.provider = options?.provider;
|
|
265
|
+
this.bundler = options?.bundler;
|
|
266
|
+
this.paymaster = options?.paymaster;
|
|
267
|
+
}
|
|
268
|
+
createAccount(config) {
|
|
269
|
+
const rhinestoneConfig = {
|
|
270
|
+
...config,
|
|
271
|
+
apiKey: this.apiKey,
|
|
272
|
+
endpointUrl: this.endpointUrl,
|
|
273
|
+
provider: this.provider,
|
|
274
|
+
bundler: this.bundler,
|
|
275
|
+
paymaster: this.paymaster,
|
|
276
|
+
};
|
|
277
|
+
return createRhinestoneAccount(rhinestoneConfig);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
exports.RhinestoneSDK = RhinestoneSDK;
|
|
@@ -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,23 +1,9 @@
|
|
|
1
|
-
import { type Chain
|
|
2
|
-
import type { RhinestoneAccountConfig } from '../types';
|
|
1
|
+
import { type Chain } from 'viem';
|
|
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';
|
|
6
6
|
import { getOwnerValidator } from './validators';
|
|
7
|
-
interface WebAuthnData {
|
|
8
|
-
authenticatorData: Hex;
|
|
9
|
-
clientDataJSON: string;
|
|
10
|
-
typeIndex: number | bigint;
|
|
11
|
-
}
|
|
12
|
-
interface WebauthnValidatorSignature {
|
|
13
|
-
webauthn: WebAuthnData;
|
|
14
|
-
signature: WebauthnSignature | Hex | Uint8Array;
|
|
15
|
-
usePrecompiled?: boolean;
|
|
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,7 @@ interface ModeleSetup {
|
|
|
25
11
|
hooks: Module[];
|
|
26
12
|
}
|
|
27
13
|
declare function getSetup(config: RhinestoneAccountConfig): ModeleSetup;
|
|
28
|
-
declare function
|
|
14
|
+
declare function getIntentExecutor(config: RhinestoneConfig): Module;
|
|
29
15
|
declare function isRip7212SupportedNetwork(chain: Chain): boolean;
|
|
30
|
-
export { HOOK_ADDRESS, getSetup, getOwnerValidator,
|
|
16
|
+
export { HOOK_ADDRESS, getSetup, getOwnerValidator, getOwners, getIntentExecutor, getValidators, isRip7212SupportedNetwork, };
|
|
31
17
|
//# 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,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"}
|