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

@gelatonetwork/relay-sdk

Package Overview
Dependencies
Maintainers
11
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gelatonetwork/relay-sdk

SDK to integrate the Gelato Multichain Relay

  • 0.0.4
  • npm
  • Socket score

Version published
Weekly downloads
4.1K
increased by65.97%
Maintainers
11
Weekly downloads
 
Created
Source

Gelato Multichain Relay SDK

SDK to integrate into Gelato Multichain Relay.

Installation

yarn add @gelatonetwork/relay-sdk

or

npm install @gelatonetwork/relay-sdk

Getting Started

Import the Gelato Multichain Relay into your project

import { RelaySDK } from "@gelatonetwork/relay-sdk";
  1. Check if the Gelato Multichain Relay supports a given ChainId
  const chainSupported = await RelaySDK.isChainSupported(chainId);
  if (!chainSupported) {
    console.log("ChainId not supported");
    return;
  }
  1. Estimate the execution price using the Relay Multichain Oracle
  // Check if the Relay has an oracle on this ChainId
  const isActiveOracle = await RelaySDK.isOracleActive(chainId);
  if (!isActiveOracle) {
    console.log("Oracle is not active on this Oracle");
    return;
  }

  // Estimate the Token cost now for the given GasLimit and it's the amount of Token
  // that the function should pay back to the caller
  const estimatedExecutionFeeInToken: BigNumber = await RelaySDK.getEstimatedFee(
    chainId,
    paymentTokenAddress,
    gasLimit,
    isHighPriority // If we want to get a high priority fee
  );
  1. Submit transaction
  import { BigNumber } from "ethers"; 
  import { Interface } from "ethers/lib/utils";

  // Generate the function data
  const contractInterface = new Interface(contractABI);
  const data = contractInterface.encodeFunctionData("functionToCall", [args]);

  const relayTx = await RelaySDK.sendRelayTransaction(
    chainId,
    destAddress, // The contract address that should be whitelisted in the Relay
    data,
    paymentTokenAddress,
    estimatedExecutionFeeInToken.toHexString() // Not used yet
  );
  console.log(`RelayerTransactionId = ${relayTx.taskId}`);

Supported Chains

These are the chain Ids supported by the Gelato Multichain Relay:

MAINNET: 1,
ROPSTEN: 3,
RINKEBY: 4,
GOERLI: 5,
OPTIMISM: 10,
BSC: 56,
XDAI: 100,
MATIC: 137,
FANTOM: 250,
MOONBEAM: 1284,
ARBITRUM: 42161,
AVALANCHE: 43114

FAQs

Package last updated on 14 Feb 2022

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