Page MenuHomePhabricator

[Cashtab] [Alias] pt 2 - Implement registerNewAlias() to handle alias registration
ClosedPublic

Authored by emack on Dec 15 2022, 13:41.

Details

Summary

T2551

Depends on D12852

Creates a new registerNewAlias functionto take in alias registration parameters (alias, alias flag & payment fee) and generateOpReturnScript to append the appropriate alias prefix hex.

[Cashtab] [Alias] pt 1 - Create scaffold for new Identity component
[Cashtab] [Alias] pt 2 - Implement registerNewAlias() to handle alias registration
[Cashtab] [Alias] pt 3 - Implement isAliasAvailable function
[Cashtab] [Alias] pt 4 - Implement isAddressRegistered function
[Cashtab] [Alias] pt 5 - Implement getAddressFromAlias function
[Cashtab] [Alias] pt 6 - Implement isLocalAliasStateLatest function
[Cashtab] [Alias] pt 7 - Enable alias lookup for Send XEC component
[Cashtab] [Alias] pt 8 - Enable alias lookup for Send Token component
[Cashtab] [Alias] pt 9 - Implement pricing mechanism
[Cashtab] [Alias] pt 10 - Server cron job
[Cashtab] [Alias] pt 11 - Upgrade tx history to recognize alias registration txs

Test Plan
  • npm test
  • npm start
  • attempt to register with no input or empty string / spaces only input and verify the Register Alias button is disabled
  • enter a valid inupt and click Register Alias
  • verify console log displays the correct registration fee based on the number of chars in the alias input
  • verify the successful transaction notification is displayed
  • verify the registration transaction shows up on explorer

https://explorer.e.cash/address/ecash:qp3c268rd5946l2f5m5es4x25f7ewu4sjvpy52pqa8

  • verify the OP_RETURN output for the registration transaction follows the expected standard below:

[OP_RETURN] [.xec] [the alias]

e.g. 6a042e786563036e6673

6a (OP_RETURN)

04

2e786563 (.xec prefix)

03

6e6673 ('nfs')
  • attempt to register an alias longer than 21 characters and ensure frontend input does not allow this
  • test sending and receiving of encrypted and unencrypted cashtab messages + external electrum messages

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes

Moved the registration fee lookup logic from Alias.js into cashMethods.js as it's a more appropriate location for later diffs to utilize the same logic.

Failed tests logs:

====== CashTab Unit Tests:  Wallet without BCH balance ======
Error: expect(received).toMatchSnapshot()

Snapshot name: `Wallet without BCH balance 1`

- Snapshot  - 2
+ Received  + 2

@@ -157,11 +157,11 @@
                                  className="ant-input-wrapper ant-input-group"
                                >
                                  <span
                                    className="ant-input-affix-wrapper"
                                    hidden={null}
-                                   onMouseDown={[Function]}
+                                   onClick={[Function]}
                                    style={null}
                                  >
                                    <span
                                      className="ant-input-prefix"
                                    >
@@ -265,11 +265,11 @@
                              <span
                                className="ant-input-group ant-input-group-compact"
                              >
                                <span
                                  className="ant-input-affix-wrapper"
-                                 onMouseDown={[Function]}
+                                 onClick={[Function]}
                                  style={
                                    Object {
                                      "textAlign": "left",
                                      "width": "60%",
                                    }
    at Object.<anonymous> (/work/web/cashtab/src/components/Send/__tests__/Send.test.js:44:18)
    at Promise.then.completed (/work/web/cashtab/node_modules/jest-circus/build/utils.js:391:28)
    at new Promise (<anonymous>)
    at callAsyncCircusFn (/work/web/cashtab/node_modules/jest-circus/build/utils.js:316:10)
    at _callCircusTest (/work/web/cashtab/node_modules/jest-circus/build/run.js:218:40)
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
    at _runTest (/work/web/cashtab/node_modules/jest-circus/build/run.js:155:3)
    at _runTestsForDescribeBlock (/work/web/cashtab/node_modules/jest-circus/build/run.js:66:9)
    at run (/work/web/cashtab/node_modules/jest-circus/build/run.js:25:3)
    at runAndTransformResultsToJestFormat (/work/web/cashtab/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:170:21)
    at jestAdapter (/work/web/cashtab/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:82:19)
    at runTestInternal (/work/web/cashtab/node_modules/jest-runner/build/runTest.js:389:16)
    at runTest (/work/web/cashtab/node_modules/jest-runner/build/runTest.js:475:34)
    at Object.worker (/work/web/cashtab/node_modules/jest-runner/build/testWorker.js:133:12)
====== CashTab Unit Tests:  Wallet with BCH balances ======
Error: expect(received).toMatchSnapshot()

Snapshot name: `Wallet with BCH balances 1`

- Snapshot  - 2
+ Received  + 2

@@ -157,11 +157,11 @@
                                  className="ant-input-wrapper ant-input-group"
                                >
                                  <span
                                    className="ant-input-affix-wrapper"
                                    hidden={null}
-                                   onMouseDown={[Function]}
+                                   onClick={[Function]}
                                    style={null}
                                  >
                                    <span
                                      className="ant-input-prefix"
                                    >
@@ -265,11 +265,11 @@
                              <span
                                className="ant-input-group ant-input-group-compact"
                              >
                                <span
                                  className="ant-input-affix-wrapper"
-                                 onMouseDown={[Function]}
+                                 onClick={[Function]}
                                  style={
                                    Object {
                                      "textAlign": "left",
                                      "width": "60%",
                                    }
    at Object.<anonymous> (/work/web/cashtab/src/components/Send/__tests__/Send.test.js:58:18)
    at Promise.then.completed (/work/web/cashtab/node_modules/jest-circus/build/utils.js:391:28)
    at new Promise (<anonymous>)
    at callAsyncCircusFn (/work/web/cashtab/node_modules/jest-circus/build/utils.js:316:10)
    at _callCircusTest (/work/web/cashtab/node_modules/jest-circus/build/run.js:218:40)
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
    at _runTest (/work/web/cashtab/node_modules/jest-circus/build/run.js:155:3)
    at _runTestsForDescribeBlock (/work/web/cashtab/node_modules/jest-circus/build/run.js:66:9)
    at run (/work/web/cashtab/node_modules/jest-circus/build/run.js:25:3)
    at runAndTransformResultsToJestFormat (/work/web/cashtab/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:170:21)
    at jestAdapter (/work/web/cashtab/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:82:19)
    at runTestInternal (/work/web/cashtab/node_modules/jest-runner/build/runTest.js:389:16)
    at runTest (/work/web/cashtab/node_modules/jest-runner/build/runTest.js:475:34)
    at Object.worker (/work/web/cashtab/node_modules/jest-runner/build/testWorker.js:133:12)
====== CashTab Unit Tests:  Wallet with BCH balances and tokens ======
Error: expect(received).toMatchSnapshot()

Snapshot name: `Wallet with BCH balances and tokens 1`

- Snapshot  - 2
+ Received  + 2

@@ -157,11 +157,11 @@
                                  className="ant-input-wrapper ant-input-group"
                                >
                                  <span
                                    className="ant-input-affix-wrapper"
                                    hidden={null}
-                                   onMouseDown={[Function]}
+                                   onClick={[Function]}
                                    style={null}
                                  >
                                    <span
                                      className="ant-input-prefix"
                                    >
@@ -265,11 +265,11 @@
                              <span
                                className="ant-input-group ant-input-group-compact"
                              >
                                <span
                                  className="ant-input-affix-wrapper"
-                                 onMouseDown={[Function]}
+                                 onClick={[Function]}
                                  style={
                                    Object {
                                      "textAlign": "left",
                                      "width": "60%",
                                    }
    at Object.<anonymous> (/work/web/cashtab/src/components/Send/__tests__/Send.test.js:72:18)
    at Promise.then.completed (/work/web/cashtab/node_modules/jest-circus/build/utils.js:391:28)
    at new Promise (<anonymous>)
    at callAsyncCircusFn (/work/web/cashtab/node_modules/jest-circus/build/utils.js:316:10)
    at _callCircusTest (/work/web/cashtab/node_modules/jest-circus/build/run.js:218:40)
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
    at _runTest (/work/web/cashtab/node_modules/jest-circus/build/run.js:155:3)
    at _runTestsForDescribeBlock (/work/web/cashtab/node_modules/jest-circus/build/run.js:66:9)
    at run (/work/web/cashtab/node_modules/jest-circus/build/run.js:25:3)
    at runAndTransformResultsToJestFormat (/work/web/cashtab/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:170:21)
    at jestAdapter (/work/web/cashtab/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:82:19)
    at runTestInternal (/work/web/cashtab/node_modules/jest-runner/build/runTest.js:389:16)
    at runTest (/work/web/cashtab/node_modules/jest-runner/build/runTest.js:475:34)
    at Object.worker (/work/web/cashtab/node_modules/jest-runner/build/testWorker.js:133:12)
====== CashTab Unit Tests:  Wallet with BCH balances and tokens and state field ======
Error: expect(received).toMatchSnapshot()

Snapshot name: `Wallet with BCH balances and tokens and state field 1`

- Snapshot  - 2
+ Received  + 2

@@ -162,11 +162,11 @@
                                  className="ant-input-wrapper ant-input-group"
                                >
                                  <span
                                    className="ant-input-affix-wrapper"
                                    hidden={null}
-                                   onMouseDown={[Function]}
+                                   onClick={[Function]}
                                    style={null}
                                  >
                                    <span
                                      className="ant-input-prefix"
                                    >
@@ -270,11 +270,11 @@
                              <span
                                className="ant-input-group ant-input-group-compact"
                              >
                                <span
                                  className="ant-input-affix-wrapper"
-                                 onMouseDown={[Function]}
+                                 onClick={[Function]}
                                  style={
                                    Object {
                                      "textAlign": "left",
                                      "width": "60%",
                                    }
    at Object.<anonymous> (/work/web/cashtab/src/components/Send/__tests__/Send.test.js:88:18)
    at Promise.then.completed (/work/web/cashtab/node_modules/jest-circus/build/utils.js:391:28)
    at new Promise (<anonymous>)
    at callAsyncCircusFn (/work/web/cashtab/node_modules/jest-circus/build/utils.js:316:10)
    at _callCircusTest (/work/web/cashtab/node_modules/jest-circus/build/run.js:218:40)
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
    at _runTest (/work/web/cashtab/node_modules/jest-circus/build/run.js:155:3)
    at _runTestsForDescribeBlock (/work/web/cashtab/node_modules/jest-circus/build/run.js:66:9)
    at run (/work/web/cashtab/node_modules/jest-circus/build/run.js:25:3)
    at runAndTransformResultsToJestFormat (/work/web/cashtab/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:170:21)
    at jestAdapter (/work/web/cashtab/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:82:19)
    at runTestInternal (/work/web/cashtab/node_modules/jest-runner/build/runTest.js:389:16)
    at runTest (/work/web/cashtab/node_modules/jest-runner/build/runTest.js:475:34)
    at Object.worker (/work/web/cashtab/node_modules/jest-runner/build/testWorker.js:133:12)Error: expect(received).toMatchSnapshot()

Snapshot name: `Wallet with BCH balances and tokens and state field 1`

- Snapshot  - 2
+ Received  + 2

@@ -54,11 +54,11 @@
                          className="ant-input-wrapper ant-input-group"
                        >
                          <span
                            className="ant-input-affix-wrapper"
                            hidden={null}
-                           onMouseDown={[Function]}
+                           onClick={[Function]}
                            style={null}
                          >
                            <span
                              className="ant-input-prefix"
                            >
@@ -161,11 +161,11 @@
                          className="ant-input-wrapper ant-input-group"
                        >
                          <span
                            className="ant-input-affix-wrapper"
                            hidden={null}
-                           onMouseDown={[Function]}
+                           onClick={[Function]}
                            style={null}
                          >
                            <span
                              className="ant-input-prefix"
                            />
    at Object.<anonymous> (/work/web/cashtab/src/components/Send/__tests__/SendToken.test.js:66:18)
    at Promise.then.completed (/work/web/cashtab/node_modules/jest-circus/build/utils.js:391:28)
    at new Promise (<anonymous>)
    at callAsyncCircusFn (/work/web/cashtab/node_modules/jest-circus/build/utils.js:316:10)
    at _callCircusTest (/work/web/cashtab/node_modules/jest-circus/build/run.js:218:40)
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
    at _runTest (/work/web/cashtab/node_modules/jest-circus/build/run.js:155:3)
    at _runTestsForDescribeBlock (/work/web/cashtab/node_modules/jest-circus/build/run.js:66:9)
    at run (/work/web/cashtab/node_modules/jest-circus/build/run.js:25:3)
    at runAndTransformResultsToJestFormat (/work/web/cashtab/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:170:21)
    at jestAdapter (/work/web/cashtab/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:82:19)
    at runTestInternal (/work/web/cashtab/node_modules/jest-runner/build/runTest.js:389:16)
    at runTest (/work/web/cashtab/node_modules/jest-runner/build/runTest.js:475:34)
    at Object.worker (/work/web/cashtab/node_modules/jest-runner/build/testWorker.js:133:12)
====== CashTab Unit Tests:  Without wallet defined ======
Error: expect(received).toMatchSnapshot()

Snapshot name: `Without wallet defined 1`

- Snapshot  - 2
+ Received  + 2

@@ -152,11 +152,11 @@
                                  className="ant-input-wrapper ant-input-group"
                                >
                                  <span
                                    className="ant-input-affix-wrapper"
                                    hidden={null}
-                                   onMouseDown={[Function]}
+                                   onClick={[Function]}
                                    style={null}
                                  >
                                    <span
                                      className="ant-input-prefix"
                                    >
@@ -260,11 +260,11 @@
                              <span
                                className="ant-input-group ant-input-group-compact"
                              >
                                <span
                                  className="ant-input-affix-wrapper"
-                                 onMouseDown={[Function]}
+                                 onClick={[Function]}
                                  style={
                                    Object {
                                      "textAlign": "left",
                                      "width": "60%",
                                    }
    at Object.<anonymous> (/work/web/cashtab/src/components/Send/__tests__/Send.test.js:107:18)
    at Promise.then.completed (/work/web/cashtab/node_modules/jest-circus/build/utils.js:391:28)
    at new Promise (<anonymous>)
    at callAsyncCircusFn (/work/web/cashtab/node_modules/jest-circus/build/utils.js:316:10)
    at _callCircusTest (/work/web/cashtab/node_modules/jest-circus/build/run.js:218:40)
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
    at _runTest (/work/web/cashtab/node_modules/jest-circus/build/run.js:155:3)
    at _runTestsForDescribeBlock (/work/web/cashtab/node_modules/jest-circus/build/run.js:66:9)
    at run (/work/web/cashtab/node_modules/jest-circus/build/run.js:25:3)
    at runAndTransformResultsToJestFormat (/work/web/cashtab/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:170:21)
    at jestAdapter (/work/web/cashtab/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:82:19)
    at runTestInternal (/work/web/cashtab/node_modules/jest-runner/build/runTest.js:389:16)
    at runTest (/work/web/cashtab/node_modules/jest-runner/build/runTest.js:475:34)
    at Object.worker (/work/web/cashtab/node_modules/jest-runner/build/testWorker.js:133:12)

Each failure log is accessible here:
CashTab Unit Tests: Wallet without BCH balance
CashTab Unit Tests: Wallet with BCH balances
CashTab Unit Tests: Wallet with BCH balances and tokens
CashTab Unit Tests: Wallet with BCH balances and tokens and state field
CashTab Unit Tests: Without wallet defined

Failed tests logs:

====== CashTab Unit Tests:  Wallet with BCH balances and tokens and state field ======
Error: expect(received).toMatchSnapshot()

Snapshot name: `Wallet with BCH balances and tokens and state field 1`

- Snapshot  - 2
+ Received  + 2

@@ -54,11 +54,11 @@
                          className="ant-input-wrapper ant-input-group"
                        >
                          <span
                            className="ant-input-affix-wrapper"
                            hidden={null}
-                           onMouseDown={[Function]}
+                           onClick={[Function]}
                            style={null}
                          >
                            <span
                              className="ant-input-prefix"
                            >
@@ -161,11 +161,11 @@
                          className="ant-input-wrapper ant-input-group"
                        >
                          <span
                            className="ant-input-affix-wrapper"
                            hidden={null}
-                           onMouseDown={[Function]}
+                           onClick={[Function]}
                            style={null}
                          >
                            <span
                              className="ant-input-prefix"
                            />
    at Object.<anonymous> (/work/web/cashtab/src/components/Send/__tests__/SendToken.test.js:66:18)
    at Promise.then.completed (/work/web/cashtab/node_modules/jest-circus/build/utils.js:391:28)
    at new Promise (<anonymous>)
    at callAsyncCircusFn (/work/web/cashtab/node_modules/jest-circus/build/utils.js:316:10)
    at _callCircusTest (/work/web/cashtab/node_modules/jest-circus/build/run.js:218:40)
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
    at _runTest (/work/web/cashtab/node_modules/jest-circus/build/run.js:155:3)
    at _runTestsForDescribeBlock (/work/web/cashtab/node_modules/jest-circus/build/run.js:66:9)
    at run (/work/web/cashtab/node_modules/jest-circus/build/run.js:25:3)
    at runAndTransformResultsToJestFormat (/work/web/cashtab/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:170:21)
    at jestAdapter (/work/web/cashtab/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:82:19)
    at runTestInternal (/work/web/cashtab/node_modules/jest-runner/build/runTest.js:389:16)
    at runTest (/work/web/cashtab/node_modules/jest-runner/build/runTest.js:475:34)
    at Object.worker (/work/web/cashtab/node_modules/jest-runner/build/testWorker.js:133:12)Error: expect(received).toMatchSnapshot()

Snapshot name: `Wallet with BCH balances and tokens and state field 1`

- Snapshot  - 2
+ Received  + 2

@@ -162,11 +162,11 @@
                                  className="ant-input-wrapper ant-input-group"
                                >
                                  <span
                                    className="ant-input-affix-wrapper"
                                    hidden={null}
-                                   onMouseDown={[Function]}
+                                   onClick={[Function]}
                                    style={null}
                                  >
                                    <span
                                      className="ant-input-prefix"
                                    >
@@ -270,11 +270,11 @@
                              <span
                                className="ant-input-group ant-input-group-compact"
                              >
                                <span
                                  className="ant-input-affix-wrapper"
-                                 onMouseDown={[Function]}
+                                 onClick={[Function]}
                                  style={
                                    Object {
                                      "textAlign": "left",
                                      "width": "60%",
                                    }
    at Object.<anonymous> (/work/web/cashtab/src/components/Send/__tests__/Send.test.js:88:18)
    at Promise.then.completed (/work/web/cashtab/node_modules/jest-circus/build/utils.js:391:28)
    at new Promise (<anonymous>)
    at callAsyncCircusFn (/work/web/cashtab/node_modules/jest-circus/build/utils.js:316:10)
    at _callCircusTest (/work/web/cashtab/node_modules/jest-circus/build/run.js:218:40)
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
    at _runTest (/work/web/cashtab/node_modules/jest-circus/build/run.js:155:3)
    at _runTestsForDescribeBlock (/work/web/cashtab/node_modules/jest-circus/build/run.js:66:9)
    at run (/work/web/cashtab/node_modules/jest-circus/build/run.js:25:3)
    at runAndTransformResultsToJestFormat (/work/web/cashtab/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:170:21)
    at jestAdapter (/work/web/cashtab/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:82:19)
    at runTestInternal (/work/web/cashtab/node_modules/jest-runner/build/runTest.js:389:16)
    at runTest (/work/web/cashtab/node_modules/jest-runner/build/runTest.js:475:34)
    at Object.worker (/work/web/cashtab/node_modules/jest-runner/build/testWorker.js:133:12)
====== CashTab Unit Tests:  Wallet without BCH balance ======
Error: expect(received).toMatchSnapshot()

Snapshot name: `Wallet without BCH balance 1`

- Snapshot  - 2
+ Received  + 2

@@ -157,11 +157,11 @@
                                  className="ant-input-wrapper ant-input-group"
                                >
                                  <span
                                    className="ant-input-affix-wrapper"
                                    hidden={null}
-                                   onMouseDown={[Function]}
+                                   onClick={[Function]}
                                    style={null}
                                  >
                                    <span
                                      className="ant-input-prefix"
                                    >
@@ -265,11 +265,11 @@
                              <span
                                className="ant-input-group ant-input-group-compact"
                              >
                                <span
                                  className="ant-input-affix-wrapper"
-                                 onMouseDown={[Function]}
+                                 onClick={[Function]}
                                  style={
                                    Object {
                                      "textAlign": "left",
                                      "width": "60%",
                                    }
    at Object.<anonymous> (/work/web/cashtab/src/components/Send/__tests__/Send.test.js:44:18)
    at Promise.then.completed (/work/web/cashtab/node_modules/jest-circus/build/utils.js:391:28)
    at new Promise (<anonymous>)
    at callAsyncCircusFn (/work/web/cashtab/node_modules/jest-circus/build/utils.js:316:10)
    at _callCircusTest (/work/web/cashtab/node_modules/jest-circus/build/run.js:218:40)
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
    at _runTest (/work/web/cashtab/node_modules/jest-circus/build/run.js:155:3)
    at _runTestsForDescribeBlock (/work/web/cashtab/node_modules/jest-circus/build/run.js:66:9)
    at run (/work/web/cashtab/node_modules/jest-circus/build/run.js:25:3)
    at runAndTransformResultsToJestFormat (/work/web/cashtab/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:170:21)
    at jestAdapter (/work/web/cashtab/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:82:19)
    at runTestInternal (/work/web/cashtab/node_modules/jest-runner/build/runTest.js:389:16)
    at runTest (/work/web/cashtab/node_modules/jest-runner/build/runTest.js:475:34)
    at Object.worker (/work/web/cashtab/node_modules/jest-runner/build/testWorker.js:133:12)
====== CashTab Unit Tests:  Wallet with BCH balances ======
Error: expect(received).toMatchSnapshot()

Snapshot name: `Wallet with BCH balances 1`

- Snapshot  - 2
+ Received  + 2

@@ -157,11 +157,11 @@
                                  className="ant-input-wrapper ant-input-group"
                                >
                                  <span
                                    className="ant-input-affix-wrapper"
                                    hidden={null}
-                                   onMouseDown={[Function]}
+                                   onClick={[Function]}
                                    style={null}
                                  >
                                    <span
                                      className="ant-input-prefix"
                                    >
@@ -265,11 +265,11 @@
                              <span
                                className="ant-input-group ant-input-group-compact"
                              >
                                <span
                                  className="ant-input-affix-wrapper"
-                                 onMouseDown={[Function]}
+                                 onClick={[Function]}
                                  style={
                                    Object {
                                      "textAlign": "left",
                                      "width": "60%",
                                    }
    at Object.<anonymous> (/work/web/cashtab/src/components/Send/__tests__/Send.test.js:58:18)
    at Promise.then.completed (/work/web/cashtab/node_modules/jest-circus/build/utils.js:391:28)
    at new Promise (<anonymous>)
    at callAsyncCircusFn (/work/web/cashtab/node_modules/jest-circus/build/utils.js:316:10)
    at _callCircusTest (/work/web/cashtab/node_modules/jest-circus/build/run.js:218:40)
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
    at _runTest (/work/web/cashtab/node_modules/jest-circus/build/run.js:155:3)
    at _runTestsForDescribeBlock (/work/web/cashtab/node_modules/jest-circus/build/run.js:66:9)
    at run (/work/web/cashtab/node_modules/jest-circus/build/run.js:25:3)
    at runAndTransformResultsToJestFormat (/work/web/cashtab/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:170:21)
    at jestAdapter (/work/web/cashtab/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:82:19)
    at runTestInternal (/work/web/cashtab/node_modules/jest-runner/build/runTest.js:389:16)
    at runTest (/work/web/cashtab/node_modules/jest-runner/build/runTest.js:475:34)
    at Object.worker (/work/web/cashtab/node_modules/jest-runner/build/testWorker.js:133:12)
====== CashTab Unit Tests:  Wallet with BCH balances and tokens ======
Error: expect(received).toMatchSnapshot()

Snapshot name: `Wallet with BCH balances and tokens 1`

- Snapshot  - 2
+ Received  + 2

@@ -157,11 +157,11 @@
                                  className="ant-input-wrapper ant-input-group"
                                >
                                  <span
                                    className="ant-input-affix-wrapper"
                                    hidden={null}
-                                   onMouseDown={[Function]}
+                                   onClick={[Function]}
                                    style={null}
                                  >
                                    <span
                                      className="ant-input-prefix"
                                    >
@@ -265,11 +265,11 @@
                              <span
                                className="ant-input-group ant-input-group-compact"
                              >
                                <span
                                  className="ant-input-affix-wrapper"
-                                 onMouseDown={[Function]}
+                                 onClick={[Function]}
                                  style={
                                    Object {
                                      "textAlign": "left",
                                      "width": "60%",
                                    }
    at Object.<anonymous> (/work/web/cashtab/src/components/Send/__tests__/Send.test.js:72:18)
    at Promise.then.completed (/work/web/cashtab/node_modules/jest-circus/build/utils.js:391:28)
    at new Promise (<anonymous>)
    at callAsyncCircusFn (/work/web/cashtab/node_modules/jest-circus/build/utils.js:316:10)
    at _callCircusTest (/work/web/cashtab/node_modules/jest-circus/build/run.js:218:40)
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
    at _runTest (/work/web/cashtab/node_modules/jest-circus/build/run.js:155:3)
    at _runTestsForDescribeBlock (/work/web/cashtab/node_modules/jest-circus/build/run.js:66:9)
    at run (/work/web/cashtab/node_modules/jest-circus/build/run.js:25:3)
    at runAndTransformResultsToJestFormat (/work/web/cashtab/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:170:21)
    at jestAdapter (/work/web/cashtab/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:82:19)
    at runTestInternal (/work/web/cashtab/node_modules/jest-runner/build/runTest.js:389:16)
    at runTest (/work/web/cashtab/node_modules/jest-runner/build/runTest.js:475:34)
    at Object.worker (/work/web/cashtab/node_modules/jest-runner/build/testWorker.js:133:12)
====== CashTab Unit Tests:  Without wallet defined ======
Error: expect(received).toMatchSnapshot()

Snapshot name: `Without wallet defined 1`

- Snapshot  - 2
+ Received  + 2

@@ -152,11 +152,11 @@
                                  className="ant-input-wrapper ant-input-group"
                                >
                                  <span
                                    className="ant-input-affix-wrapper"
                                    hidden={null}
-                                   onMouseDown={[Function]}
+                                   onClick={[Function]}
                                    style={null}
                                  >
                                    <span
                                      className="ant-input-prefix"
                                    >
@@ -260,11 +260,11 @@
                              <span
                                className="ant-input-group ant-input-group-compact"
                              >
                                <span
                                  className="ant-input-affix-wrapper"
-                                 onMouseDown={[Function]}
+                                 onClick={[Function]}
                                  style={
                                    Object {
                                      "textAlign": "left",
                                      "width": "60%",
                                    }
    at Object.<anonymous> (/work/web/cashtab/src/components/Send/__tests__/Send.test.js:107:18)
    at Promise.then.completed (/work/web/cashtab/node_modules/jest-circus/build/utils.js:391:28)
    at new Promise (<anonymous>)
    at callAsyncCircusFn (/work/web/cashtab/node_modules/jest-circus/build/utils.js:316:10)
    at _callCircusTest (/work/web/cashtab/node_modules/jest-circus/build/run.js:218:40)
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
    at _runTest (/work/web/cashtab/node_modules/jest-circus/build/run.js:155:3)
    at _runTestsForDescribeBlock (/work/web/cashtab/node_modules/jest-circus/build/run.js:66:9)
    at run (/work/web/cashtab/node_modules/jest-circus/build/run.js:25:3)
    at runAndTransformResultsToJestFormat (/work/web/cashtab/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:170:21)
    at jestAdapter (/work/web/cashtab/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:82:19)
    at runTestInternal (/work/web/cashtab/node_modules/jest-runner/build/runTest.js:389:16)
    at runTest (/work/web/cashtab/node_modules/jest-runner/build/runTest.js:475:34)
    at Object.worker (/work/web/cashtab/node_modules/jest-runner/build/testWorker.js:133:12)

Each failure log is accessible here:
CashTab Unit Tests: Wallet with BCH balances and tokens and state field
CashTab Unit Tests: Wallet without BCH balance
CashTab Unit Tests: Wallet with BCH balances
CashTab Unit Tests: Wallet with BCH balances and tokens
CashTab Unit Tests: Without wallet defined

bytesofman added inline comments.
web/cashtab/src/components/Alias/Alias.js
70 ↗(On Diff #37348)

will want to calculate this before the if, since isAliasAvailable will be async. something like

const aliasAvailable = await isAliasAvailable(aliasInput)
if (aliasAvailable) {...}
82 ↗(On Diff #37348)

Now that we have so many of the key components of sendXec compartmentalized, I think it would be better to create a new registerNewAlias function.

This way we can leave sendXec alone. But we don't have to do a lot of new things to create registerNewAlias. It will use most of the building blocks from sendXec with a special OP_RETURN.

web/cashtab/src/utils/chronik.js
15 ↗(On Diff #37348)

This will be async

This revision now requires changes to proceed.Dec 20 2022, 00:14

image.png (394×396 px, 17 KB)

I don't think we need the [_tab] prefix (making it a double prefix). Goal here is to create something that can be a standard. If someone wants to support alias registration from another wallet, they are welcome to do so.

Side note: we really don't want double prefixes to happen ever. If they do, there needs to be some kind of standard for "is there a double prefix? is there an nth prefix?"

I realize Cashtab uses double prefixes for the case of "airdrop tx that involves a cashtab msg". But this is kind of unique -- and any external service would still be able to validate it by using only the first prefix, so it is still compatible with existing standards.

In this case, some external service would see the _tab prefix and validate accordingly, not realizing that this tx is actualy a .xec tx.

emack marked 3 inline comments as done.
  • OP_RETURN script for an alias registration tx will now follow the [OP_RETURN][.xec][alias name] standard
  • migrated alias registration logic from sendXec() into its own registerNewAlias function
  • adjusted generateOpReturnScript() to no longer append the cashtab prefix on alias registration txs
  • updated unit tests for generateOpReturnScript() to validate the new standard
  • reverted sendXec() to its original state
  • separated out the async isAliasAvailable call placeholder
emack retitled this revision from [Cashtab] [Alias] pt 2 - Upgrade sendXec() to handle alias registration to [Cashtab] [Alias] pt 2 - Implement registerNewAlias() to handle alias registration.Dec 20 2022, 08:22
emack edited the summary of this revision. (Show Details)
bytesofman added inline comments.
web/cashtab/src/components/Alias/Alias.js
60 ↗(On Diff #37382)

Not sure why initializing as array with empty string instead of an empty array. This would mess with the code later on of alias.push(<pending alias>) ... now you have 2 aliases, a blank string and what you want?

65 ↗(On Diff #37382)

Need a useEffect block that calls passLoadingStatus(false) when the wallet has updated its utxo set after the registration tx is broadcast. See Send.js for model.

107 ↗(On Diff #37382)

There's a specific way to do this sort of thing in React, see https://stackoverflow.com/questions/54676966/push-method-in-react-hooks-usestate

web/cashtab/src/utils/transactions.js
353 ↗(On Diff #37382)

While we're at it, aliasName has a max length based on what we're currently able to get into one OP_RETURN msg. I'm not sure what it is.

Current behavior here if aliasName is too long is ... error thrown by generateOpReturnScript? I'm not sure. Need to handle this somewhere.

This revision now requires changes to proceed.Dec 20 2022, 23:16
emack marked 4 inline comments as done.
  • updated alias array initialization
  • added useEffect block in Alias.js which sets passLoadingStatus to false upon utxo refresh
  • adjusted for usage of push method in react hook useState
  • in terms of capping number of chars in an alias, the limit for unencrypted OP_RETURN messages through cashtab is 206 chars. However some single symbols like a cat face can take up 3-4 characters by themselves, hence, taking an approx quarter of that technical limit is 50 chars. This is enforced via the <Input> component's maxLength parameter in the frontend so no backend restriction is needed. I didn't put it in Ticker.js as this isn't something we will be adjusting on the regular.
  • adjusted NamespaceCtn css to correctly render 50 char aliases
bytesofman added inline comments.
web/cashtab/src/components/Alias/Alias.js
112 ↗(On Diff #37402)

replace aliasInput + ' (Pending)' with

`${aliasInput} (Pending)`

So that it's easier to see we are talking about one new array entry that is one string

210 ↗(On Diff #37402)

Add a comment somewhere explaining why 50 was chosen.

This revision now requires changes to proceed.Dec 22 2022, 00:07
emack marked 2 inline comments as done.
  • added currency.aliasSettings.aliasMaxLength to Ticker with comment explaining why 50 was chosen
  • adjusted alias rendering text
bytesofman requested changes to this revision.Jan 3 2023, 19:15

Also getting the git cherry-pick merge conflicts with this

web/cashtab/src/components/Common/Ticker.js
25 ↗(On Diff #37421)

For simplicity's sake, could we lower this further? Say 21 characters, because

  • Long enough for an alias, egtwentyonecharacters
  • Historical crypto significance of 21 and eCash supply
  • Easier to parse for than 50
  • Discourage use of longer aliases which could be more easily confused; e.g. if you have a 50 char alias and someone else registers an alias with 49 of those characters the same, would be very difficult for a human reader to recognize they are different at a glance

Having an exceptionally long alias kind of defeats the point, and since we need to parse the blockchain for these, the lower the better.

This revision now requires changes to proceed.Jan 3 2023, 19:15
  • reduced alias length limit down to 21 chars
  • removed placeholder code blocks to comply with the new eslint policies
bytesofman requested changes to this revision.Jan 4 2023, 16:25

Getting a new error when I run arc patch 12898 now

 INFO  Base commit is not in local repository; trying to fetch.
Branch name arcpatch-D12898 already exists; trying a new name.
Branch name arcpatch-D12898_1 already exists; trying a new name.
Created and checked out branch arcpatch-D12898_2.
Created and checked out branch arcpatch-D12852.
Checking patch web/standards/op_return-prefix-guideline.md...
Checking patch web/cashtab/src/utils/transactions.js...
Checking patch web/cashtab/src/utils/chronik.js...
Checking patch web/cashtab/src/utils/cashMethods.js...
Checking patch web/cashtab/src/components/Tokens/__tests__/__snapshots__/Tokens.test.js.snap...
Checking patch web/cashtab/src/components/Tokens/__tests__/__snapshots__/CreateTokenForm.test.js.snap...
Checking patch web/cashtab/src/components/SignVerifyMsg/__tests__/__snapshots__/SignVerifyMsg.test.js.snap...
Checking patch web/cashtab/src/components/Send/__tests__/__snapshots__/SendToken.test.js.snap...
Checking patch web/cashtab/src/components/Send/__tests__/__snapshots__/Send.test.js.snap...
Checking patch web/cashtab/src/components/Receive/__tests__/__snapshots__/Receive.test.js.snap...
Checking patch web/cashtab/src/components/Home/__tests__/__snapshots__/Home.test.js.snap...
Checking patch web/cashtab/src/components/Configure/__tests__/__snapshots__/Configure.test.js.snap...
Checking patch web/cashtab/src/components/Common/Ticker.js...
Checking patch web/cashtab/src/components/Common/CustomIcons.js...
Checking patch web/cashtab/src/components/App.js...
Checking patch web/cashtab/src/components/Alias/__tests__/__snapshots__/Alias.test.js.snap...
Checking patch web/cashtab/src/components/Alias/__tests__/Alias.test.js...
Checking patch web/cashtab/src/components/Alias/Alias.js...
Checking patch web/cashtab/src/components/Airdrop/__tests__/__snapshots__/Airdrop.test.js.snap...
Checking patch web/cashtab/src/assets/user.svg...
Checking patch web/cashtab/extension/src/components/App.js...
Applied patch web/standards/op_return-prefix-guideline.md cleanly.
Applied patch web/cashtab/src/utils/transactions.js cleanly.
Applied patch web/cashtab/src/utils/chronik.js cleanly.
Applied patch web/cashtab/src/utils/cashMethods.js cleanly.
Applied patch web/cashtab/src/components/Tokens/__tests__/__snapshots__/Tokens.test.js.snap cleanly.
Applied patch web/cashtab/src/components/Tokens/__tests__/__snapshots__/CreateTokenForm.test.js.snap cleanly.
Applied patch web/cashtab/src/components/SignVerifyMsg/__tests__/__snapshots__/SignVerifyMsg.test.js.snap cleanly.
Applied patch web/cashtab/src/components/Send/__tests__/__snapshots__/SendToken.test.js.snap cleanly.
Applied patch web/cashtab/src/components/Send/__tests__/__snapshots__/Send.test.js.snap cleanly.
Applied patch web/cashtab/src/components/Receive/__tests__/__snapshots__/Receive.test.js.snap cleanly.
Applied patch web/cashtab/src/components/Home/__tests__/__snapshots__/Home.test.js.snap cleanly.
Applied patch web/cashtab/src/components/Configure/__tests__/__snapshots__/Configure.test.js.snap cleanly.
Applied patch web/cashtab/src/components/Common/Ticker.js cleanly.
Applied patch web/cashtab/src/components/Common/CustomIcons.js cleanly.
Applied patch web/cashtab/src/components/App.js cleanly.
Applied patch web/cashtab/src/components/Alias/__tests__/__snapshots__/Alias.test.js.snap cleanly.
Applied patch web/cashtab/src/components/Alias/__tests__/Alias.test.js cleanly.
Applied patch web/cashtab/src/components/Alias/Alias.js cleanly.
Applied patch web/cashtab/src/components/Airdrop/__tests__/__snapshots__/Airdrop.test.js.snap cleanly.
Applied patch web/cashtab/src/assets/user.svg cleanly.
Applied patch web/cashtab/extension/src/components/App.js cleanly.
 COMMITTED  Successfully committed patch.


    This diff is against commit e972041249666ed2c6df03bc40a5d58bd30a85cd, but
    the commit is nowhere in the working copy. Try to apply it against the
    current working copy state? (95606b51c5c16ebcc93334a9218a66b16343e2d7)
    [Y/n] y

Checking patch web/cashtab/src/utils/transactions.js...
error: while searching for:
    MAX_UNCONFIRMED_TXS: 64,
};

/*
export const isLocalAliasStateLatest = async (
    chronik,
    aliasState
) => {
    // extract tx count from aliasState
    // calls chronik to check tx count for currency.aliasSettings.aliasPaymentAddress
    // if both tx counts match return true
    // return false
};
*/

export const createToken = async (
    chronik,
    wallet,

error: patch failed: web/cashtab/src/utils/transactions.js:23
Checking patch web/cashtab/src/utils/chronik.js...
error: while searching for:
import ecies from 'ecies-lite';
import wif from 'wif';

/*
const getAddressFromAlias = async (
    chronik,
    alias,
) => {
    // if isLocalAliasStateLatest() is true then retrieve incoming tx history from localStorage
    // else retrieve via chronik and update localStorage
    
    // for each incoming tx with OP_RETURN outputs that paid at least currency.aliasSettings.aliasMinFee
        // filter for currency.opReturn.appPrefixesHex.aliasRegistration
        // filter for valid payment fee in output[1]
        // filter for opReturnMsg (the alias) that matches alias
        // retrieve input[0] (replyAddress) as the address matching the alias
    
    if more than one entry is detected, choose the one that was confirmed first
      
    mitigate scenario if firstSeenTime === 0
    
    return address
};
*/

// Return false if do not get a valid response
export const getTokenStats = async (chronik, tokenId) => {

error: patch failed: web/cashtab/src/utils/chronik.js:12
error: while searching for:
    let isCashtabMessage = false;
    let isEncryptedMessage = false;
    let decryptionSuccess = false;
    // let isAliasRegistration = false;
    let replyAddress = '';

    // Iterate over inputs to see if this is an incoming tx (incoming === true)

error: patch failed: web/cashtab/src/utils/chronik.js:468
Checking patch web/cashtab/src/utils/cashMethods.js...
Checking patch web/cashtab/src/utils/__tests__/cashMethods.test.js...
Checking patch web/cashtab/src/components/Common/Ticker.js...
Checking patch web/cashtab/src/components/Alias/__tests__/__snapshots__/Alias.test.js.snap...
Checking patch web/cashtab/src/components/Alias/Alias.js...
Applying patch web/cashtab/src/utils/transactions.js with 1 reject...
Rejected hunk #1.
Hunk #2 applied cleanly.
Hunk #3 applied cleanly.
Hunk #4 applied cleanly.
Applying patch web/cashtab/src/utils/chronik.js with 2 rejects...
Rejected hunk #1.
Rejected hunk #2.
Applied patch web/cashtab/src/utils/cashMethods.js cleanly.
Applied patch web/cashtab/src/utils/__tests__/cashMethods.test.js cleanly.
Applied patch web/cashtab/src/components/Common/Ticker.js cleanly.
Applied patch web/cashtab/src/components/Alias/__tests__/__snapshots__/Alias.test.js.snap cleanly.
Applied patch web/cashtab/src/components/Alias/Alias.js cleanly.

 Patch Failed! 
Usage Exception: Unable to apply patch!
This revision now requires changes to proceed.Jan 4 2023, 16:25

Getting a new error when I run arc patch 12898 now

 INFO  Base commit is not in local repository; trying to fetch.
Branch name arcpatch-D12898 already exists; trying a new name.
Branch name arcpatch-D12898_1 already exists; trying a new name.
Created and checked out branch arcpatch-D12898_2.
Created and checked out branch arcpatch-D12852.
Checking patch web/standards/op_return-prefix-guideline.md...
Checking patch web/cashtab/src/utils/transactions.js...
Checking patch web/cashtab/src/utils/chronik.js...
Checking patch web/cashtab/src/utils/cashMethods.js...
Checking patch web/cashtab/src/components/Tokens/__tests__/__snapshots__/Tokens.test.js.snap...
Checking patch web/cashtab/src/components/Tokens/__tests__/__snapshots__/CreateTokenForm.test.js.snap...
Checking patch web/cashtab/src/components/SignVerifyMsg/__tests__/__snapshots__/SignVerifyMsg.test.js.snap...
Checking patch web/cashtab/src/components/Send/__tests__/__snapshots__/SendToken.test.js.snap...
Checking patch web/cashtab/src/components/Send/__tests__/__snapshots__/Send.test.js.snap...
Checking patch web/cashtab/src/components/Receive/__tests__/__snapshots__/Receive.test.js.snap...
Checking patch web/cashtab/src/components/Home/__tests__/__snapshots__/Home.test.js.snap...
Checking patch web/cashtab/src/components/Configure/__tests__/__snapshots__/Configure.test.js.snap...
Checking patch web/cashtab/src/components/Common/Ticker.js...
Checking patch web/cashtab/src/components/Common/CustomIcons.js...
Checking patch web/cashtab/src/components/App.js...
Checking patch web/cashtab/src/components/Alias/__tests__/__snapshots__/Alias.test.js.snap...
Checking patch web/cashtab/src/components/Alias/__tests__/Alias.test.js...
Checking patch web/cashtab/src/components/Alias/Alias.js...
Checking patch web/cashtab/src/components/Airdrop/__tests__/__snapshots__/Airdrop.test.js.snap...
Checking patch web/cashtab/src/assets/user.svg...
Checking patch web/cashtab/extension/src/components/App.js...
Applied patch web/standards/op_return-prefix-guideline.md cleanly.
Applied patch web/cashtab/src/utils/transactions.js cleanly.
Applied patch web/cashtab/src/utils/chronik.js cleanly.
Applied patch web/cashtab/src/utils/cashMethods.js cleanly.
Applied patch web/cashtab/src/components/Tokens/__tests__/__snapshots__/Tokens.test.js.snap cleanly.
Applied patch web/cashtab/src/components/Tokens/__tests__/__snapshots__/CreateTokenForm.test.js.snap cleanly.
Applied patch web/cashtab/src/components/SignVerifyMsg/__tests__/__snapshots__/SignVerifyMsg.test.js.snap cleanly.
Applied patch web/cashtab/src/components/Send/__tests__/__snapshots__/SendToken.test.js.snap cleanly.
Applied patch web/cashtab/src/components/Send/__tests__/__snapshots__/Send.test.js.snap cleanly.
Applied patch web/cashtab/src/components/Receive/__tests__/__snapshots__/Receive.test.js.snap cleanly.
Applied patch web/cashtab/src/components/Home/__tests__/__snapshots__/Home.test.js.snap cleanly.
Applied patch web/cashtab/src/components/Configure/__tests__/__snapshots__/Configure.test.js.snap cleanly.
Applied patch web/cashtab/src/components/Common/Ticker.js cleanly.
Applied patch web/cashtab/src/components/Common/CustomIcons.js cleanly.
Applied patch web/cashtab/src/components/App.js cleanly.
Applied patch web/cashtab/src/components/Alias/__tests__/__snapshots__/Alias.test.js.snap cleanly.
Applied patch web/cashtab/src/components/Alias/__tests__/Alias.test.js cleanly.
Applied patch web/cashtab/src/components/Alias/Alias.js cleanly.
Applied patch web/cashtab/src/components/Airdrop/__tests__/__snapshots__/Airdrop.test.js.snap cleanly.
Applied patch web/cashtab/src/assets/user.svg cleanly.
Applied patch web/cashtab/extension/src/components/App.js cleanly.
 COMMITTED  Successfully committed patch.


    This diff is against commit e972041249666ed2c6df03bc40a5d58bd30a85cd, but
    the commit is nowhere in the working copy. Try to apply it against the
    current working copy state? (95606b51c5c16ebcc93334a9218a66b16343e2d7)
    [Y/n] y

Checking patch web/cashtab/src/utils/transactions.js...
error: while searching for:
    MAX_UNCONFIRMED_TXS: 64,
};

/*
export const isLocalAliasStateLatest = async (
    chronik,
    aliasState
) => {
    // extract tx count from aliasState
    // calls chronik to check tx count for currency.aliasSettings.aliasPaymentAddress
    // if both tx counts match return true
    // return false
};
*/

export const createToken = async (
    chronik,
    wallet,

error: patch failed: web/cashtab/src/utils/transactions.js:23
Checking patch web/cashtab/src/utils/chronik.js...
error: while searching for:
import ecies from 'ecies-lite';
import wif from 'wif';

/*
const getAddressFromAlias = async (
    chronik,
    alias,
) => {
    // if isLocalAliasStateLatest() is true then retrieve incoming tx history from localStorage
    // else retrieve via chronik and update localStorage
    
    // for each incoming tx with OP_RETURN outputs that paid at least currency.aliasSettings.aliasMinFee
        // filter for currency.opReturn.appPrefixesHex.aliasRegistration
        // filter for valid payment fee in output[1]
        // filter for opReturnMsg (the alias) that matches alias
        // retrieve input[0] (replyAddress) as the address matching the alias
    
    if more than one entry is detected, choose the one that was confirmed first
      
    mitigate scenario if firstSeenTime === 0
    
    return address
};
*/

// Return false if do not get a valid response
export const getTokenStats = async (chronik, tokenId) => {

error: patch failed: web/cashtab/src/utils/chronik.js:12
error: while searching for:
    let isCashtabMessage = false;
    let isEncryptedMessage = false;
    let decryptionSuccess = false;
    // let isAliasRegistration = false;
    let replyAddress = '';

    // Iterate over inputs to see if this is an incoming tx (incoming === true)

error: patch failed: web/cashtab/src/utils/chronik.js:468
Checking patch web/cashtab/src/utils/cashMethods.js...
Checking patch web/cashtab/src/utils/__tests__/cashMethods.test.js...
Checking patch web/cashtab/src/components/Common/Ticker.js...
Checking patch web/cashtab/src/components/Alias/__tests__/__snapshots__/Alias.test.js.snap...
Checking patch web/cashtab/src/components/Alias/Alias.js...
Applying patch web/cashtab/src/utils/transactions.js with 1 reject...
Rejected hunk #1.
Hunk #2 applied cleanly.
Hunk #3 applied cleanly.
Hunk #4 applied cleanly.
Applying patch web/cashtab/src/utils/chronik.js with 2 rejects...
Rejected hunk #1.
Rejected hunk #2.
Applied patch web/cashtab/src/utils/cashMethods.js cleanly.
Applied patch web/cashtab/src/utils/__tests__/cashMethods.test.js cleanly.
Applied patch web/cashtab/src/components/Common/Ticker.js cleanly.
Applied patch web/cashtab/src/components/Alias/__tests__/__snapshots__/Alias.test.js.snap cleanly.
Applied patch web/cashtab/src/components/Alias/Alias.js cleanly.

 Patch Failed! 
Usage Exception: Unable to apply patch!

Rebased all parts - pls give it another go

green with a couple of nits

web/cashtab/src/components/Common/Ticker.js
25 ↗(On Diff #37474)

Instead of this comment, we can now just reference the spec ... tho that is still in a draft diff

web/cashtab/src/utils/cashMethods.js
662 ↗(On Diff #37474)

This comment makes sense in the context of this diff, but it won't make sense lingering in the codebase 6 months from now. Remove.

Note: we might want to also consider splitting up generateOpReturnScript into multiple functions depending on the specific use case, for the same reason we should eventually split sendXec into distinct functions for creating different types of transactions. This isn't relevant to the current diff though.

This revision is now accepted and ready to land.Jan 17 2023, 00:31
emack marked 2 inline comments as done.

updated reference to spec