@perena/bankineco-sdk 1.0.41 → 1.0.42
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.
|
@@ -32,7 +32,7 @@ export interface CreateVaultParams {
|
|
|
32
32
|
}
|
|
33
33
|
export declare function createVaultAndAssociatedStates({ bankineco, bankIndex, vaultType, yieldingMint, yieldingMintDecimals, yieldingTokenIndex, vaultCreator, oracles, yieldingMintTokenProgram, initialYieldingMintPrice, defaultFeeBps, externalYieldManager, squadsTxParams, }: CreateVaultParams): Promise<void>;
|
|
34
34
|
export declare function mintUsdStarFromYieldingTx(bankineco: BankinecoProgram, yieldingAmount: BN, fromYieldingMint: PublicKey, fromYieldingMintDecimals?: number): Promise<Transaction>;
|
|
35
|
-
export declare function burnUsdStarForYieldingTx(bankineco: BankinecoProgram, usdStarAmount: BN, toYieldingMint: PublicKey,
|
|
35
|
+
export declare function burnUsdStarForYieldingTx(bankineco: BankinecoProgram, usdStarAmount: BN, toYieldingMint: PublicKey, toYieldingMintDecimals?: number): Promise<Transaction>;
|
|
36
36
|
export declare function getLookupTableInputs(connection: Connection, lookupTables: PublicKey[]): Promise<(AddressLookupTableAccount | null)[]>;
|
|
37
37
|
export declare function createVersionedTransactionWithLuts(connection: Connection, transaction: Transaction, lookupTables?: AddressLookupTableAccount[], recentBlockhash?: string): Promise<VersionedTransaction>;
|
|
38
38
|
export declare function toTxInstruction(ix: Instruction, dataEncoding?: "base64" | "hex"): TransactionInstruction;
|
|
@@ -133,14 +133,14 @@ async function mintUsdStarFromYieldingTx(bankineco, yieldingAmount, fromYielding
|
|
|
133
133
|
const mintIx = await bankineco.mintWYieldingGen(constants_1.USD_STAR_BANK_INDEX, idleVault, bankineco.provider.publicKey, new web3_js_1.PublicKey(constants_1.PROD_NEW_USD_STAR), fromYieldingMint, yieldingAmount, (0, mathUtils_1.calcYieldingToBankMint)(yieldingAmount, await (0, priceUtils_1.getLatestUsdStarUiPrice)(bankineco.provider.connection.rpcEndpoint), await (0, priceUtils_1.getLatestYieldingPrice)(bankineco, bankineco.oraclePDA(idleVault)), idleVaultInfo.config.mintingFeeBps, constants_1.USD_STAR_DECIMALS, fromYieldingMintDecimals));
|
|
134
134
|
return new web3_js_1.Transaction().add(maybeUserIx, mintIx);
|
|
135
135
|
}
|
|
136
|
-
async function burnUsdStarForYieldingTx(bankineco, usdStarAmount, toYieldingMint,
|
|
136
|
+
async function burnUsdStarForYieldingTx(bankineco, usdStarAmount, toYieldingMint, toYieldingMintDecimals = 6) {
|
|
137
137
|
if (!toYieldingMint.equals(new web3_js_1.PublicKey(constants_1.USDC_MINT))) {
|
|
138
138
|
throw new Error(`Yielding mint not currently supported: ${toYieldingMint.toString()}`);
|
|
139
139
|
}
|
|
140
140
|
const bank = bankineco.bankPDA(constants_1.USD_STAR_BANK_INDEX);
|
|
141
141
|
const idleVault = bankineco.vaultPDA(bank, toYieldingMint, constants_1.IDLE_VAULT_CONTRACT_INDICES[toYieldingMint.toString()]);
|
|
142
142
|
const idleVaultInfo = await bankineco.pg.account.vaultGenState.fetch(idleVault);
|
|
143
|
-
return await bankineco.burnForYieldingGen(constants_1.USD_STAR_BANK_INDEX, idleVault, bankineco.provider.publicKey, new web3_js_1.PublicKey(constants_1.PROD_NEW_USD_STAR), toYieldingMint, usdStarAmount, (0, mathUtils_1.calcBankMintToYielding)(usdStarAmount, await (0, priceUtils_1.getLatestUsdStarUiPrice)(bankineco.provider.connection.rpcEndpoint), await (0, priceUtils_1.getLatestYieldingPrice)(bankineco, bankineco.oraclePDA(idleVault)), idleVaultInfo.config.burningFeeBps, constants_1.USD_STAR_DECIMALS,
|
|
143
|
+
return await bankineco.burnForYieldingGen(constants_1.USD_STAR_BANK_INDEX, idleVault, bankineco.provider.publicKey, new web3_js_1.PublicKey(constants_1.PROD_NEW_USD_STAR), toYieldingMint, usdStarAmount, (0, mathUtils_1.calcBankMintToYielding)(usdStarAmount, await (0, priceUtils_1.getLatestUsdStarUiPrice)(bankineco.provider.connection.rpcEndpoint), await (0, priceUtils_1.getLatestYieldingPrice)(bankineco, bankineco.oraclePDA(idleVault)), idleVaultInfo.config.burningFeeBps, constants_1.USD_STAR_DECIMALS, toYieldingMintDecimals));
|
|
144
144
|
}
|
|
145
145
|
async function getLookupTableInputs(connection, lookupTables) {
|
|
146
146
|
return await Promise.all(lookupTables.map(async (x) => (await connection.getAddressLookupTable(x)).value));
|