wallet

package
v0.179.11 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: MPL-2.0 Imports: 67 Imported by: 0

README

Wallet service API

Wallet service provides RPC API for checking transfers history and other methods related to wallet functionality. To enable service two values need to be changed in the config:

  1. Set Enable to true in WalletConfig
{
  "WalletConfig": {
    "Enabled": true,
  }
}
  1. And expose wallet API with APIModules
{
  APIModules: "eth,net,web3,peer,wallet",
}

API

wallet_getTransfersByAddress

Returns avaiable transfers in a given range.

Parameters
  • address: HEX - ethereum address encoded in hex
  • toBlock: BIGINT - end of the range. if nil query will return last transfers.
  • limit: BIGINT - limit of returned transfers.
  • fetchMore: BOOLEAN - if true, there are less than limit fetched transfers in the database, and zero block is not reached yet, history will be scanned for more transfers. If false only transfers which are already fetched to the app's database will be returned.
Examples
{
  "jsonrpc":"2.0",
  "id":7,
  "method":"wallet_getTransfersByAddress",
  "params":[
    "0xb81a6845649fa8c042dfaceb3f7a684873406993",
    "0x0",
    "0x5",
    true
  ]
}
Returns
[
  {
    "id":"0xb1a8adeaa0e6727bf01d6d8431b6238bdefa915e19ae7e8ceb16886c9f5e",
    "type":"eth",
    "address":"0xd65f3cb52605a54a833ae118fb13",
    "blockNumber":"0xb7190",
    "blockhash":"0x8d98aa2297fe322d0093b24372e2ead98414959093b479baf670",
    "timestamp":"0x6048ec6",
    "gasPrice":"0x346308a00",
    "gasLimit":"0x508",
    "gasUsed":"0x520",
    "nonce":"0x13",
    "txStatus":"0x1",
    "input":"0x",
    "txHash":"0x1adeaa0e672d7e67bf01d8431b6238bdef15e19ae7e8ceb16886c",
    "value":"0x1",
    "from":"0x2f865fb5dfdf0dfdf54a833ae118fb1363aaasd",
    "to":"0xaaaaaaf3cb52605a54a833ae118fb1363a123123",
    "contract":"0x0000000000000000000000000000000000000000",
    "NetworkID":1
  },...
]
GetTransfersByAddressAndChainID

Returns avaiable transfers in a given range.

Parameters
  • chainID: INT - ethereum chain ID
  • address: HEX - ethereum address encoded in hex
  • toBlock: BIGINT - end of the range. if nil query will return last transfers.
  • limit: BIGINT - limit of returned transfers.
  • fetchMore: BOOLEAN - if true, there are less than limit fetched transfers in the database, and zero block is not reached yet, history will be scanned for more transfers. If false only transfers which are already fetched to the app's database will be returned.
Examples
{
  "jsonrpc":"2.0",
  "id":7,
  "method":"wallet_getTransfersByAddressAndChainID",
  "params":[
    1,
    "0xb81a6845649fa8c042dfaceb3f7a684873406993",
    "0x0",
    "0x5",
    true
  ]
}
Returns
[
  {
    "id":"0xb1a8adeaa0e6727bf01d6d8431b6238bdefa915e19ae7e8ceb16886c9f5e",
    "type":"eth",
    "address":"0xd65f3cb52605a54a833ae118fb13",
    "blockNumber":"0xb7190",
    "blockhash":"0x8d98aa2297fe322d0093b24372e2ead98414959093b479baf670",
    "timestamp":"0x6048ec6",
    "gasPrice":"0x346308a00",
    "gasLimit":"0x508",
    "gasUsed":"0x520",
    "nonce":"0x13",
    "txStatus":"0x1",
    "input":"0x",
    "txHash":"0x1adeaa0e672d7e67bf01d8431b6238bdef15e19ae7e8ceb16886c",
    "value":"0x1",
    "from":"0x2f865fb5dfdf0dfdf54a833ae118fb1363aaasd",
    "to":"0xaaaaaaf3cb52605a54a833ae118fb1363a123123",
    "contract":"0x0000000000000000000000000000000000000000",
    "NetworkID":1
  },...
]
wallet_watchTransaction

Starts watching for transaction confirmation/rejection. If transaction was not confirmed/rejected in 10 minutes the call is timed out with error.

Parameters
  • tx-id: HEX - transaction hash
Example
{
  "jsonrpc":"2.0",
  "id":7,
  "method":"wallet_watchTransaction",
  "params":[
    "0xaaaaaaaa11111112222233333333"
  ]
}
wallet_watchTransactionByChainID

Starts watching for transaction confirmation/rejection. If transaction was not confirmed/rejected in 10 minutes the call is timed out with error.

Parameters
  • chainID: HEX - ethereum chain id
  • tx-id: HEX - transaction hash
Example
{
  "jsonrpc":"2.0",
  "id":7,
  "method":"wallet_watchTransactionByChainID",
  "params":[
    1,
    "0xaaaaaaaa11111112222233333333"
  ]
}
wallet_checkRecentHistory
Parameters
  • addresses: []HEX - array of addresses to be checked
Example
{
  "jsonrpc":"2.0",
  "id":1,
  "method":"wallet_checkRecentHistory",
  "params":[
    [
      "0x23458d65f3cB52605a54AaA833ae118fb1111aaa",
      "0x24568B4166D11aaa1194097C60Cdc714F7e11111"
    ]
  ]
}
wallet_checkRecentHistoryForChainIDs
Parameters
  • chainIDs: []INT - array of ethereum chain ID to be checked
  • addresses: []HEX - array of addresses to be checked
Example
{
  "jsonrpc":"2.0",
  "id":1,
  "method":"wallet_checkRecentHistoryForChainIDs",
  "params":[
    [1, 2],
    [
      "0x23458d65f3cB52605a54AaA833ae118fb1111aaa",
      "0x24568B4166D11aaa1194097C60Cdc714F7e11111"
    ]
  ]
}
wallet_getTokensBalancesForChainIDs

Returns tokens balances mapping for every account. See section below for the response example.

Parameters
  • chainIDs: []INT - array of ethereum chain ID
  • accounts HEX - list of ethereum addresses encoded in hex
  • tokens HEX - list of ethereum addresses encoded in hex
Request
{"jsonrpc":"2.0","id":11,"method":"wallet_getTokensBalancesForChainIDs","params":[
  [1, 2]
  ["0x066ed5c2ed45d70ad72f40de0b4dd97bd67d84de", "0x0ed535be4c0aa276942a1a782669790547ad8768"], 
  ["0x5e4bbdc178684478a615354d83c748a4393b20f0", "0x5e4bbdc178684478a615354d83c748a4393b20f0"]]
}
Returns

First level keys accounts, second level keys are tokens.

{
  "0x066ed5c2ed45d70ad72f40de0b4dd97bd67d84de": {
    "0x1dfb2099f936b3e98bfc9b7059a8fb04edcce5b3": 12,
    "0x5e4bbdc178684478a615354d83c748a4393b20f0": 12
  },
  "0x0ed535be4c0aa276942a1a782669790547ad8768": {
    "0x1dfb2099f936b3e98bfc9b7059a8fb04edcce5b3": 14,
    "0x5e4bbdc178684478a615354d83c748a4393b20f0": 14
  }
}
wallet_getTokensBalances

Returns tokens balances mapping for every account. See section below for the response example.

Parameters
  • accounts HEX - list of ethereum addresses encoded in hex
  • tokens HEX - list of ethereum addresses encoded in hex
Request
{"jsonrpc":"2.0","id":11,"method":"wallet_getTokensBalances","params":[["0x066ed5c2ed45d70ad72f40de0b4dd97bd67d84de", "0x0ed535be4c0aa276942a1a782669790547ad8768"], ["0x5e4bbdc178684478a615354d83c748a4393b20f0", "0x5e4bbdc178684478a615354d83c748a4393b20f0"]]}
Returns

First level keys accounts, second level keys are tokens.

{
  "0x066ed5c2ed45d70ad72f40de0b4dd97bd67d84de": {
    "0x1dfb2099f936b3e98bfc9b7059a8fb04edcce5b3": 12,
    "0x5e4bbdc178684478a615354d83c748a4393b20f0": 12
  },
  "0x0ed535be4c0aa276942a1a782669790547ad8768": {
    "0x1dfb2099f936b3e98bfc9b7059a8fb04edcce5b3": 14,
    "0x5e4bbdc178684478a615354d83c748a4393b20f0": 14
  }
}
wallet_storePendingTransaction

Stores pending transation in the database.

Parameters
  • transaction OBJECT - list of ethereum addresses encoded in hex
Transaction
  • hash HEX
  • timestamp ``INT`
  • from HEX
  • to HEX
  • symbol VARCHAR - "ETH" for ethereum, otherwise ERC20 tokaen name, null for contract call
  • gasPrice BIGINT
  • gasLimit BIGINT
  • value BIGINT
  • data TEXT - transaction's data field
  • type VARCHAR
  • additionalData TEXT - arbitrary additional data
  • network_id INT - an optional network id
Request example
{
  "jsonrpc":"2.0",
  "id":1,
  "method":"wallet_storePendingTransaction",
  "params":[
    {
      "hash":"0x3bce2c2d0fffbd2862ef3ec61a62872e54954551585fa0072d8e5c2f6be3523e",
      "symbol":"ETH",
      "gasPrice":"2000000000",
      "value":"1000000000000000",
      "from":"0xaaaad65f3cB52605433ae118fb1363aaaaad2",
      "timestamp":1618584138787,
      "gasLimit":"21000",
      "to":"0x237f8B4166D64a2b94097C60Cdc714F7eC3aa079",
      "data":null
    }
  ]
}
wallet_getPendingTransactions

Returns all stored pending transactions.

Request
{"jsonrpc":"2.0","id":1,"method":"wallet_getPendingTransactions","params":[]}
Returns

First level keys accounts, second level keys are tokens.

{
  "jsonrpc":"2.0",
  "id":1,
  "result":[
    {
      "hash":"0x3bce2c2d0fffbd2862ef3ec61a62872e54954551585fa0072d8e5c2f6be3523e",
      "timestamp":1618584138787,
      "value":"1000000000000000",
      "from":"0xaaaaaaaa605a54a833ae118fb1aaaaaaaaaaa",
      "to":"0x237f8b4166d64a2b94097c60cdc714f7ec3aa079",
      "data":"",
      "symbol":"ETH",
      "gasPrice":"2000000000",
      "gasLimit":"21000",
      "type":"",
      "additionalData":""
    },
    ...
  ]
}
wallet_getPendingTransactionsByChainID

Returns all stored pending transactions.

Parameters
  • chainID INT - ethereum chain ID
Request
{"jsonrpc":"2.0","id":1,"method":"wallet_getPendingTransactions","params":[1]}
Returns

First level keys accounts, second level keys are tokens.

{
  "jsonrpc":"2.0",
  "id":1,
  "result":[
    {
      "hash":"0x3bce2c2d0fffbd2862ef3ec61a62872e54954551585fa0072d8e5c2f6be3523e",
      "timestamp":1618584138787,
      "value":"1000000000000000",
      "from":"0xaaaaaaaa605a54a833ae118fb1aaaaaaaaaaa",
      "to":"0x237f8b4166d64a2b94097c60cdc714f7ec3aa079",
      "data":"",
      "symbol":"ETH",
      "gasPrice":"2000000000",
      "gasLimit":"21000",
      "type":"",
      "additionalData":"",
      "network_id": 1
    },
    ...
  ]
}
wallet_getPendingOutboundTransactionsByAddress

Returns all stored pending transaction sent from address.

Parameters
  • address HEX
Request
{
  "jsonrpc":"2.0",
  "id":1,
  "method":"wallet_getPendingOutboundTransactionsByAddress",
  "params":[
    "0xaaaaaaaa605a54a833ae118fb1aaaaaaaaaaa"
  ]
}
Returns

First level keys accounts, second level keys are tokens.

{
  "jsonrpc":"2.0",
  "id":1,
  "result":[
    {
      "hash":"0x3bce2c2d0fffbd2862ef3ec61a62872e54954551585fa0072d8e5c2f6be3523e",
      "timestamp":1618584138787,
      "value":"1000000000000000",
      "from":"0xaaaaaaaa605a54a833ae118fb1aaaaaaaaaaa",
      "to":"0x237f8b4166d64a2b94097c60cdc714f7ec3aa079",
      "data":"",
      "symbol":"ETH",
      "gasPrice":"2000000000",
      "gasLimit":"21000",
      "type":"",
      "additionalData":""
    },
    ...
  ]
}
wallet_getPendingOutboundTransactionsByAddressAndChainID

Returns all stored pending transaction sent from address.

Parameters
  • chainID INT
  • address HEX
Request
{
  "jsonrpc":"2.0",
  "id":1,
  "method":"wallet_getPendingOutboundTransactionsByAddress",
  "params":[
    1,
    "0xaaaaaaaa605a54a833ae118fb1aaaaaaaaaaa"
  ]
}
Returns

First level keys accounts, second level keys are tokens.

{
  "jsonrpc":"2.0",
  "id":1,
  "result":[
    {
      "hash":"0x3bce2c2d0fffbd2862ef3ec61a62872e54954551585fa0072d8e5c2f6be3523e",
      "timestamp":1618584138787,
      "value":"1000000000000000",
      "from":"0xaaaaaaaa605a54a833ae118fb1aaaaaaaaaaa",
      "to":"0x237f8b4166d64a2b94097c60cdc714f7ec3aa079",
      "data":"",
      "symbol":"ETH",
      "gasPrice":"2000000000",
      "gasLimit":"21000",
      "type":"",
      "additionalData":"",
      "network_id": 1
    },
    ...
  ]
}
wallet_deletePendingTransaction

Deletes pending transaction from the database by hash.

Parameters
  • hash HEX
Request
{
  "jsonrpc":"2.0",
  "id":1,
  "method":"wallet_deletePendingTransaction",
  "params":[
    "0x3bce2c2d0fffbd2862ef3ec61a62872e54954551585fa0072d8e5c2f6be3523e"
  ]
}
wallet_deletePendingTransactionByChainID

Deletes pending transaction from the database by hash.

Parameters
  • chainID INT
  • hash HEX
Request
{
  "jsonrpc":"2.0",
  "id":1,
  "method":"wallet_deletePendingTransaction",
  "params":[
    1,
    "0x3bce2c2d0fffbd2862ef3ec61a62872e54954551585fa0072d8e5c2f6be3523e"
  ]
}

Signals


All events are of the same format:

{
  "type": "wallet",
  "event": {
    "type": "event-type",
    "blockNumber": 0,
    "accounts": [
      "0x42c8f505b4006d417dd4e0ba0e880692986adbd8",
      "0x3129mdasmeo132128391fml1130410k312312mll"
    ],
    "message": "something might be here"
  }
}
  1. new-transfers

Emitted when transfers are detected. In this case block number is a block number of the latest found transfer. Client expected to request transfers starting from received block.

  1. recent-history-fetching

Emitted when history scanning is started.

  1. recent-history-ready

Emitted when history scanning is ended.

  1. fetching-history-error

Emitted when when history can't be fetched because some error. Error's decritption can be found in message field.

  1. non-archival-node-detected

Emitted when the application is connected to a non-archival node.

Flows

Account creation

When a new multiaccount is created corresponding address will not contain any transaction. Thus no point in checking history, it will be empty.

  1. Call wallet_checkRecentHistory
  2. On recent-history-ready request transactions via wallet_getTransfersByAddress
  3. Repeat wallet_checkRecentHistory in N minutes (currently 20 minutes in status-mobile for upstream RPC node. If a custom node is used interval can be arbitrary)
Logging into application
  1. Call wallet_checkRecentHistory
  2. On recent-history-ready request transactions via wallet_getTransfersByAddress
  3. Repeat wallet_checkRecentHistory in N minutes (currently 20 minutes in status-mobile for upstream RPC node. If a custom node is used interval can be arbitrary)
Watching transaction
  1. Call wallet_watchTransaction
  2. On success call wallet_checkRecentHistory
  3. On recent-history-ready request transactions via wallet_getTransfersByAddress

Documentation

Index

Constants

View Source
const ERC1155TransferString = "ERC1155Transfer"
View Source
const ERC721TransferString = "ERC721Transfer"
View Source
const EstimatePubKey = "" /* 132-byte string literal not displayed */
View Source
const EstimateUsername = "RandomUsername"
View Source
const (
	EventBlockchainStatusChanged walletevent.EventType = "wallet-blockchain-status-changed"
)
View Source
const EventWalletTickCheckConnected walletevent.EventType = "wallet-tick-check-connected"
View Source
const EventWalletTickReload walletevent.EventType = "wallet-tick-reload"

WalletTickReload emitted every 15mn to reload the wallet balance and history

Variables

This section is empty.

Functions

This section is empty.

Types

type API

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

API is class with methods available over RPC.

func NewAPI

func NewAPI(s *Service) *API

func (*API) AddCustomToken added in v0.38.1

func (api *API) AddCustomToken(ctx context.Context, token token.Token) error

func (*API) AddEthereumChain added in v0.86.7

func (api *API) AddEthereumChain(ctx context.Context, network params.Network) error

func (*API) AddressExists added in v0.152.3

func (api *API) AddressExists(ctx context.Context, address types.Address) (bool, error)

func (*API) BuildRawTransaction added in v0.171.27

func (api *API) BuildRawTransaction(ctx context.Context, chainID uint64, sendTxArgsJSON string, signature string) (response *transfer.TxResponse, err error)

func (*API) BuildTransaction added in v0.171.25

func (api *API) BuildTransaction(ctx context.Context, chainID uint64, sendTxArgsJSON string) (response *transfer.TxResponse, err error)

func (*API) CancelActivityFilterTask added in v0.167.5

func (api *API) CancelActivityFilterTask(requestID int32) error

@deprecated replaced by session APIs; see #12120

func (*API) CheckRecentHistory added in v0.75.0

func (api *API) CheckRecentHistory(ctx context.Context, addresses []common.Address) error

@deprecated

func (*API) CheckRecentHistoryForChainIDs added in v0.86.7

func (api *API) CheckRecentHistoryForChainIDs(ctx context.Context, chainIDs []uint64, addresses []common.Address) error

@deprecated

func (*API) CreateMultiTransaction added in v0.103.2

func (api *API) CreateMultiTransaction(ctx context.Context, multiTransactionCommand *transfer.MultiTransactionCommand, data []*bridge.TransactionBridge, password string) (*transfer.MultiTransactionCommandResult, error)

func (*API) DeleteCustomToken added in v0.38.1

func (api *API) DeleteCustomToken(ctx context.Context, address common.Address) error

@deprecated

func (*API) DeleteCustomTokenByChainID added in v0.86.7

func (api *API) DeleteCustomTokenByChainID(ctx context.Context, chainID uint64, address common.Address) error

func (*API) DeleteEthereumChain added in v0.86.7

func (api *API) DeleteEthereumChain(ctx context.Context, chainID uint64) error

func (*API) DiscoverToken added in v0.98.1

func (api *API) DiscoverToken(ctx context.Context, chainID uint64, address common.Address) (*token.Token, error)

func (*API) FetchAllCurrencyFormats added in v0.131.11

func (api *API) FetchAllCurrencyFormats() (currency.FormatPerSymbol, error)

func (*API) FetchBalancesByOwnerAndContractAddress added in v0.162.5

func (api *API) FetchBalancesByOwnerAndContractAddress(ctx context.Context, chainID wcommon.ChainID, ownerAddress common.Address, contractAddresses []common.Address) (thirdparty.TokenBalancesPerContractAddress, error)

func (*API) FetchChainIDForURL added in v0.162.5

func (api *API) FetchChainIDForURL(ctx context.Context, rpcURL string) (*big.Int, error)

func (*API) FetchDecodedTxData added in v0.159.2

func (api *API) FetchDecodedTxData(ctx context.Context, data string) (*thirdparty.DataParsed, error)

func (*API) FetchMarketValues added in v0.106.1

func (api *API) FetchMarketValues(ctx context.Context, symbols []string, currency string) (map[string]thirdparty.TokenMarketValues, error)

@deprecated

func (*API) FetchOrGetCachedWalletBalances added in v0.173.0

func (api *API) FetchOrGetCachedWalletBalances(ctx context.Context, addresses []common.Address) (map[common.Address][]Token, error)

func (*API) FetchPrices added in v0.96.4

func (api *API) FetchPrices(ctx context.Context, symbols []string, currencies []string) (map[string]map[string]float64, error)

@deprecated

func (*API) FetchTokenDetails added in v0.106.1

func (api *API) FetchTokenDetails(ctx context.Context, symbols []string) (map[string]thirdparty.TokenDetails, error)

@deprecated

func (*API) FilterActivityAsync added in v0.158.0

func (api *API) FilterActivityAsync(requestID int32, addresses []common.Address, chainIDs []wcommon.ChainID, filter activity.Filter, offset int, limit int) error

@deprecated replaced by session APIs; see #12120

func (*API) GetActivityCollectiblesAsync added in v0.167.5

func (api *API) GetActivityCollectiblesAsync(requestID int32, chainIDs []wcommon.ChainID, addresses []common.Address, offset int, limit int) error

func (*API) GetAddressDetails added in v0.142.1

func (api *API) GetAddressDetails(ctx context.Context, chainID uint64, address string) (*DerivedAddress, error)

Returns details for the passed address (response doesn't include derivation path)

func (*API) GetBalanceHistory added in v0.114.3

func (api *API) GetBalanceHistory(ctx context.Context, chainIDs []uint64, addresses []common.Address, tokenSymbol string, currencySymbol string, timeInterval history.TimeInterval) ([]*history.ValuePoint, error)

GetBalanceHistory retrieves token balance history for token identity on multiple chains

func (*API) GetBalanceHistoryRange added in v0.168.1

func (api *API) GetBalanceHistoryRange(ctx context.Context, chainIDs []uint64, addresses []common.Address, tokenSymbol string, currencySymbol string, fromTimestamp uint64, _ uint64) ([]*history.ValuePoint, error)

GetBalanceHistoryRange retrieves token balance history for token identity on multiple chains for a time range 'toTimestamp' is ignored for now, but will be used in the future to limit the range of the history

func (*API) GetBalancesByChain added in v0.171.39

func (api *API) GetBalancesByChain(ctx context.Context, chainIDs []uint64, addresses, tokens []common.Address) (map[uint64]map[common.Address]map[common.Address]*hexutil.Big, error)

GetBalancesByChain return a map with key as chain id and value as map of account address and map of token address and balance [chainID]account[token]balance

func (*API) GetCachedCurrencyFormats added in v0.131.11

func (api *API) GetCachedCurrencyFormats() (currency.FormatPerSymbol, error)

func (*API) GetCachedWalletTokensWithoutMarketData added in v0.151.13

func (api *API) GetCachedWalletTokensWithoutMarketData(ctx context.Context) (map[common.Address][]Token, error)

func (*API) GetCollectibleOwnersByContractAddress added in v0.146.3

func (api *API) GetCollectibleOwnersByContractAddress(ctx context.Context, chainID wcommon.ChainID, contractAddress common.Address) (*thirdparty.CollectibleContractOwnership, error)

func (*API) GetCollectibleOwnership added in v0.175.3

func (api *API) GetCollectibleOwnership(id thirdparty.CollectibleUniqueID) ([]thirdparty.AccountBalance, error)

func (*API) GetCollectiblesByUniqueIDAsync added in v0.171.21

func (api *API) GetCollectiblesByUniqueIDAsync(requestID int32, uniqueIDs []thirdparty.CollectibleUniqueID, dataType collectibles.CollectibleDataType) error

func (*API) GetCryptoOnRamps added in v0.71.4

func (api *API) GetCryptoOnRamps(ctx context.Context) ([]CryptoOnRamp, error)

func (*API) GetCustomTokens added in v0.38.1

func (api *API) GetCustomTokens(ctx context.Context) ([]*token.Token, error)

@deprecated

func (*API) GetDailyMarketValues added in v0.111.5

func (api *API) GetDailyMarketValues(ctx context.Context, symbol string, currency string, limit int, allData bool, aggregate int) ([]thirdparty.HistoricalPrice, error)

func (*API) GetDerivedAddresses added in v0.142.1

func (api *API) GetDerivedAddresses(ctx context.Context, password string, derivedFrom string, paths []string) ([]*DerivedAddress, error)

Generates addresses for the provided paths, response doesn't include `HasActivity` value (if you need it check `GetAddressDetails` function)

func (*API) GetDerivedAddressesForMnemonic added in v0.142.1

func (api *API) GetDerivedAddressesForMnemonic(ctx context.Context, mnemonic string, paths []string) ([]*DerivedAddress, error)

Generates addresses for the provided paths derived from the provided mnemonic, response doesn't include `HasActivity` value (if you need it check `GetAddressDetails` function)

func (*API) GetEstimatedLatestBlockNumber added in v0.166.7

func (api *API) GetEstimatedLatestBlockNumber(ctx context.Context, chainID uint64) (uint64, error)

func (*API) GetEthereumChains added in v0.86.7

func (api *API) GetEthereumChains(ctx context.Context) ([]*network.CombinedNetwork, error)

func (*API) GetHourlyMarketValues added in v0.111.5

func (api *API) GetHourlyMarketValues(ctx context.Context, symbol string, currency string, limit int, aggregate int) ([]thirdparty.HistoricalPrice, error)

func (*API) GetMoreForActivityFilterSession added in v0.174.6

func (api *API) GetMoreForActivityFilterSession(id activity.SessionID, pageCount int) error

func (*API) GetMultiTransactions added in v0.138.1

func (api *API) GetMultiTransactions(ctx context.Context, transactionIDs []wcommon.MultiTransactionIDType) ([]*transfer.MultiTransaction, error)

func (*API) GetMultiTxDetails added in v0.166.1

func (api *API) GetMultiTxDetails(ctx context.Context, multiTxID int) (*activity.EntryDetails, error)

func (*API) GetOldestActivityTimestampAsync added in v0.161.2

func (api *API) GetOldestActivityTimestampAsync(requestID int32, addresses []common.Address) error

func (*API) GetOwnedCollectiblesAsync added in v0.171.21

func (api *API) GetOwnedCollectiblesAsync(requestID int32, chainIDs []wcommon.ChainID, addresses []common.Address, filter collectibles.Filter, offset int, limit int, dataType collectibles.CollectibleDataType, fetchCriteria collectibles.FetchCriteria) error

func (*API) GetPairingsJSONFileContent added in v0.166.11

func (api *API) GetPairingsJSONFileContent() ([]byte, error)

func (*API) GetPendingTransactions added in v0.62.0

func (api *API) GetPendingTransactions(ctx context.Context) ([]*transactions.PendingTransaction, error)

@deprecated Not used by status-desktop anymore

func (*API) GetPendingTransactionsForIdentities added in v0.151.4

func (api *API) GetPendingTransactionsForIdentities(ctx context.Context, identities []transfer.TransactionIdentity) (
	result []*transactions.PendingTransaction, err error)

@deprecated Not used by status-desktop anymore

func (*API) GetRecipientsAsync added in v0.161.2

func (api *API) GetRecipientsAsync(requestID int32, chainIDs []wcommon.ChainID, addresses []common.Address, offset int, limit int) (ignored bool, err error)

func (*API) GetSuggestedFees added in v0.97.4

func (api *API) GetSuggestedFees(ctx context.Context, chainID uint64) (*SuggestedFees, error)

func (*API) GetSuggestedRoutes added in v0.101.1

func (api *API) GetSuggestedRoutes(
	ctx context.Context,
	sendType SendType,
	addrFrom common.Address,
	addrTo common.Address,
	amountIn *hexutil.Big,
	tokenID string,
	toTokenID string,
	disabledFromChainIDs,
	disabledToChaindIDs,
	preferedChainIDs []uint64,
	gasFeeMode GasFeeMode,
	fromLockedAmount map[uint64]*hexutil.Big,
) (*SuggestedRoutes, error)

func (*API) GetTokenList added in v0.171.21

func (api *API) GetTokenList(ctx context.Context) (*token.ListWrapper, error)

func (*API) GetTokens added in v0.93.2

func (api *API) GetTokens(ctx context.Context, chainID uint64) ([]*token.Token, error)

@deprecated

func (*API) GetTransactionEstimatedTime added in v0.103.2

func (api *API) GetTransactionEstimatedTime(ctx context.Context, chainID uint64, maxFeePerGas *big.Float) (TransactionEstimation, error)

@deprecated

func (*API) GetTransfersByAddress

func (api *API) GetTransfersByAddress(ctx context.Context, address common.Address, toBlock, limit *hexutil.Big, fetchMore bool) ([]transfer.View, error)

@deprecated GetTransfersByAddress returns transfers for a single address

func (*API) GetTransfersByAddressAndChainID added in v0.86.7

func (api *API) GetTransfersByAddressAndChainID(ctx context.Context, chainID uint64, address common.Address, toBlock, limit *hexutil.Big, fetchMore bool) ([]transfer.View, error)

@deprecated

func (*API) GetTransfersForIdentities added in v0.151.4

func (api *API) GetTransfersForIdentities(ctx context.Context, identities []transfer.TransactionIdentity) ([]transfer.View, error)

@deprecated

func (*API) GetTxDetails added in v0.166.1

func (api *API) GetTxDetails(ctx context.Context, id string) (*activity.EntryDetails, error)

func (*API) GetWalletToken added in v0.115.5

func (api *API) GetWalletToken(ctx context.Context, addresses []common.Address) (map[common.Address][]Token, error)

func (*API) GetWalletTokenBalances added in v0.172.1

func (api *API) GetWalletTokenBalances(ctx context.Context, addresses []common.Address) (map[common.Address][]Token, error)

func (*API) LoadTransferByHash added in v0.91.10

func (api *API) LoadTransferByHash(ctx context.Context, address common.Address, hash common.Hash) error

@deprecated LoadTransferByHash loads transfer to the database Only used by status-mobile

func (*API) ProceedWithTransactionsSignatures added in v0.171.1

func (api *API) ProceedWithTransactionsSignatures(ctx context.Context, signatures map[string]transfer.SignatureDetails) (*transfer.MultiTransactionCommandResult, error)

func (*API) RefetchOwnedCollectibles added in v0.167.5

func (api *API) RefetchOwnedCollectibles() error

func (*API) ResetActivityFilterSession added in v0.174.6

func (api *API) ResetActivityFilterSession(id activity.SessionID, firstPageCount int) error

func (*API) SearchCollectibles added in v0.177.0

func (api *API) SearchCollectibles(ctx context.Context, chainID wcommon.ChainID, text string, cursor string, limit int, providerID string) (*thirdparty.FullCollectibleDataContainer, error)

func (*API) SearchCollections added in v0.177.0

func (api *API) SearchCollections(ctx context.Context, chainID wcommon.ChainID, text string, cursor string, limit int, providerID string) (*thirdparty.CollectionDataContainer, error)

func (*API) SendTransactionWithSignature added in v0.171.25

func (api *API) SendTransactionWithSignature(ctx context.Context, chainID uint64, txType transactions.PendingTrxType,
	sendTxArgsJSON string, signature string) (hash types.Hash, err error)

func (*API) SetPairingsJSONFileContent added in v0.166.11

func (api *API) SetPairingsJSONFileContent(content []byte) error

func (*API) SignMessage added in v0.171.25

func (api *API) SignMessage(ctx context.Context, message types.HexBytes, address common.Address, password string) (string, error)

func (*API) StartActivityFilterSession added in v0.173.0

func (api *API) StartActivityFilterSession(addresses []common.Address, chainIDs []wcommon.ChainID, filter activity.Filter, firstPageCount int) (activity.SessionID, error)

func (*API) StartWallet added in v0.100.0

func (api *API) StartWallet(ctx context.Context) error

func (*API) StopActivityFilterSession added in v0.173.0

func (api *API) StopActivityFilterSession(id activity.SessionID)

func (*API) StopWallet added in v0.125.2

func (api *API) StopWallet(ctx context.Context) error

func (*API) UpdateActivityFilterForSession added in v0.176.3

func (api *API) UpdateActivityFilterForSession(sessionID activity.SessionID, filter activity.Filter, firstPageCount int) error

func (*API) WCAuthRequest added in v0.171.30

func (api *API) WCAuthRequest(ctx context.Context, address common.Address, authMessage string) (*transfer.TxResponse, error)

WCAuthRequest responds to "auth_request" event

func (*API) WCChangeSessionState added in v0.171.33

func (api *API) WCChangeSessionState(ctx context.Context, topic walletconnect.Topic, active bool) error

WCChangeSessionState changes the active state of a session

func (*API) WCPairSessionProposal added in v0.171.21

func (api *API) WCPairSessionProposal(ctx context.Context, sessionProposalJSON string) (*wc.PairSessionResponse, error)

WCPairSessionProposal responds to "session_proposal" event

func (*API) WCSaveOrUpdateSession added in v0.171.33

func (api *API) WCSaveOrUpdateSession(ctx context.Context, sessionProposalJSON string) error

WCSaveOrUpdateSession records a session established between Status app and dapp

func (*API) WCSessionRequest added in v0.171.21

func (api *API) WCSessionRequest(ctx context.Context, sessionRequestJSON string) (*transfer.TxResponse, error)

WCSessionRequest responds to "session_request" event

func (*API) WatchTransactionByChainID added in v0.86.7

func (api *API) WatchTransactionByChainID(ctx context.Context, chainID uint64, transactionHash common.Hash) (err error)

@deprecated TODO - #11861: Remove this and replace with EventPendingTransactionStatusChanged event and Delete to confirm the transaction where it is needed

type ChainBalance added in v0.115.5

type ChainBalance struct {
	RawBalance     string         `json:"rawBalance"`
	Balance        *big.Float     `json:"balance"`
	Balance1DayAgo string         `json:"balance1DayAgo"`
	Address        common.Address `json:"address"`
	ChainID        uint64         `json:"chainId"`
	HasError       bool           `json:"hasError"`
}

type CryptoOnRamp added in v0.71.4

type CryptoOnRamp struct {
	Name        string            `json:"name"`
	Description string            `json:"description"`
	Fees        string            `json:"fees"`
	LogoURL     string            `json:"logoUrl"`
	SiteURL     string            `json:"siteUrl"`
	Hostname    string            `json:"hostname"`
	Params      map[string]string `json:"params"` // TODO implement params in JSON and parsing status-mobile
}

type CryptoOnRampManager added in v0.71.4

type CryptoOnRampManager struct {
	LastCalled time.Time
	// contains filtered or unexported fields
}

func NewCryptoOnRampManager added in v0.71.4

func NewCryptoOnRampManager(options *CryptoOnRampOptions) *CryptoOnRampManager

func (*CryptoOnRampManager) Get added in v0.71.4

func (c *CryptoOnRampManager) Get() ([]CryptoOnRamp, error)

type CryptoOnRampOptions added in v0.71.4

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

type DataSourceType added in v0.71.4

type DataSourceType int
const (
	DataSourceHTTP DataSourceType = iota + 1
	DataSourceStatic
)

type Decoder added in v0.161.2

type Decoder struct {
	Main     *fourbytegithub.Client
	Fallback *fourbyte.Client
}

func NewDecoder added in v0.161.2

func NewDecoder() *Decoder

func (*Decoder) Decode added in v0.161.2

func (d *Decoder) Decode(data string) (*thirdparty.DataParsed, error)

type DerivedAddress added in v0.100.0

type DerivedAddress struct {
	Address        common.Address `json:"address"`
	PublicKey      types.HexBytes `json:"public-key,omitempty"`
	Path           string         `json:"path"`
	HasActivity    bool           `json:"hasActivity"`
	AlreadyCreated bool           `json:"alreadyCreated"`
}

type FeeHistory added in v0.97.4

type FeeHistory struct {
	BaseFeePerGas []string `json:"baseFeePerGas"`
}

type FeeManager added in v0.97.4

type FeeManager struct {
	RPCClient *rpc.Client
}

type GasFeeMode added in v0.113.0

type GasFeeMode int
const (
	GasFeeLow GasFeeMode = iota
	GasFeeMedium
	GasFeeHigh
)

type Graph added in v0.113.0

type Graph = []*Node

type KeycardPairings added in v0.166.11

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

func NewKeycardPairings added in v0.166.11

func NewKeycardPairings() *KeycardPairings

func (*KeycardPairings) GetPairingsJSONFileContent added in v0.166.11

func (kp *KeycardPairings) GetPairingsJSONFileContent() ([]byte, error)

func (*KeycardPairings) SetKeycardPairingsFile added in v0.166.11

func (kp *KeycardPairings) SetKeycardPairingsFile(filePath string)

func (*KeycardPairings) SetPairingsJSONFileContent added in v0.166.11

func (kp *KeycardPairings) SetPairingsJSONFileContent(content []byte) error

type Node added in v0.113.0

type Node struct {
	Path     *Path
	Children Graph
}

type Path added in v0.113.0

type Path struct {
	BridgeName              string
	From                    *params.Network
	To                      *params.Network
	MaxAmountIn             *hexutil.Big
	AmountIn                *hexutil.Big
	AmountInLocked          bool
	AmountOut               *hexutil.Big
	GasAmount               uint64
	GasFees                 *SuggestedFees
	BonderFees              *hexutil.Big
	TokenFees               *big.Float
	Cost                    *big.Float
	EstimatedTime           TransactionEstimation
	ApprovalRequired        bool
	ApprovalGasFees         *big.Float
	ApprovalAmountRequired  *hexutil.Big
	ApprovalContractAddress *common.Address
}

func (*Path) Equal added in v0.117.3

func (p *Path) Equal(o *Path) bool

type Persistence added in v0.151.13

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

func NewPersistence added in v0.151.13

func NewPersistence(db *sql.DB) *Persistence

func (*Persistence) GetTokens added in v0.151.13

func (p *Persistence) GetTokens() (map[common.Address][]Token, error)

func (*Persistence) SaveTokens added in v0.151.13

func (p *Persistence) SaveTokens(tokens map[common.Address][]Token) (err error)

type Reader added in v0.100.0

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

func NewReader added in v0.100.0

func NewReader(rpcClient *rpc.Client, tokenManager *token.Manager, marketManager *market.Manager, communityManager *community.Manager, accountsDB *accounts.Database, persistence *Persistence, walletFeed *event.Feed) *Reader

func (*Reader) FetchOrGetCachedWalletBalances added in v0.173.0

func (r *Reader) FetchOrGetCachedWalletBalances(ctx context.Context, addresses []common.Address) (map[common.Address][]Token, error)

func (*Reader) GetCachedWalletTokensWithoutMarketData added in v0.151.13

func (r *Reader) GetCachedWalletTokensWithoutMarketData() (map[common.Address][]Token, error)

GetCachedWalletTokensWithoutMarketData returns the latest fetched balances, minus price information

func (*Reader) GetWalletToken added in v0.115.5

func (r *Reader) GetWalletToken(ctx context.Context, addresses []common.Address) (map[common.Address][]Token, error)

func (*Reader) GetWalletTokenBalances added in v0.172.1

func (r *Reader) GetWalletTokenBalances(ctx context.Context, addresses []common.Address) (map[common.Address][]Token, error)

func (*Reader) Start added in v0.100.0

func (r *Reader) Start() error

func (*Reader) Stop added in v0.115.5

func (r *Reader) Stop()

type Router added in v0.101.1

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

func NewRouter added in v0.101.1

func NewRouter(s *Service) *Router

type SavedAddress added in v0.86.7

type SavedAddress struct {
	Address common.Address `json:"address"`
	// TODO: Add Emoji
	// Emoji	string		   `json:"emoji"`
	Name            string                            `json:"name"`
	ChainShortNames string                            `json:"chainShortNames"` // used with address only, not with ENSName
	ENSName         string                            `json:"ens"`
	ColorID         multiAccCommon.CustomizationColor `json:"colorId"`
	IsTest          bool                              `json:"isTest"`
	CreatedAt       int64                             `json:"createdAt"`
	Removed         bool                              `json:"removed"`
	// contains filtered or unexported fields
}

func (*SavedAddress) ID added in v0.131.2

func (s *SavedAddress) ID() string

func (*SavedAddress) MarshalJSON added in v0.175.3

func (s *SavedAddress) MarshalJSON() ([]byte, error)

type SavedAddressesManager added in v0.86.7

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

func NewSavedAddressesManager added in v0.111.5

func NewSavedAddressesManager(db *sql.DB) *SavedAddressesManager

func (*SavedAddressesManager) AddSavedAddressIfNewerUpdate added in v0.111.5

func (sam *SavedAddressesManager) AddSavedAddressIfNewerUpdate(sa SavedAddress) (insertedOrUpdated bool, err error)

func (*SavedAddressesManager) DeleteSavedAddress added in v0.86.7

func (sam *SavedAddressesManager) DeleteSavedAddress(address common.Address, isTest bool, updateClock uint64) (deleted bool, err error)

func (*SavedAddressesManager) DeleteSoftRemovedSavedAddresses added in v0.111.5

func (sam *SavedAddressesManager) DeleteSoftRemovedSavedAddresses(threshold uint64) error

func (*SavedAddressesManager) GetRawSavedAddresses added in v0.111.5

func (sam *SavedAddressesManager) GetRawSavedAddresses() ([]*SavedAddress, error)

GetRawSavedAddresses provides access to the soft-delete and sync metadata

func (*SavedAddressesManager) GetSavedAddresses added in v0.86.7

func (sam *SavedAddressesManager) GetSavedAddresses() ([]*SavedAddress, error)

func (*SavedAddressesManager) UpdateMetadataAndUpsertSavedAddress added in v0.111.5

func (sam *SavedAddressesManager) UpdateMetadataAndUpsertSavedAddress(sa SavedAddress) error

type SendType added in v0.113.0

type SendType int
const (
	Transfer SendType = iota
	ENSRegister
	ENSRelease
	ENSSetPubKey
	StickersBuy
	Bridge
	ERC721Transfer
	ERC1155Transfer
	Swap
)

func (SendType) EstimateGas added in v0.113.0

func (s SendType) EstimateGas(service *Service, network *params.Network, from common.Address, tokenID string) uint64

func (SendType) FetchPrices added in v0.166.9

func (s SendType) FetchPrices(service *Service, tokenID string) (map[string]float64, error)

func (SendType) FindToken added in v0.166.9

func (s SendType) FindToken(service *Service, account common.Address, network *params.Network, tokenID string) *token.Token

func (SendType) IsCollectiblesTransfer added in v0.174.1

func (s SendType) IsCollectiblesTransfer() bool

type Service

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

Service is a wallet service.

func NewService

func NewService(
	db *sql.DB,
	accountsDB *accounts.Database,
	appDB *sql.DB,
	rpcClient *rpc.Client,
	accountFeed *event.Feed,
	settingsFeed *event.Feed,
	gethManager *account.GethManager,
	transactor *transactions.Transactor,
	config *params.NodeConfig,
	ens *ens.Service,
	stickers *stickers.Service,
	pendingTxManager *transactions.PendingTxTracker,
	feed *event.Feed,
	mediaServer *server.MediaServer,
) *Service

NewService initializes service instance.

func (*Service) APIs

func (s *Service) APIs() []gethrpc.API

APIs returns list of available RPC APIs.

func (*Service) IsStarted added in v0.48.8

func (s *Service) IsStarted() bool

func (*Service) KeycardPairings added in v0.166.11

func (s *Service) KeycardPairings() *KeycardPairings

func (*Service) Protocols

func (s *Service) Protocols() []p2p.Protocol

Protocols returns list of p2p protocols.

func (*Service) SetWalletCommunityInfoProvider added in v0.171.34

func (s *Service) SetWalletCommunityInfoProvider(provider thirdparty.CommunityInfoProvider)

Set external Collectibles community info provider

func (*Service) Start

func (s *Service) Start() error

Start signals transmitter.

func (*Service) Stop

func (s *Service) Stop() error

Stop reactor and close db.

type SuggestedFees added in v0.97.4

type SuggestedFees struct {
	GasPrice             *big.Float `json:"gasPrice"`
	BaseFee              *big.Float `json:"baseFee"`
	MaxPriorityFeePerGas *big.Float `json:"maxPriorityFeePerGas"`
	MaxFeePerGasLow      *big.Float `json:"maxFeePerGasLow"`
	MaxFeePerGasMedium   *big.Float `json:"maxFeePerGasMedium"`
	MaxFeePerGasHigh     *big.Float `json:"maxFeePerGasHigh"`
	L1GasFee             *big.Float `json:"l1GasFee,omitempty"`
	EIP1559Enabled       bool       `json:"eip1559Enabled"`
}

type SuggestedRoutes added in v0.101.1

type SuggestedRoutes struct {
	Best                  []*Path
	Candidates            []*Path
	TokenPrice            float64
	NativeChainTokenPrice float64
}

type Token added in v0.38.1

type Token struct {
	Name                    string                       `json:"name"`
	Symbol                  string                       `json:"symbol"`
	Decimals                uint                         `json:"decimals"`
	BalancesPerChain        map[uint64]ChainBalance      `json:"balancesPerChain"`
	Description             string                       `json:"description"`
	AssetWebsiteURL         string                       `json:"assetWebsiteUrl"`
	BuiltOn                 string                       `json:"builtOn"`
	MarketValuesPerCurrency map[string]TokenMarketValues `json:"marketValuesPerCurrency"`
	PegSymbol               string                       `json:"pegSymbol"`
	Verified                bool                         `json:"verified"`
	Image                   string                       `json:"image,omitempty"`
	CommunityData           *community.Data              `json:"community_data,omitempty"`
}

type TokenMarketValues added in v0.125.0

type TokenMarketValues struct {
	MarketCap       float64 `json:"marketCap"`
	HighDay         float64 `json:"highDay"`
	LowDay          float64 `json:"lowDay"`
	ChangePctHour   float64 `json:"changePctHour"`
	ChangePctDay    float64 `json:"changePctDay"`
	ChangePct24hour float64 `json:"changePct24hour"`
	Change24hour    float64 `json:"change24hour"`
	Price           float64 `json:"price"`
	HasError        bool    `json:"hasError"`
}

type TransactionEstimation added in v0.103.2

type TransactionEstimation int
const (
	Unknown TransactionEstimation = iota
	LessThanOneMinute
	LessThanThreeMinutes
	LessThanFiveMinutes
	MoreThanFiveMinutes
)

Directories

Path Synopsis
Moved here because transactions package depends on accounts package which depends on appdatabase where this functionality is needed
Moved here because transactions package depends on accounts package which depends on appdatabase where this functionality is needed
alchemy
nolint: misspell
nolint: misspell

Jump to

Keyboard shortcuts

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