Skip to content

Unity Runtime Types

This page groups the Unity runtime support types that appear around PhantasmaAPI and PhantasmaLinkClient.

Error Handling

EPHANTASMA_SDK_ERROR_TYPE is the error enum passed to RPC error callbacks:

Action<EPHANTASMA_SDK_ERROR_TYPE, string> errorHandlingCallback

Use the callback for transport failures, timeout handling, RPC error responses, and SDK-side request errors. Successful RPC data is still delivered through the method-specific success callback.

WebClient is the lower-level HTTP helper used by PhantasmaAPI.

APIUse
WebClient.RPCRequest<T>(...)Sends JSON-RPC requests and deserializes typed responses.
WebClient.RESTGet<T>(...)Sends typed REST GET requests.
WebClient.RESTPost<T>(...)Sends typed REST POST requests.
WebClient.Ping(...)Measures endpoint response time.
WebClient.DefaultTimeoutDefault RPC timeout used by PhantasmaAPI.
WebClient.DefaultRetriesDefault retry count used by PhantasmaAPI.

WebClient.RPCRequest<T> tracks request ids and reports malformed responses through the supplied RPC error callback when an endpoint omits id, echoes a different id, omits result, or returns a result shape that cannot be decoded.

RPC Result Models

The Unity API uses the same typed model names exposed by the C# RPC package. Common callback result types include:

TypeFields or use
AccountResultAddress, Name, Stakes, Stake, Unclaimed, optional Relay, Validator, Storage, Balances, optional Txs.
BalanceResultChain, Amount, Symbol, Decimals, optional Ids.
CursorPaginatedResult<T>Result plus cursor text for account token/NFT and token series/NFT pagination.
BlockResultHash, PreviousHash, Timestamp, Height, ChainAddress, Protocol, Txs, ValidatorAddress, optional ProducerAddress, Reward, optional Events, optional Oracles.
EventResultAddress, Contract, Kind, Name, Data.
TransactionResultHash, ChainAddress, Timestamp, BlockHeight, BlockHash, Script, CarbonTxType, CarbonTxData, Payload, optional DebugComment, Events, ExtendedEvents, Result, Fee, State, optional Signatures, Sender, GasPayer, GasTarget, GasPrice, GasLimit, Expiration.
ScriptResultEvents, optional Result, optional Error, Results, Oracles, optional State, optional Gas.
TokenResultSymbol, Name, Decimals, CurrentSupply, MaxSupply, BurnedSupply, Address, Owner, Flags, optional Script, Series, CarbonId, optional Metadata, optional TokenSchemas, optional External, optional Price, and token-flag helpers.
TokenSeriesResultSeriesId, carbonTokenId, carbonSeriesId, OwnerAddress, MaxMint, MintCount, CurrentSupply, MaxSupply, optional BurnedSupply, optional Mode, optional Script, optional Methods, Metadata.
TokenDataResultId, Series, carbonTokenId, carbonSeriesId, carbonNftAddress, Mint, ChainName, OwnerAddress, CreatorAddress, Ram, Rom, Status, Infusion, Properties.
AuctionResult, ContractResult, ArchiveResultMarketplace listing, contract ABI, and archive storage response models.

ProducerAddress is the fee payout address that the block producer stamped inside the hashed block input. It is set on gas model v2 blocks and null on earlier blocks. It is a different field from ValidatorAddress, which names the consensus-log leader. Do not assume the two are equal.

For a contract event, Kind is Custom_V2 and Name is the event name the contract declared. For every other event, Name repeats Kind.

Wallet Link Types

PhantasmaLinkClient.Balance stores cached wallet balances:

FieldTypeMeaning
symbolstringToken symbol.
valueBigIntegerInteger token amount before decimal conversion.
decimalsuintToken decimal precision used by GetBalance.
idsstring[]NFT ids returned by the wallet for the symbol.

PhantasmaLinkClient.PlatformKind selects the wallet signing platform. The component also exposes SignatureKind, which is supplied by the imported cryptography package and defaults to Ed25519 in the inspector.

WebSocket Runtime

The LinkClient package includes a runtime WebSocket implementation used by PhantasmaLinkClient.

TypeUse
WebSocketConnects, sends binary or text messages, receives messages, dispatches callback queues, and closes the socket.
IWebSocketInterface for WebSocket implementations.
WebSocketStateConnection state enum.
WebSocketCloseCodeClose-code enum.
WebSocketException and derived exceptionsError types for invalid state, invalid arguments, and unexpected socket failures.
WebSocketFactoryWebGL instance factory and event delegation surface.
WaitForUpdate, WaitForBackgroundThread, MainThreadUtilAwaiter and main-thread helpers used by the WebSocket runtime.

Logging

Log is a Unity Core runtime logging helper. It exposes log levels, Unity debug log modes, file-path state, initialization, mode switches, and write methods:

Method familyUse
Init(...)Opens a log file and configures level, working-folder behavior, overwrite behavior, and thread-id output.
SwitchToCompactMode, SwitchConsoleOutput, SwitchUtcTimestamp, DisableMultilinePaddingChanges logging behavior after initialization.
Write, WriteWarning, WriteFatalError, WriteRawWrites formatted or raw log messages.

Cryptography And Transaction Types

Unity Core package code consumes key, address, hash, transaction, and Carbon types from the Phantasma Phoenix C# libraries. The most visible types are:

TypeUsed by
IKeyPairSigning helpers on PhantasmaAPI.
HashTransaction hashes and Link transaction callbacks.
TxMsgCarbon signing and broadcast helpers.
Witness, Bytes32, Bytes64Carbon transaction signing internals.
RpcAddressTypeAddress-type-aware RPC overloads.

Use the C# complete reference for deeper behavior of those shared protocol and cryptography types.