ubiquitytx

package
v1.9.1 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2023 License: Apache-2.0 Imports: 19 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SignEVMTransactionWithSigner added in v1.7.0

func SignEVMTransactionWithSigner(unsignedHexTx string, privKey *ecdsa.PrivateKey, signer types.Signer) (txHash string, signedTx []byte, err error)

SignEVMTransactionWithSigner signs an unsigned hex transaction using the provided private key and signer This will work for all Ethereum Virtual Machine (EVM) compliant blockchains, including Ethereum and Polygon This function allows more control. For higher level functions use 'SignEthereumTransaction' and 'SignPolygonTransaction'

func SignEthereumLegacyTransaction added in v1.7.0

func SignEthereumLegacyTransaction(unsignedHexTx string, network string, privKey *ecdsa.PrivateKey) (txHash string, signedTx []byte, err error)

SignEthereumLegacyTransaction signs an unsigned hex encoded transaction for the desired 'network'. This function signs a legacy transaction, these are transactions commonly used before the London hard fork

func SignEthereumTransaction added in v1.7.0

func SignEthereumTransaction(unsignedHexTx string, network string, privKey *ecdsa.PrivateKey) (txHash string, signedTx []byte, err error)

SignEthereumTransaction signs an unsigned hex encoded transaction for the desired 'network'. This function signs a post London hard fork transaction, als referred to as an EIP1559 transaction.

func SignPolkadotTransaction added in v1.3.0

func SignPolkadotTransaction(seedPhrase, rawTx, rawSigningPayload string, network PolkadotNetwork) (string, error)

func SignPolygonTransaction added in v1.7.0

func SignPolygonTransaction(unsignedHexTx string, network string, privKey *ecdsa.PrivateKey) (txHash string, signedTx []byte, err error)

SignPolygonTransaction signs an unsigned hex encoded transaction for the desired 'network'. This function signs a post London hard fork transaction, als referred to as an EIP1559 transaction.

func SignSolanaTransaction added in v1.4.0

func SignSolanaTransaction(unsignedRawTx string, privateKey solana.PrivateKey) (signedRawTx string, err error)

Types

type BitcoinTransaction

type BitcoinTransaction struct {
	Network string
	From    []TxInput
	To      []TxOutput
	// Fee        int64
	// ChangeAddr string
	PrivateKey string
}

BitcoinTransaction *Important* make sure to properly calculate the difference between INs and OUTs since it will be automatically payed as a Fee. In the future we may include UTXO and Fee calculation into the service.

type EthereumTransaction

type EthereumTransaction struct {
	Network              string
	PrivateKey           string
	To                   string
	Amount               *big.Float // In Eth
	Nonce                *int64     // Current transaction count
	Gas                  *big.Int
	MaxPriorityFeePerGas *big.Int
	MaxFeePerGas         *big.Int
}

type PolkadotNetwork added in v1.3.0

type PolkadotNetwork uint8
const (
	PolkadotMainnet PolkadotNetwork = 0
	PolkadotWestend PolkadotNetwork = 42
)

type PolkadotTransaction added in v1.3.0

type PolkadotTransaction struct {
	Network    string
	To         string
	Amount     *big.Int
	Tip        uint64
	SeedPhrase string
}

type PolygonTransaction added in v1.7.0

type PolygonTransaction struct {
	Network              string
	PrivateKey           string
	To                   string
	Amount               *big.Float // In Matic
	Nonce                *int64     // Current transaction count
	MaxPriorityFeePerGas *big.Int
	MaxFeePerGas         *big.Int
	Gas                  *big.Int
}

type SendTxResult added in v1.3.0

type SendTxResult struct {
	TxHash string
	TxID   string
}

type SolanaTransaction added in v1.4.0

type SolanaTransaction struct {
	Network        string
	From           solana.PrivateKey
	To             string
	AmountLamports int64
}

type TxInput

type TxInput struct {
	Source string // UTXO, input transaction id
	Index  uint32 // UTXO, input index
}

type TxOutput

type TxOutput struct {
	Destination string // Destination address
	Amount      int64  // In sat.
}

type UbiquityTransactionService

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

UbiquityTransactionService provides API to send various protocol transactions. So far it supports BTC and ETH.

func (UbiquityTransactionService) SendBTC

SendBTC creates, signs and sends BTC transaction. Under the hood it uses Ubiquity TxSend API.

func (UbiquityTransactionService) SendDOT added in v1.3.0

SendDOT creates, signs and sends DOT transaction. Under the hood it uses Ubiquity TxCreate and TxSend API.

func (UbiquityTransactionService) SendETH

SendETH creates, signs and sends ETH transaction. Under the hood it uses Ubiquity TxSend API.

func (UbiquityTransactionService) SendMATIC added in v1.7.0

SendMATIC creates, signs and sends MATIC transaction. Under the hood it uses Ubiquity TxCreate and TxSend API.

func (UbiquityTransactionService) SendSOL added in v1.4.0

SendSOL creates, signs and sends SOL transaction. Under the hood it uses Ubiquity TxCreate and TxSend API.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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