github.com/status-im/status-go@v1.1.0/api/backend.go (about)

     1  package api
     2  
     3  import (
     4  	"crypto/ecdsa"
     5  
     6  	signercore "github.com/ethereum/go-ethereum/signer/core/apitypes"
     7  
     8  	"github.com/status-im/status-go/eth-node/types"
     9  	"github.com/status-im/status-go/multiaccounts"
    10  	"github.com/status-im/status-go/multiaccounts/accounts"
    11  	"github.com/status-im/status-go/multiaccounts/settings"
    12  	"github.com/status-im/status-go/params"
    13  	"github.com/status-im/status-go/services/personal"
    14  	"github.com/status-im/status-go/services/typeddata"
    15  	"github.com/status-im/status-go/transactions"
    16  )
    17  
    18  // StatusBackend defines the contract for the Status.im service
    19  type StatusBackend interface {
    20  	// IsNodeRunning() bool                       // NOTE: Only used in tests
    21  	StartNode(config *params.NodeConfig) error // NOTE: Only used in canary
    22  	StartNodeWithKey(acc multiaccounts.Account, password string, keyHex string, conf *params.NodeConfig) error
    23  	StartNodeWithAccount(acc multiaccounts.Account, password string, conf *params.NodeConfig, chatKey *ecdsa.PrivateKey) error
    24  	StartNodeWithAccountAndInitialConfig(account multiaccounts.Account, password string, settings settings.Settings, conf *params.NodeConfig, subaccs []*accounts.Account, chatKey *ecdsa.PrivateKey) error
    25  	StopNode() error
    26  	// RestartNode() error // NOTE: Only used in tests
    27  
    28  	GetNodeConfig() (*params.NodeConfig, error)
    29  	UpdateRootDataDir(datadir string)
    30  
    31  	// SelectAccount(loginParams account.LoginParams) error
    32  	OpenAccounts() error
    33  	GetAccounts() ([]multiaccounts.Account, error)
    34  	LocalPairingStarted() error
    35  	// SaveAccount(account multiaccounts.Account) error
    36  	SaveAccountAndStartNodeWithKey(acc multiaccounts.Account, password string, settings settings.Settings, conf *params.NodeConfig, subaccs []*accounts.Account, keyHex string) error
    37  	Recover(rpcParams personal.RecoverParams) (types.Address, error)
    38  	Logout() error
    39  
    40  	CallPrivateRPC(inputJSON string) (string, error)
    41  	CallRPC(inputJSON string) (string, error)
    42  	HashTransaction(sendArgs transactions.SendTxArgs) (transactions.SendTxArgs, types.Hash, error)
    43  	HashTypedData(typed typeddata.TypedData) (types.Hash, error)
    44  	HashTypedDataV4(typed signercore.TypedData) (types.Hash, error)
    45  	ResetChainData() error
    46  	SendTransaction(sendArgs transactions.SendTxArgs, password string) (hash types.Hash, err error)
    47  	SendTransactionWithChainID(chainID uint64, sendArgs transactions.SendTxArgs, password string) (hash types.Hash, err error)
    48  	SendTransactionWithSignature(sendArgs transactions.SendTxArgs, sig []byte) (hash types.Hash, err error)
    49  	SignHash(hexEncodedHash string) (string, error)
    50  	SignMessage(rpcParams personal.SignParams) (types.HexBytes, error)
    51  	SignTypedData(typed typeddata.TypedData, address string, password string) (types.HexBytes, error)
    52  	SignTypedDataV4(typed signercore.TypedData, address string, password string) (types.HexBytes, error)
    53  
    54  	ConnectionChange(typ string, expensive bool)
    55  	AppStateChange(state string)
    56  
    57  	ExtractGroupMembershipSignatures(signaturePairs [][2]string) ([]string, error)
    58  	SignGroupMembership(content string) (string, error)
    59  }