phase 3.3, 3.6: cip-68 ref-nft pair + sign_partial primitive
new aldabra-core::cip68 module: - asset name prefixes 100 (0x000643b0 ref) / 222 (0x000de140 user) / 333 (0x0014df10 ft). prefixed() guards 32-byte total cap so caller can't blow past the cardano protocol limit by accident. - json_to_plutus_data: serde_json::Value → PlutusData (recursive). numbers must fit i64. strings → BoundedBytes (cip-68 convention is bytes-keyed datum maps, not text). null is rejected, floats rejected. - build_cip68_datum_cbor wraps the metadata in the canonical Constr 0 [meta_map, version_int=2, Constr 0 []] shape. new aldabra-core::mint::build_signed_cip68_nft_mint: - mints two assets simultaneously under one policy (ref + user, qty 1 each), three outputs (ref @ ref_addr w/ inline datum, user @ user_addr, change). same two-pass fee refinement as the rest of the path. - mutable nfts: pass ref_addr == change_addr. wallet's payment key can later spend the ref UTXO and re-create with new datum. - immutable: caller passes an always-fails script address (phase 4 concern; today this fn trusts whatever's passed). new aldabra-core::sign module + add_witness: - decodes a conway tx (any state — unsigned or partially signed), signs the body hash with the wallet's payment key, appends a VKeyWitness to the witness_set, re-encodes. body is invariant (regression test asserts the body hash before and after the witness append are identical). - this is the missing primitive for n-of-k multisig flows: each party calls add_witness on the previous party's output cbor; any party submits via wallet.submit_signed_tx. mcp tools: 10 → 12. - wallet.mint.cip68_nft — args: user_address, name_body_hex (≤28b), metadata (json object), user_lovelace? ref_address? ref_lovelace? invalid_after_slot? — defaults provided for the ergonomic case (ref_addr=wallet, lovelace=1.5 ADA each). - wallet.sign_partial — args: cbor_hex — appends our witness, returns updated hex. usable for MAP treasury 2-of-2 once a wallet.mint.unsigned-with-policy-arg lands (TODO, deferred). 65 → 79 unit tests. cip68 module: 9 tests covering prefix+datum shape. sign module: 4 tests covering one-witness, two-witness, body-hash invariant, garbage rejection. integration test in mint verifies cip68 build produces 3 outputs with inline datum on the ref output.
This commit is contained in:
parent
218d1ac94b
commit
640af23598
5 changed files with 903 additions and 5 deletions
|
|
@ -35,13 +35,22 @@ use pallas_addresses::{
|
|||
use thiserror::Error;
|
||||
use zeroize::ZeroizeOnDrop;
|
||||
|
||||
pub mod cip68;
|
||||
pub mod derive;
|
||||
pub mod metadata;
|
||||
pub mod mint;
|
||||
pub mod sign;
|
||||
pub mod tx;
|
||||
pub use cip68::{
|
||||
build_cip68_datum_cbor, ft_asset_name, ref_nft_asset_name, user_nft_asset_name,
|
||||
};
|
||||
pub use derive::{derive_payment_key, derive_stake_key, PaymentKey, StakeKey};
|
||||
pub use metadata::{build_cip25_aux_data, CIP25_LABEL};
|
||||
pub use mint::{build_signed_mint, build_signed_mint_with_metadata, build_unsigned_mint, PolicySpec};
|
||||
pub use mint::{
|
||||
build_signed_cip68_nft_mint, build_signed_mint, build_signed_mint_with_metadata,
|
||||
build_unsigned_mint, PolicySpec,
|
||||
};
|
||||
pub use sign::add_witness;
|
||||
pub use tx::{
|
||||
build_signed_payment, build_signed_payment_with_assets, build_unsigned_payment,
|
||||
build_unsigned_payment_with_assets, hex_decode, AssetSpec, InputUtxo, PaymentSummary,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue