chain

package
v0.1.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 19, 2025 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//0: Active 1: Frozen 2: Expired 3: OnConsignment
	TERRITORY_ACTIVE = iota
	TERRITORY_FROZEN
	TERRITORY_EXPIRED
	TERRITORY_ONCONSIGNMENT
)

Variables

View Source
var (
	ErrTxEventNotFound = errors.New("tx event not found")
)

Functions

func ConvertName

func ConvertName(name string) string

ConvertName converts snake_case field names to CamelCase for struct field mapping. Processes namespaces (e.g., "transaction_fee_paid" → "TransactionFeePaid"). Parameters:

name - Original field name in snake_case format

Returns:

CamelCase formatted name

func DecodeEvent

func DecodeEvent(event *parser.Event, value any) (err error)

DecodeEvent decodes a blockchain event into a user-provided struct. Handles reflection to map event fields to struct fields, includes error recovery for panics. Parameters:

event - Parsed event data from the blockchain
value - Pointer to a struct to decode the event into

Returns:

Error if decoding fails (invalid input, type mismatch, etc.)

func DecodeFields

func DecodeFields(target, fv reflect.Value) error

DecodeFields recursively decodes event fields into a target struct/type. Handles structs, arrays, slices, maps, and primitive types with type conversion. Parameters:

target - Reflect value of the target to decode into
fv - Reflect value of the source field data

Returns:

Error if type mismatch or decoding fails

func EncodePubkey

func EncodePubkey(pubkey []byte, format uint16) string

func GetRegisteredEventIntance

func GetRegisteredEventIntance(eventName string) (any, bool)

GetRegisteredEventInstance retrieves a new instance of registered event type.

Parameters:

  • eventName: Registered event name to look up

Returns:

  • interface{}: Newly created instance pointer for the event type
  • bool: True if the event type was registered

func GetRegisteredEventTypes

func GetRegisteredEventTypes() []string

GetRegisteredEventTypes lists all registered event type names.

Returns:

  • []string: Slice of registered event names in "Module.Event" format. Note: Order is not guaranteed as it's based on map iteration.

func ParsingPublickey

func ParsingPublickey(address string) ([]byte, error)

func QueryStorage

func QueryStorage[T any](c *Client, block uint32, prefix, method string, args ...[]byte) (T, error)

QueryStorage retrieves a single storage entry from the blockchain. Parameters:

T - Generic type for the storage data
c - Client instance for chain interaction
block - Block number to query (0 for latest)
prefix - Storage module prefix (e.g., "System")
method - Storage function name (e.g., "Account")
args - Optional arguments for storage key generation

Returns:

Decoded storage data of type T
Error if key creation, storage retrieval, or decoding fails

func QueryStorages

func QueryStorages[T any](c *Client, block uint32, prefix, method string) ([]T, error)

QueryStorages retrieves multiple storage entries matching a prefix. Parameters:

T - Generic type for the storage data
c - Client instance for chain interaction
block - Block number to query (0 for latest)
prefix - Storage module prefix
method - Storage function name

Returns:

Slice of decoded storage data entries
Error if key retrieval, storage query, or decoding fails

func RegisterEventType

func RegisterEventType(eventName string, eventType reflect.Type)

RegisterEventType registers custom event type to the global registry. Allows decoding of blockchain events into concrete Go types.

Parameters:

  • eventName: Full event name in format "Module.Event" (e.g. "Balances.Transfer")
  • eventType: Reflect type of the target event struct

func SignedSR25519WithMnemonic

func SignedSR25519WithMnemonic(mnemonic string, msg []byte) ([]byte, error)

Types

type AccBytes

type AccBytes [256]types.U8

type AccessInfo

type AccessInfo struct {
	R types.H160
	C []types.H160
}

type ActualWeightType

type ActualWeightType struct {
	RefTime   types.U64
	ProofSize types.U64
}

type BloomFilter

type BloomFilter [256]types.U64

type BucketInfo

type BucketInfo struct {
	FileList  []FileHash
	Authority []types.AccountID
}

type Client

type Client struct {
	Rpcs []string

	KeyringManager
	GenesisBlockHash types.Hash
	RuntimeVersion   *types.RuntimeVersion
	*rpc.SubstrateAPI
	Retriever retriever.EventRetriever
	Timeout   time.Duration
	Metadata  *types.Metadata

	CallRegistery registry.CallRegistry
	// contains filtered or unexported fields
}

func NewClient

func NewClient(opts ...Option) (*Client, error)

NewClient creates a full-featured CESS chain client with configurable options. Initializes RPC connection, retrieves metadata, genesis hash, and runtime version. Parameters:

opts - List of functional options for client configuration

Returns:

Configured Client instance
Error if any initialization step fails

func NewLightCessClient

func NewLightCessClient(mnemonic string, rpcs []string) (*Client, error)

NewLightCessClient creates a lightweight CESS client with a single account. Parameters:

mnemonic - BIP-39 mnemonic for the primary account
rpcs - List of RPC endpoints to connect to

Returns:

Lightweight Client instance
Error if client initialization fails

func (*Client) Authorize

func (c *Client) Authorize(account []byte, caller *signature.KeyringPair, event any) (string, error)

Authorize grants authorization to a target account for OSS operations. Parameters:

account - The target account ID (byte slice) to authorize
caller  - Keyring pair of the account initiating the authorization (nil for temporary key)
event   - Event pointer, used to receive specified events

Returns:

string  - Block hash of the submitted transaction
error   - Error if the authorization operation fails

func (*Client) CancelOssAuth

func (c *Client) CancelOssAuth(account []byte, caller *signature.KeyringPair, event any) (string, error)

CancelOssAuth revokes authorization from a target account for OSS operations. Parameters:

account - The target account ID (byte slice) to revoke authorization from
caller  - Keyring pair of the account initiating the cancellation (nil for temporary key)
event   - Event pointer, used to receive specified events

Returns:

string  - Block hash of the submitted transaction
error   - Error if the cancellation operation fails

func (*Client) CreateTerritoryOrder

func (c *Client) CreateTerritoryOrder(account []byte, name string, orderType uint8, gibCount, days, expired uint32, caller *signature.KeyringPair, event any) (string, error)

CreateTerritoryOrder creates a new territory order on the blockchain. This method is used by the agent to create a territory for other users. Parameters:

account - The account ID of the owner of the territory.
name - The name of the territory.
orderType - The type of order (e.g., mint, expand, renew, reactivate).
gibCount - The size of the territory in GiB.
days - The duration of the territory in days.
expired - The expiration time of the order in Unix timestamp.
caller - The keyring pair of the transaction signer. If nil, the client's keyring will be used.
event - A pointer to an event structure that will be populated if the transaction is successful.

Returns:

string - The block hash of the transaction.
error - An error if the transaction fails, including encoding errors, key retrieval, extrinsic creation, or submission errors.

func (*Client) DeleteUserFile

func (c *Client) DeleteUserFile(fid FileHash, owner types.AccountID, caller *signature.KeyringPair, event any) (string, error)

DeleteUserFile submits a file deletion transaction to remove a user's file. Signs and submits the extrinsic with file hash and owner's account ID. Parameters:

fid - FileHash struct representing the file's cryptographic hash
owner - AccountID of the file owner
caller - Keyring pair for transaction signing (optional, uses client's keyring if nil)
event - Event pointer, used to receive FileBank.DeleteFile event

Returns:

Block hash where the transaction was included
Error if signing, extrinsic creation, or submission fails

func (*Client) DestroyOss

func (c *Client) DestroyOss(caller *signature.KeyringPair, event any) (string, error)

DestroyOss deletes an existing OSS service registration. Parameters:

caller  - Keyring pair of the account initiating the destruction (nil for temporary key)
event   - Event pointer, used to receive specified events

Returns:

string  - Block hash of the submitted transaction
error   - Error if the destruction operation fails

func (*Client) ExecTerritoryOrder

func (c *Client) ExecTerritoryOrder(orderId []byte, caller *signature.KeyringPair, event any) (string, error)

ExecTerritoryOrder executes a territory order on the blockchain. This method is used by the agent to execute a territory order for other users. Parameters:

orderId - The ID of the order to execute.
caller - The keyring pair of the transaction signer. If nil, the client's keyring will be used.
event - A pointer to an event structure that will be populated if the transaction is successful.

Returns:

string - The block hash of the transaction.
error - An error if the transaction fails, including encoding errors, key retrieval, extrinsic creation, or submission errors.

func (*Client) ExpandingTerritory

func (c *Client) ExpandingTerritory(name string, gibCount uint32, caller *signature.KeyringPair, event any) (string, error)

ExpandingTerritory expands an existing territory on the blockchain. Parameters:

name - The name of the territory to expand.
gibCount - The additional size to add to the territory in GiB.
caller - The keyring pair of the transaction signer. If nil, the client's keyring will be used.
event - A pointer to an event structure that will be populated if the transaction is successful.

Returns:

string - The block hash of the transaction.
error - An error if the transaction fails, including encoding errors, key retrieval, extrinsic creation, or submission errors.

func (*Client) GetCaller

func (c *Client) GetCaller(caller *signature.KeyringPair) (signature.KeyringPair, error)

GetCaller retrieves the signing keyring pair for transactions. Uses provided caller if not nil; otherwise selects from client's keyring. Parameters:

caller - Optional specific keyring pair to use

Returns:

Keyring pair for transaction signing
Error if no valid caller or keyring configured

func (*Client) GetCallerNonce

func (c *Client) GetCallerNonce(caller *signature.KeyringPair) (uint64, error)

func (*Client) GetOssProxyAuthSign

func (c *Client) GetOssProxyAuthSign(mnemonic, oss string) ([]byte, []byte, error)

GetOssProxyAuthSign retrieves the OSS proxy authorization sign for a given mnemonic and OSS account. Parameters:

mnemonic - The mnemonic phrase for the key pair.
oss - The public key of the OSS account.

Returns:

[]byte - The public key of the key pair.
[]byte - The signed authorization data.
error - An error if the sign operation fails.

func (*Client) MintTerritory

func (c *Client) MintTerritory(name string, gibCount, days uint32, caller *signature.KeyringPair, event any) (string, error)

MintTerritory mints a new territory on the blockchain. Parameters:

name - The name of the territory.
gibCount - The initial size of the territory in GiB.
days - The duration of the territory in days.
caller - The keyring pair of the transaction signer. If nil, the client's keyring will be used.
event - A pointer to an event structure that will be populated if the transaction is successful.

Returns:

string - The block hash of the transaction.
error - An error if the transaction fails, including encoding errors, key retrieval, extrinsic creation, or submission errors.

func (*Client) NewSubstrateAPI

func (c *Client) NewSubstrateAPI(rpcAddr string) error

NewSubstrateAPI initializes a new Substrate RPC connection. Uses provided rpcAddr or randomly selects from client's RPC list if empty. Parameters:

rpcAddr - Specific RPC address to connect to (optional)

Returns:

Error if connection fails

func (*Client) ParseBlockData

func (c *Client) ParseBlockData(hash types.Hash) (ParsedBlock, error)

ParseBlockData processes raw block data into structured format

Workflow:

  1. Creates call registry from metadata
  2. Retrieves raw block data from chain
  3. Processes extrinsics (transactions): - Generates call hash - Extracts signature information
  4. Retrieves and processes system events: - Matches events to extrinsics - Handles success/failure statuses - Captures extrinsic errors

Parameters:

  • hash: Block hash identifier

Returns:

  • ParsedBlock: Fully parsed block structure
  • error: Wrapped error with operation context

func (*Client) ParseBlockDataWithBlockNumber

func (c *Client) ParseBlockDataWithBlockNumber(block uint32) (ParsedBlock, error)

ParseBlockDataWithBlockNumber retrieves and parses block data by block number

Parameters:

  • block: Target block number to parse

Returns:

  • ParsedBlock: Structured block data with extrinsics and events
  • error: Wrapped error containing original error context

func (*Client) ParseSystemEventError

func (c *Client) ParseSystemEventError(t types.ModuleError) error

ParseSystemEventError converts a module error into a human-readable error message. Uses client metadata to resolve error index and code to error name/description. Parameters:

t - ModuleError struct containing error index and code

Returns:

Formatted error message
Error if metadata lookup fails

func (*Client) ParseTxResult

func (cli *Client) ParseTxResult(caller signature.KeyringPair, events []*parser.Event, eventName string) (*parser.Event, error)

ParseTxResult parses transaction events to find the target event and validate transaction status. Processes events, checks for extrinsic success/failure, and matches the specified event name. Parameters:

caller - Keyring pair of the transaction caller
events - List of events from the transaction block
eventName - Target event name to search for (e.g., "Balances.Transfer")

Returns:

Target event if found
Error if parsing fails, event not found, or transaction failed

func (*Client) PutCaller

func (c *Client) PutCaller(caller *signature.KeyringPair)

func (*Client) QuerPurchasedSpace

func (c *Client) QuerPurchasedSpace(block uint32) (uint64, error)

QuerPurchasedSpace retrieves the total purchased storage space from the blockchain at the specified block height. Parameters:

block - The block number at which to query the storage.

Returns:

uint64 - The total purchased space value.
error - An error if the query fails, including wrapped errors from underlying storage queries.

func (*Client) QueryAccountInfo

func (c *Client) QueryAccountInfo(account []byte, block uint32) (types.AccountInfo, error)

QueryAccountInfo retrieves the account information for a specific account at the given block height. Parameters:

account - The byte slice representing the account address.
block - The block number at which to query the account information.

Returns:

types.AccountInfo - The account information struct containing details like nonce, consumers, providers, etc.
error - An error if the query fails, including account ID creation errors, encoding errors, or storage query failures.

func (*Client) QueryAllBondeds

func (c *Client) QueryAllBondeds(block uint32) ([]types.AccountID, error)

QueryAllBondeds lists all active bonded accounts. Accesses "Bonded" storage map under "Staking" module.

Parameters:

  • block: State query block number

Returns:

  • []types.AccountID: Slice of account identifier data structures
  • error: Storage access error with context

func (*Client) QueryAllErasStakersPaged

func (c *Client) QueryAllErasStakersPaged(accountId []byte, era, block uint32) ([]StakingExposurePaged, error)

QueryAllErasStakersPaged gets paginated validator exposure data. Iterates through 256 pages of "ErasStakersPaged" storage.

Parameters:

  • accountId: Validator account identifier
  • era: Target staking era
  • block: Query block number

Returns:

  • []StakingExposurePaged: Paginated exposure data slices
  • error: Composite error during paged queries

func (*Client) QueryAllMiners

func (c *Client) QueryAllMiners(block uint32) ([]types.AccountID, error)

QueryAllMiners retrieves the list of all registered storage miner account IDs at a given block number. Parameters:

block - The block number (uint32) at which to perform the query

Returns:

[]types.AccountID - Slice containing all storage miner account IDs
error             - Error if the query operation fails

func (*Client) QueryAllNominators

func (c *Client) QueryAllNominators(block uint32) ([]StakingNominations, error)

QueryAllNominators lists all active nominator accounts and their preferences. Accesses "Nominators" storage map under "Staking" module.

Parameters:

  • block: State query block number

Returns:

  • []StakingNominations: Slice of nominator data structures
  • error: Storage access error with context

func (*Client) QueryAllOss

func (c *Client) QueryAllOss(block uint32) ([]OssInfo, error)

QueryAllOss retrieves OSS information for all registered accounts at a given block number. Parameters:

block - The block number (uint32) at which to perform the query

Returns:

[]OssInfo - Slice containing OSS information for all accounts
error      - Error if the query operation fails

func (*Client) QueryAuthList

func (c *Client) QueryAuthList(account []byte, block uint32) ([]types.AccountID, error)

QueryAuthList retrieves the authorization list for a specific account at a given block number. Parameters:

account - The account ID (byte slice) to query authorization list for
block   - The block number (uint32) at which to perform the query

Returns:

[]types.AccountID - Slice of authorized account IDs
error             - Error if the query operation fails

func (*Client) QueryBlockNumber

func (c *Client) QueryBlockNumber(blockhash string) (uint32, error)

QueryBlockNumber retrieves the block number from the blockchain. If blockhash is provided, it queries the block number for the specified block hash. If blockhash is empty, it retrieves the latest block number. Parameters:

blockhash - The hexadecimal string of the block hash (empty for the latest block).

Returns:

uint32 - The block number.
error - An error if the query fails, including decoding errors or RPC failures.

func (*Client) QueryCounterForMinerItems

func (c *Client) QueryCounterForMinerItems(block uint32) (uint32, error)

QueryCounterForMinerItems retrieves the counter value for storage miner items at a given block number. Parameters:

block - The block number (uint32) at which to perform the query

Returns:

uint32 - Counter value representing the number of storage miner items
error  - Error if the query operation fails

func (*Client) QueryCounterForValidators

func (c *Client) QueryCounterForValidators(block uint32) (uint32, error)

QueryCounterForValidators gets the current validator count from chain storage. Accesses "CounterForValidators" entry under "Staking" module.

Parameters:

  • block: Target block number for state query

Returns:

  • uint32: Active validator count
  • error: Wrapped storage access error

func (*Client) QueryCurrencyReward

func (c *Client) QueryCurrencyReward(block uint32) (types.U128, error)

QueryCurrencyReward retrieves the current currency reward allocation from treasury storage. Queries the "CurrencyReward" entry under "CessTreasury" module in chain storage.

Parameters:

  • block: Target block number for historical query

Returns:

  • types.U128: 128-bit unsigned integer reward value
  • error: Wrapped storage access error

func (*Client) QueryCurrentEra

func (c *Client) QueryCurrentEra(block uint32) (uint32, error)

QueryCurrentEra fetches the latest active era index. Reads "CurrentEra" entry from runtime storage.

Parameters:

  • block: Block for state inspection

Returns:

  • uint32: Current era number
  • error: Enhanced error with operation context

func (*Client) QueryDealMap

func (c *Client) QueryDealMap(fid string, block uint32) (StorageOrder, error)

QueryDealMap retrieves the storage order information for a specific file by its file ID. Validates file ID format (64-byte hex string), encodes it to file hash, and queries the FileBank storage. Parameters:

fid - 64-byte hex string representing the file ID
block - Block number to query (0 for latest block)

Returns:

StorageOrder struct containing file storage details
Error if file ID is invalid, encoding fails, or storage query fails

func (*Client) QueryEraReward

func (c *Client) QueryEraReward(block uint32) (types.U128, error)

QueryEraReward fetches the accumulated reward for the current era. Accesses "EraReward" storage entry in "CessTreasury" module.

Parameters:

  • block: Block number for state query

Returns:

  • types.U128: Era-specific reward amount
  • error: Wrapped chain interaction error

func (*Client) QueryEraValidatorReward

func (c *Client) QueryEraValidatorReward(era, block uint32) (types.U128, error)

QueryEraValidatorReward gets validator reward for specific era. Accesses "ErasValidatorReward" storage with era parameter.

Parameters:

  • era: Reward calculation era
  • block: Historical block number

Returns:

  • types.U128: Era-specific validator reward amount
  • error: Composite error including encoding issues

func (*Client) QueryErasRewardPoints

func (c *Client) QueryErasRewardPoints(era, block uint32) (StakingEraRewardPoints, error)

QueryErasRewardPoints gets reward distribution details per era. Queries "ErasRewardPoints" storage with SCALE-encoded era parameter.

Parameters:

  • era: Target reward distribution era
  • block: Query block number

Returns:

  • StakingEraRewardPoints: Structured reward points data
  • error: Wrapped chain interaction error

func (*Client) QueryErasStakers

func (c *Client) QueryErasStakers(accountId []byte, era, block uint32) (StakingExposure, error)

QueryErasStakers retrieves validator exposure for specific era. Combines era parameter and account ID to query "ErasStakers".

Parameters:

  • accountId: Validator account ID
  • era: Target exposure era
  • block: Historical block number

Returns:

  • StakingExposure: Validator's era exposure details
  • error: Wrapped multi-parameter query error

func (*Client) QueryErasStakersOveriew

func (c *Client) QueryErasStakersOveriew(accountId []byte, era, block uint32) (PagedExposureMetadata, error)

func (*Client) QueryErasTotalStaking

func (c *Client) QueryErasTotalStaking(era, block uint32) (types.U128, error)

QueryErasTotalStaking retrieves total staked amount for a specific era. Requires SCALE-encoded era parameter to query "ErasTotalStake" storage.

Parameters:

  • era: Target staking era
  • block: Block number for historical data

Returns:

  • types.U128: 128-bit total stake value
  • error: Composite error including encoding failures

func (*Client) QueryFileMetadata

func (c *Client) QueryFileMetadata(fid string, block uint32) (FileMetadata, error)

QueryFileMetadata fetches metadata (e.g., file size, creation time) for a specific file. Validates file ID format, encodes to file hash, and queries the FileBank file metadata storage. Parameters:

fid - 64-byte hex string representing the file ID
block - Block number to query (0 for latest block)

Returns:

FileMetadata struct containing file metadata
Error if file ID is invalid, encoding fails, or storage query fails

func (*Client) QueryLedger

func (c *Client) QueryLedger(accountId []byte, block uint32) (StakingLedger, error)

QueryLedger fetches staking ledger for an account. Queries "Ledger" storage map with account ID parameter.

Parameters:

  • accountId: Stash account identifier
  • block: Query block number

Returns:

  • StakingLedger: Complete staking ledger information
  • error: Enhanced error with account context

func (*Client) QueryMinerItems

func (c *Client) QueryMinerItems(miner []byte, block uint32) (MinerInfo, error)

QueryMinerItems retrieves the storage miner information for a specific miner account at a given block number. Parameters:

miner - The miner account ID (byte slice) to query information for
block - The block number (uint32) at which to perform the query

Returns:

MinerInfo - Struct containing the queried storage miner information
error     - Error if the query operation fails

func (*Client) QueryNominators

func (c *Client) QueryNominators(accountId []byte, block uint32) (StakingNominations, error)

QueryNominators lists all active nominator accounts and their preferences. Accesses "Nominators" storage map under "Staking" module.

Parameters:

  • block: State query block number

Returns:

  • []StakingNominations: Slice of nominator data structures
  • error: Storage access error with context

func (*Client) QueryOss

func (c *Client) QueryOss(account []byte, block uint32) (OssInfo, error)

QueryOss retrieves the OSS information for a specific account at a given block number. Parameters:

account - The account ID (byte slice) to query OSS information for
block   - The block number (uint32) at which to perform the query

Returns:

OssInfo - Struct containing the queried OSS information
error   - Error if the query operation fails

func (*Client) QueryReserveReward

func (c *Client) QueryReserveReward(block uint32) (types.U128, error)

QueryReserveReward gets the treasury's reserved reward pool balance. Reads "ReserveReward" entry from runtime storage.

Parameters:

  • block: Target block for state inspection

Returns:

  • types.U128: Reserve pool balance
  • error: Enhanced error with operation context

func (*Client) QueryRoundReward

func (c *Client) QueryRoundReward(era, block uint32) (RoundRewardType, error)

QueryRoundReward retrieves reward distribution details for a specific era. Requires SCALE-encoded era parameter to access "RoundReward" storage entry.

Parameters:

  • era: Target reward distribution era
  • block: Block number for state query

Returns:

  • RoundRewardType: Structured reward distribution data
  • error: Composite error including parameter encoding failures

func (*Client) QueryTerritory

func (c *Client) QueryTerritory(owner []byte, name string, block uint32) (TerritoryInfo, error)

QueryTerritory retrieves detailed information about a specific territory from the blockchain at the specified block height. Parameters:

owner - The owner's account address (byte slice).
name - The name of the territory.
block - The block number at which to query the storage.

Returns:

TerritoryInfo - Struct containing territory details.
error - An error if the query fails, including encoding errors or underlying storage query failures.

func (*Client) QueryTotalIdleSpace

func (c *Client) QueryTotalIdleSpace(block uint32) (uint64, error)

QueryTotalIdleSpace retrieves the total idle storage space from the blockchain at the specified block height. Parameters:

block - The block number at which to query the storage.

Returns:

uint64 - The total idle space value.
error - An error if the query fails, including wrapped errors from underlying storage queries.

func (*Client) QueryTotalServiceSpace

func (c *Client) QueryTotalServiceSpace(block uint32) (uint64, error)

QueryTotalServiceSpace retrieves the total In-service storage space from the blockchain at the specified block height. Parameters:

block - The block number at which to query the storage.

Returns:

uint64 - The total serviceable space value.
error - An error if the query fails, including wrapped errors from underlying storage queries.

func (*Client) QueryUnitPrice

func (c *Client) QueryUnitPrice(block uint32) (*big.Int, error)

QueryUnitPrice retrieves the unit price for storage handling from the blockchain at the specified block height. Parameters:

block - The block number at which to query the storage.

Returns:

*big.Int - The unit price value.
error - An error if the query fails, including wrapped errors from underlying storage queries.

func (*Client) QueryUserFileList

func (c *Client) QueryUserFileList(accountID []byte, block uint32) ([]UserFileSliceInfo, error)

QueryUserFileList retrieves the list of files held by a specific user. Converts account ID to AccountID type, encodes it, and queries the user's file list storage. Parameters:

accountID - Raw byte slice representing the user's account ID
block - Block number to query (0 for latest block)

Returns:

Slice of UserFileSliceInfo containing file slice details
Error if account ID conversion fails, encoding fails, or storage query fails

func (*Client) QueryValidatorCommission

func (c *Client) QueryValidatorCommission(accountId []byte, block uint32) (StakingValidatorPrefs, error)

QueryValidatorCommission retrieves validator's commission preferences. Queries "Validators" storage map with account ID parameter.

Parameters:

  • accountId: Validator's account identifier (32-byte array)
  • block: Target block for query

Returns:

  • StakingValidatorPrefs: Commission rate and preferences
  • error: Wrapped storage error

func (*Client) QueryValidators

func (c *Client) QueryValidators(block uint32) ([]types.AccountID, error)

QueryValidators retrieves active validator accounts for the given block. Accesses "Validators" storage entry under "Session" module which contains the current authority set.

Parameters:

  • block: Block number for state query

Returns:

  • []types.AccountID: Slice of validator account identifiers
  • error: Wrapped storage access error with context

func (*Client) ReactivateTerritory

func (c *Client) ReactivateTerritory(name string, days uint32, caller *signature.KeyringPair, event any) (string, error)

ReactivateTerritory reactivates an existing territory on the blockchain. Parameters:

name - The name of the territory to reactivate.
days - The additional duration to add to the territory in days.
caller - The keyring pair of the transaction signer. If nil, the client's keyring will be used.
event - A pointer to an event structure that will be populated if the transaction is successful.

Returns:

string - The block hash of the transaction.
error - An error if the transaction fails, including encoding errors, key retrieval, extrinsic creation, or submission errors.

Note: This function is similar to RenewalTerritory but does not require a new name. It can be used to extend the activation period of an existing territory.

func (*Client) RefreshSubstrateApi

func (c *Client) RefreshSubstrateApi(r bool) error

RefreshSubstrateApi reconnects to RPC endpoints, optionally shuffling the list. Attempts to connect to all RPCs until successful connection with valid metadata. Parameters:

r - Whether to shuffle RPC list before connection attempts

Returns:

Error if all RPC connections fail

func (*Client) RegisterOss

func (c *Client) RegisterOss(domain string, caller *signature.KeyringPair, event any) (string, error)

RegisterOss registers a new OSS service with the specified domain name. Parameters:

domain  - The domain name (string) for the OSS service (must be 1-100 characters)
caller  - Keyring pair of the account initiating the registration (nil for temporary key)
event   - Event pointer, used to receive specified events

Returns:

string  - Block hash of the submitted transaction
error   - Error if the registration operation fails

func (*Client) RenewalTerritory

func (c *Client) RenewalTerritory(name string, days uint32, caller *signature.KeyringPair, event any) (string, error)

RenewalTerritory renews an existing territory on the blockchain. Parameters:

name - The name of the territory to renew.
days - The additional duration to add to the territory in days.
caller - The keyring pair of the transaction signer. If nil, the client's keyring will be used.
event - A pointer to an event structure that will be populated if the transaction is successful.

Returns:

string - The block hash of the transaction.
error - An error if the transaction fails, including encoding errors, key retrieval, extrinsic creation, or submission errors.

func (*Client) SendEvmCall

func (c *Client) SendEvmCall(
	source, target types.H160, input types.Bytes, value types.U256,
	gasLimit types.U64, maxFeePerGas types.U256, accessList []AccessInfo,
	caller *signature.KeyringPair, event any,
) (string, error)

func (*Client) SubmitExtrinsic

func (c *Client) SubmitExtrinsic(caller *signature.KeyringPair, call types.Call, eventName string, event any, timeout time.Duration) (string, error)

SubmitExtrinsic signs and submits an extrinsic to the blockchain network. Monitors transaction status, decodes specified event, and handles timeout. Parameters:

keypair - Account keyring pair for signing the extrinsic
call - Substrate call data to include in the extrinsic
eventName - Name of event to decode (empty for no event decoding)
event - Pointer to struct for decoded event data (optional)
timeout - Maximum time to wait for transaction confirmation

Returns:

Block hash containing the transaction
Error if signing, submission, or event decoding fails

func (*Client) TransferToken

func (c *Client) TransferToken(dest string, amount string, caller *signature.KeyringPair, event any) (string, error)

TransferToken transfers tokens from the caller's account to the destination account. It ensures the caller's account remains alive (non-zero balance after transfer). Parameters:

dest - The destination account address (SS58 format string)
amount - The amount of tokens to transfer, ("1000000000000000000" represents 1 CESS token).
caller - The keyring pair of the transaction signer
event - A pointer to an event structure that will be populated if the transaction is successful

Returns:

Block hash of the transaction
Error if the transfer fails (e.g., invalid address, insufficient balance)

func (*Client) UpdateCallerNonce

func (c *Client) UpdateCallerNonce(caller *signature.KeyringPair) error

func (*Client) UpdateOss

func (c *Client) UpdateOss(domain string, caller *signature.KeyringPair, event any) (string, error)

UpdateOss updates the domain name of an existing OSS service. Parameters:

domain  - The new domain name (string) for the OSS service (must be 1-100 characters)
caller  - Keyring pair of the account initiating the update (nil for temporary key)
event   - Event pointer, used to receive specified events

Returns:

string  - Block hash of the submitted transaction
error   - Error if the update operation fails

func (*Client) UploadDeclaration

func (c *Client) UploadDeclaration(fid FileHash, segment []SegmentList, user UserBrief, filesize uint64, caller *signature.KeyringPair, event any) (string, error)

UploadDeclaration submits a file upload declaration transaction to the blockchain. Signs and submits the extrinsic with file hash, segment info, user details, and file size. Parameters:

fid - FileHash struct representing the file's cryptographic hash
segment - Slice of SegmentList containing file segment details
user - UserBrief struct with user identification information
filesize - Total size of the file in bytes (uint64)
caller - Keyring pair for transaction signing (optional, uses client's keyring if nil)
event - Event pointer, used to receive FileBank.UploadDeclaration event

Returns:

Block hash where the transaction was included
Error if signing, extrinsic creation, or submission fails

type CompleteInfo

type CompleteInfo struct {
	Index types.U8
	Miner types.AccountID
}

type ElectionCompute

type ElectionCompute struct {
	Index types.U8
	Value types.U8
}

type ElectionScore

type ElectionScore struct {
	/// The minimal winner, in terms of total backing stake.
	///
	/// This parameter should be maximized.
	Minimal_stake types.U128
	/// The sum of the total backing of all winners.
	///
	/// This parameter should maximized
	Sum_stake types.U128
	/// The sum squared of the total backing of all winners, aka. the variance.
	///
	/// Ths parameter should be minimized.
	Sum_stake_squared types.U128
}

*******************************************************

type EventAlreadyFrozen

type EventAlreadyFrozen struct {
	Phase  types.Phase
	Acc    types.AccountID
	Topics []types.Hash
}

type EventAuthorize

type EventAuthorize struct {
	Phase    types.Phase
	Acc      types.AccountID
	Operator types.AccountID
	Topics   []types.Hash
}

type EventBuySpace

type EventBuySpace struct {
	Phase            types.Phase
	Acc              types.AccountID
	Storage_capacity types.U128
	Spend            types.U128
	Topics           []types.Hash
}

------------------------StorageHandler--------------------------------

type EventCalculateEnd

type EventCalculateEnd struct {
	Phase     types.Phase
	File_hash FileHash
	Topics    []types.Hash
}

type EventCalculateReport

type EventCalculateReport struct {
	Phase    types.Phase
	Miner    types.AccountID
	FileHash FileHash
	Topics   []types.Hash
}

type EventCallDone

type EventCallDone struct {
	Phase      types.Phase
	Who        types.AccountID
	CallResult Result
	Topics     []types.Hash
}

type EventCancelAuthorize

type EventCancelAuthorize struct {
	Phase  types.Phase
	Acc    types.AccountID
	Topics []types.Hash
}

type EventClaimRestoralOrder

type EventClaimRestoralOrder struct {
	Phase   types.Phase
	Miner   types.AccountID
	OrderId FileHash
	Topics  []types.Hash
}

type EventCreatePayOrder

type EventCreatePayOrder struct {
	Phase     types.Phase
	OrderHash []types.U8
	Topics    []types.Hash
}

type EventDeleteFile

type EventDeleteFile struct {
	Phase    types.Phase
	Operator types.AccountID
	Owner    types.AccountID
	Filehash []FileHash
	Topics   []types.Hash
}

------------------------FileBank----------------------

type EventDeposit

type EventDeposit struct {
	Phase   types.Phase
	Balance types.U128
	Topics  []types.Hash
}

type EventDrawFaucetMoney

type EventDrawFaucetMoney struct {
	Phase  types.Phase
	Topics []types.Hash
}

type EventElectionFinalized

type EventElectionFinalized struct {
	Phase   types.Phase
	Compute types.U8
	Score   ElectionScore
	Topics  []types.Hash
}

------------------------system------------------------

type EventExit

type EventExit struct {
	Phase  types.Phase
	Acc    types.AccountID
	Topics []types.Hash
}

------------------------TEE Worker--------------------

type EventExpansionSpace

type EventExpansionSpace struct {
	Phase           types.Phase
	Acc             types.AccountID
	Expansion_space types.U128
	Fee             types.U128
	Topics          []types.Hash
}

type EventFaucetTopUpMoney

type EventFaucetTopUpMoney struct {
	Phase  types.Phase
	Acc    types.AccountID
	Topics []types.Hash
}

type EventFillerDelete

type EventFillerDelete struct {
	Phase      types.Phase
	Acc        types.AccountID
	FillerHash FileHash
	Topics     []types.Hash
}

type EventFillerUpload

type EventFillerUpload struct {
	Phase    types.Phase
	Acc      types.AccountID
	Filesize types.U64
	Topics   []types.Hash
}

type EventGenerateChallenge

type EventGenerateChallenge struct {
	Phase  types.Phase
	Miner  types.AccountID
	Topics []types.Hash
}

type EventGenerateRestoralOrder

type EventGenerateRestoralOrder struct {
	Phase        types.Phase
	Miner        types.AccountID
	FragmentHash FileHash
	Topics       []types.Hash
}

type EventIdleSpaceCert

type EventIdleSpaceCert struct {
	Phase  types.Phase
	Acc    types.AccountID
	Space  types.U128
	Topics []types.Hash
}

type EventIncreaseCollateral

type EventIncreaseCollateral struct {
	Phase   types.Phase
	Acc     types.AccountID
	Balance types.U128
	Topics  []types.Hash
}

type EventIncreaseDeclarationSpace

type EventIncreaseDeclarationSpace struct {
	Phase  types.Phase
	Miner  types.AccountID
	Space  types.U128
	Topics []types.Hash
}

type EventKeyfairyAdded

type EventKeyfairyAdded struct {
	Phase  types.Phase
	Pubkey [32]types.U8
	Topics []types.Hash
}

type EventLeaseExpireIn24Hours

type EventLeaseExpireIn24Hours struct {
	Phase  types.Phase
	Acc    types.AccountID
	Size   types.U128
	Topics []types.Hash
}

type EventLeaseExpired

type EventLeaseExpired struct {
	Phase  types.Phase
	Acc    types.AccountID
	Size   types.U128
	Topics []types.Hash
}

type EventLessThan24Hours

type EventLessThan24Hours struct {
	Phase  types.Phase
	Last   types.U32
	Now    types.U32
	Topics []types.Hash
}

type EventLocked

type EventLocked struct {
	Phase  types.Phase
	Who    types.AccountID
	Amount types.U128
	Topics []types.Hash
}

type EventMasterKeyLaunched

type EventMasterKeyLaunched struct {
	Phase  types.Phase
	Topics []types.Hash
}

type EventMasterKeyRotated

type EventMasterKeyRotated struct {
	Phase        types.Phase
	RotationId   types.U64
	MasterPubkey [32]types.U8
	Topics       []types.Hash
}

type EventMasterKeyRotationFailed

type EventMasterKeyRotationFailed struct {
	Phase              types.Phase
	RotationLock       types.Option[types.U64]
	KeyfairyRotationId types.U64
	Topics             []types.Hash
}

type EventMinerClaim

type EventMinerClaim struct {
	Phase  types.Phase
	Acc    types.AccountID
	Topics []types.Hash
}

type EventMinerExit

type EventMinerExit struct {
	Phase  types.Phase
	Acc    types.AccountID
	Topics []types.Hash
}

type EventMinerExitPrep

type EventMinerExitPrep struct {
	Phase  types.Phase
	Miner  types.AccountID
	Topics []types.Hash
}

type EventMinimumCesealVersionChangedTo

type EventMinimumCesealVersionChangedTo struct {
	Phase  types.Phase
	Elem1  types.U32
	Elem2  types.U32
	Elem3  types.U32
	Topics []types.Hash
}

type EventOssDestroy

type EventOssDestroy struct {
	Phase  types.Phase
	Acc    types.AccountID
	Topics []types.Hash
}

type EventOssRegister

type EventOssRegister struct {
	Phase    types.Phase
	Acc      types.AccountID
	Endpoint [38]types.U8
	Topics   []types.Hash
}

------------------------Oss---------------------------

type EventOssUpdate

type EventOssUpdate struct {
	Phase       types.Phase
	Acc         types.AccountID
	NewEndpoint [38]types.U8
	Topics      []types.Hash
}

type EventPaidOrder

type EventPaidOrder struct {
	Phase     types.Phase
	OrderHash []types.U8
	Topics    []types.Hash
}

type EventPhaseTransitioned

type EventPhaseTransitioned struct {
	Phase  types.Phase
	From   Signed
	To     Unsigneds
	Round  types.U32
	Topics []types.Hash
}

type EventReceive

type EventReceive struct {
	Phase  types.Phase
	Acc    string
	Reward types.U128
	Topics []types.Hash
}

type EventRecoveryCompleted

type EventRecoveryCompleted struct {
	Phase   types.Phase
	Miner   types.AccountID
	OrderId FileHash
	Topics  []types.Hash
}

type EventRegisterPoisKey

type EventRegisterPoisKey struct {
	Phase  types.Phase
	Miner  types.AccountID
	Topics []types.Hash
}

type EventRegistered

type EventRegistered struct {
	Phase  types.Phase
	Acc    types.AccountID
	Topics []types.Hash
}

------------------------Sminer------------------------

type EventRenewalSpace

type EventRenewalSpace struct {
	Phase       types.Phase
	Acc         types.AccountID
	RenewalDays types.U32
	Fee         types.U128
	Topics      []types.Hash
}

type EventReplaceFiller

type EventReplaceFiller struct {
	Phase       types.Phase
	Acc         types.AccountID
	Filler_list []FileHash
	Topics      []types.Hash
}

type EventReplaceIdleSpace

type EventReplaceIdleSpace struct {
	Phase  types.Phase
	Acc    types.AccountID
	Space  types.U128
	Topics []types.Hash
}

type EventServiceFeePaid

type EventServiceFeePaid struct {
	Phase       types.Phase
	Who         types.AccountID
	ActualFee   types.U128
	ExpectedFee types.U128
	Topics      []types.Hash
}

type EventSolutionStored

type EventSolutionStored struct {
	Phase       types.Phase
	Compute     ElectionCompute
	Origin      types.Option[types.AccountID]
	PrevEjected types.Bool
	Topics      []types.Hash
}

type EventStorageCompleted

type EventStorageCompleted struct {
	Phase    types.Phase
	FileHash FileHash
	Topics   []types.Hash
}

type EventSubmitIdleProof

type EventSubmitIdleProof struct {
	Phase  types.Phase
	Miner  types.AccountID
	Topics []types.Hash
}

type EventSubmitIdleVerifyResult

type EventSubmitIdleVerifyResult struct {
	Phase  types.Phase
	Tee    [32]types.U8
	Miner  types.AccountID
	Result types.Bool
	Topics []types.Hash
}

type EventSubmitProof

type EventSubmitProof struct {
	Phase  types.Phase
	Miner  types.AccountID
	Topics []types.Hash
}

type EventSubmitServiceProof

type EventSubmitServiceProof struct {
	Phase  types.Phase
	Miner  types.AccountID
	Topics []types.Hash
}

type EventSubmitServiceVerifyResult

type EventSubmitServiceVerifyResult struct {
	Phase  types.Phase
	Tee    [32]types.U8
	Miner  types.AccountID
	Result types.Bool
	Topics []types.Hash
}

type EventTerritorFileDelivery

type EventTerritorFileDelivery struct {
	Phase        types.Phase
	Filehash     FileHash
	NewTerritory types.Bytes
	Topics       []types.Hash
}

type EventTransferReport

type EventTransferReport struct {
	Phase    types.Phase
	Acc      types.AccountID
	DealHash FileHash
	Topics   []types.Hash
}

type EventUpdateBeneficiary

type EventUpdateBeneficiary struct {
	Phase  types.Phase
	Acc    types.AccountID
	New    types.AccountID
	Topics []types.Hash
}

type EventUploadDeclaration

type EventUploadDeclaration struct {
	Phase    types.Phase
	Operator types.AccountID
	Owner    types.AccountID
	DealHash FileHash
	Topics   []types.Hash
}

type EventValidatorPrefsSet

type EventValidatorPrefsSet struct {
	Phase  types.Phase
	Stash  types.AccountID
	Prefs  ValidatorPrefs
	Topics []types.Hash
}

type EventVerifyProof

type EventVerifyProof struct {
	Phase     types.Phase
	TeeWorker [32]types.U8
	Miner     types.AccountID
	Topics    []types.Hash
}

------------------------Audit-------------------

type EventWithdraw

type EventWithdraw struct {
	Phase  types.Phase
	Acc    types.AccountID
	Topics []types.Hash
}

type EventWorkerAdded

type EventWorkerAdded struct {
	Phase               types.Phase
	Pubkey              [32]types.U8
	AttestationProvider types.Option[types.U8]
	ConfidenceLevel     types.U8
	Topics              []types.Hash
}

type EventWorkerUpdated

type EventWorkerUpdated struct {
	Phase               types.Phase
	Pubkey              [32]types.U8
	AttestationProvider types.Option[types.U8]
	ConfidenceLevel     types.U8
	Topics              []types.Hash
}

type FileHash

type FileHash [64]types.U8

type FileMetadata

type FileMetadata struct {
	SegmentList []SegmentInfo
	Owner       []UserBrief
	FileSize    types.U128
	Completion  types.U32
	State       types.U8
}

type FragmentInfo

type FragmentInfo struct {
	Hash  FileHash
	Avail types.Bool
	Tag   types.Option[types.U32]
	Miner types.AccountID
}

type Individual

type Individual struct {
	Acc    types.AccountID
	Reward types.U32
}

type KeyLocker

type KeyLocker struct {
	// contains filtered or unexported fields
}

func NewKeyLocker

func NewKeyLocker(shardCount int) *KeyLocker

func (*KeyLocker) Cleanup

func (kl *KeyLocker) Cleanup()

func (*KeyLocker) Lock

func (kl *KeyLocker) Lock(key string)

func (*KeyLocker) Unlock

func (kl *KeyLocker) Unlock(key string)

type KeyringManager

type KeyringManager interface {
	AddKey(key signature.KeyringPair)
	RemoveKey(address string)
	GetKey(address string) signature.KeyringPair
	GetKeyRandomly() signature.KeyringPair
	GetKeyInOrder() signature.KeyringPair
	PutKey(address string)
}

type Keyrings

type Keyrings struct {
	// contains filtered or unexported fields
}

func NewKeyrings

func NewKeyrings(keyrings ...signature.KeyringPair) *Keyrings

func (*Keyrings) AddKey

func (k *Keyrings) AddKey(key signature.KeyringPair)

func (*Keyrings) GetKey

func (k *Keyrings) GetKey(address string) signature.KeyringPair

func (*Keyrings) GetKeyInOrder

func (k *Keyrings) GetKeyInOrder() signature.KeyringPair

func (*Keyrings) GetKeyRandomly

func (k *Keyrings) GetKeyRandomly() signature.KeyringPair

func (*Keyrings) PutKey

func (k *Keyrings) PutKey(address string)

func (*Keyrings) RemoveKey

func (k *Keyrings) RemoveKey(address string)

type MinerInfo

type MinerInfo struct {
	BeneficiaryAccount types.AccountID
	StakingAccount     types.AccountID
	Endpoint           types.Bytes
	Collaterals        types.U128
	Debt               types.U128
	State              types.Bytes // positive, exit, frozen, lock
	DeclarationSpace   types.U128
	IdleSpace          types.U128
	ServiceSpace       types.U128
	LockSpace          types.U128
	SpaceProofInfo     types.Option[SpaceProofInfo]
	ServiceBloomFilter BloomFilter
	TeeSig             [64]types.U8
}

type Option

type Option func(*Client) error

func OptionWithAccounts

func OptionWithAccounts(mnemonics []string) Option

OptionWithAccounts configures the client with keyring accounts from mnemonics. Parameters:

mnemonics - List of BIP-39 mnemonic phrases for account recovery

Returns:

Functional option to apply to the client

func OptionWithRpcs

func OptionWithRpcs(rpcs []string) Option

OptionWithRpcs configures the client with a list of RPC endpoints. Parameters:

rpcs - List of RPC server addresses (e.g., "ws://localhost:9944")

Returns:

Functional option to apply to the client

func OptionWithTimeout

func OptionWithTimeout(timeout time.Duration) Option

OptionWithTimeout sets the default timeout for chain operations. Parameters:

timeout - Timeout duration (minimum 15 seconds if <=0)

Returns:

Functional option to apply to the client

type OssInfo

type OssInfo struct {
	Peerid [38]types.U8
	Domain types.Bytes
}

type OtherStakingExposure

type OtherStakingExposure struct {
	Who   types.AccountID
	Value types.UCompact
}

type PagedExposureMetadata

type PagedExposureMetadata struct {
	Total          types.UCompact
	Own            types.UCompact
	NominatorCount types.U32
	PageCount      types.U32
}

type ParsedBlock

type ParsedBlock struct {
	Hash         types.Hash
	Header       types.Header
	Extrinsics   []ParsedExtrinsic
	SystemEvents []ParsedEvent
}

type ParsedEvent

type ParsedEvent struct {
	Name  string
	Event any
}

type ParsedExtrinsic

type ParsedExtrinsic struct {
	Name           string
	Hash           string
	NoExtrinsic    bool
	ExtrinsicError error
	Account        types.AccountID
	Raw            types.Extrinsic
	Events         []ParsedEvent
}

type PoISKeyInfo

type PoISKeyInfo struct {
	G AccBytes
	N AccBytes
}

type Result

type Result struct {
	Index    types.U8
	ResultOk ResultOk
}

type ResultOk

type ResultOk struct {
	ActualWeight types.Option[ActualWeightType]
	PaysFee      types.U8
}

type RoundRewardType

type RoundRewardType struct {
	TotalReward types.U128
	OtherReward types.U128
}

type SegmentInfo

type SegmentInfo struct {
	Hash         FileHash
	FragmentList []FragmentInfo
}

type SegmentList

type SegmentList struct {
	SegmentHash  FileHash
	FragmentHash []FileHash
}

type SignPayload

type SignPayload struct {
	Oss types.AccountID
	Exp types.U32
}

func (SignPayload) EncodeSignPayload

func (p SignPayload) EncodeSignPayload() ([]byte, error)

type Signed

type Signed struct {
	Index types.U8
	Value types.U32
}

type SpaceProofInfo

type SpaceProofInfo struct {
	Miner       types.AccountID
	Front       types.U64
	Rear        types.U64
	PoisKey     PoISKeyInfo
	Accumulator AccBytes
}

type StakingEraRewardPoints

type StakingEraRewardPoints struct {
	Total      types.U32
	Individual []Individual
}

type StakingExposure

type StakingExposure struct {
	Total  types.UCompact
	Own    types.UCompact
	Others []OtherStakingExposure
}

type StakingExposurePaged

type StakingExposurePaged struct {
	PageTotal types.UCompact
	Others    []OtherStakingExposure
}

type StakingLedger

type StakingLedger struct {
	Stash          types.AccountID
	Total          types.UCompact
	Active         types.UCompact
	Unlocking      []UnlockChunk
	ClaimedRewards []types.U32
}

type StakingNominations

type StakingNominations struct {
	Targets     []types.AccountID
	SubmittedIn types.U32
	Suppressed  types.Bool
}

type StakingValidatorPrefs

type StakingValidatorPrefs struct {
	Commission types.U32
	Blocked    types.Bool
}

type StorageOrder

type StorageOrder struct {
	FileSize     types.U128
	SegmentList  []SegmentList
	User         UserBrief
	CompleteList []CompleteInfo
}

type TerritoryInfo

type TerritoryInfo struct {
	Token          types.H256
	TotalSpace     types.U128
	UsedSpace      types.U128
	LockedSpace    types.U128
	RemainingSpace types.U128
	Start          types.U32
	Deadline       types.U32
	State          types.U8 //0: Active 1: Frozen 2: Expired 3: OnConsignment
}

type UnlockChunk

type UnlockChunk struct {
	Value types.UCompact
	Era   types.BlockNumber
}

type UnsignedValue

type UnsignedValue struct {
	Bool types.Bool
	Bn   types.U32
}

type Unsigneds

type Unsigneds struct {
	Index         types.U8
	UnsignedValue []UnsignedValue
}

type UserBrief

type UserBrief struct {
	User          types.AccountID
	FileName      types.Bytes
	TerriortyName types.Bytes
}

type UserFileSliceInfo

type UserFileSliceInfo struct {
	TerritoryName types.Bytes
	Filehash      FileHash
	FileSize      types.U128
}

type ValidatorPrefs

type ValidatorPrefs struct {
	Commission types.U32
	Blocked    types.Bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL