Skip to content

Commit 797689c

Browse files
itsrachelfishjamaljsr
authored andcommitted
ui+connect: Custodial account support
1 parent 708bbd0 commit 797689c

File tree

4 files changed

+50
-0
lines changed

4 files changed

+50
-0
lines changed

app/src/components/common/FormInputNumber.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ interface Props {
77
value?: number;
88
extra?: ReactNode;
99
placeholder?: string;
10+
className?: string;
1011
onChange: (value: number) => void;
1112
}
1213

@@ -15,6 +16,7 @@ const FormInputNumber: React.FC<Props> = ({
1516
value,
1617
extra,
1718
placeholder,
19+
className,
1820
onChange,
1921
}) => {
2022
const handleChange = useCallback(
@@ -35,6 +37,7 @@ const FormInputNumber: React.FC<Props> = ({
3537

3638
return (
3739
<FormInput
40+
className={className}
3841
label={label}
3942
value={valueText}
4043
extra={extra}

app/src/components/connect/CustomSessionPage.tsx

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { Paragraph, Small, Label } from 'components/common/v2/Text';
99
import OverlayFormWrap from 'components/common/OverlayFormWrap';
1010
import FormField from 'components/common/FormField';
1111
import FormInput from 'components/common/FormInput';
12+
import FormInputNumber from 'components/common/FormInputNumber';
1213
import FormSelect from 'components/common/FormSelect';
1314
import FormDate from 'components/common/FormDate';
1415
import FormSwitch from 'components/common/v2/FormSwitch';
@@ -65,6 +66,11 @@ const Styled = {
6566
padding: 12px 40px 12px 0px;
6667
}
6768
`,
69+
FormInputNumber: styled(FormInputNumber)`
70+
input {
71+
background-color: ${props => props.theme.colors.lightningNavy};
72+
}
73+
`,
6874
FormDate: styled(FormDate)`
6975
input {
7076
font-family: ${props => props.theme.fonts.open.regular};
@@ -122,6 +128,7 @@ const CustomSessionPage: React.FC = () => {
122128
Permission,
123129
FormSelect,
124130
FormInput,
131+
FormInputNumber,
125132
FormDate,
126133
Small,
127134
Button,
@@ -199,6 +206,14 @@ const CustomSessionPage: React.FC = () => {
199206
<Small>{l('paymentsDesc')}</Small>
200207
</PermissionType>
201208

209+
<PermissionType
210+
active={addSessionView.permissionType === 'custodial'}
211+
onClick={setPermissionType('custodial')}
212+
>
213+
<Paragraph bold>{l('custodial')}</Paragraph>
214+
<Small>{l('custodialDesc')}</Small>
215+
</PermissionType>
216+
202217
<PermissionType
203218
active={addSessionView.permissionType === 'custom'}
204219
onClick={setPermissionType('custom')}
@@ -213,6 +228,21 @@ const CustomSessionPage: React.FC = () => {
213228
<Label semiBold>Permissions</Label>
214229

215230
<Permissions>
231+
{addSessionView.permissionType === 'custodial' && (
232+
<FormField>
233+
<Label semiBold space={8}>
234+
{l('addBalance')}
235+
</Label>
236+
237+
<FormInputNumber
238+
value={addSessionView.custodialBalance}
239+
onChange={addSessionView.setCustodialBalance}
240+
placeholder="1,000,000"
241+
extra={<b>sats</b>}
242+
/>
243+
</FormField>
244+
)}
245+
216246
<Permission>
217247
<div>
218248
<Paragraph bold>{l('permView')}</Paragraph>

app/src/components/connect/SessionRow.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { Session } from 'store/models';
77
import { BoltOutlined, Close, Column, Copy, QRCode, Row } from 'components/base';
88
import SortableHeader from 'components/common/SortableHeader';
99
import Tip from 'components/common/Tip';
10+
import * as LIT from 'types/generated/lit-sessions_pb';
1011
import QRCodeModal from './QRCodeModal';
1112

1213
/**
@@ -151,6 +152,18 @@ const SessionRow: React.FC<Props> = ({ session, style }) => {
151152
<QRCode disabled />
152153
</Tip>
153154
</>
155+
) : session.type === LIT.SessionType.TYPE_MACAROON_ACCOUNT ? (
156+
<>
157+
<Tip overlay={l('pairCustodial')}>
158+
<BoltOutlined disabled />
159+
</Tip>
160+
<Tip overlay={l('copy')}>
161+
<Copy onClick={handleCopy} />
162+
</Tip>
163+
<Tip overlay={l('generateQR')}>
164+
<QRCode onClick={toggleQRModal} />
165+
</Tip>
166+
</>
154167
) : (
155168
<>
156169
<Tip overlay={l('pairTerminal')}>

app/src/i18n/locales/en-US.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,12 @@
5353
"cmps.connect.CustomSessionPage.liquidityDesc": "User can only set fees, use Loop, and use Pool.",
5454
"cmps.connect.CustomSessionPage.payments": "Payments Manager",
5555
"cmps.connect.CustomSessionPage.paymentsDesc": "User can only send and receive payments.",
56+
"cmps.connect.CustomSessionPage.custodial": "Custodial Account",
57+
"cmps.connect.CustomSessionPage.custodialDesc": "Create a custodial off-chain account for your node.",
5658
"cmps.connect.CustomSessionPage.custom": "Custom",
5759
"cmps.connect.CustomSessionPage.customDesc": "Create a session with fully custom permissions.",
5860
"cmps.connect.CustomSessionPage.permissions": "Permissions",
61+
"cmps.connect.CustomSessionPage.addBalance": "Add Balance",
5962
"cmps.connect.CustomSessionPage.permView": "View Activity",
6063
"cmps.connect.CustomSessionPage.permViewDesc": "See node history and activity.",
6164
"cmps.connect.CustomSessionPage.permOpen": "Open Channel",
@@ -86,6 +89,7 @@
8689
"cmps.connect.SessionRow.pairTerminal": "Pair with Lightning Terminal",
8790
"cmps.connect.SessionRow.generateQR": "Generate QR Code",
8891
"cmps.connect.SessionRow.revoke": "Revoke Session",
92+
"cmps.connect.SessionRow.pairCustodial": "Custodial accounts can not be used with Terminal",
8993
"cmps.connect.QRCodeModal.title": "LNC QR",
9094
"cmps.connect.QRCodeModal.desc": "Scan to connect to Terminal from your mobile phone.",
9195
"cmps.home.HomePage.pageTitle": "Home",

0 commit comments

Comments
 (0)