@helios-lang/ledger
Advanced tools
Comparing version
{ | ||
"name": "@helios-lang/ledger", | ||
"version": "0.1.11", | ||
"version": "0.1.12", | ||
"description": "Ledger types (eg. for building transactions)", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -411,3 +411,7 @@ import { bytesToHex, equalsBytes } from "@helios-lang/codec-utils" | ||
const redeemer = mph.context ? (/** @type {MintingPolicyHash<any, any>} */ (mph)).context.redeemer.toUplcData(/** @type {TRedeemer} */ (args[2])) : /** @type {Option<UplcData>} */ (args[2]) | ||
const redeemer = mph.context | ||
? /** @type {MintingPolicyHash<any, any>} */ ( | ||
mph | ||
).context.redeemer.toUplcData(/** @type {TRedeemer} */ (args[2])) | ||
: /** @type {Option<UplcData>} */ (args[2]) | ||
@@ -414,0 +418,0 @@ this.mintedTokens.addTokens(mph, tokens) |
export { PubKeyHash } from "./PubKeyHash.js"; | ||
export { ScriptHash } from "./ScriptHash.js"; | ||
export type PubKeyHashLike = import("./PubKeyHash.js").PubKeyHashLike; | ||
export type ScriptHashLike = import("./ScriptHash.js").ScriptHashLike; | ||
//# sourceMappingURL=index.d.ts.map |
export * from "./hashes/index.js"; | ||
export * from "./native/index.js"; | ||
export type PubKeyHashLike = import("./hashes/index.js").PubKeyHashLike; | ||
export type ScriptHashLike = import("./hashes/index.js").ScriptHashLike; | ||
export type NativeContext = import("./native/index.js").NativeContext; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -7,11 +7,24 @@ /** | ||
/** | ||
* @template TStrict | ||
* @template TPermissive | ||
* @typedef {import("./Cast.js").Cast<TStrict, TPermissive>} Cast | ||
*/ | ||
/** | ||
* @typedef {MintingPolicyHash | ByteArrayLike} MintingPolicyHashLike | ||
*/ | ||
/** | ||
* @template [TRedeemer=UplcData] | ||
* @typedef {{ | ||
* program: UplcProgramV1 | UplcProgramV2, | ||
* redeemer: Cast<UplcData, TRedeemer> | ||
* }} MintingPolicyHashContext | ||
*/ | ||
/** | ||
* Represents a blake2b-224 hash of a minting policy script | ||
* | ||
* **Note**: to calculate this hash the script is first encoded as a CBOR byte-array and then prepended by a script version byte. | ||
* @template [TRedeemer=UplcData] | ||
* @implements {Hash} | ||
*/ | ||
export class MintingPolicyHash extends ScriptHash implements Hash { | ||
export class MintingPolicyHash<TRedeemer = import("@helios-lang/uplc").UplcData> extends ScriptHash implements Hash { | ||
/** | ||
@@ -44,2 +57,13 @@ * @param {MintingPolicyHashLike} arg | ||
/** | ||
* Can be 0 bytes in case of Ada | ||
* @param {Exclude<MintingPolicyHashLike, MintingPolicyHash>} bytes | ||
* @param {Option<MintingPolicyHashContext<TRedeemer>>} context | ||
*/ | ||
constructor(bytes: Exclude<MintingPolicyHashLike, MintingPolicyHash>, context?: Option<MintingPolicyHashContext<TRedeemer>>); | ||
/** | ||
* @readonly | ||
* @type {Option<MintingPolicyHashContext<TRedeemer>>} | ||
*/ | ||
readonly context: Option<MintingPolicyHashContext<TRedeemer>>; | ||
/** | ||
* @param {MintingPolicyHash} other | ||
@@ -58,4 +82,11 @@ * @returns {boolean} | ||
export type Hash = import("./Hash.js").Hash; | ||
export type Cast<TStrict, TPermissive> = import("./Cast.js").Cast<TStrict, TPermissive>; | ||
export type MintingPolicyHashLike = MintingPolicyHash | ByteArrayLike; | ||
export type MintingPolicyHashContext<TRedeemer = import("@helios-lang/uplc").UplcData> = { | ||
program: UplcProgramV1 | UplcProgramV2; | ||
redeemer: Cast<UplcData, TRedeemer>; | ||
}; | ||
import { ScriptHash } from "./ScriptHash.js"; | ||
import { UplcProgramV1 } from "@helios-lang/uplc"; | ||
import { UplcProgramV2 } from "@helios-lang/uplc"; | ||
//# sourceMappingURL=MintingPolicyHash.d.ts.map |
export { ScriptHash } from "../../allegra/index.js"; | ||
export type ScriptHashLike = import("../../allegra/index.js").ScriptHashLike; | ||
//# sourceMappingURL=ScriptHash.d.ts.map |
@@ -7,4 +7,4 @@ /** | ||
export const DEFAULT_NETWORK_PARAMS: NetworkParams; | ||
export type CostModelParamsV1 = any; | ||
export type CostModelParamsV2 = any; | ||
export type CostModelParamsV1 = import("@helios-lang/uplc").CostModelParamsV1; | ||
export type CostModelParamsV2 = import("@helios-lang/uplc").CostModelParamsV2; | ||
/** | ||
@@ -11,0 +11,0 @@ * The raw JSON can be downloaded from the following CDN locations: |
@@ -155,3 +155,11 @@ /** | ||
/** | ||
* @template TRedeemer | ||
* @overload | ||
* @param {MintingPolicyHash<TRedeemer>} policy | ||
* @param {[ByteArrayLike, number | bigint][]} tokens | ||
* @param {TRedeemer} redeemer | ||
*/ | ||
mint<TRedeemer>(policy: MintingPolicyHash<TRedeemer>, tokens: [ByteArrayLike, number | bigint][], redeemer: TRedeemer): any; | ||
/** | ||
* @overload | ||
* @param {MintingPolicyHashLike} policy | ||
@@ -533,2 +541,3 @@ * @param {[ByteArrayLike, number | bigint][]} tokens - list of pairs of [tokenName, quantity], tokenName can be list of bytes or hex-string | ||
import { UplcProgramV2 } from "@helios-lang/uplc"; | ||
import { MintingPolicyHash } from "../hashes/index.js"; | ||
import { TxOutputDatum } from "./TxOutputDatum.js"; | ||
@@ -535,0 +544,0 @@ import { TxOutput } from "./TxOutput.js"; |
@@ -27,5 +27,5 @@ /** | ||
* @param {Option<TxOutputDatum>} datum | ||
* @param {Option<UplcProgramV2>} refScript - plutus v2 script for now | ||
* @param {Option<UplcProgramV1 | UplcProgramV2>} refScript - plutus v2 script for now | ||
*/ | ||
constructor(address: AddressLike, value: ValueLike, datum?: Option<TxOutputDatum>, refScript?: Option<UplcProgramV2>); | ||
constructor(address: AddressLike, value: ValueLike, datum?: Option<TxOutputDatum>, refScript?: Option<UplcProgramV1 | UplcProgramV2>); | ||
/** | ||
@@ -47,5 +47,5 @@ * Mutation is useful when correcting the quantity of lovelace in a utxo | ||
/** | ||
* @type {Option<UplcProgramV2>} | ||
* @type {Option<UplcProgramV1 | UplcProgramV2>} | ||
*/ | ||
refScript: Option<UplcProgramV2>; | ||
refScript: Option<UplcProgramV1 | UplcProgramV2>; | ||
/** | ||
@@ -87,4 +87,6 @@ * @returns {Object} | ||
import { TxOutputDatum } from "./TxOutputDatum.js"; | ||
import { UplcProgramV1 } from "@helios-lang/uplc"; | ||
import { UplcProgramV2 } from "@helios-lang/uplc"; | ||
import { ConstrData } from "@helios-lang/uplc"; | ||
import { NetworkParamsHelper } from "../params/index.js"; | ||
//# sourceMappingURL=TxOutput.d.ts.map |
@@ -69,3 +69,3 @@ /** | ||
*/ | ||
get allScripts(): any[]; | ||
get allScripts(): (NativeScript<import("../../allegra/native/NativeScript.js").NativeScriptKind> | UplcProgramV1 | UplcProgramV2)[]; | ||
/** | ||
@@ -112,3 +112,5 @@ * @param {Signature} signature | ||
import { NativeScript } from "../native/index.js"; | ||
import { UplcProgramV1 } from "@helios-lang/uplc"; | ||
import { UplcProgramV2 } from "@helios-lang/uplc"; | ||
import { NetworkParamsHelper } from "../params/index.js"; | ||
//# sourceMappingURL=TxWitnesses.d.ts.map |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
611656
0.57%319
0.63%17975
0.31%