@tari-project/tarijs 0.13.0 → 0.13.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.
package/.prototools CHANGED
@@ -1,4 +1,4 @@
1
- moon = "1.31.0"
1
+ moon = "1.40.4"
2
2
  node = "22.13.1"
3
3
  pnpm = "9.15.3"
4
4
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tari-docs",
3
- "version": "0.13.0",
3
+ "version": "0.13.1",
4
4
  "private": true,
5
5
  "scripts": {
6
6
  "docusaurus": "docusaurus",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tari-project/tarijs",
3
- "version": "0.13.0",
3
+ "version": "0.13.1",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "keywords": [],
@@ -11,7 +11,6 @@
11
11
  },
12
12
  "devDependencies": {
13
13
  "@eslint/js": "^9.30.0",
14
- "@moonrepo/cli": "^1.32.1",
15
14
  "eslint": "^9.30.0",
16
15
  "knip": "^5.61.3",
17
16
  "typedoc": "^0.28.7",
@@ -20,7 +19,7 @@
20
19
  "typescript-eslint": "^8.35.0"
21
20
  },
22
21
  "dependencies": {
23
- "@tari-project/tarijs-types": "^0.13.0"
22
+ "@tari-project/tarijs-types": "^0.13.1"
24
23
  },
25
24
  "scripts": {
26
25
  "docs": "typedoc",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tari-project/tarijs-builders",
3
- "version": "0.13.0",
3
+ "version": "0.13.1",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tari-project/indexer-provider",
3
- "version": "0.13.0",
3
+ "version": "0.13.1",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tari-project/metamask-signer",
3
- "version": "0.13.0",
3
+ "version": "0.13.1",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tari-project/tari-permissions",
3
- "version": "0.13.0",
3
+ "version": "0.13.1",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tari-project/react-mui-connect-button",
3
- "version": "0.13.0",
3
+ "version": "0.13.1",
4
4
  "description": "React component to connect your website to the Tari Ootle Wallet",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -19,7 +19,8 @@
19
19
  "@tari-project/tari-provider": "workspace:*",
20
20
  "@tari-project/tari-signer": "workspace:^",
21
21
  "@tari-project/wallet-connect-signer": "workspace:^",
22
- "@tari-project/wallet-daemon-signer": "workspace:^"
22
+ "@tari-project/wallet-daemon-signer": "workspace:^",
23
+ "@tari-project/tari-universe-signer": "workspace:^"
23
24
  },
24
25
  "peerDependencies": {
25
26
  "@mui/icons-material": "^7",
@@ -6,6 +6,7 @@ import { TariSigner } from "@tari-project/tari-signer";
6
6
  import { TariLogoWhite } from "./Logos";
7
7
  import { WalletDaemonFetchParameters } from "@tari-project/wallet-daemon-signer";
8
8
  import { WalletConnectParameters } from "@tari-project/wallet-connect-signer";
9
+ import { TariUniverseSignerParameters } from "@tari-project/tari-universe-signer";
9
10
 
10
11
  export interface TariConnectButtonProps {
11
12
  isConnected: boolean;
@@ -13,6 +14,7 @@ export interface TariConnectButtonProps {
13
14
  onConnected?: (signer: TariSigner) => void;
14
15
  walletConnectParams?: WalletConnectParameters;
15
16
  walletDaemonParams?: WalletDaemonFetchParameters;
17
+ tariUniverseParams?: TariUniverseSignerParameters;
16
18
  }
17
19
 
18
20
  export function TariConnectButton(props: TariConnectButtonProps) {
@@ -44,6 +46,7 @@ export function TariConnectButton(props: TariConnectButtonProps) {
44
46
  onConnected={props.onConnected}
45
47
  walletConnectParams={props.walletConnectParams}
46
48
  walletDaemonParams={props.walletDaemonParams}
49
+ tariUniverseParams={props.tariUniverseParams}
47
50
  />
48
51
  </>
49
52
  );
@@ -8,17 +8,19 @@ import { WalletDaemonTariSigner, WalletDaemonFetchParameters } from "@tari-proje
8
8
  import { ReactElement, useState } from "react";
9
9
  import { WalletConnectTariSigner, WalletConnectParameters } from "@tari-project/wallet-connect-signer";
10
10
  import { TariLogo, WalletConnectLogo } from "./Logos";
11
+ import { TariUniverseSigner, TariUniverseSignerParameters } from "@tari-project/tari-universe-signer";
11
12
 
12
13
  export interface WalletSelectionProps {
13
14
  open: boolean;
14
15
  onConnected?: (signer: TariSigner) => void;
15
16
  walletConnectParams?: WalletConnectParameters;
16
17
  walletDaemonParams?: WalletDaemonFetchParameters;
18
+ tariUniverseParams?: TariUniverseSignerParameters;
17
19
  onClose: () => void;
18
20
  }
19
21
 
20
22
  export function TariWalletSelectionDialog(props: WalletSelectionProps): ReactElement {
21
- const { onClose, open, onConnected, walletConnectParams, walletDaemonParams } = props;
23
+ const { onClose, open, onConnected, walletConnectParams, walletDaemonParams, tariUniverseParams } = props;
22
24
  const [isBusy, setIsBusy] = useState(false);
23
25
  const [error, setError] = useState<string | null>(null);
24
26
 
@@ -58,6 +60,15 @@ export function TariWalletSelectionDialog(props: WalletSelectionProps): ReactEle
58
60
  }
59
61
  };
60
62
 
63
+ const onTariUniverseClick = async () => {
64
+ if (!tariUniverseParams) {
65
+ throw new Error("Tari Universe Signer parameters were not provided.");
66
+ }
67
+ const tuSigner = new TariUniverseSigner(tariUniverseParams);
68
+ onConnected?.(tuSigner);
69
+ handleClose();
70
+ };
71
+
61
72
  return (
62
73
  <Dialog fullWidth={true} onClose={handleClose} open={open}>
63
74
  <Box sx={{ padding: 4, borderRadius: 4 }}>
@@ -99,6 +110,16 @@ export function TariWalletSelectionDialog(props: WalletSelectionProps): ReactEle
99
110
  ></WalletConnectionMethodCard>
100
111
  </Grid>
101
112
  )}
113
+
114
+ {tariUniverseParams && (
115
+ <Grid container rowSpacing={1} columnSpacing={{ xs: 4 }}>
116
+ <WalletConnectionMethodCard
117
+ logo={<TariLogo />}
118
+ text="Tari Universe"
119
+ callback={onTariUniverseClick}
120
+ ></WalletConnectionMethodCard>
121
+ </Grid>
122
+ )}
102
123
  </Grid>
103
124
  </Box>
104
125
  </Dialog>
@@ -8,9 +8,7 @@
8
8
  "outDir": "./dist",
9
9
  "rootDir": "./src"
10
10
  },
11
- "include": [
12
- "src/**/*"
13
- ],
11
+ "include": ["src/**/*"],
14
12
  "references": [
15
13
  {
16
14
  "path": "../permissions"
@@ -26,6 +24,9 @@
26
24
  },
27
25
  {
28
26
  "path": "../walletconnect"
27
+ },
28
+ {
29
+ "path": "../tari_universe"
29
30
  }
30
31
  ]
31
32
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tari-project/tari-provider",
3
- "version": "0.13.0",
3
+ "version": "0.13.1",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tari-project/tari-signer",
3
- "version": "0.13.0",
3
+ "version": "0.13.1",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tari-project/tari-universe-signer",
3
- "version": "0.13.0",
3
+ "version": "0.13.1",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -23,6 +23,7 @@ import {
23
23
  ListAccountNftResponse,
24
24
  WalletGetInfoResponse,
25
25
  } from "@tari-project/typescript-bindings";
26
+ import { MessageType } from "./useIframeMessage";
26
27
 
27
28
  export class TariUniverseSigner implements TariSigner {
28
29
  public signerName = "TariUniverse";
@@ -30,8 +31,8 @@ export class TariUniverseSigner implements TariSigner {
30
31
 
31
32
  public constructor(public params: TariUniverseSignerParameters) {
32
33
  const filterResizeEvent = function (event: MessageEvent) {
33
- if (event.data && event.data.type === "resize") {
34
- const resizeEvent = new CustomEvent("resize", {
34
+ if (event.data && event.data.type === MessageType.RESIZE) {
35
+ const resizeEvent = new CustomEvent(MessageType.RESIZE, {
35
36
  detail: { width: event.data.width, height: event.data.height },
36
37
  });
37
38
  window.dispatchEvent(resizeEvent);
@@ -92,6 +93,7 @@ export class TariUniverseSigner implements TariSigner {
92
93
  }
93
94
 
94
95
  public async getAccount(): Promise<AccountData> {
96
+ console.warn("ELOSZKI Z GET ACCOUNT");
95
97
  return this.sendRequest({ methodName: "getAccount", args: [] });
96
98
  }
97
99
 
@@ -1,5 +1,6 @@
1
1
  import { TariPermissions } from "@tari-project/tari-permissions";
2
2
  import { TariUniverseSigner } from "./signer";
3
+ import { MessageType } from "./useIframeMessage";
3
4
 
4
5
  export type TariUniverseSignerParameters = {
5
6
  permissions: TariPermissions;
@@ -28,7 +29,7 @@ export type SignerRequest<T extends SignerMethodNames> = {
28
29
 
29
30
  export type SignerResponse<T extends SignerMethodNames> = {
30
31
  id: number;
31
- type: "signer-call";
32
+ type: MessageType.SIGNER_CALL;
32
33
  result: SignerReturnType<T>;
33
34
  resultError?: string;
34
35
  };
@@ -0,0 +1,82 @@
1
+ export enum MessageType {
2
+ SIGNER_CALL = "SIGNER_CALL",
3
+ RESIZE = "resize",
4
+ SET_LANGUAGE = "SET_LANGUAGE",
5
+ SET_THEME = "SET_THEME",
6
+ GET_INIT_CONFIG = "GET_INIT_CONFIG",
7
+ OPEN_EXTERNAL_LINK = "OPEN_EXTERNAL_LINK",
8
+ ERROR = "ERROR",
9
+ NOTIFICATION = "NOTIFICATION",
10
+ }
11
+
12
+ interface SignerCallMessage {
13
+ type: MessageType.SIGNER_CALL;
14
+ payload: {
15
+ id: number;
16
+ methodName: string;
17
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
18
+ args: any[];
19
+ };
20
+ }
21
+
22
+ interface ResizeMessage {
23
+ type: MessageType.RESIZE;
24
+ width: number;
25
+ height: number;
26
+ }
27
+
28
+ interface SetLanguageMessage {
29
+ type: MessageType.SET_LANGUAGE;
30
+ payload: {
31
+ language: string;
32
+ };
33
+ }
34
+
35
+ interface SetThemeMessage {
36
+ type: MessageType.SET_THEME;
37
+ payload: {
38
+ theme: string;
39
+ };
40
+ }
41
+
42
+ interface GetInitConfigMessage {
43
+ type: MessageType.GET_INIT_CONFIG;
44
+ }
45
+
46
+ interface OpenLinkMessage {
47
+ type: MessageType.OPEN_EXTERNAL_LINK;
48
+ payload: {
49
+ url: string;
50
+ };
51
+ }
52
+
53
+ type ErrorMessage = {
54
+ type: MessageType.ERROR;
55
+ payload: {
56
+ message: string;
57
+ };
58
+ };
59
+
60
+ interface EmitNotificationMessage {
61
+ type: MessageType.NOTIFICATION;
62
+ payload: {
63
+ notification: string;
64
+ };
65
+ }
66
+
67
+ export type IframeMessage =
68
+ | SignerCallMessage
69
+ | ResizeMessage
70
+ | SetLanguageMessage
71
+ | SetThemeMessage
72
+ | GetInitConfigMessage
73
+ | OpenLinkMessage
74
+ | ErrorMessage
75
+ | EmitNotificationMessage;
76
+
77
+ // Post a message to the parent window
78
+ export function postToParentIframe(message: IframeMessage, targetOrigin: string = "*") {
79
+ if (window.parent && message.type) {
80
+ window.parent.postMessage(message, targetOrigin);
81
+ }
82
+ }
@@ -1,4 +1,5 @@
1
1
  import { SignerMethodNames, SignerRequest, SignerResponse, SignerReturnType } from "./types";
2
+ import { MessageType, postToParentIframe } from "./useIframeMessage";
2
3
 
3
4
  export function sendSignerCall<MethodName extends SignerMethodNames>(
4
5
  req: Omit<SignerRequest<MethodName>, "id">,
@@ -10,7 +11,7 @@ export function sendSignerCall<MethodName extends SignerMethodNames>(
10
11
  window.removeEventListener("message", event_ref);
11
12
  reject(resp.data.resultError);
12
13
  }
13
- if (resp && resp.data && resp.data.id && resp.data.id === id && resp.data.type === "signer-call") {
14
+ if (resp && resp.data && resp.data.id && resp.data.id === id && resp.data.type === MessageType.SIGNER_CALL) {
14
15
  window.removeEventListener("message", event_ref);
15
16
  resolve(resp.data.result);
16
17
  }
@@ -18,6 +19,9 @@ export function sendSignerCall<MethodName extends SignerMethodNames>(
18
19
 
19
20
  window.addEventListener("message", event_ref, false);
20
21
 
21
- window.parent.postMessage({ ...req, id, type: "signer-call" }, "*");
22
+ postToParentIframe({
23
+ type: MessageType.SIGNER_CALL,
24
+ payload: { args: req.args, methodName: req.methodName, id: id },
25
+ });
22
26
  });
23
27
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tari-project/tarijs-all",
3
- "version": "0.13.0",
3
+ "version": "0.13.1",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tari-project/tarijs-types",
3
- "version": "0.13.0",
3
+ "version": "0.13.1",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tari-project/wallet-daemon-signer",
3
- "version": "0.13.0",
3
+ "version": "0.13.1",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tari-project/wallet-connect-signer",
3
- "version": "0.13.0",
3
+ "version": "0.13.1",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "publishConfig": {