@swaptoshi/liquid-pos-client
Version:
Client for interacting with blockchain networks that implements the Swaptoshi liquid pos module
31 lines • 1.02 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.LiquidPosEndpointClient = void 0;
const client_1 = require("@klayr/client");
class LiquidPosEndpointClient {
constructor(url, mode) {
this._url = url;
this._mode = mode;
}
async getConfig() {
const client = await this._getClient();
const result = await client.invoke('liquidPos_getConfig', {});
return result;
}
async getLSTTokenID() {
const client = await this._getClient();
const result = await client.invoke('liquidPos_getLSTTokenID', {});
return result;
}
async _getClient() {
if (this._mode === 'ipc') {
return client_1.apiClient.createIPCClient(this._url);
}
if (this._mode === 'ws') {
return client_1.apiClient.createWSClient(this._url);
}
throw new Error('unknown mode');
}
}
exports.LiquidPosEndpointClient = LiquidPosEndpointClient;
//# sourceMappingURL=endpoint.js.map