UNPKG

@accret/bridge-sdk

Version:
46 lines 1.75 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.AccretBridgeClient = void 0; const lib_1 = require("./lib"); const types_1 = require("./types"); const constants_1 = require("./constants"); class AccretBridgeClient { constructor() { this.getQuote = lib_1.getQuote; this.executeSwap = lib_1.executeSwap; this.getTokenList = lib_1.getTokenList; //Exporting types and constants this.AccretSupportedChain = types_1.AccretSupportedChain; this.AccretSupportedProvider = types_1.AccretSupportedProvider; if (!AccretBridgeClient.instance) { AccretBridgeClient.instance = this; return; } return AccretBridgeClient.instance; } /** * Initializes the Accret bridge client with the provided API keys. * @param infuraApiKey - The Infura API key. * @param heliusApiKey - The Helius API key. * @throws An error if any of the API keys are invalid. */ async configure({ infuraApiKey, heliusApiKey, }) { if (!infuraApiKey || typeof infuraApiKey !== "string" || infuraApiKey.trim().length === 0) { throw new Error("Invalid Infura API key: API key must be a non-empty string"); } if (!heliusApiKey || typeof heliusApiKey !== "string" || heliusApiKey.trim().length === 0) { throw new Error("Invalid Helius API key: API key must be a non-empty string"); } await (0, constants_1.setAPIKeys)({ infuraApiKey, heliusApiKey, }); return AccretBridgeClient.instance; } } exports.AccretBridgeClient = AccretBridgeClient; //# sourceMappingURL=index.js.map