-
Notifications
You must be signed in to change notification settings - Fork 300
feat(sdk-coin-canton): added pre-approval builder #7207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
cb41838
to
415c6fb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements a pre-approval builder for Canton transactions, allowing 1-step pre-approval functionality. It adds support for creating one-step enablement requests that can be used to set up pre-approvals in the Canton blockchain network.
- Added
OneStepPreApproval
transaction type to the SDK core enum - Implemented
OneStepPreApprovalBuilder
class with full validation and request object generation - Enhanced transaction and builder classes with proper validation and hash computation methods
Reviewed Changes
Copilot reviewed 11 out of 13 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
modules/sdk-core/src/account-lib/baseCoin/enum.ts | Added OneStepPreApproval transaction type enum |
modules/sdk-coin-canton/src/lib/oneStepPreApprovalBuilder.ts | New builder class for creating one-step pre-approval requests |
modules/sdk-coin-canton/src/lib/iface.ts | Added interfaces for one-step enablement requests |
modules/sdk-coin-canton/src/lib/transactionBuilder.ts | Enhanced base builder with validation methods and removed unused code |
modules/sdk-coin-canton/src/lib/transaction/transaction.ts | Updated transaction class with proper getters/setters and new methods |
modules/sdk-coin-canton/src/lib/transferBuilder.ts | Added setTransaction method implementation |
modules/sdk-coin-canton/src/lib/utils.ts | Added hash computation method for prepare submission responses |
modules/sdk-coin-canton/resources/hash/hash.js | Added hash computation utilities for Canton transactions |
modules/sdk-coin-canton/test/unit/builder/oneStepEnablement/oneStepEnablementBuilder.ts | Comprehensive test suite for the new builder |
modules/sdk-coin-canton/test/unit/utils.ts | Added tests for new hash computation functionality |
modules/sdk-coin-canton/src/lib/walletInitialization/walletInitTransaction.ts | Removed unused Buffer import |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
/** | ||
* Sets the template id for the 1-step enablement | ||
* | ||
* @param id - the template if of the form `#splice-wallet:Splice.Wallet.TransferPreapproval:TransferPreapprovalProposal` |
Copilot
AI
Oct 13, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected spelling of 'if' to 'id'.
* @param id - the template if of the form `#splice-wallet:Splice.Wallet.TransferPreapproval:TransferPreapprovalProposal` | |
* @param id - the template id of the form `#splice-wallet:Splice.Wallet.TransferPreapproval:TransferPreapprovalProposal` |
Copilot uses AI. Check for mistakes.
|
||
get id(): string { | ||
if (!this._id) { | ||
throw new InvalidTransactionError('transaction is is not set'); |
Copilot
AI
Oct 13, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected duplicated word 'is is' to 'id is'.
throw new InvalidTransactionError('transaction is is not set'); | |
throw new InvalidTransactionError('transaction id is not set'); |
Copilot uses AI. Check for mistakes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Ticket: COIN-5918