Skip to content

Superlogic/nft-rewards-cloud-fn

 
 

Repository files navigation

Readme

Quick Start

Install and build cloud-functions

  yarn && yarn build

Start emulator, run tests

  yarn dev
  yarn pinning

Setting up Firebase Cloud Functions

  • make sure you are using node 16.x Firebase is picky
  • additional packages:
    • firebase-tools
nvm use 16.15.1

Deployment

Develop

EXAMPLE 1:

import { readFileSync } from "fs";

const csvContent = readFileSync(PATH_TO_CSV, "utf8");

const response = await fetch(
  "https://us-central1-ipfs-scratch-space.cloudfunctions.net/pinning",
  {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({
      csvContent,
    }),
  }
);

const { cid } = await response.json();

EXAMPLE 2:

import { readFileSync } from "fs";
import { parseCsv } from "src/utils/csv";

const csvContent = readFileSync(PATH_TO_CSV, "utf8");

const response = await fetch(
  "https://us-central1-ipfs-scratch-space.cloudfunctions.net/pinning",
  {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({
      entries: parseCsv(csvContent),
    }),
  }
);

const { cid } = await response.json();

About

Cloud function to handle juicebox nft rewards

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 100.0%