@rhinestone/sdk 0.12.6 → 0.12.8
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 +69 -0
- package/dist/src/accounts/error.d.ts.map +1 -0
- package/dist/src/accounts/error.js +107 -0
- package/dist/src/accounts/index.d.ts +2 -1
- package/dist/src/accounts/index.d.ts.map +1 -1
- package/dist/src/accounts/index.js +20 -9
- package/dist/src/accounts/kernel.d.ts.map +1 -1
- package/dist/src/accounts/kernel.js +3 -2
- package/dist/src/accounts/nexus.d.ts.map +1 -1
- package/dist/src/accounts/nexus.js +3 -2
- package/dist/src/accounts/safe.d.ts.map +1 -1
- package/dist/src/accounts/safe.js +3 -2
- package/dist/src/execution/error.d.ts +54 -0
- package/dist/src/execution/error.d.ts.map +1 -0
- package/dist/src/execution/error.js +78 -0
- package/dist/src/execution/index.d.ts +2 -1
- package/dist/src/execution/index.d.ts.map +1 -1
- package/dist/src/execution/index.js +12 -3
- package/dist/src/execution/smart-session.d.ts.map +1 -1
- package/dist/src/execution/smart-session.js +4 -3
- package/dist/src/execution/utils.d.ts.map +1 -1
- package/dist/src/execution/utils.js +7 -6
- package/dist/src/index.d.ts +5 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +31 -1
- package/dist/src/orchestrator/client.d.ts.map +1 -1
- package/dist/src/orchestrator/client.js +82 -6
- package/dist/src/orchestrator/error.d.ts +80 -2
- package/dist/src/orchestrator/error.d.ts.map +1 -1
- package/dist/src/orchestrator/error.js +100 -1
- package/dist/src/orchestrator/index.d.ts +2 -2
- package/dist/src/orchestrator/index.d.ts.map +1 -1
- package/dist/src/orchestrator/index.js +12 -1
- package/dist/src/orchestrator/types.d.ts +2 -2
- package/dist/src/orchestrator/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { AccountType } from '../types';
|
|
2
|
+
declare class AccountError extends Error {
|
|
3
|
+
private readonly _message;
|
|
4
|
+
private readonly _context;
|
|
5
|
+
private readonly _errorType;
|
|
6
|
+
private readonly _traceId;
|
|
7
|
+
constructor(params?: {
|
|
8
|
+
message?: string;
|
|
9
|
+
context?: any;
|
|
10
|
+
errorType?: string;
|
|
11
|
+
traceId?: string;
|
|
12
|
+
});
|
|
13
|
+
get message(): string;
|
|
14
|
+
get context(): any;
|
|
15
|
+
get errorType(): string;
|
|
16
|
+
get traceId(): string;
|
|
17
|
+
}
|
|
18
|
+
declare class Eip7702AccountMustHaveEoaError extends AccountError {
|
|
19
|
+
constructor(params?: {
|
|
20
|
+
context?: any;
|
|
21
|
+
errorType?: string;
|
|
22
|
+
traceId?: string;
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
declare class ExistingEip7702AccountsNotSupportedError extends AccountError {
|
|
26
|
+
constructor(params?: {
|
|
27
|
+
context?: any;
|
|
28
|
+
errorType?: string;
|
|
29
|
+
traceId?: string;
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
declare class FactoryArgsNotAvailableError extends AccountError {
|
|
33
|
+
constructor(params?: {
|
|
34
|
+
context?: any;
|
|
35
|
+
errorType?: string;
|
|
36
|
+
traceId?: string;
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
declare class SmartSessionsNotEnabledError extends AccountError {
|
|
40
|
+
constructor(params?: {
|
|
41
|
+
context?: any;
|
|
42
|
+
errorType?: string;
|
|
43
|
+
traceId?: string;
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
declare class SigningNotSupportedForAccountError extends AccountError {
|
|
47
|
+
constructor(params?: {
|
|
48
|
+
context?: any;
|
|
49
|
+
errorType?: string;
|
|
50
|
+
traceId?: string;
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
declare class SignMessageNotSupportedByAccountError extends AccountError {
|
|
54
|
+
constructor(params?: {
|
|
55
|
+
context?: any;
|
|
56
|
+
errorType?: string;
|
|
57
|
+
traceId?: string;
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
declare class Eip7702NotSupportedForAccountError extends AccountError {
|
|
61
|
+
constructor(account: AccountType, params?: {
|
|
62
|
+
context?: any;
|
|
63
|
+
errorType?: string;
|
|
64
|
+
traceId?: string;
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
declare function isAccountError(error: Error): error is AccountError;
|
|
68
|
+
export { isAccountError, AccountError, Eip7702AccountMustHaveEoaError, ExistingEip7702AccountsNotSupportedError, FactoryArgsNotAvailableError, SmartSessionsNotEnabledError, SigningNotSupportedForAccountError, SignMessageNotSupportedByAccountError, Eip7702NotSupportedForAccountError, };
|
|
69
|
+
//# sourceMappingURL=error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../accounts/error.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAE3C,cAAM,YAAa,SAAQ,KAAK;IAC9B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAQ;IACjC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAK;IAC9B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAQ;IACnC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAQ;gBAErB,MAAM,CAAC,EAAE;QACnB,OAAO,CAAC,EAAE,MAAM,CAAA;QAChB,OAAO,CAAC,EAAE,GAAG,CAAA;QACb,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,OAAO,CAAC,EAAE,MAAM,CAAA;KACjB;IAQD,IAAI,OAAO,WAEV;IAED,IAAI,OAAO,QAEV;IAED,IAAI,SAAS,WAEZ;IAED,IAAI,OAAO,WAEV;CACF;AAED,cAAM,8BAA+B,SAAQ,YAAY;gBAC3C,MAAM,CAAC,EAAE;QACnB,OAAO,CAAC,EAAE,GAAG,CAAA;QACb,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,OAAO,CAAC,EAAE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A8B,EAC9B,wCAAwC,EACxC,4BAA4B,EAC5B,4BAA4B,EAC5B,kCAAkC,EAClC,qCAAqC,EACrC,kCAAkC,GACnC,CAAA"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Eip7702NotSupportedForAccountError = exports.SignMessageNotSupportedByAccountError = exports.SigningNotSupportedForAccountError = exports.SmartSessionsNotEnabledError = exports.FactoryArgsNotAvailableError = exports.ExistingEip7702AccountsNotSupportedError = exports.Eip7702AccountMustHaveEoaError = exports.AccountError = void 0;
|
|
4
|
+
exports.isAccountError = isAccountError;
|
|
5
|
+
class AccountError extends Error {
|
|
6
|
+
_message;
|
|
7
|
+
_context;
|
|
8
|
+
_errorType;
|
|
9
|
+
_traceId;
|
|
10
|
+
constructor(params) {
|
|
11
|
+
super();
|
|
12
|
+
this._message = params?.message || 'AccountError';
|
|
13
|
+
this._context = params?.context || {};
|
|
14
|
+
this._errorType = params?.errorType || 'Unknown';
|
|
15
|
+
this._traceId = params?.traceId || '';
|
|
16
|
+
}
|
|
17
|
+
get message() {
|
|
18
|
+
return this._message;
|
|
19
|
+
}
|
|
20
|
+
get context() {
|
|
21
|
+
return this._context;
|
|
22
|
+
}
|
|
23
|
+
get errorType() {
|
|
24
|
+
return this._errorType;
|
|
25
|
+
}
|
|
26
|
+
get traceId() {
|
|
27
|
+
return this._traceId;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.AccountError = AccountError;
|
|
31
|
+
class Eip7702AccountMustHaveEoaError extends AccountError {
|
|
32
|
+
constructor(params) {
|
|
33
|
+
super({
|
|
34
|
+
message: 'EIP-7702 accounts must have an EOA account',
|
|
35
|
+
...params,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.Eip7702AccountMustHaveEoaError = Eip7702AccountMustHaveEoaError;
|
|
40
|
+
class ExistingEip7702AccountsNotSupportedError extends AccountError {
|
|
41
|
+
constructor(params) {
|
|
42
|
+
super({
|
|
43
|
+
message: 'Existing EIP-7702 accounts are not yet supported',
|
|
44
|
+
...params,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.ExistingEip7702AccountsNotSupportedError = ExistingEip7702AccountsNotSupportedError;
|
|
49
|
+
class FactoryArgsNotAvailableError extends AccountError {
|
|
50
|
+
constructor(params) {
|
|
51
|
+
super({
|
|
52
|
+
message: 'Factory args not available',
|
|
53
|
+
...params,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.FactoryArgsNotAvailableError = FactoryArgsNotAvailableError;
|
|
58
|
+
class SmartSessionsNotEnabledError extends AccountError {
|
|
59
|
+
constructor(params) {
|
|
60
|
+
super({
|
|
61
|
+
message: 'Smart sessions are not enabled for this account',
|
|
62
|
+
...params,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
exports.SmartSessionsNotEnabledError = SmartSessionsNotEnabledError;
|
|
67
|
+
class SigningNotSupportedForAccountError extends AccountError {
|
|
68
|
+
constructor(params) {
|
|
69
|
+
super({
|
|
70
|
+
message: 'Signing not supported for the account',
|
|
71
|
+
...params,
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
exports.SigningNotSupportedForAccountError = SigningNotSupportedForAccountError;
|
|
76
|
+
class SignMessageNotSupportedByAccountError extends AccountError {
|
|
77
|
+
constructor(params) {
|
|
78
|
+
super({
|
|
79
|
+
message: 'Sign message not supported by account',
|
|
80
|
+
...params,
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
exports.SignMessageNotSupportedByAccountError = SignMessageNotSupportedByAccountError;
|
|
85
|
+
class Eip7702NotSupportedForAccountError extends AccountError {
|
|
86
|
+
constructor(account, params) {
|
|
87
|
+
const accountName = getAccountName(account);
|
|
88
|
+
super({
|
|
89
|
+
message: `EIP-7702 is not supported for ${accountName} accounts`,
|
|
90
|
+
...params,
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
exports.Eip7702NotSupportedForAccountError = Eip7702NotSupportedForAccountError;
|
|
95
|
+
function isAccountError(error) {
|
|
96
|
+
return error instanceof AccountError;
|
|
97
|
+
}
|
|
98
|
+
function getAccountName(account) {
|
|
99
|
+
switch (account) {
|
|
100
|
+
case 'safe':
|
|
101
|
+
return 'Safe';
|
|
102
|
+
case 'kernel':
|
|
103
|
+
return 'Kernel';
|
|
104
|
+
case 'nexus':
|
|
105
|
+
return 'Nexus';
|
|
106
|
+
}
|
|
107
|
+
}
|
|
@@ -2,6 +2,7 @@ import { type Chain, type Hex, type PublicClient } from 'viem';
|
|
|
2
2
|
import { Module } from '../modules/common';
|
|
3
3
|
import { EnableSessionData } from '../modules/validators/smart-sessions';
|
|
4
4
|
import type { AccountProviderConfig, Call, OwnerSet, RhinestoneAccountConfig, Session } from '../types';
|
|
5
|
+
import { AccountError, Eip7702AccountMustHaveEoaError, Eip7702NotSupportedForAccountError, ExistingEip7702AccountsNotSupportedError, FactoryArgsNotAvailableError, isAccountError, SigningNotSupportedForAccountError, SignMessageNotSupportedByAccountError, SmartSessionsNotEnabledError } from './error';
|
|
5
6
|
import { ValidatorConfig } from './utils';
|
|
6
7
|
declare function getDeployArgs(config: RhinestoneAccountConfig): {
|
|
7
8
|
factory: `0x${string}`;
|
|
@@ -30,5 +31,5 @@ declare function getSmartSessionSmartAccount(config: RhinestoneAccountConfig, cl
|
|
|
30
31
|
declare function getGuardianSmartAccount(config: RhinestoneAccountConfig, client: PublicClient, chain: Chain, guardians: OwnerSet): Promise<import("viem/account-abstraction").SmartAccount<import("viem/account-abstraction").SmartAccountImplementation<import("viem").Abi, "0.7">>>;
|
|
31
32
|
declare function sign(validators: OwnerSet, chain: Chain, hash: Hex): Promise<`0x${string}`>;
|
|
32
33
|
declare function getAccountProvider(config: RhinestoneAccountConfig): AccountProviderConfig;
|
|
33
|
-
export { getModuleInstallationCalls, getModuleUninstallationCalls, getDeployArgs, getBundleInitCode, getAddress, getAccountProvider, isDeployed, deploy, deploySource, deployTarget, getSmartAccount, getSmartSessionSmartAccount, getGuardianSmartAccount, getPackedSignature, sign, };
|
|
34
|
+
export { getModuleInstallationCalls, getModuleUninstallationCalls, getDeployArgs, getBundleInitCode, getAddress, getAccountProvider, isDeployed, deploy, deploySource, deployTarget, getSmartAccount, getSmartSessionSmartAccount, getGuardianSmartAccount, getPackedSignature, sign, isAccountError, AccountError, Eip7702AccountMustHaveEoaError, ExistingEip7702AccountsNotSupportedError, FactoryArgsNotAvailableError, SmartSessionsNotEnabledError, SigningNotSupportedForAccountError, SignMessageNotSupportedByAccountError, Eip7702NotSupportedForAccountError, };
|
|
34
35
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../accounts/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,KAAK,EAMV,KAAK,GAAG,EAER,KAAK,YAAY,EAGlB,MAAM,MAAM,CAAA;AAOb,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAM1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAA;AACxE,OAAO,KAAK,EACV,qBAAqB,EACrB,IAAI,EACJ,QAAQ,EACR,uBAAuB,EACvB,OAAO,EACR,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../accounts/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,KAAK,EAMV,KAAK,GAAG,EAER,KAAK,YAAY,EAGlB,MAAM,MAAM,CAAA;AAOb,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAM1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAA;AACxE,OAAO,KAAK,EACV,qBAAqB,EACr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;AAgID,iBAAe,eAAe,CAC5B,MAAM,EAAE,uBAAuB,EAC/B,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,KAAK,sJAmCb;AAED,iBAAe,2BAA2B,CACxC,MAAM,EAAE,uBAAuB,EAC/B,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,iBAAiB,GAAG,IAAI,sJA0CrC;AAED,iBAAe,uBAAuB,CACpC,MAAM,EAAE,uBAAuB,EAC/B,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,QAAQ,sJAwCpB;AAED,iBAAe,IAAI,CAAC,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,0BAYhE;AA6DD,iBAAS,kBAAkB,CACzB,MAAM,EAAE,uBAAuB,GAC9B,qBAAqB,CAOvB;AAED,OAAO,EACL,0BAA0B,EAC1B,4BAA4B,EAC5B,aAAa,EACb,iBAAiB,EACjB,UAAU,EACV,kBAAkB,EAClB,UAAU,EACV,MAAM,EACN,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,2BAA2B,EAC3B,uBAAuB,EACvB,kBAAkB,EAClB,IAAI,EAEJ,cAAc,EACd,YAAY,EACZ,8BAA8B,EAC9B,wCAAwC,EACxC,4BAA4B,EAC5B,4BAA4B,EAC5B,kCAAkC,EAClC,qCAAqC,EACrC,kCAAkC,GACnC,CAAA"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Eip7702NotSupportedForAccountError = exports.SignMessageNotSupportedByAccountError = exports.SigningNotSupportedForAccountError = exports.SmartSessionsNotEnabledError = exports.FactoryArgsNotAvailableError = exports.ExistingEip7702AccountsNotSupportedError = exports.Eip7702AccountMustHaveEoaError = exports.AccountError = exports.isAccountError = void 0;
|
|
3
4
|
exports.getModuleInstallationCalls = getModuleInstallationCalls;
|
|
4
5
|
exports.getModuleUninstallationCalls = getModuleUninstallationCalls;
|
|
5
6
|
exports.getDeployArgs = getDeployArgs;
|
|
@@ -20,6 +21,16 @@ const smart_session_1 = require("../execution/smart-session");
|
|
|
20
21
|
const modules_1 = require("../modules");
|
|
21
22
|
const validators_1 = require("../modules/validators");
|
|
22
23
|
const core_1 = require("../modules/validators/core");
|
|
24
|
+
const error_1 = require("./error");
|
|
25
|
+
Object.defineProperty(exports, "AccountError", { enumerable: true, get: function () { return error_1.AccountError; } });
|
|
26
|
+
Object.defineProperty(exports, "Eip7702AccountMustHaveEoaError", { enumerable: true, get: function () { return error_1.Eip7702AccountMustHaveEoaError; } });
|
|
27
|
+
Object.defineProperty(exports, "Eip7702NotSupportedForAccountError", { enumerable: true, get: function () { return error_1.Eip7702NotSupportedForAccountError; } });
|
|
28
|
+
Object.defineProperty(exports, "ExistingEip7702AccountsNotSupportedError", { enumerable: true, get: function () { return error_1.ExistingEip7702AccountsNotSupportedError; } });
|
|
29
|
+
Object.defineProperty(exports, "FactoryArgsNotAvailableError", { enumerable: true, get: function () { return error_1.FactoryArgsNotAvailableError; } });
|
|
30
|
+
Object.defineProperty(exports, "isAccountError", { enumerable: true, get: function () { return error_1.isAccountError; } });
|
|
31
|
+
Object.defineProperty(exports, "SigningNotSupportedForAccountError", { enumerable: true, get: function () { return error_1.SigningNotSupportedForAccountError; } });
|
|
32
|
+
Object.defineProperty(exports, "SignMessageNotSupportedByAccountError", { enumerable: true, get: function () { return error_1.SignMessageNotSupportedByAccountError; } });
|
|
33
|
+
Object.defineProperty(exports, "SmartSessionsNotEnabledError", { enumerable: true, get: function () { return error_1.SmartSessionsNotEnabledError; } });
|
|
23
34
|
const kernel_1 = require("./kernel");
|
|
24
35
|
const nexus_1 = require("./nexus");
|
|
25
36
|
const safe_1 = require("./safe");
|
|
@@ -93,7 +104,7 @@ function getModuleUninstallationCalls(config, module) {
|
|
|
93
104
|
function getAddress(config) {
|
|
94
105
|
if (is7702(config)) {
|
|
95
106
|
if (!config.eoa) {
|
|
96
|
-
throw new
|
|
107
|
+
throw new error_1.Eip7702AccountMustHaveEoaError();
|
|
97
108
|
}
|
|
98
109
|
return config.eoa.address;
|
|
99
110
|
}
|
|
@@ -141,7 +152,7 @@ async function isDeployed(chain, config) {
|
|
|
141
152
|
}
|
|
142
153
|
if (code.startsWith('0xef0100') && code.length === 48) {
|
|
143
154
|
// Defensive check to ensure there's no storage conflict; can be lifted in the future
|
|
144
|
-
throw new
|
|
155
|
+
throw new error_1.ExistingEip7702AccountsNotSupportedError();
|
|
145
156
|
}
|
|
146
157
|
return (0, viem_1.size)(code) > 0;
|
|
147
158
|
}
|
|
@@ -182,14 +193,14 @@ function getBundleInitCode(config) {
|
|
|
182
193
|
else {
|
|
183
194
|
const { factory, factoryData } = getDeployArgs(config);
|
|
184
195
|
if (!factory || !factoryData) {
|
|
185
|
-
throw new
|
|
196
|
+
throw new error_1.FactoryArgsNotAvailableError();
|
|
186
197
|
}
|
|
187
198
|
return (0, viem_1.encodePacked)(['address', 'bytes'], [factory, factoryData]);
|
|
188
199
|
}
|
|
189
200
|
}
|
|
190
201
|
async function deploy7702Self(chain, config) {
|
|
191
202
|
if (!config.eoa) {
|
|
192
|
-
throw new
|
|
203
|
+
throw new error_1.Eip7702AccountMustHaveEoaError();
|
|
193
204
|
}
|
|
194
205
|
const account = getAccountProvider(config);
|
|
195
206
|
const { implementation, initializationCallData } = getDeployArgs(config);
|
|
@@ -260,7 +271,7 @@ async function deployStandaloneWithBundler(chain, config) {
|
|
|
260
271
|
}
|
|
261
272
|
async function deploy7702WithBundler(chain, config) {
|
|
262
273
|
if (!config.eoa) {
|
|
263
|
-
throw new
|
|
274
|
+
throw new error_1.Eip7702AccountMustHaveEoaError();
|
|
264
275
|
}
|
|
265
276
|
const { implementation } = getDeployArgs(config);
|
|
266
277
|
const publicClient = (0, viem_1.createPublicClient)({
|
|
@@ -309,7 +320,7 @@ async function getSmartSessionSmartAccount(config, client, chain, session, enabl
|
|
|
309
320
|
const address = getAddress(config);
|
|
310
321
|
const smartSessionValidator = (0, validators_1.getSmartSessionValidator)(config);
|
|
311
322
|
if (!smartSessionValidator) {
|
|
312
|
-
throw new
|
|
323
|
+
throw new error_1.SmartSessionsNotEnabledError();
|
|
313
324
|
}
|
|
314
325
|
const signFn = (hash) => sign(session.owners, chain, hash);
|
|
315
326
|
const account = getAccountProvider(config);
|
|
@@ -330,7 +341,7 @@ async function getGuardianSmartAccount(config, client, chain, guardians) {
|
|
|
330
341
|
const accounts = guardians.type === 'ecdsa' ? guardians.accounts : [];
|
|
331
342
|
const socialRecoveryValidator = (0, core_1.getSocialRecoveryValidator)(accounts);
|
|
332
343
|
if (!socialRecoveryValidator) {
|
|
333
|
-
throw new Error('Social recovery is not
|
|
344
|
+
throw new Error('Social recovery is not available');
|
|
334
345
|
}
|
|
335
346
|
const signFn = (hash) => sign(guardians, chain, hash);
|
|
336
347
|
const account = getAccountProvider(config);
|
|
@@ -359,7 +370,7 @@ async function sign(validators, chain, hash) {
|
|
|
359
370
|
}
|
|
360
371
|
async function signEcdsa(account, hash) {
|
|
361
372
|
if (!account.signMessage) {
|
|
362
|
-
throw new
|
|
373
|
+
throw new error_1.SigningNotSupportedForAccountError();
|
|
363
374
|
}
|
|
364
375
|
return await account.signMessage({ message: { raw: hash } });
|
|
365
376
|
}
|
|
@@ -375,7 +386,7 @@ async function signPasskey(account, chain, hash) {
|
|
|
375
386
|
}
|
|
376
387
|
async function get7702SmartAccount(config, client) {
|
|
377
388
|
if (!config.eoa) {
|
|
378
|
-
throw new
|
|
389
|
+
throw new error_1.Eip7702AccountMustHaveEoaError();
|
|
379
390
|
}
|
|
380
391
|
const account = getAccountProvider(config);
|
|
381
392
|
switch (account.type) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kernel.d.ts","sourceRoot":"","sources":["../../../accounts/kernel.ts"],"names":[],"mappings":"AAAA,OAAO,EAC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AS,EAAE,GAAG,KAAK,GAA8B,0BAevE;AAwBD,iBAAe,eAAe,CAC5B,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,QAAQ,EAChB,gBAAgB,EAAE,OAAO,EACzB,IAAI,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,iEAYlC;AAED,iBAAe,sBAAsB,CACnC,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,gBAAgB,EAAE,OAAO,EACzB,UAAU,EAAE,iBAAiB,GAAG,IAAI,EACpC,IAAI,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,iEA0ClC;AAED,iBAAe,uBAAuB,CACpC,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,QAAQ,EACnB,gBAAgB,EAAE,OAAO,EACzB,IAAI,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,iEAclC;AA+ED,OAAO,EACL,cAAc,EACd,UAAU,EACV,aAAa,EACb,eAAe,EACf,sBAAsB,EACtB,uBAAuB,EACvB,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,GACnB,CAAA"}
|
|
@@ -14,6 +14,7 @@ const account_abstraction_1 = require("viem/account-abstraction");
|
|
|
14
14
|
const modules_1 = require("../modules");
|
|
15
15
|
const common_1 = require("../modules/common");
|
|
16
16
|
const validators_1 = require("../modules/validators");
|
|
17
|
+
const error_1 = require("./error");
|
|
17
18
|
const utils_1 = require("./utils");
|
|
18
19
|
const KERNEL_META_FACTORY_ADDRESS = '0xd703aae79538628d27099b8c4f621be4ccd142d5';
|
|
19
20
|
const KERNEL_IMPLEMENTATION_ADDRESS = '0xd6CEDDe84be40893d153Be9d467CD6aD37875b28';
|
|
@@ -129,10 +130,10 @@ function getInstallData(module) {
|
|
|
129
130
|
}
|
|
130
131
|
}
|
|
131
132
|
function get7702InitCalls() {
|
|
132
|
-
throw new
|
|
133
|
+
throw new error_1.Eip7702NotSupportedForAccountError('kernel');
|
|
133
134
|
}
|
|
134
135
|
function get7702SmartAccount() {
|
|
135
|
-
throw new
|
|
136
|
+
throw new error_1.Eip7702NotSupportedForAccountError('kernel');
|
|
136
137
|
}
|
|
137
138
|
async function getPackedSignature(signFn, hash, validator, accountAddress, transformSignature = (signature) => signature) {
|
|
138
139
|
const vId = validator.isRoot ? '0x00' : (0, viem_1.concat)(['0x01', validator.address]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nexus.d.ts","sourceRoot":"","sources":["../../../accounts/nexus.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;AAYpE,OAAO,EAIL,KAAK,YAAY,EACjB,KAAK,0BAA0B,EAEhC,MAAM,0BAA0B,CAAA;AAGjC,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAQ1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAA;AACxE,OAAO,KAAK,EAAE,QAAQ,EAAE,uBAAuB,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"nexus.d.ts","sourceRoot":"","sources":["../../../accounts/nexus.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;AAYpE,OAAO,EAIL,KAAK,YAAY,EACjB,KAAK,0BAA0B,EAEhC,MAAM,0BAA0B,CAAA;AAGjC,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAQ1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAA;AACxE,OAAO,KAAK,EAAE,QAAQ,EAAE,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uB;;;IAqDxD;AAED,OAAO,EACL,cAAc,EACd,UAAU,EACV,kBAAkB,EAClB,aAAa,EACb,eAAe,EACf,sBAAsB,EACtB,uBAAuB,EACvB,mBAAmB,EACnB,gBAAgB,GACjB,CAAA"}
|
|
@@ -13,6 +13,7 @@ const viem_1 = require("viem");
|
|
|
13
13
|
const account_abstraction_1 = require("viem/account-abstraction");
|
|
14
14
|
const modules_1 = require("../modules");
|
|
15
15
|
const validators_1 = require("../modules/validators");
|
|
16
|
+
const error_1 = require("./error");
|
|
16
17
|
const utils_1 = require("./utils");
|
|
17
18
|
const NEXUS_IMPLEMENTATION_ADDRESS = '0x000000004f43c49e93c970e84001853a70923b03';
|
|
18
19
|
const NEXUS_FACTORY_ADDRESS = '0x000000001D1D5004a02bAfAb9de2D6CE5b7B13de';
|
|
@@ -159,7 +160,7 @@ async function get7702SmartAccount(account, client) {
|
|
|
159
160
|
return `0x0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000${dynamicPart}000000000000000000000000000000000000000000000000000000000000004181d4b4981670cb18f99f0b4a66446df1bf5b204d24cfcb659bf38ba27a4359b5711649ec2423c5e1247245eba2964679b6a1dbb85c992ae40b9b00c6935b02ff1b00000000000000000000000000000000000000000000000000000000000000`;
|
|
160
161
|
}, async (hash) => {
|
|
161
162
|
if (!account.signMessage) {
|
|
162
|
-
throw new
|
|
163
|
+
throw new error_1.SignMessageNotSupportedByAccountError();
|
|
163
164
|
}
|
|
164
165
|
return await account.signMessage({
|
|
165
166
|
message: { raw: hash },
|
|
@@ -239,7 +240,7 @@ async function getBaseSmartAccount(address, client, nonceValidatorAddress, getSt
|
|
|
239
240
|
function get7702InitCalls(config) {
|
|
240
241
|
const eoa = config.eoa;
|
|
241
242
|
if (!eoa) {
|
|
242
|
-
throw new
|
|
243
|
+
throw new error_1.Eip7702AccountMustHaveEoaError();
|
|
243
244
|
}
|
|
244
245
|
const moduleSetup = (0, modules_1.getSetup)(config);
|
|
245
246
|
return [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"safe.d.ts","sourceRoot":"","sources":["../../../accounts/safe.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,GAAG,EACR,KAAK,OAAO,EAIZ,KAAK,GAAG,EAER,KAAK,YAAY,EAIlB,MAAM,MAAM,CAAA;AACb,OAAO,EAIL,KAAK,YAAY,EACjB,KAAK,0BAA0B,EAEhC,MAAM,0BAA0B,CAAA;AAGjC,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAQ1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAA;AACxE,OAAO,KAAK,EAAE,QAAQ,EAAE,uBAAuB,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"safe.d.ts","sourceRoot":"","sources":["../../../accounts/safe.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,GAAG,EACR,KAAK,OAAO,EAIZ,KAAK,GAAG,EAER,KAAK,YAAY,EAIlB,MAAM,MAAM,CAAA;AACb,OAAO,EAIL,KAAK,YAAY,EACjB,KAAK,0BAA0B,EAEhC,MAAM,0BAA0B,CAAA;AAGjC,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAQ1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAA;AACxE,OAAO,KAAK,EAAE,QAAQ,EAAE,uBAAuB,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAE1E,OAAO,EAAoC,eAAe,EAAE,MAAM,SAAS,CAAA;AAc3E,iBAAS,aAAa,CAAC,MAAM,EAAE,uBAAuB;;;;;;EAsErD;AAED,iBAAS,UAAU,CAAC,MAAM,EAAE,uBAAuB,iBAalD;AAED,iBAAS,cAAc,CAAC,MAAM,EAAE,MAAM,iBA2BrC;AAED,iBAAe,kBAAkB,CAC/B,MAAM,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,EACtC,IAAI,EAAE,GAAG,EACT,SAAS,EAAE,eAAe,EAC1B,kBAAkB,GAAE,CAAC,SAAS,EAAE,GAAG,KAAK,GAA8B,0BAQvE;AAED,iBAAe,eAAe,CAC5B,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,QAAQ,EAChB,gBAAgB,EAAE,OAAO,EACzB,IAAI,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,iEAWlC;AAED,iBAAe,sBAAsB,CACnC,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,gBAAgB,EAAE,OAAO,EACzB,UAAU,EAAE,iBAAiB,GAAG,IAAI,EACpC,IAAI,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,iEAyClC;AAED,iBAAe,uBAAuB,CACpC,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,QAAQ,EACnB,gBAAgB,EAAE,OAAO,EACzB,IAAI,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,iEAalC;AA0ED,iBAAS,mBAAmB,IAAI,KAAK,CAEpC;AAED,iBAAS,gBAAgB,IAAI,KAAK,CAEjC;AAsBD,OAAO,EACL,cAAc,EACd,UAAU,EACV,kBAAkB,EAClB,aAAa,EACb,eAAe,EACf,sBAAsB,EACtB,uBAAuB,EACvB,gBAAgB,EAChB,mBAAmB,GACpB,CAAA"}
|
|
@@ -13,6 +13,7 @@ const viem_1 = require("viem");
|
|
|
13
13
|
const account_abstraction_1 = require("viem/account-abstraction");
|
|
14
14
|
const modules_1 = require("../modules");
|
|
15
15
|
const validators_1 = require("../modules/validators");
|
|
16
|
+
const error_1 = require("./error");
|
|
16
17
|
const utils_1 = require("./utils");
|
|
17
18
|
const SAFE_7579_LAUNCHPAD_ADDRESS = '0x7579011aB74c46090561ea277Ba79D510c6C00ff';
|
|
18
19
|
const SAFE_7579_ADAPTER_ADDRESS = '0x7579ee8307284f293b1927136486880611f20002';
|
|
@@ -217,10 +218,10 @@ async function getBaseSmartAccount(address, client, validatorAddress, getStubSig
|
|
|
217
218
|
});
|
|
218
219
|
}
|
|
219
220
|
function get7702SmartAccount() {
|
|
220
|
-
throw new
|
|
221
|
+
throw new error_1.Eip7702NotSupportedForAccountError('safe');
|
|
221
222
|
}
|
|
222
223
|
function get7702InitCalls() {
|
|
223
|
-
throw new
|
|
224
|
+
throw new error_1.Eip7702NotSupportedForAccountError('safe');
|
|
224
225
|
}
|
|
225
226
|
function getOwners(config) {
|
|
226
227
|
const ownerSet = config.owners;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
declare class ExecutionError extends Error {
|
|
2
|
+
private readonly _message;
|
|
3
|
+
private readonly _context;
|
|
4
|
+
private readonly _errorType;
|
|
5
|
+
private readonly _traceId;
|
|
6
|
+
constructor(params?: {
|
|
7
|
+
message?: string;
|
|
8
|
+
context?: any;
|
|
9
|
+
errorType?: string;
|
|
10
|
+
traceId?: string;
|
|
11
|
+
});
|
|
12
|
+
get message(): string;
|
|
13
|
+
get context(): any;
|
|
14
|
+
get errorType(): string;
|
|
15
|
+
get traceId(): string;
|
|
16
|
+
}
|
|
17
|
+
declare class SourceChainRequiredForSmartSessionsError extends ExecutionError {
|
|
18
|
+
constructor(params?: {
|
|
19
|
+
context?: any;
|
|
20
|
+
errorType?: string;
|
|
21
|
+
traceId?: string;
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
declare class UserOperationRequiredForSmartSessionsError extends ExecutionError {
|
|
25
|
+
constructor(params?: {
|
|
26
|
+
context?: any;
|
|
27
|
+
errorType?: string;
|
|
28
|
+
traceId?: string;
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
declare class OrderPathRequiredForIntentsError extends ExecutionError {
|
|
32
|
+
constructor(params?: {
|
|
33
|
+
context?: any;
|
|
34
|
+
errorType?: string;
|
|
35
|
+
traceId?: string;
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
declare class SessionChainRequiredError extends ExecutionError {
|
|
39
|
+
constructor(params?: {
|
|
40
|
+
context?: any;
|
|
41
|
+
errorType?: string;
|
|
42
|
+
traceId?: string;
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
declare class BundleFailedError extends ExecutionError {
|
|
46
|
+
constructor(params?: {
|
|
47
|
+
context?: any;
|
|
48
|
+
errorType?: string;
|
|
49
|
+
traceId?: string;
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
declare function isExecutionError(error: Error): error is ExecutionError;
|
|
53
|
+
export { isExecutionError, ExecutionError, SourceChainRequiredForSmartSessionsError, UserOperationRequiredForSmartSessionsError, OrderPathRequiredForIntentsError, SessionChainRequiredError, BundleFailedError, };
|
|
54
|
+
//# sourceMappingURL=error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../execution/error.ts"],"names":[],"mappings":"AAAA,cAAM,cAAe,SAAQ,KAAK;IAChC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAQ;IACjC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAK;IAC9B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAQ;IACnC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAQ;gBAErB,MAAM,CAAC,EAAE;QACnB,OAAO,CAAC,EAAE,MAAM,CAAA;QAChB,OAAO,CAAC,EAAE,GAAG,CAAA;QACb,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,OAAO,CAAC,EAAE,MAAM,CAAA;KACjB;IAQD,IAAI,OAAO,WAEV;IAED,IAAI,OAAO,QAEV;IAED,IAAI,SAAS,WAEZ;IAED,IAAI,OAAO,WAEV;CACF;AAED,cAAM,wCAAyC,SAAQ,cAAc;gBACvD,MAAM,CAAC,EAAE;QACnB,OAAO,CAAC,EAAE,GAAG,CAAA;QACb,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,OAAO,CAAC,EAAE,MAAM,CAAA;KACjB;CAMF;AAED,cAAM,0CAA2C,SAAQ,cAAc;gBACzD,MAAM,CAAC,EAAE;QACnB,OAAO,CAAC,EAAE,GAAG,CAAA;QACb,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,OAAO,CAAC,EAAE,MAAM,CAAA;KACjB;CAMF;AAED,cAAM,gCAAiC,SAAQ,cAAc;gBAC/C,MAAM,CAAC,EAAE;QACnB,OAAO,CAAC,EAAE,GAAG,CAAA;QACb,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,OAAO,CAAC,EAAE,MAAM,CAAA;KACjB;CAMF;AAED,cAAM,yBAA0B,SAAQ,cAAc;gBACxC,MAAM,CAAC,EAAE;QACnB,OAAO,CAAC,EAAE,GAAG,CAAA;QACb,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,OAAO,CAAC,EAAE,MAAM,CAAA;KACjB;CAOF;AAED,cAAM,iBAAkB,SAAQ,cAAc;gBAChC,MAAM,CAAC,EAAE;QACnB,OAAO,CAAC,EAAE,GAAG,CAAA;QACb,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,OAAO,CAAC,EAAE,MAAM,CAAA;KACjB;CAMF;AAED,iBAAS,gBAAgB,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,IAAI,cAAc,CAE/D;AAED,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,wCAAwC,EACxC,0CAA0C,EAC1C,gCAAgC,EAChC,yBAAyB,EACzB,iBAAiB,GAClB,CAAA"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BundleFailedError = exports.SessionChainRequiredError = exports.OrderPathRequiredForIntentsError = exports.UserOperationRequiredForSmartSessionsError = exports.SourceChainRequiredForSmartSessionsError = exports.ExecutionError = void 0;
|
|
4
|
+
exports.isExecutionError = isExecutionError;
|
|
5
|
+
class ExecutionError extends Error {
|
|
6
|
+
_message;
|
|
7
|
+
_context;
|
|
8
|
+
_errorType;
|
|
9
|
+
_traceId;
|
|
10
|
+
constructor(params) {
|
|
11
|
+
super();
|
|
12
|
+
this._message = params?.message || 'ExecutionError';
|
|
13
|
+
this._context = params?.context || {};
|
|
14
|
+
this._errorType = params?.errorType || 'Unknown';
|
|
15
|
+
this._traceId = params?.traceId || '';
|
|
16
|
+
}
|
|
17
|
+
get message() {
|
|
18
|
+
return this._message;
|
|
19
|
+
}
|
|
20
|
+
get context() {
|
|
21
|
+
return this._context;
|
|
22
|
+
}
|
|
23
|
+
get errorType() {
|
|
24
|
+
return this._errorType;
|
|
25
|
+
}
|
|
26
|
+
get traceId() {
|
|
27
|
+
return this._traceId;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.ExecutionError = ExecutionError;
|
|
31
|
+
class SourceChainRequiredForSmartSessionsError extends ExecutionError {
|
|
32
|
+
constructor(params) {
|
|
33
|
+
super({
|
|
34
|
+
message: 'Specifying source chain is required when using smart sessions',
|
|
35
|
+
...params,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.SourceChainRequiredForSmartSessionsError = SourceChainRequiredForSmartSessionsError;
|
|
40
|
+
class UserOperationRequiredForSmartSessionsError extends ExecutionError {
|
|
41
|
+
constructor(params) {
|
|
42
|
+
super({
|
|
43
|
+
message: 'User operation is required when using smart sessions',
|
|
44
|
+
...params,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.UserOperationRequiredForSmartSessionsError = UserOperationRequiredForSmartSessionsError;
|
|
49
|
+
class OrderPathRequiredForIntentsError extends ExecutionError {
|
|
50
|
+
constructor(params) {
|
|
51
|
+
super({
|
|
52
|
+
message: 'Order path is required when using intents',
|
|
53
|
+
...params,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.OrderPathRequiredForIntentsError = OrderPathRequiredForIntentsError;
|
|
58
|
+
class SessionChainRequiredError extends ExecutionError {
|
|
59
|
+
constructor(params) {
|
|
60
|
+
super({
|
|
61
|
+
message: 'Specifying a chain is required when using multi-chain smart sessions',
|
|
62
|
+
...params,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
exports.SessionChainRequiredError = SessionChainRequiredError;
|
|
67
|
+
class BundleFailedError extends ExecutionError {
|
|
68
|
+
constructor(params) {
|
|
69
|
+
super({
|
|
70
|
+
message: 'Bundle failed',
|
|
71
|
+
...params,
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
exports.BundleFailedError = BundleFailedError;
|
|
76
|
+
function isExecutionError(error) {
|
|
77
|
+
return error instanceof ExecutionError;
|
|
78
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type Address, type Chain } from 'viem';
|
|
2
2
|
import type { BundleResult } from '../orchestrator';
|
|
3
3
|
import type { RhinestoneAccountConfig, Transaction } from '../types';
|
|
4
|
+
import { BundleFailedError, ExecutionError, isExecutionError, OrderPathRequiredForIntentsError, SessionChainRequiredError, SourceChainRequiredForSmartSessionsError, UserOperationRequiredForSmartSessionsError } from './error';
|
|
4
5
|
import type { BundleData, TransactionResult } from './utils';
|
|
5
6
|
declare function sendTransaction(config: RhinestoneAccountConfig, transaction: Transaction): Promise<TransactionResult>;
|
|
6
7
|
declare function waitForExecution(config: RhinestoneAccountConfig, result: TransactionResult, acceptsPreconfirmations: boolean): Promise<BundleResult | {
|
|
@@ -18,6 +19,6 @@ declare function waitForExecution(config: RhinestoneAccountConfig, result: Trans
|
|
|
18
19
|
}>;
|
|
19
20
|
declare function getMaxSpendableAmount(config: RhinestoneAccountConfig, chain: Chain, tokenAddress: Address, gasUnits: bigint): Promise<bigint>;
|
|
20
21
|
declare function getPortfolio(config: RhinestoneAccountConfig, onTestnets: boolean): Promise<import("../orchestrator").UserTokenBalance[]>;
|
|
21
|
-
export { sendTransaction, waitForExecution, getMaxSpendableAmount, getPortfolio, };
|
|
22
|
+
export { sendTransaction, waitForExecution, getMaxSpendableAmount, getPortfolio, isExecutionError, BundleFailedError, ExecutionError, SourceChainRequiredForSmartSessionsError, UserOperationRequiredForSmartSessionsError, OrderPathRequiredForIntentsError, SessionChainRequiredError, };
|
|
22
23
|
export type { BundleData, TransactionResult };
|
|
23
24
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../execution/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,KAAK,EAIX,MAAM,MAAM,CAAA;AAKb,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AASnD,OAAO,KAAK,EAEV,uBAAuB,EAGvB,WAAW,EACZ,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../execution/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,KAAK,EAIX,MAAM,MAAM,CAAA;AAKb,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AASnD,OAAO,KAAK,EAEV,uBAAuB,EAGvB,WAAW,EACZ,MAAM,UAAU,CAAA;AACjB,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EAChB,gCAAgC,EAChC,yBAAyB,EACzB,wCAAwC,EACxC,0CAA0C,EAC3C,MAAM,SAAS,CAAA;AAEhB,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAe5D,iBAAe,eAAe,CAC5B,MAAM,EAAE,uBAAuB,EAC/B,WAAW,EAAE,WAAW,8BAyBzB;AA2LD,iBAAe,gBAAgB,CAC7B,MAAM,EAAE,uBAAuB,EAC/B,MAAM,EAAE,iBAAiB,EACzB,uBAAuB,EAAE,OAAO;;;;;;;;;;;;GAwCjC;AAED,iBAAe,qBAAqB,CAClC,MAAM,EAAE,uBAAuB,EAC/B,KAAK,EAAE,KAAK,EACZ,YAAY,EAAE,OAAO,EACrB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,MAAM,CAAC,CASjB;AAED,iBAAe,YAAY,CACzB,MAAM,EAAE,uBAAuB,EAC/B,UAAU,EAAE,OAAO,yDAMpB;AAED,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,qBAAqB,EACrB,YAAY,EAEZ,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,wCAAwC,EACxC,0CAA0C,EAC1C,gCAAgC,EAChC,yBAAyB,GAC1B,CAAA;AACD,YAAY,EAAE,UAAU,EAAE,iBAAiB,EAAE,CAAA"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SessionChainRequiredError = exports.OrderPathRequiredForIntentsError = exports.UserOperationRequiredForSmartSessionsError = exports.SourceChainRequiredForSmartSessionsError = exports.ExecutionError = exports.BundleFailedError = exports.isExecutionError = void 0;
|
|
3
4
|
exports.sendTransaction = sendTransaction;
|
|
4
5
|
exports.waitForExecution = waitForExecution;
|
|
5
6
|
exports.getMaxSpendableAmount = getMaxSpendableAmount;
|
|
@@ -10,6 +11,14 @@ const accounts_1 = require("../accounts");
|
|
|
10
11
|
const utils_1 = require("../accounts/utils");
|
|
11
12
|
const orchestrator_1 = require("../orchestrator");
|
|
12
13
|
const registry_1 = require("../orchestrator/registry");
|
|
14
|
+
const error_1 = require("./error");
|
|
15
|
+
Object.defineProperty(exports, "BundleFailedError", { enumerable: true, get: function () { return error_1.BundleFailedError; } });
|
|
16
|
+
Object.defineProperty(exports, "ExecutionError", { enumerable: true, get: function () { return error_1.ExecutionError; } });
|
|
17
|
+
Object.defineProperty(exports, "isExecutionError", { enumerable: true, get: function () { return error_1.isExecutionError; } });
|
|
18
|
+
Object.defineProperty(exports, "OrderPathRequiredForIntentsError", { enumerable: true, get: function () { return error_1.OrderPathRequiredForIntentsError; } });
|
|
19
|
+
Object.defineProperty(exports, "SessionChainRequiredError", { enumerable: true, get: function () { return error_1.SessionChainRequiredError; } });
|
|
20
|
+
Object.defineProperty(exports, "SourceChainRequiredForSmartSessionsError", { enumerable: true, get: function () { return error_1.SourceChainRequiredForSmartSessionsError; } });
|
|
21
|
+
Object.defineProperty(exports, "UserOperationRequiredForSmartSessionsError", { enumerable: true, get: function () { return error_1.UserOperationRequiredForSmartSessionsError; } });
|
|
13
22
|
const smart_session_1 = require("./smart-session");
|
|
14
23
|
const utils_2 = require("./utils");
|
|
15
24
|
const POLLING_INTERVAL = 500;
|
|
@@ -43,7 +52,7 @@ async function sendTransactionInternal(config, sourceChain, targetChain, calls,
|
|
|
43
52
|
const asUserOp = signers?.type === 'guardians' || signers?.type === 'session';
|
|
44
53
|
if (asUserOp) {
|
|
45
54
|
if (!sourceChain) {
|
|
46
|
-
throw new
|
|
55
|
+
throw new error_1.SourceChainRequiredForSmartSessionsError();
|
|
47
56
|
}
|
|
48
57
|
const withSession = signers?.type === 'session' ? signers.session : null;
|
|
49
58
|
if (withSession) {
|
|
@@ -95,7 +104,7 @@ async function sendTransactionAsUserOp(config, sourceChain, targetChain, calls,
|
|
|
95
104
|
async function sendTransactionAsIntent(config, sourceChain, targetChain, calls, gasLimit, tokenRequests, accountAddress, signers) {
|
|
96
105
|
const { orderPath, hash: orderBundleHash } = await (0, utils_2.prepareTransactionAsIntent)(config, sourceChain, targetChain, calls, gasLimit, tokenRequests, accountAddress);
|
|
97
106
|
if (!orderPath) {
|
|
98
|
-
throw new
|
|
107
|
+
throw new error_1.OrderPathRequiredForIntentsError();
|
|
99
108
|
}
|
|
100
109
|
const signature = await (0, utils_2.signIntent)(config, sourceChain, targetChain, orderBundleHash, signers);
|
|
101
110
|
return await (0, utils_2.submitIntentInternal)(config, sourceChain, targetChain, orderPath, signature, true);
|
|
@@ -118,7 +127,7 @@ async function waitForExecution(config, result, acceptsPreconfirmations) {
|
|
|
118
127
|
await new Promise((resolve) => setTimeout(resolve, POLLING_INTERVAL));
|
|
119
128
|
}
|
|
120
129
|
if (bundleResult.status === orchestrator_1.BUNDLE_STATUS_FAILED) {
|
|
121
|
-
throw new
|
|
130
|
+
throw new error_1.BundleFailedError();
|
|
122
131
|
}
|
|
123
132
|
return bundleResult;
|
|
124
133
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"smart-session.d.ts","sourceRoot":"","sources":["../../../execution/smart-session.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,KAAK,EAKV,KAAK,GAAG,EAIT,MAAM,MAAM,CAAA;AAkBb,OAAO,EACL,WAAW,EAEX,iBAAiB,EAGjB,oBAAoB,EACrB,MAAM,sCAAsC,CAAA;AAC7C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAEhD,OAAO,KAAK,EAAe,uBAAuB,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"smart-session.d.ts","sourceRoot":"","sources":["../../../execution/smart-session.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,KAAK,EAKV,KAAK,GAAG,EAIT,MAAM,MAAM,CAAA;AAkBb,OAAO,EACL,WAAW,EAEX,iBAAiB,EAGjB,oBAAoB,EACrB,MAAM,sCAAsC,CAAA;AAC7C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAEhD,OAAO,KAAK,EAAe,uBAAuB,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAG7E,UAAU,cAAc;IACtB,oBAAoB,EAAE,GAAG,CAAA;IACzB,IAAI,EAAE,oBAAoB,CAAA;IAC1B,iBAAiB,EAAE,WAAW,EAAE,CAAA;IAChC,iBAAiB,EAA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