sui-pfp
TypeScript icon, indicating that this package has built-in type declarations

0.0.17 • Public • Published

sui-pfp

Description

The Sui Profile Picture Protocol allows Sui users to set a single Token-standard NFT as a universal PFP for the Sui blockchain.

Individual Sui protocols can use the documentation below both to show PFPs in their FE, and to provide functionality within their own FE to allow users to set a new PFP.

Example

import { JsonRpcProvider } from '@mysten/sui.js';
import { getProfilePicture } from 'sui-pfp';

const client = new JsonRpcProvider('https://fullnode.devnet.sui.io/');
const walletAddress = '0x28ed183435ad975c845871b8b1f72c16f1fd805c';

const { isAvailable, url } = await getProfilePicture(client, walletAddress);

API

Get the wallet's profile picture

function getProfilePicture (client: JsonRpcProvider, address: string, config: ProfilePictureConfig, programId?: string): Promise<ProfilePicture>

Params

  • client - Sui JSON RPC provider object
  • address - The address of the wallet
  • config (optional)
    • fallback - Boolean, use a fallback generated image (default true)
    • resize - Object with Cloudflare image resize params (default { width: 100 })
  • programId - PFP program id (optional)

Return value

Object with the following fields:

  • isAvailable - Boolean, true if there is a profile picture for the given wallet
  • url - The URL of the profile image, always populated (either a fallback image or an empty-image icon), you can choose to ignore it if isAvailable is false
  • name - NFT name (only if isAvailable: true)
  • address - Owner address
  • nftId - The NFT token identifier (only if isAvailable: true)

Transaction for setting an NFT for the profile picture

function createSetProfilePicturePayload (client: JsonRpcProvider, address: string, nftId: string, nftStandard?: string, programId?: string): Promise<Base64DataBuffer>

Params

  • client - Sui JSON RPC provider object
  • address - The address of the wallet
  • nftId - The NFT token identifier
  • nftStandard - NFT standard to use (optional)
  • programId - PFP program id (optional)

Return value

A entry function transaction payload object

Transaction for unsetting the profile picture

function createUnsetProfilePicturePayload (client: JsonRpcProvider, address: string, pfpId: string, programId?: string): Promise<Base64DataBuffer>

Params

  • client - Sui JSON RPC provider object
  • address - The address of the wallet
  • pfpId - The PFP object identifier
  • programId - PFP program id (optional)

Return value

A entry function transaction payload object

Readme

Keywords

none

Package Sidebar

Install

npm i sui-pfp

Weekly Downloads

2

Version

0.0.17

License

Apache-2.0

Unpacked Size

44.9 kB

Total Files

17

Last publish

Collaborators

  • anbud