@0dotxyz/p0-ts-sdk 2.3.0-alpha.1 → 2.3.0-alpha.3
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-BDDVBMdM.d.cts +48 -0
- package/dist/index-BDDVBMdM.d.ts +48 -0
- package/dist/index.cjs +7651 -128
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +96 -34
- package/dist/index.d.ts +96 -34
- package/dist/index.js +7651 -128
- package/dist/index.js.map +1 -1
- package/dist/vendor.cjs +296 -9
- package/dist/vendor.cjs.map +1 -1
- package/dist/vendor.d.cts +1578 -1193
- package/dist/vendor.d.ts +1578 -1193
- package/dist/vendor.js +282 -8
- package/dist/vendor.js.map +1 -1
- package/package.json +1 -1
- package/dist/merge.types-BS8s5Ck0.d.cts +0 -137
- package/dist/merge.types-BS8s5Ck0.d.ts +0 -137
package/dist/vendor.js
CHANGED
|
@@ -32490,13 +32490,31 @@ function deserializeTitanWireInstruction(ix) {
|
|
|
32490
32490
|
});
|
|
32491
32491
|
}
|
|
32492
32492
|
var EXPONENT_CORE_PROGRAM_ID = new PublicKey(
|
|
32493
|
-
"
|
|
32493
|
+
"ExponentnaRg3CQbW6dqQNZKXp7gtZ9DGMp1cwC4HAS7"
|
|
32494
32494
|
);
|
|
32495
|
-
var
|
|
32495
|
+
var EXPONENT_CLMM_PROGRAM_ID = new PublicKey(
|
|
32496
32496
|
"XPC1MM4dYACDfykNuXYZ5una2DsMDWL24CrYubCvarC"
|
|
32497
32497
|
);
|
|
32498
|
-
var
|
|
32499
|
-
"
|
|
32498
|
+
var EXPONENT_ORDERBOOK_PROGRAM_ID = new PublicKey(
|
|
32499
|
+
"XPBookgQTN2p8Yw1C2La35XkPMmZTCEYH77AdReVvK1"
|
|
32500
|
+
);
|
|
32501
|
+
var EXPONENT_VAULTS_PROGRAM_ID = new PublicKey(
|
|
32502
|
+
"sVau1tXvayVWfotzm9Ahcv2qfnnfRWttt78BCnNC6dD"
|
|
32503
|
+
);
|
|
32504
|
+
var EXPONENT_GENERIC_SY_PROGRAM_ID = new PublicKey(
|
|
32505
|
+
"XP1BRLn8eCYSygrd8er5P4GKdzqKbC3DLoSsS5UYVZy"
|
|
32506
|
+
);
|
|
32507
|
+
var EXPONENT_MARGINFI_SY_PROGRAM_ID = new PublicKey(
|
|
32508
|
+
"XPMfipyhcbq3DBvgvxkbZY7GekwmGNJLMD3wdiCkBc7"
|
|
32509
|
+
);
|
|
32510
|
+
var EXPONENT_KAMINO_SY_PROGRAM_ID = new PublicKey(
|
|
32511
|
+
"XPK1ndTK1xrgRg99ifvdPP1exrx8D1mRXTuxBkkroCx"
|
|
32512
|
+
);
|
|
32513
|
+
var EXPONENT_JITO_RESTAKING_SY_PROGRAM_ID = new PublicKey(
|
|
32514
|
+
"XPJitopeUEhMZVF72CvswnwrS2U2akQvk5s26aEfWv2"
|
|
32515
|
+
);
|
|
32516
|
+
var EXPONENT_PERENA_SY_PROGRAM_ID = new PublicKey(
|
|
32517
|
+
"XPerenaJPyvnjseLCn7rgzxFEum6zX1k89C13SPTyGZ"
|
|
32500
32518
|
);
|
|
32501
32519
|
var EXPONENT_EVENT_AUTHORITY_SEED = "__event_authority";
|
|
32502
32520
|
|
|
@@ -39719,6 +39737,8 @@ function pk(v) {
|
|
|
39719
39737
|
function decodeExponentVault(data) {
|
|
39720
39738
|
const d = EXPONENT_ACCOUNTS_CODER.decode("Vault", data);
|
|
39721
39739
|
const get = (snake, camel) => d[snake] ?? d[camel];
|
|
39740
|
+
const u646 = (v) => BigInt(BN2.isBN(v) ? v.toString() : String(v ?? 0));
|
|
39741
|
+
const cpi = get("cpi_accounts", "cpiAccounts") ?? {};
|
|
39722
39742
|
return {
|
|
39723
39743
|
authority: pk(get("authority", "authority")),
|
|
39724
39744
|
syProgram: pk(get("sy_program", "syProgram")),
|
|
@@ -39728,6 +39748,16 @@ function decodeExponentVault(data) {
|
|
|
39728
39748
|
escrowSy: pk(get("escrow_sy", "escrowSy")),
|
|
39729
39749
|
yieldPosition: pk(get("yield_position", "yieldPosition")),
|
|
39730
39750
|
addressLookupTable: pk(get("address_lookup_table", "addressLookupTable")),
|
|
39751
|
+
cpiAccounts: {
|
|
39752
|
+
getSyState: decodeCpiContexts(cpi.get_sy_state ?? cpi.getSyState),
|
|
39753
|
+
depositSy: decodeCpiContexts(cpi.deposit_sy ?? cpi.depositSy),
|
|
39754
|
+
withdrawSy: decodeCpiContexts(cpi.withdraw_sy ?? cpi.withdrawSy)
|
|
39755
|
+
},
|
|
39756
|
+
syForPt: u646(get("sy_for_pt", "syForPt")),
|
|
39757
|
+
ptSupply: u646(get("pt_supply", "ptSupply")),
|
|
39758
|
+
lastSeenSyExchangeRate: exponentNumberToBigNumber(
|
|
39759
|
+
get("last_seen_sy_exchange_rate", "lastSeenSyExchangeRate")
|
|
39760
|
+
),
|
|
39731
39761
|
finalSyExchangeRate: exponentNumberToBigNumber(
|
|
39732
39762
|
get("final_sy_exchange_rate", "finalSyExchangeRate")
|
|
39733
39763
|
),
|
|
@@ -39738,6 +39768,44 @@ function decodeExponentMarketVault(data) {
|
|
|
39738
39768
|
const d = EXPONENT_ACCOUNTS_CODER.decode("MarketTwo", data);
|
|
39739
39769
|
return pk(d.vault);
|
|
39740
39770
|
}
|
|
39771
|
+
function decodeCpiContexts(raw) {
|
|
39772
|
+
if (!Array.isArray(raw)) return [];
|
|
39773
|
+
return raw.map((c) => {
|
|
39774
|
+
const o = c ?? {};
|
|
39775
|
+
return {
|
|
39776
|
+
altIndex: Number(o.alt_index ?? o.altIndex ?? 0),
|
|
39777
|
+
isSigner: Boolean(o.is_signer ?? o.isSigner ?? false),
|
|
39778
|
+
isWritable: Boolean(o.is_writable ?? o.isWritable ?? false)
|
|
39779
|
+
};
|
|
39780
|
+
});
|
|
39781
|
+
}
|
|
39782
|
+
function decodeExponentMarketTwo(data) {
|
|
39783
|
+
const d = EXPONENT_ACCOUNTS_CODER.decode("MarketTwo", data);
|
|
39784
|
+
const get = (snake, camel) => d[snake] ?? d[camel];
|
|
39785
|
+
const cpi = get("cpi_accounts", "cpiAccounts") ?? {};
|
|
39786
|
+
return {
|
|
39787
|
+
selfAddress: pk(get("self_address", "selfAddress")),
|
|
39788
|
+
mintPt: pk(get("mint_pt", "mintPt")),
|
|
39789
|
+
mintSy: pk(get("mint_sy", "mintSy")),
|
|
39790
|
+
vault: pk(get("vault", "vault")),
|
|
39791
|
+
tokenPtEscrow: pk(get("token_pt_escrow", "tokenPtEscrow")),
|
|
39792
|
+
tokenSyEscrow: pk(get("token_sy_escrow", "tokenSyEscrow")),
|
|
39793
|
+
tokenFeeTreasurySy: pk(get("token_fee_treasury_sy", "tokenFeeTreasurySy")),
|
|
39794
|
+
addressLookupTable: pk(get("address_lookup_table", "addressLookupTable")),
|
|
39795
|
+
syProgram: pk(get("sy_program", "syProgram")),
|
|
39796
|
+
statusFlags: Number(get("status_flags", "statusFlags") ?? 0),
|
|
39797
|
+
cpiAccounts: {
|
|
39798
|
+
getSyState: decodeCpiContexts(cpi.get_sy_state ?? cpi.getSyState),
|
|
39799
|
+
depositSy: decodeCpiContexts(cpi.deposit_sy ?? cpi.depositSy),
|
|
39800
|
+
withdrawSy: decodeCpiContexts(cpi.withdraw_sy ?? cpi.withdrawSy)
|
|
39801
|
+
}
|
|
39802
|
+
};
|
|
39803
|
+
}
|
|
39804
|
+
async function fetchExponentMarketTwo(connection, market) {
|
|
39805
|
+
const info = await connection.getAccountInfo(market);
|
|
39806
|
+
if (!info) throw new Error(`Exponent market account not found: ${market.toBase58()}`);
|
|
39807
|
+
return decodeExponentMarketTwo(info.data);
|
|
39808
|
+
}
|
|
39741
39809
|
async function fetchExponentVault(connection, vault) {
|
|
39742
39810
|
const info = await connection.getAccountInfo(vault);
|
|
39743
39811
|
if (!info) throw new Error(`Exponent vault account not found: ${vault.toBase58()}`);
|
|
@@ -39760,6 +39828,17 @@ function deriveExponentEventAuthority() {
|
|
|
39760
39828
|
EXPONENT_CORE_PROGRAM_ID
|
|
39761
39829
|
)[0];
|
|
39762
39830
|
}
|
|
39831
|
+
function resolveCpiMetas(contexts, altAddresses, altKey) {
|
|
39832
|
+
return contexts.map((ctx) => {
|
|
39833
|
+
const pubkey = altAddresses[ctx.altIndex];
|
|
39834
|
+
if (!pubkey) {
|
|
39835
|
+
throw new Error(
|
|
39836
|
+
`Exponent CPI account alt_index ${ctx.altIndex} out of range (ALT ${altKey.toBase58()} has ${altAddresses.length} entries)`
|
|
39837
|
+
);
|
|
39838
|
+
}
|
|
39839
|
+
return { pubkey, isSigner: false, isWritable: ctx.isWritable };
|
|
39840
|
+
});
|
|
39841
|
+
}
|
|
39763
39842
|
async function resolveExponentMergeContext(params) {
|
|
39764
39843
|
const { connection, owner } = params;
|
|
39765
39844
|
const ptYtTokenProgram = params.ptYtTokenProgram ?? TOKEN_PROGRAM_ID;
|
|
@@ -39779,6 +39858,17 @@ async function resolveExponentMergeContext(params) {
|
|
|
39779
39858
|
const ptSrcAta = getAssociatedTokenAddressSync(vault.mintPt, owner, true, ptYtTokenProgram);
|
|
39780
39859
|
const ytSrcAta = getAssociatedTokenAddressSync(vault.mintYt, owner, true, ptYtTokenProgram);
|
|
39781
39860
|
const sySrcDstAta = getAssociatedTokenAddressSync(vault.mintSy, owner, true, syTokenProgram);
|
|
39861
|
+
const altResult = await connection.getAddressLookupTable(vault.addressLookupTable);
|
|
39862
|
+
const alt = altResult.value;
|
|
39863
|
+
if (!alt) {
|
|
39864
|
+
throw new Error(
|
|
39865
|
+
`Exponent vault address lookup table not found: ${vault.addressLookupTable.toBase58()}`
|
|
39866
|
+
);
|
|
39867
|
+
}
|
|
39868
|
+
const remainingAccounts = [
|
|
39869
|
+
...resolveCpiMetas(vault.cpiAccounts.getSyState, alt.state.addresses, vault.addressLookupTable),
|
|
39870
|
+
...resolveCpiMetas(vault.cpiAccounts.withdrawSy, alt.state.addresses, vault.addressLookupTable)
|
|
39871
|
+
];
|
|
39782
39872
|
const mergeAccounts = {
|
|
39783
39873
|
owner,
|
|
39784
39874
|
authority: vault.authority,
|
|
@@ -39792,20 +39882,137 @@ async function resolveExponentMergeContext(params) {
|
|
|
39792
39882
|
syProgram: vault.syProgram,
|
|
39793
39883
|
addressLookupTable: vault.addressLookupTable,
|
|
39794
39884
|
yieldPosition: vault.yieldPosition,
|
|
39795
|
-
tokenProgram: ptYtTokenProgram
|
|
39885
|
+
tokenProgram: ptYtTokenProgram,
|
|
39886
|
+
remainingAccounts
|
|
39796
39887
|
};
|
|
39797
39888
|
const decimals = await getMintDecimals(connection, vault.mintSy);
|
|
39798
39889
|
return {
|
|
39799
39890
|
vaultAddress,
|
|
39800
39891
|
vault,
|
|
39801
39892
|
mergeAccounts,
|
|
39893
|
+
addressLookupTable: alt,
|
|
39802
39894
|
underlying: { mint: vault.mintSy, decimals, tokenProgram: syTokenProgram },
|
|
39803
39895
|
computeRedeemedAmountNative(ptAmountNative) {
|
|
39804
|
-
|
|
39896
|
+
if (vault.ptSupply === 0n) return 0n;
|
|
39897
|
+
const sy = new BigNumber(ptAmountNative.toString()).times(vault.syForPt.toString()).div(vault.ptSupply.toString()).integerValue(BigNumber.ROUND_FLOOR);
|
|
39805
39898
|
return BigInt(sy.toFixed(0));
|
|
39806
39899
|
}
|
|
39807
39900
|
};
|
|
39808
39901
|
}
|
|
39902
|
+
async function resolveExponentTradePtContext(params) {
|
|
39903
|
+
const { connection, owner } = params;
|
|
39904
|
+
const ptTokenProgram = params.ptTokenProgram ?? TOKEN_PROGRAM_ID;
|
|
39905
|
+
const syTokenProgram = params.syTokenProgram ?? TOKEN_PROGRAM_ID;
|
|
39906
|
+
const market = await fetchExponentMarketTwo(connection, params.market);
|
|
39907
|
+
const altResult = await connection.getAddressLookupTable(market.addressLookupTable);
|
|
39908
|
+
const alt = altResult.value;
|
|
39909
|
+
if (!alt) {
|
|
39910
|
+
throw new Error(
|
|
39911
|
+
`Exponent market address lookup table not found: ${market.addressLookupTable.toBase58()}`
|
|
39912
|
+
);
|
|
39913
|
+
}
|
|
39914
|
+
const altAddresses = alt.state.addresses;
|
|
39915
|
+
const altKey = market.addressLookupTable;
|
|
39916
|
+
const remainingAccounts = [
|
|
39917
|
+
...resolveCpiMetas(market.cpiAccounts.getSyState, altAddresses, altKey),
|
|
39918
|
+
...resolveCpiMetas(market.cpiAccounts.depositSy, altAddresses, altKey),
|
|
39919
|
+
...resolveCpiMetas(market.cpiAccounts.withdrawSy, altAddresses, altKey)
|
|
39920
|
+
];
|
|
39921
|
+
const tokenSyTrader = getAssociatedTokenAddressSync(market.mintSy, owner, true, syTokenProgram);
|
|
39922
|
+
const tokenPtTrader = getAssociatedTokenAddressSync(market.mintPt, owner, true, ptTokenProgram);
|
|
39923
|
+
const tradePtAccounts = {
|
|
39924
|
+
trader: owner,
|
|
39925
|
+
market: market.selfAddress,
|
|
39926
|
+
tokenSyTrader,
|
|
39927
|
+
tokenPtTrader,
|
|
39928
|
+
tokenSyEscrow: market.tokenSyEscrow,
|
|
39929
|
+
tokenPtEscrow: market.tokenPtEscrow,
|
|
39930
|
+
addressLookupTable: market.addressLookupTable,
|
|
39931
|
+
syProgram: market.syProgram,
|
|
39932
|
+
tokenFeeTreasurySy: market.tokenFeeTreasurySy,
|
|
39933
|
+
tokenProgram: ptTokenProgram,
|
|
39934
|
+
remainingAccounts
|
|
39935
|
+
};
|
|
39936
|
+
const [syDecimals, ptDecimals] = await Promise.all([
|
|
39937
|
+
getMintDecimals(connection, market.mintSy),
|
|
39938
|
+
getMintDecimals(connection, market.mintPt)
|
|
39939
|
+
]);
|
|
39940
|
+
return {
|
|
39941
|
+
marketAddress: market.selfAddress,
|
|
39942
|
+
market,
|
|
39943
|
+
tradePtAccounts,
|
|
39944
|
+
addressLookupTable: alt,
|
|
39945
|
+
sy: { mint: market.mintSy, decimals: syDecimals, tokenProgram: syTokenProgram },
|
|
39946
|
+
pt: { mint: market.mintPt, decimals: ptDecimals, tokenProgram: ptTokenProgram }
|
|
39947
|
+
};
|
|
39948
|
+
}
|
|
39949
|
+
async function resolveExponentStripContext(params) {
|
|
39950
|
+
const { connection, owner } = params;
|
|
39951
|
+
const ptYtTokenProgram = params.ptYtTokenProgram ?? TOKEN_PROGRAM_ID;
|
|
39952
|
+
const syTokenProgram = params.syTokenProgram ?? TOKEN_PROGRAM_ID;
|
|
39953
|
+
let vaultAddress;
|
|
39954
|
+
let vault;
|
|
39955
|
+
if (params.vault) {
|
|
39956
|
+
vaultAddress = params.vault;
|
|
39957
|
+
vault = await fetchExponentVault(connection, vaultAddress);
|
|
39958
|
+
} else if (params.market) {
|
|
39959
|
+
const res = await fetchExponentVaultFromMarket(connection, params.market);
|
|
39960
|
+
vaultAddress = res.vault;
|
|
39961
|
+
vault = res.account;
|
|
39962
|
+
} else {
|
|
39963
|
+
throw new Error("resolveExponentStripContext: one of `vault` or `market` is required");
|
|
39964
|
+
}
|
|
39965
|
+
const altResult = await connection.getAddressLookupTable(vault.addressLookupTable);
|
|
39966
|
+
const alt = altResult.value;
|
|
39967
|
+
if (!alt) {
|
|
39968
|
+
throw new Error(
|
|
39969
|
+
`Exponent vault address lookup table not found: ${vault.addressLookupTable.toBase58()}`
|
|
39970
|
+
);
|
|
39971
|
+
}
|
|
39972
|
+
const remainingAccounts = resolveCpiMetas(
|
|
39973
|
+
vault.cpiAccounts.depositSy,
|
|
39974
|
+
alt.state.addresses,
|
|
39975
|
+
vault.addressLookupTable
|
|
39976
|
+
);
|
|
39977
|
+
const sySrc = getAssociatedTokenAddressSync(vault.mintSy, owner, true, syTokenProgram);
|
|
39978
|
+
const ptDst = getAssociatedTokenAddressSync(vault.mintPt, owner, true, ptYtTokenProgram);
|
|
39979
|
+
const ytDst = getAssociatedTokenAddressSync(vault.mintYt, owner, true, ptYtTokenProgram);
|
|
39980
|
+
const stripAccounts = {
|
|
39981
|
+
depositor: owner,
|
|
39982
|
+
authority: vault.authority,
|
|
39983
|
+
vault: vaultAddress,
|
|
39984
|
+
sySrc,
|
|
39985
|
+
escrowSy: vault.escrowSy,
|
|
39986
|
+
ytDst,
|
|
39987
|
+
ptDst,
|
|
39988
|
+
mintYt: vault.mintYt,
|
|
39989
|
+
mintPt: vault.mintPt,
|
|
39990
|
+
syProgram: vault.syProgram,
|
|
39991
|
+
addressLookupTable: vault.addressLookupTable,
|
|
39992
|
+
yieldPosition: vault.yieldPosition,
|
|
39993
|
+
tokenProgram: ptYtTokenProgram,
|
|
39994
|
+
remainingAccounts
|
|
39995
|
+
};
|
|
39996
|
+
const [syDecimals, ptDecimals] = await Promise.all([
|
|
39997
|
+
getMintDecimals(connection, vault.mintSy),
|
|
39998
|
+
getMintDecimals(connection, vault.mintPt)
|
|
39999
|
+
]);
|
|
40000
|
+
const syExchangeRate = vault.lastSeenSyExchangeRate.toNumber();
|
|
40001
|
+
return {
|
|
40002
|
+
vaultAddress,
|
|
40003
|
+
vault,
|
|
40004
|
+
stripAccounts,
|
|
40005
|
+
addressLookupTable: alt,
|
|
40006
|
+
sy: { mint: vault.mintSy, decimals: syDecimals, tokenProgram: syTokenProgram },
|
|
40007
|
+
pt: { mint: vault.mintPt, decimals: ptDecimals, tokenProgram: ptYtTokenProgram },
|
|
40008
|
+
yt: { mint: vault.mintYt, tokenProgram: ptYtTokenProgram },
|
|
40009
|
+
syExchangeRate,
|
|
40010
|
+
computeStrippedPtNative(syInNative) {
|
|
40011
|
+
const pt = vault.lastSeenSyExchangeRate.times(syInNative.toString()).integerValue(BigNumber.ROUND_FLOOR);
|
|
40012
|
+
return BigInt(pt.toFixed(0));
|
|
40013
|
+
}
|
|
40014
|
+
};
|
|
40015
|
+
}
|
|
39809
40016
|
var MERGE_DISCRIMINATOR = Buffer.from([5]);
|
|
39810
40017
|
function makeExponentMergeIx(accounts, amountNative) {
|
|
39811
40018
|
const tokenProgram = accounts.tokenProgram ?? TOKEN_PROGRAM_ID;
|
|
@@ -39828,7 +40035,46 @@ function makeExponentMergeIx(accounts, amountNative) {
|
|
|
39828
40035
|
{ pubkey: accounts.addressLookupTable, isSigner: false, isWritable: false },
|
|
39829
40036
|
{ pubkey: accounts.yieldPosition, isSigner: false, isWritable: true },
|
|
39830
40037
|
{ pubkey: eventAuthority, isSigner: false, isWritable: false },
|
|
39831
|
-
{ pubkey: EXPONENT_CORE_PROGRAM_ID, isSigner: false, isWritable: false }
|
|
40038
|
+
{ pubkey: EXPONENT_CORE_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
40039
|
+
// SY-program CPI accounts (getSyState ++ withdrawSy), ALT-resolved (post-maturity merge
|
|
40040
|
+
// still CPIs into the SY program to move SY out of escrow).
|
|
40041
|
+
...accounts.remainingAccounts ?? []
|
|
40042
|
+
];
|
|
40043
|
+
return new TransactionInstruction({
|
|
40044
|
+
keys,
|
|
40045
|
+
programId: EXPONENT_CORE_PROGRAM_ID,
|
|
40046
|
+
data
|
|
40047
|
+
});
|
|
40048
|
+
}
|
|
40049
|
+
var TRADE_PT_DISCRIMINATOR = Buffer.from([17]);
|
|
40050
|
+
function exponentBuyPtArgs({
|
|
40051
|
+
ptOutNative,
|
|
40052
|
+
maxSyInNative
|
|
40053
|
+
}) {
|
|
40054
|
+
return { netTraderPt: ptOutNative, syConstraint: -maxSyInNative };
|
|
40055
|
+
}
|
|
40056
|
+
function makeExponentTradePtIx(accounts, args) {
|
|
40057
|
+
const tokenProgram = accounts.tokenProgram ?? TOKEN_PROGRAM_ID;
|
|
40058
|
+
const eventAuthority = deriveExponentEventAuthority();
|
|
40059
|
+
const data = Buffer.alloc(TRADE_PT_DISCRIMINATOR.length + 16);
|
|
40060
|
+
TRADE_PT_DISCRIMINATOR.copy(data, 0);
|
|
40061
|
+
data.writeBigInt64LE(args.netTraderPt, TRADE_PT_DISCRIMINATOR.length);
|
|
40062
|
+
data.writeBigInt64LE(args.syConstraint, TRADE_PT_DISCRIMINATOR.length + 8);
|
|
40063
|
+
const keys = [
|
|
40064
|
+
{ pubkey: accounts.trader, isSigner: true, isWritable: true },
|
|
40065
|
+
{ pubkey: accounts.market, isSigner: false, isWritable: true },
|
|
40066
|
+
{ pubkey: accounts.tokenSyTrader, isSigner: false, isWritable: true },
|
|
40067
|
+
{ pubkey: accounts.tokenPtTrader, isSigner: false, isWritable: true },
|
|
40068
|
+
{ pubkey: accounts.tokenSyEscrow, isSigner: false, isWritable: true },
|
|
40069
|
+
{ pubkey: accounts.tokenPtEscrow, isSigner: false, isWritable: true },
|
|
40070
|
+
{ pubkey: accounts.addressLookupTable, isSigner: false, isWritable: false },
|
|
40071
|
+
{ pubkey: tokenProgram, isSigner: false, isWritable: false },
|
|
40072
|
+
{ pubkey: accounts.syProgram, isSigner: false, isWritable: false },
|
|
40073
|
+
{ pubkey: accounts.tokenFeeTreasurySy, isSigner: false, isWritable: true },
|
|
40074
|
+
{ pubkey: eventAuthority, isSigner: false, isWritable: false },
|
|
40075
|
+
{ pubkey: EXPONENT_CORE_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
40076
|
+
// SY-program CPI accounts (getSyState ++ depositSy ++ withdrawSy), ALT-resolved.
|
|
40077
|
+
...accounts.remainingAccounts
|
|
39832
40078
|
];
|
|
39833
40079
|
return new TransactionInstruction({
|
|
39834
40080
|
keys,
|
|
@@ -39836,7 +40082,35 @@ function makeExponentMergeIx(accounts, amountNative) {
|
|
|
39836
40082
|
data
|
|
39837
40083
|
});
|
|
39838
40084
|
}
|
|
40085
|
+
var STRIP_DISCRIMINATOR = Buffer.from([4]);
|
|
40086
|
+
function makeExponentStripIx(accounts, amountNative) {
|
|
40087
|
+
const tokenProgram = accounts.tokenProgram ?? TOKEN_PROGRAM_ID;
|
|
40088
|
+
const eventAuthority = deriveExponentEventAuthority();
|
|
40089
|
+
const data = Buffer.alloc(STRIP_DISCRIMINATOR.length + 8);
|
|
40090
|
+
STRIP_DISCRIMINATOR.copy(data, 0);
|
|
40091
|
+
data.writeBigUInt64LE(amountNative, STRIP_DISCRIMINATOR.length);
|
|
40092
|
+
const keys = [
|
|
40093
|
+
{ pubkey: accounts.depositor, isSigner: true, isWritable: true },
|
|
40094
|
+
{ pubkey: accounts.authority, isSigner: false, isWritable: true },
|
|
40095
|
+
{ pubkey: accounts.vault, isSigner: false, isWritable: true },
|
|
40096
|
+
{ pubkey: accounts.sySrc, isSigner: false, isWritable: true },
|
|
40097
|
+
{ pubkey: accounts.escrowSy, isSigner: false, isWritable: true },
|
|
40098
|
+
{ pubkey: accounts.ytDst, isSigner: false, isWritable: true },
|
|
40099
|
+
{ pubkey: accounts.ptDst, isSigner: false, isWritable: true },
|
|
40100
|
+
{ pubkey: accounts.mintYt, isSigner: false, isWritable: true },
|
|
40101
|
+
{ pubkey: accounts.mintPt, isSigner: false, isWritable: true },
|
|
40102
|
+
{ pubkey: tokenProgram, isSigner: false, isWritable: false },
|
|
40103
|
+
{ pubkey: accounts.addressLookupTable, isSigner: false, isWritable: false },
|
|
40104
|
+
{ pubkey: accounts.syProgram, isSigner: false, isWritable: false },
|
|
40105
|
+
{ pubkey: accounts.yieldPosition, isSigner: false, isWritable: true },
|
|
40106
|
+
{ pubkey: eventAuthority, isSigner: false, isWritable: false },
|
|
40107
|
+
{ pubkey: EXPONENT_CORE_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
40108
|
+
// SY-program CPI accounts (depositSy), ALT-resolved.
|
|
40109
|
+
...accounts.remainingAccounts ?? []
|
|
40110
|
+
];
|
|
40111
|
+
return new TransactionInstruction({ keys, programId: EXPONENT_CORE_PROGRAM_ID, data });
|
|
40112
|
+
}
|
|
39839
40113
|
|
|
39840
|
-
export { ACCOUNT_SIZE, ACCOUNT_TYPE_SIZE, ASSOCIATED_TOKEN_PROGRAM_ID, AccountLayout, AccountState, AccountType, ConnectionClosed, CorpAction, DEFAULT_RECENT_SLOT_DURATION_MS, DRIFT_IDL, DRIFT_PROGRAM_ID, DriftSpotBalanceType, EXPONENT_CORE_IDL, EXPONENT_CORE_PROGRAM_ID, EXPONENT_EVENT_AUTHORITY_SEED,
|
|
40114
|
+
export { ACCOUNT_SIZE, ACCOUNT_TYPE_SIZE, ASSOCIATED_TOKEN_PROGRAM_ID, AccountLayout, AccountState, AccountType, ConnectionClosed, CorpAction, DEFAULT_RECENT_SLOT_DURATION_MS, DRIFT_IDL, DRIFT_PROGRAM_ID, DriftSpotBalanceType, EXPONENT_CLMM_PROGRAM_ID, EXPONENT_CORE_IDL, EXPONENT_CORE_PROGRAM_ID, EXPONENT_EVENT_AUTHORITY_SEED, EXPONENT_GENERIC_SY_PROGRAM_ID, EXPONENT_JITO_RESTAKING_SY_PROGRAM_ID, EXPONENT_KAMINO_SY_PROGRAM_ID, EXPONENT_MARGINFI_SY_PROGRAM_ID, EXPONENT_NUMBER_DENOM, EXPONENT_ORDERBOOK_PROGRAM_ID, EXPONENT_PERENA_SY_PROGRAM_ID, EXPONENT_VAULTS_PROGRAM_ID, ErrorResponse, ExtensionType, FARMS_PROGRAM_ID, JUP_EXCHANGE_PRICES_PRECISION, JUP_LEND_IDL, JUP_LEND_PROGRAM_ID, JUP_LIQUIDITY_IDL, JUP_LIQUIDITY_PROGRAM_ID, JUP_MAX_REWARDS_RATE, JUP_REWARDS_PROGRAM_ID, JUP_SECONDS_PER_YEAR, KFARMS_IDL, KLEND_ACCOUNT_CODER, KLEND_IDL, KLEND_PROGRAM_ID, LENGTH_SIZE, MAX_SLOT_DIFFERENCE, MEMO_PROGRAM_ID, MINT_SIZE, MULTISIG_SIZE, MintLayout, MultisigLayout, NATIVE_MINT, ONE, ONE_HUNDRED_PCT_IN_BPS, ONE_YEAR, PERCENTAGE_PRECISION, PERCENTAGE_PRECISION_EXP, PriceStatus, PriceType, REFRESH_OBLIGATION_DISCRIMINATOR, SEED_BASE_REFERRER_STATE, SEED_BASE_REFERRER_TOKEN_STATE, SEED_BASE_SHORT_URL, SEED_BASE_USER_METADATA, SEED_DRIFT_SIGNER, SEED_DRIFT_STATE, SEED_FEE_RECEIVER, SEED_F_TOKEN_MINT, SEED_LENDING, SEED_LENDING_ADMIN, SEED_LENDING_MARKET_AUTH, SEED_LENDING_REWARDS_RATE_MODEL, SEED_LIQUIDITY, SEED_RATE_MODEL, SEED_RESERVE, SEED_RESERVE_COLL_MINT, SEED_RESERVE_COLL_SUPPLY, SEED_RESERVE_LIQ_SUPPLY, SEED_SPOT_MARKET, SEED_SPOT_MARKET_VAULT, SEED_USER, SEED_USER_CLAIM, SEED_USER_STATE, SEED_USER_STATS, SEED_USER_SUPPLY_POSITION, SLOTS_PER_DAY, SLOTS_PER_HOUR, SLOTS_PER_MINUTE, SLOTS_PER_SECOND, SLOTS_PER_YEAR, SPOT_MARKET_RATE_PRECISION, SPOT_MARKET_RATE_PRECISION_EXP, SPOT_MARKET_UTILIZATION_PRECISION, SPOT_MARKET_UTILIZATION_PRECISION_EXP, SWITCHBOARD_ONDEMANDE_PRICE_PRECISION, SinglePoolInstruction, SplAccountType, SpotBalanceType, StreamError, SwapMode, SwapVersion, TEN, TOKEN_2022_PROGRAM_ID, TOKEN_PROGRAM_ID, TYPE_SIZE, TokenAccountNotFoundError, TokenError, TokenInstruction, TokenInvalidAccountError, TokenInvalidAccountOwnerError, TokenInvalidAccountSizeError, TokenInvalidInstructionDataError, TokenInvalidInstructionKeysError, TokenInvalidInstructionProgramError, TokenInvalidInstructionTypeError, TokenInvalidMintError, TokenInvalidOwnerError, TokenOwnerOffCurveError, TokenUnsupportedInstructionError, V1Client, ZERO, addSigners, approveInstructionData, buildSwapQuoteResult, buildTitanTemplate, calculateAPYFromAPR, calculateDriftBorrowAPR, calculateDriftBorrowAPY, calculateDriftBorrowRate, calculateDriftDepositRate, calculateDriftInterestRate, calculateDriftLendingAPR, calculateDriftLendingAPY, calculateDriftUtilization, calculateJupLendBorrowRate, calculateJupLendLiquiditySupplyRate, calculateJupLendNewExchangePrice, calculateJupLendRewardsRate, calculateJupLendRewardsRateForExchangePrice, calculateJupLendSupplyAPY, calculateJupLendSupplyRate, calculateJupLendTotalAssets, calculateKaminoEstimatedBorrowRate, calculateKaminoEstimatedSupplyRate, calculateKaminoSupplyAPY, calculateRewardApy, calculateSlotAdjustmentFactor, calculateUtilizationRatio, closeAccountInstructionData, createAccountIx, createApproveInstruction, createAssociatedTokenAccountIdempotentInstruction, createAssociatedTokenAccountInstruction, createCloseAccountInstruction, createInitializeAccountInstruction, createMemoInstruction, createPoolOnrampIx, createSyncNativeInstruction, createTransferCheckedInstruction, decodeDriftSpotMarketData, decodeDriftStateData, decodeDriftUserData, decodeDriftUserStatsData, decodeExponentMarketTwo, decodeExponentMarketVault, decodeExponentVault, decodeFarmDataRaw, decodeJupLendingRewardsRateModelData, decodeJupLendingStateData, decodeJupRateModelData, decodeJupTokenReserveData, decodeKlendObligationData, decodeKlendReserveData, decodeSwitchboardPullFeedData, deriveBaseObligation, deriveDriftSigner, deriveDriftSpotMarket, deriveDriftSpotMarketVault, deriveDriftState, deriveDriftUser, deriveDriftUserStats, deriveExponentEventAuthority, deriveFeeReceiver, deriveJupLendClaimAccount, deriveJupLendFTokenMint, deriveJupLendLending, deriveJupLendLendingAdmin, deriveJupLendLendingPdas, deriveJupLendLendingRewardsRateModel, deriveJupLendLiquidity, deriveJupLendLiquiditySupplyPositionPda, deriveJupLendLiquidityVaultAta, deriveJupLendRateModel, deriveJupLendTokenReserve, deriveLendingMarketAuthority, deriveObligation, deriveReferrerState, deriveReferrerTokenState, deriveReserveCollateralMint, deriveReserveCollateralSupply, deriveReserveLiquiditySupply, deriveShortUrl, deriveUserMetadata, deriveUserState, deserializeSerializedInstruction, deserializeTitanWireInstruction, driftRewardsRawToDto, driftSpotMarketRawToDto, driftStateRawToDto, driftUserRawToDto, driftUserStatsRawToDto, dtoToDriftRewardsRaw, dtoToDriftSpotMarketRaw, dtoToDriftStateRaw, dtoToDriftUserRaw, dtoToDriftUserStatsRaw, dtoToFarmRaw, dtoToJupLendingRewardsRateModelRaw, dtoToJupLendingStateRaw, dtoToJupRateModelRaw, dtoToJupTokenReserveRaw, dtoToObligationRaw, dtoToReserveRaw, encodeTitanTemplate, exponentBuyPtArgs, exponentNumberToBigNumber, farmRawToDto, fetchExponentMarketTwo, fetchExponentVault, fetchExponentVaultFromMarket, fetchTitanQuoteSwapV3, findMplMetadataAddress, findPoolAddress, findPoolMintAddress, findPoolMintAddressByVoteAccount, findPoolMintAuthorityAddress, findPoolMplAuthorityAddress, findPoolOnRampAddress, findPoolStakeAddress, findPoolStakeAuthorityAddress, generateDriftReserveCurve, generateJupLendSupplyCurve, generateKaminoReserveCurve, getAccount, getAccountLen, getAllDerivedDriftAccounts, getAllDerivedJupLendAccounts, getAllDerivedKaminoAccounts, getAllRequiredMarkets, getAssociatedTokenAddressSync, getDriftRewards, getDriftTokenAmount, getFixedHostInterestRate, getJupLendRewards, getKaminoBorrowRate, getKaminoTotalSupply, getMinimumBalanceForRentExemptAccount, getMinimumBalanceForRentExemptAccountWithExtensions, getMint, getMintDecimals, getMultipleAccounts, getProtocolTakeRatePct, getReserveRewardsApy, getRewardPerTimeUnitSecond, getStakeAccount, getSwitchboardProgram, initializeAccountInstructionData, initializeStakedPoolIxs, initializeStakedPoolTx, instructionToTitanWire, interpolateLinear, isSpotBalanceTypeVariant, jupLendingRewardsRateModelRawToDto, jupLendingStateRawToDto, jupRateModelRawToDto, jupTokenReserveRawToDto, layout, lutToTitanWire, makeExponentMergeIx, makeExponentStripIx, makeExponentTradePtIx, makeRefreshObligationIx, makeRefreshReservesBatchIx, makeRefreshingIxs, makeUpdateJupLendRate, makeUpdateJupLendRateIx, makeUpdateSpotMarketCumulativeInterestIx, makeUpdateSpotMarketIx, obligationRawToDto, parsePriceData, parsePriceInfo2 as parsePriceInfo, replenishPoolIx, reserveRawToDto, resolveExponentMergeContext, resolveExponentStripContext, resolveExponentTradePtContext, resolveLookupTables, scaledSupplies, selectBestRoute, selectGatewayRoute, slotAdjustmentFactor, switchboardAccountCoder, syncNativeInstructionData, transferCheckedInstructionData, truncateBorrowCurve, unpackAccount };
|
|
39841
40115
|
//# sourceMappingURL=vendor.js.map
|
|
39842
40116
|
//# sourceMappingURL=vendor.js.map
|