Skip to content
Njord GitHub

← Home · Quickstart

A working campaign in under an hour.

Njord is deployed on Solana devnet today. Clone the repo or install the SDK, fund a campaign, and settle a conversion end-to-end. No mainnet funds required.

  1. 01

    Install the SDK

    Add the core TypeScript SDK to your project. It wraps the on-chain Anchor program and talks to Solana devnet out of the box.

    npm install @njord/sdk @solana/web3.js
  2. 02

    Point at devnet

    Njord is live on Solana devnet under program ID Hm5WfS2KL4UPaUqVJ3vadCuPMCftw2oybqvpDr7fn9Hv. Connect a funded devnet wallet.

    import { NjordClient } from '@njord/sdk';
    
    const client = new NjordClient({
      cluster: 'devnet',
      wallet,               // any Solana wallet adapter
    });
  3. 03

    Create and fund a campaign

    Define your budget, commission model, and attribution model. Funding deposits USDC (or SOL) into a campaign-scoped escrow.

    const campaign = await client.createCampaign({
      budget:      1_000,                    // USDC into escrow
      commission:  { type: 'percentage', rate: 0.15 },
      attribution: 'last-click',
      minTier:     'new',
    });
  4. 04

    Generate an affiliate link

    An affiliate joins the campaign and gets a tracking link. Four methods are supported: URL parameter, short link, coupon code, or SDK embed.

    const link = client.trackingLink(campaign.id, affiliateId);
    // → https://njord.cryptuon.com/r/CAMPAIGN/AFFILIATE
  5. 05

    Record a conversion

    When the customer completes the target action, the bridge (or your own SDK) submits the attribution on-chain. The contract validates and settles.

    const payout = await client.submitAttribution({
      campaign:  campaign.id,
      affiliate: affiliateId,
      amount:    240,         // sale amount
    });
  6. 06

    Watch it settle in ~3 seconds

    The contract subtracts the 2.5% protocol fee and 1% bridge fee and releases the net commission to the affiliate wallet. Read it back from the indexer.

    console.log(payout.net);   // amount − fees, in the wallet
    // Query history via @njord/indexer (GraphQL)

Now pick your role

The role guides go deeper on economics — campaign discounts, affiliate tiers, and bridge stake tiers.