npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@stellar-expert/tx-meta-effects-parser

v6.3.1

Published

Low-level effects parser for Stellar transaction results and meta XDR

Downloads

137

Readme

@stellar-expert/tx-meta-effects-parser

Low-level effects parser for Stellar transaction results and meta XDR

Some Stellar operations yield non-deterministic results, so developers often have to pull the data from Horizon /effects API endpoints. This package provides the ability to retrieve atomic ledger state modifications directly from the transaction execution result and metadata.

Installation

npm i @stellar-expert/tx-meta-effects-parser

Usage

const {parseTxOperationsMeta} = require('@stellar-expert/tx-meta-effects-parser')

const res = parseTxOperationsMeta({
    network: 'Public Global Stellar Network ; September 2015',
    tx: '_base64-encoded_transaction_envelope_XDR_', // trasnaction envelope XDR
    result: '_base64-encoded_transaction_result_XDR_', // trasnaction result XDR
    meta: '_base64-encoded_transaction_result_meta_XDR_', // trasnaction meta XDR
    processSystemEvents: false, // whether to analyze system Soroban diagnostic events
    mapSac: false, // whether to map Classic assets to Soroban contracts automatically
    processFailedOpEffects: false, // whether to analyze effects in failed transactions
    protocol: 21 // different versions of Stelalr protocol may yield uninform effects  
})

console.log(res.effects)
console.log(res.operations[0].effects)

Example:

parseTxOperationsMeta({
    network: 'Public Global Stellar Network ; September 2015',
    tx: 'AAAAAgAAAABU95GyQJbC5BUk8MOfuB2kGJMPNikp/uVdnGQ9ALDarAAAJxAAAJvZAAAAAQAAAAEAAAAAAAAAAAAAAABjnO8XAAAAAAAAAAEAAAABAAAAAGwpaFzT4YYOFQorR1hvkzU9himxtEbBMKbb/qeCkpPhAAAACAAAAABU95GyQJbC5BUk8MOfuB2kGJMPNikp/uVdnGQ9ALDarAAAAAAAAAACALDarAAAAED9Omj2K+pvRUV6jGicOlyZ7F5Jg82yj6rK0VKPSo8eOlfAkJt2AfcSYhB1HUODhbgpwHryTNjJZr8HLy3H/8wFgpKT4QAAAEAqlaQs1KKyIp5/aGFg+KRyIwR2wB+UE+PoEJC7EkyK3DNET09EDWqRCTZjZlNnvAPtw+R0ZXndNsPxZtqKjnsF',
    result: 'AAAAAAAAAGQAAAAAAAAAAQAAAAAAAAAIAAAAAAAAABdIdugAAAAAAA==',
    meta: 'AAAAAgAAAAIAAAADAACb3QAAAAAAAAAAVPeRskCWwuQVJPDDn7gdpBiTDzYpKf7lXZxkPQCw2qwAAAAXSHbnnAAAm9kAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAABAACb3QAAAAAAAAAAVPeRskCWwuQVJPDDn7gdpBiTDzYpKf7lXZxkPQCw2qwAAAAXSHbnnAAAm9kAAAABAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAAAAAAwAAAAAAAJvdAAAAAGOcyAwAAAAAAAAAAQAAAAQAAAADAACb2gAAAAAAAAAAbCloXNPhhg4VCitHWG+TNT2GKbG0RsEwptv+p4KSk+EAAAAXSHboAAAAm9oAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAABsKWhc0+GGDhUKK0dYb5M1PYYpsbRGwTCm2/6ngpKT4QAAAAMAAJvdAAAAAAAAAABU95GyQJbC5BUk8MOfuB2kGJMPNikp/uVdnGQ9ALDarAAAABdIduecAACb2QAAAAEAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAADAAAAAAAAm90AAAAAY5zIDAAAAAAAAAABAACb3QAAAAAAAAAAVPeRskCWwuQVJPDDn7gdpBiTDzYpKf7lXZxkPQCw2qwAAAAukO3PnAAAm9kAAAABAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAAAAAAwAAAAAAAJvdAAAAAGOcyAwAAAAAAAAAAA=='
})

/*json
{
  effects: [
    {
      "type": "feeCharged",
      "source": "GBKPPENSICLMFZAVETYMHH5YDWSBREYPGYUST7XFLWOGIPIAWDNKYDLI",
      "asset": "XLM",
      "bid": "10000",
      "charged": "100"
    }
  ],
  operations: [
    {
      "source": "GBWCS2C42PQYMDQVBIVUOWDPSM2T3BRJWG2ENQJQU3N75J4CSKJ6DXHN",
      "type": "accountMerge",
      "destination": "GBKPPENSICLMFZAVETYMHH5YDWSBREYPGYUST7XFLWOGIPIAWDNKYDLI",
      "effects": [
        {
          "type": "accountDebited",
          "source": "GBWCS2C42PQYMDQVBIVUOWDPSM2T3BRJWG2ENQJQU3N75J4CSKJ6DXHN",
          "asset": "XLM",
          "amount": "100000000000",
          "balance": "0"
        },
        {
          "type": "accountRemoved",
          "source": "GBWCS2C42PQYMDQVBIVUOWDPSM2T3BRJWG2ENQJQU3N75J4CSKJ6DXHN"
        },
        {
          "type": "accountCredited",
          "source": "GBKPPENSICLMFZAVETYMHH5YDWSBREYPGYUST7XFLWOGIPIAWDNKYDLI",
          "asset": "XLM",
          "amount": "100000000000",
          "balance": "199999999900"
        }
      ]
    }
  ],
  "isEphemeral": false,
  "tx": {}
}
 */

All effects

{
  type: 'feeCharged',
  source: 'GBKP…YDLI',
  asset: 'XLM',
  bid: '10000',
  charged: '100'
}
{
  type: 'accountCreated',
  source: 'GBKP…YDLI',
  account: 'GBWC…DXHN'
}
{
  type: 'accountRemoved',
  source: 'GBKP…YDLI'
}
{
  type: 'accountDebited',
  source: 'GBKP…YDLI',
  asset: 'XLM',
  amount: '1000000000'
}
{
  type: 'accountCredited',
  source: 'GBWC…DXHN',
  asset: 'XLM',
  amount: '1000000000'
}
{
  type: 'accountHomeDomainUpdated',
  source: 'GBWC…DXHN',
  domain: 'example.com'
}
{
  type: 'accountThresholdsUpdated',
  source: 'GBWC…DXHN',
  thresholds: [1, 1 ,3]
}
{
  type: 'accountFlagsUpdated',
  source: 'GBWC…DXHN',
  flags: 2,
  prevFlags: 0
}
{
  type: 'accountInflationDestinationUpdated',
  source: 'GBWC…DXHN',
  inflationDestination: 'GBKP…YDLI'
}
{
  type: 'accountSignerCreated',
  source: 'GBWC…DXHN',
  signer: 'GBKP…YDLI',
  weight: 1,
  signers: [
    {key: 'GBWC…DXHN', weight: 1},
    {key: 'GBKP…YDLI', weight: 1}
  ]
}
{
  type: 'accountSignerUpdated',
  source: 'GBWC…DXHN',
  signer: 'GBKP…YDLI',
  weight: 2,
  signers: [
    {key: 'GBWC…DXHN', weight: 2},
    {key: 'GBKP…YDLI', weight: 1}
  ]
}
{
  type: 'accountSignerRemoved',
  source: 'GBWC…DXHN',
  weight: 0,
  signer: 'GBKP…YDLI',
  signers: [
    {key: 'GBWC…DXHN', weight: 1}
  ]
}
{
  type: 'trustlineCreated',
  source: 'GBWC…DXHN',
  asset: 'USD-GBKP…YDLI-1',
  kind: 'asset',
  limit: '1000000000',
  flags: 1
}
{
  type: 'trustlineUpdated',
  source: 'GBWC…DXHN',
  asset: 'USD-GBKP…YDLI-1',
  kind: 'asset',
  limit: '2000000000',
  flags: 5
}
{
  type: 'trustlineRemoved',
  source: 'GBWC…DXHN',
  asset: 'USD-GBKP…YDLI-1',
  kind: 'asset',
  flags: 4,
}
{
  type: 'trustlineAuthorizationUpdated',
  source: 'GBWC…DXHN',
  trustor: 'GBKP…YDLI',
  asset: 'USD-GBWC…DXHN-1',
  flags: 5,
  prevFlags: 2
}
{
  type: 'assetMinted',
  source: 'GBWC…DXHN',
  asset: 'USD-GBWC…DXHN-1',
  amount: '1000000000'
}
{
  type: 'assetBurned',
  source: 'GBWC…DXHN',
  asset: 'USD-GBWC…DXHN-1',
  amount: '2000000000'
}
{
  type: 'offerCreated',
  source: 'GBWC…DXHN',
  offer: '90427',
  owner: 'GBWC…DXHN',
  amount: '1000000000',
  asset: [
    'USD-GBKP…YDLI-1',
    'XLM'
  ],
  price: 0.09215,
  flags: 0
}
{
  type: 'offerUpdated',
  source: 'GBWC…DXHN',
  offer: '90427',
  owner: 'GBWC…DXHN',
  amount: '900000000',
  asset: [
    'USD-GBKP…YDLI-1',
    'XLM'
  ],
  price: 0.09215,
  flags: 0
}
{
  type: 'offerRemoved',
  source: 'GBWC…DXHN',
  offer: '90427',
  owner: 'GBWC…DXHN',
  asset: [
    'USD-GBKP…YDLI-1',
    'XLM'
  ],
  flags: 0
}
{
  type: 'liquidityPoolCreated',
  source: 'GBWC…DXHN',
  pool: '52a8…76f8',
  reserves: [
    {
      asset: 'XLM',
      amount: '0'
    },
    {
      asset: 'USD-GBKP…YDLI-1',
      amount: '0'
    }
  ],
  shares: '0',
  accounts: 1
}
{
  type: 'liquidityPoolUpdated',
  source: 'GBWC…DXHN',
  pool: '52a8…76f8',
  reserves: [
    {
      asset: 'XLM',
      amount: '10000000000'
    },
    {
      asset: 'USD-GBKP…YDLI-1',
      amount: '10000000000'
    }
  ],
  shares: '10000000000',
  accounts: 2
}
{
  type: 'liquidityPoolDeposited',
  source: 'GBWC…DXHN',
  pool: '52a8…76f8',
  assets: [
    {
      asset: 'XLM',
      amount: '10000000000'
    },
    {
      asset: 'USD-GBKP…YDLI-1',
      amount: '10000000000'
    }
  ],
  shares: '10000000000'
}
{
  type: 'liquidityPoolWithdrew',
  source: 'GBWC…DXHN',
  pool: '52a8…76f8',
  assets: [
    {
      asset: 'XLM',
      amount: '5000000000'
    },
    {
      asset: 'USD-GBKP…YDLI-1',
      amount: '5000000000'
    }
  ],
  shares: '5000000000'
}
{
  type: 'liquidityPoolRemoved',
  source: 'GBWC…DXHN',
  pool: '52a8…76f8'
}
{
  type: 'trade',
  source: 'GBWC…DXHN',
  offer: '14834',
  amount: [
    '100000000', 
    '200000000'
  ],
  asset: [
    'USD-GBKP…YDLI-1',
    'XLM'
  ],
  seller: 'GBKP…YDLI'
}
{
  type: 'dataEntryCreated',
  source: 'GBWC…DXHN',
  name: 'test',
  value: 'dGVzdA=='
}
{
  type: 'dataEntryUpdated',
  source: 'GBWC…DXHN',
  name: 'test',
  value: 'dGVzVA=='
}
{
  type: 'dataEntryRemoved',
  source: 'GBWC…DXHN',
  name: 'test'
}
{
  type: 'sequenceBumped',
  source: 'GBWC…DXHN',
  sequence: '9223372036854775707'
}
{
  type: 'inflation',
  source: 'GBWC…DXHN'
}
{
  type: 'claimableBalanceCreated',
  source: 'GBWC…DXHN',
  sponsor: 'GBWC…DXHN',
  balance: '7aba…6f9d',
  asset: 'XLM',
  amount: '1000000000',
  claimants: [
    {
      destination: 'GBKP…YDLI',
      predicate: {
        absBefore: '1671220240580'
      }
    }
  ]
}
{
  type: 'claimableBalanceRemoved',
  source: 'GBKP…YDLI',
  sponsor: 'GBWC…DXHN',
  balance: '7aba…6f9d',
  asset: 'XLM',
  amount: '1000000000',
  claimants: [
    {
      destination: 'GBKP…YDLI',
      predicate: {
        absBefore: '1671220240580'
      }
    }
  ]
}
{
  type: 'accountSponsorshipCreated',
  source: 'GBWC…DXHN',
  sponsor: 'GBWC…DXHN',
  account: 'GBKP…YDLI'
}
{
  type: 'accountSponsorshipUpdated',
  source: 'GBWC…DXHN',
  sponsor: 'GDNP…CMXH',
  prevSponsor: 'GBWC…DXHN',
  account: 'GBKP…YDLI'
}
{
  type: 'accountSponsorshipRemoved',
  source: 'GBWC…DXHN',
  prevSponsor: 'GBWC…DXHN',
  account: 'GBKP…YDLI'
}
{
  type: 'trustlineSponsorshipCreated',
  source: 'GBWC…DXHN',
  sponsor: 'GBWC…DXHN',
  account: 'GBKP…YDLI',
  asset: 'USD-GBKP…YDLI-1'
}
{
  type: 'trustlineSponsorshipUpdated',
  source: 'GBWC…DXHN',
  sponsor: 'GDNP…CMXH',
  prevSponsor: 'GBWC…DXHN',
  account: 'GBKP…YDLI',
  asset: 'USD-GBKP…YDLI-1'
}
{
  type: 'trustlineSponsorshipRemoved',
  source: 'GBWC…DXHN',
  prevSponsor: 'GBWC…DXHN',
  account: 'GBKP…YDLI',
  asset: 'USD-GBKP…YDLI-1'
}
{
  type: 'offerSponsorshipCreated',
  source: 'GBWC…DXHN',
  sponsor: 'GBWC…DXHN',
  account: 'GBKP…YDLI',
  offer: '4523452'
}
{
  type: 'offerSponsorshipUpdated',
  source: 'GBWC…DXHN',
  sponsor: 'GDNP…CMXH',
  prevSponsor: 'GBWC…DXHN',
  account: 'GBKP…YDLI',
  offer: '4523452'
}
{
  type: 'offerSponsorshipRemoved',
  source: 'GBWC…DXHN',
  prevSponsor: 'GBWC…DXHN',
  account: 'GBKP…YDLI',
  offer: '4523452'
}
{
  type: 'dataSponsorshipCreated',
  source: 'GBWC…DXHN',
  sponsor: 'GBWC…DXHN',
  account: 'GBKP…YDLI',
  name: 'name'
}
{
  type: 'dataSponsorshipUpdated',
  source: 'GBWC…DXHN',
  sponsor: 'GDNP…CMXH',
  prevSponsor: 'GBWC…DXHN',
  account: 'GBKP…YDLI',
  name: 'name'
}
{
  type: 'dataSponsorshipRemoved',
  source: 'GBWC…DXHN',
  prevSponsor: 'GBWC…DXHN',
  account: 'GBKP…YDLI',
  name: 'name'
}
{
  type: 'claimableBalanceSponsorshipCreated',
  source: 'GBWC…DXHN',
  sponsor: 'GBWC…DXHN',
  balance: '7aba…6f9d'
}
{
  type: 'claimableBalanceSponsorshipUpdated',
  source: 'GBWC…DXHN',
  sponsor: 'GDNP…CMXH',
  prevSponsor: 'GBWC…DXHN',
  balance: '7aba…6f9d'
}
{
  type: 'claimableBalanceSponsorshipRemoved',
  source: 'GBWC…DXHN',
  prevSponsor: 'GBWC…DXHN',
  balance: '7aba…6f9d'
}
{
  type: 'signerSponsorshipCreated',
  source: 'GBWC…DXHN',
  sponsor: 'GBWC…DXHN',
  signer: 'GALF…CR2V',
  account: 'GBKP…YDLI'
}
{
  type: 'signerSponsorshipUpdated',
  source: 'GBWC…DXHN',
  sponsor: 'GDNP…CMXH',
  prevSponsor: 'GBWC…DXHN',
  signer: 'GALF…CR2V',
  account: 'GBKP…YDLI'
}
{
  type: 'signerSponsorshipRemoved',
  source: 'GBWC…DXHN',
  prevSponsor: 'GBWC…DXHN',
  signer: 'GALF…CR2V',
  account: 'GBKP…YDLI'
}
{
  type: 'liquidityPoolSponsorshipCreated',
  source: 'GBWC…DXHN',
  sponsor: 'GBWC…DXHN'
}
{
  type: 'liquidityPoolSponsorshipUpdated',
  source: 'GBWC…DXHN',
  sponsor: 'GDNP…CMXH',
  prevSponsor: 'GBWC…DXHN'
}
{
  type: 'liquidityPoolSponsorshipRemoved',
  source: 'GBWC…DXHN',
  prevSponsor: 'GBWC…DXHN'
}
{
  type: 'contractCodeUploaded',
  source: 'GBWC…DXHN',
  wasm: 'AGFz…AAAF',
  wasmHash: '5c55…e46d',
  keyHash: 'a833…f27f'
}
{
  type: 'contractCodeRemoved',
  source: 'GBWC…DXHN',
  wasmHash: '5c55…e46d',
  keyHash: 'a833…f27f'
}
{
  type: 'contractCreated',
  source: 'GBWC…DXHN',
  contract: 'CBIH…AZAD',
  kind: 'fromAsset',
  asset: 'ICGVCWUQXIHO-GBD2…FUAC-2'
}
{
  type: 'contractUpdated',
  source: 'GBWC…DXHN',
  contract: 'CBIH…AZAD',
  kind: 'wasm',
  wasmHash: '5c55…e46d',
  prevWasmHash: 'eb94…19ae'

}
{
  type: 'contractInvoked',
  source: 'GBWC…DXHN',
  contract: 'CBIH…AZAD',
  function: 'mint',
  rawArgs: 'AAAA…Ag==',
  depth: 1,
  args: [
    'CDFD…ITT3',
    '1000'
  ]
}
{
  type: 'contractError',
  source: 'GB6V…UIYN',
  contract: 'CBIH…AZAD',
  code: 13,
  details: [
    'trustline entry is missing for account',
    'GB6V…UIYN'
  ]
}
{
  type: 'contractDataCreated',
  source: 'GC3E…XMJY',
  owner: 'CCM3…OFJX',
  key: 'AAAA…0SQ=',
  value: 'AAAA…AA==',
  durability: 'persistent',
  keyHash: '2177…a56a'
}
{
  type: 'contractDataUpdated',
  source: 'GC3E…XMJY',
  owner: 'CCM3…OFJX',
  key: 'AAAAFA==',
  value: 'AAAA…AA==',
  prevValue: 'AAAA…AAA=',
  durability: 'persistent',
  keyHash: '2177…a56a'
}
{
  type: 'contractDataRemoved',
  source: 'GC3E…XMJY',
  owner: 'CCM3…OFJX',
  key: 'AAAAFA==',
  prevValue: 'AAAA…AAA=',
  durability: 'instance'
}
{
  type: 'contractEvent',
  source: 'GC3E…XMJY',
  contract: 'CCM3…OFJX',
  topics: [
    'mint',
    'GC3E…XMJY',
    'CDFD…ITT3',
    'AMDL:GC3E…XMJY'
  ],
  rawTopics: [
    'AAAA…aW50',
    'AAAA…gLs=',
    'AAAA…JA==',
    'AAAA…AAAA'
  ],
  data: '1000',
  rawData: 'AAAA…A+g='
}
{
  type: 'contractMetrics',
  source: 'GC3E…XMJY',
  contract: 'CCM3…OFJX',
  cpu_insn: 25470499,
  emit_event: 5,
  emit_event_byte: 1176,
  invoke_time_nsecs: 2013675,
  ledger_read_byte: 36624,
  ledger_write_byte: 1028,
  max_emit_event_byte: 328,
  max_rw_code_byte: 16352,
  max_rw_data_byte: 924,
  max_rw_key_byte: 160,
  mem_byte: 10204502,
  read_code_byte: 33508,
  read_data_byte: 3116,
  read_entry: 16,
  read_key_byte: 1244,
  write_code_byte: 0,
  write_data_byte: 1028,
  write_entry: 5,
  write_key_byte: 0,
  fee: {
    nonrefundable: 284210,
    refundable: 100521,
    rent: 100481
  }
}
{
  type: 'setTtl',
  source: 'GC3E…XMJY',
  owner: 'CDAE…EH7T',
  kind: 'contractData',
  keyHash: '7594…b429',
  ttl: 2873856
}