UNPKG

@frakt-protocol/frakt-sdk

Version:

Frakt SDK for interacting with frakt.xyz protocols

41 lines (40 loc) 2.32 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()); }); }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const anchor_1 = __importDefault(require("@project-serum/anchor")); const web3_js_1 = require("@solana/web3.js"); const accounts_1 = require("../../contract_model/accounts"); const updateCollectionInfo = ({ programId, provider, liquidityPool, admin, creatorAddress, pricingLookupAddress, loanToValue, collaterizationRate, royaltyAddress, collectionInfo, royaltyFeeTime, royaltyFeePrice, expirationTime, isPriceBased, sendTxn, }) => __awaiter(void 0, void 0, void 0, function* () { const program = yield (0, accounts_1.returnAnchorProgram)(programId, provider); const instruction = yield program.instruction.updateCollectionInfo({ loanToValue: new anchor_1.default.BN(loanToValue), collaterizationRate: new anchor_1.default.BN(collaterizationRate), royaltyFeeTime: new anchor_1.default.BN(royaltyFeeTime), royaltyFeePrice: new anchor_1.default.BN(royaltyFeePrice), expirationTime: new anchor_1.default.BN(expirationTime), isPriceBased, }, { accounts: { liquidityPool: liquidityPool, collectionInfo: collectionInfo, admin: admin, creatorAddress: creatorAddress, royaltyAddress, pricingLookupAddress: pricingLookupAddress, }, }); const transaction = new web3_js_1.Transaction().add(instruction); yield sendTxn(transaction); }); exports.default = updateCollectionInfo;