* wip: Use uniform interface for wallets * Fix import error * Update wallet logging + other stuff * add canPay and canSend to wallet definition * rename 'default payment method' to 'enabled' and add enable + disable method * Set canPay, canReceive in useWallet * Enable wallet if just configured * Don't pass logger to sendPayment * Add logging to attach & detach * Add schema to wallet def * Add NWC wallet * Fix unused isDefault saved in config * Fix enableWallet * wrong storage key was used * broke if wallets with no configs existed * Run validation during save * Use INFO level for 'wallet disabled' message * Pass config with spread operator * Support help, optional, hint in wallet fields * wip: Add LNC * Fix 20s page load for /settings/wallets.json?nodata=true For some reason, if nodata is passed (which is the case if going back), the page takes 20s to load. * Fix extremely slow page load for LNC import I noticed that the combination of ``` import { Form, PasswordInput, SubmitButton } from '@/components/form' ``` in components/wallet/lnc.js and the dynamic import via `await import` in components/wallet/index.js caused extremely slow page loads. * Use normal imports * Revert "Fix 20s page load for /settings/wallets.json?nodata=true" This reverts commit deb476b3a966569fefcfdf4082d6b64f90fbd0a2. Not using the dynamic import for LNC fixed the slow page load with ?nodata=true. * Remove follow and show recent logs first * Fix position of log start marker * Add FIXMEs for LNC I can't get LNC to connect. It just hangs forever on lnc.connect(). See FIXMEs. * Remove logger.error since already handled in useWallet * Don't require destructuring to pass props to input * wip: Add LND autowithdrawals * receiving wallets need to export 'server' object field * don't print macaroon error stack * fix missing wallet logs order update * mark autowithdrawl settings as required * fix server wallet logs deletion * remove canPay and canReceive since it was confusing where it is available TODO * also use numeric priority for sending wallets to be consistent with how status for receiving wallets is determined * define createInvoice function in wallet definition * consistent wallet logs: sending wallets use 'wallet attached'+'wallet enabled/disabled' whereas receiving wallets use 'wallet created/updated' * see FIXMEs * Fix TypeError * Fix sendPayment called with empty config * removed useEffect such that config is available on first render * fix hydration error using dynamic import without SSR * Fix confusing UX around enabled * Remove FIXMEs Rebase on master seemed to have fixed these, weird * Use same error format in toast and wallet log * Fix usage of conditional hooks in useConfig * Fix isConfigured * Fix delete wallet logs on server * Fix wallet logs refetch onError does not exist on client.mutate * Fix TypeError in isConfigured if no enabled wallet found * Only include local/server config if required * Fix another hydration error * Fix server config not updated after save or detach * Also use 'enabled' for server wallets * Fix wallet logs not updated after server delete * Consistent logs between local and server wallets * 'wallet attached' on create * 'wallet updated' on config updates * 'wallet enabled' and 'wallet disabled' if checkbox changed * 'wallet detached' on delete * Also enable server wallets on create * Disable checkbox if not configured yet * Move all validation schema into lib/validate * Implement drag & drop w/o persistence * Use dynamic import for WalletCard This fixes a lot of issues with hydration * Save order as priority * Fix autowithdrawSettings not applied Form requires config in flat format but mutation requires autowithdraw settings in a separate 'settings' field. I have decided that config will be in flat form format. It will be transformed into mutation format during save. * Save dedicated enabled flag for server wallets * wallet table now contains boolean column 'enabled' * 'priority' is now a number everywhere * use consistent order between how autowithdrawals are attempted and server wallets cards * Fix onCanceled missing * Fix typo * Fix noisy changes in lib/validate I moved the schema for lnbits, nwc and lnc out of lib/validate only to put them back in there later. This commit should make the changeset cleaner by removing noise. * Split arguments into [value,] config, context * Run lnbits url.replace in validate and sendPayment * Remove unnecessary WALLETS_QUERY * Generate wallet mutation from fields * Generate wallet resolver from fields * Fix import inconsistency between app and worker * Use wallet.createInvoice for autowithdrawals * Fix success autowithdrawal log * Fix wallet security banner shown for server wallets * Add autowithdrawal to lightning address * Add optional wallet short name for logging * Fix draggable * Fix autowithdraw loop * Add missing hints * Add CLN autowithdrawal * Detach wallets and delete logs on logout * Remove Wallet in lib/constants * Use inject function for resolvers and typeDefs * Fix priority ignored when fetching enabled wallet * Fix draggable false on first page load due to SSR * Use touches instead of dnd on mobile Browsers don't support drag events for touch devices. To have a consistent implementation for desktop and mobile, we would need to use mousedown/touchstart, mouseup/touchend and mousemove/touchmove. For now, this commit makes changing the order possible on touch devices with simple touches. * Fix duplicate CLN error * Fix autowithdraw priority order * Fix error per invalid bip39 word * Update LNC code * remove LNC FIXMEs Mhh, I guess the TURN server was down or something? It now magically works. Or maybe it only works once per mnemonic? * also removed the lnc.lnd.lightning.getInfo() call since we don't ask and need permission for this RPC for payments. * setting a password does not work though. It fails with 'The password provided is not valid' which is triggered at https://github.com/lightninglabs/lnc-web/blob/main/lib/util/credentialStore.ts#L81. * Fix order if wallet with no priority exists * Use common sort * Add link to lnbits.com * Add example wallet def * Remove TODOs TODO in components/wallet-logger.js was handled. I don't see a need for the TODO in lib/wallet.js anymore. This function will only be called with the wallet of type LIGHTNING_ADDRESS anyway. * Remove console.log * Toast priority save errors * Fix leaking relay connections * Remove 'tor or clearnet' hint for LN addresses * Remove React dependency from wallet definitions * Generate resolver name from walletField * Move wallets into top level directory wallet/ * Put wallets into own folder * Fix generateMutation * remove resolverName property from wallet defs * move function into lib/wallet * use function in generateMutation on client to fix wrongly generated mutation * Separate client and server imports by files * wallets now consist of an index.js, a client.js and a server.js file * client.js is imported on the client and contains the client portion * server.js is imported on the server and contains the server porition * both reexport index.js so everything in index.js can be shared by client and server * every wallet contains a client.js file since they are all imported on the client to show the cards * client.js of every wallet is reexported as an array in wallets/client.js * server.js of every wallet is reexported as an array in wallets/server.js FIXME: for some reason, worker does not properly import the default export of wallets/server.js * Fix worker import of wallets/server * Fix wallet.server usage * I removed wallet.server in a previous commit * the client couldn't determine which wallet was stored on the server since all server specific fields were set in server.js * walletType and walletField are now set in index.js * walletType is now used to determine if a wallet is stored on the server * also included some formatting changes * Fix w.default usage Since package.json with { "type": "module" } was added, this is no longer needed. * Fix id access in walletPrioritySort * Fix autowithdrawal error log * Generate validation schema for LNbits * Generate validation schema for NWC * Rename to torAllowed * Generate validation schema for LNC * Generate validation schema for LND * Generate validation schema for LnAddr * Remove stringTypes * Generate validation schema for CLN * Make clear that message belongs to test * validate.message was used in tandem with validate.test * it might be confused as the message if the validation for validate.type failed * now validate.test can be a function or an object of { test, message } shape which matches Yup.test * Remove validate.schema as a trap door * make lnc work * Return null if no wallet was found * Revert code around schema generation * Transform autowithdrawSchemaMembers into an object * Rename schema to yupSchema * Fix missing required for LNbits adminKey * Support formik form-level validation * Fix missing addWalletLog import * Fix missing space after = * fix merge conflict resolution mistake * remove non-custodial* badges * create guides for attaching wallets in sndev * Use built-in formik validation or Yup schema but not both * Rename: validate -> testConnectClient, testConnect -> testConnectServer * make lnaddr autowithdraw work in dev * move ATTACH docs to ./wallets and add lnaddr doc * Fix missing rename: yupSchema -> fieldValidation * Remove unused context * Add documentation how to add wallets --------- Co-authored-by: keyan <keyan.kousha+huumn@gmail.com> Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
163 lines
7.1 KiB
Plaintext
163 lines
7.1 KiB
Plaintext
PRISMA_SLOW_LOGS_MS=
|
|
GRAPHQL_SLOW_LOGS_MS=
|
|
NODE_ENV=development
|
|
|
|
############################################################################
|
|
# OPTIONAL SECRETS #
|
|
# put these in .env.local, and don't commit them to git #
|
|
############################################################################
|
|
|
|
# github
|
|
GITHUB_ID=
|
|
GITHUB_SECRET=
|
|
|
|
# twitter
|
|
TWITTER_ID=
|
|
TWITTER_SECRET=
|
|
|
|
# email list
|
|
LIST_MONK_AUTH=
|
|
|
|
# VAPID for Web Push
|
|
VAPID_MAILTO=
|
|
NEXT_PUBLIC_VAPID_PUBKEY=
|
|
VAPID_PRIVKEY=
|
|
|
|
# slack
|
|
SLACK_BOT_TOKEN=
|
|
SLACK_CHANNEL_ID=
|
|
|
|
# lnurl ... you'll need a tunnel to localhost:3000 for these
|
|
LNAUTH_URL=
|
|
LNWITH_URL=
|
|
|
|
########################################
|
|
# SNDEV STUFF WE PRESET #
|
|
# which you can override in .env.local #
|
|
########################################
|
|
|
|
# email
|
|
LOGIN_EMAIL_SERVER=smtp://mailhog:1025
|
|
LOGIN_EMAIL_FROM=sndev@mailhog.dev
|
|
|
|
# email salt
|
|
# openssl rand -hex 32
|
|
EMAIL_SALT=202c90943c313b829e65e3f29164fb5dd7ea3370d7262c4159691c2f6493bb8b
|
|
|
|
# static things
|
|
NEXTAUTH_URL=http://localhost:3000/api/auth
|
|
SELF_URL=http://app:3000
|
|
PUBLIC_URL=http://localhost:3000
|
|
NEXT_PUBLIC_URL=http://localhost:3000
|
|
LND_CONNECT_ADDRESS=03cc1d0932bb99b0697f5b5e5961b83ab7fd66f1efc4c9f5c7bad66c1bcbe78f02@xhlmkj7mfrl6ejnczfwl2vqik3xim6wzmurc2vlyfoqw2sasaocgpuad.onion:9735
|
|
NEXTAUTH_SECRET=3_0W_PhDRZVanbeJsZZGIEljexkKoGbL6qGIqSwTjjI
|
|
JWT_SIGNING_PRIVATE_KEY={"kty":"oct","kid":"FvD__hmeKoKHu2fKjUrWbRKfhjimIM4IKshyrJG4KSM","alg":"HS512","k":"3_0W_PhDRZVanbeJsZZGIEljexkKoGbL6qGIqSwTjjI"}
|
|
INVOICE_HMAC_KEY=a4c1d9c81edb87b79d28809876a18cf72293eadb39f92f3f4f2f1cfbdf907c91
|
|
|
|
# lnd
|
|
# xxd -p -c0 docker/lnd/sn/regtest/admin.macaroon
|
|
LND_CERT=2d2d2d2d2d424547494e2043455254494649434154452d2d2d2d2d0a4d494943516a43434165696741774942416749516139493834682b48653350385a437541525854554d54414b42676771686b6a4f50515144416a41344d5238770a485159445651514b45785a73626d5167595856306232646c626d56795958526c5a43426a5a584a304d5255774577594456515144457778694e6a41785a5749780a4d474d354f444d774868634e4d6a51774d7a41334d5463774d6a45355768634e4d6a55774e5441794d5463774d6a4535576a41344d523877485159445651514b0a45785a73626d5167595856306232646c626d56795958526c5a43426a5a584a304d5255774577594456515144457778694e6a41785a5749784d474d354f444d770a5754415442676371686b6a4f5051494242676771686b6a4f50514d4242774e4341415365596a4b62542b4a4a4a37624b6770677a6d6c3278496130364e3174680a2f4f7033533173382b4f4a41387836647849682f326548556b4f7578675a36703549434b496f375a544c356a5963764375793941334b6e466f3448544d4948510a4d41344741315564447745422f775145417749437044415442674e56485355454444414b4267677242674546425163444154415042674e5648524d42416638450a425441444151482f4d4230474131556444675157424252545756796e653752786f747568717354727969466d6a36736c557a423542674e5648524545636a42770a676778694e6a41785a5749784d474d354f444f4343577876593246736147397a64494947633235666247356b6768526f62334e304c6d52765932746c636935700a626e526c636d356862494945645735706549494b64573570654842685932746c64494948596e566d59323975626f6345667741414159635141414141414141410a41414141414141414141414141596345724273414254414b42676771686b6a4f5051514441674e4941444246416945413873616c4a667134476671465557532f0a35347a335461746c6447736673796a4a383035425a5263334f326f434943794e6e3975716976566f5575365935345143624c3966394c575779547a516e61616e0a656977482f51696b0a2d2d2d2d2d454e442043455254494649434154452d2d2d2d2d0a
|
|
LND_MACAROON=0201036c6e6402f801030a106cf4e146abffa5d766befbbf4c73b5a31201301a160a0761646472657373120472656164120577726974651a130a04696e666f120472656164120577726974651a170a08696e766f69636573120472656164120577726974651a210a086d616361726f6f6e120867656e6572617465120472656164120577726974651a160a076d657373616765120472656164120577726974651a170a086f6666636861696e120472656164120577726974651a160a076f6e636861696e120472656164120577726974651a140a057065657273120472656164120577726974651a180a067369676e6572120867656e6572617465120472656164000006202c3bfd55c191e925cbffd73712c9d4b9b4a8440410bde5f8a0a6e33af8b3d876
|
|
LND_SOCKET=sn_lnd:10009
|
|
|
|
# nostr (NIP-57 zap receipts)
|
|
# openssl rand -hex 32
|
|
NOSTR_PRIVATE_KEY=5f30b7e7714360f51f2be2e30c1d93b7fdf67366e730658e85777dfcc4e4245f
|
|
|
|
# imgproxy
|
|
NEXT_PUBLIC_IMGPROXY_URL=http://localhost:3001
|
|
IMGPROXY_KEY=9c273e803fd5d444bf8883f8c3000de57bee7995222370cab7f2d218dd9a4bbff6ca11cbf902e61eeef4358616f231da51e183aee6841e3a797a5c9a9530ba67
|
|
IMGPROXY_SALT=47b802be2c9250a66b998f411fc63912ab0bc1c6b47d99b8d37c61019d1312a984b98745eac83db9791b01bb8c93ecbc9b2ef9f2981d66061c7d0a4528ff6465
|
|
|
|
IMGPROXY_ENABLE_WEBP_DETECTION=1
|
|
IMGPROXY_ENABLE_AVIF_DETECTION=1
|
|
IMGPROXY_MAX_ANIMATION_FRAMES=2000
|
|
IMGPROXY_MAX_SRC_RESOLUTION=50
|
|
IMGPROXY_MAX_ANIMATION_FRAME_RESOLUTION=200
|
|
IMGPROXY_READ_TIMEOUT=10
|
|
IMGPROXY_WRITE_TIMEOUT=10
|
|
IMGPROXY_DOWNLOAD_TIMEOUT=9
|
|
# IMGPROXY_DEVELOPMENT_ERRORS_MODE=1
|
|
# IMGPROXY_ENABLE_DEBUG_HEADERS=true
|
|
|
|
NEXT_PUBLIC_AWS_UPLOAD_BUCKET=uploads
|
|
NEXT_PUBLIC_MEDIA_DOMAIN=localhost:4566
|
|
NEXT_PUBLIC_MEDIA_URL=http://localhost:4566/uploads
|
|
|
|
# search
|
|
OPENSEARCH_URL=http://opensearch:9200
|
|
OPENSEARCH_USERNAME=admin
|
|
OPENSEARCH_PASSWORD=mVchg1T5oA9wudUh
|
|
OPENSEARCH_INDEX=item
|
|
OPENSEARCH_MODEL_ID=
|
|
|
|
# prisma db url
|
|
DATABASE_URL="postgresql://sn:password@db:5432/stackernews?schema=public"
|
|
DB_APP_CONNECTION_LIMIT=2
|
|
DB_WORKER_CONNECTION_LIMIT=2
|
|
DB_TRANSACTION_TIMEOUT=5000
|
|
|
|
# polling intervals
|
|
NEXT_PUBLIC_FAST_POLL_INTERVAL=1000
|
|
NEXT_PUBLIC_NORMAL_POLL_INTERVAL=30000
|
|
NEXT_PUBLIC_LONG_POLL_INTERVAL=60000
|
|
NEXT_PUBLIC_EXTRA_LONG_POLL_INTERVAL=300000
|
|
|
|
# containers can't use localhost, so we need to use the container name
|
|
IMGPROXY_URL_DOCKER=http://imgproxy:8080
|
|
MEDIA_URL_DOCKER=http://s3:4566/uploads
|
|
|
|
# postgres container stuff
|
|
POSTGRES_PASSWORD=password
|
|
POSTGRES_USER=sn
|
|
POSTGRES_DB=stackernews
|
|
|
|
# opensearch container stuff
|
|
OPENSEARCH_INITIAL_ADMIN_PASSWORD=mVchg1T5oA9wudUh
|
|
plugins.security.disabled=true
|
|
discovery.type=single-node
|
|
DISABLE_SECURITY_DASHBOARDS_PLUGIN=true
|
|
|
|
# bitcoind container stuff
|
|
RPC_AUTH='7c68e5fcdba94a366bfdf629ecc676bb$0d0fc087c3bf7f068f350292bf8de1418df3dd8cb31e35682d5d3108d601002b'
|
|
RPC_USER=bitcoin
|
|
RPC_PASS=bitcoin
|
|
RPC_PORT=18443
|
|
P2P_PORT=18444
|
|
ZMQ_BLOCK_PORT=28334
|
|
ZMQ_TX_PORT=28335
|
|
|
|
# sn lnd container stuff
|
|
LND_REST_PORT=8080
|
|
LND_GRPC_PORT=10009
|
|
LND_P2P_PORT=9735
|
|
# docker exec -u lnd sn_lnd lncli newaddress p2wkh --unused
|
|
LND_ADDR=bcrt1q7q06n5st4vqq3lssn0rtkrn2qqypghv9xg2xnl
|
|
LND_PUBKEY=02cb2e2d5a6c5b17fa67b1a883e2973c82e328fb9bd08b2b156a9e23820c87a490
|
|
|
|
# stacker lnd container stuff
|
|
STACKER_LND_REST_PORT=8081
|
|
STACKER_LND_GRPC_PORT=10010
|
|
# docker exec -u lnd stacker_lnd lncli newaddress p2wkh --unused
|
|
STACKER_LND_ADDR=bcrt1qfqau4ug9e6rtrvxrgclg58e0r93wshucumm9vu
|
|
STACKER_LND_PUBKEY=028093ae52e011d45b3e67f2e0f2cb6c3a1d7f88d2920d408f3ac6db3a56dc4b35
|
|
|
|
# stacker cln container stuff
|
|
STACKER_CLN_REST_PORT=9092
|
|
# docker exec -u clightning stacker_cln lightning-cli newaddr bech32
|
|
STACKER_CLN_ADDR=bcrt1q02sqd74l4pxedy24fg0qtjz4y2jq7x4lxlgzrx
|
|
STACKER_CLN_PUBKEY=03ca7acec181dbf5e427c682c4261a46a0dd9ea5f35d97acb094e399f727835b90
|
|
|
|
LNCLI_NETWORK=regtest
|
|
|
|
# localstack container stuff
|
|
AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE
|
|
AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
|
|
PERSISTENCE=1
|
|
SKIP_SSL_CERT_DOWNLOAD=1
|
|
|
|
# tor
|
|
TOR_PROXY=http://127.0.0.1:7050/
|
|
|
|
# lnbits
|
|
LNBITS_WEB_PORT=5001 |