feat(txsHistory): add field receivedTime
This commit is contained in:
parent
ec2a0ecd8a
commit
7fe98256d2
11 changed files with 93 additions and 41 deletions
18
Cargo.lock
generated
18
Cargo.lock
generated
|
@ -757,7 +757,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "duniter-bc-reader"
|
name = "duniter-bc-reader"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://git.duniter.org/nodes/rust/duniter-core#df4fa9e073efd91a9acbc7391fec5fc35c5e9872"
|
source = "git+https://git.duniter.org/nodes/rust/duniter-core#4f26e9e6f687f2c42adf7027bebb34f4ed58e600"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"dubp",
|
"dubp",
|
||||||
|
@ -803,7 +803,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "duniter-conf"
|
name = "duniter-conf"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://git.duniter.org/nodes/rust/duniter-core#df4fa9e073efd91a9acbc7391fec5fc35c5e9872"
|
source = "git+https://git.duniter.org/nodes/rust/duniter-core#4f26e9e6f687f2c42adf7027bebb34f4ed58e600"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"dubp",
|
"dubp",
|
||||||
|
@ -817,7 +817,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "duniter-core"
|
name = "duniter-core"
|
||||||
version = "1.8.1"
|
version = "1.8.1"
|
||||||
source = "git+https://git.duniter.org/nodes/rust/duniter-core#df4fa9e073efd91a9acbc7391fec5fc35c5e9872"
|
source = "git+https://git.duniter.org/nodes/rust/duniter-core#4f26e9e6f687f2c42adf7027bebb34f4ed58e600"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"duniter-bc-reader",
|
"duniter-bc-reader",
|
||||||
"duniter-conf",
|
"duniter-conf",
|
||||||
|
@ -830,7 +830,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "duniter-dbs"
|
name = "duniter-dbs"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://git.duniter.org/nodes/rust/duniter-core#df4fa9e073efd91a9acbc7391fec5fc35c5e9872"
|
source = "git+https://git.duniter.org/nodes/rust/duniter-core#4f26e9e6f687f2c42adf7027bebb34f4ed58e600"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"arrayvec",
|
"arrayvec",
|
||||||
"bincode",
|
"bincode",
|
||||||
|
@ -853,7 +853,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "duniter-dbs-write-ops"
|
name = "duniter-dbs-write-ops"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://git.duniter.org/nodes/rust/duniter-core#df4fa9e073efd91a9acbc7391fec5fc35c5e9872"
|
source = "git+https://git.duniter.org/nodes/rust/duniter-core#4f26e9e6f687f2c42adf7027bebb34f4ed58e600"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chrono",
|
"chrono",
|
||||||
"dubp",
|
"dubp",
|
||||||
|
@ -868,7 +868,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "duniter-global"
|
name = "duniter-global"
|
||||||
version = "1.8.1"
|
version = "1.8.1"
|
||||||
source = "git+https://git.duniter.org/nodes/rust/duniter-core#df4fa9e073efd91a9acbc7391fec5fc35c5e9872"
|
source = "git+https://git.duniter.org/nodes/rust/duniter-core#4f26e9e6f687f2c42adf7027bebb34f4ed58e600"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-rwlock",
|
"async-rwlock",
|
||||||
"dubp",
|
"dubp",
|
||||||
|
@ -999,7 +999,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "duniter-mempools"
|
name = "duniter-mempools"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://git.duniter.org/nodes/rust/duniter-core#df4fa9e073efd91a9acbc7391fec5fc35c5e9872"
|
source = "git+https://git.duniter.org/nodes/rust/duniter-core#4f26e9e6f687f2c42adf7027bebb34f4ed58e600"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"dubp",
|
"dubp",
|
||||||
"duniter-bc-reader",
|
"duniter-bc-reader",
|
||||||
|
@ -1012,7 +1012,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "duniter-module"
|
name = "duniter-module"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://git.duniter.org/nodes/rust/duniter-core#df4fa9e073efd91a9acbc7391fec5fc35c5e9872"
|
source = "git+https://git.duniter.org/nodes/rust/duniter-core#4f26e9e6f687f2c42adf7027bebb34f4ed58e600"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"async-mutex",
|
"async-mutex",
|
||||||
|
@ -1558,7 +1558,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "kv_typed"
|
name = "kv_typed"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://git.duniter.org/nodes/rust/duniter-core#df4fa9e073efd91a9acbc7391fec5fc35c5e9872"
|
source = "git+https://git.duniter.org/nodes/rust/duniter-core#4f26e9e6f687f2c42adf7027bebb34f4ed58e600"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"byteorder",
|
"byteorder",
|
||||||
"cfg-if 0.1.10",
|
"cfg-if 0.1.10",
|
||||||
|
|
|
@ -49,7 +49,7 @@ use duniter_core::dbs::{
|
||||||
cm_v1::CmV1DbReadable,
|
cm_v1::CmV1DbReadable,
|
||||||
txs_mp_v2::TxsMpV2DbReadable,
|
txs_mp_v2::TxsMpV2DbReadable,
|
||||||
},
|
},
|
||||||
BlockMetaV2,
|
BlockMetaV2, PendingTxDbV2,
|
||||||
};
|
};
|
||||||
use duniter_core::dbs::{
|
use duniter_core::dbs::{
|
||||||
kv_typed::prelude::*, HashKeyV2, PubKeyKeyV2, SourceAmountValV2, UtxoIdDbV2,
|
kv_typed::prelude::*, HashKeyV2, PubKeyKeyV2, SourceAmountValV2, UtxoIdDbV2,
|
||||||
|
@ -149,7 +149,7 @@ pub trait DbsReader {
|
||||||
&self,
|
&self,
|
||||||
txs_mp_db_ro: &TxsMpDb,
|
txs_mp_db_ro: &TxsMpDb,
|
||||||
pubkey: PublicKey,
|
pubkey: PublicKey,
|
||||||
) -> KvResult<(Vec<TransactionDocumentV10>, Vec<TransactionDocumentV10>)>;
|
) -> KvResult<(Vec<PendingTxDbV2>, Vec<PendingTxDbV2>)>;
|
||||||
fn idty(
|
fn idty(
|
||||||
&self,
|
&self,
|
||||||
bc_db: &BcV2DbRo<FileBackend>,
|
bc_db: &BcV2DbRo<FileBackend>,
|
||||||
|
@ -302,7 +302,7 @@ impl DbsReader for DbsReaderImpl {
|
||||||
&self,
|
&self,
|
||||||
txs_mp_db_ro: &TxsMpDb,
|
txs_mp_db_ro: &TxsMpDb,
|
||||||
pubkey: PublicKey,
|
pubkey: PublicKey,
|
||||||
) -> KvResult<(Vec<TransactionDocumentV10>, Vec<TransactionDocumentV10>)> {
|
) -> KvResult<(Vec<PendingTxDbV2>, Vec<PendingTxDbV2>)> {
|
||||||
self.get_txs_history_mempool_(txs_mp_db_ro, pubkey)
|
self.get_txs_history_mempool_(txs_mp_db_ro, pubkey)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -341,14 +341,14 @@ impl DbsReaderImpl {
|
||||||
&self,
|
&self,
|
||||||
txs_mp_db_ro: &TxsMpDb,
|
txs_mp_db_ro: &TxsMpDb,
|
||||||
pubkey: PublicKey,
|
pubkey: PublicKey,
|
||||||
) -> KvResult<(Vec<TransactionDocumentV10>, Vec<TransactionDocumentV10>)> {
|
) -> KvResult<(Vec<PendingTxDbV2>, Vec<PendingTxDbV2>)> {
|
||||||
let sending = txs_mp_db_ro
|
let sending = txs_mp_db_ro
|
||||||
.txs_by_issuer()
|
.txs_by_issuer()
|
||||||
.get_ref_slice(&PubKeyKeyV2(pubkey), |hashs| {
|
.get_ref_slice(&PubKeyKeyV2(pubkey), |hashs| {
|
||||||
let mut sent = Vec::with_capacity(hashs.len());
|
let mut sent = Vec::with_capacity(hashs.len());
|
||||||
for hash in hashs {
|
for hash in hashs {
|
||||||
if let Some(tx_db) = txs_mp_db_ro.txs().get(HashKeyV2::from_ref(hash))? {
|
if let Some(tx_db) = txs_mp_db_ro.txs().get(HashKeyV2::from_ref(hash))? {
|
||||||
sent.push(tx_db.0);
|
sent.push(tx_db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(sent)
|
Ok(sent)
|
||||||
|
@ -360,7 +360,7 @@ impl DbsReaderImpl {
|
||||||
let mut pending = Vec::with_capacity(hashs.len());
|
let mut pending = Vec::with_capacity(hashs.len());
|
||||||
for hash in hashs {
|
for hash in hashs {
|
||||||
if let Some(tx_db) = txs_mp_db_ro.txs().get(HashKeyV2::from_ref(hash))? {
|
if let Some(tx_db) = txs_mp_db_ro.txs().get(HashKeyV2::from_ref(hash))? {
|
||||||
pending.push(tx_db.0);
|
pending.push(tx_db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(pending)
|
Ok(pending)
|
||||||
|
@ -437,8 +437,8 @@ fn txs_history_bc_collect<I: Iterator<Item = KvResult<GvaTxDbV1>>>(
|
||||||
pub struct TxsHistory {
|
pub struct TxsHistory {
|
||||||
pub sent: Vec<GvaTxDbV1>,
|
pub sent: Vec<GvaTxDbV1>,
|
||||||
pub received: Vec<GvaTxDbV1>,
|
pub received: Vec<GvaTxDbV1>,
|
||||||
pub sending: Vec<TransactionDocumentV10>,
|
pub sending: Vec<(TransactionDocumentV10, i64)>,
|
||||||
pub pending: Vec<TransactionDocumentV10>,
|
pub pending: Vec<(TransactionDocumentV10, i64)>,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Needed for BMA only
|
// Needed for BMA only
|
||||||
|
@ -484,7 +484,7 @@ pub fn get_transactions_history_for_bma<GvaDb: GvaV1DbReadable, TxsMpDb: TxsMpV2
|
||||||
let mut sent = Vec::with_capacity(hashs.len());
|
let mut sent = Vec::with_capacity(hashs.len());
|
||||||
for hash in hashs {
|
for hash in hashs {
|
||||||
if let Some(tx_db) = txs_mp_db_ro.txs().get(HashKeyV2::from_ref(hash))? {
|
if let Some(tx_db) = txs_mp_db_ro.txs().get(HashKeyV2::from_ref(hash))? {
|
||||||
sent.push(tx_db.0);
|
sent.push((tx_db.doc, tx_db.received_time));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(sent)
|
Ok(sent)
|
||||||
|
@ -496,7 +496,7 @@ pub fn get_transactions_history_for_bma<GvaDb: GvaV1DbReadable, TxsMpDb: TxsMpV2
|
||||||
let mut pending = Vec::with_capacity(hashs.len());
|
let mut pending = Vec::with_capacity(hashs.len());
|
||||||
for hash in hashs {
|
for hash in hashs {
|
||||||
if let Some(tx_db) = txs_mp_db_ro.txs().get(HashKeyV2::from_ref(hash))? {
|
if let Some(tx_db) = txs_mp_db_ro.txs().get(HashKeyV2::from_ref(hash))? {
|
||||||
pending.push(tx_db.0);
|
pending.push((tx_db.doc, tx_db.received_time));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(pending)
|
Ok(pending)
|
||||||
|
|
|
@ -78,9 +78,9 @@ pub(crate) enum TxDirection {
|
||||||
#[derive(async_graphql::SimpleObject)]
|
#[derive(async_graphql::SimpleObject)]
|
||||||
pub(crate) struct TxsHistoryMempool {
|
pub(crate) struct TxsHistoryMempool {
|
||||||
/// Transactions sending
|
/// Transactions sending
|
||||||
pub(crate) sending: Vec<TxGva>,
|
pub(crate) sending: Vec<PendingTxGva>,
|
||||||
/// Transactions receiving
|
/// Transactions receiving
|
||||||
pub(crate) receiving: Vec<TxGva>,
|
pub(crate) receiving: Vec<PendingTxGva>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, async_graphql::SimpleObject)]
|
#[derive(Clone, async_graphql::SimpleObject)]
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use super::tx_gva::TxGva;
|
use super::tx_gva::WrittenTxGva;
|
||||||
use crate::*;
|
use crate::*;
|
||||||
use dubp::block::DubpBlockV10;
|
use dubp::block::DubpBlockV10;
|
||||||
use duniter_core::dbs::BlockMetaV2;
|
use duniter_core::dbs::BlockMetaV2;
|
||||||
|
@ -103,7 +103,7 @@ pub(crate) struct Block {
|
||||||
pub excluded: Vec<String>,
|
pub excluded: Vec<String>,
|
||||||
/// Certifications
|
/// Certifications
|
||||||
pub certifications: Vec<String>,
|
pub certifications: Vec<String>,
|
||||||
pub transactions: Vec<TxGva>,
|
pub transactions: Vec<WrittenTxGva>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<&DubpBlockV10> for Block {
|
impl From<&DubpBlockV10> for Block {
|
||||||
|
|
|
@ -15,10 +15,62 @@
|
||||||
|
|
||||||
use crate::*;
|
use crate::*;
|
||||||
use dubp::documents::transaction::TransactionDocumentV10Stringified;
|
use dubp::documents::transaction::TransactionDocumentV10Stringified;
|
||||||
|
use duniter_core::dbs::PendingTxDbV2;
|
||||||
use duniter_gva_db::GvaTxDbV1;
|
use duniter_gva_db::GvaTxDbV1;
|
||||||
|
|
||||||
#[derive(async_graphql::SimpleObject)]
|
#[derive(async_graphql::SimpleObject)]
|
||||||
pub(crate) struct TxGva {
|
#[graphql(name = "PendingTx")]
|
||||||
|
pub(crate) struct PendingTxGva {
|
||||||
|
/// Version.
|
||||||
|
pub version: i32,
|
||||||
|
/// Currency.
|
||||||
|
pub currency: String,
|
||||||
|
/// Blockstamp
|
||||||
|
pub blockstamp: String,
|
||||||
|
/// Locktime
|
||||||
|
pub locktime: u64,
|
||||||
|
/// Document issuers.
|
||||||
|
pub issuers: Vec<String>,
|
||||||
|
/// Transaction inputs.
|
||||||
|
pub inputs: Vec<String>,
|
||||||
|
/// Inputs unlocks.
|
||||||
|
pub unlocks: Vec<String>,
|
||||||
|
/// Transaction outputs.
|
||||||
|
pub outputs: Vec<String>,
|
||||||
|
/// Transaction comment
|
||||||
|
pub comment: String,
|
||||||
|
/// Document signatures
|
||||||
|
pub signatures: Vec<String>,
|
||||||
|
/// Transaction hash
|
||||||
|
pub hash: String,
|
||||||
|
/// Received time
|
||||||
|
pub received_time: i64,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<&PendingTxDbV2> for PendingTxGva {
|
||||||
|
fn from(db_tx: &PendingTxDbV2) -> Self {
|
||||||
|
let tx_stringified = db_tx.doc.to_string_object();
|
||||||
|
|
||||||
|
PendingTxGva {
|
||||||
|
version: 10,
|
||||||
|
currency: tx_stringified.currency,
|
||||||
|
blockstamp: tx_stringified.blockstamp,
|
||||||
|
locktime: tx_stringified.locktime,
|
||||||
|
issuers: tx_stringified.issuers,
|
||||||
|
inputs: tx_stringified.inputs,
|
||||||
|
unlocks: tx_stringified.unlocks,
|
||||||
|
outputs: tx_stringified.outputs,
|
||||||
|
comment: tx_stringified.comment,
|
||||||
|
signatures: tx_stringified.signatures,
|
||||||
|
hash: tx_stringified.hash.unwrap_or_default(),
|
||||||
|
received_time: db_tx.received_time,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(async_graphql::SimpleObject)]
|
||||||
|
#[graphql(name = "WrittenTx")]
|
||||||
|
pub(crate) struct WrittenTxGva {
|
||||||
/// Version.
|
/// Version.
|
||||||
pub version: i32,
|
pub version: i32,
|
||||||
/// Currency.
|
/// Currency.
|
||||||
|
@ -47,23 +99,23 @@ pub(crate) struct TxGva {
|
||||||
pub written_time: Option<i64>,
|
pub written_time: Option<i64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<GvaTxDbV1> for TxGva {
|
impl From<GvaTxDbV1> for WrittenTxGva {
|
||||||
fn from(db_tx: GvaTxDbV1) -> Self {
|
fn from(db_tx: GvaTxDbV1) -> Self {
|
||||||
let mut self_: TxGva = (&db_tx.tx).into();
|
let mut self_: WrittenTxGva = (&db_tx.tx).into();
|
||||||
self_.written_block = Some(db_tx.written_block.to_string());
|
self_.written_block = Some(db_tx.written_block.to_string());
|
||||||
self_.written_time = Some(db_tx.written_time);
|
self_.written_time = Some(db_tx.written_time);
|
||||||
self_
|
self_
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<&TransactionDocumentV10> for TxGva {
|
impl From<&TransactionDocumentV10> for WrittenTxGva {
|
||||||
fn from(tx: &TransactionDocumentV10) -> Self {
|
fn from(tx: &TransactionDocumentV10) -> Self {
|
||||||
let tx_stringified = tx.to_string_object();
|
let tx_stringified = tx.to_string_object();
|
||||||
Self::from(tx_stringified)
|
Self::from(tx_stringified)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<TransactionDocumentV10Stringified> for TxGva {
|
impl From<TransactionDocumentV10Stringified> for WrittenTxGva {
|
||||||
fn from(tx_stringified: TransactionDocumentV10Stringified) -> Self {
|
fn from(tx_stringified: TransactionDocumentV10Stringified) -> Self {
|
||||||
Self {
|
Self {
|
||||||
version: 10,
|
version: 10,
|
||||||
|
|
|
@ -38,7 +38,7 @@ use crate::entities::{
|
||||||
block_gva::{Block, BlockMeta},
|
block_gva::{Block, BlockMeta},
|
||||||
idty_gva::Identity,
|
idty_gva::Identity,
|
||||||
network::{HeadGva, PeerCardGva, PeerWithHeads},
|
network::{HeadGva, PeerCardGva, PeerWithHeads},
|
||||||
tx_gva::TxGva,
|
tx_gva::{PendingTxGva, WrittenTxGva},
|
||||||
ud_gva::{CurrentUdGva, RevalUdGva, UdGva},
|
ud_gva::{CurrentUdGva, RevalUdGva, UdGva},
|
||||||
utxos_gva::UtxosGva,
|
utxos_gva::UtxosGva,
|
||||||
AggregateSum, AmountWithBase, EdgeTx, RawTxOrChanges, Sum, TxDirection, TxsHistoryMempool,
|
AggregateSum, AmountWithBase, EdgeTx, RawTxOrChanges, Sum, TxDirection, TxsHistoryMempool,
|
||||||
|
|
|
@ -26,7 +26,7 @@ impl MutationRoot {
|
||||||
&self,
|
&self,
|
||||||
ctx: &async_graphql::Context<'_>,
|
ctx: &async_graphql::Context<'_>,
|
||||||
raw_tx: String,
|
raw_tx: String,
|
||||||
) -> async_graphql::Result<TxGva> {
|
) -> async_graphql::Result<WrittenTxGva> {
|
||||||
let tx = TransactionDocumentV10::parse_from_raw_text(&raw_tx)?;
|
let tx = TransactionDocumentV10::parse_from_raw_text(&raw_tx)?;
|
||||||
|
|
||||||
let data = ctx.data::<GvaSchemaData>()?;
|
let data = ctx.data::<GvaSchemaData>()?;
|
||||||
|
@ -46,7 +46,7 @@ impl MutationRoot {
|
||||||
})
|
})
|
||||||
.await??;
|
.await??;
|
||||||
|
|
||||||
Ok(TxGva::from(&tx))
|
Ok(WrittenTxGva::from(&tx))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Process several transactions
|
/// Process several transactions
|
||||||
|
@ -55,7 +55,7 @@ impl MutationRoot {
|
||||||
&self,
|
&self,
|
||||||
ctx: &async_graphql::Context<'_>,
|
ctx: &async_graphql::Context<'_>,
|
||||||
raw_txs: Vec<String>,
|
raw_txs: Vec<String>,
|
||||||
) -> async_graphql::Result<Vec<TxGva>> {
|
) -> async_graphql::Result<Vec<WrittenTxGva>> {
|
||||||
let txs = raw_txs
|
let txs = raw_txs
|
||||||
.iter()
|
.iter()
|
||||||
.map(|raw_tx| TransactionDocumentV10::parse_from_raw_text(&raw_tx))
|
.map(|raw_tx| TransactionDocumentV10::parse_from_raw_text(&raw_tx))
|
||||||
|
@ -78,7 +78,7 @@ impl MutationRoot {
|
||||||
.map(|()| tx)
|
.map(|()| tx)
|
||||||
})
|
})
|
||||||
.await??;
|
.await??;
|
||||||
processed_txs.push(TxGva::from(&tx));
|
processed_txs.push(WrittenTxGva::from(&tx));
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(processed_txs)
|
Ok(processed_txs)
|
||||||
|
|
|
@ -55,7 +55,7 @@ impl TxsHistoryBlockchainQueryInner {
|
||||||
async fn both(
|
async fn both(
|
||||||
&self,
|
&self,
|
||||||
ctx: &async_graphql::Context<'_>,
|
ctx: &async_graphql::Context<'_>,
|
||||||
) -> async_graphql::Result<Connection<String, TxGva, EmptyFields, EdgeTx>> {
|
) -> async_graphql::Result<Connection<String, WrittenTxGva, EmptyFields, EdgeTx>> {
|
||||||
let start_time = std::time::Instant::now();
|
let start_time = std::time::Instant::now();
|
||||||
|
|
||||||
let data = ctx.data::<GvaSchemaData>()?;
|
let data = ctx.data::<GvaSchemaData>()?;
|
||||||
|
@ -146,7 +146,7 @@ impl TxsHistoryBlockchainQueryInner {
|
||||||
async fn received(
|
async fn received(
|
||||||
&self,
|
&self,
|
||||||
ctx: &async_graphql::Context<'_>,
|
ctx: &async_graphql::Context<'_>,
|
||||||
) -> async_graphql::Result<Connection<String, TxGva, EmptyFields, EmptyFields>> {
|
) -> async_graphql::Result<Connection<String, WrittenTxGva, EmptyFields, EmptyFields>> {
|
||||||
let data = ctx.data::<GvaSchemaData>()?;
|
let data = ctx.data::<GvaSchemaData>()?;
|
||||||
let db_reader = data.dbs_reader();
|
let db_reader = data.dbs_reader();
|
||||||
let pagination = self.pagination;
|
let pagination = self.pagination;
|
||||||
|
@ -181,7 +181,7 @@ impl TxsHistoryBlockchainQueryInner {
|
||||||
async fn sent(
|
async fn sent(
|
||||||
&self,
|
&self,
|
||||||
ctx: &async_graphql::Context<'_>,
|
ctx: &async_graphql::Context<'_>,
|
||||||
) -> async_graphql::Result<Connection<String, TxGva, EmptyFields, EmptyFields>> {
|
) -> async_graphql::Result<Connection<String, WrittenTxGva, EmptyFields, EmptyFields>> {
|
||||||
let data = ctx.data::<GvaSchemaData>()?;
|
let data = ctx.data::<GvaSchemaData>()?;
|
||||||
let db_reader = data.dbs_reader();
|
let db_reader = data.dbs_reader();
|
||||||
let pagination = self.pagination;
|
let pagination = self.pagination;
|
||||||
|
@ -236,11 +236,11 @@ impl TxsHistoryMempoolQuery {
|
||||||
Ok(TxsHistoryMempool {
|
Ok(TxsHistoryMempool {
|
||||||
sending: sending
|
sending: sending
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|db_tx| TxGva::from(&db_tx))
|
.map(|db_tx| PendingTxGva::from(&db_tx))
|
||||||
.collect(),
|
.collect(),
|
||||||
receiving: pending
|
receiving: pending
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|db_tx| TxGva::from(&db_tx))
|
.map(|db_tx| PendingTxGva::from(&db_tx))
|
||||||
.collect(),
|
.collect(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ impl PendingTxsSubscription {
|
||||||
async fn receive_pending_txs(
|
async fn receive_pending_txs(
|
||||||
&self,
|
&self,
|
||||||
ctx: &async_graphql::Context<'_>,
|
ctx: &async_graphql::Context<'_>,
|
||||||
) -> impl Stream<Item = async_graphql::Result<Vec<TxGva>>> {
|
) -> impl Stream<Item = async_graphql::Result<Vec<WrittenTxGva>>> {
|
||||||
create_subscription(
|
create_subscription(
|
||||||
ctx,
|
ctx,
|
||||||
|dbs| dbs.txs_mp_db.txs(),
|
|dbs| dbs.txs_mp_db.txs(),
|
||||||
|
@ -37,7 +37,7 @@ impl PendingTxsSubscription {
|
||||||
..
|
..
|
||||||
} = event
|
} = event
|
||||||
{
|
{
|
||||||
txs.push(TxGva::from(&pending_tx.0));
|
txs.push(WrittenTxGva::from(&pending_tx.doc));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if txs.is_empty() {
|
if txs.is_empty() {
|
||||||
|
|
|
@ -206,7 +206,7 @@ impl duniter_core::module::DuniterModule for GvaModule {
|
||||||
.txs()
|
.txs()
|
||||||
.get(&duniter_core::dbs::HashKeyV2(hash))?
|
.get(&duniter_core::dbs::HashKeyV2(hash))?
|
||||||
{
|
{
|
||||||
Ok(Some((tx.0, None)))
|
Ok(Some((tx.doc, None)))
|
||||||
} else if let Some(tx_db) = gva_db.txs().get(&duniter_core::dbs::HashKeyV2(hash))? {
|
} else if let Some(tx_db) = gva_db.txs().get(&duniter_core::dbs::HashKeyV2(hash))? {
|
||||||
Ok(Some((tx_db.tx, Some(tx_db.written_block.number))))
|
Ok(Some((tx_db.tx, Some(tx_db.written_block.number))))
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Reference in a new issue