rippleTransaction

package
v1.1.24 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2019 License: GPL-3.0 Imports: 7 Imported by: 3

Documentation

Index

Constants

View Source
const (
	AddressPrefix        byte   = 0x00
	PAYMENT              uint16 = 0x00
	HP_TRANSACTION_SIGN  uint32 = 0x53545800
	TxCanonicalSignature uint32 = 0x80000000
)
View Source
const (
	ST_UINT16  uint8 = 1
	ST_UINT32  uint8 = 2
	ST_AMOUNT  uint8 = 6
	ST_VL      uint8 = 7
	ST_ACCOUNT uint8 = 8
	ST_OBJECT  uint8 = 14
	ST_ARRAY   uint8 = 15
)

Variables

View Source
var (
	CurveOrder     = []byte{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xBA, 0xAE, 0xDC, 0xE6, 0xAF, 0x48, 0xA0, 0x3B, 0xBF, 0xD2, 0x5E, 0x8C, 0xD0, 0x36, 0x41, 0x41}
	HalfCurveOrder = []byte{0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x5D, 0x57, 0x6E, 0x73, 0x57, 0xA4, 0x50, 0x1D, 0xDF, 0xE9, 0x2F, 0x46, 0x68, 0x1B, 0x20, 0xA0}
)
View Source
var (
	ErrorInvalidBase58String = errors.New("invalid base58 string")
)

Errors

View Source
var (
	RippleAlphabet = NewAlphabet("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz")
)

Alphabet: copy from https://en.wikipedia.org/wiki/Base58

Functions

func CreateEmptyRawTransactionAndHash

func CreateEmptyRawTransactionAndHash(from, pubkey string, destinationTag, sequence uint32, to string, amount, fee uint64, lastLedgerSequence uint32, memoType, memoData, memoFormat string) (string, string, error)

func Decode

func Decode(input string, alphabet *Alphabet) ([]byte, error)

Decode docode with custom alphabet

func Encode

func Encode(input []byte, alphabet *Alphabet) string

Encode encode with custom alphabet

func GetProgramHashFromAddress

func GetProgramHashFromAddress(address string) ([]byte, error)

func SignRawTransaction

func SignRawTransaction(hash string, prikey []byte) (string, error)

func VerifyAndCombinRawTransaction

func VerifyAndCombinRawTransaction(emptyTrans string, signature, publicKey string) (bool, string)

Types

type Alphabet

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

Alphabet The base58 alphabet object.

func NewAlphabet

func NewAlphabet(alphabet string) *Alphabet

NewAlphabet create a custom alphabet from 58-length string. Note: len(rune(alphabet)) must be 58.

func (Alphabet) String

func (alphabet Alphabet) String() string

Alphabet's string representation

type TxStruct

type TxStruct struct {
	TransactionType    []byte
	Flags              []byte
	Sequence           []byte
	LastLedgerSequence []byte
	Amount             []byte
	Fee                []byte
	SigningPubKey      []byte
	TxnSignature       []byte
	Account            []byte
	Destination        []byte
	DestinationTag     []byte
	Memos              []byte
}

func NewTxStruct

func NewTxStruct(from, pubkey string, sequence uint32, to string, amount, fee uint64, signature string, destinationTag, lastLedgerSequence uint32, memoType, memoData, memoFormat string) (*TxStruct, error)

func (TxStruct) GetHash

func (tx TxStruct) GetHash() []byte

func (TxStruct) ToBytes

func (tx TxStruct) ToBytes() []byte

func (TxStruct) ToEmptyRawWiths

func (tx TxStruct) ToEmptyRawWiths() string

type Value

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

func (*Value) Bytes

func (v *Value) Bytes() []byte

func (Value) IsNative

func (v Value) IsNative() bool

Jump to

Keyboard shortcuts

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