Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jon/248 #14

Merged
merged 10 commits into from
Sep 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dist/index-c394561d.js → dist/index-2b8530fa.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { n as _t, s as ce, T as N, o as ot, R as Uo, a as E, t as U, p as q, y as gt } from "./index-893452ad.js";
import { n as _t, s as ce, T as N, o as ot, R as Uo, a as E, t as U, p as q, y as gt } from "./index-ab1aec8c.js";
import "react";
/**
* @license
Expand Down
6 changes: 3 additions & 3 deletions dist/index-893452ad.js → dist/index-ab1aec8c.js
Original file line number Diff line number Diff line change
Expand Up @@ -1064,7 +1064,7 @@ let ef = class {
}
async initUi() {
if (typeof window < "u") {
await import("./index-c394561d.js");
await import("./index-2b8530fa.js");
const t = document.createElement("wcm-modal");
document.body.insertAdjacentElement("beforeend", t), Yt.setIsUiLoaded(!0);
}
Expand Down Expand Up @@ -9496,10 +9496,10 @@ const ov = (e) => (t, r, n) => (n.setState = (i, s, ...u) => {
}
}
}
}), a = s ? s.message : i && i.type === "DECRYPT_REJ" ? i.data.error : void 0, l = i && i.type === "DECRYPT_RES" ? i : void 0, h = l == null ? void 0 : l.data.transitions;
}), a = s ? s.message : i && i.type === "DECRYPT_REJ" ? i.data.error : void 0, l = i && i.type === "DECRYPT_RES" ? i : void 0, h = l == null ? void 0 : l.data;
return { decrypt: () => {
!e || !e.startsWith("at1") || e.length !== 61 || n();
}, transitions: h, loading: u, error: a };
}, data: h, loading: u, error: a };
}, qv = (e) => {
const t = sr(), [r] = lr((g) => [
g.chainId
Expand Down
2 changes: 1 addition & 1 deletion dist/puzzle.es.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { x as t, A as o, K as r, J as c, b as l, P as u, k as n, v as _, l as d, F as i, c as z, I as p, w as P, u as m, d as A, e as D, f as w, g as R, h, i as E, r as I, j as g, m as B, q as C, G as f, D as x, C as b, B as v, z as y, E as F, H as S } from "./index-893452ad.js";
import { x as t, A as o, K as r, J as c, b as l, P as u, k as n, v as _, l as d, F as i, c as z, I as p, w as P, u as m, d as A, e as D, f as w, g as R, h, i as E, r as I, j as g, m as B, q as C, G as f, D as x, C as b, B as v, z as y, E as F, H as S } from "./index-ab1aec8c.js";
import "react";
export {
t as Asset,
Expand Down
2 changes: 1 addition & 1 deletion dist/puzzle.umd.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/types/hooks/useDecrypt.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export declare const useDecrypt: (transactionId?: string) => {
decrypt: () => void;
transitions: import("../index.js").ExecuteData[] | undefined;
data: import("../index.js").DeployResData | import("../index.js").ExecuteResData | undefined;
loading: any;
error: string | undefined;
};
3 changes: 2 additions & 1 deletion dist/types/messaging/decrypt.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { DeployResData } from "./deploy.js";
import { ExecuteResData } from "./execute.js";
export type DecryptReqMessage = {
type: 'DECRYPT';
Expand All @@ -7,7 +8,7 @@ export type DecryptReqMessage = {
};
export type DecryptResMessage = {
type: 'DECRYPT_RES';
data: ExecuteResData;
data: ExecuteResData | DeployResData;
};
export type DecryptRejMessage = {
type: 'DECRYPT_REJ';
Expand Down
12 changes: 9 additions & 3 deletions dist/types/messaging/deploy.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,17 @@ export type DeployMessageInputData = {
aleoCode: string;
programName: string;
};
export type DeployResData = {
type: "DEPLOYMENT";
transactionId: string;
timestamp: number;
version: number;
program: string;
programName: string;
};
export type DeployResMessage = {
type: 'DEPLOY_RES';
data: {
transactionId: string;
};
data: DeployResData;
};
export type DeployRejMessage = {
type: 'DEPLOY_REJ';
Expand Down
2 changes: 2 additions & 0 deletions dist/types/messaging/execute.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ export type ExecuteData = {
outputs: TransitionOutputs;
};
export type ExecuteResData = {
type: "EXECUTION";
transactionId: string;
timestamp: number;
transitions: ExecuteData[];
};
export type ExecuteResMessage = {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@puzzlehq/sdk",
"displayName": "Puzzle SDK",
"version": "0.0.81",
"version": "0.0.82",
"description": "Your portal to a private web3 experience.",
"main": "./dist/puzzle.umd.js",
"module": "./dist/puzzle.es.js",
Expand Down
4 changes: 2 additions & 2 deletions src/hooks/useDecrypt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ export const useDecrypt = (

const error: string | undefined = wc_error ? wc_error.message : (wc_data && wc_data.type === 'DECRYPT_REJ' ? wc_data.data.error : undefined);
const puzzleData: DecryptResMessage | undefined = wc_data && wc_data.type === 'DECRYPT_RES' ? wc_data : undefined;
const transitions = puzzleData?.data.transitions;
const data = puzzleData?.data;

const decrypt = () => {
if (!transactionId || !transactionId.startsWith('at1') || transactionId.length !== 61) return;
request();
}

return { decrypt, transitions, loading, error };
return { decrypt, data, loading, error };
};
3 changes: 2 additions & 1 deletion src/messaging/decrypt.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { DeployResData } from "./deploy.js";
import { ExecuteResData } from "./execute.js";

export type DecryptReqMessage = {
Expand All @@ -9,7 +10,7 @@ export type DecryptReqMessage = {

export type DecryptResMessage = {
type: 'DECRYPT_RES';
data: ExecuteResData
data: ExecuteResData | DeployResData
};

export type DecryptRejMessage = {
Expand Down
13 changes: 10 additions & 3 deletions src/messaging/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,18 @@ export type DeployMessageInputData = {
programName: string;
}

export type DeployResData = {
type: "DEPLOYMENT"
transactionId: string,
timestamp: number,
version: number,
program: string,
programName: string,
}

export type DeployResMessage = {
type: 'DEPLOY_RES';
data: {
transactionId: string;
}
data: DeployResData
};

export type DeployRejMessage = {
Expand Down
2 changes: 2 additions & 0 deletions src/messaging/execute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ export type ExecuteData = {
};

export type ExecuteResData = {
type: "EXECUTION"
transactionId: string,
timestamp: number,
transitions: ExecuteData[]
}

Expand Down