Page MenuHomePhabricator

[Cashtab] Do not render mint switch on token page unless user has mint baton
ClosedPublic

Authored by bytesofman on Apr 17 2024, 11:50.

Details

Summary

Token action page should conditionally render only available options. The Mint option with a long explanation of why it is disabled is not helpful.

Just do not render the mint option if it is not available.

Test Plan

npm test

Diff Detail

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

Event Timeline

Failed tests logs:

====== CashTab Unit Tests: <TokenActions /> SLP1 fixed supply token ======
TestingLibraryElementError: Unable to find an element with the title: Toggle Mint.

Ignored nodes: comments, script, style
<body>
  <div>
    <div
      class="sc-hgRTRy jOfdtI"
    >
      <div
        class="Toastify"
      />
      <div
        class="sc-iIHSe rdePw"
      >
        <div
          class="sc-feryYK kkHVET"
        >
          <div
            class="sc-gldTML femPiK"
          >
            <div
              class="sc-kkbgRg ftXgaI"
            >
              <img
                alt="cashtab"
                class="sc-hRmvpr fUuxBg"
                src="test-file-stub"
              />
            </div>
            <div
              class="sc-gbzWSY hBCHVc"
              title="Wallet Info"
            >
              <div
                class="sc-dREXXX fAmbLM"
              >
                <select
                  class="sc-kcbnda qXwFy"
                  id="wallets"
                  name="wallets"
                >
                  <option
                    class="sc-hcmgZB fKdOEb"
                    value="Token Test"
                  >
                    Token Test
                  </option>
                </select>
                <div
                  class="sc-fEUNkw NZUjR"
                >
                  <button
                    aria-label="Copy ecash:qqq9f9z3uhpzkxrgdjkd7dxuuey7tmpmugpmnw0kue"
                    class="sc-fOKMvo fAHLVb"
                  >
                    <svg
                      title="copy-paste"
                    />
                  </button>
                  <div
                    class="sc-gHboQg fjXpEN"
                  >
                    <div
                      class="sc-eilVRo impULA"
                    >
                      <input
                        checked=""
                        class="sc-dymIpo dhyqmP"
                        id="show-hide-balance"
                        name="show-hide-balance"
                        title="show-hide-balance"
                        type="checkbox"
                      />
                      <label
                        class="sc-eerKOB NZoeG"
                        for="show-hide-balance"
                      >
                        <span
                          class="sc-emmjRN gmaaWK"
                          data-off=""
                          data-on=""
                        />
                        <span
                          class="sc-cpmLhU lcLQqB"
                        />
                      </label>
                    </div>
                  </div>
                </div>
              </div>
              <div
                class="sc-dHmInP gUvHSH"
                title="Balance in XEC"
              >
                9,970.81
                 
                XEC
                 
              </div>
              <div
                class="sc-ejGVNB eJFbkD"
                title="Balance in Local Currency"
              >
                $
                0.30
                 
                USD
              </div>
              <p
                class="sc-eLdqWK cjusfr"
                title="Price in Local Currency"
              >
                1 
                XEC
                 = 
                0.00003000
                 
                USD
              </p>
            </div>
          </div>
          <div
            class="sc-ESoVU gTaONH"
          >
            <div
              class="sc-iGrrsa gzzmZH"
            >
              111.000000000
               
              Vespene Gas
               (
              VSP
              )
            </div>
            <div
              class="sc-kaNhvL czOoID"
              title="Token Stats"
            >
              <div
                class="sc-iBEsjs eLgovB"
              >
                <button
                  class="sc-dEoRIm bBCnNm"
                >
                  <img
                    alt="icon for 20a0b9337a78603c6681ed2bc541593375535dcd9979196620ce71f233f2f6f8"
                    height="128"
                    src="https://icons.etokens.cash/128/20a0b9337a78603c6681ed2bc541593375535dcd9979196620ce71f233f2f6f8.png"
                    width="128"
                  />
                </button>
              </div>
              <div
                class="sc-iBEsjs eLgovB"
              >
                <div
                  class="sc-hzNEM jRtCRI"
                >
                  <div
                    class="sc-chbbiW hCEjss"
                  >
                    Type:
                  </div>
                  <div
                    class="sc-iBEsjs eLgovB"
                  >
                    <div
                      class="sc-bmyXtO zYbHC"
                    >
                      SLP
                       
                      <button
                        aria-label="Click for more info about this token type"
                        class="sc-fOKMvo fAHLVb"
                      >
                        <svg
                          title="More Info"
                        />
                      </button>
                    </div>
                  </div>
                </div>
                <div
                  class="sc-hzNEM jRtCRI"
                >
                  <div
                    class="sc-chbbiW hCEjss"
                  >
                    Token Id:
                  </div>
                  <div
                    class="sc-iBEsjs eLgovB"
                  >
                    <a
                      href="https://explorer.e.cash/tx/20a0b9337a78603c6681ed2bc541593375535dcd9979196620ce71f233f2f6f8"
                      rel="noopener noreferrer"
                      target="_blank"
                    >
                      20a
                      ...
                      6f8
                    </a>
                  </div>
                  <div
                    class="sc-iBEsjs eLgovB"
                  >
                    <button
                      class="sc-fOKMvo fAHLVb"
                    >
                      <svg
                        title="copy-paste"
                      />
                    </button>
                  </div>
                </div>
                <div
                  class="sc-hzNEM jRtCRI"
                >
                  <div
                    class="sc-chbbiW hCEjss"
                  >
                    decimals:
                  </div>
                  <div
                    class="sc-iBEsjs eLgovB"
                  >
                    9
                  </div>
                </div>
                <div
                  class="sc-hzNEM jRtCRI"
                >
                  <div
                    class="sc-chbbiW hCEjss"
                  >
                    url:
                  </div>
                  <div
                    class="sc-iBEsjs eLgovB"
                  >
                    <a
                      href="https://simple.wikipedia.org/wiki/StarCraft#Gameplay"
                      rel="noreferrer"
                      target="_blank"
                    >
                      simple.wiki...
                    </a>
                  </div>
                </div>
                <div
                  class="sc-hzNEM jRtCRI"
                >
                  <div
                    class="sc-chbbiW hCEjss"
                  >
                    created:
                  </div>
                  <div
                    class="sc-iBEsjs eLgovB"
                  >
                    Oct 24, 2022
                  </div>
                </div>
                <div
                  class="sc-hzNEM jRtCRI"
                >
                  <div
                    class="sc-chbbiW hCEjss"
                  >
                    Genesis Qty:
                  </div>
                  <div
                    class="sc-iBEsjs eLgovB"
                  >
                    3,000,000,000.000000000
                  </div>
                </div>
                <div
                  class="sc-hzNEM jRtCRI"
                >
                  <div
                    class="sc-chbbiW hCEjss"
                  >
                    Supply:
                  </div>
                  <div
                    class="sc-iBEsjs eLgovB"
                  >
                    2,999,998,798.000000000 (fixed)
                  </div>
                </div>
              </div>
            </div>
            <div
              class="sc-jtggT huibQt"
              title="Token Actions"
            >
              <div
                class="sc-kxynE eBCGhc"
              >
                <div
                  class="sc-gHboQg fjXpEN"
                >
                  <div
                    class="sc-eilVRo eDQFpJ"
                  >
                    <input
                      class="sc-dymIpo dhyqmP"
                      id="Toggle Send"
                      name="Toggle Send"
                      title="Toggle Send"
                      type="checkbox"
                    />
                    <label
                      class="sc-eerKOB NZoeG"
                      for="Toggle Send"
                    >
                      <span
                        class="sc-emmjRN fxtHZz"
                        data-off="➡️"
                        data-on="➡️"
                      />
                      <span
                        class="sc-cpmLhU gYgCxm"
                      />
                    </label>
                  </div>
                </div>
                <div
                  class="sc-ckVGcZ hCXLOb"
                >
                  Send 
                  Vespene Gas
                   (
                  VSP
                  )
                </div>
              </div>
              <div
                class="sc-ebFjAB jcTDvn"
              >
                <div
                  class="sc-jKVCRD hkDXZT"
                >
                  <div
                    class="sc-btzYZH kSktdT"
                  >
                    <div
                      class="sc-lhVmIH fuhlTY"
                    >
                      <input
                        class="sc-bYSBpT sc-kTUwUJ eijHiD"
                        name="address"
                        placeholder="Address"
                        value=""
                      />
                      <button
                        class="sc-iELTvK gjJHRf"
                        title="Scan QR Code"
                      >
                        <svg />
                      </button>
                    </div>
                    <div
                      class="sc-kPVwWT kixwk"
                    />
                  </div>
                  <div
                    class="sc-fcdeBU eyVJKA"
                  >
                    <a
                      class="sc-chPdSV laQSyi"
                      href="https://explorer.e.cash/address/false"
                      rel="noreferrer"
                      target="_blank"
                    />
                  </div>
                </div>
              </div>
              <div
                class="sc-ebFjAB jcTDvn"
              >
                <div
                  class="sc-btzYZH kSktdT"
                >
                  <div
                    class="sc-lhVmIH fuhlTY"
                  >
                    <input
                      class="sc-bYSBpT sc-kTUwUJ eijHiD"
                      name="amount"
                      placeholder="Amount"
                      step="1e-9"
                      type="number"
                      value=""
                    />
                    <button
                      class="sc-dqBHgY sc-gxMtzJ qrFKP"
                    >
                      max
                    </button>
                  </div>
                  <div
                    class="sc-kPVwWT kixwk"
                  />
                </div>
              </div>
              <div
                class="sc-ebFjAB jcTDvn"
              >
                <button
                  class="sc-bXGyLb sc-eLExRp cOkytB"
                  style="margin-top: 24px;"
                >
                  Send 
                  VSP
                </button>
              </div>
              <div
                class="sc-kxynE eBCGhc"
              >
                <div
                  class="sc-gHboQg fjXpEN"
                >
                  <div
                    class="sc-eilVRo eDQFpJ"
                  >
                    <input
                      class="sc-dymIpo dhyqmP"
                      id="Toggle Airdrop"
                      name="Toggle Airdrop"
                      title="Toggle Airdrop"
                      type="checkbox"
                    />
                    <label
                      class="sc-eerKOB NZoeG"
                      for="Toggle Airdrop"
                    >
                      <span
                        class="sc-emmjRN fxtHZz"
                        data-off="  "
                        data-on="  "
                      />
                      <span
                        class="sc-cpmLhU gYgCxm"
                      />
                    </label>
                  </div>
                </div>
                <div
                  class="sc-ckVGcZ hCXLOb"
                >
                  Airdrop XEC to 
                  VSP
                   holders
                </div>
              </div>
              <div
                class="sc-kxynE eBCGhc"
              >
                <div
                  class="sc-gHboQg fjXpEN"
                >
                  <div
                    class="sc-eilVRo eDQFpJ"
                  >
                    <input
                      class="sc-dymIpo dhyqmP"
                      id="Toggle Burn"
                      name="Toggle Burn"
                      title="Toggle Burn"
                      type="checkbox"
                    />
                    <label
                      class="sc-eerKOB NZoeG"
                      for="Toggle Burn"
                    >
                      <span
                        class="sc-emmjRN fxtHZz"
                        data-off="  "
                        data-on="  "
                      />
                      <span
                        class="sc-cpmLhU gYgCxm"
                      />
                    </label>
                  </div>
                </div>
                <div
                  class="sc-ckVGcZ hCXLOb"
                >
                  Burn 
                  VSP
                </div>
              </div>
            </div>
          </div>
        </div>
        <div
          class="sc-cJOK bNXPnn"
        >
          <button
            class="sc-hUMlYv bfxVjT"
          >
            <svg />
          </button>
          <button
            aria-label="Send Screen"
            class="sc-hUMlYv bfxVjT"
            style="padding-bottom: 10px;"
          >
            <div
              class="sc-iwsKbI cuDgAv"
            >
              <svg
                title="tx-sent"
              />
            </div>
          </button>
          <button
            aria-label="Tokens"
            class="sc-hUMlYv bfxVjT"
          >
            <svg
              title="Tokens"
            />
          </button>
          <button
            aria-label="Receive"
            class="sc-hUMlYv bfxVjT"
          >
            <svg
              title="tx-received"
            />
          </button>
          <div
            class="sc-ccSCjj ceyGJc"
            title="Show Other Screens"
          >
            <span
              class="sc-jKmXuR eUwhtz"
            />
            <div
              class="sc-elNKlv hDTtNH"
              title="Other Screens"
            >
              <button
                class="sc-bYwvMP bwHDjw"
              >
                 
                <p>
                  Wallet Backup
                </p>
                <svg
                  title="wallet"
                />
              </button>
              <button
                class="sc-bYwvMP bwHDjw"
              >
                 
                <p>
                  Wallets
                </p>
                <svg
                  title="wallets"
                />
              </button>
              <button
                class="sc-bYwvMP bwHDjw"
              >
                 
                <p>
                  Contacts
                </p>
                <svg
                  title="Contact List"
                />
              </button>
              <button
                class="sc-bYwvMP bwHDjw"
              >
                 
                <p>
                  Airdrop
                </p>
                <svg
                  title="tx-airdrop"
                />
              </button>
              <button
                class="sc-bYwvMP bwHDjw"
              >
                 
                <p>
                  Swap
                </p>
                <svg
                  title="swap"
                />
              </button>
              <button
                class="sc-bYwvMP bwHDjw"
              >
                <p>
                  Sign & Verify
                </p>
                <svg
                  class="sc-htpNat bPFBeM"
                />
              </button>
              <button
                class="sc-bYwvMP bwHDjw"
              >
                <p>
                  Settings
                </p>
                <svg
                  title="settings"
                />
              </button>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</body>
    at Object.getElementError (/work/cashtab/node_modules/@testing-library/dom/dist/config.js:37:19)
    at /work/cashtab/node_modules/@testing-library/dom/dist/query-helpers.js:76:38
    at /work/cashtab/node_modules/@testing-library/dom/dist/query-helpers.js:52:17
    at /work/cashtab/node_modules/@testing-library/dom/dist/query-helpers.js:95:19
    at Object.getByTitle (/work/cashtab/src/components/Etokens/__tests__/TokenActions.test.js:155:23)

Each failure log is accessible here:
CashTab Unit Tests: <TokenActions /> SLP1 fixed supply token

This revision is now accepted and ready to land.Apr 17 2024, 13:13