Skip to content

feat: add decode tests for Transfer and Bond transactions - #62

Merged
b00f merged 2 commits into
mainfrom
feat/add-tx-decode-tests
Jul 1, 2026
Merged

feat: add decode tests for Transfer and Bond transactions#62
b00f merged 2 commits into
mainfrom
feat/add-tx-decode-tests

Conversation

@b00f

@b00f b00f commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

Summary

Add tests that decode real, broadcasted Pactus transactions from raw bytes, verifying all fields match expected values from the block explorer.

Test Data

Test data sourced from Trust Wallet Core.

Type Transaction ID Explorer
Transfer 1b6b7226f7935a15f05371d1a1fefead585a89704ce464b7cc1d453d299d235f pactusscan
Bond (no public key) f83f583a5c40adf93a90ea536a7e4b467d30ca4f308d5da52624d80c42adec80 pactusscan

What Each Test Verifies

  • Transfer tx: version, lock_time, fee, memo, payload type, sender/receiver addresses, amount, Ed25519 signature and public key, transaction ID, sign bytes
  • Bond tx: version, lock_time, fee, memo, payload type, sender/receiver addresses, stake, no validator public key, Ed25519 signature and public key, transaction ID, sign bytes

Testing

All 47 tests pass.

@b00f
b00f requested a review from themantre July 1, 2026 05:22
b00f added 2 commits July 1, 2026 13:36
Add tests that decode real, broadcasted Pactus transactions from raw bytes, verifying all fields match expected values from the block explorer.

Transfer tx: 1b6b7226f7935a15f05371d1a1fefead585a89704ce464b7cc1d453d299d235f
Bond tx:     f83f583a5c40adf93a90ea536a7e4b467d30ca4f308d5da52624d80c42adec80

Test data sourced from:
- Trust Wallet Core: tests/chains/Pactus/TestCases.h
- Pactus Explorer: https://pactusscan.com
Transaction.id() now returns a Hash object (from PR #61). Hash has no .hex() method — use str() which returns the hex representation via Hash.__str__.
@b00f
b00f force-pushed the feat/add-tx-decode-tests branch from 12f9e68 to 47a4e90 Compare July 1, 2026 05:37
@b00f
b00f enabled auto-merge (squash) July 1, 2026 05:37
@b00f
b00f merged commit d69acf4 into main Jul 1, 2026
3 checks passed
@b00f
b00f deleted the feat/add-tx-decode-tests branch July 1, 2026 05:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants