diff --git a/agent-manager/src/index.ts b/agent-manager/src/index.ts index be05f133..431cda5f 100644 --- a/agent-manager/src/index.ts +++ b/agent-manager/src/index.ts @@ -21,8 +21,8 @@ import environments from './config/environments' const app = express() const port = environments.serverPort -app.use('/health', healthCheck) -app.use('/blockfrost/health', blockfrostHealth) +app.use('/api/health', healthCheck) +app.use('/api/blockfrost/health', blockfrostHealth) const server = app.listen(port, async () => { console.log(`Server is running on http://localhost:${port}`) diff --git a/agent-node/src/functions/noConfidence.ts b/agent-node/src/functions/noConfidence.ts index d67307b2..ab0044f0 100644 --- a/agent-node/src/functions/noConfidence.ts +++ b/agent-node/src/functions/noConfidence.ts @@ -11,5 +11,19 @@ export default async function handler(context: FunctionContext, anchor: any) { }, ], } - return await context.wallet.buildAndSubmit(req) + return await context.wallet.buildAndSubmit(req).catch(async (e) => { + if (e.includes('ProposalReturnAccountDoesNotExist')) { + await context.builtins.registerStake().catch((e) => { + throw e + }) + return context.wallet + .buildAndSubmit(req) + .then((v) => v) + .catch((e) => { + throw e + }) + } else { + throw e + } + }) } diff --git a/agent-node/src/functions/proposalNewConstitution.ts b/agent-node/src/functions/proposalNewConstitution.ts index 48546242..dfe16ac3 100644 --- a/agent-node/src/functions/proposalNewConstitution.ts +++ b/agent-node/src/functions/proposalNewConstitution.ts @@ -25,7 +25,19 @@ export default async function handler( return await context.wallet .buildAndSubmit(req, true) .then((v) => v) - .catch((e) => { - throw e + .catch(async(e) => { + if (e.includes('ProposalReturnAccountDoesNotExist')) { + await context.builtins.registerStake().catch((e) => { + throw e + }) + return context.wallet + .buildAndSubmit(req) + .then((v) => v) + .catch((e) => { + throw e + }) + } else { + throw e + } }) } diff --git a/agent-node/src/functions/treasuryWithdrawal.ts b/agent-node/src/functions/treasuryWithdrawal.ts index b984355f..6b5fc787 100644 --- a/agent-node/src/functions/treasuryWithdrawal.ts +++ b/agent-node/src/functions/treasuryWithdrawal.ts @@ -33,5 +33,19 @@ export default async function handler( }, ], } - return await context.wallet.buildAndSubmit(req, false) + return await context.wallet.buildAndSubmit(req, false).catch(async(e)=>{ + if (e.includes('ProposalReturnAccountDoesNotExist')) { + await context.builtins.registerStake().catch((e) => { + throw e + }) + return context.wallet + .buildAndSubmit(req) + .then((v) => v) + .catch((e) => { + throw e + }) + } else { + throw e + } + }) } diff --git a/agent-node/src/functions/updateCommittee.ts b/agent-node/src/functions/updateCommittee.ts index 1f731e40..9822d447 100644 --- a/agent-node/src/functions/updateCommittee.ts +++ b/agent-node/src/functions/updateCommittee.ts @@ -22,5 +22,19 @@ export default async function handler( }, ], } - return await context.wallet.buildAndSubmit(req, false) + return await context.wallet.buildAndSubmit(req, false).catch(async (e) => { + if (e.includes('ProposalReturnAccountDoesNotExist')) { + await context.builtins.registerStake().catch((e) => { + throw e + }) + return context.wallet + .buildAndSubmit(req) + .then((v) => v) + .catch((e) => { + throw e + }) + } else { + throw e + } + }) } diff --git a/frontend/src/api/healthStatus/route.ts b/frontend/src/api/healthStatus/route.ts deleted file mode 100644 index e69de29b..00000000