From b299099043f1e3014a4694dec6a054831bdc486c Mon Sep 17 00:00:00 2001 From: Yak Date: Wed, 18 Sep 2024 19:19:31 -0300 Subject: [PATCH] commit --- index.d.ts | 1 + src/lib.rs | 6 ++++++ src/wallet.rs | 4 ++-- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/index.d.ts b/index.d.ts index a34611c..7c9d311 100644 --- a/index.d.ts +++ b/index.d.ts @@ -190,6 +190,7 @@ export declare function selectCoins(allCoins: Array, totalAmount: bigint): export interface Output { puzzleHash: Buffer amount: bigint + memos: Array } /** * Sends XCH to a given set of puzzle hashes. diff --git a/src/lib.rs b/src/lib.rs index 83c42f6..0d3313b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -731,6 +731,7 @@ pub fn select_coins(all_coins: Vec, total_amount: BigInt) -> napi::Result< pub struct Output { pub puzzle_hash: Buffer, pub amount: BigInt, + pub memos: Vec, } /// Sends XCH to a given set of puzzle hashes. @@ -752,6 +753,11 @@ pub fn send_xch( items.push(( RustBytes32::from_js(output.puzzle_hash)?, u64::from_js(output.amount)?, + output + .memos + .into_iter() + .map(RustBytes::from_js) + .collect::>>()?, )); } diff --git a/src/wallet.rs b/src/wallet.rs index 007566c..7d5651c 100644 --- a/src/wallet.rs +++ b/src/wallet.rs @@ -193,7 +193,7 @@ fn spend_coins_together( pub fn send_xch( synthetic_key: PublicKey, coins: &[Coin], - outputs: &[(Bytes32, u64)], + outputs: &[(Bytes32, u64, Vec)], fee: u64, ) -> Result, WalletError> { let mut ctx = SpendContext::new(); @@ -202,7 +202,7 @@ pub fn send_xch( let mut total_amount = fee; for output in outputs { - conditions = conditions.create_coin(output.0, output.1, Vec::new()); + conditions = conditions.create_coin(output.0, output.1, output.2.clone()); total_amount += output.1; }