@gelatonetwork/relay-sdk
Advanced tools
Comparing version 0.0.7 to 0.0.8
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k; |
import RelayTransaction from "../types/RelayTransaction.interface"; | ||
import { BigNumber } from "ethers"; | ||
declare const sendRelayTransaction: (chainId: number, dest: string, data: string, token: string, relayerFee: string) => Promise<RelayTransaction>; | ||
declare const sendRelayTransaction: (chainId: number, dest: string, data: string, token: string, relayerFee: BigNumber) => Promise<RelayTransaction>; | ||
declare const isChainSupported: (chainId: number) => Promise<boolean>; | ||
declare const getEstimatedFee: (chainId: number, paymentToken: string, gasLimit: number, isHighPriority: boolean) => Promise<BigNumber>; | ||
declare const getEstimatedFee: (chainId: number, paymentToken: string, gasLimit: BigNumber, isHighPriority: boolean) => Promise<BigNumber>; | ||
declare const isOracleActive: (chainId: number) => Promise<boolean>; | ||
declare const getPaymentTokens: (chainId: number) => Promise<string[]>; | ||
export { isChainSupported, sendRelayTransaction, isOracleActive, getEstimatedFee, getPaymentTokens, }; |
@@ -21,3 +21,4 @@ "use strict"; | ||
const sendRelayTransaction = (chainId, dest, data, token, relayerFee) => __awaiter(void 0, void 0, void 0, function* () { | ||
const params = { dest, data, token, relayerFee }; | ||
var _a, _b; | ||
const params = { dest, data, token, relayerFee: relayerFee.toString() }; | ||
let output; | ||
@@ -29,4 +30,7 @@ try { | ||
catch (error) { | ||
console.error(error); | ||
output = error; | ||
let message = `RelaySdkError: ${error.message} `; | ||
if (axios_1.default.isAxiosError(error)) { | ||
message += (_b = (_a = error.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.message; | ||
} | ||
throw new Error(message); | ||
} | ||
@@ -47,9 +51,7 @@ return output; | ||
} | ||
catch (error) { | ||
console.error(error); | ||
} | ||
catch (error) { } // eslint-disable-line no-empty | ||
return result; | ||
}); | ||
const getEstimatedFee = (chainId, paymentToken, gasLimit, isHighPriority) => __awaiter(void 0, void 0, void 0, function* () { | ||
const result = yield _getEstimatedFee(chainId, paymentToken, gasLimit, isHighPriority); | ||
const result = yield _getEstimatedFee(chainId, paymentToken, gasLimit.toString(), isHighPriority); | ||
return result; | ||
@@ -59,3 +61,3 @@ }); | ||
const _getEstimatedFee = (chainId, paymentToken, gasLimit, isHighPriority) => __awaiter(void 0, void 0, void 0, function* () { | ||
var _a; | ||
var _c, _d; | ||
const params = { paymentToken, gasLimit, isHighPriority }; | ||
@@ -70,5 +72,5 @@ let result; | ||
catch (error) { | ||
let message = error.message; | ||
if (axios_1.default.isAxiosError(error) && error.response) { | ||
message = (_a = error.response) === null || _a === void 0 ? void 0 : _a.data; | ||
let message = `RelaySdkError: ${error.message} `; | ||
if (axios_1.default.isAxiosError(error)) { | ||
message += (_d = (_c = error.response) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.message; | ||
} | ||
@@ -90,5 +92,3 @@ throw new Error(message); | ||
} | ||
catch (error) { | ||
console.error(error); | ||
} | ||
catch (error) { } // eslint-disable-line no-empty | ||
return result; | ||
@@ -102,7 +102,5 @@ }); | ||
} | ||
catch (error) { | ||
console.error(error); | ||
} | ||
catch (error) { } // eslint-disable-line no-empty | ||
return result; | ||
}); | ||
exports.getPaymentTokens = getPaymentTokens; |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k; |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k; |
{ | ||
"name": "@gelatonetwork/relay-sdk", | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"description": "SDK to integrate the Gelato Multichain Relay", | ||
@@ -53,3 +53,4 @@ "main": "dist/index.js", | ||
"sinon-chai": "^3.7.0" | ||
} | ||
}, | ||
"gitHead": "9926780c24698880b0a43190610df3cfc4ae0bc2" | ||
} |
@@ -1,5 +0,14 @@ | ||
# Gelato Multichain Relay SDK | ||
# Gelato Multichain Relay SDK <!-- omit in toc --> | ||
SDK to integrate into Gelato Multichain Relay. | ||
<br/> | ||
## Table of Contents <!-- omit in toc --> | ||
- [Installation](#installation) | ||
- [Getting Started](#getting-started) | ||
- [Examples](#examples) | ||
- [Supported Chains](#supported-chains) | ||
- [Gelato Contract Addresses](#gelato-contract-addresses) | ||
- [RelayTransit Contract Addresses](#relaytransit-contract-addresses) | ||
## Installation | ||
@@ -78,2 +87,8 @@ | ||
``` | ||
## Examples | ||
Check out our tutorial repository [relay-sdk-hello-world](https://github.com/gelatodigital/relay-sdk-hello-world) for more in-depth examples. | ||
<br/><br/> | ||
## Supported Chains | ||
@@ -80,0 +95,0 @@ These are the chain Ids supported by the Gelato Multichain Relay: |
20283
292
140