diff --git a/README.md b/README.md index 08fdc26..9466087 100644 --- a/README.md +++ b/README.md @@ -54,3 +54,16 @@ await Wallet.disconnect(); ## Documentation For full documentation, visit [docs.xverse.app](https://docs.xverse.app/sats-connect/). + +## Development + +### Build the package + +```bash +npm run build +``` +### Run example app + +```bash +npm run dev:example +``` diff --git a/example/package-lock.json b/example/package-lock.json index aff1d12..99673d6 100644 --- a/example/package-lock.json +++ b/example/package-lock.json @@ -20,11 +20,12 @@ } }, "..": { - "version": "2.1.0", + "version": "2.2.0", "license": "ISC", "dependencies": { - "@sats-connect/core": "0.0.4", - "@sats-connect/ui": "0.0.3" + "@sats-connect/core": "0.0.5", + "@sats-connect/make-default-provider-config": "0.0.1", + "@sats-connect/ui": "0.0.4" }, "devDependencies": { "husky": "^8.0.3", @@ -33,7 +34,7 @@ "rimraf": "^3.0.2", "ts-jest": "^29.0.5", "tsup": "^8.0.2", - "typescript": "^4.9.4" + "typescript": "5" } }, "node_modules/@aashutoshrathi/word-wrap": { diff --git a/package-lock.json b/package-lock.json index 74d0f35..6410633 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,8 +9,9 @@ "version": "2.2.0", "license": "ISC", "dependencies": { - "@sats-connect/core": "0.0.4", - "@sats-connect/ui": "0.0.3" + "@sats-connect/core": "0.0.5", + "@sats-connect/make-default-provider-config": "0.0.1", + "@sats-connect/ui": "0.0.4" }, "devDependencies": { "husky": "^8.0.3", @@ -19,7 +20,7 @@ "rimraf": "^3.0.2", "ts-jest": "^29.0.5", "tsup": "^8.0.2", - "typescript": "^4.9.4" + "typescript": "5" } }, "node_modules/@ampproject/remapping": { @@ -1747,6 +1748,51 @@ ] }, "node_modules/@sats-connect/core": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/@sats-connect/core/-/core-0.0.5.tgz", + "integrity": "sha512-eyAoxjs3vuJP037/XKuhjIDUrOlCHIdcvw2D1DFpzhTRzyiXptiE2A0n46loDIBCUhOuXl4vsn8cc+yC2jzGCg==", + "dependencies": { + "axios": "1.6.8", + "bitcoin-address-validation": "2.2.3", + "buffer": "6.0.3", + "jsontokens": "4.0.1", + "lodash.omit": "4.5.0" + } + }, + "node_modules/@sats-connect/make-default-provider-config": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/@sats-connect/make-default-provider-config/-/make-default-provider-config-0.0.1.tgz", + "integrity": "sha512-Hb1ZbpJ3DnRM7vRUvNepUs6/SVAeH4CdeDsTllXrzOG9jAG4HI+jG7WGDLavFHc6vQCSfTBPH4c/L7S74hMZMg==", + "dependencies": { + "@sats-connect/core": "0.0.4-caef0cb", + "@sats-connect/ui": "0.0.3-07f4874", + "bowser": "2.11.0" + }, + "peerDependencies": { + "typescript": "5.4.4" + } + }, + "node_modules/@sats-connect/make-default-provider-config/node_modules/@sats-connect/core": { + "version": "0.0.4-caef0cb", + "resolved": "https://registry.npmjs.org/@sats-connect/core/-/core-0.0.4-caef0cb.tgz", + "integrity": "sha512-M/yxUgnYF6JVhfLxMj0pLYZFiJfwkd7C3GYI43aVbaIVhqoSBianEEj2duIiSDAQLC03Scqbt2LXUu42dPs1fA==", + "dependencies": { + "axios": "1.6.8", + "bitcoin-address-validation": "2.2.3", + "buffer": "6.0.3", + "jsontokens": "4.0.1", + "lodash.omit": "4.5.0" + } + }, + "node_modules/@sats-connect/make-default-provider-config/node_modules/@sats-connect/ui": { + "version": "0.0.3-07f4874", + "resolved": "https://registry.npmjs.org/@sats-connect/ui/-/ui-0.0.3-07f4874.tgz", + "integrity": "sha512-H1rj4qOGr72M2pSFtgtFk9TjFHRhTt4vm2ct0iBJaLF4RLIa9EvPkFTMwBYhGBYNcuBpN36eYUBN7hRydfCopg==", + "dependencies": { + "@sats-connect/core": "0.0.4" + } + }, + "node_modules/@sats-connect/make-default-provider-config/node_modules/@sats-connect/ui/node_modules/@sats-connect/core": { "version": "0.0.4", "resolved": "https://registry.npmjs.org/@sats-connect/core/-/core-0.0.4.tgz", "integrity": "sha512-v+u49OXku8S5Mh9wzQ6pSdNU4MppMjjUyXy/ZBE6KxqgP7Nnnz3N2VmaBSIGQx/EEy4O3L8SnJZyAwQ7QfOf7g==", @@ -1759,12 +1805,9 @@ } }, "node_modules/@sats-connect/ui": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/@sats-connect/ui/-/ui-0.0.3.tgz", - "integrity": "sha512-IzK63qgwyrha/ngTHfwj4vwr518eYs45mrXQYamvridGX7VpbLksZlAl4McX/blq+t9DnnAK2apBk5ut441ovg==", - "dependencies": { - "@sats-connect/core": "0.0.4" - } + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/@sats-connect/ui/-/ui-0.0.4.tgz", + "integrity": "sha512-gmfsqPn44vsJubQC7KuK7zGnBgpLvDzadMlyCwsaBsASV7u8AxNdNas0xVEy6eIBa0Eim7AGcGNTulBFI8YRnA==" }, "node_modules/@sinclair/typebox": { "version": "0.25.24", @@ -2161,6 +2204,11 @@ "sha256-uint8array": "^0.10.3" } }, + "node_modules/bowser": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/bowser/-/bowser-2.11.0.tgz", + "integrity": "sha512-AlcaJBi/pqqJBIQ8U9Mcpc9i8Aqxn88Skv5d+xBX006BY5u8N3mGLHa5Lgppa7L/HfwgwLgZ6NYs+Ag6uUmJRA==" + }, "node_modules/brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -5904,16 +5952,15 @@ } }, "node_modules/typescript": { - "version": "4.9.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", - "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", - "dev": true, + "version": "5.4.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.4.tgz", + "integrity": "sha512-dGE2Vv8cpVvw28v8HCPqyb08EzbBURxDpuhJvTrusShUfGnhHBafDsLdS1EhhxyL6BJQE+2cT3dDPAv+MQ6oLw==", "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" }, "engines": { - "node": ">=4.2.0" + "node": ">=14.17" } }, "node_modules/update-browserslist-db": { @@ -7290,9 +7337,9 @@ "optional": true }, "@sats-connect/core": { - "version": "0.0.4", - "resolved": "https://registry.npmjs.org/@sats-connect/core/-/core-0.0.4.tgz", - "integrity": "sha512-v+u49OXku8S5Mh9wzQ6pSdNU4MppMjjUyXy/ZBE6KxqgP7Nnnz3N2VmaBSIGQx/EEy4O3L8SnJZyAwQ7QfOf7g==", + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/@sats-connect/core/-/core-0.0.5.tgz", + "integrity": "sha512-eyAoxjs3vuJP037/XKuhjIDUrOlCHIdcvw2D1DFpzhTRzyiXptiE2A0n46loDIBCUhOuXl4vsn8cc+yC2jzGCg==", "requires": { "axios": "1.6.8", "bitcoin-address-validation": "2.2.3", @@ -7301,14 +7348,57 @@ "lodash.omit": "4.5.0" } }, - "@sats-connect/ui": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/@sats-connect/ui/-/ui-0.0.3.tgz", - "integrity": "sha512-IzK63qgwyrha/ngTHfwj4vwr518eYs45mrXQYamvridGX7VpbLksZlAl4McX/blq+t9DnnAK2apBk5ut441ovg==", + "@sats-connect/make-default-provider-config": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/@sats-connect/make-default-provider-config/-/make-default-provider-config-0.0.1.tgz", + "integrity": "sha512-Hb1ZbpJ3DnRM7vRUvNepUs6/SVAeH4CdeDsTllXrzOG9jAG4HI+jG7WGDLavFHc6vQCSfTBPH4c/L7S74hMZMg==", "requires": { - "@sats-connect/core": "0.0.4" + "@sats-connect/core": "0.0.4-caef0cb", + "@sats-connect/ui": "0.0.3-07f4874", + "bowser": "2.11.0" + }, + "dependencies": { + "@sats-connect/core": { + "version": "0.0.4-caef0cb", + "resolved": "https://registry.npmjs.org/@sats-connect/core/-/core-0.0.4-caef0cb.tgz", + "integrity": "sha512-M/yxUgnYF6JVhfLxMj0pLYZFiJfwkd7C3GYI43aVbaIVhqoSBianEEj2duIiSDAQLC03Scqbt2LXUu42dPs1fA==", + "requires": { + "axios": "1.6.8", + "bitcoin-address-validation": "2.2.3", + "buffer": "6.0.3", + "jsontokens": "4.0.1", + "lodash.omit": "4.5.0" + } + }, + "@sats-connect/ui": { + "version": "0.0.3-07f4874", + "resolved": "https://registry.npmjs.org/@sats-connect/ui/-/ui-0.0.3-07f4874.tgz", + "integrity": "sha512-H1rj4qOGr72M2pSFtgtFk9TjFHRhTt4vm2ct0iBJaLF4RLIa9EvPkFTMwBYhGBYNcuBpN36eYUBN7hRydfCopg==", + "requires": { + "@sats-connect/core": "0.0.4" + }, + "dependencies": { + "@sats-connect/core": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/@sats-connect/core/-/core-0.0.4.tgz", + "integrity": "sha512-v+u49OXku8S5Mh9wzQ6pSdNU4MppMjjUyXy/ZBE6KxqgP7Nnnz3N2VmaBSIGQx/EEy4O3L8SnJZyAwQ7QfOf7g==", + "requires": { + "axios": "1.6.8", + "bitcoin-address-validation": "2.2.3", + "buffer": "6.0.3", + "jsontokens": "4.0.1", + "lodash.omit": "4.5.0" + } + } + } + } } }, + "@sats-connect/ui": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/@sats-connect/ui/-/ui-0.0.4.tgz", + "integrity": "sha512-gmfsqPn44vsJubQC7KuK7zGnBgpLvDzadMlyCwsaBsASV7u8AxNdNas0xVEy6eIBa0Eim7AGcGNTulBFI8YRnA==" + }, "@sinclair/typebox": { "version": "0.25.24", "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.25.24.tgz", @@ -7639,6 +7729,11 @@ "sha256-uint8array": "^0.10.3" } }, + "bowser": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/bowser/-/bowser-2.11.0.tgz", + "integrity": "sha512-AlcaJBi/pqqJBIQ8U9Mcpc9i8Aqxn88Skv5d+xBX006BY5u8N3mGLHa5Lgppa7L/HfwgwLgZ6NYs+Ag6uUmJRA==" + }, "brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -10283,10 +10378,9 @@ "peer": true }, "typescript": { - "version": "4.9.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", - "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", - "dev": true + "version": "5.4.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.4.tgz", + "integrity": "sha512-dGE2Vv8cpVvw28v8HCPqyb08EzbBURxDpuhJvTrusShUfGnhHBafDsLdS1EhhxyL6BJQE+2cT3dDPAv+MQ6oLw==" }, "update-browserslist-db": { "version": "1.0.10", diff --git a/package.json b/package.json index 885c602..d1ce671 100644 --- a/package.json +++ b/package.json @@ -22,8 +22,9 @@ ] }, "dependencies": { - "@sats-connect/core": "0.0.4", - "@sats-connect/ui": "0.0.3" + "@sats-connect/core": "0.0.5", + "@sats-connect/ui": "0.0.4", + "@sats-connect/make-default-provider-config": "0.0.1" }, "devDependencies": { "husky": "^8.0.3", @@ -32,7 +33,7 @@ "rimraf": "^3.0.2", "ts-jest": "^29.0.5", "tsup": "^8.0.2", - "typescript": "^4.9.4" + "typescript": "5" }, "repository": { "type": "git", diff --git a/src/index.ts b/src/index.ts index b2d8e86..c959cb3 100644 --- a/src/index.ts +++ b/src/index.ts @@ -11,7 +11,6 @@ import { removeDefaultProvider, RpcErrorCode, BaseAdapter, - createDefaultConfig, } from '@sats-connect/core'; import { Config, @@ -21,6 +20,7 @@ import { walletOpen, walletClose, } from '@sats-connect/ui'; +import { makeDefaultConfig } from '@sats-connect/make-default-provider-config'; loadSelector(); @@ -48,9 +48,11 @@ class Wallet { throw new Error('No wallets detected, may want to prompt user to install a wallet.'); } + console.log('[ARY]: providers', providers); + const selectorConfig = this.createCustomConfig ? this.createCustomConfig(providers) - : createDefaultConfig(providers); + : makeDefaultConfig(providers); const nextProviderId = await selectWalletProvider(selectorConfig); this.providerId = nextProviderId; }