Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@pythnetwork/express-relay-evm-js

Package Overview
Dependencies
Maintainers
4
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pythnetwork/express-relay-evm-js

Utilities for interacting with the express relay protocol

  • 0.1.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
778
increased by93.53%
Maintainers
4
Weekly downloads
 
Created
Source

Pyth Express Relay JS SDK

Utility library for interacting with the Pyth Express Relay API.

Installation

npm

$ npm install --save @pythnetwork/express-relay-evm-js

Yarn

$ yarn add @pythnetwork/express-relay-evm-js

Development

To generate the latest type declarations from the server openapi schema, run:

npm run generate-api-types

Quickstart

import {
  Client,
  OpportunityParams,
  BidInfo,
} from "@pythnetwork/express-relay-evm-js";

const client = new Client({ baseUrl: "https://per-staging.dourolabs.app/" });

function calculateOpportunityBid(opportunity: Opportunity): BidInfo | null {
  // searcher implementation here
  // if the opportunity is not suitable for the searcher, return null
}

client.setOpportunityHandler(async (opportunity: Opportunity) => {
  const bidInfo = calculateOpportunityBid(opportunity);
  if (bidInfo === null) return;
  const opportunityBid = await client.signOpportunityBid(
    opportunity,
    bidInfo,
    privateKey // searcher private key with appropriate permissions and assets
  );
  await client.submitOpportunityBid(opportunityBid);
});
await client.subscribeChains([chain_id]); // chain id you want to subscribe to

Example

There is an example searcher in examples directory.

SimpleSearcher

This example fetches OpportunityParams from the specified endpoint, creates a fixed bid on each opportunity and signs them with the provided private key, and finally submits them back to the server. You can run it with npm run simple-searcher. A full command looks like this:

npm run simple-searcher -- \
  --endpoint https://per-staging.dourolabs.app/ \
  --bid 100000 \
  --chain-id op_sepolia \
  --private-key <YOUR-PRIVATE-KEY>

Keywords

FAQs

Package last updated on 23 Feb 2024

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc