Skip to content

Latest commit

 

History

History
1727 lines (734 loc) · 51.2 KB

ord.md

File metadata and controls

1727 lines (734 loc) · 51.2 KB

Module 0x4::ord

Struct InscriptionID

struct InscriptionID has copy, drop, store

Struct SatPoint

struct SatPoint has copy, drop, store

Resource Inscription

struct Inscription has key

Struct Envelope

struct Envelope<T> has copy, drop, store

Struct InscriptionRecord

struct InscriptionRecord has copy, drop, store

Struct InvalidInscriptionEvent

struct InvalidInscriptionEvent has copy, drop, store

Resource MetaprotocolRegistry

struct MetaprotocolRegistry has key

Struct MetaprotocolValidity

struct MetaprotocolValidity has copy, drop, store

Resource InscriptionStore

struct InscriptionStore has key

Struct InscriptionEvent

Inscription event for metaprotocol

This event is used to record inscription operations related to metaprotocols. Compared to the events in inscription_updater, the main differences are:

  1. This event focuses on metaprotocol-related operations, it is an on-chain event.
  2. This event is only emitted when the inscription is created or burned, not when it is transferred.
  3. This event is only emitted if the inscription has a metaprotocol.

@param metaprotocol: The name of the metaprotocol @param sequence_number: The sequence number of the inscription @param inscription_obj_id: The ID of the inscription object @param event_type: Event type, 0 for creation, 1 for burn

struct InscriptionEvent has copy, drop, store

Struct TempStateDropEvent

Event emitted when the temporary state of an Inscription is dropped The temporary state is dropped when the inscription is transferred The event is onchain event, and the event_queue name is type_name of the temporary state

struct TempStateDropEvent has copy, drop, store

Struct InscriptionCharm

A struct to represent the Inscription Charm

struct InscriptionCharm has copy, drop, store

Constants

const TEMPORARY_AREA: vector<u8> = [116, 101, 109, 112, 111, 114, 97, 114, 121, 95, 97, 114, 101, 97];

const CHARM_BURNED_FLAG: u16 = 4096;

const CHARM_COIN_FLAG: u16 = 1;

const CHARM_CURSED_FLAG: u16 = 2;

const CHARM_EPIC_FLAG: u16 = 4;

const CHARM_LEGENDARY_FLAG: u16 = 8;

const CHARM_LOST_FLAG: u16 = 16;

const CHARM_MYTHIC_FLAG: u16 = 2048;

const CHARM_NINEBALL_FLAG: u16 = 32;

const CHARM_RARE_FLAG: u16 = 64;

const CHARM_REINSCRIPTION_FLAG: u16 = 128;

const CHARM_UNBOUND_FLAG: u16 = 256;

const CHARM_UNCOMMON_FLAG: u16 = 512;

const CHARM_VINDICATED_FLAG: u16 = 1024;

const ErrorInscriptionNotExists: u64 = 3;

const InscriptionEventTypeBurn: u8 = 1;

const InscriptionEventTypeNew: u8 = 0;

const METAPROTOCOL_VALIDITY: vector<u8> = [109, 101, 116, 97, 112, 114, 111, 116, 111, 99, 111, 108, 95, 118, 97, 108, 105, 100, 105, 116, 121];

const PERMANENT_AREA: vector<u8> = [112, 101, 114, 109, 97, 110, 101, 110, 116, 95, 97, 114, 101, 97];

Function genesis_init

public(friend) fun genesis_init()

Function borrow_mut_inscription_store

Function borrow_inscription_store

Function blessed_inscription_count

public(friend) fun blessed_inscription_count(inscription_store: &ord::InscriptionStore): u32

Function cursed_inscription_count

public(friend) fun cursed_inscription_count(inscription_store: &ord::InscriptionStore): u32

Function unbound_inscription_count

public(friend) fun unbound_inscription_count(inscription_store: &ord::InscriptionStore): u32

Function lost_sats

public(friend) fun lost_sats(inscription_store: &ord::InscriptionStore): u64

Function next_sequence_number

public(friend) fun next_sequence_number(inscription_store: &ord::InscriptionStore): u32

Function update_cursed_inscription_count

public(friend) fun update_cursed_inscription_count(inscription_store: &mut ord::InscriptionStore, count: u32)

Function update_blessed_inscription_count

public(friend) fun update_blessed_inscription_count(inscription_store: &mut ord::InscriptionStore, count: u32)

Function update_next_sequence_number

public(friend) fun update_next_sequence_number(inscription_store: &mut ord::InscriptionStore, count: u32)

Function update_unbound_inscription_count

public(friend) fun update_unbound_inscription_count(inscription_store: &mut ord::InscriptionStore, count: u32)

Function update_lost_sats

public(friend) fun update_lost_sats(inscription_store: &mut ord::InscriptionStore, count: u64)

Function new_inscription_id

public fun new_inscription_id(txid: address, index: u32): ord::InscriptionID

Function derive_inscription_id

Function parse_inscription_id

Prase InscriptionID from String

Function inscription_id_to_string

Function get_inscription_id_by_sequence_number

public fun get_inscription_id_by_sequence_number(sequence_number: u32): &ord::InscriptionID

Function get_inscription_next_sequence_number

Function create_object

public(friend) fun create_object(id: ord::InscriptionID, location: ord::SatPoint, sequence_number: u32, inscription_number: u32, is_cursed: bool, charms: u16, envelope: ord::Envelope<ord::InscriptionRecord>, owner: address): object::ObjectID

Function transfer_object

public(friend) fun transfer_object(inscription_obj: object::Object<ord::Inscription>, to: address, new_location: ord::SatPoint, is_op_return: bool)

Function take_object

public(friend) fun take_object(inscription_obj_id: object::ObjectID): object::Object<ord::Inscription>

Function borrow_object

public(friend) fun borrow_object(inscription_obj_id: object::ObjectID): &object::Object<ord::Inscription>

Function exists_inscription

public fun exists_inscription(id: ord::InscriptionID): bool

Function borrow_inscription

Function txid

public fun txid(self: &ord::Inscription): address

Function index

public fun index(self: &ord::Inscription): u32

Function location

Function sequence_number

public fun sequence_number(self: &ord::Inscription): u32

Function inscription_number

public fun inscription_number(self: &ord::Inscription): u32

Function is_cursed

public fun is_cursed(self: &ord::Inscription): bool

Function charms

public fun charms(self: &ord::Inscription): u16

Function offset

public fun offset(self: &ord::Inscription): u64

Function body

public fun body(self: &ord::Inscription): vector<u8>

Function content_encoding

Function content_type

Function metadata

public fun metadata(self: &ord::Inscription): vector<u8>

Function metaprotocol

Function parents

Function pointer

public fun pointer(self: &ord::Inscription): option::Option<u64>

Function id

public fun id(self: &ord::Inscription): &ord::InscriptionID

Function inscription_id_txid

public fun inscription_id_txid(self: &ord::InscriptionID): address

Function inscription_id_index

public fun inscription_id_index(self: &ord::InscriptionID): u32

Function new_satpoint

public fun new_satpoint(outpoint: types::OutPoint, offset: u64): ord::SatPoint

Function unpack_satpoint

public fun unpack_satpoint(satpoint: ord::SatPoint): (types::OutPoint, u64)

Function satpoint_offset

Get the SatPoint's offset

public fun satpoint_offset(satpoint: &ord::SatPoint): u64

Function satpoint_outpoint

Get the SatPoint's outpoint

Function satpoint_vout

public fun satpoint_vout(satpoint: &ord::SatPoint): u32

Function parse_inscription_from_tx

Function envelope_input

public(friend) fun envelope_input<T>(envelope: &ord::Envelope<T>): u32

Function envelope_offset

public(friend) fun envelope_offset<T>(envelope: &ord::Envelope<T>): u32

Function envelope_payload

public(friend) fun envelope_payload<T>(envelope: &ord::Envelope<T>): &T

Function envelope_pushnum

public(friend) fun envelope_pushnum<T>(envelope: &ord::Envelope<T>): bool

Function envelope_stutter

public(friend) fun envelope_stutter<T>(envelope: &ord::Envelope<T>): bool

Function inscription_record_pointer

Function inscription_record_parents

Function inscription_record_unrecognized_even_field

Function inscription_record_duplicate_field

Function inscription_record_incomplete_field

Function inscription_record_metaprotocol

Function inscription_record_rune

public(friend) fun inscription_record_rune(record: &ord::InscriptionRecord): &option::Option<u128>

Function inscription_record_metadata

public(friend) fun inscription_record_metadata(record: &ord::InscriptionRecord): &vector<u8>

Function inscription_record_content_type

Function inscription_record_content_encoding

Function inscription_record_body

public(friend) fun inscription_record_body(record: &ord::InscriptionRecord): &vector<u8>

Function add_permanent_state

#[private_generics(#[S])]
public fun add_permanent_state<S: store>(inscription: &mut object::Object<ord::Inscription>, state: S)

Function contains_permanent_state

public fun contains_permanent_state<S: store>(inscription: &object::Object<ord::Inscription>): bool

Function borrow_permanent_state

public fun borrow_permanent_state<S: store>(inscription: &object::Object<ord::Inscription>): &S

Function borrow_mut_permanent_state

#[private_generics(#[S])]
public fun borrow_mut_permanent_state<S: store>(inscription: &mut object::Object<ord::Inscription>): &mut S

Function remove_permanent_state

#[private_generics(#[S])]
public fun remove_permanent_state<S: store>(inscription: &mut object::Object<ord::Inscription>): S

Function destroy_permanent_area

Destroy permanent area if it's empty. Aborts if it's not empty.

Function add_temp_state

#[private_generics(#[S])]
public fun add_temp_state<S: drop, store>(inscription: &mut object::Object<ord::Inscription>, state: S)

Function contains_temp_state

public fun contains_temp_state<S: drop, store>(inscription: &object::Object<ord::Inscription>): bool

Function borrow_temp_state

public fun borrow_temp_state<S: drop, store>(inscription: &object::Object<ord::Inscription>): &S

Function borrow_mut_temp_state

#[private_generics(#[S])]
public fun borrow_mut_temp_state<S: drop, store>(inscription: &mut object::Object<ord::Inscription>): &mut S

Function remove_temp_state

#[private_generics(#[S])]
public fun remove_temp_state<S: drop, store>(inscription: &mut object::Object<ord::Inscription>): S

Function drop_temp_area

Drop the bag, whether it's empty or not

public(friend) fun drop_temp_area(inscription: &mut object::Object<ord::Inscription>)

Function register_metaprotocol_via_system

Currently, Only the framework can register metaprotocol. We need to find a way to allow the user to register metaprotocol.

public fun register_metaprotocol_via_system<T>(system: &signer, metaprotocol: string::String)

Function is_metaprotocol_register

public fun is_metaprotocol_register(metaprotocol: string::String): bool

Function seal_metaprotocol_validity

Seal the metaprotocol validity for the given inscription_id.

#[private_generics(#[T])]
public fun seal_metaprotocol_validity<T>(inscription_id: ord::InscriptionID, is_valid: bool, invalid_reason: option::Option<string::String>)

Function add_metaprotocol_attachment

#[private_generics(#[T])]
public fun add_metaprotocol_attachment<T>(inscription_id: ord::InscriptionID, attachment: object::Object<T>)

Function remove_metaprotocol_attachment

#[private_generics(#[T])]
public fun remove_metaprotocol_attachment<T>(inscription_id: ord::InscriptionID): object::Object<T>

Function exists_metaprotocol_attachment

public fun exists_metaprotocol_attachment<T>(inscription_id: ord::InscriptionID): bool

Function exists_metaprotocol_validity

Returns true if Inscription object contains metaprotocol validity

public fun exists_metaprotocol_validity(inscription_id: ord::InscriptionID): bool

Function borrow_metaprotocol_validity

Borrow the metaprotocol validity for the given inscription_id.

Function metaprotocol_validity_protocol_match

Check the MetaprotocolValidity's protocol_type whether match

Function metaprotocol_validity_protocol_type

Get the MetaprotocolValidity's protocol_type

Function metaprotocol_validity_is_valid

Get the MetaprotocolValidity's is_valid

Function metaprotocol_validity_invalid_reason

Get the MetaprotocolValidity's invalid_reason

Function view_validity

Function unpack_inscription_event

Function inscription_event_type_new

public fun inscription_event_type_new(): u8

Function inscription_event_type_burn

public fun inscription_event_type_burn(): u8

Function unpack_temp_state_drop_event

Function charm_coin_flag

public fun charm_coin_flag(): u16

Function charm_cursed_flag

public fun charm_cursed_flag(): u16

Function charm_epic_flag

public fun charm_epic_flag(): u16

Function charm_legendary_flag

public fun charm_legendary_flag(): u16

Function charm_lost_flag

public fun charm_lost_flag(): u16

Function charm_nineball_flag

public fun charm_nineball_flag(): u16

Function charm_rare_flag

public fun charm_rare_flag(): u16

Function charm_reinscription_flag

public fun charm_reinscription_flag(): u16

Function charm_unbound_flag

public fun charm_unbound_flag(): u16

Function charm_uncommon_flag

public fun charm_uncommon_flag(): u16

Function charm_vindicated_flag

public fun charm_vindicated_flag(): u16

Function charm_mythic_flag

public fun charm_mythic_flag(): u16

Function charm_burned_flag

public fun charm_burned_flag(): u16

Function set_charm

public fun set_charm(charms: u16, flag: u16): u16

Function is_set_charm

public fun is_set_charm(charms: u16, flag: u16): bool

Function view_inscription_charm

Views the Inscription charms for a given inscription ID string. Returns None if the inscription doesn't exist

@param inscription_id_str - String representation of the inscription ID @return Option - Some(charm) if exists, None otherwise