fireblocks

package
v0.8.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2024 License: GPL-3.0 Imports: 27 Imported by: 0

README

Fireblocks

https://developers.fireblocks.com/reference/api-overview

Transactions

This is going to be our primary API call. We use raw signing for all of our create transaction requests. This is because we cannot guranteee fireblocks is integrated with the chains we are deploying on.

Request Signing:

https://developers.fireblocks.com/reference/signing-a-request-jwt-structure

Note:

A deployment transaction is no different than a normal transaction, we build a transaction payload (the payload just specifies to deploy), we send the txn payload to fireblocks to be signed, we get it back and then send it to the chain.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadKey

func LoadKey(path string) (*rsa.PrivateKey, error)

LoadKey loads and returns the RSA256 from disk.

Types

type Asset

type Asset struct {
	ID              string `json:"id"`
	Name            string `json:"name"`
	Type            string `json:"type"`
	ContractAddress string `json:"contractAddress,omitempty"`
	NativeAsset     string `json:"nativeAsset,omitempty"`
	Decimals        int    `json:"decimals,omitempty"`
}

type Client

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

Client is a JSON HTTP client for the FireBlocks API.

func New

func New(network netconf.ID, apiKey string, privateKey *rsa.PrivateKey, opts ...Option) (Client, error)

New creates a new FireBlocks client.

func (Client) Accounts

func (c Client) Accounts(ctx context.Context) (map[common.Address]uint64, error)

Accounts returns all the vault accounts from the account cache, populating it if empty.

func (Client) GetPublicKey

func (c Client) GetPublicKey(ctx context.Context, account uint64) (*ecdsa.PublicKey, error)

GetPublicKey returns the public key for the given vault account.

func (Client) GetSupportedAssets

func (c Client) GetSupportedAssets(ctx context.Context) ([]Asset, error)

GetSupportedAssets returns all asset types supported by Fireblocks.

func (Client) Sign

func (c Client) Sign(ctx context.Context, digest common.Hash, signer common.Address) ([65]byte, error)

Sign creates a raw sign transaction and waits for it to complete, returning the resulting signature (Ethereum RSV format). The signer address is checked against the resulting signed address.

type Config

type Config struct {
	// NetworkTimeout is the allowed duration for a single network request.
	// This is intended to be used for network requests that can be replayed.
	NetworkTimeout time.Duration

	// QueryInterval is the interval at which the FireBlocks client will
	// call the get transaction by id to check for confirmations after a txn
	// has been sent
	QueryInterval time.Duration

	// LogFreqFactor is the frequency at which the FireBlocks client will
	// log a warning message if the transaction has not been signed yet
	LogFreqFactor int

	// SignNote is a note to include in the sign request
	SignNote string

	// Host is the base URL for the FireBlocks API.
	Host string

	// TestAccounts overrides dynamic account
	TestAccounts map[common.Address]uint64
}

Config houses parameters for altering the behavior of a SimpleTxManager.

type Option

type Option func(*Config)

Option is a function that modifies the Config.

func WithHost

func WithHost(host string) Option

func WithLogFreqFactor

func WithLogFreqFactor(factor int) Option

func WithQueryInterval

func WithQueryInterval(interval time.Duration) Option

func WithSignNote

func WithSignNote(note string) Option

func WithTestAccount

func WithTestAccount(addr common.Address, accID uint64) Option

type Status

type Status string

Status of a transaction. See https://developers.fireblocks.com/reference/primary-transaction-statuses.

const (
	StatusCompleted            Status = "COMPLETED"
	StatusFailed               Status = "FAILED"
	StatusRejected             Status = "REJECTED"
	StatusBlocked              Status = "BLOCKED"
	StatusCancelled            Status = "CANCELED"
	StatusCancelling           Status = "CANCELING"
	StatusConfirming           Status = "CONFIRMING"
	StatusBroadcasting         Status = "BROADCASTING"
	StatusPending3rdParty      Status = "PENDING_3RD_PARTY"
	StatusPendingSignature     Status = "PENDING_SIGNATURE"
	StatusQueued               Status = "QUEUED"
	StatusPendingAuthorization Status = "PENDING_AUTHORIZATION"
	StatusPendingAmlScreening  Status = "PENDING_AML_SCREENING"
	StatusSubmitted            Status = "SUBMITTED"
)

func (Status) Completed

func (s Status) Completed() bool

func (Status) Failed

func (s Status) Failed() bool

Jump to

Keyboard shortcuts

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