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

@gelatonetwork/relay-sdk

Package Overview
Dependencies
Maintainers
15
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gelatonetwork/relay-sdk - npm Package Compare versions

Comparing version 0.4.0 to 0.5.0

2

dist/lib/index.d.ts

@@ -7,4 +7,4 @@ import { RelayTransaction } from "../types/";

declare const getPaymentTokens: (chainId: number) => Promise<string[]>;
declare const getEstimatedFee: (chainId: number, paymentToken: string, gasLimit: BigNumber, isHighPriority: boolean) => Promise<BigNumber>;
declare const getEstimatedFee: (chainId: number, paymentToken: string, gasLimit: BigNumber, isHighPriority: boolean, gasLimitL1?: BigNumber | undefined) => Promise<BigNumber>;
declare const getTaskStatus: (taskId: string) => Promise<import("@gelatonetwork/core-sdk").TransactionStatus | undefined>;
export { isChainSupported, sendRelayTransaction, isOracleActive, getPaymentTokens, getEstimatedFee, getTaskStatus, };
{
"name": "@gelatonetwork/relay-sdk",
"version": "0.4.0",
"version": "0.5.0",
"description": "SDK to integrate the Gelato Multichain Relay",

@@ -51,7 +51,7 @@ "main": "dist/index.js",

"dependencies": {
"@gelatonetwork/core-sdk": "^0.3.0",
"@gelatonetwork/core-sdk": "^0.4.0",
"axios": "^0.24.0",
"ethers": "^5.5.2"
},
"gitHead": "54bc44e3439a42f79d9ba32ac4bedd8d255dd38e"
"gitHead": "962873487a3637a83cf0062f3e2fc7984ccb96c7"
}

@@ -7,2 +7,3 @@ # Gelato Multichain Relay SDK <!-- omit in toc -->

## Table of Contents <!-- omit in toc -->
- [Installation](#installation)

@@ -20,6 +21,9 @@ - [Getting Started](#getting-started)

```
or
```bash
npm install @gelatonetwork/relay-sdk
```
## Getting Started

@@ -36,20 +40,33 @@

```typescript
const chainSupported = await RelaySDK.isChainSupported(chainId);
if (!chainSupported) {
console.log("ChainId not supported");
return;
}
const chainSupported = await RelaySDK.isChainSupported(chainId);
if (!chainSupported) {
console.log("ChainId not supported");
return;
}
```
2. Estimate the execution price using the Relay Multichain Oracle
```typescript
// 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 network");
return;
}
// 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 network");
return;
}
// Estimates the transaction cost in the defined token for the inputted gasLimit
// The paymentTokenAddress is the address of the token used to pay transaction fees
// Estimates the transaction cost in the defined token for the inputted gasLimit
// The paymentTokenAddress is the address of the token used to pay transaction fees
const estimatedExecutionFeeInToken: BigNumber = await RelaySDK.getEstimatedFee(
chainId,
paymentTokenAddress,
gasLimit,
isHighPriority // If we want to get a high priority fee
);
```
If you are estimating the transaction cost on Optimism, you have to use the
function getEstimatedFee with the GasLimit on L1 as follows:
```typescript
const estimatedExecutionFeeInToken: BigNumber = await RelaySDK.getEstimatedFee(

@@ -60,2 +77,3 @@ chainId,

isHighPriority // If we want to get a high priority fee
gasLimitL1 // Estimated Gas Limit on L1
);

@@ -65,30 +83,33 @@ ```

3. Get supported payment tokens by chain id
```typescript
// Get Payment Token Addresses
const paymentTokensAdresses: string[] = await RelaySDK.getPaymentTokens(
chainId,
);
// Get Payment Token Addresses
const paymentTokensAdresses: string[] = await RelaySDK.getPaymentTokens(
chainId
);
```
4. Submit transaction:
If you want to submit a transaction using the Gelato Multichain Relayer, the transaction should pay to the Gelato contract
to execute, otherwise the transaction will revert.
If you want to submit a transaction using the Gelato Multichain Relayer, the transaction should pay to the Gelato contract
to execute, otherwise the transaction will revert.
```typescript
import { BigNumber } from "ethers";
import { Interface } from "ethers/lib/utils";
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]);
// Generate the function data
const contractInterface = new Interface(contractABI);
const data = contractInterface.encodeFunctionData("functionToCall", [args]);
const relayTx = await RelaySDK.sendRelayTransaction(
chainId,
destAddress,
data,
paymentTokenAddress,
);
console.log(`RelayerTransactionId = ${relayTx.taskId}`);
const relayTx = await RelaySDK.sendRelayTransaction(
chainId,
destAddress,
data,
paymentTokenAddress
);
console.log(`RelayerTransactionId = ${relayTx.taskId}`);
```
5. Check your transaction status:
```typescript

@@ -125,3 +146,5 @@ const status = await RelaySDK.getTaskStatus(taskId);

## Supported Chains
These are the chain Ids supported by the Gelato Multichain Relay:
```typescript

@@ -143,31 +166,41 @@ MAINNET: 1,

## Gelato Contract Addresses
| Chain | Contract Address |
|--- |--- |
| MAINNET | 0x3CACa7b48D0573D793d3b0279b5F0029180E83b6 |
| ROPSTEN | 0xCc4CcD69D31F9FfDBD3BFfDe49c6aA886DaB98d9 |
| RINKEBY | 0x0630d1b8C2df3F0a68Df578D02075027a6397173 |
| GOERLI | 0x683913B3A32ada4F8100458A3E1675425BdAa7DF |
| OPTIMISM | 0x01051113D81D7d6DA508462F2ad6d7fD96cF42Ef |
| BSC | 0x7C5c4Af1618220C090A6863175de47afb20fa9Df |
| XDAI | 0x29b6603D17B9D8f021EcB8845B6FD06E1Adf89DE |
| MATIC | 0x7598e84B2E114AB62CAB288CE5f7d5f6bad35BbA |
| FANTOM | 0xebA27A2301975FF5BF7864b99F55A4f7A457ED10 |
| MOONBEAM | 0x91f2A140cA47DdF438B9c583b7E71987525019bB |
| ARBITRUM | 0x4775aF8FEf4809fE10bf05867d2b038a4b5B2146 |
| AVALANCHE | 0x7C5c4Af1618220C090A6863175de47afb20fa9Df |
| Chain | Contract Address |
| --------- | ------------------------------------------ |
| MAINNET | 0x3CACa7b48D0573D793d3b0279b5F0029180E83b6 |
| ROPSTEN | 0xCc4CcD69D31F9FfDBD3BFfDe49c6aA886DaB98d9 |
| RINKEBY | 0x0630d1b8C2df3F0a68Df578D02075027a6397173 |
| GOERLI | 0x683913B3A32ada4F8100458A3E1675425BdAa7DF |
| KOVAN | 0xDf592cB2d32445F8e831d211AB20D3233cA41bD8 |
| OPTIMISM | 0x01051113D81D7d6DA508462F2ad6d7fD96cF42Ef |
| BSC | 0x7C5c4Af1618220C090A6863175de47afb20fa9Df |
| XDAI | 0x29b6603D17B9D8f021EcB8845B6FD06E1Adf89DE |
| MATIC | 0x7598e84B2E114AB62CAB288CE5f7d5f6bad35BbA |
| MUMBAI | 0x25aD59adbe00C2d80c86d01e2E05e1294DA84823 |
| FANTOM | 0xebA27A2301975FF5BF7864b99F55A4f7A457ED10 |
| MOONBEAM | 0x91f2A140cA47DdF438B9c583b7E71987525019bB |
| ARBITRUM | 0x4775aF8FEf4809fE10bf05867d2b038a4b5B2146 |
| AVALANCHE | 0x7C5c4Af1618220C090A6863175de47afb20fa9Df |
| BOBA | 0x91f2A140cA47DdF438B9c583b7E71987525019bB |
| CRONOS | 0x91f2A140cA47DdF438B9c583b7E71987525019bB |
## RelayTransit Contract Addresses
| Chain | Contract Address |
|--- |--- |
| MAINNET | 0x36225733276425f5DbA88977Aef45f042BACB953 |
| ROPSTEN | 0x1908238d294058722D9c27B3DCaffA326F05eDA4 |
| RINKEBY | 0xfe65B7FA42d7F71C6725b183CAF03b1622F3B69F |
| GOERLI | 0x5d61B0425FcEE18C872104ED00477286d7d461dc |
| OPTIMISM | 0xb34758F24fFEf132dc5831C2Cd9A0a5e120CD564 |
| BSC | 0x3652b3D7c814D331974a3Ff70C8038971727cd63 |
| XDAI | 0x0f92f38A73e8f1f226517C14126F95f5Bd3678e8 |
| MATIC | 0xAe92F11c3c8BA455e858Fbd50AA29B2db8E57121 |
| FANTOM | 0x5D6c3f065Ce364Af04f1207Cbad999A7B640921A |
| MOONBEAM | 0x24D677f8A59A486BfC6d87E9453C4f1fEfcB0958 |
| ARBITRUM | 0x79A0cB573D3Db184752511969F1b869A184EA445 |
| AVALANCHE | 0x4efaEe0fAD71A451c6Ca621df5AeFc5c01668a26 |
| Chain | Contract Address |
| --------- | ------------------------------------------ |
| MAINNET | 0x9B077C59fDe7de5AdCeF8093Bc38B61d43FC7007 |
| ROPSTEN | 0xE2Fc8F14B6cEb1AD8165623E02953eDB100288bE |
| RINKEBY | 0x7084d869F0C120957E40D762Ebe3104474D5248f |
| GOERLI | 0xCDdE9992Fb66038Dd8419b56149a75CC79Df133C |
| KOVAN | 0xb34758F24fFEf132dc5831C2Cd9A0a5e120CD564 |
| OPTIMISM | 0xe8a5eE73f3c8F1Cd55915f6Eb5Fc7df4206f3C78 |
| BSC | 0x43728A95386D64384C76Afd416Dcc8118869BA6c |
| XDAI | 0x62B1a88CCc6BC5e6FF91FB2FCD29Ab4F819b35C6 |
| MATIC | 0xE2Fc8F14B6cEb1AD8165623E02953eDB100288bE |
| MUMBAI | 0x24D677f8A59A486BfC6d87E9453C4f1fEfcB0958 |
| FANTOM | 0xFbf1CA2be769b79BE01e48F509107dcACb9ae11b |
| MOONBEAM | 0x36225733276425f5DbA88977Aef45f042BACB953 |
| ARBITRUM | 0x0ae392879A228B2484D9B1F80A5D0B7080FE79C2 |
| AVALANCHE | 0xa120a7d4EaF1910D38bc934D756DF507943a4C5a |
| BOBA | 0x4efaEe0fAD71A451c6Ca621df5AeFc5c01668a26 |
| CRONOS | 0x62B1a88CCc6BC5e6FF91FB2FCD29Ab4F819b35C6 |
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