update applesauce wallet

This commit is contained in:
hzrd149 2025-03-14 15:16:39 +00:00
parent 81b20f9056
commit 054c8817bc
4 changed files with 91 additions and 106 deletions

View File

@ -92,7 +92,7 @@
"ngeohash": "^0.6.3",
"nostr-idb": "^2.2.0",
"nostr-signer-capacitor-plugin": "^0.0.3",
"nostr-tools": "^2.10.4",
"nostr-tools": "^2.11.0",
"nostr-typedef": "^0.11.0",
"nostr-wasm": "^0.1.0",
"nuka-carousel": "^8.2.0",

167
pnpm-lock.yaml generated
View File

@ -105,34 +105,34 @@ importers:
version: 0.7.2
applesauce-accounts:
specifier: next
version: 0.0.0-next-20250313225050(typescript@5.8.2)
version: 0.0.0-next-20250314151125(typescript@5.8.2)
applesauce-actions:
specifier: next
version: 0.0.0-next-20250313225050(typescript@5.8.2)
version: 0.0.0-next-20250314151125(typescript@5.8.2)
applesauce-content:
specifier: next
version: 0.0.0-next-20250313225050(typescript@5.8.2)
version: 0.0.0-next-20250314151125(typescript@5.8.2)
applesauce-core:
specifier: next
version: 0.0.0-next-20250313225050(typescript@5.8.2)
version: 0.0.0-next-20250314151125(typescript@5.8.2)
applesauce-factory:
specifier: next
version: 0.0.0-next-20250313225050(typescript@5.8.2)
version: 0.0.0-next-20250314151125(typescript@5.8.2)
applesauce-loaders:
specifier: next
version: 0.0.0-next-20250313225050(typescript@5.8.2)
version: 0.0.0-next-20250314151125(typescript@5.8.2)
applesauce-react:
specifier: next
version: 0.0.0-next-20250313225050(react-dom@19.0.0(react@19.0.0))(typescript@5.8.2)
version: 0.0.0-next-20250314151125(react-dom@19.0.0(react@19.0.0))(typescript@5.8.2)
applesauce-relay:
specifier: next
version: 0.0.0-next-20250313225050(typescript@5.8.2)
version: 0.0.0-next-20250314151125(typescript@5.8.2)
applesauce-signers:
specifier: next
version: 0.0.0-next-20250313225050(typescript@5.8.2)
version: 0.0.0-next-20250314151125(typescript@5.8.2)
applesauce-wallet:
specifier: next
version: 0.0.0-next-20250313225050(typescript@5.8.2)
version: 0.0.0-next-20250314151125(typescript@5.8.2)
bech32:
specifier: ^2.0.0
version: 2.0.0
@ -233,8 +233,8 @@ importers:
specifier: ^0.0.3
version: 0.0.3(@capacitor/core@6.2.0)
nostr-tools:
specifier: ^2.10.4
version: 2.10.4(typescript@5.8.2)
specifier: ^2.11.0
version: 2.11.0(typescript@5.8.2)
nostr-typedef:
specifier: ^0.11.0
version: 0.11.0
@ -2205,35 +2205,35 @@ packages:
engines: {node: '>=8.0.0'}
hasBin: true
applesauce-accounts@0.0.0-next-20250313225050:
resolution: {integrity: sha512-vuMJNPAyQosyHLyyzUIVgn03WqheJFrsrc3twkrUoAp53nIOX43TO2H9i487tOmF7ia5HH1C+/KN1vI9fzKxGw==}
applesauce-accounts@0.0.0-next-20250314151125:
resolution: {integrity: sha512-QEumvkVlZVsSkShOKtIjokf8Pg5PxWgNJIfmNRIp/fDqzyICNGAwrQ28n9vq2A+A0aQRqFc700vWjs1uSACsoQ==}
applesauce-actions@0.0.0-next-20250313225050:
resolution: {integrity: sha512-fCDuhPxeUpjSZgz9v4BqGy3eFT0iNU185jwc1pB50dwDAWrnVJLwlUTWalIhQvWCrzRQqyc7Fu5dcwV0Z1ECZg==}
applesauce-actions@0.0.0-next-20250314151125:
resolution: {integrity: sha512-SapbCJ4vxrXMbWTzVP6v3zSBx1EHSXxqW8MBIywCyR+GVcXcWteIm6pgJGWgMzZDDdWY+BaDSdXedmr2r7eXDQ==}
applesauce-content@0.0.0-next-20250313225050:
resolution: {integrity: sha512-vf4duzqtRKLLV9bDezCm4RASwLJmhqrzzyfH7T+l3ddih9So6mVMpES8FyG8NqDpFoM/0pHMBAXzwh5cUK+ySw==}
applesauce-content@0.0.0-next-20250314151125:
resolution: {integrity: sha512-C1PUbK4q89y2M7DqOHZEcPzTTfxXphK8VRFgsQ2E6T8MJIJV3719z78traoVtrsf/DYR9SR5zQP24BQ8k1dF7g==}
applesauce-core@0.0.0-next-20250313225050:
resolution: {integrity: sha512-Z8/ukCDFmYbTxehLB0nlD+ewo06OgD1c0jZyDrtNWt9VpXz6PjRKss3UGlx5/IAttEE+wwc9+KHvPOrtVG3udQ==}
applesauce-core@0.0.0-next-20250314151125:
resolution: {integrity: sha512-5c0An4cH89MYANPJQaYArMoWbU86BIt48cYDNLh9bMXtrX+t8bjvJ829uFatwCbw9Lc/v8ZFCLhjltiFTp1P4w==}
applesauce-factory@0.0.0-next-20250313225050:
resolution: {integrity: sha512-faTv970d9/sLqOsK/s0EDXXY1Wr3N2I3Lub5XY6N4bqQtkoYr4G0TdZHlxW5MkyiSx7HT5IF6nP1ZU/qpzqCsw==}
applesauce-factory@0.0.0-next-20250314151125:
resolution: {integrity: sha512-m36/ys37RzZPPzpvYOEi6pRYfXrWC6JEt1LrBxADBoZaluKIgKGf8MKj1bvS9anwobcxNKKgVPNsJqYZu4Y0ug==}
applesauce-loaders@0.0.0-next-20250313225050:
resolution: {integrity: sha512-ebnUfTVxP1Pwm501iogVGC/Q2Rwe8cUIkRPjxr3hfeOYXVXrp+2rKY61gIYTG4grNeaFXomJe1c6k8tszCe9YA==}
applesauce-loaders@0.0.0-next-20250314151125:
resolution: {integrity: sha512-CfxxvsVptHEmBSBA0ilqImHSUn7ff4fritslH9SWrXp1aH3P/JFR66eLYfRVNUUKEDDEe/iZEvCb2PzsAnecRw==}
applesauce-react@0.0.0-next-20250313225050:
resolution: {integrity: sha512-N2fbW23kndMSYBakA/iTdkHDeougtXQLAEjNcvUG6EOSnSvOTQ3YQuP8qPBUc7xAwclZ5wAmdy7JC/EGVB2L4Q==}
applesauce-react@0.0.0-next-20250314151125:
resolution: {integrity: sha512-7f501dlHxbmSuBsOHqxF376KXUluDBrlatirqN+yuJQAIRpfy5bIuNIDvgePoQqB4IDjhCgxzD5Q8YIPY9Rpyw==}
applesauce-relay@0.0.0-next-20250313225050:
resolution: {integrity: sha512-dqN6ZMfAUmLjJ5A2zCcmxwIEIHX/rV5WwfnChoflujcTRflfTquUg6Q8vpOTkpfEKh2cm0Tci2GZLwEEiShryQ==}
applesauce-relay@0.0.0-next-20250314151125:
resolution: {integrity: sha512-YEzPQkud+uilxZeuR7LxZkFduRO1tPeq3ATLF3mGP9q88BJn59sPvQO4IEo4nCnbBPKcTaIMy6Bh6Xc5RFx9TA==}
applesauce-signers@0.0.0-next-20250313225050:
resolution: {integrity: sha512-o+kuvGp2eCtpEoVz3uGpDBgzq/vXp028lhRGDI+wL3nwI/ki77i7uADTzd8ylrq7eNvc3rdnebjZM9CpP1Y0vw==}
applesauce-signers@0.0.0-next-20250314151125:
resolution: {integrity: sha512-I0hvuchdPXM1riOSxC+ezKvCF5e9CcqFYx8e7if784OgsnM3OmL/3esMTu3c3X7OgT8PjFhdL8WieSOl1Tj1IA==}
applesauce-wallet@0.0.0-next-20250313225050:
resolution: {integrity: sha512-wpaJOYJTXBuYkDA20m86+rhBaKStUDWxqoMsSX+Cd0oPg1bS7wfpKcn/U353kqjvCU4osInzGwhCupg362khAg==}
applesauce-wallet@0.0.0-next-20250314151125:
resolution: {integrity: sha512-/IRVsQIORXSg7B1B2Xh6hMt3UAh7vK8QfBvpMyI9HWUmrQTdczznYhZCVdmQxJRk3MLYQdL7iIg78Y++3mPemg==}
arg@4.1.3:
resolution: {integrity: sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==}
@ -2358,8 +2358,8 @@ packages:
resolution: {integrity: sha512-pbnl5XzGBdrFU/wT4jqmJVPn2B6UHPBOhzMQkY/SPUPB6QtUXtmBHBIwCbXJol93mOpGMnQyP/+BB19q04xj7g==}
engines: {node: '>=4'}
better-sqlite3@11.8.1:
resolution: {integrity: sha512-9BxNaBkblMjhJW8sMRZxnxVTRgbRmssZW0Oxc1MPBTfiR+WW21e2Mk4qu8CzrcZb1LwPCnFsfDEzq+SNcBU8eg==}
better-sqlite3@11.9.0:
resolution: {integrity: sha512-4b9xYnoaskj8eIkke9ZCB42p5bOPabptSku8Rl4Yww70Jf+aHeLvrIjXDJrKQxUEjdppsFb+fdJSjoH4TklROA==}
bezier-js@6.1.4:
resolution: {integrity: sha512-PA0FW9ZpcHbojUCMu28z9Vg/fNkwTj5YhusSAjHHDfHDGLxJ6YUKrAN2vk1fP2MMOxVw4Oko16FMlRGVBGqLKg==}
@ -3059,8 +3059,8 @@ packages:
engines: {node: '>=0.10.0'}
hasBin: true
electron-to-chromium@1.5.117:
resolution: {integrity: sha512-G4+CYIJBiQ72N0gi868tmG4WsD8bwLE9XytBdfgXO5zdlTlvOP2ABzWYILYxCIHmsbm2HjBSgm/E/H/QfcnIyQ==}
electron-to-chromium@1.5.118:
resolution: {integrity: sha512-yNDUus0iultYyVoEFLnQeei7LOQkL8wg8GQpkPCRrOlJXlcCwa6eGKZkxQ9ciHsqZyYbj8Jd94X1CTPzGm+uIA==}
elementtree@0.1.7:
resolution: {integrity: sha512-wkgGT6kugeQk/P6VZ/f4T+4HB41BVgNBq5CDIZVbQ02nvTVqAiVTbskxxu3eA/X96lMlfYOwnLQpN2v5E1zDEg==}
@ -4444,8 +4444,8 @@ packages:
peerDependencies:
'@capacitor/core': ^6.0.0
nostr-tools@2.10.4:
resolution: {integrity: sha512-biU7sk+jxHgVASfobg2T5ttxOGGSt69wEVBC51sHHOEaKAAdzHBLV/I2l9Rf61UzClhliZwNouYhqIso4a3HYg==}
nostr-tools@2.11.0:
resolution: {integrity: sha512-kRtXI9j5f45NvIcdJacQ0UEAfEb7p/jhZqhAGLQWtUd5idZJPYdSyR8hdw+MmpGH4TCMH5plZrXzFltIIZrkEA==}
peerDependencies:
typescript: '>=5.0.0'
peerDependenciesMeta:
@ -8030,7 +8030,7 @@ snapshots:
'@satellite-earth/core@0.5.0(typescript@5.8.2)':
dependencies:
better-sqlite3: 11.8.1
better-sqlite3: 11.9.0
blossom-client-sdk: 0.9.1
blossom-server-sdk: 0.4.0
cors: 2.8.5
@ -8042,7 +8042,7 @@ snapshots:
http-errors: 2.0.0
lowdb: 7.0.1
mime: 4.0.6
nostr-tools: 2.10.4(typescript@5.8.2)
nostr-tools: 2.11.0(typescript@5.8.2)
ws: 8.18.1
transitivePeerDependencies:
- bufferutil
@ -8480,35 +8480,36 @@ snapshots:
dependencies:
entities: 2.2.0
applesauce-accounts@0.0.0-next-20250313225050(typescript@5.8.2):
applesauce-accounts@0.0.0-next-20250314151125(typescript@5.8.2):
dependencies:
'@noble/hashes': 1.7.1
applesauce-signers: 0.0.0-next-20250313225050(typescript@5.8.2)
applesauce-signers: 0.0.0-next-20250314151125(typescript@5.8.2)
nanoid: 5.1.3
nostr-tools: 2.10.4(typescript@5.8.2)
nostr-tools: 2.11.0(typescript@5.8.2)
rxjs: 7.8.2
transitivePeerDependencies:
- supports-color
- typescript
applesauce-actions@0.0.0-next-20250313225050(typescript@5.8.2):
applesauce-actions@0.0.0-next-20250314151125(typescript@5.8.2):
dependencies:
applesauce-core: 0.0.0-next-20250313225050(typescript@5.8.2)
applesauce-factory: 0.0.0-next-20250313225050(typescript@5.8.2)
nostr-tools: 2.10.4(typescript@5.8.2)
applesauce-core: 0.0.0-next-20250314151125(typescript@5.8.2)
applesauce-factory: 0.0.0-next-20250314151125(typescript@5.8.2)
nostr-tools: 2.11.0(typescript@5.8.2)
rxjs: 7.8.2
transitivePeerDependencies:
- supports-color
- typescript
applesauce-content@0.0.0-next-20250313225050(typescript@5.8.2):
applesauce-content@0.0.0-next-20250314151125(typescript@5.8.2):
dependencies:
'@cashu/cashu-ts': 2.0.0-rc1
'@types/hast': 3.0.4
'@types/mdast': 4.0.4
'@types/unist': 3.0.3
applesauce-core: 0.0.0-next-20250313225050(typescript@5.8.2)
applesauce-core: 0.0.0-next-20250314151125(typescript@5.8.2)
mdast-util-find-and-replace: 3.0.2
nostr-tools: 2.10.4(typescript@5.8.2)
nostr-tools: 2.11.0(typescript@5.8.2)
remark: 15.0.1
remark-parse: 11.0.0
unified: 11.0.5
@ -8517,7 +8518,7 @@ snapshots:
- supports-color
- typescript
applesauce-core@0.0.0-next-20250313225050(typescript@5.8.2):
applesauce-core@0.0.0-next-20250314151125(typescript@5.8.2):
dependencies:
'@noble/hashes': 1.7.1
'@scure/base': 1.2.4
@ -8526,41 +8527,41 @@ snapshots:
hash-sum: 2.0.0
light-bolt11-decoder: 3.2.0
nanoid: 5.1.3
nostr-tools: 2.10.4(typescript@5.8.2)
nostr-tools: 2.11.0(typescript@5.8.2)
rxjs: 7.8.2
transitivePeerDependencies:
- supports-color
- typescript
applesauce-factory@0.0.0-next-20250313225050(typescript@5.8.2):
applesauce-factory@0.0.0-next-20250314151125(typescript@5.8.2):
dependencies:
applesauce-content: 0.0.0-next-20250313225050(typescript@5.8.2)
applesauce-core: 0.0.0-next-20250313225050(typescript@5.8.2)
applesauce-content: 0.0.0-next-20250314151125(typescript@5.8.2)
applesauce-core: 0.0.0-next-20250314151125(typescript@5.8.2)
nanoid: 5.1.3
nostr-tools: 2.10.4(typescript@5.8.2)
nostr-tools: 2.11.0(typescript@5.8.2)
transitivePeerDependencies:
- supports-color
- typescript
applesauce-loaders@0.0.0-next-20250313225050(typescript@5.8.2):
applesauce-loaders@0.0.0-next-20250314151125(typescript@5.8.2):
dependencies:
applesauce-core: 0.0.0-next-20250313225050(typescript@5.8.2)
applesauce-core: 0.0.0-next-20250314151125(typescript@5.8.2)
nanoid: 5.1.3
nostr-tools: 2.10.4(typescript@5.8.2)
nostr-tools: 2.11.0(typescript@5.8.2)
rx-nostr: 3.5.0
rxjs: 7.8.2
transitivePeerDependencies:
- supports-color
- typescript
applesauce-react@0.0.0-next-20250313225050(react-dom@19.0.0(react@19.0.0))(typescript@5.8.2):
applesauce-react@0.0.0-next-20250314151125(react-dom@19.0.0(react@19.0.0))(typescript@5.8.2):
dependencies:
applesauce-accounts: 0.0.0-next-20250313225050(typescript@5.8.2)
applesauce-actions: 0.0.0-next-20250313225050(typescript@5.8.2)
applesauce-content: 0.0.0-next-20250313225050(typescript@5.8.2)
applesauce-core: 0.0.0-next-20250313225050(typescript@5.8.2)
applesauce-factory: 0.0.0-next-20250313225050(typescript@5.8.2)
nostr-tools: 2.10.4(typescript@5.8.2)
applesauce-accounts: 0.0.0-next-20250314151125(typescript@5.8.2)
applesauce-actions: 0.0.0-next-20250314151125(typescript@5.8.2)
applesauce-content: 0.0.0-next-20250314151125(typescript@5.8.2)
applesauce-core: 0.0.0-next-20250314151125(typescript@5.8.2)
applesauce-factory: 0.0.0-next-20250314151125(typescript@5.8.2)
nostr-tools: 2.11.0(typescript@5.8.2)
observable-hooks: 4.2.4(react-dom@19.0.0(react@19.0.0))(react@18.3.1)(rxjs@7.8.2)
react: 18.3.1
rxjs: 7.8.2
@ -8569,38 +8570,38 @@ snapshots:
- supports-color
- typescript
applesauce-relay@0.0.0-next-20250313225050(typescript@5.8.2):
applesauce-relay@0.0.0-next-20250314151125(typescript@5.8.2):
dependencies:
applesauce-core: 0.0.0-next-20250313225050(typescript@5.8.2)
applesauce-core: 0.0.0-next-20250314151125(typescript@5.8.2)
nanoid: 5.1.3
nostr-tools: 2.10.4(typescript@5.8.2)
nostr-tools: 2.11.0(typescript@5.8.2)
rxjs: 7.8.2
transitivePeerDependencies:
- supports-color
- typescript
applesauce-signers@0.0.0-next-20250313225050(typescript@5.8.2):
applesauce-signers@0.0.0-next-20250314151125(typescript@5.8.2):
dependencies:
'@noble/hashes': 1.7.1
'@noble/secp256k1': 1.7.1
'@scure/base': 1.2.4
applesauce-core: 0.0.0-next-20250313225050(typescript@5.8.2)
applesauce-core: 0.0.0-next-20250314151125(typescript@5.8.2)
debug: 4.4.0
nanoid: 5.1.3
nostr-tools: 2.10.4(typescript@5.8.2)
nostr-tools: 2.11.0(typescript@5.8.2)
transitivePeerDependencies:
- supports-color
- typescript
applesauce-wallet@0.0.0-next-20250313225050(typescript@5.8.2):
applesauce-wallet@0.0.0-next-20250314151125(typescript@5.8.2):
dependencies:
'@cashu/cashu-ts': 2.0.0-rc1
'@gandlaf21/bc-ur': 1.1.12
'@noble/hashes': 1.7.1
applesauce-actions: 0.0.0-next-20250313225050(typescript@5.8.2)
applesauce-core: 0.0.0-next-20250313225050(typescript@5.8.2)
applesauce-factory: 0.0.0-next-20250313225050(typescript@5.8.2)
nostr-tools: 2.10.4(typescript@5.8.2)
applesauce-actions: 0.0.0-next-20250314151125(typescript@5.8.2)
applesauce-core: 0.0.0-next-20250314151125(typescript@5.8.2)
applesauce-factory: 0.0.0-next-20250314151125(typescript@5.8.2)
nostr-tools: 2.11.0(typescript@5.8.2)
rxjs: 7.8.2
transitivePeerDependencies:
- supports-color
@ -8728,7 +8729,7 @@ snapshots:
dependencies:
is-windows: 1.0.2
better-sqlite3@11.8.1:
better-sqlite3@11.9.0:
dependencies:
bindings: 1.5.0
prebuild-install: 7.1.3
@ -8767,7 +8768,7 @@ snapshots:
blossom-server-sdk@0.4.0:
dependencies:
better-sqlite3: 11.8.1
better-sqlite3: 11.9.0
debug: 4.4.0
mime: 4.0.6
minio: 7.1.3
@ -8825,7 +8826,7 @@ snapshots:
browserslist@4.24.4:
dependencies:
caniuse-lite: 1.0.30001704
electron-to-chromium: 1.5.117
electron-to-chromium: 1.5.118
node-releases: 2.0.19
update-browserslist-db: 1.1.3(browserslist@4.24.4)
@ -9526,7 +9527,7 @@ snapshots:
dependencies:
jake: 10.9.2
electron-to-chromium@1.5.117: {}
electron-to-chromium@1.5.118: {}
elementtree@0.1.7:
dependencies:
@ -11182,7 +11183,7 @@ snapshots:
dependencies:
debug: 4.4.0
idb: 8.0.2
nostr-tools: 2.10.4(typescript@5.8.2)
nostr-tools: 2.11.0(typescript@5.8.2)
transitivePeerDependencies:
- supports-color
- typescript
@ -11191,7 +11192,7 @@ snapshots:
dependencies:
'@capacitor/core': 6.2.0
nostr-tools@2.10.4(typescript@5.8.2):
nostr-tools@2.11.0(typescript@5.8.2):
dependencies:
'@noble/ciphers': 0.5.3
'@noble/curves': 1.2.0

View File

@ -6,7 +6,7 @@ import { eventStore } from "./event-store";
import factory from "./event-factory";
import rxNostr from "./rx-nostr";
const actions = new ActionHub(eventStore, factory, async (label, event) => {
const actions = new ActionHub(eventStore, factory, async (event) => {
const mailboxes = eventStore.getReplaceable(kinds.RelayList, event.pubkey);
const outboxes = mailboxes && getOutboxes(mailboxes);

View File

@ -1,27 +1,16 @@
import { useState } from "react";
import {
Button,
Flex,
Input,
NumberDecrementStepper,
NumberIncrementStepper,
NumberInput,
NumberInputField,
NumberInputStepper,
Select,
} from "@chakra-ui/react";
import { Button, Flex, Input, Select } from "@chakra-ui/react";
import { WalletBalanceQuery, WalletQuery, WalletTokensQuery } from "applesauce-wallet/queries";
import { useActionHub, useActiveAccount, useStoreQuery } from "applesauce-react/hooks";
import { CompleteSpend } from "applesauce-wallet/actions";
import { useNavigate } from "react-router-dom";
import { useForm } from "react-hook-form";
import { getEncodedToken, Token } from "@cashu/cashu-ts";
import { dumbTokenSelection } from "applesauce-wallet/helpers";
import SimpleView from "../../../components/layout/presets/simple-view";
import CashuMintName from "../../../components/cashu/cashu-mint-name";
import WalletUnlockButton from "../components/wallet-unlock-button";
import RouterLink from "../../../components/router-link";
import { getEncodedToken, Proof, Token } from "@cashu/cashu-ts";
import { dumbTokenSelection, getTokenContent } from "applesauce-wallet/helpers";
import { getCashuWallet } from "../../../services/cashu-mints";
export default function WalletSendCashuView() {
@ -44,16 +33,11 @@ export default function WalletSendCashuView() {
const selected = dumbTokenSelection(tokens, values.amount, values.mint);
const wallet = await getCashuWallet(values.mint);
// get the proofs
const selectedProofs = selected
.map((t) => getTokenContent(t)!)
.reduce((arr, token) => [...arr, ...token.proofs], [] as Proof[]);
// swap
const send = await wallet.send(values.amount, selectedProofs);
const send = await wallet.send(values.amount, selected.proofs);
// save the change
await actions.run(CompleteSpend, selected, { proofs: send.keep, mint: values.mint });
await actions.run(CompleteSpend, selected.events, { proofs: send.keep, mint: values.mint });
// redirect to the token view
const token: Token = {