Project

The Project class allows you to interact with projects on chain.

create()

Create a project

This function allows you to create a new project on chain!

Required attributes

  • Name
    name
    Type
    string
    Description

    The name for the project.

  • Name
    creator
    Type
    PublicKey
    Description

    Owner of the project

  • Name
    members
    Type
    PublicKey[]
    Description

    Members of the project

  • Name
    threshold
    Type
    number
    Description

    Votes for a transaction proposal to be approved (Muiltisig)

  • Name
    shdwSize
    Type
    string
    Description

    Amount of storage you are requesting to create. Should be in a string like '1KB', '1MB', '1GB'. Only KB, MB, and GB storage delineations are supported currently.

Request

create()
Project
import Firethree from '@firethreexyz/firethree-protocol'

const projectName = 'My Project'

const firethree = new Firethree
const creator = new KeyPair()

await firethree.project.create({
  name: projectName,
  creator: creator.publicKey,
  members: [creator.publicKey],
  threshold: 1,
  shdwSize: "1GB",
  image: File
});

Response

{}

get()

Get a project by name

Retrieve a project using its name.

Required attributes

  • Name
    name
    Type
    string
    Description

    The name of the project you want to fetch.

Request

get()
Project
const projectName = 'Example Project Name'
const projectInstance = new Poject(program, wallet)
const projectDetails = await projectInstance.get(projectName)

Response

{
  "name": "decoded_project_name",
  "ts": "timestamp_as_number"
  // ...other project details
}

getProjectsByUserPublicKey()

Get projects by user public key

Retrieve all projects associated with a user's public key.

Required attributes

  • Name
    publicKey
    Type
    PublicKey
    Description

    The public key of the user.

Request

getProjectsByUserPublicKey()
Projects
const userPublicKey = new PublicKey('YOUR_PUBLIC_KEY')
const projectInstance = new Poject(program, wallet)
const projects = await projectInstance.getProjectsByUserPublicKey(userPublicKey)

Response

[
  // Array of projects associated with the user's public key
]

getAll()

Get all projects

Retrieve all projects.

Request

getAll()
Projects
const projectInstance = new Poject(program, wallet)
const allProjects = await projectInstance.getAll()

Response

[
  // Array of all projects
]

addMember()

Add a new member

Add a new member to a project.

Required attributes

  • Name
    name
    Type
    string
    Description

    Name of the project.

  • Name
    member
    Type
    PublicKey
    Description

    Public key of the new member.

Request

addMember()
Member
const projectName = 'Example Project Name'
const newMemberPublicKey = new PublicKey('NEW_MEMBER_PUBLIC_KEY')
const projectInstance = new Poject(program, wallet)

await projectInstance.addMember(projectName, newMemberPublicKey)

Response

{
  // ...response details
}

deleteProject()

Delete a project

Delete a project by its name.

Required attributes

  • Name
    name
    Type
    string
    Description

    Name of the project to be deleted.

Request

deleteProject()
Deletion
const projectName = 'Example Project Name'
const projectInstance = new Poject(program, wallet)

await projectInstance.deleteProject({ name: projectName })

Response

{
  // ...response details
}