Documentation ¶
Index ¶
- Variables
- type AccountService
- func (as *AccountService) CheckBalance(ctx context.Context, publicKey string) (*models.BalanceResult, error)
- func (as *AccountService) CreateAccount(ctx context.Context) (*models.AccountResult, error)
- func (as *AccountService) FetchTransactions(ctx context.Context, publicKey string) ([]dataserviceapi.Last10TxResponse, error)
- func (as *AccountService) FetchVouchers(ctx context.Context, publicKey string) ([]dataserviceapi.TokenHoldings, error)
- func (as *AccountService) TrackAccountStatus(ctx context.Context, publicKey string) (*models.TrackStatusResult, error)
- func (as *AccountService) VoucherData(ctx context.Context, address string) (*models.VoucherDataResult, error)
- type AccountServiceInterface
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) }
Click to show internal directories.
Click to hide internal directories.