UNPKG

@flipflop-sdk/node

Version:

FlipFlop Node.js SDK for programmatic token operations

64 lines 3.02 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getSystemConfig = void 0; const web3_js_1 = require("@solana/web3.js"); const utils_1 = require("./utils"); const constants_1 = require("./constants"); const config_1 = require("./config"); const getSystemConfig = async (options) => { // Validate required parameters if (!options.rpc) { return { success: false, message: "Missing --rpc parameter", }; } const rpc = new web3_js_1.Connection(options.rpc, "confirmed"); const config = config_1.CONFIGS[(0, config_1.getNetworkType)(options.rpc)]; const { program, programId } = await (0, utils_1.initProviderNoSigner)(rpc); try { const [launchRuleAccountPda] = web3_js_1.PublicKey.findProgramAddressSync([ Buffer.from(constants_1.LAUNCH_RULE_SEEDS), new web3_js_1.PublicKey(config.systemManagerAccount).toBuffer(), ], programId); const [systemConfigAccount] = web3_js_1.PublicKey.findProgramAddressSync([ Buffer.from(constants_1.SYSTEM_CONFIG_SEEDS), new web3_js_1.PublicKey(config.systemManagerAccount).toBuffer(), ], programId); const systemConfigAccountInfo = await program.account.systemConfigData.fetch(systemConfigAccount); if (!systemConfigAccountInfo) { return { success: false, message: "❌ Failed to get system config account data", }; } return { success: true, data: { systemConfigAccount, systemManagerAccount: new web3_js_1.PublicKey(config.systemManagerAccount), ...systemConfigAccountInfo, count: systemConfigAccountInfo.count.toNumber(), refundFeeRate: systemConfigAccountInfo.refundFeeRate, launchRuleAccount: launchRuleAccountPda, referrerResetIntervalSeconds: systemConfigAccountInfo.referrerResetIntervalSeconds.toNumber(), updateMetadataFee: systemConfigAccountInfo.updateMetadataFee.toNumber() / 1e9, customizedDeployFee: systemConfigAccountInfo.customizedDeployFee.toNumber() / 1e9, initPoolWsolAmount: systemConfigAccountInfo.initPoolWsolAmount.toNumber() / 100000, graduateFeeRate: systemConfigAccountInfo.graduateFeeRate.toNumber(), minGraduateFee: systemConfigAccountInfo.minGraduateFee.toNumber() / 1e9, raydiumCpmmCreateFee: systemConfigAccountInfo.raydiumCpmmCreateFee.toNumber() / 1e9, isPause: systemConfigAccountInfo.isPause, }, }; } catch (error) { return { success: false, message: "❌ Error displaying system config information:" + (error instanceof Error ? error.message : "Unknown error"), }; } }; exports.getSystemConfig = getSystemConfig; //# sourceMappingURL=system-config.js.map