model

package
v2.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ItemTypeAddress  ItemType = "Address"
	ItemTypeIdentity          = "Identity"
	ItemTypeOutPoint          = "OutPoint"
)
View Source
const (
	ExtraFilterTypeDao      ExtraFilterType = "Dao"
	ExtraFilterTypeCellbase ExtraFilterType = "Cellbase"
	ExtraFilterTypeFrozen   ExtraFilterType = "Frozen"

	OrderAsc                   Order                  = "Asc"
	OrderDesc                  Order                  = "Desc"
	PayFeeFrom                 PayFee                 = "From"
	PayFeeTo                   PayFee                 = "To"
	OutputCapacityProviderFrom OutputCapacityProvider = "From"
	OutputCapacityProviderTo   OutputCapacityProvider = "To"

	StructureTypeNative      StructureType = "Native"
	StructureTypeDoubleEntry StructureType = "DoubleEntry"

	SinceTypeBlockNumber SinceType = "BlockNumber"
	SinceTypeEpochNumber SinceType = "EpochNumber"
	SinceTypeTimestamp   SinceType = "Timestamp"
	SinceFlagRelative    SinceFlag = "Relative"
	SinceFlagAbsolute    SinceFlag = "Absolute"
)
View Source
const (
	IoTypeInput          IoType       = "Input"
	IoTypeOutput         IoType       = "Output"
	DaoStateTypeDeposit  DaoStateType = "Deposit"
	DaoStateTypeWithdraw DaoStateType = "Withdraw"

	AccountTypeAcp    AccountType = "Acp"
	AccountTypePwLock AccountType = "PwLock"

	DBDriverPostgreSQL DBDriver = "PostgreSQL"
	DBDriverMySQL      DBDriver = "MySQL"
	DBDriverSQLite     DBDriver = "SQLite"

	NetworkTypeMainnet NetworkType = "Mainnet"
	NetworkTypeTestnet NetworkType = "Testnet"
	NetworkTypeStaging NetworkType = "Staging"
	NetworkTypeDev     NetworkType = "Dev"

	SyncStateReadOnly            SyncState = "ReadOnly"
	SyncStateSerial              SyncState = "Serial"
	SyncStateParallelFirstStage  SyncState = "ParallelFirstStage"
	SyncStateParallelSecondStage SyncState = "ParallelSecondStage"

	TxViewTypeTransactionWithRichStatus TxViewType = "TransactionWithRichStatus"
	TxViewTypeTransactionInfo           TxViewType = "TransactionInfo"
)
View Source
const (
	IdentityFlagsCkb byte = 0x00
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountInfo

type AccountInfo struct {
	AccountNumber  uint32      `json:"account_number"`
	AccountAddress string      `json:"account_address"`
	AccountType    AccountType `json:"account_type"`
}

func (*AccountInfo) UnmarshalJSON

func (r *AccountInfo) UnmarshalJSON(input []byte) error

type AccountType

type AccountType string

type AssetInfo

type AssetInfo struct {
	AssetType AssetType  `json:"asset_type"`
	UdtHash   types.Hash `json:"udt_hash"`
}

func NewCkbAsset

func NewCkbAsset() *AssetInfo

func NewUdtAsset

func NewUdtAsset(udtHash types.Hash) *AssetInfo

type AssetType

type AssetType string
const (
	AssetTypeCKB AssetType = "CKB"
	AssetTypeUDT AssetType = "UDT"
)

type Balance

type Balance struct {
	Ownership string     `json:"ownership"`
	AssetInfo *AssetInfo `json:"asset_info"`
	Free      *big.Int   `json:"free"`
	Occupied  *big.Int   `json:"occupied"`
	Frozen    *big.Int   `json:"frozen"`
}

func (*Balance) UnmarshalJSON

func (r *Balance) UnmarshalJSON(input []byte) error

type BlockInfo

type BlockInfo struct {
	BlockNumber  uint64             `json:"block_number"`
	BlockHash    types.Hash         `json:"block_hash"`
	ParentHash   types.Hash         `json:"parent_hash"`
	Timestamp    uint64             `json:"timestamp"`
	Transactions []*TransactionInfo `json:"transactions"`
}

func (*BlockInfo) UnmarshalJSON

func (r *BlockInfo) UnmarshalJSON(input []byte) error

type BlockRange

type BlockRange struct {
	From uint64 `json:"from"`
	To   uint64 `json:"to"`
}

func (BlockRange) MarshalJSON

func (r BlockRange) MarshalJSON() ([]byte, error)

type BuildAdjustAccountPayload

type BuildAdjustAccountPayload struct {
	Item          *Item      `json:"item"`
	From          []*Item    `json:"from"`
	AssetInfo     *AssetInfo `json:"asset_info"`
	AccountNumber uint32     `json:"account_number,omitempty"`
	ExtraCKB      uint64     `json:"extra_ckb,omitempty"`
	FeeRate       uint64     `json:"fee_rate,omitempty"`
}

func (BuildAdjustAccountPayload) MarshalJSON

func (r BuildAdjustAccountPayload) MarshalJSON() ([]byte, error)

type BuildSudtIssueTransactionPayload

type BuildSudtIssueTransactionPayload struct {
	Owner                  string                 `json:"owner"`
	From                   []*Item                `json:"from"`
	To                     []*ToInfo              `json:"to"`
	OutputCapacityProvider OutputCapacityProvider `json:"output_capacity_provider,omitempty"`
	FeeRate                uint64                 `json:"fee_rate,omitempty"`
	Since                  *SinceConfig           `json:"since,omitempty"`
}

func (BuildSudtIssueTransactionPayload) MarshalJSON

func (r BuildSudtIssueTransactionPayload) MarshalJSON() ([]byte, error)

type BurnInfo

type BurnInfo struct {
	UdtHash types.Hash `json:"udt_hash"`
	Amount  *big.Int   `json:"amount"`
}

func (*BurnInfo) UnmarshalJSON

func (r *BurnInfo) UnmarshalJSON(input []byte) error

type DBDriver

type DBDriver string

type DBInfo

type DBInfo struct {
	Version   string   `json:"version"`
	DB        DBDriver `json:"db"`
	ConnSize  uint32   `json:"conn_size"`
	CenterId  int64    `json:"center_id"`
	MachineId int64    `json:"machine_id"`
}

type DaoClaimPayload

type DaoClaimPayload struct {
	From    []*Item `json:"from"`
	To      string  `json:"to,omitempty"`
	FeeRate uint64  `json:"fee_rate,omitempty"`
}

func (DaoClaimPayload) MarshalJSON

func (r DaoClaimPayload) MarshalJSON() ([]byte, error)

type DaoDepositPayload

type DaoDepositPayload struct {
	From    []*Item `json:"from"`
	To      string  `json:"to,omitempty"`
	Amount  uint64  `json:"amount"`
	FeeRate uint64  `json:"fee_rate,omitempty"`
}

func (DaoDepositPayload) MarshalJSON

func (r DaoDepositPayload) MarshalJSON() ([]byte, error)

type DaoInfo

type DaoInfo struct {
	State  DaoState `json:"state"`
	Reward uint64   `json:"reward"`
}

func (*DaoInfo) UnmarshalJSON

func (r *DaoInfo) UnmarshalJSON(input []byte) error

type DaoState

type DaoState struct {
	Type  DaoStateType `json:"type"`
	Value []uint64     `json:"value"`
}

func (*DaoState) UnmarshalJSON

func (e *DaoState) UnmarshalJSON(input []byte) error

type DaoStateType

type DaoStateType = string

type DaoWithdrawPayload

type DaoWithdrawPayload struct {
	From    []*Item `json:"from"`
	FeeRate uint64  `json:"fee_rate,omitempty"`
}

func (DaoWithdrawPayload) MarshalJSON

func (r DaoWithdrawPayload) MarshalJSON() ([]byte, error)

type Extension

type Extension struct {
	Name     string          `json:"name"`
	Scripts  []types.Script  `json:"scripts"`
	CellDeps []types.CellDep `json:"cell_deps"`
}

type ExtraFilter

type ExtraFilter struct {
	Type  ExtraFilterType `json:"type"`
	Value *DaoInfo        `json:"value,omitempty"`
}

type ExtraFilterType

type ExtraFilterType string

type GetAccountInfoPayload

type GetAccountInfoPayload struct {
	Item      *Item      `json:"item"`
	AssetInfo *AssetInfo `json:"asset_info"`
}

type GetBalancePayload

type GetBalancePayload struct {
	AssetInfos     []*AssetInfo     `json:"asset_infos"`
	TipBlockNumber uint64           `json:"tip_block_number,omitempty"`
	Item           *Item            `json:"item"`
	Extra          *ExtraFilterType `json:"extra,omitempty"`
}

func (GetBalancePayload) MarshalJSON

func (r GetBalancePayload) MarshalJSON() ([]byte, error)

type GetBalanceResponse

type GetBalanceResponse struct {
	Balances       []*Balance `json:"balances"`
	TipBlockNumber uint64     `json:"tip_block_number"`
}

func (*GetBalanceResponse) UnmarshalJSON

func (r *GetBalanceResponse) UnmarshalJSON(input []byte) error

type GetBlockInfoPayload

type GetBlockInfoPayload struct {
	BlockNumber uint64     `json:"block_number,omitempty"`
	BlockHash   types.Hash `json:"block_hash,omitempty"`
}

func (GetBlockInfoPayload) MarshalJSON

func (r GetBlockInfoPayload) MarshalJSON() ([]byte, error)

type GetSpentTransactionPayload

type GetSpentTransactionPayload struct {
	OutPoint      types.OutPoint `json:"outpoint"`
	StructureType StructureType  `json:"structure_type"`
}

type GetTransactionInfoResponse

type GetTransactionInfoResponse struct {
	Transaction *TransactionInfo        `json:"transaction,omitempty"`
	Status      types.TransactionStatus `json:"status"`
}

type IoType

type IoType string

type Item

type Item struct {
	Type  ItemType    `json:"type"`
	Value interface{} `json:"value"`
}

func NewAddressItem

func NewAddressItem(addr string) (*Item, error)

func NewIdentityItemByAddress

func NewIdentityItemByAddress(address string) (*Item, error)

func NewIdentityItemByCkb

func NewIdentityItemByCkb(publicKeyHash string) (*Item, error)

func NewIdentityItemByPublicKeyHash

func NewIdentityItemByPublicKeyHash(publicKeyHash string) (*Item, error)

func NewOutPointItem

func NewOutPointItem(txHash types.Hash, index uint) *Item

type ItemType

type ItemType string

type MercuryInfo

type MercuryInfo struct {
	MercuryVersion    string      `json:"mercury_version"`
	CkbNodeVersion    string      `json:"ckb_node_version"`
	NetworkType       NetworkType `json:"network_type"`
	EnabledExtensions []Extension `json:"enabled_extensions"`
}

type MercurySyncState

type MercurySyncState struct {
	State    SyncState `json:"type"`
	SyncInfo struct {
		Current  uint64 `json:"current"`
		Target   uint64 `json:"target"`
		Progress uint64 `json:"progress"`
	} `json:"sync_info,omitempty"`
}

type NetworkType

type NetworkType string

type Order

type Order string

type OutputCapacityProvider

type OutputCapacityProvider string

type PaginationRequest

type PaginationRequest struct {
	Cursor      uint64 `json:"cursor,omitempty"`
	Order       Order  `json:"order"`
	Limit       uint64 `json:"limit,omitempty"`
	ReturnCount bool   `json:"return_count"`
}

func (PaginationRequest) MarshalJSON

func (r PaginationRequest) MarshalJSON() ([]byte, error)

type PaginationResponseTransactionInfo

type PaginationResponseTransactionInfo struct {
	Response   []*TransactionInfoWrapper `json:"response"`
	Count      *uint64                   `json:"count,omitempty"`
	NextCursor *uint64                   `json:"next_cursor,omitempty"`
}

func (*PaginationResponseTransactionInfo) UnmarshalJSON

func (r *PaginationResponseTransactionInfo) UnmarshalJSON(input []byte) error

type PaginationResponseTransactionWithRichStatus

type PaginationResponseTransactionWithRichStatus struct {
	Response   []*TransactionWithRichStatusWrapper `json:"response"`
	Count      *uint64                             `json:"count,omitempty"`
	NextCursor *uint64                             `json:"next_cursor,omitempty"`
}

func (*PaginationResponseTransactionWithRichStatus) UnmarshalJSON

func (r *PaginationResponseTransactionWithRichStatus) UnmarshalJSON(input []byte) error

type PayFee

type PayFee string

type QueryTransactionsPayload

type QueryTransactionsPayload struct {
	Item          *Item              `json:"item"`
	AssetInfos    []*AssetInfo       `json:"asset_infos"`
	Extra         *ExtraFilterType   `json:"extra,omitempty"`
	BlockRange    *BlockRange        `json:"block_range,omitempty"`
	Pagination    *PaginationRequest `json:"pagination"`
	StructureType StructureType      `json:"structure_type"`
}

type Record

type Record struct {
	OutPoint    *types.OutPoint `json:"out_point"`
	Ownership   string          `json:"ownership"`
	IoType      IoType          `json:"io_type"`
	Amount      *big.Int        `json:"amount"`
	Occupied    *big.Int        `json:"occupied"`
	AssetInfo   *AssetInfo      `json:"asset_info"`
	Extra       *ExtraFilter    `json:"extra,omitempty"`
	BlockNumber uint64          `json:"block_number"`
	EpochNumber uint64          `json:"epoch_number"`
}

func (*Record) UnmarshalJSON

func (r *Record) UnmarshalJSON(input []byte) error

type SimpleTransferPayload

type SimpleTransferPayload struct {
	AssetInfo *AssetInfo   `json:"asset_info"`
	From      []string     `json:"from"`
	To        []*ToInfo    `json:"to"`
	FeeRate   uint64       `json:"fee_rate,omitempty"`
	Since     *SinceConfig `json:"since,omitempty"`
}

func (SimpleTransferPayload) MarshalJSON

func (r SimpleTransferPayload) MarshalJSON() ([]byte, error)

type SinceConfig

type SinceConfig struct {
	Flag  SinceFlag `json:"flag"`
	Type  SinceType `json:"type_"`
	Value uint64    `json:"value"`
}

func (SinceConfig) MarshalJSON

func (r SinceConfig) MarshalJSON() ([]byte, error)

type SinceFlag

type SinceFlag string

type SinceType

type SinceType string

type StructureType

type StructureType string

type SyncState

type SyncState string

type ToInfo

type ToInfo struct {
	Address string   `json:"address"`
	Amount  *big.Int `json:"amount"`
}

func (ToInfo) MarshalJSON

func (r ToInfo) MarshalJSON() ([]byte, error)

type TransactionInfo

type TransactionInfo struct {
	TxHash    types.Hash  `json:"tx_hash"`
	Records   []*Record   `json:"records"`
	Fee       uint64      `json:"fee"`
	Burn      []*BurnInfo `json:"burn"`
	Timestamp uint64      `json:"timestamp"`
}

func (*TransactionInfo) UnmarshalJSON

func (r *TransactionInfo) UnmarshalJSON(input []byte) error

type TransactionInfoWrapper

type TransactionInfoWrapper struct {
	Type  TxViewType       `json:"type"`
	Value *TransactionInfo `json:"value"`
}

type TransactionWithRichStatus

type TransactionWithRichStatus struct {
	Transaction *types.Transaction `json:"transaction,omitempty"`
	TxStatus    TxRichStatus       `json:"tx_status"`
}

type TransactionWithRichStatusWrapper

type TransactionWithRichStatusWrapper struct {
	Type  TxViewType                 `json:"type"`
	Value *TransactionWithRichStatus `json:"value"`
}

type TransferPayload

type TransferPayload struct {
	AssetInfo              *AssetInfo             `json:"asset_info,omitempty"`
	From                   []*Item                `json:"from"`
	To                     []*ToInfo              `json:"to"`
	OutputCapacityProvider OutputCapacityProvider `json:"output_capacity_provider,omitempty"`
	PayFee                 PayFee                 `json:"pay_fee,omitempty"`
	FeeRate                uint64                 `json:"fee_rate,omitempty"`
	Since                  *SinceConfig           `json:"since,omitempty"`
}

func (TransferPayload) MarshalJSON

func (r TransferPayload) MarshalJSON() ([]byte, error)

type TxRichStatus

type TxRichStatus struct {
	Status    types.TransactionStatus `json:"status"`
	BlockHash *types.Hash             `json:"block_hash,omitempty"`
	Reason    *string                 `json:"reason,omitempty"`
	Timestamp *uint64                 `json:"timestamp,omitempty"`
}

func (*TxRichStatus) UnmarshalJSON

func (r *TxRichStatus) UnmarshalJSON(input []byte) error

type TxViewType

type TxViewType string

Jump to

Keyboard shortcuts

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