API - Write Queries

Getting Started

  1. Obtention of an API Key

    • Contact the LAOS Foundation / Freeverse.io to request your private API key.

    • Each key is associated with a web3 address where you can view LAOS tokens, POLs, and ETHs.

    • Your account will be pre-filled with testnet LAOS tokens. Contact the LAOS Foundation for replenishment if needed.

  2. API Key Usage Add your API key to the headers of all mutations:

    {
      "x-api-key": "your-api-key-here-1234"
    }

Creating a Bridgeless Minting Collection

Use the following mutation to create your collection:

mutation CreateCollection {
  createCollection(
    input: {
      name: "My first Bridgeless Minting Collection"
      symbol: "MFBC"
      chainId: "137"
    }
  ) {
    batchMinterAddress
    chainId
    contractAddress
    laosAddress
    name
    success
    symbol
  }
}

Expected response:

{
  "data": {
    "createCollection": {
      "batchMinterAddress": "0x0f3381eb41c24dd28c3f1a71e6dcfae6434da731",
      "chainId": "137",
      "contractAddress": "0xc7471bab04d2f53f6e79c754e19fdbd1e5a4a3c3",
      "laosAddress": "0xfffffffffffffffffffffffe00000000000000da",
      "name": "My first Bridgeless Minting Collection",
      "success": true,
      "symbol": "MFBC"
    }
  }
}

The response includes both the contractAddress of the ERC721 contract on the target chain (in this case, Polygon), as well as the address of the underlying sibling collection in LAOS (in this case, 0xfff...da. This query additionally deploys a smart contract capable of executing multiple mints in one single transaction (batchMinterAddress).

Minting an First NFT

Use this mutation to mint an NFT:

mutation MintNFT {
  mint(
    input: {
      chainId: "137"
      contractAddress: "0xc7471bab04d2f53f6e79c754e19fdbd1e5a4a3c3"
      tokens: [
        {
          mintTo: ["0x4E6Da57f62b9954fBb6bAb531F556BE08E128e75"]
          name: "Intro to LAOS NFT"
          description: "This is my first LAOS Mint!"
          attributes: [{ trait_type: "Level", value: "Introduction" }]
          image: "ipfs://QmPC9LrMuN6YkcJBRhBcWiDcS4ndkx3cwXdVNQ59PY8EBq"
        }
      ]
    }
  ) {
    tokenIds
    success
  }
}

Expected response:

{
  "data": {
    "mint": {
      "tokenIds": [
        "46231769497101023895754357762572931969783788518045090509665456129453327552117"
      ],
      "success": true
    }
  }
}

contractAddress must be provided in lowercase format in all mutations. In the next release, both lowercase and checksum addresses will be accepted

Evolving an NFT

To modify the attributes of an existing NFT:

mutation EvolveNFT {
  evolve(
    input: {
      chainId: "137"
      contractAddress: "0xc7471bab04d2f53f6e79c754e19fdbd1e5a4a3c3"
      tokenId: "46231769497101023895754357762572931969783788518045090509665456129453327552117"
      name: "Intro to LAOS NFT lvl 2"
      description: "This asset has been evolved!"
      attributes: [{ trait_type: "Level", value: "Evolved Asset" }]
      image: "ipfs://QmUjVkeX1yUSbunCaXMWVsxrzcQCSBVEJzDoheowy1D3tb"
    }
  ) {
    success
    tx
  }
}

Expected response:

{
  "data": {
    "evolve": {
      "success": true,
      "tx": "0x745e45f9649bade95ccefa69bb593d40d0171646f356e4f4e9787d180e670068"
    }
  }
}

Last updated