@perena/vault-sdk 1.0.44 → 1.0.46
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/browser/nest.d.mts +208 -0
- package/dist/browser/nest.mjs +757 -0
- package/dist/index.d.ts +816 -16
- package/dist/index.js +1185 -110
- package/package.json +4 -1
package/dist/index.js
CHANGED
|
@@ -149,7 +149,7 @@ var require_compat = __commonJS({
|
|
|
149
149
|
exports2.fromWeb3PublicKey = fromWeb3PublicKey;
|
|
150
150
|
exports2.toWeb3PublicKey = toWeb3PublicKey;
|
|
151
151
|
exports2.asWeb3PublicKey = asWeb3PublicKey2;
|
|
152
|
-
exports2.toKitInstruction =
|
|
152
|
+
exports2.toKitInstruction = toKitInstruction33;
|
|
153
153
|
exports2.fromKitInstruction = fromKitInstruction3;
|
|
154
154
|
var kit_1 = require("@solana/kit");
|
|
155
155
|
var web3_js_1 = require("@solana/web3.js");
|
|
@@ -165,7 +165,7 @@ var require_compat = __commonJS({
|
|
|
165
165
|
exports2.toAddress = fromWeb3PublicKey;
|
|
166
166
|
exports2.fromWeb3Pk = fromWeb3PublicKey;
|
|
167
167
|
exports2.toWeb3Pk = toWeb3PublicKey;
|
|
168
|
-
function
|
|
168
|
+
function toKitInstruction33(ix) {
|
|
169
169
|
return {
|
|
170
170
|
programAddress: ix.programId.toBase58(),
|
|
171
171
|
data: new Uint8Array(ix.data),
|
|
@@ -253,9 +253,9 @@ var require_meta = __commonJS({
|
|
|
253
253
|
exports2.toCustomAccountMeta = toCustomAccountMeta;
|
|
254
254
|
exports2.toCustomAccountMetaFromWeb3AccountMeta = toCustomAccountMetaFromWeb3AccountMeta;
|
|
255
255
|
var roles_1 = require_roles();
|
|
256
|
-
function toCustomAccountMeta(
|
|
256
|
+
function toCustomAccountMeta(address14, isWritable, requiredAtaDetails, isSigner) {
|
|
257
257
|
const role = (0, roles_1.getAccountRole)(isWritable ?? false, isSigner ?? false);
|
|
258
|
-
return { address:
|
|
258
|
+
return { address: address14, role, isRequiredAta: requiredAtaDetails };
|
|
259
259
|
}
|
|
260
260
|
function toCustomAccountMetaFromWeb3AccountMeta(web3AccountMeta) {
|
|
261
261
|
return toCustomAccountMeta(web3AccountMeta.pubkey.toBase58(), web3AccountMeta.isWritable, void 0, web3AccountMeta.isSigner);
|
|
@@ -1112,9 +1112,9 @@ var require_dist = __commonJS({
|
|
|
1112
1112
|
}
|
|
1113
1113
|
});
|
|
1114
1114
|
|
|
1115
|
-
//
|
|
1115
|
+
// ../../node_modules/.pnpm/marginfi@file+typescript+marginfi_bufferutil@4.1.0_fastestsmallesttextencoderdecoder@1._7432de83e22e4bcea0493cabf074a552/node_modules/marginfi/dist/constants.js
|
|
1116
1116
|
var require_constants3 = __commonJS({
|
|
1117
|
-
"
|
|
1117
|
+
"../../node_modules/.pnpm/marginfi@file+typescript+marginfi_bufferutil@4.1.0_fastestsmallesttextencoderdecoder@1._7432de83e22e4bcea0493cabf074a552/node_modules/marginfi/dist/constants.js"(exports2) {
|
|
1118
1118
|
"use strict";
|
|
1119
1119
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1120
1120
|
exports2.MarginfiAccounts = exports2.MARGINFI_MAIN_USDC_ACCOUNTS = exports2.MARGINFI_CASH_ACCOUNTS = exports2.MARGINFI_USDS_ACCOUNTS = exports2.MARGINFI_PYUSD_ACCOUNTS = exports2.MARGINFI_USDG_ACCOUNTS = exports2.MARGINFI_USDT_ACCOUNTS = exports2.MARGINFI_USDC_ACCOUNTS = exports2.CASH_MINT = exports2.USDS_MINT = exports2.PYUSD_MINT = exports2.USDG_MINT = exports2.USDT_MINT = exports2.USDC_MINT = exports2.MARGINFI_THIRD_PARTY_ID = exports2.MARGINFI_ACCOUNT_INDEX = exports2.MARGINFI_GROUP = exports2.SYSVAR_INSTRUCTIONS_ID = exports2.SYSTEM_PROGRAM_ID = exports2.TOKEN_2022_PROGRAM_ID = exports2.TOKEN_PROGRAM_ID = exports2.MARGINFI_PROGRAM_ID = void 0;
|
|
@@ -1227,17 +1227,17 @@ var require_constants3 = __commonJS({
|
|
|
1227
1227
|
}
|
|
1228
1228
|
});
|
|
1229
1229
|
|
|
1230
|
-
//
|
|
1230
|
+
// ../../node_modules/.pnpm/marginfi@file+typescript+marginfi_bufferutil@4.1.0_fastestsmallesttextencoderdecoder@1._7432de83e22e4bcea0493cabf074a552/node_modules/marginfi/dist/cpiClient.js
|
|
1231
1231
|
var require_cpiClient = __commonJS({
|
|
1232
|
-
"
|
|
1232
|
+
"../../node_modules/.pnpm/marginfi@file+typescript+marginfi_bufferutil@4.1.0_fastestsmallesttextencoderdecoder@1._7432de83e22e4bcea0493cabf074a552/node_modules/marginfi/dist/cpiClient.js"(exports2) {
|
|
1233
1233
|
"use strict";
|
|
1234
1234
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1235
1235
|
exports2.CpiClient = void 0;
|
|
1236
1236
|
var kit_1 = require("@solana/kit");
|
|
1237
1237
|
var common_1 = require_dist();
|
|
1238
1238
|
var constants_1 = require_constants3();
|
|
1239
|
-
function account(
|
|
1240
|
-
return { address:
|
|
1239
|
+
function account(address14, role) {
|
|
1240
|
+
return { address: address14, role };
|
|
1241
1241
|
}
|
|
1242
1242
|
function requiredAddress(value, label) {
|
|
1243
1243
|
if (!value) {
|
|
@@ -1326,7 +1326,7 @@ var require_cpiClient = __commonJS({
|
|
|
1326
1326
|
});
|
|
1327
1327
|
const bankAndOracleRemainingAccounts = [
|
|
1328
1328
|
account(this.accounts.bank, kit_1.AccountRole.READONLY),
|
|
1329
|
-
...this.accounts.oracleAccounts.map((
|
|
1329
|
+
...this.accounts.oracleAccounts.map((address14) => account(address14, kit_1.AccountRole.READONLY))
|
|
1330
1330
|
];
|
|
1331
1331
|
return {
|
|
1332
1332
|
cpiType: params.cpiType ?? common_1.CpiTypes.MARGINFI_WITHDRAW,
|
|
@@ -1378,26 +1378,26 @@ var require_cpiClient = __commonJS({
|
|
|
1378
1378
|
}
|
|
1379
1379
|
});
|
|
1380
1380
|
|
|
1381
|
-
//
|
|
1381
|
+
// ../../node_modules/.pnpm/marginfi@file+typescript+marginfi_bufferutil@4.1.0_fastestsmallesttextencoderdecoder@1._7432de83e22e4bcea0493cabf074a552/node_modules/marginfi/dist/types.js
|
|
1382
1382
|
var require_types3 = __commonJS({
|
|
1383
|
-
"
|
|
1383
|
+
"../../node_modules/.pnpm/marginfi@file+typescript+marginfi_bufferutil@4.1.0_fastestsmallesttextencoderdecoder@1._7432de83e22e4bcea0493cabf074a552/node_modules/marginfi/dist/types.js"(exports2) {
|
|
1384
1384
|
"use strict";
|
|
1385
1385
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1386
1386
|
}
|
|
1387
1387
|
});
|
|
1388
1388
|
|
|
1389
|
-
//
|
|
1389
|
+
// ../../node_modules/.pnpm/marginfi@file+typescript+marginfi_bufferutil@4.1.0_fastestsmallesttextencoderdecoder@1._7432de83e22e4bcea0493cabf074a552/node_modules/marginfi/dist/positions.js
|
|
1390
1390
|
var require_positions = __commonJS({
|
|
1391
|
-
"
|
|
1391
|
+
"../../node_modules/.pnpm/marginfi@file+typescript+marginfi_bufferutil@4.1.0_fastestsmallesttextencoderdecoder@1._7432de83e22e4bcea0493cabf074a552/node_modules/marginfi/dist/positions.js"(exports2) {
|
|
1392
1392
|
"use strict";
|
|
1393
1393
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1394
|
-
exports2.parseBankPksFromMarginfiAccount =
|
|
1395
|
-
exports2.createMarginfiReadClient =
|
|
1394
|
+
exports2.parseBankPksFromMarginfiAccount = parseBankPksFromMarginfiAccount3;
|
|
1395
|
+
exports2.createMarginfiReadClient = createMarginfiReadClient3;
|
|
1396
1396
|
exports2.readMarginfiBankBalance = readMarginfiBankBalance2;
|
|
1397
1397
|
exports2.readAllMarginfiBalances = readAllMarginfiBalances2;
|
|
1398
1398
|
var web3_js_1 = require("@solana/web3.js");
|
|
1399
1399
|
var marginfi_client_v2_1 = require("@mrgnlabs/marginfi-client-v2");
|
|
1400
|
-
function
|
|
1400
|
+
function parseBankPksFromMarginfiAccount3(data) {
|
|
1401
1401
|
const DISCRIMINATOR = 8;
|
|
1402
1402
|
const LENDING_ACCOUNT_OFFSET = DISCRIMINATOR + 32 + 32;
|
|
1403
1403
|
const BALANCE_SIZE = 104;
|
|
@@ -1414,7 +1414,7 @@ var require_positions = __commonJS({
|
|
|
1414
1414
|
}
|
|
1415
1415
|
return out;
|
|
1416
1416
|
}
|
|
1417
|
-
async function
|
|
1417
|
+
async function createMarginfiReadClient3(connection, preloadedBankAddresses = []) {
|
|
1418
1418
|
return marginfi_client_v2_1.MarginfiClient.fetch((0, marginfi_client_v2_1.getConfig)("production"), void 0, connection, {
|
|
1419
1419
|
preloadedBankAddresses,
|
|
1420
1420
|
// Balance readers use on-chain shares and bank addresses, not metadata.
|
|
@@ -1451,9 +1451,9 @@ var require_positions = __commonJS({
|
|
|
1451
1451
|
}
|
|
1452
1452
|
});
|
|
1453
1453
|
|
|
1454
|
-
//
|
|
1454
|
+
// ../../node_modules/.pnpm/marginfi@file+typescript+marginfi_bufferutil@4.1.0_fastestsmallesttextencoderdecoder@1._7432de83e22e4bcea0493cabf074a552/node_modules/marginfi/dist/index.js
|
|
1455
1455
|
var require_dist2 = __commonJS({
|
|
1456
|
-
"
|
|
1456
|
+
"../../node_modules/.pnpm/marginfi@file+typescript+marginfi_bufferutil@4.1.0_fastestsmallesttextencoderdecoder@1._7432de83e22e4bcea0493cabf074a552/node_modules/marginfi/dist/index.js"(exports2) {
|
|
1457
1457
|
"use strict";
|
|
1458
1458
|
var __createBinding = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
1459
1459
|
if (k2 === void 0) k2 = k;
|
|
@@ -2684,9 +2684,9 @@ var init_dist = __esm({
|
|
|
2684
2684
|
}
|
|
2685
2685
|
});
|
|
2686
2686
|
|
|
2687
|
-
//
|
|
2687
|
+
// ../../node_modules/.pnpm/jupiter@file+typescript+jupiter_bufferutil@4.1.0_fastestsmallesttextencoderdecoder@1.0._929400004aea12c8b3c9bcc7c5a22ec9/node_modules/jupiter/dist/constants.js
|
|
2688
2688
|
var require_constants4 = __commonJS({
|
|
2689
|
-
"
|
|
2689
|
+
"../../node_modules/.pnpm/jupiter@file+typescript+jupiter_bufferutil@4.1.0_fastestsmallesttextencoderdecoder@1.0._929400004aea12c8b3c9bcc7c5a22ec9/node_modules/jupiter/dist/constants.js"(exports2) {
|
|
2690
2690
|
"use strict";
|
|
2691
2691
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
2692
2692
|
exports2.DEFAULT_EXCLUDED_DEXES = exports2.DEFAULT_MAX_ACCOUNTS = exports2.DEFAULT_SLIPPAGE_BPS = exports2.JUPITER_PRICE_API_URL = exports2.JUPITER_API_URL = exports2.JUPITER_V6_PROGRAM_ID = void 0;
|
|
@@ -2706,9 +2706,9 @@ var require_constants4 = __commonJS({
|
|
|
2706
2706
|
}
|
|
2707
2707
|
});
|
|
2708
2708
|
|
|
2709
|
-
//
|
|
2709
|
+
// ../../node_modules/.pnpm/jupiter@file+typescript+jupiter_bufferutil@4.1.0_fastestsmallesttextencoderdecoder@1.0._929400004aea12c8b3c9bcc7c5a22ec9/node_modules/jupiter/dist/api.js
|
|
2710
2710
|
var require_api = __commonJS({
|
|
2711
|
-
"
|
|
2711
|
+
"../../node_modules/.pnpm/jupiter@file+typescript+jupiter_bufferutil@4.1.0_fastestsmallesttextencoderdecoder@1.0._929400004aea12c8b3c9bcc7c5a22ec9/node_modules/jupiter/dist/api.js"(exports2) {
|
|
2712
2712
|
"use strict";
|
|
2713
2713
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
2714
2714
|
exports2.getJupiterQuote = getJupiterQuote;
|
|
@@ -2779,9 +2779,9 @@ var require_api = __commonJS({
|
|
|
2779
2779
|
}
|
|
2780
2780
|
});
|
|
2781
2781
|
|
|
2782
|
-
//
|
|
2782
|
+
// ../../node_modules/.pnpm/jupiter@file+typescript+jupiter_bufferutil@4.1.0_fastestsmallesttextencoderdecoder@1.0._929400004aea12c8b3c9bcc7c5a22ec9/node_modules/jupiter/dist/extract.js
|
|
2783
2783
|
var require_extract = __commonJS({
|
|
2784
|
-
"
|
|
2784
|
+
"../../node_modules/.pnpm/jupiter@file+typescript+jupiter_bufferutil@4.1.0_fastestsmallesttextencoderdecoder@1.0._929400004aea12c8b3c9bcc7c5a22ec9/node_modules/jupiter/dist/extract.js"(exports2) {
|
|
2785
2785
|
"use strict";
|
|
2786
2786
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
2787
2787
|
exports2.extractJupiterInstruction = extractJupiterInstruction;
|
|
@@ -2809,9 +2809,9 @@ var require_extract = __commonJS({
|
|
|
2809
2809
|
}
|
|
2810
2810
|
});
|
|
2811
2811
|
|
|
2812
|
-
//
|
|
2812
|
+
// ../../node_modules/.pnpm/jupiter@file+typescript+jupiter_bufferutil@4.1.0_fastestsmallesttextencoderdecoder@1.0._929400004aea12c8b3c9bcc7c5a22ec9/node_modules/jupiter/dist/routePreInstructions.js
|
|
2813
2813
|
var require_routePreInstructions = __commonJS({
|
|
2814
|
-
"
|
|
2814
|
+
"../../node_modules/.pnpm/jupiter@file+typescript+jupiter_bufferutil@4.1.0_fastestsmallesttextencoderdecoder@1.0._929400004aea12c8b3c9bcc7c5a22ec9/node_modules/jupiter/dist/routePreInstructions.js"(exports2) {
|
|
2815
2815
|
"use strict";
|
|
2816
2816
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
2817
2817
|
exports2.getJupiterRoutePreInstructions = getJupiterRoutePreInstructions;
|
|
@@ -2844,12 +2844,12 @@ var require_routePreInstructions = __commonJS({
|
|
|
2844
2844
|
if (existingAta.value) {
|
|
2845
2845
|
continue;
|
|
2846
2846
|
}
|
|
2847
|
-
instructions2.push(
|
|
2847
|
+
instructions2.push(toKitInstruction33((0, spl_token_1.createAssociatedTokenAccountIdempotentInstruction)(new web3_js_1.PublicKey(payer), new web3_js_1.PublicKey(ata), new web3_js_1.PublicKey(user), new web3_js_1.PublicKey(mint), new web3_js_1.PublicKey(tokenProgram), spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID)));
|
|
2848
2848
|
postSuccessCacheInvalidations.push({ address: ata });
|
|
2849
2849
|
}
|
|
2850
2850
|
return { instructions: instructions2, postSuccessCacheInvalidations };
|
|
2851
2851
|
}
|
|
2852
|
-
function
|
|
2852
|
+
function toKitInstruction33(ix) {
|
|
2853
2853
|
return {
|
|
2854
2854
|
programAddress: ix.programId.toBase58(),
|
|
2855
2855
|
accounts: ix.keys.map((account) => ({
|
|
@@ -2871,9 +2871,9 @@ var require_routePreInstructions = __commonJS({
|
|
|
2871
2871
|
}
|
|
2872
2872
|
});
|
|
2873
2873
|
|
|
2874
|
-
//
|
|
2874
|
+
// ../../node_modules/.pnpm/jupiter@file+typescript+jupiter_bufferutil@4.1.0_fastestsmallesttextencoderdecoder@1.0._929400004aea12c8b3c9bcc7c5a22ec9/node_modules/jupiter/dist/client.js
|
|
2875
2875
|
var require_client = __commonJS({
|
|
2876
|
-
"
|
|
2876
|
+
"../../node_modules/.pnpm/jupiter@file+typescript+jupiter_bufferutil@4.1.0_fastestsmallesttextencoderdecoder@1.0._929400004aea12c8b3c9bcc7c5a22ec9/node_modules/jupiter/dist/client.js"(exports2) {
|
|
2877
2877
|
"use strict";
|
|
2878
2878
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
2879
2879
|
exports2.JupiterSwapClient = void 0;
|
|
@@ -2977,9 +2977,9 @@ var require_client = __commonJS({
|
|
|
2977
2977
|
}
|
|
2978
2978
|
});
|
|
2979
2979
|
|
|
2980
|
-
//
|
|
2980
|
+
// ../../node_modules/.pnpm/jupiter@file+typescript+jupiter_bufferutil@4.1.0_fastestsmallesttextencoderdecoder@1.0._929400004aea12c8b3c9bcc7c5a22ec9/node_modules/jupiter/dist/priceApi.js
|
|
2981
2981
|
var require_priceApi = __commonJS({
|
|
2982
|
-
"
|
|
2982
|
+
"../../node_modules/.pnpm/jupiter@file+typescript+jupiter_bufferutil@4.1.0_fastestsmallesttextencoderdecoder@1.0._929400004aea12c8b3c9bcc7c5a22ec9/node_modules/jupiter/dist/priceApi.js"(exports2) {
|
|
2983
2983
|
"use strict";
|
|
2984
2984
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
2985
2985
|
exports2.fetchJupiterUsdPrices = fetchJupiterUsdPrices2;
|
|
@@ -3038,9 +3038,9 @@ var require_priceApi = __commonJS({
|
|
|
3038
3038
|
}
|
|
3039
3039
|
});
|
|
3040
3040
|
|
|
3041
|
-
//
|
|
3041
|
+
// ../../node_modules/.pnpm/jupiter@file+typescript+jupiter_bufferutil@4.1.0_fastestsmallesttextencoderdecoder@1.0._929400004aea12c8b3c9bcc7c5a22ec9/node_modules/jupiter/dist/sizeExactInForMinOutput.js
|
|
3042
3042
|
var require_sizeExactInForMinOutput = __commonJS({
|
|
3043
|
-
"
|
|
3043
|
+
"../../node_modules/.pnpm/jupiter@file+typescript+jupiter_bufferutil@4.1.0_fastestsmallesttextencoderdecoder@1.0._929400004aea12c8b3c9bcc7c5a22ec9/node_modules/jupiter/dist/sizeExactInForMinOutput.js"(exports2) {
|
|
3044
3044
|
"use strict";
|
|
3045
3045
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3046
3046
|
exports2.sizeExactInForMinOutput = sizeExactInForMinOutput;
|
|
@@ -3100,17 +3100,17 @@ var require_sizeExactInForMinOutput = __commonJS({
|
|
|
3100
3100
|
}
|
|
3101
3101
|
});
|
|
3102
3102
|
|
|
3103
|
-
//
|
|
3103
|
+
// ../../node_modules/.pnpm/jupiter@file+typescript+jupiter_bufferutil@4.1.0_fastestsmallesttextencoderdecoder@1.0._929400004aea12c8b3c9bcc7c5a22ec9/node_modules/jupiter/dist/types.js
|
|
3104
3104
|
var require_types4 = __commonJS({
|
|
3105
|
-
"
|
|
3105
|
+
"../../node_modules/.pnpm/jupiter@file+typescript+jupiter_bufferutil@4.1.0_fastestsmallesttextencoderdecoder@1.0._929400004aea12c8b3c9bcc7c5a22ec9/node_modules/jupiter/dist/types.js"(exports2) {
|
|
3106
3106
|
"use strict";
|
|
3107
3107
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3108
3108
|
}
|
|
3109
3109
|
});
|
|
3110
3110
|
|
|
3111
|
-
//
|
|
3111
|
+
// ../../node_modules/.pnpm/jupiter@file+typescript+jupiter_bufferutil@4.1.0_fastestsmallesttextencoderdecoder@1.0._929400004aea12c8b3c9bcc7c5a22ec9/node_modules/jupiter/dist/index.js
|
|
3112
3112
|
var require_dist3 = __commonJS({
|
|
3113
|
-
"
|
|
3113
|
+
"../../node_modules/.pnpm/jupiter@file+typescript+jupiter_bufferutil@4.1.0_fastestsmallesttextencoderdecoder@1.0._929400004aea12c8b3c9bcc7c5a22ec9/node_modules/jupiter/dist/index.js"(exports2) {
|
|
3114
3114
|
"use strict";
|
|
3115
3115
|
var __createBinding = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
3116
3116
|
if (k2 === void 0) k2 = k;
|
|
@@ -3163,6 +3163,90 @@ var require_priceApi2 = __commonJS({
|
|
|
3163
3163
|
}
|
|
3164
3164
|
});
|
|
3165
3165
|
|
|
3166
|
+
// ../nest/dist/redemptionApi.js
|
|
3167
|
+
var require_redemptionApi = __commonJS({
|
|
3168
|
+
"../nest/dist/redemptionApi.js"(exports2) {
|
|
3169
|
+
"use strict";
|
|
3170
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3171
|
+
exports2.NestApiError = void 0;
|
|
3172
|
+
exports2.assertNestShareAmount = assertNestShareAmount;
|
|
3173
|
+
exports2.fetchNestRedemptionTransaction = fetchNestRedemptionTransaction2;
|
|
3174
|
+
exports2.fetchNestRedemptionQuote = fetchNestRedemptionQuote2;
|
|
3175
|
+
exports2.fetchNestRedemptionStatus = fetchNestRedemptionStatus2;
|
|
3176
|
+
var priceApi_1 = require_priceApi2();
|
|
3177
|
+
var NestApiError2 = class extends Error {
|
|
3178
|
+
constructor(status, message2) {
|
|
3179
|
+
super(`Nest API (${status}): ${message2}`);
|
|
3180
|
+
this.status = status;
|
|
3181
|
+
this.name = "NestApiError";
|
|
3182
|
+
}
|
|
3183
|
+
};
|
|
3184
|
+
exports2.NestApiError = NestApiError2;
|
|
3185
|
+
function assertNestShareAmount(amount) {
|
|
3186
|
+
if (typeof amount !== "bigint" || amount <= 0n || amount > 0xffffffffffffffffn) {
|
|
3187
|
+
throw new Error("Nest share amount must be a positive u64 bigint in base units");
|
|
3188
|
+
}
|
|
3189
|
+
}
|
|
3190
|
+
async function request(path2, options, body) {
|
|
3191
|
+
const response = await (options.fetchFn ?? fetch)(`${(options.baseUrl ?? priceApi_1.NEST_API_BASE_URL).replace(/\/$/, "")}${path2}`, {
|
|
3192
|
+
method: body ? "POST" : "GET",
|
|
3193
|
+
headers: body ? { "Content-Type": "application/json" } : void 0,
|
|
3194
|
+
body: body ? JSON.stringify(body) : void 0,
|
|
3195
|
+
signal: options.signal
|
|
3196
|
+
});
|
|
3197
|
+
const payload = await response.json().catch(() => null);
|
|
3198
|
+
if (!response.ok) {
|
|
3199
|
+
throw new NestApiError2(response.status, typeof payload?.error === "string" ? payload.error : response.statusText);
|
|
3200
|
+
}
|
|
3201
|
+
if (!payload || typeof payload !== "object" || !payload.data) {
|
|
3202
|
+
throw new Error("Nest API returned an invalid response");
|
|
3203
|
+
}
|
|
3204
|
+
return payload.data;
|
|
3205
|
+
}
|
|
3206
|
+
async function fetchNestRedemptionTransaction2(args, options = {}) {
|
|
3207
|
+
assertNestShareAmount(args.rawAmountNestToken);
|
|
3208
|
+
const data = await request("/solana/nest/async-redeem/request/build-tx", options, {
|
|
3209
|
+
...args,
|
|
3210
|
+
rawAmountNestToken: args.rawAmountNestToken.toString(),
|
|
3211
|
+
// Squads must sign both the token authority and LayerZero fee payer at execution.
|
|
3212
|
+
feePayer: args.owner
|
|
3213
|
+
});
|
|
3214
|
+
if (typeof data.txBase64 !== "string" || !data.txBase64.length) {
|
|
3215
|
+
throw new Error("Nest API returned no transaction");
|
|
3216
|
+
}
|
|
3217
|
+
return data.txBase64;
|
|
3218
|
+
}
|
|
3219
|
+
async function fetchNestRedemptionQuote2(args, options = {}) {
|
|
3220
|
+
assertNestShareAmount(args.rawAmountNestToken);
|
|
3221
|
+
const data = await request("/solana/nest/async-redeem/quote", options, {
|
|
3222
|
+
...args,
|
|
3223
|
+
rawAmountNestToken: args.rawAmountNestToken.toString()
|
|
3224
|
+
});
|
|
3225
|
+
if (data.nestVaultSlug !== args.nestVaultSlug || data.redemptionAsset !== "USDC" || data.shareAmount !== args.rawAmountNestToken.toString() || !Number.isInteger(data.shareDecimals) || data.shareDecimals < 0 || data.shareDecimals > 18 || data.redemptionDecimals !== 6 || typeof data.redemptionAmount !== "string" || typeof data.feeAmount !== "string" || !/^\d+$/.test(data.redemptionAmount) || !/^\d+$/.test(data.feeAmount)) {
|
|
3226
|
+
throw new Error("Nest API returned an invalid redemption quote");
|
|
3227
|
+
}
|
|
3228
|
+
return data;
|
|
3229
|
+
}
|
|
3230
|
+
async function fetchNestRedemptionStatus2(signature, options = {}) {
|
|
3231
|
+
if (!/^[1-9A-HJ-NP-Za-km-z]{64,88}$/.test(signature)) {
|
|
3232
|
+
throw new Error("Enter a Solana withdrawal execution signature");
|
|
3233
|
+
}
|
|
3234
|
+
let data;
|
|
3235
|
+
try {
|
|
3236
|
+
data = await request(`/solana/redeem-status/${encodeURIComponent(signature)}`, options);
|
|
3237
|
+
} catch (error) {
|
|
3238
|
+
if (error instanceof NestApiError2 && error.status === 404)
|
|
3239
|
+
return null;
|
|
3240
|
+
throw error;
|
|
3241
|
+
}
|
|
3242
|
+
if (data.solanaBurnSignature !== signature || typeof data.solanaWallet !== "string" || typeof data.overallStatus !== "string" || !["solanaBurn", "plumeProcessing", "cctpAttestation", "solanaClaim"].every((key) => typeof data.steps?.[key]?.status === "string")) {
|
|
3243
|
+
throw new Error("Nest API returned an invalid redemption status");
|
|
3244
|
+
}
|
|
3245
|
+
return data;
|
|
3246
|
+
}
|
|
3247
|
+
}
|
|
3248
|
+
});
|
|
3249
|
+
|
|
3166
3250
|
// ../nest/dist/index.js
|
|
3167
3251
|
var require_dist4 = __commonJS({
|
|
3168
3252
|
"../nest/dist/index.js"(exports2) {
|
|
@@ -3185,6 +3269,7 @@ var require_dist4 = __commonJS({
|
|
|
3185
3269
|
};
|
|
3186
3270
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3187
3271
|
__exportStar(require_priceApi2(), exports2);
|
|
3272
|
+
__exportStar(require_redemptionApi(), exports2);
|
|
3188
3273
|
}
|
|
3189
3274
|
});
|
|
3190
3275
|
|
|
@@ -3214,7 +3299,7 @@ __export(index_exports, {
|
|
|
3214
3299
|
DEFAULT_JUNIOR_WITHDRAWAL_LOCKUP_SECS: () => DEFAULT_JUNIOR_WITHDRAWAL_LOCKUP_SECS,
|
|
3215
3300
|
DEFAULT_MAX_ACCEPTABLE_APY_BPS: () => DEFAULT_MAX_ACCEPTABLE_APY_BPS,
|
|
3216
3301
|
DEFAULT_MAX_ACCOUNTS: () => DEFAULT_MAX_ACCOUNTS,
|
|
3217
|
-
DEFAULT_MINTS: () =>
|
|
3302
|
+
DEFAULT_MINTS: () => import_common57.DEFAULT_MINTS,
|
|
3218
3303
|
DEFAULT_MIN_AMOUNT_UI: () => DEFAULT_MIN_AMOUNT_UI,
|
|
3219
3304
|
DEFAULT_ORACLE_STALENESS_THRESHOLD_SECS: () => DEFAULT_ORACLE_STALENESS_THRESHOLD_SECS,
|
|
3220
3305
|
DEFAULT_PRICE_ORACLE_ACCOUNT: () => DEFAULT_PRICE_ORACLE_ACCOUNT,
|
|
@@ -3259,11 +3344,12 @@ __export(index_exports, {
|
|
|
3259
3344
|
ManagerRedepositAssetBuilder: () => ManagerRedepositAssetBuilder,
|
|
3260
3345
|
ManagerWithdrawAssetBuilder: () => ManagerWithdrawAssetBuilder,
|
|
3261
3346
|
MarginfiPositionProvider: () => MarginfiPositionProvider,
|
|
3262
|
-
MintRegistry: () =>
|
|
3347
|
+
MintRegistry: () => import_common57.MintRegistry,
|
|
3263
3348
|
MockYieldTracker: () => MockYieldTracker,
|
|
3264
3349
|
NEST_API_BASE_URL: () => import_nest2.NEST_API_BASE_URL,
|
|
3265
3350
|
NEST_RWA_SHARE_MINT: () => NEST_RWA_SHARE_MINT,
|
|
3266
3351
|
NEST_VAULT_SLUG: () => NEST_VAULT_SLUG,
|
|
3352
|
+
NestApiError: () => import_nest4.NestApiError,
|
|
3267
3353
|
NestPriceSource: () => NestPriceSource,
|
|
3268
3354
|
ORACLE_ENTRIES_OFFSET: () => ORACLE_ENTRIES_OFFSET,
|
|
3269
3355
|
ORACLE_ENTRY_SIZE: () => ORACLE_ENTRY_SIZE,
|
|
@@ -3324,6 +3410,7 @@ __export(index_exports, {
|
|
|
3324
3410
|
assertNoUnconfirmedYieldPayments: () => assertNoUnconfirmedYieldPayments,
|
|
3325
3411
|
buildHoldingUpdate: () => buildHoldingUpdate,
|
|
3326
3412
|
buildMarginfiWithdrawInteraction: () => buildMarginfiWithdrawInteraction,
|
|
3413
|
+
buildNestWithdrawalRequest: () => buildNestWithdrawalRequest,
|
|
3327
3414
|
buildUpdates: () => buildUpdates,
|
|
3328
3415
|
coerceBool: () => coerceBool3,
|
|
3329
3416
|
collectSamples: () => collectSamples,
|
|
@@ -3336,11 +3423,14 @@ __export(index_exports, {
|
|
|
3336
3423
|
createVaultClient: () => createVaultClient,
|
|
3337
3424
|
createYieldPayment: () => createYieldPayment,
|
|
3338
3425
|
dateToStr: () => dateToStr,
|
|
3426
|
+
decodeNestWithdrawalRequest: () => decodeNestWithdrawalRequest,
|
|
3339
3427
|
decodePendingConsensusSigners: () => decodePendingConsensusSigners,
|
|
3340
3428
|
defaultKeypairPath: () => defaultKeypairPath,
|
|
3341
3429
|
deleteAccount: () => deleteAccount,
|
|
3342
3430
|
discoverVaultsForSigner: () => discoverVaultsForSigner,
|
|
3343
3431
|
fetchExternalPositions: () => fetchExternalPositions,
|
|
3432
|
+
fetchNestRedemptionQuote: () => import_nest4.fetchNestRedemptionQuote,
|
|
3433
|
+
fetchNestRedemptionStatus: () => import_nest4.fetchNestRedemptionStatus,
|
|
3344
3434
|
fetchNestTokenPrice: () => fetchNestTokenPrice,
|
|
3345
3435
|
fetchReceiptMints: () => fetchReceiptMints,
|
|
3346
3436
|
filterTargetHoldings: () => filterTargetHoldings,
|
|
@@ -3377,10 +3467,11 @@ __export(index_exports, {
|
|
|
3377
3467
|
logProspectiveApy: () => logProspectiveApy,
|
|
3378
3468
|
makeProvider: () => makeProvider,
|
|
3379
3469
|
mintTokensTo: () => mintTokensTo,
|
|
3380
|
-
mints: () =>
|
|
3470
|
+
mints: () => import_common57.mints,
|
|
3381
3471
|
mostFrequent: () => mostFrequent,
|
|
3382
3472
|
parseExternalLiquidityRefs: () => parseExternalLiquidityRefs,
|
|
3383
3473
|
planRebalance: () => planRebalance,
|
|
3474
|
+
prepareSquadsProposalUpload: () => prepareSquadsProposalUpload,
|
|
3384
3475
|
prepareVaultTransaction: () => prepareVaultTransaction,
|
|
3385
3476
|
priceInAccountingUnit: () => priceInAccountingUnit,
|
|
3386
3477
|
readI64LE: () => readI64LE,
|
|
@@ -3539,6 +3630,33 @@ var IDL = {
|
|
|
3539
3630
|
}
|
|
3540
3631
|
]
|
|
3541
3632
|
},
|
|
3633
|
+
{
|
|
3634
|
+
name: "add_incentive_recipient_v3",
|
|
3635
|
+
discriminator: [162, 229, 103, 189, 59, 242, 9, 39],
|
|
3636
|
+
accounts: [
|
|
3637
|
+
{
|
|
3638
|
+
name: "oracle",
|
|
3639
|
+
signer: true
|
|
3640
|
+
},
|
|
3641
|
+
{
|
|
3642
|
+
name: "vault"
|
|
3643
|
+
},
|
|
3644
|
+
{
|
|
3645
|
+
name: "vault_oracle",
|
|
3646
|
+
writable: true
|
|
3647
|
+
},
|
|
3648
|
+
{
|
|
3649
|
+
name: "incentive",
|
|
3650
|
+
writable: true
|
|
3651
|
+
}
|
|
3652
|
+
],
|
|
3653
|
+
args: [
|
|
3654
|
+
{
|
|
3655
|
+
name: "wallet",
|
|
3656
|
+
type: "pubkey"
|
|
3657
|
+
}
|
|
3658
|
+
]
|
|
3659
|
+
},
|
|
3542
3660
|
{
|
|
3543
3661
|
name: "cancel_incentive_proposal",
|
|
3544
3662
|
discriminator: [130, 245, 210, 51, 150, 220, 58, 96],
|
|
@@ -3690,6 +3808,36 @@ var IDL = {
|
|
|
3690
3808
|
],
|
|
3691
3809
|
args: []
|
|
3692
3810
|
},
|
|
3811
|
+
{
|
|
3812
|
+
name: "claim_incentive_v3",
|
|
3813
|
+
discriminator: [112, 63, 158, 234, 57, 42, 111, 243],
|
|
3814
|
+
accounts: [
|
|
3815
|
+
{
|
|
3816
|
+
name: "recipient",
|
|
3817
|
+
signer: true
|
|
3818
|
+
},
|
|
3819
|
+
{
|
|
3820
|
+
name: "vault",
|
|
3821
|
+
writable: true
|
|
3822
|
+
},
|
|
3823
|
+
{
|
|
3824
|
+
name: "incentive",
|
|
3825
|
+
writable: true
|
|
3826
|
+
},
|
|
3827
|
+
{
|
|
3828
|
+
name: "share_mint",
|
|
3829
|
+
writable: true
|
|
3830
|
+
},
|
|
3831
|
+
{
|
|
3832
|
+
name: "share_token_program"
|
|
3833
|
+
},
|
|
3834
|
+
{
|
|
3835
|
+
name: "recipient_share_ata",
|
|
3836
|
+
writable: true
|
|
3837
|
+
}
|
|
3838
|
+
],
|
|
3839
|
+
args: []
|
|
3840
|
+
},
|
|
3693
3841
|
{
|
|
3694
3842
|
name: "crank_nav",
|
|
3695
3843
|
docs: [
|
|
@@ -4111,6 +4259,71 @@ var IDL = {
|
|
|
4111
4259
|
}
|
|
4112
4260
|
]
|
|
4113
4261
|
},
|
|
4262
|
+
{
|
|
4263
|
+
name: "create_incentive_v3",
|
|
4264
|
+
discriminator: [129, 235, 93, 47, 200, 163, 67, 150],
|
|
4265
|
+
accounts: [
|
|
4266
|
+
{
|
|
4267
|
+
name: "oracle",
|
|
4268
|
+
writable: true,
|
|
4269
|
+
signer: true
|
|
4270
|
+
},
|
|
4271
|
+
{
|
|
4272
|
+
name: "vault"
|
|
4273
|
+
},
|
|
4274
|
+
{
|
|
4275
|
+
name: "vault_oracle",
|
|
4276
|
+
writable: true
|
|
4277
|
+
},
|
|
4278
|
+
{
|
|
4279
|
+
name: "incentive",
|
|
4280
|
+
writable: true,
|
|
4281
|
+
pda: {
|
|
4282
|
+
seeds: [
|
|
4283
|
+
{
|
|
4284
|
+
kind: "const",
|
|
4285
|
+
value: [
|
|
4286
|
+
105,
|
|
4287
|
+
110,
|
|
4288
|
+
99,
|
|
4289
|
+
101,
|
|
4290
|
+
110,
|
|
4291
|
+
116,
|
|
4292
|
+
105,
|
|
4293
|
+
118,
|
|
4294
|
+
101,
|
|
4295
|
+
95,
|
|
4296
|
+
118,
|
|
4297
|
+
51
|
|
4298
|
+
]
|
|
4299
|
+
},
|
|
4300
|
+
{
|
|
4301
|
+
kind: "account",
|
|
4302
|
+
path: "vault"
|
|
4303
|
+
},
|
|
4304
|
+
{
|
|
4305
|
+
kind: "arg",
|
|
4306
|
+
path: "args.id"
|
|
4307
|
+
}
|
|
4308
|
+
]
|
|
4309
|
+
}
|
|
4310
|
+
},
|
|
4311
|
+
{
|
|
4312
|
+
name: "system_program",
|
|
4313
|
+
address: "11111111111111111111111111111111"
|
|
4314
|
+
}
|
|
4315
|
+
],
|
|
4316
|
+
args: [
|
|
4317
|
+
{
|
|
4318
|
+
name: "args",
|
|
4319
|
+
type: {
|
|
4320
|
+
defined: {
|
|
4321
|
+
name: "CreateIncentiveV3Args"
|
|
4322
|
+
}
|
|
4323
|
+
}
|
|
4324
|
+
}
|
|
4325
|
+
]
|
|
4326
|
+
},
|
|
4114
4327
|
{
|
|
4115
4328
|
name: "create_vault",
|
|
4116
4329
|
discriminator: [29, 237, 247, 208, 193, 82, 54, 135],
|
|
@@ -4255,6 +4468,32 @@ var IDL = {
|
|
|
4255
4468
|
],
|
|
4256
4469
|
args: []
|
|
4257
4470
|
},
|
|
4471
|
+
{
|
|
4472
|
+
name: "distribute_incentive_v3",
|
|
4473
|
+
discriminator: [226, 99, 113, 6, 13, 21, 19, 70],
|
|
4474
|
+
accounts: [
|
|
4475
|
+
{
|
|
4476
|
+
name: "cranker",
|
|
4477
|
+
signer: true
|
|
4478
|
+
},
|
|
4479
|
+
{
|
|
4480
|
+
name: "vault",
|
|
4481
|
+
writable: true
|
|
4482
|
+
},
|
|
4483
|
+
{
|
|
4484
|
+
name: "incentive",
|
|
4485
|
+
writable: true
|
|
4486
|
+
},
|
|
4487
|
+
{
|
|
4488
|
+
name: "share_mint",
|
|
4489
|
+
writable: true
|
|
4490
|
+
},
|
|
4491
|
+
{
|
|
4492
|
+
name: "share_token_program"
|
|
4493
|
+
}
|
|
4494
|
+
],
|
|
4495
|
+
args: []
|
|
4496
|
+
},
|
|
4258
4497
|
{
|
|
4259
4498
|
name: "execute_deposit",
|
|
4260
4499
|
discriminator: [247, 103, 46, 184, 88, 188, 56, 46],
|
|
@@ -8868,6 +9107,37 @@ var IDL = {
|
|
|
8868
9107
|
],
|
|
8869
9108
|
args: []
|
|
8870
9109
|
},
|
|
9110
|
+
{
|
|
9111
|
+
name: "report_incentive_v3",
|
|
9112
|
+
discriminator: [167, 162, 150, 40, 140, 30, 39, 190],
|
|
9113
|
+
accounts: [
|
|
9114
|
+
{
|
|
9115
|
+
name: "oracle",
|
|
9116
|
+
signer: true
|
|
9117
|
+
},
|
|
9118
|
+
{
|
|
9119
|
+
name: "vault"
|
|
9120
|
+
},
|
|
9121
|
+
{
|
|
9122
|
+
name: "vault_oracle",
|
|
9123
|
+
writable: true
|
|
9124
|
+
},
|
|
9125
|
+
{
|
|
9126
|
+
name: "incentive",
|
|
9127
|
+
writable: true
|
|
9128
|
+
}
|
|
9129
|
+
],
|
|
9130
|
+
args: [
|
|
9131
|
+
{
|
|
9132
|
+
name: "args",
|
|
9133
|
+
type: {
|
|
9134
|
+
defined: {
|
|
9135
|
+
name: "ReportIncentiveV3Args"
|
|
9136
|
+
}
|
|
9137
|
+
}
|
|
9138
|
+
}
|
|
9139
|
+
]
|
|
9140
|
+
},
|
|
8871
9141
|
{
|
|
8872
9142
|
name: "request_junior_tranche_withdraw",
|
|
8873
9143
|
discriminator: [163, 114, 93, 2, 82, 47, 70, 253],
|
|
@@ -9061,6 +9331,34 @@ var IDL = {
|
|
|
9061
9331
|
}
|
|
9062
9332
|
]
|
|
9063
9333
|
},
|
|
9334
|
+
{
|
|
9335
|
+
name: "set_incentive_limits_v3",
|
|
9336
|
+
discriminator: [34, 95, 33, 96, 223, 192, 51, 136],
|
|
9337
|
+
accounts: [
|
|
9338
|
+
{
|
|
9339
|
+
name: "curator",
|
|
9340
|
+
signer: true
|
|
9341
|
+
},
|
|
9342
|
+
{
|
|
9343
|
+
name: "vault",
|
|
9344
|
+
writable: true
|
|
9345
|
+
},
|
|
9346
|
+
{
|
|
9347
|
+
name: "incentive",
|
|
9348
|
+
writable: true
|
|
9349
|
+
}
|
|
9350
|
+
],
|
|
9351
|
+
args: [
|
|
9352
|
+
{
|
|
9353
|
+
name: "args",
|
|
9354
|
+
type: {
|
|
9355
|
+
defined: {
|
|
9356
|
+
name: "SetIncentiveLimitsV3Args"
|
|
9357
|
+
}
|
|
9358
|
+
}
|
|
9359
|
+
}
|
|
9360
|
+
]
|
|
9361
|
+
},
|
|
9064
9362
|
{
|
|
9065
9363
|
name: "set_manager_withdraw_destination",
|
|
9066
9364
|
discriminator: [84, 201, 106, 46, 102, 249, 14, 189],
|
|
@@ -9159,6 +9457,50 @@ var IDL = {
|
|
|
9159
9457
|
}
|
|
9160
9458
|
]
|
|
9161
9459
|
},
|
|
9460
|
+
{
|
|
9461
|
+
name: "settle_incentive_v3",
|
|
9462
|
+
discriminator: [103, 14, 249, 252, 63, 221, 211, 119],
|
|
9463
|
+
accounts: [
|
|
9464
|
+
{
|
|
9465
|
+
name: "cranker",
|
|
9466
|
+
signer: true
|
|
9467
|
+
},
|
|
9468
|
+
{
|
|
9469
|
+
name: "vault",
|
|
9470
|
+
writable: true
|
|
9471
|
+
},
|
|
9472
|
+
{
|
|
9473
|
+
name: "incentive",
|
|
9474
|
+
writable: true
|
|
9475
|
+
},
|
|
9476
|
+
{
|
|
9477
|
+
name: "vault_oracle",
|
|
9478
|
+
writable: true
|
|
9479
|
+
},
|
|
9480
|
+
{
|
|
9481
|
+
name: "share_mint"
|
|
9482
|
+
},
|
|
9483
|
+
{
|
|
9484
|
+
name: "vault_tranche_state",
|
|
9485
|
+
writable: true,
|
|
9486
|
+
optional: true
|
|
9487
|
+
},
|
|
9488
|
+
{
|
|
9489
|
+
name: "junior_tranche_share_mint",
|
|
9490
|
+
optional: true
|
|
9491
|
+
},
|
|
9492
|
+
{
|
|
9493
|
+
name: "senior_tranche_share_mint",
|
|
9494
|
+
optional: true
|
|
9495
|
+
}
|
|
9496
|
+
],
|
|
9497
|
+
args: [
|
|
9498
|
+
{
|
|
9499
|
+
name: "recipient_indices",
|
|
9500
|
+
type: "bytes"
|
|
9501
|
+
}
|
|
9502
|
+
]
|
|
9503
|
+
},
|
|
9162
9504
|
{
|
|
9163
9505
|
name: "submit_incentive",
|
|
9164
9506
|
discriminator: [254, 156, 245, 213, 133, 22, 132, 222],
|
|
@@ -9625,6 +9967,10 @@ var IDL = {
|
|
|
9625
9967
|
name: "VaultIncentive",
|
|
9626
9968
|
discriminator: [120, 176, 124, 51, 97, 144, 12, 50]
|
|
9627
9969
|
},
|
|
9970
|
+
{
|
|
9971
|
+
name: "VaultIncentiveV3",
|
|
9972
|
+
discriminator: [226, 191, 170, 109, 188, 240, 31, 7]
|
|
9973
|
+
},
|
|
9628
9974
|
{
|
|
9629
9975
|
name: "VaultOracle",
|
|
9630
9976
|
discriminator: [55, 234, 122, 181, 207, 61, 41, 204]
|
|
@@ -9643,13 +9989,37 @@ var IDL = {
|
|
|
9643
9989
|
name: "IncentiveClaimed",
|
|
9644
9990
|
discriminator: [93, 82, 106, 244, 88, 183, 241, 75]
|
|
9645
9991
|
},
|
|
9992
|
+
{
|
|
9993
|
+
name: "IncentiveClaimedV3",
|
|
9994
|
+
discriminator: [74, 19, 58, 182, 5, 249, 169, 151]
|
|
9995
|
+
},
|
|
9996
|
+
{
|
|
9997
|
+
name: "IncentiveDisagreementV3",
|
|
9998
|
+
discriminator: [122, 157, 194, 177, 35, 139, 117, 244]
|
|
9999
|
+
},
|
|
9646
10000
|
{
|
|
9647
10001
|
name: "IncentiveDistributed",
|
|
9648
10002
|
discriminator: [149, 100, 29, 146, 164, 197, 158, 34]
|
|
9649
10003
|
},
|
|
10004
|
+
{
|
|
10005
|
+
name: "IncentiveDistributedV3",
|
|
10006
|
+
discriminator: [87, 187, 242, 158, 216, 39, 103, 176]
|
|
10007
|
+
},
|
|
10008
|
+
{
|
|
10009
|
+
name: "IncentiveLimitsChangedV3",
|
|
10010
|
+
discriminator: [49, 41, 70, 3, 252, 113, 144, 12]
|
|
10011
|
+
},
|
|
10012
|
+
{
|
|
10013
|
+
name: "IncentiveReportedV3",
|
|
10014
|
+
discriminator: [195, 32, 74, 25, 155, 129, 202, 150]
|
|
10015
|
+
},
|
|
9650
10016
|
{
|
|
9651
10017
|
name: "IncentiveReserved",
|
|
9652
10018
|
discriminator: [168, 145, 110, 44, 228, 193, 56, 235]
|
|
10019
|
+
},
|
|
10020
|
+
{
|
|
10021
|
+
name: "IncentiveSettledV3",
|
|
10022
|
+
discriminator: [236, 37, 94, 105, 80, 157, 154, 140]
|
|
9653
10023
|
}
|
|
9654
10024
|
],
|
|
9655
10025
|
errors: [
|
|
@@ -10205,6 +10575,28 @@ var IDL = {
|
|
|
10205
10575
|
]
|
|
10206
10576
|
}
|
|
10207
10577
|
},
|
|
10578
|
+
{
|
|
10579
|
+
name: "CreateIncentiveV3Args",
|
|
10580
|
+
type: {
|
|
10581
|
+
kind: "struct",
|
|
10582
|
+
fields: [
|
|
10583
|
+
{
|
|
10584
|
+
name: "id",
|
|
10585
|
+
type: "u64"
|
|
10586
|
+
},
|
|
10587
|
+
{
|
|
10588
|
+
name: "recipients",
|
|
10589
|
+
type: {
|
|
10590
|
+
vec: "pubkey"
|
|
10591
|
+
}
|
|
10592
|
+
},
|
|
10593
|
+
{
|
|
10594
|
+
name: "max_total_usd",
|
|
10595
|
+
type: "u64"
|
|
10596
|
+
}
|
|
10597
|
+
]
|
|
10598
|
+
}
|
|
10599
|
+
},
|
|
10208
10600
|
{
|
|
10209
10601
|
name: "ExternalLiquiditySlot",
|
|
10210
10602
|
serialization: "bytemuck",
|
|
@@ -10355,6 +10747,56 @@ var IDL = {
|
|
|
10355
10747
|
]
|
|
10356
10748
|
}
|
|
10357
10749
|
},
|
|
10750
|
+
{
|
|
10751
|
+
name: "IncentiveClaimedV3",
|
|
10752
|
+
type: {
|
|
10753
|
+
kind: "struct",
|
|
10754
|
+
fields: [
|
|
10755
|
+
{
|
|
10756
|
+
name: "vault",
|
|
10757
|
+
type: "pubkey"
|
|
10758
|
+
},
|
|
10759
|
+
{
|
|
10760
|
+
name: "incentive",
|
|
10761
|
+
type: "pubkey"
|
|
10762
|
+
},
|
|
10763
|
+
{
|
|
10764
|
+
name: "wallet",
|
|
10765
|
+
type: "pubkey"
|
|
10766
|
+
},
|
|
10767
|
+
{
|
|
10768
|
+
name: "shares",
|
|
10769
|
+
type: "u64"
|
|
10770
|
+
}
|
|
10771
|
+
]
|
|
10772
|
+
}
|
|
10773
|
+
},
|
|
10774
|
+
{
|
|
10775
|
+
name: "IncentiveDisagreementV3",
|
|
10776
|
+
type: {
|
|
10777
|
+
kind: "struct",
|
|
10778
|
+
fields: [
|
|
10779
|
+
{
|
|
10780
|
+
name: "vault",
|
|
10781
|
+
type: "pubkey"
|
|
10782
|
+
},
|
|
10783
|
+
{
|
|
10784
|
+
name: "incentive",
|
|
10785
|
+
type: "pubkey"
|
|
10786
|
+
},
|
|
10787
|
+
{
|
|
10788
|
+
name: "wallet",
|
|
10789
|
+
type: "pubkey"
|
|
10790
|
+
},
|
|
10791
|
+
{
|
|
10792
|
+
name: "totals_usd",
|
|
10793
|
+
type: {
|
|
10794
|
+
array: ["u64", 2]
|
|
10795
|
+
}
|
|
10796
|
+
}
|
|
10797
|
+
]
|
|
10798
|
+
}
|
|
10799
|
+
},
|
|
10358
10800
|
{
|
|
10359
10801
|
name: "IncentiveDistributed",
|
|
10360
10802
|
type: {
|
|
@@ -10375,6 +10817,58 @@ var IDL = {
|
|
|
10375
10817
|
]
|
|
10376
10818
|
}
|
|
10377
10819
|
},
|
|
10820
|
+
{
|
|
10821
|
+
name: "IncentiveDistributedV3",
|
|
10822
|
+
type: {
|
|
10823
|
+
kind: "struct",
|
|
10824
|
+
fields: [
|
|
10825
|
+
{
|
|
10826
|
+
name: "vault",
|
|
10827
|
+
type: "pubkey"
|
|
10828
|
+
},
|
|
10829
|
+
{
|
|
10830
|
+
name: "incentive",
|
|
10831
|
+
type: "pubkey"
|
|
10832
|
+
},
|
|
10833
|
+
{
|
|
10834
|
+
name: "shares",
|
|
10835
|
+
type: "u64"
|
|
10836
|
+
}
|
|
10837
|
+
]
|
|
10838
|
+
}
|
|
10839
|
+
},
|
|
10840
|
+
{
|
|
10841
|
+
name: "IncentiveLimitsChangedV3",
|
|
10842
|
+
type: {
|
|
10843
|
+
kind: "struct",
|
|
10844
|
+
fields: [
|
|
10845
|
+
{
|
|
10846
|
+
name: "vault",
|
|
10847
|
+
type: "pubkey"
|
|
10848
|
+
},
|
|
10849
|
+
{
|
|
10850
|
+
name: "incentive",
|
|
10851
|
+
type: "pubkey"
|
|
10852
|
+
},
|
|
10853
|
+
{
|
|
10854
|
+
name: "config_generation",
|
|
10855
|
+
type: "u64"
|
|
10856
|
+
},
|
|
10857
|
+
{
|
|
10858
|
+
name: "max_total_usd",
|
|
10859
|
+
type: "u64"
|
|
10860
|
+
},
|
|
10861
|
+
{
|
|
10862
|
+
name: "max_surplus_value",
|
|
10863
|
+
type: "u64"
|
|
10864
|
+
},
|
|
10865
|
+
{
|
|
10866
|
+
name: "min_surplus_reserve",
|
|
10867
|
+
type: "u64"
|
|
10868
|
+
}
|
|
10869
|
+
]
|
|
10870
|
+
}
|
|
10871
|
+
},
|
|
10378
10872
|
{
|
|
10379
10873
|
name: "IncentiveRecipient",
|
|
10380
10874
|
serialization: "bytemuck",
|
|
@@ -10398,43 +10892,206 @@ var IDL = {
|
|
|
10398
10892
|
}
|
|
10399
10893
|
},
|
|
10400
10894
|
{
|
|
10401
|
-
name: "settled_total",
|
|
10895
|
+
name: "settled_total",
|
|
10896
|
+
type: "u64"
|
|
10897
|
+
},
|
|
10898
|
+
{
|
|
10899
|
+
name: "distributed_total",
|
|
10900
|
+
type: "u64"
|
|
10901
|
+
}
|
|
10902
|
+
]
|
|
10903
|
+
}
|
|
10904
|
+
},
|
|
10905
|
+
{
|
|
10906
|
+
name: "IncentiveRecipientV3",
|
|
10907
|
+
serialization: "bytemuck",
|
|
10908
|
+
repr: {
|
|
10909
|
+
kind: "c"
|
|
10910
|
+
},
|
|
10911
|
+
type: {
|
|
10912
|
+
kind: "struct",
|
|
10913
|
+
fields: [
|
|
10914
|
+
{
|
|
10915
|
+
name: "wallet",
|
|
10916
|
+
type: "pubkey"
|
|
10917
|
+
},
|
|
10918
|
+
{
|
|
10919
|
+
name: "oracle_total_usd",
|
|
10920
|
+
docs: [
|
|
10921
|
+
"Lifetime atomic accounting units (USD when that is the vault's unit)."
|
|
10922
|
+
],
|
|
10923
|
+
type: {
|
|
10924
|
+
array: ["u64", 2]
|
|
10925
|
+
}
|
|
10926
|
+
},
|
|
10927
|
+
{
|
|
10928
|
+
name: "expires_at",
|
|
10929
|
+
docs: [
|
|
10930
|
+
"Independent deadlines. Zero means this slot has not authorized this wallet."
|
|
10931
|
+
],
|
|
10932
|
+
type: {
|
|
10933
|
+
array: ["i64", 2]
|
|
10934
|
+
}
|
|
10935
|
+
},
|
|
10936
|
+
{
|
|
10937
|
+
name: "settled_usd",
|
|
10938
|
+
docs: [
|
|
10939
|
+
"Cumulative accounting units actually converted and funded."
|
|
10940
|
+
],
|
|
10941
|
+
type: "u64"
|
|
10942
|
+
},
|
|
10943
|
+
{
|
|
10944
|
+
name: "settled_shares",
|
|
10945
|
+
type: "u64"
|
|
10946
|
+
},
|
|
10947
|
+
{
|
|
10948
|
+
name: "claimed_shares",
|
|
10949
|
+
type: "u64"
|
|
10950
|
+
}
|
|
10951
|
+
]
|
|
10952
|
+
}
|
|
10953
|
+
},
|
|
10954
|
+
{
|
|
10955
|
+
name: "IncentiveReportedV3",
|
|
10956
|
+
type: {
|
|
10957
|
+
kind: "struct",
|
|
10958
|
+
fields: [
|
|
10959
|
+
{
|
|
10960
|
+
name: "vault",
|
|
10961
|
+
type: "pubkey"
|
|
10962
|
+
},
|
|
10963
|
+
{
|
|
10964
|
+
name: "incentive",
|
|
10965
|
+
type: "pubkey"
|
|
10966
|
+
},
|
|
10967
|
+
{
|
|
10968
|
+
name: "oracle_index",
|
|
10969
|
+
type: "u8"
|
|
10970
|
+
},
|
|
10971
|
+
{
|
|
10972
|
+
name: "signer_generation",
|
|
10973
|
+
type: "u64"
|
|
10974
|
+
},
|
|
10975
|
+
{
|
|
10976
|
+
name: "config_generation",
|
|
10977
|
+
type: "u64"
|
|
10978
|
+
},
|
|
10979
|
+
{
|
|
10980
|
+
name: "sequence",
|
|
10981
|
+
type: "u64"
|
|
10982
|
+
},
|
|
10983
|
+
{
|
|
10984
|
+
name: "expires_at",
|
|
10985
|
+
type: "i64"
|
|
10986
|
+
},
|
|
10987
|
+
{
|
|
10988
|
+
name: "updates",
|
|
10989
|
+
type: {
|
|
10990
|
+
vec: {
|
|
10991
|
+
defined: {
|
|
10992
|
+
name: "IncentiveUsdUpdate"
|
|
10993
|
+
}
|
|
10994
|
+
}
|
|
10995
|
+
}
|
|
10996
|
+
}
|
|
10997
|
+
]
|
|
10998
|
+
}
|
|
10999
|
+
},
|
|
11000
|
+
{
|
|
11001
|
+
name: "IncentiveReserved",
|
|
11002
|
+
type: {
|
|
11003
|
+
kind: "struct",
|
|
11004
|
+
fields: [
|
|
11005
|
+
{
|
|
11006
|
+
name: "vault",
|
|
11007
|
+
type: "pubkey"
|
|
11008
|
+
},
|
|
11009
|
+
{
|
|
11010
|
+
name: "incentive",
|
|
11011
|
+
type: "pubkey"
|
|
11012
|
+
},
|
|
11013
|
+
{
|
|
11014
|
+
name: "round_id",
|
|
11015
|
+
type: "u64"
|
|
11016
|
+
},
|
|
11017
|
+
{
|
|
11018
|
+
name: "additional_shares",
|
|
11019
|
+
type: "u64"
|
|
11020
|
+
},
|
|
11021
|
+
{
|
|
11022
|
+
name: "curator_shares",
|
|
11023
|
+
type: "u64"
|
|
11024
|
+
},
|
|
11025
|
+
{
|
|
11026
|
+
name: "surplus_value",
|
|
11027
|
+
type: "u64"
|
|
11028
|
+
}
|
|
11029
|
+
]
|
|
11030
|
+
}
|
|
11031
|
+
},
|
|
11032
|
+
{
|
|
11033
|
+
name: "IncentiveSettledV3",
|
|
11034
|
+
type: {
|
|
11035
|
+
kind: "struct",
|
|
11036
|
+
fields: [
|
|
11037
|
+
{
|
|
11038
|
+
name: "vault",
|
|
11039
|
+
type: "pubkey"
|
|
11040
|
+
},
|
|
11041
|
+
{
|
|
11042
|
+
name: "incentive",
|
|
11043
|
+
type: "pubkey"
|
|
11044
|
+
},
|
|
11045
|
+
{
|
|
11046
|
+
name: "signer_generation",
|
|
11047
|
+
type: "u64"
|
|
11048
|
+
},
|
|
11049
|
+
{
|
|
11050
|
+
name: "config_generation",
|
|
11051
|
+
type: "u64"
|
|
11052
|
+
},
|
|
11053
|
+
{
|
|
11054
|
+
name: "additional_usd",
|
|
11055
|
+
type: {
|
|
11056
|
+
array: ["u64", 5]
|
|
11057
|
+
}
|
|
11058
|
+
},
|
|
11059
|
+
{
|
|
11060
|
+
name: "additional_shares",
|
|
11061
|
+
type: {
|
|
11062
|
+
array: ["u64", 5]
|
|
11063
|
+
}
|
|
11064
|
+
},
|
|
11065
|
+
{
|
|
11066
|
+
name: "curator_shares",
|
|
11067
|
+
type: "u64"
|
|
11068
|
+
},
|
|
11069
|
+
{
|
|
11070
|
+
name: "surplus_value",
|
|
10402
11071
|
type: "u64"
|
|
10403
11072
|
},
|
|
10404
11073
|
{
|
|
10405
|
-
name: "
|
|
11074
|
+
name: "regular_backing",
|
|
11075
|
+
type: "u64"
|
|
11076
|
+
},
|
|
11077
|
+
{
|
|
11078
|
+
name: "effective_supply",
|
|
10406
11079
|
type: "u64"
|
|
10407
11080
|
}
|
|
10408
11081
|
]
|
|
10409
11082
|
}
|
|
10410
11083
|
},
|
|
10411
11084
|
{
|
|
10412
|
-
name: "
|
|
11085
|
+
name: "IncentiveUsdUpdate",
|
|
10413
11086
|
type: {
|
|
10414
11087
|
kind: "struct",
|
|
10415
11088
|
fields: [
|
|
10416
11089
|
{
|
|
10417
|
-
name: "
|
|
10418
|
-
type: "
|
|
10419
|
-
},
|
|
10420
|
-
{
|
|
10421
|
-
name: "incentive",
|
|
10422
|
-
type: "pubkey"
|
|
10423
|
-
},
|
|
10424
|
-
{
|
|
10425
|
-
name: "round_id",
|
|
10426
|
-
type: "u64"
|
|
10427
|
-
},
|
|
10428
|
-
{
|
|
10429
|
-
name: "additional_shares",
|
|
10430
|
-
type: "u64"
|
|
10431
|
-
},
|
|
10432
|
-
{
|
|
10433
|
-
name: "curator_shares",
|
|
10434
|
-
type: "u64"
|
|
11090
|
+
name: "recipient_index",
|
|
11091
|
+
type: "u8"
|
|
10435
11092
|
},
|
|
10436
11093
|
{
|
|
10437
|
-
name: "
|
|
11094
|
+
name: "total_usd",
|
|
10438
11095
|
type: "u64"
|
|
10439
11096
|
}
|
|
10440
11097
|
]
|
|
@@ -10780,6 +11437,40 @@ var IDL = {
|
|
|
10780
11437
|
]
|
|
10781
11438
|
}
|
|
10782
11439
|
},
|
|
11440
|
+
{
|
|
11441
|
+
name: "ReportIncentiveV3Args",
|
|
11442
|
+
type: {
|
|
11443
|
+
kind: "struct",
|
|
11444
|
+
fields: [
|
|
11445
|
+
{
|
|
11446
|
+
name: "signer_generation",
|
|
11447
|
+
type: "u64"
|
|
11448
|
+
},
|
|
11449
|
+
{
|
|
11450
|
+
name: "config_generation",
|
|
11451
|
+
type: "u64"
|
|
11452
|
+
},
|
|
11453
|
+
{
|
|
11454
|
+
name: "sequence",
|
|
11455
|
+
type: "u64"
|
|
11456
|
+
},
|
|
11457
|
+
{
|
|
11458
|
+
name: "expires_at",
|
|
11459
|
+
type: "i64"
|
|
11460
|
+
},
|
|
11461
|
+
{
|
|
11462
|
+
name: "updates",
|
|
11463
|
+
type: {
|
|
11464
|
+
vec: {
|
|
11465
|
+
defined: {
|
|
11466
|
+
name: "IncentiveUsdUpdate"
|
|
11467
|
+
}
|
|
11468
|
+
}
|
|
11469
|
+
}
|
|
11470
|
+
}
|
|
11471
|
+
]
|
|
11472
|
+
}
|
|
11473
|
+
},
|
|
10783
11474
|
{
|
|
10784
11475
|
name: "RollingLimitConfig",
|
|
10785
11476
|
docs: [
|
|
@@ -11000,6 +11691,26 @@ var IDL = {
|
|
|
11000
11691
|
]
|
|
11001
11692
|
}
|
|
11002
11693
|
},
|
|
11694
|
+
{
|
|
11695
|
+
name: "SetIncentiveLimitsV3Args",
|
|
11696
|
+
type: {
|
|
11697
|
+
kind: "struct",
|
|
11698
|
+
fields: [
|
|
11699
|
+
{
|
|
11700
|
+
name: "max_total_usd",
|
|
11701
|
+
type: "u64"
|
|
11702
|
+
},
|
|
11703
|
+
{
|
|
11704
|
+
name: "max_surplus_value",
|
|
11705
|
+
type: "u64"
|
|
11706
|
+
},
|
|
11707
|
+
{
|
|
11708
|
+
name: "min_surplus_reserve",
|
|
11709
|
+
type: "u64"
|
|
11710
|
+
}
|
|
11711
|
+
]
|
|
11712
|
+
}
|
|
11713
|
+
},
|
|
11003
11714
|
{
|
|
11004
11715
|
name: "SetManagerWithdrawDestinationArgs",
|
|
11005
11716
|
type: {
|
|
@@ -12196,6 +12907,93 @@ var IDL = {
|
|
|
12196
12907
|
]
|
|
12197
12908
|
}
|
|
12198
12909
|
},
|
|
12910
|
+
{
|
|
12911
|
+
name: "VaultIncentiveV3",
|
|
12912
|
+
docs: [
|
|
12913
|
+
"Separate discriminator and PDA namespace: legacy share counters are never",
|
|
12914
|
+
"interpreted as USD. No per-wallet program accounts are needed."
|
|
12915
|
+
],
|
|
12916
|
+
serialization: "bytemuck",
|
|
12917
|
+
repr: {
|
|
12918
|
+
kind: "c"
|
|
12919
|
+
},
|
|
12920
|
+
type: {
|
|
12921
|
+
kind: "struct",
|
|
12922
|
+
fields: [
|
|
12923
|
+
{
|
|
12924
|
+
name: "vault",
|
|
12925
|
+
type: "pubkey"
|
|
12926
|
+
},
|
|
12927
|
+
{
|
|
12928
|
+
name: "id",
|
|
12929
|
+
type: "u64"
|
|
12930
|
+
},
|
|
12931
|
+
{
|
|
12932
|
+
name: "max_total_usd",
|
|
12933
|
+
type: "u64"
|
|
12934
|
+
},
|
|
12935
|
+
{
|
|
12936
|
+
name: "max_surplus_value",
|
|
12937
|
+
docs: ["Lifetime surplus budget, including previous settlements."],
|
|
12938
|
+
type: "u64"
|
|
12939
|
+
},
|
|
12940
|
+
{
|
|
12941
|
+
name: "spent_surplus_value",
|
|
12942
|
+
type: "u64"
|
|
12943
|
+
},
|
|
12944
|
+
{
|
|
12945
|
+
name: "config_generation",
|
|
12946
|
+
type: "u64"
|
|
12947
|
+
},
|
|
12948
|
+
{
|
|
12949
|
+
name: "oracle_sequences",
|
|
12950
|
+
docs: [
|
|
12951
|
+
"Each signer orders its own partial updates; sequences never reset."
|
|
12952
|
+
],
|
|
12953
|
+
type: {
|
|
12954
|
+
array: ["u64", 2]
|
|
12955
|
+
}
|
|
12956
|
+
},
|
|
12957
|
+
{
|
|
12958
|
+
name: "oracle_generations",
|
|
12959
|
+
type: {
|
|
12960
|
+
array: ["u64", 2]
|
|
12961
|
+
}
|
|
12962
|
+
},
|
|
12963
|
+
{
|
|
12964
|
+
name: "recipients",
|
|
12965
|
+
type: {
|
|
12966
|
+
array: [
|
|
12967
|
+
{
|
|
12968
|
+
defined: {
|
|
12969
|
+
name: "IncentiveRecipientV3"
|
|
12970
|
+
}
|
|
12971
|
+
},
|
|
12972
|
+
5
|
|
12973
|
+
]
|
|
12974
|
+
}
|
|
12975
|
+
},
|
|
12976
|
+
{
|
|
12977
|
+
name: "bump",
|
|
12978
|
+
type: "u8"
|
|
12979
|
+
},
|
|
12980
|
+
{
|
|
12981
|
+
name: "recipient_count",
|
|
12982
|
+
type: "u8"
|
|
12983
|
+
},
|
|
12984
|
+
{
|
|
12985
|
+
name: "version",
|
|
12986
|
+
type: "u8"
|
|
12987
|
+
},
|
|
12988
|
+
{
|
|
12989
|
+
name: "_padding",
|
|
12990
|
+
type: {
|
|
12991
|
+
array: ["u8", 5]
|
|
12992
|
+
}
|
|
12993
|
+
}
|
|
12994
|
+
]
|
|
12995
|
+
}
|
|
12996
|
+
},
|
|
12199
12997
|
{
|
|
12200
12998
|
name: "VaultOracle",
|
|
12201
12999
|
serialization: "bytemuck",
|
|
@@ -16623,7 +17421,7 @@ async function simulateSquadsProposalExecution(args) {
|
|
|
16623
17421
|
payerKey: feePayer,
|
|
16624
17422
|
recentBlockhash,
|
|
16625
17423
|
instructions: [...instructions2]
|
|
16626
|
-
}).compileToV0Message();
|
|
17424
|
+
}).compileToV0Message(args.addressLookupTableAccounts);
|
|
16627
17425
|
const transaction = new import_web322.VersionedTransaction(message2);
|
|
16628
17426
|
const { value } = await connection.simulateTransaction(transaction, {
|
|
16629
17427
|
sigVerify: false,
|
|
@@ -16676,7 +17474,8 @@ async function prepareVaultTransaction(args) {
|
|
|
16676
17474
|
connection,
|
|
16677
17475
|
feePayer: proposer,
|
|
16678
17476
|
instructions: instructions2,
|
|
16679
|
-
recentBlockhash: blockhash
|
|
17477
|
+
recentBlockhash: blockhash,
|
|
17478
|
+
addressLookupTableAccounts: args.addressLookupTableAccounts
|
|
16680
17479
|
});
|
|
16681
17480
|
}
|
|
16682
17481
|
const transactionMessage = new import_web322.TransactionMessage({
|
|
@@ -16691,6 +17490,7 @@ async function prepareVaultTransaction(args) {
|
|
|
16691
17490
|
vaultIndex: route.vaultIndex,
|
|
16692
17491
|
ephemeralSigners: 0,
|
|
16693
17492
|
transactionMessage,
|
|
17493
|
+
addressLookupTableAccounts: args.addressLookupTableAccounts,
|
|
16694
17494
|
memo: route.memo
|
|
16695
17495
|
});
|
|
16696
17496
|
const createProposalIx = squads.instructions.proposalCreate({
|
|
@@ -16721,15 +17521,128 @@ async function prepareVaultTransaction(args) {
|
|
|
16721
17521
|
};
|
|
16722
17522
|
}
|
|
16723
17523
|
|
|
17524
|
+
// src/utils/squadsBuffer.ts
|
|
17525
|
+
var squads2 = __toESM(require("@sqds/multisig"));
|
|
17526
|
+
var import_web323 = require("@solana/web3.js");
|
|
17527
|
+
var PacketSize = 1232;
|
|
17528
|
+
var BufferChunkSize = 700;
|
|
17529
|
+
var MaxBufferSize = 4e3;
|
|
17530
|
+
async function prepareSquadsProposalUpload(args) {
|
|
17531
|
+
const { connection, proposer, prepared } = args;
|
|
17532
|
+
const transaction = prepared.transaction;
|
|
17533
|
+
const sizeProbe = new import_web323.Transaction({
|
|
17534
|
+
feePayer: proposer,
|
|
17535
|
+
recentBlockhash: import_web323.PublicKey.default.toBase58()
|
|
17536
|
+
}).add(...transaction.instructions);
|
|
17537
|
+
let fits = false;
|
|
17538
|
+
try {
|
|
17539
|
+
fits = sizeProbe.serialize({
|
|
17540
|
+
requireAllSignatures: false,
|
|
17541
|
+
verifySignatures: false
|
|
17542
|
+
}).length <= PacketSize;
|
|
17543
|
+
} catch {
|
|
17544
|
+
}
|
|
17545
|
+
if (fits) return { setupTransactions: [], proposalTransaction: transaction };
|
|
17546
|
+
const [decoded] = squads2.generated.vaultTransactionCreateStruct.deserialize(
|
|
17547
|
+
transaction.instructions[0].data
|
|
17548
|
+
);
|
|
17549
|
+
const bytes = decoded.args.transactionMessage;
|
|
17550
|
+
if (bytes.length > MaxBufferSize)
|
|
17551
|
+
throw new Error("Squads proposal exceeds the 4,000-byte message limit");
|
|
17552
|
+
let bufferPda;
|
|
17553
|
+
let bufferIndex = 0;
|
|
17554
|
+
for (; bufferIndex <= 255; bufferIndex++) {
|
|
17555
|
+
const [candidate] = import_web323.PublicKey.findProgramAddressSync(
|
|
17556
|
+
[
|
|
17557
|
+
Buffer.from("multisig"),
|
|
17558
|
+
prepared.multisigPda.toBuffer(),
|
|
17559
|
+
Buffer.from("transaction_buffer"),
|
|
17560
|
+
proposer.toBuffer(),
|
|
17561
|
+
Buffer.from([bufferIndex])
|
|
17562
|
+
],
|
|
17563
|
+
squads2.PROGRAM_ID
|
|
17564
|
+
);
|
|
17565
|
+
if (!await connection.getAccountInfo(candidate, "confirmed")) {
|
|
17566
|
+
bufferPda = candidate;
|
|
17567
|
+
break;
|
|
17568
|
+
}
|
|
17569
|
+
}
|
|
17570
|
+
if (!bufferPda)
|
|
17571
|
+
throw new Error(
|
|
17572
|
+
"All Squads upload buffers are occupied; close an old upload first"
|
|
17573
|
+
);
|
|
17574
|
+
const finalBufferHash = Array.from(
|
|
17575
|
+
new Uint8Array(await crypto.subtle.digest("SHA-256", new Uint8Array(bytes)))
|
|
17576
|
+
);
|
|
17577
|
+
const accounts2 = {
|
|
17578
|
+
multisig: prepared.multisigPda,
|
|
17579
|
+
transactionBuffer: bufferPda,
|
|
17580
|
+
creator: proposer
|
|
17581
|
+
};
|
|
17582
|
+
const setupTransactions = [
|
|
17583
|
+
new import_web323.Transaction().add(
|
|
17584
|
+
squads2.generated.createTransactionBufferCreateInstruction(
|
|
17585
|
+
{
|
|
17586
|
+
...accounts2,
|
|
17587
|
+
rentPayer: proposer
|
|
17588
|
+
},
|
|
17589
|
+
{
|
|
17590
|
+
args: {
|
|
17591
|
+
bufferIndex,
|
|
17592
|
+
vaultIndex: prepared.vaultIndex,
|
|
17593
|
+
finalBufferHash,
|
|
17594
|
+
finalBufferSize: bytes.length,
|
|
17595
|
+
buffer: bytes.slice(0, BufferChunkSize)
|
|
17596
|
+
}
|
|
17597
|
+
}
|
|
17598
|
+
)
|
|
17599
|
+
)
|
|
17600
|
+
];
|
|
17601
|
+
for (let offset = BufferChunkSize; offset < bytes.length; offset += BufferChunkSize) {
|
|
17602
|
+
setupTransactions.push(
|
|
17603
|
+
new import_web323.Transaction().add(
|
|
17604
|
+
squads2.generated.createTransactionBufferExtendInstruction(accounts2, {
|
|
17605
|
+
args: { buffer: bytes.slice(offset, offset + BufferChunkSize) }
|
|
17606
|
+
})
|
|
17607
|
+
)
|
|
17608
|
+
);
|
|
17609
|
+
}
|
|
17610
|
+
const finalize = squads2.generated.createVaultTransactionCreateFromBufferInstruction(
|
|
17611
|
+
{
|
|
17612
|
+
vaultTransactionCreateItemMultisig: prepared.multisigPda,
|
|
17613
|
+
vaultTransactionCreateItemTransaction: prepared.vaultTransactionPda,
|
|
17614
|
+
vaultTransactionCreateItemCreator: proposer,
|
|
17615
|
+
vaultTransactionCreateItemRentPayer: proposer,
|
|
17616
|
+
vaultTransactionCreateItemSystemProgram: import_web323.SystemProgram.programId,
|
|
17617
|
+
transactionBuffer: bufferPda,
|
|
17618
|
+
creator: proposer
|
|
17619
|
+
},
|
|
17620
|
+
{ args: { ...decoded.args, transactionMessage: new Uint8Array(6) } }
|
|
17621
|
+
);
|
|
17622
|
+
const closeBufferInstruction = squads2.generated.createTransactionBufferCloseInstruction(accounts2);
|
|
17623
|
+
closeBufferInstruction.keys.find(
|
|
17624
|
+
(key) => key.pubkey.equals(proposer)
|
|
17625
|
+
).isWritable = true;
|
|
17626
|
+
return {
|
|
17627
|
+
setupTransactions,
|
|
17628
|
+
proposalTransaction: new import_web323.Transaction().add(
|
|
17629
|
+
finalize,
|
|
17630
|
+
...transaction.instructions.slice(1)
|
|
17631
|
+
),
|
|
17632
|
+
bufferPda,
|
|
17633
|
+
closeBufferInstruction
|
|
17634
|
+
};
|
|
17635
|
+
}
|
|
17636
|
+
|
|
16724
17637
|
// src/utils/token.ts
|
|
16725
17638
|
var import_spl_token19 = require("@solana/spl-token");
|
|
16726
|
-
var
|
|
17639
|
+
var import_web324 = require("@solana/web3.js");
|
|
16727
17640
|
var import_common41 = __toESM(require_dist());
|
|
16728
17641
|
async function createTokenMintIxs(connection, payer, authority, decimals, tokenProgram = import_spl_token19.TOKEN_2022_PROGRAM_ID) {
|
|
16729
|
-
const mint =
|
|
17642
|
+
const mint = import_web324.Keypair.generate();
|
|
16730
17643
|
const lamports = await (0, import_spl_token19.getMinimumBalanceForRentExemptMint)(connection);
|
|
16731
17644
|
const ixs = [
|
|
16732
|
-
|
|
17645
|
+
import_web324.SystemProgram.createAccount({
|
|
16733
17646
|
fromPubkey: payer,
|
|
16734
17647
|
newAccountPubkey: mint.publicKey,
|
|
16735
17648
|
space: import_spl_token19.MINT_SIZE,
|
|
@@ -16755,7 +17668,7 @@ async function createTokenMint(connection, payer, decimals, tokenProgram = impor
|
|
|
16755
17668
|
tokenProgram
|
|
16756
17669
|
);
|
|
16757
17670
|
const { blockhash, lastValidBlockHeight } = await connection.getLatestBlockhash("confirmed");
|
|
16758
|
-
const tx = new
|
|
17671
|
+
const tx = new import_web324.Transaction().add(...ixs);
|
|
16759
17672
|
tx.feePayer = payer.publicKey;
|
|
16760
17673
|
tx.recentBlockhash = blockhash;
|
|
16761
17674
|
tx.sign(payer, mint);
|
|
@@ -16794,7 +17707,7 @@ async function mintTokensTo(connection, payer, mint, destination, amount, tokenP
|
|
|
16794
17707
|
tokenProgramPk
|
|
16795
17708
|
)
|
|
16796
17709
|
];
|
|
16797
|
-
const tx = new
|
|
17710
|
+
const tx = new import_web324.Transaction().add(...ixs);
|
|
16798
17711
|
await connection.sendTransaction(tx, [payer]);
|
|
16799
17712
|
}
|
|
16800
17713
|
|
|
@@ -17571,7 +18484,7 @@ function toBigInt2(value) {
|
|
|
17571
18484
|
}
|
|
17572
18485
|
|
|
17573
18486
|
// src/services/consensusOracle/utils/holdings.ts
|
|
17574
|
-
var
|
|
18487
|
+
var import_web325 = require("@solana/web3.js");
|
|
17575
18488
|
var import_common44 = __toESM(require_dist());
|
|
17576
18489
|
function selectReportableHoldings(holdings, excludedMints = /* @__PURE__ */ new Set()) {
|
|
17577
18490
|
return holdings.map((holding, holdingIndex) => ({ holding, holdingIndex })).filter(({ holding }) => {
|
|
@@ -17610,7 +18523,7 @@ function parseExternalLiquidityRefs(vaultState) {
|
|
|
17610
18523
|
if (!data || data.length < 40) continue;
|
|
17611
18524
|
if (data[0] !== 1) continue;
|
|
17612
18525
|
const pubkeyBytes = new Uint8Array(data.slice(8, 40));
|
|
17613
|
-
const userAccount = new
|
|
18526
|
+
const userAccount = new import_web325.PublicKey(pubkeyBytes).toBase58();
|
|
17614
18527
|
refs.push({
|
|
17615
18528
|
kind: "marginfi",
|
|
17616
18529
|
mint: "",
|
|
@@ -17836,12 +18749,12 @@ function formatBpsAsPercent(bps) {
|
|
|
17836
18749
|
}
|
|
17837
18750
|
|
|
17838
18751
|
// src/services/consensusOracle/pipeline/dryRunSettlement.ts
|
|
17839
|
-
var
|
|
18752
|
+
var import_web327 = require("@solana/web3.js");
|
|
17840
18753
|
var import_common45 = __toESM(require_dist());
|
|
17841
18754
|
|
|
17842
18755
|
// src/services/consensusOracle/settlement/settlementSimulator.ts
|
|
17843
18756
|
var import_kit12 = require("@solana/kit");
|
|
17844
|
-
var
|
|
18757
|
+
var import_web326 = require("@solana/web3.js");
|
|
17845
18758
|
var DEFAULT_SHARE_PRICE = 1000000n;
|
|
17846
18759
|
var BPS_DENOMINATOR3 = 10000n;
|
|
17847
18760
|
var NAV_LOSS_TOLERANCE_BPS = 25n;
|
|
@@ -18044,7 +18957,7 @@ function applyConsensus(holdings, entries, nowTs, stalenessThresholdSecs) {
|
|
|
18044
18957
|
continue;
|
|
18045
18958
|
}
|
|
18046
18959
|
const reports = entries.filter(
|
|
18047
|
-
(entry) => entry.signer !==
|
|
18960
|
+
(entry) => entry.signer !== import_web326.PublicKey.default.toBase58() && isFresh(entry.lastUpdateTs, nowTs, stalenessThresholdSecs) && (entry.prices[index] ?? 0n) > 0n
|
|
18048
18961
|
);
|
|
18049
18962
|
const usesConsensusPrice = holding.priceOracleType === "consensusoracle";
|
|
18050
18963
|
const prices = reports.map((entry) => entry.prices[index] ?? 0n);
|
|
@@ -18542,7 +19455,7 @@ function decodeOracleData(data, nowTs) {
|
|
|
18542
19455
|
(_, holdingIndex) => readU64(data, offset + EXTERNAL_OFFSET + holdingIndex * 8)
|
|
18543
19456
|
);
|
|
18544
19457
|
entries.push({
|
|
18545
|
-
signer: new
|
|
19458
|
+
signer: new import_web326.PublicKey(signerBytes).toBase58(),
|
|
18546
19459
|
lastUpdateTs: readI64(data, offset + 32),
|
|
18547
19460
|
prices,
|
|
18548
19461
|
externalAmounts
|
|
@@ -18557,7 +19470,7 @@ function decodeOracleData(data, nowTs) {
|
|
|
18557
19470
|
data.slice(pendingOffset + index * 32, pendingOffset + (index + 1) * 32)
|
|
18558
19471
|
);
|
|
18559
19472
|
entries[index] = {
|
|
18560
|
-
signer: index < pendingCount ? new
|
|
19473
|
+
signer: index < pendingCount ? new import_web326.PublicKey(signerBytes).toBase58() : import_web326.PublicKey.default.toBase58(),
|
|
18561
19474
|
lastUpdateTs: 0n,
|
|
18562
19475
|
prices: Array(MAX_HOLDINGS).fill(0n),
|
|
18563
19476
|
externalAmounts: Array(MAX_HOLDINGS).fill(0n)
|
|
@@ -18585,7 +19498,7 @@ function decodeHolding(value) {
|
|
|
18585
19498
|
externalAmount: bigint(holding.externalAmount),
|
|
18586
19499
|
price: bigint(holding.price),
|
|
18587
19500
|
lastUpdateTs: bigint(holding.lastUpdateTs),
|
|
18588
|
-
cleared: mintString ===
|
|
19501
|
+
cleared: mintString === import_web326.PublicKey.default.toBase58()
|
|
18589
19502
|
};
|
|
18590
19503
|
}
|
|
18591
19504
|
function decodeTrancheState(decoded, args, warnings, blockers) {
|
|
@@ -19050,11 +19963,11 @@ async function simulateDryRunSettlement({
|
|
|
19050
19963
|
client.account.fetchVaultOracleForVault(vault, { fresh: true }),
|
|
19051
19964
|
tranchingEnabled ? client.account.fetchVaultTrancheStateForVault(vault, { fresh: true }) : Promise.resolve(void 0)
|
|
19052
19965
|
]);
|
|
19053
|
-
const mintKeys = [new
|
|
19966
|
+
const mintKeys = [new import_web327.PublicKey(vaultState.mint)];
|
|
19054
19967
|
if (trancheState) {
|
|
19055
19968
|
mintKeys.push(
|
|
19056
|
-
new
|
|
19057
|
-
new
|
|
19969
|
+
new import_web327.PublicKey(trancheState.config.juniorMint),
|
|
19970
|
+
new import_web327.PublicKey(trancheState.config.seniorMint)
|
|
19058
19971
|
);
|
|
19059
19972
|
}
|
|
19060
19973
|
const mintAccounts = await client.provider.connection.getMultipleAccountsInfo(
|
|
@@ -19635,7 +20548,7 @@ var StaticPositionProvider = class {
|
|
|
19635
20548
|
|
|
19636
20549
|
// src/services/consensusOracle/positions/kaminoPositionProvider.ts
|
|
19637
20550
|
var import_kit14 = require("@solana/kit");
|
|
19638
|
-
var
|
|
20551
|
+
var import_web328 = require("@solana/web3.js");
|
|
19639
20552
|
var import_klend_sdk = require("@kamino-finance/klend-sdk");
|
|
19640
20553
|
async function readKaminoBalance(manager, vault, sharesHolder) {
|
|
19641
20554
|
const userShares = await manager.getUserSharesBalanceSingleVault(
|
|
@@ -19672,7 +20585,7 @@ var KaminoPositionProvider = class {
|
|
|
19672
20585
|
const amount = await readKaminoBalance(
|
|
19673
20586
|
manager,
|
|
19674
20587
|
kVault,
|
|
19675
|
-
new
|
|
20588
|
+
new import_web328.PublicKey(sharesHolder)
|
|
19676
20589
|
);
|
|
19677
20590
|
out.push({ mint: ref.mint, amount });
|
|
19678
20591
|
}
|
|
@@ -19681,7 +20594,7 @@ var KaminoPositionProvider = class {
|
|
|
19681
20594
|
};
|
|
19682
20595
|
|
|
19683
20596
|
// src/services/consensusOracle/positions/marginfiPositionProvider.ts
|
|
19684
|
-
var
|
|
20597
|
+
var import_web329 = require("@solana/web3.js");
|
|
19685
20598
|
var import_marginfi2 = __toESM(require_dist2());
|
|
19686
20599
|
var MarginfiPositionProvider = class {
|
|
19687
20600
|
constructor(connection, log = () => {
|
|
@@ -19692,8 +20605,8 @@ var MarginfiPositionProvider = class {
|
|
|
19692
20605
|
async positionsFor(ctx) {
|
|
19693
20606
|
const refs = ctx.refs.filter((r) => r.kind === "marginfi");
|
|
19694
20607
|
if (refs.length === 0) return [];
|
|
19695
|
-
const explicitBanks = refs.map((r) => r.marginfiBank).filter(Boolean).map((bank) => new
|
|
19696
|
-
const autoAccountPks = refs.filter((r) => !r.marginfiBank).map((r) => r.marginfiAccount).filter(Boolean).map((account) => new
|
|
20608
|
+
const explicitBanks = refs.map((r) => r.marginfiBank).filter(Boolean).map((bank) => new import_web329.PublicKey(bank));
|
|
20609
|
+
const autoAccountPks = refs.filter((r) => !r.marginfiBank).map((r) => r.marginfiAccount).filter(Boolean).map((account) => new import_web329.PublicKey(account));
|
|
19697
20610
|
const autoBanks = [];
|
|
19698
20611
|
for (const accountPk of autoAccountPks) {
|
|
19699
20612
|
try {
|
|
@@ -19722,14 +20635,14 @@ var MarginfiPositionProvider = class {
|
|
|
19722
20635
|
if (bank) {
|
|
19723
20636
|
const amount = await (0, import_marginfi2.readMarginfiBankBalance)(
|
|
19724
20637
|
client,
|
|
19725
|
-
new
|
|
19726
|
-
new
|
|
20638
|
+
new import_web329.PublicKey(account),
|
|
20639
|
+
new import_web329.PublicKey(bank)
|
|
19727
20640
|
);
|
|
19728
20641
|
out.push({ mint: ref.mint, amount });
|
|
19729
20642
|
} else {
|
|
19730
20643
|
const balances = await (0, import_marginfi2.readAllMarginfiBalances)(
|
|
19731
20644
|
client,
|
|
19732
|
-
new
|
|
20645
|
+
new import_web329.PublicKey(account)
|
|
19733
20646
|
);
|
|
19734
20647
|
for (const { mint, amount } of balances) {
|
|
19735
20648
|
out.push({ mint: mint.toBase58(), amount });
|
|
@@ -20186,7 +21099,7 @@ async function runLiveConsensusOracle(env, oracleSigner, opts = {}) {
|
|
|
20186
21099
|
|
|
20187
21100
|
// src/services/externalLiquidityIntegrityService.ts
|
|
20188
21101
|
var import_kit15 = require("@solana/kit");
|
|
20189
|
-
var
|
|
21102
|
+
var import_web330 = require("@solana/web3.js");
|
|
20190
21103
|
var import_common53 = __toESM(require_dist());
|
|
20191
21104
|
var import_marginfi3 = __toESM(require_dist2());
|
|
20192
21105
|
var DEFAULT_MIN_AMOUNT_UI = 1;
|
|
@@ -20209,7 +21122,7 @@ function parseActiveSlots(externalLiquidity) {
|
|
|
20209
21122
|
if (discriminant === 0) continue;
|
|
20210
21123
|
if (discriminant !== 1) continue;
|
|
20211
21124
|
const pubkeyBytes = new Uint8Array(data.slice(8, 40));
|
|
20212
|
-
const userAccount = (0, import_common53.toAddress)(new
|
|
21125
|
+
const userAccount = (0, import_common53.toAddress)(new import_web330.PublicKey(pubkeyBytes));
|
|
20213
21126
|
results.push({ index: i, source: "marginfi", userAccount });
|
|
20214
21127
|
}
|
|
20215
21128
|
return results;
|
|
@@ -20326,7 +21239,7 @@ var ExternalLiquidityIntegrityService = class {
|
|
|
20326
21239
|
return result;
|
|
20327
21240
|
}
|
|
20328
21241
|
const hwManagerAddress = (0, import_common53.fromWeb3Pk)(hwManager.publicKey);
|
|
20329
|
-
const vaultPk = new
|
|
21242
|
+
const vaultPk = new import_web330.PublicKey(vault.toString());
|
|
20330
21243
|
const registeredHwManager = pubkeyStr(
|
|
20331
21244
|
vaultState.roles.hwManager
|
|
20332
21245
|
);
|
|
@@ -20506,9 +21419,11 @@ var ExternalLiquidityIntegrityService = class {
|
|
|
20506
21419
|
// src/services/idleLiquidityService.ts
|
|
20507
21420
|
var import_kit16 = require("@solana/kit");
|
|
20508
21421
|
var import_spl_token20 = require("@solana/spl-token");
|
|
20509
|
-
var
|
|
21422
|
+
var import_marginfi_client_v2 = require("@mrgnlabs/marginfi-client-v2");
|
|
21423
|
+
var import_web331 = require("@solana/web3.js");
|
|
20510
21424
|
var import_common54 = __toESM(require_dist());
|
|
20511
21425
|
var import_jupiter2 = __toESM(require_dist3());
|
|
21426
|
+
var import_marginfi4 = __toESM(require_dist2());
|
|
20512
21427
|
var IDLE_RESERVE_FLOOR_BPS = 400;
|
|
20513
21428
|
var IDLE_RESERVE_TARGET_BPS = 500;
|
|
20514
21429
|
var DEFAULT_SLIPPAGE_BPS = 30;
|
|
@@ -20545,7 +21460,6 @@ function readHolding(raw) {
|
|
|
20545
21460
|
price: toBigInt4(h.price),
|
|
20546
21461
|
decimals: Number(h.decimals ?? 0),
|
|
20547
21462
|
localAmount: toBigInt4(h.localAmount),
|
|
20548
|
-
externalAmount: toBigInt4(h.externalAmount),
|
|
20549
21463
|
lastUpdateTs: Number(toBigInt4(h.lastUpdateTs)),
|
|
20550
21464
|
lastRebalanceTs: Number(toBigInt4(h.lastRebalanceTs))
|
|
20551
21465
|
};
|
|
@@ -20583,7 +21497,7 @@ var IdleLiquidityService = class {
|
|
|
20583
21497
|
`Signer ${hwManager.publicKey.toBase58()} is not the vault hw_manager ${registeredHwManager}`
|
|
20584
21498
|
);
|
|
20585
21499
|
}
|
|
20586
|
-
const assessment = this.assess(vault, vaultState, log);
|
|
21500
|
+
const assessment = await this.assess(vault, vaultState, log);
|
|
20587
21501
|
if (assessment.result) return assessment.result;
|
|
20588
21502
|
const { usdc, pst, base } = assessment;
|
|
20589
21503
|
const pstInput = this.sizePstInput(base.shortfallUsdc, usdc, pst);
|
|
@@ -20650,11 +21564,67 @@ var IdleLiquidityService = class {
|
|
|
20650
21564
|
}
|
|
20651
21565
|
}
|
|
20652
21566
|
// ── Assessment ──────────────────────────────────────────────────────────
|
|
21567
|
+
/** Read only the two locations that constitute the idle USDC reserve. */
|
|
21568
|
+
async fetchIdleUsdc(vault, vaultState) {
|
|
21569
|
+
const connection = this.client.provider.connection;
|
|
21570
|
+
const vaultPk = new import_web331.PublicKey(vault);
|
|
21571
|
+
const usdcMint = new import_web331.PublicKey(import_common54.USDC_MINT);
|
|
21572
|
+
const ata = (0, import_spl_token20.getAssociatedTokenAddressSync)(usdcMint, vaultPk, true);
|
|
21573
|
+
const tokenInfo = await connection.getAccountInfo(ata, "confirmed");
|
|
21574
|
+
let localAmount = 0n;
|
|
21575
|
+
if (tokenInfo) {
|
|
21576
|
+
const tokenAccount = (0, import_spl_token20.unpackAccount)(ata, tokenInfo, import_spl_token20.TOKEN_PROGRAM_ID);
|
|
21577
|
+
if (!tokenAccount.mint.equals(usdcMint) || !tokenAccount.owner.equals(vaultPk) || !tokenAccount.isInitialized) {
|
|
21578
|
+
throw new Error(`Invalid vault USDC token account: ${ata.toBase58()}`);
|
|
21579
|
+
}
|
|
21580
|
+
localAmount = tokenAccount.amount;
|
|
21581
|
+
}
|
|
21582
|
+
const data = vaultState.externalLiquidity[0]?.data;
|
|
21583
|
+
if (!data || data.length < 40) {
|
|
21584
|
+
throw new Error("Invalid external-liquidity slot 0");
|
|
21585
|
+
}
|
|
21586
|
+
if (data[0] === 0) return { localAmount, marginfiAmount: 0n };
|
|
21587
|
+
if (data[0] !== 1) {
|
|
21588
|
+
throw new Error("External-liquidity slot 0 is not Marginfi");
|
|
21589
|
+
}
|
|
21590
|
+
const positionPk = new import_web331.PublicKey(new Uint8Array(data.slice(8, 40)));
|
|
21591
|
+
const positionInfo = await connection.getAccountInfo(
|
|
21592
|
+
positionPk,
|
|
21593
|
+
"confirmed"
|
|
21594
|
+
);
|
|
21595
|
+
if (!positionInfo || !positionInfo.owner.equals(new import_web331.PublicKey(import_marginfi4.MARGINFI_PROGRAM_ID))) {
|
|
21596
|
+
throw new Error(
|
|
21597
|
+
`Invalid Marginfi slot-0 account: ${positionPk.toBase58()}`
|
|
21598
|
+
);
|
|
21599
|
+
}
|
|
21600
|
+
const marginfi = await (0, import_marginfi4.createMarginfiReadClient)(
|
|
21601
|
+
connection,
|
|
21602
|
+
(0, import_marginfi4.parseBankPksFromMarginfiAccount)(positionInfo.data)
|
|
21603
|
+
);
|
|
21604
|
+
const position = await import_marginfi_client_v2.MarginfiAccountWrapper.fetch(positionPk, marginfi);
|
|
21605
|
+
if (!position.authority.equals(vaultPk)) {
|
|
21606
|
+
throw new Error("Marginfi slot-0 authority is not the vault");
|
|
21607
|
+
}
|
|
21608
|
+
let marginfiAmount = 0n;
|
|
21609
|
+
for (const balance of position.activeBalances) {
|
|
21610
|
+
const bank = marginfi.getBankByPk(balance.bankPk);
|
|
21611
|
+
if (!bank) {
|
|
21612
|
+
throw new Error(
|
|
21613
|
+
`Marginfi bank not loaded: ${balance.bankPk.toBase58()}`
|
|
21614
|
+
);
|
|
21615
|
+
}
|
|
21616
|
+
if (!bank.mint.equals(usdcMint)) continue;
|
|
21617
|
+
marginfiAmount += BigInt(
|
|
21618
|
+
balance.computeQuantity(bank).assets.toFixed(0, 1)
|
|
21619
|
+
);
|
|
21620
|
+
}
|
|
21621
|
+
return { localAmount, marginfiAmount };
|
|
21622
|
+
}
|
|
20653
21623
|
/**
|
|
20654
21624
|
* Decide whether a top-up is warranted. Returns either a terminal `result`
|
|
20655
21625
|
* (nothing to do) or the holdings and sizing needed to build the swap.
|
|
20656
21626
|
*/
|
|
20657
|
-
assess(vault, vaultState, log) {
|
|
21627
|
+
async assess(vault, vaultState, log) {
|
|
20658
21628
|
const tvl = toBigInt4(
|
|
20659
21629
|
vaultState.accounting?.tvl
|
|
20660
21630
|
);
|
|
@@ -20696,7 +21666,15 @@ var IdleLiquidityService = class {
|
|
|
20696
21666
|
return { result: { ...empty, status: "stale-price", reason } };
|
|
20697
21667
|
}
|
|
20698
21668
|
}
|
|
20699
|
-
|
|
21669
|
+
let balances;
|
|
21670
|
+
try {
|
|
21671
|
+
balances = await this.fetchIdleUsdc(vault, vaultState);
|
|
21672
|
+
} catch (error) {
|
|
21673
|
+
const reason = `idle USDC balance read failed: ${error.message}`;
|
|
21674
|
+
log(`Vault ${vault}: ${reason}`);
|
|
21675
|
+
return { result: { ...empty, status: "failed", reason } };
|
|
21676
|
+
}
|
|
21677
|
+
const idleAmount = balances.localAmount + balances.marginfiAmount;
|
|
20700
21678
|
const idleValue = holdingValue2(usdc, idleAmount);
|
|
20701
21679
|
const idleBps = Number(idleValue * 10000n / tvl);
|
|
20702
21680
|
const base = { ...empty, idleValue, idleBps };
|
|
@@ -20704,7 +21682,13 @@ var IdleLiquidityService = class {
|
|
|
20704
21682
|
`Vault ${vault}: idle USDC ${formatUi2(
|
|
20705
21683
|
idleAmount,
|
|
20706
21684
|
usdc.decimals
|
|
20707
|
-
)}
|
|
21685
|
+
)} (vault token account ${formatUi2(
|
|
21686
|
+
balances.localAmount,
|
|
21687
|
+
usdc.decimals
|
|
21688
|
+
)} + Marginfi slot 0 ${formatUi2(
|
|
21689
|
+
balances.marginfiAmount,
|
|
21690
|
+
usdc.decimals
|
|
21691
|
+
)}) = ${idleBps}bps of TVL (floor ${IDLE_RESERVE_FLOOR_BPS}bps, target ${IDLE_RESERVE_TARGET_BPS}bps)`
|
|
20708
21692
|
);
|
|
20709
21693
|
if (idleBps >= IDLE_RESERVE_FLOOR_BPS) {
|
|
20710
21694
|
const reason = `idle USDC ${idleBps}bps is at or above the ${IDLE_RESERVE_FLOOR_BPS}bps floor`;
|
|
@@ -20787,7 +21771,7 @@ var IdleLiquidityService = class {
|
|
|
20787
21771
|
*/
|
|
20788
21772
|
async mintTokenProgram(mint) {
|
|
20789
21773
|
const account = await this.client.provider.connection.getAccountInfo(
|
|
20790
|
-
new
|
|
21774
|
+
new import_web331.PublicKey(mint),
|
|
20791
21775
|
"confirmed"
|
|
20792
21776
|
);
|
|
20793
21777
|
if (!account) throw new Error(`Mint account not found: ${mint}`);
|
|
@@ -20842,9 +21826,9 @@ var IdleLiquidityService = class {
|
|
|
20842
21826
|
});
|
|
20843
21827
|
const connection = this.client.provider.connection;
|
|
20844
21828
|
const instructions2 = [
|
|
20845
|
-
|
|
21829
|
+
import_web331.ComputeBudgetProgram.setComputeUnitLimit({ units: COMPUTE_UNIT_LIMIT }),
|
|
20846
21830
|
...cuPriceMicroLamports > 0 ? [
|
|
20847
|
-
|
|
21831
|
+
import_web331.ComputeBudgetProgram.setComputeUnitPrice({
|
|
20848
21832
|
microLamports: cuPriceMicroLamports
|
|
20849
21833
|
})
|
|
20850
21834
|
] : [],
|
|
@@ -20856,12 +21840,12 @@ var IdleLiquidityService = class {
|
|
|
20856
21840
|
connection,
|
|
20857
21841
|
plan.lookupTables ?? []
|
|
20858
21842
|
);
|
|
20859
|
-
const message2 = new
|
|
21843
|
+
const message2 = new import_web331.TransactionMessage({
|
|
20860
21844
|
payerKey: hwManager.publicKey,
|
|
20861
21845
|
recentBlockhash: blockhash,
|
|
20862
21846
|
instructions: instructions2
|
|
20863
21847
|
}).compileToV0Message(lookupTableAccounts);
|
|
20864
|
-
const transaction = new
|
|
21848
|
+
const transaction = new import_web331.VersionedTransaction(message2);
|
|
20865
21849
|
transaction.sign([hwManager]);
|
|
20866
21850
|
if (!this.client.skipSimulation) {
|
|
20867
21851
|
const simulation = await connection.simulateTransaction(transaction, {
|
|
@@ -20907,9 +21891,9 @@ var IdleLiquidityService = class {
|
|
|
20907
21891
|
|
|
20908
21892
|
// src/services/timelockSettlementService.ts
|
|
20909
21893
|
var import_kit17 = require("@solana/kit");
|
|
20910
|
-
var
|
|
21894
|
+
var import_web332 = require("@solana/web3.js");
|
|
20911
21895
|
var import_common55 = __toESM(require_dist());
|
|
20912
|
-
var ZERO_PUBKEY =
|
|
21896
|
+
var ZERO_PUBKEY = import_web332.PublicKey.default.toBase58();
|
|
20913
21897
|
var CONSENSUS_SIGNER_CAPACITY = 4;
|
|
20914
21898
|
var CONSENSUS_ENTRY_OFFSET = 40;
|
|
20915
21899
|
var CONSENSUS_ENTRY_SIZE = 272;
|
|
@@ -20949,7 +21933,7 @@ function decodePendingConsensusSigners(data) {
|
|
|
20949
21933
|
const signers = [];
|
|
20950
21934
|
for (let i = 0; i < count; i += 1) {
|
|
20951
21935
|
const start = CONSENSUS_PENDING_OFFSET + i * 32;
|
|
20952
|
-
const signer = new
|
|
21936
|
+
const signer = new import_web332.PublicKey(bytes.slice(start, start + 32)).toBase58();
|
|
20953
21937
|
if (signer === ZERO_PUBKEY) {
|
|
20954
21938
|
throw new Error(`pending consensus signer ${i} is unset`);
|
|
20955
21939
|
}
|
|
@@ -21146,8 +22130,93 @@ var TimelockSettlementService = class {
|
|
|
21146
22130
|
}
|
|
21147
22131
|
};
|
|
21148
22132
|
|
|
21149
|
-
// src/
|
|
22133
|
+
// src/services/nestWithdrawalService.ts
|
|
22134
|
+
var import_kit18 = require("@solana/kit");
|
|
22135
|
+
var import_spl_token21 = require("@solana/spl-token");
|
|
22136
|
+
var import_web333 = require("@solana/web3.js");
|
|
21150
22137
|
var import_common56 = __toESM(require_dist());
|
|
22138
|
+
var import_nest3 = __toESM(require_dist4());
|
|
22139
|
+
var import_nest4 = __toESM(require_dist4());
|
|
22140
|
+
var NestOftProgram = new import_web333.PublicKey(
|
|
22141
|
+
"ChEfPd3RzLeYiRwp1K9evimmaFSd6DV1S4Mv5q5Aj1th"
|
|
22142
|
+
);
|
|
22143
|
+
var NestOftStore = new import_web333.PublicKey(
|
|
22144
|
+
"k8mJj8Gyw2gFAqut21AFVUUZhxb4RVDMnb4PrSYiDhV"
|
|
22145
|
+
);
|
|
22146
|
+
var UsdcMint = new import_web333.PublicKey("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v");
|
|
22147
|
+
var NestPerenaComposer = Buffer.from(
|
|
22148
|
+
"000000000000000000000000908dcb5531691c2124c54e30bb645cf11647090d",
|
|
22149
|
+
"hex"
|
|
22150
|
+
);
|
|
22151
|
+
async function buildNestWithdrawalRequest(args) {
|
|
22152
|
+
const txBase64 = await (0, import_nest3.fetchNestRedemptionTransaction)(
|
|
22153
|
+
{
|
|
22154
|
+
owner: args.owner.toBase58(),
|
|
22155
|
+
nestVaultSlug: NEST_VAULT_SLUG,
|
|
22156
|
+
rawAmountNestToken: args.rawAmountNestToken
|
|
22157
|
+
},
|
|
22158
|
+
args.apiOptions
|
|
22159
|
+
);
|
|
22160
|
+
return decodeNestWithdrawalRequest({ ...args, txBase64 });
|
|
22161
|
+
}
|
|
22162
|
+
async function decodeNestWithdrawalRequest(args) {
|
|
22163
|
+
const transaction = import_web333.VersionedTransaction.deserialize(
|
|
22164
|
+
Buffer.from(args.txBase64, "base64")
|
|
22165
|
+
);
|
|
22166
|
+
const message2 = transaction.message;
|
|
22167
|
+
if (!message2.staticAccountKeys[0].equals(args.owner) || message2.header.numRequiredSignatures !== 1) {
|
|
22168
|
+
throw new Error(
|
|
22169
|
+
"Nest withdrawal must use the Squads vault as its only signer and fee payer"
|
|
22170
|
+
);
|
|
22171
|
+
}
|
|
22172
|
+
const tables = await Promise.all(
|
|
22173
|
+
message2.addressTableLookups.map(async (lookup) => {
|
|
22174
|
+
const { value } = await args.connection.getAddressLookupTable(
|
|
22175
|
+
lookup.accountKey
|
|
22176
|
+
);
|
|
22177
|
+
if (!value)
|
|
22178
|
+
throw new Error(
|
|
22179
|
+
`Nest lookup table not found: ${lookup.accountKey.toBase58()}`
|
|
22180
|
+
);
|
|
22181
|
+
return value;
|
|
22182
|
+
})
|
|
22183
|
+
);
|
|
22184
|
+
const decoded = import_web333.TransactionMessage.decompile(message2, {
|
|
22185
|
+
addressLookupTableAccounts: tables
|
|
22186
|
+
});
|
|
22187
|
+
const nestMint = new import_web333.PublicKey(NEST_RWA_SHARE_MINT);
|
|
22188
|
+
const sourceAta = (0, import_spl_token21.getAssociatedTokenAddressSync)(nestMint, args.owner, true);
|
|
22189
|
+
const usdcAta = (0, import_spl_token21.getAssociatedTokenAddressSync)(UsdcMint, args.owner, true);
|
|
22190
|
+
const instructions2 = decoded.instructions.filter(
|
|
22191
|
+
(ix) => !ix.programId.equals(import_web333.ComputeBudgetProgram.programId)
|
|
22192
|
+
);
|
|
22193
|
+
let sends = 0;
|
|
22194
|
+
for (const ix of instructions2) {
|
|
22195
|
+
if (ix.programId.equals(import_spl_token21.ASSOCIATED_TOKEN_PROGRAM_ID)) {
|
|
22196
|
+
if (ix.data.length !== 1 || ix.data[0] !== 1 || !ix.keys[0]?.pubkey.equals(args.owner) || !ix.keys[1]?.pubkey.equals(usdcAta) || !ix.keys[2]?.pubkey.equals(args.owner) || !ix.keys[3]?.pubkey.equals(UsdcMint) || !ix.keys[5]?.pubkey.equals(import_spl_token21.TOKEN_PROGRAM_ID)) {
|
|
22197
|
+
throw new Error("Unexpected token account creation in Nest withdrawal");
|
|
22198
|
+
}
|
|
22199
|
+
continue;
|
|
22200
|
+
}
|
|
22201
|
+
if (!ix.programId.equals(NestOftProgram) || ix.data.length < 52 || !ix.data.subarray(0, 8).equals(Buffer.from([102, 251, 20, 187, 65, 75, 12, 69])) || !ix.data.subarray(12, 44).equals(NestPerenaComposer) || ix.data.readBigUInt64LE(44) !== args.rawAmountNestToken || ![args.owner, nestMint, sourceAta, NestOftStore].every(
|
|
22202
|
+
(key) => ix.keys.some((meta) => meta.pubkey.equals(key))
|
|
22203
|
+
)) {
|
|
22204
|
+
throw new Error(
|
|
22205
|
+
"Unexpected instruction or share amount in Nest withdrawal"
|
|
22206
|
+
);
|
|
22207
|
+
}
|
|
22208
|
+
sends += 1;
|
|
22209
|
+
}
|
|
22210
|
+
if (sends !== 1)
|
|
22211
|
+
throw new Error("Nest withdrawal must contain exactly one OFT send");
|
|
22212
|
+
return {
|
|
22213
|
+
instructions: instructions2.map(import_common56.toKitInstruction),
|
|
22214
|
+
lookupTables: tables.map((table) => (0, import_kit18.address)(table.key.toBase58()))
|
|
22215
|
+
};
|
|
22216
|
+
}
|
|
22217
|
+
|
|
22218
|
+
// src/index.ts
|
|
22219
|
+
var import_common57 = __toESM(require_dist());
|
|
21151
22220
|
// Annotate the CommonJS export names for ESM import in node:
|
|
21152
22221
|
0 && (module.exports = {
|
|
21153
22222
|
ASSET_DECIMALS,
|
|
@@ -21223,6 +22292,7 @@ var import_common56 = __toESM(require_dist());
|
|
|
21223
22292
|
NEST_API_BASE_URL,
|
|
21224
22293
|
NEST_RWA_SHARE_MINT,
|
|
21225
22294
|
NEST_VAULT_SLUG,
|
|
22295
|
+
NestApiError,
|
|
21226
22296
|
NestPriceSource,
|
|
21227
22297
|
ORACLE_ENTRIES_OFFSET,
|
|
21228
22298
|
ORACLE_ENTRY_SIZE,
|
|
@@ -21283,6 +22353,7 @@ var import_common56 = __toESM(require_dist());
|
|
|
21283
22353
|
assertNoUnconfirmedYieldPayments,
|
|
21284
22354
|
buildHoldingUpdate,
|
|
21285
22355
|
buildMarginfiWithdrawInteraction,
|
|
22356
|
+
buildNestWithdrawalRequest,
|
|
21286
22357
|
buildUpdates,
|
|
21287
22358
|
coerceBool,
|
|
21288
22359
|
collectSamples,
|
|
@@ -21295,11 +22366,14 @@ var import_common56 = __toESM(require_dist());
|
|
|
21295
22366
|
createVaultClient,
|
|
21296
22367
|
createYieldPayment,
|
|
21297
22368
|
dateToStr,
|
|
22369
|
+
decodeNestWithdrawalRequest,
|
|
21298
22370
|
decodePendingConsensusSigners,
|
|
21299
22371
|
defaultKeypairPath,
|
|
21300
22372
|
deleteAccount,
|
|
21301
22373
|
discoverVaultsForSigner,
|
|
21302
22374
|
fetchExternalPositions,
|
|
22375
|
+
fetchNestRedemptionQuote,
|
|
22376
|
+
fetchNestRedemptionStatus,
|
|
21303
22377
|
fetchNestTokenPrice,
|
|
21304
22378
|
fetchReceiptMints,
|
|
21305
22379
|
filterTargetHoldings,
|
|
@@ -21340,6 +22414,7 @@ var import_common56 = __toESM(require_dist());
|
|
|
21340
22414
|
mostFrequent,
|
|
21341
22415
|
parseExternalLiquidityRefs,
|
|
21342
22416
|
planRebalance,
|
|
22417
|
+
prepareSquadsProposalUpload,
|
|
21343
22418
|
prepareVaultTransaction,
|
|
21344
22419
|
priceInAccountingUnit,
|
|
21345
22420
|
readI64LE,
|