API Reference
Interface
interface ITokenizationPrecompile {
// Types
struct MessageInput {
string messageType; // e.g., "createCollection", "transferTokens"
string msgJson; // JSON matching the protobuf format
}
// Transaction methods
function transferTokens(string calldata msgJson) external returns (bool);
function createCollection(string calldata msgJson) external returns (uint256);
function updateCollection(string calldata msgJson) external returns (uint256);
function deleteCollection(string calldata msgJson) external returns (bool);
function createDynamicStore(string calldata msgJson) external returns (uint256);
function updateDynamicStore(string calldata msgJson) external returns (bool);
function deleteDynamicStore(string calldata msgJson) external returns (bool);
function setDynamicStoreValue(string calldata msgJson) external returns (bool);
function setIncomingApproval(string calldata msgJson) external returns (bool);
function setOutgoingApproval(string calldata msgJson) external returns (bool);
function deleteIncomingApproval(string calldata msgJson) external returns (bool);
function deleteOutgoingApproval(string calldata msgJson) external returns (bool);
function createAddressLists(string calldata msgJson) external returns (bool);
function castVote(string calldata msgJson) external returns (bool);
function executeMultiple(MessageInput[] calldata messages) external returns (bool success, bytes[] memory results);
// Query methods (all return ABI-encoded structs; define matching struct types in your contract)
function getCollection(string calldata msgJson) external view returns (TokenCollection memory);
function getBalance(string calldata msgJson) external view returns (UserBalanceStore memory);
function getBalanceAmount(string calldata msgJson) external view returns (uint256);
function getTotalSupply(string calldata msgJson) external view returns (uint256);
function getDynamicStore(string calldata msgJson) external view returns (DynamicStore memory);
function getDynamicStoreValue(string calldata msgJson) external view returns (DynamicStoreValueResult memory);
function getAddressList(string calldata msgJson) external view returns (AddressList memory);
function getCollectionStats(string calldata msgJson) external view returns (CollectionStats memory);
// Utility helper methods (pure functions)
function convertEvmAddressToBech32(address evmAddress) external pure returns (string memory);
function convertBech32ToEvmAddress(string calldata bech32Address) external pure returns (address);
function rangeContains(uint256 start, uint256 end, uint256 value) external pure returns (bool);
function rangesOverlap(uint256 start1, uint256 end1, uint256 start2, uint256 end2) external pure returns (bool);
function searchInRanges(string calldata rangesJson, uint256 value) external pure returns (bool);
function getBalanceForIdAndTime(string calldata balancesJson, uint256 tokenId, uint256 time) external pure returns (uint256);
function getReservedListId(address addr) external pure returns (string memory);
}Transaction Methods
transferTokens
transferTokenscreateCollection
createCollectioncreateDynamicStore
createDynamicStoresetDynamicStoreValue
setDynamicStoreValueexecuteMultiple
executeMultipledeleteIncomingApproval / deleteOutgoingApproval
deleteIncomingApproval / deleteOutgoingApprovaldeleteCollection
deleteCollectionQuery Methods
getCollection
getCollectiongetBalanceAmount
getBalanceAmountField
Type
Description
getTotalSupply
getTotalSupplyField
Type
Description
getDynamicStoreValue
getDynamicStoreValuegetAddressList
getAddressListgetCollectionStats
getCollectionStatsField
Type
Description
Helper Library Reference
Range Helpers
uintRangeToJson(uint256 start, uint256 end) β string
uintRangeToJson(uint256 start, uint256 end) β stringuintRangeArrayToJson(uint256[] memory starts, uint256[] memory ends) β string
uintRangeArrayToJson(uint256[] memory starts, uint256[] memory ends) β stringCollection Helpers
collectionMetadataToJson(string memory uri, string memory customData) β string
collectionMetadataToJson(string memory uri, string memory customData) β stringsimpleUserBalanceStoreToJson(bool outgoing, bool incoming, bool allIncoming) β string
simpleUserBalanceStoreToJson(bool outgoing, bool incoming, bool allIncoming) β stringstringArrayToJson(string[] memory strings) β string
stringArrayToJson(string[] memory strings) β stringUtility Helpers
uintToString(uint256 value) β string
uintToString(uint256 value) β stringStruct Return Types
JSON Format Reference
Error Handling
Security Notes
Utility Helper Methods
Address Conversion
convertEvmAddressToBech32(address evmAddress) β string
convertEvmAddressToBech32(address evmAddress) β stringconvertBech32ToEvmAddress(string bech32Address) β address
convertBech32ToEvmAddress(string bech32Address) β addressRange Utilities
rangeContains(uint256 start, uint256 end, uint256 value) β bool
rangeContains(uint256 start, uint256 end, uint256 value) β boolrangesOverlap(uint256 start1, uint256 end1, uint256 start2, uint256 end2) β bool
rangesOverlap(uint256 start1, uint256 end1, uint256 start2, uint256 end2) β boolsearchInRanges(string rangesJson, uint256 value) β bool
searchInRanges(string rangesJson, uint256 value) β boolBalance Utilities
getBalanceForIdAndTime(string balancesJson, uint256 tokenId, uint256 time) β uint256
getBalanceForIdAndTime(string balancesJson, uint256 tokenId, uint256 time) β uint256List ID Utilities
getReservedListId(address addr) β string
getReservedListId(address addr) β stringSee Also
Last updated