@@ -26,8 +26,8 @@ use chia_puzzles::SINGLETON_LAUNCHER_HASH;
26
26
use chia_wallet_sdk:: client:: { ClientError , Peer } ;
27
27
use chia_wallet_sdk:: driver:: {
28
28
get_merkle_tree, DataStore , DataStoreMetadata , DelegatedPuzzle , Did , DidInfo , DriverError ,
29
- IntermediateLauncher , Launcher , Layer , NftMint , OracleLayer ,
30
- SpendContext , SpendWithConditions , StandardLayer , WriterLayer ,
29
+ IntermediateLauncher , Launcher , Layer , NftMint , OracleLayer , SpendContext , SpendWithConditions ,
30
+ StandardLayer , WriterLayer ,
31
31
} ;
32
32
// Import proof types from our own crate's rust module
33
33
use crate :: rust:: { EveProof , LineageProof , Proof } ;
@@ -1263,7 +1263,7 @@ pub async fn mint_nft(
1263
1263
did_string : & str ,
1264
1264
recipient_puzzle_hash : Bytes32 ,
1265
1265
metadata : NftMetadata ,
1266
- royalty_puzzle_hash : Option < Bytes32 > ,
1266
+ _royalty_puzzle_hash : Option < Bytes32 > ,
1267
1267
royalty_basis_points : u16 ,
1268
1268
fee : u64 ,
1269
1269
network : TargetNetwork ,
@@ -1287,19 +1287,21 @@ pub async fn mint_nft(
1287
1287
} ;
1288
1288
1289
1289
// Create the DID singleton info (simplified DID structure)
1290
- let did_info = DidInfo :: new ( did_coin. coin_id ( ) , None , 1 , vec ! [ ] , synthetic_key. derive_synthetic ( ) . to_bytes ( ) . into ( ) ) ;
1290
+ // Use the first 32 bytes of the public key (truncate from 48 to 32 bytes)
1291
+ let public_key_bytes = synthetic_key. derive_synthetic ( ) . to_bytes ( ) ;
1292
+ let mut public_key_hash = [ 0u8 ; 32 ] ;
1293
+ public_key_hash. copy_from_slice ( & public_key_bytes[ ..32 ] ) ;
1294
+ let did_info: DidInfo < Vec < u8 > > =
1295
+ DidInfo :: new ( did_coin. coin_id ( ) , None , 1 , vec ! [ ] , public_key_hash. into ( ) ) ;
1291
1296
1292
1297
let did = Did :: new ( did_coin, did_proof, did_info) ;
1293
1298
1294
1299
// Create StandardLayer for spending coins
1295
1300
let p2 = StandardLayer :: new ( synthetic_key) ;
1296
1301
1297
- // Allocate metadata
1298
- let metadata_ptr = ctx. alloc ( & metadata) ?;
1299
-
1300
- // Create the NFT mint configuration
1302
+ // Create the NFT mint configuration with metadata
1301
1303
let nft_mint = NftMint :: new (
1302
- metadata_ptr ,
1304
+ metadata ,
1303
1305
recipient_puzzle_hash,
1304
1306
royalty_basis_points,
1305
1307
None , // No DID owner for now - we'll set this up differently
@@ -1321,7 +1323,7 @@ pub async fn mint_nft(
1321
1323
return Err ( WalletError :: Parse ) ; // Not enough coins
1322
1324
}
1323
1325
1324
- let change = total_input - total_needed;
1326
+ let _change = total_input - total_needed;
1325
1327
let change_puzzle_hash = StandardArgs :: curry_tree_hash ( synthetic_key) . into ( ) ;
1326
1328
1327
1329
// Spend the selected coins
@@ -1589,8 +1591,14 @@ pub async fn resolve_did_string_and_generate_proof(
1589
1591
let launcher_puzzle = launcher_spend. puzzle . to_clvm ( & mut allocator) ?;
1590
1592
let launcher_solution = launcher_spend. solution . to_clvm ( & mut allocator) ?;
1591
1593
1592
- let output = clvmr:: run_program ( & mut allocator, & clvmr:: ChiaDialect :: new ( 0 ) , launcher_puzzle, launcher_solution, u64:: MAX )
1593
- . map_err ( |_| WalletError :: Clvm ) ?;
1594
+ let output = clvmr:: run_program (
1595
+ & mut allocator,
1596
+ & clvmr:: ChiaDialect :: new ( 0 ) ,
1597
+ launcher_puzzle,
1598
+ launcher_solution,
1599
+ u64:: MAX ,
1600
+ )
1601
+ . map_err ( |_| WalletError :: Clvm ) ?;
1594
1602
1595
1603
let conditions =
1596
1604
Vec :: < Condition > :: from_clvm ( & allocator, output. 1 ) . map_err ( |_| WalletError :: Parse ) ?;
@@ -1650,8 +1658,14 @@ pub async fn resolve_did_string_and_generate_proof(
1650
1658
let spend_puzzle = spend. puzzle . to_clvm ( & mut allocator) ?;
1651
1659
let spend_solution = spend. solution . to_clvm ( & mut allocator) ?;
1652
1660
1653
- let spend_output = clvmr:: run_program ( & mut allocator, & clvmr:: ChiaDialect :: new ( 0 ) , spend_puzzle, spend_solution, u64:: MAX )
1654
- . map_err ( |_| WalletError :: Clvm ) ?;
1661
+ let spend_output = clvmr:: run_program (
1662
+ & mut allocator,
1663
+ & clvmr:: ChiaDialect :: new ( 0 ) ,
1664
+ spend_puzzle,
1665
+ spend_solution,
1666
+ u64:: MAX ,
1667
+ )
1668
+ . map_err ( |_| WalletError :: Clvm ) ?;
1655
1669
1656
1670
let spend_conditions = Vec :: < Condition > :: from_clvm ( & allocator, spend_output. 1 )
1657
1671
. map_err ( |_| WalletError :: Parse ) ?;
0 commit comments