These docs are for v2.0. Click to read the latest docs for v3.0.

Discussions

Ask a Question
Back to All

How to get all out going payments of a specific address

platform: "nodejs"
lib: "xrpl - ^2.5.0"

I'm trying to print out all transactions made by a specific account but its showing 2 transactions even though I only sent one. I understand some what that there is in essence outgoing and incoming transactions.

  • from my source code what changes are needed to filter the sending account to show all outgoing transactions?
  • why am I seeing 2 transactions?
  • do i just need to filter by account? but then how do I differentiate the direction?

thanks,

sedo:

  1. connect
  2. create and fund sender and recipient
  3. submitAndWait for transaction
  4. request "account_tx"

full code:
`
const TESTNET_SERVER = 'wss://s.altnet.rippletest.net:51233'

// Define the network client
const client = new xrpl.Client(TESTNET_SERVER)
await client.connect()

// Derive a wallet from a bip39 Mnemonic - cold address - issuer
const senderWallet = xrpl.Wallet.fromMnemonic(getMnemonic())
await client.fundWallet(senderWallet)

// Derive a wallet from a bip39 Mnemonic - hot address - regular user's address
const recipientWallet = xrpl.Wallet.fromMnemonic(getMnemonic())
await client.fundWallet(recipientWallet)

var result = await transfer(client, senderWallet, recipientWallet)
// Check transaction results -------------------------------------------------
console.log("Transaction result:", result)

 const tx_response = await client.request({
    "command": "account_tx",
    "account": senderWallet.address,
    "validated": true
})
console.log(tx_response)
console.log( '*************************' )
console.log(tx_response.result.transactions)

// Disconnect when done (If you omit this, Node.js won't end the process)
client.disconnect()

`

output:

`
Transaction result: tesSUCCESS
{
id: 21,
result: {
account: 'rD9zvrG9G62UtzZtaUteaENTV7SgEdJqof',
ledger_index_max: 32544985,
ledger_index_min: 32476837,
limit: 0,
transactions: [ [Object], [Object] ],
validated: true
},
type: 'response'
}


[
{
meta: {
AffectedNodes: [Array],
TransactionIndex: 3,
TransactionResult: 'tesSUCCESS',
delivered_amount: '1000000'
},
tx: {
Account: 'rfTxspF3GiroFd3Hfay2Th92kfVthDPenP',
Amount: '1000000',
Destination: 'rD9zvrG9G62UtzZtaUteaENTV7SgEdJqof',
Fee: '12',
Flags: 0,
LastLedgerSequence: 32545003,
Sequence: 32544980,
SigningPubKey: '03315108259B667674B193C51691F16901BE10783BD612A8343FED94EB56FBFC25',
TransactionType: 'Payment',
TxnSignature: '304402207D8263B69C2C08AF06A1AD84C14055655DA0DFF2106B91AE3C33CD70365ABFE3022000E71A788AD60A451CC7D6E438CF029AA474087632627C07F59E0CB735DFD7ED',
date: 720772413,
hash: 'CF091E1871A1972EC9FC8252E4AD9D3C40893F2CA3B3B821B3D56D2E77B1688C',
inLedger: 32544985,
ledger_index: 32544985
},
validated: true
},
{
meta: {
AffectedNodes: [Array],
TransactionIndex: 1,
TransactionResult: 'tesSUCCESS',
delivered_amount: '1000000000'
},
tx: {
Account: 'rPT1Sjq2YGrBMTttX4GZHjKu9dyfzbpAYe',
Amount: '1000000000',
Destination: 'rD9zvrG9G62UtzZtaUteaENTV7SgEdJqof',
Fee: '12',
Flags: 2147483648,
LastLedgerSequence: 32544986,
Sequence: 4414467,
SigningPubKey: '02356E89059A75438887F9FEE2056A2890DB82A68353BE9C0C0C8F89C0018B37FC',
TransactionType: 'Payment',
TxnSignature: '304402203EC0CEF2BEDDBEFA3093E5F9E951A55C514A780C06AD3A560BCEB1E9535E2F2602207E807454B35CC278D4437285DD457A0743145E5DE0702617BF5AA64CEDA0FED5',
date: 720772411,
hash: 'B36F8491C4235EF137E243DFF8A3273BE3FED544217B346D51DEF4AA7AF791C6',
inLedger: 32544983,
ledger_index: 32544983
},
validated: true
}
]
`