core

package
v0.0.0-...-c4e539a Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const AddressLength = 8
View Source
const ContractsParam = `{"type":"Dictionary","value":[]}`
View Source
const PublicKeyParamTpl = `` /* 734-byte string literal not displayed */

Variables

View Source
var CreateAccountTpl string
View Source
var TransferFlowTpl string

Functions

func TransactionToHTTP

func TransactionToHTTP(tx Transaction) ([]byte, error)

Types

type Address

type Address [AddressLength]byte

Address represents the 8 byte address of an account.

func BytesToAddress

func BytesToAddress(b []byte) Address

BytesToAddress returns Address with value b.

If b is larger than 8, b will be cropped from the left. If b is smaller than 8, b will be appended by zeroes at the front.

func HexToAddress

func HexToAddress(h string) Address

HexToAddress converts a hex string to an Address.

func (Address) Bytes

func (addr Address) Bytes() []byte

func (Address) String

func (addr Address) String() string

type FlowPublicKey

type FlowPublicKey [64]byte

func (FlowPublicKey) FromBytes

func (pk FlowPublicKey) FromBytes(bytes []byte) FlowPublicKey

func (FlowPublicKey) ToParam

func (pk FlowPublicKey) ToParam() string

type HttpProposalKey

type HttpProposalKey struct {
	Address        string `json:"address"`
	KeyIndex       string `json:"key_index"`
	SequenceNumber string `json:"sequence_number"`
}

type HttpTransaction

type HttpTransaction struct {
	// Base64 encoded content of the Cadence script.
	Script string `json:"script"`
	// An array containing arguments each encoded as Base64 passed in the [JSON-Cadence interchange format](https://docs.onflow.org/cadence/json-cadence-spec/).
	Arguments        []string `json:"arguments"`
	ReferenceBlockId string   `json:"reference_block_id"`
	// The limit on the amount of computation a transaction is allowed to preform.
	GasLimit           string                     `json:"gas_limit"`
	Payer              string                     `json:"payer"`
	ProposalKey        *HttpProposalKey           `json:"proposal_key"`
	Authorizers        []string                   `json:"authorizers"`
	PayloadSignatures  []HttpTransactionSignature `json:"payload_signatures"`
	EnvelopeSignatures []HttpTransactionSignature `json:"envelope_signatures"`
}

type HttpTransactionSignature

type HttpTransactionSignature struct {
	Address   string `json:"address"`
	KeyIndex  string `json:"key_index"`
	Signature string `json:"signature"`
}

type HttpTransactionSignatures

type HttpTransactionSignatures []HttpTransactionSignature

type Identifier

type Identifier [32]byte

An Identifier is a 32-byte unique identifier for an entity.

func BytesToID

func BytesToID(b []byte) Identifier

BytesToID constructs an identifier from a byte slice.

func HexToID

func HexToID(h string) Identifier

HexToID constructs an identifier from a hexadecimal string.

type ProposalKey

type ProposalKey struct {
	Address        Address
	KeyIndex       int
	SequenceNumber uint64
}

A ProposalKey is the key that specifies the proposal key and sequence number for a transaction.

type Transaction

type Transaction struct {
	// Script is the UTF-8 encoded Cadence source code that defines the execution logic for this transaction.
	Script []byte

	// Arguments is a list of Cadence values passed into this transaction.
	//
	// Each argument is encoded as JSON-CDC bytes.
	Arguments [][]byte

	// ReferenceBlockID is a reference to the block used to calculate the expiry of this transaction.
	//
	// A transaction is considered expired if it is submitted to Flow after refBlock + N, where N
	// is a constant defined by the network.
	//
	// For example, if a transaction references a block with height of X and the network limit is 10,
	// a block with height X+10 is the last block that is allowed to include this transaction.
	ReferenceBlockID Identifier

	// GasLimit is the maximum number of computational units that can be used to execute this transaction.
	GasLimit uint64

	// ProposalKey is the account key used to propose this transaction.
	//
	// A proposal key references a specific key on an account, along with an up-to-date
	// sequence number for that key. This sequence number is used to prevent replay attacks.
	//
	// You can find more information about sequence numbers here: https://docs.onflow.org/concepts/transaction-signing/#sequence-numbers
	ProposalKey ProposalKey

	// Payer is the account that pays the fee for this transaction.
	//
	// You can find more information about the payer role here: https://docs.onflow.org/concepts/transaction-signing/#signer-roles
	Payer Address

	// Authorizers is a list of the accounts that are authorizing this transaction to
	// mutate to their on-chain account state.
	//
	// You can find more information about the authorizer role here: https://docs.onflow.org/concepts/transaction-signing/#signer-roles
	Authorizers []Address

	// PayloadSignatures is a list of signatures generated by the proposer and authorizer roles.
	//
	// A payload signature is generated over the inner portion of the transaction (TransactionDomainTag + payload).
	//
	// You can find more information about transaction signatures here: https://docs.onflow.org/concepts/transaction-signing/#anatomy-of-a-transaction
	PayloadSignatures []TransactionSignature

	// EnvelopeSignatures is a list of signatures generated by the payer role.
	//
	// An envelope signature is generated over the outer portion of the transaction (TransactionDomainTag + payload + payloadSignatures).
	//
	// You can find more information about transaction signatures here: https://docs.onflow.org/concepts/transaction-signing/#anatomy-of-a-transaction
	EnvelopeSignatures []TransactionSignature
}

A Transaction is a full transaction object containing a payload and signatures.

func (*Transaction) EnvelopeMessage

func (t *Transaction) EnvelopeMessage() []byte

EnvelopeMessage returns the signable message for the transaction envelope.

This message is only signed by the payer account.

func (*Transaction) PayloadMessage

func (t *Transaction) PayloadMessage() []byte

type TransactionSignature

type TransactionSignature struct {
	Address     Address
	SignerIndex int
	KeyIndex    int
	Signature   []byte
}

A TransactionSignature is a signature associated with a specific account key.

Jump to

Keyboard shortcuts

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