UNPKG

@kamino-finance/scope-sdk

Version:
33 lines 1.34 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.CONFIGURATION_SEED = void 0; exports.getConfigurationPda = getConfigurationPda; exports.getMintsToScopeChainPda = getMintsToScopeChainPda; const kit_1 = require("@solana/kit"); const programId_1 = require("../@codegen/scope/programId"); const bn_js_1 = __importDefault(require("bn.js")); exports.CONFIGURATION_SEED = 'conf'; const addressEncoder = (0, kit_1.getAddressEncoder)(); async function getConfigurationPda(feedName) { const [addr] = await (0, kit_1.getProgramDerivedAddress)({ seeds: [Buffer.from(exports.CONFIGURATION_SEED), Buffer.from(feedName)], programAddress: programId_1.PROGRAM_ID, }); return addr; } async function getMintsToScopeChainPda(prices, seed, seedId) { const [addr] = await (0, kit_1.getProgramDerivedAddress)({ seeds: [ Buffer.from('mints_to_scope_chains'), addressEncoder.encode(prices), addressEncoder.encode(seed), new Uint8Array(new bn_js_1.default(seedId).toBuffer('le', 8)), ], programAddress: programId_1.PROGRAM_ID, }); return addr; } //# sourceMappingURL=seeds.js.map