✨Works out of the box guarantee. If you face any issue at all, hit us up on Telegram and we will write the integration for you.

Sui
Quickstart

Publish on chain using Move

Pre-requisite

We assume that you have installed Sui (opens in a new tab) on your device and that you have an understanding of Reclaim's proofs.

In this walkthrough, we will show how you can leverage Reclaim's Move sdk in your own contracts.

You can access the code of this walkthrough on Gitlab (opens in a new tab).

Reclaim is available on:

Integrating Reclaim

Add Reclaim as a dependency.

Add this to your Move.toml:

[dependencies]
---
Reclaim = { git = "https://gitlab.reclaimprotocol.org/reclaim-clients/move-sdk.git", rev = "main" }
---

Build with sui move build, you should have Reclaim sources installed.

Add handlers for Reclaim operations.

Add these functions to your designated module, they simply delegate calls to Reclaim:

    use std::string;
    use reclaim::reclaim::{ReclaimManager, Proof};
 
    // Creates a new witness
    public fun create_witness(addr: vector<u8>, host: string::String): vector<u8> {
        reclaim::reclaim::create_witness(addr, host)
    }
 
    // Creates a new Reclaim Manager
    public fun create_reclaim_manager(
        epoch_duration_s: u32,
        ctx: &mut TxContext,
    ) {
        reclaim::reclaim::create_reclaim_manager(epoch_duration_s, ctx)
    }
 
    // Adds a new epoch to the Reclaim Manager
    public fun add_new_epoch(
        manager: &mut ReclaimManager,
        witnesses: vector<vector<u8>>,
        requisite_witnesses_for_claim_create: u128,
        ctx: &mut TxContext,
    ) {
        reclaim::reclaim::add_new_epoch(manager, witnesses, requisite_witnesses_for_claim_create, ctx)       
    }
 
    // Verifies a proof
    public fun verify_proof(
        manager: &ReclaimManager,
        proof: &Proof,
    ): vector<vector<u8>> {
        reclaim::reclaim::verify_proof(manager, proof)       
    }

Add test scenarios to confirm compatibility:

These tests show how to plug data into Reclaim's models, include them under your tests/your_tests.move:

  use client::client; // TODO: replace with your own module
  use reclaim::reclaim;
  use sui::test_scenario;
 
#[test]
  fun test_reclaim() {
    let owner = @0xC0FFEE;
    let user1 = @0xA1;
    let epoch_duration_s = 1_000_000_u32;
 
    let mut scenario_val = test_scenario::begin(user1);
    let scenario = &mut scenario_val;
 
    test_scenario::next_tx(scenario, owner);
    {
      client::create_reclaim_manager(epoch_duration_s,
                                      test_scenario::ctx(scenario));
    };
 
    test_scenario::next_tx(scenario, owner);
    {
      let mut witnesses = vector<vector<u8>>[];
      let witness = client::create_witness(
          x"244897572368eadf65bfbc5aec98d8e5443a9072",
          b"http".to_string());
      witnesses.push_back(witness);
 
      let requisite_witnesses_for_claim_create = 1_u128;
 
      let mut manager =
          test_scenario::take_shared<reclaim::ReclaimManager>(scenario);
 
      client::add_new_epoch(&mut manager, witnesses,
                             requisite_witnesses_for_claim_create,
                             test_scenario::ctx(scenario));
 
      test_scenario::return_shared(manager);
    };
 
 
   test_scenario::next_tx(scenario, user1);
    {
     let ctx = test_scenario::ctx(scenario);
 
      let claim_info = reclaim::create_claim_info(
         b"http".to_string(),
         b"{\"body\":\"\",\"geoLocation\":\"in\",\"method\":\"GET\",\"responseMatches\":[{\"type\":\"regex\",\"value\":\"_steamid\\\">Steam ID: (?<CLAIM_DATA>.*)</div>\"}],\"responseRedactions\":[{\"jsonPath\":\"\",\"regex\":\"_steamid\\\">Steam ID: (?<CLAIM_DATA>.*)</div>\",\"xPath\":\"id(\\\"responsive_page_template_content\\\")/div[@class=\\\"page_header_ctn\\\"]/div[@class=\\\"page_content\\\"]/div[@class=\\\"youraccount_steamid\\\"]\"}],\"url\":\"https://store.steampowered.com/account/\"}".to_string(),
         b"{\"contextAddress\":\"user's address\",\"contextMessage\":\"for acmecorp.com on 1st january\",\"extractedParameters\":{\"CLAIM_DATA\":\"76561199601812329\"},\"providerHash\":\"0xffd5f761e0fb207368d9ebf9689f077352ab5d20ae0a2c23584c2cd90fc1b1bf\"}".to_string()
      );
 
      let complete_claim_data = reclaim::create_claim_data(
        b"0xd1dcfc5338cb588396e44e6449e8c750bd4d76332c7e9440c92383382fced0fd".to_string(),
        b"0x13239fc6bf3847dfedaf067968141ec0363ca42f".to_string(),
        b"1".to_string(),
        b"1712174155".to_string(),
      );
 
      let mut signatures = vector<vector<u8>>[];
      let signature = x"2888485f650f8ed02d18e32dd9a1512ca05feb83fc2cbf2df72fd8aa4246c5ee541fa53875c70eb64d3de9143446229a250c7a762202b7cc289ed31b74b31c811c";
      signatures.push_back(signature);
      
      let signed_claim = reclaim::create_signed_claim(
        complete_claim_data,
        signatures
      );
 
      reclaim::create_proof(claim_info, signed_claim, ctx);
    };
 
  test_scenario::next_tx(scenario, user1);
    {
      let manager = test_scenario::take_shared<reclaim::ReclaimManager>(scenario);
      let proof = test_scenario::take_shared<reclaim::Proof>(scenario);
      
      let signers = client::verify_proof(&manager, &proof);
      assert!(signers == vector[x"244897572368eadf65bfbc5aec98d8e5443a9072"], 0);
 
      test_scenario::return_shared(manager);
      test_scenario::return_shared(proof);
    };
    
    test_scenario::end(scenario_val);
  }

Run tests with sui move test -i 100000000000000000.