Helios API/ API Reference/

Types

AddressProps

Ƭ AddressProps: number[] | string

An array of bytes, a Bech32 encoded address, or the hexadecimal representation of the underlying bytes.

AssetClassProps

Ƭ AssetClassProps: string | [MintingPolicyHash | MintingPolicyHashProps, ByteArray | ByteArrayProps] | { mph: MintingPolicyHash | MintingPolicyHashProps ; tokenName: ByteArray | ByteArrayProps }

AssetsProps

Ƭ AssetsProps: [AssetClass | AssetClassProps, HInt | HIntProps][] | [MintingPolicyHash | MintingPolicyHashProps, [ByteArray | ByteArrayProps, HInt | HIntProps][]][]

ByteArrayProps

Ƭ ByteArrayProps: number[] | string

Cip30Handle

Ƭ Cip30Handle: Object

Convenience type for browser plugin wallets supporting the CIP 30 dApp connector standard (eg. Eternl, Nami, ...).

This is useful in typescript projects to avoid type errors when accessing the handles in window.cardano.

// refer to this file in the 'typeRoots' list in tsconfig.json

type Cip30SimpleHandle = {
  name: string,
  icon: string,
  enable(): Promise<helios.Cip30Handle>,
  isEnabled(): boolean
}

declare global {
  interface Window {
    cardano: {
      [walletName: string]: Cip30SimpleHandle
    };
  }
}

Type declaration

NameType
experimental{ getCollateral: () => Promise<string[]> }
experimental.getCollateral[object Object]
getCollateral() => Promise<string[]>
getNetworkId() => Promise<number>
getRewardAddresses() => Promise<string[]>
getUnusedAddresses() => Promise<string[]>
getUsedAddresses() => Promise<string[]>
getUtxos() => Promise<string[]>
signData(addr: string, sigStructure: string) => Promise<{ key: string ; signature: string }>
signTx(txHex: string, partialSign: boolean) => Promise<string>
submitTx(txHex: string) => Promise<string>

CoinSelectionAlgorithm

Ƭ CoinSelectionAlgorithm: (utxos: TxInput[], amount: Value) => [TxInput[], TxInput[]]

Type declaration

▸ (utxos, amount): [TxInput[], TxInput[]]

Returns two lists. The first list contains the selected UTxOs, the second list contains the remaining UTxOs.

Parameters
NameType
utxosTxInput[]
amountValue
Returns

[TxInput[], TxInput[]]

Cost

Ƭ Cost: Object

Type declaration

NameType
cpubigint
membigint

CostCount

Ƭ CostCount: Cost & { count: number }

CurvePoint

Ƭ CurvePoint<T>: Object

Type parameters

NameType
Textends CurvePoint<T>

Type declaration

NameType
add(other: T) => T
encode() => number[]
equals(other: T) => boolean
mul(scalar: bigint) => T

DatumHashProps

Ƭ DatumHashProps: HashProps

Decoder

Ƭ Decoder: (i: number, bytes: number[]) => void

Type declaration

▸ (i, bytes): void

Parameters
NameType
inumber
bytesnumber[]
Returns

void

HIntProps

Ƭ HIntProps: number | bigint

Deprecated

HashProps

Ƭ HashProps: number[] | string

LiveSlotGetter

Ƭ LiveSlotGetter: () => bigint

Type declaration

▸ (): bigint

Returns

bigint

Metadata

Ƭ Metadata: { map: [any, any][] } | any[] | string | number

The inner 'any' is also Metadata, but jsdoc doesn't allow declaring recursive types Metadata is essentially a JSON schema object

MintingPolicyHashProps

Ƭ MintingPolicyHashProps: HashProps

NetworkSliceUTxOs

Ƭ NetworkSliceUTxOs: Object

collectUtxos removes tx inputs from the list, and appends txoutputs sent to the address to the end.

Index signature

▪ [address: string]: TxInput[]

NumberGenerator

Ƭ NumberGenerator: () => number

Type declaration

▸ (): number

Function that generates a random number between 0 and 1

Returns

number

Profile

Ƭ Profile: Object

mem: in 8 byte words (i.e. 1 mem unit is 64 bits) cpu: in reference cpu microseconds size: in bytes builtins: breakdown per builtin terms: breakdown per termtype result: result of evaluation messages: printed messages (can be helpful when debugging)

Type declaration

NameType
builtins?{ [name: string]: CostCount; }
cpubigint
membigint
messages?string[]
result?RuntimeError | UplcValue
size?number
terms?{ [name: string]: CostCount; }

ProgramConfig

Ƭ ProgramConfig: Object

Type declaration

NameType
allowPosParamsboolean
invertEntryPointboolean

ProgramProperties

Ƭ ProgramProperties: Object

TODO: purpose as enum type

Type declaration

NameType
callsTxTimeRangeboolean
name?string
purposenull | ScriptPurpose

PropertyTest

Ƭ PropertyTest: (args: UplcValue[], res: UplcValue | RuntimeError, isSimplfied?: boolean) => boolean | { [x: string]: boolean; }

Type declaration

▸ (args, res, isSimplfied?): boolean | { [x: string]: boolean; }

Parameters
NameType
argsUplcValue[]
resUplcValue | RuntimeError
isSimplfied?boolean
Returns

boolean | { [x: string]: boolean; }

PubKeyHashProps

Ƭ PubKeyHashProps: HashProps

Represents a blake2b-224 hash of a PubKey

Note: A PubKeyHash can also be used as the second part of a payment Address, or to construct a StakeAddress.

PubKeyProps

Ƭ PubKeyProps: number[] | string

ScriptPurpose

Ƭ ScriptPurpose: "testing" | "minting" | "spending" | "staking" | "endpoint" | "module" | "unknown"

A Helios/Uplc Program can have different purposes

StakingValidatorHashProps

Ƭ StakingValidatorHashProps: HashProps

TransferUplcAst

Ƭ TransferUplcAst: Object

Needed by transfer() methods

Type declaration

NameType
transferByteArrayData(bytes: number[]) => any
transferConstrData(index: number, fields: any[]) => any
transferIntData(value: bigint) => any
transferListData(items: any[]) => any
transferMapData(pairs: [any, any][]) => any
transferSite(src: any, startPos: number, endPos: number, codeMapSite: null | any) => any
transferSource(raw: string, name: string) => any
transferUplcBool(site: any, value: boolean) => any
transferUplcBuiltin(site: any, name: string | number) => any
transferUplcByteArray(site: any, bytes: number[]) => any
transferUplcCall(site: any, a: any, b: any) => any
transferUplcConst(value: any) => any
transferUplcDataValue(site: any, data: any) => any
transferUplcDelay(site: any, expr: any) => any
transferUplcError(site: any, msg: string) => any
transferUplcForce(site: any, expr: any) => any
transferUplcInt(site: any, value: bigint, signed: boolean) => any
transferUplcLambda(site: any, rhs: any, name: null | string) => any
transferUplcList(site: any, itemType: any, items: any[]) => any
transferUplcPair(site: any, first: any, second: any) => any
transferUplcString(site: any, value: string) => any
transferUplcType(typeBits: string) => any
transferUplcUnit(site: any) => any
transferUplcVariable(site: any, index: any) => any

TransferableUplcProgram

Ƭ TransferableUplcProgram<TInstance>: Object

The constructor returns 'any' because it is an instance of TransferableUplcProgram, and the instance methods don't need to be defined here

Type parameters

Name
TInstance

Type declaration

NameType
transferUplcAstTransferUplcAst
transferUplcProgram(expr: any, properties: ProgramProperties, version: any[]) => TInstance

TxIdProps

Ƭ TxIdProps: HashProps

TxOutputIdProps

Ƭ TxOutputIdProps: string | [TxId | TxIdProps, HInt | HIntProps] | { txId: TxId | TxIdProps ; utxoId: HInt | HIntProps }

UInt64Fast

Ƭ UInt64Fast: [number, number]

TODO: switch to using UInt64Fast instead of UInt64 everywhere First entry: high Second entry: low

UplcRTECallbacks

Ƭ UplcRTECallbacks: Object

Type declaration

NameType
onEndCall(site: Site, rawStack: UplcRawStack) => Promise<void>
onIncrCost(name: string, isTerm: boolean, cost: Cost) => void
onPrint(msg: string) => Promise<void>
onStartCall(site: Site, rawStack: UplcRawStack) => Promise<boolean>

UplcRawStack

Ƭ UplcRawStack: [null | string, UplcValue][]

UserTypes

Ƭ UserTypes: Object

Interface for:

  • IRErrorExpr
  • IRCallExpr
  • IRFuncExpr
  • IRNameExpr
  • IRLiteralExpr

The copy() method is needed because inlining can't use the same IRNameExpr twice, so any inlineable expression is copied upon inlining to assure each nested IRNameExpr is unique. This is important to do even the the inlined expression is only called once, because it might still be inlined into multiple other locations that are eliminated in the next iteration.

flatSize returns the number of bits occupied by the equivalent UplcTerm in the final serialized UPLC program This is used to detect small IRFuncExprs and inline them

Index signature

▪ [name: string]: any

ValidatorHashProps

Ƭ ValidatorHashProps: HashProps

ValueGenerator

Ƭ ValueGenerator: () => UplcData

Type declaration

▸ (): UplcData

Returns

UplcData

ValueProps

Ƭ ValueProps: HInt | HIntProps | [HInt | HIntProps, Assets | AssetsProps] | { assets?: Assets | AssetsProps ; lovelace: HInt | HIntProps }