jsonrpc

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrCodeInternal = -32800 - iota
	ErrCodeValidation
	ErrCodeGeneral
)

General Errors

View Source
const (
	ErrCodeProtocolBase = -33000 - iota
)

Custom errors

Variables

This section is empty.

Functions

func DecodeError added in v0.6.0

func DecodeError(err error) error

func NewHandler

func NewHandler(services ...interface{ methods() jsonrpc2.MethodMap }) (http.Handler, error)

Types

type AccountServiceServer

type AccountServiceServer struct {
	Service wallet.AccountService
}

type AutoWalletTransport

type AutoWalletTransport struct {
	Transport
	SetWallet func(request any, field *string)
	SetVault  func(request any, field *string)
	SetToken  func(request any, field *[]byte)
}

AutoWalletTransport populates wallet request fields automatically.

AutoWalletTransport does not automatically set fields for certain request types that probably should be populated manually.

func (*AutoWalletTransport) Request

func (t *AutoWalletTransport) Request(ctx context.Context, url, method string, params, result interface{}) error

type Client

type Client struct {
	Transport Transport
	Server    string
}

func New

func New(server string) (*Client, error)

New creates new API client with default config

func NewWith

func NewWith(server string, transport Transport) (*Client, error)

New creates new API client with default config

func (*Client) AddMemoToTransaction

func (c *Client) AddMemoToTransaction(ctx context.Context, req *api.AddMemoToTransactionRequest) (*api.TransactionResponse, error)

func (*Client) AddSendTokensOutput

func (c *Client) AddSendTokensOutput(ctx context.Context, req *api.AddSendTokensOutputRequest) (*api.TransactionResponse, error)

func (*Client) AdiList

func (c *Client) AdiList(ctx context.Context, req *api.AdiListRequest) (*api.AdiListResponse, error)

func (*Client) AdoptVault

func (c *Client) AdoptVault(ctx context.Context, req *api.AdoptVaultRequest) (*api.AdoptVaultResponse, error)

func (*Client) ConvertWallet

func (c *Client) ConvertWallet(ctx context.Context, req *api.ConvertWalletRequest) (*api.ConvertWalletResponse, error)

func (*Client) CopyVaultSanitized added in v0.6.3

func (*Client) CreateEnvelope

func (*Client) CreateTransaction

func (c *Client) CreateTransaction(ctx context.Context, req *api.CreateTransactionRequest) (*api.TransactionResponse, error)

func (*Client) CreateVault

func (c *Client) CreateVault(ctx context.Context, req *api.CreateVaultRequest) (*api.CreateVaultResponse, error)

func (*Client) CreateWallet

func (c *Client) CreateWallet(ctx context.Context, req *api.CreateWalletRequest) (*api.CreateWalletResponse, error)

func (*Client) Decode

func (c *Client) Decode(ctx context.Context, req *api.DecodeRequest) (*api.DecodeResponse, error)

func (*Client) DeleteTransaction

func (c *Client) DeleteTransaction(ctx context.Context, req *api.DeleteTransactionRequest) (*api.TransactionResponse, error)

func (*Client) Encode

func (c *Client) Encode(ctx context.Context, req *api.EncodeRequest) (*api.EncodeResponse, error)

func (*Client) EncryptVault

func (c *Client) EncryptVault(ctx context.Context, req *api.EncryptVaultRequest) (*api.EncryptVaultResponse, error)

func (*Client) ExportVault

func (c *Client) ExportVault(ctx context.Context, req *api.ExportVaultRequest) (*api.ExportVaultResponse, error)

func (*Client) FindSigner

func (c *Client) FindSigner(ctx context.Context, req *api.FindSignerRequest) (*api.FindSignerResponse, error)

func (*Client) GenerateAddress

func (*Client) GenerateMnemonic

func (*Client) GetTransaction

func (c *Client) GetTransaction(ctx context.Context, req *api.GetTransactionRequest) (*api.TransactionResponse, error)

func (*Client) ImportKey

func (c *Client) ImportKey(ctx context.Context, req *api.ImportKeyRequest) (*api.ResolveKeyResponse, error)

func (*Client) ImportMnemonic

func (*Client) ImportVault

func (c *Client) ImportVault(ctx context.Context, req *api.ImportVaultRequest) (*api.ImportVaultResponse, error)

func (*Client) KeyAssign

func (c *Client) KeyAssign(ctx context.Context, req *api.KeyRotateRequest) (*api.KeyRotateResponse, error)

func (*Client) KeyList

func (c *Client) KeyList(ctx context.Context, req *api.KeyListRequest) (*api.KeyListResponse, error)

func (*Client) KeyRemove

func (c *Client) KeyRemove(ctx context.Context, req *api.KeyRotateRequest) (*api.KeyRotateResponse, error)

func (*Client) KeyRename

func (c *Client) KeyRename(ctx context.Context, req *api.KeyRotateRequest) (*api.KeyRotateResponse, error)

func (*Client) LedgerGenerateKey

func (c *Client) LedgerGenerateKey(ctx context.Context, req *api.GenerateLedgerKeyRequest) (*api.Key, error)

func (*Client) LedgerQueryWallets

func (c *Client) LedgerQueryWallets(ctx context.Context) (*api.LedgerWalletResponse, error)

func (*Client) ListAccounts

func (c *Client) ListAccounts(ctx context.Context, req *api.ListAccountsRequest) (*api.ListAccountsResponse, error)

func (*Client) ListTransactions

func (*Client) ListVaults

func (c *Client) ListVaults(ctx context.Context, req *api.ListVaultsRequest) (*api.ListVaultsResponse, error)

func (*Client) LockVault

func (c *Client) LockVault(ctx context.Context, req *api.LockVaultRequest) (*api.LockVaultResponse, error)

func (*Client) OpenVault

func (c *Client) OpenVault(ctx context.Context, req *api.OpenVaultRequest) (*api.OpenVaultResponse, error)

func (*Client) RefreshToken added in v0.6.0

func (c *Client) RefreshToken(ctx context.Context, req *api.RefreshTokenRequest) (*api.RefreshTokenResponse, error)

func (*Client) RegisterADI

func (c *Client) RegisterADI(ctx context.Context, req *api.RegisterADIRequest) (*api.RegisterADIResponse, error)

func (*Client) RegisterBook

func (c *Client) RegisterBook(ctx context.Context, req *api.RegisterBookRequest) (*api.RegisterBookResponse, error)

func (*Client) RegisterTokenAccount

func (*Client) ResetLastUsedOn

func (*Client) ResolveKey

func (c *Client) ResolveKey(ctx context.Context, req *api.ResolveKeyRequest) (*api.ResolveKeyResponse, error)

func (*Client) RestoreKeyCounters added in v0.6.0

func (*Client) Set1PasswordRef

func (*Client) Sign

func (c *Client) Sign(ctx context.Context, req *api.SignRequest) (*api.SignResponse, error)

func (*Client) SignMessage

func (c *Client) SignMessage(ctx context.Context, req *api.SignMessageRequest) (*api.SignResponse, error)

func (*Client) SignTransaction

func (c *Client) SignTransaction(ctx context.Context, req *api.SignTransactionRequest) (*api.SignResponse, error)

func (*Client) Status

func (c *Client) Status(ctx context.Context, req *api.StatusRequest) (*api.StatusResponse, error)

func (*Client) UnlockVault

func (c *Client) UnlockVault(ctx context.Context, req *api.UnlockVaultRequest) (*api.UnlockVaultResponse, error)

func (*Client) UnregisterBook

func (*Client) Version

func (c *Client) Version(ctx context.Context) (*api.VersionResponse, error)

func (*Client) WriteDataTransaction

func (c *Client) WriteDataTransaction(ctx context.Context, req *api.WriteDataRequest) (*api.TransactionResponse, error)

type DefaultTransport

type DefaultTransport struct {
	jsonrpc2.Client
}

func (*DefaultTransport) SetTimeout

func (t *DefaultTransport) SetTimeout(timeout time.Duration)

type GeneralServiceServer

type GeneralServiceServer struct {
	Service wallet.GeneralService
}

type InteractiveAuthnTransport

type InteractiveAuthnTransport struct {
	Transport
	Use1Password bool
	GetPassword  func(*api.VaultInfo, int, error) ([]byte, error)
}

func (*InteractiveAuthnTransport) Request

func (t *InteractiveAuthnTransport) Request(ctx context.Context, url, method string, params, result interface{}) error

type KeyServiceServer

type KeyServiceServer struct {
	Service wallet.KeyService
}

type LedgerServiceServer

type LedgerServiceServer struct {
	Service wallet.LedgerService
}

type SigningServiceServer

type SigningServiceServer struct {
	Service wallet.SigningService
}

type TransactionServiceServer

type TransactionServiceServer struct {
	Service wallet.TransactionService
}

type Transport

type Transport interface {
	Request(ctx context.Context, server, method string, params, result interface{}) error
	SetTimeout(time.Duration)
}

func DialTransport

func DialTransport(dial func(network, addr string) (net.Conn, error)) Transport

DialTransport returns a Transport that uses the given function to dial connections.

func NetDialTransport

func NetDialTransport(network, address string) Transport

NetDialTransport uses net.Dial to dial the given network address.

func SSHDialTransport

func SSHDialTransport(client *ssh.Client, network, address string) Transport

SSHDialTransport uses client.Dial to dial the given network address.

type VaultServiceServer

type VaultServiceServer struct {
	Service wallet.VaultService
}

Jump to

Keyboard shortcuts

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