vsys

package
v0.0.20 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2022 License: MIT Imports: 22 Imported by: 1

Documentation

Index

Constants

View Source
const (
	ApiNodeVersion      = "/node/version"
	ApiBroadcastPayment = "/vsys/broadcast/payment"
	ApiBlockHeight      = "/blocks/height"
	ApiGetBlockAt       = "/blocks/at/%d"
	ApiGetBlockBySig    = "/blocks/signature/%s"
	ApiBlocks           = "/blocks/seq/%d/%d"

	// leasing
	ApiBroadcastLease       = "/leasing/broadcast/lease"
	ApiBroadcastCancelLease = "/leasing/broadcast/cancel"

	// transactions
	ApiUnConfirmedTransaction  = "/transactions/unconfirmed"
	ApiGetTransactionInfo      = "/transactions/info/%s"
	ApiGetTransactionByAddress = "/transactions/address/%s/limit/%d"
	ApiGetTransactionList      = "/transactions/list"

	// peers
	ApiGetPeersConnected = "/peers/connected"

	// consensus
	ApiGetAllSlotsInfo  = "/consensus/allSlotsInfo"
	ApiGetConsensusAlgo = "/consensus/algo"

	// address
	ApiGetAddressDetail  = "/addresses/balance/details/%s"
	ApiGetAddressValid   = "/addresses/validate/%s"
	ApiGetAddressBalance = "/addresses/balance/%s"

	// contract
	ApiContractBroadcastRegister = "/contract/broadcast/register"
	ApiContractBroadcastExecute  = "/contract/broadcast/execute"
	ApiContractInfo              = "/contract/info/%s"
	ApiTokenInfo                 = "/contract/tokenInfo/%s"
	ApiContractTokenBalance      = "/contract/balance/%s/%s" // /contract/balance/{address}/{tokenId}
	ApiContractData              = "/contract/data/%s/%s"

	// nft
	ApiNFTGetLatestIndex = "/contract/lastTokenIndex/%s"
	ApiNFTGetByIndex     = "/contract/contractId/%s/tokenIndex/%d"
)
View Source
const (
	Protocol = "v.systems"
	Api      = 3

	// Fee
	VsysPrecision   int64 = 1e8
	ContractExecFee int64 = 3e7
	DefaultTxFee    int64 = 1e7
	DefaultFeeScale int16 = 100

	// Network
	Testnet NetType = 'T'
	Mainnet NetType = 'M'

	// TX_TYPE
	TxTypePayment          = 2
	TxTypeLease            = 3
	TxTypeCancelLease      = 4
	TxTypeMinting          = 5
	TxTypeContractRegister = 8
	TxTypeContractExecute  = 9

	//contract funcIdx variable
	ActionInit      = "init"
	ActionSupersede = "supersede"
	ActionIssue     = "issue"
	ActionDestroy   = "destroy"
	ActionSplit     = "split"
	ActionSend      = "send"
	ActionTransfer  = "transfer"
	ActionDeposit   = "deposit"
	ActionWithdraw  = "withdraw"

	// function index
	FuncidxSupersede     = 0
	FuncidxIssue         = 1
	FuncidxDestroy       = 2
	FuncidxSplit         = 3
	FuncidxSend          = 3
	FuncidxSendSplit     = 4
	FuncidxWithdraw      = 6
	FuncidxWithdrawSplit = 7
	FuncidxDeposit       = 5
	FuncidxDepositSplit  = 6

	TokenContract               = "" /* 1186-byte string literal not displayed */
	TokenContractWithSplit      = "" /* 1272-byte string literal not displayed */
	TokenContractLock           = "" /* 824-byte string literal not displayed */
	TokenContractV2WhiteList    = "" /* 1844-byte string literal not displayed */
	TokenContractV2BlackList    = "" /* 1959-byte string literal not displayed */
	TokenContractNFT            = "" /* 930-byte string literal not displayed */
	TokenContractV2NFTWhiteList = "" /* 1520-byte string literal not displayed */
	TokenContractV2NFTBlackList = "" /* 1520-byte string literal not displayed */
	ContractDescriptor          = "" /* 570-byte string literal not displayed */
	ContractWithSplitDescriptor = "" /* 615-byte string literal not displayed */
)
View Source
const (
	DeTypePublicKey       = 0x01
	DeTypeAddress         = 0x02
	DeTypeAmount          = 0x03
	DeTypeInt32           = 0x04
	DeTypeShortText       = 0x05
	DeTypeContractAccount = 0x06
	DeTypeAccount         = 0x07
	DeTypeTokenId         = 0x08
	DeTypeTimestamp       = 0x09
	DeTypeBoolean         = 0x0A
	DeTypeShortByte       = 0x0B
	DeTypeBalance         = 0x0C
)
View Source
const (
	LockStateVariableIdxMaker   = 0x00
	LockStateVariableIdxTokenId = 0x01

	LockStateMapIdxBalance  = 0x00
	LockStateMapIdxLockTime = 0x01
)
View Source
const (
	FuncIdxSysSend     = 0
	FuncIdxSysDeposit  = 1
	FuncIdxSysWithdraw = 2
	FuncIdxSysTransfer = 3
)
View Source
const (
	Funcidx2Supersede   = 0
	Funcidx2Issue       = 1
	Funcidx2Destroy     = 2
	Funcidx2UpdateList  = 3
	Funcidx2Send        = 4
	Funcidx2Transfer    = 5
	Funcidx2Deposit     = 6
	Funcidx2Withdraw    = 7
	Funcidx2TotalSupply = 8
	Funcidx2MaxSupply   = 9
	Funcidx2BalanceOf   = 10
	Funcidx2GetIssuer   = 11
)
View Source
const (
	NFTFuncIdxSupersede = 0
	NFTFuncIdxIssue     = 1
	NFTFuncIdxSend      = 2
	NFTFuncIdxTransfer  = 3
	NFTFuncIdxDeposit   = 4
	NFTFuncIdxWithdraw  = 5
)
View Source
const (
	NFT2FuncIdxSupersede  = 0
	NFT2FuncIdxIssue      = 1
	NFT2FuncIdxUpdateList = 2
	NFT2FuncIdxSend       = 3
	NFT2FuncIdxTransfer   = 4
	NFT2FuncIdxDeposit    = 5
	NFT2FuncIdxWithdraw   = 6
)
View Source
const (
	FuncidxLock = 0
)

Variables

View Source
var D = gf([]int64{0x78a3, 0x1359, 0x4dca, 0x75eb,
	0xd8ab, 0x4141, 0x0a4d, 0x0070,
	0xe898, 0x7779, 0x4079, 0x8cc7,
	0xfe73, 0x2b6f, 0x6cee, 0x5203})
View Source
var D2 = gf([]int64{0xf159, 0x26b2, 0x9b94, 0xebd6,
	0xb156, 0x8283, 0x149a, 0x00e0,
	0xd130, 0xeef3, 0x80f2, 0x198e,
	0xfce7, 0x56df, 0xd9dc, 0x2406})
View Source
var I = gf([]int64{0xa0b0, 0x4a0e, 0x1b27, 0xc4ee,
	0xe478, 0xad2f, 0x1806, 0x2f43,
	0xd7a7, 0x3dfb, 0x0099, 0x2b4d,
	0xdf0b, 0x4fc1, 0x2480, 0x2b83})
View Source
var K = []int64{}/* 160 elements not displayed */

Constantes de cada ronda del SHA-512

View Source
var L = []int64{0xed, 0xd3, 0xf5, 0x5c, 0x1a, 0x63, 0x12, 0x58,
	0xd6, 0x9c, 0xf7, 0xa2, 0xde, 0xf9, 0xde, 0x14,
	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10}
View Source
var X = gf([]int64{0xd51a, 0x8f25, 0x2d60, 0xc956,
	0xa7b2, 0x9525, 0xc760, 0x692c,
	0xdc5c, 0xfdd6, 0xe231, 0xc0a4,
	0x53fe, 0xcd6e, 0x36d3, 0x2169})
View Source
var Y = gf([]int64{0x6658, 0x6666, 0x6666, 0x6666,
	0x6666, 0x6666, 0x6666, 0x6666,
	0x6666, 0x6666, 0x6666, 0x6666,
	0x6666, 0x6666, 0x6666, 0x6666})

Functions

func A

func A(o []int64, a []int64, b []int64)

func AesDecrypt

func AesDecrypt(key []byte, data []byte) (origData []byte, err error)

AesDecrypt aes cbc PKCS5Padding

func AesEncrypt

func AesEncrypt(key []byte, data []byte) ([]byte, error)

AesEncrypt is aes encrypt function key can be any length data can be any length iv is random,multi encrypt will get different result PKCS5Padding , CBC pattern

func Base58Decode

func Base58Decode(b string) []byte

Decode decodes a modified base58 string to a byte slice.

func Base58Encode

func Base58Encode(b []byte) string

Encode encodes a byte slice to a modified base58 string.

func BuildDepositData added in v0.0.18

func BuildDepositData(sender string, contract string, index int32) []byte

func BuildIssueData

func BuildIssueData(tokenDescription string) []byte

func BuildSeedHash

func BuildSeedHash(seed string, nonce int) []byte

func BuildSendData

func BuildSendData(recipient string, nftIndex int32) []byte

func BuildWithdrawData added in v0.0.18

func BuildWithdrawData(contract string, recipient string, index int32) []byte

func ContractId2TokenId

func ContractId2TokenId(contractId string, tokenIndex int) string

func DecodeContractTexture

func DecodeContractTexture(data string) string

func GenerateSeed

func GenerateSeed() string

GenerateSeed generates seed string

func HashChain

func HashChain(nonceSecret []byte) []byte

func InitApi

func InitApi(nodeAddress string, network NetType)

func IsValidateAddress

func IsValidateAddress(address string, network NetType) bool

IsValidateAddress checks if address valid

func IsValidatePhrase

func IsValidatePhrase(phrase string) bool

IsValidatePhrase checks if phrase valid

func Keccak256

func Keccak256(data ...[]byte) []byte

Keccak256 calculates and returns the Keccak256 hash of the input data.

func M

func M(o []int64, a []int64, b []int64)

optimized by Miguel

func Post

func Post(url string, data interface{}) (body []byte, err error)

func PostWithTimeOut

func PostWithTimeOut(url string, data interface{}, duration time.Duration) (body []byte, err error)

func PublicKeyToAddress

func PublicKeyToAddress(publicKey string, network NetType) string

PublicKeyToAddress return address with base58 encoded

func S

func S(o []int64, a []int64)

func SharedKey

func SharedKey(secretKey []uint8, publicKey []uint8) []uint8

func Sign

func Sign(secretKey []uint8, msg []uint8, opt_random []uint8) []uint8

func SignMessage

func SignMessage(secretKey []uint8, msg []uint8, opt_random []uint8) []uint8

func TokenId2ContractId

func TokenId2ContractId(tokenId string) string

func UrlGetContent

func UrlGetContent(url string) (body []byte, err error)

func Verify

func Verify(publicKey []uint8, msg []uint8, signature []uint8) int

func Z

func Z(o []int64, a []int64, b []int64)

Types

type Account

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

func GenerateKeyPair

func GenerateKeyPair(seed []byte) *Account

GenerateKeyPair generate Account using seed byte array

func InitAccount

func InitAccount(network NetType) *Account

InitAccount return account with network initiated

func (*Account) AccountSeed

func (acc *Account) AccountSeed() string

func (*Account) Address

func (acc *Account) Address() string

get account address string

func (*Account) BuildCancelLeasing

func (acc *Account) BuildCancelLeasing(txId string) *Transaction

BuildCancelLeasing build Cancel transaction

func (*Account) BuildExecuteContract

func (acc *Account) BuildExecuteContract(contractId string, funcIdx int16, funcData []byte, attachment string) *Transaction

BuildExecuteContract build ExecuteContract transaction

func (*Account) BuildFromPrivateKey

func (acc *Account) BuildFromPrivateKey(privateKey string)

BuildFromPrivateKey build account using privateKey

func (*Account) BuildFromSeed

func (acc *Account) BuildFromSeed(seed string, nonce int)

BuildFromPrivateKey build account using seed and nonce

func (*Account) BuildLeasing

func (acc *Account) BuildLeasing(recipient string, amount int64) *Transaction

BuildLeasing build leasing transaction recipient should be address amount is in minimum unit

func (*Account) BuildPayment

func (acc *Account) BuildPayment(recipient string, amount int64, attachment string) *Transaction

BuildPayment build payment transaction recipient should be address amount is in minimum unit attachment can be empty

func (*Account) BuildRegisterContract

func (acc *Account) BuildRegisterContract(contract string, max int64, unity int64, tokenDescription string, contractDescription string) *Transaction

BuildRegisterContract build RegisterContract transaction

func (*Account) BuildRegisterContractV2 added in v0.0.4

func (acc *Account) BuildRegisterContractV2(contract string, max int64, unity int64, tokenDescription string, contractDescription string) *Transaction

BuildRegisterContractV2 build RegisterContract transaction

func (*Account) BuildRegisterLockContractTransaction

func (acc *Account) BuildRegisterLockContractTransaction(tokenId string, desc string) *Transaction

func (*Account) BuildRegisterNFTContractTransaction added in v0.0.4

func (acc *Account) BuildRegisterNFTContractTransaction(contract string, desc string) *Transaction

func (*Account) BuildSendTokenTransaction

func (acc *Account) BuildSendTokenTransaction(tokenId string, recipient string, amount int64, isSplitSupported bool, attachment string) *Transaction

BuildSendTokenTransaction build SendToken transaction

func (*Account) GetInfo

func (acc *Account) GetInfo() (AccountInfo, error)

Get account V Coin balance

func (*Account) GetTokenBalance

func (acc *Account) GetTokenBalance(tokenId string) (TokenBalance, error)

func (*Account) GetTransferHistory

func (acc *Account) GetTransferHistory(limit int64, offset int64, txType int64) (TxHistoryList, error)

func (*Account) PrivateKey

func (acc *Account) PrivateKey() string

get account privateKey string

func (*Account) PublicKey

func (acc *Account) PublicKey() string

get account publicKey string

func (*Account) SignData

func (acc *Account) SignData(data []byte) string

SignData sign data bytes and the output is base58 encoded data

func (*Account) VerifySignature

func (acc *Account) VerifySignature(data, signature []byte) bool

VerifySignature check if signature is correct

type AccountInfo

type AccountInfo struct {
	Address        string
	Regular        int64
	MintingAverage int64
	Available      int64
	Effective      int64
	Height         int64
}

type CommonResp

type CommonResp struct {
	Error   int    `json:"error"`
	Message string `json:"message"`
	Status  string `json:"status,omitempty"`
	Details string `json:"details,omitempty"`
}

type Contract

type Contract struct {
	ContractId          string
	Contract            string
	Max                 int64
	Unity               int64
	TokenDescription    string
	ContractDescription string
	Amount              int64
	TokenIdx            int32 // const 0
	Recipient           string
	SenderPublicKey     string
	NewUnity            int64  // split newUnity
	NewIssuer           string // supersede newIssuer

	SenderAddress string

	Textual   Textual // [init func, user defined func, stateVar]
	Functions []Func
}

func (*Contract) BuildDepositData added in v0.0.9

func (c *Contract) BuildDepositData(sender string, contract string, amount int64) []byte

func (*Contract) BuildDestroyData

func (c *Contract) BuildDestroyData() []byte

func (*Contract) BuildIssueData

func (c *Contract) BuildIssueData() []byte

func (*Contract) BuildRegisterData

func (c *Contract) BuildRegisterData() []byte

func (*Contract) BuildSendData

func (c *Contract) BuildSendData() []byte

func (*Contract) BuildSplitData

func (c *Contract) BuildSplitData() []byte

func (*Contract) BuildSupersedeData

func (c *Contract) BuildSupersedeData(address string) []byte

BuildSupersedeData transfer issuing right of Contract

func (*Contract) BuildWithdrawData added in v0.0.9

func (c *Contract) BuildWithdrawData(contract string, recipient string, amount int64) []byte

func (*Contract) DecodeDeposit added in v0.0.9

func (c *Contract) DecodeDeposit(data []byte)

func (*Contract) DecodeDestroy

func (c *Contract) DecodeDestroy(data []byte)

func (*Contract) DecodeIssue

func (c *Contract) DecodeIssue(data []byte)

func (*Contract) DecodeRegister

func (c *Contract) DecodeRegister(data []byte)

func (*Contract) DecodeSend

func (c *Contract) DecodeSend(data []byte)

func (*Contract) DecodeSplit

func (c *Contract) DecodeSplit(data []byte)

func (*Contract) DecodeSupersede

func (c *Contract) DecodeSupersede(data []byte)

func (*Contract) DecodeTexture

func (c *Contract) DecodeTexture()

func (*Contract) DecodeWithdraw added in v0.0.9

func (c *Contract) DecodeWithdraw(data []byte)

type ContractV2

type ContractV2 struct {
	NewIssuer    string
	NewRegulator string
	Address      string
	AddToList    bool
}

func (*ContractV2) BuildSupersedeData

func (c *ContractV2) BuildSupersedeData(newIssuer string, newRegulator string) []byte

BuildSupersedeData transfer issuing right of Contract

func (*ContractV2) BuildUpdateListData

func (c *ContractV2) BuildUpdateListData(address string, add bool) []byte

func (*ContractV2) DecodeSupersede added in v0.0.5

func (c *ContractV2) DecodeSupersede(data []byte)

func (*ContractV2) DecodeUpdateList added in v0.0.5

func (c *ContractV2) DecodeUpdateList(data []byte)

type DataEncoder

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

func (*DataEncoder) Decode

func (de *DataEncoder) Decode(data []byte) (list []DataEntry)

func (*DataEncoder) Encode

func (de *DataEncoder) Encode(data interface{}, dataEntryType byte)

func (*DataEncoder) EncodeArgAmount

func (de *DataEncoder) EncodeArgAmount(amount int16)

func (*DataEncoder) Result

func (de *DataEncoder) Result() []byte

type DataEntry

type DataEntry struct {
	Type  int8
	Value interface{}
}

type Func

type Func struct {
	Name    string
	Args    []string
	RetArgs []string
}

type LockBalanceResp added in v0.0.14

type LockBalanceResp struct {
	LockResp
	Value int64 `json:"value"`
}

type LockContract

type LockContract struct {
	TokenId   string
	Timestamp int64
}

func (*LockContract) BuildLockData added in v0.0.9

func (c *LockContract) BuildLockData(timestamp time.Time) []byte

func (*LockContract) BuildRegisterData

func (c *LockContract) BuildRegisterData() []byte

func (*LockContract) DecodeLock added in v0.0.12

func (c *LockContract) DecodeLock(data []byte)

func (*LockContract) DecodeRegister added in v0.0.17

func (c *LockContract) DecodeRegister(data []byte)

func (*LockContract) GenQueryKeyBalance added in v0.0.14

func (c *LockContract) GenQueryKeyBalance(userAddress string) string

func (*LockContract) GenQueryKeyLockTime added in v0.0.14

func (c *LockContract) GenQueryKeyLockTime(userAddress string) string

func (*LockContract) GenQueryKeyMaker added in v0.0.14

func (c *LockContract) GenQueryKeyMaker() string

func (*LockContract) GenQueryKeyTokenId added in v0.0.14

func (c *LockContract) GenQueryKeyTokenId() string

type LockMakerResp added in v0.0.14

type LockMakerResp struct {
	LockResp
	Value string `json:"value"`
}

type LockResp added in v0.0.14

type LockResp struct {
	ContractId string `json:"contractId"`
	Key        string `json:"key"`
	Height     int64  `json:"height"`
	DbName     string `json:"dbName"`
	DateType   string `json:"dateType"`
}

type LockTimeResp added in v0.0.14

type LockTimeResp struct {
	LockResp
	Value int64 `json:"value"`
}

type LockTokenIdResp added in v0.0.14

type LockTokenIdResp struct {
	LockResp
	Value string `json:"value"`
}

type NFTContract

type NFTContract struct {
	SenderAddress string
	TokenIndex    int64
	Recipient     string
	ContractId    string
	Description   string
}

func (*NFTContract) BuildIssue

func (c *NFTContract) BuildIssue(nftDesc string) []byte

func (*NFTContract) BuildRegisterData

func (c *NFTContract) BuildRegisterData() []byte

func (*NFTContract) BuildSend

func (c *NFTContract) BuildSend(recipient string, index int32) []byte

func (*NFTContract) DecodeDepositData added in v0.0.18

func (c *NFTContract) DecodeDepositData(data []byte)

func (*NFTContract) DecodeIssueData added in v0.0.19

func (c *NFTContract) DecodeIssueData(data []byte)

func (*NFTContract) DecodeSendData added in v0.0.19

func (c *NFTContract) DecodeSendData(data []byte)

func (*NFTContract) DecodeTransferData added in v0.0.19

func (c *NFTContract) DecodeTransferData(data []byte)

func (*NFTContract) DecodeWithdrawData added in v0.0.18

func (c *NFTContract) DecodeWithdrawData(data []byte)

type NFTIssueResponse

type NFTIssueResponse struct {
	Type       int
	Id         string
	Fee        int64
	Timestamp  int64
	Attachment string
	FeeScale   int
	Recipient  string
}

type NetType

type NetType byte

type Proof

type Proof struct {
	ProofType string `json:"proofType"`
	PublicKey string `json:"publicKey"`
	Signature string `json:"signature"`
	Address   string `json:"address"`
}

type SystemContract added in v0.0.16

type SystemContract struct {
	Sender     string
	ContractId string
	Recipient  string
	Amount     int64
}

func (*SystemContract) BuildDepositData added in v0.0.16

func (c *SystemContract) BuildDepositData(sender string, contractId string, amount int64) []byte

func (*SystemContract) BuildSendData added in v0.0.16

func (c *SystemContract) BuildSendData(recipient string, amount int64) []byte

func (*SystemContract) BuildTransferData added in v0.0.16

func (c *SystemContract) BuildTransferData(sender string, recipient string, amount int64) []byte

func (*SystemContract) BuildWithdrawData added in v0.0.16

func (c *SystemContract) BuildWithdrawData(contractId string, recipient string, amount int64) []byte

func (*SystemContract) DecodeDeposit added in v0.0.16

func (c *SystemContract) DecodeDeposit(data []byte)

func (*SystemContract) DecodeSend added in v0.0.16

func (c *SystemContract) DecodeSend(data []byte)

func (*SystemContract) DecodeTransfer added in v0.0.16

func (c *SystemContract) DecodeTransfer(data []byte)

func (*SystemContract) DecodeWithdraw added in v0.0.16

func (c *SystemContract) DecodeWithdraw(data []byte)

type Textual

type Textual struct {
	Triggers       string
	Descriptors    string
	StateVariables string
}

type TokenBalance

type TokenBalance struct {
	Error   int    `json:"error"`
	Message string `json:"message"`
	Address string `json:"address"`
	TokenId string `json:"tokenId"`
	Balance int64  `json:"balance"`
	Unity   int64  `json:"unity"`
}

type TokenInfo

type TokenInfo struct {
	TokenId     string `json:"tokenId"`
	ContractId  string `json:"contractId"`
	Max         int64  `json:"max"`
	Total       int64  `json:"total"`
	Unity       int64  `json:"unity"`
	Description string `json:"description"`
}

func GetTokenInfo

func GetTokenInfo(tokenId string) (TokenInfo, error)

Get token info by token_id

type Transaction

type Transaction struct {
	TxId            string `json:"txId,omitempty"`
	Timestamp       int64  `json:"timestamp"`
	Fee             int64  `json:"fee"`
	FeeScale        int16  `json:"feeScale"`
	Amount          int64  `json:"amount,omitempty"`
	SenderPublicKey string `json:"senderPublicKey"`
	Attachment      string `json:"attachment,omitempty"`
	Recipient       string `json:"recipient,omitempty"`
	Signature       string `json:"signature"`
	// contract
	Contract      string `json:"contract,omitempty"`
	InitData      string `json:"initData,omitempty"`
	ContractId    string `json:"contractId,omitempty"`
	TokenIdx      int32  `json:"tokenIdx,omitempty"`
	Description   string `json:"description,omitempty"`
	FunctionIndex int16  `json:"functionIndex"`
	FunctionData  string `json:"functionData,omitempty"`
	// contains filtered or unexported fields
}

func NewCancelLeaseTransaction

func NewCancelLeaseTransaction(txId string) *Transaction

func NewExecuteTransaction

func NewExecuteTransaction(contractId string, funcIdx int16, funcData string, attachment string) *Transaction

func NewLeaseTransaction

func NewLeaseTransaction(recipient string, amount int64) *Transaction

func NewPaymentTransaction

func NewPaymentTransaction(recipient string, amount int64, attachment string) *Transaction

func NewRegisterTransaction

func NewRegisterTransaction(contract string, data string, contractDescription string) *Transaction

func (*Transaction) BuildTxData

func (tx *Transaction) BuildTxData() []byte

BuildTxData generate data which is used to be signed

func (*Transaction) TxType

func (tx *Transaction) TxType() int

type TransactionResponse

type TransactionResponse struct {
	Type       uint8   `json:"type"`
	Id         string  `json:"id"`
	Fee        int64   `json:"fee"`
	Timestamp  int64   `json:"timestamp"`
	Proofs     []Proof `json:"proofs"`
	Recipient  string  `json:"recipient"`
	FeeScale   int16   `json:"feeScale"`
	Amount     int64   `json:"amount"`
	Attachment string  `json:"attachment"`
	CommonResp
}

func SendCancelLeasingTx

func SendCancelLeasingTx(tx *Transaction) (resp TransactionResponse, err error)

func SendExecuteContractTx

func SendExecuteContractTx(tx *Transaction) (resp TransactionResponse, err error)

func SendLeasingTx

func SendLeasingTx(tx *Transaction) (resp TransactionResponse, err error)

func SendPaymentTx

func SendPaymentTx(tx *Transaction) (resp TransactionResponse, err error)

func SendRegisterContractTx

func SendRegisterContractTx(tx *Transaction) (resp TransactionResponse, err error)

type TxHistoryList

type TxHistoryList struct {
	Error        int    `json:"error"`
	Message      string `json:"message"`
	TotalCount   int64  `json:"totalCount"`
	Size         int    `json:"size"`
	Transactions []struct {
		Type      int64
		Id        string
		Fee       int64
		FeeScale  int64 `json:"feeScale"`
		Timestamp int64 `json:"timestamp"`
		Proofs    []struct {
			ProofType string `json:"proofType"`
			PublicKey string `json:"publicKey"`
			Address   string `json:"address"`
			Signature string `json:"signature"`
		}
		Recipient  string `json:"recipient"`
		Amount     int64  `json:"amount"`
		Attachment string `json:"attachment"`
		Status     string `json:"status"`
		FeeCharged int64  `json:"feeCharged"`
		Height     int64  `json:"height"`
	} `json:"transactions"`
}

func GetTransactionList

func GetTransactionList(address string, limit int64, offset int64, txType int64) (TxHistoryList, error)

txType eg: TxTypePayment | TxTypeLeasing txType <= 0 will return all kind of transactions

type VsysApi

type VsysApi struct {
	NodeAddress string
	Network     NetType
}

func GetVsysApi

func GetVsysApi() *VsysApi

func (*VsysApi) Get

func (a *VsysApi) Get(path string) ([]byte, error)

func (*VsysApi) Post

func (a *VsysApi) Post(path string, data interface{}) ([]byte, error)

Jump to

Keyboard shortcuts

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