Skip to content

Commit 4ae3d10

Browse files
authored
Merge pull request #225 from MeshJS/fix/deposit-bug
refactor: remove DREP and STAKE deposit constants from codebase
2 parents 2972e7a + 657f26c commit 4ae3d10

7 files changed

Lines changed: 20 additions & 293 deletions

File tree

package-lock.json

Lines changed: 16 additions & 136 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/multisig/proxy/offchain.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import {
77
} from "@meshsdk/core";
88
import type { UTxO, MeshTxBuilder } from "@meshsdk/core";
99
// import { parseDatumCbor } from "@meshsdk/core-cst";
10-
import { DREP_DEPOSIT_STRING } from "@/utils/protocol-deposit-constants";
1110
import { parseProposalId } from "@/lib/governance";
1211

1312
import { MeshTxInitiator } from "./common";
@@ -503,7 +502,7 @@ export class MeshProxyContract extends MeshTxInitiator {
503502
anchorDataHash: anchorHash!,
504503
});
505504
} else if (action === "deregister") {
506-
txHex.drepDeregistrationCertificate(drepId, DREP_DEPOSIT_STRING);
505+
txHex.drepDeregistrationCertificate(drepId);
507506
} else if (action === "update") {
508507
txHex.drepUpdateCertificate(drepId, {
509508
anchorUrl: anchorUrl!,

src/components/pages/wallet/governance/drep/retire.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import { MeshProxyContract } from "@/components/multisig/proxy/offchain";
1313
import { api } from "@/utils/api";
1414
import { useCallback } from "react";
1515
import { useToast } from "@/hooks/use-toast";
16-
import { DREP_DEPOSIT_STRING } from "@/utils/protocol-deposit-constants";
1716
import useActiveWallet from "@/hooks/useActiveWallet";
1817

1918
export default function Retire({ appWallet, manualUtxos }: { appWallet: Wallet; manualUtxos: UTxO[] }) {
@@ -243,7 +242,7 @@ export default function Retire({ appWallet, manualUtxos }: { appWallet: Wallet;
243242
txBuilder
244243
.txInScript(scriptCbor)
245244
.changeAddress(changeAddress)
246-
.drepDeregistrationCertificate(dRepId, DREP_DEPOSIT_STRING);
245+
.drepDeregistrationCertificate(dRepId);
247246

248247
// Only add certificateScript if it's different from the spending script
249248
// to avoid "extraneous scripts" error

src/components/pages/wallet/staking/StakingActions/stake.tsx

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import { MultisigWallet } from "@/utils/multisigSDK";
88
import { ToastAction } from "@radix-ui/react-toast";
99
import { toast } from "@/hooks/use-toast";
1010
import { getTxBuilder } from "@/utils/get-tx-builder";
11-
import { STAKE_KEY_DEPOSIT } from "@/utils/protocol-deposit-constants";
1211
import useTransaction from "@/hooks/useTransaction";
1312

1413
type StakingAction = "register" | "deregister" | "delegate" | "withdrawal" | "registerAndDelegate";
@@ -20,10 +19,6 @@ type StakingActionConfig = {
2019
successMessage: string;
2120
};
2221

23-
function shouldApplyStakeDeposit(action: StakingAction): boolean {
24-
return action === "register" || action === "registerAndDelegate";
25-
}
26-
2722
function buildStakingActionConfigs({
2823
txBuilder,
2924
rewardAddress,
@@ -131,10 +126,6 @@ export default function StakeButton({
131126
});
132127
const actionConfig = actionConfigs[action];
133128

134-
if (shouldApplyStakeDeposit(action)) {
135-
txBuilder.protocolParams({ keyDeposit: STAKE_KEY_DEPOSIT });
136-
}
137-
138129
actionConfig.execute();
139130

140131
txBuilder.changeAddress(appWallet.address);

0 commit comments

Comments
 (0)