Skip to content

Commit 516bfd3

Browse files
committed
feat(wallet): enhance DRep script handling and UI components
- Added support for displaying DRep scripts in the InspectMultisigScript and ReviewNativeScript components. - Updated wallet management to include DRep keys in the new wallet creation and invite flows. - Improved UI to show DRep script information and CBOR representation for better user experience.
1 parent 9d16067 commit 516bfd3

File tree

4 files changed

+32
-5
lines changed

4 files changed

+32
-5
lines changed

src/components/multisig/inspect-multisig-script.tsx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,16 @@ export default function InspectMultisigScript({
7474

7575
if (mWallet?.buildScript(3) !== undefined && mWallet.isGovernanceEnabled()) {
7676
slides.push(
77-
<RowLabelInfo
78-
key="stake-3"
79-
label="drep:"
80-
value={<Code>{JSON.stringify(mWallet.buildScript(3), null, 2)}</Code>}
81-
/>,
77+
<div key="drep-3">
78+
<RowLabelInfo
79+
label="drep:"
80+
value={<Code>{JSON.stringify(mWallet.buildScript(3), null, 2)}</Code>}
81+
/>
82+
<RowLabelInfo
83+
label="DRep Script CBOR"
84+
value={<Code>{mWallet.getDRepScript()}</Code>}
85+
/>
86+
</div>,
8287
);
8388
}
8489

src/components/pages/homepage/wallets/invite/info/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,13 @@ export default function PageNewWalletInviteInfo() {
100100
const updatedAddresses = newWallet.signersAddresses.filter((_, i) => i !== userIndex);
101101
const updatedStakeKeys = newWallet.signersStakeKeys.filter((_, i) => i !== userIndex);
102102
const updatedDescriptions = newWallet.signersDescriptions.filter((_, i) => i !== userIndex);
103+
const updatedDRepKeys = newWallet.signersDRepKeys?.filter((_, i) => i !== userIndex) || [];
103104

104105
updateNewWalletSigners({
105106
walletId: newWalletId!,
106107
signersAddresses: updatedAddresses,
107108
signersStakeKeys: updatedStakeKeys,
109+
signersDRepKeys: updatedDRepKeys,
108110
signersDescriptions: updatedDescriptions,
109111
});
110112
}

src/components/pages/homepage/wallets/new-wallet-flow/create/ReviewNativeScript.tsx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ export default function ReviewNativeScript({
9393
...(mWallet?.buildScript(2) !== undefined && mWallet.stakingEnabled()
9494
? [{ id: "stake", label: "Stake Script" }]
9595
: []),
96+
...(mWallet?.buildScript(3) !== undefined && mWallet.isGovernanceEnabled()
97+
? [{ id: "drep", label: "DRep Script" }]
98+
: []),
9699
];
97100

98101
const renderContent = () => {
@@ -185,6 +188,22 @@ export default function ReviewNativeScript({
185188
</div>
186189
);
187190

191+
case "drep":
192+
return (
193+
<div className="space-y-4 min-h-[200px]">
194+
<RowLabelInfo
195+
label="DRep Script"
196+
value={JSON.stringify(mWallet.buildScript(3), null, 2)}
197+
copyString={JSON.stringify(mWallet.buildScript(3), null, 2)}
198+
/>
199+
<RowLabelInfo
200+
label="DRep Script CBOR"
201+
value={mWallet.getDRepScript()}
202+
copyString={mWallet.getDRepScript()}
203+
/>
204+
</div>
205+
);
206+
188207
default:
189208
return null;
190209
}

src/components/pages/homepage/wallets/new-wallet/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ export default function PageNewWallet() {
206206
signersAddresses: signersAddresses,
207207
signersDescriptions: signersDescriptions,
208208
signersStakeKeys: signersStakeKeys,
209+
signersDRepKeys: signersDRepKeys,
209210
numRequiredSigners: numRequiredSigners,
210211
scriptCbor: scriptCbor,
211212
stakeCredentialHash: stakeKey.length > 0 ? stakeKey : undefined,

0 commit comments

Comments
 (0)