@stellar-expert/tx-meta-effects-parser 7.0.0-rc.14 → 7.0.0-rc.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stellar-expert/tx-meta-effects-parser",
3
- "version": "7.0.0-rc.14",
3
+ "version": "7.0.0-rc.16",
4
4
  "description": "Low-level effects parser for Stellar transaction results and meta XDR",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
package/src/index.js CHANGED
@@ -140,7 +140,6 @@ function parseTxOperationsMeta({
140
140
  const metaValue = meta.value()
141
141
  const opMeta = metaValue.operations()
142
142
  const isV4Meta = meta.arm() === 'v4'
143
- let txEvents = isV4Meta ? metaValue.events() : undefined
144
143
 
145
144
  //analyze operation effects for each operation
146
145
  for (let i = 0; i < parsedTx.operations.length; i++) {
@@ -13,19 +13,22 @@ const {generateContractStateEntryHash, generateContractCodeEntryHash} = require(
13
13
 
14
14
  /**
15
15
  * @param {LedgerEntryChange[]} ledgerEntryChanges
16
+ * @param {Set<string>} [filter]
16
17
  * @return {ParsedLedgerEntryMeta[]}
17
18
  */
18
- function parseLedgerEntryChanges(ledgerEntryChanges) {
19
+ function parseLedgerEntryChanges(ledgerEntryChanges, filter = undefined) {
19
20
  const changes = []
20
21
  let state
21
22
  let containsTtl = false
22
23
  for (let i = 0; i < ledgerEntryChanges.length; i++) {
23
24
  const entry = ledgerEntryChanges[i]
25
+ const type = entry._value._arm
26
+ if (filter && !filter.has(type)) //skip filtered ledger entry types
27
+ continue
24
28
  const action = entry._arm
25
29
  const stateData = parseEntry(entry, action)
26
30
  if (stateData === undefined)
27
31
  continue
28
- const type = entry._value._arm
29
32
  const change = {action, type}
30
33
  switch (action) {
31
34
  case 'state':
@@ -231,13 +234,15 @@ function parseLiquidityPoolEntry(value) {
231
234
 
232
235
  function parseOfferEntry(value) {
233
236
  const offerEntryXdr = value.value()
237
+ const rprice = offerEntryXdr.price()
234
238
  const data = {
235
239
  entry: 'offer',
236
240
  id: offerEntryXdr.offerId().toString(),
237
241
  account: xdrParseAccountAddress(offerEntryXdr.sellerId()),
238
242
  asset: [xdrParseAsset(offerEntryXdr.selling()), xdrParseAsset(offerEntryXdr.buying())],
239
243
  amount: offerEntryXdr.amount().toString(),
240
- price: xdrParsePrice(offerEntryXdr.price()),
244
+ price: xdrParsePrice(rprice),
245
+ rprice,
241
246
  flags: offerEntryXdr.flags()
242
247
  }
243
248
  return data