New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@cryptorubic/sdk

Package Overview
Dependencies
Maintainers
0
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cryptorubic/sdk - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

src/lib/core/ws-service/ws-api-service.d.ts

2

package.json
{
"name": "@cryptorubic/sdk",
"version": "0.0.3",
"version": "0.0.4",
"dependencies": {

@@ -5,0 +5,0 @@ "tslib": "^2.3.0"

import { QuoteAllInterface, QuoteRequestInterface, QuoteResponseInterface, SwapBestRequestInterface, SwapRequestInterface, SwapResponseInterface } from "@cryptorubic/core";
export declare class ApiService {
private static get apiUrl();
static get apiUrl(): string;
static quoteAll(body: QuoteRequestInterface): Promise<QuoteAllInterface>;

@@ -5,0 +5,0 @@ static quoteBest(body: QuoteRequestInterface): Promise<QuoteResponseInterface>;

import { BlockchainAdapterFactoryService } from "@cryptorubic/web3";
import { HttpClient } from "@cryptorubic/core";
import { TokenService } from "../token-service/token.service";
import { ApiWsService } from "../ws-service/ws-api-service";
export declare class Injector {

@@ -9,6 +10,8 @@ private readonly httpClient;

private static injector;
static get tokenService(): TokenService;
private readonly _wsApiService;
static get wsApiService(): ApiWsService;
private readonly _tokensService;
static get tokensService(): TokenService;
static get chainFactory(): BlockchainAdapterFactoryService;
static get httpClient(): HttpClient;
private readonly tokensService;
static get envType(): string;

@@ -15,0 +18,0 @@ static createInjector(httpClient: HttpClient, blockchainFactory: BlockchainAdapterFactoryService, envType: string): void;

@@ -5,6 +5,10 @@ "use strict";

const token_service_1 = require("../token-service/token.service");
const ws_api_service_1 = require("../ws-service/ws-api-service");
class Injector {
static get tokenService() {
return this.injector.tokensService;
static get wsApiService() {
return this.injector._wsApiService;
}
static get tokensService() {
return this.injector._tokensService;
}
static get chainFactory() {

@@ -27,5 +31,6 @@ return Injector.injector.chainFactory;

Injector.injector = this;
this.tokensService = new token_service_1.TokenService(httpClient, chainFactory);
this._tokensService = new token_service_1.TokenService(httpClient, chainFactory);
this._wsApiService = new ws_api_service_1.ApiWsService();
}
}
exports.Injector = Injector;
import { IntegratorAddress } from "../../core/sdk/models/integrator-address";
import { QuoteRequestInterface, QuoteTradeInterface } from "@cryptorubic/core";
import { Trade } from "./models/trade";
import { Trade } from "./trade";
export declare class Router {

@@ -8,2 +8,5 @@ private readonly integratorAddress;

quoteAll(tradeData: QuoteTradeInterface, options?: Omit<QuoteRequestInterface, keyof QuoteTradeInterface>): Promise<Trade[]>;
quoteBest(tradeData: QuoteTradeInterface, options?: Omit<QuoteRequestInterface, keyof QuoteTradeInterface>): Promise<Trade>;
private getIntegratorAddress;
private getQuoteOptions;
}

@@ -11,6 +11,3 @@ "use strict";

async quoteAll(tradeData, options) {
const body = {
...tradeData,
...options
};
const body = this.getQuoteOptions(tradeData, options);
const response = await api_service_1.ApiService.quoteAll(body);

@@ -20,3 +17,24 @@ const routes = await transform_utils_1.TransformUtils.transformRoutes(response.routes, tradeData);

}
async quoteBest(tradeData, options) {
const body = this.getQuoteOptions(tradeData, options);
const response = await api_service_1.ApiService.quoteBest(body);
const [route] = await transform_utils_1.TransformUtils.transformRoutes([response], tradeData);
return route;
}
getIntegratorAddress(tradeData, integratorAddress) {
if (integratorAddress) {
return integratorAddress;
}
return tradeData.dstTokenBlockchain === tradeData.srcTokenBlockchain
? this.integratorAddress.onChain
: this.integratorAddress.crossChain;
}
getQuoteOptions(tradeData, options) {
return {
...tradeData,
...options,
integratorAddress: this.getIntegratorAddress(tradeData, options?.integratorAddress)
};
}
}
exports.Router = Router;
import { QuoteRequestInterface, QuoteResponseInterface } from "@cryptorubic/core";
import { Trade } from "../models/trade";
import { Trade } from "../trade";
export declare class TransformUtils {

@@ -4,0 +4,0 @@ static transformRoutes(routes: QuoteResponseInterface[], quote: QuoteRequestInterface): Promise<Trade[]>;

@@ -7,3 +7,3 @@ "use strict";

const injector_1 = require("../../../core/injector/injector");
const trade_1 = require("../models/trade");
const trade_1 = require("../trade");
class TransformUtils {

@@ -62,8 +62,8 @@ static async transformRoutes(routes, quote) {

static transformInterfaceToToken(tokenInterface) {
return injector_1.Injector.tokenService.createPriceToken(tokenInterface);
return injector_1.Injector.tokensService.createPriceToken(tokenInterface);
}
static transformInterfaceToTokenAmount(tokenInterface, amount) {
return injector_1.Injector.tokenService.createPriceTokenAmount(tokenInterface, amount);
return injector_1.Injector.tokensService.createPriceTokenAmount(tokenInterface, amount);
}
}
exports.TransformUtils = TransformUtils;
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