Operations by Domain
Asset Core provides 16 operations across 5 domains. This reference documents each operation with its arguments, errors, and examples.
Overview
Operations are categorized by the entity type they affect. Each operation has:
- Tags describing domain, action, scope, and reversibility
- Arguments specific to the operation
- Errors that may be returned
- Example showing typical usage
Structure
All operations use the same envelope:
{
"op": "OperationName",
"args": { ... }
}
Fields
Tag Definitions
Domain: What entity type is affected
container,balance,instance,slot,schema
Action: What kind of change
create,destroy,move,link,consolidate
Scope: How many entities
single,multi
Reversibility: Can it be undone
reversible,destructive,neutral
Examples
Container Operations
CreateContainer
Creates a new container for storing assets.
Tags: container create single reversible
| Argument | Type | Required | Description |
|---|---|---|---|
container_id | integer | Yes | Unique container identifier |
kind | string | Yes | Container kind: Standard, Slots, or Grid |
owner | integer | No | Optional owner identifier |
Errors: ContainerAlreadyExists
{
"op": "CreateContainer",
"args": {
"container_id": 1001,
"kind": "Standard",
"owner": null
}
}
RemoveContainer
Deletes an empty container.
Tags: container destroy single destructive
| Argument | Type | Required | Description |
|---|---|---|---|
container_id | integer | Yes | Container to remove |
Errors: ContainerNotFound
{
"op": "RemoveContainer",
"args": {
"container_id": 1001
}
}
Balance Operations
AddFungible
Adds quantity to a fungible balance.
Tags: balance create single reversible
| Argument | Type | Required | Description |
|---|---|---|---|
container_id | integer | Yes | Target container |
class_id | integer | Yes | Asset class |
key | integer | Yes | Balance key |
quantity | integer | Yes | Amount to add |
Errors: InvalidQuantity, ContainerNotFound, WrongContainerKind, UnregisteredClassShape, InvalidOperation
{
"op": "AddFungible",
"args": {
"container_id": 1001,
"class_id": 100,
"key": 1,
"quantity": 500
}
}
RemoveFungible
Removes quantity from a fungible balance.
Tags: balance destroy single destructive
| Argument | Type | Required | Description |
|---|---|---|---|
container_id | integer | Yes | Target container |
class_id | integer | Yes | Asset class |
key | integer | Yes | Balance key |
quantity | integer | Yes | Amount to remove |
Errors: InvalidQuantity, ContainerNotFound, WrongContainerKind, InsufficientBalance
{
"op": "RemoveFungible",
"args": {
"container_id": 1001,
"class_id": 100,
"key": 1,
"quantity": 100
}
}
TransferFungible
Moves fungible quantity between containers.
Tags: balance move multi neutral
| Argument | Type | Required | Description |
|---|---|---|---|
from_container | integer | Yes | Source container |
to_container | integer | Yes | Destination container |
class_id | integer | Yes | Asset class |
key | integer | Yes | Balance key |
quantity | integer | Yes | Amount to transfer |
Errors: InvalidQuantity, InvalidOperation, ContainerNotFound, WrongContainerKind, InsufficientBalance, UnregisteredClassShape
{
"op": "TransferFungible",
"args": {
"from_container": 1001,
"to_container": 1002,
"class_id": 100,
"key": 1,
"quantity": 250
}
}
MergeStacks
Combines two fungible stacks into one.
Tags: balance consolidate multi reversible
| Argument | Type | Required | Description |
|---|---|---|---|
src_stack | integer | Yes | Stack to merge from |
dst_stack | integer | Yes | Stack to merge into |
Errors: InvalidOperation, ContainerNotFound, WrongContainerKind, StackNotFound, IncompatibleStacks
ConsolidateStacks
Merges all matching stacks in a container.
Tags: balance consolidate multi reversible
| Argument | Type | Required | Description |
|---|---|---|---|
container_id | integer | Yes | Container to consolidate |
class_id | integer | Yes | Asset class |
key | integer | Yes | Balance key |
Errors: ContainerNotFound, WrongContainerKind, InvalidOperation, StackNotFound
Instance Operations
MintInstance
Creates a new unique instance.
Tags: instance create single reversible
| Argument | Type | Required | Description |
|---|---|---|---|
class_id | integer | Yes | Instance class |
key | integer | Yes | Instance key |
Errors: IntegerOverflow
{
"op": "MintInstance",
"args": {
"class_id": 200,
"key": 1
}
}
The minted instance ID is returned in minted_instances.
BurnInstance
Destroys a unique instance permanently.
Tags: instance destroy single destructive
| Argument | Type | Required | Description |
|---|---|---|---|
instance_id | integer | Yes | Instance to destroy |
Errors: InstanceNotFound, HasChildren
Attach
Attaches a child instance to a parent.
Tags: instance link multi reversible
| Argument | Type | Required | Description |
|---|---|---|---|
child_instance | integer | Yes | Instance to attach |
parent_instance | integer | Yes | Parent instance |
Errors: InvalidOperation, InstanceNotFound, AlreadyAttached, WouldCreateCycle
Detach
Detaches an instance from its parent.
Tags: instance link single destructive
| Argument | Type | Required | Description |
|---|---|---|---|
child_instance | integer | Yes | Instance to detach |
Errors: InstanceNotFound, NotAttached
Slot Operations
PlaceInSlot
Places an instance into a container slot.
Tags: slot move single reversible
| Argument | Type | Required | Description |
|---|---|---|---|
container_id | integer | Yes | Target container |
instance_id | integer | Yes | Instance to place |
slot_index | integer | Yes | Slot position |
Errors: ContainerNotFound, WrongContainerKind, SlotOutOfBounds, InstanceNotFound, SlotOccupied
{
"op": "PlaceInSlot",
"args": {
"container_id": 1001,
"instance_id": 9001,
"slot_index": 0
}
}
RemoveFromSlot
Removes an instance from a slot.
Tags: slot move single destructive
| Argument | Type | Required | Description |
|---|---|---|---|
container_id | integer | Yes | Target container |
slot_index | integer | Yes | Slot position |
Errors: ContainerNotFound, WrongContainerKind, SlotOutOfBounds, SlotEmpty
SwapSlots
Exchanges contents between two slots.
Tags: slot move multi neutral
| Argument | Type | Required | Description |
|---|---|---|---|
container_a | integer | Yes | First container |
slot_a | integer | Yes | First slot |
container_b | integer | Yes | Second container |
slot_b | integer | Yes | Second slot |
Errors: InvalidOperation, ContainerNotFound, WrongContainerKind, SlotOutOfBounds, SlotEmpty
Schema Operations
RegisterClass
Registers a new asset class definition.
Tags: schema create single reversible
| Argument | Type | Required | Description |
|---|---|---|---|
request.class_id | integer | Yes | Unique class identifier |
request.name | string | Yes | Human-readable name |
request.fungible | boolean | Yes | Whether assets are fungible |
Errors: ClassAlreadyExists, ClassCapacityExceeded
{
"op": "RegisterClass",
"args": {
"request": {
"class_id": 100,
"name": "Gold Coin",
"fungible": true
}
}
}
RegisterClassShape
Adds a shape configuration to an existing class.
Tags: schema create single reversible
| Argument | Type | Required | Description |
|---|---|---|---|
request.class_id | integer | Yes | Class to configure |
request.shape_id | integer | Yes | Unique shape identifier |
request.width | integer | Yes | Shape width |
request.height | integer | Yes | Shape height |
Errors: ClassNotFound, ShapeAlreadyDefined
{
"op": "RegisterClassShape",
"args": {
"request": {
"class_id": 200,
"shape_id": 1,
"width": 2,
"height": 3
}
}
}
Related references
- Transactions - Request structure
- Recipes - Multi-operation patterns
- Error Model - Error handling