apiv1

package
v0.0.0-...-4a9e3d1 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2023 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrNilTx      = bcError("nil transaction provided")
	ErrNoKeyPairs = bcError("no key pairs provided")

	ModeAsync  = txMode(models.TransactionModeAsync)
	ModeSync   = txMode(models.TransactionModeSync)
	ModeCommit = txMode(models.TransactionModeCommit)

	OpCreate   = txOp(models.TransactionOperationCREATE)
	OpTransfer = txOp(models.TransactionOperationTRANSFER)
)

Variables

View Source
var DefaultSchemes = []string{"http"}

Functions

func NewEd25519Condition

func NewEd25519Condition(pubKey ed25519.PublicKey) *cryptoconditions.Condition

func NewURIfromKey

func NewURIfromKey(key ed25519.PublicKey) string

func SignTx

func SignTx(t *models.Transaction, keyPairs []*KeyPair) error

Types

type Asset

type Asset = models.Asset

type BigChainDBDialer

type BigChainDBDialer = stubborn.DuplexConnector

type Block

type Block = models.Block

type CreateParams

type CreateParams struct {
	Mode             txMode
	Amount           float64
	TxData, MetaData any
}

type Fulfills

type Fulfills = models.Fulfills

type KeyPair

type KeyPair struct {
	PrivateKey ed25519.PrivateKey `json:"privateKey"`
	PublicKey  ed25519.PublicKey  `json:"publicKey"`
}

func NewKeyPair

func NewKeyPair() (*KeyPair, error)

type Metadata

type Metadata = models.Metadata

type Owner

type Owner struct {
	TxID string
	Pair *KeyPair
}

type RESTClientV1

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

func NewRESTClientV1

func NewRESTClientV1(ctx context.Context, host string, ownerKeyPair *KeyPair) (*RESTClientV1, error)

func (*RESTClientV1) CreateTx

func (c *RESTClientV1) CreateTx(params CreateParams) (*Transaction, error)

CreateTx : all key names (e.g. anywhere in the JSON documents stored in asset.data or metadata): - must not begin with $ - must not contain . - must not contain the null character (Unicode code point U+0000)

func (*RESTClientV1) GetBlockHeight

func (c *RESTClientV1) GetBlockHeight(blockHeight int64) (*Block, error)

func (*RESTClientV1) GetTransaction

func (c *RESTClientV1) GetTransaction(txID string) (*Transaction, error)

func (*RESTClientV1) ListBlocks

func (c *RESTClientV1) ListBlocks(txID string) ([]int64, error)

func (*RESTClientV1) ListOutputs

func (c *RESTClientV1) ListOutputs(pubKey string, spent bool) ([]*Fulfills, error)

func (*RESTClientV1) ListTransactions

func (c *RESTClientV1) ListTransactions(assetID string, operation txOp, onlyLast bool) ([]*Transaction, error)

func (*RESTClientV1) SearchAsset

func (c *RESTClientV1) SearchAsset(search string, limit int64) ([]*Asset, error)

func (*RESTClientV1) SearchMetadata

func (c *RESTClientV1) SearchMetadata(search string, limit int64) ([]Metadata, error)

func (*RESTClientV1) TransferManyToMany

func (c *RESTClientV1) TransferManyToMany(
	mode txMode,
	amount float64,
	prevTx []*Transaction,
	destPubKeys []string,
	metaData any,
) error

TransferManyToMany TODO

func (*RESTClientV1) TransferOneToOne

func (c *RESTClientV1) TransferOneToOne(params TransferParams) (*Transaction, error)

type Transaction

type Transaction = models.Transaction

type TransferParams

type TransferParams struct {
	Mode     txMode
	Amount   float64
	From     Owner
	To       ed25519.PublicKey
	MetaData any
}

type ValidTransaction

type ValidTransaction = models.ValidTransactionResponse

type WSClient

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

func NewWSClient

func NewWSClient(ctx context.Context, host string, logf func(format string, v ...any)) (*WSClient, error)

func (*WSClient) Close

func (ws *WSClient) Close()

func (*WSClient) SubscribeStream

func (ws *WSClient) SubscribeStream(stream chan ValidTransaction) error

Jump to

Keyboard shortcuts

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