From 70ac8196367a38803ee6c95fb71c0c5a7ef9936c Mon Sep 17 00:00:00 2001 From: Mahmoud Aboelenein Date: Fri, 5 Apr 2024 08:34:55 +0200 Subject: [PATCH] add usage example in readme --- README.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/README.md b/README.md index f6458f3..cab91de 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,39 @@ Developers building apps on the Bitcoin ecosystem can use Sats connect to intera npm i sats-connect ``` +## Usage + +### import + +``` +import Wallet from 'sats-connect'; +``` + + +### Connect Wallet + +``` +const response = await Wallet.request('getAccounts', { + purposes: [ + AddressPurpose.Payment, + AddressPurpose.Ordinals, + AddressPurpose.Stacks + ], + message: 'Cool app wants to know your addresses!' +}); +``` +### Request a wallet action + +``` +await Wallet.request('sendTransfer', {...}); +``` + +### Disconnect Wallet + +``` +await Wallet.disconnect(); +``` + ## Documentation For full documentation, visit [docs.xverse.app](https://docs.xverse.app/sats-connect/).