(constant) addressToPushPrefixedLockScript

Helper function to convert an address to a locking script hex string prefixed with the PUSH opcode required to push the lock script

(constant) calculateRequiredFundingSatoshis

Calculate the total required satoshis to pay for a contract funding, including potential settlement service fees and miner fees. For miner fee calculation it is assumed that the transaction contains 2 P2PKH inputs.

(constant) calculateTakerFundingSatoshis

Calculate the final funding satoshis required by a taker in a maker-taker scenario where taker is assumed to be paying all contract related fees.

(constant) calculateTransactionSize

Calculate the size of the passed transaction in bytes

(constant) constructFundingOutputs

Constructs the required outputs for a funding transaction, including fee output if fee information is provided.

(constant) createOutput

Create a Libauth Output object from an address and amount.

(constant) createUnsignedInput

Convert a "UTXO" object to a Libauth "Input" object (with value preserved).

(constant) decodeUnlockingBytecodeP2PKH

Decode a P2PKH unlocking bytecode into the corresponding signature and public key.

(constant) encodeUnlockingBytecodeP2PKH

Encode a public key and signature into unlocking bytecode for a P2PKH locking bytecode.

(constant) estimateTransactionSizeWithoutInputs

Estimate the transaction size of a dummy transaction in bytes, disregarding inputs

(constant) generateSigningSerializationHash

Generate a signing serialization based on the provided transaction / input related parameters.

(constant) generateTransactionFromFundingProposal

Deterministically generate a partial transaction from a funding proposal.

(constant) mergeTransactionInputs

Merge the inputs of transaction 2 into transaction 1.

(constant) signTransactionP2PKH

Sign an unsigned transaction using the provided private key WIF, skipping inputs that are already signed.

(constant) validateHighLiquidationPrice

Validates analytical constraints on the high liquidation price in the context of a full contract lifecycle.

(constant) validateIntegerDivisionPrecision

Validates minimum integer division precision, which is used in various contract calculations. Precision is defined in the context of integer division when the remainder portion (mod) is discarded. Precision is fine when the relative distance between numbers is large, e.g. (1_000_000 / 7 = 142857 vs. 142857.142). However, calculations become imprecise when the relative distance is small, e.g. (10 / 7 = 1 vs. 1.429, almost 50% error).

(constant) validateLowLiquidationPrice

Validates analytical constraints on the low liquidation price in the context of a full contract lifecycle.

(constant) validateNominalUnitsXSatsPerBch

Validates analytical constraints on the compound nominal value x satoshis per bch in the context of a full contract lifecycle.

(constant) validatePayoutSats

Validates analytical constraints of payout satoshis in the context of a full contract lifecycle.

Type Definitions


Name Type Attributes Description
authenticationToken string <optional>
authentication token used to authenticate network requests to the settlement service
contractVersion ContractVersion <optional>
string denoting which AnyHedge contract version to use.
serviceDomain string <optional>
fully qualified domain name for the settlement service provider.
servicePort number <optional>
network port number for the settlement service provider.
serviceScheme 'http' | 'https' <optional>
network scheme for the settlement service provider, either 'http' or 'https'.
electrumCluster ElectrumCluster <optional>
electrum cluster to use in BCH network operations.
networkProvider NetworkProvider <optional>
network provider to use for BCH network operations.
Constructor parameters for setting up an anyhedge manager.
  • object


Name Type Description
name string name or identifier for the fee in form presentable to an end-user.
description string description explaining the fee in form presentable to an end-user.
address string bitcoin cash address where service fees are to be paid.
satoshis number how many satoshis are required to be paid as service fee.
Information about service fees.
  • object