@rhinestone/sdk 0.12.6 → 0.12.7
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 +60 -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/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,MAAM,CAAA;KACjB;CAMF;AAED,cAAM,wCAAyC,SAAQ,YAAY;gBACrD,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,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,EACrB,IAAI,EACJ,QAAQ,EACR,uBAAuB,EACvB,OAAO,EACR,MAAM,UAAU,C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E,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,EACL,GAAG,EACH,OAAO,EAQP,GAAG,EAEH,YAAY,EAMb,MAAM,MAAM,CAA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AAM,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,uBAAuB,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAK1E,OAAO,EAAoC,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,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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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,EAAE,iBAAiB,CAAA;CACrC;AAED,iBAAe,iBAAiB,CAC9B,MAAM,EAAE,uBAAuB,EAC/B,QAAQ,EAAE,OAAO,EAAE,EACnB,YAAY,EAAE,MAAM,EACpB,SAAS,CAAC,EAAE,GAAG,GACd,OAAO,CAAC,cAAc,CAAC,CA2BzB;AA2FD,iBAAS,mBAAmB,CAAC,YAAY,EAAE,WAAW,EAAE,GAAG,GAAG,CAgC7D;AAiLD,iBAAe,kBAAkB,CAC/B,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,uBAAuB,EAC/B,OAAO,EAAE,OAAO,iBAiCjB;AAED,iBAAe,WAAW,CACxB,WAAW,EAAE,KAAK,EAClB,SAAS,EAAE,SAAS,EACpB,cAAc,EAAE,OAAO;;;;;GAiExB;AAED,iBAAS,mBAAmB,CAC1B,SAAS,EAAE,GAAG,EACd,kBAAkB,EAAE,GAAG,EACvB,UAAU,EAAE,GAAG,EACf,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,OAAO,iBAkBrB;AAED,OAAO,EACL,kBAAkB,EAClB,WAAW,EACX,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,GACpB,CAAA;AACD,YAAY,EAAE,cAAc,EAAE,CAAA"}
|
|
@@ -12,13 +12,14 @@ const modules_1 = require("../modules");
|
|
|
12
12
|
const validators_1 = require("../modules/validators");
|
|
13
13
|
const smart_sessions_1 = require("../modules/validators/smart-sessions");
|
|
14
14
|
const utils_2 = require("../orchestrator/utils");
|
|
15
|
+
const error_1 = require("./error");
|
|
15
16
|
async function getSessionDetails(config, sessions, sessionIndex, signature) {
|
|
16
17
|
const account = (0, accounts_1.getAccountProvider)(config);
|
|
17
18
|
const accountAddress = (0, accounts_1.getAddress)(config);
|
|
18
19
|
const sessionDetails = await getEnableSessionDetails(account.type, sessions, sessionIndex, accountAddress);
|
|
19
20
|
const chain = sessions[sessionIndex].chain;
|
|
20
21
|
if (!chain) {
|
|
21
|
-
throw new
|
|
22
|
+
throw new error_1.SessionChainRequiredError();
|
|
22
23
|
}
|
|
23
24
|
const validator = {
|
|
24
25
|
address: sessionDetails.enableSessionData.validator,
|
|
@@ -40,7 +41,7 @@ async function getEnableSessionDetails(accountType, sessions, sessionIndex, acco
|
|
|
40
41
|
});
|
|
41
42
|
const sessionChain = session.chain;
|
|
42
43
|
if (!sessionChain) {
|
|
43
|
-
throw new
|
|
44
|
+
throw new error_1.SessionChainRequiredError();
|
|
44
45
|
}
|
|
45
46
|
const sessionNonce = await getSessionNonce(publicClient, accountAddress, permissionId);
|
|
46
47
|
const sessionData = await (0, smart_sessions_1.getSessionData)(sessionChain, session);
|
|
@@ -74,7 +75,7 @@ async function getEnableSessionDetails(accountType, sessions, sessionIndex, acco
|
|
|
74
75
|
const sessionToEnable = sessions[sessionIndex || 0];
|
|
75
76
|
const sessionChain = sessionToEnable.chain;
|
|
76
77
|
if (!sessionChain) {
|
|
77
|
-
throw new
|
|
78
|
+
throw new error_1.SessionChainRequiredError();
|
|
78
79
|
}
|
|
79
80
|
const sessionData = await (0, smart_sessions_1.getSessionData)(sessionChain, sessionToEnable);
|
|
80
81
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../execution/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,KAAK,EAGL,GAAG,EAOJ,MAAM,MAAM,CAAA;AACb,OAAO,EAGL,aAAa,EACd,MAAM,0BAA0B,CAAA;AA6BjC,OAAO,EAEL,SAAS,EAGV,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EACL,IAAI,EAEJ,uBAAuB,EACvB,SAAS,EACT,YAAY,EACZ,WAAW,EACZ,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../execution/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,KAAK,EAGL,GAAG,EAOJ,MAAM,MAAM,CAAA;AACb,OAAO,EAGL,aAAa,EACd,MAAM,0BAA0B,CAAA;AA6BjC,OAAO,EAEL,SAAS,EAGV,MA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G,SAAS,EAC9B,WAAW,EAAE,KAAK,EAClB,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,GAAG,EACd,MAAM,EAAE,OAAO,8BA6BhB;AAED,iBAAe,mBAAmB,CAChC,MAAM,EAAE,uBAAuB,EAC/B,OAAO,EAAE,SAAS,GAAG,SAAS,EAC9B,YAAY,EAAE,GAAG,EACjB,KAAK,EAAE,KAAK,yKAuBb;AA0FD,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,sBAAsB,EACtB,kBAAkB,EAClB,SAAS,EACT,UAAU,EACV,UAAU,EACV,YAAY,EACZ,0BAA0B,EAC1B,oBAAoB,EACpB,mBAAmB,GACpB,CAAA;AACD,YAAY,EACV,UAAU,EACV,iBAAiB,EACjB,uBAAuB,EACvB,qBAAqB,GACtB,CAAA"}
|
|
@@ -21,6 +21,7 @@ const core_1 = require("../modules/validators/core");
|
|
|
21
21
|
const orchestrator_1 = require("../orchestrator");
|
|
22
22
|
const consts_1 = require("../orchestrator/consts");
|
|
23
23
|
const registry_1 = require("../orchestrator/registry");
|
|
24
|
+
const error_1 = require("./error");
|
|
24
25
|
const smart_session_1 = require("./smart-session");
|
|
25
26
|
async function prepareTransaction(config, transaction) {
|
|
26
27
|
const { sourceChain, targetChain, tokenRequests, signers } = getTransactionParams(transaction);
|
|
@@ -29,7 +30,7 @@ async function prepareTransaction(config, transaction) {
|
|
|
29
30
|
const asUserOp = signers?.type === 'guardians' || signers?.type === 'session';
|
|
30
31
|
if (asUserOp) {
|
|
31
32
|
if (!sourceChain) {
|
|
32
|
-
throw new
|
|
33
|
+
throw new error_1.SourceChainRequiredForSmartSessionsError();
|
|
33
34
|
}
|
|
34
35
|
// Smart sessions require a UserOp flow
|
|
35
36
|
bundleData = await prepareTransactionAsUserOp(config, sourceChain, targetChain, transaction.calls, transaction.gasLimit, tokenRequests, accountAddress, signers);
|
|
@@ -50,11 +51,11 @@ async function signTransaction(config, preparedTransaction) {
|
|
|
50
51
|
let signature;
|
|
51
52
|
if (withSession) {
|
|
52
53
|
if (!sourceChain) {
|
|
53
|
-
throw new
|
|
54
|
+
throw new error_1.SourceChainRequiredForSmartSessionsError();
|
|
54
55
|
}
|
|
55
56
|
const userOp = bundleData.userOp;
|
|
56
57
|
if (!userOp) {
|
|
57
|
-
throw new
|
|
58
|
+
throw new error_1.UserOperationRequiredForSmartSessionsError();
|
|
58
59
|
}
|
|
59
60
|
// Smart sessions require a UserOp flow
|
|
60
61
|
signature = await signUserOp(config, sourceChain, targetChain, accountAddress, signers, userOp, bundleData.orderPath);
|
|
@@ -74,11 +75,11 @@ async function submitTransaction(config, signedTransaction) {
|
|
|
74
75
|
const withSession = signers?.type === 'session' ? signers.session : null;
|
|
75
76
|
if (withSession) {
|
|
76
77
|
if (!sourceChain) {
|
|
77
|
-
throw new
|
|
78
|
+
throw new error_1.SourceChainRequiredForSmartSessionsError();
|
|
78
79
|
}
|
|
79
80
|
const userOp = bundleData.userOp;
|
|
80
81
|
if (!userOp) {
|
|
81
|
-
throw new
|
|
82
|
+
throw new error_1.UserOperationRequiredForSmartSessionsError();
|
|
82
83
|
}
|
|
83
84
|
// Smart sessions require a UserOp flow
|
|
84
85
|
return await submitUserOp(config, sourceChain, targetChain, userOp, signature, bundleData.orderPath);
|
|
@@ -86,7 +87,7 @@ async function submitTransaction(config, signedTransaction) {
|
|
|
86
87
|
else {
|
|
87
88
|
const orderPath = bundleData.orderPath;
|
|
88
89
|
if (!orderPath) {
|
|
89
|
-
throw new
|
|
90
|
+
throw new error_1.OrderPathRequiredForIntentsError();
|
|
90
91
|
}
|
|
91
92
|
return await submitIntent(config, sourceChain, targetChain, orderPath, signature);
|
|
92
93
|
}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import type { Address, Chain, Hex } from 'viem';
|
|
2
2
|
import { UserOperationReceipt } from 'viem/account-abstraction';
|
|
3
|
+
import { AccountError, Eip7702AccountMustHaveEoaError, Eip7702NotSupportedForAccountError, ExistingEip7702AccountsNotSupportedError, FactoryArgsNotAvailableError, isAccountError, SigningNotSupportedForAccountError, SignMessageNotSupportedByAccountError, SmartSessionsNotEnabledError } from './accounts';
|
|
3
4
|
import { addOwner, changeThreshold, disableEcdsa, disablePasskeys, enableEcdsa, enablePasskeys, encodeSmartSessionSignature, recover, removeOwner, setUpRecovery, trustAttester } from './actions';
|
|
4
5
|
import type { TransactionResult } from './execution';
|
|
6
|
+
import { BundleFailedError, ExecutionError, isExecutionError, OrderPathRequiredForIntentsError, SessionChainRequiredError, SourceChainRequiredForSmartSessionsError, UserOperationRequiredForSmartSessionsError } from './execution';
|
|
5
7
|
import { SessionDetails } from './execution/smart-session';
|
|
6
8
|
import { BundleData, PreparedTransactionData, SignedTransactionData } from './execution/utils';
|
|
7
|
-
import
|
|
9
|
+
import { BundleResult, BundleStatus, MetaIntent, MultiChainCompact, PostOrderBundleResult, SignedMultiChainCompact, UserTokenBalance } from './orchestrator';
|
|
10
|
+
import { AuthenticationRequiredError, InsufficientBalanceError, InvalidApiKeyError, InvalidBundleSignatureError, isOrchestratorError, NoPathFoundError, OnlyOneTargetTokenAmountCanBeUnsetError, OrchestratorError, OrderBundleNotFoundError, TokenNotSupportedError, UnsupportedChainError, UnsupportedChainIdError, UnsupportedTokenError } from './orchestrator';
|
|
8
11
|
import type { Call, Execution, RhinestoneAccountConfig, Session, Transaction } from './types';
|
|
9
12
|
interface RhinestoneAccount {
|
|
10
13
|
config: RhinestoneAccountConfig;
|
|
@@ -32,6 +35,6 @@ interface RhinestoneAccount {
|
|
|
32
35
|
* @returns account
|
|
33
36
|
*/
|
|
34
37
|
declare function createRhinestoneAccount(config: RhinestoneAccountConfig): Promise<RhinestoneAccount>;
|
|
35
|
-
export { createRhinestoneAccount, addOwner, changeThreshold, disableEcdsa, disablePasskeys, enableEcdsa, enablePasskeys, recover, removeOwner, setUpRecovery, encodeSmartSessionSignature, trustAttester, };
|
|
38
|
+
export { createRhinestoneAccount, addOwner, changeThreshold, disableEcdsa, disablePasskeys, enableEcdsa, enablePasskeys, recover, removeOwner, setUpRecovery, encodeSmartSessionSignature, trustAttester, isAccountError, AccountError, Eip7702AccountMustHaveEoaError, ExistingEip7702AccountsNotSupportedError, FactoryArgsNotAvailableError, SmartSessionsNotEnabledError, SigningNotSupportedForAccountError, SignMessageNotSupportedByAccountError, Eip7702NotSupportedForAccountError, isExecutionError, BundleFailedError, ExecutionError, SourceChainRequiredForSmartSessionsError, UserOperationRequiredForSmartSessionsError, OrderPathRequiredForIntentsError, SessionChainRequiredError, isOrchestratorError, AuthenticationRequiredError, InsufficientBalanceError, InvalidApiKeyError, InvalidBundleSignatureError, NoPathFoundError, OnlyOneTargetTokenAmountCanBeUnsetError, OrchestratorError, OrderBundleNotFoundError, TokenNotSupportedError, UnsupportedChainError, UnsupportedChainIdError, UnsupportedTokenError, };
|
|
36
39
|
export type { RhinestoneAccount, BundleStatus, Session, Call, Execution, MetaIntent, MultiChainCompact, PostOrderBundleResult, SignedMultiChainCompact, BundleData, PreparedTransactionData, SignedTransactionData, TransactionResult, };
|
|
37
40
|
//# 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,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAA;AAC/D,OAAO,EACL,YAAY,EAEZ,8BAA8B,EAC9B,kCAAkC,EAClC,wCA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GAC9B,OAAO,CAAC,iBAAiB,CAAC,CA+G5B;AAED,OAAO,EACL,uBAAuB,EACvB,QAAQ,EACR,eAAe,EACf,YAAY,EACZ,eAAe,EACf,WAAW,EACX,cAAc,EACd,OAAO,EACP,WAAW,EACX,aAAa,EACb,2BAA2B,EAC3B,aAAa,EAEb,cAAc,EACd,YAAY,EACZ,8BAA8B,EAC9B,wCAAwC,EACxC,4BAA4B,EAC5B,4BAA4B,EAC5B,kCAAkC,EAClC,qCAAqC,EACrC,kCAAkC,EAElC,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,wCAAwC,EACxC,0CAA0C,EAC1C,gCAAgC,EAChC,yBAAyB,EAEzB,mBAAmB,EACnB,2BAA2B,EAC3B,wBAAwB,EACxB,kBAAkB,EAClB,2BAA2B,EAC3B,gBAAgB,EAChB,uCAAuC,EACvC,iBAAiB,EACjB,wBAAwB,EACxB,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,GACtB,CAAA;AACD,YAAY,EACV,iBAAiB,EACjB,YAAY,EACZ,OAAO,EACP,IAAI,EACJ,SAAS,EACT,UAAU,EACV,iBAAiB,EACjB,qBAAqB,EACrB,uBAAuB,EACvB,UAAU,EACV,uBAAuB,EACvB,qBAAqB,EACrB,iBAAiB,GAClB,CAAA"}
|
package/dist/src/index.js
CHANGED
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.trustAttester = exports.encodeSmartSessionSignature = exports.setUpRecovery = exports.removeOwner = exports.recover = exports.enablePasskeys = exports.enableEcdsa = exports.disablePasskeys = exports.disableEcdsa = exports.changeThreshold = exports.addOwner = void 0;
|
|
3
|
+
exports.UnsupportedTokenError = exports.UnsupportedChainIdError = exports.UnsupportedChainError = exports.TokenNotSupportedError = exports.OrderBundleNotFoundError = exports.OrchestratorError = exports.OnlyOneTargetTokenAmountCanBeUnsetError = exports.NoPathFoundError = exports.InvalidBundleSignatureError = exports.InvalidApiKeyError = exports.InsufficientBalanceError = exports.AuthenticationRequiredError = exports.isOrchestratorError = exports.SessionChainRequiredError = exports.OrderPathRequiredForIntentsError = exports.UserOperationRequiredForSmartSessionsError = exports.SourceChainRequiredForSmartSessionsError = exports.ExecutionError = exports.BundleFailedError = exports.isExecutionError = exports.Eip7702NotSupportedForAccountError = exports.SignMessageNotSupportedByAccountError = exports.SigningNotSupportedForAccountError = exports.SmartSessionsNotEnabledError = exports.FactoryArgsNotAvailableError = exports.ExistingEip7702AccountsNotSupportedError = exports.Eip7702AccountMustHaveEoaError = exports.AccountError = exports.isAccountError = exports.trustAttester = exports.encodeSmartSessionSignature = exports.setUpRecovery = exports.removeOwner = exports.recover = exports.enablePasskeys = exports.enableEcdsa = exports.disablePasskeys = exports.disableEcdsa = exports.changeThreshold = exports.addOwner = void 0;
|
|
4
4
|
exports.createRhinestoneAccount = createRhinestoneAccount;
|
|
5
5
|
const accounts_1 = require("./accounts");
|
|
6
|
+
Object.defineProperty(exports, "AccountError", { enumerable: true, get: function () { return accounts_1.AccountError; } });
|
|
7
|
+
Object.defineProperty(exports, "Eip7702AccountMustHaveEoaError", { enumerable: true, get: function () { return accounts_1.Eip7702AccountMustHaveEoaError; } });
|
|
8
|
+
Object.defineProperty(exports, "Eip7702NotSupportedForAccountError", { enumerable: true, get: function () { return accounts_1.Eip7702NotSupportedForAccountError; } });
|
|
9
|
+
Object.defineProperty(exports, "ExistingEip7702AccountsNotSupportedError", { enumerable: true, get: function () { return accounts_1.ExistingEip7702AccountsNotSupportedError; } });
|
|
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; } });
|
|
6
15
|
const actions_1 = require("./actions");
|
|
7
16
|
Object.defineProperty(exports, "addOwner", { enumerable: true, get: function () { return actions_1.addOwner; } });
|
|
8
17
|
Object.defineProperty(exports, "changeThreshold", { enumerable: true, get: function () { return actions_1.changeThreshold; } });
|
|
@@ -16,9 +25,30 @@ Object.defineProperty(exports, "removeOwner", { enumerable: true, get: function
|
|
|
16
25
|
Object.defineProperty(exports, "setUpRecovery", { enumerable: true, get: function () { return actions_1.setUpRecovery; } });
|
|
17
26
|
Object.defineProperty(exports, "trustAttester", { enumerable: true, get: function () { return actions_1.trustAttester; } });
|
|
18
27
|
const execution_1 = require("./execution");
|
|
28
|
+
Object.defineProperty(exports, "BundleFailedError", { enumerable: true, get: function () { return execution_1.BundleFailedError; } });
|
|
29
|
+
Object.defineProperty(exports, "ExecutionError", { enumerable: true, get: function () { return execution_1.ExecutionError; } });
|
|
30
|
+
Object.defineProperty(exports, "isExecutionError", { enumerable: true, get: function () { return execution_1.isExecutionError; } });
|
|
31
|
+
Object.defineProperty(exports, "OrderPathRequiredForIntentsError", { enumerable: true, get: function () { return execution_1.OrderPathRequiredForIntentsError; } });
|
|
32
|
+
Object.defineProperty(exports, "SessionChainRequiredError", { enumerable: true, get: function () { return execution_1.SessionChainRequiredError; } });
|
|
33
|
+
Object.defineProperty(exports, "SourceChainRequiredForSmartSessionsError", { enumerable: true, get: function () { return execution_1.SourceChainRequiredForSmartSessionsError; } });
|
|
34
|
+
Object.defineProperty(exports, "UserOperationRequiredForSmartSessionsError", { enumerable: true, get: function () { return execution_1.UserOperationRequiredForSmartSessionsError; } });
|
|
19
35
|
const smart_session_1 = require("./execution/smart-session");
|
|
20
36
|
const utils_1 = require("./execution/utils");
|
|
21
37
|
const modules_1 = require("./modules");
|
|
38
|
+
const orchestrator_1 = require("./orchestrator");
|
|
39
|
+
Object.defineProperty(exports, "AuthenticationRequiredError", { enumerable: true, get: function () { return orchestrator_1.AuthenticationRequiredError; } });
|
|
40
|
+
Object.defineProperty(exports, "InsufficientBalanceError", { enumerable: true, get: function () { return orchestrator_1.InsufficientBalanceError; } });
|
|
41
|
+
Object.defineProperty(exports, "InvalidApiKeyError", { enumerable: true, get: function () { return orchestrator_1.InvalidApiKeyError; } });
|
|
42
|
+
Object.defineProperty(exports, "InvalidBundleSignatureError", { enumerable: true, get: function () { return orchestrator_1.InvalidBundleSignatureError; } });
|
|
43
|
+
Object.defineProperty(exports, "isOrchestratorError", { enumerable: true, get: function () { return orchestrator_1.isOrchestratorError; } });
|
|
44
|
+
Object.defineProperty(exports, "NoPathFoundError", { enumerable: true, get: function () { return orchestrator_1.NoPathFoundError; } });
|
|
45
|
+
Object.defineProperty(exports, "OnlyOneTargetTokenAmountCanBeUnsetError", { enumerable: true, get: function () { return orchestrator_1.OnlyOneTargetTokenAmountCanBeUnsetError; } });
|
|
46
|
+
Object.defineProperty(exports, "OrchestratorError", { enumerable: true, get: function () { return orchestrator_1.OrchestratorError; } });
|
|
47
|
+
Object.defineProperty(exports, "OrderBundleNotFoundError", { enumerable: true, get: function () { return orchestrator_1.OrderBundleNotFoundError; } });
|
|
48
|
+
Object.defineProperty(exports, "TokenNotSupportedError", { enumerable: true, get: function () { return orchestrator_1.TokenNotSupportedError; } });
|
|
49
|
+
Object.defineProperty(exports, "UnsupportedChainError", { enumerable: true, get: function () { return orchestrator_1.UnsupportedChainError; } });
|
|
50
|
+
Object.defineProperty(exports, "UnsupportedChainIdError", { enumerable: true, get: function () { return orchestrator_1.UnsupportedChainIdError; } });
|
|
51
|
+
Object.defineProperty(exports, "UnsupportedTokenError", { enumerable: true, get: function () { return orchestrator_1.UnsupportedTokenError; } });
|
|
22
52
|
/**
|
|
23
53
|
* Initialize a Rhinestone account
|
|
24
54
|
* Note: accounts are deployed onchain only when the first transaction is sent.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../orchestrator/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,OAAO,EAAU,KAAK,GAAG,EAAE,MAAM,MAAM,CAAA;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../orchestrator/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,OAAO,EAAU,KAAK,GAAG,EAAE,MAAM,MAAM,CAAA;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAgB7D,OAAO,KAAK,EACV,WAAW,EACX,YAAY,EAEZ,UAAU,EAEV,eAAe,EACf,aAAa,EACb,SAAS,EACT,qBAAqB,EACrB,uBAAuB,EAEvB,gBAAgB,EACjB,MAAM,SAAS,CAAA;AAShB,qBAAa,YAAY;IACvB,OAAO,CAAC,SAAS,CAAQ;IACzB,OAAO,CAAC,MAAM,CAAQ;gBAEV,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAKvC,YAAY,CAChB,WAAW,EAAE,OAAO,EACpB,MAAM,CAAC,EAAE;QACP,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;QACnB,MAAM,CAAC,EAAE;YACP,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,EAAE,CAAA;SAC7B,CAAA;KACF,GACA,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAwCxB,iBAAiB,CACrB,WAAW,EAAE,OAAO,EACpB,aAAa,EAAE,MAAM,EACrB,kBAAkB,EAAE,OAAO,EAC3B,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,MAAM,CAAC;IAgCZ,aAAa,CACjB,MAAM,EAAE,aAAa,EACrB,WAAW,EAAE,OAAO,GACnB,OAAO,CAAC,eAAe,CAAC;IAqBrB,YAAY,CAChB,MAAM,EAAE,UAAU,EAClB,WAAW,EAAE,OAAO,GACnB,OAAO,CAAC,SAAS,CAAC;IAgCf,qBAAqB,CACzB,kBAAkB,EAAE;QAClB,iBAAiB,EAAE,uBAAuB,CAAA;QAC1C,QAAQ,CAAC,EAAE,GAAG,CAAA;QACd,MAAM,CAAC,EAAE,aAAa,CAAA;KACvB,EAAE,GACF,OAAO,CAAC,qBAAqB,CAAC;IA2C3B,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAyBxD,iBAAiB,CACrB,KAAK,GAAE,MAAW,EAClB,MAAM,GAAE,MAAU,GACjB,OAAO,CAAC;QAAE,cAAc,EAAE,WAAW,EAAE,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAuBlE,OAAO,CAAC,UAAU;CAwHnB"}
|
|
@@ -233,17 +233,71 @@ class Orchestrator {
|
|
|
233
233
|
console.error(`Context: ${JSON.stringify(err.context, undefined, 4)}`);
|
|
234
234
|
}
|
|
235
235
|
context = { ...context, ...err.context };
|
|
236
|
+
const message = err.message;
|
|
237
|
+
const finalErrorParams = {
|
|
238
|
+
context: { ...context, traceId },
|
|
239
|
+
errorType,
|
|
240
|
+
traceId,
|
|
241
|
+
};
|
|
242
|
+
if (message === 'Insufficient balance') {
|
|
243
|
+
throw new error_1.InsufficientBalanceError(finalErrorParams);
|
|
244
|
+
}
|
|
245
|
+
else if (message === 'Unsupported chain id') {
|
|
246
|
+
throw new error_1.UnsupportedChainIdError(finalErrorParams);
|
|
247
|
+
}
|
|
248
|
+
else if (message.startsWith('Unsupported chain ')) {
|
|
249
|
+
const chainIdMatch = message.match(/Unsupported chain (\d+)/);
|
|
250
|
+
if (chainIdMatch) {
|
|
251
|
+
const chainId = parseInt(chainIdMatch[1], 10);
|
|
252
|
+
throw new error_1.UnsupportedChainError(chainId, finalErrorParams);
|
|
253
|
+
}
|
|
254
|
+
throw new error_1.UnsupportedChainIdError(finalErrorParams);
|
|
255
|
+
}
|
|
256
|
+
else if (message.includes('Unsupported token') &&
|
|
257
|
+
message.includes('for chain')) {
|
|
258
|
+
const tokenMatch = message.match(/Unsupported token (\w+) for chain (\d+)/);
|
|
259
|
+
if (tokenMatch) {
|
|
260
|
+
const tokenSymbol = tokenMatch[1];
|
|
261
|
+
const chainId = parseInt(tokenMatch[2], 10);
|
|
262
|
+
throw new error_1.UnsupportedTokenError(tokenSymbol, chainId, finalErrorParams);
|
|
263
|
+
}
|
|
264
|
+
throw new error_1.OrchestratorError({ message, ...finalErrorParams });
|
|
265
|
+
}
|
|
266
|
+
else if (message.includes('not supported on chain')) {
|
|
267
|
+
const tokenMatch = message.match(/Token (.+) not supported on chain (\d+)/);
|
|
268
|
+
if (tokenMatch) {
|
|
269
|
+
const tokenAddress = tokenMatch[1];
|
|
270
|
+
const chainId = parseInt(tokenMatch[2], 10);
|
|
271
|
+
throw new error_1.TokenNotSupportedError(tokenAddress, chainId, finalErrorParams);
|
|
272
|
+
}
|
|
273
|
+
throw new error_1.OrchestratorError({ message, ...finalErrorParams });
|
|
274
|
+
}
|
|
275
|
+
else if (message === 'Authentication is required') {
|
|
276
|
+
throw new error_1.AuthenticationRequiredError(finalErrorParams);
|
|
277
|
+
}
|
|
278
|
+
else if (message === 'Invalid API key') {
|
|
279
|
+
throw new error_1.InvalidApiKeyError(finalErrorParams);
|
|
280
|
+
}
|
|
281
|
+
else if (message === 'Invalid bundle signature') {
|
|
282
|
+
throw new error_1.InvalidBundleSignatureError(finalErrorParams);
|
|
283
|
+
}
|
|
284
|
+
else if (message === 'Only one target token amount can be unset') {
|
|
285
|
+
throw new error_1.OnlyOneTargetTokenAmountCanBeUnsetError(finalErrorParams);
|
|
286
|
+
}
|
|
287
|
+
else if (message === 'No Path Found') {
|
|
288
|
+
throw new error_1.NoPathFoundError(finalErrorParams);
|
|
289
|
+
}
|
|
290
|
+
else if (message === 'Order bundle not found') {
|
|
291
|
+
throw new error_1.OrderBundleNotFoundError(finalErrorParams);
|
|
292
|
+
}
|
|
293
|
+
else {
|
|
294
|
+
throw new error_1.OrchestratorError({ message, ...finalErrorParams });
|
|
295
|
+
}
|
|
236
296
|
}
|
|
237
297
|
}
|
|
238
298
|
else {
|
|
239
299
|
console.error(error);
|
|
240
300
|
}
|
|
241
|
-
throw new error_1.OrchestratorError({
|
|
242
|
-
message: error.response.data.errors[0].message,
|
|
243
|
-
context,
|
|
244
|
-
errorType,
|
|
245
|
-
traceId: context.traceId,
|
|
246
|
-
});
|
|
247
301
|
}
|
|
248
302
|
}
|
|
249
303
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
declare class OrchestratorError extends Error {
|
|
2
2
|
private readonly _message;
|
|
3
3
|
private readonly _context;
|
|
4
4
|
private readonly _errorType;
|
|
@@ -14,5 +14,83 @@ export declare class OrchestratorError extends Error {
|
|
|
14
14
|
get errorType(): string;
|
|
15
15
|
get traceId(): string;
|
|
16
16
|
}
|
|
17
|
-
|
|
17
|
+
declare class InsufficientBalanceError extends OrchestratorError {
|
|
18
|
+
constructor(params?: {
|
|
19
|
+
context?: any;
|
|
20
|
+
errorType?: string;
|
|
21
|
+
traceId?: string;
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
declare class UnsupportedChainIdError extends OrchestratorError {
|
|
25
|
+
constructor(params?: {
|
|
26
|
+
context?: any;
|
|
27
|
+
errorType?: string;
|
|
28
|
+
traceId?: string;
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
declare class UnsupportedChainError extends OrchestratorError {
|
|
32
|
+
constructor(chainId: number, params?: {
|
|
33
|
+
context?: any;
|
|
34
|
+
errorType?: string;
|
|
35
|
+
traceId?: string;
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
declare class UnsupportedTokenError extends OrchestratorError {
|
|
39
|
+
constructor(tokenSymbol: string, chainId: number, params?: {
|
|
40
|
+
context?: any;
|
|
41
|
+
errorType?: string;
|
|
42
|
+
traceId?: string;
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
declare class TokenNotSupportedError extends OrchestratorError {
|
|
46
|
+
constructor(tokenAddress: string, chainId: number, params?: {
|
|
47
|
+
context?: any;
|
|
48
|
+
errorType?: string;
|
|
49
|
+
traceId?: string;
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
declare class AuthenticationRequiredError extends OrchestratorError {
|
|
53
|
+
constructor(params?: {
|
|
54
|
+
context?: any;
|
|
55
|
+
errorType?: string;
|
|
56
|
+
traceId?: string;
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
declare class InvalidApiKeyError extends OrchestratorError {
|
|
60
|
+
constructor(params?: {
|
|
61
|
+
context?: any;
|
|
62
|
+
errorType?: string;
|
|
63
|
+
traceId?: string;
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
declare class InvalidBundleSignatureError extends OrchestratorError {
|
|
67
|
+
constructor(params?: {
|
|
68
|
+
context?: any;
|
|
69
|
+
errorType?: string;
|
|
70
|
+
traceId?: string;
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
declare class OnlyOneTargetTokenAmountCanBeUnsetError extends OrchestratorError {
|
|
74
|
+
constructor(params?: {
|
|
75
|
+
context?: any;
|
|
76
|
+
errorType?: string;
|
|
77
|
+
traceId?: string;
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
declare class NoPathFoundError extends OrchestratorError {
|
|
81
|
+
constructor(params?: {
|
|
82
|
+
context?: any;
|
|
83
|
+
errorType?: string;
|
|
84
|
+
traceId?: string;
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
declare class OrderBundleNotFoundError extends OrchestratorError {
|
|
88
|
+
constructor(params?: {
|
|
89
|
+
context?: any;
|
|
90
|
+
errorType?: string;
|
|
91
|
+
traceId?: string;
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
declare function isOrchestratorError(error: Error): error is OrchestratorError;
|
|
95
|
+
export { isOrchestratorError, OrchestratorError, InsufficientBalanceError, UnsupportedChainIdError, UnsupportedChainError, UnsupportedTokenError, TokenNotSupportedError, AuthenticationRequiredError, InvalidApiKeyError, InvalidBundleSignatureError, OnlyOneTargetTokenAmountCanBeUnsetError, NoPathFoundError, OrderBundleNotFoundError, };
|
|
18
96
|
//# sourceMappingURL=error.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../orchestrator/error.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../orchestrator/error.ts"],"names":[],"mappings":"AAAA,cAAM,iBAAkB,SAAQ,KAAK;IACnC,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,wBAAyB,SAAQ,iBAAiB;gBAC1C,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,uBAAwB,SAAQ,iBAAiB;gBACzC,MAAM,CAAC,EAAE;QACnB,OAAO,CAAC,EAAE,GAAG,CAAA;QACb,SAAS,CA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OAAO,CAAC,EAAE,MAAM,CAAA;KACjB;CAMF;AAED,cAAM,uCAAwC,SAAQ,iBAAiB;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,gBAAiB,SAAQ,iBAAiB;gBAClC,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,wBAAyB,SAAQ,iBAAiB;gBAC1C,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,mBAAmB,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,IAAI,iBAAiB,CAErE;AAED,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,wBAAwB,EACxB,uBAAuB,EACvB,qBAAqB,EACrB,qBAAqB,EACrB,sBAAsB,EACtB,2BAA2B,EAC3B,kBAAkB,EAClB,2BAA2B,EAC3B,uCAAuC,EACvC,gBAAgB,EAChB,wBAAwB,GACzB,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.OrchestratorError = void 0;
|
|
3
|
+
exports.OrderBundleNotFoundError = exports.NoPathFoundError = exports.OnlyOneTargetTokenAmountCanBeUnsetError = exports.InvalidBundleSignatureError = exports.InvalidApiKeyError = exports.AuthenticationRequiredError = exports.TokenNotSupportedError = exports.UnsupportedTokenError = exports.UnsupportedChainError = exports.UnsupportedChainIdError = exports.InsufficientBalanceError = exports.OrchestratorError = void 0;
|
|
4
4
|
exports.isOrchestratorError = isOrchestratorError;
|
|
5
5
|
class OrchestratorError extends Error {
|
|
6
6
|
_message;
|
|
@@ -28,6 +28,105 @@ class OrchestratorError extends Error {
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
exports.OrchestratorError = OrchestratorError;
|
|
31
|
+
class InsufficientBalanceError extends OrchestratorError {
|
|
32
|
+
constructor(params) {
|
|
33
|
+
super({
|
|
34
|
+
message: 'Insufficient balance',
|
|
35
|
+
...params,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.InsufficientBalanceError = InsufficientBalanceError;
|
|
40
|
+
class UnsupportedChainIdError extends OrchestratorError {
|
|
41
|
+
constructor(params) {
|
|
42
|
+
super({
|
|
43
|
+
message: 'Unsupported chain id',
|
|
44
|
+
...params,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.UnsupportedChainIdError = UnsupportedChainIdError;
|
|
49
|
+
class UnsupportedChainError extends OrchestratorError {
|
|
50
|
+
constructor(chainId, params) {
|
|
51
|
+
super({
|
|
52
|
+
message: `Unsupported chain ${chainId}`,
|
|
53
|
+
...params,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.UnsupportedChainError = UnsupportedChainError;
|
|
58
|
+
class UnsupportedTokenError extends OrchestratorError {
|
|
59
|
+
constructor(tokenSymbol, chainId, params) {
|
|
60
|
+
super({
|
|
61
|
+
message: `Unsupported token ${tokenSymbol} for chain ${chainId}`,
|
|
62
|
+
...params,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
exports.UnsupportedTokenError = UnsupportedTokenError;
|
|
67
|
+
class TokenNotSupportedError extends OrchestratorError {
|
|
68
|
+
constructor(tokenAddress, chainId, params) {
|
|
69
|
+
super({
|
|
70
|
+
message: `Token ${tokenAddress} not supported on chain ${chainId}`,
|
|
71
|
+
...params,
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
exports.TokenNotSupportedError = TokenNotSupportedError;
|
|
76
|
+
class AuthenticationRequiredError extends OrchestratorError {
|
|
77
|
+
constructor(params) {
|
|
78
|
+
super({
|
|
79
|
+
message: 'Authentication is required',
|
|
80
|
+
...params,
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
exports.AuthenticationRequiredError = AuthenticationRequiredError;
|
|
85
|
+
class InvalidApiKeyError extends OrchestratorError {
|
|
86
|
+
constructor(params) {
|
|
87
|
+
super({
|
|
88
|
+
message: 'Invalid API key',
|
|
89
|
+
...params,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
exports.InvalidApiKeyError = InvalidApiKeyError;
|
|
94
|
+
class InvalidBundleSignatureError extends OrchestratorError {
|
|
95
|
+
constructor(params) {
|
|
96
|
+
super({
|
|
97
|
+
message: 'Invalid bundle signature',
|
|
98
|
+
...params,
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
exports.InvalidBundleSignatureError = InvalidBundleSignatureError;
|
|
103
|
+
class OnlyOneTargetTokenAmountCanBeUnsetError extends OrchestratorError {
|
|
104
|
+
constructor(params) {
|
|
105
|
+
super({
|
|
106
|
+
message: 'Only one target token amount can be unset',
|
|
107
|
+
...params,
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
exports.OnlyOneTargetTokenAmountCanBeUnsetError = OnlyOneTargetTokenAmountCanBeUnsetError;
|
|
112
|
+
class NoPathFoundError extends OrchestratorError {
|
|
113
|
+
constructor(params) {
|
|
114
|
+
super({
|
|
115
|
+
message: 'No Path Found',
|
|
116
|
+
...params,
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
exports.NoPathFoundError = NoPathFoundError;
|
|
121
|
+
class OrderBundleNotFoundError extends OrchestratorError {
|
|
122
|
+
constructor(params) {
|
|
123
|
+
super({
|
|
124
|
+
message: 'Order bundle not found',
|
|
125
|
+
...params,
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
exports.OrderBundleNotFoundError = OrderBundleNotFoundError;
|
|
31
130
|
function isOrchestratorError(error) {
|
|
32
131
|
return error instanceof OrchestratorError;
|
|
33
132
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Orchestrator } from './client';
|
|
2
2
|
import { RHINESTONE_SPOKE_POOL_ADDRESS } from './consts';
|
|
3
|
-
import { isOrchestratorError, OrchestratorError } from './error';
|
|
3
|
+
import { AuthenticationRequiredError, InsufficientBalanceError, InvalidApiKeyError, InvalidBundleSignatureError, isOrchestratorError, NoPathFoundError, OnlyOneTargetTokenAmountCanBeUnsetError, OrchestratorError, OrderBundleNotFoundError, TokenNotSupportedError, UnsupportedChainError, UnsupportedChainIdError, UnsupportedTokenError } from './error';
|
|
4
4
|
import { getHookAddress, getRhinestoneSpokePoolAddress, getSameChainModuleAddress, getSupportedTokens, getTargetModuleAddress, getTokenAddress, getTokenBalanceSlot, getTokenRootBalanceSlot, getTokenSymbol, getWethAddress, isTokenAddressSupported } from './registry';
|
|
5
5
|
import type { BundleResult, Execution, MetaIntent, MultiChainCompact, OrderCost, OrderCostResult, OrderFeeInput, OrderPath, PostOrderBundleResult, SignedMultiChainCompact, UserTokenBalance } from './types';
|
|
6
6
|
import { BUNDLE_STATUS_COMPLETED, BUNDLE_STATUS_EXPIRED, BUNDLE_STATUS_FAILED, BUNDLE_STATUS_FILLED, BUNDLE_STATUS_PARTIALLY_COMPLETED, BUNDLE_STATUS_PENDING, BUNDLE_STATUS_PRECONFIRMED, BUNDLE_STATUS_UNKNOWN } from './types';
|
|
7
7
|
import { applyInjectedExecutions, BundleStatusEnum, getEmptyUserOp, getOrderBundleHash } from './utils';
|
|
8
8
|
declare function getOrchestrator(apiKey: string, orchestratorUrl?: string): Orchestrator;
|
|
9
9
|
export type { Execution, BundleResult, MetaIntent, MultiChainCompact, OrderPath, SignedMultiChainCompact, PostOrderBundleResult, OrderCost, OrderCostResult, OrderFeeInput, UserTokenBalance, };
|
|
10
|
-
export { BundleStatusEnum as BundleStatus, BUNDLE_STATUS_PENDING, BUNDLE_STATUS_EXPIRED, BUNDLE_STATUS_PARTIALLY_COMPLETED, BUNDLE_STATUS_COMPLETED, BUNDLE_STATUS_FILLED, BUNDLE_STATUS_FAILED, BUNDLE_STATUS_PRECONFIRMED, BUNDLE_STATUS_UNKNOWN, RHINESTONE_SPOKE_POOL_ADDRESS, Orchestrator, OrchestratorError, getOrchestrator, getOrderBundleHash, getEmptyUserOp, getWethAddress, getTokenBalanceSlot, getTokenRootBalanceSlot, getTokenSymbol, getHookAddress, getSameChainModuleAddress, getTargetModuleAddress, getRhinestoneSpokePoolAddress, getTokenAddress, getSupportedTokens, isOrchestratorError, isTokenAddressSupported, applyInjectedExecutions, };
|
|
10
|
+
export { BundleStatusEnum as BundleStatus, BUNDLE_STATUS_PENDING, BUNDLE_STATUS_EXPIRED, BUNDLE_STATUS_PARTIALLY_COMPLETED, BUNDLE_STATUS_COMPLETED, BUNDLE_STATUS_FILLED, BUNDLE_STATUS_FAILED, BUNDLE_STATUS_PRECONFIRMED, BUNDLE_STATUS_UNKNOWN, RHINESTONE_SPOKE_POOL_ADDRESS, Orchestrator, AuthenticationRequiredError, InsufficientBalanceError, InvalidApiKeyError, InvalidBundleSignatureError, NoPathFoundError, OnlyOneTargetTokenAmountCanBeUnsetError, OrchestratorError, OrderBundleNotFoundError, TokenNotSupportedError, UnsupportedChainError, UnsupportedChainIdError, UnsupportedTokenError, getOrchestrator, getOrderBundleHash, getEmptyUserOp, getWethAddress, getTokenBalanceSlot, getTokenRootBalanceSlot, getTokenSymbol, getHookAddress, getSameChainModuleAddress, getTargetModuleAddress, getRhinestoneSpokePoolAddress, getTokenAddress, getSupportedTokens, isOrchestratorError, isTokenAddressSupported, applyInjectedExecutions, };
|
|
11
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../orchestrator/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AACvC,OAAO,EAAyB,6BAA6B,EAAE,MAAM,UAAU,CAAA;AAC/E,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../orchestrator/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AACvC,OAAO,EAAyB,6BAA6B,EAAE,MAAM,UAAU,CAAA;AAC/E,OAAO,EACL,2BAA2B,EAC3B,wBAAwB,EACxB,kBAAkB,EAClB,2BAA2B,EAC3B,mBAAmB,EACnB,gBAAgB,EAChB,uCAAuC,EACvC,iBAAiB,EACjB,wBAAwB,EACxB,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,EACtB,MAAM,SAAS,CAAA;AAChB,OAAO,EACL,cAAc,EACd,6BAA6B,EAC7B,yBAAyB,EACzB,kBAAkB,EAClB,sBAAsB,EACtB,eAAe,EACf,mBAAmB,EACnB,uBAAuB,EACvB,cAAc,EACd,cAAc,EACd,uBAAuB,EACxB,MAAM,YAAY,CAAA;AACnB,OAAO,KAAK,EACV,YAAY,EACZ,SAAS,EACT,UAAU,EACV,iBAAiB,EACjB,SAAS,EACT,eAAe,EACf,aAAa,EACb,SAAS,EACT,qBAAqB,EACrB,uBAAuB,EACvB,gBAAgB,EACjB,MAAM,SAAS,CAAA;AAChB,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,EACpB,iCAAiC,EACjC,qBAAqB,EACrB,0BAA0B,EAC1B,qBAAqB,EACtB,MAAM,SAAS,CAAA;AAChB,OAAO,EACL,uBAAuB,EACvB,gBAAgB,EAChB,cAAc,EACd,kBAAkB,EACnB,MAAM,SAAS,CAAA;AAEhB,iBAAS,eAAe,CACtB,MAAM,EAAE,MAAM,EACd,eAAe,CAAC,EAAE,MAAM,GACvB,YAAY,CAEd;AAED,YAAY,EACV,SAAS,EACT,YAAY,EACZ,UAAU,EACV,iBAAiB,EACjB,SAAS,EACT,uBAAuB,EACvB,qBAAqB,EACrB,SAAS,EACT,eAAe,EACf,aAAa,EACb,gBAAgB,GACjB,CAAA;AACD,OAAO,EACL,gBAAgB,IAAI,YAAY,EAChC,qBAAqB,EACrB,qBAAqB,EACrB,iCAAiC,EACjC,uBAAuB,EACvB,oBAAoB,EACpB,oBAAoB,EACpB,0BAA0B,EAC1B,qBAAqB,EACrB,6BAA6B,EAC7B,YAAY,EACZ,2BAA2B,EAC3B,wBAAwB,EACxB,kBAAkB,EAClB,2BAA2B,EAC3B,gBAAgB,EAChB,uCAAuC,EACvC,iBAAiB,EACjB,wBAAwB,EACxB,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,EACrB,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,mBAAmB,EACnB,uBAAuB,EACvB,cAAc,EACd,cAAc,EACd,yBAAyB,EACzB,sBAAsB,EACtB,6BAA6B,EAC7B,eAAe,EACf,kBAAkB,EAClB,mBAAmB,EACnB,uBAAuB,EACvB,uBAAuB,GACxB,CAAA"}
|
|
@@ -1,14 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.applyInjectedExecutions = exports.isTokenAddressSupported = exports.isOrchestratorError = exports.getSupportedTokens = exports.getTokenAddress = exports.getRhinestoneSpokePoolAddress = exports.getTargetModuleAddress = exports.getSameChainModuleAddress = exports.getHookAddress = exports.getTokenSymbol = exports.getTokenRootBalanceSlot = exports.getTokenBalanceSlot = exports.getWethAddress = exports.getEmptyUserOp = exports.getOrderBundleHash = exports.OrchestratorError = exports.Orchestrator = exports.RHINESTONE_SPOKE_POOL_ADDRESS = exports.BUNDLE_STATUS_UNKNOWN = exports.BUNDLE_STATUS_PRECONFIRMED = exports.BUNDLE_STATUS_FAILED = exports.BUNDLE_STATUS_FILLED = exports.BUNDLE_STATUS_COMPLETED = exports.BUNDLE_STATUS_PARTIALLY_COMPLETED = exports.BUNDLE_STATUS_EXPIRED = exports.BUNDLE_STATUS_PENDING = exports.BundleStatus = void 0;
|
|
3
|
+
exports.applyInjectedExecutions = exports.isTokenAddressSupported = exports.isOrchestratorError = exports.getSupportedTokens = exports.getTokenAddress = exports.getRhinestoneSpokePoolAddress = exports.getTargetModuleAddress = exports.getSameChainModuleAddress = exports.getHookAddress = exports.getTokenSymbol = exports.getTokenRootBalanceSlot = exports.getTokenBalanceSlot = exports.getWethAddress = exports.getEmptyUserOp = exports.getOrderBundleHash = exports.UnsupportedTokenError = exports.UnsupportedChainIdError = exports.UnsupportedChainError = exports.TokenNotSupportedError = exports.OrderBundleNotFoundError = exports.OrchestratorError = exports.OnlyOneTargetTokenAmountCanBeUnsetError = exports.NoPathFoundError = exports.InvalidBundleSignatureError = exports.InvalidApiKeyError = exports.InsufficientBalanceError = exports.AuthenticationRequiredError = exports.Orchestrator = exports.RHINESTONE_SPOKE_POOL_ADDRESS = exports.BUNDLE_STATUS_UNKNOWN = exports.BUNDLE_STATUS_PRECONFIRMED = exports.BUNDLE_STATUS_FAILED = exports.BUNDLE_STATUS_FILLED = exports.BUNDLE_STATUS_COMPLETED = exports.BUNDLE_STATUS_PARTIALLY_COMPLETED = exports.BUNDLE_STATUS_EXPIRED = exports.BUNDLE_STATUS_PENDING = exports.BundleStatus = void 0;
|
|
4
4
|
exports.getOrchestrator = getOrchestrator;
|
|
5
5
|
const client_1 = require("./client");
|
|
6
6
|
Object.defineProperty(exports, "Orchestrator", { enumerable: true, get: function () { return client_1.Orchestrator; } });
|
|
7
7
|
const consts_1 = require("./consts");
|
|
8
8
|
Object.defineProperty(exports, "RHINESTONE_SPOKE_POOL_ADDRESS", { enumerable: true, get: function () { return consts_1.RHINESTONE_SPOKE_POOL_ADDRESS; } });
|
|
9
9
|
const error_1 = require("./error");
|
|
10
|
+
Object.defineProperty(exports, "AuthenticationRequiredError", { enumerable: true, get: function () { return error_1.AuthenticationRequiredError; } });
|
|
11
|
+
Object.defineProperty(exports, "InsufficientBalanceError", { enumerable: true, get: function () { return error_1.InsufficientBalanceError; } });
|
|
12
|
+
Object.defineProperty(exports, "InvalidApiKeyError", { enumerable: true, get: function () { return error_1.InvalidApiKeyError; } });
|
|
13
|
+
Object.defineProperty(exports, "InvalidBundleSignatureError", { enumerable: true, get: function () { return error_1.InvalidBundleSignatureError; } });
|
|
10
14
|
Object.defineProperty(exports, "isOrchestratorError", { enumerable: true, get: function () { return error_1.isOrchestratorError; } });
|
|
15
|
+
Object.defineProperty(exports, "NoPathFoundError", { enumerable: true, get: function () { return error_1.NoPathFoundError; } });
|
|
16
|
+
Object.defineProperty(exports, "OnlyOneTargetTokenAmountCanBeUnsetError", { enumerable: true, get: function () { return error_1.OnlyOneTargetTokenAmountCanBeUnsetError; } });
|
|
11
17
|
Object.defineProperty(exports, "OrchestratorError", { enumerable: true, get: function () { return error_1.OrchestratorError; } });
|
|
18
|
+
Object.defineProperty(exports, "OrderBundleNotFoundError", { enumerable: true, get: function () { return error_1.OrderBundleNotFoundError; } });
|
|
19
|
+
Object.defineProperty(exports, "TokenNotSupportedError", { enumerable: true, get: function () { return error_1.TokenNotSupportedError; } });
|
|
20
|
+
Object.defineProperty(exports, "UnsupportedChainError", { enumerable: true, get: function () { return error_1.UnsupportedChainError; } });
|
|
21
|
+
Object.defineProperty(exports, "UnsupportedChainIdError", { enumerable: true, get: function () { return error_1.UnsupportedChainIdError; } });
|
|
22
|
+
Object.defineProperty(exports, "UnsupportedTokenError", { enumerable: true, get: function () { return error_1.UnsupportedTokenError; } });
|
|
12
23
|
const registry_1 = require("./registry");
|
|
13
24
|
Object.defineProperty(exports, "getHookAddress", { enumerable: true, get: function () { return registry_1.getHookAddress; } });
|
|
14
25
|
Object.defineProperty(exports, "getRhinestoneSpokePoolAddress", { enumerable: true, get: function () { return registry_1.getRhinestoneSpokePoolAddress; } });
|