apilib

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2020 License: Apache-2.0, BSD-2-Clause Imports: 35 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrStateNotFound = errors.New("State not found")

Functions

func ActivateSC

func ActivateSC(host string, addr *address.Address) error

func ActivateSCMulti

func ActivateSCMulti(par ActivateSCParams) error

func CheckProgramMetadata

func CheckProgramMetadata(hosts []string, progHash *hashing.HashValue) (*progmeta.ProgramMetadata, error)

CheckProgramMetadata checks if metadata exists in hosts and is consistent return program meta data from the first host if all consistent, otherwise nil

func CheckSC

func CheckSC(apiHosts []string, scAddr *address.Address, textout ...io.Writer) bool

CheckSC checks and reports deployment data of SC in the given list of node it loads bootuo data from the first node in the list and uses CommitteeNodes from that bootup data to check the whole committee

func CreateRequestTransactionOld

func CreateRequestTransactionOld(client nodeclient.NodeClient, senderSigScheme signaturescheme.SignatureScheme, reqsJson []*RequestBlockJson) (*sctransaction.Transaction, error)

Deprecated

func CreateSC

func CreateSC(par CreateSCParams) (*address.Address, *balance.Color, error)

CreateSC performs all actions needed to deploy smart contract, except activation noinspection ALL

func DeactivateSC

func DeactivateSC(host string, addr *address.Address) error

func DeactivateSCMulti

func DeactivateSCMulti(par DeactivateSCParams) error

func DumpSCState

func DumpSCState(host string, scAddress string) (*admapi.DumpSCStateResponse, error)

func ExportDKShare

func ExportDKShare(node string, address *address.Address) (string, error)

func GenerateNewDistributedKeySet

func GenerateNewDistributedKeySet(hosts []string, n, t uint16) (*address.Address, error)

GenerateNewDistributedKeySet calls nodes in parallel to produce distributed key set

func GenerateNewDistributedKeySetOld

func GenerateNewDistributedKeySetOld(nodes []string, n, t uint16) (*address.Address, error)

GenerateNewDistributedKeySetOld calls nodes one after the other to produce distributed key set

func GetProgramMetadata

func GetProgramMetadata(host string, progHash *hashing.HashValue) (*progmeta.ProgramMetadata, error)

GetProgramMetadata calls node to get ProgramMetadata by program hash

func GetPublicKeyInfo

func GetPublicKeyInfo(node string, addr *address.Address) *dkgapi.GetPubKeyInfoResponse

GetPublicKeyInfo retrieves public info about key with specific address from host

func GetPublicKeyInfoMulti

func GetPublicKeyInfoMulti(nodes []string, addr *address.Address) []*dkgapi.GetPubKeyInfoResponse

GetPublicKeyInfoMulti retrieves public info about key with specific address from multiple hosts

func GetSCData

func GetSCData(host string, addr *address.Address) (*registry.BootupData, bool, error)

GetSCData calls node to get BootupData record by address

func GetSCList

func GetSCList(url string) ([]address.Address, error)

gets list of all SCs from the node

func ImportDKShare

func ImportDKShare(node string, base58blob string) error

func IsRequestProcessed

func IsRequestProcessed(host string, addr *address.Address, reqid sctransaction.RequestId) (bool, error)

func MustNotNullInputs

func MustNotNullInputs(tx *valuetransaction.Transaction)

func NewColoredTokensTransaction

func NewColoredTokensTransaction(client nodeclient.NodeClient, sigScheme signaturescheme.SignatureScheme, amount int64) (*valuetransaction.Transaction, error)

NewColoredTokensTransaction mints specified amount of colored tokens from iotas in the address corresponding to sigScheme. It returns a value transaction with empty data payload (not sc transaction)

func PutProgramMetadata

func PutProgramMetadata(host string, md registry.ProgramMetadata) error

PutProgramMetadata calls node to write ProgramMetadata record

func PutSCData

func PutSCData(host string, bd registry.BootupData) error

PutSCData calls node to write BootupData record

func PutSCDataMulti

func PutSCDataMulti(hosts []string, bd registry.BootupData) (bool, []error)

PutSCDataMulti calls PutSCData to hosts in parallel

func QueryRequestProcessingStatusMulti

func QueryRequestProcessingStatusMulti(host string, addr *address.Address, reqs []sctransaction.RequestId) (map[sctransaction.RequestId]bool, error)

func RunAndWaitForRequestProcessedMulti

func RunAndWaitForRequestProcessedMulti(hosts []string, scAddr *address.Address, reqIndex uint16, timeout time.Duration, f func() (*sctransaction.Transaction, error)) (*sctransaction.Transaction, error)

func Shutdown

func Shutdown(host string) error

func TotalBalanceOfInputs

func TotalBalanceOfInputs(outs map[valuetransaction.OutputID][]*balance.Balance) int64

func WaitForRequestProcessedMulti

func WaitForRequestProcessedMulti(hosts []string, scAddr *address.Address, txid *valuetransaction.ID, reqIndex uint16, timeout time.Duration) error

Types

type ActivateSCParams

type ActivateSCParams struct {
	Addresses         []*address.Address
	ApiHosts          []string
	WaitForCompletion bool
	PublisherHosts    []string
	Timeout           time.Duration
}

type CreateRequestTransactionParams

type CreateRequestTransactionParams struct {
	NodeClient          nodeclient.NodeClient
	SenderSigScheme     signaturescheme.SignatureScheme
	BlockParams         []RequestBlockParams
	Post                bool
	WaitForConfirmation bool
	WaitForCompletion   bool
	PublisherHosts      []string
	PublisherQuorum     int
	Timeout             time.Duration
}

type CreateSCParams

type CreateSCParams struct {
	Node                  nodeclient.NodeClient
	CommitteeApiHosts     []string
	CommitteePeeringHosts []string
	AccessNodes           []string
	N                     uint16
	T                     uint16
	OwnerSigScheme        signaturescheme.SignatureScheme
	ProgramHash           hashing.HashValue
	Description           string
	Textout               io.Writer
	Prefix                string
}

type CreateSimpleRequestParamsOld

type CreateSimpleRequestParamsOld struct {
	SCAddress   *address.Address
	RequestCode sctransaction.RequestCode
	Timelock    uint32
	Transfer    map[balance.Color]int64 // should not not include request token. It is added automatically
	Vars        map[string]interface{}  ` `
}

type DeactivateSCParams

type DeactivateSCParams struct {
	Addresses         []*address.Address
	ApiHosts          []string
	WaitForCompletion bool
	PublisherHosts    []string
	Timeout           time.Duration
}

type QuerySCStateResult

type QuerySCStateResult struct {
	Queries map[kv.Key]*stateapi.QueryResult
	// returned only when QueryGeneralData = true
	StateIndex uint32
	Timestamp  time.Time
	StateHash  *hashing.HashValue
	StateTxId  *valuetransaction.ID
	Requests   []*sctransaction.RequestId
}

func QuerySCState

func QuerySCState(host string, query *stateapi.QueryRequest) (*QuerySCStateResult, error)

type RequestBlockJson

type RequestBlockJson struct {
	Address     string                    `json:"address"`
	RequestCode sctransaction.RequestCode `json:"request_code"`
	Timelock    uint32                    `json:"timelock"`
	AmountIotas int64                     `json:"amount_iotas"` // minimum 1 iota will be taken anyway
	Vars        map[string]interface{}    `json:"vars"`
}

Deprecated

type RequestBlockParams

type RequestBlockParams struct {
	TargetSCAddress *address.Address
	RequestCode     sctransaction.RequestCode
	Timelock        uint32
	Transfer        map[balance.Color]int64 // should not not include request token. It is added automatically
	Vars            map[string]interface{}  ` `
}

type SCStatus

type SCStatus struct {
	StateIndex uint32
	Timestamp  time.Time
	StateHash  *hashing.HashValue
	StateTxId  *valuetransaction.ID
	Requests   []*sctransaction.RequestId

	ProgramHash   *hashing.HashValue
	Description   string
	OwnerAddress  *address.Address
	SCAddress     *address.Address
	Balance       map[balance.Color]int64
	MinimumReward int64
	FetchedAt     time.Time
}

func FetchSCStatus

func FetchSCStatus(nodeClient nodeclient.NodeClient, waspHost string, scAddress *address.Address, addCustomQueries func(query *stateapi.QueryRequest)) (*SCStatus, map[kv.Key]*stateapi.QueryResult, error)

Jump to

Keyboard shortcuts

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