Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
tx-mutation-parser
Advanced tools
Parse XRPL transaction to context aware object for visual representation
tx-mutation-parser
Parse XRPL transaction to context aware object for visual representation. It takes a XRPL transaction (outcome, meta) and an XRPL account. The XRPL account is the context from which the XPRL transaction is to be interpreted.
The account can be the sender, recipient, or an intermediate account. An intermediate account applies if e.g. there's a trade happening, touching your own offer asynchronously. You put up an offer and at some point down the road it gets (possibly partially) consumed. Alternatively, you can be an Intermediate account if you are a regular key signer or if something is rippling through your account.
The lib. then parses everything, performs all logic (include fee or not, etc.) and returns an object that is ready for use in e.g. an event list, or transaction details view, with all relevant objects parsed & calculated.
This package can be used in Node/Typescript projects (tx-mutation-parser
) or used (browserified) in the browser.
Origin: https://github.com/XRPL-Labs/XUMM-Issue-Tracker/issues/341
const xrplTx = {}; // Full XRPL transaction, containing Account, Destination, meta, etc.)
const parsedTx = TxMutationParser("r...", xrplTx);
console.log(parsedTx);
A sample response object (see src/types.ts
):
{
self: {
account: 'rwietsevLFg8XSmG3bEZzFein1g8RBqWDZ',
balanceChanges: [ [Object], [Object] ]
},
type: 'TRADE',
eventList: {
primary: { ... },
secondary: { ... },
},
eventFlow: {
start: {
account: 'rXUMMaPpZqPutoRszR29jtC8amWq3APkx',
mutation: [Object]
},
intermediate: {
account: 'rwietsevLFg8XSmG3bEZzFein1g8RBqWDZ',
mutations: [Object]
},
end: {
account: 'richard43NZXStHcjJi2UB8LGDQGFLKNs',
mutation: [Object]
}
},
allBalanceChanges: {
rXUMMaPpZqPutoRszR29jtC8amWq3APkx: [ [Object], [Object] ],
rwietsevLFg8XSmG3bEZzFein1g8RBqWDZ: [ [Object], [Object] ],
richard43NZXStHcjJi2UB8LGDQGFLKNs: [ [Object] ]
}
}
You can clone this repository and run:
npm run install
to install dependenciesnpm run build
to build the source codenpm run browserify
to browserify this lib.Now the dist/browser.js
file will exist, for you to use in a browser.
Alternatively you can get a prebuilt / prebuilt & minified version from Github.
Sample: jsfiddle.net/WietseWind/5937ykmx
eventList
, e.g. a list with transactions belonging to the context account)If no balance changes to your context account applied: empty. If only one relevant change (e.g. payment in / out): only the eventList.primary
object exists. If a trade happened and your account both sent and received / exchanged something, the eventList.primary
object is the main balance change. For reference, the eventList.secondary
value can be displayed as well.
A common scenario where the eventList
is completely empty, is if your context account is eg. the account an issued currency
rippled through, or the context account is the regular key, signing the transaction parsed.
eventFlow
, e.g. transaction details page viewed by the context account)The eventFlow
object can contain a eventFlow.start
, eventFlow.intermediate
and eventFlow.end
object. The start
and end
object can contain a mutation
(one, so e.g. eventFlow.start.mutation
).
The eventFlow.intermediate
object can contain multiple mutations
, an in
and out
(or only in
, or (more commonly) only out
) mutation: eventFlow.intermediate.mutations.in
/ eventFlow.intermediate.mutations.out
.
The eventFlow
object can contain only a intermediate
object (so no start
and end
object) if:
SET
(e.g. Regular Key set, AccountSet, putting up an XRPL offer, etc.)Always show then in this order (if present)
... And only (but always) show them if they are present.
FAQs
Parse XRPL transaction to context aware object for visual representation
We found that tx-mutation-parser demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.