From 04a5615d75daa9cca5c4b9da578cb8d39995ba9d Mon Sep 17 00:00:00 2001 From: Wei Su Date: Mon, 25 Sep 2023 15:08:56 +0800 Subject: [PATCH] doc: update README --- README.md | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/README.md b/README.md index 3a1ff59..b8e2a21 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,38 @@ # Cyber App SDK Create a CyberWallet app easily with Cyber App SDK. + +## Installation + +```bash +npm install cyber-app-sdk +``` + +## Getting Started + +### Connect to CyberWallet + +```javascript +import { CyberApp } from "@cyberlab/cyber-app-sdk"; + +const app = new CyberApp({ name: "testapp" }); +const { connected } = await app.start(); + +if (connected) { + console.log("Connected to CyberWallet"); +} else { + console.log("Connection to CyberWallet failed"); +} +``` + +### Send a transaction + +```javascript +const res = await app?.cyberWallet + ?.sendTransaction({ + to: address, + value: parseUnits("0.0001", 18), + data: "0x", + }) + .catch((err: any) => console.log({ err })); +```