@gelatonetwork/relay-sdk
Advanced tools
Comparing version 1.0.3-beta to 1.0.3-beta.0
@@ -5,2 +5,6 @@ declare const RELAY_V2_ENABLED_CHAINS: { | ||
readonly ARBITRUM_GOERLI: 421613; | ||
readonly RINKEBY: 4; | ||
readonly CELO_ALFAJORES: 44787; | ||
readonly POLYGON: 137; | ||
readonly OPTIMISM_GOERLI: 420; | ||
}; | ||
@@ -10,3 +14,2 @@ declare type RelayV2EnabledChains = typeof RELAY_V2_ENABLED_CHAINS[keyof typeof RELAY_V2_ENABLED_CHAINS]; | ||
relayAddress: string | null; | ||
relayWithTransferFromAddress: string | null; | ||
}; | ||
@@ -13,0 +16,0 @@ export declare const RELAY_ADDRESSES: { |
@@ -8,2 +8,6 @@ "use strict"; | ||
ARBITRUM_GOERLI: 421613, | ||
RINKEBY: 4, | ||
CELO_ALFAJORES: 44787, | ||
POLYGON: 137, | ||
OPTIMISM_GOERLI: 420, | ||
}; | ||
@@ -13,12 +17,21 @@ exports.RELAY_ADDRESSES = { | ||
relayAddress: "0xaBcC9b596420A9E9172FD5938620E265a0f9Df92", | ||
relayWithTransferFromAddress: null, | ||
}, | ||
5: { | ||
relayAddress: "0xaBcC9b596420A9E9172FD5938620E265a0f9Df92", | ||
relayWithTransferFromAddress: null, | ||
}, | ||
421613: { | ||
relayAddress: "0xaBcC9b596420A9E9172FD5938620E265a0f9Df92", | ||
relayWithTransferFromAddress: null, | ||
}, | ||
4: { | ||
relayAddress: "0xaBcC9b596420A9E9172FD5938620E265a0f9Df92", | ||
}, | ||
44787: { | ||
relayAddress: "0xaBcC9b596420A9E9172FD5938620E265a0f9Df92", | ||
}, | ||
137: { | ||
relayAddress: "0xaBcC9b596420A9E9172FD5938620E265a0f9Df92", | ||
}, | ||
420: { | ||
relayAddress: "0xaBcC9b596420A9E9172FD5938620E265a0f9Df92", | ||
}, | ||
}; |
@@ -5,3 +5,3 @@ import { RelayRequestOptions, RelayResponse } from "../types"; | ||
* @param {CallWithSyncFeeRequest} request - CallWithSyncFee request to be relayed by Gelato Executors | ||
* @param {RelayRequestOptions} options - Optional Relay configuration | ||
* @param {RelayRequestOptions} [options] - Optional Relay configuration | ||
* @returns {Promise<RelayResponse>} Response object with taskId parameter | ||
@@ -8,0 +8,0 @@ * |
@@ -21,3 +21,3 @@ "use strict"; | ||
* @param {CallWithSyncFeeRequest} request - CallWithSyncFee request to be relayed by Gelato Executors | ||
* @param {RelayRequestOptions} options - Optional Relay configuration | ||
* @param {RelayRequestOptions} [options] - Optional Relay configuration | ||
* @returns {Promise<RelayResponse>} Response object with taskId parameter | ||
@@ -24,0 +24,0 @@ * |
export { relayWithSyncFee } from "./callWithSyncFee"; | ||
export { relayWithUserSignature } from "./userAuthCall"; | ||
export { relayWithSponsorSignature } from "./sponsorAuthCall"; | ||
export { generateUserSponsorSignature, relayWithUserSponsorSignature, } from "./userSponsorAuthCall"; | ||
export { relayWithSponsoredCall } from "./sponsoredCall"; | ||
export { generateUserSponsorSignature, relayWithSponsoredUserAuthCall, } from "./sponsoredUserAuthCall"; | ||
export { getEstimatedFee, getGelatoOracles, getPaymentTokens, isOracleActive, } from "./oracle"; | ||
export { getTaskStatus } from "./status"; | ||
export { PaymentType, SignerProfile } from "./types"; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SignerProfile = exports.PaymentType = exports.relayWithUserSponsorSignature = exports.generateUserSponsorSignature = exports.relayWithSponsorSignature = exports.relayWithUserSignature = exports.relayWithSyncFee = void 0; | ||
exports.SignerProfile = exports.PaymentType = exports.getTaskStatus = exports.isOracleActive = exports.getPaymentTokens = exports.getGelatoOracles = exports.getEstimatedFee = exports.relayWithSponsoredUserAuthCall = exports.generateUserSponsorSignature = exports.relayWithSponsoredCall = exports.relayWithSyncFee = void 0; | ||
var callWithSyncFee_1 = require("./callWithSyncFee"); | ||
Object.defineProperty(exports, "relayWithSyncFee", { enumerable: true, get: function () { return callWithSyncFee_1.relayWithSyncFee; } }); | ||
var userAuthCall_1 = require("./userAuthCall"); | ||
Object.defineProperty(exports, "relayWithUserSignature", { enumerable: true, get: function () { return userAuthCall_1.relayWithUserSignature; } }); | ||
var sponsorAuthCall_1 = require("./sponsorAuthCall"); | ||
Object.defineProperty(exports, "relayWithSponsorSignature", { enumerable: true, get: function () { return sponsorAuthCall_1.relayWithSponsorSignature; } }); | ||
var userSponsorAuthCall_1 = require("./userSponsorAuthCall"); | ||
Object.defineProperty(exports, "generateUserSponsorSignature", { enumerable: true, get: function () { return userSponsorAuthCall_1.generateUserSponsorSignature; } }); | ||
Object.defineProperty(exports, "relayWithUserSponsorSignature", { enumerable: true, get: function () { return userSponsorAuthCall_1.relayWithUserSponsorSignature; } }); | ||
var sponsoredCall_1 = require("./sponsoredCall"); | ||
Object.defineProperty(exports, "relayWithSponsoredCall", { enumerable: true, get: function () { return sponsoredCall_1.relayWithSponsoredCall; } }); | ||
var sponsoredUserAuthCall_1 = require("./sponsoredUserAuthCall"); | ||
Object.defineProperty(exports, "generateUserSponsorSignature", { enumerable: true, get: function () { return sponsoredUserAuthCall_1.generateUserSponsorSignature; } }); | ||
Object.defineProperty(exports, "relayWithSponsoredUserAuthCall", { enumerable: true, get: function () { return sponsoredUserAuthCall_1.relayWithSponsoredUserAuthCall; } }); | ||
var oracle_1 = require("./oracle"); | ||
Object.defineProperty(exports, "getEstimatedFee", { enumerable: true, get: function () { return oracle_1.getEstimatedFee; } }); | ||
Object.defineProperty(exports, "getGelatoOracles", { enumerable: true, get: function () { return oracle_1.getGelatoOracles; } }); | ||
Object.defineProperty(exports, "getPaymentTokens", { enumerable: true, get: function () { return oracle_1.getPaymentTokens; } }); | ||
Object.defineProperty(exports, "isOracleActive", { enumerable: true, get: function () { return oracle_1.isOracleActive; } }); | ||
var status_1 = require("./status"); | ||
Object.defineProperty(exports, "getTaskStatus", { enumerable: true, get: function () { return status_1.getTaskStatus; } }); | ||
var types_1 = require("./types"); | ||
Object.defineProperty(exports, "PaymentType", { enumerable: true, get: function () { return types_1.PaymentType; } }); | ||
Object.defineProperty(exports, "SignerProfile", { enumerable: true, get: function () { return types_1.SignerProfile; } }); |
import { BigNumberish } from "ethers"; | ||
export declare enum RelayContract { | ||
GelatoRelay = "GelatoRelay", | ||
GelatoRelayWithTransferFrom = "GelatoRelayWithTransferFrom" | ||
GelatoRelay = "GelatoRelay" | ||
} | ||
@@ -13,4 +12,3 @@ export declare enum AuthCall { | ||
export declare enum PaymentType { | ||
OneBalance = 0, | ||
TransferFrom = 1 | ||
OneBalance = 0 | ||
} | ||
@@ -24,8 +22,6 @@ export declare enum SignerProfile { | ||
}; | ||
export declare type TransferFromPayment = { | ||
paymentType: PaymentType.TransferFrom; | ||
}; | ||
export declare type RelayRequestOptions = { | ||
gasLimit?: BigNumberish; | ||
retries?: number; | ||
sponsorApiKey: string; | ||
}; | ||
@@ -32,0 +28,0 @@ export declare type RelayResponse = { |
@@ -7,3 +7,2 @@ "use strict"; | ||
RelayContract["GelatoRelay"] = "GelatoRelay"; | ||
RelayContract["GelatoRelayWithTransferFrom"] = "GelatoRelayWithTransferFrom"; | ||
})(RelayContract = exports.RelayContract || (exports.RelayContract = {})); | ||
@@ -19,3 +18,2 @@ var AuthCall; | ||
PaymentType[PaymentType["OneBalance"] = 0] = "OneBalance"; | ||
PaymentType[PaymentType["TransferFrom"] = 1] = "TransferFrom"; | ||
})(PaymentType = exports.PaymentType || (exports.PaymentType = {})); | ||
@@ -22,0 +20,0 @@ var SignerProfile; |
@@ -15,9 +15,2 @@ "use strict"; | ||
}; | ||
case types_1.RelayContract.GelatoRelayWithTransferFrom: | ||
return { | ||
name: "GelatoRelayWithTransferFrom", | ||
version: "1", | ||
chainId, | ||
verifyingContract: (0, getRelayAddresses_1.getRelayWithTransferFromAddress)(chainId), | ||
}; | ||
default: { | ||
@@ -24,0 +17,0 @@ const _exhaustiveCheck = relayContract; |
export declare const getRelayAddress: (chainId: number) => string; | ||
export declare const getRelayWithTransferFromAddress: (chainId: number) => string; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getRelayWithTransferFromAddress = exports.getRelayAddress = void 0; | ||
exports.getRelayAddress = void 0; | ||
const utils_1 = require("ethers/lib/utils"); | ||
@@ -14,9 +14,1 @@ const address_1 = require("../constants/address"); | ||
exports.getRelayAddress = getRelayAddress; | ||
const getRelayWithTransferFromAddress = (chainId) => { | ||
const addresses = address_1.RELAY_ADDRESSES[chainId]; | ||
if (!addresses || !addresses.relayWithTransferFromAddress) { | ||
throw new Error(`Relay With Transfer From is not supported on chainId [${chainId}]`); | ||
} | ||
return (0, utils_1.getAddress)(addresses.relayWithTransferFromAddress); | ||
}; | ||
exports.getRelayWithTransferFromAddress = getRelayWithTransferFromAddress; |
@@ -18,7 +18,3 @@ "use strict"; | ||
const getUserNonce = (paymentType, chainId, account, provider) => __awaiter(void 0, void 0, void 0, function* () { | ||
const address = paymentType === lib_1.PaymentType.OneBalance | ||
? (0, getRelayAddresses_1.getRelayAddress)(chainId) | ||
: paymentType === lib_1.PaymentType.TransferFrom | ||
? (0, getRelayAddresses_1.getRelayWithTransferFromAddress)(chainId) | ||
: null; | ||
const address = paymentType === lib_1.PaymentType.OneBalance ? (0, getRelayAddresses_1.getRelayAddress)(chainId) : null; | ||
if (!address) { | ||
@@ -25,0 +21,0 @@ throw new Error(`Unsupported payment type [${paymentType}]`); |
@@ -1,5 +0,3 @@ | ||
import { SponsorAuthCallWith1BalanceRequest, SponsorAuthCallWith1BalanceRequestOptionalParameters } from "../lib/sponsorAuthCall/1balance/types"; | ||
import { SponsorAuthCallWithTransferFromRequest, SponsorAuthCallWithTransferFromRequestOptionalParameters } from "../lib/sponsorAuthCall/transferFrom/types"; | ||
import { UserSponsorAuthCallWith1BalanceRequest, UserSponsorAuthCallWith1BalanceRequestOptionalParameters } from "../lib/userSponsorAuthCall/1balance/types"; | ||
import { UserSponsorAuthCallWithTransferFromRequest, UserSponsorAuthCallWithTransferFromRequestOptionalParameters } from "../lib/userSponsorAuthCall/transferFrom/types"; | ||
export declare const populateOptionalSponsorParameters: <Request extends UserSponsorAuthCallWith1BalanceRequest | UserSponsorAuthCallWithTransferFromRequest | SponsorAuthCallWith1BalanceRequest | SponsorAuthCallWithTransferFromRequest, OptionalParameters extends UserSponsorAuthCallWith1BalanceRequestOptionalParameters | UserSponsorAuthCallWithTransferFromRequestOptionalParameters | SponsorAuthCallWith1BalanceRequestOptionalParameters | SponsorAuthCallWithTransferFromRequestOptionalParameters>(request: Request) => Promise<Partial<OptionalParameters>>; | ||
import { SponsoredCallWith1BalanceRequest, SponsoredCallWith1BalanceRequestOptionalParameters } from "../lib/sponsoredCall/1balance/types"; | ||
import { SponsoredUserAuthCallRequest, SponsoredUserAuthCallRequestOptionalParameters } from "../lib/sponsoredUserAuthCall/1balance/types"; | ||
export declare const populateOptionalSponsorParameters: <Request extends SponsoredUserAuthCallRequest | SponsoredCallWith1BalanceRequest, OptionalParameters extends SponsoredUserAuthCallRequestOptionalParameters | SponsoredCallWith1BalanceRequestOptionalParameters>(request: Request) => Promise<Partial<OptionalParameters>>; |
@@ -13,10 +13,8 @@ "use strict"; | ||
exports.populateOptionalSponsorParameters = void 0; | ||
const ethers_1 = require("ethers"); | ||
const populateOptionalSponsorParameters = (request) => __awaiter(void 0, void 0, void 0, function* () { | ||
const populateOptionalSponsorParameters = ( | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
request) => __awaiter(void 0, void 0, void 0, function* () { | ||
const parametersToOverride = {}; | ||
if (!request.sponsorSalt) { | ||
parametersToOverride.sponsorSalt = ethers_1.BigNumber.from(ethers_1.utils.randomBytes(32)).toString(); | ||
} | ||
return parametersToOverride; | ||
}); | ||
exports.populateOptionalSponsorParameters = populateOptionalSponsorParameters; |
import { ethers, providers } from "ethers"; | ||
import { PaymentType } from "../lib"; | ||
import { UserAuthCallWith1BalanceRequest, UserAuthCallWith1BalanceRequestOptionalParameters } from "../lib/userAuthCall/1balance/types"; | ||
import { UserAuthCallWithTransferFromRequest, UserAuthCallWithTransferFromRequestOptionalParameters } from "../lib/userAuthCall/transferFrom/types"; | ||
import { UserSponsorAuthCallWith1BalanceRequest, UserSponsorAuthCallWith1BalanceRequestOptionalParameters } from "../lib/userSponsorAuthCall/1balance/types"; | ||
import { UserSponsorAuthCallWithTransferFromRequest, UserSponsorAuthCallWithTransferFromRequestOptionalParameters } from "../lib/userSponsorAuthCall/transferFrom/types"; | ||
export declare const populateOptionalUserParameters: <Request extends UserAuthCallWith1BalanceRequest | UserAuthCallWithTransferFromRequest | UserSponsorAuthCallWith1BalanceRequest | UserSponsorAuthCallWithTransferFromRequest, OptionalParameters extends UserAuthCallWith1BalanceRequestOptionalParameters | UserAuthCallWithTransferFromRequestOptionalParameters | UserSponsorAuthCallWith1BalanceRequestOptionalParameters | UserSponsorAuthCallWithTransferFromRequestOptionalParameters>(paymentType: PaymentType, request: Request, provider: providers.Web3Provider | ethers.providers.Provider) => Promise<Partial<OptionalParameters>>; | ||
import { SponsoredUserAuthCallRequest, SponsoredUserAuthCallRequestOptionalParameters } from "../lib/sponsoredUserAuthCall/1balance/types"; | ||
export declare const populateOptionalUserParameters: <Request extends SponsoredUserAuthCallRequest, OptionalParameters extends SponsoredUserAuthCallRequestOptionalParameters>(paymentType: PaymentType, request: Request, provider: providers.Web3Provider | ethers.providers.Provider) => Promise<Partial<OptionalParameters>>; |
@@ -24,10 +24,7 @@ "use strict"; | ||
switch (authCall) { | ||
case types_1.AuthCall.User: | ||
path = `${constants_1.GELATO_RELAY_URL}/relays/v2/user-auth-call`; | ||
break; | ||
case types_1.AuthCall.Sponsor: | ||
path = `${constants_1.GELATO_RELAY_URL}/relays/v2/sponsor-auth-call`; | ||
path = `${constants_1.GELATO_RELAY_URL}/relays/v2/sponsored-call`; | ||
break; | ||
case types_1.AuthCall.UserSponsor: | ||
path = `${constants_1.GELATO_RELAY_URL}/relays/v2/user-sponsor-auth-call`; | ||
path = `${constants_1.GELATO_RELAY_URL}/relays/v2/sponsored-user-auth-call`; | ||
break; | ||
@@ -34,0 +31,0 @@ default: { |
{ | ||
"name": "@gelatonetwork/relay-sdk", | ||
"version": "1.0.3-beta", | ||
"version": "1.0.3-beta.0", | ||
"description": "SDK to integrate with Gelato Relay", | ||
@@ -15,3 +15,4 @@ "main": "dist/index.js", | ||
"lint": "eslint --cache .", | ||
"prepare": "husky install" | ||
"prepare": "husky install", | ||
"test": "npx ts-node test/test.ts" | ||
}, | ||
@@ -26,2 +27,3 @@ "keywords": [], | ||
"@typescript-eslint/parser": "^5.30.0", | ||
"dotenv": "^16.0.2", | ||
"eslint": "^8.18.0", | ||
@@ -34,2 +36,3 @@ "eslint-config-prettier": "^8.5.0", | ||
"lint-staged": "^13.0.3", | ||
"minimize-js": "^1.3.0", | ||
"prettier": "^2.7.1", | ||
@@ -36,0 +39,0 @@ "typescript": "4.5.3" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
56293
15
64
1072
1