@vsc.eco/crosschain-sdk
v0.0.3
Published
High-level Magi (VSC) L2 client — quickSwap, pool queries, signer integration via Aioha
Readme
@vsc.eco/crosschain-sdk
High-level client for the Magi (VSC) cross-chain DEX. Wraps @vsc.eco/crosschain-core with pool, price, and balance providers plus a quickSwap() orchestrator that composes the 1- or 2-hop swap, signs via Aioha, and broadcasts.
Supports HIVE ↔ HBD ↔ BTC — all swaps are mainnet-to-mainnet; the VSC L2 is used internally for routing.
Install
pnpm add @vsc.eco/crosschain-sdk
# optional, for signing HIVE/HBD input:
pnpm add @aioha/aiohaSigned swap (HIVE/HBD input)
import { createMagi, CoinAmount } from '@vsc.eco/crosschain-sdk';
import { KeyTypes } from '@aioha/aioha';
const magi = createMagi({ aioha });
const { txId } = await magi.quickSwap(
{
username: 'alice',
assetIn: 'HBD',
amountIn: CoinAmount.fromDecimal('10', 'HBD'),
assetOut: 'BTC',
recipient: 'bc1q...'
},
KeyTypes.Active
);Build-only (broadcast yourself)
const { ops, preview } = await magi.buildQuickSwap({ /* ... */ });
// ops = [transferOp, customJsonOp] — pass to your own signerBTC-input flow (no wallet connection)
const { address } = await magi.getBtcDepositAddress({
recipient: 'alice',
assetOut: 'HIVE',
destinationChain: 'HIVE'
});
// User sends BTC to `address` from any wallet; mapping bot handles the rest.See also
@vsc.eco/crosschain-core— the math + op layer used by this client.@vsc.eco/crosschain-widget— drop-in UI built on this SDK.- Repository README — integration paths, referral-fee model, full API surface.
