Skip to content
This repository has been archived by the owner on Nov 5, 2023. It is now read-only.

Latest commit

 

History

History

aggregator-proxy

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Aggregator Proxy

npm version

This package makes it easy to provide an aggregator by proxying another. The primary use-case is to expose a free aggregator based on one that requires payment by augmenting the bundles with transactions that pay tx.origin.

Setup

npm install bls-wallet-aggregator-proxy
yarn install bls-wallet-aggregator-proxy

Usage

import {
  runAggregatorProxy,

  // AggregatorProxyCallback,
  // ^ Alternatively, for manual control, import AggregatorProxyCallback to
  // just generate the req,res callback for use with http.createServer
} from "bls-wallet-aggregator-proxy";

runAggregatorProxy(
  "https://arbitrum-goerli.blswallet.org",
  async (bundle) => {
    console.log("proxying bundle", JSON.stringify(bundle, null, 2));

    // Return a different/augmented bundle to send to the upstream aggregator
    return bundle;
  },
  8080,
  "0.0.0.0",
  () => {
    console.log("Proxying aggregator on port 8080");
  }
);

Instant wallet example without dapp-sponsored transaction

Instant wallet without dapp-sponsored transactions

Instant wallet example with dapp-sponsored transaction

Instant wallet with dapp-sponsored transaction

Example dApp using a proxy aggregator