Skip to content

Enable instant onchain delivery with in-app purchases. MintTemplates teach Mobile Minting to mint on new platforms.

License

Notifications You must be signed in to change notification settings

floornfts/mobile-minting

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

What is Mobile Minting?

Mobile Minting unlocks mobile payments for onchain purchases and powers minting in the Rally app (formerly known as Floor!).

πŸ“± Users pay in-app with In-App Purchases

⛓️ A fleet of signers instantly deliver NFTs onchain

For users: no πŸŒ‰ Bridging, no ⛽️ Gas fees - just the tap of a button!

mm

Example Mobile Minting user experience.


What is this repository?

This repository is a public, contributable collection of Ingestors that teach Mobile Minting how to support mints from new platforms.

Historically, only Rally could choose what mints users could mint through Rally based on our roadmap, or partnerships, now anyone can build support for any minting platform / product and (provided it meets some safety & reliability checks) it can be included in Mobile Minting.

This library is included in Rally's platform and executed in a sandboxed environment for indexing mints.


Adding a new platform to Mobile Minting

Today, Mobile Minting supports the following creator platforms:

Platform Chains Create from URL Create from onchain address Supports Quantity
Zora Base, Zora βœ… βœ… βœ…
Highlight Base πŸ’₯ Failing πŸ’₯ Failing πŸ’₯ Failing
Rodeo Base βœ… βœ… βœ…
Manifold Base βœ… ❌ ❌
FXHash Base βœ… βœ… ❌
Rarible Base βœ… βœ… ❌
Foundation Base, ETH βœ… ❌ ❌
Prohibition Daily Base βœ… βœ… ❌
Transient Labs Base βœ… βœ… ❌

Adding a new platform to Mobile Minting is easy - you just have to write a MintIngestor!

MintIngestor functionality

A MintIngestor has a simple job:

Transform a URL or contract address into a valid MintTemplate, iff it represents a supported mint by the ingestor

template


What is a MintTemplate?

A MintTemplate is a standard format for expressing the details of a mint. It's used to populate the marketing page, pricing, and ultimately fulfill the item onchain.

mint-template

Mapping of MintTemplate fields to an in-app mint.

Once you generate a MintTemplate, Rally will do all the additional work to get the mint live:

  • Map priceWei to an in-app purchase
  • Simulate the transaction in multiple scenarios to ensure success
  • Re-host all images & cache IPFS resources

The full process looks something like this...

mint-template-flow


Writing your first MintIngestor

We recommend consulting example complete ingestor PRs e.g. #1: Prohibition Daily.

You will create a new folder in src/ingestors for your new Ingestor.

export class MyMintIngestor implements MintIngestor {
  async supportsUrl(resources: MintIngestorResources, url: string): Promise<boolean> {
    // check if URL is supported by your ingestor
  }

  async supportsContract(resources: MintIngestorResources, contract: MintContractOptions): Promise<boolean> {
    // check if the contract is supported by the ingestor
  }

  async createMintTemplateForUrl(resources: MintIngestorResources, url: string): Promise<MintTemplate> {
    // create the mint template for your URL
  }

  async createMintForContract(resources: MintIngestorResources, contract: MintContractOptions): Promise<MintTemplate> {
    // create the mint template for your contract
  }
}

For building the MintTemplate, we recommend using the MintTemplateBuilder which will ensure validation and give handy builder methods.

In this example we make a template, relying on getMintMetadataFromSomewhere() and getMintContractDetailsFromSomewhere() to fetch the marketing & onchain data respectively. We'll touch on those later.

  const mintBuilder = new MintTemplateBuilder()
      .setOriginalUrl(url)
      .setMintInstructionType(MintInstructionType.EVM_MINT)
      .setPartnerName('MyMints');

  const { name, description, image } = await getMintMetadataFromSomewhere();
  mintBuilder.setName(name).setDescription(description).setFeaturedImageUrl(image);

  const { contractAddress, priceWei } = await getMintContractDetailsFromSomewhere();
  mintBuilder.setMintInstructions({
      chainId: '8453',
      contractAddress,
      contractMethod: 'mint',
      contractParams: '[address, 1]',
      abi: YOUR_ABI_FILE_IMPORT,
      priceWei: totalPriceWei,
    });

Note: You will typically want to implement either createMintForContract or createMintTemplateForUrl, and then call that one from the other.

You can then build the MintTemplate from the builder.

  return mintBuilder.build();

Note that mintBuilder.build() will throw if the MintTemplate does not meet validation requirements.


Getting outside resources

Your MintIngestor is passed a resources object in it's sandboxed environment.

async createMintTemplateForUrl(url: string, resources: MintIngestorResources): Promise<MintTemplate>

This resources object contains properties:

  • alchemy: An initalized Alchemy instance
  • fetch: An HTTP client (Axios)

You can use these to fetch resources you need.

Note: You will need to set up a locally Alchemy key for testing, and YOU MUST NOT attempt to import resources not passed in the resources object


Local Setup

In order to use the Alchemy instance on resources, you will need to set a local Alchemy key.

  • Copy .env.sample -> .env
  • Insert your own Alchemy API key as ALCHEMY_API_KEY

This repo uses Yarn to manage dependencies & execution.

When you pull the repository, setup can be completed (and confirmed) using:

yarn
yarn test

Trying out your Mint Ingestor

You can try your mint ingestory using yarn dry-run -- this will:

  • Create an instance of your minter
  • Pass the inputs you provide to it
  • Print out the output MintTemplate
yarn dry-run <minterSlug> <inputType> <input>

<minterSlug>: The key for the ingestor in ALL_MINT_INGESTORS <inputType>: url or contract <input>: A full URL for url, or a colon delimited fullly qualified address for `contract

Examples:

yarn dry-run prohibition-daily url https://daily.prohibition.art/mint/8453/0x896037d93a231273070dd5f5c9a72aba9a3fe920
yarn dry-run prohibition-daily contract 8453:0x896037d93a231273070dd5f5c9a72aba9a3fe920
yarn dry-run some-erc-1155-ingestor contract 8453:contractAddress:tokenId

Submitting a Mobile Minting Ingestor

Once you've written a Mobile Minting Ingestor, it needs to be Pull Requested to this repository to be included in the production Rally Mobile Minting ingestion fleet.

Before you submit

  • Ensure your generated MintTemplate works πŸ˜„
  • Ensure that your code is restricted to a single folder in src/ingestors
  • Ensure that all required assets are included (e.g. ABIs)
  • Ensure ABIs are trimmed to include only methods (1) used in the ingestor or (2) required to mint
  • Ensure that all exported methods are prefixed with the name of your ingestor e.g. myMintingPlatformGetContractDetails
  • Ensure that a test exists for generating a MintTemplate that will always succeed
  • Ensure that your code accesses no external resources except those passed in the resources object

Submitting a Mint Ingestor

Open a Pull Request against this repo with your new Ingestor, as well as any comments / questions.

We're excited to see new platforms supported, so will quickly jump to help!

Hopes and dreams

Mobile Minting started out entirely internal & this is our first experiment in decentralizing it & making it more accessible.

In time, we hope to continue down this path, but for now all ingestors will be reviewed by the Rally engineering team & accepted on the basis of safety, cost & other considerations by Rally.

We hope to see people (other companies!?) emerge for whom Mobile Minting, and a unified standard for expressing onchain mints is useful, and look forward to working with them to continue this mission.

Questions?

Open an issue, or email [email protected]

About

Enable instant onchain delivery with in-app purchases. MintTemplates teach Mobile Minting to mint on new platforms.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages