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
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,6 @@ tsconfig.tsbuildinfo






22 changes: 22 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM node:20-alpine

# Install PostgreSQL client tools for health checks
RUN apk add --no-cache postgresql-client

# Set working directory
WORKDIR /app

# Copy package files
COPY package.json package-lock.json* ./

# Copy Prisma schema (needed for postinstall script)
COPY prisma ./prisma

# Install dependencies (postinstall will run prisma generate)
RUN npm ci

# Expose port
EXPOSE 3000

# Default command (can be overridden in docker-compose)
CMD ["npm", "run", "dev"]
18 changes: 18 additions & 0 deletions docker/ensure-roles.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/sh
set -e

echo "Ensuring required database roles exist..."

# Connect to PostgreSQL and ensure required roles exist
# This is a placeholder - adjust based on your actual requirements
psql "${DATABASE_URL}" -c "
DO \$\$
BEGIN
-- Add any role creation logic here if needed
-- Example: CREATE ROLE IF NOT EXISTS app_user;
NULL;
END
\$\$;
" || true

echo "Database roles check complete."
14 changes: 14 additions & 0 deletions docker/fix-crowdfund-rls.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh
set -e

echo "Applying Crowdfund RLS fixes..."

# This script fixes Row Level Security (RLS) issues with the Crowdfund table
# Adjust the SQL based on your actual schema requirements
psql "${DATABASE_URL}" -c "
-- Add any RLS policy fixes here
-- Example: ALTER TABLE \"Crowdfund\" ENABLE ROW LEVEL SECURITY;
SELECT 1;
" || true

echo "Crowdfund RLS fixes applied."
9 changes: 9 additions & 0 deletions docker/init-db.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
set -e

echo "Initializing database..."

# This script runs automatically when PostgreSQL container starts for the first time
# Add any custom initialization SQL here if needed

echo "Database initialization complete."
2 changes: 2 additions & 0 deletions src/components/pages/wallet/governance/drep/drepMetadata.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ export async function getDRepMetadata(
"@context": {
GovernanceMetadata: "CIP100:GovernanceMetadataReference",
Other: "CIP100:OtherReference",
Link: "CIP100:OtherReference",
Identity: "CIP100:OtherReference",
label: "CIP100:reference-label",
uri: "CIP100:reference-uri",
referenceHash: {
Expand Down
82 changes: 59 additions & 23 deletions src/components/pages/wallet/governance/drep/retire.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,17 @@ export default function Retire({ appWallet, manualUtxos }: { appWallet: Wallet;

try {
const blockchainProvider = getProvider(network);
const utxos = await blockchainProvider.fetchAddressUTxOs(multisigWallet.getScript().address);
// For legacy wallets, use appWallet address; for SDK wallets, use multisig address
const addressToFetch = multisigWallet?.getScript().address || appWallet.address;
if (!addressToFetch) {
toast({
title: "Address Error",
description: "No address available to fetch UTxOs",
variant: "destructive",
});
return;
}
const utxos = await blockchainProvider.fetchAddressUTxOs(addressToFetch);

const assetMap = new Map<Unit, Quantity>();
assetMap.set("lovelace", "5000000");
Expand All @@ -171,32 +181,58 @@ export default function Retire({ appWallet, manualUtxos }: { appWallet: Wallet;

const txBuilder = getTxBuilder(network);

const drepData = multisigWallet?.getDRep(appWallet);
if (!drepData) {
toast({
title: "DRep Error",
description: "DRep not found",
variant: "destructive",
});
return;
}
const { dRepId, drepCbor } = drepData;

const scriptCbor = multisigWallet?.getKeysByRole(3) ? multisigWallet?.getScript().scriptCbor : appWallet.scriptCbor;
const changeAddress = multisigWallet?.getKeysByRole(3) ? multisigWallet?.getScript().address : appWallet.address;
// For legacy wallets (no multisigWallet), use appWallet values directly (preserves input order)
// For SDK wallets, use multisigWallet to compute DRep ID and script
let dRepId: string;
let drepCbor: string;
let scriptCbor: string;
let changeAddress: string;

if (!changeAddress) {
toast({
title: "Address Error",
description: "Change address not found",
variant: "destructive",
});
return;
if (multisigWallet) {
const drepData = multisigWallet.getDRep(appWallet);
if (!drepData) {
toast({
title: "DRep Error",
description: "DRep not found",
variant: "destructive",
});
return;
}
dRepId = drepData.dRepId;
drepCbor = drepData.drepCbor;
const multisigScript = multisigWallet.getScript();
const multisigScriptCbor = multisigScript.scriptCbor;
const appScriptCbor = appWallet.scriptCbor;
if (!multisigScriptCbor && !appScriptCbor) {
toast({
title: "Script Error",
description: "Script CBOR not found",
variant: "destructive",
});
return;
}
scriptCbor = multisigWallet.getKeysByRole(3) ? (multisigScriptCbor || appScriptCbor!) : (appScriptCbor || multisigScriptCbor!);
changeAddress = multisigScript.address;
} else {
// Legacy wallet: use appWallet values (computed with input order preserved)
if (!appWallet.dRepId || !appWallet.scriptCbor) {
toast({
title: "DRep Error",
description: "DRep ID or script not found for legacy wallet",
variant: "destructive",
});
return;
}
dRepId = appWallet.dRepId;
drepCbor = appWallet.scriptCbor; // Use payment script CBOR for legacy wallets
scriptCbor = appWallet.scriptCbor;
changeAddress = appWallet.address;
}
if (!scriptCbor) {

if (!scriptCbor || !changeAddress) {
toast({
title: "Script Error",
description: "Script not found",
description: "Script or change address not found",
variant: "destructive",
});
return;
Expand Down
Loading