diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d0df4d6aa..2a7d8e71f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -60,6 +60,10 @@ jobs: - name: Mgv cli Tests run: yarn mgv help + # == verify docs can be generated == + - name: Generate Docs + run: yarn doc + # == Send coverage report to Coveralls == # Coverallsapp by default uses GITHUB_SHA but that does not necessarily correspond # to HEAD because a branch is checked out. We here find the actual SHA for HEAD. diff --git a/examples/tutorials/deploy-kandel.js b/examples/tutorials/deploy-kandel.js index 0be1d5ce5..03cde80f9 100644 --- a/examples/tutorials/deploy-kandel.js +++ b/examples/tutorials/deploy-kandel.js @@ -85,8 +85,8 @@ const seed = { }; // Deploy a Kandel instance with the specified seed data (the offers are later populated based on the above distribution) -const { result: kandelPromise } = await kandelStrategies.seeder.sow(seed); -const kandelInstance = await kandelPromise; +const { result } = await kandelStrategies.seeder.sow(seed); +const kandelInstance = await result; // Approve Kandel instance to use our funds const approvalTxs = await kandelInstance.approveIfHigher(); diff --git a/package.json b/package.json index a66fca9dd..3cd98e035 100644 --- a/package.json +++ b/package.json @@ -123,7 +123,8 @@ "ts-mockito": "^2.0.0", "ts-node": "^10.9.1", "typechain": "^8.1.0", - "typedoc": "^0.25.2", + "typedoc": "^0.25.7", + "typedoc-plugin-markdown": "^3.17.1", "typescript": "^5.2.2" }, "packageManager": "yarn@3.5.0" diff --git a/src/configuration.ts b/src/configuration.ts index 272e9b2ae..1a17d01ce 100644 --- a/src/configuration.ts +++ b/src/configuration.ts @@ -13,7 +13,8 @@ import { ReliableHttpProvider, ReliableWebsocketProvider, } from "@mangrovedao/reliable-event-subscriber"; -import { Bigish, Provider, typechain } from "./types"; +import { Provider, typechain } from "./types"; +import { Bigish } from "./util"; import * as mgvDeployments from "@mangrovedao/mangrove-deployments"; import * as contextAddresses from "@mangrovedao/context-addresses"; import * as eth from "./eth"; @@ -783,7 +784,7 @@ function readContextAaveAddresses() { * * Example for adding configuration for a new token with symbol "SYM": * - * updateConfiguration({tokens: { SYM: { decimals: 18}}}) + * `updateConfiguration({tokens: { SYM: { decimals: 18}}})` */ export function updateConfiguration(defaults: PartialConfiguration): void { config = deepmerge(config, defaults) as Configuration; diff --git a/src/eth.ts b/src/eth.ts index 2e33a442a..26c4da3fb 100644 --- a/src/eth.ts +++ b/src/eth.ts @@ -8,7 +8,7 @@ import { Provider, Signer } from "./types"; import { logger, logdataLimiter } from "./util/logger"; import { readJsonWallet } from "./util/readJsonWallet"; -interface JsonWalletOptions { +export interface JsonWalletOptions { // local path to json wallet file path: string; // json wallet password diff --git a/src/index.ts b/src/index.ts index 7eced051c..68c743ad4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -11,50 +11,177 @@ import Mangrove from "./mangrove"; import Market from "./market"; import Semibook from "./semibook"; import OfferLogic from "./offerLogic"; -import Token from "./token"; +import Token, { + AmountAndOverrides, + ApproveArgs, + TokenCalculations, +} from "./token"; import LiquidityProvider from "./liquidityProvider"; import KandelStrategies from "./kandelStrategies"; import * as mgvTestUtil from "./util/test/mgvIntegrationTestUtil"; import { typechain } from "./types"; -import KandelDistribution from "./kandel/kandelDistribution"; +import { Bigish } from "./util"; +import KandelDistribution, { + OfferDistribution, + OfferList, +} from "./kandel/kandelDistribution"; import GeometricKandelDistributionGenerator from "./kandel/geometricKandel/geometricKandelDistributionGenerator"; import KandelFarm from "./kandel/kandelFarm"; -import KandelSeeder from "./kandel/kandelSeeder"; -import CoreKandelInstance from "./kandel/coreKandelInstance"; +import KandelSeeder, { KandelSeed } from "./kandel/kandelSeeder"; +import CoreKandelInstance, { + KandelParameterOverrides, + KandelParameters, + MarketOrMarketFactory, +} from "./kandel/coreKandelInstance"; import OfferMaker from "./offerMaker"; import { enableLogging } from "./util/logger"; -import configuration from "./configuration"; -import TickPriceHelper from "./util/tickPriceHelper"; +import configuration, { + AddressesConfig, + Configuration, + KandelAllConfigurationFields, + KandelMarketConfiguration, + KandelNetworkConfiguration, + KandelRawMarketConfiguration, + MangroveOrderNetworkConfiguration, + NamedAddresses, + PartialConfiguration, + PartialKandelAllConfigurationFields, + PartialKandelConfiguration, + PartialMangroveOrderConfiguration, + PartialMarketConfig, + PartialNetworkConfig, + RecursivePartial, + ReliableEventSubscriberConfig, + TokenConfig, + TokenDefaults, + address, + network, + tokenId, + tokenSymbol, +} from "./configuration"; +import TickPriceHelper, { RoundingMode } from "./util/tickPriceHelper"; import GeometricKandelDistribution from "./kandel/geometricKandel/geometricKandelDistribution"; import GeneralKandelDistribution from "./kandel/generalKandelDistribution"; -import GeometricKandelInstance from "./kandel/geometricKandel/geometricKandelInstance"; +import GeometricKandelInstance, { + GeometricKandelParameterOverrides, +} from "./kandel/geometricKandel/geometricKandelInstance"; +import KandelDistributionHelper, { + OffersWithGives, +} from "./kandel/kandelDistributionHelper"; +import GeneralKandelDistributionGenerator from "./kandel/generalKandelDistributionGenerator"; +import GeometricKandelDistributionHelper, { + DistributionParams, + PriceDistributionParams, + TickDistributionParams, +} from "./kandel/geometricKandel/geometricKandelDistributionHelper"; +import GeneralKandelDistributionHelper from "./kandel/generalKandelDistributionHelper"; +import GeometricKandelLib from "./kandel/geometricKandel/geometricKandelLib"; +import GeometricKandelStatus, { + OfferStatus, + OffersWithLiveness, + Statuses, +} from "./kandel/geometricKandel/geometricKandelStatus"; +import TradeEventManagement, { + Optional, + OrderResultWithOptionalSummary, +} from "./util/tradeEventManagement"; +import Trade, { CleanUnitParams } from "./util/trade"; +import KandelConfiguration from "./kandel/kandelConfiguration"; +import { JsonWalletOptions } from "./eth"; +import MangroveEventSubscriber from "./mangroveEventSubscriber"; +import { prettyPrintFilter } from "./util/prettyPrint"; +import { Density } from "./util/Density"; // Turn off Ethers.js warnings // ethers.utils.Logger.setLogLevel(ethers.utils.Logger.levels.ERROR); export default Mangrove; + +// Mangrove +export { Mangrove, Market, Semibook, OfferLogic, LiquidityProvider }; + +// Utils +export type { prettyPrintFilter }; +export type { Bigish }; +export type { Optional }; +export type { JsonWalletOptions }; +export type { MangroveEventSubscriber }; +export { Density, eth, typechain, ethers, OfferMaker, enableLogging }; + +// Test utils +export { mgvTestUtil }; + +// Tick price helper +export { TickPriceHelper }; +export type { RoundingMode }; + +// Trade +export { Trade, TradeEventManagement }; +export type { CleanUnitParams, OrderResultWithOptionalSummary }; + +// Kandel export { - eth, - typechain, - ethers, - Mangrove, - Market, - Semibook, - Token, - OfferLogic, - LiquidityProvider, - mgvTestUtil, KandelStrategies, KandelDistribution, GeneralKandelDistribution, GeometricKandelDistributionGenerator, GeometricKandelDistribution, KandelFarm, - KandelSeeder, CoreKandelInstance, GeometricKandelInstance, - OfferMaker, - TickPriceHelper, - enableLogging, - configuration, + KandelDistributionHelper, + GeneralKandelDistributionGenerator, + KandelConfiguration, + GeometricKandelDistributionHelper, + GeneralKandelDistributionHelper, + GeometricKandelLib, + GeometricKandelStatus, + KandelSeeder, +}; +export type { + OfferDistribution, + DistributionParams, + PriceDistributionParams, + TickDistributionParams, + OfferStatus, + KandelParameterOverrides, + GeometricKandelParameterOverrides, + KandelSeed, + MarketOrMarketFactory, + OffersWithGives, + OffersWithLiveness, + KandelParameters, + Statuses, + OfferList, +}; + +// Token +export { Token, TokenCalculations }; +export type { ApproveArgs, AmountAndOverrides }; + +// Configuration +export { configuration }; +export type { + KandelMarketConfiguration, + PartialKandelAllConfigurationFields, + RecursivePartial, + network, + PartialNetworkConfig, + address, + AddressesConfig, + KandelRawMarketConfiguration, + PartialConfiguration, + NamedAddresses, + KandelAllConfigurationFields, + MangroveOrderNetworkConfiguration, + PartialMarketConfig, + tokenSymbol, + PartialMangroveOrderConfiguration, + tokenId, + TokenDefaults, + TokenConfig, + ReliableEventSubscriberConfig, + PartialKandelConfiguration, + KandelNetworkConfiguration, + Configuration, }; diff --git a/src/kandel/coreKandelInstance.ts b/src/kandel/coreKandelInstance.ts index 4f7ca2697..66cee0979 100644 --- a/src/kandel/coreKandelInstance.ts +++ b/src/kandel/coreKandelInstance.ts @@ -1,6 +1,6 @@ import * as ethers from "ethers"; -import { Bigish, typechain } from "../types"; - +import { typechain } from "../types"; +import { Bigish } from "../util"; import * as KandelTypes from "../types/typechain/GeometricKandel"; import Big from "big.js"; @@ -16,6 +16,7 @@ import KandelSeeder from "./kandelSeeder"; import GeneralKandelDistribution from "./generalKandelDistribution"; import GeneralKandelDistributionGenerator from "./generalKandelDistributionGenerator"; import GeneralKandelDistributionHelper from "./generalKandelDistributionHelper"; +import Mangrove from "../mangrove"; // The market used by the Kandel instance or a factory function to create the market. export type MarketOrMarketFactory = @@ -350,8 +351,6 @@ class CoreKandelInstance { /** Creates a distribution based on an explicit set of offers based on the Kandel parameters. * @param params The parameters for the distribution. * @param params.explicitOffers The explicit offers to use. - * @param params.explicitOffers.bids The explicit bids to use. - * @param params.explicitOffers.asks The explicit asks to use. * @returns The new distribution. */ public async createDistributionWithOffers(params: { @@ -405,9 +404,7 @@ class CoreKandelInstance { /** Calculates a new distribution based on the provided offers and deltas. * @param params The parameters for the new distribution. - * @param params.explicitOffers The offers to use. - * @param params.explicitOffers.bids The explicit bids to use. - * @param params.explicitOffers.asks The explicit asks to use. + * @param params.explicitOffers The explicit offers to use. * @param params.baseDelta The delta to apply to the base token volume. If not provided, then the base token volume is unchanged. * @param params.quoteDelta The delta to apply to the quote token volume. If not provided, then the quote token volume is unchanged. * @param params.minimumBasePerOffer The minimum base token volume per offer. If not provided, then the minimum base token volume is used. @@ -569,17 +566,11 @@ class CoreKandelInstance { /** Calculates the provision locked for a set of offers based on the given parameters * @param existingOffers the offers to calculate provision for. - * @param existingOffers.bids[].gasprice the gas price for the offer in Mwei. Should be 0 for deprovisioned offers. - * @param existingOffers.bids[].gasreq the gas requirement for the offer. - * @param existingOffers.bids[].gasbase the offer list's offer_gasbase. - * @param existingOffers.asks[].gasprice the gas price for the offer in Mwei. Should be 0 for deprovisioned offers. - * @param existingOffers.asks[].gasreq the gas requirement for the offer. - * @param existingOffers.asks[].gasbase the offer list's offer_gasbase. * @returns the locked provision, in ethers. */ public getLockedProvisionFromOffers(existingOffers: { - bids: { gasprice: number; gasreq: number; gasbase: number }[]; - asks: { gasprice: number; gasreq: number; gasbase: number }[]; + bids: Mangrove.OfferProvisionParams[]; + asks: Mangrove.OfferProvisionParams[]; }) { return this.market.mgv.calculateOffersProvision( existingOffers.bids.concat(existingOffers.asks), @@ -614,10 +605,7 @@ class CoreKandelInstance { * @param params.distribution The distribution to calculate the provision for. Optional. * @param params.bidCount The number of bids to calculate the provision for. Optional. * @param params.askCount The number of asks to calculate the provision for. Optional. - * @param existingOffers[] the offers with potential locked provision. - * @param existingOffers[].gasprice the gas price for the offer in Mwei. Should be 0 for deprovisioned offers. - * @param existingOffers[].gasreq the gas requirement for the offer. - * @param existingOffers[].gasbase the offer list's offer_gasbase. + * @param existingOffers the offers with potential locked provision. * @returns the additional required provision, in ethers. * @remarks If neither distribution nor askCount or bidCount is provided, then the current number of price points less the stepSize is used. */ @@ -630,8 +618,8 @@ class CoreKandelInstance { askCount?: number; }, existingOffers: { - bids: { gasprice: number; gasreq: number; gasbase: number }[]; - asks: { gasprice: number; gasreq: number; gasbase: number }[]; + bids: Mangrove.OfferProvisionParams[]; + asks: Mangrove.OfferProvisionParams[]; }, ) { const lockedProvision = this.getLockedProvisionFromOffers(existingOffers); @@ -938,11 +926,7 @@ class CoreKandelInstance { /** Retracts offers * @param params The parameters. - * @param params.retractParams The parameters for retracting offers. - * @param params.retractParams.startIndex The start Kandel index of offers to retract. If not provided, then 0 is used. - * @param params.retractParams.endIndex The end index of offers to retract. This is exclusive of the offer the index 'endIndex'. If not provided, then the number of price points is used. - * @param params.retractParams.maxOffersInChunk The maximum number of offers to include in a single retract transaction. If not provided, then KandelConfiguration is used. - * @param params.retractParams.firstAskIndex The index of the first ask in the distribution. It is used to determine the order in which to retract offers if multiple chunks are needed; if not provided, the midpoint between start and end is used. + * @param params.retractParams The parameters for retracting offers. See {@link retractOffers} * @param params.skipLast Whether to skip the last chunk. This is used to allow the last chunk to be retracted while withdrawing funds. * @param overrides The ethers overrides to use when calling the retractOffers function. * @returns The transaction(s) used to retract the offers. diff --git a/src/kandel/generalKandelDistribution.ts b/src/kandel/generalKandelDistribution.ts index dc56916e6..242fe5fb4 100644 --- a/src/kandel/generalKandelDistribution.ts +++ b/src/kandel/generalKandelDistribution.ts @@ -7,12 +7,10 @@ import KandelDistribution, { /** @title A general distribution of bids and ask for Kandel fully specified as bids and asks with tick and volumes and no other parameters. */ class GeneralKandelDistribution extends KandelDistribution { /** Constructor - * @param params.offers The distribution of bids and asks. - * @param params.baseQuoteTickOffset The number of ticks to jump between two price points - this gives the geometric progression. Should be >=1. * @param params.pricePoints The number of price points in the distribution. * @param params.stepSize The step size used when transporting funds from an offer to its dual. Should be >=1. + * @param params.offers The distribution of bids and asks. * @param params.market The key data about the market. - * */ public constructor(params: { pricePoints: number; diff --git a/src/kandel/generalKandelDistributionGenerator.ts b/src/kandel/generalKandelDistributionGenerator.ts index 7af856696..104bd3186 100644 --- a/src/kandel/generalKandelDistributionGenerator.ts +++ b/src/kandel/generalKandelDistributionGenerator.ts @@ -1,5 +1,5 @@ import Big from "big.js"; -import { Bigish } from "../types"; +import { Bigish } from "../util"; import KandelDistribution from "./kandelDistribution"; import { OffersWithGives } from "./kandelDistributionHelper"; import GeneralKandelDistributionHelper from "./generalKandelDistributionHelper"; @@ -50,8 +50,6 @@ class GeneralKandelDistributionGenerator { /** Creates a distribution based on an explicit set of offers. Either based on an original distribution or parameters for one. * @param params The parameters for the distribution. * @param params.explicitOffers The explicit offers to use. - * @param params.explicitOffers.bids The explicit bids to use. - * @param params.explicitOffers.asks The explicit asks to use. * @param params.distribution The original distribution or parameters for one. If pricePoints is not provided, then the number of offers is used. * @returns The new distribution. */ diff --git a/src/kandel/generalKandelDistributionHelper.ts b/src/kandel/generalKandelDistributionHelper.ts index 4e80e075a..8a03cb243 100644 --- a/src/kandel/generalKandelDistributionHelper.ts +++ b/src/kandel/generalKandelDistributionHelper.ts @@ -17,7 +17,6 @@ class GeneralKandelDistributionHelper { * @param explicitOffers The explicit offers to use. * @param explicitOffers.bids The explicit bids to use. * @param explicitOffers.asks The explicit asks to use. - * @param explicitAsks The explicit asks to use. * @param distribution The original distribution. If pricePoints is not provided, then the number of offers is used. * @returns The new distribution. */ diff --git a/src/kandel/geometricKandel/geometricKandelDistribution.ts b/src/kandel/geometricKandel/geometricKandelDistribution.ts index 1660c582c..ca32f74f0 100644 --- a/src/kandel/geometricKandel/geometricKandelDistribution.ts +++ b/src/kandel/geometricKandel/geometricKandelDistribution.ts @@ -1,7 +1,7 @@ import KandelDistribution, { OfferDistribution } from "../kandelDistribution"; -import { Bigish } from "../../types"; import Market from "../../market"; import GeometricKandelDistributionHelper from "./geometricKandelDistributionHelper"; +import { Bigish } from "../../util"; /** @title A geometric distribution of bids and ask for a geometric Kandel. */ class GeometricKandelDistribution extends KandelDistribution { @@ -23,7 +23,7 @@ class GeometricKandelDistribution extends KandelDistribution { * @param pricePoints The number of price points in the distribution. * @param stepSize The step size used when transporting funds from an offer to its dual. Should be >=1. * @param offers The distribution of bids and asks. - * @param params.market The key data about the market. + * @param market The key data about the market. */ public constructor( geometricHelper: GeometricKandelDistributionHelper, diff --git a/src/kandel/geometricKandel/geometricKandelDistributionGenerator.ts b/src/kandel/geometricKandel/geometricKandelDistributionGenerator.ts index a0aef4883..96c598b7a 100644 --- a/src/kandel/geometricKandel/geometricKandelDistributionGenerator.ts +++ b/src/kandel/geometricKandel/geometricKandelDistributionGenerator.ts @@ -1,12 +1,12 @@ import Big from "big.js"; import Market from "../../market"; -import { Bigish } from "../../types"; import GeometricKandelLib from "./geometricKandelLib"; import GeometricKandelDistributionHelper, { DistributionParams, } from "./geometricKandelDistributionHelper"; import GeometricKandelDistribution from "./geometricKandelDistribution"; import GeneralKandelDistributionHelper from "../generalKandelDistributionHelper"; +import { Bigish } from "../../util"; /** @title Helper for generating geometric Kandel distributions. */ class GeometricKandelDistributionGenerator { @@ -100,7 +100,6 @@ class GeometricKandelDistributionGenerator { /** Calculates a minimal recommended volume distribution of bids and asks and their base and quote amounts to match the geometric price distribution given by parameters. * @param params The parameters for the geometric price distribution. * @param params.distributionParams The parameters for the geometric price distribution. - * @param params.stepSize The step size used when transporting funds from an offer to its dual. * @param params.constantBase Whether the base amount should be constant for all offers. * @param params.constantQuote Whether the quote amount should be constant for all offers. * @param params.minimumBasePerOffer The minimum amount of base to give for each offer. Should be at least minimumBasePerOfferFactor from KandelConfiguration multiplied with the minimum volume for the market. @@ -124,11 +123,11 @@ class GeometricKandelDistributionGenerator { ); const protoDistribution = - await this.calculateDistributionFromGeometricParams({ + await this.calculateDistributionFromGeometricParams( geometricParams, - initialBidGives: 1, - initialAskGives: 1, - }); + 1, + 1, + ); const { askGives, bidGives } = protoDistribution.calculateMinimumInitialGives( @@ -136,11 +135,11 @@ class GeometricKandelDistributionGenerator { Big(params.minimumQuotePerOffer), ); - return this.calculateDistributionFromGeometricParams({ + return this.calculateDistributionFromGeometricParams( geometricParams, - initialAskGives: params.constantQuote ? undefined : askGives, - initialBidGives: params.constantBase ? undefined : bidGives, - }); + params.constantQuote ? undefined : askGives, + params.constantBase ? undefined : bidGives, + ); } /** Calculates distribution of bids and asks and their base and quote amounts to match the geometric price distribution given by parameters. @@ -160,46 +159,45 @@ class GeometricKandelDistributionGenerator { params.distributionParams, ); - return this.calculateDistributionFromGeometricParams({ + return this.calculateDistributionFromGeometricParams( geometricParams, - initialAskGives: params.initialAskGives, - initialBidGives: params.initialBidGives, - }); + params.initialAskGives, + params.initialBidGives, + ); } /** Calculates distribution of bids and asks and their base and quote amounts to match the geometric price distribution given by parameters. - * @param params The parameters for the geometric distribution. - * @param params.geometricParams The parameters for the geometric price distribution. - * @param params.geometricParams.pricePoints The number of price points in the distribution. - * @param params.geometricParams.firstAskIndex The index of the first live ask. - * @param params.geometricParams.baseQuoteTickOffset The number of ticks to jump between two price points. - * @param params.geometricParams.baseQuoteTickIndex0 The tick of the lowest priced price point. - * @param params.geometricParams.stepSize The step size used when transporting funds from an offer to its dual. - * @param params.initialAskGives The initial amount of base to give for all asks. Should be at least minimumBasePerOfferFactor from KandelConfiguration multiplied with the minimum volume for the market. If not provided, then initialBidGives is used as quote for asks, and the base the ask gives is set to according to the price. - * @param params.initialBidGives The initial amount of quote to give for all bids. Should be at least minimumQuotePerOfferFactor from KandelConfiguration multiplied with the minimum volume for the market. If not provided, then initialAskGives is used as base for bids, and the quote the bid gives is set to according to the price. + * @param geometricParams The parameters for the geometric price distribution. + * @param geometricParams.pricePoints The number of price points in the distribution. + * @param geometricParams.firstAskIndex The index of the first live ask. + * @param geometricParams.baseQuoteTickOffset The number of ticks to jump between two price points. + * @param geometricParams.baseQuoteTickIndex0 The tick of the lowest priced price point. + * @param geometricParams.stepSize The step size used when transporting funds from an offer to its dual. + * @param initialAskGives The initial amount of base to give for all asks. Should be at least minimumBasePerOfferFactor from KandelConfiguration multiplied with the minimum volume for the market. If not provided, then initialBidGives is used as quote for asks, and the base the ask gives is set to according to the price. + * @param initialBidGives The initial amount of quote to give for all bids. Should be at least minimumQuotePerOfferFactor from KandelConfiguration multiplied with the minimum volume for the market. If not provided, then initialAskGives is used as base for bids, and the quote the bid gives is set to according to the price. * @returns The distribution of bids and asks and their base and quote amounts. * @remarks The price distribution may not match the priceDistributionParams exactly due to limited precision. */ - public async calculateDistributionFromGeometricParams(params: { + public async calculateDistributionFromGeometricParams( geometricParams: { baseQuoteTickOffset: number; pricePoints: number; firstAskIndex: number; baseQuoteTickIndex0: number; stepSize: number; - }; - initialAskGives?: Bigish; - initialBidGives?: Bigish; - }) { + }, + initialAskGives?: Bigish, + initialBidGives?: Bigish, + ) { const distribution = await this.geometricKandelLib.createFullGeometricDistribution({ - baseQuoteTickIndex0: params.geometricParams.baseQuoteTickIndex0, - baseQuoteTickOffset: params.geometricParams.baseQuoteTickOffset, - firstAskIndex: params.geometricParams.firstAskIndex, - bidGives: params.initialBidGives, - askGives: params.initialAskGives, - pricePoints: params.geometricParams.pricePoints, - stepSize: params.geometricParams.stepSize, + baseQuoteTickIndex0: geometricParams.baseQuoteTickIndex0, + baseQuoteTickOffset: geometricParams.baseQuoteTickOffset, + firstAskIndex: geometricParams.firstAskIndex, + bidGives: initialBidGives, + askGives: initialAskGives, + pricePoints: geometricParams.pricePoints, + stepSize: geometricParams.stepSize, }); return distribution; @@ -224,11 +222,11 @@ class GeometricKandelDistributionGenerator { params.availableQuote ? Big(params.availableQuote) : undefined, ); - return this.calculateDistributionFromGeometricParams({ - geometricParams: params.distribution, - initialAskGives: initialGives.askGives, - initialBidGives: initialGives.bidGives, - }); + return this.calculateDistributionFromGeometricParams( + params.distribution, + initialGives.askGives, + initialGives.bidGives, + ); } /** Retrieves the minimum volume for a given offer type at the given index. diff --git a/src/kandel/geometricKandel/geometricKandelDistributionHelper.ts b/src/kandel/geometricKandel/geometricKandelDistributionHelper.ts index 70bdb9c33..6133cc615 100644 --- a/src/kandel/geometricKandel/geometricKandelDistributionHelper.ts +++ b/src/kandel/geometricKandel/geometricKandelDistributionHelper.ts @@ -2,7 +2,7 @@ import Market from "../../market"; import { MAX_TICK, MIN_TICK } from "../../util/coreCalculations/Constants"; import Big from "big.js"; import { ethers } from "ethers"; -import { Bigish } from "../../types"; +import { Bigish } from "../../util"; import KandelDistributionHelper from "../kandelDistributionHelper"; /** Price and price ratio parameters for calculating a geometric price distribution. diff --git a/src/kandel/geometricKandel/geometricKandelInstance.ts b/src/kandel/geometricKandel/geometricKandelInstance.ts index e4bf9a547..8ef2f7c49 100644 --- a/src/kandel/geometricKandel/geometricKandelInstance.ts +++ b/src/kandel/geometricKandel/geometricKandelInstance.ts @@ -1,5 +1,6 @@ import Market from "../../market"; -import { Bigish, typechain } from "../../types"; +import { typechain } from "../../types"; +import { Bigish } from "../../util"; import CoreKandelInstance, { KandelParameterOverrides, MarketOrMarketFactory, diff --git a/src/kandel/geometricKandel/geometricKandelLib.ts b/src/kandel/geometricKandel/geometricKandelLib.ts index 31c731ae6..edc7cf578 100644 --- a/src/kandel/geometricKandel/geometricKandelLib.ts +++ b/src/kandel/geometricKandel/geometricKandelLib.ts @@ -1,6 +1,6 @@ import * as ethers from "ethers"; -import { Bigish, typechain } from "../../types"; - +import { typechain } from "../../types"; +import { Bigish } from "../../util"; import KandelDistribution, { OfferDistribution } from "../kandelDistribution"; import GeometricKandelDistribution from "./geometricKandelDistribution"; import Market from "../../market"; diff --git a/src/kandel/geometricKandel/geometricKandelStatus.ts b/src/kandel/geometricKandel/geometricKandelStatus.ts index 9f8b6153c..59f54532a 100644 --- a/src/kandel/geometricKandel/geometricKandelStatus.ts +++ b/src/kandel/geometricKandel/geometricKandelStatus.ts @@ -122,9 +122,7 @@ class GeometricKandelStatus { * @param stepSize The step size used when transporting funds from an offer to its dual. * @param offers The offers to determine the status of. * @returns The status of the Kandel instance. - * @remarks The expected prices are determined by extrapolating from an offer closest to the mid price. - * @remarks Offers are expected to be live bids below the mid price and asks above. - * @remarks Offers are expected to be dead near the mid price due to the step size between the live bid and ask. + * @remarks The expected prices are determined by extrapolating from an offer closest to the mid price. Offers are expected to be live bids below the mid price and asks above. Offers are expected to be dead near the mid price due to the step size between the live bid and ask. */ public getOfferStatuses( midPrice: Big, diff --git a/src/kandel/kandelDistribution.ts b/src/kandel/kandelDistribution.ts index ab706d925..e624da78c 100644 --- a/src/kandel/kandelDistribution.ts +++ b/src/kandel/kandelDistribution.ts @@ -31,10 +31,9 @@ class KandelDistribution { helper: KandelDistributionHelper; /** Constructor - * @param offers The distribution of bids and asks. - * @param baseQuoteTickOffset The number of ticks to jump between two price points - this gives the geometric progression. Should be >=1. * @param pricePoints The number of price points in the distribution. * @param stepSize The step size used when transporting funds from an offer to its dual. Should be >=1. + * @param offers The distribution of bids and asks. * @param market The key data about the market. */ public constructor( diff --git a/src/kandel/kandelDistributionHelper.ts b/src/kandel/kandelDistributionHelper.ts index 49abf3b80..b94741131 100644 --- a/src/kandel/kandelDistributionHelper.ts +++ b/src/kandel/kandelDistributionHelper.ts @@ -1,6 +1,6 @@ import Big from "big.js"; import Market from "../market"; -import { Bigish } from "../types"; +import { Bigish } from "../util"; import TickPriceHelper from "../util/tickPriceHelper"; /** Offers with their tick, Kandel index, and gives amount. @@ -39,7 +39,7 @@ class KandelDistributionHelper { /** Uniformly changes values by a total amount without decreasing below a minimum for each value. A value already below minimum will not be changed. * @param values The values to change. - * @param totalDelta The total amount to change. + * @param delta The total amount to change. * @param minimumValue The minimum value for each value. * @param round The function to round the values. * @returns The new values and the total change. diff --git a/src/kandel/kandelSeeder.ts b/src/kandel/kandelSeeder.ts index 04e28544f..4bdebf71d 100644 --- a/src/kandel/kandelSeeder.ts +++ b/src/kandel/kandelSeeder.ts @@ -151,7 +151,6 @@ class KandelSeeder { } /** Retrieves the gasprice for the Kandel type multiplied by the buffer factor. - * @param params The parameters for sowing the Kandel instance. * @param gaspriceFactor The factor to multiply the gasprice by. This is used to ensure that the Kandel offers do not fail to be reposted even if Mangrove's gasprice increases up to this. * @param gasprice The gasprice (in Mwei) to use for the Kandel (before multiplying with the factor). If null, then Mangrove's global gasprice will be used. * @returns The gasprice for the Kandel type multiplied by the buffer factor. diff --git a/src/liquidityProvider.ts b/src/liquidityProvider.ts index 0fc750a21..8b95ac21e 100644 --- a/src/liquidityProvider.ts +++ b/src/liquidityProvider.ts @@ -4,7 +4,7 @@ import util from "util"; import Market from "./market"; // syntactic sugar -import { Bigish } from "./types"; +import { Bigish } from "./util"; import Mangrove from "./mangrove"; import { typechain } from "./types"; @@ -29,12 +29,11 @@ namespace LiquidityProvider { * offer order. */ - type OptParams = { fund?: Bigish }; - - export type OfferParams = - | ({ price: Bigish; volume: Bigish } & OptParams) - | ({ tick: number; gives: Bigish } & OptParams) - | ({ wants: Bigish; gives: Bigish } & OptParams); + export type OfferParams = ( + | { price: Bigish; volume: Bigish } + | { tick: number; gives: Bigish } + | { wants: Bigish; gives: Bigish } + ) & { fund?: Bigish }; export type OfferActionResult = { offerType: Market.BA; diff --git a/src/mangrove.ts b/src/mangrove.ts index a5f265a16..a7133e11e 100644 --- a/src/mangrove.ts +++ b/src/mangrove.ts @@ -5,7 +5,8 @@ import configuration, { } from "./configuration"; import * as eth from "./eth"; import DevNode from "./util/devNode"; -import { Bigish, Provider, Signer, typechain } from "./types"; +import { Provider, Signer, typechain } from "./types"; +import { Bigish } from "./util"; import { logdataLimiter, logger } from "./util/logger"; import { TypedDataSigner } from "@ethersproject/abstract-signer"; import { ApproveArgs, TokenCalculations } from "./token"; @@ -105,6 +106,17 @@ namespace Mangrove { export type Configuration = MangroveJsConfiguration; export type PartialConfiguration = PartialMangroveJsConfiguration; + + /** Parameters used to calculate provision for an offer + * @param gasprice the gas price for the offer in Mwei. + * @param gasreq the gas requirement for the offer + * @param gasbase the offer list's offer_gasbase. + */ + export type OfferProvisionParams = { + gasprice: number; + gasreq: number; + gasbase: number; + }; } class Mangrove { @@ -662,15 +674,10 @@ class Mangrove { } /** Calculates the provision required or locked for offers based on the given parameters - * @param offers[] the offers to calculate provision for. - * @param offers[].gasprice the gas price for the offer in Mwei. - * @param offers[].gasreq the gas requirement for the offer - * @param offers[].gasbase the offer list's offer_gasbase. + * @param offers the offers to calculate provision for. * @returns the required provision, in ethers. */ - public calculateOffersProvision( - offers: { gasprice: number; gasreq: number; gasbase: number }[], - ) { + public calculateOffersProvision(offers: Mangrove.OfferProvisionParams[]) { return offers.reduce( (acc, offer) => acc.add( @@ -887,9 +894,9 @@ class Mangrove { /** * Returns open markets data according to MgvReader. - * @param from start at market `from`. Default 0. - * @param maxLen max number of markets returned. Default all. - * @param configs fetch market's config information. Default true. + * @param params.from start at market `from`. Default 0. + * @param params.maxLen max number of markets returned. Default all. + * @param params.configs fetch market's config information. Default true. * @note If an open market has a token with no/bad decimals/symbol function, this function will revert. */ async openMarkets( diff --git a/src/market.ts b/src/market.ts index c9fdfd4f0..dbcf6fa38 100644 --- a/src/market.ts +++ b/src/market.ts @@ -3,7 +3,8 @@ import { BigNumber } from "ethers"; // syntactic sugar import Mangrove from "./mangrove"; import Token, { TokenCalculations } from "./token"; import Semibook from "./semibook"; -import { Bigish, typechain } from "./types"; +import { typechain } from "./types"; +import { Bigish } from "./util"; import Trade from "./util/trade"; import * as TCM from "./types/typechain/Mangrove"; import TradeEventManagement from "./util/tradeEventManagement"; @@ -371,16 +372,6 @@ namespace Market { gasbase: number; }; - // eslint-disable-next-line @typescript-eslint/no-namespace - export namespace BookReturns { - type _BookReturns = Awaited< - ReturnType - >; - export type Indices = _BookReturns[1]; - export type Offers = _BookReturns[2]; - export type Details = _BookReturns[3]; - } - /** * Type for events emitted by the Mangrove market. */ @@ -1075,7 +1066,7 @@ class Market { /** * Clean a set of given offers. * @param params Parameters for the cleaning, specifying the target offers, the side of the market to clean, and optionally the taker to impersonate. - * @param overrides: ethers overrides for the transaction. + * @param overrides ethers overrides for the transaction. * @returns a promise that resolves to the transasction response and the result of the cleaning. * * @see {@link Market.CleanParams} for a description of params. @@ -1093,7 +1084,7 @@ class Market { /** * Gets parameters to send to function `market.mgv.cleanerContract.cleanByImpersonation`. * - * @param params: Parameters for the cleaning, specifying the target offers, the side of the market to clean, and optionally the taker to impersonate + * @param params Parameters for the cleaning, specifying the target offers, the side of the market to clean, and optionally the taker to impersonate * * @returns a promise that resolves to the raw parameters to send to the cleaner contract * @@ -1143,8 +1134,8 @@ class Market { /** Uses {@link Semibook.simulateMarketOrder} to simulate the gas required for a market order. An overhead of 50% is added to account for changes to the book and failing offers. * @param ba bids or asks - * @param gives amount of inbound token to give to the makers - * @param wants amount of outbound token to receive from the makers + * @param maxTick the maximum to reach for the market order. + * @param fillVolume the amount to fill (wants or gives) * @param fillWants whether to fill wants or gives */ async simulateGas( diff --git a/src/offerLogic.ts b/src/offerLogic.ts index 644eecb82..bc0b8c1a5 100644 --- a/src/offerLogic.ts +++ b/src/offerLogic.ts @@ -1,6 +1,6 @@ import * as ethers from "ethers"; -import { Bigish } from "./types"; import { typechain } from "./types"; +import { Bigish } from "./util"; import { Mangrove, Market } from "."; import { TransactionResponse } from "@ethersproject/abstract-provider"; diff --git a/src/semibook.ts b/src/semibook.ts index e64b785cd..2d79902a3 100644 --- a/src/semibook.ts +++ b/src/semibook.ts @@ -10,7 +10,7 @@ import { StateLogSubscriber, } from "@mangrovedao/reliable-event-subscriber"; import MangroveEventSubscriber from "./mangroveEventSubscriber"; -import { Bigish } from "./types"; +import { Bigish } from "./util"; import { OfferDetailUnpackedStructOutput, OfferUnpackedStructOutput, diff --git a/src/token.ts b/src/token.ts index 727291284..0e557e683 100644 --- a/src/token.ts +++ b/src/token.ts @@ -1,7 +1,7 @@ import Big from "big.js"; import * as ethers from "ethers"; import Mangrove from "./mangrove"; -import { Bigish } from "./types"; +import { Bigish } from "./util"; import { typechain } from "./types"; import UnitCalculations from "./util/unitCalculations"; import configuration from "./configuration"; @@ -19,7 +19,10 @@ namespace Token { } // Used to ease the use of approve functions -type AmountAndOverrides = { amount: Bigish; overrides: ethers.Overrides }; +export type AmountAndOverrides = { + amount: Bigish; + overrides: ethers.Overrides; +}; export type ApproveArgs = Bigish | ethers.Overrides | AmountAndOverrides; function approveArgsIsBigish(args: ApproveArgs): args is Bigish { diff --git a/src/types/index.ts b/src/types/index.ts index 5a17f3553..e6f345e08 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -1,24 +1,7 @@ import { Provider } from "@ethersproject/abstract-provider"; import { Signer } from "@ethersproject/abstract-signer"; -import type { MarkOptional } from "ts-essentials"; -import type { BigSource } from "big.js"; export type { Signer, Provider }; import * as typechain from "./typechain/index"; export { typechain }; - -/* Mangrove */ - -export interface TokenInfo { - name: string; - address: string; - decimals: number; -} - -export interface MarketParams { - base: string | MarkOptional; - quote: string | MarkOptional; -} - -export type Bigish = BigSource; diff --git a/src/util.ts b/src/util.ts index c85d1beb9..fe840044a 100644 --- a/src/util.ts +++ b/src/util.ts @@ -1,3 +1,7 @@ +import { BigSource } from "big.js"; + +export type Bigish = BigSource; + export class Deferred { public readonly promise: Promise; #resolve!: (value: T | PromiseLike) => void; diff --git a/src/util/Density.ts b/src/util/Density.ts index a27106439..56260c5f8 100644 --- a/src/util/Density.ts +++ b/src/util/Density.ts @@ -127,7 +127,7 @@ export class Density { /** * Get the maximum amount of gas an offer may require for the given raw amount of outbound tokens. * - * @param outbound the raw amount of outbound tokens to calculate the maximum gas for + * @param rawOutboundAmt the raw amount of outbound tokens to calculate the maximum gas for * @returns the maximum amount of gas an offer may require for the given raw amount of outbound tokens */ getMaximumGasForRawOutbound(rawOutboundAmt: BigNumberish): BigNumber { diff --git a/src/util/tickPriceHelper.ts b/src/util/tickPriceHelper.ts index 29e375936..d5091aa0d 100644 --- a/src/util/tickPriceHelper.ts +++ b/src/util/tickPriceHelper.ts @@ -3,7 +3,7 @@ import * as TickLib from "./coreCalculations/TickLib"; import Market from "../market"; import Big from "big.js"; -import { Bigish } from "../types"; +import { Bigish } from "../util"; import { MANTISSA_BITS, MIN_RATIO_EXP } from "./coreCalculations/Constants"; /** roundDown rounds down to a representable value, roundUp rounds up to a representable value, and nearest rounds to the nearest representable value. */ diff --git a/src/util/trade.ts b/src/util/trade.ts index 88c0b22e7..3f0e41735 100644 --- a/src/util/trade.ts +++ b/src/util/trade.ts @@ -1,7 +1,7 @@ import Big, { BigSource } from "big.js"; import { BigNumber, ContractTransaction, ethers } from "ethers"; import Market from "../market"; -import { Bigish } from "../types"; +import { Bigish } from "../util"; import logger from "./logger"; import TradeEventManagement, { OrderResultWithOptionalSummary, @@ -9,7 +9,7 @@ import TradeEventManagement, { import configuration from "../configuration"; import TickPriceHelper from "./tickPriceHelper"; -type CleanUnitParams = { +export type CleanUnitParams = { ba: Market.BA; targets: { offerId: number; @@ -430,9 +430,9 @@ class Trade { /** * Clean a set of given offers. - * @param params: Parameters for the cleaning, specifying the target offers, the side of the market to clean, and optionally the taker to impersonate. - * @param market: the market to clean on - * @param overrides: ethers overrides for the transaction + * @param params Parameters for the cleaning, specifying the target offers, the side of the market to clean, and optionally the taker to impersonate. + * @param market the market to clean on + * @param overrides ethers overrides for the transaction * @returns a promise that resolves to the transaction response and the result of the cleaning. * * @see {@link Market.CleanParams} for a more thorough description of cleaning parameters. @@ -463,8 +463,8 @@ class Trade { /** * Gets parameters to send to function `market.mgv.cleanerContract.cleanByImpersonation`. * - * @param params: Parameters for the cleaning, specifying the target offers, the side of the market to clean, and optionally the taker to impersonate. - * @param market: the market to clean on + * @param params Parameters for the cleaning, specifying the target offers, the side of the market to clean, and optionally the taker to impersonate. + * @param market the market to clean on * @returns a promise that resolves to the raw parameters to send to the cleaner contract * * @remarks @@ -500,7 +500,8 @@ class Trade { /** * Estimate amount of gas for a buy or sell order for the given volume. * @param bs buy or sell - * @param volume volume to trade + * @param params The parameters for the trade + * @param market The market * @returns an estimate of the gas required for the trade */ async estimateGas(bs: Market.BS, params: Market.TradeParams, market: Market) { @@ -522,7 +523,7 @@ class Trade { } /** Simulate the gas required for a market order. - * @param ba buy or sell + * @param bs buy or sell * @param params trade parameters - see {@link Market.TradeParams} * @param market the market to trade on * @returns an estimate of the gas required for the trade diff --git a/src/util/tradeEventManagement.ts b/src/util/tradeEventManagement.ts index 4d9e8c641..138c22fa9 100644 --- a/src/util/tradeEventManagement.ts +++ b/src/util/tradeEventManagement.ts @@ -21,7 +21,7 @@ import { import { logger } from "./logger"; import { CleanStartEvent } from "../types/typechain/IMangrove"; -type Optional = Pick, K> & Omit; +export type Optional = Pick, K> & Omit; export type OrderResultWithOptionalSummary = Optional< Market.DirtyOrderResult, diff --git a/src/util/unitCalculations.ts b/src/util/unitCalculations.ts index 1cc5bf67c..954bf7952 100644 --- a/src/util/unitCalculations.ts +++ b/src/util/unitCalculations.ts @@ -1,6 +1,6 @@ import Big from "big.js"; import * as ethers from "ethers"; -import { Bigish } from "../types"; +import { Bigish } from "../util"; class UnitCalculations { /** Convert public token amount to internal token representation. diff --git a/test/integration/kandel/seeder.integration.test.ts b/test/integration/kandel/seeder.integration.test.ts index ba1f64888..bb0a06475 100644 --- a/test/integration/kandel/seeder.integration.test.ts +++ b/test/integration/kandel/seeder.integration.test.ts @@ -98,8 +98,8 @@ describe(`${KandelSeeder.prototype.constructor.name} integration tests suite`, f ); return; } - const { result: kandelPromise } = await seeder.sow(seed); - const kandel = await kandelPromise; + const { result } = await seeder.sow(seed); + const kandel = await result; // Assert const params = await kandel.getParameters(); @@ -153,8 +153,8 @@ describe(`${KandelSeeder.prototype.constructor.name} integration tests suite`, f 2, 10000, ); - const { result: kandelPromise } = await seeder.sow(seed); - const kandel = await kandelPromise; + const { result } = await seeder.sow(seed); + const kandel = await result; await kandel.setGasprice(20000); // Assert diff --git a/test/integration/market.integration.test.ts b/test/integration/market.integration.test.ts index 6ed7668c1..a46e9281e 100644 --- a/test/integration/market.integration.test.ts +++ b/test/integration/market.integration.test.ts @@ -13,13 +13,12 @@ import { } from "../../src/util/test/mgvIntegrationTestUtil"; import assert from "assert"; -import { Mangrove, Market, Semibook } from "../../src"; +import { Bigish, Mangrove, Market, Semibook } from "../../src"; import * as helpers from "../util/helpers"; import { Big } from "big.js"; import { BigNumber, utils } from "ethers"; import * as mockito from "ts-mockito"; -import { Bigish } from "../../src/types"; import { Density } from "../../src/util/Density"; import { MAX_TICK } from "../../src/util/coreCalculations/Constants"; import TickPriceHelper from "../../src/util/tickPriceHelper"; diff --git a/test/integration/semibook.integration.test.ts b/test/integration/semibook.integration.test.ts index d56c25ef0..6e5288181 100644 --- a/test/integration/semibook.integration.test.ts +++ b/test/integration/semibook.integration.test.ts @@ -12,14 +12,13 @@ import { } from "../util/helpers"; const waitForTransaction = mgvTestUtil.waitForTransaction; -import { Mangrove, Market, Semibook, TickPriceHelper } from "../../src"; +import { Bigish, Mangrove, Market, Semibook, TickPriceHelper } from "../../src"; import { TransactionReceipt } from "@ethersproject/providers"; import { Big } from "big.js"; import { BigNumber } from "ethers"; import { Density } from "../../src/util/Density"; import * as DensityLib from "../../src/util/coreCalculations/DensityLib"; -import { Bigish } from "../../src/types"; import { waitForBlock } from "../../src/util/test/mgvIntegrationTestUtil"; //pretty-print when using console.log diff --git a/test/unit/tickPriceHelper.unit.test.ts b/test/unit/tickPriceHelper.unit.test.ts index 70ff2a7da..4d7f79d81 100644 --- a/test/unit/tickPriceHelper.unit.test.ts +++ b/test/unit/tickPriceHelper.unit.test.ts @@ -1,10 +1,9 @@ import assert from "assert"; import { Big } from "big.js"; import { describe, it } from "mocha"; -import { Market } from "../../src"; +import { Bigish, Market } from "../../src"; import { BigNumber } from "ethers"; import TickPriceHelper, { RoundingMode } from "../../src/util/tickPriceHelper"; -import { Bigish } from "../../src/types"; import { bidsAsks } from "../../src/util/test/mgvIntegrationTestUtil"; import UnitCalculations from "../../src/util/unitCalculations"; import * as TickLib from "../../src/util/coreCalculations/TickLib"; diff --git a/test/unit/trade.unit.test.ts b/test/unit/trade.unit.test.ts index b47d63d17..b96160a3f 100644 --- a/test/unit/trade.unit.test.ts +++ b/test/unit/trade.unit.test.ts @@ -4,8 +4,7 @@ import { Big } from "big.js"; import { BigNumber } from "ethers"; import { describe, it } from "mocha"; import { spy, verify } from "ts-mockito"; -import { Market } from "../../src"; -import { Bigish } from "../../src/types"; +import { Bigish, Market } from "../../src"; import Trade from "../../src/util/trade"; import TickPriceHelper from "../../src/util/tickPriceHelper"; import { TokenCalculations } from "../../src/token"; diff --git a/test/util/helpers.ts b/test/util/helpers.ts index f86080a52..2d6d581df 100644 --- a/test/util/helpers.ts +++ b/test/util/helpers.ts @@ -1,6 +1,5 @@ import { BigNumber, BigNumberish, ContractTransaction, utils } from "ethers"; -import Mangrove, { Market, TickPriceHelper, Token } from "../../src"; -import { Bigish } from "../../src/types"; +import Mangrove, { Bigish, Market, TickPriceHelper, Token } from "../../src"; import Big from "big.js"; import assert from "assert"; diff --git a/typedoc.json b/typedoc.json index 3a8908d4b..8270ade64 100644 --- a/typedoc.json +++ b/typedoc.json @@ -1,7 +1,53 @@ { "entryPoints": ["src/index.ts"], + "exclude": [ + "node_modules/ethers/**/*", + "src/types/Mangrove.ts", + "src/types/**/*", + "src/types/typechain/Mangrove.ts" + ], + "intentionallyNotExported": [ + "PrettyPrint", + "IMangrove", + "MgvReader", + "Multicall2", + "MangroveOrder", + "DevNode", + "__module", + "AaveKandelSeeder", + "CoreKandel", + "GeometricKandel", + "ILiquidityProvider", + "KandelSeeder", + "OfferWriteEvent", + "OfferFailEvent", + "OfferSuccessEvent", + "OfferRetractEvent", + "SetActiveEvent", + "SetFeeEvent", + "SetGasbaseEvent", + "SetDensity96X32Event", + "IOfferLogic", + "SignerOrProvider", + "OLKeyStruct", + "Result", + "OfferWriteEventObject", + "TestToken", + "DirectWithBidsAndAsksDistribution.DistributionStruct", + "AbstractRouter", + "GlobalUnpackedStructOutput", + "MgvLib.CleanTargetStruct", + "LocalUnpackedStructOutput", + "SimpleTestMaker", + "CleanStartEvent", + "OfferFailWithPosthookDataEvent", + "OfferSuccessWithPosthookDataEvent", + "MangroveOrderStartEvent" + ], "out": "docs", "excludePrivate": true, "excludeInternal": true, - "sort": "source-order" + "plugin": ["typedoc-plugin-markdown"], + "sort": ["source-order"], + "treatWarningsAsErrors": true } diff --git a/yarn.lock b/yarn.lock index c4b196152..95403e757 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1340,7 +1340,8 @@ __metadata: ts-mockito: ^2.0.0 ts-node: ^10.9.1 typechain: ^8.1.0 - typedoc: ^0.25.2 + typedoc: ^0.25.7 + typedoc-plugin-markdown: ^3.17.1 typescript: ^5.2.2 util: ^0.12.5 yargs: ^17.3.0 @@ -3764,6 +3765,24 @@ __metadata: languageName: node linkType: hard +"handlebars@npm:^4.7.7": + version: 4.7.8 + resolution: "handlebars@npm:4.7.8" + dependencies: + minimist: ^1.2.5 + neo-async: ^2.6.2 + source-map: ^0.6.1 + uglify-js: ^3.1.4 + wordwrap: ^1.0.0 + dependenciesMeta: + uglify-js: + optional: true + bin: + handlebars: bin/handlebars + checksum: 00e68bb5c183fd7b8b63322e6234b5ac8fbb960d712cb3f25587d559c2951d9642df83c04a1172c918c41bcfc81bfbd7a7718bbce93b893e0135fc99edea93ff + languageName: node + linkType: hard + "has-bigints@npm:^1.0.1, has-bigints@npm:^1.0.2": version: 1.0.2 resolution: "has-bigints@npm:1.0.2" @@ -4919,7 +4938,7 @@ __metadata: languageName: node linkType: hard -"minimist@npm:^1.2.0, minimist@npm:^1.2.3": +"minimist@npm:^1.2.0, minimist@npm:^1.2.3, minimist@npm:^1.2.5": version: 1.2.8 resolution: "minimist@npm:1.2.8" checksum: 75a6d645fb122dad29c06a7597bddea977258957ed88d7a6df59b5cd3fe4a527e253e9bbf2e783e4b73657f9098b96a5fe96ab8a113655d4109108577ecf85b0 @@ -5132,6 +5151,13 @@ __metadata: languageName: node linkType: hard +"neo-async@npm:^2.6.2": + version: 2.6.2 + resolution: "neo-async@npm:2.6.2" + checksum: deac9f8d00eda7b2e5cd1b2549e26e10a0faa70adaa6fdadca701cc55f49ee9018e427f424bac0c790b7c7e2d3068db97f3093f1093975f2acb8f8818b936ed9 + languageName: node + linkType: hard + "nice-try@npm:^1.0.4": version: 1.0.5 resolution: "nice-try@npm:1.0.5" @@ -6207,15 +6233,15 @@ __metadata: languageName: node linkType: hard -"shiki@npm:^0.14.1": - version: 0.14.2 - resolution: "shiki@npm:0.14.2" +"shiki@npm:^0.14.7": + version: 0.14.7 + resolution: "shiki@npm:0.14.7" dependencies: ansi-sequence-parser: ^1.1.0 jsonc-parser: ^3.2.0 vscode-oniguruma: ^1.7.0 vscode-textmate: ^8.0.0 - checksum: f2a14302b1803617e3ff1b751a5c87b4af4ad15214dc00e9215402e42940a84a0b956cf55d628f25dbf1296b18e277b8529571cd9359b971ac599a0ab11303e7 + checksum: 2aec3b3519df977c4391df9e1825cb496e9a4d7e11395f05a0da77e4fa2f7c3d9d6e6ee94029ac699533017f2b25637ee68f6d39f05f311535c2704d0329b520 languageName: node linkType: hard @@ -6925,19 +6951,30 @@ __metadata: languageName: node linkType: hard -"typedoc@npm:^0.25.2": - version: 0.25.2 - resolution: "typedoc@npm:0.25.2" +"typedoc-plugin-markdown@npm:^3.17.1": + version: 3.17.1 + resolution: "typedoc-plugin-markdown@npm:3.17.1" + dependencies: + handlebars: ^4.7.7 + peerDependencies: + typedoc: ">=0.24.0" + checksum: f12494bfc98ef532be63fb5e7630ff0aa2de17bb22b1d0b6260c416fe8b62cb537ddd3576cadc90c57c4aae2371722994ed873dc3220b23660e149a3eb676c04 + languageName: node + linkType: hard + +"typedoc@npm:^0.25.7": + version: 0.25.7 + resolution: "typedoc@npm:0.25.7" dependencies: lunr: ^2.3.9 marked: ^4.3.0 minimatch: ^9.0.3 - shiki: ^0.14.1 + shiki: ^0.14.7 peerDependencies: - typescript: 4.6.x || 4.7.x || 4.8.x || 4.9.x || 5.0.x || 5.1.x || 5.2.x + typescript: 4.6.x || 4.7.x || 4.8.x || 4.9.x || 5.0.x || 5.1.x || 5.2.x || 5.3.x bin: typedoc: bin/typedoc - checksum: 5b6e24bae7498bb542aaba495378ed5a3e13c76eb04a1ae95b506f76bda4d517847101fb05a7eab3f6b79357d1e2ac6f4747d39792395329b72e463f7effda65 + checksum: 49c3bf923a3c9401b549e5843f8efaaac8fa28f8ec6bd8617187b5d9ba9932a3fa63dc3863b82389507ffc7d92908af0dce33780fffb4970cd0833274f6fa0cf languageName: node linkType: hard @@ -6982,6 +7019,15 @@ __metadata: languageName: node linkType: hard +"uglify-js@npm:^3.1.4": + version: 3.17.4 + resolution: "uglify-js@npm:3.17.4" + bin: + uglifyjs: bin/uglifyjs + checksum: 7b3897df38b6fc7d7d9f4dcd658599d81aa2b1fb0d074829dd4e5290f7318dbca1f4af2f45acb833b95b1fe0ed4698662ab61b87e94328eb4c0a0d3435baf924 + languageName: node + linkType: hard + "unbox-primitive@npm:^1.0.2": version: 1.0.2 resolution: "unbox-primitive@npm:1.0.2" @@ -7201,6 +7247,13 @@ __metadata: languageName: node linkType: hard +"wordwrap@npm:^1.0.0": + version: 1.0.0 + resolution: "wordwrap@npm:1.0.0" + checksum: 2a44b2788165d0a3de71fd517d4880a8e20ea3a82c080ce46e294f0b68b69a2e49cff5f99c600e275c698a90d12c5ea32aff06c311f0db2eb3f1201f3e7b2a04 + languageName: node + linkType: hard + "wordwrapjs@npm:^4.0.0": version: 4.0.1 resolution: "wordwrapjs@npm:4.0.1"