Class PoolAPI

Represents a class for handling pool operations related to the subgraph and the pool contracts.

Hierarchy

  • BaseAPI
    • PoolAPI

Constructors

Properties

Methods

Constructors

Properties

premia: Premia

Methods

  • Returns the balance of long / short options for a given address.

    Parameters

    • poolAddress: string

      {string} The contract address of the pool.

    • userAddress: string

      {string} The address of which the long / short option balance should be queried.

    • short: boolean = false

      {boolean} Whether to return the long or short balance of the address.

    Returns Promise<bigint>

    Promise containing the long / short option balance of the address.

  • Retrieves the balance of a position in a specified pool.

    Parameters

    • poolAddress: string

      The address of the pool.

    • positionKey: PositionKey

      The position identifier.

    Returns Promise<bigint>

    The balance of the position.

  • Returns a promise containing a signed transaction to buy options. Buying options can be in the form of buying long options positions or buying to close short option positions.

    Parameters

    • poolAddress: string

      {string} Contract address of the pool.

    • __namedParameters: {
          premiumLimit: BigNumberish;
          referrer?: string;
          size: BigNumberish;
      }
      • premiumLimit: BigNumberish
      • Optional referrer?: string
      • size: BigNumberish

    Returns Promise<ContractTransactionResponse>

    Promise containing the contract transaction.

  • Sends a cancel quote request.

    Parameters

    • poolAddress: string

      The address of the pool.

    • quoteHash: string

      The hash of the quote to be cancelled.

    Returns Promise<ContractTransactionResponse>

    A promise that resolves to the transaction response.

  • Cancels the quote stream for a given pool.

    Parameters

    • poolAddress: string

      The address of the pool.

    Returns Promise<void>

  • Cancels multiple quotes.

    Parameters

    • poolAddress: string

      The address of the pool.

    • quoteHashes: string[]

      An array of hashes of the quotes to be cancelled.

    Returns Promise<ContractTransactionResponse>

    A promise that resolves to the transaction response.

  • Returns a promise containing a signed transaction to make claim fees generated by a range order. Allows the SDK to be used without providing a signer.

    Parameters

    • poolAddress: string

      {string} Contract address of the pool.

    • __namedParameters: {
          lower: BigNumberish;
          operator?: string;
          orderType: OrderType;
          owner: string;
          upper: BigNumberish;
      }
      • lower: BigNumberish
      • Optional operator?: string
      • orderType: OrderType
      • owner: string
      • upper: BigNumberish

    Returns Promise<ContractTransactionResponse>

    Promise containing the contract transaction.

  • Returns a promise containing a signed transaction to claim fees generated by the range order specified by the PositionKey. Allows the SDK to be used without providing a signer.

    Parameters

    • poolAddress: string

      {string} Contract address of the pool.

    • key: PositionKey

      {PositionKey} PositionKey parametrizing the range order.

    Returns Promise<ContractTransactionResponse>

    Promise containing the contract transaction.

  • Returns the promise containing a transaction to deploy a pool parametrized by the input parameters.

    Parameters

    • base: string

      {string} Contract address of the base token.

    • quote: string

      {string} Contract address of the quote token.

    • oracleAdapter: string

      {string} Contract address of the oracleAdapter.

    • strike: BigNumberish

      {BigNumberish} Strike of the pool; denominated in the quote token.

    • maturity: BigNumberish

      {BigNumberish} Maturity of the pool (UNIX timestamp).

    • isCall: boolean

      {boolean} Whether the pool supports call or put options.

    Returns Promise<ContractTransactionResponse>

    Promise containing the contract transaction.

  • Returns the promise containing a transaction to deploy a pool parametrized by the PoolKey.

    Parameters

    • key: PoolKey

      {PoolKey} PoolKey containing parameters of the pool to be deployed.

    Returns Promise<ContractTransactionResponse>

    Promise containing the contract transaction.

  • Returns the promise containing a signed transaction to make a deposit parametrized by the inputs.

    Parameters

    • poolAddress: string

      {string} Contract address of the pool.

    • __namedParameters: {
          lower: BigNumberish;
          maxMarketPrice?: BigNumberish;
          minMarketPrice?: BigNumberish;
          operator?: string;
          orderType: OrderType;
          owner: string;
          size: BigNumberish;
          upper: BigNumberish;
      }
      • lower: BigNumberish
      • Optional maxMarketPrice?: BigNumberish
      • Optional minMarketPrice?: BigNumberish
      • Optional operator?: string
      • orderType: OrderType
      • owner: string
      • size: BigNumberish
      • upper: BigNumberish

    Returns Promise<ContractTransactionResponse>

    Promise containing the contract transaction.

  • Returns the promise containing a signed transaction to make a deposit parametrized by the inputs.

    Parameters

    • poolAddress: string

      {string} Contract address of the pool.

    • __namedParameters: {
          maxMarketPrice?: BigNumberish;
          minMarketPrice?: BigNumberish;
          positionKey: PositionKey;
          size: BigNumberish;
      }
      • Optional maxMarketPrice?: BigNumberish
      • Optional minMarketPrice?: BigNumberish
      • positionKey: PositionKey
      • size: BigNumberish

    Returns Promise<ContractTransactionResponse>

    Promise containing the contract transaction.

  • Returns a promise containing a populated transaction to buy options. Allows users to use the SDK without providing a signer.

    Parameters

    • poolAddress: string

      {string} Contract address of the pool.

    • __namedParameters: {
          premiumLimit: BigNumberish;
          referrer?: string;
          size: BigNumberish;
      }
      • premiumLimit: BigNumberish
      • Optional referrer?: string
      • size: BigNumberish

    Returns Promise<ContractTransaction>

    Promise containing the contract transaction.

  • Encodes the cancel quote request, preparing the transaction for execution.

    Parameters

    • poolAddress: string

      The address of the pool.

    • quoteHash: string

      The hash of the quote to be cancelled.

    Returns Promise<ContractTransaction>

    A promise that resolves to the encoded cancel quote request.

  • Encodes the cancel quotes request for multiple quotes, preparing the transaction for execution.

    Parameters

    • poolAddress: string

      The address of the pool.

    • quoteHashes: string[]

      An array of hashes of the quotes to be cancelled.

    Returns Promise<ContractTransaction>

    A promise that resolves to the encoded cancel quotes request.

  • Returns a promise containing a populated transaction to make claim fees generated by a range order. Allows the SDK to be used without providing a signer.

    Parameters

    • poolAddress: string

      {string} Contract address of the pool.

    • __namedParameters: {
          lower: BigNumberish;
          operator?: string;
          orderType: OrderType;
          owner: string;
          upper: BigNumberish;
      }
      • lower: BigNumberish
      • Optional operator?: string
      • orderType: OrderType
      • owner: string
      • upper: BigNumberish

    Returns Promise<ContractTransaction>

    Promise containing the contract transaction.

  • Returns a promise containing a populated transaction to claim fees generated by the range order specified by the PositionKey. Allows the SDK to be used without providing a signer.

    Parameters

    • poolAddress: string

      {string} Contract address of the pool.

    • key: PositionKey

      {PositionKey} PositionKey parametrizing the range order.

    Returns Promise<ContractTransaction>

    Promise containing the contract transaction.

  • Returns a promise containing a populated transaction to deploy a pool parametrized by the input parameters. Allows SDK users to sign the transaction without providing a signer.

    Parameters

    • base: string

      {string} Contract address of the base token.

    • quote: string

      {string} Contract address of the quote token.

    • oracleAdapter: string

      {string} Contract address of the oracleAdapter.

    • strike: BigNumberish

      {BigNumberish} Strike of the pool; denominated in the quote token.

    • maturity: BigNumberish

      {BigNumberish} Maturity of the pool (UNIX timestamp).

    • isCall: boolean

      {boolean} Whether the pool supports call or put options.

    Returns Promise<ContractTransaction>

    Promise containing the contract transaction.

  • Returns the promise containing a populated transaction to deploy a pool parametrized by the PoolKey. Allows SDK users to sign the transaction without providing a signer.

    Parameters

    • key: PoolKey

      {PoolKey} PoolKey containing parameters of the pool to be deployed.

    Returns Promise<ContractTransaction>

    Promise containing the contract transaction.

  • Returns the promise containing a populated transaction to make a deposit parametrized by the inputs. Allows the SDK to be used without providing a signer.

    Parameters

    • poolAddress: string

      {string} Contract address of the pool.

    • __namedParameters: {
          lower: BigNumberish;
          maxMarketPrice?: BigNumberish;
          minMarketPrice?: BigNumberish;
          operator?: string;
          orderType: OrderType;
          owner: string;
          size: BigNumberish;
          upper: BigNumberish;
      }
      • lower: BigNumberish
      • Optional maxMarketPrice?: BigNumberish
      • Optional minMarketPrice?: BigNumberish
      • Optional operator?: string
      • orderType: OrderType
      • owner: string
      • size: BigNumberish
      • upper: BigNumberish

    Returns Promise<ContractTransaction>

    Promise containing the contract transaction.

  • Returns the promise containing a populated transaction to make a deposit parametrized by the inputs. Allows the SDK to be used without providing a signer.

    Parameters

    • poolAddress: string

      {string} Contract address of the pool.

    • __namedParameters: {
          maxMarketPrice?: BigNumberish;
          minMarketPrice?: BigNumberish;
          positionKey: PositionKey;
          size: BigNumberish;
      }
      • Optional maxMarketPrice?: BigNumberish
      • Optional minMarketPrice?: BigNumberish
      • positionKey: PositionKey
      • size: BigNumberish

    Returns Promise<ContractTransaction>

    Promise containing the contract transaction.

  • Returns a promise containing a populated transaction to exercise long option positions. Allows the user to use the SDK without providing a signer.

    Parameters

    • poolAddress: string

      {string} The address of the pool.

    Returns Promise<ContractTransaction>

    A promise that resolves to the transaction response.

  • Returns a promise containing a populated transaction to exercise option positions on behalf of other users. Allows the user to use the SDK without providing a signer.

    Parameters

    • poolAddress: string

      {string} Contract address of the pool.

    • holderAddresses: string[]

      {string[]} Addresses of which the long option positions should be exercised. Note a user can only exercise long option positions on behalf of other users if the holder granted permission via the UserSettings.

    • costPerHolder: BigNumberish

      {BigNumberish} Amount charged for exercising the long options per holder. Note the maximum amount charged is specified by each option holder individually in the UserSettings. If the amount charged is above the exercise value the transaction will revert.

    Returns Promise<ContractTransaction>

    Promise containing the contract transaction.

  • Encodes the fill quote request, preparing the transaction for execution.

    Parameters

    • poolAddress: string

      The address of the pool.

    • options: {
          quote: Quote;
          referrer?: string;
          signature: Signature;
          size: BigNumberish;
      }

      The options for the fill quote request.

      • quote: Quote

        The quote object.

      • Optional referrer?: string

        The address of the referrer.

      • signature: Signature

        The signature of the quote provider.

      • size: BigNumberish

        The size to fill.

    Returns Promise<ContractTransaction>

    A promise that resolves to the encoded fill quote request.

  • Returns a promise containing a populated transaction to sell options. Selling options can be in the form of selling long option positions or selling to open short positions. Allows users to use the SDK without providing a signer.

    Parameters

    • poolAddress: string

      {string} Contract address of the pool.

    • __namedParameters: {
          premiumLimit: BigNumberish;
          referrer?: string;
          size: BigNumberish;
      }
      • premiumLimit: BigNumberish
      • Optional referrer?: string
      • size: BigNumberish

    Returns Promise<ContractTransaction>

    Promise containing the contract transaction.

  • Returns a promise containing a populated transaction to settle short option positions. Allows the user to use the SDK without providing a signer.

    Parameters

    • poolAddress: string

      {string} Contract address of the pool.

    Returns Promise<ContractTransaction>

    Promise containing the contract transaction.

  • Returns a promise containing a populated transaction to settle option positions on behalf of other users. Allows the user to use the SDK without providing a signer.

    Parameters

    • poolAddress: string

      {string} Contract address of the pool.

    • underwriterAddresses: string[]

      {string[]} List containing the addresses for which the short options should be settled. Note a user can only settle short option positions on behalf of other users if the holder granted permission via the UserSettings.

    • costPerUnderwriter: BigNumberish

      {BigNumberish} Amount charged by the user to each underwriter. Note the maximum amount charged is specified by each underwriter individually in the UserSettings. If the amount charged is above the settlement value the transaction will revert. // todo

    Returns Promise<ContractTransaction>

    Promise containing the contract transaction.

  • Returns a promise containing a populated transaction to settle a range order position. Allows the user to use the SDK without providing a signer.

    Parameters

    • poolAddress: string

      {string} Contract address of the pool.

    • __namedParameters: {
          lower: BigNumberish;
          operator?: string;
          orderType: OrderType;
          owner: string;
          upper: BigNumberish;
      }
      • lower: BigNumberish
      • Optional operator?: string
      • orderType: OrderType
      • owner: string
      • upper: BigNumberish

    Returns Promise<ContractTransaction>

    Promise containing the contract transaction.

  • Returns a promise containing a populated transaction to settle range orders / positions on behalf of other users. Allows the user to use the SDK without providing a signer.

    Parameters

    • poolAddress: string

      {string} Contract address of the pool.

    • positionKeys: PositionKey[]

      {string[]} List containing the position keys parametrizing the range orders that should be settled. Note a user can only settle range order positions on behalf of other users if the liquidity providers granted permission via the UserSettings.

    • costPerHolder: BigNumberish

      {BigNumberish} Amount charged by the user to each liquidity provider. Note the maximum amount charged is specified by each liquidity provider individually in the UserSettings. If the amount charged is above the settlement value of the range order the transaction will revert. // todo

    Returns Promise<ContractTransaction>

    Promise containing the contract transaction.

  • Returns a promise containing a populated transaction to settle a range order position. Allows the user to use the SDK without providing a signer.

    Parameters

    • poolAddress: string

      {string} Contract address of the pool.

    • positionKey: PositionKey

      {PositionKey} PositionKey parametrizing the range order.

    Returns Promise<ContractTransaction>

    Promise containing the contract transaction.

  • Returns a promise containing a populated transaction to trade options. Allows users to use the SDK without providing a signer.

    Parameters

    • poolAddress: string

      {string} Contract address of the pool.

    • __namedParameters: {
          isBuy: boolean;
          premiumLimit: BigNumberish;
          referrer: string;
          size: BigNumberish;
      }
      • isBuy: boolean
      • premiumLimit: BigNumberish
      • referrer: string
      • size: BigNumberish

    Returns Promise<ContractTransaction>

    Promise containing the contract transaction.

  • Returns a promise containing a populated transaction to transfer range order liquidity to another owner and operator. Allows the user to use the SDK without providing a signer.

    Parameters

    • poolAddress: string

      {string} Contract address of the pool.

    • __namedParameters: {
          lower: BigNumberish;
          operator?: string;
          orderType: OrderType;
          owner: string;
          size: BigNumberish;
          toOperator?: string;
          toOwner: string;
          upper: BigNumberish;
      }
      • lower: BigNumberish
      • Optional operator?: string
      • orderType: OrderType
      • owner: string
      • size: BigNumberish
      • Optional toOperator?: string
      • toOwner: string
      • upper: BigNumberish

    Returns Promise<ContractTransaction>

    Promise containing the contract transaction.

  • Returns a promise containing a populated transaction to transfer range order liquidity to another owner and operator. Allows the user to use the SDK without providing a signer.

    Parameters

    • poolAddress: string

      {string} Contract address of the pool.

    • size: BigNumberish

      {BigNumberish} Amount of liquidity transferred. Liquidity is denominated in option contracts that can be sold or (potentially) bought.

    • positionKey: PositionKey

      {PositionKey} Position key parametrizing the range order that should be transferred.

    • toOwner: string

      {string} Address of the owner receiving the range order liquidity.

    • Optional toOperator: string

      {string} Address of the owner receiving the range order liquidity.

    Returns Promise<ContractTransaction>

    Promise containing the contract transaction.

  • Returns the promise containing a populated transaction to make a withdrawal parametrized through the input parameters. Allows users to use the SDK without a signer.

    Parameters

    • poolAddress: string

      {string} Contract address of the pool.

    • __namedParameters: {
          lower: BigNumberish;
          maxMarketPrice?: BigNumberish;
          minMarketPrice?: BigNumberish;
          operator?: string;
          orderType: OrderType;
          owner: string;
          size: BigNumberish;
          upper: BigNumberish;
      }
      • lower: BigNumberish
      • Optional maxMarketPrice?: BigNumberish
      • Optional minMarketPrice?: BigNumberish
      • Optional operator?: string
      • orderType: OrderType
      • owner: string
      • size: BigNumberish
      • upper: BigNumberish

    Returns Promise<ContractTransaction>

    Promise containing the contract transaction.

  • Returns the promise containing a populated transaction to make a withdrawal parametrized by the PositionKey. Allows the SDK to be used without providing a signer.

    Parameters

    • poolAddress: string

      {string} Contract address of the pool.

    • __namedParameters: {
          maxMarketPrice?: BigNumberish;
          minMarketPrice?: BigNumberish;
          positionKey: PositionKey;
          size: BigNumberish;
      }
      • Optional maxMarketPrice?: BigNumberish
      • Optional minMarketPrice?: BigNumberish
      • positionKey: PositionKey
      • size: BigNumberish

    Returns Promise<ContractTransaction>

    Promise containing the contract transaction.

  • Returns a promise containing a populated transaction to underwrite an option. The option's strike and maturity are specified through the contract address of the pool. Allows users to use the SDK without providing a signer.

    Parameters

    • poolAddress: string

      {string} Contract address of the pool.

    • __namedParameters: {
          longReceiver?: string;
          referrer?: string;
          size: BigNumberish;
          underwriter: string;
      }
      • Optional longReceiver?: string
      • Optional referrer?: string
      • size: BigNumberish
      • underwriter: string

    Returns Promise<ContractTransaction>

    Promise containing the contract transaction.

  • Returns a promise containing a signed transaction to exercise long option positions.

    Parameters

    • poolAddress: string

      {string} Contract address of the pool.

    Returns Promise<ContractTransactionResponse>

    Promise containing the contract transaction.

  • Returns a promise containing a signed transaction to exercise option positions on behalf of other users. Allows the user to use the SDK without providing a signer.

    Parameters

    • poolAddress: string

      {string} Contract address of the pool.

    • holderAddresses: string[]

      {string[]} Addresses of which the long option positions should be exercised. Note a user can only exercise long option positions on behalf of other users if the holder granted permission via the UserSettings.

    • costPerHolder: BigNumberish

      {BigNumberish} Amount charged for exercising the long options per holder. Note the maximum amount charged is specified by each option holder individually in the UserSettings. If the amount charged is above the exercise value the transaction will revert.

    Returns Promise<ContractTransactionResponse>

    Promise containing the contract transaction.

  • Sends a fill quote request.

    Parameters

    • poolAddress: string

      The address of the pool.

    • options: {
          quote: Quote;
          referrer?: string;
          signature: Signature;
          size: BigNumberish;
      }

      The options for the fill quote request.

      • quote: Quote

        The quote object.

      • Optional referrer?: string

        The address of the referrer.

      • signature: Signature

        The signature of the quote provider.

      • size: BigNumberish

        The size to fill.

    Returns Promise<ContractTransactionResponse>

    A promise that resolves to the transaction response.

  • Computes the breakeven price for an option.

    Parameters

    • strike: BigNumberish

      {BigNumberish} The strike price.

    • isCall: boolean

      {boolean} Whether the option is a call or put.

    • price: BigNumberish

      {BigNumberish} The price that was paid for the option in terms of the quote.

    • spotPrice: BigNumberish

      {BigNumberish} The spot price at the time of purchase.

    • isFullPrice: boolean = false

      {boolean} Whether the option price is not normalized.

    Returns bigint

    The breakeven spot price at expiration.

  • Returns the promise containing the amount of fees that are claimable.

    Parameters

    • poolAddress: string

      {string} Contract address of the pool.

    • __namedParameters: {
          lower: BigNumberish;
          operator?: string;
          orderType: OrderType;
          owner: string;
          upper: BigNumberish;
      }
      • lower: BigNumberish
      • Optional operator?: string
      • orderType: OrderType
      • owner: string
      • upper: BigNumberish

    Returns Promise<bigint>

    Promise containing the amount of claimable fees.

  • Returns the promise containing the amount of fees that are claimable.

    Parameters

    • poolAddress: string

      {string} Contract address of the pool.

    • key: PositionKey

      {PositionKey} PositionKey parametrizing the range order.

    Returns Promise<bigint>

    Promise containing the amount of claimable fees.

  • Calculates the exercise value of an option from a specified pool.

    Parameters

    • poolAddress: string

      The address of the pool.

    Returns Promise<bigint>

    The exercise value of the option.

  • Retrieves the filled amount of a quote.

    Parameters

    • poolAddress: string

      The address of the pool.

    • quoteProvider: string

      The address of the quote provider.

    • quoteHash: string

      The hash of the quote.

    Returns Promise<bigint>

    A promise that resolves to the filled amount of the quote.

  • Retrieves the pool information given its address. Cached daily.

    Parameters

    • address: string

      The address of the pool.

    Returns Promise<Pool>

    A promise that resolves to a Pool object.

  • Returns the contract address of a pool corresponding to a PoolKey.

    Parameters

    • key: PoolKey

      {PoolKey} The pool key.

    Returns Promise<string>

    Promise containing the contract address if it exists.

  • Retrieves extended pool information given its address. Cached per minute.

    Parameters

    • address: string

      The address of the Pool contract.

    Returns Promise<PoolExtended>

    A promise that resolves to a PoolExtended objects.

  • Returns the PoolKey given the contract address of a pool.

    Parameters

    • poolAddress: string

      {string} The contract address of the relevant pool.

    Returns Promise<PoolKey>

  • Returns the corresponding PoolMinimal object from the contract address of a pool.

    Parameters

    • address: string

      {string} The relevant contract address.

    Returns Promise<PoolMinimal>

    Promise containing PoolMinimal.

  • Returns the corresponding PoolMinimal object from a PoolKey.

    Parameters

    • key: PoolKey

      {PoolKey} The relevant PoolKey.

    Returns Promise<PoolMinimal>

    Promise containing PoolMinimal.

  • Retrieves pools based on the base address. Cached daily.

    Parameters

    • baseAddress: string

      The address of the base token.

    Returns Promise<Pool[]>

    A promise that resolves to an array of Pool objects.

  • Retrieves extended pools based on the base address. Cached daily.

    Parameters

    • baseAddress: string

      The address of the base token.

    Returns Promise<PoolExtended[]>

    A promise that resolves to an array of PoolExtended objects.

  • Retrieves extended pools for a given token. Cached per minute.

    Parameters

    • token: Token

      The token information.

    • Optional isQuote: boolean = false

      A flag to indicate if the token is quote token.

    Returns Promise<PoolExtended[]>

    A promise that resolves to an array of PoolExtended objects.

  • Retrieves pools for a given token pair. Cached daily.

    Parameters

    Returns Promise<Pool[]>

    A promise that resolves to an array of Pool objects.

  • Retrieves pools for a given token. Cached daily.

    Parameters

    • token: Token

      The token information.

    • Optional isQuote: boolean = false

      A flag to indicate if the token is quote token.

    Returns Promise<Pool[]>

    A promise that resolves to an array of Pool objects.

  • Gets the stranded area, defined by its lower and upper bounds.

    Parameters

    • poolAddress: string

      The address of the pool.

    Returns Promise<{
        lower: bigint;
        upper: bigint;
    }>

    The stranded area.

  • Generates a token ID from a position key.

    Parameters

    • positionKey: PositionKey

      The key identifying the position.

    Returns bigint

    The generated token ID.

  • Returns the fee charged to initialize a pool corresponding to the supplied PoolKey.

    Parameters

    • key: PoolKey

      {PoolKey} The relevant pool key.

    Returns Promise<bigint>

    Promise containing the

  • Determines if the market price is stranded by comparing the upper and lower bounds of the stranded area.

    Parameters

    • poolAddress: string

      The address of the pool.

    Returns Promise<boolean>

    Whether the market price is stranded.

  • Validates a quote for its correctness.

    Parameters

    • quote: QuoteWithSignatureT

      The quote with the signature to validate.

    • Optional options: {
          poolAddress?: string;
          size?: BigNumberish;
      }

      Additional options for validation.

      • Optional poolAddress?: string

        The address of the Pool contract.

      • Optional size?: BigNumberish

        The size of the quote.

    Returns Promise<ValidQuoteResponse>

    A promise that resolves to the validation result with error information if the quote is invalid.

  • Fetches the current market price of a specific pool using its address.

    Parameters

    • poolAddress: string

      The address of the pool.

    Returns Promise<bigint>

    • Returns a promise that resolves to the market price.
  • Returns a promise containing the range order position's delta struct that would be transferred from the user to the pool upon deposit. The delta struct contains the amount of collateral / longs / shorts transferred to the pool when the deposit is executed given the current market price.

    Parameters

    • poolAddress: string

      {string} Contract address of the pool.

    • __namedParameters: {
          lower: BigNumberish;
          maxMarketPrice?: BigNumberish;
          minMarketPrice?: BigNumberish;
          operator?: string;
          orderType: OrderType;
          owner: string;
          size: BigNumberish;
          upper: BigNumberish;
      }
      • lower: BigNumberish
      • Optional maxMarketPrice?: BigNumberish
      • Optional minMarketPrice?: BigNumberish
      • Optional operator?: string
      • orderType: OrderType
      • owner: string
      • size: BigNumberish
      • upper: BigNumberish

    Returns Promise<DeltaStructOutput>

    Promise containing the position's delta struct.

  • Returns a promise containing the range order position's delta struct that would be transferred from the user to the pool upon deposit. The delta struct contains the amount of collateral / longs / shorts transferred to the pool when the deposit is executed given the current market price.

    Parameters

    • poolAddress: string

      {string} Contract address of the pool.

    • __namedParameters: {
          maxMarketPrice?: BigNumberish;
          minMarketPrice?: BigNumberish;
          positionKey: PositionKey;
          size: BigNumberish;
      }
      • Optional maxMarketPrice?: BigNumberish
      • Optional minMarketPrice?: BigNumberish
      • positionKey: PositionKey
      • size: BigNumberish

    Returns Promise<DeltaStructOutput>

    Promise containing the position's delta struct.

  • Previews the result of exercising the options in the specified pool.

    Parameters

    • poolAddress: string

      The address of the pool.

    Returns Promise<[bigint, bigint] & {
        exerciseFee: bigint;
        exerciseValue: bigint;
    }>

    The result of exercising the options.

  • Previews the result of exercising the options for a list of holders in the specified pool.

    Parameters

    • poolAddress: string

      The address of the pool.

    • holderAddresses: string[]

      The array of holder addresses.

    • costPerHolder: BigNumberish

      The cost per holder.

    Returns Promise<[bigint[], bigint[]] & {
        exerciseFees: bigint[];
        exerciseValues: bigint[];
    }>

    The result of exercising the options for the holders.

  • Previews the result of settling the options in the specified pool.

    Parameters

    • poolAddress: string

      The address of the pool.

    Returns Promise<bigint>

    The result of settling the options.

  • Previews the result of settling the options for a list of underwriters in the specified pool.

    Parameters

    • poolAddress: string

      The address of the pool.

    • underwriterAddresses: string[]

      The array of underwriter addresses.

    • costPerUnderwriter: BigNumberish

      The cost per underwriter.

    Returns Promise<bigint[]>

    The result of settling the options for the underwriters.

  • Previews the result of settling a specific position in the specified pool.

    Parameters

    • poolAddress: string

      The address of the pool.

    • positionData: {
          lower: BigNumberish;
          operator?: string;
          orderType: OrderType;
          owner: string;
          upper: BigNumberish;
      }

      Data defining the position to settle.

      • lower: BigNumberish

        The lower bound of the position.

      • Optional operator?: string

        The address of the operator.

      • orderType: OrderType

        The order type of the position.

      • owner: string

        The address of the position owner.

      • upper: BigNumberish

        The upper bound of the position.

    Returns Promise<bigint>

    The result of settling the position.

  • Previews the result of settling the positions for a list of holders in the specified pool.

    Parameters

    • poolAddress: string

      The address of the pool.

    • positionKeys: PositionKey[]

      The array of position keys.

    • costPerHolder: BigNumberish

      The cost per holder.

    Returns Promise<bigint[]>

    The result of settling the positions for the holders.

  • Previews the result of settling a specific position in the specified pool using a position key.

    Parameters

    • poolAddress: string

      The address of the pool.

    • positionKey: PositionKey

      The key identifying the position.

    Returns Promise<bigint>

    The result of settling the position.

  • Returns the promise containing the range order position's delta struct. The delta struct contains the amount of collateral / longs / shorts received when the withdrawal is executed given the current market price.

    Parameters

    • poolAddress: string

      {string} Contract address of the pool.

    • __namedParameters: {
          lower: BigNumberish;
          maxMarketPrice?: BigNumberish;
          minMarketPrice?: BigNumberish;
          operator?: string;
          orderType: OrderType;
          owner: string;
          size: BigNumberish;
          upper: BigNumberish;
      }
      • lower: BigNumberish
      • Optional maxMarketPrice?: BigNumberish
      • Optional minMarketPrice?: BigNumberish
      • Optional operator?: string
      • orderType: OrderType
      • owner: string
      • size: BigNumberish
      • upper: BigNumberish

    Returns Promise<DeltaStructOutput>

    Promise containing the position's delta struct.

  • Returns the promise containing the range order position's delta struct. The delta struct contains the amount of collateral / longs / shorts received when the withdrawal is executed given the current market price.

    Parameters

    • poolAddress: string

      {string} Contract address of the pool.

    • __namedParameters: {
          maxMarketPrice?: BigNumberish;
          minMarketPrice?: BigNumberish;
          positionKey: PositionKey;
          size: BigNumberish;
      }
      • Optional maxMarketPrice?: BigNumberish
      • Optional minMarketPrice?: BigNumberish
      • positionKey: PositionKey
      • size: BigNumberish

    Returns Promise<DeltaStructOutput>

    Promise containing the position's delta struct.

  • Requests a quote from the pool with optional parameters.

    Parameters

    • poolAddress: string

      The address of the pool.

    • size: BigNumberish

      The size of the quote.

    • isBuy: boolean

      Whether it's a buy or sell.

    • Optional referrer: string

      The address of the referrer.

    • Optional taker: string

      The address of the taker.

    • Optional maxSlippagePercent: BigNumberish

      The maximum slippage percent.

    Returns Promise<FillableQuote>

    A promise that resolves to the fillable quote.

  • Returns a promise containing a signed transaction to sell options. Selling options can be in the form of selling long option positions or selling to open short positions.

    Parameters

    • poolAddress: string

      {string} Contract address of the pool.

    • __namedParameters: {
          premiumLimit: BigNumberish;
          referrer?: string;
          size: BigNumberish;
      }
      • premiumLimit: BigNumberish
      • Optional referrer?: string
      • size: BigNumberish

    Returns Promise<ContractTransactionResponse>

    Promise containing the contract transaction.

  • Returns a promise containing a signed transaction to settle short option positions.

    Parameters

    • poolAddress: string

      {string} Contract address of the pool.

    Returns Promise<ContractTransactionResponse>

    Promise containing the contract transaction.

  • Returns a promise containing a signed transaction to settle option positions on behalf of other users.

    Parameters

    • poolAddress: string

      {string} Contract address of the pool.

    • underwriterAddresses: string[]

      {string[]} List containing the addresses for which the short options should be settled. Note a user can only settle short option positions on behalf of other users if the holder granted permission via the UserSettings.

    • costPerUnderwriter: BigNumberish

      {BigNumberish} Amount charged by the user to each underwriter. Note the maximum amount charged is specified by each underwriter individually in the UserSettings. If the amount charged is above the settlement value the transaction will revert. // todo

    Returns Promise<ContractTransactionResponse>

    Promise containing the contract transaction.

  • Returns a promise containing a signed transaction to settle a range order position.

    Parameters

    • poolAddress: string

      {string} Contract address of the pool.

    • __namedParameters: {
          lower: BigNumberish;
          operator?: string;
          orderType: OrderType;
          owner: string;
          upper: BigNumberish;
      }
      • lower: BigNumberish
      • Optional operator?: string
      • orderType: OrderType
      • owner: string
      • upper: BigNumberish

    Returns Promise<ContractTransactionResponse>

    Promise containing the contract transaction.

  • Returns a promise containing a signed transaction to settle option positions on behalf of other users.

    Parameters

    • poolAddress: string

      {string} Contract address of the pool.

    • positionKeys: PositionKey[]

      {string[]} List containing the position keys parametrizing the range orders that should be settled. Note a user can only exercise long option positions on behalf of other users if the holder granted permission via the UserSettings.

    • costPerHolder: BigNumberish

      {BigNumberish} Amount charged by the user to each liquidity provider. Note the maximum amount charged is specified by each liquidity provider individually in the UserSettings. If the amount charged is above the settlement value of the range order the transaction will revert. // todo

    Returns Promise<ContractTransactionResponse>

    Promise containing the contract transaction.

  • Returns a promise containing a signed transaction to settle a range order position.

    Parameters

    • poolAddress: string

      {string} Contract address of the pool.

    • positionKey: PositionKey

      {PositionKey} PositionKey parametrizing the range order.

    Returns Promise<ContractTransactionResponse>

    Promise containing the contract transaction.

  • Fetches the final settlement price of a specific pool using its address.

    The settlement price is the spot price of the reference oracle for the pool, at the time of the pool's expiration. This can be used to calculate the exercise price of options in the pool. The settlement price is only available after the pool has expired, otherwise 0 is returned.

    Parameters

    • poolAddress: string

      The address of the pool.

    Returns Promise<bigint>

    • Returns a promise that resolves to the settlement price.
  • Gets the new lower and upper bounds that are snapped to the closest valid range order width. The valid range widths are multiples of 2^n*5^m.

    Parameters

    • lower: BigNumberish

      The lower bound of the range order.

    • upper: BigNumberish

      The upper bound of the range order.

    • orderType: OrderType

      The type of the order. If it's LONG_COLLATERAL, the lower bound is adjusted; otherwise, the upper bound is adjusted.

    Returns {
        lower: bigint;
        upper: bigint;
    }

    An object with the adjusted lower and upper bounds, as bigints. The lower and upper bounds are snapped to the closest width in validWidths (multiples of 2^n*5^m), and are ensured to be within the bounds of minTickDistance and maxTickPrice, respectively.

    • lower: bigint
    • upper: bigint
  • Fetches the current spot price of a specific pool using its address.

    The reference oracle for the pool is used to calculate the spot price.

    Parameters

    • poolAddress: string

      The address of the pool.

    Returns Promise<bigint>

    • Returns a promise that resolves to the spot price.
  • Streams quotes for a specified size and direction (buy/sell).

    Parameters

    • options: {
          isBuy: boolean;
          poolAddress: string;
          size: BigNumberish;
      }

      The options for the quote stream.

      • isBuy: boolean

        Whether it's a buy or sell.

      • poolAddress: string

        The address of the pool.

      • size: BigNumberish

        The size of the quote.

    • callback: ((quote) => void)

      The callback function to handle each new quote.

    Returns Promise<void>

  • Returns the takerFee charged when trading with the pool.

    Parameters

    • poolAddress: string

      {string} The contract address of the relevant pool.

    • size: bigint

      {size} The amount of contracts to be bought / sold.

    • premium: bigint

      {bigint} The premium paid for the contracts .

    • isPremiumNormalized: boolean = false

      {isPremiumNormalized} Whether the premium is normalized. Relevant for put options where the price can be quoted normalized, which is the price divided by the strike, or unnormalized.

    • Optional taker: string

      {string} The taker's address. Relevant in case staking discounts apply. Default: ZeroAddress.

    Returns Promise<bigint>

    Promise containing the taker fee charged for trading on the exchange.

  • Resolves the referrer address. Defaults to a pre-configured referrer if none is provided.

    Parameters

    • Optional referrer: string

      The address of the referrer.

    Returns string

    The address of the referrer.

  • Returns a promise containing a signed transaction to trade options.

    Parameters

    • poolAddress: string

      {string} Contract address of the pool.

    • __namedParameters: {
          isBuy: boolean;
          premiumLimit: BigNumberish;
          referrer: string;
          size: BigNumberish;
      }
      • isBuy: boolean
      • premiumLimit: BigNumberish
      • referrer: string
      • size: BigNumberish

    Returns Promise<ContractTransactionResponse>

    Promise containing the contract transaction.

  • Returns a promise containing a signed transaction to transfer range order liquidity to another owner and operator.

    Parameters

    • poolAddress: string

      {string} Contract address of the pool.

    • __namedParameters: {
          lower: BigNumberish;
          operator?: string;
          orderType: OrderType;
          owner: string;
          size: BigNumberish;
          toOperator?: string;
          toOwner: string;
          upper: BigNumberish;
      }
      • lower: BigNumberish
      • Optional operator?: string
      • orderType: OrderType
      • owner: string
      • size: BigNumberish
      • Optional toOperator?: string
      • toOwner: string
      • upper: BigNumberish

    Returns Promise<ContractTransactionResponse>

    Promise containing the contract transaction.

  • Returns a promise containing a signed transaction to transfer range order liquidity to another owner and operator.

    Parameters

    • poolAddress: string

      {string} Contract address of the pool.

    • size: BigNumberish

      {BigNumberish} Amount of liquidity transferred. Liquidity is denominated in option contracts that can be sold or (potentially) bought.

    • positionKey: PositionKey

      {PositionKey} Position key parametrizing the range order that should be transferred.

    • toOwner: string

      {string} Address of the owner receiving the range order liquidity.

    • Optional toOperator: string

      {string} Address of the owner receiving the range order liquidity.

    Returns Promise<ContractTransactionResponse>

    Promise containing the contract transaction.

  • Returns the promise containing a signed transaction to make a withdrawal parametrized through the input parameters.

    Parameters

    • poolAddress: string

      {string} Contract address of the pool.

    • __namedParameters: {
          lower: BigNumberish;
          maxMarketPrice?: BigNumberish;
          minMarketPrice?: BigNumberish;
          operator?: string;
          orderType: OrderType;
          owner: string;
          size: BigNumberish;
          upper: BigNumberish;
      }
      • lower: BigNumberish
      • Optional maxMarketPrice?: BigNumberish
      • Optional minMarketPrice?: BigNumberish
      • Optional operator?: string
      • orderType: OrderType
      • owner: string
      • size: BigNumberish
      • upper: BigNumberish

    Returns Promise<ContractTransactionResponse>

    Promise containing the contract transaction.

  • Returns the promise containing a signed transaction to make a withdrawal parametrized by the PositionKey.

    Parameters

    • poolAddress: string

      {string} Contract address of the pool.

    • __namedParameters: {
          maxMarketPrice?: BigNumberish;
          minMarketPrice?: BigNumberish;
          positionKey: PositionKey;
          size: BigNumberish;
      }
      • Optional maxMarketPrice?: BigNumberish
      • Optional minMarketPrice?: BigNumberish
      • positionKey: PositionKey
      • size: BigNumberish

    Returns Promise<ContractTransactionResponse>

    Promise containing the contract transaction.

  • Returns a promise containing a signed transaction to underwrite an option. The option's strike and maturity are specified through the contract address of the pool.

    Parameters

    • poolAddress: string

      {string} Contract address of the pool.

    • __namedParameters: {
          longReceiver?: string;
          size: BigNumberish;
          underwriter: string;
      }
      • Optional longReceiver?: string
      • size: BigNumberish
      • underwriter: string

    Returns Promise<ContractTransactionResponse>

    Promise containing the contract transaction.

Generated using TypeDoc