Skip to content

Conversation

@aruokhai
Copy link
Contributor

This PR is specifically for the visibility of Arkade Asset

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 18, 2025

Important

Review skipped

Draft detected.

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.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch ark-asset

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

Comment @coderabbitai help to get the list of available commands and usage tips.

Comment on lines 50 to 52
assetData = append(assetData, a.genesisTxId...)
assetData = append(assetData, batchTxId...)
assetData = append(assetData, encodedTlv...)
Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe we should encode these as var len bytes like len(buf)+buf?

}

func (a *Asset) encodeTlv() ([]byte, error) {
var tlvRecords []tlv.Record
Copy link
Collaborator

Choose a reason for hiding this comment

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

do we really need this external dep tls.Record to serilalize/deserialize asset data?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can always implement the encoding and decoding logic using TLV schematics, which @Kukks recommended in the Arkade Asset docs https://github.com/ArkLabsHQ/arkade-assets/blob/master/arkade-assets.md#3-packet-format-canonical-tlv , but the tlv library provides a fast way of doing it, but in the future it can always be removed for custom implementation

Comment on lines 13 to 22
tlvTypeAssetID tlv.Type = 1
tlvTypeOutput tlv.Type = 2
tlvTypeControlPubkey tlv.Type = 3
tlvTypeInput tlv.Type = 4
tlvTypeMetadata tlv.Type = 6
tlvTypeOutScriptPubKey tlv.Type = 7
tlvTypeInTxid tlv.Type = 8
tlvTypeOutAmount tlv.Type = 9
tlvTypeInVout tlv.Type = 10
tlvTypeImmutable tlv.Type = 11
Copy link
Collaborator

Choose a reason for hiding this comment

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

use iota:

Suggested change
tlvTypeAssetID tlv.Type = 1
tlvTypeOutput tlv.Type = 2
tlvTypeControlPubkey tlv.Type = 3
tlvTypeInput tlv.Type = 4
tlvTypeMetadata tlv.Type = 6
tlvTypeOutScriptPubKey tlv.Type = 7
tlvTypeInTxid tlv.Type = 8
tlvTypeOutAmount tlv.Type = 9
tlvTypeInVout tlv.Type = 10
tlvTypeImmutable tlv.Type = 11
tlvTypeAssetID tlv.Type = iota
tlvTypeOutput
tlvTypeControlPubkey
tlvTypeInput
tlvTypeMetadata
tlvTypeOutScriptPubKey
tlvTypeInTxid
tlvTypeOutAmount
tlvTypeInVout
tlvTypeImmutable

- Update Receiver struct to include AssetAmount, AssetId, and AssetTeleport fields.
- Modify RegisterIntent method to handle asset outputs and seals.
- Enhance asset output retrieval and encoding in transaction creation.
- Introduce ArkAssetSealVtxoField for marking asset seal inputs in PSBT.
- Refactor tree builder to accommodate multiple outputs, including asset scripts.
… struct; update transaction building and tests accordingly
…xosLeaves; add logging for script generation
…issuance and burning; update teleport pubkey comparison in utils
…set handling and introduce byte reversal utility
…fication of control VTXO and error handling for missing assets
… are correctly appended when control VTXO is found
… logic and ensure proper input management for control assets
Introduces comprehensive unit tests to validate the rebuilding of asset
transactions
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.

3 participants