import { WebSocketClient } from "@radar/redshift-api-client";
const client = new WebSocketClient();
await client.connect();
const quoteRequest = {
market: "BTC_LBTC",
invoice: "lnbc1m1p0zwsllpp5np23cxgafxcqnk434v86rlnpght09gvnzwtrvy0y704nqtjtffvqdqdgdf4wgztv4uhxcqzpg3awyquek08frfexrphkm9sjwdggkfepm6uxex0lg4m8s0s59d7z8kdf9cajvc00cwl2nzu57qe9n92fv2mzm4hlgctw2x3v0lxcjrrcpul9wen",
refundAddress: "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa",
};
const quote = await client.requestQuote(quoteRequest);
console.log(quote);
// {
// orderId: "13283979-2c0b-45e4-b2e0-2a487535822e";
// expiryTimestampMs: 1578598212267;
// amount: "0.001056000000000000";
// details: {
// payToAddress: "3LKomc2i3rLm2TnA36U4pGH25cFWvRMnJB";
// redeemScript: "76a914d5846ccb08521347c1d5718ec460656d67427cbf8763752102369b4d174f601239daef6a83bf553092e139901e6ed19ffbcbedcee07be7a4ae6703575709b17576a914c1e27ac884310271f04dd1ebe9eb4e135113a1d08868ac";
// refundableAtBlockHeight: 612183;
// }
// }
import io from "socket.io-client";
const socket = io.connect("https://api.redshift.radar.tech/user/v1");
const request = {
market: "BTC_LBTC",
invoice: "lnbc1m1p0pv6fepp5kjf5zgm6590w77u3qtg38cjwxwz36l505q3gurl4nl8xw47t33msdqsgdf4wfmnyp9k27tncqzpgwrdthp4apgu7v4s53xc27clm82nkchmylm5huvwdd660q36e82vske04eeesljjyt89q3aglzr9l7l3yxpy5pwfl08unztfrqhcndesqyym288",
refundAddress: "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa",
};
socket.emit(
"requestQuote",
request,
({ success, message }: WebSocketResponse<Quote | string>) => {
console.log("Successful:", success, "Response Message:", message);
},
);