sdk

package
v0.0.0-...-79c6f9a Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2018 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Overview

Package sdk provides a client library for the Catapult REST API.

Index

Constants

View Source
const NUM_CHECKSUM_BYTES = 4

Variables

View Source
var TimestampNemesisBlock = time.Unix(1459468800, 0)
View Source
var XemMosaicId, _ = NewMosaicId(nil, "nem:xem")

Functions

func BigIntegerToHex

func BigIntegerToHex(id *big.Int) string

analog JAVA Uint64.bigIntegerToHex

func ExtractVersion

func ExtractVersion(version uint64) (uint64, error)

func FromBigInt

func FromBigInt(int *big.Int) []uint32

func GenerateChecksum

func GenerateChecksum(b []byte) ([]byte, error)

func GenerateNamespacePath

func GenerateNamespacePath(name string) ([]*big.Int, error)

GenerateNamespacePath create list NamespaceId from string

Types

type Account

type Account struct {
	*PublicAccount
	*crypto.KeyPair
}

func NewAccount

func NewAccount(pKey string, networkType NetworkType) (*Account, error)

func (*Account) Sign

func (a *Account) Sign(tx Transaction) (*SignedTransaction, error)

Sign a transaction

func (*Account) SignCosignatureTransaction

func (a *Account) SignCosignatureTransaction(tx *CosignatureTransaction) (*CosignatureSignedTransaction, error)

Sign aggregate signature transaction

func (*Account) SignWithCosignatures

func (a *Account) SignWithCosignatures(tx *AggregateTransaction, cosignatories []*Account) (*SignedTransaction, error)

Sign transaction with cosignatories creating a new SignedTransaction

type AccountInfo

type AccountInfo struct {
	Address          *Address
	AddressHeight    *big.Int
	PublicKey        string
	PublicKeyHeight  *big.Int
	Importance       *big.Int
	ImportanceHeight *big.Int
	Mosaics          []*Mosaic
}

func (*AccountInfo) String

func (tx *AccountInfo) String() string

type AccountService

type AccountService service

func (*AccountService) AggregateBondedTransactions

func (a *AccountService) AggregateBondedTransactions(ctx context.Context, account *PublicAccount, opt *AccountTransactionsOption) ([]*AggregateTransaction, *http.Response, error)

Gets an array of transactions for which an account is the sender or has sign the transaction. A transaction is said to be aggregate bonded with respect to an account if there are missing signatures.

func (*AccountService) GetAccountInfo

func (a *AccountService) GetAccountInfo(ctx context.Context, address *Address) (*AccountInfo, *http.Response, error)

func (*AccountService) GetAccountsInfo

func (a *AccountService) GetAccountsInfo(ctx context.Context, addresses []*Address) ([]*AccountInfo, *http.Response, error)

Gets AccountsInfo for different accounts.

func (*AccountService) GetMultisigAccountGraphInfo

func (a *AccountService) GetMultisigAccountGraphInfo(ctx context.Context, address *Address) (*MultisigAccountGraphInfo, *http.Response, error)

Gets a MultisigAccountGraphInfo for an account.

func (*AccountService) GetMultisigAccountInfo

func (a *AccountService) GetMultisigAccountInfo(ctx context.Context, address *Address) (*MultisigAccountInfo, *http.Response, error)

Gets a MultisigAccountInfo for an account.

func (*AccountService) IncomingTransactions

func (a *AccountService) IncomingTransactions(ctx context.Context, account *PublicAccount, opt *AccountTransactionsOption) ([]Transaction, *http.Response, error)

Gets an array of transactions for which an account is the recipient of a transaction. A transaction is said to be incoming with respect to an account if the account is the recipient of a transaction.

func (*AccountService) OutgoingTransactions

func (a *AccountService) OutgoingTransactions(ctx context.Context, account *PublicAccount, opt *AccountTransactionsOption) ([]Transaction, *http.Response, error)

Gets an array of transactions for which an account is the sender a transaction. A transaction is said to be outgoing with respect to an account if the account is the sender of a transaction.

func (*AccountService) Transactions

Gets an array of confirmed transactions for which an account is signer or receiver.

func (*AccountService) UnconfirmedTransactions

func (a *AccountService) UnconfirmedTransactions(ctx context.Context, account *PublicAccount, opt *AccountTransactionsOption) ([]Transaction, *http.Response, error)

Gets the array of transactions for which an account is the sender or receiver and which have not yet been included in a block. Unconfirmed transactions are those transactions that have not yet been included in a block. Unconfirmed transactions are not guaranteed to be included in any block.

type AccountTransactionsOption

type AccountTransactionsOption struct {
	PageSize int    `url:"pageSize,omitempty"`
	Id       string `url:"id,omitempty"`
}

type Address

type Address struct {
	Type    NetworkType
	Address string
}

func NewAddress

func NewAddress(address string, networkType NetworkType) *Address

Create an Address from a given raw address

func NewAddressFromEncoded

func NewAddressFromEncoded(encoded string) (*Address, error)

func NewAddressFromPublicKey

func NewAddressFromPublicKey(pKey string, networkType NetworkType) (*Address, error)

Create an Address from a given raw address.

func NewAddressFromRaw

func NewAddressFromRaw(address string) (*Address, error)

func (*Address) Pretty

func (ad *Address) Pretty() string

type Addresses

type Addresses struct {
	List []*Address
	// contains filtered or unexported fields
}

func (*Addresses) AddAddress

func (ref *Addresses) AddAddress(address *Address)

func (*Addresses) GetAddress

func (ref *Addresses) GetAddress(i int) (*Address, error)

func (*Addresses) MarshalJSON

func (ref *Addresses) MarshalJSON() (buf []byte, err error)

func (*Addresses) UnmarshalJSON

func (ref *Addresses) UnmarshalJSON(buf []byte) error

type AggregateTransaction

type AggregateTransaction struct {
	InnerTransactions []Transaction
	Cosignatures      []*AggregateTransactionCosignature
	// contains filtered or unexported fields
}

AggregateTransaction

func NewBondedAggregateTransaction

func NewBondedAggregateTransaction(deadline *Deadline, innerTxs []Transaction, networkType NetworkType) (*AggregateTransaction, error)

func NewCompleteAggregateTransaction

func NewCompleteAggregateTransaction(deadline *Deadline, innerTxs []Transaction, networkType NetworkType) (*AggregateTransaction, error)

Create an aggregate complete transaction

func (*AggregateTransaction) GetAbstractTransaction

func (tx *AggregateTransaction) GetAbstractTransaction() *abstractTransaction

func (*AggregateTransaction) HasMissingSignatures

func (tx *AggregateTransaction) HasMissingSignatures() bool

func (*AggregateTransaction) IsConfirmed

func (tx *AggregateTransaction) IsConfirmed() bool

func (*AggregateTransaction) IsUnannounced

func (tx *AggregateTransaction) IsUnannounced() bool

func (*AggregateTransaction) IsUnconfirmed

func (tx *AggregateTransaction) IsUnconfirmed() bool

func (*AggregateTransaction) String

func (tx *AggregateTransaction) String() string

type AggregateTransactionCosignature

type AggregateTransactionCosignature struct {
	Signature string
	Signer    *PublicAccount
}

AggregateTransactionCosignature

func (*AggregateTransactionCosignature) String

type BlockInfo

type BlockInfo struct {
	NetworkType
	Hash                  string
	GenerationHash        string
	TotalFee              *big.Int
	NumTransactions       uint64
	Signature             string
	Signer                *PublicAccount
	Version               uint64
	Type                  uint64
	Height                *big.Int
	Timestamp             *big.Int
	Difficulty            *big.Int
	PreviousBlockHash     string
	BlockTransactionsHash string
}

Models Block

func (*BlockInfo) String

func (b *BlockInfo) String() string

type BlockchainService

type BlockchainService service

func (*BlockchainService) GetBlockByHeight

func (b *BlockchainService) GetBlockByHeight(ctx context.Context, height *big.Int) (*BlockInfo, *http.Response, error)

Get Block Height

func (*BlockchainService) GetBlockTransactions

func (b *BlockchainService) GetBlockTransactions(ctx context.Context, height *big.Int) ([]Transaction, *http.Response, error)

Get Transactions from a block information

func (*BlockchainService) GetBlockchainHeight

func (b *BlockchainService) GetBlockchainHeight(ctx context.Context) (*big.Int, *http.Response, error)

Get the Chain Height

func (*BlockchainService) GetBlockchainScore

func (b *BlockchainService) GetBlockchainScore(ctx context.Context) (*big.Int, *http.Response, error)

Get the Chain Score

func (*BlockchainService) GetBlockchainStorage

func (b *BlockchainService) GetBlockchainStorage(ctx context.Context) (*BlockchainStorageInfo, *http.Response, error)

Get the Storage Information

func (*BlockchainService) GetBlocksByHeightWithLimit

func (b *BlockchainService) GetBlocksByHeightWithLimit(ctx context.Context, height, limit *big.Int) ([]*BlockInfo, *http.Response, error)

GetBlocksByHeightWithLimit Returns blocks information for a given block height and limit

type BlockchainStorageInfo

type BlockchainStorageInfo struct {
	NumBlocks       int `json:"numBlocks"`
	NumTransactions int `json:"numTransactions"`
	NumAccounts     int `json:"numAccounts"`
}

Blockchain Storage

type Client

type Client struct {

	// Services for communicating to the Catapult REST APIs
	Blockchain  *BlockchainService
	Mosaic      *MosaicService
	Namespace   *NamespaceService
	Network     *NetworkService
	Transaction *TransactionService
	Account     *AccountService
	// contains filtered or unexported fields
}

Catapult API Client configuration

func NewClient

func NewClient(httpClient *http.Client, conf *Config) *Client

NewClient returns a new Catapult API client. If httpClient is nil then it will create http.DefaultClient

func (*Client) Do

func (c *Client) Do(ctx context.Context, req *http.Request, v interface{}) (*http.Response, error)

Do sends an API Request and returns a parsed response

func (*Client) DoNewRequest

func (s *Client) DoNewRequest(ctx context.Context, method string, path string, body interface{}, v interface{}) (*http.Response, error)

DoNewRequest creates new request, Do it & return result in V

func (*Client) NewRequest

func (c *Client) NewRequest(method, urlStr string, body interface{}) (*http.Request, error)

type ClientWs

type ClientWs struct {
	Uid string

	Subscribe *SubscribeService
	// contains filtered or unexported fields
}

Catapult Websocket Client configuration

func NewConnectWs

func NewConnectWs(host string) (*ClientWs, error)

type Config

type Config struct {
	BaseURL *url.URL
	NetworkType
}

Provides service configuration

func LoadMainnetConfig

func LoadMainnetConfig(baseUrl string) (*Config, error)

Mainnet config default

func LoadTestnetConfig

func LoadTestnetConfig(baseUrl string) (*Config, error)

Testnet config default

type CosignatureSignedTransaction

type CosignatureSignedTransaction struct {
	ParentHash string `json:"parentHash"`
	Signature  string `json:"signature"`
	Signer     string `json:"signer"`
}

CosignatureSignedTransaction

type CosignatureTransaction

type CosignatureTransaction struct {
	TransactionToCosign *AggregateTransaction
}

func NewCosignatureTransaction

func NewCosignatureTransaction(txToCosign *AggregateTransaction) (*CosignatureTransaction, error)

func (*CosignatureTransaction) String

func (tx *CosignatureTransaction) String() string

type Deadline

type Deadline struct {
	time.Time
}

Deadline

func NewDeadline

func NewDeadline(d time.Duration) *Deadline

Create deadline model

func (*Deadline) GetInstant

func (d *Deadline) GetInstant() int64

type HashType

type HashType uint8
const SHA3_512 HashType = 0

func (HashType) String

func (ht HashType) String() string

type ListNamespaceInfo

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

ListNamespaceInfo is a list NamespaceInfo

type LockFundsTransaction

type LockFundsTransaction struct {
	*Mosaic
	Duration *big.Int
	*SignedTransaction
	// contains filtered or unexported fields
}

LockFundsTransaction

func NewLockFundsTransaction

func NewLockFundsTransaction(deadline *Deadline, mosaic *Mosaic, duration *big.Int, signedTx *SignedTransaction, networkType NetworkType) (*LockFundsTransaction, error)

func (*LockFundsTransaction) GetAbstractTransaction

func (tx *LockFundsTransaction) GetAbstractTransaction() *abstractTransaction

func (*LockFundsTransaction) HasMissingSignatures

func (tx *LockFundsTransaction) HasMissingSignatures() bool

func (*LockFundsTransaction) IsConfirmed

func (tx *LockFundsTransaction) IsConfirmed() bool

func (*LockFundsTransaction) IsUnannounced

func (tx *LockFundsTransaction) IsUnannounced() bool

func (*LockFundsTransaction) IsUnconfirmed

func (tx *LockFundsTransaction) IsUnconfirmed() bool

func (*LockFundsTransaction) String

func (tx *LockFundsTransaction) String() string

type Message

type Message struct {
	Type    uint8
	Payload string
}

Message

func NewPlainMessage

func NewPlainMessage(payload string) *Message

The transaction message of 1024 characters.

func (*Message) String

func (m *Message) String() string

type ModifyMultisigAccountTransaction

type ModifyMultisigAccountTransaction struct {
	MinApprovalDelta int32
	MinRemovalDelta  int32
	Modifications    []*MultisigCosignatoryModification
	// contains filtered or unexported fields
}

ModifyMultisigAccountTransaction

func NewModifyMultisigAccountTransaction

func NewModifyMultisigAccountTransaction(deadline *Deadline, minApprovalDelta int32, minRemovalDelta int32, modifications []*MultisigCosignatoryModification, networkType NetworkType) (*ModifyMultisigAccountTransaction, error)

func (*ModifyMultisigAccountTransaction) GetAbstractTransaction

func (tx *ModifyMultisigAccountTransaction) GetAbstractTransaction() *abstractTransaction

func (*ModifyMultisigAccountTransaction) HasMissingSignatures

func (tx *ModifyMultisigAccountTransaction) HasMissingSignatures() bool

func (*ModifyMultisigAccountTransaction) IsConfirmed

func (tx *ModifyMultisigAccountTransaction) IsConfirmed() bool

func (*ModifyMultisigAccountTransaction) IsUnannounced

func (tx *ModifyMultisigAccountTransaction) IsUnannounced() bool

func (*ModifyMultisigAccountTransaction) IsUnconfirmed

func (tx *ModifyMultisigAccountTransaction) IsUnconfirmed() bool

func (*ModifyMultisigAccountTransaction) String

type Mosaic

type Mosaic struct {
	MosaicId *MosaicId
	Amount   *big.Int
}

Mosaic

func NewMosaic

func NewMosaic(mosaicId *MosaicId, amount *big.Int) (*Mosaic, error)

func Xem

func Xem(amount int64) *Mosaic

Create xem with using xem as unit

func XemRelative

func XemRelative(amount int64) *Mosaic

func (*Mosaic) String

func (m *Mosaic) String() string

type MosaicDefinitionTransaction

type MosaicDefinitionTransaction struct {
	*MosaicProperties
	*NamespaceId
	*MosaicId
	MosaicName string
	// contains filtered or unexported fields
}

MosaicDefinitionTransaction

func NewMosaicDefinitionTransaction

func NewMosaicDefinitionTransaction(deadline *Deadline, mosaicName string, namespaceName string, mosaicProps *MosaicProperties, networkType NetworkType) (*MosaicDefinitionTransaction, error)

func (*MosaicDefinitionTransaction) GetAbstractTransaction

func (tx *MosaicDefinitionTransaction) GetAbstractTransaction() *abstractTransaction

func (*MosaicDefinitionTransaction) HasMissingSignatures

func (tx *MosaicDefinitionTransaction) HasMissingSignatures() bool

func (*MosaicDefinitionTransaction) IsConfirmed

func (tx *MosaicDefinitionTransaction) IsConfirmed() bool

func (*MosaicDefinitionTransaction) IsUnannounced

func (tx *MosaicDefinitionTransaction) IsUnannounced() bool

func (*MosaicDefinitionTransaction) IsUnconfirmed

func (tx *MosaicDefinitionTransaction) IsUnconfirmed() bool

func (*MosaicDefinitionTransaction) String

func (tx *MosaicDefinitionTransaction) String() string

type MosaicId

type MosaicId struct {
	Id       *big.Int
	FullName string
}

MosaicId

func NewMosaicId

func NewMosaicId(id *big.Int, name string) (*MosaicId, error)

type MosaicIds

type MosaicIds struct {
	MosaicIds []*MosaicId `json:"mosaicIds"`
}

MosaicIds is a list MosaicId

func (*MosaicIds) MarshalJSON

func (ref *MosaicIds) MarshalJSON() (buf []byte, err error)

type MosaicInfo

type MosaicInfo struct {
	Active      bool
	Index       int
	MetaId      string
	NamespaceId *NamespaceId
	MosaicId    *MosaicId
	Supply      *big.Int
	Height      *big.Int
	Owner       *PublicAccount
	Properties  *MosaicProperties
}

MosaicInfo info structure contains its properties, the owner and the namespace to which it belongs to.

type MosaicName

type MosaicName struct {
	MosaicId *MosaicId
	Name     string
	ParentId *NamespaceId
}

type MosaicProperties

type MosaicProperties struct {
	SupplyMutable bool
	Transferable  bool
	LevyMutable   bool
	Divisibility  int64
	Duration      *big.Int
}

MosaicProperties structure describes mosaic properties.

func NewMosaicProperties

func NewMosaicProperties(supplyMutable bool, transferable bool, levyMutable bool, divisibility int64, duration *big.Int) *MosaicProperties

func (*MosaicProperties) String

func (mp *MosaicProperties) String() string

type MosaicService

type MosaicService service

func (*MosaicService) GetMosaic

func (ref *MosaicService) GetMosaic(ctx context.Context, mosaicId MosaicId) (mscInfo *MosaicInfo, resp *http.Response, err error)

mosaics get mosaics Info @get /mosaic/{mosaicId}

func (*MosaicService) GetMosaicNames

func (ref *MosaicService) GetMosaicNames(ctx context.Context, mosaicIds MosaicIds) (mscNames []*MosaicName, resp *http.Response, err error)

GetMosaicNames Get readable names for a set of mosaics post @/mosaic/names

func (*MosaicService) GetMosaics

func (ref *MosaicService) GetMosaics(ctx context.Context, mosaicIds MosaicIds) (mscInfoArr MosaicsInfo, resp *http.Response, err error)

GetMosaics get list mosaics Info post @/mosaic/

func (*MosaicService) GetMosaicsFromNamespace

func (ref *MosaicService) GetMosaicsFromNamespace(ctx context.Context, namespaceId *NamespaceId, mosaicId *MosaicId,
	pageSize int) (mscInfo []*MosaicInfo, resp *http.Response, err error)

GetMosaicsFromNamespace Get mosaics information from namespaceId (nsId) get @/namespaces/{namespaceId}/mosaic/

type MosaicSupplyChangeTransaction

type MosaicSupplyChangeTransaction struct {
	MosaicSupplyType
	*MosaicId
	Delta *big.Int
	// contains filtered or unexported fields
}

MosaicSupplyChangeTransaction

func NewMosaicSupplyChangeTransaction

func NewMosaicSupplyChangeTransaction(deadline *Deadline, mosaicId *MosaicId, supplyType MosaicSupplyType, delta *big.Int, networkType NetworkType) (*MosaicSupplyChangeTransaction, error)

func (*MosaicSupplyChangeTransaction) GetAbstractTransaction

func (tx *MosaicSupplyChangeTransaction) GetAbstractTransaction() *abstractTransaction

func (*MosaicSupplyChangeTransaction) HasMissingSignatures

func (tx *MosaicSupplyChangeTransaction) HasMissingSignatures() bool

func (*MosaicSupplyChangeTransaction) IsConfirmed

func (tx *MosaicSupplyChangeTransaction) IsConfirmed() bool

func (*MosaicSupplyChangeTransaction) IsUnannounced

func (tx *MosaicSupplyChangeTransaction) IsUnannounced() bool

func (*MosaicSupplyChangeTransaction) IsUnconfirmed

func (tx *MosaicSupplyChangeTransaction) IsUnconfirmed() bool

func (*MosaicSupplyChangeTransaction) String

type MosaicSupplyType

type MosaicSupplyType uint8

MosaicSupplyType mosaic supply type : Decrease the supply - DECREASE. Increase the supply - INCREASE.

const (
	Decrease MosaicSupplyType = iota
	Increase
)

func (MosaicSupplyType) String

func (tx MosaicSupplyType) String() string

type Mosaics

type Mosaics []*Mosaic

Mosaics

func (Mosaics) String

func (ref Mosaics) String() string

type MosaicsInfo

type MosaicsInfo []*MosaicInfo

func (MosaicsInfo) String

func (ref MosaicsInfo) String() string

type MultisigAccountGraphInfo

type MultisigAccountGraphInfo struct {
	MultisigAccounts map[int32][]*MultisigAccountInfo
}

type MultisigAccountInfo

type MultisigAccountInfo struct {
	Account          PublicAccount
	MinApproval      int32
	MinRemoval       int32
	Cosignatories    []*PublicAccount
	MultisigAccounts []*PublicAccount
}

func (*MultisigAccountInfo) String

func (ref *MultisigAccountInfo) String() string

type MultisigCosignatoryModification

type MultisigCosignatoryModification struct {
	Type MultisigCosignatoryModificationType
	*PublicAccount
}

MultisigCosignatoryModification

func (*MultisigCosignatoryModification) String

type MultisigCosignatoryModificationType

type MultisigCosignatoryModificationType uint8
const (
	Add MultisigCosignatoryModificationType = iota
	Remove
)

func (MultisigCosignatoryModificationType) String

type NamespaceId

type NamespaceId struct {
	Id       *big.Int
	FullName string
}

NamespaceId

func NewNamespaceId

func NewNamespaceId(id *big.Int) (*NamespaceId, error)

NewNamespaceId generate new NamespaceId from bigInt

func NewNamespaceIdFromName

func NewNamespaceIdFromName(namespaceName string) (*NamespaceId, error)

NewNamespaceIdFromName generate Id from namespaceName

func (*NamespaceId) Equals

func (ref *NamespaceId) Equals(nsId NamespaceId) bool

Equals compares namespaceIds for equality

type NamespaceIds

type NamespaceIds struct {
	List []*NamespaceId
}

NamespaceIds is a list of NamespaceId

func (*NamespaceIds) Decode

func (ref *NamespaceIds) Decode(ptr unsafe.Pointer, iter *jsoniter.Iterator)

func (*NamespaceIds) Encode

func (ref *NamespaceIds) Encode(ptr unsafe.Pointer, stream *jsoniter.Stream)

func (*NamespaceIds) IsEmpty

func (ref *NamespaceIds) IsEmpty(ptr unsafe.Pointer) bool

func (*NamespaceIds) MarshalJSON

func (ref *NamespaceIds) MarshalJSON() (buf []byte, err error)

type NamespaceInfo

type NamespaceInfo struct {
	Active      bool
	Index       int
	MetaId      string
	TypeSpace   NamespaceType
	Depth       int
	Levels      []*NamespaceId
	ParentId    *NamespaceId
	Owner       *PublicAccount
	StartHeight *big.Int
	EndHeight   *big.Int
}

NamespaceInfo contains the state information of a Namespace.

func (*NamespaceInfo) String

func (ref *NamespaceInfo) String() string

type NamespaceName

type NamespaceName struct {
	NamespaceId *NamespaceId
	Name        string
	ParentId    *NamespaceId /* Optional NamespaceId my be nil */
}

NamespaceName name info structure describes basic information of a namespace and name.

type NamespaceService

type NamespaceService service

NamespaceService provides a set of methods for obtaining information about the namespace

func NewNamespaceService

func NewNamespaceService(httpClient *http.Client, conf *Config) *NamespaceService

func (*NamespaceService) GetNamespace

func (ref *NamespaceService) GetNamespace(ctx context.Context, nsId *NamespaceId) (nsInfo *NamespaceInfo, resp *http.Response, err error)

func (*NamespaceService) GetNamespaceNames

func (ref *NamespaceService) GetNamespaceNames(ctx context.Context, nsIds NamespaceIds) (nsList []*NamespaceName, resp *http.Response, err error)

GetNamespaceNames

func (*NamespaceService) GetNamespacesFromAccount

func (ref *NamespaceService) GetNamespacesFromAccount(ctx context.Context, address *Address, nsId string,
	pageSize int) (nsList ListNamespaceInfo, resp *http.Response, err error)

GetNamespacesFromAccount get required params addresses, other skipped if value < 0

func (*NamespaceService) GetNamespacesFromAccounts

func (ref *NamespaceService) GetNamespacesFromAccounts(ctx context.Context, addresses *Addresses, nsId string,
	pageSize int) (nsList ListNamespaceInfo, resp *http.Response, err error)

GetNamespacesFromAccounts get required params addresses, other skipped if value is empty

type NamespaceType

type NamespaceType uint8
const (
	Root NamespaceType = iota
	Sub
)

type NetworkService

type NetworkService service

func (*NetworkService) GetNetworkType

func (ref *NetworkService) GetNetworkType(ctx context.Context) (mscInfo NetworkType, resp *http.Response, err error)

mosaics get mosaics Info @get /network

type NetworkType

type NetworkType uint8
const (
	MainNet         NetworkType = 104
	TestNet         NetworkType = 152
	Mijin           NetworkType = 96
	MijinTest       NetworkType = 144
	NotSupportedNet NetworkType = 0
)

NetworkType enums

func ExtractNetworkType

func ExtractNetworkType(version uint64) NetworkType

func (NetworkType) String

func (nt NetworkType) String() string

type PublicAccount

type PublicAccount struct {
	Address   *Address
	PublicKey string
}

func NewPublicAccount

func NewPublicAccount(pKey string, networkType NetworkType) (*PublicAccount, error)

func (*PublicAccount) String

func (ref *PublicAccount) String() string

type RegisterNamespaceTransaction

type RegisterNamespaceTransaction struct {
	*NamespaceId
	NamespaceType
	NamspaceName string
	Duration     *big.Int
	ParentId     *NamespaceId
	// contains filtered or unexported fields
}

RegisterNamespaceTransaction

func NewRegisterRootNamespaceTransaction

func NewRegisterRootNamespaceTransaction(deadline *Deadline, namespaceName string, duration *big.Int, networkType NetworkType) (*RegisterNamespaceTransaction, error)

func NewRegisterSubNamespaceTransaction

func NewRegisterSubNamespaceTransaction(deadline *Deadline, namespaceName string, parentId *NamespaceId, networkType NetworkType) (*RegisterNamespaceTransaction, error)

func (*RegisterNamespaceTransaction) GetAbstractTransaction

func (tx *RegisterNamespaceTransaction) GetAbstractTransaction() *abstractTransaction

func (*RegisterNamespaceTransaction) HasMissingSignatures

func (tx *RegisterNamespaceTransaction) HasMissingSignatures() bool

func (*RegisterNamespaceTransaction) IsConfirmed

func (tx *RegisterNamespaceTransaction) IsConfirmed() bool

func (*RegisterNamespaceTransaction) IsUnannounced

func (tx *RegisterNamespaceTransaction) IsUnannounced() bool

func (*RegisterNamespaceTransaction) IsUnconfirmed

func (tx *RegisterNamespaceTransaction) IsUnconfirmed() bool

func (*RegisterNamespaceTransaction) String

func (tx *RegisterNamespaceTransaction) String() string

type SecretLockTransaction

type SecretLockTransaction struct {
	*Mosaic
	HashType
	Duration  *big.Int
	Secret    string
	Recipient *Address
	// contains filtered or unexported fields
}

SecretLockTransaction

func NewSecretLockTransaction

func NewSecretLockTransaction(deadline *Deadline, mosaic *Mosaic, duration *big.Int, hashType HashType, secret string, recipient *Address, networkType NetworkType) (*SecretLockTransaction, error)

func (*SecretLockTransaction) GetAbstractTransaction

func (tx *SecretLockTransaction) GetAbstractTransaction() *abstractTransaction

func (*SecretLockTransaction) HasMissingSignatures

func (tx *SecretLockTransaction) HasMissingSignatures() bool

func (*SecretLockTransaction) IsConfirmed

func (tx *SecretLockTransaction) IsConfirmed() bool

func (*SecretLockTransaction) IsUnannounced

func (tx *SecretLockTransaction) IsUnannounced() bool

func (*SecretLockTransaction) IsUnconfirmed

func (tx *SecretLockTransaction) IsUnconfirmed() bool

func (*SecretLockTransaction) String

func (tx *SecretLockTransaction) String() string

type SecretProofTransaction

type SecretProofTransaction struct {
	HashType
	Secret string
	Proof  string
	// contains filtered or unexported fields
}

SecretProofTransaction

func NewSecretProofTransaction

func NewSecretProofTransaction(deadline *Deadline, hashType HashType, secret string, proof string, networkType NetworkType) (*SecretProofTransaction, error)

func (*SecretProofTransaction) GetAbstractTransaction

func (tx *SecretProofTransaction) GetAbstractTransaction() *abstractTransaction

func (*SecretProofTransaction) HasMissingSignatures

func (tx *SecretProofTransaction) HasMissingSignatures() bool

func (*SecretProofTransaction) IsConfirmed

func (tx *SecretProofTransaction) IsConfirmed() bool

func (*SecretProofTransaction) IsUnannounced

func (tx *SecretProofTransaction) IsUnannounced() bool

func (*SecretProofTransaction) IsUnconfirmed

func (tx *SecretProofTransaction) IsUnconfirmed() bool

func (*SecretProofTransaction) String

func (tx *SecretProofTransaction) String() string

type SignedTransaction

type SignedTransaction struct {
	TransactionType `json:"transactionType"`
	Payload         string `json:"payload"`
	Hash            string `json:"hash"`
}

SignedTransaction

type SignerInfo

type SignerInfo struct {
	Signer     string `json:"signer"`
	Signature  string `json:"signature"`
	ParentHash string `json:"parentHash"`
}

type StatusInfo

type StatusInfo struct {
	Status string `json:"status"`
	Hash   string `json:"hash"`
}

type Subscribe

type Subscribe struct {
	Uid       string `json:"uid"`
	Subscribe string `json:"subscribe"`
	ChIn      chan interface{}
	// contains filtered or unexported fields
}

func (*Subscribe) Unsubscribe

func (c *Subscribe) Unsubscribe() error

Unsubscribe terminates the specified subscription. It does not have any specific param.

type SubscribeHash

type SubscribeHash struct {
	Hash string `json:"hash"`
}

structure for Subscribe status

type SubscribePartialRemoved

type SubscribePartialRemoved struct {
	Meta SubscribeHash `json:"meta"`
}

structure for Subscribe PartialRemoved

type SubscribeService

type SubscribeService serviceWs

func (*SubscribeService) Block

func (c *SubscribeService) Block() (*Subscribe, error)

Block notifies for every new block. The message contains the BlockInfo struct.

func (*SubscribeService) ConfirmedAdded

func (c *SubscribeService) ConfirmedAdded(add string) (*Subscribe, error)

ConfirmedAdded notifies when a transaction related to an address is included in a block. The message contains the transaction.

func (*SubscribeService) Cosignature

func (c *SubscribeService) Cosignature(add string) (*Subscribe, error)

Cosignature notifies when a cosignature signed transaction related to an address is added to an aggregate bonded transaction with partial state. The message contains the cosignature signed transaction.

func (*SubscribeService) PartialAdded

func (c *SubscribeService) PartialAdded(add string) (*Subscribe, error)

PartialAdded notifies when an aggregate bonded transaction related to an address is in partial state and waiting to have all required cosigners. The message contains a transaction.

func (*SubscribeService) PartialRemoved

func (c *SubscribeService) PartialRemoved(add string) (*Subscribe, error)

PartialRemoved notifies when a transaction related to an address was in partial state but not anymore. The message contains the transaction hash.

func (*SubscribeService) Status

func (c *SubscribeService) Status(add string) (*Subscribe, error)

Status notifies when a transaction related to an address rises an error. The message contains the error message and the transaction hash.

func (*SubscribeService) UnconfirmedAdded

func (c *SubscribeService) UnconfirmedAdded(add string) (*Subscribe, error)

UnconfirmedAdded notifies when a transaction related to an address is in unconfirmed state and waiting to be included in a block. The message contains the transaction.

func (*SubscribeService) UnconfirmedRemoved

func (c *SubscribeService) UnconfirmedRemoved(add string) (*Subscribe, error)

UnconfirmedRemoved notifies when a transaction related to an address was in unconfirmed state but not anymore. The message contains the transaction hash.

type Transaction

type Transaction interface {
	GetAbstractTransaction() *abstractTransaction
	String() string
	// contains filtered or unexported methods
}

Models Transaction

func MapTransaction

func MapTransaction(b *bytes.Buffer) (Transaction, error)

func MapTransactions

func MapTransactions(b *bytes.Buffer) ([]Transaction, error)

type TransactionHashesDTO

type TransactionHashesDTO struct {
	Hashes []string `json:"hashes"`
}

TransactionHashes

type TransactionIdsDTO

type TransactionIdsDTO struct {
	Ids []string `json:"transactionIds"`
}

TransactionIds

type TransactionInfo

type TransactionInfo struct {
	Height              *big.Int
	Index               uint32
	Id                  string
	Hash                string
	MerkleComponentHash string
	AggregateHash       string
	AggregateId         string
}

Transaction Info

func (*TransactionInfo) String

func (ti *TransactionInfo) String() string

type TransactionService

type TransactionService service

func (*TransactionService) Announce

Announce a transaction to the network

func (*TransactionService) AnnounceAggregateBonded

func (txs *TransactionService) AnnounceAggregateBonded(ctx context.Context, tx *SignedTransaction) (string, *http.Response, error)

Announce a partial transaction to the network

func (*TransactionService) AnnounceAggregateBondedCosignature

func (txs *TransactionService) AnnounceAggregateBondedCosignature(ctx context.Context, c *CosignatureSignedTransaction) (string, *http.Response, error)

Announce a cosignature transaction to the network

func (*TransactionService) GetTransaction

func (txs *TransactionService) GetTransaction(ctx context.Context, id string) (Transaction, *http.Response, error)

Returns transaction information for a given transaction id or hash

func (*TransactionService) GetTransactionStatus

func (txs *TransactionService) GetTransactionStatus(ctx context.Context, id string) (*TransactionStatus, *http.Response, error)

Returns transaction status for a given transaction id or hash

func (*TransactionService) GetTransactionStatuses

func (txs *TransactionService) GetTransactionStatuses(ctx context.Context, hashes []string) ([]*TransactionStatus, *http.Response, error)

Returns transaction information for a given set of transaction hash

func (*TransactionService) GetTransactions

func (txs *TransactionService) GetTransactions(ctx context.Context, ids []string) ([]Transaction, *http.Response, error)

Returns transaction information for a given set of transaction id or hash

type TransactionStatus

type TransactionStatus struct {
	*Deadline
	Group  string
	Status string
	Hash   string
	Height *big.Int
}

TransactionStatus

func (*TransactionStatus) String

func (ts *TransactionStatus) String() string

type TransactionType

type TransactionType uint16
const (
	AggregateCompleted TransactionType = iota
	AggregateBonded
	MosaicDefinition
	MosaicSupplyChange
	ModifyMultisig
	RegisterNamespace
	Transfer
	Lock
	SecretLock
	SecretProof
)

TransactionType enums

func TransactionTypeFromRaw

func TransactionTypeFromRaw(value uint32) (TransactionType, error)

func (TransactionType) Hex

func (t TransactionType) Hex() uint16

func (TransactionType) Raw

func (t TransactionType) Raw() uint32

func (TransactionType) String

func (t TransactionType) String() string

type TransferTransaction

type TransferTransaction struct {
	*Message
	Mosaics   Mosaics
	Recipient *Address
	// contains filtered or unexported fields
}

TransferTransaction

func NewTransferTransaction

func NewTransferTransaction(deadline *Deadline, recipient *Address, mosaics Mosaics, message *Message, networkType NetworkType) (*TransferTransaction, error)

Create a transfer transaction

func (*TransferTransaction) GetAbstractTransaction

func (tx *TransferTransaction) GetAbstractTransaction() *abstractTransaction

func (*TransferTransaction) HasMissingSignatures

func (tx *TransferTransaction) HasMissingSignatures() bool

func (*TransferTransaction) IsConfirmed

func (tx *TransferTransaction) IsConfirmed() bool

func (*TransferTransaction) IsUnannounced

func (tx *TransferTransaction) IsUnannounced() bool

func (*TransferTransaction) IsUnconfirmed

func (tx *TransferTransaction) IsUnconfirmed() bool

func (*TransferTransaction) String

func (tx *TransferTransaction) String() string

func (*TransferTransaction) ToAggregate

func (tx *TransferTransaction) ToAggregate(publicAccount *PublicAccount) *abstractTransaction

Convert an aggregate transaction to an inner transaction including transaction signer

type VarSize

type VarSize uint32
const (
	ByteSize  VarSize = 1
	ShortSize VarSize = 2
	IntSize   VarSize = 4
)

Jump to

Keyboard shortcuts

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