transactions

package
v0.0.0-...-6653c62 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2018 License: MIT Imports: 14 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Hashing = map[string]Apost{
	"MD5":      {"MD5", "81", "01"},
	"SHA1":     {"SHA1", "82", "02"},
	"SHA256":   {"SHA256", "83", "03"},
	"SHA3-256": {"SHA3-256", "88", "08"},
	"SHA3-512": {"SHA3-512", "89", "09"},
}

Apostille hashing methods with version bytes

Functions

func CommonPart

func CommonPart(txtype, version int, timeStamp, due int64, senderPublicKey string) base.CommonTransaction

The common part of transactions param txType - A type of transaction param senderPublicKey - A sender public key param timeStamp - A timestamp for the transation param due - A deadline in minutes param version - A network version param network - A network id return - A common transaction struct

func MsgPrepare

func MsgPrepare(common Common, tx *Transfer) base.Message

Prepare a message struct param common - A common struct param tx - An un-prepared transferTransaction struct point return - A prepared message struct

func MultisigWrapper

func MultisigWrapper(senderPublicKey string, innerEntity base.Tx, due int64, network int) *base.MultisigTransaction

Wrap a transaction in a multisignature transaction param senderPublicKey - The sender public key param innerEntity - The transaction entity to wrap param due - The transaction deadline in minutes param network - A network id return - A [MultisigTransaction] struct link http://bob.nem.ninja/docs/#multisigTransaction

func Send

func Send(common Common, entity interface{}, endpoint *requests.Client) (requests.NemAnnounceResult, error)

Serialize a transaction and broadcast it to the network param common - A common struct param entity - A prepared transaction struct param endpoint - An NIS endpoint struct return - An announce transaction promise of the com.requests service

func VerifyApost

func VerifyApost(fileContent []byte, apostilleTransaction base.TransactionResponce) bool

Verify an apostille param fileContent - The file content param apostilleTransaction - The transaction object for the apostille return - True if valid, false otherwise

Types

type Apost

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

type Apostilledata

type Apostilledata struct {
	Data        DataAp      `json:"data"`
	Transaction base.TxDict `json:"transaction"`
}

func Create

func Create(common Common, fileName string, fileContent []byte, tags string, hashing Apost, isMultisig bool,
	multisigAccount string, isPrivate bool, network int) Apostilledata

Create an apostille object param common - A common object param fileName - The file name (with extension) param fileContent - The file content param tags - The apostille tags param hashing - An hashing object param isMultisig - True if transaction is multisig, false otherwise param multisigAccount - An [AccountInfo] struct link https://bob.nem.ninja/docs/#accountInfo} object param isPrivate - True if apostille is private / transferable / updateable, false if public param network - A network id return - An apostille object containing apostille data and the prepared transaction ready to be sent

type Common

type Common struct {
	Password, PrivateKey string
	IsHW                 bool
}

type DataAp

type DataAp struct {
	File             File       `json:"file"`
	Hash             string     `json:"hash"`
	Checksum         string     `json:"checksum"`
	DedicatedAccount *Dedicated `json:"dedicatedAccount"`
	Tags             string     `json:"tags"`
}

type Dedicated

type Dedicated struct {
	Address    string `json:"address"`
	PrivateKey string `json:"privateKey"`
}

type File

type File struct {
	Name    string `json:"name"`
	Hash    string `json:"hash"`
	Content []byte `json:"content"`
}

type Levy

type Levy struct {
	Mosaic struct {
		NamespaceID string `json:"namespaceId,omitempty"`
		Name        string `json:"name,omitempty"`
	} `json:"mosaic,omitempty"`
	Address string  `json:"address,omitempty"`
	FeeType int     `json:"feeType,omitempty"`
	Fee     float64 `json:"fee,omitempty"`
}

type MosaicDefinition

type MosaicDefinition struct {
	MosaicName      string `json:"mosaicName,omitempty"`
	NamespaceParent struct {
		Fqn string `json:"fqn,omitempty"`
	} `json:"namespaceParent,omitempty"`
	MosaicDescription string            `json:"mosaicDescription,omitempty"`
	Properties        []base.Properties `json:"properties,omitempty"`
	Levy              Levy              `json:"levy,omitempty"`
	IsMultisig        bool              `json:"isMultisig"`
	MultisigAccount   string            `json:"multisigAccount"`
}

A mosaic definition describes an asset class. Some fields are mandatory while others are optional. The properties of a mosaic definition always have a default value and only need to be supplied if they differ from the default value.

func (*MosaicDefinition) Get

func (r *MosaicDefinition) Get()

func (MosaicDefinition) Prepare

Prepare a mosaic definition transaction argument r - An un-prepared mosaicDefinitionTransaction struct param common - A common struct param network - A network id return A [MosaicDefinitionCreationTransaction] struc ready for serialization link http://bob.nem.ninja/docs/#mosaicDefinitionCreationTransaction

type NamespaceProvision

type NamespaceProvision struct {
	NamespaceName   string `json:"namespaceName,omitempty"`
	NamespaceParent struct {
		Fqn string `json:"fqn,omitempty"`
	} `json:"namespaceParent,omitempty"`
	IsMultisig      bool   `json:"isMultisig"`
	MultisigAccount string `json:"multisigAccount"`
}

func (*NamespaceProvision) Get

func (r *NamespaceProvision) Get()

func (*NamespaceProvision) GetTx

func (t *NamespaceProvision) GetTx() base.Transaction

func (*NamespaceProvision) GetType

func (t *NamespaceProvision) GetType() int

func (*NamespaceProvision) Prepare

func (r *NamespaceProvision) Prepare(common Common, network int) base.TxDict

Prepare a namespace provision transaction object param common - A common struct param r - An un-prepared namespaceProvisionTransaction method param network - A network id return - A [ProvisionNamespaceTransaction] struct link {http://bob.nem.ninja/docs/#provisionNamespaceTransaction}

type Transfer

type Transfer struct {
	Amount             float64       `json:"amount"`
	Recipient          string        `json:"recipient"`
	RecipientPublicKey string        `json:"recipientPublicKey"`
	IsMultisig         bool          `json:"isMultisig"`
	MultisigAccount    string        `json:"multisigAccount"`
	Message            string        `json:"message"`
	MessageType        int           `json:"messageType"`
	Mosaics            []base.Mosaic `json:"mosaics"`
}

func TransferA

func TransferA(recipient string, amount float64, message string) Transfer

An un-prepared transfer transaction object param recipient - A NEM account address param amount - A number of XEM param message - A message return A - Transfer struct

func (*Transfer) Get

func (r *Transfer) Get()

func (*Transfer) GetTx

func (t *Transfer) GetTx() base.Transaction

func (*Transfer) GetType

func (t *Transfer) GetType() int

func (*Transfer) Prepare

func (r *Transfer) Prepare(common Common, network int) (base.TxDict, error)

Prepare a transfer transaction struct param common - A common struct param r - An un-prepared TransferTransaction method param network - A network id return - A [TransferTransaction] struct link http://bob.nem.ninja/docs/#transferTransaction

func (*Transfer) PrepareMosaic

func (r *Transfer) PrepareMosaic(common Common, mosaicDefinitionMetaDataPair map[string]base.MosaicDefinition,
	client *requests.Client, network int) base.TxDict

Prepare a mosaic transfer transaction struct param common - A common struct param tx - The un-prepared transfer transaction struct param mosaicDefinitionMetaDataPair - The mosaicDefinitionMetaDataPair object with properties of mosaics to send param network - A network id return - A [TransferTransaction] struct ready for serialization link http://bob.nem.ninja/docs/#transferTransaction

type TxDict

type TxDict interface {
	Get() interface{}
	Create() interface{}
}

Jump to

Keyboard shortcuts

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