@hazbase/simplicity 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/LICENSE +182 -0
  2. package/README.md +778 -0
  3. package/dist/cli.d.ts +2 -0
  4. package/dist/cli.js +628 -0
  5. package/dist/client/ContractFactory.d.ts +13 -0
  6. package/dist/client/ContractFactory.js +50 -0
  7. package/dist/client/DeployedContract.d.ts +12 -0
  8. package/dist/client/DeployedContract.js +43 -0
  9. package/dist/client/SimplicityClient.d.ts +21 -0
  10. package/dist/client/SimplicityClient.js +65 -0
  11. package/dist/core/artifact.d.ts +6 -0
  12. package/dist/core/artifact.js +100 -0
  13. package/dist/core/compiler.d.ts +3 -0
  14. package/dist/core/compiler.js +117 -0
  15. package/dist/core/errors.d.ts +33 -0
  16. package/dist/core/errors.js +70 -0
  17. package/dist/core/executor.d.ts +5 -0
  18. package/dist/core/executor.js +664 -0
  19. package/dist/core/presets.d.ts +16 -0
  20. package/dist/core/presets.js +251 -0
  21. package/dist/core/rpc.d.ts +7 -0
  22. package/dist/core/rpc.js +37 -0
  23. package/dist/core/summary.d.ts +6 -0
  24. package/dist/core/summary.js +27 -0
  25. package/dist/core/templating.d.ts +2 -0
  26. package/dist/core/templating.js +17 -0
  27. package/dist/core/toolchain.d.ts +14 -0
  28. package/dist/core/toolchain.js +82 -0
  29. package/dist/core/types.d.ts +258 -0
  30. package/dist/core/types.js +2 -0
  31. package/dist/gasless/RelayerClient.d.ts +13 -0
  32. package/dist/gasless/RelayerClient.js +76 -0
  33. package/dist/gasless/types.d.ts +144 -0
  34. package/dist/gasless/types.js +2 -0
  35. package/dist/index.d.ts +8 -0
  36. package/dist/index.js +35 -0
  37. package/dist/presets/htlc.simf.tmpl +35 -0
  38. package/dist/presets/manifest.d.ts +1 -0
  39. package/dist/presets/manifest.js +5 -0
  40. package/dist/presets/p2pk.simf.tmpl +4 -0
  41. package/dist/presets/p2pkLockHeight.simf.tmpl +5 -0
  42. package/dist/presets/transferWithTimeout.simf.tmpl +26 -0
  43. package/package.json +45 -0
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CompiledContract = void 0;
4
+ const artifact_1 = require("../core/artifact");
5
+ const DeployedContract_1 = require("./DeployedContract");
6
+ class CompiledContract {
7
+ config;
8
+ artifact;
9
+ constructor(config, artifact) {
10
+ this.config = config;
11
+ this.artifact = artifact;
12
+ }
13
+ get contractAddress() {
14
+ return this.artifact.compiled.contractAddress;
15
+ }
16
+ get cmr() {
17
+ return this.artifact.compiled.cmr;
18
+ }
19
+ get program() {
20
+ return this.artifact.compiled.program;
21
+ }
22
+ deployment() {
23
+ return {
24
+ contractAddress: this.artifact.compiled.contractAddress,
25
+ internalKey: this.artifact.compiled.internalKey,
26
+ cmr: this.artifact.compiled.cmr,
27
+ network: this.artifact.network,
28
+ instructions: [
29
+ `Fund the contract by sending L-BTC to ${this.artifact.compiled.contractAddress}`,
30
+ "Wait for the contract UTXO to appear before calling inspect/execute.",
31
+ ],
32
+ };
33
+ }
34
+ async saveArtifact(path) {
35
+ await (0, artifact_1.saveArtifact)(path, this.artifact);
36
+ }
37
+ at(addressOverride) {
38
+ const artifact = addressOverride && addressOverride !== this.artifact.compiled.contractAddress
39
+ ? {
40
+ ...this.artifact,
41
+ compiled: {
42
+ ...this.artifact.compiled,
43
+ contractAddress: addressOverride,
44
+ },
45
+ }
46
+ : this.artifact;
47
+ return new DeployedContract_1.DeployedContract(this.config, artifact, artifact.compiled.contractAddress);
48
+ }
49
+ }
50
+ exports.CompiledContract = CompiledContract;
@@ -0,0 +1,12 @@
1
+ import { ContractUtxo, ExecuteCallInput, ExecuteResult, GaslessExecuteInput, GaslessExecuteResult, InspectCallInput, InspectResult, SimplicityArtifact, SimplicityClientConfig, WaitForFundingInput } from "../core/types";
2
+ export declare class DeployedContract {
3
+ private readonly config;
4
+ readonly artifact: SimplicityArtifact;
5
+ readonly contractAddress: string;
6
+ constructor(config: SimplicityClientConfig, artifact: SimplicityArtifact, contractAddress?: string);
7
+ findUtxos(): Promise<ContractUtxo[]>;
8
+ waitForFunding(input?: WaitForFundingInput): Promise<ContractUtxo[]>;
9
+ inspectCall(input: InspectCallInput): Promise<InspectResult>;
10
+ execute(input: ExecuteCallInput): Promise<ExecuteResult>;
11
+ executeGasless(input: GaslessExecuteInput): Promise<GaslessExecuteResult>;
12
+ }
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DeployedContract = void 0;
4
+ const executor_1 = require("../core/executor");
5
+ const executor_2 = require("../core/executor");
6
+ class DeployedContract {
7
+ config;
8
+ artifact;
9
+ contractAddress;
10
+ constructor(config, artifact, contractAddress = artifact.compiled.contractAddress) {
11
+ this.config = config;
12
+ this.artifact = artifact;
13
+ this.contractAddress = contractAddress;
14
+ }
15
+ async findUtxos() {
16
+ return (0, executor_1.findContractUtxos)(this.config, this.artifact);
17
+ }
18
+ async waitForFunding(input = {}) {
19
+ const minAmountSat = input.minAmountSat ?? 1;
20
+ const pollIntervalMs = input.pollIntervalMs ?? 10_000;
21
+ const timeoutMs = input.timeoutMs ?? 120_000;
22
+ const start = Date.now();
23
+ while (Date.now() - start < timeoutMs) {
24
+ const utxos = await this.findUtxos();
25
+ const filtered = utxos.filter((utxo) => utxo.sat >= minAmountSat);
26
+ if (filtered.length > 0) {
27
+ return filtered;
28
+ }
29
+ await new Promise((resolve) => setTimeout(resolve, pollIntervalMs));
30
+ }
31
+ throw new Error(`Timed out waiting for funding at ${this.contractAddress}`);
32
+ }
33
+ async inspectCall(input) {
34
+ return (0, executor_1.inspectContractCall)(this.config, this.artifact, input);
35
+ }
36
+ async execute(input) {
37
+ return (0, executor_1.executeContractCall)(this.config, this.artifact, input);
38
+ }
39
+ async executeGasless(input) {
40
+ return (0, executor_2.executeGaslessContractCall)(this.config, this.artifact, input);
41
+ }
42
+ }
43
+ exports.DeployedContract = DeployedContract;
@@ -0,0 +1,21 @@
1
+ import { ElementsRpcClient } from "../core/rpc";
2
+ import { CompileFromFileInput, CompileFromPresetInput, SimplicityArtifact, SimplicityClientConfig } from "../core/types";
3
+ import { RelayerClient } from "../gasless/RelayerClient";
4
+ import { GaslessTransferInput, GaslessTransferResult, RelayerClientConfig } from "../gasless/types";
5
+ import { CompiledContract } from "./ContractFactory";
6
+ import { DeployedContract } from "./DeployedContract";
7
+ export declare class SimplicityClient {
8
+ readonly config: SimplicityClientConfig;
9
+ readonly rpc: ElementsRpcClient;
10
+ readonly payments: {
11
+ gaslessTransfer: (input: GaslessTransferInput) => Promise<GaslessTransferResult>;
12
+ };
13
+ constructor(config: SimplicityClientConfig);
14
+ compileFromFile(input: CompileFromFileInput): Promise<CompiledContract>;
15
+ compileFromPreset(input: CompileFromPresetInput): Promise<CompiledContract>;
16
+ loadArtifact(path: string): Promise<CompiledContract>;
17
+ fromArtifact(artifact: SimplicityArtifact): DeployedContract;
18
+ relayer(config: RelayerClientConfig): RelayerClient;
19
+ private gaslessTransfer;
20
+ }
21
+ export declare function createSimplicityClient(config: SimplicityClientConfig): SimplicityClient;
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SimplicityClient = void 0;
4
+ exports.createSimplicityClient = createSimplicityClient;
5
+ const artifact_1 = require("../core/artifact");
6
+ const compiler_1 = require("../core/compiler");
7
+ const rpc_1 = require("../core/rpc");
8
+ const RelayerClient_1 = require("../gasless/RelayerClient");
9
+ const ContractFactory_1 = require("./ContractFactory");
10
+ const DeployedContract_1 = require("./DeployedContract");
11
+ class SimplicityClient {
12
+ config;
13
+ rpc;
14
+ payments;
15
+ constructor(config) {
16
+ this.config = config;
17
+ this.rpc = new rpc_1.ElementsRpcClient(config.rpc);
18
+ this.payments = {
19
+ gaslessTransfer: async (input) => this.gaslessTransfer(input),
20
+ };
21
+ }
22
+ async compileFromFile(input) {
23
+ const artifact = await (0, compiler_1.compileFromFile)(this.config, input);
24
+ return new ContractFactory_1.CompiledContract(this.config, artifact);
25
+ }
26
+ async compileFromPreset(input) {
27
+ const artifact = await (0, compiler_1.compileFromPreset)(this.config, input);
28
+ return new ContractFactory_1.CompiledContract(this.config, artifact);
29
+ }
30
+ async loadArtifact(path) {
31
+ const artifact = await (0, artifact_1.loadArtifact)(path, this.config.network);
32
+ return new ContractFactory_1.CompiledContract(this.config, artifact);
33
+ }
34
+ fromArtifact(artifact) {
35
+ return new DeployedContract_1.DeployedContract(this.config, artifact);
36
+ }
37
+ relayer(config) {
38
+ return new RelayerClient_1.RelayerClient(config);
39
+ }
40
+ async gaslessTransfer(input) {
41
+ const relayer = input.relayer ?? (this.config.relayer ? new RelayerClient_1.RelayerClient({
42
+ baseUrl: this.config.relayer.baseUrl,
43
+ apiKey: this.config.relayer.apiKey ?? "",
44
+ }) : null);
45
+ if (!relayer) {
46
+ throw new Error("Relayer config is required for gaslessTransfer");
47
+ }
48
+ const request = await relayer.requestPset({
49
+ amount: input.amount,
50
+ toAddress: input.toAddress,
51
+ fromLabel: input.fromLabel,
52
+ });
53
+ const walletResult = await this.rpc.call("walletprocesspsbt", [request.psetBase64, true, "ALL", true], input.userWallet);
54
+ const signedPsetBase64 = walletResult.psbt;
55
+ const submit = await relayer.submitSignedPset({
56
+ psetId: request.psetId,
57
+ signedPsetBase64,
58
+ });
59
+ return { request, signedPsetBase64, submit };
60
+ }
61
+ }
62
+ exports.SimplicityClient = SimplicityClient;
63
+ function createSimplicityClient(config) {
64
+ return new SimplicityClient(config);
65
+ }
@@ -0,0 +1,6 @@
1
+ import { AnyArtifact, SimplicityArtifact } from "./types";
2
+ export declare const SDK_ARTIFACT_VERSION = 6;
3
+ export declare const SDK_PACKAGE_VERSION = "0.1.0";
4
+ export declare function normalizeArtifact(artifact: AnyArtifact, networkDefault?: SimplicityArtifact["network"]): SimplicityArtifact;
5
+ export declare function loadArtifact(artifactPath: string, networkDefault?: SimplicityArtifact["network"]): Promise<SimplicityArtifact>;
6
+ export declare function saveArtifact(artifactPath: string, artifact: SimplicityArtifact): Promise<void>;
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.SDK_PACKAGE_VERSION = exports.SDK_ARTIFACT_VERSION = void 0;
7
+ exports.normalizeArtifact = normalizeArtifact;
8
+ exports.loadArtifact = loadArtifact;
9
+ exports.saveArtifact = saveArtifact;
10
+ const promises_1 = require("node:fs/promises");
11
+ const node_path_1 = __importDefault(require("node:path"));
12
+ const errors_1 = require("./errors");
13
+ exports.SDK_ARTIFACT_VERSION = 6;
14
+ exports.SDK_PACKAGE_VERSION = "0.1.0";
15
+ function isArtifactV5(value) {
16
+ return value.version === 5;
17
+ }
18
+ function normalizeArtifact(artifact, networkDefault = "liquidtestnet") {
19
+ if (artifact.version === exports.SDK_ARTIFACT_VERSION) {
20
+ return artifact;
21
+ }
22
+ if (!isArtifactV5(artifact)) {
23
+ throw new errors_1.ArtifactError("Unsupported artifact version", artifact);
24
+ }
25
+ const compiled = artifact.compiled ?? {};
26
+ if (!compiled.program || !compiled.cmr || !compiled.internalKey || !compiled.contractAddress) {
27
+ throw new errors_1.ArtifactError("Artifact v5 is missing compiled fields", artifact);
28
+ }
29
+ return {
30
+ version: exports.SDK_ARTIFACT_VERSION,
31
+ kind: "simplicity-artifact",
32
+ createdAt: artifact.createdAt,
33
+ network: networkDefault,
34
+ source: {
35
+ mode: "file",
36
+ simfPath: artifact.simfTemplatePath,
37
+ templateVars: artifact.params
38
+ ? {
39
+ MIN_HEIGHT: artifact.params.minHeight ?? "",
40
+ SIGNER_XONLY: artifact.params.signerXonly ?? "",
41
+ }
42
+ : undefined,
43
+ },
44
+ compiled: {
45
+ program: compiled.program,
46
+ cmr: compiled.cmr,
47
+ internalKey: compiled.internalKey,
48
+ contractAddress: compiled.contractAddress,
49
+ },
50
+ toolchain: {
51
+ simcPath: artifact.toolchain?.simcPath ?? "simc",
52
+ halSimplicity: artifact.toolchain?.halSimplicity ?? "hal-simplicity",
53
+ },
54
+ metadata: {
55
+ sdkVersion: exports.SDK_PACKAGE_VERSION,
56
+ notes: null,
57
+ },
58
+ legacy: {
59
+ simfTemplatePath: artifact.simfTemplatePath,
60
+ params: artifact.params,
61
+ },
62
+ };
63
+ }
64
+ async function loadArtifact(artifactPath, networkDefault = "liquidtestnet") {
65
+ const raw = await (0, promises_1.readFile)(artifactPath, "utf8");
66
+ let parsed;
67
+ try {
68
+ parsed = JSON.parse(raw);
69
+ }
70
+ catch (error) {
71
+ throw new errors_1.ArtifactError(`Failed to parse artifact JSON at ${artifactPath}`, error);
72
+ }
73
+ const normalized = normalizeArtifact(parsed, networkDefault);
74
+ const artifactDir = node_path_1.default.dirname(node_path_1.default.resolve(artifactPath));
75
+ const sourceSimfPath = normalized.source.simfPath
76
+ ? node_path_1.default.resolve(artifactDir, normalized.source.simfPath)
77
+ : normalized.source.simfPath;
78
+ const legacySimfTemplatePath = normalized.legacy?.simfTemplatePath
79
+ ? node_path_1.default.resolve(artifactDir, normalized.legacy.simfTemplatePath)
80
+ : normalized.legacy?.simfTemplatePath;
81
+ return {
82
+ ...normalized,
83
+ source: {
84
+ ...normalized.source,
85
+ simfPath: sourceSimfPath,
86
+ },
87
+ legacy: normalized.legacy
88
+ ? {
89
+ ...normalized.legacy,
90
+ simfTemplatePath: legacySimfTemplatePath,
91
+ }
92
+ : undefined,
93
+ };
94
+ }
95
+ async function saveArtifact(artifactPath, artifact) {
96
+ if (!node_path_1.default.isAbsolute(artifactPath) && artifactPath.trim().length === 0) {
97
+ throw new errors_1.ValidationError("artifactPath must not be empty");
98
+ }
99
+ await (0, promises_1.writeFile)(artifactPath, JSON.stringify(artifact, null, 2), "utf8");
100
+ }
@@ -0,0 +1,3 @@
1
+ import { CompileFromFileInput, CompileFromPresetInput, SimplicityArtifact, SimplicityClientConfig } from "./types";
2
+ export declare function compileFromFile(config: SimplicityClientConfig, input: CompileFromFileInput): Promise<SimplicityArtifact>;
3
+ export declare function compileFromPreset(config: SimplicityClientConfig, input: CompileFromPresetInput): Promise<SimplicityArtifact>;
@@ -0,0 +1,117 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.compileFromFile = compileFromFile;
7
+ exports.compileFromPreset = compileFromPreset;
8
+ const promises_1 = require("node:fs/promises");
9
+ const node_os_1 = require("node:os");
10
+ const node_path_1 = __importDefault(require("node:path"));
11
+ const artifact_1 = require("./artifact");
12
+ const errors_1 = require("./errors");
13
+ const presets_1 = require("./presets");
14
+ const templating_1 = require("./templating");
15
+ const toolchain_1 = require("./toolchain");
16
+ function parseSimcProgram(output) {
17
+ const lines = output
18
+ .split("\n")
19
+ .map((line) => line.trim())
20
+ .filter(Boolean);
21
+ for (const line of lines) {
22
+ if (line.startsWith("Program:")) {
23
+ const rest = line.slice("Program:".length).trim();
24
+ if (rest)
25
+ return rest;
26
+ }
27
+ }
28
+ const nextLineIndex = lines.findIndex((line) => line === "Program:");
29
+ if (nextLineIndex >= 0 && lines[nextLineIndex + 1]) {
30
+ return lines[nextLineIndex + 1];
31
+ }
32
+ throw new errors_1.CompilerError("Could not parse Program from simc output", { output });
33
+ }
34
+ async function buildArtifact(input) {
35
+ const compileOutput = await (0, toolchain_1.runSimcCompile)(input.config.toolchain.simcPath, input.renderedSimfPath);
36
+ const program = parseSimcProgram(compileOutput);
37
+ const info = (await (0, toolchain_1.runHalInfo)(input.config.toolchain.halSimplicityPath, program));
38
+ const cmr = info.cmr;
39
+ const contractAddress = info.liquid_testnet_address_unconf ?? info.liquid_address_unconf;
40
+ const internalKey = info.internal_key ?? "50929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0";
41
+ if (!cmr || !contractAddress || !internalKey) {
42
+ throw new errors_1.CompilerError("Missing fields in hal-simplicity info response", info);
43
+ }
44
+ const halVersion = await (0, toolchain_1.runCommand)(input.config.toolchain.halSimplicityPath, ["--version"]);
45
+ return (0, artifact_1.normalizeArtifact)({
46
+ version: 6,
47
+ kind: "simplicity-artifact",
48
+ createdAt: new Date().toISOString(),
49
+ network: input.config.network,
50
+ source: {
51
+ mode: input.sourceMode,
52
+ simfPath: input.sourceSimfPath,
53
+ preset: input.preset,
54
+ templateVars: input.templateVars,
55
+ },
56
+ compiled: {
57
+ program,
58
+ cmr,
59
+ internalKey,
60
+ contractAddress,
61
+ },
62
+ toolchain: {
63
+ simcPath: input.config.toolchain.simcPath,
64
+ halSimplicity: halVersion.stdout || input.config.toolchain.halSimplicityPath,
65
+ },
66
+ metadata: {
67
+ sdkVersion: artifact_1.SDK_PACKAGE_VERSION,
68
+ notes: null,
69
+ },
70
+ legacy: {
71
+ simfTemplatePath: input.sourceSimfPath,
72
+ params: {
73
+ minHeight: typeof input.templateVars?.MIN_HEIGHT === "number" ? input.templateVars.MIN_HEIGHT : undefined,
74
+ signerXonly: typeof input.templateVars?.SIGNER_XONLY === "string" ? input.templateVars.SIGNER_XONLY : undefined,
75
+ },
76
+ },
77
+ }, input.config.network);
78
+ }
79
+ async function compileFromFile(config, input) {
80
+ const rawSource = await (0, promises_1.readFile)(input.simfPath, "utf8");
81
+ const rendered = (0, templating_1.renderTemplate)(rawSource, input.templateVars ?? {});
82
+ const workDir = await (0, promises_1.mkdtemp)(node_path_1.default.join((0, node_os_1.tmpdir)(), "simplicity-sdk-compile-"));
83
+ const renderedPath = node_path_1.default.join(workDir, node_path_1.default.basename(input.simfPath));
84
+ await (0, promises_1.writeFile)(renderedPath, rendered, "utf8");
85
+ const artifact = await buildArtifact({
86
+ config,
87
+ renderedSimfPath: renderedPath,
88
+ sourceMode: "file",
89
+ sourceSimfPath: input.simfPath,
90
+ templateVars: input.templateVars,
91
+ });
92
+ if (input.artifactPath) {
93
+ await (0, artifact_1.saveArtifact)(input.artifactPath, artifact);
94
+ }
95
+ return artifact;
96
+ }
97
+ async function compileFromPreset(config, input) {
98
+ const preset = (0, presets_1.getPresetOrThrow)(input.preset);
99
+ const params = (0, presets_1.validatePresetParams)(preset, input.params);
100
+ const rawSource = await (0, promises_1.readFile)(preset.simfTemplatePath, "utf8");
101
+ const rendered = (0, templating_1.renderTemplate)(rawSource, params);
102
+ const workDir = await (0, promises_1.mkdtemp)(node_path_1.default.join((0, node_os_1.tmpdir)(), "simplicity-sdk-preset-"));
103
+ const renderedPath = node_path_1.default.join(workDir, `${preset.id}.simf`);
104
+ await (0, promises_1.writeFile)(renderedPath, rendered, "utf8");
105
+ const artifact = await buildArtifact({
106
+ config,
107
+ renderedSimfPath: renderedPath,
108
+ sourceMode: "preset",
109
+ sourceSimfPath: preset.simfTemplatePath,
110
+ preset: preset.id,
111
+ templateVars: params,
112
+ });
113
+ if (input.artifactPath) {
114
+ await (0, artifact_1.saveArtifact)(input.artifactPath, artifact);
115
+ }
116
+ return artifact;
117
+ }
@@ -0,0 +1,33 @@
1
+ export declare class SimplicitySdkError extends Error {
2
+ readonly code: string;
3
+ readonly details?: unknown | undefined;
4
+ constructor(code: string, message: string, details?: unknown | undefined);
5
+ }
6
+ export declare class ToolchainError extends SimplicitySdkError {
7
+ constructor(message: string, details?: unknown);
8
+ }
9
+ export declare class CompilerError extends SimplicitySdkError {
10
+ constructor(message: string, details?: unknown);
11
+ }
12
+ export declare class ArtifactError extends SimplicitySdkError {
13
+ constructor(message: string, details?: unknown);
14
+ }
15
+ export declare class ExecutionError extends SimplicitySdkError {
16
+ constructor(message: string, details?: unknown);
17
+ }
18
+ export declare class UtxoNotFoundError extends SimplicitySdkError {
19
+ constructor(message: string, details?: unknown);
20
+ }
21
+ export declare class RelayerError extends SimplicitySdkError {
22
+ readonly status?: number | undefined;
23
+ constructor(message: string, details?: unknown, status?: number | undefined);
24
+ }
25
+ export declare class UnsupportedFeatureError extends SimplicitySdkError {
26
+ constructor(message: string, details?: unknown);
27
+ }
28
+ export declare class ValidationError extends SimplicitySdkError {
29
+ constructor(message: string, details?: unknown);
30
+ }
31
+ export declare class PresetExecutionError extends SimplicitySdkError {
32
+ constructor(message: string, details?: unknown);
33
+ }
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PresetExecutionError = exports.ValidationError = exports.UnsupportedFeatureError = exports.RelayerError = exports.UtxoNotFoundError = exports.ExecutionError = exports.ArtifactError = exports.CompilerError = exports.ToolchainError = exports.SimplicitySdkError = void 0;
4
+ class SimplicitySdkError extends Error {
5
+ code;
6
+ details;
7
+ constructor(code, message, details) {
8
+ super(message);
9
+ this.code = code;
10
+ this.details = details;
11
+ this.name = new.target.name;
12
+ }
13
+ }
14
+ exports.SimplicitySdkError = SimplicitySdkError;
15
+ class ToolchainError extends SimplicitySdkError {
16
+ constructor(message, details) {
17
+ super("TOOLCHAIN_ERROR", message, details);
18
+ }
19
+ }
20
+ exports.ToolchainError = ToolchainError;
21
+ class CompilerError extends SimplicitySdkError {
22
+ constructor(message, details) {
23
+ super("COMPILER_ERROR", message, details);
24
+ }
25
+ }
26
+ exports.CompilerError = CompilerError;
27
+ class ArtifactError extends SimplicitySdkError {
28
+ constructor(message, details) {
29
+ super("ARTIFACT_ERROR", message, details);
30
+ }
31
+ }
32
+ exports.ArtifactError = ArtifactError;
33
+ class ExecutionError extends SimplicitySdkError {
34
+ constructor(message, details) {
35
+ super("EXECUTION_ERROR", message, details);
36
+ }
37
+ }
38
+ exports.ExecutionError = ExecutionError;
39
+ class UtxoNotFoundError extends SimplicitySdkError {
40
+ constructor(message, details) {
41
+ super("UTXO_NOT_FOUND", message, details);
42
+ }
43
+ }
44
+ exports.UtxoNotFoundError = UtxoNotFoundError;
45
+ class RelayerError extends SimplicitySdkError {
46
+ status;
47
+ constructor(message, details, status) {
48
+ super("RELAYER_ERROR", message, details);
49
+ this.status = status;
50
+ }
51
+ }
52
+ exports.RelayerError = RelayerError;
53
+ class UnsupportedFeatureError extends SimplicitySdkError {
54
+ constructor(message, details) {
55
+ super("UNSUPPORTED_FEATURE", message, details);
56
+ }
57
+ }
58
+ exports.UnsupportedFeatureError = UnsupportedFeatureError;
59
+ class ValidationError extends SimplicitySdkError {
60
+ constructor(message, details) {
61
+ super("VALIDATION_ERROR", message, details);
62
+ }
63
+ }
64
+ exports.ValidationError = ValidationError;
65
+ class PresetExecutionError extends SimplicitySdkError {
66
+ constructor(message, details) {
67
+ super("PRESET_EXECUTION_UNSUPPORTED", message, details);
68
+ }
69
+ }
70
+ exports.PresetExecutionError = PresetExecutionError;
@@ -0,0 +1,5 @@
1
+ import { ContractUtxo, ExecuteCallInput, ExecuteResult, GaslessExecuteInput, GaslessExecuteResult, InspectCallInput, InspectResult, SimplicityArtifact, SimplicityClientConfig } from "./types";
2
+ export declare function inspectContractCall(config: SimplicityClientConfig, artifact: SimplicityArtifact, input: InspectCallInput): Promise<InspectResult>;
3
+ export declare function executeContractCall(config: SimplicityClientConfig, artifact: SimplicityArtifact, input: ExecuteCallInput): Promise<ExecuteResult>;
4
+ export declare function findContractUtxos(config: SimplicityClientConfig, artifact: SimplicityArtifact): Promise<ContractUtxo[]>;
5
+ export declare function executeGaslessContractCall(config: SimplicityClientConfig, artifact: SimplicityArtifact, input: GaslessExecuteInput): Promise<GaslessExecuteResult>;