client

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2026 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: unspent outputs,
	Pendings        []Output                `json:"pendings"`         // For bitcoin, litecoin: signed outptus,
	Changes         []Output                `json:"changes"`          // For bitcoin, litecoin: unreceived changes
	Balances        map[string]AssetBalance `json:"balances"`         // For evm chains: unspent balances,
	PendingBalances map[string]AssetBalance `json:"pending_balances"` // For evm chains: signed balances,
	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"`
	State           string    `json:"state"` // done | pending
	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 Inheritance added in v1.2.0

type Inheritance struct {
	LockId    string    `json:"lock_id"`
	RequestId string    `json:"request_id"`
	Hash      string    `json:"hash"`
	Holder    string    `json:"holder"`
	Address   string    `json:"address"`
	Chain     int64     `json:"chain"`
	Duration  uint16    `json:"duration"` // lock for hours
	Status    string    `json:"state"`    // initial | active | revoked
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

func ReadAccountInheritances added in v1.2.0

func ReadAccountInheritances(ctx context.Context, id string) ([]*Inheritance, error)

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 string, req RecoveryRequest) (*Recovery, error)

type RecoveryRequest added in v1.2.0

type RecoveryRequest struct {
	Signature string `json:"signature"`
	Raw       string `json:"raw"`
	Hash      string `json:"hash"`
	Id        string `json:"id"`
	Action    string `json:"action"`
}

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