Page MenuHomePhabricator

[Cashtab] Add quick select buttons for agora offer buy qty and do not render unbuyable offers
ClosedPublic

Authored by bytesofman on Jul 8 2025, 22:53.

Details

Summary

Working on creating a more exchange-like UX for agora. Incremental improvement here.

  • Often, the spot price offer is not buyable. This happens for example on FIRMA where the lowest offer could have a min buy of $98. So a user without $98 will see this as unbuyable, and may think no offers are buyable.

-> So, we hide such offers from such users.

  • We add 25% / 50% / 75% / max buttons to quick select a buy amount for available offers. In a real exchange, this would always be relative to the user's stack, and it would accept (maybe) multiple candles. We can get there, but I think we need better ecash-wallet logic to handle that properly. For now, apply these to a single candle. If the user can afford the whole offer, then the %s apply to that offer. If the user cannot afford the whole offer, then the %s apply to the user's balance of XEC.

Note that we DO NOT (yet) account for tx fees in these calculations. This is pretty complex and, if it proves necessary (perhaps the token qty quanta requirements make fee errors rare) -- we will add it, but should be in its own diff.

Test Plan

npm test, this is deployed to cashtab.io, try checking out FIRMA and XECX pages for regular offers with wallets of different balance

Diff Detail

Repository
rABC Bitcoin ABC
Branch
agora-better-features
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 33807
Build 67092: Build Diffcashtab-tests
Build 67091: arc lint + arc unit

Event Timeline

Failed tests logs:

====== CashTab Unit Tests: <Agora /> We can see multiple offers, some we made, others we did not, and we can cancel an offer ======
Error: Unable to find role="button" and name "Buy BULL"

Ignored nodes: comments, script, style
<body>
  <div>
    <div
      class="sc-epGmkI gEcelO"
    >
      <section
        aria-atomic="false"
        aria-label="Notifications Alt+T"
        aria-live="polite"
        aria-relevant="additions text"
        class="Toastify"
      />
      <div
        class="sc-dphlzf kWTBLl"
      >
        <div
          class="sc-fCPvlr jjqlGS"
        >
          <div
            class="sc-cmIlrE erdidG"
            title="Wallet Info"
          >
            <div
              class="sc-gleUXh eqThuU"
            >
              <img
                alt="cashtab"
                src="test-file-stub"
              />
              <div
                class="sc-bNQFlB iWAswN"
                title="Price in Local Currency mobile"
              >
                1 
                XEC
                 = 
                0.00003000
                 
                USD
              </div>
            </div>
            <div
              class="sc-doWzTn cwxplc"
            >
              <div
                class="sc-dBaXSw YgqsB"
                title="Price in Local Currency"
              >
                1 
                XEC
                 = 
                0.00003000
                 
                USD
              </div>
              <div
                class="sc-dRCTWM fkOZJx"
              >
                <label
                  class="sc-dPNhBE bHLtba"
                >
                  <input
                    checked=""
                    class="sc-kkwfeq bizqnG"
                    type="checkbox"
                  />
                  <div
                    class="sc-izvnbC cWRmnN"
                  >
                    <img
                      alt="toggle icon"
                      src="test-file-stub"
                    />
                  </div>
                </label>
                <button
                  aria-label="Copy ecash:qreq3mm4avxaw782g4qvhktx4qcv0w2tkqj3j5jaad"
                  class="sc-dNLxif cAFGSA"
                >
                  <svg
                    title="copy-paste"
                  />
                </button>
                <select
                  class="sc-cgHJcJ hQnlum"
                  data-testid="wallet-select"
                  id="wallets"
                  name="wallets"
                >
                  <option
                    class="sc-hizQCF bqpbnS"
                    value="Agora Partial Beta"
                  >
                    Agora Partial Beta
                  </option>
                  <option
                    class="sc-hizQCF bqpbnS"
                    value="Agora Partial Alpha"
                  >
                    Agora Partial Alpha
                  </option>
                </select>
              </div>
            </div>
            <div
              class="sc-hARARD eVwYut"
            >
              <div
                class="sc-ccLTTT bPnMjq"
              >
                <div
                  class="sc-hlILIN ldlUir"
                >
                  <img
                    alt="eCash"
                    class="sc-jQMNup kNOJiJ"
                    src="test-file-stub"
                  />
                  <div
                    class="sc-bJHhxl hcFRXF"
                  >
                    eCash
                  </div>
                  <div
                    class="sc-TuwoP gKAyt"
                    title="Balance XEC"
                  >
                    390.16
                     
                    XEC
                  </div>
                  <div
                    class="sc-fQkuQJ idpvOV"
                    title="Balance XEC Fiat"
                  >
                    $
                    0.01
                     
                    USD
                  </div>
                </div>
                <div
                  class="sc-hlILIN cHZcbF"
                >
                  <img
                    alt="eCash Staking"
                    class="sc-jQMNup kNOJiJ"
                    src="test-file-stub"
                  />
                  <div
                    class="sc-bJHhxl hjJCEK"
                  >
                    Staking
                  </div>
                  <div
                    class="sc-TuwoP eUItcw"
                    title="Balance XECX"
                  >
                    0.00
                     
                    <a
                      href="#/token/c67bf5c2b6d91cfb46a5c1772582eff80d88686887be10aa63b0945479cf4ed4"
                    >
                      XECX
                    </a>
                  </div>
                  <div
                    class="sc-fQkuQJ idpvOV"
                    title="Balance XECX Fiat"
                  >
                    ...
    at waitForWrapper (/work/cashtab/node_modules/@testing-library/dom/dist/wait-for.js:163:27)
    at /work/cashtab/node_modules/@testing-library/dom/dist/query-helpers.js:86:33
    at Object.findByRole (/work/cashtab/src/components/Agora/__tests__/index.test.tsx:1046:26)
====== CashTab Unit Tests: <Agora /> We get expected error if we try to buy an offer we cannot afford ======
Error: Unable to find an element with the text: (content, _element) => content.includes('Cachet'). This could be because the text is broken up by multiple elements. In this case, you can provide a function for your text matcher to make your matcher more flexible.

Ignored nodes: comments, script, style
<body>
  <div>
    <div
      class="sc-epGmkI gEcelO"
    >
      <section
        aria-atomic="false"
        aria-label="Notifications Alt+T"
        aria-live="polite"
        aria-relevant="additions text"
        class="Toastify"
      />
      <div
        class="sc-dphlzf kWTBLl"
      >
        <div
          class="sc-fCPvlr jjqlGS"
        >
          <div
            class="sc-cmIlrE erdidG"
            title="Wallet Info"
          >
            <div
              class="sc-gleUXh eqThuU"
            >
              <img
                alt="cashtab"
                src="test-file-stub"
              />
              <div
                class="sc-bNQFlB iWAswN"
                title="Price in Local Currency mobile"
              >
                1 
                XEC
                 = 
                0.00003000
                 
                USD
              </div>
            </div>
            <div
              class="sc-doWzTn cwxplc"
            >
              <div
                class="sc-dBaXSw YgqsB"
                title="Price in Local Currency"
              >
                1 
                XEC
                 = 
                0.00003000
                 
                USD
              </div>
              <div
                class="sc-dRCTWM fkOZJx"
              >
                <label
                  class="sc-iLVFha lcySES"
                >
                  <input
                    checked=""
                    class="sc-cgzHhG cruPSs"
                    type="checkbox"
                  />
                  <div
                    class="sc-jtHxuu fZmJVb"
                  >
                    <img
                      alt="toggle icon"
                      src="test-file-stub"
                    />
                  </div>
                </label>
                <button
                  aria-label="Copy ecash:qqpmsv8yh8wwx3lnf92rrc0e6yq97j6zqs8av8vx8h"
                  class="sc-dNLxif cAFGSA"
                >
                  <svg
                    title="copy-paste"
                  />
                </button>
                <select
                  class="sc-cgHJcJ hQnlum"
                  data-testid="wallet-select"
                  id="wallets"
                  name="wallets"
                >
                  <option
                    class="sc-hizQCF bqpbnS"
                    value="Agora Partial Alpha"
                  >
                    Agora Partial Alpha
                  </option>
                  <option
                    class="sc-hizQCF bqpbnS"
                    value="Agora Partial Beta"
                  >
                    Agora Partial Beta
                  </option>
                </select>
              </div>
            </div>
            <div
              class="sc-hARARD eVwYut"
            >
              <div
                class="sc-ccLTTT bPnMjq"
              >
                <div
                  class="sc-hlILIN ldlUir"
                >
                  <img
                    alt="eCash"
                    class="sc-jQMNup kNOJiJ"
                    src="test-file-stub"
                  />
                  <div
                    class="sc-bJHhxl hcFRXF"
                  >
                    eCash
                  </div>
                  <div
                    class="sc-TuwoP gKAyt"
                    title="Balance XEC"
                  >
                    0.00
                     
                    XEC
                  </div>
                  <div
                    class="sc-fQkuQJ idpvOV"
                    title="Balance XEC Fiat"
                  >
                    $
                    0.00
                     
                    USD
                  </div>
                </div>
                <div
                  class="sc-hlILIN cHZcbF"
                >
                  <img
                    alt="eCash Staking"
                    class="sc-jQMNup kNOJiJ"
                    src="test-file-stub"
                  />
                  <div
                    class="sc-bJHhxl hjJCEK"
                  >
                    Staking
                  </div>
                  <div
                    class="sc-TuwoP eUItcw"
                    title="Balance XECX"
                  >
                    0.00
                     
                    <a
                      href="#/token/c67bf5c2b6d91cfb46a5c1772582eff80d88686887be10aa63b0945479cf4ed4"
                    >
                      XECX
                    </a>
                  </div>
                  <div
                    class="sc-fQkuQJ idpvOV"
                    title="Balance XECX Fiat"
                  >
                    $
                    0.00
                     
                    USD
                  </div>
                </div>
                <div
                  class="sc-hlILIN jZIzbe"
                >
                  <img
                    alt="Savings"
                    class="sc-jQMNup kNOJiJ"
                    src="test-file-stub"
                  />
                  <div
                    class="sc-bJHhxl eawrlD"
                  >
                    Savings
                  </div>
                  <div
                    class="sc-TuwoP bZHsqc"
                    title="Balance FIRMA"
                  >
                    0.0000
                     
                    <a
                      href="#/token/0387947fd575db4fb19a3e322f635dec37fd192b5941625b66bc4b2c3008cbf0"
                    >
                      FIRMA
                    </a>
                  </div>
                  <div
                    class="sc-fQkuQJ idpvOV"
                    title="Balance FIRMA Fiat"
                  >
                    $
                    0.00
                     
                    USD
                  </div>
                </div>
              </div>
            </div>
          </div>
          <div
            class="sc-bvTASY cPgImB"
          >
            <div
              class="sc-iBmynh blrvCq"
            >
              <h2>
                Token Offers
              </h2>
              <div>
                Sort by:
                <div
                  class="sc-jvEmr fvolFl"
                  title="Sort by TokenId"
                >
                  TokenID
                </div>
                <div
                  class="sc-jvEmr kQCwPb"
                  disabled=""
                  title="Sort by Offer Count"
                >
                  Offers
                  <div>
                    <div
                      class="sc-jzJRlG eQTBdJ"
                      title="Loading OrderBook info..."
                    >
                      <div />
                      <div />
                      <div />
                      <div />
                    </div>
                  </div>
                </div>
                <span
                  class="sc-fKGOjr jxXtZY"
                  title="Toggle Active Offers"
                >
                  My Listings
                </span>
              </div>
            </div>
            <div
              class="sc-keFjpB hMeyhD"
              title="Active Offers"
            >
              <div
                class="sc-kVrTmx bTaxlq"
              >
                <div
                  class="sc-cEvuZC cVlZVQ"
                >
                  <div
                    class="sc-kXeGPI iGSNth"
                  >
                    <button
                      aria-label="View larger icon for Bull"
                      class="sc-eIHaNI gaCbJG"
                      size="64"
                      title="01d63c4f4cb496829a6743f7b1805d086ea3877a1dd34b3f92ffba2c9c99f896"
                    />
                    <div
                      class="sc-ugnQR dgcpte"
                    >
                      <a
                        href="#/token/01d63c4f4cb496829a6743f7b1805d086ea3877a1dd34b3f92ffba2c9c99f896"
                      >
                        Bull
                      </a>
                      <span>
                        BULL
                      </span>
                      <div
                        class="sc-btzYZH gFFXpf"
                      >
                        01d
                        ...
                        896
                        <button
                          aria-label="Copy Token ID"
                          class="sc-dNLxif eXaqhu"
                        >
                          <svg
                            title="copy-paste"
                          />
                        </button>
                      </div>
                    </div>
                    <div
                      class="sc-fyjhYU fASKoZ"
                    >
                      <div>
                        1
                         Offer
                      </div>
                      <div
                        class="sc-emmjRN fIvjCD"
                      >
                        <div
                          class="sc-cpmLhU eZgTGK"
                        >
                          <input
                            class="sc-fhYwyz jqalqV"
                            id="Toggle price for 01d63c4f4cb496829a6743f7b1805d086ea3877a1dd34b3f92ffba2c9c99f896"
                            name="Toggle price for 01d63c4f4cb496829a6743f7b1805d086ea3877a1dd34b3f92ffba2c9c99f896"
                            title="Toggle price for 01d63c4f4cb496829a6743f7b1805d086ea3877a1dd34b3f92ffba2c9c99f896"
                            type="checkbox"
                          />
                          <label
                            class="sc-dymIpo naeFY"
                            for="Toggle price for 01d63c4f4cb496829a6743f7b1805d086ea3877a1dd34b3f92ffba2c9c99f896"
                          >
                            <span
                              class="sc-bnXvFD knuOql"
                              data-off="XEC"
                              data-on="usd"
                            />
                            <span
                              class="sc-gFaPwZ gJfkuM"
                            />
                          </label>
                        </div>
                      </div>
                    </div>
                  </div>
                  <div
                    class="sc-eTpRJs kNhBrF"
                  >
                    <div
                      class="sc-dxZgTM lkaufQ"
                    >
                      <button
                        class="sc-iomxrj hBsBZH"
                        data-tooltip-content="888 BULL (888 total)"
                        data-tooltip-id="cashtab-tooltip"
                      >
                        <div
                          class="sc-iFMziU fmWvnF"
                        />
                        <div
                          class="sc-keVrkP cMNAYz"
                        />
                        <div
                          class="sc-dvCyap dXekpn"
                        >
                          50,000.72 XEC
                        </div>
                      </button>
                    </div>
                    <div
                      class="sc-bFADNz bjZiWF"
                    >
                      <div
                        class="sc-cqpYsc inQEbV"
                      >
                        <div
                          class="sc-kfGgVZ cEztvs"
                        >
                          <input
                            aria-labelledby="Select buy qty 01d63c4f4cb496829a6743f7b1805d086ea3877a1dd34b3f92ffba2c9c99f896"
                            class="sc-cLQEGU bPmRCh"
                            max="888"
                            min="8"
                            name="Select buy qty 01d63c4f4cb496829a6743f7b1805d086ea3877a1dd34b3f92ffba2c9c99f896"
                            step="1"
                            type="range"
                            value="8"
                          />
                          <div
                            class="sc-bMVAic esQArc"
                          >
                            <input
                              class="sc-gqPbQI jPBRIf"
                              name="Select buy qty 01d63c4f4cb496829a6743f7b1805d086ea3877a1dd34b3f92ffba2c9c99f896-typed"
                              placeholder="Select buy qty 01d63c4f4cb496829a6743f7b1805d086ea3877a1dd34b3f92ffba2c9c99f896"
                              type="number"
                              value="8"
                            />
                          </div>
                          <div
                            class="sc-iQNlJl dyZQpl"
                          >
                            Buy price (400.42k XEC) exceeds available balance (0.00 XEC).
                          </div>
                        </div>
                      </div>
                    </div>
                    <div
                      class="sc-gVLVqr kqrrrm"
                    >
                      <div>
                        8
                         
                        BULL
                      </div>
                      <h3>
                        400.42k
                         
                        XEC
                      </h3>
                      <button
                        class="sc-ksYbfQ sc-hqyNC fYTjZk"
                      >
                        Cancel your offer
                      </button>
                    </div>
                  </div>
                </div>
                <div
                  class="sc-cIShpX hkSros"
                >
                  No active offers for this token
                </div>
              </div>
            </div>
          </div>
        </div>
        <div
          class="sc-gAmQfK cVeZjp"
        >
          <div
            class="sc-sPYgB iJRnzM"
          >
            <img
              alt="cashtab"
              class="sc-gJqsIT dsezft"
              src="test-file-stub"
            />
          </div>
          <button
            class="sc-kAdXeD cdydlx"
          >
            <span>
              Transactions
            </span>
            <svg />
          </button>
          <button
            aria-label="Send Screen"
            class="sc-kAdXeD cdydlx"
          >
            <span>
              Send
            </span>
            <svg
              title="tx-sent"
            />
          </button>
          <button
            aria-label="Tokens"
            class="sc-kAdXeD cdydlx"
          >
            <span>
              Tokens
            </span>
            <svg
              title="Tokens"
            />
          </button>
          <button
            aria-label="Receive"
            class="sc-kAdXeD cdydlx"
          >
            <span>
              Receive
            </span>
            <svg
              title="tx-received"
            />
          </button>
          <div
            class="sc-hAXbOi gcQJRd nav-menu-container"
            title="Show Other Screens"
          >
            <span
              class="sc-cCVOAp cixQLW"
            />
            <div
              class="sc-cfWELz ibKTHp"
              title="Other Screens"
            >
              <button
                class="sc-hCaUpS jGbmUe"
              >
                 
                <p>
                  Wallet Backup
                </p>
                <svg
                  title="wallet"
                />
              </button>
              <button
                class="sc-hCaUpS jGbmUe"
              >
                 
                <p>
                  Wallets
                </p>
                <svg
                  title="wallets"
                />
              </button>
              <button
                class="sc-hCaUpS jGbmUe"
              >
                 
                <p>
                  Listed NFTs
                </p>
                <svg
                  title="NFT"
                />
              </button>
              <button
                class="sc-hCaUpS jGbmUe"
              >
                 
                <p>
                  Agora
                </p>
                <svg
                  title="Meme Agora"
                />
              </button>
              <button
                class="sc-hCaUpS jGbmUe"
              >
                 
                <p>
                  Contacts
                </p>
                <svg
                  title="Contact List"
                />
              </button>
              <button
                class="sc-hCaUpS jGbmUe"
              >
                 
                <p>
                  Airdrop
                </p>
                <svg
                  title="tx-airdrop"
                />
              </button>
              <button
                class="sc-hCaUpS jGbmUe"
              >
                 
                <p>
                  Rewards
                </p>
                <svg
                  title="Cashtab Rewards"
                />
              </button>
              <button
                class="sc-hCaUpS jGbmUe"
              >
                <p>
                  Sign & Verify
                </p>
                <svg
                  class="sc-htpNat bPFBeM"
                />
              </button>
              <button
                class="sc-hCaUpS jGbmUe"
              >
                <p>
                  Settings
                </p>
                <svg
                  title="settings"
                />
              </button>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</body>
    at waitForWrapper (/work/cashtab/node_modules/@testing-library/dom/dist/wait-for.js:163:27)
    at /work/cashtab/node_modules/@testing-library/dom/dist/query-helpers.js:86:33
    at Object.findAllByText (/work/cashtab/src/components/Agora/__tests__/index.test.tsx:1303:30)
    at runNextTicks (node:internal/process/task_queues:60:5)
    at listOnTimeout (node:internal/timers:545:9)
    at processTimers (node:internal/timers:519:7)
====== CashTab Unit Tests: <Token /> available actions rendered The FIRMA OrderBook loads with price in USD ======
Error: Unable to find an element with the title: Toggle price for 0387947fd575db4fb19a3e322f635dec37fd192b5941625b66bc4b2c3008cbf0.

Ignored nodes: comments, script, style
<body>
  <div>
    <div
      class="sc-epGmkI gEcelO"
    >
      <section
        aria-atomic="false"
        aria-label="Notifications Alt+T"
        aria-live="polite"
        aria-relevant="additions text"
        class="Toastify"
      />
      <div
        class="sc-dphlzf kWTBLl"
      >
        <div
          class="sc-fCPvlr jjqlGS"
        >
          <div
            class="sc-cmIlrE erdidG"
            title="Wallet Info"
          >
            <div
              class="sc-gleUXh eqThuU"
            >
              <img
                alt="cashtab"
                src="test-file-stub"
              />
              <div
                class="sc-bNQFlB iWAswN"
                title="Price in Local Currency mobile"
              >
                1 
                XEC
                 = 
                0.00003000
                 
                USD
              </div>
            </div>
            <div
              class="sc-doWzTn cwxplc"
            >
              <div
                class="sc-dBaXSw YgqsB"
                title="Price in Local Currency"
              >
                1 
                XEC
                 = 
                0.00003000
                 
                USD
              </div>
              <div
                class="sc-dRCTWM fkOZJx"
              >
                <label
                  class="sc-ePDpFu jgdYXE"
                >
                  <input
                    checked=""
                    class="sc-ijhsb cQIRtQ"
                    type="checkbox"
                  />
                  <div
                    class="sc-gohEOc gZWYAn"
                  >
                    <img
                      alt="toggle icon"
                      src="test-file-stub"
                    />
                  </div>
                </label>
                <button
                  aria-label="Copy ecash:qqq9f9z3uhpzkxrgdjkd7dxuuey7tmpmugpmnw0kue"
                  class="sc-dNLxif cAFGSA"
                >
                  <svg
                    title="copy-paste"
                  />
                </button>
                <select
                  class="sc-cgHJcJ hQnlum"
                  data-testid="wallet-select"
                  id="wallets"
                  name="wallets"
                >
                  <option
                    class="sc-hizQCF bqpbnS"
                    value="Token Test"
                  >
                    Token Test
                  </option>
                </select>
              </div>
            </div>
            <div
              class="sc-hARARD eVwYut"
            >
              <div
                class="sc-ccLTTT bPnMjq"
              >
                <div
                  class="sc-hlILIN ldlUir"
                >
                  <img
                    alt="eCash"
                    class="sc-jQMNup kNOJiJ"
                    src="test-file-stub"
                  />
                  <div
                    class="sc-bJHhxl hcFRXF"
                  >
                    eCash
                  </div>
                  <div
                    class="sc-TuwoP gKAyt"
                    title="Balance XEC"
                  >
                    9,970.81
                     
                    XEC
                  </div>
                  <div
                    class="sc-fQkuQJ idpvOV"
                    title="Balance XEC Fiat"
                  >
                    $
                    0.30
                     
                    USD
                  </div>
                </div>
                <div
                  class="sc-hlILIN cHZcbF"
                >
                  <img
                    alt="eCash Staking"
                    class="sc-jQMNup kNOJiJ"
                    src="test-file-stub"
                  />
                  <div
                    class="sc-bJHhxl hjJCEK"
                  >
                    Staking
                  </div>
                  <div
                    class="sc-TuwoP eUItcw"
                    title="Balance XECX"
                  >
                    10,000.00
                     
                    <a
                      href="#/token/c67bf5c2b6d91cfb46a5c1772582eff80d88686887be10aa63b0945479cf4ed4"
                    >
                      XECX
                    </a>
                  </div>
                  <div
                    class="sc-fQkuQJ idpvOV"
                    title="Balance XECX Fiat"
                  >
                    $
                    0.30
                     
                    USD
                  </div>
                </div>
                <div
                  class="sc-hlILIN jZIzbe"
                >
   ...
    at waitForWrapper (/work/cashtab/node_modules/@testing-library/dom/dist/wait-for.js:163:27)
    at /work/cashtab/node_modules/@testing-library/dom/dist/query-helpers.js:86:33
    at Object.findByTitle (/work/cashtab/src/components/Etokens/__tests__/TokenActions.test.js:2654:42)

Each failure log is accessible here:
CashTab Unit Tests: <Agora /> We can see multiple offers, some we made, others we did not, and we can cancel an offer
CashTab Unit Tests: <Agora /> We get expected error if we try to buy an offer we cannot afford
CashTab Unit Tests: <Token /> available actions rendered The FIRMA OrderBook loads with price in USD

remove tests that use now-unbuyable offers, use a bigger wallet to keep another test

Tail of the build log:

> ecashaddrjs@2.0.0 build
> tsc


added 480 packages, and audited 481 packages in 4s

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

8 vulnerabilities (1 low, 6 moderate, 1 high)

To address all issues, run:
  npm audit fix

Run `npm audit` for details.

> ecashaddrjs@2.0.0 build
> tsc

/work/modules/ecashaddrjs /work/abc-ci-builds/cashtab-tests

> ecashaddrjs@2.0.0 prepublish
> npm run build


> ecashaddrjs@2.0.0 build
> tsc


added 480 packages, and audited 481 packages in 3s

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

8 vulnerabilities (1 low, 6 moderate, 1 high)

To address all issues, run:
  npm audit fix

Run `npm audit` for details.

> ecashaddrjs@2.0.0 build
> tsc

/work/modules/chronik-client /work/abc-ci-builds/cashtab-tests
npm warn deprecated @humanwhocodes/config-array@0.13.0: Use @eslint/config-array instead
npm warn deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
npm warn deprecated @humanwhocodes/object-schema@2.0.3: Use @eslint/object-schema instead
npm warn deprecated eslint@8.57.1: This version is no longer supported. Please see https://eslint.org/version-support for other options.
npm error code ECONNRESET
npm error syscall read
npm error errno -104
npm error network read ECONNRESET
npm error network This is a problem related to network connectivity.
npm error network In most cases you are behind a proxy or have bad network settings.
npm error network
npm error network If you are behind a proxy, please make sure that the
npm error network 'proxy' config is set properly.  See: 'npm help config'
npm error A complete log of this run can be found in: /root/.npm/_logs/2025-07-08T23_25_55_564Z-debug-0.log
Build cashtab-tests failed with exit code 152

Failed tests logs:

====== CashTab Unit Tests: <Agora /> We can see multiple offers, some we made, others we did not, and we can cancel an offer ======
Error: Unable to find role="button" and name "Buy BULL"

Ignored nodes: comments, script, style
<body>
  <div>
    <div
      class="sc-epGmkI gEcelO"
    >
      <section
        aria-atomic="false"
        aria-label="Notifications Alt+T"
        aria-live="polite"
        aria-relevant="additions text"
        class="Toastify"
      />
      <div
        class="sc-dphlzf kWTBLl"
      >
        <div
          class="sc-fCPvlr jjqlGS"
        >
          <div
            class="sc-cmIlrE erdidG"
            title="Wallet Info"
          >
            <div
              class="sc-gleUXh eqThuU"
            >
              <img
                alt="cashtab"
                src="test-file-stub"
              />
              <div
                class="sc-bNQFlB iWAswN"
                title="Price in Local Currency mobile"
              >
                1 
                XEC
                 = 
                0.00003000
                 
                USD
              </div>
            </div>
            <div
              class="sc-doWzTn cwxplc"
            >
              <div
                class="sc-dBaXSw YgqsB"
                title="Price in Local Currency"
              >
                1 
                XEC
                 = 
                0.00003000
                 
                USD
              </div>
              <div
                class="sc-dRCTWM fkOZJx"
              >
                <label
                  class="sc-dPNhBE bHLtba"
                >
                  <input
                    checked=""
                    class="sc-kkwfeq bizqnG"
                    type="checkbox"
                  />
                  <div
                    class="sc-izvnbC cWRmnN"
                  >
                    <img
                      alt="toggle icon"
                      src="test-file-stub"
                    />
                  </div>
                </label>
                <button
                  aria-label="Copy ecash:qreq3mm4avxaw782g4qvhktx4qcv0w2tkqj3j5jaad"
                  class="sc-dNLxif cAFGSA"
                >
                  <svg
                    title="copy-paste"
                  />
                </button>
                <select
                  class="sc-cgHJcJ hQnlum"
                  data-testid="wallet-select"
                  id="wallets"
                  name="wallets"
                >
                  <option
                    class="sc-hizQCF bqpbnS"
                    value="Agora Partial Beta"
                  >
                    Agora Partial Beta
                  </option>
                  <option
                    class="sc-hizQCF bqpbnS"
                    value="Agora Partial Alpha"
                  >
                    Agora Partial Alpha
                  </option>
                </select>
              </div>
            </div>
            <div
              class="sc-hARARD eVwYut"
            >
              <div
                class="sc-ccLTTT bPnMjq"
              >
                <div
                  class="sc-hlILIN ldlUir"
                >
                  <img
                    alt="eCash"
                    class="sc-jQMNup kNOJiJ"
                    src="test-file-stub"
                  />
                  <div
                    class="sc-bJHhxl hcFRXF"
                  >
                    eCash
                  </div>
                  <div
                    class="sc-TuwoP gKAyt"
                    title="Balance XEC"
                  >
                    100,000.00
                     
                    XEC
                  </div>
                  <div
                    class="sc-fQkuQJ idpvOV"
                    title="Balance XEC Fiat"
                  >
                    $
                    3.00
                     
                    USD
                  </div>
                </div>
                <div
                  class="sc-hlILIN cHZcbF"
                >
                  <img
                    alt="eCash Staking"
                    class="sc-jQMNup kNOJiJ"
                    src="test-file-stub"
                  />
                  <div
                    class="sc-bJHhxl hjJCEK"
                  >
                    Staking
                  </div>
                  <div
                    class="sc-TuwoP eUItcw"
                    title="Balance XECX"
                  >
                    0.00
                     
                    <a
                      href="#/token/c67bf5c2b6d91cfb46a5c1772582eff80d88686887be10aa63b0945479cf4ed4"
                    >
                      XECX
                    </a>
                  </div>
                  <div
                    class="sc-fQkuQJ idpvOV"
                    title="Balance XECX Fiat"
                  >
                   ...
    at waitForWrapper (/work/cashtab/node_modules/@testing-library/dom/dist/wait-for.js:163:27)
    at /work/cashtab/node_modules/@testing-library/dom/dist/query-helpers.js:86:33
    at Object.findByRole (/work/cashtab/src/components/Agora/__tests__/index.test.tsx:1047:26)

Each failure log is accessible here:
CashTab Unit Tests: <Agora /> We can see multiple offers, some we made, others we did not, and we can cancel an offer

we do not see an offer bc we cannot afford it

bytesofman published this revision for review.Jul 9 2025, 01:07
bytesofman added inline comments.
cashtab/src/components/Agora/OrderBook/index.tsx
702

this is a pretty sophisticated function that I would not have thought up but that cursor just sorta spat out

it seems to run ... surprisingly fast, I don't even notice it in the app

719–740

🤯

emack requested changes to this revision.Jul 9 2025, 04:57
emack added a subscriber: emack.

There's the unintended consequence where newly onboarded users with empty or low balance wallets will just see Agora with most if not all offers filtered out, giving the impression of a ghost town. IMO that's worse than the UX improvement.

I would suggest backing out the filtering for unbuyable offers and keep the quick buys in this diff, and reconsider how the filtering of offers should look to both high and low balance wallets.

image.png (1×1 px, 228 KB)

This revision now requires changes to proceed.Jul 9 2025, 04:57

instead of hiding unaffordable offers, visually indicate them and do not autoselect them

There's the unintended consequence where newly onboarded users with empty or low balance wallets will just see Agora with most if not all offers filtered out, giving the impression of a ghost town. IMO that's worse than the UX improvement.

I would suggest backing out the filtering for unbuyable offers and keep the quick buys in this diff, and reconsider how the filtering of offers should look to both high and low balance wallets.

image.png (1×1 px, 228 KB)

good point. some more iterations here

  • we do not hide offers for being unaffordable
  • instead, we highlight them separately
  • we do not auto-select such offers unless there are no affordable offers
  • when the offer is selected, instead of displaying the usual qty select UI, we display a msg explaining the offer is unaffordable

deployed again to cashtab.io

image.png (588×408 px, 36 KB)

This revision is now accepted and ready to land.Jul 9 2025, 12:26