UNPKG

@openocean.finance/widget-sdk

Version:

OpenOcean Any-to-Any Cross-Chain-Swap SDK

36 lines 1.2 kB
import { isUTXOAddress } from '@bigmi/core'; import { ChainType } from '@openocean.finance/widget-types'; import { UTXOStepExecutor } from './UTXOStepExecutor.js'; import { getUTXOBalance } from './getUTXOBalance.js'; export function UTXO(options) { const _options = options ?? {}; return { get type() { return ChainType.UTXO; }, isAddress: isUTXOAddress, async resolveAddress(name) { // Not supported on UTXO yet return name; }, getBalance: getUTXOBalance, async getStepExecutor(options) { if (!_options.getWalletClient) { throw new Error('Client is not provided.'); } const walletClient = await _options.getWalletClient(); const executor = new UTXOStepExecutor({ client: walletClient, routeId: options.routeId, executionOptions: { ...options.executionOptions, }, }); return executor; }, setOptions(options) { Object.assign(_options, options); }, }; } //# sourceMappingURL=UTXO.js.map