UNPKG

fbonds-core

Version:

Banx protocol sdk

43 lines (42 loc) 2.06 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.fixBrokenBanxStake = void 0; const helpers_1 = require("../../../helpers"); const anchor_1 = require("@coral-xyz/anchor"); const fixBrokenBanxStake = (_a) => __awaiter(void 0, [_a], void 0, function* ({ programId, connection, accounts, sendTxn, }) { const program = (0, helpers_1.returnAnchorProgram)(connection); const instructions = []; const requestHeap = anchor_1.web3.ComputeBudgetProgram.setComputeUnitPrice({ microLamports: 150000 }); instructions.push(requestHeap); const accountsIntoInstruction = { banxStake: accounts.banxStake, user: accounts.userPubkey, systemProgram: anchor_1.web3.SystemProgram.programId, rent: anchor_1.web3.SYSVAR_RENT_PUBKEY, }; instructions.push(yield program.methods .fixBrokenBanxStake() .accountsStrict(accountsIntoInstruction) .instruction()); const addressesForLookupTable = [...Object.values(accountsIntoInstruction)]; const transaction = new anchor_1.web3.Transaction(); for (let instruction of instructions) transaction.add(instruction); const signers = []; yield sendTxn(transaction, signers); return { instructions, signers, addressesForLookupTable, }; }); exports.fixBrokenBanxStake = fixBrokenBanxStake;