Skip to content

[TA-4976][TA-4977] Add Batch transaction type#146

Merged
GuillemGarciaDev merged 21 commits intov0.1.xfrom
xrpl/feat/add-batch-tx-type
Jul 9, 2025
Merged

[TA-4976][TA-4977] Add Batch transaction type#146
GuillemGarciaDev merged 21 commits intov0.1.xfrom
xrpl/feat/add-batch-tx-type

Conversation

@banasa44
Copy link

@banasa44 banasa44 commented Jul 7, 2025

[TA-4976] Add Batch transaction type

Description

This PR aims to add the transaction type Batch.

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Refactoring

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code where needed
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective
  • New and existing unit tests pass locally with my changes

Changes

  • Add Batch transaction type and tests.

  • Add isArray and isRecord validation helpers.

  • Add ParentBatchID in TxObjMeta.

  • Add support tfInnerBatchTxn flag on HashSignedTx.

Notes

Although the support for tfInnerBatchTxn flag on HashSignedTx was intended for a separate task, as it uses TfInnerBatchTxn introduced in this branch, i added the implementation.

Summary by CodeRabbit

  • New Features

    • Introduced support for Batch transactions, allowing multiple transactions to be processed together.
    • Added new Batch transaction flags for advanced batch control.
    • Enabled BatchSigners for batch transactions.
    • Added the ParentBatchID field to transaction metadata.
    • Added the Batch transaction type to transaction definitions.
  • Bug Fixes

    • Improved validation for batch transactions and inner transactions.
  • Tests

    • Added comprehensive tests for Batch transactions and BatchSigners.
  • Documentation

    • Updated changelog to reflect new Batch transaction features.

@notion-workspace
Copy link

@coderabbitai
Copy link

coderabbitai bot commented Jul 7, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

📝 Walkthrough

Walkthrough

The changes introduce a new Batch transaction type to the XRPL Go SDK, including its definition, validation logic, and flag management. Supporting features include a new transaction flag (TfInnerBatchTxn), a new field (ParentBatchID), type-checking helpers, and updates to transaction signing and metadata handling. Comprehensive unit tests for Batch transactions are also added.

Changes

File(s) Change Summary
CHANGELOG.md Updated changelog to document the addition of Batch transaction type, new flag, helper functions, and support.
binary-codec/definitions/definitions.json Added ParentBatchID field and Batch transaction type to definitions.
xrpl/hash/tx.go Modified SignTxBlob to handle TfInnerBatchTxn flag and added ErrMissingSignature error variable.
xrpl/transaction/batch.go Introduced Batch transaction type, data structures, flag setters, flattening, and validation logic.
xrpl/transaction/batch_test.go Added unit tests for Batch transaction type, flattening, validation, flag setting, and batch signer flattening.
xrpl/transaction/flags.go Added TfInnerBatchTxn flag constant for inner batch transactions.
xrpl/transaction/transaction_metadata.go Added ParentBatchID field to TxObjMeta struct.
xrpl/transaction/tx_type.go Added BatchTx constant to TxType enumeration.
xrpl/transaction/validations_commons.go Added isArray and isRecord runtime type-checking helper functions.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant BatchTx
    participant InnerTx
    participant Validator

    Client->>BatchTx: Create Batch transaction with RawTransactions
    BatchTx->>InnerTx: Wrap each transaction with TfInnerBatchTxn flag
    BatchTx->>Validator: Validate Batch (check flags, structure, signers)
    Validator-->>BatchTx: Validation result (success/failure)
    BatchTx->>Client: Flatten/serialize Batch for submission
Loading

Suggested labels

binary-codec

Suggested reviewers

  • florent-uzio
  • AgustinMJ

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@banasa44 banasa44 added feature Feature xrpl xrpl package labels Jul 7, 2025
@banasa44
Copy link
Author

banasa44 commented Jul 7, 2025

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Jul 7, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (3)
xrpl/transaction/validations_commons.go (1)

20-30: Simplify the redundant condition in isRecord function.

The function logic is correct but contains redundant checks. Since val.Kind() can only be one type at a time, the additional checks for slice and array are unnecessary.

-	// Check if it's an object (map or struct) but not an array/slice
-	return (val.Kind() == reflect.Map || val.Kind() == reflect.Struct) &&
-		val.Kind() != reflect.Slice && val.Kind() != reflect.Array
+	// Check if it's an object (map or struct)
+	return val.Kind() == reflect.Map || val.Kind() == reflect.Struct
CHANGELOG.md (1)

27-30: Documentation is comprehensive and accurate.

The changelog properly documents all the new batch transaction features. The repetitive "Adds" beginnings flagged by static analysis are common in changelogs and don't impact clarity.

If you want to address the style hint, you could vary the sentence beginnings:

- Adds `Batch` transaction type.
- Adds `TfInnerBatchTxn` in `flags.go` file
- Adds `isArray` and `isRecord` validation helpers.
- Adds support for `tfInnerBatchTxn` flag on `SignTxBlob`.
+ Adds `Batch` transaction type.
+ Introduces `TfInnerBatchTxn` in `flags.go` file
+ Implements `isArray` and `isRecord` validation helpers.
+ Adds support for `tfInnerBatchTxn` flag on `SignTxBlob`.
xrpl/transaction/batch_test.go (1)

29-29: Consider using named constants instead of hardcoded flag values.

The tests use hardcoded numeric values (e.g., 65536, 1073741824) for flags. Using the named constants would improve readability and maintainability.

For example, replace:

-"Flags": 65536,
+"Flags": tfAllOrNothing,

And:

-"Flags": 1073741824,
+"Flags": uint32(TfInnerBatchTxn),

Also applies to: 37-37, 54-54, 77-77, 93-93, 116-116, 132-132, 159-159, 185-185, 235-235, 258-258, 267-267, 301-301, 323-323, 345-345, 367-367, 389-389

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 73334b9 and 6be970f.

📒 Files selected for processing (9)
  • CHANGELOG.md (1 hunks)
  • binary-codec/definitions/definitions.json (2 hunks)
  • xrpl/hash/tx.go (2 hunks)
  • xrpl/transaction/batch.go (1 hunks)
  • xrpl/transaction/batch_test.go (1 hunks)
  • xrpl/transaction/flags.go (1 hunks)
  • xrpl/transaction/transaction_metadata.go (1 hunks)
  • xrpl/transaction/tx_type.go (1 hunks)
  • xrpl/transaction/validations_commons.go (1 hunks)
🧰 Additional context used
🧠 Learnings (10)
📓 Common learnings
Learnt from: florent-uzio
PR: Peersyst/xrpl-go#113
File: xrpl/transaction/credential_create.go:30-34
Timestamp: 2025-03-11T11:50:58.330Z
Learning: In PR #113 for xrpl-go, the `CredentialCreate` struct in xrpl/transaction/credential_create.go does not have any duplicated fields as was incorrectly flagged in a previous review comment.
Learnt from: banasa44
PR: Peersyst/xrpl-go#145
File: binary-codec/codec.go:0-0
Timestamp: 2025-07-07T11:40:34.708Z
Learning: XRPL batch transactions have a maximum limit of 8 transactions per batch, as defined by the XRPL protocol. This constraint eliminates practical concerns about integer overflow when converting batch length to uint32.
Learnt from: florent-uzio
PR: Peersyst/xrpl-go#113
File: xrpl/transaction/credential_create.go:30-34
Timestamp: 2025-03-11T11:50:58.330Z
Learning: In the PR #113 for xrpl-go, the initial flagging of duplicated fields (`CredentialType` and `Expiration`) in the `xrpl/transaction/credential_create.go` file was determined to be irrelevant and not an actual issue.
Learnt from: vriveraPeersyst
PR: Peersyst/xrpl-snap#129
File: packages/site/src/domain/transaction/controller/TransactionController.ts:98-111
Timestamp: 2025-05-17T14:29:55.132Z
Learning: In the TransactionController class of the XRPL Snap project, the `...rest` parameter in the `sendIOUTransaction` method does not contain flags from callers, so directly setting `flags: PARTIAL_PAYMENT_FLAG` without merging with existing flags is appropriate.
Learnt from: florent-uzio
PR: Peersyst/xrpl-go#113
File: xrpl/transaction/credential_create.go:30-34
Timestamp: 2025-03-11T11:50:58.330Z
Learning: The CredentialCreate struct in xrpl/transaction/credential_create.go does not have any duplicated fields as was incorrectly flagged in a previous review comment.
xrpl/transaction/flags.go (4)
Learnt from: florent-uzio
PR: Peersyst/xrpl-go#113
File: xrpl/transaction/credential_create.go:30-34
Timestamp: 2025-03-11T11:50:58.330Z
Learning: In the PR #113 for xrpl-go, the initial flagging of duplicated fields (`CredentialType` and `Expiration`) in the `xrpl/transaction/credential_create.go` file was determined to be irrelevant and not an actual issue.
Learnt from: vriveraPeersyst
PR: Peersyst/xrpl-snap#129
File: packages/site/src/domain/transaction/controller/TransactionController.ts:98-111
Timestamp: 2025-05-17T14:29:55.132Z
Learning: In the TransactionController class of the XRPL Snap project, the `...rest` parameter in the `sendIOUTransaction` method does not contain flags from callers, so directly setting `flags: PARTIAL_PAYMENT_FLAG` without merging with existing flags is appropriate.
Learnt from: florent-uzio
PR: Peersyst/xrpl-go#113
File: xrpl/transaction/credential_create.go:30-34
Timestamp: 2025-03-11T11:50:58.330Z
Learning: In PR #113 for xrpl-go, the `CredentialCreate` struct in xrpl/transaction/credential_create.go does not have any duplicated fields as was incorrectly flagged in a previous review comment.
Learnt from: florent-uzio
PR: Peersyst/xrpl-go#113
File: xrpl/transaction/credential_create.go:30-34
Timestamp: 2025-03-11T11:50:58.330Z
Learning: The CredentialCreate struct in xrpl/transaction/credential_create.go does not have any duplicated fields as was incorrectly flagged in a previous review comment.
xrpl/transaction/tx_type.go (3)
Learnt from: banasa44
PR: Peersyst/xrpl-go#145
File: binary-codec/codec.go:0-0
Timestamp: 2025-07-07T11:40:34.708Z
Learning: XRPL batch transactions have a maximum limit of 8 transactions per batch, as defined by the XRPL protocol. This constraint eliminates practical concerns about integer overflow when converting batch length to uint32.
Learnt from: florent-uzio
PR: Peersyst/xrpl-go#113
File: xrpl/transaction/credential_create.go:30-34
Timestamp: 2025-03-11T11:50:58.330Z
Learning: In the PR #113 for xrpl-go, the initial flagging of duplicated fields (`CredentialType` and `Expiration`) in the `xrpl/transaction/credential_create.go` file was determined to be irrelevant and not an actual issue.
Learnt from: florent-uzio
PR: Peersyst/xrpl-go#113
File: xrpl/transaction/credential_create.go:30-34
Timestamp: 2025-03-11T11:50:58.330Z
Learning: In PR #113 for xrpl-go, the `CredentialCreate` struct in xrpl/transaction/credential_create.go does not have any duplicated fields as was incorrectly flagged in a previous review comment.
xrpl/transaction/transaction_metadata.go (3)
Learnt from: florent-uzio
PR: Peersyst/xrpl-go#113
File: xrpl/transaction/credential_create.go:30-34
Timestamp: 2025-03-11T11:50:58.330Z
Learning: In PR #113 for xrpl-go, the `CredentialCreate` struct in xrpl/transaction/credential_create.go does not have any duplicated fields as was incorrectly flagged in a previous review comment.
Learnt from: florent-uzio
PR: Peersyst/xrpl-go#113
File: xrpl/transaction/credential_create.go:30-34
Timestamp: 2025-03-11T11:50:58.330Z
Learning: In the PR #113 for xrpl-go, the initial flagging of duplicated fields (`CredentialType` and `Expiration`) in the `xrpl/transaction/credential_create.go` file was determined to be irrelevant and not an actual issue.
Learnt from: florent-uzio
PR: Peersyst/xrpl-go#113
File: xrpl/transaction/credential_create.go:30-34
Timestamp: 2025-03-11T11:50:58.330Z
Learning: The CredentialCreate struct in xrpl/transaction/credential_create.go does not have any duplicated fields as was incorrectly flagged in a previous review comment.
xrpl/transaction/validations_commons.go (3)
Learnt from: GuillemGarciaDev
PR: Peersyst/xrpl-go#131
File: xrpl/rpc/client.go:265-265
Timestamp: 2025-03-31T17:29:49.615Z
Learning: In the XRPL Go codebase, type assertions from maps should always use the two-return pattern (value, ok := map[key].(type)) with proper error handling to avoid potential panics.
Learnt from: florent-uzio
PR: Peersyst/xrpl-go#113
File: xrpl/transaction/credential_create.go:30-34
Timestamp: 2025-03-11T11:50:58.330Z
Learning: In PR #113 for xrpl-go, the `CredentialCreate` struct in xrpl/transaction/credential_create.go does not have any duplicated fields as was incorrectly flagged in a previous review comment.
Learnt from: florent-uzio
PR: Peersyst/xrpl-go#113
File: xrpl/transaction/credential_create.go:30-34
Timestamp: 2025-03-11T11:50:58.330Z
Learning: In the PR #113 for xrpl-go, the initial flagging of duplicated fields (`CredentialType` and `Expiration`) in the `xrpl/transaction/credential_create.go` file was determined to be irrelevant and not an actual issue.
xrpl/hash/tx.go (5)
Learnt from: florent-uzio
PR: Peersyst/xrpl-go#113
File: xrpl/transaction/credential_create.go:30-34
Timestamp: 2025-03-11T11:50:58.330Z
Learning: In PR #113 for xrpl-go, the `CredentialCreate` struct in xrpl/transaction/credential_create.go does not have any duplicated fields as was incorrectly flagged in a previous review comment.
Learnt from: florent-uzio
PR: Peersyst/xrpl-go#113
File: xrpl/transaction/credential_create.go:30-34
Timestamp: 2025-03-11T11:50:58.330Z
Learning: In the PR #113 for xrpl-go, the initial flagging of duplicated fields (`CredentialType` and `Expiration`) in the `xrpl/transaction/credential_create.go` file was determined to be irrelevant and not an actual issue.
Learnt from: florent-uzio
PR: Peersyst/xrpl-go#113
File: xrpl/transaction/credential_create.go:30-34
Timestamp: 2025-03-11T11:50:58.330Z
Learning: The CredentialCreate struct in xrpl/transaction/credential_create.go does not have any duplicated fields as was incorrectly flagged in a previous review comment.
Learnt from: vriveraPeersyst
PR: Peersyst/xrpl-snap#129
File: packages/site/src/domain/transaction/controller/TransactionController.ts:98-111
Timestamp: 2025-05-17T14:29:55.132Z
Learning: In the TransactionController class of the XRPL Snap project, the `...rest` parameter in the `sendIOUTransaction` method does not contain flags from callers, so directly setting `flags: PARTIAL_PAYMENT_FLAG` without merging with existing flags is appropriate.
Learnt from: AgustinMJ
PR: Peersyst/near-mobile#58
File: packages/shared/blockchain/core/src/signers/signer.ts:26-27
Timestamp: 2025-02-27T10:24:14.276Z
Learning: The Signer interface uses `Record<string, any>` for the transaction parameter in `signTransaction` method to allow implementing classes to add their own specific types extending this base type, providing flexibility for different blockchain implementations.
CHANGELOG.md (5)
Learnt from: florent-uzio
PR: Peersyst/xrpl-go#113
File: xrpl/transaction/credential_create.go:30-34
Timestamp: 2025-03-11T11:50:58.330Z
Learning: In the PR #113 for xrpl-go, the initial flagging of duplicated fields (`CredentialType` and `Expiration`) in the `xrpl/transaction/credential_create.go` file was determined to be irrelevant and not an actual issue.
Learnt from: florent-uzio
PR: Peersyst/xrpl-go#113
File: xrpl/transaction/credential_create.go:30-34
Timestamp: 2025-03-11T11:50:58.330Z
Learning: In PR #113 for xrpl-go, the `CredentialCreate` struct in xrpl/transaction/credential_create.go does not have any duplicated fields as was incorrectly flagged in a previous review comment.
Learnt from: banasa44
PR: Peersyst/xrpl-go#145
File: binary-codec/codec.go:0-0
Timestamp: 2025-07-07T11:40:34.708Z
Learning: XRPL batch transactions have a maximum limit of 8 transactions per batch, as defined by the XRPL protocol. This constraint eliminates practical concerns about integer overflow when converting batch length to uint32.
Learnt from: florent-uzio
PR: Peersyst/xrpl-go#113
File: xrpl/transaction/credential_create.go:30-34
Timestamp: 2025-03-11T11:50:58.330Z
Learning: The CredentialCreate struct in xrpl/transaction/credential_create.go does not have any duplicated fields as was incorrectly flagged in a previous review comment.
Learnt from: vriveraPeersyst
PR: Peersyst/xrpl-snap#129
File: packages/site/src/domain/transaction/controller/TransactionController.ts:98-111
Timestamp: 2025-05-17T14:29:55.132Z
Learning: In the TransactionController class of the XRPL Snap project, the `...rest` parameter in the `sendIOUTransaction` method does not contain flags from callers, so directly setting `flags: PARTIAL_PAYMENT_FLAG` without merging with existing flags is appropriate.
binary-codec/definitions/definitions.json (1)
Learnt from: banasa44
PR: Peersyst/xrpl-go#145
File: binary-codec/codec.go:0-0
Timestamp: 2025-07-07T11:40:34.708Z
Learning: XRPL batch transactions have a maximum limit of 8 transactions per batch, as defined by the XRPL protocol. This constraint eliminates practical concerns about integer overflow when converting batch length to uint32.
xrpl/transaction/batch_test.go (4)
Learnt from: florent-uzio
PR: Peersyst/xrpl-go#113
File: xrpl/transaction/credential_create.go:30-34
Timestamp: 2025-03-11T11:50:58.330Z
Learning: In PR #113 for xrpl-go, the `CredentialCreate` struct in xrpl/transaction/credential_create.go does not have any duplicated fields as was incorrectly flagged in a previous review comment.
Learnt from: banasa44
PR: Peersyst/xrpl-go#145
File: binary-codec/codec.go:0-0
Timestamp: 2025-07-07T11:40:34.708Z
Learning: XRPL batch transactions have a maximum limit of 8 transactions per batch, as defined by the XRPL protocol. This constraint eliminates practical concerns about integer overflow when converting batch length to uint32.
Learnt from: florent-uzio
PR: Peersyst/xrpl-go#113
File: xrpl/transaction/credential_create.go:30-34
Timestamp: 2025-03-11T11:50:58.330Z
Learning: In the PR #113 for xrpl-go, the initial flagging of duplicated fields (`CredentialType` and `Expiration`) in the `xrpl/transaction/credential_create.go` file was determined to be irrelevant and not an actual issue.
Learnt from: florent-uzio
PR: Peersyst/xrpl-go#113
File: xrpl/transaction/credential_create.go:30-34
Timestamp: 2025-03-11T11:50:58.330Z
Learning: The CredentialCreate struct in xrpl/transaction/credential_create.go does not have any duplicated fields as was incorrectly flagged in a previous review comment.
xrpl/transaction/batch.go (4)
Learnt from: florent-uzio
PR: Peersyst/xrpl-go#113
File: xrpl/transaction/credential_create.go:30-34
Timestamp: 2025-03-11T11:50:58.330Z
Learning: In PR #113 for xrpl-go, the `CredentialCreate` struct in xrpl/transaction/credential_create.go does not have any duplicated fields as was incorrectly flagged in a previous review comment.
Learnt from: banasa44
PR: Peersyst/xrpl-go#145
File: binary-codec/codec.go:0-0
Timestamp: 2025-07-07T11:40:34.708Z
Learning: XRPL batch transactions have a maximum limit of 8 transactions per batch, as defined by the XRPL protocol. This constraint eliminates practical concerns about integer overflow when converting batch length to uint32.
Learnt from: florent-uzio
PR: Peersyst/xrpl-go#113
File: xrpl/transaction/credential_create.go:30-34
Timestamp: 2025-03-11T11:50:58.330Z
Learning: In the PR #113 for xrpl-go, the initial flagging of duplicated fields (`CredentialType` and `Expiration`) in the `xrpl/transaction/credential_create.go` file was determined to be irrelevant and not an actual issue.
Learnt from: florent-uzio
PR: Peersyst/xrpl-go#113
File: xrpl/transaction/credential_create.go:30-34
Timestamp: 2025-03-11T11:50:58.330Z
Learning: The CredentialCreate struct in xrpl/transaction/credential_create.go does not have any duplicated fields as was incorrectly flagged in a previous review comment.
🧬 Code Graph Analysis (2)
xrpl/hash/tx.go (1)
xrpl/transaction/flags.go (1)
  • TfInnerBatchTxn (8-8)
xrpl/transaction/batch_test.go (6)
xrpl/transaction/batch.go (5)
  • Batch (87-93)
  • Batch (121-123)
  • RawTransactionWrapper (55-57)
  • BatchSigner (42-44)
  • BatchSignerData (47-52)
xrpl/transaction/tx_type.go (2)
  • BatchTx (16-16)
  • TxType (3-3)
xrpl/transaction/tx.go (1)
  • BaseTx (30-99)
xrpl/transaction/flags.go (1)
  • TfInnerBatchTxn (8-8)
xrpl/testutil/flatten.go (1)
  • CompareFlattenAndExpected (9-32)
xrpl/transaction/signer.go (2)
  • Signer (7-9)
  • SignerData (17-21)
🪛 LanguageTool
CHANGELOG.md

[style] ~27-~27: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...dds NFTokenModify transaction type. - Adds Batch transaction type. - Adds `TfInn...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[style] ~28-~28: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...ype. - Adds Batch transaction type. - Adds TfInnerBatchTxn in flags.go file - ...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)

🔇 Additional comments (9)
xrpl/transaction/transaction_metadata.go (1)

21-21: Field addition looks good.

The ParentBatchID field follows the existing struct patterns with appropriate type (string) and JSON tagging (omitempty). This supports the batch transaction functionality correctly.

xrpl/transaction/flags.go (1)

5-9: Flag constant addition is well-implemented.

The TfInnerBatchTxn flag constant is properly defined with a clear comment explaining its purpose. The value 0x40000000 is appropriate for a flag constant, and the section organization with a descriptive header comment enhances code readability.

xrpl/transaction/tx_type.go (1)

16-16: Transaction type constant addition is correct.

The BatchTx constant follows the established pattern for transaction types, with appropriate naming and correct alphabetical placement in the constants list.

xrpl/transaction/validations_commons.go (1)

10-18: isArray function implementation is correct.

The function properly handles nil input and uses reflection correctly to check for both slice and array types. The logic and error handling are sound.

xrpl/hash/tx.go (1)

11-16: LGTM! Correct handling of inner batch transactions.

The implementation properly skips signature validation for inner batch transactions marked with the TfInnerBatchTxn flag, which is appropriate since these transactions are signed as part of the parent batch transaction.

Also applies to: 27-43

binary-codec/definitions/definitions.json (1)

1457-1466: LGTM! Proper integration of batch transaction definitions.

The additions correctly follow the existing patterns:

  • ParentBatchID field is properly configured as a Hash256 type with appropriate serialization settings
  • Batch transaction type is assigned the next available ID (64)

Also applies to: 3062-3062

xrpl/transaction/batch_test.go (1)

1-546: Comprehensive test coverage!

The test suite thoroughly covers all aspects of the Batch transaction implementation, including positive and negative test cases for validation, flag handling, and serialization.

xrpl/transaction/batch.go (2)

87-93: Well-structured Batch transaction implementation!

The Batch struct and supporting types are well-designed, with clear documentation and appropriate field tagging for JSON serialization.


129-159: Clear and well-documented flag methods!

The flag setting methods are properly implemented with clear documentation explaining the behavior of each flag.

@banasa44 banasa44 requested a review from GuillemGarciaDev July 8, 2025 10:28
@GuillemGarciaDev GuillemGarciaDev force-pushed the xrpl/feat/add-batch-tx-type branch from 926b313 to c7e555b Compare July 8, 2025 14:16
@GuillemGarciaDev GuillemGarciaDev changed the title [TA-4976] Add Batch transaction type [TA-4976][TA-4977] Add Batch transaction type Jul 9, 2025
@notion-workspace
Copy link

@GuillemGarciaDev GuillemGarciaDev self-assigned this Jul 9, 2025
@GuillemGarciaDev GuillemGarciaDev merged commit fa31914 into v0.1.x Jul 9, 2025
5 checks passed
@GuillemGarciaDev GuillemGarciaDev deleted the xrpl/feat/add-batch-tx-type branch July 9, 2025 09:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Feature xrpl xrpl package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants