@rhinestone/sdk 1.0.0-alpha.32 → 1.0.0-alpha.33

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.
Files changed (78) hide show
  1. package/dist/src/accounts/index.d.ts +18 -18
  2. package/dist/src/accounts/index.d.ts.map +1 -1
  3. package/dist/src/accounts/index.js +12 -8
  4. package/dist/src/accounts/index.test.js +0 -2
  5. package/dist/src/accounts/kernel.test.js +0 -6
  6. package/dist/src/accounts/nexus.test.js +0 -6
  7. package/dist/src/accounts/safe.test.js +0 -6
  8. package/dist/src/accounts/signing/common.d.ts +3 -3
  9. package/dist/src/accounts/signing/common.d.ts.map +1 -1
  10. package/dist/src/accounts/signing/common.js +10 -8
  11. package/dist/src/accounts/signing/message.d.ts +1 -1
  12. package/dist/src/accounts/signing/message.d.ts.map +1 -1
  13. package/dist/src/accounts/signing/message.js +3 -3
  14. package/dist/src/accounts/signing/typedData.d.ts.map +1 -1
  15. package/dist/src/accounts/signing/typedData.js +2 -2
  16. package/dist/src/accounts/startale.test.js +0 -4
  17. package/dist/src/accounts/utils.d.ts +2 -2
  18. package/dist/src/accounts/utils.d.ts.map +1 -1
  19. package/dist/src/actions/compact.d.ts +13 -0
  20. package/dist/src/actions/compact.d.ts.map +1 -0
  21. package/dist/src/actions/compact.js +210 -0
  22. package/dist/src/actions/ecdsa.d.ts +35 -0
  23. package/dist/src/actions/ecdsa.d.ts.map +1 -0
  24. package/dist/src/actions/ecdsa.js +114 -0
  25. package/dist/src/actions/ecdsa.test.d.ts +2 -0
  26. package/dist/src/actions/ecdsa.test.d.ts.map +1 -0
  27. package/dist/src/actions/ecdsa.test.js +99 -0
  28. package/dist/src/actions/index.d.ts +5 -176
  29. package/dist/src/actions/index.d.ts.map +1 -1
  30. package/dist/src/actions/index.js +10 -563
  31. package/dist/src/actions/mfa.d.ts +37 -0
  32. package/dist/src/actions/mfa.d.ts.map +1 -0
  33. package/dist/src/actions/mfa.js +133 -0
  34. package/dist/src/actions/passkeys.d.ts +37 -0
  35. package/dist/src/actions/passkeys.d.ts.map +1 -0
  36. package/dist/src/actions/passkeys.js +129 -0
  37. package/dist/src/actions/passkeys.test.d.ts +2 -0
  38. package/dist/src/actions/passkeys.test.d.ts.map +1 -0
  39. package/dist/src/actions/passkeys.test.js +54 -0
  40. package/dist/src/actions/recovery.d.ts +33 -0
  41. package/dist/src/actions/recovery.d.ts.map +1 -0
  42. package/dist/src/actions/recovery.js +193 -0
  43. package/dist/src/actions/recovery.test.d.ts +2 -0
  44. package/dist/src/actions/recovery.test.d.ts.map +1 -0
  45. package/dist/src/actions/recovery.test.js +168 -0
  46. package/dist/src/errors/index.d.ts +5 -0
  47. package/dist/src/errors/index.d.ts.map +1 -0
  48. package/dist/src/errors/index.js +35 -0
  49. package/dist/src/execution/compact.d.ts +1 -12
  50. package/dist/src/execution/compact.d.ts.map +1 -1
  51. package/dist/src/execution/compact.js +0 -190
  52. package/dist/src/execution/error.d.ts +2 -16
  53. package/dist/src/execution/error.d.ts.map +1 -1
  54. package/dist/src/execution/error.js +4 -22
  55. package/dist/src/execution/index.d.ts +23 -24
  56. package/dist/src/execution/index.d.ts.map +1 -1
  57. package/dist/src/execution/index.js +38 -24
  58. package/dist/src/execution/smart-session.d.ts +3 -3
  59. package/dist/src/execution/smart-session.d.ts.map +1 -1
  60. package/dist/src/execution/utils.d.ts +33 -29
  61. package/dist/src/execution/utils.d.ts.map +1 -1
  62. package/dist/src/execution/utils.js +76 -69
  63. package/dist/src/index.d.ts +28 -17
  64. package/dist/src/index.d.ts.map +1 -1
  65. package/dist/src/index.js +69 -74
  66. package/dist/src/modules/index.d.ts +2 -2
  67. package/dist/src/modules/index.d.ts.map +1 -1
  68. package/dist/src/modules/index.js +1 -1
  69. package/dist/src/modules/index.test.js +0 -4
  70. package/dist/src/modules/validators/smart-sessions.test.js +0 -3
  71. package/dist/src/orchestrator/types.d.ts +1 -6
  72. package/dist/src/orchestrator/types.d.ts.map +1 -1
  73. package/dist/src/types.d.ts +22 -4
  74. package/dist/src/types.d.ts.map +1 -1
  75. package/package.json +36 -1
  76. package/dist/src/actions/index.test.d.ts +0 -2
  77. package/dist/src/actions/index.test.d.ts.map +0 -1
  78. package/dist/src/actions/index.test.js +0 -302
@@ -0,0 +1,168 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const viem_1 = require("viem");
4
+ const chains_1 = require("viem/chains");
5
+ const vitest_1 = require("vitest");
6
+ const consts_1 = require("../../test/consts");
7
+ const __1 = require("..");
8
+ const utils_1 = require("../execution/utils");
9
+ const recovery_1 = require("./recovery");
10
+ const accountAddress = '0x36C03e7D593F7B2C6b06fC18B5f4E9a4A29C99b0';
11
+ // Mock viem
12
+ vitest_1.vi.mock('viem', async (importOriginal) => {
13
+ const actual = await importOriginal();
14
+ return {
15
+ // @ts-ignore
16
+ ...actual,
17
+ createPublicClient: vitest_1.vi.fn(),
18
+ };
19
+ });
20
+ (0, vitest_1.describe)('Recovery Actions', () => {
21
+ (0, vitest_1.describe)('Set Up Recovery', async () => {
22
+ const rhinestone = new __1.RhinestoneSDK();
23
+ const rhinestoneAccount = await rhinestone.createAccount({
24
+ owners: {
25
+ type: 'ecdsa',
26
+ accounts: [consts_1.accountA],
27
+ },
28
+ });
29
+ (0, vitest_1.test)('Single Guardian', async () => {
30
+ const calls = await (0, utils_1.resolveCallInputs)([(0, recovery_1.enable)([consts_1.accountB], 1)], rhinestoneAccount.config, chains_1.base, accountAddress);
31
+ (0, vitest_1.expect)(calls).toEqual([
32
+ {
33
+ to: accountAddress,
34
+ value: 0n,
35
+ data: '0x9517e29f0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000a04d053b3c8021e8d5bf641816c42daa75d8b597000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000010000000000000000000000006092086a3dc0020cd604a68fcf5d430007d51bb7',
36
+ },
37
+ ]);
38
+ });
39
+ (0, vitest_1.test)('Guardian Multi-Sig', async () => {
40
+ const calls = await (0, utils_1.resolveCallInputs)([(0, recovery_1.enable)([consts_1.accountB, consts_1.accountC, consts_1.accountD], 2)], rhinestoneAccount.config, chains_1.base, accountAddress);
41
+ (0, vitest_1.expect)(calls).toEqual([
42
+ {
43
+ to: accountAddress,
44
+ value: 0n,
45
+ data: '0x9517e29f0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000a04d053b3c8021e8d5bf641816c42daa75d8b597000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000030000000000000000000000006092086a3dc0020cd604a68fcf5d430007d51bb7000000000000000000000000c27b7578151c5ef713c62c65db09763d57ac3596000000000000000000000000c5587d912c862252599b61926adaef316ba06da0',
46
+ },
47
+ ]);
48
+ });
49
+ });
50
+ (0, vitest_1.describe)('Recover', () => {
51
+ const rhinestone = new __1.RhinestoneSDK();
52
+ const accountPromise = rhinestone.createAccount({
53
+ owners: {
54
+ type: 'ecdsa',
55
+ accounts: [consts_1.accountA],
56
+ },
57
+ });
58
+ const mockPublicClient = {
59
+ readContract: vitest_1.vi.fn(),
60
+ multicall: vitest_1.vi.fn(),
61
+ };
62
+ (0, vitest_1.beforeEach)(() => {
63
+ const createPublicClientMock = viem_1.createPublicClient;
64
+ createPublicClientMock.mockReturnValue(mockPublicClient);
65
+ vitest_1.vi.clearAllMocks();
66
+ });
67
+ (0, vitest_1.test)('1/1 Owners - Single owner to different single owner', async () => {
68
+ const rhinestoneAccount = await accountPromise;
69
+ // Initial state
70
+ mockPublicClient.multicall.mockResolvedValueOnce([
71
+ { result: [consts_1.accountA.address.toLowerCase()], status: 'success' },
72
+ { result: 1n, status: 'success' },
73
+ ]);
74
+ const newOwners = {
75
+ type: 'ecdsa',
76
+ accounts: [consts_1.accountB],
77
+ threshold: 1,
78
+ };
79
+ const result = await (0, recovery_1.recoverEcdsaOwnership)(accountAddress, newOwners, chains_1.base, rhinestoneAccount.config);
80
+ (0, vitest_1.expect)(mockPublicClient.multicall).toHaveBeenCalledTimes(1);
81
+ (0, vitest_1.expect)(result).toEqual([
82
+ {
83
+ to: '0x000000000013fdb5234e4e3162a810f54d9f7e98',
84
+ value: 0n,
85
+ data: '0x7065cb480000000000000000000000006092086a3dc0020cd604a68fcf5d430007d51bb7',
86
+ },
87
+ {
88
+ to: '0x000000000013fdb5234e4e3162a810f54d9f7e98',
89
+ value: 0n,
90
+ data: '0xfbe5ce0a0000000000000000000000006092086a3dc0020cd604a68fcf5d430007d51bb7000000000000000000000000f6c02c78ded62973b43bfa523b247da099486936',
91
+ },
92
+ ]);
93
+ });
94
+ (0, vitest_1.test)('1/N Owners - Single owner to multiple owners', async () => {
95
+ const rhinestoneAccount = await accountPromise;
96
+ // Initial state
97
+ mockPublicClient.multicall.mockResolvedValueOnce([
98
+ {
99
+ result: [
100
+ consts_1.accountA.address.toLowerCase(),
101
+ consts_1.accountB.address.toLowerCase(),
102
+ consts_1.accountC.address.toLowerCase(),
103
+ ],
104
+ status: 'success',
105
+ },
106
+ { result: 1n, status: 'success' },
107
+ ]);
108
+ const newOwners = {
109
+ type: 'ecdsa',
110
+ accounts: [consts_1.accountB, consts_1.accountC, consts_1.accountD],
111
+ threshold: 1,
112
+ };
113
+ const result = await (0, recovery_1.recoverEcdsaOwnership)(accountAddress, newOwners, chains_1.base, rhinestoneAccount.config);
114
+ (0, vitest_1.expect)(mockPublicClient.multicall).toHaveBeenCalledTimes(1);
115
+ (0, vitest_1.expect)(result).toEqual([
116
+ {
117
+ to: '0x000000000013fdb5234e4e3162a810f54d9f7e98',
118
+ value: 0n,
119
+ data: '0x7065cb48000000000000000000000000c5587d912c862252599b61926adaef316ba06da0',
120
+ },
121
+ {
122
+ to: '0x000000000013fdb5234e4e3162a810f54d9f7e98',
123
+ value: 0n,
124
+ data: '0xfbe5ce0a000000000000000000000000c5587d912c862252599b61926adaef316ba06da0000000000000000000000000f6c02c78ded62973b43bfa523b247da099486936',
125
+ },
126
+ ]);
127
+ });
128
+ (0, vitest_1.test)('M/N Owners - Multiple owners to different multiple owners', async () => {
129
+ const rhinestoneAccount = await accountPromise;
130
+ // Initial state
131
+ mockPublicClient.multicall.mockResolvedValueOnce([
132
+ {
133
+ result: [
134
+ consts_1.accountA.address.toLowerCase(),
135
+ consts_1.accountB.address.toLowerCase(),
136
+ consts_1.accountC.address.toLowerCase(),
137
+ ],
138
+ status: 'success',
139
+ },
140
+ { result: 2n, status: 'success' },
141
+ ]);
142
+ const newOwners = {
143
+ type: 'ecdsa',
144
+ accounts: [consts_1.accountB, consts_1.accountD],
145
+ threshold: 2,
146
+ };
147
+ const result = await (0, recovery_1.recoverEcdsaOwnership)(accountAddress, newOwners, chains_1.base, rhinestoneAccount.config);
148
+ (0, vitest_1.expect)(mockPublicClient.multicall).toHaveBeenCalledTimes(1);
149
+ (0, vitest_1.expect)(result).toEqual([
150
+ {
151
+ to: '0x000000000013fdb5234e4e3162a810f54d9f7e98',
152
+ value: 0n,
153
+ data: '0x7065cb48000000000000000000000000c5587d912c862252599b61926adaef316ba06da0',
154
+ },
155
+ {
156
+ to: '0x000000000013fdb5234e4e3162a810f54d9f7e98',
157
+ value: 0n,
158
+ data: '0xfbe5ce0a000000000000000000000000c5587d912c862252599b61926adaef316ba06da0000000000000000000000000f6c02c78ded62973b43bfa523b247da099486936',
159
+ },
160
+ {
161
+ to: '0x000000000013fdb5234e4e3162a810f54d9f7e98',
162
+ value: 0n,
163
+ data: '0xfbe5ce0a0000000000000000000000006092086a3dc0020cd604a68fcf5d430007d51bb7000000000000000000000000c27b7578151c5ef713c62c65db09763d57ac3596',
164
+ },
165
+ ]);
166
+ });
167
+ });
168
+ });
@@ -0,0 +1,5 @@
1
+ import { AccountConfigurationNotSupportedError, AccountError, Eip7702AccountMustHaveEoaError, Eip7702NotSupportedForAccountError, ExistingEip7702AccountsNotSupportedError, FactoryArgsNotAvailableError, isAccountError, SigningNotSupportedForAccountError, SmartSessionsNotEnabledError, WalletClientNoConnectedAccountError } from '../accounts';
2
+ import { ExecutionError, IntentFailedError, isExecutionError, OrderPathRequiredForIntentsError, SessionChainRequiredError, SignerNotSupportedError } from '../execution';
3
+ import { AuthenticationRequiredError, InsufficientBalanceError, IntentNotFoundError, InvalidApiKeyError, InvalidIntentSignatureError, isOrchestratorError, NoPathFoundError, OnlyOneTargetTokenAmountCanBeUnsetError, OrchestratorError, TokenNotSupportedError, UnsupportedChainError, UnsupportedChainIdError, UnsupportedTokenError } from '../orchestrator';
4
+ export { isAccountError, AccountError, AccountConfigurationNotSupportedError, Eip7702AccountMustHaveEoaError, ExistingEip7702AccountsNotSupportedError, FactoryArgsNotAvailableError, SmartSessionsNotEnabledError, SigningNotSupportedForAccountError, Eip7702NotSupportedForAccountError, WalletClientNoConnectedAccountError, isExecutionError, ExecutionError, IntentFailedError, OrderPathRequiredForIntentsError, SessionChainRequiredError, SignerNotSupportedError, isOrchestratorError, AuthenticationRequiredError, InsufficientBalanceError, InvalidApiKeyError, InvalidIntentSignatureError, NoPathFoundError, OnlyOneTargetTokenAmountCanBeUnsetError, OrchestratorError, IntentNotFoundError, TokenNotSupportedError, UnsupportedChainError, UnsupportedChainIdError, UnsupportedTokenError, };
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../errors/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qCAAqC,EACrC,YAAY,EACZ,8BAA8B,EAC9B,kCAAkC,EAClC,wCAAwC,EACxC,4BAA4B,EAC5B,cAAc,EACd,kCAAkC,EAClC,4BAA4B,EAC5B,mCAAmC,EACpC,MAAM,aAAa,CAAA;AACpB,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,gCAAgC,EAChC,yBAAyB,EACzB,uBAAuB,EACxB,MAAM,cAAc,CAAA;AACrB,OAAO,EACL,2BAA2B,EAC3B,wBAAwB,EACxB,mBAAmB,EACnB,kBAAkB,EAClB,2BAA2B,EAC3B,mBAAmB,EACnB,gBAAgB,EAChB,uCAAuC,EACvC,iBAAiB,EACjB,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,EACtB,MAAM,iBAAiB,CAAA;AAExB,OAAO,EAEL,cAAc,EACd,YAAY,EACZ,qCAAqC,EACrC,8BAA8B,EAC9B,wCAAwC,EACxC,4BAA4B,EAC5B,4BAA4B,EAC5B,kCAAkC,EAClC,kCAAkC,EAClC,mCAAmC,EAEnC,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,gCAAgC,EAChC,yBAAyB,EACzB,uBAAuB,EAEvB,mBAAmB,EACnB,2BAA2B,EAC3B,wBAAwB,EACxB,kBAAkB,EAClB,2BAA2B,EAC3B,gBAAgB,EAChB,uCAAuC,EACvC,iBAAiB,EACjB,mBAAmB,EACnB,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,GACtB,CAAA"}
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UnsupportedTokenError = exports.UnsupportedChainIdError = exports.UnsupportedChainError = exports.TokenNotSupportedError = exports.IntentNotFoundError = exports.OrchestratorError = exports.OnlyOneTargetTokenAmountCanBeUnsetError = exports.NoPathFoundError = exports.InvalidIntentSignatureError = exports.InvalidApiKeyError = exports.InsufficientBalanceError = exports.AuthenticationRequiredError = exports.isOrchestratorError = exports.SignerNotSupportedError = exports.SessionChainRequiredError = exports.OrderPathRequiredForIntentsError = exports.IntentFailedError = exports.ExecutionError = exports.isExecutionError = exports.WalletClientNoConnectedAccountError = exports.Eip7702NotSupportedForAccountError = exports.SigningNotSupportedForAccountError = exports.SmartSessionsNotEnabledError = exports.FactoryArgsNotAvailableError = exports.ExistingEip7702AccountsNotSupportedError = exports.Eip7702AccountMustHaveEoaError = exports.AccountConfigurationNotSupportedError = exports.AccountError = exports.isAccountError = void 0;
4
+ const accounts_1 = require("../accounts");
5
+ Object.defineProperty(exports, "AccountConfigurationNotSupportedError", { enumerable: true, get: function () { return accounts_1.AccountConfigurationNotSupportedError; } });
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, "SmartSessionsNotEnabledError", { enumerable: true, get: function () { return accounts_1.SmartSessionsNotEnabledError; } });
14
+ Object.defineProperty(exports, "WalletClientNoConnectedAccountError", { enumerable: true, get: function () { return accounts_1.WalletClientNoConnectedAccountError; } });
15
+ const execution_1 = require("../execution");
16
+ Object.defineProperty(exports, "ExecutionError", { enumerable: true, get: function () { return execution_1.ExecutionError; } });
17
+ Object.defineProperty(exports, "IntentFailedError", { enumerable: true, get: function () { return execution_1.IntentFailedError; } });
18
+ Object.defineProperty(exports, "isExecutionError", { enumerable: true, get: function () { return execution_1.isExecutionError; } });
19
+ Object.defineProperty(exports, "OrderPathRequiredForIntentsError", { enumerable: true, get: function () { return execution_1.OrderPathRequiredForIntentsError; } });
20
+ Object.defineProperty(exports, "SessionChainRequiredError", { enumerable: true, get: function () { return execution_1.SessionChainRequiredError; } });
21
+ Object.defineProperty(exports, "SignerNotSupportedError", { enumerable: true, get: function () { return execution_1.SignerNotSupportedError; } });
22
+ const orchestrator_1 = require("../orchestrator");
23
+ Object.defineProperty(exports, "AuthenticationRequiredError", { enumerable: true, get: function () { return orchestrator_1.AuthenticationRequiredError; } });
24
+ Object.defineProperty(exports, "InsufficientBalanceError", { enumerable: true, get: function () { return orchestrator_1.InsufficientBalanceError; } });
25
+ Object.defineProperty(exports, "IntentNotFoundError", { enumerable: true, get: function () { return orchestrator_1.IntentNotFoundError; } });
26
+ Object.defineProperty(exports, "InvalidApiKeyError", { enumerable: true, get: function () { return orchestrator_1.InvalidApiKeyError; } });
27
+ Object.defineProperty(exports, "InvalidIntentSignatureError", { enumerable: true, get: function () { return orchestrator_1.InvalidIntentSignatureError; } });
28
+ Object.defineProperty(exports, "isOrchestratorError", { enumerable: true, get: function () { return orchestrator_1.isOrchestratorError; } });
29
+ Object.defineProperty(exports, "NoPathFoundError", { enumerable: true, get: function () { return orchestrator_1.NoPathFoundError; } });
30
+ Object.defineProperty(exports, "OnlyOneTargetTokenAmountCanBeUnsetError", { enumerable: true, get: function () { return orchestrator_1.OnlyOneTargetTokenAmountCanBeUnsetError; } });
31
+ Object.defineProperty(exports, "OrchestratorError", { enumerable: true, get: function () { return orchestrator_1.OrchestratorError; } });
32
+ Object.defineProperty(exports, "TokenNotSupportedError", { enumerable: true, get: function () { return orchestrator_1.TokenNotSupportedError; } });
33
+ Object.defineProperty(exports, "UnsupportedChainError", { enumerable: true, get: function () { return orchestrator_1.UnsupportedChainError; } });
34
+ Object.defineProperty(exports, "UnsupportedChainIdError", { enumerable: true, get: function () { return orchestrator_1.UnsupportedChainIdError; } });
35
+ Object.defineProperty(exports, "UnsupportedTokenError", { enumerable: true, get: function () { return orchestrator_1.UnsupportedTokenError; } });
@@ -1,16 +1,5 @@
1
- import { type Address } from 'viem';
2
1
  import type { IntentOp } from '../orchestrator/types';
3
- import type { Call } from '../types';
4
2
  declare const COMPACT_ADDRESS = "0x73d2dc0c21fca4ec1601895d50df7f5624f07d3f";
5
- declare function depositEther(account: Address, value: bigint): Call;
6
- declare function enableEtherWithdrawal(): Call;
7
- declare function disableEtherWithdrawal(): Call;
8
- declare function withdrawEther(account: Address, value: bigint): Call;
9
- declare function depositErc20(account: Address, tokenAddress: Address, amount: bigint): Call;
10
- declare function enableErc20Withdrawal(tokenAddress: Address): Call;
11
- declare function disableErc20Withdrawal(tokenAddress: Address): Call;
12
- declare function withdrawErc20(account: Address, tokenAddress: Address, amount: bigint): Call;
13
- declare function approveErc20(tokenAddress: Address, amount: bigint): Call;
14
3
  declare function getCompactTypedData(intentOp: IntentOp): {
15
4
  readonly domain: {
16
5
  readonly name: "The Compact";
@@ -137,5 +126,5 @@ declare function getCompactTypedData(intentOp: IntentOp): {
137
126
  }[];
138
127
  };
139
128
  };
140
- export { COMPACT_ADDRESS, depositEther, enableEtherWithdrawal, disableEtherWithdrawal, withdrawEther, depositErc20, enableErc20Withdrawal, disableErc20Withdrawal, withdrawErc20, approveErc20, getCompactTypedData, };
129
+ export { COMPACT_ADDRESS, getCompactTypedData };
141
130
  //# sourceMappingURL=compact.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"compact.d.ts","sourceRoot":"","sources":["../../../execution/compact.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EASb,MAAM,MAAM,CAAA;AACb,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AACrD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAcpC,QAAA,MAAM,eAAe,+CAA+C,CAAA;AAKpE,iBAAS,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAqB3D;AAED,iBAAS,qBAAqB,IAAI,IAAI,CAGrC;AAED,iBAAS,sBAAs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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiD9C;AAED,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,CAAA"}
@@ -1,200 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.COMPACT_ADDRESS = void 0;
4
- exports.depositEther = depositEther;
5
- exports.enableEtherWithdrawal = enableEtherWithdrawal;
6
- exports.disableEtherWithdrawal = disableEtherWithdrawal;
7
- exports.withdrawEther = withdrawEther;
8
- exports.depositErc20 = depositErc20;
9
- exports.enableErc20Withdrawal = enableErc20Withdrawal;
10
- exports.disableErc20Withdrawal = disableErc20Withdrawal;
11
- exports.withdrawErc20 = withdrawErc20;
12
- exports.approveErc20 = approveErc20;
13
4
  exports.getCompactTypedData = getCompactTypedData;
14
5
  const viem_1 = require("viem");
15
6
  const COMPACT_ADDRESS = '0x73d2dc0c21fca4ec1601895d50df7f5624f07d3f';
16
7
  exports.COMPACT_ADDRESS = COMPACT_ADDRESS;
17
- const ALLOCATOR_ADDRESS = '0xd93ed1dd9f1f0b523e4d77233809dc2ee22928c6';
18
- const DEFAULT_RESET_PERIOD = 6;
19
- const DEFAULT_SCOPE = 0;
20
- function depositEther(account, value) {
21
- return {
22
- to: COMPACT_ADDRESS,
23
- data: (0, viem_1.encodeFunctionData)({
24
- abi: [
25
- {
26
- type: 'function',
27
- name: 'depositNative',
28
- inputs: [
29
- { name: 'lockTag', type: 'bytes12', internalType: 'bytes12' },
30
- { name: 'recipient', type: 'address', internalType: 'address' },
31
- ],
32
- outputs: [{ name: 'id', type: 'uint256', internalType: 'uint256' }],
33
- stateMutability: 'payable',
34
- },
35
- ],
36
- functionName: 'depositNative',
37
- args: [lockTag(), account],
38
- }),
39
- value,
40
- };
41
- }
42
- function enableEtherWithdrawal() {
43
- const id = (0, viem_1.concat)([lockTag(), viem_1.zeroAddress]);
44
- return enableForcedWithdrawal(BigInt(id));
45
- }
46
- function disableEtherWithdrawal() {
47
- const id = (0, viem_1.concat)([lockTag(), viem_1.zeroAddress]);
48
- return disableForcedWithdrawal(BigInt(id));
49
- }
50
- function withdrawEther(account, value) {
51
- const id = (0, viem_1.concat)([lockTag(), viem_1.zeroAddress]);
52
- return forcedWithdrawal(BigInt(id), account, value);
53
- }
54
- function depositErc20(account, tokenAddress, amount) {
55
- return {
56
- to: COMPACT_ADDRESS,
57
- value: 0n,
58
- data: (0, viem_1.encodeFunctionData)({
59
- abi: [
60
- {
61
- type: 'function',
62
- name: 'depositERC20',
63
- inputs: [
64
- {
65
- name: 'token',
66
- type: 'address',
67
- internalType: 'address',
68
- },
69
- { name: 'lockTag', type: 'bytes12', internalType: 'bytes12' },
70
- { name: 'amount', type: 'uint256', internalType: 'uint256' },
71
- { name: 'recipient', type: 'address', internalType: 'address' },
72
- ],
73
- outputs: [{ name: 'id', type: 'uint256', internalType: 'uint256' }],
74
- stateMutability: 'nonpayable',
75
- },
76
- ],
77
- functionName: 'depositERC20',
78
- args: [tokenAddress, lockTag(), amount, account],
79
- }),
80
- };
81
- }
82
- function enableErc20Withdrawal(tokenAddress) {
83
- const id = (0, viem_1.concat)([lockTag(), tokenAddress]);
84
- return enableForcedWithdrawal(BigInt(id));
85
- }
86
- function disableErc20Withdrawal(tokenAddress) {
87
- const id = (0, viem_1.concat)([lockTag(), tokenAddress]);
88
- return disableForcedWithdrawal(BigInt(id));
89
- }
90
- function withdrawErc20(account, tokenAddress, amount) {
91
- const id = (0, viem_1.concat)([lockTag(), tokenAddress]);
92
- return forcedWithdrawal(BigInt(id), account, amount);
93
- }
94
- function enableForcedWithdrawal(id) {
95
- return {
96
- to: COMPACT_ADDRESS,
97
- data: (0, viem_1.encodeFunctionData)({
98
- abi: [
99
- {
100
- type: 'function',
101
- name: 'enableForcedWithdrawal',
102
- inputs: [{ name: 'id', type: 'uint256', internalType: 'uint256' }],
103
- outputs: [{ name: '', type: 'uint256', internalType: 'uint256' }],
104
- stateMutability: 'nonpayable',
105
- },
106
- ],
107
- functionName: 'enableForcedWithdrawal',
108
- args: [id],
109
- }),
110
- value: 0n,
111
- };
112
- }
113
- function disableForcedWithdrawal(id) {
114
- return {
115
- to: COMPACT_ADDRESS,
116
- data: (0, viem_1.encodeFunctionData)({
117
- abi: [
118
- {
119
- type: 'function',
120
- name: 'disableForcedWithdrawal',
121
- inputs: [{ name: 'id', type: 'uint256', internalType: 'uint256' }],
122
- outputs: [{ name: '', type: 'uint256', internalType: 'uint256' }],
123
- stateMutability: 'nonpayable',
124
- },
125
- ],
126
- functionName: 'disableForcedWithdrawal',
127
- args: [id],
128
- }),
129
- value: 0n,
130
- };
131
- }
132
- function forcedWithdrawal(id, recipient, amount) {
133
- return {
134
- to: COMPACT_ADDRESS,
135
- data: (0, viem_1.encodeFunctionData)({
136
- abi: [
137
- {
138
- type: 'function',
139
- name: 'forcedWithdrawal',
140
- inputs: [
141
- { name: 'id', type: 'uint256', internalType: 'uint256' },
142
- { name: 'recipient', type: 'address', internalType: 'address' },
143
- { name: 'amount', type: 'uint256', internalType: 'uint256' },
144
- ],
145
- outputs: [{ name: '', type: 'bool', internalType: 'bool' }],
146
- stateMutability: 'nonpayable',
147
- },
148
- ],
149
- functionName: 'forcedWithdrawal',
150
- args: [id, recipient, amount],
151
- }),
152
- value: 0n,
153
- };
154
- }
155
- function approveErc20(tokenAddress, amount) {
156
- return {
157
- to: tokenAddress,
158
- value: 0n,
159
- data: (0, viem_1.encodeFunctionData)({
160
- abi: viem_1.erc20Abi,
161
- functionName: 'approve',
162
- args: [COMPACT_ADDRESS, amount],
163
- }),
164
- };
165
- }
166
- function toCompactFlag(allocator) {
167
- const addrBytes = Buffer.from(allocator.slice(2), 'hex');
168
- let leadingZeroNibbles = 0;
169
- for (const byte of addrBytes) {
170
- if (byte === 0) {
171
- leadingZeroNibbles += 2;
172
- }
173
- else {
174
- if (byte >> 4 === 0)
175
- leadingZeroNibbles += 1;
176
- break;
177
- }
178
- }
179
- if (leadingZeroNibbles >= 18)
180
- return 15;
181
- if (leadingZeroNibbles >= 4)
182
- return leadingZeroNibbles - 3;
183
- return 0;
184
- }
185
- function usingAllocatorId(allocator = ALLOCATOR_ADDRESS) {
186
- const compactFlag = BigInt(toCompactFlag(allocator));
187
- const last88Bits = BigInt(`0x${allocator.slice(-22)}`); // Extract last 88 bits (11 bytes * 2 hex chars per byte)
188
- return (compactFlag << 88n) | last88Bits;
189
- }
190
- function lockTag() {
191
- const allocatorId = usingAllocatorId(ALLOCATOR_ADDRESS);
192
- const tagBig = (BigInt(DEFAULT_SCOPE) << 255n) |
193
- (BigInt(DEFAULT_RESET_PERIOD) << 252n) |
194
- (allocatorId << 160n);
195
- const hex = tagBig.toString(16).slice(0, 24);
196
- return `0x${hex}`;
197
- }
198
8
  // Define the typed data structure as const to preserve type safety
199
9
  const COMPACT_TYPED_DATA_TYPES = {
200
10
  MultichainCompact: [
@@ -14,14 +14,7 @@ declare class ExecutionError extends Error {
14
14
  get errorType(): string;
15
15
  get traceId(): string;
16
16
  }
17
- declare class SourceChainsNotAvailableForUserOpFlowError extends ExecutionError {
18
- constructor(params?: {
19
- context?: any;
20
- errorType?: string;
21
- traceId?: string;
22
- });
23
- }
24
- declare class UserOperationRequiredForSmartSessionsError extends ExecutionError {
17
+ declare class SignerNotSupportedError extends ExecutionError {
25
18
  constructor(params?: {
26
19
  context?: any;
27
20
  errorType?: string;
@@ -42,13 +35,6 @@ declare class SessionChainRequiredError extends ExecutionError {
42
35
  traceId?: string;
43
36
  });
44
37
  }
45
- declare class SimulationNotSupportedForUserOpFlowError extends ExecutionError {
46
- constructor(params?: {
47
- context?: any;
48
- errorType?: string;
49
- traceId?: string;
50
- });
51
- }
52
38
  declare class IntentFailedError extends ExecutionError {
53
39
  constructor(params?: {
54
40
  context?: any;
@@ -57,5 +43,5 @@ declare class IntentFailedError extends ExecutionError {
57
43
  });
58
44
  }
59
45
  declare function isExecutionError(error: Error): error is ExecutionError;
60
- export { isExecutionError, ExecutionError, SourceChainsNotAvailableForUserOpFlowError, UserOperationRequiredForSmartSessionsError, OrderPathRequiredForIntentsError, SessionChainRequiredError, IntentFailedError, SimulationNotSupportedForUserOpFlowError, };
46
+ export { isExecutionError, ExecutionError, OrderPathRequiredForIntentsError, SessionChainRequiredError, IntentFailedError, SignerNotSupportedError, };
61
47
  //# sourceMappingURL=error.d.ts.map
@@ -1 +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,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,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,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AClB,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,uBAAwB,SAAQ,cAAc;gBACtC,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,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,gCAAgC,EAChC,yBAAyB,EACzB,iBAAiB,EACjB,uBAAuB,GACxB,CAAA"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SimulationNotSupportedForUserOpFlowError = exports.IntentFailedError = exports.SessionChainRequiredError = exports.OrderPathRequiredForIntentsError = exports.UserOperationRequiredForSmartSessionsError = exports.SourceChainsNotAvailableForUserOpFlowError = exports.ExecutionError = void 0;
3
+ exports.SignerNotSupportedError = exports.IntentFailedError = exports.SessionChainRequiredError = exports.OrderPathRequiredForIntentsError = exports.ExecutionError = void 0;
4
4
  exports.isExecutionError = isExecutionError;
5
5
  class ExecutionError extends Error {
6
6
  _message;
@@ -28,24 +28,15 @@ class ExecutionError extends Error {
28
28
  }
29
29
  }
30
30
  exports.ExecutionError = ExecutionError;
31
- class SourceChainsNotAvailableForUserOpFlowError extends ExecutionError {
31
+ class SignerNotSupportedError extends ExecutionError {
32
32
  constructor(params) {
33
33
  super({
34
- message: "Can't specify the source chains when using user operations",
34
+ message: 'Sending a transaction is not supported for this type of signers. Use user operations instead.',
35
35
  ...params,
36
36
  });
37
37
  }
38
38
  }
39
- exports.SourceChainsNotAvailableForUserOpFlowError = SourceChainsNotAvailableForUserOpFlowError;
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;
39
+ exports.SignerNotSupportedError = SignerNotSupportedError;
49
40
  class OrderPathRequiredForIntentsError extends ExecutionError {
50
41
  constructor(params) {
51
42
  super({
@@ -64,15 +55,6 @@ class SessionChainRequiredError extends ExecutionError {
64
55
  }
65
56
  }
66
57
  exports.SessionChainRequiredError = SessionChainRequiredError;
67
- class SimulationNotSupportedForUserOpFlowError extends ExecutionError {
68
- constructor(params) {
69
- super({
70
- message: 'Simulation not supported for user operation flow',
71
- ...params,
72
- });
73
- }
74
- }
75
- exports.SimulationNotSupportedForUserOpFlowError = SimulationNotSupportedForUserOpFlowError;
76
58
  class IntentFailedError extends ExecutionError {
77
59
  constructor(params) {
78
60
  super({
@@ -1,36 +1,35 @@
1
- import { type Address, type Chain } from 'viem';
2
- import type { IntentOpStatus } from '../orchestrator';
1
+ import { type Address, type Chain, type Hex } from 'viem';
2
+ import type { UserOperationReceipt } from 'viem/_types/account-abstraction';
3
3
  import type { SettlementLayer } from '../orchestrator/types';
4
- import type { CallInput, RhinestoneAccountConfig, SignerSet, SourceAssetInput, TokenRequest, TokenSymbol, Transaction } from '../types';
5
- import { ExecutionError, IntentFailedError, isExecutionError, OrderPathRequiredForIntentsError, SessionChainRequiredError, SimulationNotSupportedForUserOpFlowError, SourceChainsNotAvailableForUserOpFlowError, UserOperationRequiredForSmartSessionsError } from './error';
6
- import type { IntentData, TransactionResult } from './utils';
4
+ import type { CalldataInput, CallInput, RhinestoneAccountConfig, RhinestoneConfig, SignerSet, SourceAssetInput, TokenRequest, TokenSymbol, Transaction, UserOperationTransaction } from '../types';
5
+ import { ExecutionError, IntentFailedError, isExecutionError, OrderPathRequiredForIntentsError, SessionChainRequiredError, SignerNotSupportedError } from './error';
6
+ import type { TransactionResult, UserOperationResult } from './utils';
7
+ interface TransactionStatus {
8
+ fill: {
9
+ hash: Hex | undefined;
10
+ chainId: number;
11
+ };
12
+ claims: {
13
+ hash: Hex | undefined;
14
+ chainId: number;
15
+ }[];
16
+ }
7
17
  declare function sendTransaction(config: RhinestoneAccountConfig, transaction: Transaction): Promise<TransactionResult>;
8
- declare function sendTransactionInternal(config: RhinestoneAccountConfig, sourceChains: Chain[], targetChain: Chain, callInputs: CallInput[], options: {
18
+ declare function sendUserOperation(config: RhinestoneAccountConfig, transaction: UserOperationTransaction): Promise<UserOperationResult>;
19
+ declare function sendTransactionInternal(config: RhinestoneConfig, sourceChains: Chain[], targetChain: Chain, callInputs: CallInput[], options: {
9
20
  gasLimit?: bigint;
10
21
  initialTokenRequests?: TokenRequest[];
11
22
  signers?: SignerSet;
12
23
  sponsored?: boolean;
13
24
  settlementLayers?: SettlementLayer[];
14
25
  sourceAssets?: SourceAssetInput;
15
- asUserOp?: boolean;
16
26
  lockFunds?: boolean;
17
27
  feeAsset?: Address | TokenSymbol;
18
28
  }): Promise<TransactionResult>;
19
- declare function waitForExecution(config: RhinestoneAccountConfig, result: TransactionResult, acceptsPreconfirmations: boolean): Promise<IntentOpStatus | {
20
- actualGasCost: bigint;
21
- actualGasUsed: bigint;
22
- entryPoint: Address;
23
- logs: import("viem").Log<bigint, number, false>[];
24
- nonce: bigint;
25
- paymaster?: `0x${string}` | undefined;
26
- reason?: string | undefined | undefined;
27
- receipt: import("viem").TransactionReceipt<bigint, number, "success" | "reverted">;
28
- sender: Address;
29
- success: boolean;
30
- userOpHash: import("viem").Hash;
31
- }>;
32
- declare function getMaxSpendableAmount(config: RhinestoneAccountConfig, chain: Chain, tokenAddress: Address, gasUnits: bigint, sponsored?: boolean): Promise<bigint>;
33
- declare function getPortfolio(config: RhinestoneAccountConfig, onTestnets: boolean): Promise<import("../orchestrator").Portfolio>;
34
- export { sendTransaction, sendTransactionInternal, waitForExecution, getMaxSpendableAmount, getPortfolio, isExecutionError, ExecutionError, IntentFailedError, OrderPathRequiredForIntentsError, SessionChainRequiredError, SimulationNotSupportedForUserOpFlowError, SourceChainsNotAvailableForUserOpFlowError, UserOperationRequiredForSmartSessionsError, };
35
- export type { IntentData, TransactionResult };
29
+ declare function sendUserOperationInternal(config: RhinestoneConfig, chain: Chain, callInputs: CalldataInput[], signers?: SignerSet): Promise<UserOperationResult>;
30
+ declare function waitForExecution(config: RhinestoneConfig, result: TransactionResult | UserOperationResult, acceptsPreconfirmations: boolean): Promise<TransactionStatus | UserOperationReceipt>;
31
+ declare function getMaxSpendableAmount(config: RhinestoneConfig, chain: Chain, tokenAddress: Address, gasUnits: bigint, sponsored?: boolean): Promise<bigint>;
32
+ declare function getPortfolio(config: RhinestoneConfig, onTestnets: boolean): Promise<import("../orchestrator").Portfolio>;
33
+ export { sendTransaction, sendTransactionInternal, sendUserOperation, sendUserOperationInternal, waitForExecution, getMaxSpendableAmount, getPortfolio, isExecutionError, ExecutionError, IntentFailedError, OrderPathRequiredForIntentsError, SessionChainRequiredError, SignerNotSupportedError, };
34
+ export type { TransactionStatus, TransactionResult, UserOperationResult };
36
35
  //# sourceM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