@openocean.finance/widget-sdk
Version:
OpenOcean Any-to-Any Cross-Chain-Swap SDK
38 lines • 1.32 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.UTXO = UTXO;
const core_1 = require("@bigmi/core");
const widget_types_1 = require("@openocean.finance/widget-types");
const UTXOStepExecutor_js_1 = require("./UTXOStepExecutor.js");
const getUTXOBalance_js_1 = require("./getUTXOBalance.js");
function UTXO(options) {
const _options = options ?? {};
return {
get type() {
return widget_types_1.ChainType.UTXO;
},
isAddress: core_1.isUTXOAddress,
async resolveAddress(name) {
return name;
},
getBalance: getUTXOBalance_js_1.getUTXOBalance,
async getStepExecutor(options) {
if (!_options.getWalletClient) {
throw new Error('Client is not provided.');
}
const walletClient = await _options.getWalletClient();
const executor = new UTXOStepExecutor_js_1.UTXOStepExecutor({
client: walletClient,
routeId: options.routeId,
executionOptions: {
...options.executionOptions,
},
});
return executor;
},
setOptions(options) {
Object.assign(_options, options);
},
};
}
//# sourceMappingURL=UTXO.js.map