wallet

package
v0.98.1 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2022 License: MPL-2.0 Imports: 29 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_setInitialBlocksRange

Sets zero block - latest block range as scanned for an account. It is used when a new multiaccount is generated to avoid scanning transfers history.

Example
{"jsonrpc":"2.0","id":7,"method":"wallet_setInitialBlocksRange","params":[]}
setInitialBlocksRangeForChainIDs

Sets zero block - latest block range as scanned for an account. It is used when a new multiaccount is generated to avoid scanning transfers history.

Parameters
  • chainIDs: []INT - array of ethereum chain ID to be initialized
Example
{"jsonrpc":"2.0","id":7,"method":"wallet_setInitialBlocksRangeForChainIDs","params":[[1, 2]]}
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_setInitialRange
  2. Call wallet_checkRecentHistory
  3. On recent-history-ready request transactions via wallet_getTransfersByAddress
  4. Repeat wallet_checkRecentHistory in N minutes (currently 20 minutes in status-react 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-react 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 AssetLimit = 50
View Source
const CollectionLimit = 300

Variables

View Source
var BaseURLs = map[uint64]string{
	1: "https://api.opensea.io/api/v1",
	4: "https://rinkeby-api.opensea.io/api/v1",
}

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) error

func (*API) AddEthereumChain added in v0.86.7

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

func (*API) AddFavourite added in v0.62.2

func (api *API) AddFavourite(ctx context.Context, favourite Favourite) error

func (*API) AddSavedAddress added in v0.86.7

func (api *API) AddSavedAddress(ctx context.Context, sa SavedAddress) error

func (*API) CheckRecentHistory added in v0.75.0

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

func (*API) CheckRecentHistoryForChainIDs added in v0.86.7

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

func (*API) DeleteCustomToken added in v0.38.1

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

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) DeletePendingTransaction added in v0.62.0

func (api *API) DeletePendingTransaction(ctx context.Context, transactionHash common.Hash) error

func (*API) DeletePendingTransactionByChainID added in v0.86.7

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

func (*API) DeleteSavedAddress added in v0.86.7

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

func (*API) DiscoverToken added in v0.98.1

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

func (*API) FetchPrices added in v0.96.4

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

func (*API) GetCachedBalances added in v0.79.4

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

func (*API) GetCachedBalancesbyChainID added in v0.86.7

func (api *API) GetCachedBalancesbyChainID(ctx context.Context, chainID uint64, addresses []common.Address) ([]transfer.LastKnownBlockView, 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, error)

func (*API) GetEthereumChains added in v0.86.7

func (api *API) GetEthereumChains(ctx context.Context, onlyEnabled bool) ([]*params.Network, error)

func (*API) GetFavourites added in v0.62.2

func (api *API) GetFavourites(ctx context.Context) ([]*Favourite, error)

func (*API) GetOpenseaAssetsByOwnerAndCollection added in v0.83.17

func (api *API) GetOpenseaAssetsByOwnerAndCollection(ctx context.Context, chainID uint64, owner common.Address, collectionSlug string, limit int) ([]OpenseaAsset, error)

func (*API) GetOpenseaCollectionsByOwner added in v0.83.17

func (api *API) GetOpenseaCollectionsByOwner(ctx context.Context, chainID uint64, owner common.Address) ([]OpenseaCollection, error)

func (*API) GetPendingOutboundTransactionsByAddress added in v0.62.0

func (api *API) GetPendingOutboundTransactionsByAddress(ctx context.Context, address common.Address) ([]*PendingTransaction, error)

func (*API) GetPendingOutboundTransactionsByAddressAndChainID added in v0.86.7

func (api *API) GetPendingOutboundTransactionsByAddressAndChainID(ctx context.Context, chainID uint64, address common.Address) ([]*PendingTransaction, error)

func (*API) GetPendingTransactions added in v0.62.0

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

func (*API) GetPendingTransactionsByChainID added in v0.86.7

func (api *API) GetPendingTransactionsByChainID(ctx context.Context, chainID uint64) ([]*PendingTransaction, error)

func (*API) GetSavedAddresses added in v0.86.7

func (api *API) GetSavedAddresses(ctx context.Context) ([]*SavedAddress, error)

func (*API) GetSuggestedFees added in v0.97.4

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

func (*API) GetTokens added in v0.93.2

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

func (*API) GetTokensBalances

func (api *API) GetTokensBalances(ctx context.Context, accounts, addresses []common.Address) (map[common.Address]map[common.Address]*hexutil.Big, error)

GetTokensBalances return mapping of token balances for every account.

func (*API) GetTokensBalancesForChainIDs added in v0.86.7

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

func (*API) GetTransfersByAddress

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

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)

func (*API) LoadTransferByHash added in v0.91.10

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

LoadTransferByHash loads transfer to the database

func (*API) SetInitialBlocksRange added in v0.73.1

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

SetInitialBlocksRange sets initial blocks range

func (*API) SetInitialBlocksRangeForChainIDs added in v0.86.7

func (api *API) SetInitialBlocksRangeForChainIDs(ctx context.Context, chainIDs []uint64) error

func (*API) StorePendingTransaction added in v0.62.0

func (api *API) StorePendingTransaction(ctx context.Context, trx PendingTransaction) error

func (*API) WatchTransaction added in v0.74.1

func (api *API) WatchTransaction(ctx context.Context, transactionHash common.Hash) error

func (*API) WatchTransactionByChainID added in v0.86.7

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

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-react
}

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 Favourite added in v0.62.2

type Favourite struct {
	Address common.Address `json:"address"`
	Name    string         `json:"name"`
}

type FavouriteManager added in v0.86.7

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

func (*FavouriteManager) AddFavourite added in v0.86.7

func (fm *FavouriteManager) AddFavourite(favourite Favourite) error

func (*FavouriteManager) GetFavourites added in v0.86.7

func (fm *FavouriteManager) GetFavourites() ([]*Favourite, error)

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 OpenseaAsset added in v0.83.17

type OpenseaAsset struct {
	ID                int                    `json:"id"`
	Name              string                 `json:"name"`
	Description       string                 `json:"description"`
	Permalink         string                 `json:"permalink"`
	ImageThumbnailURL string                 `json:"image_thumbnail_url"`
	ImageURL          string                 `json:"image_url"`
	Contract          OpenseaContract        `json:"asset_contract"`
	Collection        OpenseaAssetCollection `json:"collection"`
	Traits            []OpenseaTrait         `json:"traits"`
	LastSale          OpenseaLastSale        `json:"last_sale"`
	SellOrders        []OpenseaSellOrder     `json:"sell_orders"`
	BackgroundColor   string                 `json:"background_color"`
}

type OpenseaAssetCollection added in v0.83.17

type OpenseaAssetCollection struct {
	Name string `json:"name"`
}

type OpenseaAssetContainer added in v0.83.17

type OpenseaAssetContainer struct {
	Assets []OpenseaAsset `json:"assets"`
}

type OpenseaClient added in v0.83.17

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

type OpenseaCollection added in v0.83.17

type OpenseaCollection struct {
	Name            string                            `json:"name"`
	Slug            string                            `json:"slug"`
	ImageURL        string                            `json:"image_url"`
	OwnedAssetCount int                               `json:"owned_asset_count"`
	Traits          map[string]OpenseaCollectionTrait `json:"traits"`
}

type OpenseaCollectionTrait added in v0.87.0

type OpenseaCollectionTrait struct {
	Min float64 `json:"min"`
	Max float64 `json:"max"`
}

type OpenseaContract added in v0.83.17

type OpenseaContract struct {
	Address string `json:"address"`
}

type OpenseaLastSale added in v0.87.0

type OpenseaLastSale struct {
	PaymentToken OpenseaPaymentToken `json:"payment_token"`
}

type OpenseaPaymentToken added in v0.87.0

type OpenseaPaymentToken struct {
	ID       int    `json:"id"`
	Symbol   string `json:"symbol"`
	Address  string `json:"address"`
	ImageURL string `json:"image_url"`
	Name     string `json:"name"`
	Decimals int    `json:"decimals"`
	EthPrice string `json:"eth_price"`
	UsdPrice string `json:"usd_price"`
}

type OpenseaSellOrder added in v0.87.0

type OpenseaSellOrder struct {
	CurrentPrice string `json:"current_price"`
}

type OpenseaTrait added in v0.85.1

type OpenseaTrait struct {
	TraitType   string     `json:"trait_type"`
	Value       TraitValue `json:"value"`
	DisplayType string     `json:"display_type"`
	MaxValue    string     `json:"max_value"`
}

type PendingTransaction added in v0.62.0

type PendingTransaction struct {
	Hash           common.Hash    `json:"hash"`
	Timestamp      uint64         `json:"timestamp"`
	Value          bigint.BigInt  `json:"value"`
	From           common.Address `json:"from"`
	To             common.Address `json:"to"`
	Data           string         `json:"data"`
	Symbol         string         `json:"symbol"`
	GasPrice       bigint.BigInt  `json:"gasPrice"`
	GasLimit       bigint.BigInt  `json:"gasLimit"`
	Type           PendingTrxType `json:"type"`
	AdditionalData string         `json:"additionalData"`
	ChainID        uint64         `json:"network_id"`
}

type PendingTrxType added in v0.62.0

type PendingTrxType string
const (
	RegisterENS    PendingTrxType = "RegisterENS"
	ReleaseENS     PendingTrxType = "ReleaseENS"
	SetPubKey      PendingTrxType = "SetPubKey"
	BuyStickerPack PendingTrxType = "BuyStickerPack"
	WalletTransfer PendingTrxType = "WalletTransfer"
)

type SavedAddress added in v0.86.7

type SavedAddress struct {
	Address common.Address `json:"address"`
	// TODO: Add Emoji and Networks
	// Emoji    string         `json:"emoji"`
	Name    string `json:"name"`
	ChainID uint64 `json:"chainId"`
}

type SavedAddressesManager added in v0.86.7

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

func (*SavedAddressesManager) AddSavedAddress added in v0.86.7

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

func (*SavedAddressesManager) DeleteSavedAddress added in v0.86.7

func (sam *SavedAddressesManager) DeleteSavedAddress(chainID uint64, address common.Address) error

func (*SavedAddressesManager) GetSavedAddresses added in v0.86.7

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

type Service

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

Service is a wallet service.

func NewService

func NewService(db *sql.DB, rpcClient *rpc.Client, accountFeed *event.Feed, openseaAPIKey string) *Service

NewService initializes service instance.

func (*Service) APIs

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

APIs returns list of available RPC APIs.

func (*Service) GetFeed added in v0.62.16

func (s *Service) GetFeed() *event.Feed

GetFeed returns signals feed.

func (*Service) IsStarted added in v0.48.8

func (s *Service) IsStarted() bool

func (*Service) Protocols

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

Protocols returns list of p2p protocols.

func (*Service) Start

func (s *Service) Start() error

Start signals transmitter.

func (*Service) Stop

func (s *Service) Stop() error

Stop reactor, signals transmitter 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"`
}

type Token added in v0.38.1

type Token struct {
	Address common.Address `json:"address"`
	Name    string         `json:"name"`
	Symbol  string         `json:"symbol"`
	Color   string         `json:"color"`
	// Decimals defines how divisible the token is. For example, 0 would be
	// indivisible, whereas 18 would allow very small amounts of the token
	// to be traded.
	Decimals uint   `json:"decimals"`
	ChainID  uint64 `json:"chainId"`
}

type TokenManager added in v0.86.7

type TokenManager struct {
	RPCClient *rpc.Client
	// contains filtered or unexported fields
}

type TraitValue added in v0.85.1

type TraitValue string

func (*TraitValue) UnmarshalJSON added in v0.85.1

func (st *TraitValue) UnmarshalJSON(b []byte) error

type TransactionManager added in v0.86.7

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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