State Changing Messages

State changing messages in the NabiHub.tact contract

This document elaborates on the functions of the implementation, as well as the conditions that need to be met for successful execution of on-chain mutations. All NFT standard messages and internal messages have been omitted from this document.

SetOwner

SetOwner(20f246bd){new_owner:address}

Parameter NameTypeDescription

new_owner

address

The address of the new owner to be set

This message sets a new owner wallet for the Nabi Hub contract.

It should...

  1. Set the owner_address field for the Nabi Hub contract.

Will revert if...

  1. Message sender is not the current owner of the Nabi Hub contract.

SetDispatcher

SetDispatcher(cdf9f40b){dispatcher_address:address}

Parameter NameTypeDescription

dispatcher_address

address

The address of the Nabi Hub Dispatcher contract

This message sets a new dispatcher for the Nabi Hub contract.

It should...

  1. Set the dispatcher_address field for the Nabi Hub contract. State changing messages sent from this Nabi Hub Dispatcher contract are able to bypass ownership and closed beta checks.

Will revert if...

  1. Message sender is not the current owner of the Nabi Hub contract.

InitProfileOfMinted

InitProfileOfMinted(a401f652){item_id:int257,handle:^cell,image_uri:^cell,follow_nft_uri:^cell,individual_content_uri:^cell}

Parameter NameTypeDescription

item_id

address

The index of the existing Nabi Profile NFT item

handle

Cell

The handle to set for the profile

image_uri

Cell

The URI of the profile image

follow_nft_uri

Cell

The URI that contains the Follow NFT collection metadata

individual_content_uri

Cell

The URI that contains the Nabi Profile NFT item metadata

This message Initializes the profile of an existing (already minted) Nabi Profile NFT item. To be used after sending a "mint" message directly to the NabiHub contract.

It should...

  1. Send input data to the target Nabi Profile contract, to populate fields of the profile.

  2. Set is_profile_initialized field in the target Nabi Profile contract to true.

Will revert if...

  1. Message sender is not the current owner of the Nabi Profile.

  2. Nabi Profile is already initialized.

  3. Handle is not unique.

Message format:

const msg_body = beginCell()    
    .storeBuffer(Buffer.from("a401f652", "hex"))    
    .storeInt(item_id, 257)    
    .storeRef(handle)    
    .storeRef(image_uri)    
    .storeRef(follow_nft_uri);
const b = new Builder();
b.storeRef(individual_content_uri);
msg_body.storeRef(b.endCell()).endCell();

CreateNabi

CreateNabi(1ce34a40){owner_address:Maybe address,handle:^cell,image_uri:^cell,follow_nft_uri:^cell,individual_content_uri:^cell}

Parameter NameTypeDescription

handle

Cell

The handle to set for the profile

image_uri

Cell

The URI of the profile image

follow_nft_uri

Cell

The URI that contains the Follow NFT collection metadata

individual_content_uri

Cell

The URI that contains the Nabi Profile NFT item metadata

This message mints a Nabi Profile NFT item and initializes the profile in a single transaction.

It should...

  1. Deploy a new Nabi Profile NFT contract.

  2. Increment next_item_index field in the Nabi Hub contract.

  3. Send input data to the newly deployed Nabi Profile contract, to populate fields of the profile.

  4. Set is_profile_initialized field in the Nabi Profile contract to true.

Will revert if...

  1. Handle is not unique.

Message format:

let msg_body = beginCell()
        .storeBuffer(Buffer.from("1ce34a40", "hex"))
        .storeAddress(owner_address)
        .storeRef(handle)
        .storeRef(image_uri)
        .storeRef(follow_nft_uri);
let b = new Builder();
b.storeRef(individual_content_uri);
msg_body.storeRef(b.endCell()).endCell();

Post

Post(29660d2a){sender_profile_address:address,content_uri:^cell}

Parameter NameTypeDescription

sender_profile_address

address

The address of the sender's Nabi Profile contract.

content_uri

Cell

The URI of the post content.

This message posts a publication for the sender's Nabi Profile.

It should...

  1. Deploy a new Publication contract.

  2. Increment pub_count field in sender's the Nabi Profile contract.

  3. Initialise the newly deployed Publication contract by sending input data to set the content_uri field of the Publication.

  4. Set is_profile_initialized field in the Publication contract to true.

Will revert if...

  1. Sender's Nabi Profile is not initialized.

  2. Sender is not the owner of the input Nabi Profile.

Message format:

const msgBody = beginCell()
      .storeBuffer(Buffer.from('29660d2a', 'hex'))
      .storeAddress(inputAddress)
      .storeRef(inputPubUri)
      .endCell();

Mirror

Mirror(fa7f25a8){sender_profile_address:address,pub_address:address}

Parameter NameTypeDescription

sender_profile_address

address

The address of the sender's Nabi Profile contract.

pub_address

address

The address of the publication to be mirrored.

This message mirrors a publication for the sender's Nabi Profile.

It should...

  1. Deploy a new Publication contract.

  2. Increment pub_count field in sender's the Nabi Profile contract.

  3. Initialize the newly deployed Publication contract by sending input data to set the content_uri and pub_contract_pointed fields of the Publication.

  4. Set is_profile_initialized field in the Publication contract to true.

Will revert if...

  1. Sender's Nabi Profile is not initialized.

  2. Sender is not the owner of the input Nabi Profile.

Message format:

let msg_body = beginCell()
        .storeBuffer(Buffer.from("fa7f25a8", "hex"))
        .storeAddress(sender_profile_address)
        .storeAddress(pub_address)
        .endCell();

Comment

Comment(061f5182){sender_profile_address:address,pub_address:address,content_uri:^cell}

Parameter NameTypeDescription

sender_profile_address

address

The address of the sender's Nabi Profile contract.

pub_address

address

The address of the publication to be commented on.

content_uri

Cell

The URI of the comment content.

This message comments on a publication for the sender's Nabi Profile.

It should...

  1. Deploy a new Publication contract.

  2. Increment pub_count field in sender's the Nabi Profile contract.

  3. Initialize the newly deployed Publication contract by sending input data to set the content_uri and pub_contract_pointed fields of the Publication.

  4. Set is_profile_initialized field in the Publication contract to true.

Will revert if...

  1. Sender's Nabi Profile is not initialized.

  2. Sender is not the owner of the input Nabi Profile.

Message format:

let msg_body = beginCell()
        .storeBuffer(Buffer.from("061f5182", "hex"))
        .storeAddress(sender_profile_address)
        .storeAddress(pub_address)
        .storeRef(content_uri)
        .endCell();

Follow

Follow(cec05374){sender_profile_address:address,following_profile_address:address}

Parameter NameTypeDescription

sender_profile_address

address

The address of the sender's Nabi Profile contract.

following_profile_address

address

The address of the Nabi Profile to be followed.

This message follows a profile for the sender's Nabi Profile.

It should...

  1. Send an internal message to the following Nabi Profile contract to deploy a Follow NFT collection contract for the following profile, if contract does not exist.

  2. Mint a Follow NFT item to the sender's profile by sending an internal message to the Follow NFT collection contract.

Will revert if...

  1. Sender's Nabi Profile is not initialized.

  2. Sender is not the owner of the input Nabi Profile.

  3. Following Nabi Profile is not initialized.

Message format:

let msg_body = beginCell()
        .storeBuffer(Buffer.from("cec05374", "hex"))
        .storeAddress(sender_profile_address)
        .storeAddress(following_profile_address)
        .endCell();

Collect

Collect(aa063734){sender_profile_address:address,publication_address:address}

Parameter NameTypeDescription

sender_profile_address

address

The address of the sender's Nabi Profile contract.

publication_address

address

The address of the publication to be collected.

This message collects a publication for the sender's Nabi Profile.

It should...

  1. Send an internal message to the target publication contract to deploy a Collect NFT collection contract, if it does not exist

  2. Mint a Collect NFT item to the sender's profile by sending an internal message to the Collect NFT collection contract.

Will revert if...

  1. Sender's Nabi Profile is not initialized.

  2. Sender is not the owner of the input Nabi Profile.

  3. Target publication is not initialized.

Message format:

let msg_body = beginCell()
        .storeBuffer(Buffer.from("aa063734", "hex"))
        .storeAddress(sender_profile_address)
        .storeAddress(publication_address)
        .endCell();

CreateNabiBadge

CreateNabiBadge(26445c31){sender_profile_address:address,collection_content_uri:^cell}

Parameter NameTypeDescription

sender_profile_address

address

The address of the sender's Nabi Profile contract.

collection_content_uri

Cell

The URI that contains the Nabi Badge Collection metadata.

This message creates a Nabi Badge NFT Collection for the sender's Nabi Profile.

It should...

  1. Deploy a Nabi Badge NFT collection contract by sending an internal message to the sender's profile contract.

  2. Send an internal message to the newly deployed Nabi Badge collection to intialize its collection_content and collection_index fields.

Will revert if...

  1. Sender's Nabi Profile is not initialized.

  2. Sender is not the owner of the input Nabi Profile.

Message format:

let msg_body = beginCell()
        .storeBuffer(Buffer.from("26445c31", "hex"))
        .storeAddress(sender_profile_address)
        .storeRef(collection_content_uri)
        .endCell();

MintNabiBadge

MintNabiBadge(e772c694){sender_profile_address:address,nabi_badge_collection_address:address}

Parameter NameTypeDescription

sender_profile_address

address

The address of the sender's Nabi Profile contract.

nabi_badge_collection_address

Cell

The address of the Nabi Badge NFT collection contract to mint from.

This message mints a Nabi Badge NFT item from the target collection, for the sender's Nabi Profile.

It should...

  1. Deploy a new Nabi Badge NFT item contract from the target collection.

  2. Increments next_item_index field in the target Nabi Hub NFT collection contract.

Will revert if...

  1. Sender's Nabi Profile is not initialized.

  2. Sender is not the owner of the input Nabi Profile.

Message format:

let msg_body = beginCell()
        .storeBuffer(Buffer.from("e772c694", "hex"))
        .storeAddress(sender_profile_address)
        .storeAddress(nabi_badge_collection_address)
        .endCell();

MintNabiBadgeToRecipient

MintNabiBadgeToRecipient(3be9d023){owner_profile_address:address,nabi_badge_collection_address:address,recipient_profile_address:address}

Parameter NameTypeDescription

owner_profile_address

address

The address of the sender's Nabi Profile contract.

nabi_badge_collection_address

Cell

The address of the Nabi Badge NFT collection contract to mint from.

recipient_profile_address

address

The address of the recipient's Nabi Profile contract.

This message mints a Nabi Badge NFT item to a recipient, for the sender's Nabi Profile.

It should...

  1. Deploy a new Nabi Badge NFT item contract from the target collection.

  2. Increments next_item_index field in the target Nabi Hub NFT collection contract.

  3. Transfers ownership of the newly minted Nabi Badge to the recipient.

Will revert if...

  1. Sender's Nabi Profile is not initialized.

  2. Sender is not the owner of the input Nabi Profile.

  3. Sender is not the owner of the Nabi Badge Collection.

Message format:

let msg_body = beginCell()
        .storeBuffer(Buffer.from("3be9d023", "hex"))
        .storeAddress(owner_profile_address)
        .storeAddress(nabi_badge_collection_address)
        .storeAddress(recipient_profile_address)
        .endCell();

URI Standards

Before storing a URI string in a Cell, URIs must be prefixed with 8-bit off-chain content prefix (0x01) to be rendered correctly on TONscan and NFT marketplaces.

const OFFCHAIN_CONTENT_PREFIX = 0x01;
const uriString = "https://...";
let uriInputParam = beginCell()
	.storeInt(OFFCHAIN_CONTENT_PREFIX, 8)
	.storeStringRefTail(uriString)
	.endCell();

Last updated