@cloak.dev/sdk, you can attach your partner code to the fee-bearing transactions your app makes. You earn commission on them under the same rules as a link: 20% of the percentage fee, per wallet, for two calendar months. Your users pay exactly the same fees as everyone else.
1
Get approved
Apply at cloak.ag/affiliates and wait for approval. Your code is the one you chose when you applied. It only earns once your account is approved. See How to apply.
2
Pass affiliateCode
Add your code to the options of every withdrawal, send to an address and swap your app makes.
3
Track it
Commission appears on your partner dashboard as grouped, delayed totals, and is paid monthly.
The affiliateCode option
affiliateCode is an optional string on TransactOptions, so it is accepted by every flow that takes those options, including SpendOptions:
You can therefore set
affiliateCode once on shared options and pass them everywhere: the SDK leaves it out where it does not apply.
Normalisation and invalid codes
The SDK trims the code and lower-cases it once, before it is used. The result must match^[a-z0-9_]{3,24}$. A code that is still invalid is left out of the request and reported through onWarning. It never fails or delays the transaction.
To validate a code in a settings form before it ever reaches a transaction, use normalizeAffiliateCode, which applies the same rule and returns the normalised code or null:
{"active": true} only for an approved partner:
Batches
IntransactBatch, the batch’s options.affiliateCode applies to every fee-bearing item. An item can set its own options.affiliateCode to override it.
Security
The code is part of the request the wallet signs, so nothing between your app and Cloak can add, remove or change it after the user approves. The code is never written on-chain.How your commission is decided
An SDK integration skips the link step, so there is no device record. Everything else is the same as for a link, and it is all decided on Cloak’s side after the transaction confirms. See How attribution works.- Every fee is verified on-chain. Only the fee the program actually collected counts, and you earn 20% of its percentage part.
- First code wins, per wallet. A user’s wallet is bound to the first approved code its fee-bearing transactions carry, for two calendar months from that first transaction. If a user was already brought to Cloak by another partner, your code earns nothing on that wallet until their window ends.
- No self-referral. Transactions from your own payout wallet never earn, and the terms forbid commission on any other wallet you control.
- An inactive code earns nothing. A pending, suspended or removed code is accepted by the SDK and ignored by Cloak; the transaction goes through normally.