* Migrate vault entries to new schema (#2092) * Migrate existing vault entries to new schema * Read+write new vault schema * Drop VaultEntry table * Refactor vaultPrismaFragments * Remove wrong comment * Remove TODO * Fix possible race condition on update of vault key * Remove lib/object.js * Wallet schema v2 (#2146) * Add wallet-v2 TODOs * Update checkWallet * Wallet list * Delete almost all wallet v1 code and add some code for wallet protocol forms * Define protocol display name in JSON * Show form per protocol * Increase max-height of image in form * Add JSdoc for protocols, form validation * Use wallet cards again My wallet list was quite ugly and I couldn't look at it anymore. * Refactor hooks in wallet provider * Fix PasswordInput not used * Read encrypted wallets * Decrypt wallets * useWalletQuery now returns decrypted wallets * Refactor useIndexedDB because its only purpose will be to store the key, so no need for pagination code etc. * There is still a bug: if the wallet is not decrypted on first render, the form will not see the decrypted value. See TODO. * Rename protocolJson to protocol it no longer uses a JSON file * Fix form not updated with decrypted API key * Fix wallet template forms * Fix optional shown as hint * Rename to mapUserWalletResolveTypes * Save LNbits send and recv TODO: * implement resolvers for other protocols * fix double update required for trigger? * add missing validation on server * add missing network tests * don't import from wallets/client on server * Move definitions to lib/wallets.json and lib/protocols * Fix ProtocolWallet.updated_at not updated by trigger * Move wallet fragments into wallets/client/fragments/ * move invoice fragments to fragments/invoice.js * remove some unused fragments that I don't think I also will not use * move fragments that will be generated in own file * Move wallet resolvers into wallets/server/resolvers * Fix missing authorization check on wallet update * Run all shared code in generic wallet update function * Fix 'encrypt' flag not set for blink send currency * Add mutations for all protocols * Fix macaroon validation * Fix CLN socket value not set * Add server-side schema validation * Fix JSDoc typedef for protocols * Don't put JSDoc into separate file * Create test invoices on save * Also move type resolvers into wallets/server/resolvers * Fix unconfigured protocols of UserWallet not found * Fix Blink API key in wallet seed * Test send payment on save (except LNC) This does not include LNC because LNC cannot be saved yet * Check if window.webln is defined on save * Create new wallets from templates * Separate protocols in wallets/lib into individual files * Use justify-content-start for protocol tabs and larger margin at the top * Add LNC to client protocols * Only return wallets from useWallets * Query decrypted wallets * Payments with new wallets * More wallet logos * Fix TypeError in useIndexedDB * Add protocol attach docs * Fix undefined useWalletRecvPrompt import * Remove outdated TODOs * First successful zap to new wallets * Fix walletLogger imports * Fix sequences * the sequences for InvoiceForward and DirectPayment were still starting at 1 * when using setval() with two arguments, nextval() will return the second argument+1 (see https://www.postgresql.org/docs/current/functions-sequence.html) * Rename ProtocolWallet columns * Remove more outdated TODOs * Update wallet indicator * Fix page reset on route change * Refactor __typename checks into functions * Refactor protocol selection into own hook * Add button to detach protocol * Refetch wallet on save and detach * Refetch wallets on change * Always show all templates * Refactor WalletLink component * Also put wallet into forms context * Remove outdated TODOs * Use useMemo in wallets hooks * Passphrase modals * prompt for password if decryption failed * add button to reveal passphrase on wallet page TODO: * remove button if passphrase was revealed or imported * encrypt wallets with new key on passphrase reveal * Fix protocol missing as callback dependency * Encrypt wallets with new key on passphrase export * Update 'unlock wallets' text * Rename wallet mutation hooks * Remove 'removeWallet' mutation Wallets are automatically deleted when all protocols are deleted * Passphrase reset * Use 110px as minimum width for bip39 words longest bip39 words are 8 characters and they fit into 103px so I rounded up to 110px. * Also disable passphrase export on save * Wallet settings * Fix wallet receive prompt * Remove unused parameters from postgres function * Rename UserWallet to Wallet, ProtocolWallet to WalletProtocol * Use danger variant for button to show passphrase * Fix inconsistent imports and exports * Remove outdated TODOs * wallet logs * Remove outdated comment * Make sure wallets are used in priority order * Separate wallets from templates in reducer * Fix missing useCallback dependencies * Refactor with useWalletLogger hook * Move enabled to WalletProtocol * Add checkbox to enable/disable protocol * Fix migration with prod db dump * Parse Coinos relay URLs * Skip network tests if only enabled changed * Allow IndexedDB calls without session * Add code to migrate old CryptoKey * first try to use existing CryptoKey before generating a new one * bump IDB version to delete old object stores and create new ones * return IDB callbacks with useMemo * don't delete old IDB right away, wait until next release * Fix ghost import error *Sometimes*, I get import errors because it tries to resolve @/wallets/server to wallets/server.js instead of wallets/server/index.js. For the files in wallets/server, it kind of makes sense because it's a circular import. But I don't know why the files in worker/ have this problem. Interestingly, it only seems to happen with walletLogger imports, so I guess its related to its import chain. Anyway, this commit should make sure this never happens again ... * Skip wallets queries if not logged in * Split CUSTOM wallet into NWC and LN_ADDR * Migrate local wallets * Link to /wallets/:id/receive if send not supported * Hide separator if there are no configured wallets * Save LNC * Add one-liner to attach LNC * Update wallet priorities via DnD * Wallet logs are part of protocol resolvers * Fix logging to deleted protocol * Fix trying to fetch logs for template * also change type to Int so GraphQL layer can catch trying to fetch string IDs as is the case for templates * Fix embedded flag for wallets logs not set * Remove TODO * Decrease max-height for embedded wallet logs on big screens * Fix missing refetch on wallet priority update * Set priorities of all wallets in one tx * Fix nested state update * Add DragIcon * DnD mobile support and refactor * Add CancelButton to wallet settings * Remount form if path changes This fixes the following warning in the console: """ Warning: A component is changing an uncontrolled input to be controlled. This is likely caused by the value changing from undefined to a defined value, which should not happen. Decide between using a controlled or uncontrolled input element for the lifetime of the component. """ * Support string and object for wallet.image JSON * Append domain to lightning address inputs * Remove outdated TODOs * Add template IDs to wallet JSON * Fix missing callback dependency * Implement lightning address save in receive prompt * Update TODOs * Fix missing check for enabled * Pay QR codes with WebLN as anon * Add logo for NWC * Fix trying to save logs for template * Add template logs * Fix inconsistent margin * Always throw on missing key * Remove misleading comment Wallets are returned even if decryption fails so we can show the unlock page if a wallet is stored as encrypted in the context. Maybe I should rethink this. * Check for existing wallets on local wallet migration * Fix local wallet migration causing duplicates * Fix protocol reattached on detach due to migration * Fix form not centered * Fix ZEUS lightning address domain * Add placeholder, help, hints etc. to wallet form inputs * Fix wallet badges not updated * Remove unused declared variables * Rename to ATTACH_PAGE * Fix 500 error if no amount was given to LNURLp endpoint * Tag log messages with wallet name * Only skip network tests if we're disabling the wallet * Rename var to networkTests * Continue to store key hash in IndexedDB * Rethink wallet state management If decryption failed, the function to decrypt the wallets didn't throw but simply returned wallets that were still encrypted. This was bad because it meant we could not rely on the wallets in the state being decrypted, even though this was the original idea behind the query hooks: hide the details of encryption and decryption inside them. Because of this, we had to check if the wallets were still encrypted before we ran the wallet migration since we want to check if a protocol already exists. This commit fixes this by making encryption and decryption always throw (and catching the errors), as well as returning a ready state from hooks. A hook might not be ready because it still needs to load something (in the case of the crypto hooks, it's loading the key from IndexedDB). Callers check that ready state before they call the function returned by the hook. So now, the wallet migration hook can itself simply check if the hook to encrypt wallets is ready and if the wallets are no longer loading to let callers know if it itself is ready. Since we also relied on wallets stored as encrypted in the context to show the unlock page, this was also changed by comparing the local and remote key hash. * Add empty line * Save new key hash during wallet reset * Only receive protocol upserts require networkTests param * Compare key hashes on server on each save * Delete old code * Fix card shows attach instead of configure * Fix empty wallets created during migration The old schema can contain '' instead of NULL in the columns of wallets for receiving. * Update reset passphrase text * Wrap passphrase reset in try/catch * Fix migrate called multiple times * Update key hash on migration if not set * Fetch local wallets in migrate * Fix missing await on setKey * Let first device set key hash * Fix indicator not shown if wallets locked * Check if IndexedDB is available * Fix inconsistent WebLN error message * Disable WebLN if not available * Remove outdated TODO * Cursor-based pagination for wallet logs * Fix log message x-overflow * Add context to wallet logs * Wrap errors are warnings in logs * Rename wallet v2 migrations * Update wallet status during logging * Fix wallet logs loading state The loading state would go from false -> true -> false because it's false when the lazy query wasn't called yet. * Add wallet search * Add Alby Go wallet * Revert "Add Alby Go wallet" This reverts commit 926c70638f1673756480c848237e52d5889dc037. * Fix wallet logs sent by client don't update protocol status * Fix mutation name * put drag icon on opposite corner * Add wallets/README.md * Fix inconsistent case in wallets/README.md * Fix autoprefixer warning about mixed support This warning was in the app logs: app | Warning app | app | (31:3) autoprefixer: end value has mixed support, consider using flex-end instead app | app | Import trace for requested module: app | ./styles/wallet.module.css app | ./wallets/client/hooks/prompt.js app | ./wallets/client/hooks/index.js app | ./wallets/client/context/hooks.js app | ./wallets/client/context/provider.js app | ./wallets/client/context/index.js * fix effect of wallet indicators on logo * Fix deleting wallet template logs * Use name as primary key of WalletTemplate * Fix wallet_clear_vault trigger not mentioned in README * Fix wallet receive prompt Also remove no longer needed templateId from wallets.json and helper functions * Use findUnique since name is now primary key * Merge Alby wallets into one * Remove unused name parameter from WalletsForm component * Fix number check to decide if wallet or template * Update wallet encryption on click, not as effect * add cashu.me and lightning address logos * add images * Use recommended typeof to check if IDB available * Also check if IDB available on delete * Use constraint triggers * Add indices on columns used for joins * Fix inconsistent CLEAR OR REPLACE TRIGGER * Attach wallet_check_support trigger to WalletProtocol table * Update wallets/README.md * Remove debugging code * Refactor reducer: replace page with status * Show 'wallets unavailable' if device does not support IndexedDB * Remove duplicate ELSIF condition * Fix hasSendWallet The useSendWallets hook was not checking if the returned send wallets are enabled. Since the components that used that hook only need to know if there is a send wallet, I replaced the useSendWallets hook with a useHasSendWallet hook. * Add Cash App wallet * fix changes loglevel enum * Fix key init race condition in strict mode if no key exists yet * Formatting * Fix key init race condition via transactions in readwrite mode * Replace Promise.withResolvers with regular promises * replace generic spinner with our usual --------- Co-authored-by: k00b <k00b@stacker.news>
26 lines
6.6 KiB
XML
26 lines
6.6 KiB
XML
<svg width="124" height="36" viewBox="0 0 124 36" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
<path d="M21.8684 35.583C20.6223 35.8559 19.3279 35.9997 17.9999 35.9997C14.3549 35.9997 10.963 34.9163 8.12856 33.054C7.42496 32.0476 7.10927 31.4935 6.87899 31.0894C6.76489 30.8892 6.67176 30.7257 6.5628 30.5623C5.48908 28.8355 4.9273 26.6174 4.80479 24.0113C4.42532 15.9363 9.3328 10.7798 14.3461 9.93346C17.5241 9.39695 20.0496 9.94028 21.9866 10.9762C20.2741 10.4998 18.2326 10.4712 15.9053 11.1374C10.2636 12.9558 8.38286 18.4852 9.18896 24.6085C10.5958 32.2811 18.1187 35.0311 21.8684 35.583Z" fill="url(#paint0_linear_24_382)"/>
|
|
<path d="M5.79919 31.235C4.74978 29.3716 3.79946 26.5912 3.68071 24.0649C3.27786 15.4924 8.51664 9.77741 14.1585 8.82493C21.8491 7.52657 26.1246 12.0794 27.5985 15.4587C27.6602 15.4171 27.6852 15.3348 27.6527 15.264C25.2293 9.99435 20.2169 6.37564 14.4271 6.37564C7.85277 6.37564 1.98661 11.0916 0 18.1005C0.028214 23.2941 2.25599 27.9669 5.79919 31.235Z" fill="url(#paint1_linear_24_382)"/>
|
|
<path d="M28.1246 32.8843C26.8263 33.7692 25.4062 34.4887 23.8946 35.0124C23.1688 34.886 22.3647 34.7286 21.7985 34.6178C21.5302 34.5653 21.3152 34.5232 21.1875 34.4998C17.7635 33.8744 11.6415 31.6681 10.3003 24.4334C9.9214 21.5244 10.1928 18.8466 11.1539 16.7225C12.1007 14.6299 13.7348 13.0257 16.2268 12.2158C19.1232 11.4267 21.5234 11.8178 23.3063 12.7753C22.8674 12.6828 22.4138 12.6343 21.9496 12.6343C18.0919 12.6343 14.9645 15.9849 14.9645 20.1182C14.9645 21.7686 15.4632 23.2943 16.3078 24.5316C16.3078 24.5316 18.7257 29.0989 25.3078 28.6907C31.1767 28.3267 34.2244 23.0624 34.5876 21.1179C34.7764 20.1074 34.8751 19.0652 34.8751 17.9999C34.8751 8.68016 27.32 1.12499 18.0002 1.12499C10.9479 1.12499 4.90605 5.45106 2.38354 11.5942C1.53151 12.7042 0.797846 13.9347 0.206665 15.2653C1.52404 6.62202 8.98879 0 18.0002 0C27.9413 0 36.0001 8.05884 36.0001 17.9999C36.0001 24.1869 32.8786 29.6444 28.1246 32.8843Z" fill="url(#paint2_linear_24_382)"/>
|
|
<path d="M46 32H50.3419V24.8894C50.7308 25.396 51.2555 25.7985 51.9158 26.0971C52.5852 26.3866 53.3721 26.5313 54.2767 26.5313C55.9592 26.5313 57.325 25.9207 58.3743 24.6994C59.4236 23.469 59.9482 21.8225 59.9482 19.7599V19.3257C59.9482 17.2359 59.4236 15.5939 58.3743 14.3998C57.3341 13.2056 55.9546 12.6086 54.236 12.6086C53.3405 12.6086 52.5354 12.7895 51.8208 13.1514C51.1062 13.5042 50.5906 13.9475 50.274 14.4812H50.2198L50.179 12.9207H46V32ZM50.3419 21.6868V17.453C50.5409 17.0007 50.8529 16.6026 51.2781 16.2589C51.7123 15.9151 52.2505 15.7432 52.8927 15.7432C53.7792 15.7432 54.4395 16.0463 54.8737 16.6524C55.3079 17.2495 55.525 18.0863 55.525 19.1628V19.9499C55.525 21.0174 55.3079 21.8678 54.8737 22.501C54.4486 23.1253 53.7882 23.4374 52.8927 23.4374C52.2776 23.4374 51.7439 23.2655 51.2917 22.9217C50.8484 22.5689 50.5318 22.1573 50.3419 21.6868Z" fill="#DDDDDD"/>
|
|
<path d="M62.1192 26.2599H66.5425V18.0637C66.8319 17.4666 67.2435 16.9826 67.7772 16.6117C68.3109 16.2408 68.8807 16.0553 69.4868 16.0553C69.7491 16.0553 69.9843 16.0689 70.1923 16.096C70.4094 16.1232 70.5994 16.1639 70.7622 16.2182V12.785C70.6718 12.7488 70.518 12.7126 70.3009 12.6764C70.0838 12.6402 69.8577 12.6221 69.6225 12.6221C68.9441 12.6221 68.3335 12.8076 67.7907 13.1785C67.248 13.5494 66.8183 14.0153 66.5018 14.5762H66.461L66.4068 12.9207H62.1192V26.2599Z" fill="#DDDDDD"/>
|
|
<path d="M72.4718 26.2599H76.8815V12.9207H72.4718V26.2599ZM72.1869 8.72756C72.1869 9.36082 72.3995 9.8991 72.8246 10.3424C73.2588 10.7857 73.8739 11.0073 74.6699 11.0073C75.4659 11.0073 76.081 10.7857 76.5152 10.3424C76.9494 9.8991 77.1665 9.36082 77.1665 8.72756C77.1665 8.08525 76.9539 7.54697 76.5288 7.11273C76.1036 6.6785 75.4885 6.46138 74.6835 6.46138C73.8875 6.46138 73.2724 6.6785 72.8382 7.11273C72.404 7.54697 72.1869 8.08525 72.1869 8.72756Z" fill="#DDDDDD"/>
|
|
<path d="M79.7852 26.2599H84.1406V17.6023C84.3667 17.0685 84.6743 16.6479 85.0632 16.3403C85.4522 16.0327 85.909 15.8789 86.4336 15.8789C87.0397 15.8789 87.501 16.0508 87.8176 16.3946C88.1432 16.7383 88.3061 17.3038 88.3061 18.0908V26.2599H92.6751V17.5887C92.9012 17.0731 93.2088 16.6614 93.5977 16.3539C93.9957 16.0372 94.457 15.8789 94.9817 15.8789C95.5877 15.888 96.0491 16.0644 96.3657 16.4081C96.6823 16.7429 96.8406 17.2947 96.8406 18.0637V26.2599H101.196V17.7651C101.196 15.9106 100.789 14.5898 99.9748 13.8027C99.1698 13.0066 98.0979 12.6086 96.7591 12.6086C95.8003 12.6086 94.9093 12.8121 94.0862 13.2192C93.2721 13.6263 92.6253 14.2098 92.1459 14.9697H92.1052C91.8157 14.2008 91.3228 13.6173 90.6263 13.2192C89.9388 12.8121 89.1156 12.6086 88.1568 12.6086C87.2794 12.6086 86.4879 12.7895 85.7824 13.1514C85.0859 13.5132 84.5205 14.0153 84.0863 14.6576H84.032L83.9913 12.9207H79.7852V26.2599Z" fill="#DDDDDD"/>
|
|
<path d="M103.299 22.3789C103.299 23.7359 103.724 24.7582 104.575 25.4457C105.434 26.1333 106.551 26.477 107.926 26.477C109.084 26.477 110.043 26.2735 110.802 25.8664C111.571 25.4593 112.105 25.0024 112.403 24.4958C112.431 24.8215 112.485 25.1427 112.566 25.4593C112.657 25.7759 112.761 26.0428 112.878 26.2599H117.166V26.0564C116.985 25.7035 116.845 25.2829 116.745 24.7944C116.655 24.2968 116.61 23.7766 116.61 23.2338V17.263C116.61 15.6256 116.089 14.4315 115.049 13.6806C114.018 12.9297 112.517 12.5543 110.545 12.5543C108.591 12.5543 107.026 12.9478 105.85 13.7349C104.683 14.5129 104.1 15.5216 104.1 16.761V17.0324L108.211 17.0459V16.8017C108.211 16.3222 108.378 15.9377 108.713 15.6482C109.048 15.3587 109.572 15.214 110.287 15.214C111.001 15.214 111.508 15.3859 111.806 15.7296C112.105 16.0734 112.254 16.5438 112.254 17.1409V17.9415H109.269C107.505 17.9506 106.067 18.3396 104.954 19.1086C103.851 19.8775 103.299 20.9676 103.299 22.3789ZM107.627 22.0397C107.627 21.4426 107.844 21.0038 108.279 20.7234C108.722 20.4429 109.405 20.3027 110.327 20.3027H112.254V21.4426C112.254 22.0849 111.992 22.6503 111.467 23.1388C110.952 23.6183 110.332 23.858 109.608 23.858C108.939 23.858 108.441 23.6997 108.116 23.3831C107.79 23.0574 107.627 22.6096 107.627 22.0397Z" fill="#DDDDDD"/>
|
|
<path d="M119.527 26.2599H123.909V6H119.527V26.2599Z" fill="#DDDDDD"/>
|
|
<defs>
|
|
<linearGradient id="paint0_linear_24_382" x1="11.2413" y1="14.9124" x2="11.2138" y2="30.9099" gradientUnits="userSpaceOnUse">
|
|
<stop offset="0.0297309" stop-color="#FA3C3C"/>
|
|
<stop offset="1" stop-color="#BC1870"/>
|
|
</linearGradient>
|
|
<linearGradient id="paint1_linear_24_382" x1="8.79045" y1="7.31564" x2="7.89914" y2="23.3177" gradientUnits="userSpaceOnUse">
|
|
<stop stop-color="#FF9F2F"/>
|
|
<stop offset="1" stop-color="#FA3C3C"/>
|
|
</linearGradient>
|
|
<linearGradient id="paint2_linear_24_382" x1="21.375" y1="35.6248" x2="21.4244" y2="17.0626" gradientUnits="userSpaceOnUse">
|
|
<stop stop-color="#5B09AD"/>
|
|
<stop offset="1" stop-color="#BC1870"/>
|
|
</linearGradient>
|
|
</defs>
|
|
</svg>
|