@haven-fi/solauto-sdk 1.0.176 → 1.0.178
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/constants/generalAccounts.d.ts.map +1 -1
- package/dist/constants/generalAccounts.js +0 -1
- package/dist/constants/solautoConstants.d.ts +0 -1
- package/dist/constants/solautoConstants.d.ts.map +1 -1
- package/dist/constants/solautoConstants.js +3 -3
- package/dist/generated/errors/solauto.d.ts +8 -26
- package/dist/generated/errors/solauto.d.ts.map +1 -1
- package/dist/generated/errors/solauto.js +26 -59
- package/dist/index.js +2 -0
- package/dist/jupiter-sdk/errors/index.d.ts +9 -0
- package/dist/jupiter-sdk/errors/index.d.ts.map +1 -0
- package/dist/jupiter-sdk/errors/index.js +24 -0
- package/dist/jupiter-sdk/errors/jupiter.d.ts +127 -0
- package/dist/jupiter-sdk/errors/jupiter.d.ts.map +1 -0
- package/dist/jupiter-sdk/errors/jupiter.js +229 -0
- package/dist/jupiter-sdk/index.d.ts +10 -0
- package/dist/jupiter-sdk/index.d.ts.map +1 -0
- package/dist/jupiter-sdk/index.js +25 -0
- package/dist/jupiter-sdk/programs/index.d.ts +9 -0
- package/dist/jupiter-sdk/programs/index.d.ts.map +1 -0
- package/dist/jupiter-sdk/programs/index.js +24 -0
- package/dist/jupiter-sdk/programs/jupiter.d.ts +13 -0
- package/dist/jupiter-sdk/programs/jupiter.d.ts.map +1 -0
- package/dist/jupiter-sdk/programs/jupiter.js +36 -0
- package/dist/transactions/transactionUtils.d.ts +5 -0
- package/dist/transactions/transactionUtils.d.ts.map +1 -1
- package/dist/transactions/transactionUtils.js +46 -4
- package/dist/transactions/transactionsManager.d.ts +2 -1
- package/dist/transactions/transactionsManager.d.ts.map +1 -1
- package/dist/transactions/transactionsManager.js +12 -20
- package/package.json +1 -1
- package/src/constants/generalAccounts.ts +0 -3
- package/src/constants/solautoConstants.ts +1 -2
- package/src/generated/errors/solauto.ts +30 -88
- package/src/index.ts +3 -1
- package/src/jupiter-sdk/errors/index.ts +9 -0
- package/src/jupiter-sdk/errors/jupiter.ts +282 -0
- package/src/jupiter-sdk/index.ts +10 -0
- package/src/jupiter-sdk/programs/index.ts +9 -0
- package/src/jupiter-sdk/programs/jupiter.ts +52 -0
- package/src/transactions/transactionUtils.ts +72 -5
- package/src/transactions/transactionsManager.ts +26 -29
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This code was AUTOGENERATED using the kinobi library.
|
|
4
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
5
|
+
* to add features, then rerun kinobi to update it.
|
|
6
|
+
*
|
|
7
|
+
* @see https://github.com/metaplex-foundation/kinobi
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.ExactOutAmountNotMatchedError = exports.SwapNotSupportedError = exports.TokenProgramNotProvidedError = exports.IncorrectTokenProgramIDError = exports.InvalidTokenLedgerError = exports.LedgerTokenAccountDoesNotMatchError = exports.InvalidReferralAuthorityError = exports.InvalidRoutePlanError = exports.NonZeroMinimumOutAmountNotSupportedError = exports.NotEnoughAccountKeysError = exports.InvalidOutputIndexError = exports.InvalidInputIndexError = exports.NotEnoughPercentError = exports.InvalidSlippageError = exports.MissingPlatformFeeAccountError = exports.InvalidCalculationError = exports.SlippageToleranceExceededError = exports.EmptyRouteError = void 0;
|
|
11
|
+
exports.getJupiterErrorFromCode = getJupiterErrorFromCode;
|
|
12
|
+
exports.getJupiterErrorFromName = getJupiterErrorFromName;
|
|
13
|
+
const umi_1 = require("@metaplex-foundation/umi");
|
|
14
|
+
const codeToErrorMap = new Map();
|
|
15
|
+
const nameToErrorMap = new Map();
|
|
16
|
+
/** EmptyRoute: Empty route */
|
|
17
|
+
class EmptyRouteError extends umi_1.ProgramError {
|
|
18
|
+
constructor(program, cause) {
|
|
19
|
+
super('Empty route', program, cause);
|
|
20
|
+
this.name = 'EmptyRoute';
|
|
21
|
+
this.code = 0x1770; // 6000
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.EmptyRouteError = EmptyRouteError;
|
|
25
|
+
codeToErrorMap.set(0x1770, EmptyRouteError);
|
|
26
|
+
nameToErrorMap.set('EmptyRoute', EmptyRouteError);
|
|
27
|
+
/** SlippageToleranceExceeded: Slippage tolerance exceeded */
|
|
28
|
+
class SlippageToleranceExceededError extends umi_1.ProgramError {
|
|
29
|
+
constructor(program, cause) {
|
|
30
|
+
super('Slippage tolerance exceeded', program, cause);
|
|
31
|
+
this.name = 'SlippageToleranceExceeded';
|
|
32
|
+
this.code = 0x1771; // 6001
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.SlippageToleranceExceededError = SlippageToleranceExceededError;
|
|
36
|
+
codeToErrorMap.set(0x1771, SlippageToleranceExceededError);
|
|
37
|
+
nameToErrorMap.set('SlippageToleranceExceeded', SlippageToleranceExceededError);
|
|
38
|
+
/** InvalidCalculation: Invalid calculation */
|
|
39
|
+
class InvalidCalculationError extends umi_1.ProgramError {
|
|
40
|
+
constructor(program, cause) {
|
|
41
|
+
super('Invalid calculation', program, cause);
|
|
42
|
+
this.name = 'InvalidCalculation';
|
|
43
|
+
this.code = 0x1772; // 6002
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.InvalidCalculationError = InvalidCalculationError;
|
|
47
|
+
codeToErrorMap.set(0x1772, InvalidCalculationError);
|
|
48
|
+
nameToErrorMap.set('InvalidCalculation', InvalidCalculationError);
|
|
49
|
+
/** MissingPlatformFeeAccount: Missing platform fee account */
|
|
50
|
+
class MissingPlatformFeeAccountError extends umi_1.ProgramError {
|
|
51
|
+
constructor(program, cause) {
|
|
52
|
+
super('Missing platform fee account', program, cause);
|
|
53
|
+
this.name = 'MissingPlatformFeeAccount';
|
|
54
|
+
this.code = 0x1773; // 6003
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.MissingPlatformFeeAccountError = MissingPlatformFeeAccountError;
|
|
58
|
+
codeToErrorMap.set(0x1773, MissingPlatformFeeAccountError);
|
|
59
|
+
nameToErrorMap.set('MissingPlatformFeeAccount', MissingPlatformFeeAccountError);
|
|
60
|
+
/** InvalidSlippage: Invalid slippage */
|
|
61
|
+
class InvalidSlippageError extends umi_1.ProgramError {
|
|
62
|
+
constructor(program, cause) {
|
|
63
|
+
super('Invalid slippage', program, cause);
|
|
64
|
+
this.name = 'InvalidSlippage';
|
|
65
|
+
this.code = 0x1774; // 6004
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
exports.InvalidSlippageError = InvalidSlippageError;
|
|
69
|
+
codeToErrorMap.set(0x1774, InvalidSlippageError);
|
|
70
|
+
nameToErrorMap.set('InvalidSlippage', InvalidSlippageError);
|
|
71
|
+
/** NotEnoughPercent: Not enough percent to 100 */
|
|
72
|
+
class NotEnoughPercentError extends umi_1.ProgramError {
|
|
73
|
+
constructor(program, cause) {
|
|
74
|
+
super('Not enough percent to 100', program, cause);
|
|
75
|
+
this.name = 'NotEnoughPercent';
|
|
76
|
+
this.code = 0x1775; // 6005
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
exports.NotEnoughPercentError = NotEnoughPercentError;
|
|
80
|
+
codeToErrorMap.set(0x1775, NotEnoughPercentError);
|
|
81
|
+
nameToErrorMap.set('NotEnoughPercent', NotEnoughPercentError);
|
|
82
|
+
/** InvalidInputIndex: Token input index is invalid */
|
|
83
|
+
class InvalidInputIndexError extends umi_1.ProgramError {
|
|
84
|
+
constructor(program, cause) {
|
|
85
|
+
super('Token input index is invalid', program, cause);
|
|
86
|
+
this.name = 'InvalidInputIndex';
|
|
87
|
+
this.code = 0x1776; // 6006
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
exports.InvalidInputIndexError = InvalidInputIndexError;
|
|
91
|
+
codeToErrorMap.set(0x1776, InvalidInputIndexError);
|
|
92
|
+
nameToErrorMap.set('InvalidInputIndex', InvalidInputIndexError);
|
|
93
|
+
/** InvalidOutputIndex: Token output index is invalid */
|
|
94
|
+
class InvalidOutputIndexError extends umi_1.ProgramError {
|
|
95
|
+
constructor(program, cause) {
|
|
96
|
+
super('Token output index is invalid', program, cause);
|
|
97
|
+
this.name = 'InvalidOutputIndex';
|
|
98
|
+
this.code = 0x1777; // 6007
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
exports.InvalidOutputIndexError = InvalidOutputIndexError;
|
|
102
|
+
codeToErrorMap.set(0x1777, InvalidOutputIndexError);
|
|
103
|
+
nameToErrorMap.set('InvalidOutputIndex', InvalidOutputIndexError);
|
|
104
|
+
/** NotEnoughAccountKeys: Not Enough Account keys */
|
|
105
|
+
class NotEnoughAccountKeysError extends umi_1.ProgramError {
|
|
106
|
+
constructor(program, cause) {
|
|
107
|
+
super('Not Enough Account keys', program, cause);
|
|
108
|
+
this.name = 'NotEnoughAccountKeys';
|
|
109
|
+
this.code = 0x1778; // 6008
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
exports.NotEnoughAccountKeysError = NotEnoughAccountKeysError;
|
|
113
|
+
codeToErrorMap.set(0x1778, NotEnoughAccountKeysError);
|
|
114
|
+
nameToErrorMap.set('NotEnoughAccountKeys', NotEnoughAccountKeysError);
|
|
115
|
+
/** NonZeroMinimumOutAmountNotSupported: Non zero minimum out amount not supported */
|
|
116
|
+
class NonZeroMinimumOutAmountNotSupportedError extends umi_1.ProgramError {
|
|
117
|
+
constructor(program, cause) {
|
|
118
|
+
super('Non zero minimum out amount not supported', program, cause);
|
|
119
|
+
this.name = 'NonZeroMinimumOutAmountNotSupported';
|
|
120
|
+
this.code = 0x1779; // 6009
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
exports.NonZeroMinimumOutAmountNotSupportedError = NonZeroMinimumOutAmountNotSupportedError;
|
|
124
|
+
codeToErrorMap.set(0x1779, NonZeroMinimumOutAmountNotSupportedError);
|
|
125
|
+
nameToErrorMap.set('NonZeroMinimumOutAmountNotSupported', NonZeroMinimumOutAmountNotSupportedError);
|
|
126
|
+
/** InvalidRoutePlan: Invalid route plan */
|
|
127
|
+
class InvalidRoutePlanError extends umi_1.ProgramError {
|
|
128
|
+
constructor(program, cause) {
|
|
129
|
+
super('Invalid route plan', program, cause);
|
|
130
|
+
this.name = 'InvalidRoutePlan';
|
|
131
|
+
this.code = 0x177a; // 6010
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
exports.InvalidRoutePlanError = InvalidRoutePlanError;
|
|
135
|
+
codeToErrorMap.set(0x177a, InvalidRoutePlanError);
|
|
136
|
+
nameToErrorMap.set('InvalidRoutePlan', InvalidRoutePlanError);
|
|
137
|
+
/** InvalidReferralAuthority: Invalid referral authority */
|
|
138
|
+
class InvalidReferralAuthorityError extends umi_1.ProgramError {
|
|
139
|
+
constructor(program, cause) {
|
|
140
|
+
super('Invalid referral authority', program, cause);
|
|
141
|
+
this.name = 'InvalidReferralAuthority';
|
|
142
|
+
this.code = 0x177b; // 6011
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
exports.InvalidReferralAuthorityError = InvalidReferralAuthorityError;
|
|
146
|
+
codeToErrorMap.set(0x177b, InvalidReferralAuthorityError);
|
|
147
|
+
nameToErrorMap.set('InvalidReferralAuthority', InvalidReferralAuthorityError);
|
|
148
|
+
/** LedgerTokenAccountDoesNotMatch: Token account doesn't match the ledger */
|
|
149
|
+
class LedgerTokenAccountDoesNotMatchError extends umi_1.ProgramError {
|
|
150
|
+
constructor(program, cause) {
|
|
151
|
+
super("Token account doesn't match the ledger", program, cause);
|
|
152
|
+
this.name = 'LedgerTokenAccountDoesNotMatch';
|
|
153
|
+
this.code = 0x177c; // 6012
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
exports.LedgerTokenAccountDoesNotMatchError = LedgerTokenAccountDoesNotMatchError;
|
|
157
|
+
codeToErrorMap.set(0x177c, LedgerTokenAccountDoesNotMatchError);
|
|
158
|
+
nameToErrorMap.set('LedgerTokenAccountDoesNotMatch', LedgerTokenAccountDoesNotMatchError);
|
|
159
|
+
/** InvalidTokenLedger: Invalid token ledger */
|
|
160
|
+
class InvalidTokenLedgerError extends umi_1.ProgramError {
|
|
161
|
+
constructor(program, cause) {
|
|
162
|
+
super('Invalid token ledger', program, cause);
|
|
163
|
+
this.name = 'InvalidTokenLedger';
|
|
164
|
+
this.code = 0x177d; // 6013
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
exports.InvalidTokenLedgerError = InvalidTokenLedgerError;
|
|
168
|
+
codeToErrorMap.set(0x177d, InvalidTokenLedgerError);
|
|
169
|
+
nameToErrorMap.set('InvalidTokenLedger', InvalidTokenLedgerError);
|
|
170
|
+
/** IncorrectTokenProgramID: Token program ID is invalid */
|
|
171
|
+
class IncorrectTokenProgramIDError extends umi_1.ProgramError {
|
|
172
|
+
constructor(program, cause) {
|
|
173
|
+
super('Token program ID is invalid', program, cause);
|
|
174
|
+
this.name = 'IncorrectTokenProgramID';
|
|
175
|
+
this.code = 0x177e; // 6014
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
exports.IncorrectTokenProgramIDError = IncorrectTokenProgramIDError;
|
|
179
|
+
codeToErrorMap.set(0x177e, IncorrectTokenProgramIDError);
|
|
180
|
+
nameToErrorMap.set('IncorrectTokenProgramID', IncorrectTokenProgramIDError);
|
|
181
|
+
/** TokenProgramNotProvided: Token program not provided */
|
|
182
|
+
class TokenProgramNotProvidedError extends umi_1.ProgramError {
|
|
183
|
+
constructor(program, cause) {
|
|
184
|
+
super('Token program not provided', program, cause);
|
|
185
|
+
this.name = 'TokenProgramNotProvided';
|
|
186
|
+
this.code = 0x177f; // 6015
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
exports.TokenProgramNotProvidedError = TokenProgramNotProvidedError;
|
|
190
|
+
codeToErrorMap.set(0x177f, TokenProgramNotProvidedError);
|
|
191
|
+
nameToErrorMap.set('TokenProgramNotProvided', TokenProgramNotProvidedError);
|
|
192
|
+
/** SwapNotSupported: Swap not supported */
|
|
193
|
+
class SwapNotSupportedError extends umi_1.ProgramError {
|
|
194
|
+
constructor(program, cause) {
|
|
195
|
+
super('Swap not supported', program, cause);
|
|
196
|
+
this.name = 'SwapNotSupported';
|
|
197
|
+
this.code = 0x1780; // 6016
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
exports.SwapNotSupportedError = SwapNotSupportedError;
|
|
201
|
+
codeToErrorMap.set(0x1780, SwapNotSupportedError);
|
|
202
|
+
nameToErrorMap.set('SwapNotSupported', SwapNotSupportedError);
|
|
203
|
+
/** ExactOutAmountNotMatched: Exact out amount doesn't match */
|
|
204
|
+
class ExactOutAmountNotMatchedError extends umi_1.ProgramError {
|
|
205
|
+
constructor(program, cause) {
|
|
206
|
+
super("Exact out amount doesn't match", program, cause);
|
|
207
|
+
this.name = 'ExactOutAmountNotMatched';
|
|
208
|
+
this.code = 0x1781; // 6017
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
exports.ExactOutAmountNotMatchedError = ExactOutAmountNotMatchedError;
|
|
212
|
+
codeToErrorMap.set(0x1781, ExactOutAmountNotMatchedError);
|
|
213
|
+
nameToErrorMap.set('ExactOutAmountNotMatched', ExactOutAmountNotMatchedError);
|
|
214
|
+
/**
|
|
215
|
+
* Attempts to resolve a custom program error from the provided error code.
|
|
216
|
+
* @category Errors
|
|
217
|
+
*/
|
|
218
|
+
function getJupiterErrorFromCode(code, program, cause) {
|
|
219
|
+
const constructor = codeToErrorMap.get(code);
|
|
220
|
+
return constructor ? new constructor(program, cause) : null;
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Attempts to resolve a custom program error from the provided error name, i.e. 'Unauthorized'.
|
|
224
|
+
* @category Errors
|
|
225
|
+
*/
|
|
226
|
+
function getJupiterErrorFromName(name, program, cause) {
|
|
227
|
+
const constructor = nameToErrorMap.get(name);
|
|
228
|
+
return constructor ? new constructor(program, cause) : null;
|
|
229
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was AUTOGENERATED using the kinobi library.
|
|
3
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
4
|
+
* to add features, then rerun kinobi to update it.
|
|
5
|
+
*
|
|
6
|
+
* @see https://github.com/metaplex-foundation/kinobi
|
|
7
|
+
*/
|
|
8
|
+
export * from './errors';
|
|
9
|
+
export * from './programs';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/jupiter-sdk/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This code was AUTOGENERATED using the kinobi library.
|
|
4
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
5
|
+
* to add features, then rerun kinobi to update it.
|
|
6
|
+
*
|
|
7
|
+
* @see https://github.com/metaplex-foundation/kinobi
|
|
8
|
+
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
16
|
+
}) : (function(o, m, k, k2) {
|
|
17
|
+
if (k2 === undefined) k2 = k;
|
|
18
|
+
o[k2] = m[k];
|
|
19
|
+
}));
|
|
20
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
21
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
22
|
+
};
|
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
__exportStar(require("./errors"), exports);
|
|
25
|
+
__exportStar(require("./programs"), exports);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was AUTOGENERATED using the kinobi library.
|
|
3
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
4
|
+
* to add features, then rerun kinobi to update it.
|
|
5
|
+
*
|
|
6
|
+
* @see https://github.com/metaplex-foundation/kinobi
|
|
7
|
+
*/
|
|
8
|
+
export * from './jupiter';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/jupiter-sdk/programs/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This code was AUTOGENERATED using the kinobi library.
|
|
4
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
5
|
+
* to add features, then rerun kinobi to update it.
|
|
6
|
+
*
|
|
7
|
+
* @see https://github.com/metaplex-foundation/kinobi
|
|
8
|
+
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
16
|
+
}) : (function(o, m, k, k2) {
|
|
17
|
+
if (k2 === undefined) k2 = k;
|
|
18
|
+
o[k2] = m[k];
|
|
19
|
+
}));
|
|
20
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
21
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
22
|
+
};
|
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
__exportStar(require("./jupiter"), exports);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was AUTOGENERATED using the kinobi library.
|
|
3
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
4
|
+
* to add features, then rerun kinobi to update it.
|
|
5
|
+
*
|
|
6
|
+
* @see https://github.com/metaplex-foundation/kinobi
|
|
7
|
+
*/
|
|
8
|
+
import { ClusterFilter, Context, Program, PublicKey } from '@metaplex-foundation/umi';
|
|
9
|
+
export declare const JUPITER_PROGRAM_ID: PublicKey<"JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4">;
|
|
10
|
+
export declare function createJupiterProgram(): Program;
|
|
11
|
+
export declare function getJupiterProgram<T extends Program = Program>(context: Pick<Context, 'programs'>, clusterFilter?: ClusterFilter): T;
|
|
12
|
+
export declare function getJupiterProgramId(context: Pick<Context, 'programs'>, clusterFilter?: ClusterFilter): PublicKey;
|
|
13
|
+
//# sourceMappingURL=jupiter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jupiter.d.ts","sourceRoot":"","sources":["../../../src/jupiter-sdk/programs/jupiter.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,aAAa,EACb,OAAO,EACP,OAAO,EACP,SAAS,EACV,MAAM,0BAA0B,CAAC;AAGlC,eAAO,MAAM,kBAAkB,EACoB,SAAS,CAAC,6CAA6C,CAAC,CAAC;AAE5G,wBAAgB,oBAAoB,IAAI,OAAO,CAc9C;AAED,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,OAAO,GAAG,OAAO,EAC3D,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC,EAClC,aAAa,CAAC,EAAE,aAAa,GAC5B,CAAC,CAEH;AAED,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC,EAClC,aAAa,CAAC,EAAE,aAAa,GAC5B,SAAS,CAMX"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This code was AUTOGENERATED using the kinobi library.
|
|
4
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
5
|
+
* to add features, then rerun kinobi to update it.
|
|
6
|
+
*
|
|
7
|
+
* @see https://github.com/metaplex-foundation/kinobi
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.JUPITER_PROGRAM_ID = void 0;
|
|
11
|
+
exports.createJupiterProgram = createJupiterProgram;
|
|
12
|
+
exports.getJupiterProgram = getJupiterProgram;
|
|
13
|
+
exports.getJupiterProgramId = getJupiterProgramId;
|
|
14
|
+
const errors_1 = require("../errors");
|
|
15
|
+
exports.JUPITER_PROGRAM_ID = 'JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4';
|
|
16
|
+
function createJupiterProgram() {
|
|
17
|
+
return {
|
|
18
|
+
name: 'jupiter',
|
|
19
|
+
publicKey: exports.JUPITER_PROGRAM_ID,
|
|
20
|
+
getErrorFromCode(code, cause) {
|
|
21
|
+
return (0, errors_1.getJupiterErrorFromCode)(code, this, cause);
|
|
22
|
+
},
|
|
23
|
+
getErrorFromName(name, cause) {
|
|
24
|
+
return (0, errors_1.getJupiterErrorFromName)(name, this, cause);
|
|
25
|
+
},
|
|
26
|
+
isOnCluster() {
|
|
27
|
+
return true;
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function getJupiterProgram(context, clusterFilter) {
|
|
32
|
+
return context.programs.get('jupiter', clusterFilter);
|
|
33
|
+
}
|
|
34
|
+
function getJupiterProgramId(context, clusterFilter) {
|
|
35
|
+
return context.programs.getPublicKey('jupiter', exports.JUPITER_PROGRAM_ID, clusterFilter);
|
|
36
|
+
}
|
|
@@ -10,4 +10,9 @@ export declare function buildSolautoRebalanceTransaction(client: SolautoClient,
|
|
|
10
10
|
lookupTableAddresses: string[];
|
|
11
11
|
} | undefined>;
|
|
12
12
|
export declare function convertReferralFeesToDestination(umi: Umi, referralState: ReferralState, tokenAccount: PublicKey): Promise<[TransactionBuilder, string[]] | undefined>;
|
|
13
|
+
export declare function getErrorInfo(tx: TransactionBuilder, error: any): {
|
|
14
|
+
errorName: string;
|
|
15
|
+
errorInfo: string;
|
|
16
|
+
canBeIgnored: boolean;
|
|
17
|
+
};
|
|
13
18
|
//# sourceMappingURL=transactionUtils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transactionUtils.d.ts","sourceRoot":"","sources":["../../src/transactions/transactionUtils.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"transactionUtils.d.ts","sourceRoot":"","sources":["../../src/transactions/transactionUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,kBAAkB,EAClB,GAAG,EAGJ,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,SAAS,EAA8B,MAAM,iBAAiB,CAAC;AAKxE,OAAO,EAGL,aAAa,EAYd,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAiOzD,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,aAAa,EACrB,EAAE,EAAE,kBAAkB,EACtB,sBAAsB,EAAE,MAAM,EAAE,GAC/B,OAAO,CAAC,kBAAkB,CAAC,CA+G7B;AAmLD,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,aAAa,EACrB,EAAE,EAAE,kBAAkB,GACrB,OAAO,CAAC,CAAC,kBAAkB,EAAE,kBAAkB,CAAC,CAAC,CA0BnD;AAED,wBAAgB,8BAA8B,CAAC,MAAM,EAAE,aAAa,WAwCnE;AAED,wBAAsB,gCAAgC,CACpD,MAAM,EAAE,aAAa,EACrB,2BAA2B,CAAC,EAAE,MAAM,EACpC,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CACN;IACE,EAAE,EAAE,kBAAkB,CAAC;IACvB,oBAAoB,EAAE,MAAM,EAAE,CAAC;CAChC,GACD,SAAS,CACZ,CAwHA;AAED,wBAAsB,gCAAgC,CACpD,GAAG,EAAE,GAAG,EACR,aAAa,EAAE,aAAa,EAC5B,YAAY,EAAE,SAAS,GACtB,OAAO,CAAC,CAAC,kBAAkB,EAAE,MAAM,EAAE,CAAC,GAAG,SAAS,CAAC,CAmCrD;AAED,wBAAgB,YAAY,CAAC,EAAE,EAAE,kBAAkB,EAAE,KAAK,EAAE,GAAG;;;;EA0C9D"}
|
|
@@ -5,6 +5,7 @@ exports.getTransactionChores = getTransactionChores;
|
|
|
5
5
|
exports.requiresRefreshBeforeRebalance = requiresRefreshBeforeRebalance;
|
|
6
6
|
exports.buildSolautoRebalanceTransaction = buildSolautoRebalanceTransaction;
|
|
7
7
|
exports.convertReferralFeesToDestination = convertReferralFeesToDestination;
|
|
8
|
+
exports.getErrorInfo = getErrorInfo;
|
|
8
9
|
const umi_1 = require("@metaplex-foundation/umi");
|
|
9
10
|
const umi_web3js_adapters_1 = require("@metaplex-foundation/umi-web3js-adapters");
|
|
10
11
|
const web3_js_1 = require("@solana/web3.js");
|
|
@@ -18,6 +19,7 @@ const numberUtils_1 = require("../utils/numberUtils");
|
|
|
18
19
|
const generalUtils_2 = require("../utils/solauto/generalUtils");
|
|
19
20
|
const accountUtils_1 = require("../utils/accountUtils");
|
|
20
21
|
const marginfi_sdk_1 = require("../marginfi-sdk");
|
|
22
|
+
const jupiter_sdk_1 = require("../jupiter-sdk");
|
|
21
23
|
function getWSolUsage(client, solautoActions, initiatingDcaIn, cancellingDcaIn) {
|
|
22
24
|
const supplyIsWsol = client.supplyMint.equals(spl_token_1.NATIVE_MINT);
|
|
23
25
|
const debtIsWsol = client.debtMint.equals(spl_token_1.NATIVE_MINT);
|
|
@@ -329,14 +331,18 @@ function requiresRefreshBeforeRebalance(client) {
|
|
|
329
331
|
return true;
|
|
330
332
|
}
|
|
331
333
|
else if (client.solautoPositionData && !client.selfManaged) {
|
|
332
|
-
if (client.livePositionUpdates.supplyAdjustment > BigInt(0) ||
|
|
334
|
+
if (client.livePositionUpdates.supplyAdjustment > BigInt(0) ||
|
|
335
|
+
client.livePositionUpdates.debtAdjustment > BigInt(0)) {
|
|
333
336
|
return false;
|
|
334
337
|
}
|
|
335
338
|
const oldSupply = client.solautoPositionData.state.supply.amountUsed.baseUnit;
|
|
336
339
|
const oldDebt = client.solautoPositionData.state.debt.amountUsed.baseUnit;
|
|
337
|
-
const supplyDiff = (client.solautoPositionState?.supply.amountUsed.baseUnit ?? BigInt(0)) -
|
|
338
|
-
|
|
339
|
-
|
|
340
|
+
const supplyDiff = (client.solautoPositionState?.supply.amountUsed.baseUnit ?? BigInt(0)) -
|
|
341
|
+
oldSupply;
|
|
342
|
+
const debtDiff = (client.solautoPositionState?.debt.amountUsed.baseUnit ?? BigInt(0)) -
|
|
343
|
+
oldDebt;
|
|
344
|
+
if (Math.abs(Number(supplyDiff)) / Number(oldSupply) >= 0.01 ||
|
|
345
|
+
Math.abs(Number(debtDiff)) / Number(oldDebt) >= 0.01) {
|
|
340
346
|
return true;
|
|
341
347
|
}
|
|
342
348
|
}
|
|
@@ -421,3 +427,39 @@ async function convertReferralFeesToDestination(umi, referralState, tokenAccount
|
|
|
421
427
|
.add(swapIx);
|
|
422
428
|
return [tx, lookupTableAddresses];
|
|
423
429
|
}
|
|
430
|
+
function getErrorInfo(tx, error) {
|
|
431
|
+
let canBeIgnored = false;
|
|
432
|
+
let errorName = undefined;
|
|
433
|
+
let errorInfo = undefined;
|
|
434
|
+
try {
|
|
435
|
+
let programError = null;
|
|
436
|
+
if (typeof error === "object" && error["InstructionError"]) {
|
|
437
|
+
const err = error["InstructionError"];
|
|
438
|
+
const errIx = tx.getInstructions()[Math.max(0, err[0] - 2)];
|
|
439
|
+
const errCode = err[1]["Custom"];
|
|
440
|
+
if (errIx.programId === generated_1.SOLAUTO_PROGRAM_ID) {
|
|
441
|
+
programError = (0, generated_1.getSolautoErrorFromCode)(errCode, (0, generated_1.createSolautoProgram)());
|
|
442
|
+
if (programError?.name ===
|
|
443
|
+
new generated_1.InvalidRebalanceConditionError((0, generated_1.createSolautoProgram)()).name) {
|
|
444
|
+
canBeIgnored = true;
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
else if (errIx.programId === marginfi_sdk_1.MARGINFI_PROGRAM_ID) {
|
|
448
|
+
programError = (0, marginfi_sdk_1.getMarginfiErrorFromName)(errCode, (0, marginfi_sdk_1.createMarginfiProgram)());
|
|
449
|
+
}
|
|
450
|
+
else if (errIx.programId === jupiter_sdk_1.JUPITER_PROGRAM_ID) {
|
|
451
|
+
programError = (0, jupiter_sdk_1.getJupiterErrorFromName)(errCode, (0, jupiter_sdk_1.createJupiterProgram)());
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
if (programError) {
|
|
455
|
+
errorName = programError?.name;
|
|
456
|
+
errorName = programError?.message;
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
catch { }
|
|
460
|
+
return {
|
|
461
|
+
errorName: errorName ?? "Unknown error",
|
|
462
|
+
errorInfo: errorInfo ?? "Unknown error",
|
|
463
|
+
canBeIgnored,
|
|
464
|
+
};
|
|
465
|
+
}
|
|
@@ -28,10 +28,11 @@ export declare enum TransactionStatus {
|
|
|
28
28
|
}
|
|
29
29
|
export type TransactionManagerStatuses = {
|
|
30
30
|
name: string;
|
|
31
|
+
attemptNum: number;
|
|
31
32
|
status: TransactionStatus;
|
|
33
|
+
moreInfo?: string;
|
|
32
34
|
simulationSuccessful?: boolean;
|
|
33
35
|
txSig?: string;
|
|
34
|
-
attemptNum: number;
|
|
35
36
|
}[];
|
|
36
37
|
export declare class TransactionsManager {
|
|
37
38
|
private txHandler;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transactionsManager.d.ts","sourceRoot":"","sources":["../../src/transactions/transactionsManager.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,kBAAkB,EAEnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAKzD,OAAO,EACL,aAAa,EAEd,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAa,MAAM,YAAY,CAAC;AA0C7D,qBAAa,eAAe;IAKjB,OAAO,EAAE,CACd,UAAU,EAAE,MAAM,KACf,OAAO,CACV;QAAE,EAAE,EAAE,kBAAkB,CAAC;QAAC,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,GAAG,SAAS,CACxE;IACM,IAAI,CAAC,EAAE,MAAM;IATtB,oBAAoB,EAAG,MAAM,EAAE,CAAC;IAChC,EAAE,CAAC,EAAE,kBAAkB,CAAC;gBAGf,OAAO,EAAE,CACd,UAAU,EAAE,MAAM,KACf,OAAO,CACV;QAAE,EAAE,EAAE,kBAAkB,CAAC;QAAC,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,GAAG,SAAS,CACxE,EACM,IAAI,CAAC,EAAE,MAAM,YAAA;IAGhB,UAAU;IAIV,OAAO,CAAC,UAAU,EAAE,MAAM;IAMhC,cAAc,IAAI,MAAM,EAAE;CAY3B;AAgFD,oBAAY,iBAAiB;IAC3B,OAAO,YAAY;IACnB,UAAU,eAAe;IACzB,MAAM,WAAW;IACjB,UAAU,eAAe;IACzB,MAAM,WAAW;CAClB;AAED,MAAM,MAAM,0BAA0B,GAAG;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,iBAAiB,CAAC;IAC1B,
|
|
1
|
+
{"version":3,"file":"transactionsManager.d.ts","sourceRoot":"","sources":["../../src/transactions/transactionsManager.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,kBAAkB,EAEnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAKzD,OAAO,EACL,aAAa,EAEd,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAa,MAAM,YAAY,CAAC;AA0C7D,qBAAa,eAAe;IAKjB,OAAO,EAAE,CACd,UAAU,EAAE,MAAM,KACf,OAAO,CACV;QAAE,EAAE,EAAE,kBAAkB,CAAC;QAAC,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,GAAG,SAAS,CACxE;IACM,IAAI,CAAC,EAAE,MAAM;IATtB,oBAAoB,EAAG,MAAM,EAAE,CAAC;IAChC,EAAE,CAAC,EAAE,kBAAkB,CAAC;gBAGf,OAAO,EAAE,CACd,UAAU,EAAE,MAAM,KACf,OAAO,CACV;QAAE,EAAE,EAAE,kBAAkB,CAAC;QAAC,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,GAAG,SAAS,CACxE,EACM,IAAI,CAAC,EAAE,MAAM,YAAA;IAGhB,UAAU;IAIV,OAAO,CAAC,UAAU,EAAE,MAAM;IAMhC,cAAc,IAAI,MAAM,EAAE;CAY3B;AAgFD,oBAAY,iBAAiB;IAC3B,OAAO,YAAY;IACnB,UAAU,eAAe;IACzB,MAAM,WAAW;IACjB,UAAU,eAAe;IACzB,MAAM,WAAW;CAClB;AAED,MAAM,MAAM,0BAA0B,GAAG;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,iBAAiB,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,EAAE,CAAC;AAEJ,qBAAa,mBAAmB;IAK5B,OAAO,CAAC,SAAS;IACjB,OAAO,CAAC,cAAc,CAAC;IACvB,OAAO,CAAC,MAAM,CAAC;IACf,OAAO,CAAC,YAAY,CAAC;IACrB,OAAO,CAAC,aAAa,CAAC;IACtB,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,UAAU;IAVpB,OAAO,CAAC,QAAQ,CAAkC;IAClD,OAAO,CAAC,YAAY,CAAe;gBAGzB,SAAS,EAAE,aAAa,GAAG,oBAAoB,EAC/C,cAAc,CAAC,GAAE,CAAC,QAAQ,EAAE,0BAA0B,KAAK,IAAI,aAAA,EAC/D,MAAM,CAAC,EAAE,kBAAkB,YAAA,EAC3B,YAAY,CAAC,EAAE,OAAO,YAAA,EACtB,aAAa,CAAC,EAAE,aAAa,YAAA,EAC7B,OAAO,GAAE,MAAU,EACnB,UAAU,GAAE,MAAY;YAQpB,uBAAuB;IAwCrC,OAAO,CAAC,YAAY;YA8CN,aAAa;IAoBd,UAAU,CACrB,YAAY,EAAE,eAAe,EAAE,EAC/B,eAAe,CAAC,EAAE,kBAAkB,GACnC,OAAO,CAAC,0BAA0B,CAAC;IAyEzB,IAAI,CACf,KAAK,EAAE,eAAe,EAAE,EACxB,eAAe,CAAC,EAAE,kBAAkB,EACpC,WAAW,CAAC,EAAE,OAAO,GACpB,OAAO,CAAC,0BAA0B,CAAC;YA0GxB,eAAe;CAiD9B"}
|
|
@@ -9,7 +9,6 @@ const umi_1 = require("@metaplex-foundation/umi");
|
|
|
9
9
|
const solanaUtils_1 = require("../utils/solanaUtils");
|
|
10
10
|
const generalUtils_1 = require("../utils/generalUtils");
|
|
11
11
|
const transactionUtils_1 = require("./transactionUtils");
|
|
12
|
-
const generated_1 = require("../generated");
|
|
13
12
|
// import { sendJitoBundledTransactions } from "../utils/jitoUtils";
|
|
14
13
|
class LookupTables {
|
|
15
14
|
constructor(defaultLuts, umi) {
|
|
@@ -162,7 +161,7 @@ class TransactionsManager {
|
|
|
162
161
|
}
|
|
163
162
|
return transactionSets;
|
|
164
163
|
}
|
|
165
|
-
updateStatus(name, status, attemptNum, txSig, simulationSuccessful) {
|
|
164
|
+
updateStatus(name, status, attemptNum, txSig, simulationSuccessful, moreInfo) {
|
|
166
165
|
if (!this.statuses.filter((x) => x.name === name)) {
|
|
167
166
|
this.statuses.push({
|
|
168
167
|
name,
|
|
@@ -170,6 +169,7 @@ class TransactionsManager {
|
|
|
170
169
|
txSig,
|
|
171
170
|
attemptNum,
|
|
172
171
|
simulationSuccessful,
|
|
172
|
+
moreInfo,
|
|
173
173
|
});
|
|
174
174
|
}
|
|
175
175
|
else {
|
|
@@ -180,6 +180,9 @@ class TransactionsManager {
|
|
|
180
180
|
if (simulationSuccessful) {
|
|
181
181
|
this.statuses[idx].simulationSuccessful = simulationSuccessful;
|
|
182
182
|
}
|
|
183
|
+
if (moreInfo) {
|
|
184
|
+
this.statuses[idx].moreInfo = moreInfo;
|
|
185
|
+
}
|
|
183
186
|
}
|
|
184
187
|
else {
|
|
185
188
|
this.statuses.push({
|
|
@@ -188,6 +191,7 @@ class TransactionsManager {
|
|
|
188
191
|
txSig,
|
|
189
192
|
attemptNum,
|
|
190
193
|
simulationSuccessful,
|
|
194
|
+
moreInfo,
|
|
191
195
|
});
|
|
192
196
|
}
|
|
193
197
|
}
|
|
@@ -332,25 +336,13 @@ class TransactionsManager {
|
|
|
332
336
|
this.updateStatus(txName, TransactionStatus.Successful, attemptNum, txSig ? bs58_1.default.encode(txSig) : undefined);
|
|
333
337
|
}
|
|
334
338
|
catch (e) {
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
const invalidRebalanceError = new generated_1.InvalidRebalanceConditionError(solautoProgram);
|
|
342
|
-
if (tx.getInstructions()[Math.max(0, errIx - 2)].programId ===
|
|
343
|
-
generated_1.SOLAUTO_PROGRAM_ID &&
|
|
344
|
-
solautoProgram.getErrorFromCode(errCode)?.name ===
|
|
345
|
-
invalidRebalanceError.name) {
|
|
346
|
-
this.updateStatus(txName, TransactionStatus.Skipped, attemptNum);
|
|
347
|
-
return;
|
|
348
|
-
}
|
|
349
|
-
}
|
|
339
|
+
const errorDetails = (0, transactionUtils_1.getErrorInfo)(tx, e);
|
|
340
|
+
this.updateStatus(txName, errorDetails.canBeIgnored
|
|
341
|
+
? TransactionStatus.Skipped
|
|
342
|
+
: TransactionStatus.Failed, attemptNum, undefined, undefined, errorDetails.errorInfo);
|
|
343
|
+
if (!errorDetails.canBeIgnored) {
|
|
344
|
+
throw e;
|
|
350
345
|
}
|
|
351
|
-
catch { }
|
|
352
|
-
this.updateStatus(txName, TransactionStatus.Failed, attemptNum);
|
|
353
|
-
throw e;
|
|
354
346
|
}
|
|
355
347
|
}
|
|
356
348
|
}
|
package/package.json
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { PublicKey } from "@solana/web3.js";
|
|
2
2
|
|
|
3
3
|
export const USD_DECIMALS = 9;
|
|
4
|
-
|
|
5
|
-
// TODO
|
|
6
4
|
export const SOLAUTO_FEES_WALLET = new PublicKey("AprYCPiVeKMCgjQ2ZufwChMzvQ5kFjJo2ekTLSkXsQDm");
|
|
7
|
-
|
|
8
5
|
export const SOLAUTO_MANAGER = new PublicKey("MNGRcX4nc7quPdzBbNKJ4ScK5EE73JnwJVGxuJXhHCY");
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
// import { JitoRpcConnection } from "jito-ts";
|
|
13
13
|
import { SOLAUTO_PROGRAM_ID } from "../generated";
|
|
14
14
|
import { SOLAUTO_MANAGER } from "./generalAccounts";
|
|
15
|
+
import { JUPITER_PROGRAM_ID } from "../jupiter-sdk";
|
|
15
16
|
|
|
16
17
|
export const BASIS_POINTS = 10000;
|
|
17
18
|
|
|
@@ -30,8 +31,6 @@ export const PRICES: { [key: string]: { price: number; time: number; } } = {};
|
|
|
30
31
|
|
|
31
32
|
export const SOLAUTO_LUT = "9D4xwZwDf46n9ft5gQxZzq3rBbdRXsXojKQLZbBdskPY";
|
|
32
33
|
|
|
33
|
-
export const JUPITER_PROGRAM_ID = "JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4";
|
|
34
|
-
|
|
35
34
|
export const STANDARD_LUT_ACCOUNTS = [
|
|
36
35
|
PublicKey.default.toString(),
|
|
37
36
|
SOLAUTO_PROGRAM_ID,
|