Documentation ¶
Index ¶
- func GetPrivateKeyECDSA(e EVMTransaction) (*ecdsa.PrivateKey, error)
- func SignAvalancheTransaction(unsignedHexTx string, network string, privKey *ecdsa.PrivateKey) (txHash string, signedTx []byte, err error)
- func SignEVMTransactionWithSigner(unsignedHexTx string, privKey *ecdsa.PrivateKey, signer types.Signer) (txHash string, signedTx []byte, err error)
- func SignEthereumLegacyTransaction(unsignedHexTx string, network string, privKey *ecdsa.PrivateKey) (txHash string, signedTx []byte, err error)
- func SignEthereumTransaction(unsignedHexTx string, network string, privKey *ecdsa.PrivateKey) (txHash string, signedTx []byte, err error)
- func SignFantomTransaction(unsignedHexTx string, network string, privKey *ecdsa.PrivateKey) (txHash string, signedTx []byte, err error)
- func SignPolkadotTransaction(seedPhrase, rawTx, rawSigningPayload string, network PolkadotNetwork) (string, error)
- func SignPolygonTransaction(unsignedHexTx string, network string, privKey *ecdsa.PrivateKey) (txHash string, signedTx []byte, err error)
- func SignSolanaTransaction(unsignedRawTx string, privateKey solana.PrivateKey) (signedRawTx string, err error)
- func ValidateEVMTransaction(e EVMTransaction) error
- type AvalancheTransaction
- func (f AvalancheTransaction) GetAmount() *big.Float
- func (f AvalancheTransaction) GetFeeEstimationType() FeeEstimationType
- func (f AvalancheTransaction) GetGas() *big.Int
- func (f AvalancheTransaction) GetMaxFeePerGas() *big.Int
- func (f AvalancheTransaction) GetMaxPriorityFeePerGas() *big.Int
- func (f AvalancheTransaction) GetNetwork() string
- func (f AvalancheTransaction) GetNonce() *int64
- func (f AvalancheTransaction) GetPrivateKey() string
- func (f AvalancheTransaction) GetProtocol() string
- func (f AvalancheTransaction) GetRecipient() string
- func (f AvalancheTransaction) SetTxProtocolParams(i *ubiquity.TxCreateEvm) *ubiquity.TxCreateProtocol
- type BitcoinTransaction
- type EVMTransaction
- type EthereumTransaction
- func (f EthereumTransaction) GetAmount() *big.Float
- func (f EthereumTransaction) GetFeeEstimationType() FeeEstimationType
- func (f EthereumTransaction) GetGas() *big.Int
- func (f EthereumTransaction) GetMaxFeePerGas() *big.Int
- func (f EthereumTransaction) GetMaxPriorityFeePerGas() *big.Int
- func (f EthereumTransaction) GetNetwork() string
- func (f EthereumTransaction) GetNonce() *int64
- func (f EthereumTransaction) GetPrivateKey() string
- func (f EthereumTransaction) GetProtocol() string
- func (f EthereumTransaction) GetRecipient() string
- func (f EthereumTransaction) SetTxProtocolParams(i *ubiquity.TxCreateEvm) *ubiquity.TxCreateProtocol
- type FantomTransaction
- func (f FantomTransaction) GetAmount() *big.Float
- func (f FantomTransaction) GetFeeEstimationType() FeeEstimationType
- func (f FantomTransaction) GetGas() *big.Int
- func (f FantomTransaction) GetMaxFeePerGas() *big.Int
- func (f FantomTransaction) GetMaxPriorityFeePerGas() *big.Int
- func (f FantomTransaction) GetNetwork() string
- func (f FantomTransaction) GetNonce() *int64
- func (f FantomTransaction) GetPrivateKey() string
- func (f FantomTransaction) GetProtocol() string
- func (f FantomTransaction) GetRecipient() string
- func (f FantomTransaction) SetTxProtocolParams(i *ubiquity.TxCreateEvm) *ubiquity.TxCreateProtocol
- type FeeEstimationType
- type PolkadotNetwork
- type PolkadotTransaction
- type PolygonTransaction
- func (f PolygonTransaction) GetAmount() *big.Float
- func (f PolygonTransaction) GetFeeEstimationType() FeeEstimationType
- func (f PolygonTransaction) GetGas() *big.Int
- func (f PolygonTransaction) GetMaxFeePerGas() *big.Int
- func (f PolygonTransaction) GetMaxPriorityFeePerGas() *big.Int
- func (f PolygonTransaction) GetNetwork() string
- func (f PolygonTransaction) GetNonce() *int64
- func (f PolygonTransaction) GetPrivateKey() string
- func (f PolygonTransaction) GetProtocol() string
- func (f PolygonTransaction) GetRecipient() string
- func (f PolygonTransaction) SetTxProtocolParams(i *ubiquity.TxCreateEvm) *ubiquity.TxCreateProtocol
- type SendTxResult
- type SolanaTransaction
- type TxInput
- type TxOutput
- type UbiquityTransactionService
- func (s UbiquityTransactionService) CreateEVMTransaction(ctx context.Context, tx EVMTransaction) (*ubiquity.UnsignedTx, error)
- func (s UbiquityTransactionService) EstimateEVMTransactionFee(ctx context.Context, tx EVMTransaction) (*big.Int, *big.Int, error)
- func (s UbiquityTransactionService) SendAvax(ctx context.Context, tx *AvalancheTransaction) (*SendTxResult, error)
- func (s UbiquityTransactionService) SendBTC(ctx context.Context, tx *BitcoinTransaction) (*SendTxResult, error)
- func (s UbiquityTransactionService) SendDOT(ctx context.Context, tx *PolkadotTransaction) (*SendTxResult, error)
- func (s UbiquityTransactionService) SendETH(ctx context.Context, tx *EthereumTransaction) (*SendTxResult, error)
- func (s UbiquityTransactionService) SendFTM(ctx context.Context, tx *FantomTransaction) (*SendTxResult, error)
- func (s UbiquityTransactionService) SendMATIC(ctx context.Context, tx *PolygonTransaction) (*SendTxResult, error)
- func (s UbiquityTransactionService) SendSOL(ctx context.Context, tx *SolanaTransaction) (*SendTxResult, error)
- func (s UbiquityTransactionService) TxCreate(ctx context.Context, protocol, network string, tx ubiquity.TxCreate) (*ubiquity.UnsignedTx, error)
- func (s UbiquityTransactionService) TxSend(ctx context.Context, protocol, network string, signedTx string) (*ubiquity.TxReceipt, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetPrivateKeyECDSA ¶ added in v1.10.0
func GetPrivateKeyECDSA(e EVMTransaction) (*ecdsa.PrivateKey, error)
GetPrivateKeyEDCSA retrieves the private key from EVMTransaction
func SignAvalancheTransaction ¶ added in v1.10.0
func SignAvalancheTransaction(unsignedHexTx string, network string, privKey *ecdsa.PrivateKey) (txHash string, signedTx []byte, err error)
SignAvalancheTransaction 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 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 SignFantomTransaction ¶ added in v1.10.0
func SignFantomTransaction(unsignedHexTx string, network string, privKey *ecdsa.PrivateKey) (txHash string, signedTx []byte, err error)
SignFantomTransaction 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 ValidateEVMTransaction ¶ added in v1.10.0
func ValidateEVMTransaction(e EVMTransaction) error
Types ¶
type AvalancheTransaction ¶ added in v1.10.0
type AvalancheTransaction struct { Network string PrivateKey string To string Amount *big.Float // In Avax Nonce *int64 // Current transaction count MaxPriorityFeePerGas *big.Int MaxFeePerGas *big.Int Gas *big.Int // FeeEstimation can be used to indicate whether the Ubiquity // /tx/estimate_fee API should be used. // When MaxPriorityFeePerGas or MaxFeePerGas is set or when // this is set to UbiquityFeeEstimationNone (the default) // the fee estimation API is not used. FeeEstimation FeeEstimationType }
Represents an Avalanche Transaction and implements the EVMTransaction interface
func (AvalancheTransaction) GetAmount ¶ added in v1.10.0
func (f AvalancheTransaction) GetAmount() *big.Float
func (AvalancheTransaction) GetFeeEstimationType ¶ added in v1.10.0
func (f AvalancheTransaction) GetFeeEstimationType() FeeEstimationType
func (AvalancheTransaction) GetGas ¶ added in v1.10.0
func (f AvalancheTransaction) GetGas() *big.Int
func (AvalancheTransaction) GetMaxFeePerGas ¶ added in v1.10.0
func (f AvalancheTransaction) GetMaxFeePerGas() *big.Int
func (AvalancheTransaction) GetMaxPriorityFeePerGas ¶ added in v1.10.0
func (f AvalancheTransaction) GetMaxPriorityFeePerGas() *big.Int
func (AvalancheTransaction) GetNetwork ¶ added in v1.10.0
func (f AvalancheTransaction) GetNetwork() string
func (AvalancheTransaction) GetNonce ¶ added in v1.10.0
func (f AvalancheTransaction) GetNonce() *int64
func (AvalancheTransaction) GetPrivateKey ¶ added in v1.10.0
func (f AvalancheTransaction) GetPrivateKey() string
func (AvalancheTransaction) GetProtocol ¶ added in v1.10.0
func (f AvalancheTransaction) GetProtocol() string
func (AvalancheTransaction) GetRecipient ¶ added in v1.10.0
func (f AvalancheTransaction) GetRecipient() string
func (AvalancheTransaction) SetTxProtocolParams ¶ added in v1.10.0
func (f AvalancheTransaction) SetTxProtocolParams(i *ubiquity.TxCreateEvm) *ubiquity.TxCreateProtocol
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 EVMTransaction ¶ added in v1.10.0
type EVMTransaction interface { GetProtocol() string GetNetwork() string GetPrivateKey() string GetRecipient() string GetAmount() *big.Float GetNonce() *int64 GetMaxPriorityFeePerGas() *big.Int GetMaxFeePerGas() *big.Int GetGas() *big.Int GetFeeEstimationType() FeeEstimationType SetTxProtocolParams(i *ubiquity.TxCreateEvm) *ubiquity.TxCreateProtocol }
EVMTransaction is a generic interface to reflect a Ethereum Virtual Machine compatbile transaction. All specific transaction types for EVM based chains implement this interface.
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 // FeeEstimation can be used to indicate whether the Ubiquity // /tx/estimate_fee API should be used. Be default uses the // medium category. // When MaxPriorityFeePerGas or MaxFeePerGas is set // the fee estimation API is not used. FeeEstimation *FeeEstimationType }
func (EthereumTransaction) GetAmount ¶ added in v1.10.0
func (f EthereumTransaction) GetAmount() *big.Float
func (EthereumTransaction) GetFeeEstimationType ¶ added in v1.10.0
func (f EthereumTransaction) GetFeeEstimationType() FeeEstimationType
func (EthereumTransaction) GetGas ¶ added in v1.10.0
func (f EthereumTransaction) GetGas() *big.Int
func (EthereumTransaction) GetMaxFeePerGas ¶ added in v1.10.0
func (f EthereumTransaction) GetMaxFeePerGas() *big.Int
func (EthereumTransaction) GetMaxPriorityFeePerGas ¶ added in v1.10.0
func (f EthereumTransaction) GetMaxPriorityFeePerGas() *big.Int
func (EthereumTransaction) GetNetwork ¶ added in v1.10.0
func (f EthereumTransaction) GetNetwork() string
func (EthereumTransaction) GetNonce ¶ added in v1.10.0
func (f EthereumTransaction) GetNonce() *int64
func (EthereumTransaction) GetPrivateKey ¶ added in v1.10.0
func (f EthereumTransaction) GetPrivateKey() string
func (EthereumTransaction) GetProtocol ¶ added in v1.10.0
func (f EthereumTransaction) GetProtocol() string
func (EthereumTransaction) GetRecipient ¶ added in v1.10.0
func (f EthereumTransaction) GetRecipient() string
func (EthereumTransaction) SetTxProtocolParams ¶ added in v1.10.0
func (f EthereumTransaction) SetTxProtocolParams(i *ubiquity.TxCreateEvm) *ubiquity.TxCreateProtocol
type FantomTransaction ¶ added in v1.10.0
type FantomTransaction struct { Network string PrivateKey string To string Amount *big.Float // In FTM Nonce *int64 // Current transaction count MaxPriorityFeePerGas *big.Int MaxFeePerGas *big.Int Gas *big.Int // FeeEstimation can be used to indicate whether the Ubiquity // /tx/estimate_fee API should be used. // When MaxPriorityFeePerGas or MaxFeePerGas is set or when // this is set to UbiquityFeeEstimationNone (the default) // the fee estimation API is not used. FeeEstimation FeeEstimationType }
func (FantomTransaction) GetAmount ¶ added in v1.10.0
func (f FantomTransaction) GetAmount() *big.Float
func (FantomTransaction) GetFeeEstimationType ¶ added in v1.10.0
func (f FantomTransaction) GetFeeEstimationType() FeeEstimationType
func (FantomTransaction) GetGas ¶ added in v1.10.0
func (f FantomTransaction) GetGas() *big.Int
func (FantomTransaction) GetMaxFeePerGas ¶ added in v1.10.0
func (f FantomTransaction) GetMaxFeePerGas() *big.Int
func (FantomTransaction) GetMaxPriorityFeePerGas ¶ added in v1.10.0
func (f FantomTransaction) GetMaxPriorityFeePerGas() *big.Int
func (FantomTransaction) GetNetwork ¶ added in v1.10.0
func (f FantomTransaction) GetNetwork() string
func (FantomTransaction) GetNonce ¶ added in v1.10.0
func (f FantomTransaction) GetNonce() *int64
func (FantomTransaction) GetPrivateKey ¶ added in v1.10.0
func (f FantomTransaction) GetPrivateKey() string
func (FantomTransaction) GetProtocol ¶ added in v1.10.0
func (f FantomTransaction) GetProtocol() string
func (FantomTransaction) GetRecipient ¶ added in v1.10.0
func (f FantomTransaction) GetRecipient() string
func (FantomTransaction) SetTxProtocolParams ¶ added in v1.10.0
func (f FantomTransaction) SetTxProtocolParams(i *ubiquity.TxCreateEvm) *ubiquity.TxCreateProtocol
type FeeEstimationType ¶ added in v1.10.0
type FeeEstimationType uint8
const ( UbiquityFeeEstimationNone FeeEstimationType = iota UbiquityFeeEstimationSlow UbiquityFeeEstimationMedium UbiquityFeeEstimationFast )
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 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 // FeeEstimation can be used to indicate whether the Ubiquity // /tx/estimate_fee API should be used. // When MaxPriorityFeePerGas or MaxFeePerGas is set or when // this is set to UbiquityFeeEstimationNone (the default) // the fee estimation API is not used. FeeEstimation FeeEstimationType }
func (PolygonTransaction) GetAmount ¶ added in v1.10.0
func (f PolygonTransaction) GetAmount() *big.Float
func (PolygonTransaction) GetFeeEstimationType ¶ added in v1.10.0
func (f PolygonTransaction) GetFeeEstimationType() FeeEstimationType
func (PolygonTransaction) GetGas ¶ added in v1.10.0
func (f PolygonTransaction) GetGas() *big.Int
func (PolygonTransaction) GetMaxFeePerGas ¶ added in v1.10.0
func (f PolygonTransaction) GetMaxFeePerGas() *big.Int
func (PolygonTransaction) GetMaxPriorityFeePerGas ¶ added in v1.10.0
func (f PolygonTransaction) GetMaxPriorityFeePerGas() *big.Int
func (PolygonTransaction) GetNetwork ¶ added in v1.10.0
func (f PolygonTransaction) GetNetwork() string
func (PolygonTransaction) GetNonce ¶ added in v1.10.0
func (f PolygonTransaction) GetNonce() *int64
func (PolygonTransaction) GetPrivateKey ¶ added in v1.10.0
func (f PolygonTransaction) GetPrivateKey() string
func (PolygonTransaction) GetProtocol ¶ added in v1.10.0
func (f PolygonTransaction) GetProtocol() string
func (PolygonTransaction) GetRecipient ¶ added in v1.10.0
func (f PolygonTransaction) GetRecipient() string
func (PolygonTransaction) SetTxProtocolParams ¶ added in v1.10.0
func (f PolygonTransaction) SetTxProtocolParams(i *ubiquity.TxCreateEvm) *ubiquity.TxCreateProtocol
type SendTxResult ¶ added in v1.3.0
type SolanaTransaction ¶ added in v1.4.0
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 NewService ¶
func NewService(txAPI ubiquity.TransactionsAPI, feesAPI ubiquity.FeeEstimatorAPI) *UbiquityTransactionService
func (UbiquityTransactionService) CreateEVMTransaction ¶ added in v1.10.0
func (s UbiquityTransactionService) CreateEVMTransaction(ctx context.Context, tx EVMTransaction) (*ubiquity.UnsignedTx, error)
CreateEVMTransaction creates a new transaction using the Ubiquity /tx/create endpoint using the EVMTransaction interface This function returns an unsigned transaction.
func (UbiquityTransactionService) EstimateEVMTransactionFee ¶ added in v1.10.0
func (s UbiquityTransactionService) EstimateEVMTransactionFee(ctx context.Context, tx EVMTransaction) (*big.Int, *big.Int, error)
EstimateEVMTransactionFee uses the Ubiquity /tx/estimate_fee API to estimate the fee of an EVMTransaction. Uses the tx.GetFeeEstimationType() to select the category. Default is UbiquityFeeEstimationMedium.
func (UbiquityTransactionService) SendAvax ¶ added in v1.10.0
func (s UbiquityTransactionService) SendAvax(ctx context.Context, tx *AvalancheTransaction) (*SendTxResult, error)
SendAvax creates, signs and sends AVAX transaction. Under the hood it uses Ubiquity TxCreate and TxSend API.
func (UbiquityTransactionService) SendBTC ¶
func (s UbiquityTransactionService) SendBTC(ctx context.Context, tx *BitcoinTransaction) (*SendTxResult, error)
SendBTC creates, signs and sends BTC transaction. Under the hood it uses Ubiquity TxSend API.
func (UbiquityTransactionService) SendDOT ¶ added in v1.3.0
func (s UbiquityTransactionService) SendDOT(ctx context.Context, tx *PolkadotTransaction) (*SendTxResult, error)
SendDOT creates, signs and sends DOT transaction. Under the hood it uses Ubiquity TxCreate and TxSend API.
func (UbiquityTransactionService) SendETH ¶
func (s UbiquityTransactionService) SendETH(ctx context.Context, tx *EthereumTransaction) (*SendTxResult, error)
SendETH creates, signs and sends ETH transaction. Under the hood it uses Ubiquity TxSend API.
func (UbiquityTransactionService) SendFTM ¶ added in v1.10.0
func (s UbiquityTransactionService) SendFTM(ctx context.Context, tx *FantomTransaction) (*SendTxResult, error)
SendFTM creates, signs and sends FTM transaction. Under the hood it uses Ubiquity TxCreate and TxSend API.
func (UbiquityTransactionService) SendMATIC ¶ added in v1.7.0
func (s UbiquityTransactionService) SendMATIC(ctx context.Context, tx *PolygonTransaction) (*SendTxResult, error)
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
func (s UbiquityTransactionService) SendSOL(ctx context.Context, tx *SolanaTransaction) (*SendTxResult, error)
SendSOL creates, signs and sends SOL transaction. Under the hood it uses Ubiquity TxCreate and TxSend API.