Skip to content

Latest commit

 

History

History
122 lines (102 loc) · 2.56 KB

query_data_model.md

File metadata and controls

122 lines (102 loc) · 2.56 KB

Getting transactions, transfers, and outputs

Wallet transactions, transfers, and outputs can be queried by their properties using query objects.

Getting transactions with queries

See MoneroWallet.getTxs() for all query options.

// get a transaction by hash
let tx = await wallet.getTx("48db7afb1e9eecb11303d4f49c955ffdee2ffc2fa513b8f05da35ff537744096");
// get unconfirmed transactions
let txs = await wallet.getTxs({
  isConfirmed: false
});
// get transactions since height 582106 with incoming transfers to
// account 0, subaddress 0
let txs = await wallet.getTxs({
  minHeight: 582106,
  transferQuery: {
    isIncoming: true,
    accountIndex: 0,
    subaddressIndex: 1
  }
});
// get transactions with available outputs
let txs = await wallet.getTxs({
  isLocked: false,
  outputQuery: {
    isSpent: false,
  }
});

Getting transfers with queries

See MoneroWallet.getTransfers() for all query options.

// get all transfers
let transfers = await wallet.getTransfers();
// get incoming transfers to account 0, subaddress 1
let transfers = await wallet.getTransfers({
  isIncoming: true,
  accountIndex: 0,
  subaddressIndex: 1
});
// get transfers in the tx pool
let transfers = await wallet.getTransfers({
  txQuery: {
    inTxPool: true
  }
});
// get confirmed outgoing transfers since a block height
let transfers = await wallet.getTransfers({
  isIncoming: false,
  txQuery: {
    isConfirmed: true,
    minHeight: 582106,
  }
});

Getting outputs with queries

See MoneroWallet.getOutputs() for all query options.

// get all outputs
let outputs = await wallet.getOutputs();
// get outputs available to be spent
let outputs = await wallet.getOutputs({
  isSpent: false,
  txQuery: {
    isLocked: false
  }
});
// get outputs by amount
outputs = await wallet.getOutputs({
  amount: 250000000000n
});
// get outputs received to a specific subaddress
let outputs = await wallet.getOutputs({
  accountIndex: 0,
  subaddressIndex: 1
});
// get outputs by their key image hex
let keyImage = outputs[0].getKeyImage().getHex();
outputs = await wallet.getOutputs({
  keyImage: keyImage
});