bcef2d6249
author shashankshampi <shashank.sanket1995@gmail.com> 1729780155 +0530 committer shashankshampi <shashank.sanket1995@gmail.com> 1730274350 +0530 test: Code Migration from status-cli-tests fix_: functional tests (#5979) * fix_: generate on test-functional * chore(test)_: fix functional test assertion --------- Co-authored-by: Siddarth Kumar <siddarthkay@gmail.com> feat(accounts)_: cherry-pick Persist acceptance of Terms of Use & Privacy policy (#5766) (#5977) * feat(accounts)_: Persist acceptance of Terms of Use & Privacy policy (#5766) The original GH issue https://github.com/status-im/status-mobile/issues/21113 came from a request from the Legal team. We must show to Status v1 users the new terms (Terms of Use & Privacy Policy) right after they upgrade to Status v2 from the stores. The solution we use is to create a flag in the accounts table, named hasAcceptedTerms. The flag will be set to true on the first account ever created in v2 and we provide a native call in mobile/status.go#AcceptTerms, which allows the client to persist the user's choice in case they are upgrading (from v1 -> v2, or from a v2 older than this PR). This solution is not the best because we should store the setting in a separate table, not in the accounts table. Related Mobile PR https://github.com/status-im/status-mobile/pull/21124 * fix(test)_: Compare addresses using uppercased strings --------- Co-authored-by: Icaro Motta <icaro.ldm@gmail.com> test_: restore account (#5960) feat_: `LogOnPanic` linter (#5969) * feat_: LogOnPanic linter * fix_: add missing defer LogOnPanic * chore_: make vendor * fix_: tests, address pr comments * fix_: address pr comments fix(ci)_: remove workspace and tmp dir This ensures we do not encounter weird errors like: ``` + ln -s /home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907 /home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907@tmp/go/src/github.com/status-im/status-go ln: failed to create symbolic link '/home/jenkins/workspace/go_prs_linux_x86_64_main_PR-5907@tmp/go/src/github.com/status-im/status-go': File exists script returned exit code 1 ``` Signed-off-by: Jakub Sokołowski <jakub@status.im> chore_: enable windows and macos CI build (#5840) - Added support for Windows and macOS in CI pipelines - Added missing dependencies for Windows and x86-64-darwin - Resolved macOS SDK version compatibility for darwin-x86_64 The `mkShell` override was necessary to ensure compatibility with the newer macOS SDK (version 11.0) for x86_64. The default SDK (10.12) was causing build failures because of the missing libs and frameworks. OverrideSDK creates a mapping from the default SDK in all package categories to the requested SDK (11.0). fix(contacts)_: fix trust status not being saved to cache when changed (#5965) Fixes https://github.com/status-im/status-desktop/issues/16392 cleanup added logger and cleanup review comments changes fix_: functional tests (#5979) * fix_: generate on test-functional * chore(test)_: fix functional test assertion --------- Co-authored-by: Siddarth Kumar <siddarthkay@gmail.com> feat(accounts)_: cherry-pick Persist acceptance of Terms of Use & Privacy policy (#5766) (#5977) * feat(accounts)_: Persist acceptance of Terms of Use & Privacy policy (#5766) The original GH issue https://github.com/status-im/status-mobile/issues/21113 came from a request from the Legal team. We must show to Status v1 users the new terms (Terms of Use & Privacy Policy) right after they upgrade to Status v2 from the stores. The solution we use is to create a flag in the accounts table, named hasAcceptedTerms. The flag will be set to true on the first account ever created in v2 and we provide a native call in mobile/status.go#AcceptTerms, which allows the client to persist the user's choice in case they are upgrading (from v1 -> v2, or from a v2 older than this PR). This solution is not the best because we should store the setting in a separate table, not in the accounts table. Related Mobile PR https://github.com/status-im/status-mobile/pull/21124 * fix(test)_: Compare addresses using uppercased strings --------- Co-authored-by: Icaro Motta <icaro.ldm@gmail.com> test_: restore account (#5960) feat_: `LogOnPanic` linter (#5969) * feat_: LogOnPanic linter * fix_: add missing defer LogOnPanic * chore_: make vendor * fix_: tests, address pr comments * fix_: address pr comments chore_: enable windows and macos CI build (#5840) - Added support for Windows and macOS in CI pipelines - Added missing dependencies for Windows and x86-64-darwin - Resolved macOS SDK version compatibility for darwin-x86_64 The `mkShell` override was necessary to ensure compatibility with the newer macOS SDK (version 11.0) for x86_64. The default SDK (10.12) was causing build failures because of the missing libs and frameworks. OverrideSDK creates a mapping from the default SDK in all package categories to the requested SDK (11.0). fix(contacts)_: fix trust status not being saved to cache when changed (#5965) Fixes https://github.com/status-im/status-desktop/issues/16392 test_: remove port bind chore(wallet)_: move route execution code to separate module chore_: replace geth logger with zap logger (#5962) closes: #6002 feat(telemetry)_: add metrics for message reliability (#5899) * feat(telemetry)_: track message reliability Add metrics for dial errors, missed messages, missed relevant messages, and confirmed delivery. * fix_: handle error from json marshal chore_: use zap logger as request logger iterates: status-im/status-desktop#16536 test_: unique project per run test_: use docker compose v2, more concrete project name fix(codecov)_: ignore folders without tests Otherwise Codecov reports incorrect numbers when making changes. https://docs.codecov.com/docs/ignoring-paths Signed-off-by: Jakub Sokołowski <jakub@status.im> test_: verify schema of signals during init; fix schema verification warnings (#5947) fix_: update defaultGorushURL (#6011) fix(tests)_: use non-standard port to avoid conflicts We have observed `nimbus-eth2` build failures reporting this port: ```json { "lvl": "NTC", "ts": "2024-10-28 13:51:32.308+00:00", "msg": "REST HTTP server could not be started", "topics": "beacnde", "address": "127.0.0.1:5432", "reason": "(98) Address already in use" } ``` https://ci.status.im/job/nimbus-eth2/job/platforms/job/linux/job/x86_64/job/main/job/PR-6683/3/ Signed-off-by: Jakub Sokołowski <jakub@status.im> fix_: create request logger ad-hoc in tests Fixes `TestCall` failing when run concurrently. chore_: configure codecov (#6005) * chore_: configure codecov * fix_: after_n_builds |
||
---|---|---|
.. | ||
activity | ||
async | ||
balance | ||
bigint | ||
blockchainstate | ||
collectibles | ||
common | ||
community | ||
connection | ||
currency | ||
history | ||
market | ||
onramp | ||
requests | ||
responses | ||
routeexecution | ||
router | ||
testutils | ||
thirdparty | ||
token | ||
transfer | ||
walletconnect | ||
walletevent | ||
README.md | ||
api.go | ||
api_test.go | ||
decoder.go | ||
keycard_pairings.go | ||
keycard_pairings_test.go | ||
reader.go | ||
reader_test.go | ||
saved_addresses.go | ||
saved_addresses_test.go | ||
service.go |
README.md
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:
- Set Enable to true in WalletConfig
{
"WalletConfig": {
"Enabled": true,
}
}
- 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 hextoBlock
:BIGINT
- end of the range. if nil query will return last transfers.limit
:BIGINT
- limit of returned transfers.fetchMore
:BOOLEAN
- iftrue
, there are less thanlimit
fetched transfers in the database, and zero block is not reached yet, history will be scanned for more transfers. Iffalse
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 IDaddress
:HEX
- ethereum address encoded in hextoBlock
:BIGINT
- end of the range. if nil query will return last transfers.limit
:BIGINT
- limit of returned transfers.fetchMore
:BOOLEAN
- iftrue
, there are less thanlimit
fetched transfers in the database, and zero block is not reached yet, history will be scanned for more transfers. Iffalse
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 idtx-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 checkedaddresses
:[]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 IDaccounts
HEX
- list of ethereum addresses encoded in hextokens
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 hextokens
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 callgasPrice
BIGINT
gasLimit
BIGINT
value
BIGINT
data
TEXT
- transaction'sdata
fieldtype
VARCHAR
additionalData
TEXT
- arbitrary additional datanetwork_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"
}
}
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.
recent-history-fetching
Emitted when history scanning is started.
recent-history-ready
Emitted when history scanning is ended.
fetching-history-error
Emitted when when history can't be fetched because some error. Error's decritption can be found in message
field.
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.
- Call
wallet_checkRecentHistory
- On
recent-history-ready
request transactions viawallet_getTransfersByAddress
- Repeat
wallet_checkRecentHistory
in N minutes (currently 20 minutes instatus-mobile
for upstream RPC node. If a custom node is used interval can be arbitrary)
Logging into application
- Call
wallet_checkRecentHistory
- On
recent-history-ready
request transactions viawallet_getTransfersByAddress
- Repeat
wallet_checkRecentHistory
in N minutes (currently 20 minutes instatus-mobile
for upstream RPC node. If a custom node is used interval can be arbitrary)
Watching transaction
- Call
wallet_watchTransaction
- On success call
wallet_checkRecentHistory
- On
recent-history-ready
request transactions viawallet_getTransfersByAddress