@perena/vault-sdk 1.0.30 → 1.0.31
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/index.d.ts +713 -11
- package/dist/index.js +683 -129
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -782,7 +782,7 @@ var require_registry = __commonJS({
|
|
|
782
782
|
var token_2022_1 = require("@solana-program/token-2022");
|
|
783
783
|
var defaults_1 = require_defaults();
|
|
784
784
|
var utils_1 = require_utils();
|
|
785
|
-
var
|
|
785
|
+
var MintRegistry2 = class {
|
|
786
786
|
constructor(options = {}) {
|
|
787
787
|
this.byAddress = /* @__PURE__ */ new Map();
|
|
788
788
|
this.bySymbol = /* @__PURE__ */ new Map();
|
|
@@ -839,8 +839,8 @@ var require_registry = __commonJS({
|
|
|
839
839
|
return this.all().map((mint) => mint.address);
|
|
840
840
|
}
|
|
841
841
|
};
|
|
842
|
-
exports2.MintRegistry =
|
|
843
|
-
exports2.mints = new
|
|
842
|
+
exports2.MintRegistry = MintRegistry2;
|
|
843
|
+
exports2.mints = new MintRegistry2();
|
|
844
844
|
}
|
|
845
845
|
});
|
|
846
846
|
|
|
@@ -2868,12 +2868,12 @@ var require_routePreInstructions = __commonJS({
|
|
|
2868
2868
|
if (!intermediate.size) {
|
|
2869
2869
|
return { instructions: [], postSuccessCacheInvalidations: [] };
|
|
2870
2870
|
}
|
|
2871
|
-
const
|
|
2872
|
-
const mintInfos = await rpc.getMultipleAccounts(
|
|
2871
|
+
const mints2 = [...intermediate];
|
|
2872
|
+
const mintInfos = await rpc.getMultipleAccounts(mints2, { encoding: "base64" }).send();
|
|
2873
2873
|
const instructions2 = [];
|
|
2874
2874
|
const postSuccessCacheInvalidations = [];
|
|
2875
|
-
for (let i = 0; i <
|
|
2876
|
-
const mint =
|
|
2875
|
+
for (let i = 0; i < mints2.length; i += 1) {
|
|
2876
|
+
const mint = mints2[i];
|
|
2877
2877
|
const tokenProgram = mintInfos.value[i]?.owner;
|
|
2878
2878
|
if (!tokenProgram) {
|
|
2879
2879
|
throw new Error(`getJupiterRoutePreInstructions: route mint ${mint} not found on-chain`);
|
|
@@ -3043,11 +3043,11 @@ var require_priceApi = __commonJS({
|
|
|
3043
3043
|
}
|
|
3044
3044
|
throw lastErr instanceof Error ? lastErr : new Error(String(lastErr));
|
|
3045
3045
|
}
|
|
3046
|
-
async function fetchJupiterUsdPrices2(
|
|
3046
|
+
async function fetchJupiterUsdPrices2(mints2, opts = {}) {
|
|
3047
3047
|
const baseUrl = opts.baseUrl ?? constants_1.JUPITER_PRICE_API_URL;
|
|
3048
3048
|
const retries = opts.retries ?? DEFAULT_RETRIES;
|
|
3049
3049
|
const fetchFn = opts.fetchFn ?? fetch;
|
|
3050
|
-
const unique = [...new Set(
|
|
3050
|
+
const unique = [...new Set(mints2.map((mint) => mint.toString()))];
|
|
3051
3051
|
if (unique.length === 0)
|
|
3052
3052
|
return {};
|
|
3053
3053
|
const responses = await Promise.all(chunk(unique, BATCH_SIZE).map((batch) => withRetry(async () => {
|
|
@@ -3249,6 +3249,7 @@ __export(index_exports, {
|
|
|
3249
3249
|
DEFAULT_JUNIOR_WITHDRAWAL_LOCKUP_SECS: () => DEFAULT_JUNIOR_WITHDRAWAL_LOCKUP_SECS,
|
|
3250
3250
|
DEFAULT_MAX_ACCEPTABLE_APY_BPS: () => DEFAULT_MAX_ACCEPTABLE_APY_BPS,
|
|
3251
3251
|
DEFAULT_MAX_ACCOUNTS: () => DEFAULT_MAX_ACCOUNTS,
|
|
3252
|
+
DEFAULT_MINTS: () => import_common52.DEFAULT_MINTS,
|
|
3252
3253
|
DEFAULT_MIN_AMOUNT_UI: () => DEFAULT_MIN_AMOUNT_UI,
|
|
3253
3254
|
DEFAULT_ORACLE_STALENESS_THRESHOLD_SECS: () => DEFAULT_ORACLE_STALENESS_THRESHOLD_SECS,
|
|
3254
3255
|
DEFAULT_PRICE_ORACLE_ACCOUNT: () => DEFAULT_PRICE_ORACLE_ACCOUNT,
|
|
@@ -3288,6 +3289,7 @@ __export(index_exports, {
|
|
|
3288
3289
|
ManagerRedepositAssetBuilder: () => ManagerRedepositAssetBuilder,
|
|
3289
3290
|
ManagerWithdrawAssetBuilder: () => ManagerWithdrawAssetBuilder,
|
|
3290
3291
|
MarginfiPositionProvider: () => MarginfiPositionProvider,
|
|
3292
|
+
MintRegistry: () => import_common52.MintRegistry,
|
|
3291
3293
|
MockYieldTracker: () => MockYieldTracker,
|
|
3292
3294
|
NEST_API_BASE_URL: () => import_nest2.NEST_API_BASE_URL,
|
|
3293
3295
|
NEST_RWA_SHARE_MINT: () => NEST_RWA_SHARE_MINT,
|
|
@@ -3384,6 +3386,7 @@ __export(index_exports, {
|
|
|
3384
3386
|
logProspectiveApy: () => logProspectiveApy,
|
|
3385
3387
|
makeProvider: () => makeProvider,
|
|
3386
3388
|
mintTokensTo: () => mintTokensTo,
|
|
3389
|
+
mints: () => import_common52.mints,
|
|
3387
3390
|
mostFrequent: () => mostFrequent,
|
|
3388
3391
|
parseExternalLiquidityRefs: () => parseExternalLiquidityRefs,
|
|
3389
3392
|
planRebalance: () => planRebalance,
|
|
@@ -6807,6 +6810,524 @@ var IDL = {
|
|
|
6807
6810
|
}
|
|
6808
6811
|
]
|
|
6809
6812
|
},
|
|
6813
|
+
{
|
|
6814
|
+
"name": "execute_tranche_withdraw_from_external",
|
|
6815
|
+
"docs": [
|
|
6816
|
+
"Instant tranche redemption that may first pull the shortfall out of an",
|
|
6817
|
+
"external liquidity source. `external_withdraw_ix_refs` and",
|
|
6818
|
+
"`external_liquidity_source` are optional but must be passed together;",
|
|
6819
|
+
"with both `None` this is equivalent to `execute_tranche_withdraw`."
|
|
6820
|
+
],
|
|
6821
|
+
"discriminator": [
|
|
6822
|
+
36,
|
|
6823
|
+
174,
|
|
6824
|
+
206,
|
|
6825
|
+
234,
|
|
6826
|
+
239,
|
|
6827
|
+
177,
|
|
6828
|
+
233,
|
|
6829
|
+
249
|
|
6830
|
+
],
|
|
6831
|
+
"accounts": [
|
|
6832
|
+
{
|
|
6833
|
+
"name": "user",
|
|
6834
|
+
"writable": true,
|
|
6835
|
+
"signer": true
|
|
6836
|
+
},
|
|
6837
|
+
{
|
|
6838
|
+
"name": "vault",
|
|
6839
|
+
"writable": true
|
|
6840
|
+
},
|
|
6841
|
+
{
|
|
6842
|
+
"name": "vault_oracle"
|
|
6843
|
+
},
|
|
6844
|
+
{
|
|
6845
|
+
"name": "vault_tranche_state",
|
|
6846
|
+
"writable": true
|
|
6847
|
+
},
|
|
6848
|
+
{
|
|
6849
|
+
"name": "asset_mint"
|
|
6850
|
+
},
|
|
6851
|
+
{
|
|
6852
|
+
"name": "tranche_share_mint",
|
|
6853
|
+
"writable": true
|
|
6854
|
+
},
|
|
6855
|
+
{
|
|
6856
|
+
"name": "user_asset_ata",
|
|
6857
|
+
"writable": true,
|
|
6858
|
+
"pda": {
|
|
6859
|
+
"seeds": [
|
|
6860
|
+
{
|
|
6861
|
+
"kind": "account",
|
|
6862
|
+
"path": "user"
|
|
6863
|
+
},
|
|
6864
|
+
{
|
|
6865
|
+
"kind": "account",
|
|
6866
|
+
"path": "asset_token_program"
|
|
6867
|
+
},
|
|
6868
|
+
{
|
|
6869
|
+
"kind": "account",
|
|
6870
|
+
"path": "asset_mint"
|
|
6871
|
+
}
|
|
6872
|
+
],
|
|
6873
|
+
"program": {
|
|
6874
|
+
"kind": "const",
|
|
6875
|
+
"value": [
|
|
6876
|
+
140,
|
|
6877
|
+
151,
|
|
6878
|
+
37,
|
|
6879
|
+
143,
|
|
6880
|
+
78,
|
|
6881
|
+
36,
|
|
6882
|
+
137,
|
|
6883
|
+
241,
|
|
6884
|
+
187,
|
|
6885
|
+
61,
|
|
6886
|
+
16,
|
|
6887
|
+
41,
|
|
6888
|
+
20,
|
|
6889
|
+
142,
|
|
6890
|
+
13,
|
|
6891
|
+
131,
|
|
6892
|
+
11,
|
|
6893
|
+
90,
|
|
6894
|
+
19,
|
|
6895
|
+
153,
|
|
6896
|
+
218,
|
|
6897
|
+
255,
|
|
6898
|
+
16,
|
|
6899
|
+
132,
|
|
6900
|
+
4,
|
|
6901
|
+
142,
|
|
6902
|
+
123,
|
|
6903
|
+
216,
|
|
6904
|
+
219,
|
|
6905
|
+
233,
|
|
6906
|
+
248,
|
|
6907
|
+
89
|
|
6908
|
+
]
|
|
6909
|
+
}
|
|
6910
|
+
}
|
|
6911
|
+
},
|
|
6912
|
+
{
|
|
6913
|
+
"name": "vault_asset_ata",
|
|
6914
|
+
"writable": true,
|
|
6915
|
+
"pda": {
|
|
6916
|
+
"seeds": [
|
|
6917
|
+
{
|
|
6918
|
+
"kind": "account",
|
|
6919
|
+
"path": "vault"
|
|
6920
|
+
},
|
|
6921
|
+
{
|
|
6922
|
+
"kind": "account",
|
|
6923
|
+
"path": "asset_token_program"
|
|
6924
|
+
},
|
|
6925
|
+
{
|
|
6926
|
+
"kind": "account",
|
|
6927
|
+
"path": "asset_mint"
|
|
6928
|
+
}
|
|
6929
|
+
],
|
|
6930
|
+
"program": {
|
|
6931
|
+
"kind": "const",
|
|
6932
|
+
"value": [
|
|
6933
|
+
140,
|
|
6934
|
+
151,
|
|
6935
|
+
37,
|
|
6936
|
+
143,
|
|
6937
|
+
78,
|
|
6938
|
+
36,
|
|
6939
|
+
137,
|
|
6940
|
+
241,
|
|
6941
|
+
187,
|
|
6942
|
+
61,
|
|
6943
|
+
16,
|
|
6944
|
+
41,
|
|
6945
|
+
20,
|
|
6946
|
+
142,
|
|
6947
|
+
13,
|
|
6948
|
+
131,
|
|
6949
|
+
11,
|
|
6950
|
+
90,
|
|
6951
|
+
19,
|
|
6952
|
+
153,
|
|
6953
|
+
218,
|
|
6954
|
+
255,
|
|
6955
|
+
16,
|
|
6956
|
+
132,
|
|
6957
|
+
4,
|
|
6958
|
+
142,
|
|
6959
|
+
123,
|
|
6960
|
+
216,
|
|
6961
|
+
219,
|
|
6962
|
+
233,
|
|
6963
|
+
248,
|
|
6964
|
+
89
|
|
6965
|
+
]
|
|
6966
|
+
}
|
|
6967
|
+
}
|
|
6968
|
+
},
|
|
6969
|
+
{
|
|
6970
|
+
"name": "user_tranche_share_ata",
|
|
6971
|
+
"writable": true,
|
|
6972
|
+
"pda": {
|
|
6973
|
+
"seeds": [
|
|
6974
|
+
{
|
|
6975
|
+
"kind": "account",
|
|
6976
|
+
"path": "user"
|
|
6977
|
+
},
|
|
6978
|
+
{
|
|
6979
|
+
"kind": "account",
|
|
6980
|
+
"path": "share_token_program"
|
|
6981
|
+
},
|
|
6982
|
+
{
|
|
6983
|
+
"kind": "account",
|
|
6984
|
+
"path": "tranche_share_mint"
|
|
6985
|
+
}
|
|
6986
|
+
],
|
|
6987
|
+
"program": {
|
|
6988
|
+
"kind": "const",
|
|
6989
|
+
"value": [
|
|
6990
|
+
140,
|
|
6991
|
+
151,
|
|
6992
|
+
37,
|
|
6993
|
+
143,
|
|
6994
|
+
78,
|
|
6995
|
+
36,
|
|
6996
|
+
137,
|
|
6997
|
+
241,
|
|
6998
|
+
187,
|
|
6999
|
+
61,
|
|
7000
|
+
16,
|
|
7001
|
+
41,
|
|
7002
|
+
20,
|
|
7003
|
+
142,
|
|
7004
|
+
13,
|
|
7005
|
+
131,
|
|
7006
|
+
11,
|
|
7007
|
+
90,
|
|
7008
|
+
19,
|
|
7009
|
+
153,
|
|
7010
|
+
218,
|
|
7011
|
+
255,
|
|
7012
|
+
16,
|
|
7013
|
+
132,
|
|
7014
|
+
4,
|
|
7015
|
+
142,
|
|
7016
|
+
123,
|
|
7017
|
+
216,
|
|
7018
|
+
219,
|
|
7019
|
+
233,
|
|
7020
|
+
248,
|
|
7021
|
+
89
|
|
7022
|
+
]
|
|
7023
|
+
}
|
|
7024
|
+
}
|
|
7025
|
+
},
|
|
7026
|
+
{
|
|
7027
|
+
"name": "asset_token_program"
|
|
7028
|
+
},
|
|
7029
|
+
{
|
|
7030
|
+
"name": "share_token_program"
|
|
7031
|
+
},
|
|
7032
|
+
{
|
|
7033
|
+
"name": "associated_token_program",
|
|
7034
|
+
"address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
|
|
7035
|
+
},
|
|
7036
|
+
{
|
|
7037
|
+
"name": "system_program",
|
|
7038
|
+
"address": "11111111111111111111111111111111"
|
|
7039
|
+
}
|
|
7040
|
+
],
|
|
7041
|
+
"args": [
|
|
7042
|
+
{
|
|
7043
|
+
"name": "kind",
|
|
7044
|
+
"type": {
|
|
7045
|
+
"defined": {
|
|
7046
|
+
"name": "TrancheKind"
|
|
7047
|
+
}
|
|
7048
|
+
}
|
|
7049
|
+
},
|
|
7050
|
+
{
|
|
7051
|
+
"name": "share_amount",
|
|
7052
|
+
"type": "u64"
|
|
7053
|
+
},
|
|
7054
|
+
{
|
|
7055
|
+
"name": "external_withdraw_ix_refs",
|
|
7056
|
+
"type": {
|
|
7057
|
+
"option": {
|
|
7058
|
+
"defined": {
|
|
7059
|
+
"name": "InstructionRefs"
|
|
7060
|
+
}
|
|
7061
|
+
}
|
|
7062
|
+
}
|
|
7063
|
+
},
|
|
7064
|
+
{
|
|
7065
|
+
"name": "external_liquidity_source",
|
|
7066
|
+
"type": {
|
|
7067
|
+
"option": "u8"
|
|
7068
|
+
}
|
|
7069
|
+
}
|
|
7070
|
+
]
|
|
7071
|
+
},
|
|
7072
|
+
{
|
|
7073
|
+
"name": "execute_tranche_withdraw_from_external_fee_exempt",
|
|
7074
|
+
"discriminator": [
|
|
7075
|
+
217,
|
|
7076
|
+
186,
|
|
7077
|
+
123,
|
|
7078
|
+
85,
|
|
7079
|
+
254,
|
|
7080
|
+
115,
|
|
7081
|
+
196,
|
|
7082
|
+
110
|
|
7083
|
+
],
|
|
7084
|
+
"accounts": [
|
|
7085
|
+
{
|
|
7086
|
+
"name": "user",
|
|
7087
|
+
"writable": true,
|
|
7088
|
+
"signer": true
|
|
7089
|
+
},
|
|
7090
|
+
{
|
|
7091
|
+
"name": "vault",
|
|
7092
|
+
"writable": true
|
|
7093
|
+
},
|
|
7094
|
+
{
|
|
7095
|
+
"name": "vault_oracle"
|
|
7096
|
+
},
|
|
7097
|
+
{
|
|
7098
|
+
"name": "vault_tranche_state",
|
|
7099
|
+
"writable": true
|
|
7100
|
+
},
|
|
7101
|
+
{
|
|
7102
|
+
"name": "asset_mint"
|
|
7103
|
+
},
|
|
7104
|
+
{
|
|
7105
|
+
"name": "tranche_share_mint",
|
|
7106
|
+
"writable": true
|
|
7107
|
+
},
|
|
7108
|
+
{
|
|
7109
|
+
"name": "user_asset_ata",
|
|
7110
|
+
"writable": true,
|
|
7111
|
+
"pda": {
|
|
7112
|
+
"seeds": [
|
|
7113
|
+
{
|
|
7114
|
+
"kind": "account",
|
|
7115
|
+
"path": "user"
|
|
7116
|
+
},
|
|
7117
|
+
{
|
|
7118
|
+
"kind": "account",
|
|
7119
|
+
"path": "asset_token_program"
|
|
7120
|
+
},
|
|
7121
|
+
{
|
|
7122
|
+
"kind": "account",
|
|
7123
|
+
"path": "asset_mint"
|
|
7124
|
+
}
|
|
7125
|
+
],
|
|
7126
|
+
"program": {
|
|
7127
|
+
"kind": "const",
|
|
7128
|
+
"value": [
|
|
7129
|
+
140,
|
|
7130
|
+
151,
|
|
7131
|
+
37,
|
|
7132
|
+
143,
|
|
7133
|
+
78,
|
|
7134
|
+
36,
|
|
7135
|
+
137,
|
|
7136
|
+
241,
|
|
7137
|
+
187,
|
|
7138
|
+
61,
|
|
7139
|
+
16,
|
|
7140
|
+
41,
|
|
7141
|
+
20,
|
|
7142
|
+
142,
|
|
7143
|
+
13,
|
|
7144
|
+
131,
|
|
7145
|
+
11,
|
|
7146
|
+
90,
|
|
7147
|
+
19,
|
|
7148
|
+
153,
|
|
7149
|
+
218,
|
|
7150
|
+
255,
|
|
7151
|
+
16,
|
|
7152
|
+
132,
|
|
7153
|
+
4,
|
|
7154
|
+
142,
|
|
7155
|
+
123,
|
|
7156
|
+
216,
|
|
7157
|
+
219,
|
|
7158
|
+
233,
|
|
7159
|
+
248,
|
|
7160
|
+
89
|
|
7161
|
+
]
|
|
7162
|
+
}
|
|
7163
|
+
}
|
|
7164
|
+
},
|
|
7165
|
+
{
|
|
7166
|
+
"name": "vault_asset_ata",
|
|
7167
|
+
"writable": true,
|
|
7168
|
+
"pda": {
|
|
7169
|
+
"seeds": [
|
|
7170
|
+
{
|
|
7171
|
+
"kind": "account",
|
|
7172
|
+
"path": "vault"
|
|
7173
|
+
},
|
|
7174
|
+
{
|
|
7175
|
+
"kind": "account",
|
|
7176
|
+
"path": "asset_token_program"
|
|
7177
|
+
},
|
|
7178
|
+
{
|
|
7179
|
+
"kind": "account",
|
|
7180
|
+
"path": "asset_mint"
|
|
7181
|
+
}
|
|
7182
|
+
],
|
|
7183
|
+
"program": {
|
|
7184
|
+
"kind": "const",
|
|
7185
|
+
"value": [
|
|
7186
|
+
140,
|
|
7187
|
+
151,
|
|
7188
|
+
37,
|
|
7189
|
+
143,
|
|
7190
|
+
78,
|
|
7191
|
+
36,
|
|
7192
|
+
137,
|
|
7193
|
+
241,
|
|
7194
|
+
187,
|
|
7195
|
+
61,
|
|
7196
|
+
16,
|
|
7197
|
+
41,
|
|
7198
|
+
20,
|
|
7199
|
+
142,
|
|
7200
|
+
13,
|
|
7201
|
+
131,
|
|
7202
|
+
11,
|
|
7203
|
+
90,
|
|
7204
|
+
19,
|
|
7205
|
+
153,
|
|
7206
|
+
218,
|
|
7207
|
+
255,
|
|
7208
|
+
16,
|
|
7209
|
+
132,
|
|
7210
|
+
4,
|
|
7211
|
+
142,
|
|
7212
|
+
123,
|
|
7213
|
+
216,
|
|
7214
|
+
219,
|
|
7215
|
+
233,
|
|
7216
|
+
248,
|
|
7217
|
+
89
|
|
7218
|
+
]
|
|
7219
|
+
}
|
|
7220
|
+
}
|
|
7221
|
+
},
|
|
7222
|
+
{
|
|
7223
|
+
"name": "user_tranche_share_ata",
|
|
7224
|
+
"writable": true,
|
|
7225
|
+
"pda": {
|
|
7226
|
+
"seeds": [
|
|
7227
|
+
{
|
|
7228
|
+
"kind": "account",
|
|
7229
|
+
"path": "user"
|
|
7230
|
+
},
|
|
7231
|
+
{
|
|
7232
|
+
"kind": "account",
|
|
7233
|
+
"path": "share_token_program"
|
|
7234
|
+
},
|
|
7235
|
+
{
|
|
7236
|
+
"kind": "account",
|
|
7237
|
+
"path": "tranche_share_mint"
|
|
7238
|
+
}
|
|
7239
|
+
],
|
|
7240
|
+
"program": {
|
|
7241
|
+
"kind": "const",
|
|
7242
|
+
"value": [
|
|
7243
|
+
140,
|
|
7244
|
+
151,
|
|
7245
|
+
37,
|
|
7246
|
+
143,
|
|
7247
|
+
78,
|
|
7248
|
+
36,
|
|
7249
|
+
137,
|
|
7250
|
+
241,
|
|
7251
|
+
187,
|
|
7252
|
+
61,
|
|
7253
|
+
16,
|
|
7254
|
+
41,
|
|
7255
|
+
20,
|
|
7256
|
+
142,
|
|
7257
|
+
13,
|
|
7258
|
+
131,
|
|
7259
|
+
11,
|
|
7260
|
+
90,
|
|
7261
|
+
19,
|
|
7262
|
+
153,
|
|
7263
|
+
218,
|
|
7264
|
+
255,
|
|
7265
|
+
16,
|
|
7266
|
+
132,
|
|
7267
|
+
4,
|
|
7268
|
+
142,
|
|
7269
|
+
123,
|
|
7270
|
+
216,
|
|
7271
|
+
219,
|
|
7272
|
+
233,
|
|
7273
|
+
248,
|
|
7274
|
+
89
|
|
7275
|
+
]
|
|
7276
|
+
}
|
|
7277
|
+
}
|
|
7278
|
+
},
|
|
7279
|
+
{
|
|
7280
|
+
"name": "asset_token_program"
|
|
7281
|
+
},
|
|
7282
|
+
{
|
|
7283
|
+
"name": "share_token_program"
|
|
7284
|
+
},
|
|
7285
|
+
{
|
|
7286
|
+
"name": "associated_token_program",
|
|
7287
|
+
"address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
|
|
7288
|
+
},
|
|
7289
|
+
{
|
|
7290
|
+
"name": "system_program",
|
|
7291
|
+
"address": "11111111111111111111111111111111"
|
|
7292
|
+
}
|
|
7293
|
+
],
|
|
7294
|
+
"args": [
|
|
7295
|
+
{
|
|
7296
|
+
"name": "kind",
|
|
7297
|
+
"type": {
|
|
7298
|
+
"defined": {
|
|
7299
|
+
"name": "TrancheKind"
|
|
7300
|
+
}
|
|
7301
|
+
}
|
|
7302
|
+
},
|
|
7303
|
+
{
|
|
7304
|
+
"name": "share_amount",
|
|
7305
|
+
"type": "u64"
|
|
7306
|
+
},
|
|
7307
|
+
{
|
|
7308
|
+
"name": "external_withdraw_ix_refs",
|
|
7309
|
+
"type": {
|
|
7310
|
+
"option": {
|
|
7311
|
+
"defined": {
|
|
7312
|
+
"name": "InstructionRefs"
|
|
7313
|
+
}
|
|
7314
|
+
}
|
|
7315
|
+
}
|
|
7316
|
+
},
|
|
7317
|
+
{
|
|
7318
|
+
"name": "external_liquidity_source",
|
|
7319
|
+
"type": {
|
|
7320
|
+
"option": "u8"
|
|
7321
|
+
}
|
|
7322
|
+
},
|
|
7323
|
+
{
|
|
7324
|
+
"name": "signer_seeds",
|
|
7325
|
+
"type": {
|
|
7326
|
+
"vec": "bytes"
|
|
7327
|
+
}
|
|
7328
|
+
}
|
|
7329
|
+
]
|
|
7330
|
+
},
|
|
6810
7331
|
{
|
|
6811
7332
|
"name": "execute_withdraw",
|
|
6812
7333
|
"discriminator": [
|
|
@@ -19185,56 +19706,142 @@ var ExecuteTrancheDepositBuilder = class extends VaultBuilderBase {
|
|
|
19185
19706
|
// src/client/builders/executeTrancheWithdraw.ts
|
|
19186
19707
|
var import_core9 = require("@anchor-lang/core");
|
|
19187
19708
|
var import_spl_token10 = require("@solana/spl-token");
|
|
19709
|
+
var import_web312 = require("@solana/web3.js");
|
|
19710
|
+
var import_common27 = __toESM(require_dist());
|
|
19711
|
+
|
|
19712
|
+
// src/client/builders/externalLiquidity.ts
|
|
19713
|
+
var import_kit7 = require("@solana/kit");
|
|
19188
19714
|
var import_web311 = require("@solana/web3.js");
|
|
19189
19715
|
var import_common26 = __toESM(require_dist());
|
|
19716
|
+
var import_marginfi = __toESM(require_dist2());
|
|
19717
|
+
function parseMarginfiSlot(slot) {
|
|
19718
|
+
const data = slot?.data;
|
|
19719
|
+
if (!data || data.length < 40) return null;
|
|
19720
|
+
if (data[0] !== 1) return null;
|
|
19721
|
+
const pubkeyBytes = new Uint8Array(data.slice(8, 40));
|
|
19722
|
+
const userAccount = new import_web311.PublicKey(pubkeyBytes).toBase58();
|
|
19723
|
+
return { userAccount };
|
|
19724
|
+
}
|
|
19725
|
+
function toWeb3AccountMeta(account) {
|
|
19726
|
+
return {
|
|
19727
|
+
pubkey: new import_web311.PublicKey(account.address),
|
|
19728
|
+
isWritable: account.role === import_kit7.AccountRole.WRITABLE || account.role === import_kit7.AccountRole.WRITABLE_SIGNER,
|
|
19729
|
+
isSigner: account.role === import_kit7.AccountRole.READONLY_SIGNER || account.role === import_kit7.AccountRole.WRITABLE_SIGNER
|
|
19730
|
+
};
|
|
19731
|
+
}
|
|
19732
|
+
function resolveExternalWithdraw({
|
|
19733
|
+
externalLiquidity,
|
|
19734
|
+
vault,
|
|
19735
|
+
assetMint,
|
|
19736
|
+
vaultAssetAta,
|
|
19737
|
+
overrides
|
|
19738
|
+
}) {
|
|
19739
|
+
const externalWithdrawIxRefs = overrides?.externalWithdrawIxRefs ?? null;
|
|
19740
|
+
const externalLiquiditySource = overrides?.externalLiquiditySource ?? null;
|
|
19741
|
+
const externalWithdrawAccounts = overrides?.externalWithdrawAccounts ?? [];
|
|
19742
|
+
if (externalWithdrawIxRefs != null || externalLiquiditySource != null || overrides?.skipExternalLiquidity) {
|
|
19743
|
+
return {
|
|
19744
|
+
externalWithdrawIxRefs,
|
|
19745
|
+
externalLiquiditySource,
|
|
19746
|
+
externalWithdrawAccounts
|
|
19747
|
+
};
|
|
19748
|
+
}
|
|
19749
|
+
const slot0 = parseMarginfiSlot(externalLiquidity[0]);
|
|
19750
|
+
if (!slot0) {
|
|
19751
|
+
return {
|
|
19752
|
+
externalWithdrawIxRefs: null,
|
|
19753
|
+
externalLiquiditySource: null,
|
|
19754
|
+
externalWithdrawAccounts
|
|
19755
|
+
};
|
|
19756
|
+
}
|
|
19757
|
+
const marginfiAccounts = (0, import_marginfi.marginfiAccountsForMint)(assetMint);
|
|
19758
|
+
if (!marginfiAccounts) {
|
|
19759
|
+
return {
|
|
19760
|
+
externalWithdrawIxRefs: null,
|
|
19761
|
+
externalLiquiditySource: null,
|
|
19762
|
+
externalWithdrawAccounts
|
|
19763
|
+
};
|
|
19764
|
+
}
|
|
19765
|
+
const marginfiClient = new import_marginfi.CpiClient({ accounts: marginfiAccounts });
|
|
19766
|
+
const withdrawRefs = (0, import_common26.createCpiRefs)([
|
|
19767
|
+
marginfiClient.withdraw_cpi({
|
|
19768
|
+
marginfiAccount: slot0.userAccount,
|
|
19769
|
+
authority: vault,
|
|
19770
|
+
destinationTokenAccount: vaultAssetAta
|
|
19771
|
+
})
|
|
19772
|
+
]);
|
|
19773
|
+
return {
|
|
19774
|
+
externalWithdrawIxRefs: withdrawRefs.refs,
|
|
19775
|
+
externalLiquiditySource: 0,
|
|
19776
|
+
externalWithdrawAccounts: withdrawRefs.accounts
|
|
19777
|
+
};
|
|
19778
|
+
}
|
|
19779
|
+
|
|
19780
|
+
// src/client/builders/executeTrancheWithdraw.ts
|
|
19190
19781
|
var ExecuteTrancheWithdrawBuilder = class extends VaultBuilderBase {
|
|
19191
19782
|
getIxAccounts(args) {
|
|
19192
19783
|
return {
|
|
19193
|
-
user: (0,
|
|
19194
|
-
vault: (0,
|
|
19195
|
-
vaultOracle: (0,
|
|
19196
|
-
vaultTrancheState: (0,
|
|
19197
|
-
assetMint: (0,
|
|
19198
|
-
trancheShareMint: (0,
|
|
19199
|
-
userAssetAta: (0,
|
|
19200
|
-
vaultAssetAta: (0,
|
|
19201
|
-
userTrancheShareAta: (0,
|
|
19202
|
-
assetTokenProgram: (0,
|
|
19203
|
-
shareTokenProgram: (0,
|
|
19784
|
+
user: (0, import_common27.toWeb3Pk)(args.user),
|
|
19785
|
+
vault: (0, import_common27.toWeb3Pk)(args.vault),
|
|
19786
|
+
vaultOracle: (0, import_common27.toWeb3Pk)(args.vaultOracle),
|
|
19787
|
+
vaultTrancheState: (0, import_common27.toWeb3Pk)(args.vaultTrancheState),
|
|
19788
|
+
assetMint: (0, import_common27.toWeb3Pk)(args.assetMint),
|
|
19789
|
+
trancheShareMint: (0, import_common27.toWeb3Pk)(args.trancheShareMint),
|
|
19790
|
+
userAssetAta: (0, import_common27.toWeb3Pk)(args.userAssetAta),
|
|
19791
|
+
vaultAssetAta: (0, import_common27.toWeb3Pk)(args.vaultAssetAta),
|
|
19792
|
+
userTrancheShareAta: (0, import_common27.toWeb3Pk)(args.userTrancheShareAta),
|
|
19793
|
+
assetTokenProgram: (0, import_common27.toWeb3Pk)(args.assetTokenProgram),
|
|
19794
|
+
shareTokenProgram: (0, import_common27.toWeb3Pk)(args.shareTokenProgram),
|
|
19204
19795
|
associatedTokenProgram: import_spl_token10.ASSOCIATED_TOKEN_PROGRAM_ID,
|
|
19205
|
-
systemProgram:
|
|
19796
|
+
systemProgram: import_web312.SystemProgram.programId
|
|
19206
19797
|
};
|
|
19207
19798
|
}
|
|
19208
19799
|
getIxData(args) {
|
|
19209
19800
|
return {
|
|
19210
19801
|
kind: args.kind,
|
|
19211
19802
|
shareAmount: args.shareAmount,
|
|
19803
|
+
externalWithdrawIxRefs: args.externalWithdrawIxRefs ?? null,
|
|
19804
|
+
externalLiquiditySource: args.externalLiquiditySource ?? null,
|
|
19212
19805
|
addressSeeds: args.addressSeeds
|
|
19213
19806
|
};
|
|
19214
19807
|
}
|
|
19215
19808
|
async getIx(args) {
|
|
19216
19809
|
const data = this.getIxData(args);
|
|
19217
|
-
const
|
|
19810
|
+
const useExternal = data.externalWithdrawIxRefs != null || data.externalLiquiditySource != null;
|
|
19811
|
+
const anchorSeeds = data.addressSeeds?.map((seed) => Buffer.from(seed));
|
|
19812
|
+
const methods = anchorSeeds ? useExternal ? this.program.methods.executeTrancheWithdrawFromExternalFeeExempt(
|
|
19218
19813
|
data.kind,
|
|
19219
19814
|
data.shareAmount,
|
|
19220
|
-
data.
|
|
19815
|
+
data.externalWithdrawIxRefs,
|
|
19816
|
+
data.externalLiquiditySource,
|
|
19817
|
+
anchorSeeds
|
|
19818
|
+
) : this.program.methods.executeTrancheWithdrawFeeExempt(
|
|
19819
|
+
data.kind,
|
|
19820
|
+
data.shareAmount,
|
|
19821
|
+
anchorSeeds
|
|
19822
|
+
) : useExternal ? this.program.methods.executeTrancheWithdrawFromExternal(
|
|
19823
|
+
data.kind,
|
|
19824
|
+
data.shareAmount,
|
|
19825
|
+
data.externalWithdrawIxRefs,
|
|
19826
|
+
data.externalLiquiditySource
|
|
19221
19827
|
) : this.program.methods.executeTrancheWithdraw(
|
|
19222
19828
|
data.kind,
|
|
19223
19829
|
data.shareAmount
|
|
19224
19830
|
);
|
|
19225
19831
|
return methods.accountsPartial(
|
|
19226
19832
|
this.getIxAccounts(args)
|
|
19227
|
-
).instruction().then(
|
|
19833
|
+
).remainingAccounts(args.externalWithdrawAccounts.map(toWeb3AccountMeta)).instruction().then(import_common27.toKitInstruction);
|
|
19228
19834
|
}
|
|
19229
19835
|
async deriveIxArgs(txArgs) {
|
|
19230
19836
|
const connection = this.program.provider.connection;
|
|
19231
|
-
const [[vaultOracle], [vaultTrancheState], trancheShare] = await Promise.all([
|
|
19837
|
+
const [[vaultOracle], [vaultTrancheState], trancheShare, vaultData] = await Promise.all([
|
|
19232
19838
|
this.pda.deriveVaultOraclePda(txArgs.vault),
|
|
19233
19839
|
this.pda.deriveVaultTrancheStatePda(txArgs.vault),
|
|
19234
19840
|
resolveTrancheShare(this.account, txArgs.vault, txArgs.kind, {
|
|
19235
19841
|
mint: txArgs.trancheShareMint,
|
|
19236
19842
|
tokenProgram: txArgs.shareTokenProgram
|
|
19237
|
-
})
|
|
19843
|
+
}),
|
|
19844
|
+
this.account.fetchVault(txArgs.vault)
|
|
19238
19845
|
]);
|
|
19239
19846
|
const assetTokenProgram = await resolveHoldingTokenProgram(
|
|
19240
19847
|
this.account,
|
|
@@ -19244,6 +19851,23 @@ var ExecuteTrancheWithdrawBuilder = class extends VaultBuilderBase {
|
|
|
19244
19851
|
txArgs.assetTokenProgram
|
|
19245
19852
|
);
|
|
19246
19853
|
const { mint: trancheShareMint, tokenProgram: shareTokenProgram } = trancheShare;
|
|
19854
|
+
const vaultAssetAta = (0, import_common27.getAtaAddress)(
|
|
19855
|
+
txArgs.assetMint,
|
|
19856
|
+
txArgs.vault,
|
|
19857
|
+
assetTokenProgram,
|
|
19858
|
+
true
|
|
19859
|
+
);
|
|
19860
|
+
const {
|
|
19861
|
+
externalWithdrawIxRefs,
|
|
19862
|
+
externalLiquiditySource,
|
|
19863
|
+
externalWithdrawAccounts
|
|
19864
|
+
} = resolveExternalWithdraw({
|
|
19865
|
+
externalLiquidity: vaultData.externalLiquidity,
|
|
19866
|
+
vault: txArgs.vault,
|
|
19867
|
+
assetMint: txArgs.assetMint,
|
|
19868
|
+
vaultAssetAta,
|
|
19869
|
+
overrides: txArgs
|
|
19870
|
+
});
|
|
19247
19871
|
return {
|
|
19248
19872
|
user: txArgs.user,
|
|
19249
19873
|
vault: txArgs.vault,
|
|
@@ -19256,35 +19880,36 @@ var ExecuteTrancheWithdrawBuilder = class extends VaultBuilderBase {
|
|
|
19256
19880
|
addressSeeds: txArgs.addressSeeds,
|
|
19257
19881
|
assetTokenProgram,
|
|
19258
19882
|
shareTokenProgram,
|
|
19259
|
-
userAssetAta: (0,
|
|
19883
|
+
userAssetAta: (0, import_common27.getAtaAddress)(
|
|
19260
19884
|
txArgs.assetMint,
|
|
19261
19885
|
txArgs.user,
|
|
19262
19886
|
assetTokenProgram
|
|
19263
19887
|
),
|
|
19264
|
-
vaultAssetAta
|
|
19265
|
-
|
|
19266
|
-
txArgs.vault,
|
|
19267
|
-
assetTokenProgram,
|
|
19268
|
-
true
|
|
19269
|
-
),
|
|
19270
|
-
userTrancheShareAta: (0, import_common26.getAtaAddress)(
|
|
19888
|
+
vaultAssetAta,
|
|
19889
|
+
userTrancheShareAta: (0, import_common27.getAtaAddress)(
|
|
19271
19890
|
trancheShareMint,
|
|
19272
19891
|
txArgs.user,
|
|
19273
19892
|
shareTokenProgram
|
|
19274
|
-
)
|
|
19893
|
+
),
|
|
19894
|
+
externalWithdrawIxRefs,
|
|
19895
|
+
externalLiquiditySource,
|
|
19896
|
+
externalWithdrawAccounts
|
|
19275
19897
|
};
|
|
19276
19898
|
}
|
|
19899
|
+
async buildLookupTables(_args, txArgs) {
|
|
19900
|
+
return txArgs.lookupTables;
|
|
19901
|
+
}
|
|
19277
19902
|
async buildPreambleInstructions(args) {
|
|
19278
|
-
const payer = (0,
|
|
19903
|
+
const payer = (0, import_common27.toWeb3Pk)(args.user);
|
|
19279
19904
|
const createUserAssetAta = (0, import_spl_token10.createAssociatedTokenAccountIdempotentInstruction)(
|
|
19280
19905
|
payer,
|
|
19281
|
-
(0,
|
|
19906
|
+
(0, import_common27.toWeb3Pk)(args.userAssetAta),
|
|
19282
19907
|
payer,
|
|
19283
|
-
(0,
|
|
19284
|
-
(0,
|
|
19908
|
+
(0, import_common27.toWeb3Pk)(args.assetMint),
|
|
19909
|
+
(0, import_common27.toWeb3Pk)(args.assetTokenProgram),
|
|
19285
19910
|
import_spl_token10.ASSOCIATED_TOKEN_PROGRAM_ID
|
|
19286
19911
|
);
|
|
19287
|
-
return [createUserAssetAta].map(
|
|
19912
|
+
return [createUserAssetAta].map(import_common27.toKitInstruction);
|
|
19288
19913
|
}
|
|
19289
19914
|
async buildPlanExtras(args) {
|
|
19290
19915
|
return {
|
|
@@ -19293,92 +19918,12 @@ var ExecuteTrancheWithdrawBuilder = class extends VaultBuilderBase {
|
|
|
19293
19918
|
]
|
|
19294
19919
|
};
|
|
19295
19920
|
}
|
|
19296
|
-
async getTx(txArgs) {
|
|
19297
|
-
const args = await this.deriveIxArgs(txArgs);
|
|
19298
|
-
const preambleInstructions = await this.buildPreambleInstructions(args);
|
|
19299
|
-
const instruction = await this.getIx(args);
|
|
19300
|
-
const extras = await this.buildPlanExtras(args);
|
|
19301
|
-
return {
|
|
19302
|
-
instructions: [...preambleInstructions, instruction],
|
|
19303
|
-
...extras ?? {}
|
|
19304
|
-
};
|
|
19305
|
-
}
|
|
19306
19921
|
};
|
|
19307
19922
|
|
|
19308
19923
|
// src/client/builders/executeWithdraw.ts
|
|
19309
19924
|
var import_core10 = require("@anchor-lang/core");
|
|
19310
19925
|
var import_spl_token11 = require("@solana/spl-token");
|
|
19311
19926
|
var import_common28 = __toESM(require_dist());
|
|
19312
|
-
|
|
19313
|
-
// src/client/builders/externalLiquidity.ts
|
|
19314
|
-
var import_kit7 = require("@solana/kit");
|
|
19315
|
-
var import_web312 = require("@solana/web3.js");
|
|
19316
|
-
var import_common27 = __toESM(require_dist());
|
|
19317
|
-
var import_marginfi = __toESM(require_dist2());
|
|
19318
|
-
function parseMarginfiSlot(slot) {
|
|
19319
|
-
const data = slot?.data;
|
|
19320
|
-
if (!data || data.length < 40) return null;
|
|
19321
|
-
if (data[0] !== 1) return null;
|
|
19322
|
-
const pubkeyBytes = new Uint8Array(data.slice(8, 40));
|
|
19323
|
-
const userAccount = new import_web312.PublicKey(pubkeyBytes).toBase58();
|
|
19324
|
-
return { userAccount };
|
|
19325
|
-
}
|
|
19326
|
-
function toWeb3AccountMeta(account) {
|
|
19327
|
-
return {
|
|
19328
|
-
pubkey: new import_web312.PublicKey(account.address),
|
|
19329
|
-
isWritable: account.role === import_kit7.AccountRole.WRITABLE || account.role === import_kit7.AccountRole.WRITABLE_SIGNER,
|
|
19330
|
-
isSigner: account.role === import_kit7.AccountRole.READONLY_SIGNER || account.role === import_kit7.AccountRole.WRITABLE_SIGNER
|
|
19331
|
-
};
|
|
19332
|
-
}
|
|
19333
|
-
function resolveExternalWithdraw({
|
|
19334
|
-
externalLiquidity,
|
|
19335
|
-
vault,
|
|
19336
|
-
assetMint,
|
|
19337
|
-
vaultAssetAta,
|
|
19338
|
-
overrides
|
|
19339
|
-
}) {
|
|
19340
|
-
const externalWithdrawIxRefs = overrides?.externalWithdrawIxRefs ?? null;
|
|
19341
|
-
const externalLiquiditySource = overrides?.externalLiquiditySource ?? null;
|
|
19342
|
-
const externalWithdrawAccounts = overrides?.externalWithdrawAccounts ?? [];
|
|
19343
|
-
if (externalWithdrawIxRefs != null || externalLiquiditySource != null || overrides?.skipExternalLiquidity) {
|
|
19344
|
-
return {
|
|
19345
|
-
externalWithdrawIxRefs,
|
|
19346
|
-
externalLiquiditySource,
|
|
19347
|
-
externalWithdrawAccounts
|
|
19348
|
-
};
|
|
19349
|
-
}
|
|
19350
|
-
const slot0 = parseMarginfiSlot(externalLiquidity[0]);
|
|
19351
|
-
if (!slot0) {
|
|
19352
|
-
return {
|
|
19353
|
-
externalWithdrawIxRefs: null,
|
|
19354
|
-
externalLiquiditySource: null,
|
|
19355
|
-
externalWithdrawAccounts
|
|
19356
|
-
};
|
|
19357
|
-
}
|
|
19358
|
-
const marginfiAccounts = (0, import_marginfi.marginfiAccountsForMint)(assetMint);
|
|
19359
|
-
if (!marginfiAccounts) {
|
|
19360
|
-
return {
|
|
19361
|
-
externalWithdrawIxRefs: null,
|
|
19362
|
-
externalLiquiditySource: null,
|
|
19363
|
-
externalWithdrawAccounts
|
|
19364
|
-
};
|
|
19365
|
-
}
|
|
19366
|
-
const marginfiClient = new import_marginfi.CpiClient({ accounts: marginfiAccounts });
|
|
19367
|
-
const withdrawRefs = (0, import_common27.createCpiRefs)([
|
|
19368
|
-
marginfiClient.withdraw_cpi({
|
|
19369
|
-
marginfiAccount: slot0.userAccount,
|
|
19370
|
-
authority: vault,
|
|
19371
|
-
destinationTokenAccount: vaultAssetAta
|
|
19372
|
-
})
|
|
19373
|
-
]);
|
|
19374
|
-
return {
|
|
19375
|
-
externalWithdrawIxRefs: withdrawRefs.refs,
|
|
19376
|
-
externalLiquiditySource: 0,
|
|
19377
|
-
externalWithdrawAccounts: withdrawRefs.accounts
|
|
19378
|
-
};
|
|
19379
|
-
}
|
|
19380
|
-
|
|
19381
|
-
// src/client/builders/executeWithdraw.ts
|
|
19382
19927
|
var ExecuteWithdrawBuilder = class extends VaultBuilderBase {
|
|
19383
19928
|
getIxAccounts(args) {
|
|
19384
19929
|
return {
|
|
@@ -19787,10 +20332,13 @@ var ManagerRedepositAssetBuilder = class extends VaultBuilderBase {
|
|
|
19787
20332
|
assetTokenProgram,
|
|
19788
20333
|
true
|
|
19789
20334
|
),
|
|
20335
|
+
// The manager may be a PDA (e.g. a Squads vault), so allow off-curve
|
|
20336
|
+
// owners when deriving its ATA.
|
|
19790
20337
|
managerAssetAta: (0, import_common31.getAtaAddress)(
|
|
19791
20338
|
txArgs.assetMint,
|
|
19792
20339
|
txArgs.manager,
|
|
19793
|
-
assetTokenProgram
|
|
20340
|
+
assetTokenProgram,
|
|
20341
|
+
true
|
|
19794
20342
|
)
|
|
19795
20343
|
};
|
|
19796
20344
|
}
|
|
@@ -22759,9 +23307,9 @@ async function fetchExternalPositions(deps, target, manager, vaultState, log = (
|
|
|
22759
23307
|
return reconcilePositionSnapshots(snapshots, target.vault, log);
|
|
22760
23308
|
}
|
|
22761
23309
|
function reconcilePositionSnapshots(snapshots, vault, log) {
|
|
22762
|
-
const
|
|
23310
|
+
const mints2 = new Set(snapshots.flatMap((snapshot2) => [...snapshot2.keys()]));
|
|
22763
23311
|
const reconciled = /* @__PURE__ */ new Map();
|
|
22764
|
-
for (const mint of
|
|
23312
|
+
for (const mint of mints2) {
|
|
22765
23313
|
const readings = snapshots.map((snapshot2) => snapshot2.get(mint) ?? 0n);
|
|
22766
23314
|
let amount;
|
|
22767
23315
|
try {
|
|
@@ -23007,8 +23555,8 @@ var JupiterPriceSource = class {
|
|
|
23007
23555
|
constructor(opts = {}) {
|
|
23008
23556
|
this.opts = opts;
|
|
23009
23557
|
}
|
|
23010
|
-
async fetchUsdPrices(
|
|
23011
|
-
return (0, import_jupiter.fetchJupiterUsdPrices)(
|
|
23558
|
+
async fetchUsdPrices(mints2) {
|
|
23559
|
+
return (0, import_jupiter.fetchJupiterUsdPrices)(mints2, this.opts);
|
|
23012
23560
|
}
|
|
23013
23561
|
};
|
|
23014
23562
|
|
|
@@ -23029,8 +23577,8 @@ var NestPriceSource = class {
|
|
|
23029
23577
|
this.nestVaultSlug = opts.nestVaultSlug ?? NEST_VAULT_SLUG;
|
|
23030
23578
|
this.options = { baseUrl: opts.baseUrl, fetchFn: opts.fetchFn };
|
|
23031
23579
|
}
|
|
23032
|
-
async fetchUsdPrices(
|
|
23033
|
-
if (!
|
|
23580
|
+
async fetchUsdPrices(mints2) {
|
|
23581
|
+
if (!mints2.some((mint) => mint.toString() === this.shareMint.toString())) {
|
|
23034
23582
|
return {};
|
|
23035
23583
|
}
|
|
23036
23584
|
return {
|
|
@@ -23048,9 +23596,9 @@ var LivePriceSource = class {
|
|
|
23048
23596
|
this.jupiter = opts.jupiter ?? new JupiterPriceSource();
|
|
23049
23597
|
this.nest = opts.nest ?? new NestPriceSource();
|
|
23050
23598
|
}
|
|
23051
|
-
async fetchUsdPrices(
|
|
23599
|
+
async fetchUsdPrices(mints2) {
|
|
23052
23600
|
const unique = [
|
|
23053
|
-
...new Map(
|
|
23601
|
+
...new Map(mints2.map((mint) => [mint.toString(), mint])).values()
|
|
23054
23602
|
];
|
|
23055
23603
|
const nestMint = this.nest.shareMint.toString();
|
|
23056
23604
|
const jupiterMints = unique.filter((mint) => mint.toString() !== nestMint);
|
|
@@ -24361,6 +24909,9 @@ var IdleLiquidityService = class {
|
|
|
24361
24909
|
return { signature };
|
|
24362
24910
|
}
|
|
24363
24911
|
};
|
|
24912
|
+
|
|
24913
|
+
// src/index.ts
|
|
24914
|
+
var import_common52 = __toESM(require_dist());
|
|
24364
24915
|
// Annotate the CommonJS export names for ESM import in node:
|
|
24365
24916
|
0 && (module.exports = {
|
|
24366
24917
|
ASSET_DECIMALS,
|
|
@@ -24381,6 +24932,7 @@ var IdleLiquidityService = class {
|
|
|
24381
24932
|
DEFAULT_JUNIOR_WITHDRAWAL_LOCKUP_SECS,
|
|
24382
24933
|
DEFAULT_MAX_ACCEPTABLE_APY_BPS,
|
|
24383
24934
|
DEFAULT_MAX_ACCOUNTS,
|
|
24935
|
+
DEFAULT_MINTS,
|
|
24384
24936
|
DEFAULT_MIN_AMOUNT_UI,
|
|
24385
24937
|
DEFAULT_ORACLE_STALENESS_THRESHOLD_SECS,
|
|
24386
24938
|
DEFAULT_PRICE_ORACLE_ACCOUNT,
|
|
@@ -24420,6 +24972,7 @@ var IdleLiquidityService = class {
|
|
|
24420
24972
|
ManagerRedepositAssetBuilder,
|
|
24421
24973
|
ManagerWithdrawAssetBuilder,
|
|
24422
24974
|
MarginfiPositionProvider,
|
|
24975
|
+
MintRegistry,
|
|
24423
24976
|
MockYieldTracker,
|
|
24424
24977
|
NEST_API_BASE_URL,
|
|
24425
24978
|
NEST_RWA_SHARE_MINT,
|
|
@@ -24516,6 +25069,7 @@ var IdleLiquidityService = class {
|
|
|
24516
25069
|
logProspectiveApy,
|
|
24517
25070
|
makeProvider,
|
|
24518
25071
|
mintTokensTo,
|
|
25072
|
+
mints,
|
|
24519
25073
|
mostFrequent,
|
|
24520
25074
|
parseExternalLiquidityRefs,
|
|
24521
25075
|
planRebalance,
|