Page MenuHomePhabricator

[cashtab] Support agora txs for ALP tokens
ClosedPublic

Authored by bytesofman on Tue, Nov 26, 19:19.

Details

Reviewers
emack
Group Reviewers
Restricted Project
Commits
rABC4153a32c0037: [cashtab] Support agora txs for ALP tokens
Summary

Support listing ALP tokens on Agora

Note that buys and cancels work, as these functions are just using already-tested library methods that use AgoraOffer as an input param (so, adjust "automagically" for ALP vs SLP).

The only different tx type is the listing tx. We add and test a new helper function for creating these target outputs.

Agora list txs need special parsing vs SLP list txs. Add that too.

Test Plan

npm test

This diff is deployed at https://cashtab-local-dev.netlify.app/

Diff Detail

Repository
rABC Bitcoin ABC
Branch
alp-agora
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 31333
Build 62164: Build Diffcashtab-tests
Build 62163: arc lint + arc unit

Event Timeline

Tail of the build log:

To address all issues, run:
  npm audit fix

Run `npm audit` for details.

> ecash-lib@1.0.0 build
> tsc && tsc -p ./tsconfig.build.json && cp -r ./src/ffi ./dist

Installing ecash-agora dependencies...
/work/modules/ecash-agora /work/modules/ecash-lib /work/modules/ecash-lib-wasm /work/modules/ecash-script /work/modules/chronik-client /work/modules/mock-chronik-client /work/modules/ecashaddrjs /work/abc-ci-builds/cashtab-tests

added 364 packages, and audited 367 packages in 2s

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

2 vulnerabilities (1 moderate, 1 high)

To address all issues, run:
  npm audit fix

Run `npm audit` for details.

> ecash-agora@0.1.1 build
> tsc && tsc -p ./tsconfig.build.json

/work/cashtab /work/modules/ecash-agora /work/modules/ecash-lib /work/modules/ecash-lib-wasm /work/modules/ecash-script /work/modules/chronik-client /work/modules/mock-chronik-client /work/modules/ecashaddrjs /work/abc-ci-builds/cashtab-tests
npm warn deprecated @humanwhocodes/config-array@0.11.14: Use @eslint/config-array instead
npm warn deprecated @humanwhocodes/object-schema@2.0.3: Use @eslint/object-schema instead
npm warn deprecated eslint@8.56.0: This version is no longer supported. Please see https://eslint.org/version-support for other options.

added 1487 packages, and audited 3333 packages in 25s

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

4 vulnerabilities (2 moderate, 2 high)

To address all issues, run:
  npm audit fix

Run `npm audit` for details.

> cashtab@2.56.0 build
> node scripts/build.js

Creating an optimized production build...

Treating warnings as errors because process.env.CI = true.
Most CI servers set it automatically.

Failed to compile.

[eslint] 
src/token-protocols/alp/index.ts
  Line 14:5:  'toHex' is defined but never used  @typescript-eslint/no-unused-vars


Build cashtab-tests failed with exit code 1

Add test for ALP listing, change types and var names specific to SLP that now could cover ALP

Tail of the build log:

To address all issues, run:
  npm audit fix

Run `npm audit` for details.

> ecash-lib@1.0.0 build
> tsc && tsc -p ./tsconfig.build.json && cp -r ./src/ffi ./dist

Installing ecash-agora dependencies...
/work/modules/ecash-agora /work/modules/ecash-lib /work/modules/ecash-lib-wasm /work/modules/ecash-script /work/modules/chronik-client /work/modules/mock-chronik-client /work/modules/ecashaddrjs /work/abc-ci-builds/cashtab-tests

added 364 packages, and audited 367 packages in 1s

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

2 vulnerabilities (1 moderate, 1 high)

To address all issues, run:
  npm audit fix

Run `npm audit` for details.

> ecash-agora@0.1.1 build
> tsc && tsc -p ./tsconfig.build.json

/work/cashtab /work/modules/ecash-agora /work/modules/ecash-lib /work/modules/ecash-lib-wasm /work/modules/ecash-script /work/modules/chronik-client /work/modules/mock-chronik-client /work/modules/ecashaddrjs /work/abc-ci-builds/cashtab-tests
npm warn deprecated @humanwhocodes/config-array@0.11.14: Use @eslint/config-array instead
npm warn deprecated @humanwhocodes/object-schema@2.0.3: Use @eslint/object-schema instead
npm warn deprecated eslint@8.56.0: This version is no longer supported. Please see https://eslint.org/version-support for other options.

added 1487 packages, and audited 3333 packages in 24s

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

4 vulnerabilities (2 moderate, 2 high)

To address all issues, run:
  npm audit fix

Run `npm audit` for details.

> cashtab@2.56.0 build
> node scripts/build.js

Creating an optimized production build...

Treating warnings as errors because process.env.CI = true.
Most CI servers set it automatically.

Failed to compile.

[eslint] 
src/token-protocols/alp/index.ts
  Line 14:5:  'toHex' is defined but never used  @typescript-eslint/no-unused-vars


Build cashtab-tests failed with exit code 1

remove debug log, adjust another slp-specific name that should be more generic

Tail of the build log:

To address all issues, run:
  npm audit fix

Run `npm audit` for details.

> ecash-lib@1.0.0 build
> tsc && tsc -p ./tsconfig.build.json && cp -r ./src/ffi ./dist

Installing ecash-agora dependencies...
/work/modules/ecash-agora /work/modules/ecash-lib /work/modules/ecash-lib-wasm /work/modules/ecash-script /work/modules/chronik-client /work/modules/mock-chronik-client /work/modules/ecashaddrjs /work/abc-ci-builds/cashtab-tests

added 364 packages, and audited 367 packages in 1s

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

2 vulnerabilities (1 moderate, 1 high)

To address all issues, run:
  npm audit fix

Run `npm audit` for details.

> ecash-agora@0.1.1 build
> tsc && tsc -p ./tsconfig.build.json

/work/cashtab /work/modules/ecash-agora /work/modules/ecash-lib /work/modules/ecash-lib-wasm /work/modules/ecash-script /work/modules/chronik-client /work/modules/mock-chronik-client /work/modules/ecashaddrjs /work/abc-ci-builds/cashtab-tests
npm warn deprecated @humanwhocodes/config-array@0.11.14: Use @eslint/config-array instead
npm warn deprecated @humanwhocodes/object-schema@2.0.3: Use @eslint/object-schema instead
npm warn deprecated eslint@8.56.0: This version is no longer supported. Please see https://eslint.org/version-support for other options.

added 1487 packages, and audited 3333 packages in 24s

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

4 vulnerabilities (2 moderate, 2 high)

To address all issues, run:
  npm audit fix

Run `npm audit` for details.

> cashtab@2.56.0 build
> node scripts/build.js

Creating an optimized production build...

Treating warnings as errors because process.env.CI = true.
Most CI servers set it automatically.

Failed to compile.

[eslint] 
src/token-protocols/alp/index.ts
  Line 14:5:  'toHex' is defined but never used  @typescript-eslint/no-unused-vars


Build cashtab-tests failed with exit code 1
emack requested changes to this revision.Wed, Nov 27, 11:00
emack added a subscriber: emack.
emack added inline comments.
cashtab/src/components/Etokens/Token/index.tsx
1643–1655

This logic is duplicated across two other areas already /Collection/index.tsx and /OrderBook/index.tsx. Should be in its own util function with two simple unit tests.

This revision now requires changes to proceed.Wed, Nov 27, 11:00
bytesofman marked an inline comment as done.
bytesofman added inline comments.
cashtab/src/components/Etokens/Token/index.tsx
1643–1655

yes, this will be in its own diff

the recent wallet migration with sk and pk ready for ecash-lib was addressing a similar issue.

It's true I keep kicking the can on this. But it's already repeated in like ... 6 places. One more can be tolerated.

The issue is that I am still thinking of the best way to handle it. We're getting close to the point where CashtabWallet should just be its own class, where fee could just be a property, or getFee() could be a method.

For now, SLP fungible and NFT list/buy/cancel functions all have this repeated. so we're just using the existing (lazy but tested and effective) pattern.

This revision is now accepted and ready to land.Thu, Nov 28, 02:35
This revision was automatically updated to reflect the committed changes.
bytesofman marked an inline comment as done.