Milestones
The Milestones module enables payments or invoices with a milestone-based structure. This allows the sender and receiver to define and agree on multiple milestones, providing a flexible and transparent payment process for services or projects.
import Denota from '@denota-labs/denota-sdk';
async function createMilestoneNota() {
const { txHash, notaId } = await Denota.write({
amount: 10,
currency: "DAI",
metadata: { type: "raw", notes: "Example invoice" },
module: {
moduleName: "milestones",
type: "invoice",
worker: "0x...",
client: "0x...",
milestones: [2, 4, 4],
},
});
}
createMilestoneNota();
In the code snippet above, we pass in the module object, which contains the details of the nota. We also pass in the
amount
and currency
parameters, representing the total amount and the currency in which the nota is written.The module object properties are as follows:
moduleName
: Set to "milestones" for the Milestones module.type
: Set to "invoice" for creating an invoice or "payment" for sending a payment.worker
: The Ethereum address of the worker or service provider.client
: The Ethereum address of the client or payer.milestones
: An array of numbers representing the percentage of the total amount allocated to each milestone.ipfsHash
(optional): The IPFS hash of any additional documentation, like a statement of work or contract.
When creating an invoice or sending a payment, provide the Ethereum addresses of the worker and client, as well as the milestones array. The milestones array should contain the percentage breakdown of the total amount, corresponding to each milestone.
If you have an IPFS hash for additional documentation, you can provide it using the
ipfsHash
property.Last modified 9h ago