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
- type AccountInfo
- type BatchSignInput
- type BatchSignResponse
- type Client
- func (c *Client) BatchSign(ctx context.Context, requests []SignRequest) (*BatchSignResponse, error)
- func (c *Client) DeployContract(ctx context.Context, accountID, nefBase64, manifestJSON string, data any) (*DeployContractResponse, error)
- func (c *Client) DeployMaster(ctx context.Context, nefBase64, manifestJSON string, data any) (*DeployMasterResponse, error)
- func (c *Client) FundAccount(ctx context.Context, toAddress string, amount int64) (*FundAccountResponse, error)
- func (c *Client) GetLockedAccounts(ctx context.Context, tokenType string, minBalance *int64) ([]AccountInfo, error)
- func (c *Client) GetMasterKeyAttestation(ctx context.Context) (*MasterKeyAttestation, error)
- func (c *Client) GetPoolInfo(ctx context.Context) (*PoolInfoResponse, error)
- func (c *Client) InvokeContract(ctx context.Context, accountID, contractAddress, method string, ...) (*InvokeContractResponse, error)
- func (c *Client) InvokeMaster(ctx context.Context, contractAddress, method string, params []ContractParam, ...) (*InvokeContractResponse, error)
- func (c *Client) ListLowBalanceAccounts(ctx context.Context, tokenType string, maxBalance int64, limit int) ([]AccountInfo, error)
- func (c *Client) ReleaseAccounts(ctx context.Context, accountIDs []string) (*ReleaseAccountsResponse, error)
- func (c *Client) RequestAccounts(ctx context.Context, count int, purpose string) (*RequestAccountsResponse, error)
- func (c *Client) SignTransaction(ctx context.Context, accountID string, txHash []byte) (*SignTransactionResponse, error)
- func (c *Client) SimulateContract(ctx context.Context, accountID, contractAddress, method string, ...) (*SimulateContractResponse, error)
- func (c *Client) Transfer(ctx context.Context, accountID, toAddress string, amount int64, ...) (*TransferResponse, error)
- func (c *Client) TransferWithData(ctx context.Context, accountID, toAddress string, amount int64, data string) (*TransferWithDataResponse, error)
- func (c *Client) UpdateBalance(ctx context.Context, accountID, token string, delta int64, absolute *int64) (*UpdateBalanceResponse, error)
- func (c *Client) UpdateContract(ctx context.Context, ...) (*UpdateContractResponse, error)
- type Config
- type ContractParam
- type DeployContractInput
- type DeployContractResponse
- type DeployMasterInput
- type DeployMasterResponse
- type FundAccountInput
- type FundAccountResponse
- type InvokeContractInput
- type InvokeContractResponse
- type InvokeMasterInput
- type ListAccountsResponse
- type MasterKeyAttestation
- type PoolInfoResponse
- type ReleaseAccountsInput
- type ReleaseAccountsResponse
- type RequestAccountsInput
- type RequestAccountsResponse
- type SignRequest
- type SignTransactionInput
- type SignTransactionResponse
- type SimulateContractInput
- type SimulateContractResponse
- type TokenBalance
- type TokenStats
- type TransferInput
- type TransferResponse
- type TransferWithDataInput
- type TransferWithDataResponse
- type UpdateBalanceInput
- type UpdateBalanceResponse
- type UpdateContractInput
- type UpdateContractResponse
Constants ¶
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 (*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 DeployContractInput ¶
type DeployContractInput = neoaccountstypes.DeployContractInput
type DeployContractResponse ¶
type DeployContractResponse = neoaccountstypes.DeployContractResponse
type DeployMasterInput ¶
type DeployMasterInput = neoaccountstypes.DeployMasterInput
Deploy with master wallet types
type DeployMasterResponse ¶
type DeployMasterResponse = neoaccountstypes.DeployMasterResponse
type FundAccountInput ¶
type FundAccountInput = neoaccountstypes.FundAccountInput
Fund account types - transfer from master wallet to pool accounts
type FundAccountResponse ¶
type FundAccountResponse = neoaccountstypes.FundAccountResponse
type InvokeContractInput ¶
type InvokeContractInput = neoaccountstypes.InvokeContractInput
type InvokeContractResponse ¶
type InvokeContractResponse = neoaccountstypes.InvokeContractResponse
type InvokeMasterInput ¶
type InvokeMasterInput = neoaccountstypes.InvokeMasterInput
type ListAccountsResponse ¶
type ListAccountsResponse = neoaccountstypes.ListAccountsResponse
type MasterKeyAttestation ¶
type MasterKeyAttestation = neoaccountstypes.MasterKeyAttestation
type PoolInfoResponse ¶
type PoolInfoResponse = neoaccountstypes.PoolInfoResponse
type ReleaseAccountsInput ¶
type ReleaseAccountsInput = neoaccountstypes.ReleaseAccountsInput
type ReleaseAccountsResponse ¶
type ReleaseAccountsResponse = neoaccountstypes.ReleaseAccountsResponse
type RequestAccountsInput ¶
type RequestAccountsInput = neoaccountstypes.RequestAccountsInput
type RequestAccountsResponse ¶
type RequestAccountsResponse = neoaccountstypes.RequestAccountsResponse
type SignRequest ¶
type SignRequest = neoaccountstypes.SignRequest
type SignTransactionInput ¶
type SignTransactionInput = neoaccountstypes.SignTransactionInput
type SignTransactionResponse ¶
type SignTransactionResponse = neoaccountstypes.SignTransactionResponse
type SimulateContractInput ¶
type SimulateContractInput = neoaccountstypes.SimulateContractInput
type SimulateContractResponse ¶
type SimulateContractResponse = neoaccountstypes.SimulateContractResponse
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 TransferWithDataInput ¶
type TransferWithDataInput = neoaccountstypes.TransferWithDataInput
type TransferWithDataResponse ¶
type TransferWithDataResponse = neoaccountstypes.TransferWithDataResponse
type UpdateBalanceInput ¶
type UpdateBalanceInput = neoaccountstypes.UpdateBalanceInput
type UpdateBalanceResponse ¶
type UpdateBalanceResponse = neoaccountstypes.UpdateBalanceResponse
type UpdateContractInput ¶
type UpdateContractInput = neoaccountstypes.UpdateContractInput
type UpdateContractResponse ¶
type UpdateContractResponse = neoaccountstypes.UpdateContractResponse