@rhinestone/sdk 1.0.41-alpha.0 → 1.0.41
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 +114 -0
- package/dist/src/accounts/error.d.ts.map +1 -0
- package/dist/src/accounts/error.js +174 -0
- package/dist/src/accounts/index.d.ts +50 -0
- package/dist/src/accounts/index.d.ts.map +1 -0
- package/dist/src/accounts/index.js +669 -0
- package/dist/src/accounts/index.test.d.ts +2 -0
- package/dist/src/accounts/index.test.d.ts.map +1 -0
- package/dist/src/accounts/index.test.js +33 -0
- 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 +20 -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 +33 -0
- package/dist/src/accounts/json-rpc/providers.d.ts +5 -0
- package/dist/src/accounts/json-rpc/providers.d.ts.map +1 -0
- package/dist/src/accounts/json-rpc/providers.js +22 -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 +43 -0
- package/dist/src/accounts/kernel.d.ts +29 -0
- package/dist/src/accounts/kernel.d.ts.map +1 -0
- package/dist/src/accounts/kernel.js +297 -0
- package/dist/src/accounts/kernel.test.d.ts +2 -0
- package/dist/src/accounts/kernel.test.d.ts.map +1 -0
- package/dist/src/accounts/kernel.test.js +132 -0
- package/dist/src/accounts/nexus.d.ts +35 -0
- package/dist/src/accounts/nexus.d.ts.map +1 -0
- package/dist/src/accounts/nexus.js +471 -0
- package/dist/src/accounts/nexus.test.d.ts +2 -0
- package/dist/src/accounts/nexus.test.d.ts.map +1 -0
- package/dist/src/accounts/nexus.test.js +118 -0
- package/dist/src/accounts/passport.d.ts +12 -0
- package/dist/src/accounts/passport.d.ts.map +1 -0
- package/dist/src/accounts/passport.js +173 -0
- package/dist/src/accounts/safe.d.ts +35 -0
- package/dist/src/accounts/safe.d.ts.map +1 -0
- package/dist/src/accounts/safe.js +365 -0
- package/dist/src/accounts/safe.test.d.ts +2 -0
- package/dist/src/accounts/safe.test.d.ts.map +1 -0
- package/dist/src/accounts/safe.test.js +118 -0
- 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 +183 -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 +27 -0
- package/dist/src/accounts/startale.d.ts.map +1 -0
- package/dist/src/accounts/startale.js +116 -0
- package/dist/src/accounts/startale.test.d.ts +2 -0
- package/dist/src/accounts/startale.test.d.ts.map +1 -0
- package/dist/src/accounts/startale.test.js +92 -0
- package/dist/src/accounts/utils.d.ts +33 -0
- package/dist/src/accounts/utils.d.ts.map +1 -0
- package/dist/src/accounts/utils.js +208 -0
- package/dist/src/accounts/utils.test.d.ts +2 -0
- package/dist/src/accounts/utils.test.d.ts.map +1 -0
- package/dist/src/accounts/utils.test.js +49 -0
- package/dist/src/accounts/walletClient.d.ts +34 -0
- package/dist/src/accounts/walletClient.d.ts.map +1 -0
- package/dist/src/accounts/walletClient.js +121 -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/deployment.d.ts +19 -0
- package/dist/src/actions/deployment.d.ts.map +1 -0
- package/dist/src/actions/deployment.js +78 -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 +17 -0
- package/dist/src/actions/index.d.ts.map +1 -0
- package/dist/src/actions/index.js +53 -0
- 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-sessions.d.ts +14 -0
- package/dist/src/actions/smart-sessions.d.ts.map +1 -0
- package/dist/src/actions/smart-sessions.js +16 -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 +53 -0
- package/dist/src/execution/compact.d.ts +151 -0
- package/dist/src/execution/compact.d.ts.map +1 -0
- package/dist/src/execution/compact.js +122 -0
- package/dist/src/execution/error.d.ts +61 -0
- package/dist/src/execution/error.d.ts.map +1 -0
- package/dist/src/execution/error.js +87 -0
- package/dist/src/execution/index.d.ts +41 -0
- package/dist/src/execution/index.d.ts.map +1 -0
- package/dist/src/execution/index.js +233 -0
- 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 +291 -0
- package/dist/src/execution/singleChainOps.d.ts +28 -0
- package/dist/src/execution/singleChainOps.d.ts.map +1 -0
- package/dist/src/execution/singleChainOps.js +32 -0
- package/dist/src/execution/smart-session.d.ts +13 -0
- package/dist/src/execution/smart-session.d.ts.map +1 -0
- package/dist/src/execution/smart-session.js +178 -0
- package/dist/src/execution/types.d.ts +36 -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 +83 -0
- package/dist/src/execution/utils.d.ts.map +1 -0
- package/dist/src/execution/utils.js +705 -0
- package/dist/src/index.d.ts +74 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +317 -0
- package/dist/src/modules/abi/smart-sessions.d.ts +104 -0
- package/dist/src/modules/abi/smart-sessions.d.ts.map +1 -0
- package/dist/src/modules/abi/smart-sessions.js +131 -0
- package/dist/src/modules/chain-abstraction.d.ts +5 -0
- package/dist/src/modules/chain-abstraction.d.ts.map +1 -0
- package/dist/src/modules/chain-abstraction.js +7 -0
- package/dist/src/modules/common.d.ts +30 -0
- package/dist/src/modules/common.d.ts.map +1 -0
- package/dist/src/modules/common.js +42 -0
- package/dist/src/modules/index.d.ts +10 -0
- package/dist/src/modules/index.d.ts.map +1 -0
- package/dist/src/modules/index.js +94 -0
- package/dist/src/modules/index.test.d.ts +2 -0
- package/dist/src/modules/index.test.d.ts.map +1 -0
- package/dist/src/modules/index.test.js +81 -0
- package/dist/src/modules/legacy.d.ts +10 -0
- package/dist/src/modules/legacy.d.ts.map +1 -0
- package/dist/src/modules/legacy.js +65 -0
- package/dist/src/modules/read.d.ts +9 -0
- package/dist/src/modules/read.d.ts.map +1 -0
- package/dist/src/modules/read.js +125 -0
- package/dist/src/modules/validators/core.d.ts +29 -0
- package/dist/src/modules/validators/core.d.ts.map +1 -0
- package/dist/src/modules/validators/core.js +278 -0
- package/dist/src/modules/validators/core.test.d.ts +2 -0
- package/dist/src/modules/validators/core.test.d.ts.map +1 -0
- package/dist/src/modules/validators/core.test.js +101 -0
- package/dist/src/modules/validators/index.d.ts +4 -0
- package/dist/src/modules/validators/index.d.ts.map +1 -0
- package/dist/src/modules/validators/index.js +15 -0
- package/dist/src/modules/validators/smart-sessions.d.ts +96 -0
- package/dist/src/modules/validators/smart-sessions.d.ts.map +1 -0
- package/dist/src/modules/validators/smart-sessions.js +497 -0
- package/dist/src/modules/validators/smart-sessions.test.d.ts +2 -0
- package/dist/src/modules/validators/smart-sessions.test.d.ts.map +1 -0
- package/dist/src/modules/validators/smart-sessions.test.js +219 -0
- package/dist/src/orchestrator/client.d.ts +27 -0
- package/dist/src/orchestrator/client.d.ts.map +1 -0
- package/dist/src/orchestrator/client.js +354 -0
- package/dist/src/orchestrator/consts.d.ts +5 -0
- package/dist/src/orchestrator/consts.d.ts.map +1 -0
- package/dist/src/orchestrator/consts.js +9 -0
- package/dist/src/orchestrator/error.d.ts +232 -0
- package/dist/src/orchestrator/error.d.ts.map +1 -0
- package/dist/src/orchestrator/error.js +268 -0
- package/dist/src/orchestrator/index.d.ts +10 -0
- package/dist/src/orchestrator/index.d.ts.map +1 -0
- package/dist/src/orchestrator/index.js +57 -0
- package/dist/src/orchestrator/registry.d.ts +22 -0
- package/dist/src/orchestrator/registry.d.ts.map +1 -0
- package/dist/src/orchestrator/registry.js +121 -0
- package/dist/src/orchestrator/registry.test.d.ts +2 -0
- package/dist/src/orchestrator/registry.test.d.ts.map +1 -0
- package/dist/src/orchestrator/registry.test.js +150 -0
- package/dist/src/orchestrator/types.d.ts +295 -0
- package/dist/src/orchestrator/types.d.ts.map +1 -0
- package/dist/src/orchestrator/types.js +17 -0
- package/dist/src/orchestrator/utils.d.ts +3 -0
- package/dist/src/orchestrator/utils.d.ts.map +1 -0
- package/dist/src/orchestrator/utils.js +24 -0
- package/dist/src/types.d.ts +284 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +2 -0
- package/dist/src/utils/index.d.ts +26 -0
- package/dist/src/utils/index.d.ts.map +1 -0
- package/dist/src/utils/index.js +63 -0
- package/dist/test/consts.d.ts +10 -0
- package/dist/test/consts.d.ts.map +1 -0
- package/dist/test/consts.js +22 -0
- package/dist/test/utils/utils.d.ts +5 -0
- package/dist/test/utils/utils.d.ts.map +1 -0
- package/dist/test/utils/utils.js +20 -0
- package/package.json +1 -1
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { Address, Chain, HashTypedDataParameters, Hex, SignableMessage, SignedAuthorizationList, TypedData, TypedDataDefinition } from 'viem';
|
|
2
|
+
import type { UserOperationReceipt } from 'viem/account-abstraction';
|
|
3
|
+
import { walletClientToAccount, wrapParaAccount } from './accounts/walletClient';
|
|
4
|
+
import { deployAccountsForOwners } from './actions/deployment';
|
|
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';
|
|
7
|
+
import { type SessionDetails } from './execution/smart-session';
|
|
8
|
+
import { type IntentRoute, type PreparedTransactionData, type PreparedUserOperationData, type SignedTransactionData, type SignedUserOperationData } from './execution/utils';
|
|
9
|
+
import { type ApprovalRequired, getAllSupportedChainsAndTokens, getSupportedTokens, getTokenAddress, getTokenDecimals, type IntentCost, type IntentInput, type IntentOp, type IntentOpStatus, type Portfolio, type SettlementLayer, type SignedIntentOp, type TokenRequirements, type WrapRequired } from './orchestrator';
|
|
10
|
+
import type { AccountProviderConfig, AccountType, BundlerConfig, Call, CallInput, MultiFactorValidatorConfig, OwnableValidatorConfig, OwnerSet, PaymasterConfig, Policy, ProviderConfig, Recovery, RhinestoneAccountConfig, RhinestoneConfig, RhinestoneSDKConfig, Session, SignerSet, TokenRequest, TokenSymbol, Transaction, UniversalActionPolicyParamCondition, UserOperationTransaction, WebauthnValidatorConfig } from './types';
|
|
11
|
+
interface RhinestoneAccount {
|
|
12
|
+
config: RhinestoneAccountConfig;
|
|
13
|
+
deploy: (chain: Chain, params?: {
|
|
14
|
+
session?: Session;
|
|
15
|
+
sponsored?: boolean;
|
|
16
|
+
}) => Promise<boolean>;
|
|
17
|
+
isDeployed: (chain: Chain) => Promise<boolean>;
|
|
18
|
+
setup: (chain: Chain) => Promise<boolean>;
|
|
19
|
+
getInitData(): {
|
|
20
|
+
factory: Address;
|
|
21
|
+
factoryData: Hex;
|
|
22
|
+
};
|
|
23
|
+
signEip7702InitData: () => Promise<Hex>;
|
|
24
|
+
prepareTransaction: (transaction: Transaction) => Promise<PreparedTransactionData>;
|
|
25
|
+
getTransactionMessages: (preparedTransaction: PreparedTransactionData) => {
|
|
26
|
+
origin: TypedDataDefinition[];
|
|
27
|
+
destination: TypedDataDefinition;
|
|
28
|
+
};
|
|
29
|
+
signTransaction: (preparedTransaction: PreparedTransactionData) => Promise<SignedTransactionData>;
|
|
30
|
+
signAuthorizations: (preparedTransaction: PreparedTransactionData) => Promise<SignedAuthorizationList>;
|
|
31
|
+
signMessage: (message: SignableMessage, chain: Chain, signers: SignerSet | undefined) => Promise<Hex>;
|
|
32
|
+
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>;
|
|
33
|
+
submitTransaction: (signedTransaction: SignedTransactionData, authorizations?: SignedAuthorizationList, dryRun?: boolean) => Promise<TransactionResult>;
|
|
34
|
+
sendTransaction: (transaction: Transaction) => Promise<TransactionResult>;
|
|
35
|
+
prepareUserOperation: (transaction: UserOperationTransaction) => Promise<PreparedUserOperationData>;
|
|
36
|
+
signUserOperation: (preparedUserOperation: PreparedUserOperationData) => Promise<SignedUserOperationData>;
|
|
37
|
+
submitUserOperation: (signedUserOperation: SignedUserOperationData) => Promise<UserOperationResult>;
|
|
38
|
+
sendUserOperation: (transaction: UserOperationTransaction) => Promise<UserOperationResult>;
|
|
39
|
+
waitForExecution(result: TransactionResult, acceptsPreconfirmations?: boolean): Promise<TransactionStatus>;
|
|
40
|
+
waitForExecution(result: UserOperationResult, acceptsPreconfirmations?: boolean): Promise<UserOperationReceipt>;
|
|
41
|
+
getAddress: () => Address;
|
|
42
|
+
getPortfolio: (onTestnets?: boolean) => Promise<Portfolio>;
|
|
43
|
+
getMaxSpendableAmount: (chain: Chain, tokenAddress: Address | TokenSymbol, gasUnits: bigint, sponsored?: boolean) => Promise<bigint>;
|
|
44
|
+
getSessionDetails: (sessions: Session[], sessionIndex: number, initialNonces?: bigint[], signature?: Hex) => Promise<SessionDetails>;
|
|
45
|
+
getOwners: (chain: Chain) => Promise<{
|
|
46
|
+
accounts: Address[];
|
|
47
|
+
threshold: number;
|
|
48
|
+
} | null>;
|
|
49
|
+
getValidators: (chain: Chain) => Promise<Address[]>;
|
|
50
|
+
checkERC20Allowance: (tokenAddress: Address, chain: Chain) => Promise<bigint>;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Initialize a Rhinestone account
|
|
54
|
+
* Note: accounts are deployed onchain only when the first transaction is sent.
|
|
55
|
+
* @param config Account config (e.g. implementation vendor, owner signers, smart sessions)
|
|
56
|
+
* @returns account
|
|
57
|
+
*/
|
|
58
|
+
declare function createRhinestoneAccount(config: RhinestoneConfig): Promise<RhinestoneAccount>;
|
|
59
|
+
declare class RhinestoneSDK {
|
|
60
|
+
private apiKey?;
|
|
61
|
+
private endpointUrl?;
|
|
62
|
+
private provider?;
|
|
63
|
+
private bundler?;
|
|
64
|
+
private paymaster?;
|
|
65
|
+
private useDevContracts?;
|
|
66
|
+
constructor(options?: RhinestoneSDKConfig);
|
|
67
|
+
createAccount(config: RhinestoneAccountConfig): Promise<RhinestoneAccount>;
|
|
68
|
+
getIntentStatus(intentId: bigint): Promise<TransactionStatus & {
|
|
69
|
+
status: IntentOpStatus["status"];
|
|
70
|
+
}>;
|
|
71
|
+
}
|
|
72
|
+
export { RhinestoneSDK, createRhinestoneAccount, deployAccountsForOwners, walletClientToAccount, wrapParaAccount, getSupportedTokens, getTokenAddress, getTokenDecimals, getAllSupportedChainsAndTokens, checkERC20AllowanceDirect, getPermit2Address, signPermit2Batch, signPermit2Sequential, };
|
|
73
|
+
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, SettlementLayer, SignedIntentOp, Portfolio, TokenRequirements, WrapRequired, ApprovalRequired, MultiChainPermit2Config, MultiChainPermit2Result, BatchPermit2Result, };
|
|
74
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +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,mBAAmB,EACpB,MAAM,MAAM,CAAA;AACb,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAA;AAapE,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAChF,OAAO,EAAE,uBAAuB,EAAE,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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,eAAe,EACf,cAAc,EACd,SAAS,EACT,iBAAiB,EACjB,YAAY,EACZ,gBAAgB,EAEhB,uBAAuB,EACvB,uBAAuB,EACvB,kBAAkB,GACnB,CAAA"}
|
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.signPermit2Sequential = exports.signPermit2Batch = exports.getPermit2Address = exports.checkERC20AllowanceDirect = exports.getAllSupportedChainsAndTokens = exports.getTokenDecimals = exports.getTokenAddress = exports.getSupportedTokens = exports.wrapParaAccount = exports.walletClientToAccount = exports.deployAccountsForOwners = exports.RhinestoneSDK = void 0;
|
|
4
|
+
exports.createRhinestoneAccount = createRhinestoneAccount;
|
|
5
|
+
const accounts_1 = require("./accounts");
|
|
6
|
+
const walletClient_1 = require("./accounts/walletClient");
|
|
7
|
+
Object.defineProperty(exports, "walletClientToAccount", { enumerable: true, get: function () { return walletClient_1.walletClientToAccount; } });
|
|
8
|
+
Object.defineProperty(exports, "wrapParaAccount", { enumerable: true, get: function () { return walletClient_1.wrapParaAccount; } });
|
|
9
|
+
const deployment_1 = require("./actions/deployment");
|
|
10
|
+
Object.defineProperty(exports, "deployAccountsForOwners", { enumerable: true, get: function () { return deployment_1.deployAccountsForOwners; } });
|
|
11
|
+
const execution_1 = require("./execution");
|
|
12
|
+
const permit2_1 = require("./execution/permit2");
|
|
13
|
+
Object.defineProperty(exports, "checkERC20AllowanceDirect", { enumerable: true, get: function () { return permit2_1.checkERC20AllowanceDirect; } });
|
|
14
|
+
Object.defineProperty(exports, "getPermit2Address", { enumerable: true, get: function () { return permit2_1.getPermit2Address; } });
|
|
15
|
+
Object.defineProperty(exports, "signPermit2Batch", { enumerable: true, get: function () { return permit2_1.signPermit2Batch; } });
|
|
16
|
+
Object.defineProperty(exports, "signPermit2Sequential", { enumerable: true, get: function () { return permit2_1.signPermit2Sequential; } });
|
|
17
|
+
const smart_session_1 = require("./execution/smart-session");
|
|
18
|
+
const utils_1 = require("./execution/utils");
|
|
19
|
+
const modules_1 = require("./modules");
|
|
20
|
+
const orchestrator_1 = require("./orchestrator");
|
|
21
|
+
Object.defineProperty(exports, "getAllSupportedChainsAndTokens", { enumerable: true, get: function () { return orchestrator_1.getAllSupportedChainsAndTokens; } });
|
|
22
|
+
Object.defineProperty(exports, "getSupportedTokens", { enumerable: true, get: function () { return orchestrator_1.getSupportedTokens; } });
|
|
23
|
+
Object.defineProperty(exports, "getTokenAddress", { enumerable: true, get: function () { return orchestrator_1.getTokenAddress; } });
|
|
24
|
+
Object.defineProperty(exports, "getTokenDecimals", { enumerable: true, get: function () { return orchestrator_1.getTokenDecimals; } });
|
|
25
|
+
/**
|
|
26
|
+
* Initialize a Rhinestone account
|
|
27
|
+
* Note: accounts are deployed onchain only when the first transaction is sent.
|
|
28
|
+
* @param config Account config (e.g. implementation vendor, owner signers, smart sessions)
|
|
29
|
+
* @returns account
|
|
30
|
+
*/
|
|
31
|
+
async function createRhinestoneAccount(config) {
|
|
32
|
+
// Sanity check for existing (externally created) accounts
|
|
33
|
+
// Ensures we decode the initdata correctly
|
|
34
|
+
(0, accounts_1.checkAddress)(config);
|
|
35
|
+
// Validate that owners field is provided for non-EOA accounts
|
|
36
|
+
if (config.account?.type !== 'eoa' && !config.owners) {
|
|
37
|
+
throw new accounts_1.OwnersFieldRequiredError();
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Deploys the account on a given chain
|
|
41
|
+
* @param chain Chain to deploy the account on
|
|
42
|
+
* @param session Session to deploy the account on (optional)
|
|
43
|
+
*/
|
|
44
|
+
function deploy(chain, params) {
|
|
45
|
+
return (0, accounts_1.deploy)(config, chain, params);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Checks if the account is deployed on a given chain
|
|
49
|
+
* @param chain Chain to check if the account is deployed on
|
|
50
|
+
* @returns true if the account is deployed, false otherwise
|
|
51
|
+
*/
|
|
52
|
+
function isDeployed(chain) {
|
|
53
|
+
return (0, accounts_1.isDeployed)(config, chain);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Sets up the existing account on a given chain
|
|
57
|
+
* by installing the missing modules (if any).
|
|
58
|
+
* @param chain Chain to set up the account on
|
|
59
|
+
*/
|
|
60
|
+
function setup(chain) {
|
|
61
|
+
return (0, accounts_1.setup)(config, chain);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Get the account initialization data. Used for deploying the account onchain.
|
|
65
|
+
* @returns factory address and factory data
|
|
66
|
+
*/
|
|
67
|
+
function getInitData() {
|
|
68
|
+
const initData = (0, accounts_1.getInitCode)(config);
|
|
69
|
+
if (!initData) {
|
|
70
|
+
throw new accounts_1.FactoryArgsNotAvailableError();
|
|
71
|
+
}
|
|
72
|
+
if (!('factory' in initData)) {
|
|
73
|
+
throw new accounts_1.FactoryArgsNotAvailableError();
|
|
74
|
+
}
|
|
75
|
+
return {
|
|
76
|
+
factory: initData.factory,
|
|
77
|
+
factoryData: initData.factoryData,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Prepare and sign the EIP-7702 account initialization data
|
|
82
|
+
* @returns init data signature
|
|
83
|
+
*/
|
|
84
|
+
function signEip7702InitData() {
|
|
85
|
+
return (0, accounts_1.signEip7702InitData)(config);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Prepare a transaction data
|
|
89
|
+
* @param transaction Transaction to prepare
|
|
90
|
+
* @returns prepared transaction data
|
|
91
|
+
*/
|
|
92
|
+
function prepareTransaction(transaction) {
|
|
93
|
+
return (0, utils_1.prepareTransaction)(config, transaction);
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Get the transaction typed data message to sign
|
|
97
|
+
* @param preparedTransaction Prepared transaction data
|
|
98
|
+
* @see {@link prepareTransaction} to prepare the transaction data for signing
|
|
99
|
+
*/
|
|
100
|
+
function getTransactionMessages(preparedTransaction) {
|
|
101
|
+
return (0, utils_1.getTransactionMessages)(config, preparedTransaction);
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Sign a transaction
|
|
105
|
+
* @param preparedTransaction Prepared transaction data
|
|
106
|
+
* @returns signed transaction data
|
|
107
|
+
* @see {@link prepareTransaction} to prepare the transaction data for signing
|
|
108
|
+
*/
|
|
109
|
+
function signTransaction(preparedTransaction) {
|
|
110
|
+
return (0, utils_1.signTransaction)(config, preparedTransaction);
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Sign the required EIP-7702 authorizations for a transaction
|
|
114
|
+
* @param preparedTransaction Prepared transaction data
|
|
115
|
+
* @returns signed authorizations
|
|
116
|
+
* @see {@link prepareTransaction} to prepare the transaction data for signing
|
|
117
|
+
*/
|
|
118
|
+
function signAuthorizations(preparedTransaction) {
|
|
119
|
+
return (0, utils_1.signAuthorizations)(config, preparedTransaction);
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Sign a message (EIP-191)
|
|
123
|
+
* @param message Message to sign
|
|
124
|
+
* @param chain Chain to sign the message on
|
|
125
|
+
* @param signers Signers to use for signing
|
|
126
|
+
* @returns signature
|
|
127
|
+
*/
|
|
128
|
+
function signMessage(message, chain, signers) {
|
|
129
|
+
return (0, utils_1.signMessage)(config, message, chain, signers);
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Sign a typed data (EIP-712)
|
|
133
|
+
* @param parameters Typed data parameters
|
|
134
|
+
* @param chain Chain to sign the typed data on
|
|
135
|
+
* @param signers Signers to use for signing
|
|
136
|
+
* @returns signature
|
|
137
|
+
*/
|
|
138
|
+
function signTypedData(parameters, chain, signers) {
|
|
139
|
+
return (0, utils_1.signTypedData)(config, parameters, chain, signers);
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Submit a transaction
|
|
143
|
+
* @param signedTransaction Signed transaction data
|
|
144
|
+
* @param authorizations EIP-7702 authorizations to submit (optional)
|
|
145
|
+
* @returns transaction result object (a UserOp hash)
|
|
146
|
+
* @see {@link signTransaction} to sign the transaction data
|
|
147
|
+
* @see {@link signAuthorizations} to sign the required EIP-7702 authorizations
|
|
148
|
+
* @see {@link dryRun} true when intent is not executed onchain (internal use only)
|
|
149
|
+
*/
|
|
150
|
+
function submitTransaction(signedTransaction, authorizations, dryRun) {
|
|
151
|
+
return (0, utils_1.submitTransaction)(config, signedTransaction, authorizations ?? [], dryRun);
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Prepare a user operation data
|
|
155
|
+
* @param transaction User operation to prepare
|
|
156
|
+
* @returns prepared user operation data
|
|
157
|
+
*/
|
|
158
|
+
function prepareUserOperation(transaction) {
|
|
159
|
+
return (0, utils_1.prepareUserOperation)(config, transaction);
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Sign a user operation
|
|
163
|
+
* @param preparedUserOperation Prepared user operation data
|
|
164
|
+
* @returns signed user operation data
|
|
165
|
+
* @see {@link prepareUserOperation} to prepare the user operation data for signing
|
|
166
|
+
*/
|
|
167
|
+
function signUserOperation(preparedUserOperation) {
|
|
168
|
+
return (0, utils_1.signUserOperation)(config, preparedUserOperation);
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Submit a transaction
|
|
172
|
+
* @param signedTransaction Signed transaction data
|
|
173
|
+
* @returns transaction result object (a UserOp hash)
|
|
174
|
+
* @see {@link signUserOperation} to sign the user operation data
|
|
175
|
+
*/
|
|
176
|
+
function submitUserOperation(signedUserOperation) {
|
|
177
|
+
return (0, utils_1.submitUserOperation)(config, signedUserOperation);
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Sign and send a transaction
|
|
181
|
+
* @param transaction Transaction to send
|
|
182
|
+
* @returns transaction result object (an intent ID)
|
|
183
|
+
*/
|
|
184
|
+
function sendTransaction(transaction) {
|
|
185
|
+
return (0, execution_1.sendTransaction)(config, transaction);
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Sign and send a user operation
|
|
189
|
+
* @param transaction User operation to send
|
|
190
|
+
* @returns user operation result object (a UserOp hash)
|
|
191
|
+
*/
|
|
192
|
+
function sendUserOperation(transaction) {
|
|
193
|
+
return (0, execution_1.sendUserOperation)(config, transaction);
|
|
194
|
+
}
|
|
195
|
+
function waitForExecution(result, acceptsPreconfirmations = true) {
|
|
196
|
+
return (0, execution_1.waitForExecution)(config, result, acceptsPreconfirmations);
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Get account address
|
|
200
|
+
* @returns Address of the smart account
|
|
201
|
+
*/
|
|
202
|
+
function getAddress() {
|
|
203
|
+
return (0, accounts_1.getAddress)(config);
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Get account portfolio
|
|
207
|
+
* @param onTestnets Whether to query the testnet balances (default is `false`)
|
|
208
|
+
* @returns Account balances
|
|
209
|
+
*/
|
|
210
|
+
function getPortfolio(onTestnets = false) {
|
|
211
|
+
return (0, execution_1.getPortfolio)(config, onTestnets);
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Get the maximum spendable token amount on the target chain
|
|
215
|
+
* @param chain Target chain
|
|
216
|
+
* @param token Token address (on the target chain)
|
|
217
|
+
* @param gasUnits Gas cost estimate for the transaction execution
|
|
218
|
+
* @returns Maximum spendable amount in absolute units
|
|
219
|
+
*/
|
|
220
|
+
function getMaxSpendableAmount(chain, token, gasUnits, sponsored = false) {
|
|
221
|
+
return (0, execution_1.getMaxSpendableAmount)(config, chain, token, gasUnits, sponsored);
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Get account owners (ECDSA)
|
|
225
|
+
* @param chain Chain to get the owners on
|
|
226
|
+
* @returns Account owners
|
|
227
|
+
*/
|
|
228
|
+
function getOwners(chain) {
|
|
229
|
+
const account = getAddress();
|
|
230
|
+
return (0, modules_1.getOwners)(account, chain, config.provider);
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Get account validator modules
|
|
234
|
+
* @param chain Chain to get the validators on
|
|
235
|
+
* @returns List of account validators
|
|
236
|
+
*/
|
|
237
|
+
function getValidators(chain) {
|
|
238
|
+
const accountType = (0, accounts_1.getAccountProvider)(config).type;
|
|
239
|
+
const account = getAddress();
|
|
240
|
+
return (0, modules_1.getValidators)(accountType, account, chain, config.provider);
|
|
241
|
+
}
|
|
242
|
+
function getSessionDetails(sessions, sessionIndex, initialNonces, signature) {
|
|
243
|
+
return (0, smart_session_1.getSessionDetails)(config, sessions, sessionIndex, initialNonces, signature);
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Check ERC20 allowance for the account owner and token (using Permit2 as spender)
|
|
247
|
+
* @param tokenAddress The token contract address
|
|
248
|
+
* @param chain The chain to check the allowance on
|
|
249
|
+
* @returns The allowance amount
|
|
250
|
+
*/
|
|
251
|
+
function checkERC20Allowance(tokenAddress, chain) {
|
|
252
|
+
if (!config.provider) {
|
|
253
|
+
throw new Error('Provider configuration is required');
|
|
254
|
+
}
|
|
255
|
+
return (0, permit2_1.checkERC20Allowance)(tokenAddress, chain, config);
|
|
256
|
+
}
|
|
257
|
+
return {
|
|
258
|
+
config,
|
|
259
|
+
deploy,
|
|
260
|
+
isDeployed,
|
|
261
|
+
setup,
|
|
262
|
+
signEip7702InitData,
|
|
263
|
+
prepareTransaction,
|
|
264
|
+
getTransactionMessages,
|
|
265
|
+
signTransaction,
|
|
266
|
+
signAuthorizations,
|
|
267
|
+
signMessage,
|
|
268
|
+
signTypedData,
|
|
269
|
+
submitTransaction,
|
|
270
|
+
prepareUserOperation,
|
|
271
|
+
signUserOperation,
|
|
272
|
+
submitUserOperation,
|
|
273
|
+
sendTransaction,
|
|
274
|
+
sendUserOperation,
|
|
275
|
+
waitForExecution,
|
|
276
|
+
getAddress,
|
|
277
|
+
getPortfolio,
|
|
278
|
+
getMaxSpendableAmount,
|
|
279
|
+
getSessionDetails,
|
|
280
|
+
getOwners,
|
|
281
|
+
getValidators,
|
|
282
|
+
checkERC20Allowance,
|
|
283
|
+
getInitData,
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
class RhinestoneSDK {
|
|
287
|
+
apiKey;
|
|
288
|
+
endpointUrl;
|
|
289
|
+
provider;
|
|
290
|
+
bundler;
|
|
291
|
+
paymaster;
|
|
292
|
+
useDevContracts;
|
|
293
|
+
constructor(options) {
|
|
294
|
+
this.apiKey = options?.apiKey;
|
|
295
|
+
this.endpointUrl = options?.endpointUrl;
|
|
296
|
+
this.provider = options?.provider;
|
|
297
|
+
this.bundler = options?.bundler;
|
|
298
|
+
this.paymaster = options?.paymaster;
|
|
299
|
+
this.useDevContracts = options?.useDevContracts;
|
|
300
|
+
}
|
|
301
|
+
createAccount(config) {
|
|
302
|
+
const rhinestoneConfig = {
|
|
303
|
+
...config,
|
|
304
|
+
apiKey: this.apiKey,
|
|
305
|
+
endpointUrl: this.endpointUrl,
|
|
306
|
+
provider: this.provider,
|
|
307
|
+
bundler: this.bundler,
|
|
308
|
+
paymaster: this.paymaster,
|
|
309
|
+
useDevContracts: this.useDevContracts,
|
|
310
|
+
};
|
|
311
|
+
return createRhinestoneAccount(rhinestoneConfig);
|
|
312
|
+
}
|
|
313
|
+
getIntentStatus(intentId) {
|
|
314
|
+
return (0, execution_1.getIntentStatus)(this.apiKey, this.endpointUrl, intentId);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
exports.RhinestoneSDK = RhinestoneSDK;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
declare const enableSessionsAbi: readonly [{
|
|
2
|
+
readonly type: "function";
|
|
3
|
+
readonly name: "enableSessions";
|
|
4
|
+
readonly inputs: readonly [{
|
|
5
|
+
readonly name: "sessions";
|
|
6
|
+
readonly type: "tuple[]";
|
|
7
|
+
readonly internalType: "struct Session[]";
|
|
8
|
+
readonly components: readonly [{
|
|
9
|
+
readonly name: "sessionValidator";
|
|
10
|
+
readonly type: "address";
|
|
11
|
+
readonly internalType: "contract ISessionValidator";
|
|
12
|
+
}, {
|
|
13
|
+
readonly name: "sessionValidatorInitData";
|
|
14
|
+
readonly type: "bytes";
|
|
15
|
+
readonly internalType: "bytes";
|
|
16
|
+
}, {
|
|
17
|
+
readonly name: "salt";
|
|
18
|
+
readonly type: "bytes32";
|
|
19
|
+
readonly internalType: "bytes32";
|
|
20
|
+
}, {
|
|
21
|
+
readonly name: "userOpPolicies";
|
|
22
|
+
readonly type: "tuple[]";
|
|
23
|
+
readonly internalType: "struct PolicyData[]";
|
|
24
|
+
readonly components: readonly [{
|
|
25
|
+
readonly name: "policy";
|
|
26
|
+
readonly type: "address";
|
|
27
|
+
readonly internalType: "address";
|
|
28
|
+
}, {
|
|
29
|
+
readonly name: "initData";
|
|
30
|
+
readonly type: "bytes";
|
|
31
|
+
readonly internalType: "bytes";
|
|
32
|
+
}];
|
|
33
|
+
}, {
|
|
34
|
+
readonly name: "erc7739Policies";
|
|
35
|
+
readonly type: "tuple";
|
|
36
|
+
readonly internalType: "struct ERC7739Data";
|
|
37
|
+
readonly components: readonly [{
|
|
38
|
+
readonly name: "allowedERC7739Content";
|
|
39
|
+
readonly type: "tuple[]";
|
|
40
|
+
readonly internalType: "struct ERC7739Context[]";
|
|
41
|
+
readonly components: readonly [{
|
|
42
|
+
readonly name: "appDomainSeparator";
|
|
43
|
+
readonly type: "bytes32";
|
|
44
|
+
readonly internalType: "bytes32";
|
|
45
|
+
}, {
|
|
46
|
+
readonly name: "contentName";
|
|
47
|
+
readonly type: "string[]";
|
|
48
|
+
readonly internalType: "string[]";
|
|
49
|
+
}];
|
|
50
|
+
}, {
|
|
51
|
+
readonly name: "erc1271Policies";
|
|
52
|
+
readonly type: "tuple[]";
|
|
53
|
+
readonly internalType: "struct PolicyData[]";
|
|
54
|
+
readonly components: readonly [{
|
|
55
|
+
readonly name: "policy";
|
|
56
|
+
readonly type: "address";
|
|
57
|
+
readonly internalType: "address";
|
|
58
|
+
}, {
|
|
59
|
+
readonly name: "initData";
|
|
60
|
+
readonly type: "bytes";
|
|
61
|
+
readonly internalType: "bytes";
|
|
62
|
+
}];
|
|
63
|
+
}];
|
|
64
|
+
}, {
|
|
65
|
+
readonly name: "actions";
|
|
66
|
+
readonly type: "tuple[]";
|
|
67
|
+
readonly internalType: "struct ActionData[]";
|
|
68
|
+
readonly components: readonly [{
|
|
69
|
+
readonly name: "actionTargetSelector";
|
|
70
|
+
readonly type: "bytes4";
|
|
71
|
+
readonly internalType: "bytes4";
|
|
72
|
+
}, {
|
|
73
|
+
readonly name: "actionTarget";
|
|
74
|
+
readonly type: "address";
|
|
75
|
+
readonly internalType: "address";
|
|
76
|
+
}, {
|
|
77
|
+
readonly name: "actionPolicies";
|
|
78
|
+
readonly type: "tuple[]";
|
|
79
|
+
readonly internalType: "struct PolicyData[]";
|
|
80
|
+
readonly components: readonly [{
|
|
81
|
+
readonly name: "policy";
|
|
82
|
+
readonly type: "address";
|
|
83
|
+
readonly internalType: "address";
|
|
84
|
+
}, {
|
|
85
|
+
readonly name: "initData";
|
|
86
|
+
readonly type: "bytes";
|
|
87
|
+
readonly internalType: "bytes";
|
|
88
|
+
}];
|
|
89
|
+
}];
|
|
90
|
+
}, {
|
|
91
|
+
readonly name: "permitERC4337Paymaster";
|
|
92
|
+
readonly type: "bool";
|
|
93
|
+
readonly internalType: "bool";
|
|
94
|
+
}];
|
|
95
|
+
}];
|
|
96
|
+
readonly outputs: readonly [{
|
|
97
|
+
readonly name: "permissionIds";
|
|
98
|
+
readonly type: "bytes32[]";
|
|
99
|
+
readonly internalType: "PermissionId[]";
|
|
100
|
+
}];
|
|
101
|
+
readonly stateMutability: "nonpayable";
|
|
102
|
+
}];
|
|
103
|
+
export { enableSessionsAbi };
|
|
104
|
+
//# sourceMappingURL=smart-sessions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"smart-sessions.d.ts","sourceRoot":"","sources":["../../../../modules/abi/smart-sessions.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8Hb,CAAA;AAEV,OAAO,EAAE,iBAAiB,EAAE,CAAA"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.enableSessionsAbi = void 0;
|
|
4
|
+
const enableSessionsAbi = [
|
|
5
|
+
{
|
|
6
|
+
type: 'function',
|
|
7
|
+
name: 'enableSessions',
|
|
8
|
+
inputs: [
|
|
9
|
+
{
|
|
10
|
+
name: 'sessions',
|
|
11
|
+
type: 'tuple[]',
|
|
12
|
+
internalType: 'struct Session[]',
|
|
13
|
+
components: [
|
|
14
|
+
{
|
|
15
|
+
name: 'sessionValidator',
|
|
16
|
+
type: 'address',
|
|
17
|
+
internalType: 'contract ISessionValidator',
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
name: 'sessionValidatorInitData',
|
|
21
|
+
type: 'bytes',
|
|
22
|
+
internalType: 'bytes',
|
|
23
|
+
},
|
|
24
|
+
{ name: 'salt', type: 'bytes32', internalType: 'bytes32' },
|
|
25
|
+
{
|
|
26
|
+
name: 'userOpPolicies',
|
|
27
|
+
type: 'tuple[]',
|
|
28
|
+
internalType: 'struct PolicyData[]',
|
|
29
|
+
components: [
|
|
30
|
+
{
|
|
31
|
+
name: 'policy',
|
|
32
|
+
type: 'address',
|
|
33
|
+
internalType: 'address',
|
|
34
|
+
},
|
|
35
|
+
{ name: 'initData', type: 'bytes', internalType: 'bytes' },
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: 'erc7739Policies',
|
|
40
|
+
type: 'tuple',
|
|
41
|
+
internalType: 'struct ERC7739Data',
|
|
42
|
+
components: [
|
|
43
|
+
{
|
|
44
|
+
name: 'allowedERC7739Content',
|
|
45
|
+
type: 'tuple[]',
|
|
46
|
+
internalType: 'struct ERC7739Context[]',
|
|
47
|
+
components: [
|
|
48
|
+
{
|
|
49
|
+
name: 'appDomainSeparator',
|
|
50
|
+
type: 'bytes32',
|
|
51
|
+
internalType: 'bytes32',
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: 'contentName',
|
|
55
|
+
type: 'string[]',
|
|
56
|
+
internalType: 'string[]',
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: 'erc1271Policies',
|
|
62
|
+
type: 'tuple[]',
|
|
63
|
+
internalType: 'struct PolicyData[]',
|
|
64
|
+
components: [
|
|
65
|
+
{
|
|
66
|
+
name: 'policy',
|
|
67
|
+
type: 'address',
|
|
68
|
+
internalType: 'address',
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
name: 'initData',
|
|
72
|
+
type: 'bytes',
|
|
73
|
+
internalType: 'bytes',
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
name: 'actions',
|
|
81
|
+
type: 'tuple[]',
|
|
82
|
+
internalType: 'struct ActionData[]',
|
|
83
|
+
components: [
|
|
84
|
+
{
|
|
85
|
+
name: 'actionTargetSelector',
|
|
86
|
+
type: 'bytes4',
|
|
87
|
+
internalType: 'bytes4',
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
name: 'actionTarget',
|
|
91
|
+
type: 'address',
|
|
92
|
+
internalType: 'address',
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
name: 'actionPolicies',
|
|
96
|
+
type: 'tuple[]',
|
|
97
|
+
internalType: 'struct PolicyData[]',
|
|
98
|
+
components: [
|
|
99
|
+
{
|
|
100
|
+
name: 'policy',
|
|
101
|
+
type: 'address',
|
|
102
|
+
internalType: 'address',
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
name: 'initData',
|
|
106
|
+
type: 'bytes',
|
|
107
|
+
internalType: 'bytes',
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
},
|
|
111
|
+
],
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
name: 'permitERC4337Paymaster',
|
|
115
|
+
type: 'bool',
|
|
116
|
+
internalType: 'bool',
|
|
117
|
+
},
|
|
118
|
+
],
|
|
119
|
+
},
|
|
120
|
+
],
|
|
121
|
+
outputs: [
|
|
122
|
+
{
|
|
123
|
+
name: 'permissionIds',
|
|
124
|
+
type: 'bytes32[]',
|
|
125
|
+
internalType: 'PermissionId[]',
|
|
126
|
+
},
|
|
127
|
+
],
|
|
128
|
+
stateMutability: 'nonpayable',
|
|
129
|
+
},
|
|
130
|
+
];
|
|
131
|
+
exports.enableSessionsAbi = enableSessionsAbi;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chain-abstraction.d.ts","sourceRoot":"","sources":["../../../modules/chain-abstraction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAEnC,QAAA,MAAM,uBAAuB,EAAE,OACe,CAAA;AAC9C,QAAA,MAAM,2BAA2B,EAAE,OACW,CAAA;AAE9C,OAAO,EAAE,uBAAuB,EAAE,2BAA2B,EAAE,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.INTENT_EXECUTOR_ADDRESS_DEV = exports.INTENT_EXECUTOR_ADDRESS = void 0;
|
|
4
|
+
const INTENT_EXECUTOR_ADDRESS = '0x00000000005aD9ce1f5035FD62CA96CEf16AdAAF';
|
|
5
|
+
exports.INTENT_EXECUTOR_ADDRESS = INTENT_EXECUTOR_ADDRESS;
|
|
6
|
+
const INTENT_EXECUTOR_ADDRESS_DEV = '0xbf9b5b917a83f8adac17b0752846d41d8d7b7e17';
|
|
7
|
+
exports.INTENT_EXECUTOR_ADDRESS_DEV = INTENT_EXECUTOR_ADDRESS_DEV;
|