From 103920f18ee5b10ecb387640e439c06458fa51ae Mon Sep 17 00:00:00 2001 From: Mahmoud Aboelenein Date: Thu, 28 Mar 2024 04:03:16 +0200 Subject: [PATCH] update sats-connect-core and implement wallet action loading --- README.md | 14 ++++++++- package-lock.json | 72 ++++++++++++++++++++++++++++++++++++++++++----- package.json | 2 +- src/index.ts | 23 +++++++++------ 4 files changed, 94 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index ccf5dab..e095a07 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,17 @@ # Sats Connect +![Banner](data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTkyMCIgaGVpZ2h0PSI2MDAiIHZpZXdCb3g9IjAgMCAxOTIwIDYwMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9IjE5MjAiIGhlaWdodD0iNjAwIiBmaWxsPSIjRkY0RDAwIi8+CjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMF8xMV80MzMwKSI+CjxwYXRoIGZpbGwtcnVsZT0iZXZlbm9kZCIgY2xpcC1ydWxlPSJldmVub2RkIiBkPSJNNjQyLjI2NyAyNDQuMjQyQzY0Mi4yNjcgMjM5LjEzOCA2NDYuMzU2IDIzNSA2NTEuNCAyMzVINjYwLjUzM0g2NzguOEg2ODcuOTMzQzY5Mi45NzcgMjM1IDY5Ny4wNjcgMjM5LjEzOCA2OTcuMDY3IDI0NC4yNDJWMjUzLjQ4NEg2NzguOEg2NjAuNTMzSDY0Mi4yNjdWMjQ0LjI0MlpNNjQyLjI2NyAyOTAuNDUySDYzMy4xMzNDNjI4LjA4OSAyOTAuNDUyIDYyNCAyODYuMzE0IDYyNCAyODEuMjFWMjcxLjk2OFYyNjIuNzI2QzYyNCAyNTcuNjIyIDYyOC4wODkgMjUzLjQ4NCA2MzMuMTMzIDI1My40ODRINjQyLjI2N1YyNzEuOTY4VjI5MC40NTJaTTY5Ny4w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jxyZWN0IHdpZHRoPSI2NzIuMzE0IiBoZWlnaHQ9IjEyOS4zODkiIGZpbGw9IndoaXRlIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSg2MjQgMjM1KSIvPgo8L2NsaXBQYXRoPgo8L2RlZnM+Cjwvc3ZnPgo=) + Sats connect is a simple javascript library that connects apps to Bitcoin wallets like Xverse to retrieve user wallet addresses and sign transactions (PSBTs). -[Read the docs](https://docs.xverse.app/sats-connect/) +## Quick start + +```bash +npm i sats-connect +``` + + +## Documentation + +For full documentation, visit [docs.xverse.app](https://docs.xverse.app/sats-connect/). + diff --git a/package-lock.json b/package-lock.json index aabf57c..2396deb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "2.1.0", "license": "ISC", "dependencies": { - "@sats-connect/core": "0.0.1-80ec315", + "@sats-connect/core": "0.0.2-7d8cb11", "@sats-connect/ui": "0.0.2-fa73f78" }, "devDependencies": { @@ -1046,11 +1046,12 @@ ] }, "node_modules/@sats-connect/core": { - "version": "0.0.1-80ec315", - "resolved": "https://registry.npmjs.org/@sats-connect/core/-/core-0.0.1-80ec315.tgz", - "integrity": "sha512-SoChwCTEClawqIHMOByW7SWcZpNeWCJ9lCsVZz6dSw6kB96ZsCmTfyoe/jDlDfCXPR0Sn5XkPSYjDRfNtSByDw==", + "version": "0.0.2-7d8cb11", + "resolved": "https://registry.npmjs.org/@sats-connect/core/-/core-0.0.2-7d8cb11.tgz", + "integrity": "sha512-v0fiGZ89Yxg8dQjKFx558yUHHxbkxBWvtF0QtiX37roRtXasp9WphV61Q39+8FriUJQpTbgobzmuePpMl30FKA==", "dependencies": { "bitcoin-address-validation": "2.2.3", + "buffer": "6.0.3", "jsontokens": "4.0.1", "lodash.omit": "4.5.0" } @@ -1485,6 +1486,29 @@ "node-int64": "^0.4.0" } }, + "node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, "node_modules/buffer-from": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", @@ -2132,6 +2156,25 @@ "url": "https://github.com/sponsors/typicode" } }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, "node_modules/import-local": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.1.0.tgz", @@ -5313,11 +5356,12 @@ "integrity": "sha512-hOUk6AyBFmqVrv7k5WAw/LpszxVbj9gGN4JRkIX52fdFAj1UA61KXmZDvqVEm+pOyec3+fIeZB02LYa/pWOArw==" }, "@sats-connect/core": { - "version": "0.0.1-80ec315", - "resolved": "https://registry.npmjs.org/@sats-connect/core/-/core-0.0.1-80ec315.tgz", - "integrity": "sha512-SoChwCTEClawqIHMOByW7SWcZpNeWCJ9lCsVZz6dSw6kB96ZsCmTfyoe/jDlDfCXPR0Sn5XkPSYjDRfNtSByDw==", + "version": "0.0.2-7d8cb11", + "resolved": "https://registry.npmjs.org/@sats-connect/core/-/core-0.0.2-7d8cb11.tgz", + "integrity": "sha512-v0fiGZ89Yxg8dQjKFx558yUHHxbkxBWvtF0QtiX37roRtXasp9WphV61Q39+8FriUJQpTbgobzmuePpMl30FKA==", "requires": { "bitcoin-address-validation": "2.2.3", + "buffer": "6.0.3", "jsontokens": "4.0.1", "lodash.omit": "4.5.0" } @@ -5674,6 +5718,15 @@ "node-int64": "^0.4.0" } }, + "buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "requires": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, "buffer-from": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", @@ -6143,6 +6196,11 @@ "integrity": "sha512-+dQSyqPh4x1hlO1swXBiNb2HzTDN1I2IGLQx1GrBuiqFJfoMrnZWwVmatvSiO+Iz8fBUnf+lekwNo4c2LlXItg==", "dev": true }, + "ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==" + }, "import-local": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.1.0.tgz", diff --git a/package.json b/package.json index db33cc0..86edf16 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ ] }, "dependencies": { - "@sats-connect/core": "0.0.1-80ec315", + "@sats-connect/core": "0.0.2-7d8cb11", "@sats-connect/ui": "0.0.2-fa73f78" }, "devDependencies": { diff --git a/src/index.ts b/src/index.ts index f7330b2..026ac8a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -13,7 +13,14 @@ import { BaseAdapter, createDefaultConfig, } from '@sats-connect/core'; -import { Config, loadSelector, selectWalletProvider, close } from '@sats-connect/ui'; +import { + Config, + loadSelector, + selectWalletProvider, + close, + walletOpen, + walletClose, +} from '@sats-connect/ui'; loadSelector(); @@ -46,7 +53,6 @@ class Wallet { : createDefaultConfig(providers); const nextProviderId = await selectWalletProvider(selectorConfig); this.providerId = nextProviderId; - close(); } static async disconnect() { @@ -67,18 +73,19 @@ class Wallet { } } const adapter = { ...this.defaultAdapters, ...this.userAdapters }[this.providerId as string]; + walletOpen(this.providerId as string); const response = adapter ? await new adapter().request(method, params) : await new BaseAdapter(this.providerId as string).request(method, params); - if ( - !defaultProvider && - response?.status === 'error' && - response.error?.code === RpcErrorCode.USER_REJECTION - ) { - this.providerId = undefined; + walletClose(); + if (response?.status === 'error' && response.error?.code === RpcErrorCode.USER_REJECTION) { + if (!defaultProvider) { + this.providerId = undefined; + } } else { setDefaultProvider(this.providerId as string); } + close(); if (!response) { return { status: 'error',