You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP
Socket
Sign inDemoInstall
Socket

@lifi/sdk

Package Overview
Dependencies
Maintainers
1
Versions
187
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lifi/sdk - npm Package Compare versions

Comparing version

to
2.0.0-beta.4

dist/cjs/execution/RouteExecutionManager.d.ts

4

dist/cjs/execution/StepExecutor.d.ts
import { Signer } from 'ethers';
import { InteractionSettings, InternalExecutionSettings, Step } from '../types';
import { ExecutionManager } from './ExecutionManager';
import { StatusManager } from './StatusManager';
import { StepExecutionManager } from './StepExecutionManager';
export declare class StepExecutor {
executionManager: ExecutionManager;
stepExecutionManager: StepExecutionManager;
statusManager: StatusManager;

@@ -8,0 +8,0 @@ settings: InternalExecutionSettings;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.StepExecutor = void 0;
const ExecutionManager_1 = require("./ExecutionManager");
const StepExecutionManager_1 = require("./StepExecutionManager");
const switchChain_1 = require("./switchChain");

@@ -22,3 +22,3 @@ // Please be careful when changing the defaults as it may break the behavior (e.g., background execution)

this.allowUserInteraction = interactionSettings.allowInteraction;
this.executionManager.allowInteraction(interactionSettings.allowInteraction);
this.stepExecutionManager.allowInteraction(interactionSettings.allowInteraction);
this.statusManager.allowUpdates(interactionSettings.allowUpdates);

@@ -47,6 +47,6 @@ this.executionStopped = interactionSettings.stopExecution;

};
await this.executionManager.execute(parameters);
await this.stepExecutionManager.execute(parameters);
return step;
};
this.executionManager = new ExecutionManager_1.ExecutionManager();
this.stepExecutionManager = new StepExecutionManager_1.StepExecutionManager();
this.statusManager = statusManager;

@@ -53,0 +53,0 @@ this.settings = settings;

@@ -30,2 +30,2 @@ import { Route, Step, Token } from '@lifi/types';

};
export declare const request: <T = Response>(url: string, options?: RequestInit, retries?: number) => Promise<T>;
export declare const request: <T = Response>(url: RequestInfo | URL, options?: RequestInit, retries?: number) => Promise<T>;

@@ -1,6 +0,5 @@

import LIFI from './Lifi';
export * from './execution';
export * from './helpers';
export { LiFi } from './LiFi';
export * from './types';
export * from './utils/errors';
export default LIFI;

@@ -16,13 +16,10 @@ "use strict";

};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.LiFi = void 0;
// expose types and helpers
const Lifi_1 = __importDefault(require("./Lifi"));
__exportStar(require("./execution"), exports);
__exportStar(require("./helpers"), exports);
var LiFi_1 = require("./LiFi");
Object.defineProperty(exports, "LiFi", { enumerable: true, get: function () { return LiFi_1.LiFi; } });
__exportStar(require("./types"), exports);
__exportStar(require("./utils/errors"), exports);
// expose sdk
exports.default = Lifi_1.default;

@@ -6,3 +6,3 @@ import { ContractCallQuoteRequest, GasRecommendationRequest, GasRecommendationResponse, GetStatusRequest, QuoteRequest, RequestOptions, TokensRequest, TokensResponse } from '@lifi/types';

getContractCallQuote: (requestConfig: ContractCallQuoteRequest, options?: RequestOptions | undefined) => Promise<Step>;
getGasRecommendation: (requestConfig: GasRecommendationRequest, options?: RequestOptions | undefined) => Promise<GasRecommendationResponse>;
getGasRecommendation: ({ chainId, fromChain, fromToken }: GasRecommendationRequest, options?: RequestOptions | undefined) => Promise<GasRecommendationResponse>;
getPossibilities: (requestConfig?: PossibilitiesRequest | undefined, options?: RequestOptions | undefined) => Promise<PossibilitiesResponse>;

@@ -9,0 +9,0 @@ getQuote: (requestConfig: QuoteRequest, options?: RequestOptions | undefined) => Promise<Step>;

@@ -280,14 +280,16 @@ "use strict";

};
const getGasRecommendation = async (requestConfig, options) => {
const getGasRecommendation = async ({ chainId, fromChain, fromToken }, options) => {
const config = ConfigService_1.default.getInstance().getConfig();
Object.keys(requestConfig).forEach((key) => !requestConfig[key] &&
delete requestConfig[key]);
if (!requestConfig.chainId) {
if (!chainId) {
throw new errors_1.ValidationError('Required parameter "chainId" is missing.');
}
const url = new URL(`${config.apiUrl}/gas/suggestion/${chainId}`);
if (fromChain) {
url.searchParams.append('fromChain', fromChain);
}
if (fromToken) {
url.searchParams.append('fromToken', fromToken);
}
try {
const response = await (0, helpers_1.request)(`${config.apiUrl}/gas/suggestion/${requestConfig.chainId}?${new URLSearchParams({
fromChain: requestConfig.fromChain,
fromToken: requestConfig.fromToken,
})}`, {
const response = await (0, helpers_1.request)(url, {
signal: options?.signal,

@@ -294,0 +296,0 @@ });

@@ -57,3 +57,3 @@ import { Route, RouteOptions, Step, Token } from '@lifi/types';

export type AcceptExchangeRateUpdateHook = (params: ExchangeRateUpdateParams) => Promise<boolean | undefined>;
export interface ExecutionData {
export interface RouteExecutionData {
route: Route;

@@ -75,8 +75,4 @@ executors: StepExecutor[];

};
export interface ActiveRouteDictionary {
[k: string]: {
executionData: ExecutionData;
executionPromise: Promise<Route>;
};
}
export type RouteExecutionDictionary = Partial<Record<string, RouteExecutionData>>;
export type RouteExecutionPromiseDictionary = Partial<Record<string, Promise<Route>>>;
export type RevokeTokenData = {

@@ -83,0 +79,0 @@ token: Token;

export declare const name = "@lifi/sdk";
export declare const version = "2.0.0-beta.3";
export declare const version = "2.0.0-beta.4";

@@ -5,2 +5,2 @@ "use strict";

exports.name = '@lifi/sdk';
exports.version = '2.0.0-beta.3';
exports.version = '2.0.0-beta.4';
import { Signer } from 'ethers';
import { InteractionSettings, InternalExecutionSettings, Step } from '../types';
import { ExecutionManager } from './ExecutionManager';
import { StatusManager } from './StatusManager';
import { StepExecutionManager } from './StepExecutionManager';
export declare class StepExecutor {
executionManager: ExecutionManager;
stepExecutionManager: StepExecutionManager;
statusManager: StatusManager;

@@ -8,0 +8,0 @@ settings: InternalExecutionSettings;

@@ -1,2 +0,2 @@

import { ExecutionManager } from './ExecutionManager';
import { StepExecutionManager } from './StepExecutionManager';
import { switchChain } from './switchChain';

@@ -19,3 +19,3 @@ // Please be careful when changing the defaults as it may break the behavior (e.g., background execution)

this.allowUserInteraction = interactionSettings.allowInteraction;
this.executionManager.allowInteraction(interactionSettings.allowInteraction);
this.stepExecutionManager.allowInteraction(interactionSettings.allowInteraction);
this.statusManager.allowUpdates(interactionSettings.allowUpdates);

@@ -44,6 +44,6 @@ this.executionStopped = interactionSettings.stopExecution;

};
await this.executionManager.execute(parameters);
await this.stepExecutionManager.execute(parameters);
return step;
};
this.executionManager = new ExecutionManager();
this.stepExecutionManager = new StepExecutionManager();
this.statusManager = statusManager;

@@ -50,0 +50,0 @@ this.settings = settings;

@@ -30,2 +30,2 @@ import { Route, Step, Token } from '@lifi/types';

};
export declare const request: <T = Response>(url: string, options?: RequestInit, retries?: number) => Promise<T>;
export declare const request: <T = Response>(url: RequestInfo | URL, options?: RequestInit, retries?: number) => Promise<T>;

@@ -1,6 +0,5 @@

import LIFI from './Lifi';
export * from './execution';
export * from './helpers';
export { LiFi } from './LiFi';
export * from './types';
export * from './utils/errors';
export default LIFI;
// expose types and helpers
import LIFI from './Lifi';
export * from './execution';
export * from './helpers';
export { LiFi } from './LiFi';
export * from './types';
export * from './utils/errors';
// expose sdk
export default LIFI;

@@ -6,3 +6,3 @@ import { ContractCallQuoteRequest, GasRecommendationRequest, GasRecommendationResponse, GetStatusRequest, QuoteRequest, RequestOptions, TokensRequest, TokensResponse } from '@lifi/types';

getContractCallQuote: (requestConfig: ContractCallQuoteRequest, options?: RequestOptions | undefined) => Promise<Step>;
getGasRecommendation: (requestConfig: GasRecommendationRequest, options?: RequestOptions | undefined) => Promise<GasRecommendationResponse>;
getGasRecommendation: ({ chainId, fromChain, fromToken }: GasRecommendationRequest, options?: RequestOptions | undefined) => Promise<GasRecommendationResponse>;
getPossibilities: (requestConfig?: PossibilitiesRequest | undefined, options?: RequestOptions | undefined) => Promise<PossibilitiesResponse>;

@@ -9,0 +9,0 @@ getQuote: (requestConfig: QuoteRequest, options?: RequestOptions | undefined) => Promise<Step>;

@@ -275,14 +275,16 @@ import { request } from '../helpers';

};
const getGasRecommendation = async (requestConfig, options) => {
const getGasRecommendation = async ({ chainId, fromChain, fromToken }, options) => {
const config = ConfigService.getInstance().getConfig();
Object.keys(requestConfig).forEach((key) => !requestConfig[key] &&
delete requestConfig[key]);
if (!requestConfig.chainId) {
if (!chainId) {
throw new ValidationError('Required parameter "chainId" is missing.');
}
const url = new URL(`${config.apiUrl}/gas/suggestion/${chainId}`);
if (fromChain) {
url.searchParams.append('fromChain', fromChain);
}
if (fromToken) {
url.searchParams.append('fromToken', fromToken);
}
try {
const response = await request(`${config.apiUrl}/gas/suggestion/${requestConfig.chainId}?${new URLSearchParams({
fromChain: requestConfig.fromChain,
fromToken: requestConfig.fromToken,
})}`, {
const response = await request(url, {
signal: options?.signal,

@@ -289,0 +291,0 @@ });

@@ -57,3 +57,3 @@ import { Route, RouteOptions, Step, Token } from '@lifi/types';

export type AcceptExchangeRateUpdateHook = (params: ExchangeRateUpdateParams) => Promise<boolean | undefined>;
export interface ExecutionData {
export interface RouteExecutionData {
route: Route;

@@ -75,8 +75,4 @@ executors: StepExecutor[];

};
export interface ActiveRouteDictionary {
[k: string]: {
executionData: ExecutionData;
executionPromise: Promise<Route>;
};
}
export type RouteExecutionDictionary = Partial<Record<string, RouteExecutionData>>;
export type RouteExecutionPromiseDictionary = Partial<Record<string, Promise<Route>>>;
export type RevokeTokenData = {

@@ -83,0 +79,0 @@ token: Token;

export declare const name = "@lifi/sdk";
export declare const version = "2.0.0-beta.3";
export declare const version = "2.0.0-beta.4";
export const name = '@lifi/sdk';
export const version = '2.0.0-beta.3';
export const version = '2.0.0-beta.4';
{
"name": "@lifi/sdk",
"version": "2.0.0-beta.3",
"version": "2.0.0-beta.4",
"description": "LI.FI Any-to-Any Cross-Chain-Swap SDK",

@@ -79,3 +79,3 @@ "main": "./dist/cjs/index.js",

"@ethersproject/contracts": "^5.7.0",
"@lifi/types": "^2.3.0",
"@lifi/types": "^2.4.1",
"bignumber.js": "^9.1.1",

@@ -92,7 +92,7 @@ "eth-rpc-errors": "^4.0.3",

"cross-fetch": "^3.1.5",
"eslint": "^8.35.0",
"eslint": "^8.36.0",
"eslint-config-prettier": "^8.7.0",
"eslint-plugin-prettier": "^4.2.1",
"husky": "^8.0.3",
"lint-staged": "^13.1.4",
"lint-staged": "^13.2.0",
"msw": "1.0.1",

@@ -99,0 +99,0 @@ "npm-run-all": "^4.1.5",