Skip to content

Commit

Permalink
rename omitUtxo to omitBoxes
Browse files Browse the repository at this point in the history
  • Loading branch information
arobsn committed Nov 28, 2021
1 parent 81ebd83 commit d8e559d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -100,7 +100,7 @@ This is a wrapper for the [Ergo explorer API](https://explorer.ergoplatform.com/
tx: string, // tx hash
|},
untilBlock: string, // block hash - inclusive
omitUtxo?: boolean // setting this to true means the response will not include inputs, dataInputs nor outputs
omitBoxes?: boolean // setting this to true means the response will not include inputs, dataInputs nor outputs
}
```
Output:
Expand Down
13 changes: 6 additions & 7 deletions src/api.js
Expand Up @@ -39,7 +39,6 @@ import type {

const addressesRequestLimit = 50;
const apiResponseLimit = 20;
const apiTransactionsBoxesLimit = 20;

const isNumberOrBigint = (x: *): boolean =>
(typeof x === 'number') || BigNumber.isBigNumber(x);
Expand Down Expand Up @@ -611,9 +610,9 @@ const history: HandlerFunction = async function (req, _res) {
hash: tx.id,
time: iso8601date,
tx_state: 'Successful',
inputs: input.omitUtxo ? undefined : tx.inputs,
dataInputs: input.omitUtxo ? undefined : tx.dataInputs,
outputs: input.omitUtxo ? undefined : tx.outputs,
inputs: input.omitBoxes ? undefined : tx.inputs,
dataInputs: input.omitBoxes ? undefined : tx.dataInputs,
outputs: input.omitBoxes ? undefined : tx.outputs,
});
}
// 2) add the pending txs
Expand All @@ -629,9 +628,9 @@ const history: HandlerFunction = async function (req, _res) {
hash: tx.id,
time: iso8601date,
tx_state: 'Pending',
inputs: input.omitUtxo ? undefined : tx.inputs,
dataInputs: input.omitUtxo ? undefined : tx.dataInputs,
outputs: input.omitUtxo ? undefined : tx.outputs.map(output => ({
inputs: input.omitBoxes ? undefined : tx.inputs,
dataInputs: input.omitBoxes ? undefined : tx.dataInputs,
outputs: input.omitBoxes ? undefined : tx.outputs.map(output => ({
...output,
})),
});
Expand Down
2 changes: 1 addition & 1 deletion src/types/wrapperApi.js
Expand Up @@ -37,7 +37,7 @@ export type HistoryInput = {|
tx: string, // tx hash
|},
untilBlock: string, // block hash - inclusive
omitUtxo?: boolean // setting this to true means the response will not include inputs, dataInputs nor outputs
omitBoxes?: boolean // setting this to true means the response will not include inputs, dataInputs nor outputs
|};
export type HistoryOutput = Array<{
block_hash: null | string,
Expand Down
2 changes: 1 addition & 1 deletion test/real.test.js
Expand Up @@ -249,7 +249,7 @@ const specs: Array<Spec> = [
input: {
addresses: ['9hK1EHKmPPQu4YJrZDjQ2E5sYZxkHFGvU5kVTcxTxojgP28tWzC'],
untilBlock: '008a03ddb289aea660f69165245b1448a3fb16dfc7b04061489a77f8911b6572',
omitUtxo: true,
omitBoxes: true,
},
output: (output) => {
for (let o of output) {
Expand Down

0 comments on commit d8e559d

Please sign in to comment.