diff --git a/bin/drk/src/rpc_blockchain.rs b/bin/drk/src/rpc_blockchain.rs index 3374d3e10..ce2b7be14 100644 --- a/bin/drk/src/rpc_blockchain.rs +++ b/bin/drk/src/rpc_blockchain.rs @@ -171,8 +171,7 @@ impl Drk { let txid = serde_json::from_value(rep)?; // Store transactions history record - // FIXME: This breaks with the DAO::Exec transaction - //self.insert_tx_history_record(tx).await?; + self.insert_tx_history_record(tx).await?; Ok(txid) } diff --git a/bin/drk/src/wallet_txs_history.rs b/bin/drk/src/wallet_txs_history.rs index b794bcbdc..2c7642ff9 100644 --- a/bin/drk/src/wallet_txs_history.rs +++ b/bin/drk/src/wallet_txs_history.rs @@ -80,7 +80,7 @@ impl Drk { WALLET_TXS_HISTORY_COL_TX_HASH, QueryType::Text as u8, WALLET_TXS_HISTORY_COL_STATUS, - QueryType::Blob as u8, + QueryType::Text as u8, WALLET_TXS_HISTORY_COL_TX, ]); @@ -99,7 +99,8 @@ impl Drk { let status: String = serde_json::from_value(arr[1].clone())?; - let tx_bytes: Vec = serde_json::from_value(arr[2].clone())?; + let tx_encoded: String = serde_json::from_value(arr[2].clone())?; + let tx_bytes: Vec = bs58::decode(&tx_encoded).into_vec()?; let tx: Transaction = deserialize(&tx_bytes)?; Ok((tx_hash, status, tx)) @@ -121,8 +122,8 @@ impl Drk { tx.hash().to_string(), QueryType::Text as u8, "Broadcasted", - QueryType::Blob as u8, - serialize(tx), + QueryType::Text as u8, + bs58::encode(&serialize(tx)).into_string().to_string(), ]); let req = JsonRequest::new("wallet.exec_sql", params); diff --git a/src/contract/money/wallet.sql b/src/contract/money/wallet.sql index 108b8cee4..12c4532bc 100644 --- a/src/contract/money/wallet.sql +++ b/src/contract/money/wallet.sql @@ -50,3 +50,10 @@ CREATE TABLE IF NOT EXISTS money_aliases ( alias BLOB PRIMARY KEY NOT NULL, token_id BLOB NOT NULL ); + +CREATE TABLE IF NOT EXISTS transactions_history ( + id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, + transaction_hash TEXT UNIQUE NOT NULL, + status TEXT NOT NULL, + tx TEXT UNIQUE NOT NULL +);