Skip to main content

@mangrovedao/mangrove.js

Namespaces​

Classes​

Interfaces​

References​

default​

Renames and re-exports Mangrove

Type Aliases​

RecursivePartial​

Ζ¬ RecursivePartial<T>: { [P in keyof T]?: T[P] extends (infer U)[] ? RecursivePartial<U>[] : T[P] extends object | undefined ? RecursivePartial<T[P]> : T[P] }

Type parameters​

Name
T

Defined in​

@mangrovedao/mangrove.js/src/configuration.ts:25


network​

Ζ¬ network: string

Defined in​

@mangrovedao/mangrove.js/src/configuration.ts:33


address​

Ζ¬ address: string

Defined in​

@mangrovedao/mangrove.js/src/configuration.ts:34


tokenId​

Ζ¬ tokenId: string

Defined in​

@mangrovedao/mangrove.js/src/configuration.ts:35


tokenSymbol​

Ζ¬ tokenSymbol: string

Defined in​

@mangrovedao/mangrove.js/src/configuration.ts:36


NamedAddresses​

Ζ¬ NamedAddresses: Record<string, address>

Defined in​

@mangrovedao/mangrove.js/src/configuration.ts:38


AddressesConfig​

Ζ¬ AddressesConfig: Record<network, NamedAddresses>

Defined in​

@mangrovedao/mangrove.js/src/configuration.ts:39


TokenConfig​

Ζ¬ TokenConfig: Object

Type declaration​

NameType
symbol?tokenSymbol
decimals?number
displayName?string
displayedDecimals?number
displayedAsPriceDecimals?number
cashness?number

Defined in​

@mangrovedao/mangrove.js/src/configuration.ts:41


TokenDefaults​

Ζ¬ TokenDefaults: Object

Type declaration​

NameType
defaultDisplayedDecimalsnumber
defaultDisplayedPriceDecimalsnumber

Defined in​

@mangrovedao/mangrove.js/src/configuration.ts:49


ReliableEventSubscriberConfig​

Ζ¬ ReliableEventSubscriberConfig: Object

Type declaration​

NameType
defaultBlockManagerOptionsBlockManager.Options
blockManagerOptionsByNetworkRecord<network, BlockManager.Options>
defaultReliableHttpProviderOptionsOmit<ReliableHttpProvider.Options, "onError">
reliableHttpProviderOptionsByNetworkRecord<network, Omit<ReliableHttpProvider.Options, "onError">>
defaultReliableWebSocketOptionsOmit<ReliableWebsocketProvider.Options, "wsUrl">
reliableWebSocketOptionsByNetworkRecord<network, Omit<ReliableWebsocketProvider.Options, "wsUrl">>

Defined in​

@mangrovedao/mangrove.js/src/configuration.ts:54


KandelNetworkConfiguration​

Ζ¬ KandelNetworkConfiguration: Object

Kandel configuration for a specific chain.

Param

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

The maximum number of offers to include in a single populate transaction to avoid exceeding the gas limit.

Param

The maximum number of offers to include in a single retract transaction to avoid exceeding the gas limit.

Type declaration​

NameType
gaspriceFactornumber
maxOffersInPopulateChunknumber
maxOffersInRetractChunknumber

Defined in​

@mangrovedao/mangrove.js/src/configuration.ts:80


KandelMarketConfiguration​

Ζ¬ KandelMarketConfiguration: Object

Kandel configuration for a specific market.

Param

Whether AaveKandel should be allowed to be used.

Param

Additional factor for the minimum amount of base token that should be offered per offer to stay above density requirements.

Param

Additional factor for the minimum amount of quote token that should be offered per offer to stay above density requirements.

Param

The default step size used when transporting funds from an offer to its dual.

Param

The default baseQuoteTickOffset number of ticks to jump between two price points - this gives the geometric progression. Should be >=1.

Type declaration​

NameType
aaveEnabledboolean
minimumBasePerOfferFactorBig
minimumQuotePerOfferFactorBig
stepSizenumber
baseQuoteTickOffsetnumber

Defined in​

@mangrovedao/mangrove.js/src/configuration.ts:93


KandelRawMarketConfiguration​

Ζ¬ KandelRawMarketConfiguration: Omit<KandelMarketConfiguration, "minimumBasePerOfferFactor" | "minimumQuotePerOfferFactor" | "baseQuoteTickOffset"> & { minimumBasePerOfferFactor: Bigish ; minimumQuotePerOfferFactor: Bigish ; baseQuoteTickOffset: number }

Defined in​

@mangrovedao/mangrove.js/src/configuration.ts:101


KandelAllConfigurationFields​

Ζ¬ KandelAllConfigurationFields: KandelNetworkConfiguration & KandelRawMarketConfiguration

Defined in​

@mangrovedao/mangrove.js/src/configuration.ts:112


PartialKandelAllConfigurationFields​

Ζ¬ PartialKandelAllConfigurationFields: Partial<KandelAllConfigurationFields>

Defined in​

@mangrovedao/mangrove.js/src/configuration.ts:115


PartialMarketConfig​

Ζ¬ PartialMarketConfig: PartialKandelAllConfigurationFields

Defined in​

@mangrovedao/mangrove.js/src/configuration.ts:117


PartialNetworkConfig​

Ζ¬ PartialNetworkConfig: PartialKandelAllConfigurationFields & { markets?: Record<tokenId, Record<tokenId, Record<number, PartialMarketConfig>>> }

Defined in​

@mangrovedao/mangrove.js/src/configuration.ts:118


PartialKandelConfiguration​

Ζ¬ PartialKandelConfiguration: PartialKandelAllConfigurationFields & { networks?: Record<network, PartialNetworkConfig> }

Defined in​

@mangrovedao/mangrove.js/src/configuration.ts:125


MangroveOrderNetworkConfiguration​

Ζ¬ MangroveOrderNetworkConfiguration: Object

Mangrove order configuration for a specific chain.

Param

The gasreq for a resting order using the MangroveOrder contract.

Param

The factor to multiply the gasprice by. This is used to ensure that the offers do not fail to be reposted even if Mangrove's gasprice increases up to this.

Param

The overhead of making a market order using the take function on MangroveOrder vs a market order directly on Mangrove.

Type declaration​

NameType
restingOrderGasreqnumber
restingOrderGaspriceFactornumber
takeGasOverheadnumber

Defined in​

@mangrovedao/mangrove.js/src/configuration.ts:134


PartialMangroveOrderConfiguration​

Ζ¬ PartialMangroveOrderConfiguration: Partial<MangroveOrderNetworkConfiguration> & { networks?: Record<network, Partial<MangroveOrderNetworkConfiguration>> }

Defined in​

@mangrovedao/mangrove.js/src/configuration.ts:140


Configuration​

Ζ¬ Configuration: Object

Type declaration​

NameType
addressesByNetworkAddressesConfig
tokenDefaultsTokenDefaults
tokensRecord<tokenId, TokenConfig>
tokenSymbolDefaultIdsByNetworkRecord<tokenSymbol, Record<network, tokenId>>
mangroveOrderPartialMangroveOrderConfiguration
reliableEventSubscriberReliableEventSubscriberConfig
kandelPartialKandelConfiguration

Defined in​

@mangrovedao/mangrove.js/src/configuration.ts:145


PartialConfiguration​

Ζ¬ PartialConfiguration: RecursivePartial<Configuration>

Defined in​

@mangrovedao/mangrove.js/src/configuration.ts:157


MarketOrMarketFactory​

Ζ¬ MarketOrMarketFactory: Market | (baseAddress: string, quoteAddress: string, tickSpacing: number) => Promise<Market>

Defined in​

@mangrovedao/mangrove.js/src/kandel/coreKandelInstance.ts:22


KandelParameters​

Ζ¬ KandelParameters: Object

Notice

Parameters for a Kandel instance.

Param

The gas price used when provisioning offers.

Param

The gas required to execute a trade.

Param

The step size used when transporting funds from an offer to its dual. Should be >=1.

Param

The number of price points. Should be >=2.

Type declaration​

NameType
gaspricenumber
gasreqnumber
stepSizenumber
pricePointsnumber

Defined in​

@mangrovedao/mangrove.js/src/kandel/coreKandelInstance.ts:37


KandelParameterOverrides​

Ζ¬ KandelParameterOverrides: Object

Notice

Parameters for a Kandel instance where provided properties override current values. baseQuoteTickOffset takes precedence over priceRatio. Note that baseQuoteTickOffset and pricePoints are normally provided via the KandelDistribution. @seeKandelParameters for more information.

Remarks

Cannot simply be Partial<KandelParameters> due to Big vs Bigish.

Type declaration​

NameType
gasprice?number
gasreq?number
stepSize?number
pricePoints?number

Defined in​

@mangrovedao/mangrove.js/src/kandel/coreKandelInstance.ts:49


PriceDistributionParams​

Ζ¬ PriceDistributionParams: Object

Price and price ratio parameters for calculating a geometric price distribution.

Param

The minimum price in the distribution (used to derive minTick).

Param

The maximum price in the distribution.

Param

The ratio between each price point (used to derive baseQuoteTickOffset).

Param

The mid-price used to determine when to switch from bids to asks. (used to derive midTick).

Param

The step size used when transporting funds from an offer to its dual.

Param

Whether to generate the distribution outwards from the midPrice or upwards from the minPrice.

Type declaration​

NameType
minPrice?Bigish
maxPrice?Bigish
priceRatio?Bigish
midPrice?Bigish
stepSizenumber
generateFromMidboolean

Defined in​

@mangrovedao/mangrove.js/src/kandel/geometricKandel/geometricKandelDistributionHelper.ts:16


TickDistributionParams​

Ζ¬ TickDistributionParams: Object

Tick and offset parameters for calculating a geometric price distribution. Parameters should conform to tickSpacing of the market (i.e. be divisible by it).

Param

The minimum base quote tick in the distribution.

Param

The maximum base quote tick in the distribution (used to derive minTick).

Param

The number of ticks to jump between two price points.

Param

The number of price points in the distribution.

Param

The mid-price as base quote tick used to determine when to switch from bids to asks.

Param

The step size used when transporting funds from an offer to its dual.

Param

Whether to generate the distribution outwards from the midPrice or upwards from the minPrice.

Type declaration​

NameType
minBaseQuoteTicknumber
maxBaseQuoteTicknumber
baseQuoteTickOffsetnumber
midBaseQuoteTicknumber
pricePointsnumber
stepSizenumber
generateFromMidboolean

Defined in​

@mangrovedao/mangrove.js/src/kandel/geometricKandel/geometricKandelDistributionHelper.ts:34


DistributionParams​

Ζ¬ DistributionParams: PriceDistributionParams & Partial<TickDistributionParams>

Parameters for calculating a geometric price distribution. Exactly three of minPrice (or minTick), maxPrice (or maxTick), priceRatio (or baseQuoteTickOffset), and pricePoints must be provided.

Defined in​

@mangrovedao/mangrove.js/src/kandel/geometricKandel/geometricKandelDistributionHelper.ts:45


GeometricKandelParameterOverrides​

Ζ¬ GeometricKandelParameterOverrides: Object

Notice

Parameters specific to a geometric Kandel instance where provided properties override current values. baseQuoteTickOffset takes precedence over priceRatio. Note that baseQuoteTickOffset and pricePoints are normally provided via the KandelDistribution.

See

GeometricKandelParameters for more information.

Remarks

Cannot simply be Partial<GeometricKandelParameters> due to Big vs Bigish.

Type declaration​

NameType
baseQuoteTickOffset?number
priceRatio?Bigish

Defined in​

@mangrovedao/mangrove.js/src/kandel/geometricKandel/geometricKandelInstance.ts:38


OffersWithLiveness​

Ζ¬ OffersWithLiveness: { tick: number ; index: number ; id: number ; live: boolean }[]

Offers with their price, liveness, and Kandel index.

Param

The tick of the offer.

Param

The index of the price point in Kandel.

Param

The Mangrove offer id of the offer.

Param

Whether the offer is live.

Defined in​

@mangrovedao/mangrove.js/src/kandel/geometricKandel/geometricKandelStatus.ts:11


OfferStatus​

Ζ¬ OfferStatus: Object

The status of an offer at a price point.

Param

Whether a bid is expected to be live.

Param

Whether an ask is expected to be live.

Param

The expected price of the offer based on extrapolation from a live offer near the mid price.

Param

The expected ask tick of the offer (negate for bids) based on extrapolation from a live offer near the mid price.

Param

The status of the current ask at the price point or undefined if there never was an ask at this point.

Param

Whether the offer is live.

Param

The Mangrove offer id.

Param

The actual price of the offer.

Param

The status of the current bid at the price point or undefined if there is no bid.

Param

Whether the offer is live.

Param

The Mangrove offer id.

Param

The actual price of the offer.

Type declaration​

NameType
expectedLiveBidboolean
expectedLiveAskboolean
expectedBaseQuoteTicknumber
expectedPriceBig
asksundefined | { live: boolean ; id: number ; tick: number ; price: Big }
bidsundefined | { live: boolean ; id: number ; tick: number ; price: Big }

Defined in​

@mangrovedao/mangrove.js/src/kandel/geometricKandel/geometricKandelStatus.ts:32


Statuses​

Ζ¬ Statuses: Object

Statuses of offers at each price point.

Param

The status of each offer.

Param

Offers that are live but have an index above pricePoints. This does not happen if populate is not called when offers are live.

Param

The live offer that is selected near the mid price and used to calculate expected prices.

Param

The minimum price of the offers. This is the price of the offer at index 0 if it is live; otherwise, the expected price at index 0.

Param

The maximum price of the offers. This is the price of the offer at index pricePoints - 1 if it is live; otherwise, the expected price at index pricePoints - 1.

Param

The price ratio calculated based on the baseQuoteTickOffset

Param

The offset in ticks between two price points of the geometric distribution.

Type declaration​

NameType
statusesOfferStatus[]
liveOutOfRange{ offerType: BA ; id: number ; index: number }[]
baseOffer{ offerType: BA ; index: number ; id: number }
baseOffer.offerTypeBA
baseOffer.indexnumber
baseOffer.idnumber
minPriceBig
maxPriceBig
minBaseQuoteTicknumber
maxBaseQuoteTicknumber
priceRatioBig
baseQuoteTickOffsetnumber

Defined in​

@mangrovedao/mangrove.js/src/kandel/geometricKandel/geometricKandelStatus.ts:64


OfferList​

Ζ¬ OfferList: { index: number ; gives: Big ; tick: number }[]

A list of bids or asks with their index, tick, and gives.

Param

The index of the price point in Kandel.

Param

The amount of tokens (base for ask, quote for bid) the offer should give.

Param

The tick for the offer (the tick price of base per quote for bids and quote per base for asks)

Defined in​

@mangrovedao/mangrove.js/src/kandel/kandelDistribution.ts:10


OfferDistribution​

Ζ¬ OfferDistribution: Object

Distribution of bids and asks and their base and quote amounts. Take care to ensure duals are included or already populated with correct parameters.

Param

The bids in the distribution.

Param

The asks in the distribution.

Type declaration​

NameType
bidsOfferList
asksOfferList

Defined in​

@mangrovedao/mangrove.js/src/kandel/kandelDistribution.ts:20


OffersWithGives​

Ζ¬ OffersWithGives: { tick: number ; index: number ; gives: Bigish }[]

Offers with their tick, Kandel index, and gives amount.

Param

The tick of the offer.

Param

The index of the price point in Kandel.

Param

The amount of base or quote that the offer gives.

Defined in​

@mangrovedao/mangrove.js/src/kandel/kandelDistributionHelper.ts:11


KandelSeed​

Ζ¬ KandelSeed: Object

The parameters for sowing the Kandel instance.

Param

Whether to create an AaveKandel which supplies liquidity on Aave to earn yield, or a standard Kandel.

Param

The market to create the Kandel for.

Param

Whether to enable liquidity sharing for the Kandel so that the signer can publish the same liquidity for multiple router-based Kandels (currently AaveKandel).

Type declaration​

NameType
onAaveboolean
marketMarket
liquiditySharingboolean

Defined in​

@mangrovedao/mangrove.js/src/kandel/kandelSeeder.ts:19


AmountAndOverrides​

Ζ¬ AmountAndOverrides: Object

Type declaration​

NameType
amountBigish
overridesethers.Overrides

Defined in​

@mangrovedao/mangrove.js/src/token.ts:22


ApproveArgs​

Ζ¬ ApproveArgs: Bigish | ethers.Overrides | AmountAndOverrides

Defined in​

@mangrovedao/mangrove.js/src/token.ts:26


Bigish​

Ζ¬ Bigish: BigSource

Defined in​

@mangrovedao/mangrove.js/src/util.ts:3


prettyPrintFilter​

Ζ¬ prettyPrintFilter: ("id" | "prev" | "next" | "gasprice" | "maker" | "gasreq" | "gasbase" | "gives" | "price" | "tick")[]

Defined in​

@mangrovedao/mangrove.js/src/util/prettyPrint.ts:4


RoundingMode​

Ζ¬ RoundingMode: "nearest" | "roundDown" | "roundUp"

roundDown rounds down to a representable value, roundUp rounds up to a representable value, and nearest rounds to the nearest representable value.

Defined in​

@mangrovedao/mangrove.js/src/util/tickPriceHelper.ts:10


CleanUnitParams​

Ζ¬ CleanUnitParams: Object

Type declaration​

NameType
baBA
targets{ offerId: number ; tick: number ; gasreq: ethers.BigNumber ; takerWants: ethers.BigNumber }[]
takerstring
gasLowerBound?ethers.BigNumberish

Defined in​

@mangrovedao/mangrove.js/src/util/trade.ts:12


Optional​

Ζ¬ Optional<T, K>: Pick<Partial<T>, K> & Omit<T, K>

Type parameters​

NameType
TT
Kextends keyof T

Defined in​

@mangrovedao/mangrove.js/src/util/tradeEventManagement.ts:24


OrderResultWithOptionalSummary​

Ζ¬ OrderResultWithOptionalSummary: Optional<DirtyOrderResult, "summary">

Defined in​

@mangrovedao/mangrove.js/src/util/tradeEventManagement.ts:26

Variables​

configuration​

β€’ Const configuration: Object

Type declaration​

NameType
addresses{ getAllAddresses: (network: string) => [string, string][] ; getAddress: (name: string, network: string) => string ; watchAddress: (network: string, name: string, callback: (address: string) => void) => void ; setAddress: (name: string, address: string, network: string) => void }
addresses.getAllAddresses(network: string) => [string, string][]
addresses.getAddress(name: string, network: string) => string
addresses.watchAddress(network: string, name: string, callback: (address: string) => void) => void
addresses.setAddress(name: string, address: string, network: string) => void
tokens{ isTokenIdRegistered: (tokenId: string) => boolean ; getDefaultIdForSymbolOnNetwork: (tokenSymbol: string, network: string) => string ; getTokenIdFromAddress: (address: string, network: string) => undefined | string ; getDecimals: (tokenId: string) => number ; getOrFetchDecimals: (tokenId: string, provider: Provider) => Promise<number> ; fetchDecimals: (tokenId: string, provider: Provider) => Promise<number> ; getSymbol: (tokenId: string) => undefined | string ; getOrFetchSymbol: (tokenId: string, provider: Provider) => Promise<string> ; fetchSymbol: (tokenId: string, provider: Provider) => Promise<string> ; fetchSymbolFromAddress: (address: string, provider: Provider) => Promise<string> ; getDisplayName: (tokenId: string) => undefined | string ; getDisplayedDecimals: (tokenId: string) => number ; getDisplayedPriceDecimals: (tokenId: string) => number ; getCashness: (tokenId: string) => undefined | number ; setDefaultIdForSymbolOnNetwork: (tokenSymbol: string, network: string, tokenId: string) => void ; setDecimals: (tokenId: string, dec: number) => void ; setSymbol: (tokenId: string, symbol: string) => void ; setDisplayName: (tokenId: string, displayName: string) => void ; setDisplayedDecimals: (tokenId: string, dec: number) => void ; setDisplayedPriceDecimals: (tokenId: string, dec: number) => void ; setCashness: (tokenId: string, cashness: number) => void }
tokens.isTokenIdRegistered[object Object]
tokens.getDefaultIdForSymbolOnNetwork[object Object]
tokens.getTokenIdFromAddress(address: string, network: string) => undefined | string
tokens.getDecimals(tokenId: string) => number
tokens.getOrFetchDecimals(tokenId: string, provider: Provider) => Promise<number>
tokens.fetchDecimals(tokenId: string, provider: Provider) => Promise<number>
tokens.getSymbol(tokenId: string) => undefined | string
tokens.getOrFetchSymbol(tokenId: string, provider: Provider) => Promise<string>
tokens.fetchSymbol(tokenId: string, provider: Provider) => Promise<string>
tokens.fetchSymbolFromAddress(address: string, provider: Provider) => Promise<string>
tokens.getDisplayName(tokenId: string) => undefined | string
tokens.getDisplayedDecimals(tokenId: string) => number
tokens.getDisplayedPriceDecimals(tokenId: string) => number
tokens.getCashness(tokenId: string) => undefined | number
tokens.setDefaultIdForSymbolOnNetwork[object Object]
tokens.setDecimals(tokenId: string, dec: number) => void
tokens.setSymbol(tokenId: string, symbol: string) => void
tokens.setDisplayName(tokenId: string, displayName: string) => void
tokens.setDisplayedDecimals(tokenId: string, dec: number) => void
tokens.setDisplayedPriceDecimals(tokenId: string, dec: number) => void
tokens.setCashness(tokenId: string, cashness: number) => void
reliableEventSubscriber{ getLogsTimeout: (network: string) => number ; getBlockManagerOptions: (network: string) => Options ; getReliableHttpProviderOptions: (network: string) => Omit<Options, "onError"> ; getReliableWebSocketOptions: (network: string) => Omit<Options, "wsUrl"> }
reliableEventSubscriber.getLogsTimeout(network: string) => number
reliableEventSubscriber.getBlockManagerOptions(network: string) => Options
reliableEventSubscriber.getReliableHttpProviderOptions(network: string) => Omit<Options, "onError">
reliableEventSubscriber.getReliableWebSocketOptions(network: string) => Omit<Options, "wsUrl">
kandel{ getRawConfiguration: () => PartialKandelConfiguration }
kandel.getRawConfiguration() => PartialKandelConfiguration
mangroveOrder{ getRestingOrderGasreq: (network: string) => number ; getRestingOrderGaspriceFactor: (network: string) => number ; getTakeGasOverhead: (network: string) => number }
mangroveOrder.getRestingOrderGasreq(network: string) => number
mangroveOrder.getRestingOrderGaspriceFactor(network: string) => number
mangroveOrder.getTakeGasOverhead(network: string) => number
resetConfiguration() => void
updateConfiguration(defaults: RecursivePartial<Configuration>) => void

Defined in​

@mangrovedao/mangrove.js/src/configuration.ts:771

Functions​

enableLogging​

β–Έ enableLogging(): void

Returns​

void

Defined in​

@mangrovedao/mangrove.js/src/util/logger.ts:10

  • Namespaces
  • Classes
  • Interfaces
  • References
    • default
  • Type Aliases
    • RecursivePartial
    • network
    • address
    • tokenId
    • tokenSymbol
    • NamedAddresses
    • AddressesConfig
    • TokenConfig
    • TokenDefaults
    • ReliableEventSubscriberConfig
    • KandelNetworkConfiguration
    • KandelMarketConfiguration
    • KandelRawMarketConfiguration
    • KandelAllConfigurationFields
    • PartialKandelAllConfigurationFields
    • PartialMarketConfig
    • PartialNetworkConfig
    • PartialKandelConfiguration
    • MangroveOrderNetworkConfiguration
    • PartialMangroveOrderConfiguration
    • Configuration
    • PartialConfiguration
    • MarketOrMarketFactory
    • KandelParameters
    • KandelParameterOverrides
    • PriceDistributionParams
    • TickDistributionParams
    • DistributionParams
    • GeometricKandelParameterOverrides
    • OffersWithLiveness
    • OfferStatus
    • Statuses
    • OfferList
    • OfferDistribution
    • OffersWithGives
    • KandelSeed
    • AmountAndOverrides
    • ApproveArgs
    • Bigish
    • prettyPrintFilter
    • RoundingMode
    • CleanUnitParams
    • Optional
    • OrderResultWithOptionalSummary
  • Variables
    • configuration
  • Functions
    • enableLogging