Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions hooks/use-bounty-cancel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,19 +77,21 @@ export const useBountyCancel = ({

const cancel = async (): Promise<void> => {
if (!organizationId || !bountyId) return;
if (!ownerAddress) {
toast.error(
isExternal
? 'Connect a wallet to sign the cancellation.'
: 'Please connect your wallet first'
);
// EXTERNAL is signed by the connected wallet; MANAGED is signed server-side
// by the on-chain event manager (the treasury/owner that published), so no
// connected wallet is needed. ownerAddress is a hint the backend may use as
// a fallback.
if (isExternal && !ownerAddress) {
toast.error('Connect a wallet to sign the cancellation.');
return;
}

const body: CancelBountyEscrowRequest = {
ownerAddress,
// ownerAddress is optional on the backend (boundless-nestjs#392); until
// codegen picks that up the generated type marks it required, so cast.
const body = {
fundingMode,
};
...(ownerAddress ? { ownerAddress } : {}),
} as CancelBountyEscrowRequest;

finalizedRef.current = false;
toast.info('Submitting cancellation…');
Expand Down
21 changes: 12 additions & 9 deletions hooks/use-bounty-payout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,20 +72,23 @@ export const useBountyPayout = ({
selections: BountyWinnerSelection[]
): Promise<void> => {
if (!organizationId || !bountyId || selections.length === 0) return;
if (!ownerAddress) {
toast.error(
isExternal
? 'Connect a wallet to sign the payout.'
: 'Please connect your wallet first'
);
// EXTERNAL is signed by the connected wallet, so it's required there.
// MANAGED is signed server-side by the on-chain event manager (the treasury
// / owner that published) — no connected wallet needed. ownerAddress is a
// hint only; the backend resolves and signs with the real manager.
if (isExternal && !ownerAddress) {
toast.error('Connect a wallet to sign the payout.');
return;
}

const body: SelectBountyWinnersRequest = {
ownerAddress,
// ownerAddress is optional on the backend (it resolves the manager); until
// codegen picks that up (boundless-nestjs#392) the generated type still
// marks it required, so cast.
const body = {
selections,
fundingMode,
};
...(ownerAddress ? { ownerAddress } : {}),
} as SelectBountyWinnersRequest;

finalizedRef.current = false;
toast.info('Submitting winner selection…');
Expand Down
Loading