client

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package client provides a client SDK for the NeoAccounts service.

API types are re-exported from `infrastructure/accountpool/types` to keep a single canonical definition shared between server and clients.

Index

Constants

View Source
const (
	TokenTypeNEO = neoaccountstypes.TokenTypeNEO
	TokenTypeGAS = neoaccountstypes.TokenTypeGAS
)

Re-export token constants for convenience.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountInfo

type AccountInfo = neoaccountstypes.AccountInfo

type BatchSignInput

type BatchSignInput = neoaccountstypes.BatchSignInput

type BatchSignResponse

type BatchSignResponse = neoaccountstypes.BatchSignResponse

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a client for the NeoAccounts service.

func New

func New(cfg Config) (*Client, error)

New creates a new NeoAccounts client.

func (*Client) BatchSign

func (c *Client) BatchSign(ctx context.Context, requests []SignRequest) (*BatchSignResponse, error)

BatchSign signs multiple transaction hashes.

func (*Client) DeployContract

func (c *Client) DeployContract(ctx context.Context, accountID, nefBase64, manifestJSON string, data any) (*DeployContractResponse, error)

DeployContract deploys a new smart contract using a pool account. All signing happens inside TEE - private keys never leave the enclave.

func (*Client) DeployMaster

func (c *Client) DeployMaster(ctx context.Context, nefBase64, manifestJSON string, data any) (*DeployMasterResponse, error)

DeployMaster deploys a new smart contract using the master wallet (TEE_PRIVATE_KEY). This is used for deploying contracts where the master account needs to be the Admin. All signing happens inside TEE - private keys never leave the enclave.

func (*Client) FundAccount

func (c *Client) FundAccount(ctx context.Context, toAddress string, amount int64) (*FundAccountResponse, error)

FundAccount transfers tokens from the master wallet (TEE_PRIVATE_KEY) to a target address. This is used to fund pool accounts with GAS for transaction fees.

func (*Client) GetLockedAccounts

func (c *Client) GetLockedAccounts(ctx context.Context, tokenType string, minBalance *int64) ([]AccountInfo, error)

GetLockedAccounts returns accounts locked by this service with optional token and balance filters.

func (*Client) GetMasterKeyAttestation

func (c *Client) GetMasterKeyAttestation(ctx context.Context) (*MasterKeyAttestation, error)

GetMasterKeyAttestation fetches the publicly cacheable master key attestation bundle.

func (*Client) GetPoolInfo

func (c *Client) GetPoolInfo(ctx context.Context) (*PoolInfoResponse, error)

GetPoolInfo returns pool statistics.

func (*Client) InvokeContract

func (c *Client) InvokeContract(ctx context.Context, accountID, contractAddress, method string, params []ContractParam, scope string) (*InvokeContractResponse, error)

InvokeContract invokes a contract method using a pool account. All signing happens inside TEE - private keys never leave the enclave. Scope can be: "CalledByEntry" (default), "Global", "CustomContracts", "CustomGroups", "None"

func (*Client) InvokeMaster

func (c *Client) InvokeMaster(ctx context.Context, contractAddress, method string, params []ContractParam, scope string) (*InvokeContractResponse, error)

InvokeMaster invokes a contract method using the master wallet (TEE_PRIVATE_KEY). This is used for TEE operations like PriceFeed and RandomnessLog that require the caller to be a registered TEE signer in AppRegistry.

func (*Client) ListLowBalanceAccounts

func (c *Client) ListLowBalanceAccounts(ctx context.Context, tokenType string, maxBalance int64, limit int) ([]AccountInfo, error)

ListLowBalanceAccounts returns accounts with balance below the specified threshold. This is useful for auto top-up workers that need to find accounts requiring funding.

func (*Client) ReleaseAccounts

func (c *Client) ReleaseAccounts(ctx context.Context, accountIDs []string) (*ReleaseAccountsResponse, error)

ReleaseAccounts releases accounts back to the pool.

func (*Client) RequestAccounts

func (c *Client) RequestAccounts(ctx context.Context, count int, purpose string) (*RequestAccountsResponse, error)

RequestAccounts requests and locks accounts from the pool.

func (*Client) SignTransaction

func (c *Client) SignTransaction(ctx context.Context, accountID string, txHash []byte) (*SignTransactionResponse, error)

SignTransaction signs a transaction hash with an account's private key.

func (*Client) SimulateContract

func (c *Client) SimulateContract(ctx context.Context, accountID, contractAddress, method string, params []ContractParam) (*SimulateContractResponse, error)

SimulateContract simulates a contract invocation without signing or broadcasting.

func (*Client) Transfer

func (c *Client) Transfer(ctx context.Context, accountID, toAddress string, amount int64, tokenAddress string) (*TransferResponse, error)

Transfer transfers tokens from a pool account to an external address.

func (*Client) TransferWithData

func (c *Client) TransferWithData(ctx context.Context, accountID, toAddress string, amount int64, data string) (*TransferWithDataResponse, error)

TransferWithData transfers GAS from a pool account to an external address with optional data. The data parameter is passed to the OnNEP17Payment callback of the receiving contract. This is used for payments to contracts like PaymentHub that need to identify the payment source.

func (*Client) UpdateBalance

func (c *Client) UpdateBalance(ctx context.Context, accountID, token string, delta int64, absolute *int64) (*UpdateBalanceResponse, error)

UpdateBalance updates an account's balance.

func (*Client) UpdateContract

func (c *Client) UpdateContract(ctx context.Context, accountID, contractAddress, nefBase64, manifestJSON string, data any) (*UpdateContractResponse, error)

UpdateContract updates an existing smart contract using a pool account. All signing happens inside TEE - private keys never leave the enclave.

type Config

type Config struct {
	BaseURL string
	// ServiceID identifies the caller. In strict identity mode this is redundant
	// (caller identity is enforced by MarbleRun mTLS), but it's still useful for
	// local development and debugging.
	ServiceID string
	Timeout   time.Duration
	// HTTPClient optionally overrides the client used to execute requests.
	// For MarbleRun mesh calls, prefer using `marble.Marble.HTTPClient()` so
	// requests are sent over verified mTLS.
	HTTPClient *http.Client
	// MaxBodyBytes caps responses to prevent memory exhaustion.
	MaxBodyBytes int64
}

Config holds client configuration.

type ContractParam

type ContractParam = neoaccountstypes.ContractParam

Contract operation types - all signing happens inside TEE

type DeployMasterInput

type DeployMasterInput = neoaccountstypes.DeployMasterInput

Deploy with master wallet types

type FundAccountInput

type FundAccountInput = neoaccountstypes.FundAccountInput

Fund account types - transfer from master wallet to pool accounts

type InvokeMasterInput

type InvokeMasterInput = neoaccountstypes.InvokeMasterInput

type PoolInfoResponse

type PoolInfoResponse = neoaccountstypes.PoolInfoResponse

type SignRequest

type SignRequest = neoaccountstypes.SignRequest

type TokenBalance

type TokenBalance = neoaccountstypes.TokenBalance

type TokenStats

type TokenStats = neoaccountstypes.TokenStats

type TransferInput

type TransferInput = neoaccountstypes.TransferInput

type TransferResponse

type TransferResponse = neoaccountstypes.TransferResponse

type UpdateBalanceInput

type UpdateBalanceInput = neoaccountstypes.UpdateBalanceInput

Jump to

Keyboard shortcuts

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