-
Notifications
You must be signed in to change notification settings - Fork 6
feat: Add support for Asset Freeze transactions #167
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
Conversation
c876e58
to
005e406
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 adds support for Asset Freeze transactions across the core library, FFI bindings, and language-specific SDKs.
- Introduce
AssetFreezeTransactionFields
andAssetFreezeTransactionBuilder
in Rust core - Extend
Transaction
enum, serialization, FFI, fee calculation, and ID logic to cover asset freeze/unfreeze - Add comprehensive tests and examples in TypeScript, Python, and Rust
Reviewed Changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
packages/typescript/algokit_transact/tests/asset_freeze.test.ts | Add TS tests for freeze/unfreeze encoding, ID, fee |
packages/python/algokit_transact/tests/test_asset_freeze.py | Add Python tests for asset freeze transactions |
crates/algokit_transact_ffi/src/lib.rs | Expose AssetFreezeTransactionFields via FFI |
crates/algokit_transact/src/transactions/mod.rs | Register AssetFreeze variant in the core Transaction enum |
crates/algokit_transact/src/transactions/asset_freeze.rs | Define the Rust AssetFreezeTransactionFields struct |
crates/algokit_transact/src/tests.rs | Add end-to-end Rust tests for freeze/unfreeze flows |
crates/algokit_transact/src/test_utils/mod.rs | Extend test utilities to generate freeze/unfreeze data |
crates/algokit_transact/src/lib.rs | Re-export freeze builder/fields in top-level API |
Comments suppressed due to low confidence (2)
packages/python/algokit_transact/tests/test_asset_freeze.py:110
- It could be valuable to also verify that the decoded transaction’s
freeze_target
matches the original address (e.g.,assert decoded.asset_freeze.freeze_target.address == target_account.address
).
assert get_encoded_transaction_type(encoded) == TransactionType.ASSET_FREEZE
crates/algokit_transact/src/transactions/asset_freeze.rs:25
asset_id
andfreeze_target
are required fields for this transaction. Consider adding builder validation (e.g., via#[builder(validator(...))]
) to ensureasset_id > 0
andfreeze_target
is not a zero address.
pub struct AssetFreezeTransactionFields {
packages/typescript/algokit_transact/__tests__/asset_freeze.test.ts
Outdated
Show resolved
Hide resolved
005e406
to
6225e27
Compare
87f5640
to
41a54f4
Compare
@@ -156,6 +158,115 @@ impl TransactionMother { | |||
.receiver(AddressMother::neil()) | |||
.to_owned() | |||
} | |||
|
|||
pub fn asset_freeze() -> AssetFreezeTransactionBuilder { |
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.
You should move the builder methods for asset freeze to another file, following the pattern of app call and asset config.
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.
Are you referring to the testing builder or the regular builder? The AssetFreezeTransactionBuilder
lives in the asset_freeze.rs
like the others.
fb8f3d4
to
51abbc2
Compare
e441e12
to
c4b06fd
Compare
- Implement AssetFreezeTransactionFields with asset_id, freeze_target, and frozen fields - Add AssetFreezeTransactionBuilder with derive_builder pattern support - Update Transaction enum to include AssetFreeze variant with proper serde serialization - Add FFI bindings for cross-language support (Python, TypeScript, Swift) - Update all transaction handling code to support the new transaction type - Add comprehensive test coverage including encoding/decoding, transaction IDs, fee calculation, and transaction grouping - Include test data generation for both freeze and unfreeze scenarios - Add example usage in Python and TypeScript test suites This enables freezing and unfreezing of asset holdings for specific accounts, allowing asset managers to control transfer permissions on a per-account basis.
- Add asset freeze transaction support across Rust, Python, and TypeScript packages - Update test utilities and test cases for asset freeze functionality - Implement FFI bindings for asset freeze transactions
415dd4f
to
7d901d0
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.
LGTM
🎉 This PR is included in version 1.0.0-alpha.35 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
🎉 This PR is included in version 1.0.0-alpha.30 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This enables freezing and unfreezing of asset holdings for specific accounts, allowing asset managers to control transfer permissions on a per-account basis.