Create job
The ees-sdk makes it easy to create jobs.
const transactionReceipt: `0x${string}` = await eesSDK.createJob(jobSpecification, sponsor, sponsorSignature, hasSponsorship, index);Here jobSpecification has type JobSpecification. The sponsor field has type `0x{string}` and is the sponsor address of the job. The sponsorSignature has type `0x{string}` and is an EIP-712 signature of jobSpecification signed by the sponsor. Next, hasSponsorship has type boolean and is a flag that indicates whether the job should be created with a sponsorship. Finally, index is the index in the jobs array in which the job should be created. The function returns transactionReceipt of viem's type TransactionReceipt containing information about the transaction.
Warning: If index < jobs.length, the job will reuse an existing index in the array. This can only be done if the job at that index is cancelled, i.e. if the owner field is set to the zero address. Otherwise if index >= jobs.length, this operation will extend the jobs array. Reusing an index is cheaper gas wise but will revert if the index is not free.
Warning: This action will perform an on-chain transaction and requires that the eesSDK object was initialised with a wallet client.
Last updated