sdk-connect-js
v1.0.9
Published
SDK Connect for VChain
Downloads
13
Readme
SDK Connect
Install package
npm install sdk-connect-js
Usage
Import pkg
import SDK from "sdk-connect-js";
Connect
const sdk = new SDK(SDK_ENDPOINT);
// dApp: create connection
var connectionId = await sdk.createConnection();
var embeddedLink = await sdk.getConnectionEmbeddedLink(connectionId);
var qrCodeLink = await sdk.getConnectionQrCodeLink(connectionId);
// Wallet: update connection address
var connection = await sdk.submitConnectionAddress(
connectionId,
"0x52ec083d30192691872b60334bfdd1450c1826d9"
);
// dApp: get connection address
var connectionAddress = await sdk.getConnectionAddress(connectionId);
Sign Transaction
const sdk = new SDK(SDK_ENDPOINT);
// dApp: create Tx
const txUuid = await sdk.submitTx(/* RawTx */);
const embeddedLink = await sdk.getEmbeddedLink(txUuid);
const qrCodeLink = await sdk.getQrCodeLink(txUuid);
// Wallet: sign Tx
const rawTx = await sdk.getRawTx(txUuid);
await sdk.submitSignedTx(txUuid, "0x123456789abcdef");
// dApp: continue process signed Tx
const signedTx = await sdk.getSignedTx(txUuid);