Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix:Handle StakeRegistration on first proposal fail #297

Merged
merged 1 commit into from
Jan 6, 2025
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
4 changes: 2 additions & 2 deletions agent-manager/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`)
Expand Down
16 changes: 15 additions & 1 deletion agent-node/src/functions/noConfidence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
})
}
16 changes: 14 additions & 2 deletions agent-node/src/functions/proposalNewConstitution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
})
}
16 changes: 15 additions & 1 deletion agent-node/src/functions/treasuryWithdrawal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
})
}
16 changes: 15 additions & 1 deletion agent-node/src/functions/updateCommittee.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
})
}
Empty file.
Loading