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
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
},
"dependencies": {
"@auth/prisma-adapter": "^2.11.1",
"@meshsdk/core": "^1.9.0-beta.104",
"@meshsdk/core-csl": "^1.9.0-beta.104",
"@meshsdk/core-cst": "^1.9.0-beta.87",
"@meshsdk/provider": "^1.9.0-beta.86",
"@meshsdk/core": "^1.9.0",
"@meshsdk/core-csl": "^1.9.0",
"@meshsdk/core-cst": "^1.9.0",
"@meshsdk/provider": "^1.9.0-beta.101",
"@meshsdk/react": "^2.0.0-beta.2",
"@octokit/core": "^6.1.2",
"@prisma/client": "^7.8.0",
Expand Down
50 changes: 26 additions & 24 deletions src/components/multisig/proxy/ProxyControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -170,27 +170,29 @@ export default function ProxyControl() {
if (isWalletReady && activeWallet) {
// Only initialize once
if (!contractInitializedRef.current) {
try {
const txBuilder = getTxBuilder(network);
const contract = new MeshProxyContract(
{
mesh: txBuilder,
wallet: activeWallet,
networkId: network,
},
{},
appWallet?.scriptCbor ?? undefined,
);
setProxyContract(contract);
contractInitializedRef.current = true;
} catch (error) {
console.error("[ProxyContract] Failed to initialize:", error);
toast({
title: "Error",
description: "Failed to initialize proxy contract",
variant: "destructive",
});
}
(async () => {
try {
const txBuilder = await getTxBuilder(network);
const contract = new MeshProxyContract(
{
mesh: txBuilder,
wallet: activeWallet,
networkId: network,
},
{},
appWallet?.scriptCbor ?? undefined,
);
setProxyContract(contract);
contractInitializedRef.current = true;
} catch (error) {
console.error("[ProxyContract] Failed to initialize:", error);
toast({
title: "Error",
description: "Failed to initialize proxy contract",
variant: "destructive",
});
}
})();
}
} else {
// Clear contract if wallet is not ready
Expand Down Expand Up @@ -432,7 +434,7 @@ export default function ProxyControl() {
// Create a temporary contract instance for this proxy
const tempContract = new MeshProxyContract(
{
mesh: getTxBuilder(network),
mesh: await getTxBuilder(network),
wallet: activeWallet,
networkId: network,
},
Expand All @@ -456,7 +458,7 @@ export default function ProxyControl() {
// Create a temporary contract instance for this proxy
const tempContract = new MeshProxyContract(
{
mesh: getTxBuilder(network),
mesh: await getTxBuilder(network),
wallet: activeWallet,
networkId: network,
},
Expand Down Expand Up @@ -605,7 +607,7 @@ export default function ProxyControl() {

const selectedProxyContract = new MeshProxyContract(
{
mesh: getTxBuilder(network),
mesh: await getTxBuilder(network),
wallet: activeWallet,
networkId: network,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default function DelegateButton({ drepid }: { drepid: string }) {
}

// console.log("Building delegation transaction...");
const txBuilder = getTxBuilder(await wallet.getNetworkId());
const txBuilder = await getTxBuilder(await wallet.getNetworkId());
txBuilder
.voteDelegationCertificate({ dRepId: drepid }, rewardAddress)
.changeAddress(changeAddress)
Expand Down
4 changes: 2 additions & 2 deletions src/components/pages/wallet/governance/ballot/ballot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ export default function BallotCard({
const proxy = proxies.find((p: any) => p.id === selectedProxyId);
if (!proxy) throw new Error("Proxy not found");

const meshTxBuilder = getTxBuilder(network);
const meshTxBuilder = await getTxBuilder(network);
const proxyContract = new MeshProxyContract(
{
mesh: meshTxBuilder,
Expand Down Expand Up @@ -436,7 +436,7 @@ export default function BallotCard({
setAlert("Change address not found");
return;
}
const txBuilder = getTxBuilder(network);
const txBuilder = await getTxBuilder(network);

// Ensure minimum ADA for fee and voting
const assetMap = new Map<Unit, Quantity>();
Expand Down
4 changes: 2 additions & 2 deletions src/components/pages/wallet/governance/cCommitee/voteCC.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export default function VoteCC({

setLoading(true);
try {
const txBuilder = getTxBuilder(network);
const txBuilder = await getTxBuilder(network);
const paymentScript = appWallet.scriptCbor;
if (!paymentScript) return;

Expand Down Expand Up @@ -145,7 +145,7 @@ export default function VoteCC({
});
// send discord message
await sendDiscordMessage(
discordIds,
discordIds as [],
`**NEW MULTISIG TRANSACTION:** A new CC Vote was created for your wallet: ${appWallet.name}. Review it here: ${window.location.origin}/wallets/${appWallet.id}/transactions`,
);
router.push(`/wallets/${appWallet.id}/transactions`);
Expand Down
2 changes: 1 addition & 1 deletion src/components/pages/wallet/governance/card-info.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export default function CardInfo({ appWallet, manualUtxos }: { appWallet: Wallet
}, 10000); // 10 second timeout

try {
const txBuilder = getTxBuilder(network);
const txBuilder = await getTxBuilder(network);
const proxyContract = new MeshProxyContract(
{
mesh: txBuilder,
Expand Down
4 changes: 2 additions & 2 deletions src/components/pages/wallet/governance/drep/registerDrep.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ export default function RegisterDRep({ onClose }: RegisterDRepProps = {}) {
}

setLoading(true);
const txBuilder = getTxBuilder(network);
const txBuilder = await getTxBuilder(network);

// For legacy wallets (no multisigWallet), use appWallet values directly (preserves input order)
// For SDK wallets, use multisigWallet to compute DRep ID and script
Expand Down Expand Up @@ -281,7 +281,7 @@ export default function RegisterDRep({ onClose }: RegisterDRepProps = {}) {
}

// Create proxy contract instance with the selected proxy
const txBuilder = getTxBuilder(network);
const txBuilder = await getTxBuilder(network);
const proxyContract = new MeshProxyContract(
{
mesh: txBuilder,
Expand Down
4 changes: 2 additions & 2 deletions src/components/pages/wallet/governance/drep/retire.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export default function Retire({ appWallet, manualUtxos }: { appWallet: Wallet;
}

// Create proxy contract instance
const txBuilder = getTxBuilder(network);
const txBuilder = await getTxBuilder(network);
const proxyContract = new MeshProxyContract(
{
mesh: txBuilder,
Expand Down Expand Up @@ -171,7 +171,7 @@ export default function Retire({ appWallet, manualUtxos }: { appWallet: Wallet;
return;
}

const txBuilder = getTxBuilder(network);
const txBuilder = await getTxBuilder(network);

// For legacy wallets (no multisigWallet), use appWallet values directly (preserves input order)
// For SDK wallets, use multisigWallet to compute DRep ID and script
Expand Down
4 changes: 2 additions & 2 deletions src/components/pages/wallet/governance/drep/updateDrep.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export default function UpdateDRep({ onClose }: UpdateDRepProps = {}) {
const { utxos, walletAddress } = await getMsInputs();

// Create proxy contract instance
const txBuilder = getTxBuilder(network);
const txBuilder = await getTxBuilder(network);
const proxyContract = new MeshProxyContract(
{
mesh: txBuilder,
Expand Down Expand Up @@ -182,7 +182,7 @@ export default function UpdateDRep({ onClose }: UpdateDRepProps = {}) {
throw new Error("Wallet not connected");

setLoading(true);
const txBuilder = getTxBuilder(network);
const txBuilder = await getTxBuilder(network);

// For legacy wallets (no multisigWallet), use appWallet values directly (preserves input order)
// For SDK wallets, use multisigWallet to compute DRep ID and script
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export default function VoteButton({
}

// Create proxy contract instance
const txBuilder = getTxBuilder(network);
const txBuilder = await getTxBuilder(network);
const proxyContract = new MeshProxyContract(
{
mesh: txBuilder,
Expand Down Expand Up @@ -265,7 +265,7 @@ export default function VoteButton({
setAlert("Change address not found");
return;
}
const txBuilder = getTxBuilder(network);
const txBuilder = await getTxBuilder(network);

const assetMap = new Map<Unit, Quantity>();
assetMap.set("lovelace", "5000000");
Expand Down
2 changes: 1 addition & 1 deletion src/components/pages/wallet/governance/proposals.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ export default function AllProposals({ appWallet, utxos, selectedBallotId, onSel

// Otherwise, calculate it from the proxy contract
try {
const txBuilder = getTxBuilder(network);
const txBuilder = await getTxBuilder(network);
const proxyContract = new MeshProxyContract(
{
mesh: txBuilder,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ export default function FundTransferStep({
return;
}

const txBuilder = getTxBuilder(network);
const txBuilder = await getTxBuilder(network);

// Add all UTxOs as inputs
for (const utxo of utxos) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ export default function PageNewTransaction() {
return;
}

const txBuilder = getTxBuilder(network);
const txBuilder = await getTxBuilder(network);

for (const utxo of selectedUtxos) {
txBuilder.txIn(
Expand Down
2 changes: 1 addition & 1 deletion src/components/pages/wallet/new-transaction/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ export default function PageNewTransaction({ onSuccess }: { onSuccess?: () => vo
return;
}

const txBuilder = getTxBuilder(network);
const txBuilder = await getTxBuilder(network);
const paymentScript = appWallet.scriptCbor;
if (!paymentScript) return;

Expand Down
4 changes: 2 additions & 2 deletions src/components/pages/wallet/staking/StakingActions/stake.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function buildStakingActionConfigs({
poolHex,
rewards,
}: {
txBuilder: ReturnType<typeof getTxBuilder>;
txBuilder: Awaited<ReturnType<typeof getTxBuilder>>;
rewardAddress: string;
stakingScript: string;
poolHex: string;
Expand Down Expand Up @@ -103,7 +103,7 @@ export default function StakeButton({
const stakingScript = appWallet.stakeScriptCbor || mWallet.getStakingScript();
if (!stakingScript) throw new Error("Staking Script could not be built.");

const txBuilder = getTxBuilder(network);
const txBuilder = await getTxBuilder(network);
const selectedUtxos = utxos;

for (const utxo of selectedUtxos) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ function RowAction({
);

if (allTxInputsFromSameAddress) {
const txBuilder = getTxBuilder(network);
const txBuilder = await getTxBuilder(network);

const _amount: { [unit: string]: number } = {};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ function RowAction({
);

if (allTxInputsFromSameAddress) {
const txBuilder = getTxBuilder(network);
const txBuilder = await getTxBuilder(network);

const _amount: { [unit: string]: number } = {};

Expand Down
2 changes: 1 addition & 1 deletion src/components/pages/wallet/transactions/send-all.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export default function CardSendAll({ appWallet }: { appWallet: Wallet }) {
appWallet.address,
);

const txBuilder = getTxBuilder(network);
const txBuilder = await getTxBuilder(network);

for (const utxo of utxos) {
txBuilder.txIn(
Expand Down
6 changes: 3 additions & 3 deletions src/lib/zustand/proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ export const useProxyStore = create<ProxyState>()(
get().setDrepLoading(proxyId, true);
get().setDrepError(proxyId, null);

const txBuilder = getTxBuilder(parseInt(network));
const txBuilder = await getTxBuilder(parseInt(network));
const proxyContract = new MeshProxyContract(
{
mesh: txBuilder,
Expand Down Expand Up @@ -215,7 +215,7 @@ export const useProxyStore = create<ProxyState>()(
get().setDrepLoading(proxyId, true);
get().setDrepError(proxyId, null);

const txBuilder = getTxBuilder(parseInt(network));
const txBuilder = await getTxBuilder(parseInt(network));
const proxyContract = new MeshProxyContract(
{
mesh: txBuilder,
Expand Down Expand Up @@ -303,7 +303,7 @@ export const useProxyStore = create<ProxyState>()(
get().setError(walletId, null);

// Create a single txBuilder instance to reuse across all proxies
const txBuilder = getTxBuilder(parseInt(network));
const txBuilder = await getTxBuilder(parseInt(network));

// Create all fetch promises in parallel
const fetchPromises = proxies.map(async (proxy) => {
Expand Down
4 changes: 3 additions & 1 deletion src/utils/get-tx-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { MeshTxBuilder } from "@meshsdk/core";
import { getProvider } from "@/utils/get-provider";
// import { CSLSerializer } from "@meshsdk/core-csl";

export function getTxBuilder(network: number) {
export async function getTxBuilder(network: number) {
const blockchainProvider = getProvider(network);
const txBuilder = new MeshTxBuilder({
fetcher: blockchainProvider,
Expand All @@ -15,5 +15,7 @@ export function getTxBuilder(network: number) {
} else {
txBuilder.setNetwork("preprod");
}
const costModels = await blockchainProvider.fetchCostModels();
txBuilder.setCostModels(costModels);
return txBuilder;
}
Loading