remote

package
v0.0.0-...-0bb444c Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2024 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	InfoLogger  *log.Logger
	ErrorLogger *log.Logger
)

Functions

This section is empty.

Types

type AccountService

type AccountService struct {
}

func (*AccountService) CheckBalance

func (as *AccountService) CheckBalance(ctx context.Context, publicKey string) (*models.BalanceResult, error)

CheckBalance retrieves the balance for a given public key from the custodial balance API endpoint. Parameters:

  • publicKey: The public key associated with the account whose balance needs to be checked.

func (*AccountService) CreateAccount

func (as *AccountService) CreateAccount(ctx context.Context) (*models.AccountResult, error)

CreateAccount creates a new account in the custodial system. Returns:

  • *models.AccountResponse: A pointer to an AccountResponse struct containing the details of the created account. If there is an error during the request or processing, this will be nil.
  • error: An error if any occurred during the HTTP request, reading the response, or unmarshalling the JSON data. If no error occurs, this will be nil.

func (*AccountService) FetchTransactions

func (as *AccountService) FetchTransactions(ctx context.Context, publicKey string) ([]dataserviceapi.Last10TxResponse, error)

FetchTransactions retrieves the last 10 transactions for a given public key from the data indexer API endpoint Parameters:

  • publicKey: The public key associated with the account.

func (*AccountService) FetchVouchers

func (as *AccountService) FetchVouchers(ctx context.Context, publicKey string) ([]dataserviceapi.TokenHoldings, error)

FetchVouchers retrieves the token holdings for a given public key from the data indexer API endpoint Parameters:

  • publicKey: The public key associated with the account.

func (*AccountService) TrackAccountStatus

func (as *AccountService) TrackAccountStatus(ctx context.Context, publicKey string) (*models.TrackStatusResult, error)

Parameters:

  • trackingId: A unique identifier for the account.This should be obtained from a previous call to CreateAccount or a similar function that returns an AccountResponse. The `trackingId` field in the AccountResponse struct can be used here to check the account status during a transaction.

Returns:

  • string: The status of the transaction as a string. If there is an error during the request or processing, this will be an empty string.
  • error: An error if any occurred during the HTTP request, reading the response, or unmarshalling the JSON data. If no error occurs, this will be nil

func (*AccountService) VoucherData

func (as *AccountService) VoucherData(ctx context.Context, address string) (*models.VoucherDataResult, error)

VoucherData retrieves voucher metadata from the data indexer API endpoint. Parameters:

  • address: The voucher address.

type AccountServiceInterface

type AccountServiceInterface interface {
	CheckBalance(ctx context.Context, publicKey string) (*models.BalanceResult, error)
	CreateAccount(ctx context.Context) (*models.AccountResult, error)
	TrackAccountStatus(ctx context.Context, publicKey string) (*models.TrackStatusResult, error)
	FetchVouchers(ctx context.Context, publicKey string) ([]dataserviceapi.TokenHoldings, error)
	FetchTransactions(ctx context.Context, publicKey string) ([]dataserviceapi.Last10TxResponse, error)
	VoucherData(ctx context.Context, address string) (*models.VoucherDataResult, error)
}

Jump to

Keyboard shortcuts

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