client

package
v2.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotImplemented = errors.New("not implemented")

Functions

This section is empty.

Types

type AuthSecretKey added in v2.0.2

type AuthSecretKey string

func (AuthSecretKey) Sign added in v2.0.2

func (k AuthSecretKey) Sign(timestamp time.Time, data []byte) (AuthSignature, error)

type AuthSignature added in v2.0.2

type AuthSignature string

func (AuthSignature) String added in v2.0.2

func (s AuthSignature) String() string

type Chain

type Chain string
const (
	ChainLocal      Chain = "local"
	ChainEthereum   Chain = "ethereum"
	ChainSepolia    Chain = "sepolia"
	ChainBSC        Chain = "bsc"
	ChainBSCTestnet Chain = "bsc-testnet"
	ChainPolygon    Chain = "polygon"
	ChainAmoy       Chain = "amoy"
	ChainAvalanche  Chain = "avalanche"
	ChainFuji       Chain = "fuji"
)

type Client

type Client interface {
	URL() string
	APIKey() string
	VaultID() string
	AuthSecretKey() *AuthSecretKey

	Sign(ctx context.Context, options SignOptions) (SignResult, error)

	CreateWallet(ctx context.Context, options CreateWalletOptions) (Wallet, error)
	GetWallet(ctx context.Context, address common.Address) (Wallet, error)
	ListWallets(ctx context.Context, options ListWalletsOptions) (ListWalletsResult, error)
	UpdateWallet(ctx context.Context, address common.Address, options UpdateWalletOptions) (Wallet, error)
	ExpireWallet(ctx context.Context, address common.Address) (Wallet, error)
	UnexpireWallet(ctx context.Context, address common.Address) (Wallet, error)

	VaultStatus(ctx context.Context) (VaultStatus, error)
}

func NewClient

func NewClient(options ClientOptions) (Client, error)

type ClientOptions

type ClientOptions interface {
	URL() *string
	SetURL(url string) ClientOptions
	UnsetURL() ClientOptions

	APIKey() string
	SetAPIKey(apiKey string) ClientOptions

	VaultID() string
	SetVaultID(vaultId string) ClientOptions

	AuthSecretKey() *AuthSecretKey
	SetAuthSecretKey(authSecretKey AuthSecretKey) ClientOptions
	SetAuthSecretKeyFromString(authSecretKey string) ClientOptions
	SetAuthSecretKeyFromEnv() ClientOptions
}

func NewClientOptions

func NewClientOptions() ClientOptions

type CreateWalletOptions

type CreateWalletOptions interface {
	Name() string
	SetName(name string) CreateWalletOptions
}

func NewCreateWalletOptions

func NewCreateWalletOptions() CreateWalletOptions

type ListWalletsOptions

type ListWalletsOptions interface {
	Offset() *int64
	SetOffset(offset int64) ListWalletsOptions

	Count() *int64
	SetCount(count int64) ListWalletsOptions
}

func NewListWalletsOptions

func NewListWalletsOptions() ListWalletsOptions

type ListWalletsResult

type ListWalletsResult interface {
	Count() int64
	Page() []Wallet
}

type SignOptions

type SignOptions interface {
	Chain() Chain
	SetChain(chain Chain) SignOptions

	Contract() common.Address
	SetContract(contract common.Address) SignOptions

	Sender() common.Address
	SetSender(sender common.Address) SignOptions

	Uniq() *[]byte
	SetUniq(uniq []byte) SignOptions
	UnsetUniq() SignOptions

	Signer() *common.Address
	SetSigner(signer common.Address) SignOptions
	UnsetSigner() SignOptions

	ABI() map[string]any
	SetABI(abi map[string]any) SignOptions

	Args() []any
	SetArgs(args []any) SignOptions
}

func NewSignOptions

func NewSignOptions() SignOptions

type SignResult

type SignResult interface {
	SubmissionHash() string
	Args() []any
}

type UpdateWalletOptions

type UpdateWalletOptions interface {
	Name() string
	SetName(name string) UpdateWalletOptions
}

func NewUpdateWalletOptions

func NewUpdateWalletOptions() UpdateWalletOptions

type VaultStatus

type VaultStatus interface {
	Timestamp() time.Time
	Online() bool
	VaultKeys() int64
	Wallets() int64
	Version() string
}

type Wallet

type Wallet interface {
	ID() string
	Account() string
	Vault() string
	Name() string
	Address() common.Address
	Created() time.Time
	Updated() time.Time
	Expires() *time.Time
}

Jump to

Keyboard shortcuts

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