@0dotxyz/p0-ts-sdk 2.3.0-alpha.2 → 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 +291 -8
- 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 +277 -7
- package/dist/vendor.js.map +1 -1
- package/package.json +1 -1
- package/dist/merge.types-Coz1eQZg.d.cts +0 -144
- package/dist/merge.types-Coz1eQZg.d.ts +0 -144
package/dist/vendor.cjs
CHANGED
|
@@ -32516,13 +32516,31 @@ function deserializeTitanWireInstruction(ix) {
|
|
|
32516
32516
|
});
|
|
32517
32517
|
}
|
|
32518
32518
|
var EXPONENT_CORE_PROGRAM_ID = new web3_js.PublicKey(
|
|
32519
|
-
"
|
|
32519
|
+
"ExponentnaRg3CQbW6dqQNZKXp7gtZ9DGMp1cwC4HAS7"
|
|
32520
32520
|
);
|
|
32521
|
-
var
|
|
32521
|
+
var EXPONENT_CLMM_PROGRAM_ID = new web3_js.PublicKey(
|
|
32522
32522
|
"XPC1MM4dYACDfykNuXYZ5una2DsMDWL24CrYubCvarC"
|
|
32523
32523
|
);
|
|
32524
|
-
var
|
|
32525
|
-
"
|
|
32524
|
+
var EXPONENT_ORDERBOOK_PROGRAM_ID = new web3_js.PublicKey(
|
|
32525
|
+
"XPBookgQTN2p8Yw1C2La35XkPMmZTCEYH77AdReVvK1"
|
|
32526
|
+
);
|
|
32527
|
+
var EXPONENT_VAULTS_PROGRAM_ID = new web3_js.PublicKey(
|
|
32528
|
+
"sVau1tXvayVWfotzm9Ahcv2qfnnfRWttt78BCnNC6dD"
|
|
32529
|
+
);
|
|
32530
|
+
var EXPONENT_GENERIC_SY_PROGRAM_ID = new web3_js.PublicKey(
|
|
32531
|
+
"XP1BRLn8eCYSygrd8er5P4GKdzqKbC3DLoSsS5UYVZy"
|
|
32532
|
+
);
|
|
32533
|
+
var EXPONENT_MARGINFI_SY_PROGRAM_ID = new web3_js.PublicKey(
|
|
32534
|
+
"XPMfipyhcbq3DBvgvxkbZY7GekwmGNJLMD3wdiCkBc7"
|
|
32535
|
+
);
|
|
32536
|
+
var EXPONENT_KAMINO_SY_PROGRAM_ID = new web3_js.PublicKey(
|
|
32537
|
+
"XPK1ndTK1xrgRg99ifvdPP1exrx8D1mRXTuxBkkroCx"
|
|
32538
|
+
);
|
|
32539
|
+
var EXPONENT_JITO_RESTAKING_SY_PROGRAM_ID = new web3_js.PublicKey(
|
|
32540
|
+
"XPJitopeUEhMZVF72CvswnwrS2U2akQvk5s26aEfWv2"
|
|
32541
|
+
);
|
|
32542
|
+
var EXPONENT_PERENA_SY_PROGRAM_ID = new web3_js.PublicKey(
|
|
32543
|
+
"XPerenaJPyvnjseLCn7rgzxFEum6zX1k89C13SPTyGZ"
|
|
32526
32544
|
);
|
|
32527
32545
|
var EXPONENT_EVENT_AUTHORITY_SEED = "__event_authority";
|
|
32528
32546
|
|
|
@@ -39746,6 +39764,7 @@ function decodeExponentVault(data) {
|
|
|
39746
39764
|
const d = EXPONENT_ACCOUNTS_CODER.decode("Vault", data);
|
|
39747
39765
|
const get = (snake, camel) => d[snake] ?? d[camel];
|
|
39748
39766
|
const u646 = (v) => BigInt(BN2__default.default.isBN(v) ? v.toString() : String(v ?? 0));
|
|
39767
|
+
const cpi = get("cpi_accounts", "cpiAccounts") ?? {};
|
|
39749
39768
|
return {
|
|
39750
39769
|
authority: pk(get("authority", "authority")),
|
|
39751
39770
|
syProgram: pk(get("sy_program", "syProgram")),
|
|
@@ -39755,8 +39774,16 @@ function decodeExponentVault(data) {
|
|
|
39755
39774
|
escrowSy: pk(get("escrow_sy", "escrowSy")),
|
|
39756
39775
|
yieldPosition: pk(get("yield_position", "yieldPosition")),
|
|
39757
39776
|
addressLookupTable: pk(get("address_lookup_table", "addressLookupTable")),
|
|
39777
|
+
cpiAccounts: {
|
|
39778
|
+
getSyState: decodeCpiContexts(cpi.get_sy_state ?? cpi.getSyState),
|
|
39779
|
+
depositSy: decodeCpiContexts(cpi.deposit_sy ?? cpi.depositSy),
|
|
39780
|
+
withdrawSy: decodeCpiContexts(cpi.withdraw_sy ?? cpi.withdrawSy)
|
|
39781
|
+
},
|
|
39758
39782
|
syForPt: u646(get("sy_for_pt", "syForPt")),
|
|
39759
39783
|
ptSupply: u646(get("pt_supply", "ptSupply")),
|
|
39784
|
+
lastSeenSyExchangeRate: exponentNumberToBigNumber(
|
|
39785
|
+
get("last_seen_sy_exchange_rate", "lastSeenSyExchangeRate")
|
|
39786
|
+
),
|
|
39760
39787
|
finalSyExchangeRate: exponentNumberToBigNumber(
|
|
39761
39788
|
get("final_sy_exchange_rate", "finalSyExchangeRate")
|
|
39762
39789
|
),
|
|
@@ -39767,6 +39794,44 @@ function decodeExponentMarketVault(data) {
|
|
|
39767
39794
|
const d = EXPONENT_ACCOUNTS_CODER.decode("MarketTwo", data);
|
|
39768
39795
|
return pk(d.vault);
|
|
39769
39796
|
}
|
|
39797
|
+
function decodeCpiContexts(raw) {
|
|
39798
|
+
if (!Array.isArray(raw)) return [];
|
|
39799
|
+
return raw.map((c) => {
|
|
39800
|
+
const o = c ?? {};
|
|
39801
|
+
return {
|
|
39802
|
+
altIndex: Number(o.alt_index ?? o.altIndex ?? 0),
|
|
39803
|
+
isSigner: Boolean(o.is_signer ?? o.isSigner ?? false),
|
|
39804
|
+
isWritable: Boolean(o.is_writable ?? o.isWritable ?? false)
|
|
39805
|
+
};
|
|
39806
|
+
});
|
|
39807
|
+
}
|
|
39808
|
+
function decodeExponentMarketTwo(data) {
|
|
39809
|
+
const d = EXPONENT_ACCOUNTS_CODER.decode("MarketTwo", data);
|
|
39810
|
+
const get = (snake, camel) => d[snake] ?? d[camel];
|
|
39811
|
+
const cpi = get("cpi_accounts", "cpiAccounts") ?? {};
|
|
39812
|
+
return {
|
|
39813
|
+
selfAddress: pk(get("self_address", "selfAddress")),
|
|
39814
|
+
mintPt: pk(get("mint_pt", "mintPt")),
|
|
39815
|
+
mintSy: pk(get("mint_sy", "mintSy")),
|
|
39816
|
+
vault: pk(get("vault", "vault")),
|
|
39817
|
+
tokenPtEscrow: pk(get("token_pt_escrow", "tokenPtEscrow")),
|
|
39818
|
+
tokenSyEscrow: pk(get("token_sy_escrow", "tokenSyEscrow")),
|
|
39819
|
+
tokenFeeTreasurySy: pk(get("token_fee_treasury_sy", "tokenFeeTreasurySy")),
|
|
39820
|
+
addressLookupTable: pk(get("address_lookup_table", "addressLookupTable")),
|
|
39821
|
+
syProgram: pk(get("sy_program", "syProgram")),
|
|
39822
|
+
statusFlags: Number(get("status_flags", "statusFlags") ?? 0),
|
|
39823
|
+
cpiAccounts: {
|
|
39824
|
+
getSyState: decodeCpiContexts(cpi.get_sy_state ?? cpi.getSyState),
|
|
39825
|
+
depositSy: decodeCpiContexts(cpi.deposit_sy ?? cpi.depositSy),
|
|
39826
|
+
withdrawSy: decodeCpiContexts(cpi.withdraw_sy ?? cpi.withdrawSy)
|
|
39827
|
+
}
|
|
39828
|
+
};
|
|
39829
|
+
}
|
|
39830
|
+
async function fetchExponentMarketTwo(connection, market) {
|
|
39831
|
+
const info = await connection.getAccountInfo(market);
|
|
39832
|
+
if (!info) throw new Error(`Exponent market account not found: ${market.toBase58()}`);
|
|
39833
|
+
return decodeExponentMarketTwo(info.data);
|
|
39834
|
+
}
|
|
39770
39835
|
async function fetchExponentVault(connection, vault) {
|
|
39771
39836
|
const info = await connection.getAccountInfo(vault);
|
|
39772
39837
|
if (!info) throw new Error(`Exponent vault account not found: ${vault.toBase58()}`);
|
|
@@ -39789,6 +39854,17 @@ function deriveExponentEventAuthority() {
|
|
|
39789
39854
|
EXPONENT_CORE_PROGRAM_ID
|
|
39790
39855
|
)[0];
|
|
39791
39856
|
}
|
|
39857
|
+
function resolveCpiMetas(contexts, altAddresses, altKey) {
|
|
39858
|
+
return contexts.map((ctx) => {
|
|
39859
|
+
const pubkey = altAddresses[ctx.altIndex];
|
|
39860
|
+
if (!pubkey) {
|
|
39861
|
+
throw new Error(
|
|
39862
|
+
`Exponent CPI account alt_index ${ctx.altIndex} out of range (ALT ${altKey.toBase58()} has ${altAddresses.length} entries)`
|
|
39863
|
+
);
|
|
39864
|
+
}
|
|
39865
|
+
return { pubkey, isSigner: false, isWritable: ctx.isWritable };
|
|
39866
|
+
});
|
|
39867
|
+
}
|
|
39792
39868
|
async function resolveExponentMergeContext(params) {
|
|
39793
39869
|
const { connection, owner } = params;
|
|
39794
39870
|
const ptYtTokenProgram = params.ptYtTokenProgram ?? TOKEN_PROGRAM_ID;
|
|
@@ -39808,6 +39884,17 @@ async function resolveExponentMergeContext(params) {
|
|
|
39808
39884
|
const ptSrcAta = getAssociatedTokenAddressSync(vault.mintPt, owner, true, ptYtTokenProgram);
|
|
39809
39885
|
const ytSrcAta = getAssociatedTokenAddressSync(vault.mintYt, owner, true, ptYtTokenProgram);
|
|
39810
39886
|
const sySrcDstAta = getAssociatedTokenAddressSync(vault.mintSy, owner, true, syTokenProgram);
|
|
39887
|
+
const altResult = await connection.getAddressLookupTable(vault.addressLookupTable);
|
|
39888
|
+
const alt = altResult.value;
|
|
39889
|
+
if (!alt) {
|
|
39890
|
+
throw new Error(
|
|
39891
|
+
`Exponent vault address lookup table not found: ${vault.addressLookupTable.toBase58()}`
|
|
39892
|
+
);
|
|
39893
|
+
}
|
|
39894
|
+
const remainingAccounts = [
|
|
39895
|
+
...resolveCpiMetas(vault.cpiAccounts.getSyState, alt.state.addresses, vault.addressLookupTable),
|
|
39896
|
+
...resolveCpiMetas(vault.cpiAccounts.withdrawSy, alt.state.addresses, vault.addressLookupTable)
|
|
39897
|
+
];
|
|
39811
39898
|
const mergeAccounts = {
|
|
39812
39899
|
owner,
|
|
39813
39900
|
authority: vault.authority,
|
|
@@ -39821,13 +39908,15 @@ async function resolveExponentMergeContext(params) {
|
|
|
39821
39908
|
syProgram: vault.syProgram,
|
|
39822
39909
|
addressLookupTable: vault.addressLookupTable,
|
|
39823
39910
|
yieldPosition: vault.yieldPosition,
|
|
39824
|
-
tokenProgram: ptYtTokenProgram
|
|
39911
|
+
tokenProgram: ptYtTokenProgram,
|
|
39912
|
+
remainingAccounts
|
|
39825
39913
|
};
|
|
39826
39914
|
const decimals = await getMintDecimals(connection, vault.mintSy);
|
|
39827
39915
|
return {
|
|
39828
39916
|
vaultAddress,
|
|
39829
39917
|
vault,
|
|
39830
39918
|
mergeAccounts,
|
|
39919
|
+
addressLookupTable: alt,
|
|
39831
39920
|
underlying: { mint: vault.mintSy, decimals, tokenProgram: syTokenProgram },
|
|
39832
39921
|
computeRedeemedAmountNative(ptAmountNative) {
|
|
39833
39922
|
if (vault.ptSupply === 0n) return 0n;
|
|
@@ -39836,6 +39925,120 @@ async function resolveExponentMergeContext(params) {
|
|
|
39836
39925
|
}
|
|
39837
39926
|
};
|
|
39838
39927
|
}
|
|
39928
|
+
async function resolveExponentTradePtContext(params) {
|
|
39929
|
+
const { connection, owner } = params;
|
|
39930
|
+
const ptTokenProgram = params.ptTokenProgram ?? TOKEN_PROGRAM_ID;
|
|
39931
|
+
const syTokenProgram = params.syTokenProgram ?? TOKEN_PROGRAM_ID;
|
|
39932
|
+
const market = await fetchExponentMarketTwo(connection, params.market);
|
|
39933
|
+
const altResult = await connection.getAddressLookupTable(market.addressLookupTable);
|
|
39934
|
+
const alt = altResult.value;
|
|
39935
|
+
if (!alt) {
|
|
39936
|
+
throw new Error(
|
|
39937
|
+
`Exponent market address lookup table not found: ${market.addressLookupTable.toBase58()}`
|
|
39938
|
+
);
|
|
39939
|
+
}
|
|
39940
|
+
const altAddresses = alt.state.addresses;
|
|
39941
|
+
const altKey = market.addressLookupTable;
|
|
39942
|
+
const remainingAccounts = [
|
|
39943
|
+
...resolveCpiMetas(market.cpiAccounts.getSyState, altAddresses, altKey),
|
|
39944
|
+
...resolveCpiMetas(market.cpiAccounts.depositSy, altAddresses, altKey),
|
|
39945
|
+
...resolveCpiMetas(market.cpiAccounts.withdrawSy, altAddresses, altKey)
|
|
39946
|
+
];
|
|
39947
|
+
const tokenSyTrader = getAssociatedTokenAddressSync(market.mintSy, owner, true, syTokenProgram);
|
|
39948
|
+
const tokenPtTrader = getAssociatedTokenAddressSync(market.mintPt, owner, true, ptTokenProgram);
|
|
39949
|
+
const tradePtAccounts = {
|
|
39950
|
+
trader: owner,
|
|
39951
|
+
market: market.selfAddress,
|
|
39952
|
+
tokenSyTrader,
|
|
39953
|
+
tokenPtTrader,
|
|
39954
|
+
tokenSyEscrow: market.tokenSyEscrow,
|
|
39955
|
+
tokenPtEscrow: market.tokenPtEscrow,
|
|
39956
|
+
addressLookupTable: market.addressLookupTable,
|
|
39957
|
+
syProgram: market.syProgram,
|
|
39958
|
+
tokenFeeTreasurySy: market.tokenFeeTreasurySy,
|
|
39959
|
+
tokenProgram: ptTokenProgram,
|
|
39960
|
+
remainingAccounts
|
|
39961
|
+
};
|
|
39962
|
+
const [syDecimals, ptDecimals] = await Promise.all([
|
|
39963
|
+
getMintDecimals(connection, market.mintSy),
|
|
39964
|
+
getMintDecimals(connection, market.mintPt)
|
|
39965
|
+
]);
|
|
39966
|
+
return {
|
|
39967
|
+
marketAddress: market.selfAddress,
|
|
39968
|
+
market,
|
|
39969
|
+
tradePtAccounts,
|
|
39970
|
+
addressLookupTable: alt,
|
|
39971
|
+
sy: { mint: market.mintSy, decimals: syDecimals, tokenProgram: syTokenProgram },
|
|
39972
|
+
pt: { mint: market.mintPt, decimals: ptDecimals, tokenProgram: ptTokenProgram }
|
|
39973
|
+
};
|
|
39974
|
+
}
|
|
39975
|
+
async function resolveExponentStripContext(params) {
|
|
39976
|
+
const { connection, owner } = params;
|
|
39977
|
+
const ptYtTokenProgram = params.ptYtTokenProgram ?? TOKEN_PROGRAM_ID;
|
|
39978
|
+
const syTokenProgram = params.syTokenProgram ?? TOKEN_PROGRAM_ID;
|
|
39979
|
+
let vaultAddress;
|
|
39980
|
+
let vault;
|
|
39981
|
+
if (params.vault) {
|
|
39982
|
+
vaultAddress = params.vault;
|
|
39983
|
+
vault = await fetchExponentVault(connection, vaultAddress);
|
|
39984
|
+
} else if (params.market) {
|
|
39985
|
+
const res = await fetchExponentVaultFromMarket(connection, params.market);
|
|
39986
|
+
vaultAddress = res.vault;
|
|
39987
|
+
vault = res.account;
|
|
39988
|
+
} else {
|
|
39989
|
+
throw new Error("resolveExponentStripContext: one of `vault` or `market` is required");
|
|
39990
|
+
}
|
|
39991
|
+
const altResult = await connection.getAddressLookupTable(vault.addressLookupTable);
|
|
39992
|
+
const alt = altResult.value;
|
|
39993
|
+
if (!alt) {
|
|
39994
|
+
throw new Error(
|
|
39995
|
+
`Exponent vault address lookup table not found: ${vault.addressLookupTable.toBase58()}`
|
|
39996
|
+
);
|
|
39997
|
+
}
|
|
39998
|
+
const remainingAccounts = resolveCpiMetas(
|
|
39999
|
+
vault.cpiAccounts.depositSy,
|
|
40000
|
+
alt.state.addresses,
|
|
40001
|
+
vault.addressLookupTable
|
|
40002
|
+
);
|
|
40003
|
+
const sySrc = getAssociatedTokenAddressSync(vault.mintSy, owner, true, syTokenProgram);
|
|
40004
|
+
const ptDst = getAssociatedTokenAddressSync(vault.mintPt, owner, true, ptYtTokenProgram);
|
|
40005
|
+
const ytDst = getAssociatedTokenAddressSync(vault.mintYt, owner, true, ptYtTokenProgram);
|
|
40006
|
+
const stripAccounts = {
|
|
40007
|
+
depositor: owner,
|
|
40008
|
+
authority: vault.authority,
|
|
40009
|
+
vault: vaultAddress,
|
|
40010
|
+
sySrc,
|
|
40011
|
+
escrowSy: vault.escrowSy,
|
|
40012
|
+
ytDst,
|
|
40013
|
+
ptDst,
|
|
40014
|
+
mintYt: vault.mintYt,
|
|
40015
|
+
mintPt: vault.mintPt,
|
|
40016
|
+
syProgram: vault.syProgram,
|
|
40017
|
+
addressLookupTable: vault.addressLookupTable,
|
|
40018
|
+
yieldPosition: vault.yieldPosition,
|
|
40019
|
+
tokenProgram: ptYtTokenProgram,
|
|
40020
|
+
remainingAccounts
|
|
40021
|
+
};
|
|
40022
|
+
const [syDecimals, ptDecimals] = await Promise.all([
|
|
40023
|
+
getMintDecimals(connection, vault.mintSy),
|
|
40024
|
+
getMintDecimals(connection, vault.mintPt)
|
|
40025
|
+
]);
|
|
40026
|
+
const syExchangeRate = vault.lastSeenSyExchangeRate.toNumber();
|
|
40027
|
+
return {
|
|
40028
|
+
vaultAddress,
|
|
40029
|
+
vault,
|
|
40030
|
+
stripAccounts,
|
|
40031
|
+
addressLookupTable: alt,
|
|
40032
|
+
sy: { mint: vault.mintSy, decimals: syDecimals, tokenProgram: syTokenProgram },
|
|
40033
|
+
pt: { mint: vault.mintPt, decimals: ptDecimals, tokenProgram: ptYtTokenProgram },
|
|
40034
|
+
yt: { mint: vault.mintYt, tokenProgram: ptYtTokenProgram },
|
|
40035
|
+
syExchangeRate,
|
|
40036
|
+
computeStrippedPtNative(syInNative) {
|
|
40037
|
+
const pt = vault.lastSeenSyExchangeRate.times(syInNative.toString()).integerValue(bignumber_js.BigNumber.ROUND_FLOOR);
|
|
40038
|
+
return BigInt(pt.toFixed(0));
|
|
40039
|
+
}
|
|
40040
|
+
};
|
|
40041
|
+
}
|
|
39839
40042
|
var MERGE_DISCRIMINATOR = Buffer.from([5]);
|
|
39840
40043
|
function makeExponentMergeIx(accounts, amountNative) {
|
|
39841
40044
|
const tokenProgram = accounts.tokenProgram ?? TOKEN_PROGRAM_ID;
|
|
@@ -39858,7 +40061,10 @@ function makeExponentMergeIx(accounts, amountNative) {
|
|
|
39858
40061
|
{ pubkey: accounts.addressLookupTable, isSigner: false, isWritable: false },
|
|
39859
40062
|
{ pubkey: accounts.yieldPosition, isSigner: false, isWritable: true },
|
|
39860
40063
|
{ pubkey: eventAuthority, isSigner: false, isWritable: false },
|
|
39861
|
-
{ pubkey: EXPONENT_CORE_PROGRAM_ID, isSigner: false, isWritable: false }
|
|
40064
|
+
{ pubkey: EXPONENT_CORE_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
40065
|
+
// SY-program CPI accounts (getSyState ++ withdrawSy), ALT-resolved (post-maturity merge
|
|
40066
|
+
// still CPIs into the SY program to move SY out of escrow).
|
|
40067
|
+
...accounts.remainingAccounts ?? []
|
|
39862
40068
|
];
|
|
39863
40069
|
return new web3_js.TransactionInstruction({
|
|
39864
40070
|
keys,
|
|
@@ -39866,6 +40072,70 @@ function makeExponentMergeIx(accounts, amountNative) {
|
|
|
39866
40072
|
data
|
|
39867
40073
|
});
|
|
39868
40074
|
}
|
|
40075
|
+
var TRADE_PT_DISCRIMINATOR = Buffer.from([17]);
|
|
40076
|
+
function exponentBuyPtArgs({
|
|
40077
|
+
ptOutNative,
|
|
40078
|
+
maxSyInNative
|
|
40079
|
+
}) {
|
|
40080
|
+
return { netTraderPt: ptOutNative, syConstraint: -maxSyInNative };
|
|
40081
|
+
}
|
|
40082
|
+
function makeExponentTradePtIx(accounts, args) {
|
|
40083
|
+
const tokenProgram = accounts.tokenProgram ?? TOKEN_PROGRAM_ID;
|
|
40084
|
+
const eventAuthority = deriveExponentEventAuthority();
|
|
40085
|
+
const data = Buffer.alloc(TRADE_PT_DISCRIMINATOR.length + 16);
|
|
40086
|
+
TRADE_PT_DISCRIMINATOR.copy(data, 0);
|
|
40087
|
+
data.writeBigInt64LE(args.netTraderPt, TRADE_PT_DISCRIMINATOR.length);
|
|
40088
|
+
data.writeBigInt64LE(args.syConstraint, TRADE_PT_DISCRIMINATOR.length + 8);
|
|
40089
|
+
const keys = [
|
|
40090
|
+
{ pubkey: accounts.trader, isSigner: true, isWritable: true },
|
|
40091
|
+
{ pubkey: accounts.market, isSigner: false, isWritable: true },
|
|
40092
|
+
{ pubkey: accounts.tokenSyTrader, isSigner: false, isWritable: true },
|
|
40093
|
+
{ pubkey: accounts.tokenPtTrader, isSigner: false, isWritable: true },
|
|
40094
|
+
{ pubkey: accounts.tokenSyEscrow, isSigner: false, isWritable: true },
|
|
40095
|
+
{ pubkey: accounts.tokenPtEscrow, isSigner: false, isWritable: true },
|
|
40096
|
+
{ pubkey: accounts.addressLookupTable, isSigner: false, isWritable: false },
|
|
40097
|
+
{ pubkey: tokenProgram, isSigner: false, isWritable: false },
|
|
40098
|
+
{ pubkey: accounts.syProgram, isSigner: false, isWritable: false },
|
|
40099
|
+
{ pubkey: accounts.tokenFeeTreasurySy, isSigner: false, isWritable: true },
|
|
40100
|
+
{ pubkey: eventAuthority, isSigner: false, isWritable: false },
|
|
40101
|
+
{ pubkey: EXPONENT_CORE_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
40102
|
+
// SY-program CPI accounts (getSyState ++ depositSy ++ withdrawSy), ALT-resolved.
|
|
40103
|
+
...accounts.remainingAccounts
|
|
40104
|
+
];
|
|
40105
|
+
return new web3_js.TransactionInstruction({
|
|
40106
|
+
keys,
|
|
40107
|
+
programId: EXPONENT_CORE_PROGRAM_ID,
|
|
40108
|
+
data
|
|
40109
|
+
});
|
|
40110
|
+
}
|
|
40111
|
+
var STRIP_DISCRIMINATOR = Buffer.from([4]);
|
|
40112
|
+
function makeExponentStripIx(accounts, amountNative) {
|
|
40113
|
+
const tokenProgram = accounts.tokenProgram ?? TOKEN_PROGRAM_ID;
|
|
40114
|
+
const eventAuthority = deriveExponentEventAuthority();
|
|
40115
|
+
const data = Buffer.alloc(STRIP_DISCRIMINATOR.length + 8);
|
|
40116
|
+
STRIP_DISCRIMINATOR.copy(data, 0);
|
|
40117
|
+
data.writeBigUInt64LE(amountNative, STRIP_DISCRIMINATOR.length);
|
|
40118
|
+
const keys = [
|
|
40119
|
+
{ pubkey: accounts.depositor, isSigner: true, isWritable: true },
|
|
40120
|
+
{ pubkey: accounts.authority, isSigner: false, isWritable: true },
|
|
40121
|
+
{ pubkey: accounts.vault, isSigner: false, isWritable: true },
|
|
40122
|
+
{ pubkey: accounts.sySrc, isSigner: false, isWritable: true },
|
|
40123
|
+
{ pubkey: accounts.escrowSy, isSigner: false, isWritable: true },
|
|
40124
|
+
{ pubkey: accounts.ytDst, isSigner: false, isWritable: true },
|
|
40125
|
+
{ pubkey: accounts.ptDst, isSigner: false, isWritable: true },
|
|
40126
|
+
{ pubkey: accounts.mintYt, isSigner: false, isWritable: true },
|
|
40127
|
+
{ pubkey: accounts.mintPt, isSigner: false, isWritable: true },
|
|
40128
|
+
{ pubkey: tokenProgram, isSigner: false, isWritable: false },
|
|
40129
|
+
{ pubkey: accounts.addressLookupTable, isSigner: false, isWritable: false },
|
|
40130
|
+
{ pubkey: accounts.syProgram, isSigner: false, isWritable: false },
|
|
40131
|
+
{ pubkey: accounts.yieldPosition, isSigner: false, isWritable: true },
|
|
40132
|
+
{ pubkey: eventAuthority, isSigner: false, isWritable: false },
|
|
40133
|
+
{ pubkey: EXPONENT_CORE_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
40134
|
+
// SY-program CPI accounts (depositSy), ALT-resolved.
|
|
40135
|
+
...accounts.remainingAccounts ?? []
|
|
40136
|
+
];
|
|
40137
|
+
return new web3_js.TransactionInstruction({ keys, programId: EXPONENT_CORE_PROGRAM_ID, data });
|
|
40138
|
+
}
|
|
39869
40139
|
|
|
39870
40140
|
exports.ACCOUNT_SIZE = ACCOUNT_SIZE;
|
|
39871
40141
|
exports.ACCOUNT_TYPE_SIZE = ACCOUNT_TYPE_SIZE;
|
|
@@ -39879,12 +40149,18 @@ exports.DEFAULT_RECENT_SLOT_DURATION_MS = DEFAULT_RECENT_SLOT_DURATION_MS;
|
|
|
39879
40149
|
exports.DRIFT_IDL = DRIFT_IDL;
|
|
39880
40150
|
exports.DRIFT_PROGRAM_ID = DRIFT_PROGRAM_ID;
|
|
39881
40151
|
exports.DriftSpotBalanceType = DriftSpotBalanceType;
|
|
40152
|
+
exports.EXPONENT_CLMM_PROGRAM_ID = EXPONENT_CLMM_PROGRAM_ID;
|
|
39882
40153
|
exports.EXPONENT_CORE_IDL = EXPONENT_CORE_IDL;
|
|
39883
40154
|
exports.EXPONENT_CORE_PROGRAM_ID = EXPONENT_CORE_PROGRAM_ID;
|
|
39884
40155
|
exports.EXPONENT_EVENT_AUTHORITY_SEED = EXPONENT_EVENT_AUTHORITY_SEED;
|
|
39885
|
-
exports.
|
|
40156
|
+
exports.EXPONENT_GENERIC_SY_PROGRAM_ID = EXPONENT_GENERIC_SY_PROGRAM_ID;
|
|
40157
|
+
exports.EXPONENT_JITO_RESTAKING_SY_PROGRAM_ID = EXPONENT_JITO_RESTAKING_SY_PROGRAM_ID;
|
|
40158
|
+
exports.EXPONENT_KAMINO_SY_PROGRAM_ID = EXPONENT_KAMINO_SY_PROGRAM_ID;
|
|
40159
|
+
exports.EXPONENT_MARGINFI_SY_PROGRAM_ID = EXPONENT_MARGINFI_SY_PROGRAM_ID;
|
|
39886
40160
|
exports.EXPONENT_NUMBER_DENOM = EXPONENT_NUMBER_DENOM;
|
|
39887
|
-
exports.
|
|
40161
|
+
exports.EXPONENT_ORDERBOOK_PROGRAM_ID = EXPONENT_ORDERBOOK_PROGRAM_ID;
|
|
40162
|
+
exports.EXPONENT_PERENA_SY_PROGRAM_ID = EXPONENT_PERENA_SY_PROGRAM_ID;
|
|
40163
|
+
exports.EXPONENT_VAULTS_PROGRAM_ID = EXPONENT_VAULTS_PROGRAM_ID;
|
|
39888
40164
|
exports.ErrorResponse = ErrorResponse;
|
|
39889
40165
|
exports.ExtensionType = ExtensionType;
|
|
39890
40166
|
exports.FARMS_PROGRAM_ID = FARMS_PROGRAM_ID;
|
|
@@ -40019,6 +40295,7 @@ exports.decodeDriftSpotMarketData = decodeDriftSpotMarketData;
|
|
|
40019
40295
|
exports.decodeDriftStateData = decodeDriftStateData;
|
|
40020
40296
|
exports.decodeDriftUserData = decodeDriftUserData;
|
|
40021
40297
|
exports.decodeDriftUserStatsData = decodeDriftUserStatsData;
|
|
40298
|
+
exports.decodeExponentMarketTwo = decodeExponentMarketTwo;
|
|
40022
40299
|
exports.decodeExponentMarketVault = decodeExponentMarketVault;
|
|
40023
40300
|
exports.decodeExponentVault = decodeExponentVault;
|
|
40024
40301
|
exports.decodeFarmDataRaw = decodeFarmDataRaw;
|
|
@@ -40079,8 +40356,10 @@ exports.dtoToJupTokenReserveRaw = dtoToJupTokenReserveRaw;
|
|
|
40079
40356
|
exports.dtoToObligationRaw = dtoToObligationRaw;
|
|
40080
40357
|
exports.dtoToReserveRaw = dtoToReserveRaw;
|
|
40081
40358
|
exports.encodeTitanTemplate = encodeTitanTemplate;
|
|
40359
|
+
exports.exponentBuyPtArgs = exponentBuyPtArgs;
|
|
40082
40360
|
exports.exponentNumberToBigNumber = exponentNumberToBigNumber;
|
|
40083
40361
|
exports.farmRawToDto = farmRawToDto;
|
|
40362
|
+
exports.fetchExponentMarketTwo = fetchExponentMarketTwo;
|
|
40084
40363
|
exports.fetchExponentVault = fetchExponentVault;
|
|
40085
40364
|
exports.fetchExponentVaultFromMarket = fetchExponentVaultFromMarket;
|
|
40086
40365
|
exports.fetchTitanQuoteSwapV3 = fetchTitanQuoteSwapV3;
|
|
@@ -40132,6 +40411,8 @@ exports.jupTokenReserveRawToDto = jupTokenReserveRawToDto;
|
|
|
40132
40411
|
exports.layout = layout;
|
|
40133
40412
|
exports.lutToTitanWire = lutToTitanWire;
|
|
40134
40413
|
exports.makeExponentMergeIx = makeExponentMergeIx;
|
|
40414
|
+
exports.makeExponentStripIx = makeExponentStripIx;
|
|
40415
|
+
exports.makeExponentTradePtIx = makeExponentTradePtIx;
|
|
40135
40416
|
exports.makeRefreshObligationIx = makeRefreshObligationIx;
|
|
40136
40417
|
exports.makeRefreshReservesBatchIx = makeRefreshReservesBatchIx;
|
|
40137
40418
|
exports.makeRefreshingIxs = makeRefreshingIxs;
|
|
@@ -40145,6 +40426,8 @@ exports.parsePriceInfo = parsePriceInfo2;
|
|
|
40145
40426
|
exports.replenishPoolIx = replenishPoolIx;
|
|
40146
40427
|
exports.reserveRawToDto = reserveRawToDto;
|
|
40147
40428
|
exports.resolveExponentMergeContext = resolveExponentMergeContext;
|
|
40429
|
+
exports.resolveExponentStripContext = resolveExponentStripContext;
|
|
40430
|
+
exports.resolveExponentTradePtContext = resolveExponentTradePtContext;
|
|
40148
40431
|
exports.resolveLookupTables = resolveLookupTables;
|
|
40149
40432
|
exports.scaledSupplies = scaledSupplies;
|
|
40150
40433
|
exports.selectBestRoute = selectBestRoute;
|