UNPKG

@hubbleprotocol/farms-sdk

Version:
49 lines 1.53 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.createAddExtraComputeUnitFeeTransaction = createAddExtraComputeUnitFeeTransaction; exports.initializeClient = initializeClient; exports.unwrap = unwrap; const web3_js_1 = require("@solana/web3.js"); const utils_1 = require("../utils"); function createAddExtraComputeUnitFeeTransaction(units, microLamports) { const ixns = []; ixns.push(web3_js_1.ComputeBudgetProgram.setComputeUnitLimit({ units })); ixns.push(web3_js_1.ComputeBudgetProgram.setComputeUnitPrice({ microLamports })); return ixns; } function initializeClient(cluster, admin, programId, multisig) { let resolvedCluster; let resolvedAdmin; if (cluster) { resolvedCluster = cluster; } else { throw "Must specify cluster"; } if (admin) { resolvedAdmin = admin; } else { throw "Must specify admin"; } // Get connection first const env = (0, utils_1.setUpProgram)({ adminFilePath: admin, clusterOverride: cluster, programOverride: programId, }); !multisig && console.log("\nSettings ⚙️"); !multisig && console.log("Program ID:", env.program.programId.toString()); !multisig && console.log("Admin:", resolvedAdmin); !multisig && console.log("Cluster:", resolvedCluster); return env; } function unwrap(val) { if (val) { return val; } else { throw new Error("Value is null"); } } //# sourceMappingURL=utils.js.map