fully suport alby nostr-wallet-connect

This commit is contained in:
Ren Amamiya 2023-09-10 16:25:35 +07:00
parent a33c9d3517
commit 5bf816eba2
20 changed files with 425 additions and 364 deletions

View File

@ -50,6 +50,7 @@
"nostr-tools": "^1.14.2",
"qrcode.react": "^3.1.0",
"react": "^18.2.0",
"react-currency-input-field": "^3.6.11",
"react-dom": "^18.2.0",
"react-hook-form": "^7.46.1",
"react-hotkeys-hook": "^4.4.1",
@ -71,7 +72,7 @@
"@tauri-apps/cli": "^1.4.0",
"@trivago/prettier-plugin-sort-imports": "^4.2.0",
"@types/html-to-text": "^9.0.1",
"@types/node": "^20.5.9",
"@types/node": "^20.6.0",
"@types/react": "^18.2.21",
"@types/react-dom": "^18.2.7",
"@types/youtube-player": "^5.5.7",
@ -83,7 +84,7 @@
"cross-env": "^7.0.3",
"csstype": "^3.1.2",
"encoding": "^0.1.13",
"eslint": "^8.48.0",
"eslint": "^8.49.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-jsx-a11y": "^6.7.1",
"eslint-plugin-react": "^7.33.2",
@ -98,6 +99,6 @@
"tailwindcss": "^3.3.3",
"typescript": "^5.2.2",
"vite": "^4.4.9",
"vite-tsconfig-paths": "^4.2.0"
"vite-tsconfig-paths": "^4.2.1"
}
}

View File

@ -97,6 +97,9 @@ dependencies:
react:
specifier: ^18.2.0
version: 18.2.0
react-currency-input-field:
specifier: ^3.6.11
version: 3.6.11(react@18.2.0)
react-dom:
specifier: ^18.2.0
version: 18.2.0(react@18.2.0)
@ -157,8 +160,8 @@ devDependencies:
specifier: ^9.0.1
version: 9.0.1
'@types/node':
specifier: ^20.5.9
version: 20.5.9
specifier: ^20.6.0
version: 20.6.0
'@types/react':
specifier: ^18.2.21
version: 18.2.21
@ -170,10 +173,10 @@ devDependencies:
version: 5.5.7
'@typescript-eslint/eslint-plugin':
specifier: ^6.6.0
version: 6.6.0(@typescript-eslint/parser@6.6.0)(eslint@8.48.0)(typescript@5.2.2)
version: 6.6.0(@typescript-eslint/parser@6.6.0)(eslint@8.49.0)(typescript@5.2.2)
'@typescript-eslint/parser':
specifier: ^6.6.0
version: 6.6.0(eslint@8.48.0)(typescript@5.2.2)
version: 6.6.0(eslint@8.49.0)(typescript@5.2.2)
'@vitejs/plugin-react-swc':
specifier: ^3.3.2
version: 3.3.2(vite@4.4.9)
@ -193,20 +196,20 @@ devDependencies:
specifier: ^0.1.13
version: 0.1.13
eslint:
specifier: ^8.48.0
version: 8.48.0
specifier: ^8.49.0
version: 8.49.0
eslint-config-prettier:
specifier: ^9.0.0
version: 9.0.0(eslint@8.48.0)
version: 9.0.0(eslint@8.49.0)
eslint-plugin-jsx-a11y:
specifier: ^6.7.1
version: 6.7.1(eslint@8.48.0)
version: 6.7.1(eslint@8.49.0)
eslint-plugin-react:
specifier: ^7.33.2
version: 7.33.2(eslint@8.48.0)
version: 7.33.2(eslint@8.49.0)
eslint-plugin-simple-import-sort:
specifier: ^10.0.0
version: 10.0.0(eslint@8.48.0)
version: 10.0.0(eslint@8.49.0)
husky:
specifier: ^8.0.3
version: 8.0.3
@ -236,10 +239,10 @@ devDependencies:
version: 5.2.2
vite:
specifier: ^4.4.9
version: 4.4.9(@types/node@20.5.9)
version: 4.4.9(@types/node@20.6.0)
vite-tsconfig-paths:
specifier: ^4.2.0
version: 4.2.0(typescript@5.2.2)(vite@4.4.9)
specifier: ^4.2.1
version: 4.2.1(typescript@5.2.2)(vite@4.4.9)
packages:
@ -278,21 +281,21 @@ packages:
engines: {node: '>=6.9.0'}
dependencies:
'@babel/template': 7.22.15
'@babel/types': 7.22.15
'@babel/types': 7.22.17
dev: true
/@babel/helper-hoist-variables@7.22.5:
resolution: {integrity: sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/types': 7.22.15
'@babel/types': 7.22.17
dev: true
/@babel/helper-split-export-declaration@7.22.6:
resolution: {integrity: sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/types': 7.22.15
'@babel/types': 7.22.17
dev: true
/@babel/helper-string-parser@7.22.5:
@ -332,7 +335,7 @@ packages:
dependencies:
'@babel/code-frame': 7.22.13
'@babel/parser': 7.22.16
'@babel/types': 7.22.15
'@babel/types': 7.22.17
dev: true
/@babel/traverse@7.17.3:
@ -361,8 +364,8 @@ packages:
to-fast-properties: 2.0.0
dev: true
/@babel/types@7.22.15:
resolution: {integrity: sha512-X+NLXr0N8XXmN5ZsaQdm9U2SSC3UbIYq/doL++sueHOTisgZHoKaQtZxGuV2cUPQHMfjKEfg/g6oy7Hm6SKFtA==}
/@babel/types@7.22.17:
resolution: {integrity: sha512-YSQPHLFtQNE5xN9tHuZnzu8vPr61wVTBZdfv1meex1NBosa4iT05k/Jw06ddJugi4bk7The/oSwQGFcksmEJQg==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/helper-string-parser': 7.22.5
@ -778,13 +781,13 @@ packages:
dev: true
optional: true
/@eslint-community/eslint-utils@4.4.0(eslint@8.48.0):
/@eslint-community/eslint-utils@4.4.0(eslint@8.49.0):
resolution: {integrity: sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies:
eslint: ^6.0.0 || ^7.0.0 || >=8.0.0
dependencies:
eslint: 8.48.0
eslint: 8.49.0
eslint-visitor-keys: 3.4.3
/@eslint-community/regexpp@4.8.0:
@ -807,8 +810,8 @@ packages:
transitivePeerDependencies:
- supports-color
/@eslint/js@8.48.0:
resolution: {integrity: sha512-ZSjtmelB7IJfWD2Fvb7+Z+ChTIKWq6kjda95fLcQKNS5aheVHn4IkfgRQE3sIIzTcSLwLcLZUD9UBt+V7+h+Pw==}
/@eslint/js@8.49.0:
resolution: {integrity: sha512-1S8uAY/MTJqVx0SC4epBq+N2yhuwtNwLbJYNZyhL2pO1ZVKn5HFXav5T41Ryzy9K9V7ZId2JB2oy/W4aCd9/2w==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
/@floating-ui/core@1.4.1:
@ -956,14 +959,14 @@ packages:
'@noble/hashes': 1.3.2
'@noble/secp256k1': 2.0.0
'@scure/base': 1.1.3
'@typescript-eslint/eslint-plugin': 5.62.0(@typescript-eslint/parser@5.62.0)(eslint@8.48.0)(typescript@5.2.2)
'@typescript-eslint/parser': 5.62.0(eslint@8.48.0)(typescript@5.2.2)
'@typescript-eslint/eslint-plugin': 5.62.0(@typescript-eslint/parser@5.62.0)(eslint@8.49.0)(typescript@5.2.2)
'@typescript-eslint/parser': 5.62.0(eslint@8.49.0)(typescript@5.2.2)
debug: 4.3.4
esbuild: 0.17.19
esbuild-plugin-alias: 0.2.1
eslint: 8.48.0
eslint-config-prettier: 8.10.0(eslint@8.48.0)
eslint-plugin-import: 2.28.1(@typescript-eslint/parser@5.62.0)(eslint@8.48.0)
eslint: 8.49.0
eslint-config-prettier: 8.10.0(eslint@8.49.0)
eslint-plugin-import: 2.28.1(@typescript-eslint/parser@5.62.0)(eslint@8.49.0)
esm-loader-typescript: 1.0.5
eventemitter3: 5.0.1
light-bolt11-decoder: 3.0.0
@ -2356,8 +2359,8 @@ packages:
resolution: {integrity: sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA==}
dev: false
/@types/node@20.5.9:
resolution: {integrity: sha512-PcGNd//40kHAS3sTlzKB9C9XL4K0sTup8nbG5lC14kzEteTNuAFh9u5nA0o5TWnSG2r/JNPRXFVcHJIIeRlmqQ==}
/@types/node@20.6.0:
resolution: {integrity: sha512-najjVq5KN2vsH2U/xyh2opaSEz6cZMR2SetLIlxlj08nOcmPOemJmUK2o4kUzfLqfrWE0PIrNeE16XhYDd3nqg==}
dev: true
/@types/normalize-package-data@2.4.1:
@ -2405,7 +2408,7 @@ packages:
resolution: {integrity: sha512-W8F4eoTIvzXeNrT3JroQPimZLXnlJA8smYygHZUKFPVoYwgs/OhJkA1VBhL3iSs57OQkuINqHlY4SmMT5wtnJg==}
dev: true
/@typescript-eslint/eslint-plugin@5.62.0(@typescript-eslint/parser@5.62.0)(eslint@8.48.0)(typescript@5.2.2):
/@typescript-eslint/eslint-plugin@5.62.0(@typescript-eslint/parser@5.62.0)(eslint@8.49.0)(typescript@5.2.2):
resolution: {integrity: sha512-TiZzBSJja/LbhNPvk6yc0JrX9XqhQ0hdh6M2svYfsHGejaKFIAGd9MQ+ERIMzLGlN/kZoYIgdxFV0PuljTKXag==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies:
@ -2417,12 +2420,12 @@ packages:
optional: true
dependencies:
'@eslint-community/regexpp': 4.8.0
'@typescript-eslint/parser': 5.62.0(eslint@8.48.0)(typescript@5.2.2)
'@typescript-eslint/parser': 5.62.0(eslint@8.49.0)(typescript@5.2.2)
'@typescript-eslint/scope-manager': 5.62.0
'@typescript-eslint/type-utils': 5.62.0(eslint@8.48.0)(typescript@5.2.2)
'@typescript-eslint/utils': 5.62.0(eslint@8.48.0)(typescript@5.2.2)
'@typescript-eslint/type-utils': 5.62.0(eslint@8.49.0)(typescript@5.2.2)
'@typescript-eslint/utils': 5.62.0(eslint@8.49.0)(typescript@5.2.2)
debug: 4.3.4
eslint: 8.48.0
eslint: 8.49.0
graphemer: 1.4.0
ignore: 5.2.4
natural-compare-lite: 1.4.0
@ -2433,7 +2436,7 @@ packages:
- supports-color
dev: false
/@typescript-eslint/eslint-plugin@6.6.0(@typescript-eslint/parser@6.6.0)(eslint@8.48.0)(typescript@5.2.2):
/@typescript-eslint/eslint-plugin@6.6.0(@typescript-eslint/parser@6.6.0)(eslint@8.49.0)(typescript@5.2.2):
resolution: {integrity: sha512-CW9YDGTQnNYMIo5lMeuiIG08p4E0cXrXTbcZ2saT/ETE7dWUrNxlijsQeU04qAAKkILiLzdQz+cGFxCJjaZUmA==}
engines: {node: ^16.0.0 || >=18.0.0}
peerDependencies:
@ -2445,13 +2448,13 @@ packages:
optional: true
dependencies:
'@eslint-community/regexpp': 4.8.0
'@typescript-eslint/parser': 6.6.0(eslint@8.48.0)(typescript@5.2.2)
'@typescript-eslint/parser': 6.6.0(eslint@8.49.0)(typescript@5.2.2)
'@typescript-eslint/scope-manager': 6.6.0
'@typescript-eslint/type-utils': 6.6.0(eslint@8.48.0)(typescript@5.2.2)
'@typescript-eslint/utils': 6.6.0(eslint@8.48.0)(typescript@5.2.2)
'@typescript-eslint/type-utils': 6.6.0(eslint@8.49.0)(typescript@5.2.2)
'@typescript-eslint/utils': 6.6.0(eslint@8.49.0)(typescript@5.2.2)
'@typescript-eslint/visitor-keys': 6.6.0
debug: 4.3.4
eslint: 8.48.0
eslint: 8.49.0
graphemer: 1.4.0
ignore: 5.2.4
natural-compare: 1.4.0
@ -2462,7 +2465,7 @@ packages:
- supports-color
dev: true
/@typescript-eslint/parser@5.62.0(eslint@8.48.0)(typescript@5.2.2):
/@typescript-eslint/parser@5.62.0(eslint@8.49.0)(typescript@5.2.2):
resolution: {integrity: sha512-VlJEV0fOQ7BExOsHYAGrgbEiZoi8D+Bl2+f6V2RrXerRSylnp+ZBHmPvaIa8cz0Ajx7WO7Z5RqfgYg7ED1nRhA==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies:
@ -2476,13 +2479,13 @@ packages:
'@typescript-eslint/types': 5.62.0
'@typescript-eslint/typescript-estree': 5.62.0(typescript@5.2.2)
debug: 4.3.4
eslint: 8.48.0
eslint: 8.49.0
typescript: 5.2.2
transitivePeerDependencies:
- supports-color
dev: false
/@typescript-eslint/parser@6.6.0(eslint@8.48.0)(typescript@5.2.2):
/@typescript-eslint/parser@6.6.0(eslint@8.49.0)(typescript@5.2.2):
resolution: {integrity: sha512-setq5aJgUwtzGrhW177/i+DMLqBaJbdwGj2CPIVFFLE0NCliy5ujIdLHd2D1ysmlmsjdL2GWW+hR85neEfc12w==}
engines: {node: ^16.0.0 || >=18.0.0}
peerDependencies:
@ -2497,7 +2500,7 @@ packages:
'@typescript-eslint/typescript-estree': 6.6.0(typescript@5.2.2)
'@typescript-eslint/visitor-keys': 6.6.0
debug: 4.3.4
eslint: 8.48.0
eslint: 8.49.0
typescript: 5.2.2
transitivePeerDependencies:
- supports-color
@ -2519,7 +2522,7 @@ packages:
'@typescript-eslint/visitor-keys': 6.6.0
dev: true
/@typescript-eslint/type-utils@5.62.0(eslint@8.48.0)(typescript@5.2.2):
/@typescript-eslint/type-utils@5.62.0(eslint@8.49.0)(typescript@5.2.2):
resolution: {integrity: sha512-xsSQreu+VnfbqQpW5vnCJdq1Z3Q0U31qiWmRhr98ONQmcp/yhiPJFPq8MXiJVLiksmOKSjIldZzkebzHuCGzew==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies:
@ -2530,16 +2533,16 @@ packages:
optional: true
dependencies:
'@typescript-eslint/typescript-estree': 5.62.0(typescript@5.2.2)
'@typescript-eslint/utils': 5.62.0(eslint@8.48.0)(typescript@5.2.2)
'@typescript-eslint/utils': 5.62.0(eslint@8.49.0)(typescript@5.2.2)
debug: 4.3.4
eslint: 8.48.0
eslint: 8.49.0
tsutils: 3.21.0(typescript@5.2.2)
typescript: 5.2.2
transitivePeerDependencies:
- supports-color
dev: false
/@typescript-eslint/type-utils@6.6.0(eslint@8.48.0)(typescript@5.2.2):
/@typescript-eslint/type-utils@6.6.0(eslint@8.49.0)(typescript@5.2.2):
resolution: {integrity: sha512-8m16fwAcEnQc69IpeDyokNO+D5spo0w1jepWWY2Q6y5ZKNuj5EhVQXjtVAeDDqvW6Yg7dhclbsz6rTtOvcwpHg==}
engines: {node: ^16.0.0 || >=18.0.0}
peerDependencies:
@ -2550,9 +2553,9 @@ packages:
optional: true
dependencies:
'@typescript-eslint/typescript-estree': 6.6.0(typescript@5.2.2)
'@typescript-eslint/utils': 6.6.0(eslint@8.48.0)(typescript@5.2.2)
'@typescript-eslint/utils': 6.6.0(eslint@8.49.0)(typescript@5.2.2)
debug: 4.3.4
eslint: 8.48.0
eslint: 8.49.0
ts-api-utils: 1.0.3(typescript@5.2.2)
typescript: 5.2.2
transitivePeerDependencies:
@ -2611,19 +2614,19 @@ packages:
- supports-color
dev: true
/@typescript-eslint/utils@5.62.0(eslint@8.48.0)(typescript@5.2.2):
/@typescript-eslint/utils@5.62.0(eslint@8.49.0)(typescript@5.2.2):
resolution: {integrity: sha512-n8oxjeb5aIbPFEtmQxQYOLI0i9n5ySBEY/ZEHHZqKQSFnxio1rv6dthascc9dLuwrL0RC5mPCxB7vnAVGAYWAQ==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies:
eslint: ^6.0.0 || ^7.0.0 || ^8.0.0
dependencies:
'@eslint-community/eslint-utils': 4.4.0(eslint@8.48.0)
'@eslint-community/eslint-utils': 4.4.0(eslint@8.49.0)
'@types/json-schema': 7.0.12
'@types/semver': 7.5.1
'@typescript-eslint/scope-manager': 5.62.0
'@typescript-eslint/types': 5.62.0
'@typescript-eslint/typescript-estree': 5.62.0(typescript@5.2.2)
eslint: 8.48.0
eslint: 8.49.0
eslint-scope: 5.1.1
semver: 7.5.4
transitivePeerDependencies:
@ -2631,19 +2634,19 @@ packages:
- typescript
dev: false
/@typescript-eslint/utils@6.6.0(eslint@8.48.0)(typescript@5.2.2):
/@typescript-eslint/utils@6.6.0(eslint@8.49.0)(typescript@5.2.2):
resolution: {integrity: sha512-mPHFoNa2bPIWWglWYdR0QfY9GN0CfvvXX1Sv6DlSTive3jlMTUy+an67//Gysc+0Me9pjitrq0LJp0nGtLgftw==}
engines: {node: ^16.0.0 || >=18.0.0}
peerDependencies:
eslint: ^7.0.0 || ^8.0.0
dependencies:
'@eslint-community/eslint-utils': 4.4.0(eslint@8.48.0)
'@eslint-community/eslint-utils': 4.4.0(eslint@8.49.0)
'@types/json-schema': 7.0.12
'@types/semver': 7.5.1
'@typescript-eslint/scope-manager': 6.6.0
'@typescript-eslint/types': 6.6.0
'@typescript-eslint/typescript-estree': 6.6.0(typescript@5.2.2)
eslint: 8.48.0
eslint: 8.49.0
semver: 7.5.4
transitivePeerDependencies:
- supports-color
@ -2672,7 +2675,7 @@ packages:
vite: ^4
dependencies:
'@swc/core': 1.3.83
vite: 4.4.9(@types/node@20.5.9)
vite: 4.4.9(@types/node@20.6.0)
transitivePeerDependencies:
- '@swc/helpers'
dev: true
@ -2874,7 +2877,7 @@ packages:
postcss: ^8.1.0
dependencies:
browserslist: 4.21.10
caniuse-lite: 1.0.30001528
caniuse-lite: 1.0.30001532
fraction.js: 4.3.6
normalize-range: 0.1.2
picocolors: 1.0.0
@ -2886,8 +2889,8 @@ packages:
resolution: {integrity: sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==}
engines: {node: '>= 0.4'}
/axe-core@4.8.0:
resolution: {integrity: sha512-ZtlVZobOeDQhb/y2lMK6mznDw7TJHDNcKx5/bbBkFvArIQ5CVFhSI6hWWQnMx9I8cNmNmZ30wpDyOC2E2nvgbQ==}
/axe-core@4.8.1:
resolution: {integrity: sha512-9l850jDDPnKq48nbad8SiEelCv4OrUWrKab/cPj0GScVg6cb6NbCCt/Ulk26QEq5jP9NnGr04Bit1BHyV6r5CQ==}
engines: {node: '>=4'}
dev: true
@ -2926,8 +2929,8 @@ packages:
engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7}
hasBin: true
dependencies:
caniuse-lite: 1.0.30001528
electron-to-chromium: 1.4.511
caniuse-lite: 1.0.30001532
electron-to-chromium: 1.4.513
node-releases: 2.0.13
update-browserslist-db: 1.0.11(browserslist@4.21.10)
dev: true
@ -2961,8 +2964,8 @@ packages:
engines: {node: '>=6'}
dev: false
/caniuse-lite@1.0.30001528:
resolution: {integrity: sha512-0Db4yyjR9QMNlsxh+kKWzQtkyflkG/snYheSzkjmvdEtEXB1+jt7A2HmSEiO6XIJPIbo92lHNGNySvE5pZcs5Q==}
/caniuse-lite@1.0.30001532:
resolution: {integrity: sha512-FbDFnNat3nMnrROzqrsg314zhqN5LGQ1kyyMk2opcrwGbVGpHRhgCWtAgD5YJUqNAiQ+dklreil/c3Qf1dfCTw==}
dev: true
/case-anything@2.1.13:
@ -3286,8 +3289,8 @@ packages:
resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==}
dev: true
/electron-to-chromium@1.4.511:
resolution: {integrity: sha512-udHyLfdy390CObLy3uFQitCBvK+WxWu6WZWQMBzO/npNiRy6tanDKR1c/F6OImfAiSt1ylgNszPJBxix2c0w3w==}
/electron-to-chromium@1.4.513:
resolution: {integrity: sha512-cOB0xcInjm+E5qIssHeXJ29BaUyWpMyFKT5RB3bsLENDheCja0wMkHJyiPl0NBE/VzDI7JDuNEQWhe6RitEUcw==}
dev: true
/emoji-regex@8.0.0:
@ -3486,22 +3489,22 @@ packages:
engines: {node: '>=12'}
dev: false
/eslint-config-prettier@8.10.0(eslint@8.48.0):
/eslint-config-prettier@8.10.0(eslint@8.49.0):
resolution: {integrity: sha512-SM8AMJdeQqRYT9O9zguiruQZaN7+z+E4eAP9oiLNGKMtomwaB1E9dcgUD6ZAn/eQAb52USbvezbiljfZUhbJcg==}
hasBin: true
peerDependencies:
eslint: '>=7.0.0'
dependencies:
eslint: 8.48.0
eslint: 8.49.0
dev: false
/eslint-config-prettier@9.0.0(eslint@8.48.0):
/eslint-config-prettier@9.0.0(eslint@8.49.0):
resolution: {integrity: sha512-IcJsTkJae2S35pRsRAwoCE+925rJJStOdkKnLVgtE+tEpqU0EVVM7OqrwxqgptKdX29NUwC82I5pXsGFIgSevw==}
hasBin: true
peerDependencies:
eslint: '>=7.0.0'
dependencies:
eslint: 8.48.0
eslint: 8.49.0
dev: true
/eslint-formatter-pretty@4.1.0:
@ -3528,7 +3531,7 @@ packages:
- supports-color
dev: false
/eslint-module-utils@2.8.0(@typescript-eslint/parser@5.62.0)(eslint-import-resolver-node@0.3.9)(eslint@8.48.0):
/eslint-module-utils@2.8.0(@typescript-eslint/parser@5.62.0)(eslint-import-resolver-node@0.3.9)(eslint@8.49.0):
resolution: {integrity: sha512-aWajIYfsqCKRDgUfjEXNN/JlrzauMuSEy5sbd7WXbtW3EH6A6MpwEh42c7qD+MqQo9QMJ6fWLAeIJynx0g6OAw==}
engines: {node: '>=4'}
peerDependencies:
@ -3549,15 +3552,15 @@ packages:
eslint-import-resolver-webpack:
optional: true
dependencies:
'@typescript-eslint/parser': 5.62.0(eslint@8.48.0)(typescript@5.2.2)
'@typescript-eslint/parser': 5.62.0(eslint@8.49.0)(typescript@5.2.2)
debug: 3.2.7
eslint: 8.48.0
eslint: 8.49.0
eslint-import-resolver-node: 0.3.9
transitivePeerDependencies:
- supports-color
dev: false
/eslint-plugin-import@2.28.1(@typescript-eslint/parser@5.62.0)(eslint@8.48.0):
/eslint-plugin-import@2.28.1(@typescript-eslint/parser@5.62.0)(eslint@8.49.0):
resolution: {integrity: sha512-9I9hFlITvOV55alzoKBI+K9q74kv0iKMeY6av5+umsNwayt59fz692daGyjR+oStBQgx6nwR9rXldDev3Clw+A==}
engines: {node: '>=4'}
peerDependencies:
@ -3567,16 +3570,16 @@ packages:
'@typescript-eslint/parser':
optional: true
dependencies:
'@typescript-eslint/parser': 5.62.0(eslint@8.48.0)(typescript@5.2.2)
'@typescript-eslint/parser': 5.62.0(eslint@8.49.0)(typescript@5.2.2)
array-includes: 3.1.7
array.prototype.findlastindex: 1.2.3
array.prototype.flat: 1.3.2
array.prototype.flatmap: 1.3.2
debug: 3.2.7
doctrine: 2.1.0
eslint: 8.48.0
eslint: 8.49.0
eslint-import-resolver-node: 0.3.9
eslint-module-utils: 2.8.0(@typescript-eslint/parser@5.62.0)(eslint-import-resolver-node@0.3.9)(eslint@8.48.0)
eslint-module-utils: 2.8.0(@typescript-eslint/parser@5.62.0)(eslint-import-resolver-node@0.3.9)(eslint@8.49.0)
has: 1.0.3
is-core-module: 2.13.0
is-glob: 4.0.3
@ -3592,7 +3595,7 @@ packages:
- supports-color
dev: false
/eslint-plugin-jsx-a11y@6.7.1(eslint@8.48.0):
/eslint-plugin-jsx-a11y@6.7.1(eslint@8.49.0):
resolution: {integrity: sha512-63Bog4iIethyo8smBklORknVjB0T2dwB8Mr/hIC+fBS0uyHdYYpzM/Ed+YC8VxTjlXHEWFOdmgwcDn1U2L9VCA==}
engines: {node: '>=4.0'}
peerDependencies:
@ -3603,11 +3606,11 @@ packages:
array-includes: 3.1.7
array.prototype.flatmap: 1.3.2
ast-types-flow: 0.0.7
axe-core: 4.8.0
axe-core: 4.8.1
axobject-query: 3.2.1
damerau-levenshtein: 1.0.8
emoji-regex: 9.2.2
eslint: 8.48.0
eslint: 8.49.0
has: 1.0.3
jsx-ast-utils: 3.3.5
language-tags: 1.0.5
@ -3617,7 +3620,7 @@ packages:
semver: 6.3.1
dev: true
/eslint-plugin-react@7.33.2(eslint@8.48.0):
/eslint-plugin-react@7.33.2(eslint@8.49.0):
resolution: {integrity: sha512-73QQMKALArI8/7xGLNI/3LylrEYrlKZSb5C9+q3OtOewTnMQi5cT+aE9E41sLCmli3I9PGGmD1yiZydyo4FEPw==}
engines: {node: '>=4'}
peerDependencies:
@ -3628,7 +3631,7 @@ packages:
array.prototype.tosorted: 1.1.2
doctrine: 2.1.0
es-iterator-helpers: 1.0.14
eslint: 8.48.0
eslint: 8.49.0
estraverse: 5.3.0
jsx-ast-utils: 3.3.5
minimatch: 3.1.2
@ -3642,12 +3645,12 @@ packages:
string.prototype.matchall: 4.0.9
dev: true
/eslint-plugin-simple-import-sort@10.0.0(eslint@8.48.0):
/eslint-plugin-simple-import-sort@10.0.0(eslint@8.49.0):
resolution: {integrity: sha512-AeTvO9UCMSNzIHRkg8S6c3RPy5YEwKWSQPx3DYghLedo2ZQxowPFLGDN1AZ2evfg6r6mjBSZSLxLFsWSu3acsw==}
peerDependencies:
eslint: '>=5.0.0'
dependencies:
eslint: 8.48.0
eslint: 8.49.0
dev: true
/eslint-rule-docs@1.1.235:
@ -3673,15 +3676,15 @@ packages:
resolution: {integrity: sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
/eslint@8.48.0:
resolution: {integrity: sha512-sb6DLeIuRXxeM1YljSe1KEx9/YYeZFQWcV8Rq9HfigmdDEugjLEVEa1ozDjL6YDjBpQHPJxJzze+alxi4T3OLg==}
/eslint@8.49.0:
resolution: {integrity: sha512-jw03ENfm6VJI0jA9U+8H5zfl5b+FvuU3YYvZRdZHOlU2ggJkxrlkJH4HcDrZpj6YwD8kuYqvQM8LyesoazrSOQ==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
hasBin: true
dependencies:
'@eslint-community/eslint-utils': 4.4.0(eslint@8.48.0)
'@eslint-community/eslint-utils': 4.4.0(eslint@8.49.0)
'@eslint-community/regexpp': 4.8.0
'@eslint/eslintrc': 2.1.2
'@eslint/js': 8.48.0
'@eslint/js': 8.49.0
'@humanwhocodes/config-array': 0.11.11
'@humanwhocodes/module-importer': 1.0.1
'@nodelib/fs.walk': 1.2.8
@ -5852,6 +5855,14 @@ packages:
engines: {node: '>=8'}
dev: false
/react-currency-input-field@3.6.11(react@18.2.0):
resolution: {integrity: sha512-M9vOx1eaioSaYWirm7W2WSBi4bpLg+LK4Gf7C1kNhy6MvoSoOzd0mYZPxA78OC9UBIQ2nM080Wu9D1CwTY6n3w==}
peerDependencies:
react: ^16.9.0 || ^17.0.0 || ^18.0.0
dependencies:
react: 18.2.0
dev: false
/react-dom@18.2.0(react@18.2.0):
resolution: {integrity: sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g==}
peerDependencies:
@ -6954,8 +6965,8 @@ packages:
vfile-message: 3.1.4
dev: false
/vite-tsconfig-paths@4.2.0(typescript@5.2.2)(vite@4.4.9):
resolution: {integrity: sha512-jGpus0eUy5qbbMVGiTxCL1iB9ZGN6Bd37VGLJU39kTDD6ZfULTTb1bcc5IeTWqWJKiWV5YihCaibeASPiGi8kw==}
/vite-tsconfig-paths@4.2.1(typescript@5.2.2)(vite@4.4.9):
resolution: {integrity: sha512-GNUI6ZgPqT3oervkvzU+qtys83+75N/OuDaQl7HmOqFTb0pjZsuARrRipsyJhJ3enqV8beI1xhGbToR4o78nSQ==}
peerDependencies:
vite: '*'
peerDependenciesMeta:
@ -6965,13 +6976,13 @@ packages:
debug: 4.3.4
globrex: 0.1.2
tsconfck: 2.1.2(typescript@5.2.2)
vite: 4.4.9(@types/node@20.5.9)
vite: 4.4.9(@types/node@20.6.0)
transitivePeerDependencies:
- supports-color
- typescript
dev: true
/vite@4.4.9(@types/node@20.5.9):
/vite@4.4.9(@types/node@20.6.0):
resolution: {integrity: sha512-2mbUn2LlUmNASWwSCNSJ/EG2HuSRTnVNaydp6vMCm5VIqJsjMfbIWtbH2kDuwUVW5mMUKKZvGPX/rqeqVvv1XA==}
engines: {node: ^14.18.0 || >=16.0.0}
hasBin: true
@ -6999,7 +7010,7 @@ packages:
terser:
optional: true
dependencies:
'@types/node': 20.5.9
'@types/node': 20.6.0
esbuild: 0.18.20
postcss: 8.4.29
rollup: 3.29.0

64
src-tauri/Cargo.lock generated
View File

@ -401,9 +401,9 @@ checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8"
[[package]]
name = "base64"
version = "0.21.3"
version = "0.21.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "414dcefbc63d77c526a76b3afcf6fbb9b5e2791c19c3aa2297733208750c6e53"
checksum = "9ba43ea6f343b788c8764558649e08df62f86c6ef251fdaeb1ffd010a9ae50a2"
[[package]]
name = "base64ct"
@ -614,7 +614,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "599aa35200ffff8f04c1925aa1acc92fa2e08874379ef42e210a80e527e60838"
dependencies = [
"serde",
"toml 0.7.6",
"toml 0.7.8",
]
[[package]]
@ -654,9 +654,9 @@ dependencies = [
[[package]]
name = "cfg-expr"
version = "0.15.4"
version = "0.15.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b40ccee03b5175c18cde8f37e7d2a33bcef6f8ec8f7cc0d81090d1bb380949c9"
checksum = "03915af431787e6ffdcc74c645077518c6b6e01f80b761e0fbbfa288536311b3"
dependencies = [
"smallvec",
"target-lexicon",
@ -1330,7 +1330,7 @@ checksum = "fd0a2c9b742a980060d22545a7a83b573acd6b73045b9de6370c9530ce652f27"
dependencies = [
"cc",
"rustc_version",
"toml 0.7.6",
"toml 0.7.8",
"vswhom",
"winreg 0.51.0",
]
@ -1459,7 +1459,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ef033ed5e9bad94e55838ca0ca906db0e043f517adda0c8b79c7a8c66c93c1b5"
dependencies = [
"cfg-if",
"rustix 0.38.11",
"rustix 0.38.12",
"windows-sys 0.48.0",
]
@ -2590,9 +2590,9 @@ checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519"
[[package]]
name = "linux-raw-sys"
version = "0.4.5"
version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57bcfdad1b858c2db7c38303a6d2ad4dfaf5eb53dfeb0910128b2c26d6158503"
checksum = "1a9bad9f94746442c783ca431b22403b519cd7fbeed0533fdd6328b2f2212128"
[[package]]
name = "lock_api"
@ -3444,7 +3444,7 @@ version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bdc0001cfea3db57a2e24bc0d818e9e20e554b5f97fabb9bc231dc240269ae06"
dependencies = [
"base64 0.21.3",
"base64 0.21.4",
"indexmap 1.9.3",
"line-wrap",
"quick-xml 0.29.0",
@ -3823,7 +3823,7 @@ version = "0.11.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3e9ad3fe7488d7e34558a2033d45a0c90b72d97b4f80705666fea71472e2e6a1"
dependencies = [
"base64 0.21.3",
"base64 0.21.4",
"bytes",
"encoding_rs",
"futures-core",
@ -3936,7 +3936,7 @@ version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e71971821b3ae0e769e4a4328dbcb517607b434db7697e9aba17203ec14e46a"
dependencies = [
"base64 0.21.3",
"base64 0.21.4",
"blake2b_simd",
"constant_time_eq 0.3.0",
]
@ -3972,14 +3972,14 @@ dependencies = [
[[package]]
name = "rustix"
version = "0.38.11"
version = "0.38.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0c3dde1fc030af041adc40e79c0e7fbcf431dd24870053d187d7c66e4b87453"
checksum = "bdf14a7a466ce88b5eac3da815b53aefc208ce7e74d1c263aabb04d88c4abeb1"
dependencies = [
"bitflags 2.4.0",
"errno",
"libc",
"linux-raw-sys 0.4.5",
"linux-raw-sys 0.4.7",
"windows-sys 0.48.0",
]
@ -4000,7 +4000,7 @@ version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2d3987094b1d07b653b7dfdc3f70ce9a1da9c51ac18c1b06b662e4f9a0e9f4b2"
dependencies = [
"base64 0.21.3",
"base64 0.21.4",
]
[[package]]
@ -4169,9 +4169,9 @@ dependencies = [
[[package]]
name = "serde_json"
version = "1.0.105"
version = "1.0.106"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "693151e1ac27563d6dbcec9dee9fbd5da8539b20fa14ad3752b2e6d363ace360"
checksum = "2cc66a619ed80bf7a0f6b17dd063a84b88f6dea1813737cf469aef1d081142c2"
dependencies = [
"itoa 1.0.9",
"ryu",
@ -4216,7 +4216,7 @@ version = "3.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ca3b16a3d82c4088f343b7480a93550b3eabe1a358569c2dfe38bbcead07237"
dependencies = [
"base64 0.21.3",
"base64 0.21.4",
"chrono",
"hex",
"indexmap 1.9.3",
@ -4584,7 +4584,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ca69bf415b93b60b80dc8fda3cb4ef52b2336614d8da2de5456cc942a110482"
dependencies = [
"atoi",
"base64 0.21.3",
"base64 0.21.4",
"bitflags 2.4.0",
"byteorder",
"bytes",
@ -4627,7 +4627,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a0db2df1b8731c3651e204629dd55e52adbae0462fa1bdcbed56a2302c18181e"
dependencies = [
"atoi",
"base64 0.21.3",
"base64 0.21.4",
"bitflags 2.4.0",
"byteorder",
"crc",
@ -4871,10 +4871,10 @@ version = "6.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "30c2de8a4d8f4b823d634affc9cd2a74ec98c53a756f317e529a48046cbf71f3"
dependencies = [
"cfg-expr 0.15.4",
"cfg-expr 0.15.5",
"heck 0.4.1",
"pkg-config",
"toml 0.7.6",
"toml 0.7.8",
"version-compare 0.1.1",
]
@ -5029,7 +5029,7 @@ version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "54ad2d49fdeab4a08717f5b49a163bdc72efc3b1950b6758245fcde79b645e1a"
dependencies = [
"base64 0.21.3",
"base64 0.21.4",
"brotli",
"ico",
"json-patch",
@ -5231,7 +5231,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5993dc129e544393574288923d1ec447c857f3f644187f4fbf7d9a875fbfc4fb"
dependencies = [
"embed-resource",
"toml 0.7.6",
"toml 0.7.8",
]
[[package]]
@ -5253,7 +5253,7 @@ dependencies = [
"cfg-if",
"fastrand 2.0.0",
"redox_syscall 0.3.5",
"rustix 0.38.11",
"rustix 0.38.12",
"windows-sys 0.48.0",
]
@ -5421,9 +5421,9 @@ dependencies = [
[[package]]
name = "toml"
version = "0.7.6"
version = "0.7.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c17e963a819c331dcacd7ab957d80bc2b9a9c1e71c804826d2f283dd65306542"
checksum = "dd79e69d3b627db300ff956027cc6c3798cef26d22526befdfcd12feeb6d2257"
dependencies = [
"serde",
"serde_spanned",
@ -5442,9 +5442,9 @@ dependencies = [
[[package]]
name = "toml_edit"
version = "0.19.14"
version = "0.19.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8123f27e969974a3dfba720fdb560be359f57b44302d280ba72e76a74480e8a"
checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421"
dependencies = [
"indexmap 2.0.0",
"serde",
@ -5972,8 +5972,8 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "window-vibrancy"
version = "0.4.0"
source = "git+https://github.com/tauri-apps/window-vibrancy?branch=dev#84b45368cb9aa8ce5107ae3d508092720226da22"
version = "0.4.1"
source = "git+https://github.com/tauri-apps/window-vibrancy?branch=dev#ce6e299a3bc98bd1d0f322c3b922fe8634f09e8e"
dependencies = [
"cocoa 0.25.0",
"objc",

View File

@ -16,7 +16,7 @@ tauri-build = { version = "1.4", features = [] }
[dependencies]
serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] }
tauri = { version = "1.4", features = [ "window-create",
tauri = { version = "1.4", features = [ "window-close", "window-print", "window-create",
"macos-private-api",
"fs-read-dir",
"fs-read-file",

View File

@ -61,7 +61,7 @@ export function CreateStep2Screen() {
setLoading(true);
if (data.password.length > 3) {
const dir = await appConfigDir();
const stronghold = await Stronghold.load(`${dir}/lume.stronghold`, data.password);
const stronghold = await Stronghold.load(`${dir}lume.stronghold`, data.password);
if (!db.secureDB) db.secureDB = stronghold;

View File

@ -61,7 +61,7 @@ export function ImportStep2Screen() {
setLoading(true);
if (data.password.length > 3) {
const dir = await appConfigDir();
const stronghold = await Stronghold.load(`${dir}/lume.stronghold`, data.password);
const stronghold = await Stronghold.load(`${dir}lume.stronghold`, data.password);
if (!db.secureDB) db.secureDB = stronghold;

View File

@ -33,6 +33,7 @@ const resolver: Resolver<FormValues> = async (values) => {
export function UnlockScreen() {
const navigate = useNavigate();
const setPrivkey = useStronghold((state) => state.setPrivkey);
const setWalletConnectURL = useStronghold((state) => state.setWalletConnectURL);
const [showPassword, setShowPassword] = useState<boolean>(false);
const [loading, setLoading] = useState<boolean>(false);
@ -55,8 +56,13 @@ export function UnlockScreen() {
if (!db.secureDB) db.secureDB = stronghold;
const privkey = await db.secureLoad(db.account.pubkey);
const uri = await db.secureLoad('walletConnectURL', 'alby');
setPrivkey(privkey);
console.log('found privkey: ', privkey);
console.log('found wallet conenct url: ', uri);
if (privkey) setPrivkey(privkey);
if (uri) setWalletConnectURL(uri);
// redirect to home
navigate('/', { replace: true });
} catch (e) {

View File

@ -22,10 +22,9 @@ export function SplashScreen() {
const prefetch = async () => {
try {
const user = await fetchUserData();
const data = await prefetchEvents();
const [user, events] = await Promise.all([fetchUserData(), prefetchEvents()]);
if (user.status === 'ok' && data.status === 'ok') {
if (user.status === 'ok' && events.status === 'ok') {
// update last login = current time
await db.updateLastLogin();
// close splash screen and open main app screen

View File

@ -289,7 +289,7 @@ export function EditProfileModal() {
<button
type="submit"
disabled={!isValid}
className="inline-flex h-11 w-full transform items-center justify-center gap-1 rounded-md bg-fuchsia-500 font-medium text-white hover:bg-fuchsia-600 focus:outline-none active:translate-y-1 disabled:pointer-events-none disabled:opacity-50"
className="inline-flex h-11 w-full transform items-center justify-center gap-1 rounded-lg bg-fuchsia-500 font-medium text-white hover:bg-fuchsia-600 focus:outline-none active:translate-y-1 disabled:pointer-events-none disabled:opacity-50"
>
{loading ? (
<LoaderIcon className="h-4 w-4 animate-spin text-black dark:text-white" />

View File

@ -2,21 +2,13 @@
@tailwind components;
@tailwind utilities;
html {
font-size: 14px;
}
input::-ms-reveal,
input::-ms-clear {
.scrollbar-hide::-webkit-scrollbar {
display: none;
}
a {
@apply cursor-default no-underline !important;
}
button {
@apply cursor-default focus:outline-none;
.scrollbar-hide {
-ms-overflow-style: none;
scrollbar-width: none;
}
.markdown {
@ -35,25 +27,31 @@ button {
@apply outline-fuchsia-500;
}
html {
font-size: 14px;
}
a {
@apply cursor-default no-underline !important;
}
button {
@apply cursor-default focus:outline-none;
}
iframe {
height: auto !important;
}
/* For Webkit-based browsers (Chrome, Safari and Opera) */
.scrollbar-hide::-webkit-scrollbar {
span[data-slate-placeholder] {
margin-top: 0;
}
input::-ms-reveal,
input::-ms-clear {
display: none;
}
/* For IE, Edge and Firefox */
.scrollbar-hide {
-ms-overflow-style: none; /* IE and Edge */
scrollbar-width: none; /* Firefox */
}
.border {
background-clip: padding-box;
}
span[data-slate-placeholder] {
@apply top-0;
::-webkit-input-placeholder {
line-height: normal;
}

View File

@ -19,29 +19,35 @@ export class LumeStorage {
this.account = null;
}
private async getSecureClient() {
private async getSecureClient(key?: string) {
try {
return await this.secureDB.loadClient('lume');
return await this.secureDB.loadClient(key ?? 'lume');
} catch {
return await this.secureDB.createClient('lume');
return await this.secureDB.createClient(key ?? 'lume');
}
}
public async secureSave(key: string, value: string) {
public async secureSave(key: string, value: string, clientKey?: string) {
if (!this.secureDB) throw new Error("Stronghold isn't initialize");
const client = await this.getSecureClient();
const client = await this.getSecureClient(clientKey);
const store = client.getStore();
console.log('insert key: ', key);
await store.insert(key, Array.from(new TextEncoder().encode(value)));
return await this.secureDB.save();
await this.secureDB.save();
}
public async secureLoad(key: string) {
public async secureLoad(key: string, clientKey?: string) {
if (!this.secureDB) throw new Error("Stronghold isn't initialize");
const client = await this.getSecureClient();
const client = await this.getSecureClient(clientKey);
const store = client.getStore();
console.log('get key: ', key);
const value = await store.get(key);
if (!value) return null;
const decoded = new TextDecoder().decode(new Uint8Array(value));
return decoded;
}
@ -137,18 +143,29 @@ export class LumeStorage {
return await this.db.execute('DELETE FROM widgets WHERE id = $1;', [id]);
}
public async createEvent(
id: string,
event: string,
author: string,
kind: number,
root_id: string,
reply_id: string,
created_at: number
) {
public async createEvent(event: NDKEvent) {
let root: string;
let reply: string;
if (event.tags?.[0]?.[0] === 'e' && !event.tags?.[0]?.[3]) {
root = event.tags[0][1];
} else {
root = event.tags.find((el) => el[3] === 'root')?.[1];
reply = event.tags.find((el) => el[3] === 'reply')?.[1];
}
return await this.db.execute(
'INSERT OR IGNORE INTO events (id, account_id, event, author, kind, root_id, reply_id, created_at) VALUES ($1, $2, $3, $4, $5, $6, $7, $8);',
[id, this.account.id, event, author, kind, root_id, reply_id, created_at]
[
event.id,
this.account.id,
JSON.stringify(event),
event.pubkey,
event.kind,
root,
reply,
event.created_at,
]
);
}

View File

@ -10,15 +10,20 @@ import {
AlbyIcon,
ArrowRightCircleIcon,
CancelIcon,
CheckCircleIcon,
LoaderIcon,
StarsIcon,
} from '@shared/icons';
import { useStronghold } from '@stores/stronghold';
export function AlbyConnectButton() {
const { db } = useStorage();
const setWalletConnectURL = useStronghold((state) => state.setWalletConnectURL);
const [isOpen, setIsOpen] = useState(false);
const [isLoading, setIsloading] = useState(false);
const [isConnected, setIsConnected] = useState(false);
const initAlby = async () => {
try {
@ -35,16 +40,16 @@ export function AlbyConnectButton() {
title: 'Connect Alby',
url: authURL.href,
center: true,
theme: 'light',
width: 400,
height: 650,
});
webview.listen('tauri://close-requested', async (e) => {
console.log(e);
await db.secureSave('wallet-connect-url', walletConnectURL);
webview.listen('tauri://close-requested', async () => {
await db.secureSave('walletConnectURL', walletConnectURL, 'alby');
setWalletConnectURL(walletConnectURL);
setIsloading(false);
webview.close();
setIsOpen(false);
setIsConnected(true);
});
} catch (e) {
setIsloading(false);
@ -84,7 +89,7 @@ export function AlbyConnectButton() {
<Dialog.Overlay className="fixed inset-0 z-50 bg-black/80 backdrop-blur-2xl" />
<Dialog.Content className="fixed inset-0 z-50 flex min-h-full items-center justify-center">
<div className="relative h-min w-full max-w-xl rounded-xl bg-white/10 backdrop-blur-xl">
<div className="h-min w-full shrink-0 border-b border-white/10 bg-white/5 px-5 py-5">
<div className="h-min w-full shrink-0 rounded-t-xl border-b border-white/10 bg-white/5 px-5 py-5">
<div className="flex flex-col gap-1">
<div className="flex items-center justify-between">
<Dialog.Title className="text-lg font-semibold leading-none text-white">
@ -97,11 +102,25 @@ export function AlbyConnectButton() {
</div>
</div>
<div className="flex flex-col gap-3 px-5 py-5">
<div className="relative flex h-40 items-center justify-center gap-4">
<div className="inline-flex h-16 w-16 items-end justify-center rounded-lg bg-black pb-2">
<img src="/lume.png" className="w-1/3" alt="Lume Logo" />
</div>
<div className="w-20 border border-dashed border-white/5" />
<div className="inline-flex h-16 w-16 items-center justify-center rounded-lg bg-white">
<AlbyIcon className="h-8 w-8" />
</div>
{isConnected ? (
<div className="absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 transform">
<CheckCircleIcon className="h-5 w-5 text-green-500" />
</div>
) : null}
</div>
<div className="flex flex-col gap-2">
<p className="text-sm text-white/50">
When you click &quot;Connect&quot;, a new window will open in your
default browser. You will need to click the &quot;Connect Wallet&quot;
button to grant Lume permission to integrate with your Alby account.
When you click &quot;Connect&quot;, a new window will open and you need
to click the &quot;Connect Wallet&quot; button to grant Lume permission
to integrate with your Alby account.
</p>
<p className="text-sm text-white/50">
All information will be encrypted and stored on the local machine.
@ -118,6 +137,12 @@ export function AlbyConnectButton() {
<span>Connecting...</span>
<LoaderIcon className="h-5 w-5 animate-spin text-white" />
</>
) : isConnected ? (
<>
<span className="w-5" />
<span>Connected</span>
<CheckCircleIcon className="h-5 w-5" />
</>
) : (
<>
<span className="w-5" />

View File

@ -14,11 +14,13 @@ import { BellIcon, NavArrowDownIcon, SpaceIcon } from '@shared/icons';
import { useActivities } from '@stores/activities';
import { useSidebar } from '@stores/sidebar';
import { useStronghold } from '@stores/stronghold';
import { compactNumber } from '@utils/number';
export function Navigation() {
const { db } = useStorage();
const walletConnectURL = useStronghold((state) => state.walletConnectURL);
const [totalNewActivities] = useActivities((state) => [state.totalNewActivities]);
const [chats, toggleChats] = useSidebar((state) => [state.chats, state.toggleChats]);
@ -99,9 +101,11 @@ export function Navigation() {
</Collapsible.Root>
</div>
<div className="relative shrink-0">
<div className="border-l-2 border-transparent pb-2 pl-4 pr-2">
<AlbyConnectButton />
</div>
{!walletConnectURL ? (
<div className="border-l-2 border-transparent pb-2 pl-4 pr-2">
<AlbyConnectButton />
</div>
) : null}
<ActiveAccount />
</div>
</Frame>

View File

@ -33,7 +33,7 @@ export function NoteActions({
<NoteReply id={id} pubkey={pubkey} root={root} />
<NoteReaction id={id} pubkey={pubkey} />
<NoteRepost id={id} pubkey={pubkey} />
<NoteZap id={id} />
<NoteZap id={id} pubkey={pubkey} />
</div>
{extraButtons && (
<>

View File

@ -1,34 +1,75 @@
import { NostrEvent } from '@nostr-dev-kit/ndk';
import { webln } from '@getalby/sdk';
import { SendPaymentResponse } from '@getalby/sdk/dist/types';
import * as Dialog from '@radix-ui/react-dialog';
import { message } from '@tauri-apps/api/dialog';
import { QRCodeSVG } from 'qrcode.react';
import { useState } from 'react';
import { twMerge } from 'tailwind-merge';
import CurrencyInput from 'react-currency-input-field';
import TextareaAutosize from 'react-textarea-autosize';
import { CancelIcon, ZapIcon } from '@shared/icons';
import { AlbyIcon, CancelIcon, ZapIcon } from '@shared/icons';
import { useStronghold } from '@stores/stronghold';
import { useEvent } from '@utils/hooks/useEvent';
import { useNostr } from '@utils/hooks/useNostr';
import { useProfile } from '@utils/hooks/useProfile';
import { sendNativeNotification } from '@utils/notification';
import { compactNumber } from '@utils/number';
export function NoteZap({ id }: { id: string }) {
export function NoteZap({ id, pubkey }: { id: string; pubkey: string }) {
const { createZap } = useNostr();
const { data: event } = useEvent(id);
const { user } = useProfile(pubkey);
const [amount, setAmount] = useState<null | number>(null);
const [amount, setAmount] = useState<string>('21');
const [zapMessage, setZapMessage] = useState<string>('');
const [invoice, setInvoice] = useState<null | string>(null);
const [isOpen, setIsOpen] = useState(false);
const selected = (num: number) => {
if (amount === num) return true;
return false;
};
const walletConnectURL = useStronghold((state) => state.walletConnectURL);
const createZapRequest = async () => {
// @ts-expect-error, todo: fix this
const res = await createZap(event as unknown as NostrEvent, amount);
if (res) setInvoice(res);
try {
const zapAmount = parseInt(amount) * 1000;
const res = await createZap(event, zapAmount, zapMessage);
if (!res)
return await message('Cannot create zap request', {
title: 'Zap',
type: 'error',
});
// user don't connect Alby, create QR Code for invoice
if (!walletConnectURL) return setInvoice(res);
// user connect Alby
const nwc = new webln.NostrWebLNProvider({
nostrWalletConnectUrl: walletConnectURL,
});
await nwc.enable();
const send: SendPaymentResponse = await nwc.sendPayment(res);
if (send) {
await sendNativeNotification(
`You've tipped ${compactNumber.format(send.amount)} sats to ${
user?.display_name || user?.name
}`
);
// eose
nwc.close();
setIsOpen(false);
setAmount('');
setZapMessage('');
}
} catch (e) {
await message(JSON.stringify(e), { title: 'Zap', type: 'error' });
}
};
return (
<Dialog.Root>
<Dialog.Root open={isOpen} onOpenChange={setIsOpen}>
<Dialog.Trigger asChild>
<button
type="button"
@ -41,110 +82,109 @@ export function NoteZap({ id }: { id: string }) {
<Dialog.Overlay className="fixed inset-0 z-50 bg-black/80 backdrop-blur-2xl" />
<Dialog.Content className="fixed inset-0 z-50 flex min-h-full items-center justify-center">
<div className="relative h-min w-full max-w-xl rounded-xl bg-white/10 backdrop-blur-xl">
<div className="relative h-min w-full shrink-0 border-b border-white/5 bg-white/5 px-5 py-5">
<div className="flex flex-col items-center gap-1.5">
<Dialog.Title className="font-medium leading-none text-white">
Zap (Beta)
</Dialog.Title>
<Dialog.Description className="text-sm leading-none text-white/50">
Send tip with Bitcoin via Lightning
</Dialog.Description>
</div>
<Dialog.Close className="absolute right-3 top-3 inline-flex h-6 w-6 items-center justify-center rounded-md backdrop-blur-xl hover:bg-white/10">
<div className="inline-flex w-full shrink-0 items-center justify-between px-5 py-3">
<div className="w-6" />
<Dialog.Title className="text-center text-sm font-semibold leading-none text-white">
Send tip to {user?.display_name || user?.name}
</Dialog.Title>
<Dialog.Close className="inline-flex h-6 w-6 items-center justify-center rounded-md backdrop-blur-xl hover:bg-white/10">
<CancelIcon className="h-4 w-4 text-white/50" />
</Dialog.Close>
</div>
<div className="overflow-y-auto overflow-x-hidden px-5 py-5">
<div className="overflow-y-auto overflow-x-hidden px-5 pb-5">
{!invoice ? (
<>
<div className="grid grid-cols-3 gap-3">
<button
type="button"
onClick={() => setAmount(21000)}
className={twMerge(
'inline-flex flex-col items-center justify-center gap-2 rounded-lg px-2 py-2 backdrop-blur-xl hover:bg-white/10',
`${selected(21000) && 'bg-white/10 backdrop-blur-xl'}`
)}
>
<img className="h-12 w-12" src="/zap.png" alt="High Voltage" />
<span className="text-sm font-medium leading-none text-white/80">
21 sats
<div className="relative flex h-40 flex-col">
<div className="inline-flex h-full flex-1 items-center justify-center gap-1">
<CurrencyInput
placeholder="0"
defaultValue={'21'}
value={amount}
decimalsLimit={2}
min={0} // 0 sats
max={10000} // 1M sats
maxLength={10000} // 1M sats
onValueChange={(value) => setAmount(value)}
className="w-full flex-1 bg-transparent text-right text-4xl font-semibold text-white placeholder:text-white/50 focus:outline-none"
/>
<span className="w-full flex-1 text-left text-4xl font-semibold text-white/50">
sats
</span>
</button>
<button
type="button"
onClick={() => setAmount(69000)}
className={twMerge(
'inline-flex flex-col items-center justify-center gap-2 rounded-lg px-2 py-2 backdrop-blur-xl hover:bg-white/10',
`${selected(69000) && 'bg-white/10 backdrop-blur-xl'}`
)}
>
<img className="h-12 w-12" src="/zap.png" alt="High Voltage" />
<span className="text-sm font-medium leading-none text-white/80">
</div>
<div className="inline-flex items-center justify-center gap-2">
<button
type="button"
onClick={() => setAmount('69')}
className="w-max rounded-full border border-white/5 bg-white/5 px-2.5 py-1 text-sm font-medium hover:bg-white/10"
>
69 sats
</span>
</button>
<button
type="button"
onClick={() => setAmount(100000)}
className={twMerge(
'inline-flex flex-col items-center justify-center gap-2 rounded-lg px-2 py-2 backdrop-blur-xl hover:bg-white/10',
`${selected(100000) && 'bg-white/10 backdrop-blur-xl'}`
)}
>
<img className="h-12 w-12" src="/zap.png" alt="High Voltage" />
<span className="text-sm font-medium leading-none text-white/80">
</button>
<button
type="button"
onClick={() => setAmount('100')}
className="w-max rounded-full border border-white/5 bg-white/5 px-2.5 py-1 text-sm font-medium hover:bg-white/10"
>
100 sats
</span>
</button>
<button
type="button"
onClick={() => setAmount(200000)}
className={twMerge(
'inline-flex flex-col items-center justify-center gap-2 rounded-lg px-2 py-2 backdrop-blur-xl hover:bg-white/10',
`${selected(200000) && 'bg-white/10 backdrop-blur-xl'}`
)}
>
<img className="h-12 w-12" src="/zap.png" alt="High Voltage" />
<span className="text-sm font-medium leading-none text-white/80">
</button>
<button
type="button"
onClick={() => setAmount('200')}
className="w-max rounded-full border border-white/5 bg-white/5 px-2.5 py-1 text-sm font-medium hover:bg-white/10"
>
200 sats
</span>
</button>
<button
type="button"
onClick={() => setAmount(500000)}
className={twMerge(
'inline-flex flex-col items-center justify-center gap-2 rounded-lg px-2 py-2 backdrop-blur-xl hover:bg-white/10',
`${selected(500000) && 'bg-white/10 backdrop-blur-xl'}`
)}
>
<img className="h-12 w-12" src="/zap.png" alt="High Voltage" />
<span className="text-sm font-medium leading-none text-white/80">
</button>
<button
type="button"
onClick={() => setAmount('500')}
className="w-max rounded-full border border-white/5 bg-white/5 px-2.5 py-1 text-sm font-medium hover:bg-white/10"
>
500 sats
</span>
</button>
<button
type="button"
onClick={() => setAmount(1000000)}
className={twMerge(
'inline-flex flex-col items-center justify-center gap-2 rounded-lg px-2 py-2 backdrop-blur-xl hover:bg-white/10',
`${selected(1000000) && 'bg-white/10 backdrop-blur-xl'}`
)}
>
<img className="h-12 w-12" src="/zap.png" alt="High Voltage" />
<span className="text-sm font-medium leading-none text-white/80">
1000 sats
</span>
</button>
</button>
<button
type="button"
onClick={() => setAmount('1000')}
className="w-max rounded-full border border-white/5 bg-white/5 px-2.5 py-1 text-sm font-medium hover:bg-white/10"
>
1K sats
</button>
</div>
</div>
<div className="mt-4 flex w-full">
<button
type="button"
onClick={() => createZapRequest()}
className="inline-flex h-11 w-full items-center justify-center rounded-lg bg-fuchsia-500 px-4 hover:bg-fuchsia-600"
>
Create invoice
</button>
<div className="mt-4 flex w-full flex-col gap-2">
<TextareaAutosize
name="zapMessage"
value={zapMessage}
onChange={(e) => setZapMessage(e.target.value)}
spellCheck={false}
autoComplete="off"
autoCorrect="off"
autoCapitalize="off"
placeholder="Enter message (optional)"
className="relative min-h-[56px] w-full resize-none rounded-lg bg-white/10 px-3 py-2 !outline-none backdrop-blur-xl placeholder:text-white/50"
/>
<div className="flex flex-col gap-2">
{walletConnectURL ? (
<button
type="button"
onClick={() => createZapRequest()}
className="inline-flex h-11 w-full items-center justify-center rounded-lg bg-orange-100 px-4 font-medium text-black hover:bg-orange-200"
>
<p>Tip with Alby</p>
<AlbyIcon className="h-6 w-6" />
</button>
) : (
<button
type="button"
onClick={() => createZapRequest()}
className="inline-flex h-11 w-full items-center justify-center rounded-lg bg-fuchsia-500 px-4 font-medium hover:bg-fuchsia-600"
>
<p>Create Lightning invoice</p>
</button>
)}
<span className="text-center text-sm leading-tight text-white/50">
The recipient receives 100% of the amount that you send. Lume does
not take any commission, and you cannot get refund
</span>
</div>
</div>
</>
) : (

View File

@ -130,27 +130,8 @@ export function LocalNetworkWidget() {
sub(
filter,
async (event) => {
let root: string;
let reply: string;
if (event.tags?.[0]?.[0] === 'e' && !event.tags?.[0]?.[3]) {
root = event.tags[0][1];
} else {
root = event.tags.find((el) => el[3] === 'root')?.[1];
reply = event.tags.find((el) => el[3] === 'reply')?.[1];
}
const rawEvent = toRawEvent(event);
await db.createEvent(
event.id,
JSON.stringify(rawEvent),
event.pubkey,
event.kind,
root,
reply,
event.created_at
);
await db.createEvent(rawEvent);
},
false // don't close sub on eose
);

View File

@ -3,7 +3,9 @@ import { createJSONStorage, persist } from 'zustand/middleware';
interface StrongholdState {
privkey: null | string;
walletConnectURL: null | string;
setPrivkey: (privkey: string) => void;
setWalletConnectURL: (uri: string) => void;
clearPrivkey: () => void;
}
@ -11,9 +13,13 @@ export const useStronghold = create<StrongholdState>()(
persist(
(set) => ({
privkey: null,
walletConnectURL: null,
setPrivkey: (privkey: string) => {
set({ privkey: privkey });
},
setWalletConnectURL: (uri: string) => {
set({ walletConnectURL: uri });
},
clearPrivkey: () => {
set({ privkey: null });
},

View File

@ -25,26 +25,8 @@ export function useEvent(id: string, embed?: string) {
const event = await ndk.fetchEvent(id);
if (!event) throw new Error(`Event not found: ${id.toString()}`);
let root: string;
let reply: string;
if (event.tags?.[0]?.[0] === 'e' && !event.tags?.[0]?.[3]) {
root = event.tags[0][1];
} else {
root = event.tags.find((el) => el[3] === 'root')?.[1];
reply = event.tags.find((el) => el[3] === 'reply')?.[1];
}
const rawEvent = toRawEvent(event);
await db.createEvent(
event.id,
JSON.stringify(rawEvent),
event.pubkey,
event.kind,
root,
reply,
event.created_at
);
await db.createEvent(rawEvent);
return event;
},

View File

@ -134,37 +134,21 @@ export function useNostr() {
console.log("prefetching events with user's network: ", db.account.network.length);
console.log('prefetching events since: ', since);
const events = await fetcher.fetchAllEvents(
const events = (await fetcher.fetchAllEvents(
relayUrls,
{
kinds: [NDKKind.Text, NDKKind.Repost, 1063, NDKKind.Article],
authors: db.account.network,
},
{ since: since }
);
)) as unknown as NDKEvent[];
// save all events to database
for (const event of events) {
let root: string;
let reply: string;
if (event.tags?.[0]?.[0] === 'e' && !event.tags?.[0]?.[3]) {
root = event.tags[0][1];
} else {
root = event.tags.find((el) => el[3] === 'root')?.[1];
reply = event.tags.find((el) => el[3] === 'reply')?.[1];
}
await db.createEvent(
event.id,
JSON.stringify(event),
event.pubkey,
event.kind,
root,
reply,
event.created_at
);
}
const promises = await Promise.all(
events.map(async (event) => await db.createEvent(event))
);
return { status: 'ok', message: 'prefetch completed' };
if (promises) return { status: 'ok', message: 'prefetch completed' };
} catch (e) {
console.error('prefetch events failed, error: ', e);
return { status: 'failed', message: e };

View File

@ -1,5 +1,5 @@
import { nip19 } from 'nostr-tools';
import { EventPointer } from 'nostr-tools/lib/nip19';
import { EventPointer, ProfilePointer } from 'nostr-tools/lib/nip19';
import { RichContent } from '@utils/types';
@ -58,20 +58,27 @@ export function parser(eventContent: string) {
}
// nostr account references
if (word.startsWith('nostr:npub1')) {
if (word.startsWith('nostr:npub1') || word.startsWith('npub1')) {
const npub = word.replace('nostr:', '').replace(/[^a-zA-Z0-9 ]/g, '');
return word.replace(word, `~pub-${nip19.decode(npub).data}~`);
}
// nostr profile references
if (word.startsWith('nostr:nprofile1') || word.startsWith('nprofile1')) {
const nprofile = word.replace('nostr:', '').replace(/[^a-zA-Z0-9 ]/g, '');
const decoded = nip19.decode(nprofile).data as ProfilePointer;
return word.replace(word, `~pub-${decoded.pubkey}~`);
}
// nostr account references
if (word.startsWith('nostr:note1')) {
if (word.startsWith('nostr:note1') || word.startsWith('noté')) {
const note = word.replace('nostr:', '').replace(/[^a-zA-Z0-9 ]/g, '');
content.notes.push(nip19.decode(note).data as string);
return word.replace(word, '');
}
// nostr event references
if (word.startsWith('nostr:nevent1')) {
if (word.startsWith('nostr:nevent1') || word.startsWith('nevent1')) {
const nevent = word.replace('nostr:', '').replace(/[^a-zA-Z0-9 ]/g, '');
const decoded = nip19.decode(nevent).data as EventPointer;
content.notes.push(decoded.id);