UNPKG

@hubbleprotocol/farms-sdk

Version:
30 lines 1.88 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.initGlobalConfigCommand = initGlobalConfigCommand; const web3_js_1 = require("@solana/web3.js"); const Farms_1 = require("../Farms"); const accounts_1 = require("../rpc_client/accounts"); const utils_1 = require("./utils"); const utils_2 = require("../utils"); function initGlobalConfigCommand() { return __awaiter(this, void 0, void 0, function* () { const admin = process.env.ADMIN; const rpc = process.env.RPC; const env = (0, utils_1.initializeClient)(rpc, admin, (0, utils_2.getFarmsProgramId)(rpc), false); const globalConfig = web3_js_1.Keypair.generate(); const farmsClient = new Farms_1.Farms(env.provider.connection); yield farmsClient.createGlobalConfig(env.initialOwner, globalConfig, 1, env.web3Client); let globalConfigState = yield accounts_1.GlobalConfig.fetch(env.provider.connection, globalConfig.publicKey); console.log("Global Config", globalConfig.publicKey.toString(), globalConfigState === null || globalConfigState === void 0 ? void 0 : globalConfigState.toJSON()); }); } //# sourceMappingURL=init_global_config.js.map