5.6 Participating in the Insurance Ecosystem
Once your DApp is connected to a Verified Node, you can interact with the InsuranceDAO.World ecosystem. This involves validating coverage and claiming payouts when a covered event occurs. Below is an example of how to claim insurance payouts.
Code Example: Claim Insurance Payout
// async function claimInsurancePayout(connection, payer, nodeId, claimAmount) {
const program = anchor.workspace.InsuranceDAO;
// Fetch Verified Node details and check claim eligibility
const verifiedNode = await program.account.verifiedNode.fetch(nodeId);
if (verifiedNode.claimableAmount < claimAmount) {
throw new Error('Insufficient claimable amount available for this node');
}
// Prepare claim transaction
const transaction = new anchor.web3.Transaction();
transaction.add(
program.instruction.claimInsurancePayout(
nodeId,
claimAmount,
{
accounts: {
payer: payer.publicKey,
verifiedNode: verifiedNode.publicKey,
systemProgram: SystemProgram.programId,
},
}
)
);
// Send the claim transaction
const signature = await connection.sendTransaction(transaction, [payer], { skipPreflight: false, preflightCommitment: 'confirmed' });
console.log(`Claim processed with signature: ${signature}`);
}
Explanation:
• The claimInsurancePayout function checks the claimable amount for a Verified Node and triggers the payout process when a valid claim is made.
Important Notice:
The Node and Market pages are still under development, so all code examples provided are for reference only. If you have any suggestions, requests, or encounter technical issues, feel free to contact our development team at foundation@insurancedao.world. We are continuously improving the platform and welcome your feedback to provide a better developer experience.
Last updated: February 1, 2025.
Last updated