ext

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Cryptographic types.
	TypeCrypto                  = abi.Type(1000)
	TypeCryptoS256N             = TypeCrypto + abi.Type(1)
	TypeCryptoS256P             = TypeCrypto + abi.Type(2)
	TypeCryptoS256PubKey        = TypeCrypto + abi.Type(3)
	TypeCryptoS256PrivKey       = TypeCrypto + abi.Type(4)
	TypeCryptoShamirS256N       = TypeCrypto + abi.Type(5)
	TypeCryptoShamirS256P       = TypeCrypto + abi.Type(6)
	TypeCryptoShamirS256PrivKey = TypeCrypto + abi.Type(7)

	// RenVM types.
	Type          = abi.Type(1100)
	TypeTx        = Type + abi.Type(1)
	TypeArgument  = Type + abi.Type(2)
	TypeArguments = Type + abi.Type(3)

	// Ethereum types.
	TypeEthereum        = abi.Type(1200)
	TypeEthereumAddress = TypeEthereum + abi.Type(1)
	TypeEthereumTx      = TypeEthereum + abi.Type(2)

	// Bitcoin types.
	TypeBitcoin          = abi.Type(1300)
	TypeBitcoinAddress   = TypeBitcoin + abi.Type(1)
	TypeBitcoinUTXOIndex = TypeBitcoin + abi.Type(2)
	TypeBitcoinUTXO      = TypeBitcoin + abi.Type(3)

	// ZCash types.
	TypeZCash        = abi.Type(1400)
	TypeZCashAddress = TypeZCash + abi.Type(1)

	// Bitcoin Cash types.
	TypeBitcoinCash        = abi.Type(1500)
	TypeBitcoinCashAddress = TypeBitcoinCash + abi.Type(1)

	// Litecoin types.
	TypeLitecoin        = abi.Type(1700)
	TypeLitecoinAddress = TypeLitecoin + abi.Type(1)
)

Extension types. The standard unmarshaler will not check these extension types. Instead, you must use the unmarshalers in this packages (and sub-packages).

Variables

This section is empty.

Functions

func EncodeArguments added in v0.2.0

func EncodeArguments(ls []abi.Value) []byte

EncodeArguments into an Ethereum ABI compatible byte slice.

func NewTxHash added in v0.2.0

func NewTxHash(to abi.String, in Arguments) abi.Bytes32

NewTxHash returns the Sum256 hash of the To address and In arguments for a RenVM transaction. Autogen arguments are ignored because they are deterministically generated from the In arguments, and the Out arguments are ignored because they do not exist until the transaction has been fully executed.

Types

type Address added in v0.2.0

type Address ethcommon.Address

func (Address) Marshal added in v0.2.0

func (addr Address) Marshal(w io.Writer, m int) (int, error)

func (Address) MarshalJSON added in v0.2.0

func (addr Address) MarshalJSON() ([]byte, error)

func (Address) SizeHint added in v0.2.0

func (Address) SizeHint() int

func (Address) Type added in v0.2.0

func (Address) Type() abi.Type

func (*Address) Unmarshal added in v0.2.0

func (addr *Address) Unmarshal(r io.Reader, m int) (int, error)

func (*Address) UnmarshalJSON added in v0.2.0

func (addr *Address) UnmarshalJSON(data []byte) error

type Argument added in v0.2.0

type Argument struct {
	Name  abi.String
	Value abi.Value
}

func (Argument) Marshal added in v0.2.0

func (arg Argument) Marshal(w io.Writer, m int) (int, error)

func (Argument) MarshalJSON added in v0.2.0

func (arg Argument) MarshalJSON() ([]byte, error)

func (Argument) SizeHint added in v0.2.0

func (arg Argument) SizeHint() int

func (Argument) Type added in v0.2.0

func (Argument) Type() abi.Type

func (*Argument) Unmarshal added in v0.2.0

func (arg *Argument) Unmarshal(r io.Reader, m int) (int, error)

func (*Argument) UnmarshalJSON added in v0.2.0

func (arg *Argument) UnmarshalJSON(data []byte) error

type Arguments added in v0.2.0

type Arguments []Argument

func (Arguments) Marshal added in v0.2.0

func (args Arguments) Marshal(w io.Writer, m int) (int, error)

func (Arguments) SizeHint added in v0.2.0

func (args Arguments) SizeHint() int

func (Arguments) Type added in v0.2.0

func (Arguments) Type() abi.Type

func (*Arguments) Unmarshal added in v0.2.0

func (args *Arguments) Unmarshal(r io.Reader, m int) (int, error)

type Tx added in v0.2.0

type Tx struct {
	// Hash of the to address and the inputs arguments.
	Hash abi.Bytes32 `json:"hash"`

	// To address specifies the RenVM address that will be receiving the
	// transaction. For cross-chain transactions, this will be the unique
	// human-readable address that identifies the specific cross-chain gateway
	// being used.
	To abi.String `json:"to"`

	// In argumenst are provided by the transaction sender. These arguments may,
	// or may not, need to be validated by the receiver. Either way, it is
	// impossible for the receiver to generate these arguments.
	In Arguments `json:"in"`

	// Autogen arguments are can be generated from the input arguments. If these
	// arguments were provided as input, then they would need to be validated by
	// the receiver (which usually involves autogenerating the arguments from
	// scratch, and comparing them against the originally provided ones).
	Autogen Arguments `json:"autogen"`

	// Out arguments are produced by executing the transaction.
	Out Arguments `json:"out"`
}

Tx represents a RenVM transaction. It may, or may not, include transactions from other blockchains (if it does, then they are usually included as part of the RenVM transaction inputs).

func NewTx added in v0.2.0

func NewTx(to abi.String, in, autogen, out Arguments) Tx

NewTx computes the transaction hash and returns a filled in RenVM transaction.

func (Tx) Marshal added in v0.2.0

func (tx Tx) Marshal(w io.Writer, m int) (int, error)

Marshal the transaction into binary. A maximum number of bytes can be allocated while marshaling (this maximum is not strict).

func (Tx) SizeHint added in v0.2.0

func (tx Tx) SizeHint() int

SizeHint returns the number of bytes required to represent this transaction in binary.

func (Tx) Type added in v0.2.0

func (Tx) Type() abi.Type

func (*Tx) Unmarshal added in v0.2.0

func (tx *Tx) Unmarshal(r io.Reader, m int) (int, error)

Unmarshal the transaction from binary. A maximum number of bytes can be allocated while unmarshaling (to protect against malicious input).

type UTXO added in v0.2.0

type UTXO struct {
	UTXOIndex
	Amount       abi.U64   `json:"amount"`
	ScriptPubKey abi.Bytes `json:"scriptPubKey"`
}

A UTXO is the complete information of an unspent transaction output. It includes the UTXOIndex.

func (UTXO) Marshal added in v0.2.0

func (utxo UTXO) Marshal(w io.Writer, m int) (int, error)

func (UTXO) SizeHint added in v0.2.0

func (utxo UTXO) SizeHint() int

func (UTXO) Type added in v0.2.0

func (UTXO) Type() abi.Type

func (*UTXO) Unmarshal added in v0.2.0

func (utxo *UTXO) Unmarshal(r io.Reader, m int) (int, error)

type UTXOIndex added in v0.2.0

type UTXOIndex struct {
	TxHash abi.Bytes32 `json:"txHash"`
	VOut   abi.U32     `json:"vOut"`
}

A UTXOIndex uniquely identifies an unspent transaction output, and can be used to find the complete UTXO information on the Bitcoin blockchain.

func (UTXOIndex) Marshal added in v0.2.0

func (utxoi UTXOIndex) Marshal(w io.Writer, m int) (int, error)

func (UTXOIndex) SizeHint added in v0.2.0

func (utxoi UTXOIndex) SizeHint() int

func (UTXOIndex) Type added in v0.2.0

func (UTXOIndex) Type() abi.Type

func (*UTXOIndex) Unmarshal added in v0.2.0

func (utxoi *UTXOIndex) Unmarshal(r io.Reader, m int) (int, error)

Jump to

Keyboard shortcuts

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