Skip to content

Commit

Permalink
chore: add data fetcher tests (#72)
Browse files Browse the repository at this point in the history
* chore: add data fetcher tests

* chore: add fs.write test

* chore: add fetch rewards test

* chore: add fetch proposal test

* chore: add data fetcher tests

* chore: add fetch remote chain id test

* chore: add populate wallet alias test

* chore: add fetch validator tests

* chore: add populate validator tests

* chore: removed populate proposal

* chore: add populate multichain wallet tests

* chore: add get multichain denom info test

* chore: add coingecko price fetcher test

* chore: add populate amount and coingecko test
  • Loading branch information
freak12techno authored Jul 18, 2024
1 parent f114f7f commit 0f5d60f
Show file tree
Hide file tree
Showing 40 changed files with 2,549 additions and 106 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ lint:
golangci-lint run --fix ./...

test:
go test -coverpkg=./... -coverprofile cover.out ./...

test-verbose:
go test -coverpkg=./... -coverprofile cover.out -v ./...


coverage:
go tool cover -html=cover.out
1 change: 1 addition & 0 deletions assets/coingecko.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"cosmos":{"usd":6.59},"akash-network":{}}
10 changes: 10 additions & 0 deletions assets/commission.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"commission": {
"commission": [
{
"denom": "uatom",
"amount": "12345"
}
]
}
}
104 changes: 104 additions & 0 deletions assets/cosmos-directory.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
{
"repository": {
"url": "https://github.com/cosmos/chain-registry",
"branch": "master",
"commit": "c6cfe11be261b20ce5881ea9ba38d855130c22a5",
"timestamp": 1720810736
},
"chains": [
{
"name": "8ball",
"path": "8ball",
"chain_name": "8ball",
"network_type": "mainnet",
"pretty_name": "8ball",
"chain_id": "eightball-1",
"status": "live",
"bech32_prefix": "8ball",
"slip44": 118,
"symbol": "EBL",
"display": "ebl",
"denom": "uebl",
"decimals": 6,
"image": "https://raw.githubusercontent.com/cosmos/chain-registry/master/8ball/images/8ball.svg",
"website": "https://8ball.info/",
"height": null,
"best_apis": {
"rest": [],
"rpc": []
},
"proxy_status": {
"rest": false,
"rpc": false
},
"versions": {
"application_version": "v1",
"cosmos_sdk_version": "0.46.7"
},
"cosmwasm_enabled": true,
"explorers": [
{
"url": "https://explorer.8ball.info/",
"tx_page": "https://explorer.8ball.info/8ball/tx/${txHash}"
},
{
"kind": "ping.pub",
"url": "https://ping.pub/8ball",
"tx_page": "https://ping.pub/8ball/tx/${txHash}"
},
{
"kind": "NodeStake Explorer",
"url": "https://explorer.nodestake.top/8ball/",
"tx_page": "https://explorer.nodestake.top/8ball/tx/${txHash}"
},
{
"kind": "TC Network",
"url": "https://explorer.tcnetwork.io/8ball",
"tx_page": "https://explorer.tcnetwork.io/8ball/transaction/${txHash}"
},
{
"kind": "TC Network",
"url": "https://explorer.co.id/8ball",
"tx_page": "https://explorer.co.id/8ball/tx/${txHash}"
},
{
"kind": "NODEXPLORER",
"url": "https://explorer.nodexcapital.com/8ball",
"tx_page": "https://explorer.nodexcapital.com/8ball/tx/${txHash}"
}
],
"assets": [
{
"name": "8ball",
"description": "The native staking token of 8ball.",
"symbol": "EBL",
"denom": "uebl",
"decimals": 6,
"base": {
"denom": "uebl",
"exponent": 0
},
"display": {
"denom": "ebl",
"exponent": 6
},
"denom_units": [
{
"denom": "uebl",
"exponent": 0
},
{
"denom": "ebl",
"exponent": 6
}
],
"logo_URIs": {
"png": "https://raw.githubusercontent.com/cosmos/chain-registry/master/8ball/images/8ball.png",
"svg": "https://raw.githubusercontent.com/cosmos/chain-registry/master/8ball/images/8ball.svg"
},
"image": "https://raw.githubusercontent.com/cosmos/chain-registry/master/8ball/images/8ball.svg"
}
]
}
]
}
6 changes: 6 additions & 0 deletions assets/denom-trace.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"denom_trace": {
"path": "transfer/channel-569",
"base_denom": "untrn"
}
}
20 changes: 20 additions & 0 deletions assets/ibc-channel-multihop.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"channel": {
"state": "STATE_TRYOPEN",
"ordering": "ORDER_UNORDERED",
"counterparty": {
"port_id": "transfer",
"channel_id": "channel-0"
},
"connection_hops": [
"connection-5",
"connection-6"
],
"version": "ics20-1"
},
"proof": null,
"proof_height": {
"revision_number": "4",
"revision_height": "21299329"
}
}
19 changes: 19 additions & 0 deletions assets/ibc-channel.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"channel": {
"state": "STATE_TRYOPEN",
"ordering": "ORDER_UNORDERED",
"counterparty": {
"port_id": "transfer",
"channel_id": "channel-0"
},
"connection_hops": [
"connection-5"
],
"version": "ics20-1"
},
"proof": null,
"proof_height": {
"revision_number": "4",
"revision_height": "21299329"
}
}
83 changes: 83 additions & 0 deletions assets/ibc-client-state.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
{
"identified_client_state": {
"client_id": "07-tendermint-5",
"client_state": {
"@type": "/ibc.lightclients.tendermint.v1.ClientState",
"chain_id": "denis-fadeev-chain",
"trust_level": {
"numerator": "1",
"denominator": "3"
},
"trusting_period": "1209600s",
"unbonding_period": "1814400s",
"max_clock_drift": "600s",
"frozen_height": {
"revision_number": "0",
"revision_height": "0"
},
"latest_height": {
"revision_number": "0",
"revision_height": "338"
},
"proof_specs": [
{
"leaf_spec": {
"hash": "SHA256",
"prehash_key": "NO_HASH",
"prehash_value": "SHA256",
"length": "VAR_PROTO",
"prefix": "AA=="
},
"inner_spec": {
"child_order": [
0,
1
],
"child_size": 33,
"min_prefix_length": 4,
"max_prefix_length": 12,
"empty_child": null,
"hash": "SHA256"
},
"max_depth": 0,
"min_depth": 0,
"prehash_key_before_comparison": false
},
{
"leaf_spec": {
"hash": "SHA256",
"prehash_key": "NO_HASH",
"prehash_value": "SHA256",
"length": "VAR_PROTO",
"prefix": "AA=="
},
"inner_spec": {
"child_order": [
0,
1
],
"child_size": 32,
"min_prefix_length": 1,
"max_prefix_length": 1,
"empty_child": null,
"hash": "SHA256"
},
"max_depth": 0,
"min_depth": 0,
"prehash_key_before_comparison": false
}
],
"upgrade_path": [
"upgrade",
"upgradedIBCState"
],
"allow_update_after_expiry": true,
"allow_update_after_misbehaviour": true
}
},
"proof": null,
"proof_height": {
"revision_number": "4",
"revision_height": "21299398"
}
}
27 changes: 27 additions & 0 deletions assets/proposal.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"proposal": {
"proposal_id": "1",
"content": {
"@type": "/cosmos.gov.v1beta1.TextProposal",
"title": "Adjustment of blocks_per_year to come aligned with actual block time",
"description": "This governance proposal is for adjustment of blocks_per_year parameter to normalize the inflation rate and reward rate.\\n ipfs link: https://ipfs.io/ipfs/QmXqEBr56xeUzFpgjsmDKMSit3iqnKaDEL4tabxPXoz9xc"
},
"status": "PROPOSAL_STATUS_PASSED",
"final_tally_result": {
"yes": "97118903526799",
"abstain": "402380577234",
"no": "320545400000",
"no_with_veto": "0"
},
"submit_time": "2019-03-20T06:41:27.040075748Z",
"deposit_end_time": "2019-04-03T06:41:27.040075748Z",
"total_deposit": [
{
"denom": "uatom",
"amount": "512100000"
}
],
"voting_start_time": "2019-03-20T20:43:59.630492307Z",
"voting_end_time": "2019-04-03T20:43:59.630492307Z"
}
}
8 changes: 8 additions & 0 deletions assets/rewards.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"rewards": [
{
"denom": "uatom",
"amount": "23456"
}
]
}
13 changes: 13 additions & 0 deletions assets/staking-params.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"params": {
"unbonding_time": "1814400s",
"max_validators": 180,
"max_entries": 7,
"historical_entries": 10000,
"bond_denom": "uatom",
"min_commission_rate": "0.050000000000000000",
"validator_bond_factor": "250.000000000000000000",
"global_liquid_staking_cap": "0.250000000000000000",
"validator_liquid_staking_cap": "1.000000000000000000"
}
}
42 changes: 42 additions & 0 deletions assets/validator.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"validator": {
"operator_address": "cosmosvaloper1xqz9pemz5e5zycaa89kys5aw6m8rhgsvw4328e",
"consensus_pubkey": {
"@type": "/cosmos.crypto.ed25519.PubKey",
"key": "DdZjDxgmWzB6cqk1OjRjiKJ7dAGUt18xeh4Qorh930s="
},
"jailed": false,
"status": "BOND_STATUS_BONDED",
"tokens": "194546758015",
"delegator_shares": "194546758015.000000000000000000",
"description": {
"moniker": "🐹 Quokka Stake",
"identity": "14BFE711AAB70C77",
"website": "https://quokkastake.io",
"security_contact": "[email protected]",
"details": "100% slashing refund | 24/7 monitoring. Stake with us! Subscribe for news: https://t.me/quokkastake"
},
"unbonding_height": "18037515",
"unbonding_time": "2023-12-18T18:12:38.688999277Z",
"commission": {
"commission_rates": {
"rate": "0.050000000000000000",
"max_rate": "0.200000000000000000",
"max_change_rate": "0.010000000000000000"
},
"update_time": "2023-01-03T12:29:29.048914658Z"
},
"min_self_delegation": "1",
"unbonding_on_hold_ref_count": "0",
"unbonding_ids": [
"36045",
"45875",
"52499",
"56201",
"59636",
"202054"
],
"validator_bond_shares": "516286890.000000000000000000",
"liquid_shares": "11160615760.000000000000000000"
}
}
Loading

0 comments on commit 0f5d60f

Please sign in to comment.