Evolution SDK

PoolParams.ts

PoolParams overview


Table of contents


arbitrary

arbitrary

FastCheck arbitrary for generating random PoolParams instances for testing.

Signature

export declare const arbitrary: FastCheck.Arbitrary<PoolParams>

Added in v2.0.0

encoding

toBytes

Encode PoolParams to CBOR bytes.

Signature

export declare const toBytes: (params: PoolParams, options?: CBOR.CodecOptions) => Uint8Array

Added in v2.0.0

toHex

Encode PoolParams to CBOR hex string.

Signature

export declare const toHex: (params: PoolParams, options?: CBOR.CodecOptions) => string

Added in v2.0.0

model

PoolParams (class)

Schema for PoolParams representing stake pool registration parameters.

pool_params =
  ( operator       : pool_keyhash
  , vrf_keyhash    : vrf_keyhash
  , pledge         : coin
  , cost           : coin
  , margin         : unit_interval
  , reward_account : reward_account
  , pool_owners    : set<addr_keyhash>
  , relays         : [* relay]
  , pool_metadata  : pool_metadata/ nil
  )

Signature

export declare class PoolParams

Added in v2.0.0

toJSON (method)

Convert to JSON-serializable object. Converts bigint fields to strings and delegates to contained types' toJSON methods.

Signature

toJSON()

Added in v2.0.0

toCBORBytes (method)

Encode to CBOR bytes.

Signature

toCBORBytes(): Uint8Array

Added in v2.0.0

toCBORHex (method)

Encode to CBOR hex string.

Signature

toCBORHex(): string

Added in v2.0.0

toString (method)

Signature

toString(): string

[Inspectable.NodeInspectSymbol] (method)

Signature

[Inspectable.NodeInspectSymbol](): unknown

[Equal.symbol] (method)

Signature

[Equal.symbol](that: unknown): boolean

[Hash.symbol] (method)

Signature

[Hash.symbol](): number

parsing

fromBytes

Parse PoolParams from CBOR bytes.

Signature

export declare const fromBytes: (bytes: Uint8Array, options?: CBOR.CodecOptions) => PoolParams

Added in v2.0.0

fromHex

Parse PoolParams from CBOR hex string.

Signature

export declare const fromHex: (hex: string, options?: CBOR.CodecOptions) => PoolParams

Added in v2.0.0

predicates

hasMinimumCost

Check if the pool has the minimum required cost.

Signature

export declare const hasMinimumCost: (params: PoolParams, minPoolCost: Coin.Coin) => boolean

Added in v2.0.0

hasValidMargin

Check if the pool margin is within valid range (0 to 1).

Signature

export declare const hasValidMargin: (params: PoolParams) => boolean

Added in v2.0.0

schemas

FromBytes

CBOR bytes transformation schema for PoolParams.

Signature

export declare const FromBytes: (
  options?: CBOR.CodecOptions
) => Schema.transform<
  Schema.transformOrFail<
    typeof Schema.Uint8ArrayFromSelf,
    Schema.declare<CBOR.CBOR, CBOR.CBOR, readonly [], never>,
    never
  >,
  Schema.transformOrFail<
    Schema.Tuple<
      [
        typeof Schema.Uint8ArrayFromSelf,
        typeof Schema.Uint8ArrayFromSelf,
        typeof Schema.BigIntFromSelf,
        typeof Schema.BigIntFromSelf,
        Schema.TaggedStruct<
          "Tag",
          {
            tag: Schema.Literal<[30]>
            value: Schema.Tuple2<typeof Schema.BigIntFromSelf, typeof Schema.BigIntFromSelf>
          }
        >,
        typeof Schema.Uint8ArrayFromSelf,
        Schema.Array$<typeof Schema.Uint8ArrayFromSelf>,
        Schema.Array$<
          Schema.SchemaClass<
            readonly [0n, bigint | null, any, any] | readonly [1n, bigint | null, string] | readonly [2n, string],
            readonly [0n, bigint | null, any, any] | readonly [1n, bigint | null, string] | readonly [2n, string],
            never
          >
        >,
        Schema.NullOr<Schema.SchemaClass<readonly [string, any], readonly [string, any], never>>
      ]
    >,
    Schema.SchemaClass<PoolParams, PoolParams, never>,
    never
  >
>

Added in v2.0.0

FromCDDL

CDDL schema for PoolParams.

pool_params = [
  operator       : pool_keyhash,
  vrf_keyhash    : vrf_keyhash,
  pledge         : coin,
  cost           : coin,
  margin         : unit_interval,
  reward_account : reward_account,
  pool_owners    : set<addr_keyhash>,
  relays         : [* relay],
  pool_metadata  : pool_metadata / nil
]

Signature

export declare const FromCDDL: Schema.transformOrFail<
  Schema.Tuple<
    [
      typeof Schema.Uint8ArrayFromSelf,
      typeof Schema.Uint8ArrayFromSelf,
      typeof Schema.BigIntFromSelf,
      typeof Schema.BigIntFromSelf,
      Schema.TaggedStruct<
        "Tag",
        { tag: Schema.Literal<[30]>; value: Schema.Tuple2<typeof Schema.BigIntFromSelf, typeof Schema.BigIntFromSelf> }
      >,
      typeof Schema.Uint8ArrayFromSelf,
      Schema.Array$<typeof Schema.Uint8ArrayFromSelf>,
      Schema.Array$<
        Schema.SchemaClass<
          readonly [0n, bigint | null, any, any] | readonly [1n, bigint | null, string] | readonly [2n, string],
          readonly [0n, bigint | null, any, any] | readonly [1n, bigint | null, string] | readonly [2n, string],
          never
        >
      >,
      Schema.NullOr<Schema.SchemaClass<readonly [string, any], readonly [string, any], never>>
    ]
  >,
  Schema.SchemaClass<PoolParams, PoolParams, never>,
  never
>

Added in v2.0.0

FromHex

CBOR hex transformation schema for PoolParams.

Signature

export declare const FromHex: (
  options?: CBOR.CodecOptions
) => Schema.transform<
  Schema.Schema<Uint8Array, string, never>,
  Schema.transform<
    Schema.transformOrFail<
      typeof Schema.Uint8ArrayFromSelf,
      Schema.declare<CBOR.CBOR, CBOR.CBOR, readonly [], never>,
      never
    >,
    Schema.transformOrFail<
      Schema.Tuple<
        [
          typeof Schema.Uint8ArrayFromSelf,
          typeof Schema.Uint8ArrayFromSelf,
          typeof Schema.BigIntFromSelf,
          typeof Schema.BigIntFromSelf,
          Schema.TaggedStruct<
            "Tag",
            {
              tag: Schema.Literal<[30]>
              value: Schema.Tuple2<typeof Schema.BigIntFromSelf, typeof Schema.BigIntFromSelf>
            }
          >,
          typeof Schema.Uint8ArrayFromSelf,
          Schema.Array$<typeof Schema.Uint8ArrayFromSelf>,
          Schema.Array$<
            Schema.SchemaClass<
              readonly [0n, bigint | null, any, any] | readonly [1n, bigint | null, string] | readonly [2n, string],
              readonly [0n, bigint | null, any, any] | readonly [1n, bigint | null, string] | readonly [2n, string],
              never
            >
          >,
          Schema.NullOr<Schema.SchemaClass<readonly [string, any], readonly [string, any], never>>
        ]
      >,
      Schema.SchemaClass<PoolParams, PoolParams, never>,
      never
    >
  >
>

Added in v2.0.0

transformation

calculatePoolRewards

Calculate pool operator rewards based on pool parameters.

Signature

export declare const calculatePoolRewards: (
  params: PoolParams,
  totalRewards: Coin.Coin
) => { operatorRewards: Coin.Coin; delegatorRewards: Coin.Coin }

Added in v2.0.0

getEffectiveStake

Get total effective stake for pool rewards calculation.

Signature

export declare const getEffectiveStake: (params: PoolParams, totalStake: Coin.Coin) => Coin.Coin

Added in v2.0.0

utils

CDDLSchema

Signature

export declare const CDDLSchema: Schema.Tuple<
  [
    typeof Schema.Uint8ArrayFromSelf,
    typeof Schema.Uint8ArrayFromSelf,
    typeof Schema.BigIntFromSelf,
    typeof Schema.BigIntFromSelf,
    Schema.TaggedStruct<
      "Tag",
      { tag: Schema.Literal<[30]>; value: Schema.Tuple2<typeof Schema.BigIntFromSelf, typeof Schema.BigIntFromSelf> }
    >,
    typeof Schema.Uint8ArrayFromSelf,
    Schema.Array$<typeof Schema.Uint8ArrayFromSelf>,
    Schema.Array$<
      Schema.SchemaClass<
        readonly [0n, bigint | null, any, any] | readonly [1n, bigint | null, string] | readonly [2n, string],
        readonly [0n, bigint | null, any, any] | readonly [1n, bigint | null, string] | readonly [2n, string],
        never
      >
    >,
    Schema.NullOr<Schema.SchemaClass<readonly [string, any], readonly [string, any], never>>
  ]
>