Page MenuHomePhabricator

[ecash-agora] Add a helper function to prepare agora listings for ecash-wallet
ClosedPublic

Authored by bytesofman on Sep 23 2025, 21:41.

Details

Summary

Add new getAgoraPaymentAction function to ecash-agora, to prepare a payment.Action that ecash-wallet can use to broadcast a valid agora tx.

For now, we only support ALP AgoraPartial 'LIST' actions. But we add and test error handling for other actions, so that we have an easy way to extend functionality.

Looked at adding this kind of support directly into ecash-wallet, but I think this kind of approach is best for preserving the modularity / optionality of agora features while also allowing full agora support in ecash-wallet.

Test Plan

npm test, CI integration tests

Event Timeline

Tail of the build log:

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

7 vulnerabilities (1 low, 5 moderate, 1 high)

To address all issues, run:
  npm audit fix

Run `npm audit` for details.

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

/work/modules/ecash-agora /work/abc-ci-builds/cashtab-tests

added 273 packages, and audited 277 packages in 1s

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

7 vulnerabilities (1 low, 5 moderate, 1 high)

To address all issues, run:
  npm audit fix

Run `npm audit` for details.

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

../ecash-wallet/src/wallet.ts(43,8): error TS2307: Cannot find module 'ecash-lib' or its corresponding type declarations.
../ecash-wallet/src/wallet.ts(44,54): error TS2307: Cannot find module 'chronik-client' or its corresponding type declarations.
../ecash-wallet/src/wallet.ts(303,47): error TS7006: Parameter 'action' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(546,29): error TS7006: Parameter 'action' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(551,29): error TS7006: Parameter 'action' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(1274,10): error TS7006: Parameter 'output' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(1851,9): error TS7006: Parameter 'action' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(1946,40): error TS7006: Parameter 'output' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(1972,46): error TS7006: Parameter 'output' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(1985,9): error TS7006: Parameter 'action' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2006,9): error TS7006: Parameter 'output' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2031,13): error TS7006: Parameter 'output' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2074,9): error TS7006: Parameter 'action' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2078,10): error TS7006: Parameter 'o' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2101,21): error TS7006: Parameter 'action' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2102,18): error TS7006: Parameter 'action' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2106,10): error TS7006: Parameter 'output' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2140,21): error TS7006: Parameter 'action' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2141,18): error TS7006: Parameter 'action' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2147,21): error TS7006: Parameter 'action' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2148,18): error TS7006: Parameter 'action' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2157,17): error TS7006: Parameter 'o' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2162,18): error TS7006: Parameter 'o' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2261,17): error TS7006: Parameter 'output' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2265,22): error TS7006: Parameter 'output' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2266,26): error TS7006: Parameter 'prev' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2266,32): error TS7006: Parameter 'curr' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2284,29): error TS7006: Parameter 'burnAction' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2309,25): error TS2365: Operator '-' cannot be applied to types 'number' and 'bigint'.
Build cashtab-tests failed with exit code 2

Tail of the build log:

[584/596] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/transactiontablemodel.cpp.o
[585/596] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/transactiondesc.cpp.o
[586/596] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/signverifymessagedialog.cpp.o
[587/596] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/paymentrequestplus.cpp.o
[588/596] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/sendcoinsdialog.cpp.o
[589/596] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/walletcontroller.cpp.o
[590/596] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/walletview.cpp.o
[591/596] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/walletmodel.cpp.o
[592/596] Linking CXX static library src/qt/libbitcoin-qt-base.a
[593/596] Automatic MOC for target bitcoin-qt
[594/596] Building CXX object src/qt/CMakeFiles/bitcoin-qt.dir/bitcoin-qt_autogen/mocs_compilation.cpp.o
[595/596] Building CXX object src/qt/CMakeFiles/bitcoin-qt.dir/main.cpp.o
[596/596] Linking CXX executable src/qt/bitcoin-qt
/work/modules/ecash-agora /work/abc-ci-builds/ecash-agora-integration-tests

added 273 packages, and audited 277 packages in 1s

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

7 vulnerabilities (1 low, 5 moderate, 1 high)

To address all issues, run:
  npm audit fix

Run `npm audit` for details.

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

../ecash-wallet/src/wallet.ts(43,8): error TS2307: Cannot find module 'ecash-lib' or its corresponding type declarations.
../ecash-wallet/src/wallet.ts(44,54): error TS2307: Cannot find module 'chronik-client' or its corresponding type declarations.
../ecash-wallet/src/wallet.ts(303,47): error TS7006: Parameter 'action' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(546,29): error TS7006: Parameter 'action' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(551,29): error TS7006: Parameter 'action' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(1274,10): error TS7006: Parameter 'output' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(1851,9): error TS7006: Parameter 'action' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(1946,40): error TS7006: Parameter 'output' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(1972,46): error TS7006: Parameter 'output' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(1985,9): error TS7006: Parameter 'action' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2006,9): error TS7006: Parameter 'output' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2031,13): error TS7006: Parameter 'output' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2074,9): error TS7006: Parameter 'action' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2078,10): error TS7006: Parameter 'o' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2101,21): error TS7006: Parameter 'action' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2102,18): error TS7006: Parameter 'action' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2106,10): error TS7006: Parameter 'output' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2140,21): error TS7006: Parameter 'action' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2141,18): error TS7006: Parameter 'action' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2147,21): error TS7006: Parameter 'action' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2148,18): error TS7006: Parameter 'action' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2157,17): error TS7006: Parameter 'o' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2162,18): error TS7006: Parameter 'o' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2261,17): error TS7006: Parameter 'output' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2265,22): error TS7006: Parameter 'output' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2266,26): error TS7006: Parameter 'prev' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2266,32): error TS7006: Parameter 'curr' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2284,29): error TS7006: Parameter 'burnAction' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2309,25): error TS2365: Operator '-' cannot be applied to types 'number' and 'bigint'.
Build ecash-agora-integration-tests failed with exit code 2

build lint type fixes, patch version bump for ecash-wallet

Tail of the build log:

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

7 vulnerabilities (1 low, 5 moderate, 1 high)

To address all issues, run:
  npm audit fix

Run `npm audit` for details.

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

/work/modules/ecash-agora /work/abc-ci-builds/cashtab-tests

added 273 packages, and audited 277 packages in 1s

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

7 vulnerabilities (1 low, 5 moderate, 1 high)

To address all issues, run:
  npm audit fix

Run `npm audit` for details.

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

../ecash-wallet/src/wallet.ts(43,8): error TS2307: Cannot find module 'ecash-lib' or its corresponding type declarations.
../ecash-wallet/src/wallet.ts(44,54): error TS2307: Cannot find module 'chronik-client' or its corresponding type declarations.
../ecash-wallet/src/wallet.ts(303,47): error TS7006: Parameter 'action' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(545,29): error TS7006: Parameter 'action' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(551,29): error TS7006: Parameter 'action' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(1274,10): error TS7006: Parameter 'output' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(1851,9): error TS7006: Parameter 'action' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(1946,40): error TS7006: Parameter 'output' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(1972,46): error TS7006: Parameter 'output' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(1985,9): error TS7006: Parameter 'action' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2006,9): error TS7006: Parameter 'output' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2031,13): error TS7006: Parameter 'output' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2074,9): error TS7006: Parameter 'action' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2078,10): error TS7006: Parameter 'o' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2101,21): error TS7006: Parameter 'action' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2102,18): error TS7006: Parameter 'action' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2106,10): error TS7006: Parameter 'output' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2140,21): error TS7006: Parameter 'action' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2141,18): error TS7006: Parameter 'action' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2147,21): error TS7006: Parameter 'action' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2148,18): error TS7006: Parameter 'action' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2157,17): error TS7006: Parameter 'o' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2162,18): error TS7006: Parameter 'o' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2261,17): error TS7006: Parameter 'output' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2265,22): error TS7006: Parameter 'output' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2266,26): error TS7006: Parameter 'prev' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2266,32): error TS7006: Parameter 'curr' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2284,29): error TS7006: Parameter 'burnAction' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2309,25): error TS2365: Operator '-' cannot be applied to types 'number' and 'bigint'.
Build cashtab-tests failed with exit code 2

add ecash-wallet as dep for ecash-agora in CI

Tail of the build log:

[584/596] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/signverifymessagedialog.cpp.o
[585/596] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/transactiontablemodel.cpp.o
[586/596] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/transactiondesc.cpp.o
[587/596] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/paymentrequestplus.cpp.o
[588/596] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/sendcoinsdialog.cpp.o
[589/596] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/walletcontroller.cpp.o
[590/596] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/walletview.cpp.o
[591/596] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/walletmodel.cpp.o
[592/596] Linking CXX static library src/qt/libbitcoin-qt-base.a
[593/596] Automatic MOC for target bitcoin-qt
[594/596] Building CXX object src/qt/CMakeFiles/bitcoin-qt.dir/bitcoin-qt_autogen/mocs_compilation.cpp.o
[595/596] Building CXX object src/qt/CMakeFiles/bitcoin-qt.dir/main.cpp.o
[596/596] Linking CXX executable src/qt/bitcoin-qt
/work/modules/ecash-agora /work/abc-ci-builds/ecash-agora-integration-tests

added 273 packages, and audited 277 packages in 1s

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

7 vulnerabilities (1 low, 5 moderate, 1 high)

To address all issues, run:
  npm audit fix

Run `npm audit` for details.

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

../ecash-wallet/src/wallet.ts(43,8): error TS2307: Cannot find module 'ecash-lib' or its corresponding type declarations.
../ecash-wallet/src/wallet.ts(44,54): error TS2307: Cannot find module 'chronik-client' or its corresponding type declarations.
../ecash-wallet/src/wallet.ts(303,47): error TS7006: Parameter 'action' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(545,29): error TS7006: Parameter 'action' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(551,29): error TS7006: Parameter 'action' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(1274,10): error TS7006: Parameter 'output' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(1851,9): error TS7006: Parameter 'action' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(1946,40): error TS7006: Parameter 'output' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(1972,46): error TS7006: Parameter 'output' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(1985,9): error TS7006: Parameter 'action' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2006,9): error TS7006: Parameter 'output' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2031,13): error TS7006: Parameter 'output' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2074,9): error TS7006: Parameter 'action' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2078,10): error TS7006: Parameter 'o' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2101,21): error TS7006: Parameter 'action' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2102,18): error TS7006: Parameter 'action' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2106,10): error TS7006: Parameter 'output' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2140,21): error TS7006: Parameter 'action' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2141,18): error TS7006: Parameter 'action' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2147,21): error TS7006: Parameter 'action' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2148,18): error TS7006: Parameter 'action' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2157,17): error TS7006: Parameter 'o' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2162,18): error TS7006: Parameter 'o' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2261,17): error TS7006: Parameter 'output' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2265,22): error TS7006: Parameter 'output' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2266,26): error TS7006: Parameter 'prev' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2266,32): error TS7006: Parameter 'curr' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2284,29): error TS7006: Parameter 'burnAction' implicitly has an 'any' type.
../ecash-wallet/src/wallet.ts(2309,25): error TS2365: Operator '-' cannot be applied to types 'number' and 'bigint'.
Build ecash-agora-integration-tests failed with exit code 2
Fabien requested changes to this revision.Sep 24 2025, 10:40
Fabien added a subscriber: Fabien.
Fabien added inline comments.
modules/ecash-agora/src/actions.ts
1 ↗(On Diff #55827)

Macro whatyearisit:

modules/ecash-agora/tests/actions.test.ts
54 ↗(On Diff #55827)

You don't need all this stuff, just create the action and check it fails for unsupported types

266 ↗(On Diff #55827)

dito

349 ↗(On Diff #55827)

dito

433 ↗(On Diff #55827)

dito

This revision now requires changes to proceed.Sep 24 2025, 10:40

remove superfluous txs from tests, make sure we run all the integration tests, update header year

Fabien requested changes to this revision.Sep 24 2025, 12:39
Fabien added inline comments.
modules/ecash-agora/tests/actions.test.ts
53–72

Same for the other tests

This revision now requires changes to proceed.Sep 24 2025, 12:39

further simplify tests, clarify names, use dummy consts

This revision is now accepted and ready to land.Sep 24 2025, 13:29