Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <h4>connex.thor.filter - VET transfer </h4>
<pre id="status">connecting to node.....</pre>
<label>criteria: </label>
<select id="criteria">
  <option value="txOrigin">txOrigin</option>
  <option value="sender">sender</option>
  <option value="recipient">recipient</option>
</select>
<label>address: </label>
<input id="address" placeholder="input address" value="0x70aE85A2fF6030366F512DbcD60Be3828139b498"></input>
<br><br>
<label>order: </label>
<select id="order">
  <option value="desc">desc</option>
  <option value="asc">asc</option>
</select>
<br><br>
<label>fitlerRange: </label>
<select id="rangeUnit">
  <option value="block">block</option>
  <option value="time">time</option>
</select>
<label>from</label>
<input id="from"></input>
<label>to</label>
<input id="to"></input>
<h5>Note: Enter block number or timestamp in second</h5>

<button onclick="filter()">filter</button>

<pre id="filterResult"></pre>
              
            
!

CSS

              
                
              
            
!

JS

              
                const connex = new Connex({
  node: "https://testnet.veblocks.net/",
  network: "test"
});

const filterResult = document.getElementById("filterResult");
const filterOffset = 0; // Start cursor in the result
const filterLimit = 1; // Constrain the number of result returned

const ticker = connex.thor.ticker();
void (async () => {
  for (;;) {
    await ticker.next();
    document.getElementById("status").innerText =
      "Current block# " + connex.thor.status.head.number;
  }
})();

function filter() {
  const criteriaType = document.getElementById("criteria").value;
  var criteriaArray=[]
  const orderType = document.getElementById("order").value;
  const rangeUnit = document.getElementById("rangeUnit").value;
  const filterFrom = document.getElementById("from").value;
  const filterTo = document.getElementById("to").value;
  const filterCriteria = document.getElementsByName("filter_criteria");
  const address = document.getElementById("address").value;
  filterResult.innerText = "";

  const criteria = { [criteriaType]: address };
  criteriaArray.push(criteria)
  const filter = connex.thor.filter("transfer", criteriaArray);

  filter.order(orderType);
  if (filterFrom && filterTo != "") {
    filter.range({
      unit: rangeUnit,
      from: parseInt(filterFrom, 10),
      to: parseInt(filterTo, 10)
    });
  }
  filter.apply(filterOffset, filterLimit).then((logs) => {
    filterResult.innerText = JSON.stringify(logs, null, 4);
  });
}

              
            
!
999px

Console