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

@bancor/carbon-sdk

Package Overview
Dependencies
Maintainers
2
Versions
104
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bancor/carbon-sdk - npm Package Compare versions

Comparing version 0.0.89-DEV to 0.0.90-DEV

44

dist/shared/index5.js

@@ -762,2 +762,20 @@ import { d as Decimal, t as tenPow, f as formatUnits, p as parseUnits, B as BigNumber, e as trimDecimal, m as mulDiv } from './numerics.js';

}
/**
* Calculate the overlapping strategy prices. Returns it with correct decimals
*
* @param {string} quoteToken - The address of the quote token.
* @param {string} buyPriceLow - The minimum buy price for the strategy, in in `quoteToken` per 1 `baseToken`, as a string.
* @param {string} sellPriceHigh - The maximum sell price for the strategy, in `quoteToken` per 1 `baseToken`, as a string.
* @param {string} marketPrice - The market price, in `quoteToken` per 1 `baseToken`, as a string.
* @param {string} spreadPercentage - The spread percentage, e.g. for 10%, enter `10`.
* @return {Promise<{
* buyPriceLow: string;
* buyPriceHigh: string;
* buyPriceMarginal: string;
* sellPriceLow: string;
* sellPriceHigh: string;
* sellPriceMarginal: string;
* marketPrice: string;
* }>} The calculated overlapping strategy prices.
*/
async calculateOverlappingStrategyPrices(quoteToken, buyPriceLow, sellPriceHigh, marketPrice, spreadPercentage) {

@@ -769,6 +787,9 @@ logger.debug('calculateOverlappingStrategyPrices called', arguments);

const result = {
buyPriceLow: trimDecimal(buyPriceLow, quoteDecimals),
buyPriceHigh: trimDecimal(prices.buyPriceHigh.toString(), quoteDecimals),
buyPriceMarginal: trimDecimal(prices.buyPriceMarginal.toString(), quoteDecimals),
sellPriceLow: trimDecimal(prices.sellPriceLow.toString(), quoteDecimals),
sellPriceHigh: trimDecimal(sellPriceHigh, quoteDecimals),
sellPriceMarginal: trimDecimal(prices.sellPriceMarginal.toString(), quoteDecimals),
marketPrice: trimDecimal(marketPrice, quoteDecimals),
};

@@ -840,5 +861,7 @@ logger.debug('calculateOverlappingStrategyPrices info:', {

* @param {string} buyPriceLow - The minimum buy price for the strategy, in in `quoteToken` per 1 `baseToken`, as a string.
* @param {string} buyPriceMarginal - The marginal buy price for the strategy, in in `quoteToken` per 1 `baseToken`, as a string.
* @param {string} buyPriceHigh - The maximum buy price for the strategy, in `quoteToken` per 1 `baseToken`, as a string.
* @param {string} buyBudget - The maximum budget for buying tokens in the strategy, in `quoteToken`, as a string.
* @param {string} sellPriceLow - The minimum sell price for the strategy, in `quoteToken` per 1 `baseToken`, as a string.
* @param {string} sellPriceMarginal - The marginal sell price for the strategy, in `quoteToken` per 1 `baseToken`, as a string.
* @param {string} sellPriceHigh - The maximum sell price for the strategy, in `quoteToken` per 1 `baseToken`, as a string.

@@ -864,4 +887,6 @@ * @param {string} sellBudget - The maximum budget for selling tokens in the strategy, in `baseToken`, as a string.

* '0.2',
* '0.2',
* '1',
* '0.5',
* '0.5',
* '0.6',

@@ -886,11 +911,14 @@ * '2'

/**
* Creates an unsigned transaction to update an on chain strategy.
* This function takes various optional parameters to update different aspects of the strategy and returns a promise that resolves to a PopulatedTransaction object.
*
* @param strategyId
* @param encoded
* @param param2
* @param {MarginalPriceOptions | string} marginalPrice - The marginal price parameter.
* Can either be a value from the `MarginalPriceOptions` enum, or a "BigNumberish" string value for advanced users -
* who wish to set the marginal price themselves.
* @param overrides
* @returns
* @param {string} strategyId - The unique identifier of the strategy to be updated.
* @param {EncodedStrategyBNStr} encoded - The encoded strategy string, representing the current state of the strategy in the contracts.
* @param {StrategyUpdate} strategyUpdate - An object containing optional fields to update in the strategy, including buy and sell price limits and budgets.
* @param {MarginalPriceOptions | string} [buyPriceMarginal] - Optional parameter that can be used to instruct the SDK what to do with the marginal price - or pass a value to use.
* If unsure leave this undefined.
* @param {MarginalPriceOptions | string} [sellPriceMarginal] - Optional parameter that can be used to instruct the SDK what to do with the marginal price - or pass a value to use.
* If unsure leave this undefined.
* @param {PayableOverrides} [overrides] - Optional Ethereum transaction overrides.
* @returns {Promise<PopulatedTransaction>} A promise that resolves to a PopulatedTransaction object.
*/

@@ -897,0 +925,0 @@ async updateStrategy(strategyId, encoded, { buyPriceLow, buyPriceHigh, buyBudget, sellPriceLow, sellPriceHigh, sellBudget, }, buyPriceMarginal, sellPriceMarginal, overrides) {

@@ -241,7 +241,28 @@ import { PopulatedTransaction } from '@ethersproject/contracts';

composeTradeBySourceTransaction(sourceToken: string, targetToken: string, tradeActions: TradeActionBNStr[], deadline: string, minReturn: string, overrides?: PayableOverrides): Promise<PopulatedTransaction>;
/**
* Calculate the overlapping strategy prices. Returns it with correct decimals
*
* @param {string} quoteToken - The address of the quote token.
* @param {string} buyPriceLow - The minimum buy price for the strategy, in in `quoteToken` per 1 `baseToken`, as a string.
* @param {string} sellPriceHigh - The maximum sell price for the strategy, in `quoteToken` per 1 `baseToken`, as a string.
* @param {string} marketPrice - The market price, in `quoteToken` per 1 `baseToken`, as a string.
* @param {string} spreadPercentage - The spread percentage, e.g. for 10%, enter `10`.
* @return {Promise<{
* buyPriceLow: string;
* buyPriceHigh: string;
* buyPriceMarginal: string;
* sellPriceLow: string;
* sellPriceHigh: string;
* sellPriceMarginal: string;
* marketPrice: string;
* }>} The calculated overlapping strategy prices.
*/
calculateOverlappingStrategyPrices(quoteToken: string, buyPriceLow: string, sellPriceHigh: string, marketPrice: string, spreadPercentage: string): Promise<{
buyPriceLow: string;
buyPriceHigh: string;
buyPriceMarginal: string;
sellPriceLow: string;
sellPriceHigh: string;
sellPriceMarginal: string;
marketPrice: string;
}>;

@@ -284,5 +305,7 @@ /**

* @param {string} buyPriceLow - The minimum buy price for the strategy, in in `quoteToken` per 1 `baseToken`, as a string.
* @param {string} buyPriceMarginal - The marginal buy price for the strategy, in in `quoteToken` per 1 `baseToken`, as a string.
* @param {string} buyPriceHigh - The maximum buy price for the strategy, in `quoteToken` per 1 `baseToken`, as a string.
* @param {string} buyBudget - The maximum budget for buying tokens in the strategy, in `quoteToken`, as a string.
* @param {string} sellPriceLow - The minimum sell price for the strategy, in `quoteToken` per 1 `baseToken`, as a string.
* @param {string} sellPriceMarginal - The marginal sell price for the strategy, in `quoteToken` per 1 `baseToken`, as a string.
* @param {string} sellPriceHigh - The maximum sell price for the strategy, in `quoteToken` per 1 `baseToken`, as a string.

@@ -308,4 +331,6 @@ * @param {string} sellBudget - The maximum budget for selling tokens in the strategy, in `baseToken`, as a string.

* '0.2',
* '0.2',
* '1',
* '0.5',
* '0.5',
* '0.6',

@@ -321,11 +346,14 @@ * '2'

/**
* Creates an unsigned transaction to update an on chain strategy.
* This function takes various optional parameters to update different aspects of the strategy and returns a promise that resolves to a PopulatedTransaction object.
*
* @param strategyId
* @param encoded
* @param param2
* @param {MarginalPriceOptions | string} marginalPrice - The marginal price parameter.
* Can either be a value from the `MarginalPriceOptions` enum, or a "BigNumberish" string value for advanced users -
* who wish to set the marginal price themselves.
* @param overrides
* @returns
* @param {string} strategyId - The unique identifier of the strategy to be updated.
* @param {EncodedStrategyBNStr} encoded - The encoded strategy string, representing the current state of the strategy in the contracts.
* @param {StrategyUpdate} strategyUpdate - An object containing optional fields to update in the strategy, including buy and sell price limits and budgets.
* @param {MarginalPriceOptions | string} [buyPriceMarginal] - Optional parameter that can be used to instruct the SDK what to do with the marginal price - or pass a value to use.
* If unsure leave this undefined.
* @param {MarginalPriceOptions | string} [sellPriceMarginal] - Optional parameter that can be used to instruct the SDK what to do with the marginal price - or pass a value to use.
* If unsure leave this undefined.
* @param {PayableOverrides} [overrides] - Optional Ethereum transaction overrides.
* @returns {Promise<PopulatedTransaction>} A promise that resolves to a PopulatedTransaction object.
*/

@@ -332,0 +360,0 @@ updateStrategy(strategyId: string, encoded: EncodedStrategyBNStr, { buyPriceLow, buyPriceHigh, buyBudget, sellPriceLow, sellPriceHigh, sellBudget, }: StrategyUpdate, buyPriceMarginal?: MarginalPriceOptions | string, sellPriceMarginal?: MarginalPriceOptions | string, overrides?: PayableOverrides): Promise<PopulatedTransaction>;

5

package.json

@@ -5,3 +5,3 @@ {

"source": "src/index.ts",
"version": "0.0.89-DEV",
"version": "0.0.90-DEV",
"description": "The SDK is a READ-ONLY tool, intended to facilitate working with Carbon contracts. It's a convenient wrapper around our matching algorithm, allowing programs and users get a ready to use transaction data that will allow them to manage strategies and fulfill trades",

@@ -21,2 +21,5 @@ "main": "dist/index.js",

],
"engines": {
"node": ">=20"
},
"typesVersions": {

@@ -23,0 +26,0 @@ "*": {

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

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