@0dotxyz/p0-ts-sdk 3.0.0-next.2 → 3.0.1-alpha.0
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.cjs +79 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +22 -2
- package/dist/index.d.ts +22 -2
- package/dist/index.js +79 -4
- package/dist/index.js.map +1 -1
- package/dist/{types-DvtvVd73.d.cts → types-ChkgWMym.d.cts} +60 -2
- package/dist/{types-DvtvVd73.d.ts → types-ChkgWMym.d.ts} +60 -2
- package/dist/vendor.cjs +115 -0
- package/dist/vendor.cjs.map +1 -1
- package/dist/vendor.d.cts +17 -3
- package/dist/vendor.d.ts +17 -3
- package/dist/vendor.js +112 -1
- package/dist/vendor.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -17905,7 +17905,7 @@ async function makeDepositIx2({
|
|
|
17905
17905
|
return depositIxs;
|
|
17906
17906
|
}
|
|
17907
17907
|
async function makeDepositTx(params) {
|
|
17908
|
-
const { rpc, txFormat, latestBlockhash, bankMap, ...depositIxParams } = params;
|
|
17908
|
+
const { rpc, txFormat, latestBlockhash, bankMap, prependedIxs = [], ...depositIxParams } = params;
|
|
17909
17909
|
const { bank, bankMetadataMap } = params;
|
|
17910
17910
|
if (exceedsCostlyPositionLimit(params.marginfiAccount.balances, bankMap, bank)) {
|
|
17911
17911
|
throw TransactionBuildingError.costlyPositionLimitExceeded(bank.address);
|
|
@@ -17916,7 +17916,7 @@ async function makeDepositTx(params) {
|
|
|
17916
17916
|
const refreshIxs = kaminoAccounts && reserve ? makeRefreshingIxs(kaminoAccounts.kaminoReserve, reserve, kaminoAccounts.kaminoObligation) : [];
|
|
17917
17917
|
const actionIxs = await prependOrderCloses({
|
|
17918
17918
|
...params,
|
|
17919
|
-
actionIxs: [...refreshIxs, ...depositIxs],
|
|
17919
|
+
actionIxs: [...prependedIxs, ...refreshIxs, ...depositIxs],
|
|
17920
17920
|
txFormat: selectLutsForBanks(txFormat, [bank])
|
|
17921
17921
|
});
|
|
17922
17922
|
const { instructions: txIxs, txFormat: selectedFormat } = await appendPremiumRefresh({
|
|
@@ -23005,6 +23005,25 @@ async function makeMergeStakeAccountsTx({
|
|
|
23005
23005
|
type: "MERGE_STAKE_ACCOUNTS" /* MERGE_STAKE_ACCOUNTS */
|
|
23006
23006
|
};
|
|
23007
23007
|
}
|
|
23008
|
+
var DEPOSIT_POLICY_DISCRIMINATOR = new Uint8Array([
|
|
23009
|
+
159,
|
|
23010
|
+
243,
|
|
23011
|
+
65,
|
|
23012
|
+
242,
|
|
23013
|
+
81,
|
|
23014
|
+
27,
|
|
23015
|
+
41,
|
|
23016
|
+
167
|
|
23017
|
+
]);
|
|
23018
|
+
function getDepositPolicyDecoder() {
|
|
23019
|
+
return kit.getStructDecoder([
|
|
23020
|
+
["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)],
|
|
23021
|
+
["lpVault", kit.getAddressDecoder()],
|
|
23022
|
+
["capacityAssets", kit.getU64Decoder()],
|
|
23023
|
+
["depositsPaused", kit.getBooleanDecoder()],
|
|
23024
|
+
["bump", kit.getU8Decoder()]
|
|
23025
|
+
]);
|
|
23026
|
+
}
|
|
23008
23027
|
var LP_VAULT_DISCRIMINATOR = new Uint8Array([
|
|
23009
23028
|
189,
|
|
23010
23029
|
45,
|
|
@@ -23038,6 +23057,30 @@ function getLpVaultDecoder() {
|
|
|
23038
23057
|
["keeperAuthority", kit.getAddressDecoder()]
|
|
23039
23058
|
]);
|
|
23040
23059
|
}
|
|
23060
|
+
var WITHDRAWAL_POLICY_DISCRIMINATOR = new Uint8Array([
|
|
23061
|
+
52,
|
|
23062
|
+
231,
|
|
23063
|
+
68,
|
|
23064
|
+
59,
|
|
23065
|
+
247,
|
|
23066
|
+
250,
|
|
23067
|
+
119,
|
|
23068
|
+
244
|
|
23069
|
+
]);
|
|
23070
|
+
function getWithdrawalPolicyDecoder() {
|
|
23071
|
+
return kit.getStructDecoder([
|
|
23072
|
+
["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)],
|
|
23073
|
+
["lpVault", kit.getAddressDecoder()],
|
|
23074
|
+
["withdrawalFeeBps", kit.getU16Decoder()],
|
|
23075
|
+
["hourlyWithdrawalCapBps", kit.getU16Decoder()],
|
|
23076
|
+
["dailyWithdrawalCapBps", kit.getU16Decoder()],
|
|
23077
|
+
["hourlyWithdrawnAssets", kit.getU64Decoder()],
|
|
23078
|
+
["dailyWithdrawnAssets", kit.getU64Decoder()],
|
|
23079
|
+
["hourlyWindowStart", kit.getI64Decoder()],
|
|
23080
|
+
["dailyWindowStart", kit.getI64Decoder()],
|
|
23081
|
+
["bump", kit.getU8Decoder()]
|
|
23082
|
+
]);
|
|
23083
|
+
}
|
|
23041
23084
|
var WITHDRAW_RECEIPT_DISCRIMINATOR = new Uint8Array([
|
|
23042
23085
|
132,
|
|
23043
23086
|
238,
|
|
@@ -23609,6 +23652,28 @@ function decodeGammaWithdrawReceipt(data) {
|
|
|
23609
23652
|
"Gamma WithdrawReceipt"
|
|
23610
23653
|
);
|
|
23611
23654
|
}
|
|
23655
|
+
function decodeGammaDepositPolicy(data) {
|
|
23656
|
+
return decodeAccountData(
|
|
23657
|
+
data,
|
|
23658
|
+
DEPOSIT_POLICY_DISCRIMINATOR,
|
|
23659
|
+
getDepositPolicyDecoder(),
|
|
23660
|
+
"Gamma DepositPolicy"
|
|
23661
|
+
);
|
|
23662
|
+
}
|
|
23663
|
+
function decodeGammaWithdrawalPolicy(data) {
|
|
23664
|
+
return decodeAccountData(
|
|
23665
|
+
data,
|
|
23666
|
+
WITHDRAWAL_POLICY_DISCRIMINATOR,
|
|
23667
|
+
getWithdrawalPolicyDecoder(),
|
|
23668
|
+
"Gamma WithdrawalPolicy"
|
|
23669
|
+
);
|
|
23670
|
+
}
|
|
23671
|
+
function deriveGammaDepositPolicy(lpVault) {
|
|
23672
|
+
return findDepositPolicyPda({ lpVault });
|
|
23673
|
+
}
|
|
23674
|
+
function deriveGammaWithdrawalPolicy(lpVault) {
|
|
23675
|
+
return findWithdrawalPolicyPda({ lpVault });
|
|
23676
|
+
}
|
|
23612
23677
|
function deriveGammaWithdrawReceipt(user, lpVault) {
|
|
23613
23678
|
return findWithdrawReceiptPda({ crossChainWithdrawer: user, lpVault });
|
|
23614
23679
|
}
|
|
@@ -23627,6 +23692,16 @@ async function fetchGammaWithdrawReceipt(rpc, user, lpVault) {
|
|
|
23627
23692
|
const account = await kit.fetchEncodedAccount(rpc, receipt);
|
|
23628
23693
|
return account.exists ? decodeGammaWithdrawReceipt(account.data) : null;
|
|
23629
23694
|
}
|
|
23695
|
+
async function fetchGammaDepositPolicy(rpc, lpVault) {
|
|
23696
|
+
const [policy] = await deriveGammaDepositPolicy(lpVault);
|
|
23697
|
+
const account = await kit.fetchEncodedAccount(rpc, policy);
|
|
23698
|
+
return account.exists ? decodeGammaDepositPolicy(account.data) : null;
|
|
23699
|
+
}
|
|
23700
|
+
async function fetchGammaWithdrawalPolicy(rpc, lpVault) {
|
|
23701
|
+
const [policy] = await deriveGammaWithdrawalPolicy(lpVault);
|
|
23702
|
+
const account = await kit.fetchEncodedAccount(rpc, policy);
|
|
23703
|
+
return account.exists ? decodeGammaWithdrawalPolicy(account.data) : null;
|
|
23704
|
+
}
|
|
23630
23705
|
async function resolveVaultTokenProgram(rpc, assetsMint) {
|
|
23631
23706
|
const account = await kit.fetchEncodedAccount(rpc, assetsMint);
|
|
23632
23707
|
return account.exists && account.programAddress === TOKEN_2022_PROGRAM_ID ? TOKEN_2022_PROGRAM_ID : token.TOKEN_PROGRAM_ADDRESS;
|
|
@@ -25576,8 +25651,10 @@ exports.exceedsCostlyPositionLimit = exceedsCostlyPositionLimit;
|
|
|
25576
25651
|
exports.extractPythOracleKeys = extractPythOracleKeys;
|
|
25577
25652
|
exports.fetchBank = fetchBank;
|
|
25578
25653
|
exports.fetchBankIntegrationMetadata = fetchBankIntegrationMetadata;
|
|
25654
|
+
exports.fetchGammaDepositPolicy = fetchGammaDepositPolicy;
|
|
25579
25655
|
exports.fetchGammaLpVault = fetchGammaLpVault;
|
|
25580
25656
|
exports.fetchGammaWithdrawReceipt = fetchGammaWithdrawReceipt;
|
|
25657
|
+
exports.fetchGammaWithdrawalPolicy = fetchGammaWithdrawalPolicy;
|
|
25581
25658
|
exports.fetchGlobalFeeWallet = fetchGlobalFeeWallet;
|
|
25582
25659
|
exports.fetchMarginfiAccountActiveBalancesForBank = fetchMarginfiAccountActiveBalancesForBank;
|
|
25583
25660
|
exports.fetchMarginfiAccountAddresses = fetchMarginfiAccountAddresses;
|