@charterlabs/rhinestone-sdk 0.2.7-dev.2 → 0.2.7-dev.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/accounts/error.d.ts +38 -3
- package/dist/src/accounts/error.d.ts.map +1 -1
- package/dist/src/accounts/error.js +55 -7
- package/dist/src/accounts/index.d.ts +28 -20
- package/dist/src/accounts/index.d.ts.map +1 -1
- package/dist/src/accounts/index.js +196 -21
- package/dist/src/accounts/index.test.js +2 -4
- package/dist/src/accounts/json-rpc/providers.d.ts.map +1 -1
- package/dist/src/accounts/json-rpc/providers.js +42 -4
- package/dist/src/accounts/kernel.d.ts +1 -1
- package/dist/src/accounts/kernel.d.ts.map +1 -1
- package/dist/src/accounts/kernel.js +29 -1
- package/dist/src/accounts/kernel.test.js +35 -8
- package/dist/src/accounts/nexus.d.ts +4 -3
- package/dist/src/accounts/nexus.d.ts.map +1 -1
- package/dist/src/accounts/nexus.js +82 -14
- package/dist/src/accounts/nexus.test.js +33 -6
- package/dist/src/accounts/safe.d.ts.map +1 -1
- package/dist/src/accounts/safe.js +85 -53
- package/dist/src/accounts/safe.test.js +33 -6
- package/dist/src/accounts/signing/common.d.ts +4 -4
- package/dist/src/accounts/signing/common.d.ts.map +1 -1
- package/dist/src/accounts/signing/common.js +21 -9
- package/dist/src/accounts/signing/message.d.ts +1 -1
- package/dist/src/accounts/signing/message.d.ts.map +1 -1
- package/dist/src/accounts/signing/message.js +6 -6
- package/dist/src/accounts/signing/passkeys.d.ts +8 -1
- package/dist/src/accounts/signing/passkeys.d.ts.map +1 -1
- package/dist/src/accounts/signing/passkeys.js +35 -0
- package/dist/src/accounts/signing/passkeys.test.js +15 -0
- package/dist/src/accounts/signing/typedData.d.ts.map +1 -1
- package/dist/src/accounts/signing/typedData.js +2 -2
- package/dist/src/accounts/startale.test.js +0 -4
- package/dist/src/accounts/utils.d.ts +2 -2
- package/dist/src/accounts/utils.d.ts.map +1 -1
- package/dist/src/accounts/walletClient.d.ts +7 -0
- package/dist/src/accounts/walletClient.d.ts.map +1 -0
- package/dist/src/accounts/walletClient.js +38 -0
- package/dist/src/actions/compact.d.ts +13 -0
- package/dist/src/actions/compact.d.ts.map +1 -0
- package/dist/src/actions/compact.js +210 -0
- package/dist/src/actions/ecdsa.d.ts +35 -0
- package/dist/src/actions/ecdsa.d.ts.map +1 -0
- package/dist/src/actions/ecdsa.js +114 -0
- package/dist/src/actions/ecdsa.test.d.ts +2 -0
- package/dist/src/actions/ecdsa.test.d.ts.map +1 -0
- package/dist/src/actions/ecdsa.test.js +99 -0
- package/dist/src/actions/index.d.ts +23 -166
- package/dist/src/actions/index.d.ts.map +1 -1
- package/dist/src/actions/index.js +25 -544
- package/dist/src/actions/mfa.d.ts +37 -0
- package/dist/src/actions/mfa.d.ts.map +1 -0
- package/dist/src/actions/mfa.js +133 -0
- package/dist/src/actions/passkeys.d.ts +37 -0
- package/dist/src/actions/passkeys.d.ts.map +1 -0
- package/dist/src/actions/passkeys.js +129 -0
- package/dist/src/actions/passkeys.test.d.ts +2 -0
- package/dist/src/actions/passkeys.test.d.ts.map +1 -0
- package/dist/src/actions/passkeys.test.js +54 -0
- package/dist/src/actions/recovery.d.ts +33 -0
- package/dist/src/actions/recovery.d.ts.map +1 -0
- package/dist/src/actions/recovery.js +193 -0
- package/dist/src/actions/recovery.test.d.ts +2 -0
- package/dist/src/actions/recovery.test.d.ts.map +1 -0
- package/dist/src/actions/recovery.test.js +168 -0
- package/dist/src/errors/index.d.ts +5 -0
- package/dist/src/errors/index.d.ts.map +1 -0
- package/dist/src/errors/index.js +35 -0
- package/dist/src/execution/compact.d.ts +24 -8
- package/dist/src/execution/compact.d.ts.map +1 -1
- package/dist/src/execution/compact.js +29 -103
- package/dist/src/execution/error.d.ts +2 -9
- package/dist/src/execution/error.d.ts.map +1 -1
- package/dist/src/execution/error.js +4 -13
- package/dist/src/execution/index.d.ts +33 -22
- package/dist/src/execution/index.d.ts.map +1 -1
- package/dist/src/execution/index.js +60 -41
- package/dist/src/execution/permit2.d.ts +148 -0
- package/dist/src/execution/permit2.d.ts.map +1 -0
- package/dist/src/execution/permit2.js +282 -0
- package/dist/src/execution/smart-session.d.ts +3 -3
- package/dist/src/execution/smart-session.d.ts.map +1 -1
- package/dist/src/execution/types.d.ts +35 -0
- package/dist/src/execution/types.d.ts.map +1 -0
- package/dist/src/execution/types.js +2 -0
- package/dist/src/execution/utils.d.ts +36 -28
- package/dist/src/execution/utils.d.ts.map +1 -1
- package/dist/src/execution/utils.js +248 -91
- package/dist/src/index.d.ts +37 -19
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +130 -66
- package/dist/src/modules/common.d.ts +10 -4
- package/dist/src/modules/common.d.ts.map +1 -1
- package/dist/src/modules/common.js +22 -1
- package/dist/src/modules/index.d.ts +3 -2
- package/dist/src/modules/index.d.ts.map +1 -1
- package/dist/src/modules/index.js +16 -13
- package/dist/src/modules/index.test.js +8 -11
- package/dist/src/modules/read.d.ts.map +1 -1
- package/dist/src/modules/read.js +4 -0
- package/dist/src/modules/validators/core.d.ts +5 -3
- package/dist/src/modules/validators/core.d.ts.map +1 -1
- package/dist/src/modules/validators/core.js +29 -10
- package/dist/src/modules/validators/core.test.js +4 -4
- package/dist/src/modules/validators/smart-sessions.test.js +0 -3
- package/dist/src/modules/validators/webauthn-contract.d.ts.map +1 -1
- package/dist/src/orchestrator/client.d.ts +2 -1
- package/dist/src/orchestrator/client.d.ts.map +1 -1
- package/dist/src/orchestrator/client.js +36 -14
- package/dist/src/orchestrator/consts.d.ts +1 -2
- package/dist/src/orchestrator/consts.d.ts.map +1 -1
- package/dist/src/orchestrator/consts.js +1 -3
- package/dist/src/orchestrator/registry.d.ts +2 -2
- package/dist/src/orchestrator/registry.d.ts.map +1 -1
- package/dist/src/orchestrator/registry.js +68 -30
- package/dist/src/orchestrator/registry.test.js +4 -4
- package/dist/src/orchestrator/types.d.ts +34 -25
- package/dist/src/orchestrator/types.d.ts.map +1 -1
- package/dist/src/types.d.ts +64 -9
- package/dist/src/types.d.ts.map +1 -1
- package/package.json +73 -2
- package/dist/src/accounts/json-rpc/index.test.d.ts +0 -2
- package/dist/src/accounts/json-rpc/index.test.d.ts.map +0 -1
- package/dist/src/accounts/json-rpc/index.test.js +0 -16
- package/dist/src/accounts/json-rpc/providers.test.d.ts +0 -2
- package/dist/src/accounts/json-rpc/providers.test.d.ts.map +0 -1
- package/dist/src/accounts/json-rpc/providers.test.js +0 -15
- package/dist/src/actions/index.test.d.ts +0 -2
- package/dist/src/actions/index.test.d.ts.map +0 -1
- 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 utils_1 = require("../execution/utils");
|
|
8
|
+
const index_1 = require("../index");
|
|
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 index_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 index_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,11 +1,7 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type Hex } from 'viem';
|
|
2
2
|
import type { IntentOp } from '../orchestrator/types';
|
|
3
|
-
|
|
4
|
-
declare
|
|
5
|
-
declare function getDepositEtherCall(account: Address, value: bigint): Call;
|
|
6
|
-
declare function getDepositErc20Call(account: Address, tokenAddress: Address, amount: bigint): Call;
|
|
7
|
-
declare function getApproveErc20Call(tokenAddress: Address, amount: bigint): Call;
|
|
8
|
-
declare function getIntentData(intentOp: IntentOp): {
|
|
3
|
+
declare const COMPACT_ADDRESS = "0x73d2dc0c21fca4ec1601895d50df7f5624f07d3f";
|
|
4
|
+
declare function getCompactTypedData(intentOp: IntentOp): {
|
|
9
5
|
readonly domain: {
|
|
10
6
|
readonly name: "The Compact";
|
|
11
7
|
readonly version: "1";
|
|
@@ -52,6 +48,12 @@ declare function getIntentData(intentOp: IntentOp): {
|
|
|
52
48
|
readonly Mandate: readonly [{
|
|
53
49
|
readonly name: "target";
|
|
54
50
|
readonly type: "Target";
|
|
51
|
+
}, {
|
|
52
|
+
readonly name: "v";
|
|
53
|
+
readonly type: "uint8";
|
|
54
|
+
}, {
|
|
55
|
+
readonly name: "minGas";
|
|
56
|
+
readonly type: "uint128";
|
|
55
57
|
}, {
|
|
56
58
|
readonly name: "originOps";
|
|
57
59
|
readonly type: "Op[]";
|
|
@@ -116,6 +118,8 @@ declare function getIntentData(intentOp: IntentOp): {
|
|
|
116
118
|
targetChain: bigint;
|
|
117
119
|
fillExpiry: bigint;
|
|
118
120
|
};
|
|
121
|
+
v: number;
|
|
122
|
+
minGas: bigint;
|
|
119
123
|
originOps: {
|
|
120
124
|
to: `0x${string}`;
|
|
121
125
|
value: bigint;
|
|
@@ -131,5 +135,17 @@ declare function getIntentData(intentOp: IntentOp): {
|
|
|
131
135
|
}[];
|
|
132
136
|
};
|
|
133
137
|
};
|
|
134
|
-
|
|
138
|
+
/**
|
|
139
|
+
* Get the compact digest for signing
|
|
140
|
+
* @param intentOp The intent operation
|
|
141
|
+
* @returns The digest hash
|
|
142
|
+
*/
|
|
143
|
+
declare function getCompactDigest(intentOp: IntentOp): Hex;
|
|
144
|
+
/**
|
|
145
|
+
* Get the Permit2 digest for signing
|
|
146
|
+
* @param intentOp The intent operation
|
|
147
|
+
* @returns The digest hash
|
|
148
|
+
*/
|
|
149
|
+
declare function getPermit2Digest(intentOp: IntentOp): Hex;
|
|
150
|
+
export { COMPACT_ADDRESS, getCompactTypedData, getCompactDigest, getPermit2Digest, };
|
|
135
151
|
//# sourceMappingURL=compact.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compact.d.ts","sourceRoot":"","sources":["../../../execution/compact.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"compact.d.ts","sourceRoot":"","sources":["../../../execution/compact.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,GAAG,EAA0C,MAAM,MAAM,CAAA;AACvE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAGrD,QAAA,MAAM,eAAe,+CAA+C,CAAA;AA8CpE,iBAAS,mBAAmB,CAAC,QAAQ,EAAE,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmD9C;AAED;;;;GAIG;AACH,iBAAS,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,GAAG,GAAG,CAGjD;AAED;;;;GAIG;AACH,iBAAS,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,GAAG,GAAG,CAGjD;AAED,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,GACjB,CAAA"}
|
|
@@ -1,109 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.COMPACT_ADDRESS = void 0;
|
|
4
|
-
exports.
|
|
5
|
-
exports.
|
|
6
|
-
exports.
|
|
7
|
-
exports.getIntentData = getIntentData;
|
|
4
|
+
exports.getCompactTypedData = getCompactTypedData;
|
|
5
|
+
exports.getCompactDigest = getCompactDigest;
|
|
6
|
+
exports.getPermit2Digest = getPermit2Digest;
|
|
8
7
|
const viem_1 = require("viem");
|
|
9
|
-
const
|
|
8
|
+
const permit2_1 = require("./permit2");
|
|
9
|
+
const COMPACT_ADDRESS = '0x73d2dc0c21fca4ec1601895d50df7f5624f07d3f';
|
|
10
10
|
exports.COMPACT_ADDRESS = COMPACT_ADDRESS;
|
|
11
|
-
const ALLOCATOR_ADDRESS = '0x9Ef7519F90C9B6828650Ff4913d663BB1f688507';
|
|
12
|
-
const DEFAULT_RESET_PERIOD = 3;
|
|
13
|
-
const DEFAULT_SCOPE = 0;
|
|
14
|
-
function getDepositEtherCall(account, value) {
|
|
15
|
-
return {
|
|
16
|
-
to: COMPACT_ADDRESS,
|
|
17
|
-
data: (0, viem_1.encodeFunctionData)({
|
|
18
|
-
abi: [
|
|
19
|
-
{
|
|
20
|
-
type: 'function',
|
|
21
|
-
name: 'depositNative',
|
|
22
|
-
inputs: [
|
|
23
|
-
{ name: 'lockTag', type: 'bytes12', internalType: 'bytes12' },
|
|
24
|
-
{ name: 'recipient', type: 'address', internalType: 'address' },
|
|
25
|
-
],
|
|
26
|
-
outputs: [{ name: '', type: 'uint256', internalType: 'uint256' }],
|
|
27
|
-
stateMutability: 'payable',
|
|
28
|
-
},
|
|
29
|
-
],
|
|
30
|
-
functionName: 'depositNative',
|
|
31
|
-
args: [lockTag(), account],
|
|
32
|
-
}),
|
|
33
|
-
value,
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
function getDepositErc20Call(account, tokenAddress, amount) {
|
|
37
|
-
return {
|
|
38
|
-
to: COMPACT_ADDRESS,
|
|
39
|
-
value: 0n,
|
|
40
|
-
data: (0, viem_1.encodeFunctionData)({
|
|
41
|
-
abi: [
|
|
42
|
-
{
|
|
43
|
-
type: 'function',
|
|
44
|
-
name: 'depositERC20',
|
|
45
|
-
inputs: [
|
|
46
|
-
{
|
|
47
|
-
name: 'token',
|
|
48
|
-
type: 'address',
|
|
49
|
-
internalType: 'address',
|
|
50
|
-
},
|
|
51
|
-
{ name: 'lockTag', type: 'bytes12', internalType: 'bytes12' },
|
|
52
|
-
{ name: 'amount', type: 'uint256', internalType: 'uint256' },
|
|
53
|
-
{ name: 'recipient', type: 'address', internalType: 'address' },
|
|
54
|
-
],
|
|
55
|
-
outputs: [{ name: 'id', type: 'uint256', internalType: 'uint256' }],
|
|
56
|
-
stateMutability: 'nonpayable',
|
|
57
|
-
},
|
|
58
|
-
],
|
|
59
|
-
functionName: 'depositERC20',
|
|
60
|
-
args: [tokenAddress, lockTag(), amount, account],
|
|
61
|
-
}),
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
function getApproveErc20Call(tokenAddress, amount) {
|
|
65
|
-
return {
|
|
66
|
-
to: tokenAddress,
|
|
67
|
-
value: 0n,
|
|
68
|
-
data: (0, viem_1.encodeFunctionData)({
|
|
69
|
-
abi: viem_1.erc20Abi,
|
|
70
|
-
functionName: 'approve',
|
|
71
|
-
args: [COMPACT_ADDRESS, amount],
|
|
72
|
-
}),
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
function toCompactFlag(allocator) {
|
|
76
|
-
const addrBytes = Buffer.from(allocator.slice(2), 'hex');
|
|
77
|
-
let leadingZeroNibbles = 0;
|
|
78
|
-
for (const byte of addrBytes) {
|
|
79
|
-
if (byte === 0) {
|
|
80
|
-
leadingZeroNibbles += 2;
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
83
|
-
if (byte >> 4 === 0)
|
|
84
|
-
leadingZeroNibbles += 1;
|
|
85
|
-
break;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
if (leadingZeroNibbles >= 18)
|
|
89
|
-
return 15;
|
|
90
|
-
if (leadingZeroNibbles >= 4)
|
|
91
|
-
return leadingZeroNibbles - 3;
|
|
92
|
-
return 0;
|
|
93
|
-
}
|
|
94
|
-
function usingAllocatorId(allocator = ALLOCATOR_ADDRESS) {
|
|
95
|
-
const compactFlag = BigInt(toCompactFlag(allocator));
|
|
96
|
-
const last88Bits = BigInt(`0x${allocator.slice(-22)}`); // Extract last 88 bits (11 bytes * 2 hex chars per byte)
|
|
97
|
-
return (compactFlag << 88n) | last88Bits;
|
|
98
|
-
}
|
|
99
|
-
function lockTag() {
|
|
100
|
-
const allocatorId = usingAllocatorId(ALLOCATOR_ADDRESS);
|
|
101
|
-
const tagBig = (BigInt(DEFAULT_SCOPE) << 255n) |
|
|
102
|
-
(BigInt(DEFAULT_RESET_PERIOD) << 252n) |
|
|
103
|
-
(allocatorId << 160n);
|
|
104
|
-
const hex = tagBig.toString(16).slice(0, 24);
|
|
105
|
-
return `0x${hex}`;
|
|
106
|
-
}
|
|
107
11
|
// Define the typed data structure as const to preserve type safety
|
|
108
12
|
const COMPACT_TYPED_DATA_TYPES = {
|
|
109
13
|
MultichainCompact: [
|
|
@@ -125,6 +29,8 @@ const COMPACT_TYPED_DATA_TYPES = {
|
|
|
125
29
|
],
|
|
126
30
|
Mandate: [
|
|
127
31
|
{ name: 'target', type: 'Target' },
|
|
32
|
+
{ name: 'v', type: 'uint8' },
|
|
33
|
+
{ name: 'minGas', type: 'uint128' },
|
|
128
34
|
{ name: 'originOps', type: 'Op[]' },
|
|
129
35
|
{ name: 'destOps', type: 'Op[]' },
|
|
130
36
|
{ name: 'q', type: 'bytes32' },
|
|
@@ -145,7 +51,7 @@ const COMPACT_TYPED_DATA_TYPES = {
|
|
|
145
51
|
{ name: 'data', type: 'bytes' },
|
|
146
52
|
],
|
|
147
53
|
};
|
|
148
|
-
function
|
|
54
|
+
function getCompactTypedData(intentOp) {
|
|
149
55
|
const typedData = {
|
|
150
56
|
domain: {
|
|
151
57
|
name: 'The Compact',
|
|
@@ -177,6 +83,8 @@ function getIntentData(intentOp) {
|
|
|
177
83
|
targetChain: BigInt(element.mandate.destinationChainId),
|
|
178
84
|
fillExpiry: BigInt(element.mandate.fillDeadline),
|
|
179
85
|
},
|
|
86
|
+
v: element.mandate.v || 0,
|
|
87
|
+
minGas: BigInt(element.mandate.minGas || '0'),
|
|
180
88
|
originOps: element.mandate.preClaimOps.map((op) => ({
|
|
181
89
|
to: op.to,
|
|
182
90
|
value: BigInt(op.value),
|
|
@@ -187,10 +95,28 @@ function getIntentData(intentOp) {
|
|
|
187
95
|
value: BigInt(op.value),
|
|
188
96
|
data: op.data,
|
|
189
97
|
})),
|
|
190
|
-
q: (0, viem_1.keccak256)(element.mandate.qualifier
|
|
98
|
+
q: (0, viem_1.keccak256)(element.mandate.qualifier.encodedVal),
|
|
191
99
|
},
|
|
192
100
|
})),
|
|
193
101
|
},
|
|
194
102
|
};
|
|
195
103
|
return typedData;
|
|
196
104
|
}
|
|
105
|
+
/**
|
|
106
|
+
* Get the compact digest for signing
|
|
107
|
+
* @param intentOp The intent operation
|
|
108
|
+
* @returns The digest hash
|
|
109
|
+
*/
|
|
110
|
+
function getCompactDigest(intentOp) {
|
|
111
|
+
const typedData = getCompactTypedData(intentOp);
|
|
112
|
+
return (0, viem_1.hashTypedData)(typedData);
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Get the Permit2 digest for signing
|
|
116
|
+
* @param intentOp The intent operation
|
|
117
|
+
* @returns The digest hash
|
|
118
|
+
*/
|
|
119
|
+
function getPermit2Digest(intentOp) {
|
|
120
|
+
const typedData = (0, permit2_1.getTypedData)(intentOp);
|
|
121
|
+
return (0, viem_1.hashTypedData)(typedData);
|
|
122
|
+
}
|
|
@@ -14,14 +14,7 @@ declare class ExecutionError extends Error {
|
|
|
14
14
|
get errorType(): string;
|
|
15
15
|
get traceId(): string;
|
|
16
16
|
}
|
|
17
|
-
declare class
|
|
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;
|
|
@@ -50,5 +43,5 @@ declare class IntentFailedError extends ExecutionError {
|
|
|
50
43
|
});
|
|
51
44
|
}
|
|
52
45
|
declare function isExecutionError(error: Error): error is ExecutionError;
|
|
53
|
-
export { isExecutionError, ExecutionError,
|
|
46
|
+
export { isExecutionError, ExecutionError, OrderPathRequiredForIntentsError, SessionChainRequiredError, IntentFailedError, SignerNotSupportedError, };
|
|
54
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,
|
|
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,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.
|
|
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
|
|
31
|
+
class SignerNotSupportedError extends ExecutionError {
|
|
32
32
|
constructor(params) {
|
|
33
33
|
super({
|
|
34
|
-
message:
|
|
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.
|
|
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({
|
|
@@ -1,24 +1,35 @@
|
|
|
1
|
-
import { type Address, type Chain } from 'viem';
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
1
|
+
import { type Address, type Chain, type Hex } from 'viem';
|
|
2
|
+
import type { UserOperationReceipt } from 'viem/_types/account-abstraction';
|
|
3
|
+
import type { SettlementLayer } from '../orchestrator/types';
|
|
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
|
+
}
|
|
6
17
|
declare function sendTransaction(config: RhinestoneAccountConfig, transaction: Transaction): Promise<TransactionResult>;
|
|
7
|
-
declare function
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
declare function getMaxSpendableAmount(config:
|
|
21
|
-
declare function getPortfolio(config:
|
|
22
|
-
export { sendTransaction, waitForExecution, getMaxSpendableAmount, getPortfolio, isExecutionError,
|
|
23
|
-
export type {
|
|
18
|
+
declare function sendUserOperation(config: RhinestoneAccountConfig, transaction: UserOperationTransaction): Promise<UserOperationResult>;
|
|
19
|
+
declare function sendTransactionInternal(config: RhinestoneConfig, sourceChains: Chain[], targetChain: Chain, callInputs: CallInput[], options: {
|
|
20
|
+
gasLimit?: bigint;
|
|
21
|
+
initialTokenRequests?: TokenRequest[];
|
|
22
|
+
signers?: SignerSet;
|
|
23
|
+
sponsored?: boolean;
|
|
24
|
+
settlementLayers?: SettlementLayer[];
|
|
25
|
+
sourceAssets?: SourceAssetInput;
|
|
26
|
+
lockFunds?: boolean;
|
|
27
|
+
feeAsset?: Address | TokenSymbol;
|
|
28
|
+
}): Promise<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 };
|
|
24
35
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../execution/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../execution/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,KAAK,EAAsB,KAAK,GAAG,EAAE,MAAM,MAAM,CAAA;AAC7E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAA;AAY3E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,KAAK,EACV,aAAa,EACb,SAAS,EACT,uBAAuB,EACvB,gBAAgB,EAChB,SAAS,EACT,gBAAgB,EAChB,YAAY,EACZ,WAAW,EACX,WAAW,EACX,wBAAwB,EACzB,MAAM,UAAU,CAAA;AACjB,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,gCAAgC,EAChC,yBAAyB,EACzB,uBAAuB,EACxB,MAAM,SAAS,CAAA;AAEhB,OAAO,KAAK,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAerE,UAAU,iBAAiB;IACzB,IAAI,EAAE;QACJ,IAAI,EAAE,GAAG,GAAG,SAAS,CAAA;QACrB,OAAO,EAAE,MAAM,CAAA;KAChB,CAAA;IACD,MAAM,EAAE;QACN,IAAI,EAAE,GAAG,GAAG,SAAS,CAAA;QACrB,OAAO,EAAE,MAAM,CAAA;KAChB,EAAE,CAAA;CACJ;AAED,iBAAe,eAAe,CAC5B,MAAM,EAAE,uBAAuB,EAC/B,WAAW,EAAE,WAAW,8BAsCzB;AAED,iBAAe,iBAAiB,CAC9B,MAAM,EAAE,uBAAuB,EAC/B,WAAW,EAAE,wBAAwB,gCAqBtC;AAED,iBAAe,uBAAuB,CACpC,MAAM,EAAE,gBAAgB,EACxB,YAAY,EAAE,KAAK,EAAE,EACrB,WAAW,EAAE,KAAK,EAClB,UAAU,EAAE,SAAS,EAAE,EACvB,OAAO,EAAE;IACP,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,oBAAoB,CAAC,EAAE,YAAY,EAAE,CAAA;IACrC,OAAO,CAAC,EAAE,SAAS,CAAA;IACnB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,gBAAgB,CAAC,EAAE,eAAe,EAAE,CAAA;IACpC,YAAY,CAAC,EAAE,gBAAgB,CAAA;IAC/B,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,QAAQ,CAAC,EAAE,OAAO,GAAG,WAAW,CAAA;CACjC,8BAqCF;AAED,iBAAe,yBAAyB,CACtC,MAAM,EAAE,gBAAgB,EACxB,KAAK,EAAE,KAAK,EACZ,UAAU,EAAE,aAAa,EAAE,EAC3B,OAAO,CAAC,EAAE,SAAS,gCAgCpB;AAsDD,iBAAe,gBAAgB,CAC7B,MAAM,EAAE,gBAAgB,EACxB,MAAM,EAAE,iBAAiB,GAAG,mBAAmB,EAC/C,uBAAuB,EAAE,OAAO,GAC/B,OAAO,CAAC,iBAAiB,GAAG,oBAAoB,CAAC,CAoDnD;AAED,iBAAe,qBAAqB,CAClC,MAAM,EAAE,gBAAgB,EACxB,KAAK,EAAE,KAAK,EACZ,YAAY,EAAE,OAAO,EACrB,QAAQ,EAAE,MAAM,EAChB,SAAS,GAAE,OAAe,GACzB,OAAO,CAAC,MAAM,CAAC,CAcjB;AAED,iBAAe,YAAY,CAAC,MAAM,EAAE,gBAAgB,EAAE,UAAU,EAAE,OAAO,gDASxE;AAED,OAAO,EACL,eAAe,EACf,uBAAuB,EACvB,iBAAiB,EACjB,yBAAyB,EACzB,gBAAgB,EAChB,qBAAqB,EACrB,YAAY,EAEZ,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,gCAAgC,EAChC,yBAAyB,EACzB,uBAAuB,GACxB,CAAA;AACD,YAAY,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,CAAA"}
|