Documentation ¶
Index ¶
- Constants
- Variables
- type AppState
- type ConnectionState
- type ConnectionType
- type StatusAPI
- func (api *StatusAPI) AccountManager() *account.Manager
- func (api *StatusAPI) AppStateChange(state string)
- func (api *StatusAPI) ApproveSignRequest(id, password string) sign.Result
- func (api *StatusAPI) ApproveSignRequestWithArgs(id, password string, gas, gasPrice int64) sign.Result
- func (api *StatusAPI) ApproveSignRequests(ids []string, password string) map[string]sign.Result
- func (api *StatusAPI) CallPrivateRPC(inputJSON string) string
- func (api *StatusAPI) CallRPC(inputJSON string) string
- func (api *StatusAPI) ConnectionChange(typ string, expensive bool)
- func (api *StatusAPI) CreateAccount(password string) (address, pubKey, mnemonic string, err error)
- func (api *StatusAPI) CreateAndInitCell(chatID, js string) string
- func (api *StatusAPI) CreateChildAccount(parentAddress, password string) (address, pubKey string, err error)
- func (api *StatusAPI) DiscardSignRequest(id string) error
- func (api *StatusAPI) DiscardSignRequests(ids []string) map[string]error
- func (api *StatusAPI) JailCall(chatID, this, args string) string
- func (api *StatusAPI) JailExecute(chatID, code string) string
- func (api *StatusAPI) JailManager() jail.Manager
- func (api *StatusAPI) JailParse(chatID string, js string) string
- func (api *StatusAPI) Logout() error
- func (api *StatusAPI) NotifyUsers(message string, payload fcm.NotificationPayload, tokens ...string) error
- func (api *StatusAPI) PendingSignRequests() *sign.PendingRequests
- func (api *StatusAPI) RecoverAccount(password, mnemonic string) (address, pubKey string, err error)
- func (api *StatusAPI) ResetChainData() error
- func (api *StatusAPI) ResetChainDataAsync() <-chan error
- func (api *StatusAPI) RestartNode() error
- func (api *StatusAPI) RestartNodeAsync() <-chan error
- func (api *StatusAPI) SelectAccount(address, password string) error
- func (api *StatusAPI) SendTransaction(ctx context.Context, args transactions.SendTxArgs) (gethcommon.Hash, error)
- func (api *StatusAPI) SetJailBaseJS(js string)
- func (api *StatusAPI) StartNode(config *params.NodeConfig) error
- func (api *StatusAPI) StartNodeAsync(config *params.NodeConfig) <-chan error
- func (api *StatusAPI) StatusNode() *node.StatusNode
- func (api *StatusAPI) StopNode() error
- func (api *StatusAPI) StopNodeAsync() <-chan error
- func (api *StatusAPI) Transactor() *transactions.Transactor
- func (api *StatusAPI) VerifyAccountPassword(keyStoreDir, address, password string) (*keystore.Key, error)
- type StatusBackend
- func (b *StatusBackend) AccountManager() *account.Manager
- func (b *StatusBackend) AppStateChange(state string)
- func (b *StatusBackend) ApproveSignRequest(id, password string) sign.Result
- func (b *StatusBackend) ApproveSignRequestWithArgs(id, password string, gas, gasPrice int64) sign.Result
- func (b *StatusBackend) ApproveSignRequests(ids []string, password string) map[string]sign.Result
- func (b *StatusBackend) CallPrivateRPC(inputJSON string) string
- func (b *StatusBackend) CallRPC(inputJSON string) string
- func (b *StatusBackend) ConnectionChange(typ string, expensive bool)
- func (b *StatusBackend) DiscardSignRequest(id string) error
- func (b *StatusBackend) DiscardSignRequests(ids []string) map[string]error
- func (b *StatusBackend) IsNodeRunning() bool
- func (b *StatusBackend) JailManager() jail.Manager
- func (b *StatusBackend) Logout() error
- func (b *StatusBackend) NotifyUsers(message string, payload fcmlib.NotificationPayload, tokens ...string) error
- func (b *StatusBackend) PendingSignRequests() *sign.PendingRequests
- func (b *StatusBackend) PersonalAPI() *personal.PublicAPI
- func (b *StatusBackend) ReSelectAccount() error
- func (b *StatusBackend) ResetChainData() error
- func (b *StatusBackend) RestartNode() error
- func (b *StatusBackend) SelectAccount(address, password string) error
- func (b *StatusBackend) SendTransaction(ctx context.Context, args transactions.SendTxArgs) (hash gethcommon.Hash, err error)
- func (b *StatusBackend) StartNode(config *params.NodeConfig) error
- func (b *StatusBackend) StatusNode() *node.StatusNode
- func (b *StatusBackend) StopNode() error
- func (b *StatusBackend) Transactor() *transactions.Transactor
Constants ¶
const ( AppStateForeground = AppState("active") // these constant values are kept in sync with React Native AppStateBackground = AppState("background") AppStateInactive = AppState("inactive") AppStateInvalid = AppState("") )
Specific app states see https://facebook.github.io/react-native/docs/appstate.html
Variables ¶
var ( // ErrWhisperClearIdentitiesFailure clearing whisper identities has failed. ErrWhisperClearIdentitiesFailure = errors.New("failed to clear whisper identities") // ErrWhisperIdentityInjectionFailure injecting whisper identities has failed. ErrWhisperIdentityInjectionFailure = errors.New("failed to inject identity into Whisper") )
Functions ¶
This section is empty.
Types ¶
type AppState ¶
type AppState string
AppState represents if the app is in foreground, background or some other state
func ParseAppState ¶
ParseAppState creates AppState from a string
type ConnectionState ¶
type ConnectionState struct { Offline bool `json:"offline"` Type ConnectionType `json:"type"` Expensive bool `json:"expensive"` }
ConnectionState represents device connection state and type, as reported by mobile framework.
Zero value represents default assumption about network (online and unknown type).
func (ConnectionState) String ¶
func (c ConnectionState) String() string
String formats ConnectionState for logs. Implements Stringer.
type ConnectionType ¶
type ConnectionType byte
ConnectionType represents description of available connection types as reported by React Native (see https://facebook.github.io/react-native/docs/netinfo.html) We're interested mainly in 'wifi' and 'cellular', but other types are also may be used.
const ( ConnectionUnknown ConnectionType = iota ConnectionCellular // cellular, LTE, 4G, 3G, EDGE, etc. ConnectionWifi // WIFI or iOS simulator )
ConnectionType constants
func NewConnectionType ¶
func NewConnectionType(s string) ConnectionType
NewConnectionType creates new ConnectionType from string.
type StatusAPI ¶
type StatusAPI struct {
// contains filtered or unexported fields
}
StatusAPI provides API to access Status related functionality.
func NewStatusAPIWithBackend ¶
func NewStatusAPIWithBackend(b *StatusBackend) *StatusAPI
NewStatusAPIWithBackend creates a new StatusAPI instance using the passed backend.
func (*StatusAPI) AccountManager ¶
AccountManager returns reference to account manager
func (*StatusAPI) AppStateChange ¶
AppStateChange handles app state changes (background/foreground). state values: see https://facebook.github.io/react-native/docs/appstate.html
func (*StatusAPI) ApproveSignRequest ¶
ApproveSignRequest instructs backend to complete sending of a given transaction
func (*StatusAPI) ApproveSignRequestWithArgs ¶
func (api *StatusAPI) ApproveSignRequestWithArgs(id, password string, gas, gasPrice int64) sign.Result
ApproveSignRequestWithArgs instructs backend to complete sending of a given transaction gas and gasPrice will be overrided with the given values before signing the transaction.
func (*StatusAPI) ApproveSignRequests ¶
ApproveSignRequests instructs backend to complete sending of multiple transactions
func (*StatusAPI) CallPrivateRPC ¶
CallPrivateRPC executes public and private RPC requests on node's in-proc RPC server.
func (*StatusAPI) ConnectionChange ¶
ConnectionChange handles network state changes logic.
func (*StatusAPI) CreateAccount ¶
CreateAccount creates an internal geth account BIP44-compatible keys are generated: CKD#1 is stored as account key, CKD#2 stored as sub-account root Public key of CKD#1 is returned, with CKD#2 securely encoded into account key file (to be used for sub-account derivations)
func (*StatusAPI) CreateAndInitCell ¶
CreateAndInitCell creates a new jail cell context, with the given chatID as identifier. New context executes provided JavaScript code, right after the initialization.
func (*StatusAPI) CreateChildAccount ¶
func (api *StatusAPI) CreateChildAccount(parentAddress, password string) (address, pubKey string, err error)
CreateChildAccount creates sub-account for an account identified by parent address. CKD#2 is used as root for master accounts (when parentAddress is ""). Otherwise (when parentAddress != ""), child is derived directly from parent.
func (*StatusAPI) DiscardSignRequest ¶
DiscardSignRequest discards a given transaction from transaction queue
func (*StatusAPI) DiscardSignRequests ¶
DiscardSignRequests discards given multiple transactions from transaction queue
func (*StatusAPI) JailCall ¶
JailCall executes given JavaScript function w/i a jail cell context identified by the chatID.
func (*StatusAPI) JailExecute ¶
JailExecute allows to run arbitrary JS code within a jail cell.
func (*StatusAPI) JailManager ¶
JailManager returns reference to jail
func (*StatusAPI) JailParse ¶
JailParse creates a new jail cell context, with the given chatID as identifier. New context executes provided JavaScript code, right after the initialization. DEPRECATED in favour of CreateAndInitCell.
func (*StatusAPI) NotifyUsers ¶
func (api *StatusAPI) NotifyUsers(message string, payload fcm.NotificationPayload, tokens ...string) error
NotifyUsers send notifications to users.
func (*StatusAPI) PendingSignRequests ¶
func (api *StatusAPI) PendingSignRequests() *sign.PendingRequests
PendingSignRequests returns reference to a list of current sign requests
func (*StatusAPI) RecoverAccount ¶
RecoverAccount re-creates master key using given details. Once master key is re-generated, it is inserted into keystore (if not already there).
func (*StatusAPI) ResetChainData ¶
ResetChainData remove chain data from data directory. Node is stopped, and new node is started, with clean data directory.
func (*StatusAPI) ResetChainDataAsync ¶
ResetChainDataAsync remove chain data from data directory, in async manner
func (*StatusAPI) RestartNode ¶
RestartNode restart running Status node, fails if node is not running
func (*StatusAPI) RestartNodeAsync ¶
RestartNodeAsync restart running Status node, in async manner
func (*StatusAPI) SelectAccount ¶
SelectAccount selects current account, by verifying that address has corresponding account which can be decrypted using provided password. Once verification is done, decrypted key is injected into Whisper (as a single identity, all previous identities are removed).
func (*StatusAPI) SendTransaction ¶
func (api *StatusAPI) SendTransaction(ctx context.Context, args transactions.SendTxArgs) (gethcommon.Hash, error)
SendTransaction creates a new transaction and waits until it's complete.
func (*StatusAPI) SetJailBaseJS ¶
SetJailBaseJS allows to setup initial JavaScript to be loaded on each jail.CreateAndInitCell().
func (*StatusAPI) StartNode ¶
func (api *StatusAPI) StartNode(config *params.NodeConfig) error
StartNode start Status node, fails if node is already started
func (*StatusAPI) StartNodeAsync ¶
func (api *StatusAPI) StartNodeAsync(config *params.NodeConfig) <-chan error
StartNodeAsync start Status node, fails if node is already started Returns immediately w/o waiting for node to start (see node.ready)
func (*StatusAPI) StatusNode ¶
func (api *StatusAPI) StatusNode() *node.StatusNode
StatusNode returns reference to StatusNode.
func (*StatusAPI) StopNodeAsync ¶
StopNodeAsync stop Status node. Stopped node cannot be resumed. Returns immediately, w/o waiting for node to stop (see node.stopped)
func (*StatusAPI) Transactor ¶
func (api *StatusAPI) Transactor() *transactions.Transactor
Transactor returns reference to a status transactor
func (*StatusAPI) VerifyAccountPassword ¶
func (api *StatusAPI) VerifyAccountPassword(keyStoreDir, address, password string) (*keystore.Key, error)
VerifyAccountPassword tries to decrypt a given account key file, with a provided password. If no error is returned, then account is considered verified.
type StatusBackend ¶
type StatusBackend struct {
// contains filtered or unexported fields
}
StatusBackend implements Status.im service
func NewStatusBackend ¶
func NewStatusBackend() *StatusBackend
NewStatusBackend create a new NewStatusBackend instance
func (*StatusBackend) AccountManager ¶
func (b *StatusBackend) AccountManager() *account.Manager
AccountManager returns reference to account manager
func (*StatusBackend) AppStateChange ¶
func (b *StatusBackend) AppStateChange(state string)
AppStateChange handles app state changes (background/foreground). state values: see https://facebook.github.io/react-native/docs/appstate.html
func (*StatusBackend) ApproveSignRequest ¶
func (b *StatusBackend) ApproveSignRequest(id, password string) sign.Result
ApproveSignRequest instructs backend to complete sending of a given transaction.
func (*StatusBackend) ApproveSignRequestWithArgs ¶
func (b *StatusBackend) ApproveSignRequestWithArgs(id, password string, gas, gasPrice int64) sign.Result
ApproveSignRequestWithArgs instructs backend to complete sending of a given transaction. gas and gasPrice will be overrided with the given values before signing the transaction.
func (*StatusBackend) ApproveSignRequests ¶
ApproveSignRequests instructs backend to complete sending of multiple transactions
func (*StatusBackend) CallPrivateRPC ¶
func (b *StatusBackend) CallPrivateRPC(inputJSON string) string
CallPrivateRPC executes public and private RPC requests on node's in-proc RPC server.
func (*StatusBackend) CallRPC ¶
func (b *StatusBackend) CallRPC(inputJSON string) string
CallRPC executes public RPC requests on node's in-proc RPC server.
func (*StatusBackend) ConnectionChange ¶
func (b *StatusBackend) ConnectionChange(typ string, expensive bool)
ConnectionChange handles network state changes logic.
func (*StatusBackend) DiscardSignRequest ¶
func (b *StatusBackend) DiscardSignRequest(id string) error
DiscardSignRequest discards a given transaction from transaction queue
func (*StatusBackend) DiscardSignRequests ¶
func (b *StatusBackend) DiscardSignRequests(ids []string) map[string]error
DiscardSignRequests discards given multiple transactions from transaction queue
func (*StatusBackend) IsNodeRunning ¶
func (b *StatusBackend) IsNodeRunning() bool
IsNodeRunning confirm that node is running
func (*StatusBackend) JailManager ¶
func (b *StatusBackend) JailManager() jail.Manager
JailManager returns reference to jail
func (*StatusBackend) Logout ¶
func (b *StatusBackend) Logout() error
Logout clears whisper identities.
func (*StatusBackend) NotifyUsers ¶
func (b *StatusBackend) NotifyUsers(message string, payload fcmlib.NotificationPayload, tokens ...string) error
NotifyUsers sends push notifications to users.
func (*StatusBackend) PendingSignRequests ¶
func (b *StatusBackend) PendingSignRequests() *sign.PendingRequests
PendingSignRequests returns reference to a list of current sign requests
func (*StatusBackend) PersonalAPI ¶
func (b *StatusBackend) PersonalAPI() *personal.PublicAPI
PersonalAPI returns reference to personal APIs
func (*StatusBackend) ReSelectAccount ¶
func (b *StatusBackend) ReSelectAccount() error
ReSelectAccount selects previously selected account, often, after node restart.
func (*StatusBackend) ResetChainData ¶
func (b *StatusBackend) ResetChainData() error
ResetChainData remove chain data from data directory. Node is stopped, and new node is started, with clean data directory.
func (*StatusBackend) RestartNode ¶
func (b *StatusBackend) RestartNode() error
RestartNode restart running Status node, fails if node is not running
func (*StatusBackend) SelectAccount ¶
func (b *StatusBackend) SelectAccount(address, password string) error
SelectAccount selects current account, by verifying that address has corresponding account which can be decrypted using provided password. Once verification is done, decrypted key is injected into Whisper (as a single identity, all previous identities are removed).
func (*StatusBackend) SendTransaction ¶
func (b *StatusBackend) SendTransaction(ctx context.Context, args transactions.SendTxArgs) (hash gethcommon.Hash, err error)
SendTransaction creates a new transaction and waits until it's complete.
func (*StatusBackend) StartNode ¶
func (b *StatusBackend) StartNode(config *params.NodeConfig) error
StartNode start Status node, fails if node is already started
func (*StatusBackend) StatusNode ¶
func (b *StatusBackend) StatusNode() *node.StatusNode
StatusNode returns reference to node manager
func (*StatusBackend) StopNode ¶
func (b *StatusBackend) StopNode() error
StopNode stop Status node. Stopped node cannot be resumed.
func (*StatusBackend) Transactor ¶
func (b *StatusBackend) Transactor() *transactions.Transactor
Transactor returns reference to a status transactor