Skip to content

Commit 5917e3a

Browse files
committed
Add privacy warning
1 parent 2ec3863 commit 5917e3a

File tree

4 files changed

+32
-4
lines changed

4 files changed

+32
-4
lines changed

wallets/client/components/form/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import Text from '@/components/text'
99
import Info from '@/components/info'
1010
import { useFormState, useMaxSteps, useNext, useStepIndex } from '@/components/multi-step-form'
1111
import { isTemplate, isWallet, protocolDisplayName, protocolFormId, protocolLogName, walletLud16Domain } from '@/wallets/lib/util'
12-
import { WalletGuide, WalletLayout, WalletLayoutHeader, WalletLayoutImageOrName, WalletLogs } from '@/wallets/client/components'
12+
import { WalletGuide, WalletLayout, WalletLayoutHeader, WalletLayoutImageOrName, WalletLayoutWarning, WalletLogs } from '@/wallets/client/components'
1313
import { TemplateLogsProvider, useTestSendPayment, useWalletLogger, useTestCreateInvoice, useWalletSupport } from '@/wallets/client/hooks'
1414
import ArrowRight from '@/svgs/arrow-right-s-fill.svg'
1515
import { useFormikContext } from 'formik'
@@ -45,6 +45,7 @@ export function WalletMultiStepForm ({ wallet }) {
4545
<WalletLayoutImageOrName name={wallet.name} maxHeight='80px' />
4646
</WalletLayoutHeader>
4747
<WalletGuide name={wallet.name} />
48+
<WalletLayoutWarning name={wallet.name} />
4849
<WalletMultiStepFormContextProvider wallet={wallet} initial={initial} steps={steps}>
4950
{steps.map(step => {
5051
// WalletForm is aware of the current step via hooks

wallets/client/components/layout.js

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
import { Alert } from 'react-bootstrap'
2+
import Link from 'next/link'
13
import Layout from '@/components/layout'
24
import { useWalletImage } from '@/wallets/client/hooks'
3-
import { walletDisplayName, walletGuideUrl } from '@/wallets/lib/util'
4-
import Link from 'next/link'
5+
import { walletDisplayName, walletGuideUrl, walletWarning } from '@/wallets/lib/util'
56
import InfoIcon from '@/svgs/information-fill.svg'
7+
import Text from '@/components/text'
68

79
export function WalletLayout ({ children }) {
810
// TODO(wallet-v2): py-5 doesn't work, I think it gets overriden by the layout class
@@ -69,3 +71,16 @@ export function WalletGuide ({ name }) {
6971
</Link>
7072
)
7173
}
74+
75+
export function WalletLayoutWarning ({ name }) {
76+
const warning = walletWarning(name)
77+
if (!warning) return null
78+
79+
if (warning) {
80+
return (
81+
<Alert variant='warning' className='mx-auto my-3'>
82+
<Text>{warning}</Text>
83+
</Alert>
84+
)
85+
}
86+
}

wallets/lib/util.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ export function walletDisplayName (name) {
1111
return walletJson(name)?.displayName || titleCase(name)
1212
}
1313

14+
export function walletWarning (name) {
15+
let { warning } = walletJson(name)
16+
if (Array.isArray(warning)) {
17+
warning = warning.join('\n')
18+
}
19+
return warning
20+
}
21+
1422
export function walletImage (name) {
1523
return walletJson(name)?.image
1624
}

wallets/lib/wallets.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,10 @@
173173
"name": "SPARK",
174174
"displayName": "Spark",
175175
"image": "/wallets/spark.svg",
176-
"url": "https://spark.money/"
176+
"url": "https://spark.money/",
177+
"warning": [
178+
"**Spark balances are public.**",
179+
"Anyone with your identity public key can look up your balance on [www.sparkscan.io](https://www.sparkscan.io/)."
180+
]
177181
}
178182
]

0 commit comments

Comments
 (0)