-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: extend sandbox with PoO request (#996)
* feat(sandbox): extend sandbox with PoO request Proof of ownership (PoO) is new type of request RDT and wallets introduced. It's used to ensure specific accounts/personas are controlled by user * chore: bump neverthrow to ^8.0.0 * fix: regression in pow requests * fix: bump RDT to only use `authorizedRequest` for POO * feat: bump rdt
- Loading branch information
1 parent
2f794ed
commit fd54e4f
Showing
10 changed files
with
275 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -76,7 +76,6 @@ export const PersonaDataCard = () => { | |
) | ||
} | ||
)} | ||
; | ||
<Box mt={2}> | ||
<Checkbox | ||
disabled={!enabled} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
import Box from '@mui/joy/Box' | ||
import Checkbox from '@mui/joy/Checkbox' | ||
import { Card } from '../components/Card' | ||
import { Button, Input } from '@mui/joy' | ||
|
||
export const AccountsProofCard = ({ | ||
state, | ||
updateState | ||
}: { | ||
state: { | ||
enabled: boolean | ||
data: { | ||
addresses: string[] | ||
} | ||
} | ||
updateState: (state: { | ||
enabled: boolean | ||
data: { | ||
addresses: string[] | ||
} | ||
}) => void | ||
}) => { | ||
const enabled = !!state.enabled | ||
return ( | ||
<Card | ||
title="Accounts Proof of Ownership" | ||
side={ | ||
<Checkbox | ||
checked={enabled} | ||
onChange={(ev) => { | ||
updateState({ ...state, enabled: ev.target.checked }) | ||
}} | ||
/> | ||
} | ||
> | ||
<Box | ||
sx={{ | ||
p: 2, | ||
display: 'grid', | ||
gap: 2 | ||
}} | ||
> | ||
<Button | ||
color="primary" | ||
onClick={() => { | ||
updateState({ | ||
...state, | ||
data: { | ||
addresses: [...state.data.addresses, ''] | ||
} | ||
}) | ||
}} | ||
> | ||
Add | ||
</Button> | ||
{state.data.addresses.map((address, index) => ( | ||
<Box sx={{ display: 'flex', gap: 1 }} key={index}> | ||
<Input | ||
sx={{ width: '100%' }} | ||
placeholder="account address" | ||
value={address} | ||
onChange={(ev) => { | ||
const addresses = [...state.data.addresses] | ||
addresses[index] = ev.target.value | ||
updateState({ | ||
...state, | ||
data: { | ||
addresses | ||
} | ||
}) | ||
}} | ||
/> | ||
<Button | ||
onClick={() => { | ||
const addresses = [...state.data.addresses] | ||
addresses.splice(index, 1) | ||
updateState({ | ||
...state, | ||
data: { | ||
addresses | ||
} | ||
}) | ||
}} | ||
> | ||
x | ||
</Button> | ||
</Box> | ||
))} | ||
</Box> | ||
</Card> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import Box from '@mui/joy/Box' | ||
import Checkbox from '@mui/joy/Checkbox' | ||
import { Card } from '../components/Card' | ||
import { Input } from '@mui/joy' | ||
|
||
export const PersonaProofCard = ({ | ||
state, | ||
updateState | ||
}: { | ||
state: { | ||
enabled: boolean | ||
data: { | ||
address: string | ||
} | ||
} | ||
updateState: (state: { | ||
enabled: boolean | ||
data: { | ||
address: string | ||
} | ||
}) => void | ||
}) => { | ||
const enabled = !!state.enabled | ||
return ( | ||
<Card | ||
title="Persona Proof of Ownership" | ||
side={ | ||
<Checkbox | ||
checked={enabled} | ||
onChange={(ev) => { | ||
updateState({ ...state, enabled: ev.target.checked }) | ||
}} | ||
/> | ||
} | ||
> | ||
<Box sx={{ p: 2 }}> | ||
<Input | ||
placeholder="Identity address" | ||
onChange={(event) => { | ||
updateState({ | ||
...state, | ||
data: { address: event.target.value.toString() } | ||
}) | ||
}} | ||
/> | ||
</Box> | ||
</Card> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.