Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: pools command, make helpers work both in Node.js and browser #74

Merged
merged 23 commits into from
Oct 17, 2023

Conversation

fadeev
Copy link
Member

@fadeev fadeev commented Oct 12, 2023

  • Removed helpers for testing, because we're no longer using them and migrating them for browser is a pain in the neck.
  • Refactored balances, fees and tx tracking
  • helpers can now be used from browser, which is nice
import { getBalances, trackCCTX, fetchFees } from "@zetachain/toolkit/helpers";
  • added getPools to get info about liquidity in internal pools. This function was needed for two reasons: to display a table when talking about liquidity pools in the docs and as a prerequisite for a function, which will calculate if a transaction value is enough to cover the withdraw fee for omnichain contracts.
npx hardhat pools
┌─────────┬───────────────────────┬──────────┬──────────┐
│ (index) │         name          │  ZRC-20  │   ZETA   │
├─────────┼───────────────────────┼──────────┼──────────┤
│    0    │       'tMATIC'        │ '403.70' │ '376.06' │
│    1    │        'tBTC'         │ '31.70'  │  '0.00'  │
│    2    │        'tBNB'         │ '358.49' │ '332.25' │
│    3    │        'gETH'         │ '192.60' │ '404.00' │
│    4    │ 'USDC-mumbai_testnet' │  '0.00'  │  '0.00'  │
│    5    │ 'USDC-goerli_testnet' │  '0.00'  │  '0.00'  │
│    6    │  'USDC-bsc_testnet'   │  '0.00'  │  '0.00'  │
└─────────┴───────────────────────┴──────────┴──────────┘

@socket-security
Copy link

socket-security bot commented Oct 12, 2023

New, updated, and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Packages Version New capabilities Transitives Size Publisher
isomorphic-fetch 3.0.0 network +5 557 kB mattandrews
eventemitter3 5.0.1 None +0 73.4 kB lpinca
@zetachain/networks 2.3.0...2.4.3 None +0/-0 26.3 kB lucasjanon

🚮 Removed packages: [email protected]

@fadeev fadeev changed the title refactor(balances): extract functions that can be imported in browser context refactor: make helpers work both in Node.js and browser Oct 13, 2023
@fadeev fadeev marked this pull request as ready for review October 16, 2023 10:39
@fadeev fadeev changed the title refactor: make helpers work both in Node.js and browser refactor: pools command, make helpers work both in Node.js and browser Oct 17, 2023
@fadeev fadeev merged commit bad7fe3 into main Oct 17, 2023
6 checks passed
@fadeev fadeev deleted the refactor-balances branch October 17, 2023 07:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants