betamax-connect
v0.1.5
Published
api for connecting to betamax wallet
Downloads
10
Readme
betamax-connect
A simple API for connecting to betamax wallet(transaction not supported). By utilizing unique string that can be used as QR code.
How To Use
install it:
npm install betamax-connect
create a new worker:
import * as betamax from "betamax-connect";
let api = new betamax.Worker(false); // false for testnet and true for mainnet
request a unique string to be used as qr:
let uniqueString = await api.request(
"http://some.icon.jpg",
"http://some.website.com",
"some random website"
);
then wait for the qr code to be scanned:
let response = await api.connect();
to get the wallet after receiving the response:
let wallets = api.getWallets(); // get the wallet
Example
import * as betamax from "betamax-connect";
async function main() {
let api = new betamax.Worker(false);
/**
* ```betamax-qr[-]http://some.icon.jpg[-]http://some.website.com[-]some random website[-]1ba8aa4c-fcdc-46fc-a288-2a3e67ea7bb3```
*
* this can be used as a qr code
* */
let uniqueString = await api.request(
"http://some.icon.jpg",
"http://some.website.com",
"some random website"
);
/**
* example response:
* ```json
*{ status: true, message: 'INVALID', data: null }
* ```
*/
let response = await api.connect(10000); // timeout 10 seconds
let wallets = api.getWallets(); // get the wallet
}
main();
You can evaluate the response
message by using builtin constant type that this api provided:
INVALID
REJECTED
ACCEPTED
PENDING
CANCELLED