🤠Quest Claim

We'll show you how to get the quest object from your site.

First, please apply for an API key from here.

😄pageUse API key🎾pageGet Quest List
{
    "Activities": "[\"buildspace V2 NFT Owner\"]", 
    "Condition": "BuildSpaceOwner", <- Condition
    "MetadataUrl": "https://www.arweave.net/bFKtd81gs2SREvS7fzUsw68bYedXeaBrQ8XFyJf77EE",
    "QuestURL": "https://quest.philand.xyz/items/0x3D8C06e65ebf06A9d40F313a35353be06BD46038/101901"
    "Name": "buildspace Achiever",
    "TokenId": "101901", 
    "Value": "1" <- value
}
  • metadataURl (including NFT image)

Then, please retrieve the coupon information from the query below.

Request

query questCoupon {
  questCoupon(input: {address: "0x5037e7...", condition: "ActiveScore", value: 5000}) {
    coupon {
      r
      s
      v
    }
  }
}

Response

{
 "data": {
    "questCoupon": {
      "coupon": {
        "r": "0xccd90b3476a8236484875f6f36e066b86ede0738b58422bc97bed6d80221b4c5",
        "s": "0x1c9499def2d08658dbaebae099d5e0fdfa5e776101617a4c06fa9afc6eec4b27",
        "v": 27
      }
    }
  }
}

Last, please call the contract with the latest obtained information.

const ethers = require('ethers');

// Set up wallet and provider
const provider = new ethers.providers.JsonRpcProvider('YOUR_RPC_URL');
const wallet = new ethers.Wallet('YOUR_PRIVATE_KEY', provider);

// Contract ABI (must include the appropriate function signature)
const contractAbi = [...];

// Create contract instance
// 0x754e78bC0f7B487D304552810A5254497084970C is phi contract
const contract = new ethers.Contract('0x754e78bC0f7B487D304552810A5254497084970C', contractAbi, wallet);

// Function parameters
const params = {
  ContractAddress: '0x3D8C06e65ebf06A9d40F313a35353be06BD46038', <- Quest Object NFT address
  tokenId: '100151',
  condition: 'ActiveScore5000',
  Coupon: {
    r: '0xccd90b3476a8236484875f6f36e066b86ede0738b58422bc97bed6d80221b4c5',
    s: '0x1c9499def2d08658dbaebae099d5e0fdfa5e776101617a4c06fa9afc6eec4b27',
    v: 27
  }
};

// Call the function (you must set the function name and parameters appropriately)
contract.claimQuestObject(params).then((result) => {
  console.log('Transaction result:', result);
}).catch((error) => {
  console.error('Error:', error);
});

Last updated