diff --git a/web/cashtab/src/components/Configure/__tests__/__snapshots__/Configure.test.js.snap b/web/cashtab/src/components/Configure/__tests__/__snapshots__/Configure.test.js.snap --- a/web/cashtab/src/components/Configure/__tests__/__snapshots__/Configure.test.js.snap +++ b/web/cashtab/src/components/Configure/__tests__/__snapshots__/Configure.test.js.snap @@ -61,6 +61,9 @@
+
@@ -83,27 +86,25 @@ role="button" tabIndex={0} > -
- + -
+ + + Click to reveal seed phrase
@@ -469,6 +470,9 @@
+
diff --git a/web/cashtab/src/components/Send/__tests__/__snapshots__/Send.test.js.snap b/web/cashtab/src/components/Send/__tests__/__snapshots__/Send.test.js.snap --- a/web/cashtab/src/components/Send/__tests__/__snapshots__/Send.test.js.snap +++ b/web/cashtab/src/components/Send/__tests__/__snapshots__/Send.test.js.snap @@ -44,7 +44,7 @@ className="sc-iwsKbI ebAbAb" >
@@ -155,7 +154,7 @@ className="sc-iwsKbI ebAbAb" >
@@ -367,27 +365,25 @@ role="button" tabIndex={0} > -
- + -
+ + + Advanced
@@ -434,27 +430,25 @@ role="button" tabIndex={0} > -
- + -
+ + + Sign Message
@@ -506,7 +500,7 @@ className="sc-iwsKbI ebAbAb" >
@@ -617,7 +610,7 @@ className="sc-iwsKbI ebAbAb" >
@@ -829,27 +821,25 @@ role="button" tabIndex={0} > -
- + -
+ + + Advanced
@@ -896,27 +886,25 @@ role="button" tabIndex={0} > -
- + -
+ + + Sign Message
@@ -975,7 +963,7 @@ className="sc-iwsKbI ebAbAb" >
@@ -1086,7 +1073,7 @@ className="sc-iwsKbI ebAbAb" >
@@ -1298,27 +1284,25 @@ role="button" tabIndex={0} > -
- + -
+ + + Advanced
@@ -1366,27 +1350,25 @@ role="button" tabIndex={0} > -
- + -
+ + + Sign Message
@@ -1438,7 +1420,7 @@ className="sc-iwsKbI ebAbAb" >
@@ -1549,7 +1530,7 @@ className="sc-iwsKbI ebAbAb" >
@@ -1761,27 +1741,25 @@ role="button" tabIndex={0} > -
- + -
+ + + Advanced
@@ -1828,27 +1806,25 @@ role="button" tabIndex={0} > -
- + -
+ + + Sign Message
@@ -1900,7 +1876,7 @@ className="sc-iwsKbI ebAbAb" >
@@ -2011,7 +1986,7 @@ className="sc-iwsKbI ebAbAb" >
@@ -2223,27 +2197,25 @@ role="button" tabIndex={0} > -
- + -
+ + + Advanced
@@ -2290,27 +2262,25 @@ role="button" tabIndex={0} > -
- + -
+ + + Sign Message
diff --git a/web/cashtab/src/components/Send/__tests__/__snapshots__/SendToken.test.js.snap b/web/cashtab/src/components/Send/__tests__/__snapshots__/SendToken.test.js.snap --- a/web/cashtab/src/components/Send/__tests__/__snapshots__/SendToken.test.js.snap +++ b/web/cashtab/src/components/Send/__tests__/__snapshots__/SendToken.test.js.snap @@ -47,6 +47,9 @@
+
@@ -78,7 +81,7 @@ className="sc-VigVT hchaxg" >
@@ -189,7 +191,7 @@ className="sc-VigVT hchaxg" >
diff --git a/web/cashtab/src/components/Tokens/__tests__/__snapshots__/CreateTokenForm.test.js.snap b/web/cashtab/src/components/Tokens/__tests__/__snapshots__/CreateTokenForm.test.js.snap --- a/web/cashtab/src/components/Tokens/__tests__/__snapshots__/CreateTokenForm.test.js.snap +++ b/web/cashtab/src/components/Tokens/__tests__/__snapshots__/CreateTokenForm.test.js.snap @@ -21,27 +21,25 @@ role="button" tabIndex={0} > -
- + -
+ + + Create eToken
diff --git a/web/cashtab/src/components/Tokens/__tests__/__snapshots__/Tokens.test.js.snap b/web/cashtab/src/components/Tokens/__tests__/__snapshots__/Tokens.test.js.snap --- a/web/cashtab/src/components/Tokens/__tests__/__snapshots__/Tokens.test.js.snap +++ b/web/cashtab/src/components/Tokens/__tests__/__snapshots__/Tokens.test.js.snap @@ -52,6 +52,9 @@
+
@@ -80,27 +83,25 @@ role="button" tabIndex={-1} > -
- + -
+ + + Create eToken
@@ -178,6 +179,9 @@
+
@@ -206,27 +210,25 @@ role="button" tabIndex={-1} > -
- + -
+ + + Create eToken
@@ -305,6 +307,9 @@
+
@@ -333,27 +338,25 @@ role="button" tabIndex={0} > -
- + -
+ + + Create eToken
@@ -436,6 +439,9 @@
+
@@ -464,27 +470,25 @@ role="button" tabIndex={-1} > -
- + -
+ + + Create eToken
@@ -562,6 +566,9 @@
+
@@ -590,27 +597,25 @@ role="button" tabIndex={-1} > -
- + -
+ + + Create eToken
diff --git a/web/cashtab/src/hooks/__tests__/useBCH.test.js b/web/cashtab/src/hooks/__tests__/useBCH.test.js --- a/web/cashtab/src/hooks/__tests__/useBCH.test.js +++ b/web/cashtab/src/hooks/__tests__/useBCH.test.js @@ -148,14 +148,17 @@ it('sends XEC correctly with an encrypted OP_RETURN message', async () => { const { sendXec } = useBCH(); const BCH = new BCHJS(); - const { - expectedTxId, - expectedHex, - utxos, - wallet, - destinationAddress, - sendAmount, - } = sendBCHMock; + const { expectedTxId, utxos, wallet, destinationAddress, sendAmount } = + sendBCHMock; + const expectedPubKeyResponse = { + success: true, + publicKey: + '03451a3e61ae8eb76b8d4cd6057e4ebaf3ef63ae3fe5f441b72c743b5810b6a389', + }; + + BCH.encryption.getPubKey = jest + .fn() + .mockResolvedValue(expectedPubKeyResponse); BCH.RawTransactions.sendRawTransaction = jest .fn() @@ -592,6 +595,15 @@ 'bitcoincash:qqvuj09f80sw9j7qru84ptxf0hyqffc38gstxfs5ru'; const message = 'This message is encrypted by ecies-lite with default parameters'; + const expectedPubKeyResponse = { + success: true, + publicKey: + '03208c4f52229e021ddec5fc6e07a59fd66388ac52bc2a2c1e0f1afb24b0e275ac', + }; + + BCH.encryption.getPubKey = jest + .fn() + .mockResolvedValue(expectedPubKeyResponse); const result = await handleEncryptedOpReturn( BCH, @@ -630,100 +642,23 @@ } }); - it(`handleEncryptedOpReturn() correctly throws error when attempting to encrypt a message based on an invalid cash address`, async () => { - const { handleEncryptedOpReturn } = useBCH(); - const BCH = new BCHJS(); - const destinationAddress = 'bitcoincash:qqvINVALIDADDRESSSSSSru'; - const message = - 'This message is encrypted by ecies-lite with default parameters'; - - const expectedError = { - error: `Unsupported address format : ${destinationAddress}`, - success: false, - }; - - let thrownError; - try { - await handleEncryptedOpReturn( - BCH, - destinationAddress, - Buffer.from(message), - ); - } catch (err) { - thrownError = err; - } - - expect(thrownError).toStrictEqual(expectedError); - }); - - it(`handleEncryptedOpReturn() correctly throws error when attempting to encrypt a message based on null cash address input`, async () => { - const { handleEncryptedOpReturn } = useBCH(); - const BCH = new BCHJS(); - const destinationAddress = null; - const message = - 'This message is encrypted by ecies-lite with default parameters'; - const expectedError = 'Input must be a valid Bitcoin Cash address.'; - - let thrownError; - try { - await handleEncryptedOpReturn( - BCH, - destinationAddress, - Buffer.from(message), - ); - } catch (err) { - thrownError = err; - } - - expect(thrownError).toStrictEqual(new Error(expectedError)); - }); - it(`getRecipientPublicKey() correctly retrieves the public key of a cash address`, async () => { const { getRecipientPublicKey } = useBCH(); const BCH = new BCHJS(); - expect( - await getRecipientPublicKey( - BCH, - 'bitcoincash:qqvuj09f80sw9j7qru84ptxf0hyqffc38gstxfs5ru', - ), - ).toStrictEqual( - '03208c4f52229e021ddec5fc6e07a59fd66388ac52bc2a2c1e0f1afb24b0e275ac', - ); - }); - - it(`getRecipientPublicKey() correctly throws error for an invalid cash address`, async () => { - const { getRecipientPublicKey } = useBCH(); - const BCH = new BCHJS(); - const destinationAddress = 'bitcoincash:qqvuj0INVALIDDDDDDDDDDs5ru'; - - const expectedError = { - error: `Unsupported address format : ${destinationAddress}`, - success: false, + const expectedPubKeyResponse = { + success: true, + publicKey: + '03208c4f52229e021ddec5fc6e07a59fd66388ac52bc2a2c1e0f1afb24b0e275ac', }; - - let thrownError; - try { - await getRecipientPublicKey(BCH, destinationAddress); - } catch (err) { - thrownError = err; - } - - expect(thrownError).toStrictEqual(expectedError); - }); - - it(`getRecipientPublicKey() correctly throws error for a null cash address input`, async () => { - const { getRecipientPublicKey } = useBCH(); - const BCH = new BCHJS(); - const destinationAddress = null; - const expectedError = 'Input must be a valid Bitcoin Cash address.'; - - let thrownError; - try { - await getRecipientPublicKey(BCH, destinationAddress); - } catch (err) { - thrownError = err; - } - - expect(thrownError).toStrictEqual(new Error(expectedError)); + const expectedPubKey = + '03208c4f52229e021ddec5fc6e07a59fd66388ac52bc2a2c1e0f1afb24b0e275ac'; + const destinationAddress = + 'bitcoincash:qqvuj09f80sw9j7qru84ptxf0hyqffc38gstxfs5ru'; + BCH.encryption.getPubKey = jest + .fn() + .mockResolvedValue(expectedPubKeyResponse); + expect(await getRecipientPublicKey(BCH, destinationAddress)).toBe( + expectedPubKey, + ); }); });