@tari-project/tarijs 0.12.1 → 0.13.0
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/.github/workflows/lint.yml +19 -0
- package/README.md +4 -1
- package/docusaurus/tari-docs/package.json +1 -1
- package/eslint.config.mjs +23 -6
- package/examples/vite-typescript-react/eslint.config.js +13 -10
- package/examples/vite-typescript-react/index.html +1 -1
- package/examples/vite-typescript-react/package.json +5 -6
- package/examples/vite-typescript-react/public/tari-logo.svg +18 -0
- package/examples/vite-typescript-react/tsconfig.json +2 -4
- package/knip.ts +18 -0
- package/package.json +7 -5
- package/packages/builders/package.json +3 -2
- package/packages/builders/src/helpers/submitTransaction.ts +11 -10
- package/packages/builders/src/helpers/workspace.ts +2 -2
- package/packages/builders/src/transaction/TransactionBuilder.ts +12 -13
- package/packages/indexer_provider/package.json +3 -2
- package/packages/indexer_provider/src/provider.ts +6 -7
- package/packages/indexer_provider/src/transports/IndexerProviderClient.ts +1 -0
- package/packages/indexer_provider/src/transports/fetch.ts +2 -2
- package/packages/indexer_provider/src/transports/rpc.ts +1 -0
- package/packages/metamask_signer/package.json +3 -2
- package/packages/metamask_signer/src/index.ts +24 -7
- package/packages/metamask_signer/src/utils.ts +36 -45
- package/packages/permissions/package.json +3 -2
- package/packages/permissions/src/helpers.ts +0 -1
- package/packages/permissions/src/permissions.ts +6 -13
- package/packages/react-mui-connect-button/package.json +3 -4
- package/packages/react-mui-connect-button/src/Logos.tsx +77 -48
- package/packages/react-mui-connect-button/src/TariConnectButton.tsx +1 -2
- package/packages/react-mui-connect-button/src/TariWalletSelectionDialog.tsx +64 -28
- package/packages/react-mui-connect-button/src/index.ts +6 -3
- package/packages/tari_provider/package.json +3 -2
- package/packages/tari_signer/package.json +3 -2
- package/packages/tari_signer/src/TariSigner.ts +7 -0
- package/packages/tari_universe/package.json +3 -2
- package/packages/tari_universe/src/signer.ts +16 -0
- package/packages/tari_universe/src/types.ts +1 -0
- package/packages/tarijs/package.json +3 -2
- package/packages/tarijs/src/index.ts +2 -20
- package/packages/tarijs/src/templates/TestFaucet.ts +7 -2
- package/packages/tarijs/test/integration-tests/wallet_daemon/json_rpc_provider.spec.ts +6 -9
- package/packages/tarijs_types/package.json +3 -2
- package/packages/tarijs_types/src/SubmitTransactionResponse.ts +3 -0
- package/packages/tarijs_types/src/TransactionArg.ts +1 -0
- package/packages/tarijs_types/src/consts.ts +1 -1
- package/packages/tarijs_types/src/helpers/hexString.ts +20 -19
- package/packages/tarijs_types/src/helpers/simpleResult.ts +23 -20
- package/packages/tarijs_types/src/helpers/txResult.ts +3 -4
- package/packages/tarijs_types/src/index.ts +9 -4
- package/packages/tarijs_types/src/signer.ts +3 -6
- package/packages/wallet_daemon/package.json +3 -2
- package/packages/wallet_daemon/src/provider.ts +14 -16
- package/packages/wallet_daemon/src/signer.ts +38 -17
- package/packages/wallet_daemon/src/webrtc.ts +18 -13
- package/packages/walletconnect/package.json +6 -6
- package/packages/walletconnect/src/index.ts +60 -22
- package/pnpm-workspace.yaml +8 -8
- package/tsconfig.json +1 -1
- package/typedoc.json +3 -2
- package/packages/react-mui-connect-button/src/defaultPermissions.ts +0 -0
- package/packages/tarijs_types/src/TransactionResult.ts +0 -16
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { MetaMaskInpageProvider } from
|
|
2
|
-
|
|
1
|
+
import { MetaMaskInpageProvider } from "@metamask/providers";
|
|
3
2
|
|
|
4
3
|
export type GetSnapsResponse = Record<string, Snap>;
|
|
5
4
|
|
|
6
5
|
export type Snap = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
permissionName: string;
|
|
7
|
+
id: string;
|
|
8
|
+
version: string;
|
|
9
|
+
initialPermissions: Record<string, unknown>;
|
|
11
10
|
};
|
|
12
11
|
|
|
13
12
|
/**
|
|
@@ -16,13 +15,10 @@ export type Snap = {
|
|
|
16
15
|
* @param provider - The MetaMask inpage provider.
|
|
17
16
|
* @returns The snaps installed in MetaMask.
|
|
18
17
|
*/
|
|
19
|
-
export const getSnaps = async (
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
method: 'wallet_getSnaps',
|
|
24
|
-
})) as unknown as GetSnapsResponse;
|
|
25
|
-
|
|
18
|
+
export const getSnaps = async (provider: MetaMaskInpageProvider): Promise<GetSnapsResponse> =>
|
|
19
|
+
(await provider.request({
|
|
20
|
+
method: "wallet_getSnaps",
|
|
21
|
+
})) as unknown as GetSnapsResponse;
|
|
26
22
|
|
|
27
23
|
/**
|
|
28
24
|
* Connect a snap to MetaMask.
|
|
@@ -30,14 +26,11 @@ export const getSnaps = async (
|
|
|
30
26
|
* @param snapId - The ID of the snap.
|
|
31
27
|
* @param params - The params to pass with the snap to connect.
|
|
32
28
|
*/
|
|
33
|
-
export const connectSnap = async (
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
method: 'wallet_requestSnaps',
|
|
39
|
-
params: snaps,
|
|
40
|
-
});
|
|
29
|
+
export const connectSnap = async (provider: MetaMaskInpageProvider, snaps: Record<string, { version?: string }>) => {
|
|
30
|
+
await provider.request({
|
|
31
|
+
method: "wallet_requestSnaps",
|
|
32
|
+
params: snaps,
|
|
33
|
+
});
|
|
41
34
|
};
|
|
42
35
|
|
|
43
36
|
/**
|
|
@@ -47,24 +40,22 @@ export const connectSnap = async (
|
|
|
47
40
|
* @returns The snap object returned by the extension.
|
|
48
41
|
*/
|
|
49
42
|
export const getSnap = async (
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
43
|
+
provider: MetaMaskInpageProvider,
|
|
44
|
+
snapId: string,
|
|
45
|
+
version?: string,
|
|
53
46
|
): Promise<Snap | undefined> => {
|
|
54
|
-
|
|
55
|
-
|
|
47
|
+
try {
|
|
48
|
+
const snaps = await getSnaps(provider);
|
|
56
49
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
console.log('Failed to obtain installed snap', e);
|
|
63
|
-
return undefined;
|
|
64
|
-
}
|
|
50
|
+
return Object.values(snaps).find((snap) => snap.id === snapId && (!version || snap.version === version));
|
|
51
|
+
} catch (e) {
|
|
52
|
+
console.log("Failed to obtain installed snap", e);
|
|
53
|
+
return undefined;
|
|
54
|
+
}
|
|
65
55
|
};
|
|
66
56
|
|
|
67
|
-
|
|
57
|
+
/** @public */
|
|
58
|
+
export const isLocalSnap = (snapId: string) => snapId.startsWith("local:");
|
|
68
59
|
|
|
69
60
|
/**
|
|
70
61
|
* Detect if the wallet injecting the ethereum object is MetaMask Flask.
|
|
@@ -72,15 +63,15 @@ export const isLocalSnap = (snapId: string) => snapId.startsWith('local:');
|
|
|
72
63
|
* @returns True if the MetaMask version is Flask, false otherwise.
|
|
73
64
|
*/
|
|
74
65
|
export const isFlask = async (provider: MetaMaskInpageProvider) => {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
66
|
+
try {
|
|
67
|
+
const clientVersion = await provider.request({
|
|
68
|
+
method: "web3_clientVersion",
|
|
69
|
+
});
|
|
79
70
|
|
|
80
|
-
|
|
71
|
+
const isFlaskDetected = (clientVersion as string[])?.includes("flask");
|
|
81
72
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
};
|
|
73
|
+
return Boolean(provider && isFlaskDetected);
|
|
74
|
+
} catch {
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
};
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tari-project/tari-permissions",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
|
-
"build": "tsc -b"
|
|
10
|
+
"build": "tsc -b",
|
|
11
|
+
"lint": "eslint src/"
|
|
11
12
|
},
|
|
12
13
|
"keywords": [],
|
|
13
14
|
"author": "The Tari Community",
|
|
@@ -10,7 +10,6 @@ import {
|
|
|
10
10
|
TariPermissionTransactionSend,
|
|
11
11
|
} from "./permissions";
|
|
12
12
|
|
|
13
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
14
13
|
export function createPermissionFromType(permission: any): TariPermission {
|
|
15
14
|
if (Object.prototype.hasOwnProperty.call(permission, "AccountBalance")) {
|
|
16
15
|
return new TariPermissionAccountBalance(permission.AccountBalance);
|
|
@@ -119,7 +119,6 @@ export class NonFungibleAddress {
|
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
|
|
123
122
|
export class ComponentAddress {
|
|
124
123
|
private tagged: Tagged;
|
|
125
124
|
|
|
@@ -186,8 +185,7 @@ export class TariPermissionAccountBalance {
|
|
|
186
185
|
}
|
|
187
186
|
|
|
188
187
|
export class TariPermissionAccountInfo {
|
|
189
|
-
constructor() {
|
|
190
|
-
}
|
|
188
|
+
constructor() {}
|
|
191
189
|
|
|
192
190
|
toJSON() {
|
|
193
191
|
return "AccountInfo";
|
|
@@ -216,8 +214,7 @@ export class TariPermissionAccountList {
|
|
|
216
214
|
}
|
|
217
215
|
|
|
218
216
|
export class TariPermissionKeyList {
|
|
219
|
-
constructor() {
|
|
220
|
-
}
|
|
217
|
+
constructor() {}
|
|
221
218
|
|
|
222
219
|
toJSON() {
|
|
223
220
|
return "KeyList";
|
|
@@ -225,8 +222,7 @@ export class TariPermissionKeyList {
|
|
|
225
222
|
}
|
|
226
223
|
|
|
227
224
|
export class TariPermissionTransactionGet {
|
|
228
|
-
constructor() {
|
|
229
|
-
}
|
|
225
|
+
constructor() {}
|
|
230
226
|
|
|
231
227
|
toJSON() {
|
|
232
228
|
return "TransactionGet";
|
|
@@ -277,8 +273,7 @@ export class TariPermissionNftGetOwnershipProof {
|
|
|
277
273
|
}
|
|
278
274
|
|
|
279
275
|
export class TariPermissionTransactionsGet {
|
|
280
|
-
constructor() {
|
|
281
|
-
}
|
|
276
|
+
constructor() {}
|
|
282
277
|
|
|
283
278
|
toJSON() {
|
|
284
279
|
return "TransactionGet";
|
|
@@ -286,8 +281,7 @@ export class TariPermissionTransactionsGet {
|
|
|
286
281
|
}
|
|
287
282
|
|
|
288
283
|
export class TariPermissionSubstatesRead {
|
|
289
|
-
constructor() {
|
|
290
|
-
}
|
|
284
|
+
constructor() {}
|
|
291
285
|
|
|
292
286
|
toJSON() {
|
|
293
287
|
return "SubstatesRead";
|
|
@@ -295,8 +289,7 @@ export class TariPermissionSubstatesRead {
|
|
|
295
289
|
}
|
|
296
290
|
|
|
297
291
|
export class TariPermissionTemplatesRead {
|
|
298
|
-
constructor() {
|
|
299
|
-
}
|
|
292
|
+
constructor() {}
|
|
300
293
|
|
|
301
294
|
toJSON() {
|
|
302
295
|
return "TemplatesRead";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tari-project/react-mui-connect-button",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "React component to connect your website to the Tari Ootle Wallet",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -9,15 +9,15 @@
|
|
|
9
9
|
"scripts": {
|
|
10
10
|
"build": "tsc -b",
|
|
11
11
|
"test": "echo 'no tests'",
|
|
12
|
-
"
|
|
12
|
+
"lint": "eslint src/"
|
|
13
13
|
},
|
|
14
14
|
"keywords": [],
|
|
15
15
|
"author": "",
|
|
16
16
|
"license": "ISC",
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@tari-project/tari-permissions": "workspace:^",
|
|
19
|
+
"@tari-project/tari-provider": "workspace:*",
|
|
19
20
|
"@tari-project/tari-signer": "workspace:^",
|
|
20
|
-
"@tari-project/tari-provider": "workspace:^",
|
|
21
21
|
"@tari-project/wallet-connect-signer": "workspace:^",
|
|
22
22
|
"@tari-project/wallet-daemon-signer": "workspace:^"
|
|
23
23
|
},
|
|
@@ -29,7 +29,6 @@
|
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@types/node": "catalog:",
|
|
31
31
|
"@types/react": "^19.1.8",
|
|
32
|
-
"@types/react-dom": "^19.1.6",
|
|
33
32
|
"typescript": "catalog:"
|
|
34
33
|
},
|
|
35
34
|
"files": [
|
|
@@ -1,60 +1,89 @@
|
|
|
1
1
|
export function TariLogo() {
|
|
2
|
-
return (
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
<
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
<
|
|
15
|
-
|
|
16
|
-
|
|
2
|
+
return (
|
|
3
|
+
<svg
|
|
4
|
+
width="50px"
|
|
5
|
+
height="50px"
|
|
6
|
+
viewBox="0 0 25 25"
|
|
7
|
+
version="1.1"
|
|
8
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
9
|
+
style={{ display: "block", margin: "0 auto" }}
|
|
10
|
+
>
|
|
11
|
+
<title>node-icon</title>
|
|
12
|
+
<defs>
|
|
13
|
+
<linearGradient x1="18.2919102%" y1="10.0218476%" x2="75.2362057%" y2="77.3326874%" id="linearGradient-1">
|
|
14
|
+
<stop stopColor="#6239FF" offset="0%"></stop>
|
|
15
|
+
<stop stopColor="#C326D6" offset="100%"></stop>
|
|
16
|
+
</linearGradient>
|
|
17
|
+
</defs>
|
|
18
|
+
<g id="Final-Designs" stroke="none" strokeWidth="1" fill="none" fillRule="evenodd">
|
|
19
|
+
<g id="Icons">
|
|
20
|
+
<g id="node-icon">
|
|
21
|
+
<polygon id="Path" points="0 0 25 0 25 25 0 25"></polygon>
|
|
22
|
+
<path
|
|
23
|
+
d="M20.1635307,8.81670631 L20.1635307,11.1649473 L6.39264373,7.6223935 L11.0366915,4.59938041 L20.1635307,8.81670631 Z M11.8116251,18.6587023 L11.8116251,10.9999256 L19.1635161,12.8911326 L11.8116251,18.6587023 Z M9.89076494,17.9185993 L4.8364693,12.2747253 L4.8364693,9.20558518 L9.89076494,10.5058018 L9.89076494,17.9185993 Z M2.91551501,7.5936818 L2.91551501,13.0091801 L10.8424874,21.8606694 L22.084485,13.0410925 L22.084485,7.58822187 L10.8784476,2.41013641 L2.91551501,7.5936818 Z"
|
|
24
|
+
fill="url(#linearGradient-1)"
|
|
25
|
+
></path>
|
|
26
|
+
</g>
|
|
17
27
|
</g>
|
|
18
28
|
</g>
|
|
19
|
-
</
|
|
20
|
-
|
|
29
|
+
</svg>
|
|
30
|
+
);
|
|
21
31
|
}
|
|
22
32
|
|
|
23
33
|
export function TariLogoWhite() {
|
|
24
|
-
return (
|
|
25
|
-
<
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
<
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
<
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
return (
|
|
35
|
+
<svg
|
|
36
|
+
width="50px"
|
|
37
|
+
height="50px"
|
|
38
|
+
viewBox="0 0 25 25"
|
|
39
|
+
version="1.1"
|
|
40
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
41
|
+
style={{ display: "block", margin: "0 auto" }}
|
|
42
|
+
>
|
|
43
|
+
<title>node-icon</title>
|
|
44
|
+
<defs>
|
|
45
|
+
<linearGradient x1="18.2919102%" y1="10.0218476%" x2="75.2362057%" y2="77.3326874%" id="linearGradient-1">
|
|
46
|
+
<stop stopColor="#FFFFFF" offset="0%"></stop>
|
|
47
|
+
<stop stopColor="#FFFFFF" offset="100%"></stop>
|
|
48
|
+
</linearGradient>
|
|
49
|
+
</defs>
|
|
50
|
+
<g id="Final-Designs" stroke="none" strokeWidth="1" fill="none" fillRule="evenodd">
|
|
51
|
+
<g id="Icons">
|
|
52
|
+
<g id="node-icon">
|
|
53
|
+
<polygon id="Path" points="0 0 25 0 25 25 0 25"></polygon>
|
|
54
|
+
<path
|
|
55
|
+
d="M20.1635307,8.81670631 L20.1635307,11.1649473 L6.39264373,7.6223935 L11.0366915,4.59938041 L20.1635307,8.81670631 Z M11.8116251,18.6587023 L11.8116251,10.9999256 L19.1635161,12.8911326 L11.8116251,18.6587023 Z M9.89076494,17.9185993 L4.8364693,12.2747253 L4.8364693,9.20558518 L9.89076494,10.5058018 L9.89076494,17.9185993 Z M2.91551501,7.5936818 L2.91551501,13.0091801 L10.8424874,21.8606694 L22.084485,13.0410925 L22.084485,7.58822187 L10.8784476,2.41013641 L2.91551501,7.5936818 Z"
|
|
56
|
+
fill="url(#linearGradient-1)"
|
|
57
|
+
></path>
|
|
58
|
+
</g>
|
|
39
59
|
</g>
|
|
40
60
|
</g>
|
|
41
|
-
</
|
|
42
|
-
|
|
61
|
+
</svg>
|
|
62
|
+
);
|
|
43
63
|
}
|
|
44
64
|
|
|
45
65
|
export function WalletConnectLogo() {
|
|
46
|
-
|
|
47
66
|
return (
|
|
48
|
-
<svg
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
67
|
+
<svg
|
|
68
|
+
version="1.1"
|
|
69
|
+
baseProfile="basic"
|
|
70
|
+
id="Layer_1"
|
|
71
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
72
|
+
viewBox="0 0 387.6 237.6"
|
|
73
|
+
width="50px"
|
|
74
|
+
height="50px"
|
|
75
|
+
style={{ display: "block", margin: "0 auto" }}
|
|
76
|
+
>
|
|
77
|
+
<path
|
|
78
|
+
fill="#3B99FC"
|
|
79
|
+
d="M79.4,46.4
|
|
80
|
+
c63.2-61.9,165.7-61.9,228.9,0l7.6,7.4c3.2,3.1,3.2,8.1,0,11.2l-26,25.5c-1.6,1.5-4.1,1.5-5.7,0l-10.5-10.3
|
|
81
|
+
c-44.1-43.2-115.6-43.2-159.7,0l-11.2,11c-1.6,1.5-4.1,1.5-5.7,0L71,65.8c-3.2-3.1-3.2-8.1,0-11.2L79.4,46.4z M362.1,99.1l23.2,22.7
|
|
82
|
+
c3.2,3.1,3.2,8.1,0,11.2L280.8,235.3c-3.2,3.1-8.3,3.1-11.4,0c0,0,0,0,0,0l-74.1-72.6c-0.8-0.8-2.1-0.8-2.9,0c0,0,0,0,0,0
|
|
83
|
+
l-74.1,72.6c-3.2,3.1-8.3,3.1-11.4,0c0,0,0,0,0,0L2.4,133c-3.2-3.1-3.2-8.1,0-11.2l23.2-22.7c3.2-3.1,8.3-3.1,11.4,0l74.1,72.6
|
|
84
|
+
c0.8,0.8,2.1,0.8,2.9,0c0,0,0,0,0,0l74.1-72.6c3.2-3.1,8.3-3.1,11.4,0c0,0,0,0,0,0l74.1,72.6c0.8,0.8,2.1,0.8,2.9,0l74.1-72.6
|
|
85
|
+
C353.8,96,358.9,96,362.1,99.1z"
|
|
86
|
+
/>
|
|
87
|
+
</svg>
|
|
88
|
+
);
|
|
89
|
+
}
|
|
@@ -7,12 +7,11 @@ 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
9
|
|
|
10
|
-
|
|
11
10
|
export interface TariConnectButtonProps {
|
|
12
11
|
isConnected: boolean;
|
|
13
12
|
disabled?: boolean;
|
|
14
13
|
onConnected?: (signer: TariSigner) => void;
|
|
15
|
-
walletConnectParams?: WalletConnectParameters
|
|
14
|
+
walletConnectParams?: WalletConnectParameters;
|
|
16
15
|
walletDaemonParams?: WalletDaemonFetchParameters;
|
|
17
16
|
}
|
|
18
17
|
|
|
@@ -9,7 +9,6 @@ import { ReactElement, useState } from "react";
|
|
|
9
9
|
import { WalletConnectTariSigner, WalletConnectParameters } from "@tari-project/wallet-connect-signer";
|
|
10
10
|
import { TariLogo, WalletConnectLogo } from "./Logos";
|
|
11
11
|
|
|
12
|
-
|
|
13
12
|
export interface WalletSelectionProps {
|
|
14
13
|
open: boolean;
|
|
15
14
|
onConnected?: (signer: TariSigner) => void;
|
|
@@ -49,16 +48,18 @@ export function TariWalletSelectionDialog(props: WalletSelectionProps): ReactEle
|
|
|
49
48
|
onConnected?.(walletConnectSigner);
|
|
50
49
|
} catch (err) {
|
|
51
50
|
console.error("Error connecting to WalletConnect:", err);
|
|
52
|
-
setError(
|
|
51
|
+
setError(
|
|
52
|
+
`Failed to connect to WalletConnect. ${
|
|
53
|
+
err instanceof Error ? err.message : typeof err === "string" ? err : JSON.stringify(err)
|
|
54
|
+
}`,
|
|
55
|
+
);
|
|
53
56
|
} finally {
|
|
54
57
|
setIsBusy(false);
|
|
55
58
|
}
|
|
56
|
-
|
|
57
59
|
};
|
|
58
60
|
|
|
59
61
|
return (
|
|
60
62
|
<Dialog fullWidth={true} onClose={handleClose} open={open}>
|
|
61
|
-
|
|
62
63
|
<Box sx={{ padding: 4, borderRadius: 4 }}>
|
|
63
64
|
<Stack direction="row" justifyContent="space-between" spacing={2}>
|
|
64
65
|
<Typography style={{ fontSize: 24 }}>Connect a wallet</Typography>
|
|
@@ -73,20 +74,29 @@ export function TariWalletSelectionDialog(props: WalletSelectionProps): ReactEle
|
|
|
73
74
|
</Box>
|
|
74
75
|
)}
|
|
75
76
|
<Grid container spacing={2} justifyContent="center">
|
|
76
|
-
{
|
|
77
|
+
{walletConnectParams?.projectId && (
|
|
77
78
|
<Grid size={{ xs: 4 }}>
|
|
78
|
-
|
|
79
|
-
|
|
79
|
+
{isBusy ? (
|
|
80
|
+
<CircularProgress />
|
|
81
|
+
) : (
|
|
82
|
+
<Grid container rowSpacing={1} columnSpacing={{ xs: 4 }}>
|
|
83
|
+
<WalletConnectionMethodCard
|
|
84
|
+
logo={<WalletConnectLogo />}
|
|
85
|
+
text="WalletConnect"
|
|
86
|
+
callback={onWalletConnectClick}
|
|
87
|
+
></WalletConnectionMethodCard>
|
|
88
|
+
</Grid>
|
|
89
|
+
)}
|
|
80
90
|
</Grid>
|
|
81
91
|
)}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
92
|
+
|
|
93
|
+
{walletDaemonParams && (
|
|
94
|
+
<Grid container rowSpacing={1} columnSpacing={{ xs: 4 }}>
|
|
95
|
+
<WalletConnectionMethodCard
|
|
96
|
+
logo={<TariLogo />}
|
|
97
|
+
text="Tari Wallet Daemon"
|
|
98
|
+
callback={onWalletDaemonClick}
|
|
99
|
+
></WalletConnectionMethodCard>
|
|
90
100
|
</Grid>
|
|
91
101
|
)}
|
|
92
102
|
</Grid>
|
|
@@ -95,21 +105,47 @@ export function TariWalletSelectionDialog(props: WalletSelectionProps): ReactEle
|
|
|
95
105
|
);
|
|
96
106
|
}
|
|
97
107
|
|
|
98
|
-
function WalletConnectionMethodCard({
|
|
99
|
-
logo
|
|
100
|
-
text
|
|
101
|
-
callback
|
|
108
|
+
function WalletConnectionMethodCard({
|
|
109
|
+
logo,
|
|
110
|
+
text,
|
|
111
|
+
callback,
|
|
112
|
+
}: {
|
|
113
|
+
logo: ReactElement;
|
|
114
|
+
text: string;
|
|
115
|
+
callback: () => Promise<void>;
|
|
102
116
|
}) {
|
|
103
117
|
return (
|
|
104
|
-
<Card
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
118
|
+
<Card
|
|
119
|
+
variant="outlined"
|
|
120
|
+
elevation={0}
|
|
121
|
+
sx={{
|
|
122
|
+
padding: 4,
|
|
123
|
+
borderRadius: 4,
|
|
124
|
+
width: "175px",
|
|
125
|
+
height: "175px",
|
|
126
|
+
cursor: "pointer",
|
|
127
|
+
display: "flex",
|
|
128
|
+
alignItems: "center",
|
|
129
|
+
justifyContent: "center",
|
|
130
|
+
}}
|
|
131
|
+
onClick={async () => {
|
|
132
|
+
await callback();
|
|
133
|
+
}}
|
|
134
|
+
>
|
|
135
|
+
<CardContent
|
|
136
|
+
sx={{
|
|
137
|
+
display: "flex",
|
|
138
|
+
flexDirection: "column",
|
|
139
|
+
alignItems: "center",
|
|
140
|
+
justifyContent: "center",
|
|
141
|
+
height: "100%",
|
|
142
|
+
padding: 0,
|
|
143
|
+
}}
|
|
144
|
+
>
|
|
145
|
+
{logo}
|
|
146
|
+
<Typography textAlign="center" sx={{ mt: 2 }}>
|
|
147
|
+
{text}
|
|
148
|
+
</Typography>
|
|
113
149
|
</CardContent>
|
|
114
150
|
</Card>
|
|
115
151
|
);
|
|
@@ -3,13 +3,16 @@ export { TariWalletSelectionDialog, WalletSelectionProps } from "./TariWalletSel
|
|
|
3
3
|
import {
|
|
4
4
|
TariPermissionAccountInfo,
|
|
5
5
|
TariPermissionKeyList,
|
|
6
|
-
TariPermissions,
|
|
6
|
+
TariPermissions,
|
|
7
|
+
TariPermissionSubstatesRead,
|
|
8
|
+
TariPermissionTemplatesRead,
|
|
9
|
+
TariPermissionTransactionSend,
|
|
7
10
|
TariPermissionTransactionsGet,
|
|
8
11
|
} from "@tari-project/tari-permissions";
|
|
9
12
|
|
|
10
13
|
export function defaultPermissions() {
|
|
11
14
|
// Minimal permissions for the example site
|
|
12
|
-
// But each application will have different permission needs
|
|
15
|
+
// But each application will have different permission needs
|
|
13
16
|
const walletDaemonPermissions = new TariPermissions();
|
|
14
17
|
walletDaemonPermissions
|
|
15
18
|
// Required for createFreeTestCoins
|
|
@@ -21,4 +24,4 @@ export function defaultPermissions() {
|
|
|
21
24
|
.addPermission(new TariPermissionTemplatesRead())
|
|
22
25
|
.addPermission(new TariPermissionTransactionSend());
|
|
23
26
|
return walletDaemonPermissions;
|
|
24
|
-
}
|
|
27
|
+
}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tari-project/tari-provider",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
|
-
"build": "tsc -b"
|
|
10
|
+
"build": "tsc -b",
|
|
11
|
+
"lint": "eslint src/"
|
|
11
12
|
},
|
|
12
13
|
"keywords": [],
|
|
13
14
|
"author": "The Tari Community",
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tari-project/tari-signer",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
|
-
"build": "tsc -b"
|
|
10
|
+
"build": "tsc -b",
|
|
11
|
+
"lint": "eslint src/"
|
|
11
12
|
},
|
|
12
13
|
"keywords": [],
|
|
13
14
|
"author": "The Tari Community",
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import type {
|
|
2
|
+
AccountGetResponse,
|
|
3
|
+
AccountsListRequest,
|
|
4
|
+
AccountsListResponse,
|
|
2
5
|
ConfidentialViewVaultBalanceRequest,
|
|
3
6
|
ListAccountNftRequest,
|
|
4
7
|
ListAccountNftResponse,
|
|
8
|
+
WalletGetInfoResponse,
|
|
5
9
|
} from "@tari-project/typescript-bindings";
|
|
6
10
|
import {
|
|
7
11
|
GetTransactionResultResponse,
|
|
@@ -18,7 +22,9 @@ import {
|
|
|
18
22
|
export interface TariSigner {
|
|
19
23
|
signerName: string;
|
|
20
24
|
isConnected(): boolean;
|
|
25
|
+
accountsList(req: AccountsListRequest): Promise<AccountsListResponse>;
|
|
21
26
|
getAccount(): Promise<AccountData>;
|
|
27
|
+
getAccountByAddress(address: string): Promise<AccountGetResponse>;
|
|
22
28
|
getSubstate(substate_address: string): Promise<Substate>;
|
|
23
29
|
submitTransaction(req: SubmitTransactionRequest): Promise<SubmitTransactionResponse>;
|
|
24
30
|
getTransactionResult(transactionId: string): Promise<GetTransactionResultResponse>;
|
|
@@ -27,4 +33,5 @@ export interface TariSigner {
|
|
|
27
33
|
getConfidentialVaultBalances(req: ConfidentialViewVaultBalanceRequest): Promise<VaultBalances>;
|
|
28
34
|
listSubstates(req: ListSubstatesRequest): Promise<ListSubstatesResponse>;
|
|
29
35
|
getNftsList(req: ListAccountNftRequest): Promise<ListAccountNftResponse>;
|
|
36
|
+
getWalletInfo(): Promise<WalletGetInfoResponse>;
|
|
30
37
|
}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tari-project/tari-universe-signer",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
|
-
"build": "tsc -b"
|
|
10
|
+
"build": "tsc -b",
|
|
11
|
+
"lint": "eslint src/"
|
|
11
12
|
},
|
|
12
13
|
"keywords": [],
|
|
13
14
|
"author": "The Tari Community",
|