UNPKG

fbonds-core

Version:

Banx protocol sdk

39 lines (38 loc) 2.4 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.updateBanxStakingSettings = void 0; const anchor_1 = require("@coral-xyz/anchor"); const helpers_1 = require("../../../helpers"); const constants_1 = require("../../../constants"); const updateBanxStakingSettings = (_a) => __awaiter(void 0, [_a], void 0, function* ({ programId, connection, args, accounts, sendTxn, }) { const program = (0, helpers_1.returnAnchorProgram)(connection); const instructions = []; const requestHeap = anchor_1.web3.ComputeBudgetProgram.setComputeUnitPrice({ microLamports: 400000 }); instructions.push(requestHeap); const [banxStakingSettings] = yield anchor_1.web3.PublicKey.findProgramAddress([constants_1.ENCODER.encode(constants_1.BANX_STAKING_SETTINGS_PREFIX)], program.programId); instructions.push(yield program.methods .updateBanxStakingSettings(new anchor_1.BN(args.maxTokenStakeAmount), new anchor_1.BN(args.tokensPerPartnerPoints), new anchor_1.BN(args.tokensPerWeek), new anchor_1.BN(args.tokensStaked), new anchor_1.BN(args.playerPointsStaked), new anchor_1.BN(args.partnerPointsStaked)) .accountsStrict({ systemProgram: anchor_1.web3.SystemProgram.programId, rent: anchor_1.web3.SYSVAR_RENT_PUBKEY, user: accounts.userPubkey, banxStakingSettings, }) .instruction()); const transaction = new anchor_1.web3.Transaction(); for (let instruction of instructions) transaction.add(instruction); const signers = []; yield sendTxn(transaction, signers); return { account: banxStakingSettings, instructions, signers }; }); exports.updateBanxStakingSettings = updateBanxStakingSettings;