Add bisqJS and liquidJS npm modules.
This commit is contained in:
11
examples/nodejs/bisq-js/addresses.ts
Normal file
11
examples/nodejs/bisq-js/addresses.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import bisqJS from "./../../../src/index-bisq";
|
||||
|
||||
const init = async () => {
|
||||
const { addresses } = bisqJS();
|
||||
|
||||
const address = 'B1DgwRN92rdQ9xpEVCdXRfgeqGw9X4YtrZz';
|
||||
|
||||
const myAddress = await addresses.getAddress({ address });
|
||||
console.log(myAddress);
|
||||
};
|
||||
init();
|
||||
24
examples/nodejs/bisq-js/blocks.ts
Normal file
24
examples/nodejs/bisq-js/blocks.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import bisqJS from "./../../../src/index-bisq";
|
||||
|
||||
const init = async () => {
|
||||
try {
|
||||
const { blocks } = bisqJS();
|
||||
|
||||
const hash = '000000000000000000079aa6bfa46eb8fc20474e8673d6e8a123b211236bf82d';
|
||||
|
||||
const block = await blocks.getBlock({ hash });
|
||||
console.log(block);
|
||||
|
||||
const myBlocks = await blocks.getBlocks({ index: 0, length: 1 });
|
||||
console.log(myBlocks);
|
||||
|
||||
const myBlocksHeight = await blocks.getBlocksTipHeight({
|
||||
index: 0,
|
||||
length: 1,
|
||||
});
|
||||
console.log(myBlocksHeight);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
init();
|
||||
38
examples/nodejs/bisq-js/markets.ts
Normal file
38
examples/nodejs/bisq-js/markets.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import bisqJS from "./../../../src/index-bisq";
|
||||
|
||||
const init = async () => {
|
||||
try {
|
||||
const { markets } = bisqJS();
|
||||
|
||||
const market = "BTC_USD";
|
||||
const basecurrency = "BTC";
|
||||
|
||||
const allMarkets = await markets.getMarkets();
|
||||
console.log(allMarkets);
|
||||
|
||||
const currencies = await markets.getCurrencies();
|
||||
console.log(currencies);
|
||||
|
||||
const depth = await markets.getDepth({ market });
|
||||
console.log(depth)
|
||||
|
||||
const hloc = await markets.getHloc({ market });
|
||||
console.log(hloc);
|
||||
|
||||
const offers = await markets.getOffers({ market });
|
||||
console.log(offers);
|
||||
|
||||
const ticker = await markets.getTicker({ market });
|
||||
console.log(ticker);
|
||||
|
||||
const trades = await markets.getTrades({ market });
|
||||
console.log(trades);
|
||||
|
||||
const volumes = await markets.getVolumes({ basecurrency, market });
|
||||
console.log(volumes);
|
||||
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
init();
|
||||
13
examples/nodejs/bisq-js/statistics.ts
Normal file
13
examples/nodejs/bisq-js/statistics.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import bisqJS from "./../../../src/index-bisq";
|
||||
|
||||
const init = async () => {
|
||||
try {
|
||||
const { statistics } = bisqJS();
|
||||
|
||||
const stats = await statistics.getStats();
|
||||
console.log(stats);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
init();
|
||||
18
examples/nodejs/bisq-js/transactions.ts
Normal file
18
examples/nodejs/bisq-js/transactions.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import bisqJS from "./../../../src/index-bisq";
|
||||
|
||||
const init = async () => {
|
||||
try {
|
||||
const { transactions } = bisqJS();
|
||||
|
||||
const txid = '4b5417ec5ab6112bedf539c3b4f5a806ed539542d8b717e1c4470aa3180edce5';
|
||||
|
||||
const tx = await transactions.getTx({ txid });
|
||||
console.log(tx);
|
||||
|
||||
const txs = await transactions.getTxs({ index: 0, length: 1 });
|
||||
console.log(txs);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
init();
|
||||
Reference in New Issue
Block a user