Page MenuHomePhabricator

[Cashtab] [final countdown bch param p1] Delete getBCH function
ClosedPublic

Authored by bytesofman on Dec 8 2022, 03:59.

Details

Summary

T2730

Now that chronik is the only backend for Cashtab and there is no need to switch between different instances of bch-api, delete the getBCH function.

Test Plan

npm test
grep -r getBCH src/ and no output
npm start and nothing explodes

Diff Detail

Event Timeline

Tail of the build log:

npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: 'postcss-place@7.0.5',
npm WARN EBADENGINE   required: { node: '^12 || ^14 || >=16' },
npm WARN EBADENGINE   current: { node: 'v15.14.0', npm: '7.7.6' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: 'postcss-preset-env@7.8.2',
npm WARN EBADENGINE   required: { node: '^12 || ^14 || >=16' },
npm WARN EBADENGINE   current: { node: 'v15.14.0', npm: '7.7.6' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: 'postcss-pseudo-class-any-link@7.1.6',
npm WARN EBADENGINE   required: { node: '^12 || ^14 || >=16' },
npm WARN EBADENGINE   current: { node: 'v15.14.0', npm: '7.7.6' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: 'postcss-selector-not@6.0.1',
npm WARN EBADENGINE   required: { node: '^12 || ^14 || >=16' },
npm WARN EBADENGINE   current: { node: 'v15.14.0', npm: '7.7.6' }
npm WARN EBADENGINE }

> cashtab@1.0.0 prepare
> cd ../.. && husky install web/cashtab/.husky

husky - Git hooks installed

added 1813 packages, and audited 1814 packages in 35s

234 packages are looking for funding
  run `npm fund` for details

8 vulnerabilities (5 moderate, 2 high, 1 critical)

To address issues that do not require attention, run:
  npm audit fix

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.
npm notice 
npm notice New major version of npm available! 7.7.6 -> 9.2.0
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v9.2.0>
npm notice Run `npm install -g npm@9.2.0` to update!
npm notice 

> cashtab@1.0.0 build
> node scripts/build.js

Creating an optimized production build...
Failed to compile.

[eslint] 
src/hooks/useBCH.js
  Line 2:8:  'SlpWallet' is defined but never used  no-unused-vars

Search for the keywords to learn more about each error.


Build cashtab-tests failed with exit code 1

Delete minimal-slp-wallet as it is no longer used after this function is out

Tail of the build log:

  tokenMethods.js                |     100 |      100 |     100 |     100 |                                                                                                                                                                                                                                                                                                                                                                                    
  txBuilder.js                   |   63.88 |    42.85 |      50 |   65.71 | 11,43-53,69-72,89                                                                                                                                                                                                                                                                                                                                                                  
  validation.js                  |   92.89 |    80.98 |   84.61 |   93.18 | 22-23,79-86,123-130,234,280,330,342                                                                                                                                                                                                                                                                                                                                                
 src/utils/icons                 |    2.52 |        0 |       0 |    2.72 |                                                                                                                                                                                                                                                                                                                                                                                    
  cropImage.js                   |    2.27 |        0 |       0 |    2.43 | 2-78                                                                                                                                                                                                                                                                                                                                                                               
  resizeImage.js                 |    2.77 |        0 |       0 |    3.03 | 2-51                                                                                                                                                                                                                                                                                                                                                                               
  roundImage.js                  |    2.56 |        0 |       0 |    2.77 | 2-57                                                                                                                                                                                                                                                                                                                                                                               
---------------------------------|---------|----------|---------|---------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

##teamcity[blockOpened name='Code Coverage Summary']
##teamcity[buildStatisticValue key='CodeCoverageAbsBCovered' value='1797']
##teamcity[buildStatisticValue key='CodeCoverageAbsBTotal' value='4324']
##teamcity[buildStatisticValue key='CodeCoverageAbsRCovered' value='738']
##teamcity[buildStatisticValue key='CodeCoverageAbsRTotal' value='2096']
##teamcity[buildStatisticValue key='CodeCoverageAbsMCovered' value='308']
##teamcity[buildStatisticValue key='CodeCoverageAbsMTotal' value='965']
##teamcity[buildStatisticValue key='CodeCoverageAbsLCovered' value='1767']
##teamcity[buildStatisticValue key='CodeCoverageAbsLTotal' value='4219']
##teamcity[blockClosed name='Code Coverage Summary']

Summary of all failing tests
FAIL src/hooks/__tests__/migrations.test.js
  ● Test suite failed to run

    Cannot find module '@psf/bch-js' from 'src/hooks/__tests__/migrations.test.js'

      1 | import { currency } from '../../components/Common/Ticker';
      2 | import BigNumber from 'bignumber.js';
    > 3 | import BCHJS from '@psf/bch-js';
        | ^
      4 | import { fromSatoshisToXec, fromXecToSatoshis } from 'utils/cashMethods';
      5 |
      6 | describe('Testing functions for upgrading Cashtab', () => {

      at Resolver.resolveModule (node_modules/jest-resolve/build/resolver.js:324:11)
      at Object.<anonymous> (src/hooks/__tests__/migrations.test.js:3:1)

FAIL src/utils/__tests__/cashMethods.test.js
  ● Test suite failed to run

    Cannot find module '@psf/bch-js' from 'src/utils/__tests__/cashMethods.test.js'

      84 |
      85 | import mockLegacyWallets from 'hooks/__mocks__/mockLegacyWallets';
    > 86 | import BCHJS from '@psf/bch-js';
         | ^
      87 | import sendBCHMock from '../../hooks/__mocks__/sendBCH';
      88 | import {
      89 |     activeWebsocketAlpha,

      at Resolver.resolveModule (node_modules/jest-resolve/build/resolver.js:324:11)
      at Object.<anonymous> (src/utils/__tests__/cashMethods.test.js:86:1)


Test Suites: 2 failed, 19 passed, 21 total
Tests:       268 passed, 268 total
Snapshots:   37 passed, 37 total
Time:        11.82 s
Ran all test suites.
Build cashtab-tests failed with exit code 1

Add @psf/bch-js as a dev dependency so that unit tests relying on it do not break with deletion of minimal-slp-wallet

This revision is now accepted and ready to land.Dec 8 2022, 06:14