Page MenuHomePhabricator

[Cashtab] add message signing function
AbandonedPublic

Authored by emack on Oct 27 2021, 20:48.

Details

Reviewers
bytesofman
Group Reviewers
Restricted Project
Summary
  • Adds a new function for the user to sign messages using the current active wallet.
  • New collapsable form added to Configure.js, which then passes BCH, fundingWif and message to sign to useBCH.js, which subsequently calls BCH.BitcoinCash.signMessageWithPrivKey(pk, message)
  • Issue: as discussed with @bytesofman, getting a strange error from the test suite complaining of unhandled exceptions within async function, but there are clearly try catch blocks in the added code.

The other potential cause may be down to changing:
const Configure = () =>
into
const Configure = ({ jestBCH, passLoadingStatus }) =>

which was to allow me to then set BCH as follows
const BCH = jestBCH ? jestBCH : getBCH();

and then pass BCH from Configure.js to useBCH.js to use when calling
BCH.BitcoinCash.signMessageWithPrivKey(pk, message)

1.PNG (445×476 px, 35 KB)

2.PNG (457×480 px, 37 KB)

3.PNG (492×514 px, 50 KB)

Test Plan
  • npm start
  • navigate to Settings tab
  • un-collapse the Sign Message form
  • input message then click the sign message and okay the confirmation dialog, and note the successful notif and signature returned
  • npm test then note the error below

test error.PNG (371×872 px, 75 KB)

Diff Detail

Repository
rABC Bitcoin ABC
Branch
signmessage
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 17124
Build 34080: Build Diffcashtab-tests
Build 34079: arc lint + arc unit

Event Timeline

emack requested review of this revision.Oct 27 2021, 20:48
emack edited the test plan for this revision. (Show Details)

Tail of the build log:

  BalanceHeaderFiat.js     |     100 |       50 |     100 |     100 | 9-13                                                                                                                                                                                                                           
  CustomIcons.js           |   63.16 |      100 |   22.22 |   63.16 | 16,19,27,35,38,57,62                                                                                                                                                                                                           
  EnhancedInputs.js        |   68.75 |    58.33 |      80 |   69.84 | 273-299,313-328                                                                                                                                                                                                                
  PrimaryButton.js         |   93.75 |        0 |   92.31 |   93.75 | 59                                                                                                                                                                                                                             
  QRCode.js                |     100 |     91.3 |     100 |     100 | 24,39,42,91                                                                                                                                                                                                                    
  ScanQRCode.js            |   30.77 |    15.79 |      25 |   30.77 | 34,48-52,57-74,78-113,124-127,136-143                                                                                                                                                                                          
  StyledCollapse.js        |   88.89 |    33.33 |   83.33 |   88.89 | 57                                                                                                                                                                                                                             
  Ticker.js                |      50 |    47.62 |      75 |   47.73 | 136-191                                                                                                                                                                                                                        
  WalletLabel.js           |       0 |        0 |       0 |       0 | 5-26                                                                                                                                                                                                                           
 src/components/Configure  |       0 |        0 |       0 |       0 |                                                                                                                                                                                                                                
  Configure.js             |       0 |        0 |       0 |       0 | 41-773                                                                                                                                                                                                                         
 src/components/OnBoarding |   44.83 |     8.33 |      25 |   46.43 |                                                                                                                                                                                                                                
  OnBoarding.js            |   44.83 |     8.33 |      25 |   46.43 | 45-56,60-79,109-144                                                                                                                                                                                                            
 src/components/Send       |   28.64 |    31.79 |   21.05 |   29.11 |                                                                                                                                                                                                                                
  Send.js                  |   28.46 |    37.11 |   18.18 |   29.37 | 71,75-76,80,106-239,244-298,305-307,314-324,332-353,375,432-501                                                                                                                                                                
  SendToken.js             |   28.89 |       25 |      25 |   28.74 | 73-152,157-181,188-224,232-243,285-369                                                                                                                                                                                         
 src/components/Tokens     |   42.31 |    49.43 |   11.76 |   42.31 |                                                                                                                                                                                                                                
  CreateTokenForm.js       |   35.29 |    41.18 |    6.67 |   35.29 | 35-38,45-48,56-66,74-79,88-91,112-186,194-351,373                                                                                                                                                                              
  Tokens.js                |      90 |    78.95 |      50 |      90 | 116                                                                                                                                                                                                                            
 src/components/Wallet     |   61.54 |    27.55 |   30.77 |   61.54 |                                                                                                                                                                                                                                
  TokenList.js             |     100 |      100 |     100 |     100 |                                                                                                                                                                                                                                
  TokenListItem.js         |     100 |       50 |     100 |     100 | 37                                                                                                                                                                                                                             
  Tx.js                    |      50 |        0 |       0 |      50 | 16,19,22,25,38,42,67,84,135-141,151-160                                                                                                                                                                                        
  TxHistory.js             |      60 |      100 |       0 |      60 | 9-12                                                                                                                                                                                                                           
  Wallet.js                |   58.82 |    48.15 |      30 |   58.82 | 38,48-55,63,111-127,137-154,180,248-275                                                                                                                                                                                        
 src/hooks                 |   40.48 |    36.27 |   35.96 |   40.52 |                                                                                                                                                                                                                                
  useAsyncTimeout.js       |   77.78 |       50 |   83.33 |   82.35 | 20,25-26                                                                                                                                                                                                                       
  useBCH.js                |   60.24 |    54.68 |   53.57 |   59.64 | 107-108,169-185,191-206,211-234,296-322,332-348,357-366,371-401,424-425,522,568,600-602,650,657,659,661,666,679-685,696-860,864-872,909,915-918,949,952,1004,1011,1013,1015,1020,1030-1033                                     
  useImage.js              |       0 |        0 |       0 |       0 | 1-199                                                                                                                                                                                                                          
  useInnerScroll.js        |       0 |      100 |       0 |       0 | 3-6                                                                                                                                                                                                                            
  useInterval.js           |       0 |      100 |       0 |       0 | 3-16                                                                                                                                                                                                                           
  usePrevious.js           |     100 |      100 |     100 |     100 |                                                                                                                                                                                                                                
  useWallet.js             |   29.65 |    20.86 |   39.02 |   30.22 | 67-70,78-79,90-98,102-106,132-136,148-191,210-281,300-301,331-332,343-349,393-396,404-409,418-448,459-479,490-599,605-639,648-685,690-739,743-769,778-788,810-814,822-823,833-838,843,849-890,903,951-1028,1068-1086,1111-1130 
  useWindowDimensions.js   |   77.78 |      100 |      60 |    87.5 | 21                                                                                                                                                                                                                             
 src/utils                 |    78.7 |    78.65 |   64.86 |   78.79 |                                                                                                                                                                                                                                
  GoogleAnalytics.js       |   27.27 |        0 |   14.29 |   28.57 | 9-39,54-60                                                                                                                                                                                                                     
  cashMethods.js           |      95 |    86.21 |   92.31 |   94.81 | 143,194,203,229                                                                                                                                                                                                                
  context.js               |      50 |      100 |       0 |      50 | 6-7                                                                                                                                                                                                                            
  debounce.js              |       0 |        0 |       0 |       0 | 4-8                                                                                                                                                                                                                            
  retry.js                 |       0 |        0 |       0 |       0 | 1-8                                                                                                                                                                                                                            
  tokenMethods.js          |     100 |      100 |     100 |     100 |                                                                                                                                                                                                                                
  validation.js            |   93.62 |    97.73 |     100 |   93.62 | 119,129,139                                                                                                                                                                                                                    
---------------------------|---------|----------|---------|---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

##teamcity[blockOpened name='Code Coverage Summary']
##teamcity[buildStatisticValue key='CodeCoverageAbsBCovered' value='891']
##teamcity[buildStatisticValue key='CodeCoverageAbsBTotal' value='2123']
##teamcity[buildStatisticValue key='CodeCoverageAbsRCovered' value='376']
##teamcity[buildStatisticValue key='CodeCoverageAbsRTotal' value='1017']
##teamcity[buildStatisticValue key='CodeCoverageAbsMCovered' value='171']
##teamcity[buildStatisticValue key='CodeCoverageAbsMTotal' value='463']
##teamcity[buildStatisticValue key='CodeCoverageAbsLCovered' value='870']
##teamcity[buildStatisticValue key='CodeCoverageAbsLTotal' value='2067']
##teamcity[blockClosed name='Code Coverage Summary']
Test Suites: 1 failed, 15 passed, 16 total
Tests:       158 passed, 158 total
Snapshots:   21 passed, 21 total
Time:        18.369 s
Ran all test suites.
Build cashtab-tests failed with exit code 1

Adding @generated to snapshot update

Tail of the build log:

  BalanceHeaderFiat.js     |     100 |       50 |     100 |     100 | 9-13                                                                                                                                                                                                                           
  CustomIcons.js           |   63.16 |      100 |   22.22 |   63.16 | 16,19,27,35,38,57,62                                                                                                                                                                                                           
  EnhancedInputs.js        |   68.75 |    58.33 |      80 |   69.84 | 273-299,313-328                                                                                                                                                                                                                
  PrimaryButton.js         |   93.75 |        0 |   92.31 |   93.75 | 59                                                                                                                                                                                                                             
  QRCode.js                |     100 |     91.3 |     100 |     100 | 24,39,42,91                                                                                                                                                                                                                    
  ScanQRCode.js            |   30.77 |    15.79 |      25 |   30.77 | 34,48-52,57-74,78-113,124-127,136-143                                                                                                                                                                                          
  StyledCollapse.js        |   88.89 |    33.33 |   83.33 |   88.89 | 57                                                                                                                                                                                                                             
  Ticker.js                |      50 |    47.62 |      75 |   47.73 | 136-191                                                                                                                                                                                                                        
  WalletLabel.js           |       0 |        0 |       0 |       0 | 5-26                                                                                                                                                                                                                           
 src/components/Configure  |       0 |        0 |       0 |       0 |                                                                                                                                                                                                                                
  Configure.js             |       0 |        0 |       0 |       0 | 41-773                                                                                                                                                                                                                         
 src/components/OnBoarding |   44.83 |     8.33 |      25 |   46.43 |                                                                                                                                                                                                                                
  OnBoarding.js            |   44.83 |     8.33 |      25 |   46.43 | 45-56,60-79,109-144                                                                                                                                                                                                            
 src/components/Send       |   28.64 |    31.79 |   21.05 |   29.11 |                                                                                                                                                                                                                                
  Send.js                  |   28.46 |    37.11 |   18.18 |   29.37 | 71,75-76,80,106-239,244-298,305-307,314-324,332-353,375,432-501                                                                                                                                                                
  SendToken.js             |   28.89 |       25 |      25 |   28.74 | 73-152,157-181,188-224,232-243,285-369                                                                                                                                                                                         
 src/components/Tokens     |   42.31 |    49.43 |   11.76 |   42.31 |                                                                                                                                                                                                                                
  CreateTokenForm.js       |   35.29 |    41.18 |    6.67 |   35.29 | 35-38,45-48,56-66,74-79,88-91,112-186,194-351,373                                                                                                                                                                              
  Tokens.js                |      90 |    78.95 |      50 |      90 | 116                                                                                                                                                                                                                            
 src/components/Wallet     |   61.54 |    27.55 |   30.77 |   61.54 |                                                                                                                                                                                                                                
  TokenList.js             |     100 |      100 |     100 |     100 |                                                                                                                                                                                                                                
  TokenListItem.js         |     100 |       50 |     100 |     100 | 37                                                                                                                                                                                                                             
  Tx.js                    |      50 |        0 |       0 |      50 | 16,19,22,25,38,42,67,84,135-141,151-160                                                                                                                                                                                        
  TxHistory.js             |      60 |      100 |       0 |      60 | 9-12                                                                                                                                                                                                                           
  Wallet.js                |   58.82 |    48.15 |      30 |   58.82 | 38,48-55,63,111-127,137-154,180,248-275                                                                                                                                                                                        
 src/hooks                 |   40.48 |    36.27 |   35.96 |   40.52 |                                                                                                                                                                                                                                
  useAsyncTimeout.js       |   77.78 |       50 |   83.33 |   82.35 | 20,25-26                                                                                                                                                                                                                       
  useBCH.js                |   60.24 |    54.68 |   53.57 |   59.64 | 107-108,169-185,191-206,211-234,296-322,332-348,357-366,371-401,424-425,522,568,600-602,650,657,659,661,666,679-685,696-860,864-872,909,915-918,949,952,1004,1011,1013,1015,1020,1030-1033                                     
  useImage.js              |       0 |        0 |       0 |       0 | 1-199                                                                                                                                                                                                                          
  useInnerScroll.js        |       0 |      100 |       0 |       0 | 3-6                                                                                                                                                                                                                            
  useInterval.js           |       0 |      100 |       0 |       0 | 3-16                                                                                                                                                                                                                           
  usePrevious.js           |     100 |      100 |     100 |     100 |                                                                                                                                                                                                                                
  useWallet.js             |   29.65 |    20.86 |   39.02 |   30.22 | 67-70,78-79,90-98,102-106,132-136,148-191,210-281,300-301,331-332,343-349,393-396,404-409,418-448,459-479,490-599,605-639,648-685,690-739,743-769,778-788,810-814,822-823,833-838,843,849-890,903,951-1028,1068-1086,1111-1130 
  useWindowDimensions.js   |   77.78 |      100 |      60 |    87.5 | 21                                                                                                                                                                                                                             
 src/utils                 |    78.7 |    78.65 |   64.86 |   78.79 |                                                                                                                                                                                                                                
  GoogleAnalytics.js       |   27.27 |        0 |   14.29 |   28.57 | 9-39,54-60                                                                                                                                                                                                                     
  cashMethods.js           |      95 |    86.21 |   92.31 |   94.81 | 143,194,203,229                                                                                                                                                                                                                
  context.js               |      50 |      100 |       0 |      50 | 6-7                                                                                                                                                                                                                            
  debounce.js              |       0 |        0 |       0 |       0 | 4-8                                                                                                                                                                                                                            
  retry.js                 |       0 |        0 |       0 |       0 | 1-8                                                                                                                                                                                                                            
  tokenMethods.js          |     100 |      100 |     100 |     100 |                                                                                                                                                                                                                                
  validation.js            |   93.62 |    97.73 |     100 |   93.62 | 119,129,139                                                                                                                                                                                                                    
---------------------------|---------|----------|---------|---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

##teamcity[blockOpened name='Code Coverage Summary']
##teamcity[buildStatisticValue key='CodeCoverageAbsBCovered' value='891']
##teamcity[buildStatisticValue key='CodeCoverageAbsBTotal' value='2123']
##teamcity[buildStatisticValue key='CodeCoverageAbsRCovered' value='376']
##teamcity[buildStatisticValue key='CodeCoverageAbsRTotal' value='1017']
##teamcity[buildStatisticValue key='CodeCoverageAbsMCovered' value='171']
##teamcity[buildStatisticValue key='CodeCoverageAbsMTotal' value='463']
##teamcity[buildStatisticValue key='CodeCoverageAbsLCovered' value='870']
##teamcity[buildStatisticValue key='CodeCoverageAbsLTotal' value='2067']
##teamcity[blockClosed name='Code Coverage Summary']
Test Suites: 1 failed, 15 passed, 16 total
Tests:       158 passed, 158 total
Snapshots:   21 passed, 21 total
Time:        18.323 s
Ran all test suites.
Build cashtab-tests failed with exit code 1

Issue resolved, to be resubmitted in a clean diff.