Skip to content

exo-tech-xyz/whitelist

 
 

Repository files navigation

Tensor Whitelist

Tensor Whitelist

Verify your collection on-chain.

Overview

The Tensor Foundation Whitelist program allows defining and managing a collection of NFTs or other digital assets on-chain. Within the Tensor protocol it is used for gatekeeping which NFTs can be deposited or sold in to AMM pools, and which items Marketplace bids are placed against.

Program

This project contains the following program:

  • Whitelist TL1ST2iRBzuGTqLn1KXnGdSnEow62BzPnGiqyRXhWtW

You will need a Rust version compatible with BPF to compile the program, currently we recommend using Rust 1.75.0.

Clients

This project contains the following clients:

Status

This new Whitelist program is currently deployed to devnet, and will be deployed to mainnet on October 2nd.

Devnet Mainnet
v0.2.1 v0.2.1

Build

Prerequisites

You need the following tools installed to build the project:

  • pnpm v9+
  • rust v1.78.0
  • node v18+
  • solana v1.17.23
  • anchor v0.29.0

Steps

Install JavaScript dependencies:

pnpm install

Build the program and generate the clients:

pnpm programs:build
pnpm generate

Run JS and Rust tests:

pnpm clients:js:test
pnpm clients:rust:test

Getting started

Install this library using the package manager of your choice.

npm install @tensor-foundation/whitelist

Examples

Find Whitelist Account PDA

const uuid = Buffer.from(
  "099c4f20-fd22-44b3-af6d-43d2b9f4cf21".replaceAll("-", ""),
).toJSON().data;
const whitelistSeeds: WhitelistSeeds = {
  uuid: uuid,
};
const [whitelistPDA] = await findWhitelistPda(whitelistSeeds);

Fetch Whitelist Account

const transport = createDefaultRpcTransport({
  url: "https://api.mainnet-beta.solana.com/",
});
const rpc = createSolanaRpc({ transport });
const whitelistAccountResponse = await fetchWhitelist(rpc, whitelistPDA);

Retrieve InitUpdateMintProof Instruction

const mint =
  "DWBXzV8MjkCRLxWwZEZm6B3wfrpgh4oYcYKVxSuL9ay6" as Address<"MintType">;
const whitelist =
  "ExGjYcjK1GNtQ5WnN3gy22132s6WMzrgFUHDNi6sT6nL" as Address<"WhitelistType">;
const seeds = { mint: mint, whiltelist: whitelist };
const mintProofPDA = await findMintProofPda(seeds);
const URL = `https://api.mainnet.tensordev.io/api/v1/sdk/mint_proofs?whitelist=${whitelist}&mints=${mint}`;
const response = await axios.get(URL, {
  headers: {
    "x-tensor-api-key": API_KEY,
  },
});
const proof: Array<Uint8Array> = response.data[0].proof.map(
  (proof) => proof.data,
);

const initUpdateMintProofInput = {
  whitelist: whitelist,
  mint: mint,
  mintProof: mintProofPDA,
  user: wallet.publicKey,
  proof: proof,
};
const mintProofInstruction = getInitUpdateMintProofInstruction(
  initUpdateMintProofInput,
);

Community and Support

  • We're here to help!

  • Join our developer community on discord

Contributing

Check out the Contributing Guide the learn more about how to contribute to this project.

License

Copyright (c) 2024 Tensor Protocol Foundation

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

About

Verify your collection on-chain.

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 89.0%
  • Rust 10.4%
  • Other 0.6%