UNPKG

@bagsfm/bags-sdk

Version:

TypeScript SDK for Bags

27 lines 1.19 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.getExistingConfig = getExistingConfig; const constants_1 = require("../constants"); const bs58_1 = __importDefault(require("bs58")); const bn_js_1 = __importDefault(require("bn.js")); async function getExistingConfig(feeClaimer, connection, commitment) { try { const accounts = await connection.getProgramAccounts(constants_1.METEORA_DBC_PROGRAM_ID, { filters: [ { memcmp: { offset: 40, bytes: feeClaimer.toBase58() } }, { memcmp: { offset: 72, bytes: constants_1.BAGS_TOKEN_CREATION_AUTHORITY.toBase58() } }, { memcmp: { offset: 104, bytes: bs58_1.default.encode(new bn_js_1.default(20000000).toArray('le', 8)) } }, ], commitment: commitment, }); return accounts.length > 0 ? accounts[0].pubkey : null; } catch (err) { console.error('Error fetching config from RPC:', err); return null; } } //# sourceMappingURL=config.js.map