Skip to content

Instantly share code, notes, and snippets.

@eektheeek
Last active June 6, 2023 10:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eektheeek/34a0a345d9b7dd9f696ac74eb4c021e3 to your computer and use it in GitHub Desktop.
Save eektheeek/34a0a345d9b7dd9f696ac74eb4c021e3 to your computer and use it in GitHub Desktop.

POST /api/v2/referrals/:campaignId/:referrer

Server MUST verify signature or apiKey before returning referral codes.

Headres:
  - x-ref-campaign-key // api key, needed if request did not contain body
Params:
  - campaign_id: referral campaign id
  - referrer: ethereum address of the user
Body: 
  - signature_data: // needed if request did not contain x-ref-campaign-key
    - signature: signature, singed by with creator address
    - address: creator address of referral campaign
    - domain: domain to use in veryfication message
    - version: version to use in veryfication message
    - chain_id: chain_id to use in veryfication message
    - uri: uri to use in veryfication message
    - nonce: nonce to use in veryfication message
    - issued_at: issued_atto use in veryfication message
Returns (success):
  - success: boolean, indicating whether the operation was successful 
  - referrer: ethereum address of the user
  - campaign_active: boolean, indicating whether the campaign was active
  - claim_codes[]: array of claim code objects associated with the referrer
    - claim_code: claim code
    - link_id: link id associated with the claim code
    - status: status of the claim link
Returns (errored):
  - success: boolean, indicating whether the operation was successful
  - errors:
    - Referrer is not provided - referrer address was not provided in params
    - Campaign id is not provided - campaing id was not provided in params
    - Referral campaing not found - campaing was not find with id in db
    - Invalid x-ref-campaign-key - x-ref-campaign-key did not match with apiKey for campaign in db
    - URI is not provided - body did not contain uri param
    - Nonce is not provided - body did not contain nonce param
    - Domain is not provided - body did not contain domain param
    - Address is not provided - body did not contain address param
    - Version is not provided - body did not contain version param
    - Signature is not provided - body did not contain siganture param
    - Chain id is not provided - body did not contain chain id param
    - issuedAt param is not provided - body did not contain issuedAt param
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment