types

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	QueryTypeUnknown      = QueryType(iota)
	QueryTypeUrl          // Query by Url
	QueryTypeChainId      // Query by chain id
	QueryTypeTxId         // Query tx and pending chains By TxId
	QueryTypeTxHistory    // Query transaction history
	QueryTypeDirectoryUrl // Query directory by URL
	QueryTypeData         // Query a specific data entry using the url and optional entry hash
	QueryTypeDataSet      // Query a set of data given pagination parameters for a given URL
	QueryTypeKeyPageIndex // Query key page index
)

QueryType enumeration order matters, do not change order when adding new enums.

Variables

View Source
var (
	QueryTypeName = map[QueryType]string{
		QueryTypeUnknown:      "QueryTypeUnknown",
		QueryTypeUrl:          "QueryTypeUrl",
		QueryTypeChainId:      "QueryTypeChainId",
		QueryTypeTxId:         "QueryTypeTxId",
		QueryTypeTxHistory:    "QueryTypeTxHistory",
		QueryTypeDirectoryUrl: "QueryTypeDirectoryUrl",
		QueryTypeData:         "QueryTypeData",
		QueryTypeDataSet:      "QueryTypeDataSet",
		QueryTypeKeyPageIndex: "QueryTypeKeyPageIndex",
	}
	QueryTypeValue = map[string]QueryType{
		"QueryTypeUnknown":      QueryTypeUnknown,
		"QueryTypeUrl":          QueryTypeUrl,
		"QueryTypeChainId":      QueryTypeChainId,
		"QueryTypeTxId":         QueryTypeTxId,
		"QueryTypeTxHistory":    QueryTypeTxHistory,
		"QueryTypeDirectoryUrl": QueryTypeDirectoryUrl,
		"QueryTypeData":         QueryTypeData,
		"QueryTypeDataSet":      QueryTypeDataSet,
		"QueryTypeKeyPageIndex": QueryTypeKeyPageIndex,
	}
)

Enum value maps for QueryType.

Functions

func CreateKeyPair

func CreateKeyPair() ed25519.PrivKey

CreateKeyPair generic helper function to create an ed25519 key pair

func CreateKeyPairFromSeed

func CreateKeyPairFromSeed(seed ed25519.PrivKey) (ret ed25519.PrivKey)

func GetAddressFromIdentity deprecated

func GetAddressFromIdentity(name *string) uint64

GetAddressFromIdentity return the address used for bvc routing.

Deprecated: use ./internal/url.URL.Routing()

func GetAddressFromIdentityChain deprecated

func GetAddressFromIdentityChain(identitychain []byte) uint64

GetAddressFromIdentityChain gets the 8-bit address from the identity chain. Used for bvc routing.

Deprecated: use ./internal/url.URL.Routing()

func MarshalBinaryLedgerAdiChainPath

func MarshalBinaryLedgerAdiChainPath(adiChainPath string, payload []byte, timestamp int64) []byte

MarshalBinaryLedgerAdiChainPath adiChainPath == adi/chain/path This function will generate a ledger needed for ed25519 signing or sha256 hashed to produce TXID

func MarshalBinaryLedgerChainId

func MarshalBinaryLedgerChainId(chainId []byte, payload []byte, timestamp int64) []byte

MarshalBinaryLedgerChainId create a ledger that can be used for signing or generating a txid

func ParseIdentityChainPath deprecated

func ParseIdentityChainPath(adiChainPath *string) (adi string, chainPath string, err error)

ParseIdentityChainPath helpful parser to extract the identity name and chainpath. For example RedWagon/MyAccAddress becomes identity=redwagon and chainpath=redwagon/MyAccAddress.

Deprecated: use ./internal/url.Parse

Types

type AccountType added in v0.4.0

type AccountType uint64

AccountType is the type of an account.

const (
	// AccountTypeUnknown represents an unknown account type.
	AccountTypeUnknown AccountType = 0

	// AccountTypeAnchor is one or more Merkle DAG anchors.
	AccountTypeAnchor AccountType = 1

	// AccountTypeIdentity is an Identity account, aka an ADI.
	AccountTypeIdentity AccountType = 2

	// AccountTypeTokenIssuer is a Token Issuer account.
	AccountTypeTokenIssuer AccountType = 3

	// AccountTypeTokenAccount is an ADI Token Account.
	AccountTypeTokenAccount AccountType = 4

	// AccountTypeLiteTokenAccount is a Lite Token Account.
	AccountTypeLiteTokenAccount AccountType = 5

	// AccountTypeTransaction is a completed transaction.
	AccountTypeTransaction AccountType = 7

	// AccountTypePendingTransaction is a pending transaction.
	AccountTypePendingTransaction AccountType = 8

	// AccountTypeKeyPage is a Key Page account.
	AccountTypeKeyPage AccountType = 9

	// AccountTypeKeyBook is a Key Book account.
	AccountTypeKeyBook AccountType = 10

	// AccountTypeDataAccount is an ADI Data Account.
	AccountTypeDataAccount AccountType = 11

	// AccountTypeLiteDataAccount is a Lite Data Account.
	AccountTypeLiteDataAccount AccountType = 12

	// AccountTypeInternalLedger is a ledger that tracks the state of internal
	// operations.
	AccountTypeInternalLedger AccountType = 14
)

func (AccountType) ID added in v0.4.0

func (t AccountType) ID() uint64

ID returns the account type ID

func (AccountType) IsTransaction added in v0.4.0

func (t AccountType) IsTransaction() bool

IsTransaction returns true if the account type is a transaction.

func (AccountType) MarshalJSON added in v0.4.0

func (t AccountType) MarshalJSON() ([]byte, error)

func (AccountType) Name added in v0.4.0

func (t AccountType) Name() string

Name is an alias for String Deprecated: use String

func (AccountType) String added in v0.4.0

func (t AccountType) String() string

String returns the name of the account type

func (*AccountType) UnmarshalJSON added in v0.4.0

func (t *AccountType) UnmarshalJSON(data []byte) error

type Amount

type Amount struct {
	big.Int
}

func NewAmount

func NewAmount(v int64) *Amount

func (*Amount) AsBigInt

func (a *Amount) AsBigInt() *big.Int

func (*Amount) Div

func (a *Amount) Div(v int64)

func (*Amount) MarshalBinary

func (a *Amount) MarshalBinary() ([]byte, error)

func (*Amount) MarshalJSON

func (s *Amount) MarshalJSON() ([]byte, error)

MarshalJSON serializes ByteArray to hex

func (*Amount) Mul

func (a *Amount) Mul(v int64)

func (*Amount) Size

func (a *Amount) Size() int

func (*Amount) UnmarshalBinary

func (a *Amount) UnmarshalBinary(data []byte) error

func (*Amount) UnmarshalJSON

func (s *Amount) UnmarshalJSON(data []byte) error

UnmarshalJSON serializes ByteArray to hex

type AtomicBool

type AtomicBool int32

func (*AtomicBool) Load

func (a *AtomicBool) Load() (v bool)

func (*AtomicBool) Store

func (a *AtomicBool) Store(x bool)

type ByByteArray

type ByByteArray [][]byte

------------------------------------------------ Byte array sorting - ascending

func (ByByteArray) Len

func (f ByByteArray) Len() int

func (ByByteArray) Less

func (f ByByteArray) Less(i, j int) bool

func (ByByteArray) Swap

func (f ByByteArray) Swap(i, j int)

type Byte

type Byte byte

func (*Byte) MarshalBinary

func (s *Byte) MarshalBinary() ([]byte, error)

func (*Byte) UnmarshalBinary

func (s *Byte) UnmarshalBinary(data []byte) error

type Bytes

type Bytes []byte

func (Bytes) AsBytes32

func (s Bytes) AsBytes32() (ret Bytes32)

func (Bytes) AsBytes64

func (s Bytes) AsBytes64() (ret Bytes64)

func (*Bytes) Bytes

func (s *Bytes) Bytes() []byte

func (*Bytes) MarshalBinary

func (s *Bytes) MarshalBinary() ([]byte, error)

func (*Bytes) MarshalJSON

func (s *Bytes) MarshalJSON() ([]byte, error)

MarshalJSON serializes ByteArray to hex

func (*Bytes) Size

func (s *Bytes) Size(varintbuf *[8]byte) int

func (*Bytes) UnmarshalBinary

func (s *Bytes) UnmarshalBinary(data []byte) (err error)

func (*Bytes) UnmarshalJSON

func (s *Bytes) UnmarshalJSON(data []byte) error

UnmarshalJSON serializes ByteArray to hex

type Bytes32

type Bytes32 [32]byte

Bytes32 is a fixed array of 32 bytes

func GetChainIdFromChainPath deprecated

func GetChainIdFromChainPath(adiChainPath *string) *Bytes32

GetChainIdFromChainPath expects an identity chain path to produce the chainid, e.g. "RedWagon/Acc/Chain/Path".

Deprecated: use ./internal/url.URL.ResourceChain()

func GetIdentityChainFromIdentity deprecated

func GetIdentityChainFromIdentity(adi *string) *Bytes32

GetIdentityChainFromIdentity generates an identity chain from ADI. Returns nil if the ADI is malformed.

Deprecated: use ./internal/url.URL.IdentityChain()

func (*Bytes32) AsByteArray

func (s *Bytes32) AsByteArray() [32]byte

func (*Bytes32) Bytes

func (s *Bytes32) Bytes() []byte

Bytes returns the bite slice of the 32 byte array

func (*Bytes32) FromBytes

func (s *Bytes32) FromBytes(b []byte) error

FromBytes sets the byte array.

func (*Bytes32) FromString

func (s *Bytes32) FromString(str string) error

FromString takes a hex encoded string and sets the byte array. The input parameter, str, must be 64 hex characters in length

func (*Bytes32) MarshalJSON

func (s *Bytes32) MarshalJSON() ([]byte, error)

MarshalJSON serializes ByteArray to hex

func (*Bytes32) ToString

func (s *Bytes32) ToString() String

ToString will convert the 32 byte array into a hex string that is 64 hex characters in length

func (*Bytes32) UnmarshalJSON

func (s *Bytes32) UnmarshalJSON(data []byte) error

UnmarshalJSON serializes ByteArray to hex

type Bytes64

type Bytes64 [64]byte

Bytes64 is a fixed array of 32 bytes

func (Bytes64) Bytes

func (s Bytes64) Bytes() []byte

Bytes returns the bite slice of the 32 byte array

func (*Bytes64) FromBytes

func (s *Bytes64) FromBytes(b []byte) error

FromBytes sets the byte array.

func (*Bytes64) FromString

func (s *Bytes64) FromString(str string) error

FromString takes a hex encoded string and sets the byte array. The input parameter, str, must be 64 hex characters in length

func (*Bytes64) MarshalJSON

func (s *Bytes64) MarshalJSON() ([]byte, error)

MarshalJSON serializes ByteArray to hex

func (*Bytes64) ToString

func (s *Bytes64) ToString() String

ToString will convert the 32 byte array into a hex string that is 64 hex characters in length

func (*Bytes64) UnmarshalJSON

func (s *Bytes64) UnmarshalJSON(data []byte) error

UnmarshalJSON serializes ByteArray to hex

type QueryType

type QueryType uint64

func (QueryType) AsUint64

func (t QueryType) AsUint64() uint64

AsUint64 casts as a uint64

func (QueryType) Name

func (t QueryType) Name() string

Name will return the name of the type

func (*QueryType) SetType

func (t *QueryType) SetType(s string)

SetType will set the type based on the string name submitted

func (QueryType) String

func (t QueryType) String() string

type String

type String string

func (*String) AsString

func (s *String) AsString() *string

func (*String) MarshalBinary

func (s *String) MarshalBinary() ([]byte, error)

func (*String) MarshalJSON

func (s *String) MarshalJSON() ([]byte, error)

func (*String) Size

func (s *String) Size(varintbuf *[8]byte) int

func (*String) UnmarshalBinary

func (s *String) UnmarshalBinary(data []byte) error

func (*String) UnmarshalJSON

func (s *String) UnmarshalJSON(data []byte) error

type TransactionType

type TransactionType uint64

TransactionType is the type of a transaction.

const (
	// TxTypeCreateIdentity creates an ADI, which produces a synthetic chain
	// create transaction.
	TxTypeCreateIdentity TransactionType = 0x01

	// TxTypeCreateTokenAccount creates an ADI token account, which produces a
	// synthetic chain create transaction.
	TxTypeCreateTokenAccount TransactionType = 0x02

	// TxTypeSendTokens transfers tokens between token accounts, which produces
	// a synthetic deposit tokens transaction.
	TxTypeSendTokens TransactionType = 0x03

	// TxTypeCreateDataAccount creates an ADI Data Account, which produces a
	// synthetic chain create transaction.
	TxTypeCreateDataAccount TransactionType = 0x04

	// TxTypeWriteData writes data to an ADI Data Account, which *does not*
	// produce a synthetic transaction.
	TxTypeWriteData TransactionType = 0x05

	// TxTypeWriteDataTo writes data to a Lite Data Account, which produces a
	// synthetic write data transaction.
	TxTypeWriteDataTo TransactionType = 0x06

	// TxTypeAcmeFaucet produces a synthetic deposit tokens transaction that
	// deposits ACME tokens into a lite account.
	TxTypeAcmeFaucet TransactionType = 0x07

	// TxTypeCreateToken creates a token issuer, which produces a synthetic
	// chain create transaction.
	TxTypeCreateToken TransactionType = 0x08

	// TxTypeIssueTokens issues tokens to a token account, which produces a
	// synthetic token deposit transaction.
	TxTypeIssueTokens TransactionType = 0x09

	// TxTypeBurnTokens burns tokens from a token account, which produces a
	// synthetic burn tokens transaction.
	TxTypeBurnTokens TransactionType = 0x0A

	// TxTypeCreateKeyPage creates a key page, which produces a synthetic chain
	// create transaction.
	TxTypeCreateKeyPage TransactionType = 0x0C

	// TxTypeCreateKeyBook creates a key book, which produces a synthetic chain
	// create transaction.
	TxTypeCreateKeyBook TransactionType = 0x0D

	// TxTypeAddCredits converts ACME tokens to credits, which produces a
	// synthetic deposit credits transaction.
	TxTypeAddCredits TransactionType = 0x0E

	// TxTypeUpdateKeyPage adds, removes, or updates keys in a key page, which
	// *does not* produce a synthetic transaction.
	TxTypeUpdateKeyPage TransactionType = 0x0F

	// TxTypeSignPending is used to sign a pending transaction.
	TxTypeSignPending TransactionType = 0x30
)

User transactions

const (
	// TxTypeSyntheticCreateChain creates or updates chains.
	TxTypeSyntheticCreateChain TransactionType = 0x31

	// TxTypeSyntheticWriteData writes data to a data account.
	TxTypeSyntheticWriteData TransactionType = 0x32

	// TxTypeSyntheticDepositTokens deposits tokens into token accounts.
	TxTypeSyntheticDepositTokens TransactionType = 0x33

	// TxTypeSyntheticAnchor anchors one network to another.
	TxTypeSyntheticAnchor TransactionType = 0x34

	// TxTypeSyntheticDepositCredits deposits credits into a credit holder.
	TxTypeSyntheticDepositCredits TransactionType = 0x35

	// TxTypeSyntheticBurnTokens returns tokens to a token issuer's pool of
	// issuable tokens.
	TxTypeSyntheticBurnTokens TransactionType = 0x36

	// TxTypeSyntheticMirror mirrors records from one network to another.
	TxTypeSyntheticMirror TransactionType = 0x38

	// TxTypeSegWitDataEntry is a surrogate transaction segregated witness for
	// a WriteData transaction
	TxTypeSegWitDataEntry TransactionType = 0x39
)

Synthetic transactions

const (
	// TxTypeInternalGenesis initializes system chains.
	TxTypeInternalGenesis TransactionType = 0x60

	TxTypeInternalSendTransactions TransactionType = 0x61

	// TxTypeInternalTransactionsSigned notifies the executor of synthetic
	// transactions that have been signed.
	TxTypeInternalTransactionsSigned TransactionType = 0x62

	// TxTypeInternalTransactionsSent notifies the executor of synthetic
	// transactions that have been sent.
	TxTypeInternalTransactionsSent TransactionType = 0x63
)
const (
	// TxTypeUnknown represents an unknown transaction type.
	TxTypeUnknown TransactionType = 0x00
)

func (TransactionType) BinarySize added in v0.4.0

func (t TransactionType) BinarySize() int

func (TransactionType) ID

func (t TransactionType) ID() uint64

ID returns the transaction type ID

func (TransactionType) IsInternal added in v0.4.0

func (t TransactionType) IsInternal() bool

IsInternal returns true if the transaction type is internal.

func (TransactionType) IsSynthetic

func (t TransactionType) IsSynthetic() bool

IsSynthetic returns true if the transaction type is synthetic.

func (TransactionType) IsUser added in v0.4.0

func (t TransactionType) IsUser() bool

IsUser returns true if the transaction type is user.

func (TransactionType) MarshalBinary added in v0.4.0

func (t TransactionType) MarshalBinary() ([]byte, error)

func (TransactionType) MarshalJSON

func (t TransactionType) MarshalJSON() ([]byte, error)

func (TransactionType) Name

func (t TransactionType) Name() string

Name is an alias for String Deprecated: use String

func (TransactionType) String

func (t TransactionType) String() string

String returns the name of the transaction type

func (*TransactionType) UnmarshalBinary added in v0.4.0

func (t *TransactionType) UnmarshalBinary(data []byte) error

func (*TransactionType) UnmarshalJSON

func (t *TransactionType) UnmarshalJSON(data []byte) error

type TxType

type TxType = TransactionType

TxType is an alias for TransactionType Deprecated: use TransactionType

type UrlAdi

type UrlAdi struct {
	String
}

func (*UrlAdi) IsValid

func (s *UrlAdi) IsValid() bool

func (*UrlAdi) Parse

func (s *UrlAdi) Parse() (string, string, error)

type UrlChain

type UrlChain struct {
	String
}

func (*UrlChain) IsValid

func (s *UrlChain) IsValid() error

func (*UrlChain) MarshalJSON

func (s *UrlChain) MarshalJSON() ([]byte, error)

func (*UrlChain) Parse

func (s *UrlChain) Parse() (string, string, error)

func (*UrlChain) UnmarshalJSON

func (s *UrlChain) UnmarshalJSON(data []byte) error

UnmarshalJSON serializes ByteArray to hex

Directories

Path Synopsis
api

Jump to

Keyboard shortcuts

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