- Struct
InscriptionID
- Struct
SatPoint
- Resource
Inscription
- Struct
Envelope
- Struct
InscriptionRecord
- Struct
InvalidInscriptionEvent
- Resource
MetaprotocolRegistry
- Struct
MetaprotocolValidity
- Resource
InscriptionStore
- Struct
InscriptionEvent
- Struct
TempStateDropEvent
- Struct
InscriptionCharm
- Constants
- Function
genesis_init
- Function
borrow_mut_inscription_store
- Function
borrow_inscription_store
- Function
blessed_inscription_count
- Function
cursed_inscription_count
- Function
unbound_inscription_count
- Function
lost_sats
- Function
next_sequence_number
- Function
update_cursed_inscription_count
- Function
update_blessed_inscription_count
- Function
update_next_sequence_number
- Function
update_unbound_inscription_count
- Function
update_lost_sats
- Function
new_inscription_id
- Function
derive_inscription_id
- Function
parse_inscription_id
- Function
inscription_id_to_string
- Function
get_inscription_id_by_sequence_number
- Function
get_inscription_next_sequence_number
- Function
create_object
- Function
transfer_object
- Function
take_object
- Function
borrow_object
- Function
exists_inscription
- Function
borrow_inscription
- Function
txid
- Function
index
- Function
location
- Function
sequence_number
- Function
inscription_number
- Function
is_cursed
- Function
charms
- Function
offset
- Function
body
- Function
content_encoding
- Function
content_type
- Function
metadata
- Function
metaprotocol
- Function
parents
- Function
pointer
- Function
id
- Function
inscription_id_txid
- Function
inscription_id_index
- Function
new_satpoint
- Function
unpack_satpoint
- Function
satpoint_offset
- Function
satpoint_outpoint
- Function
satpoint_vout
- Function
parse_inscription_from_tx
- Function
envelope_input
- Function
envelope_offset
- Function
envelope_payload
- Function
envelope_pushnum
- Function
envelope_stutter
- 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
- Function
inscription_record_metadata
- Function
inscription_record_content_type
- Function
inscription_record_content_encoding
- Function
inscription_record_body
- Function
add_permanent_state
- Function
contains_permanent_state
- Function
borrow_permanent_state
- Function
borrow_mut_permanent_state
- Function
remove_permanent_state
- Function
destroy_permanent_area
- Function
add_temp_state
- Function
contains_temp_state
- Function
borrow_temp_state
- Function
borrow_mut_temp_state
- Function
remove_temp_state
- Function
drop_temp_area
- Function
register_metaprotocol_via_system
- Function
is_metaprotocol_register
- Function
seal_metaprotocol_validity
- Function
add_metaprotocol_attachment
- Function
remove_metaprotocol_attachment
- Function
exists_metaprotocol_attachment
- Function
exists_metaprotocol_validity
- Function
borrow_metaprotocol_validity
- Function
metaprotocol_validity_protocol_match
- Function
metaprotocol_validity_protocol_type
- Function
metaprotocol_validity_is_valid
- Function
metaprotocol_validity_invalid_reason
- Function
view_validity
- Function
unpack_inscription_event
- Function
inscription_event_type_new
- Function
inscription_event_type_burn
- Function
unpack_temp_state_drop_event
- Function
charm_coin_flag
- Function
charm_cursed_flag
- Function
charm_epic_flag
- Function
charm_legendary_flag
- Function
charm_lost_flag
- Function
charm_nineball_flag
- Function
charm_rare_flag
- Function
charm_reinscription_flag
- Function
charm_unbound_flag
- Function
charm_uncommon_flag
- Function
charm_vindicated_flag
- Function
charm_mythic_flag
- Function
charm_burned_flag
- Function
set_charm
- Function
is_set_charm
- Function
view_inscription_charm
use 0x1::option;
use 0x1::string;
use 0x1::vector;
use 0x2::bag;
use 0x2::core_addresses;
use 0x2::event_queue;
use 0x2::json;
use 0x2::object;
use 0x2::simple_map;
use 0x2::string_utils;
use 0x2::type_info;
use 0x4::bitcoin_hash;
use 0x4::temp_state;
use 0x4::types;
struct InscriptionID has copy, drop, store
struct SatPoint has copy, drop, store
struct Inscription has key
struct Envelope<T> has copy, drop, store
struct InscriptionRecord has copy, drop, store
struct InvalidInscriptionEvent has copy, drop, store
struct MetaprotocolRegistry has key
struct MetaprotocolValidity has copy, drop, store
struct InscriptionStore has key
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:
- This event focuses on metaprotocol-related operations, it is an on-chain event.
- This event is only emitted when the inscription is created or burned, not when it is transferred.
- 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
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
A struct to represent the Inscription Charm
struct InscriptionCharm has copy, drop, store
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 ErrorMetaprotocolAlreadyRegistered: u64 = 1;
const ErrorMetaprotocolProtocolMismatch: u64 = 2;
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];
public(friend) fun genesis_init()
public(friend) fun borrow_mut_inscription_store(): &mut ord::InscriptionStore
public(friend) fun borrow_inscription_store(): &ord::InscriptionStore
public(friend) fun blessed_inscription_count(inscription_store: &ord::InscriptionStore): u32
public(friend) fun cursed_inscription_count(inscription_store: &ord::InscriptionStore): u32
public(friend) fun unbound_inscription_count(inscription_store: &ord::InscriptionStore): u32
public(friend) fun lost_sats(inscription_store: &ord::InscriptionStore): u64
public(friend) fun next_sequence_number(inscription_store: &ord::InscriptionStore): u32
public(friend) fun update_cursed_inscription_count(inscription_store: &mut ord::InscriptionStore, count: u32)
public(friend) fun update_blessed_inscription_count(inscription_store: &mut ord::InscriptionStore, count: u32)
public(friend) fun update_next_sequence_number(inscription_store: &mut ord::InscriptionStore, count: u32)
public(friend) fun update_unbound_inscription_count(inscription_store: &mut ord::InscriptionStore, count: u32)
public(friend) fun update_lost_sats(inscription_store: &mut ord::InscriptionStore, count: u64)
public fun new_inscription_id(txid: address, index: u32): ord::InscriptionID
public fun derive_inscription_id(inscription_id: ord::InscriptionID): object::ObjectID
Prase InscriptionID from String
public fun parse_inscription_id(inscription_id: &string::String): option::Option<ord::InscriptionID>
public fun inscription_id_to_string(inscription_id: &ord::InscriptionID): string::String
public fun get_inscription_id_by_sequence_number(sequence_number: u32): &ord::InscriptionID
public fun get_inscription_next_sequence_number(): u32
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
public(friend) fun transfer_object(inscription_obj: object::Object<ord::Inscription>, to: address, new_location: ord::SatPoint, is_op_return: bool)
public(friend) fun take_object(inscription_obj_id: object::ObjectID): object::Object<ord::Inscription>
public(friend) fun borrow_object(inscription_obj_id: object::ObjectID): &object::Object<ord::Inscription>
public fun exists_inscription(id: ord::InscriptionID): bool
public fun borrow_inscription(id: ord::InscriptionID): &ord::Inscription
public fun txid(self: &ord::Inscription): address
public fun index(self: &ord::Inscription): u32
public fun location(self: &ord::Inscription): &ord::SatPoint
public fun sequence_number(self: &ord::Inscription): u32
public fun inscription_number(self: &ord::Inscription): u32
public fun is_cursed(self: &ord::Inscription): bool
public fun charms(self: &ord::Inscription): u16
public fun offset(self: &ord::Inscription): u64
public fun body(self: &ord::Inscription): vector<u8>
public fun content_encoding(self: &ord::Inscription): option::Option<string::String>
public fun content_type(self: &ord::Inscription): option::Option<string::String>
public fun metadata(self: &ord::Inscription): vector<u8>
public fun metaprotocol(self: &ord::Inscription): option::Option<string::String>
public fun parents(self: &ord::Inscription): vector<ord::InscriptionID>
public fun pointer(self: &ord::Inscription): option::Option<u64>
public fun id(self: &ord::Inscription): &ord::InscriptionID
public fun inscription_id_txid(self: &ord::InscriptionID): address
public fun inscription_id_index(self: &ord::InscriptionID): u32
public fun new_satpoint(outpoint: types::OutPoint, offset: u64): ord::SatPoint
public fun unpack_satpoint(satpoint: ord::SatPoint): (types::OutPoint, u64)
Get the SatPoint's offset
public fun satpoint_offset(satpoint: &ord::SatPoint): u64
Get the SatPoint's outpoint
public fun satpoint_outpoint(satpoint: &ord::SatPoint): &types::OutPoint
public fun satpoint_vout(satpoint: &ord::SatPoint): u32
public(friend) fun parse_inscription_from_tx(tx: &types::Transaction): vector<ord::Envelope<ord::InscriptionRecord>>
public(friend) fun envelope_input<T>(envelope: &ord::Envelope<T>): u32
public(friend) fun envelope_offset<T>(envelope: &ord::Envelope<T>): u32
public(friend) fun envelope_payload<T>(envelope: &ord::Envelope<T>): &T
public(friend) fun envelope_pushnum<T>(envelope: &ord::Envelope<T>): bool
public(friend) fun envelope_stutter<T>(envelope: &ord::Envelope<T>): bool
public(friend) fun inscription_record_pointer(record: &ord::InscriptionRecord): &option::Option<u64>
public(friend) fun inscription_record_parents(record: &ord::InscriptionRecord): &vector<ord::InscriptionID>
public(friend) fun inscription_record_unrecognized_even_field(record: &ord::InscriptionRecord): bool
public(friend) fun inscription_record_duplicate_field(record: &ord::InscriptionRecord): bool
public(friend) fun inscription_record_incomplete_field(record: &ord::InscriptionRecord): bool
public(friend) fun inscription_record_metaprotocol(record: &ord::InscriptionRecord): &option::Option<string::String>
public(friend) fun inscription_record_rune(record: &ord::InscriptionRecord): &option::Option<u128>
public(friend) fun inscription_record_metadata(record: &ord::InscriptionRecord): &vector<u8>
public(friend) fun inscription_record_content_type(record: &ord::InscriptionRecord): &option::Option<string::String>
public(friend) fun inscription_record_content_encoding(record: &ord::InscriptionRecord): &option::Option<string::String>
public(friend) fun inscription_record_body(record: &ord::InscriptionRecord): &vector<u8>
#[private_generics(#[S])]
public fun add_permanent_state<S: store>(inscription: &mut object::Object<ord::Inscription>, state: S)
public fun contains_permanent_state<S: store>(inscription: &object::Object<ord::Inscription>): bool
public fun borrow_permanent_state<S: store>(inscription: &object::Object<ord::Inscription>): &S
#[private_generics(#[S])]
public fun borrow_mut_permanent_state<S: store>(inscription: &mut object::Object<ord::Inscription>): &mut S
#[private_generics(#[S])]
public fun remove_permanent_state<S: store>(inscription: &mut object::Object<ord::Inscription>): S
Destroy permanent area if it's empty. Aborts if it's not empty.
public fun destroy_permanent_area(inscription: &mut object::Object<ord::Inscription>)
#[private_generics(#[S])]
public fun add_temp_state<S: drop, store>(inscription: &mut object::Object<ord::Inscription>, state: S)
public fun contains_temp_state<S: drop, store>(inscription: &object::Object<ord::Inscription>): bool
public fun borrow_temp_state<S: drop, store>(inscription: &object::Object<ord::Inscription>): &S
#[private_generics(#[S])]
public fun borrow_mut_temp_state<S: drop, store>(inscription: &mut object::Object<ord::Inscription>): &mut S
#[private_generics(#[S])]
public fun remove_temp_state<S: drop, store>(inscription: &mut object::Object<ord::Inscription>): S
Drop the bag, whether it's empty or not
public(friend) fun drop_temp_area(inscription: &mut object::Object<ord::Inscription>)
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)
public fun is_metaprotocol_register(metaprotocol: string::String): bool
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>)
#[private_generics(#[T])]
public fun add_metaprotocol_attachment<T>(inscription_id: ord::InscriptionID, attachment: object::Object<T>)
#[private_generics(#[T])]
public fun remove_metaprotocol_attachment<T>(inscription_id: ord::InscriptionID): object::Object<T>
public fun exists_metaprotocol_attachment<T>(inscription_id: ord::InscriptionID): bool
Returns true if Inscription object
contains metaprotocol validity
public fun exists_metaprotocol_validity(inscription_id: ord::InscriptionID): bool
Borrow the metaprotocol validity for the given inscription_id.
public fun borrow_metaprotocol_validity(inscription_id: ord::InscriptionID): &ord::MetaprotocolValidity
Check the MetaprotocolValidity's protocol_type whether match
public fun metaprotocol_validity_protocol_match<T>(validity: &ord::MetaprotocolValidity): bool
Get the MetaprotocolValidity's protocol_type
public fun metaprotocol_validity_protocol_type(validity: &ord::MetaprotocolValidity): string::String
Get the MetaprotocolValidity's is_valid
public fun metaprotocol_validity_is_valid(validity: &ord::MetaprotocolValidity): bool
Get the MetaprotocolValidity's invalid_reason
public fun metaprotocol_validity_invalid_reason(validity: &ord::MetaprotocolValidity): option::Option<string::String>
public fun view_validity(inscription_id_str: string::String): option::Option<ord::MetaprotocolValidity>
public fun unpack_inscription_event(event: ord::InscriptionEvent): (string::String, u32, object::ObjectID, u8)
public fun inscription_event_type_new(): u8
public fun inscription_event_type_burn(): u8
public fun unpack_temp_state_drop_event(event: ord::TempStateDropEvent): (object::ObjectID, ord::InscriptionID)
public fun charm_coin_flag(): u16
public fun charm_cursed_flag(): u16
public fun charm_epic_flag(): u16
public fun charm_legendary_flag(): u16
public fun charm_lost_flag(): u16
public fun charm_nineball_flag(): u16
public fun charm_rare_flag(): u16
public fun charm_reinscription_flag(): u16
public fun charm_unbound_flag(): u16
public fun charm_uncommon_flag(): u16
public fun charm_vindicated_flag(): u16
public fun charm_mythic_flag(): u16
public fun charm_burned_flag(): u16
public fun set_charm(charms: u16, flag: u16): u16
public fun is_set_charm(charms: u16, flag: u16): bool
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
public fun view_inscription_charm(inscription_id_str: string::String): option::Option<ord::InscriptionCharm>