remote

package
v0.8.0-beta.11 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2025 License: AGPL-3.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountService

type AccountService struct {
}

func (*AccountService) CheckAliasAddress

func (as *AccountService) CheckAliasAddress(ctx context.Context, alias string) (*dataserviceapi.AliasAddress, error)

CheckAliasAddress retrieves the address of an alias from the API endpoint. Parameters:

  • alias: The alias of the user.

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) TokenTransfer

func (as *AccountService) TokenTransfer(ctx context.Context, amount, from, to, tokenAddress string) (*models.TokenTransferResponse, error)

TokenTransfer creates a new token transfer in the custodial system. Returns:

  • *models.TokenTransferResponse: A pointer to an TokenTransferResponse struct containing the trackingId. 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) 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)
	TokenTransfer(ctx context.Context, amount, from, to, tokenAddress string) (*models.TokenTransferResponse, error)
	CheckAliasAddress(ctx context.Context, alias string) (*dataserviceapi.AliasAddress, error)
}

Jump to

Keyboard shortcuts

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