Build
Skip to content

Sell your Game Items via a Web Shop

Accelerate your game growth by selling items directly to your players. In this guide, we will go over the steps how to deploy a Primary Sale contract using any custom or existing currency for a webshop that utilizes game items from a ERC1155 contract. We will use the following technologies from the Sequence platform:

  1. Primary Sales Contract: How to set up and deploy contracts for launching a primary sale — suitable for an Web Shop, NFT Drop, and more.
  2. Embedded Wallet: Use Sequence Kit and Sequence Embedded Wallet to authenticate a user.
  3. Sequence Indexer: Leveraging the Sequence Indexer to query NFT metadata and user's wallet assets.
  4. Sequence Metadata: Updating and managing a collection or token's metadata via the Sequence Builder UI and API.

Clone the Primary Sales for Game Items boilerplate

You can easily clone the Primary Sales repository using the Sequence CLI

npx sequence-cli boilerplates create-primary-drop-sale-starter

You can clone Primary Sales Repository from Github

git clone https://github.com/0xsequence/primary-drop-sale-1155-boilerplate.git

Then install and run:


pnpm install && pnpm dev

After you install the dependencies, .env.example will be automatically copied to .env, so you can test things out with pre-provided keys.


When you're ready, replace the contents of .env with your project's information.

You can use the Primary Sales Repository Template from Github

Go to https://github.com/0xsequence/primary-drop-sale-1155-boilerplate and click "Use this Template" in the top right corner.


Clone your newly made repo.


Then install and run:


pnpm install && pnpm dev

After you install the dependencies, .env.example will be automatically copied to .env, so you can test things out with pre-provided keys.


When you're ready, replace the contents of .env with your project's information.

Configure your own Primary Sales Contracts in the repository

We provide a few example contracts and variables in order to get you started. However, you will likely want to use your own contracts. In order to configure this simply following the steps below:

Deploy a Primary Sales Contract in Sequence Builder.

We first need a Primary Sales Contract along with an ERC1155 contract that will contain our game items we want to sell. To do that, please follow the guide here.

Set the Sales Configurations for the project.

Once we have our sales contract deployed, we'll simply update the sales configuration on the boilerplate. Go to src/salesConfigs.ts and modify the salesConfigs variable by adding each contract sale in an array for your project with the networks you want to support. Example:

export const salesConfigs: SaleConfiguration[] = [
  {
    nftTokenAddress: "0x888a322db4b8033bac3ff84412738c096f87f9d0",
    salesContractAddress: "0x0327b2f274e04d292e74a06809bcd687c63a4ba4",
    chainId: 80002, //polygonAmoy
    // Modify here to show different items
    itemsForSale: ["0", "1"],
  },
  {
    nftTokenAddress: "0xd4bb59d0ba1f7b2beea4c6d9b9f151ee1da02665",
    salesContractAddress: "0x326d2fbe4808dd2a3e205aecc5e25a6322ad0a81",
    chainId: 421614, //arbitrumSepolia,
    // Modify here to show different items
    itemsForSale: ["0"],
  },
];

Set a default chainId for the project.

To set the default chainId, go to src/salesConfigs.ts and modify the defaultChainId variable with the chainId you want to display by default in the project. It must match a chainId present in your salesConfigs variable. For example:

// In this case, the chosen `defaultChainId` is 80002 (amoy), which is present in the previously declared `salesConfigs` variable.
export const defaultChainId = 80002;

Done!

Your primary sales should now appear and function correctly from this point onward. In order to make a purchase, ensure you have the corresponding token that you set as a currency for the sale in your wallet, increment the amount, and click purchase!