Requirements
Project Scope - Technical Requirements
// Eample of what interfaces and functions could look like // SDKs and libraries are free to interpret and implement as suits their implementation // values based on (preview): 8c86970a2431a9f43a0363b116b4c60471a29cc35d253c0ed8c18c1dff3dcf10 const stakeAddr = "stake1u8sa8kegf22wcjqqlc0230rtlemck5lhqycd3u8lattqh2cdjuzs4" const dRepID = "drep1yfhx2j5j7q989gfvj6cg04htakpqn32a3yuhtytjxt9m80qt5ekm3" const donationBasisPoints = 150 // 15% donation /** * Where transaction is an existing object from library (something else can be used) * addCIP149Metadata adds a VoteDelegation certificate and CIP149 compliant metadata */ transaction.addCIP149Delegation(stakeAddr, dRepID, donationBasisPoints) console.log(transaction.toJson()) /** ... "certs":[ 0:{ "VoteDelegation":{ "stake_credential":{ "Key":"e1d3db284a94ec4800fe1ea8bc6bfe778b53f70130d8f0ffea…" } "drep":{ "KeyHash":"6e654a92f00a72a12c96b087d6ebed8209c55d893975917232…" } } } ] ... "auxiliary_data":{ "metadata":{ "3692": { donationBasisPoints: 150 } } } ... */// Example of what interfaces and functions could look like // SDKs and libraries are free to interpret and implement as suits their implementation interface CIP149Delegation { txId: string; drepId: string; drepPaymentAddr: string; basisPoints: number; } /** * NoCIP149Delegation: The stakeKey has not delegated to a DRep using CIP149 correctly * NoDRepPaymentAddr: The DRep has not included payment address in their metadata */ interface CIP149DelegationError { type: "NoCIP149Delegation" | "NoDRepPaymentAddr" ; // some more error cases message: string; } /** * getLastestCIP149Delegation triggers a chain query (using a given provider) * to find the most recent valid CIP149 delegation. * Indexing will invovle indexing the stakeKey's most recent vote delegation transacion * its transaction metadata and the DRep's latest metadata (to find DRep's payment address) */ const cip149Delegation: CIP149Delegation | CIP149DelegationError = getLastestCIP149Delegation("stake1u8sa8kegf22wcjqqlc0230rtlemck5lhqycd3u8lattqh2cdjuzs4") const rewardsAvaliable = 100 // 100 ada avaliable in rewards account /** * Where withdrawalTransaction is an existing object from library (something else can be used) * The wallet can then use this information, to build the withdrawal transaction * using drepPaymentAddr and basisPoints to donate to the DRep */ withdarawalTransaction.addRewardsWithdrawal(rewardsAvaliable) withdrawalTransaction.addOutput(cip149Delegation.drepPaymentAddr, (rewardsAvaliable/100 * cip149Delegation.basisPoints/10))
Example Transactions
CIP-149 DRep Delegation
CIP-149 Staking Rewards withdrawal
More example transactions
Eligibility
Last updated
Was this helpful?