client

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 26, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ProdHost = "https://observer.mixin.one"
	TestHost = "https://safe.mixin.dev"
)

Functions

func Request

func Request(ctx context.Context, method, path string, body []byte) ([]byte, error)

func RevokeTransaction

func RevokeTransaction(ctx context.Context, id string, chain int64, signature string) error

func SetBaseUri

func SetBaseUri(base string)

Types

type Account

type Account struct {
	ID              string                  `json:"id"`
	Address         string                  `json:"address"`
	Chain           int64                   `json:"chain"`
	Keys            []string                `json:"keys"`
	Outputs         []Output                `json:"outputs"`        // For bitcoin, litecoin
	Pendings        []Output                `json:"pendings"`       // For bitcoin, litecoin
	Balances        map[string]AssetBalance `json:"balances"`       // For evm chains
	PendingBalances map[string]AssetBalance `json:"pendingbalance"` // For evm chains
	Nonce           int64                   `json:"nonce"`          // For evm chains
	Script          string                  `json:"script"`
	State           string                  `json:"state"`
	Migrated        bool                    `json:"migrated"`
	SafeAssetId     string                  `json:"safe_asset_id"`
	Error           any                     `json:"error,omitempty"`
}

func ApproveAccount

func ApproveAccount(ctx context.Context, id, address, signature string) (*Account, error)

func CloseAccount

func CloseAccount(ctx context.Context, id, address, raw, hash string) (*Account, error)

func ReadAccount

func ReadAccount(ctx context.Context, id string) (*Account, error)

type Accountant

type Accountant struct {
	Outputs AccountantOutputs `json:"outputs"`
}

type AccountantOutputs

type AccountantOutputs struct {
	Count   int    `json:"count"`
	Satoshi uint64 `json:"satoshi"`
}

type AssetBalance

type AssetBalance struct {
	AssetAddress string `json:"asset_address"`
	Amount       string `json:"amount"`
	SafeAssetId  string `json:"safe_asset_id"`
}

type Chain

type Chain struct {
	ID         string     `json:"id"`
	Chain      int64      `json:"chain"`
	Head       *Head      `json:"head"`
	Accountant Accountant `json:"accountant,omitempty"` // For bitcoin, litecoin
	Sender     string     `json:"sender,omitempty"`     // For evm chains
}

func ReadChains

func ReadChains(ctx context.Context) ([]*Chain, error)

type Deposit

type Deposit struct {
	Amount          string    `json:"amount"`
	AssetID         string    `json:"asset_id"`
	Chain           int64     `json:"chain"`
	Change          bool      `json:"change"`
	OutputIndex     int64     `json:"output_index"`
	Receiver        string    `json:"receiver"`
	TransactionHash string    `json:"transaction_hash"`
	Sender          string    `json:"sender"`
	SentHash        string    `json:"sent_hash"`
	UpdatedAt       time.Time `json:"updated_at"`
	CreatedAt       time.Time `json:"created_at"`
}

func ReadDeposits

func ReadDeposits(ctx context.Context, chain int64, offset int64) ([]*Deposit, error)
type Head struct {
	CreatedAt time.Time `json:"created_at"`
	Fee       int64     `json:"fee"`
	Hash      string    `json:"hash"`
	Height    uint64    `json:"height"`
	ID        string    `json:"id"`
}

type Output

type Output struct {
	TransactionHash string `json:"transaction_hash"`
	Satoshi         int64  `json:"satoshi"`
	OutputIndex     uint32 `json:"output_index"`
	Script          string `json:"script"`
	Sequence        uint32 `json:"sequence"`
}

type Recovery

type Recovery struct {
	ID       string `json:"id"`
	Address  string `json:"address"`
	Chain    int64  `json:"chain"`
	Holder   string `json:"holder"`
	Observer string `json:"observer"`
	Hash     string `json:"hash"`
	Raw      string `json:"raw"`
	State    string `json:"state"`
	Error    any    `json:"error,omitempty"`
}

func ReadRecoveries

func ReadRecoveries(ctx context.Context) ([]*Recovery, error)

func ReadRecovery

func ReadRecovery(ctx context.Context, id string) (*Recovery, error)

func SignRecovery

func SignRecovery(ctx context.Context, id, raw, hash string) (*Recovery, error)

type Transaction

type Transaction struct {
	AccountID      string   `json:"account_id"`
	AccountAddress string   `json:"account_address"`
	ID             string   `json:"id"`
	Chain          int64    `json:"chain"`
	Fee            string   `json:"fee"`
	Hash           string   `json:"hash"`
	Raw            string   `json:"raw"`
	Signers        []string `json:"signers"`
	State          string   `json:"state"`
	Error          any      `json:"error,omitempty"`
}

func ApproveTransaction

func ApproveTransaction(ctx context.Context, id string, chain int64, raw string) (*Transaction, error)

func ReadTransaction

func ReadTransaction(ctx context.Context, id string) (*Transaction, error)

Jump to

Keyboard shortcuts

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