Skip to content

merkle3/merkle-sdk-ts

Repository files navigation

merkle is building crypto infrastructure. Join us on discord.

merkle SDK

The merkle SDK is a great way to access our products.

Install

Install the merkle SDK package:

yarn add @mkl3/sdk

Features

Stream auctions

Stream auctions from merkle's private pool. Learn more

import Merkle from "@mkl3/sdk";

const merkle = new Merkle("<API KEY>"); // optional, get one at mbs.merkle.io

// stream auctions and make bids
merkle.pool.auctions().on("auction", (auction) => {
  console.log("new auction: ", auction);

  // construct a backrun
  const backrun = "0x....";

  // make a bid
  merkle.pool.bid(auction.transaction.hash, backrun);
});

// send new transactions for auctions
merkle.pool.send(tx, {
  // a signed ethers.Transaction
  // optional parameters
  feeRecipient: "0x", // where to receive the bid revenue, defaults to the tx.from
  hints: [], // what hints to provide to searchers, see https://docs.merkle.io/private-pool/privacy
});

Stream public mempool transactions

Stream public mempool transactions from merkle's ultra fast network on Ethereum, Polygon and BSC. Learn more

Typescript:

import Merkle from "@mkl3/sdk";

const merkle = new Merkle("<API KEY>"); // get one at mbs.merkle.io

// stream ethereum transactions
merkle.transactions.stream().on("transaction", (tx) => {
  console.log("tx from: ", tx.from);
});

// stream polygon transactions
merkle.transactions.stream(137).on("transaction", (tx) => {
  console.log("tx from: ", tx.from);
});

// stream bnb transactions
merkle.transactions.stream(56).on("transaction", (tx) => {
  console.log("tx from: ", tx.from);
});

Javascript:

const Merkle = require("@mkl3/sdk");

const merkle = new Merkle("<API KEY>"); //get one at mbs.merkle.io

// stream ethereum transactions
merkle.transactions.stream().on("transaction", (tx) => {
  console.log("tx from: ", tx.from);
});

// stream polygon transactions
merkle.transactions.stream(137).on("transaction", (tx) => {
  console.log("tx from: ", tx.from);
});

// stream bnb transactions
merkle.transactions.stream(56).on("transaction", (tx) => {
  console.log("tx from: ", tx.from);
});

Transaction tracing

Know exactly when and where a transaction was broadcasted. Learn more

import Merkle from "@mkl3/sdk";

const merkle = new Merkle("<API KEY>"); //get one at mbs.merkle.io

// trace a transaction with its hash
merkle.transactions.trace("0x...").then((trace) => {
  console.log("trace: ", trace);
});

About

Typescript SDK for Merkle.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published