@tari-project/tarijs 0.12.2 → 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/docusaurus/tari-docs/package.json +1 -1
- package/package.json +2 -2
- package/packages/builders/package.json +1 -1
- package/packages/indexer_provider/package.json +1 -1
- package/packages/metamask_signer/package.json +1 -1
- package/packages/metamask_signer/src/index.ts +17 -0
- package/packages/permissions/package.json +1 -1
- package/packages/react-mui-connect-button/package.json +1 -1
- package/packages/tari_provider/package.json +1 -1
- package/packages/tari_signer/package.json +1 -1
- package/packages/tari_signer/src/TariSigner.ts +7 -0
- package/packages/tari_universe/package.json +1 -1
- package/packages/tari_universe/src/signer.ts +16 -0
- package/packages/tarijs/package.json +1 -1
- package/packages/tarijs_types/package.json +1 -1
- package/packages/wallet_daemon/package.json +1 -1
- package/packages/wallet_daemon/src/signer.ts +23 -0
- package/packages/walletconnect/package.json +1 -1
- package/packages/walletconnect/src/index.ts +24 -0
- package/pnpm-workspace.yaml +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tari-project/tarijs",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [],
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"typescript-eslint": "^8.35.0"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@tari-project/tarijs-types": "^0.
|
|
23
|
+
"@tari-project/tarijs-types": "^0.13.0"
|
|
24
24
|
},
|
|
25
25
|
"scripts": {
|
|
26
26
|
"docs": "typedoc",
|
|
@@ -15,9 +15,13 @@ import {
|
|
|
15
15
|
import { MetaMaskInpageProvider } from "@metamask/providers";
|
|
16
16
|
import { connectSnap, getSnap, isFlask, Snap } from "./utils";
|
|
17
17
|
import {
|
|
18
|
+
AccountGetResponse,
|
|
19
|
+
AccountsListRequest,
|
|
20
|
+
AccountsListResponse,
|
|
18
21
|
ConfidentialViewVaultBalanceRequest,
|
|
19
22
|
ListAccountNftRequest,
|
|
20
23
|
ListAccountNftResponse,
|
|
24
|
+
WalletGetInfoResponse,
|
|
21
25
|
} from "@tari-project/typescript-bindings";
|
|
22
26
|
|
|
23
27
|
export const MetamaskNotInstalled = "METAMASK_NOT_INSTALLED";
|
|
@@ -84,10 +88,18 @@ export class MetamaskTariSigner implements TariSigner {
|
|
|
84
88
|
};
|
|
85
89
|
}
|
|
86
90
|
|
|
91
|
+
async accountsList(req: AccountsListRequest): Promise<AccountsListResponse> {
|
|
92
|
+
return await this.metamaskRequest("accountsList", req);
|
|
93
|
+
}
|
|
94
|
+
|
|
87
95
|
async getAccount(): Promise<AccountData> {
|
|
88
96
|
return (await this.metamaskRequest("getAccountData", { account_id: 0 })) as any;
|
|
89
97
|
}
|
|
90
98
|
|
|
99
|
+
async getAccountByAddress(address: string): Promise<AccountGetResponse> {
|
|
100
|
+
return await this.metamaskRequest("accountsGet", { address });
|
|
101
|
+
}
|
|
102
|
+
|
|
91
103
|
async getSubstate(substate_address: string): Promise<Substate> {
|
|
92
104
|
const {
|
|
93
105
|
substate,
|
|
@@ -205,6 +217,11 @@ export class MetamaskTariSigner implements TariSigner {
|
|
|
205
217
|
const resp = (await this.metamaskRequest("getNftsList", req)) as ListAccountNftResponse;
|
|
206
218
|
return resp;
|
|
207
219
|
}
|
|
220
|
+
|
|
221
|
+
public async getWalletInfo(): Promise<WalletGetInfoResponse> {
|
|
222
|
+
const resp = (await this.metamaskRequest("getWalletInfo", {})) as WalletGetInfoResponse;
|
|
223
|
+
return resp;
|
|
224
|
+
}
|
|
208
225
|
}
|
|
209
226
|
|
|
210
227
|
function convertToStatus(result: any): TransactionStatus {
|
|
@@ -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
|
}
|
|
@@ -14,10 +14,14 @@ import { SignerRequest, SignerMethodNames, SignerReturnType, TariUniverseSignerP
|
|
|
14
14
|
import { sendSignerCall } from "./utils";
|
|
15
15
|
import { TariSigner } from "@tari-project/tari-signer";
|
|
16
16
|
import {
|
|
17
|
+
AccountGetResponse,
|
|
17
18
|
AccountsGetBalancesResponse,
|
|
19
|
+
AccountsListRequest,
|
|
20
|
+
AccountsListResponse,
|
|
18
21
|
ConfidentialViewVaultBalanceRequest,
|
|
19
22
|
ListAccountNftRequest,
|
|
20
23
|
ListAccountNftResponse,
|
|
24
|
+
WalletGetInfoResponse,
|
|
21
25
|
} from "@tari-project/typescript-bindings";
|
|
22
26
|
|
|
23
27
|
export class TariUniverseSigner implements TariSigner {
|
|
@@ -83,10 +87,18 @@ export class TariUniverseSigner implements TariSigner {
|
|
|
83
87
|
return this.sendRequest({ methodName: "requestParentSize", args: [] });
|
|
84
88
|
}
|
|
85
89
|
|
|
90
|
+
public async accountsList(req: AccountsListRequest): Promise<AccountsListResponse> {
|
|
91
|
+
return this.sendRequest({ methodName: "accountsList", args: [req] });
|
|
92
|
+
}
|
|
93
|
+
|
|
86
94
|
public async getAccount(): Promise<AccountData> {
|
|
87
95
|
return this.sendRequest({ methodName: "getAccount", args: [] });
|
|
88
96
|
}
|
|
89
97
|
|
|
98
|
+
public async getAccountByAddress(address: string): Promise<AccountGetResponse> {
|
|
99
|
+
return this.sendRequest({ methodName: "getAccountByAddress", args: [address] });
|
|
100
|
+
}
|
|
101
|
+
|
|
90
102
|
public async getAccountBalances(componentAddress: string): Promise<AccountsGetBalancesResponse> {
|
|
91
103
|
return this.sendRequest({
|
|
92
104
|
methodName: "getAccountBalances",
|
|
@@ -126,4 +138,8 @@ export class TariUniverseSigner implements TariSigner {
|
|
|
126
138
|
public async getNftsFromAccountBalances(req: ListAccountNftFromBalancesRequest): Promise<ListAccountNftResponse> {
|
|
127
139
|
return this.sendRequest({ methodName: "getNftsFromAccountBalances", args: [req] });
|
|
128
140
|
}
|
|
141
|
+
|
|
142
|
+
public async getWalletInfo(): Promise<WalletGetInfoResponse> {
|
|
143
|
+
return this.sendRequest({ methodName: "getWalletInfo", args: [] });
|
|
144
|
+
}
|
|
129
145
|
}
|
|
@@ -16,12 +16,16 @@ import {
|
|
|
16
16
|
ListSubstatesRequest,
|
|
17
17
|
} from "@tari-project/tarijs-types";
|
|
18
18
|
import {
|
|
19
|
+
AccountGetResponse,
|
|
20
|
+
AccountsListRequest,
|
|
21
|
+
AccountsListResponse,
|
|
19
22
|
ConfidentialViewVaultBalanceRequest,
|
|
20
23
|
KeyBranch,
|
|
21
24
|
ListAccountNftRequest,
|
|
22
25
|
ListAccountNftResponse,
|
|
23
26
|
substateIdToString,
|
|
24
27
|
SubstatesListRequest,
|
|
28
|
+
WalletGetInfoResponse,
|
|
25
29
|
} from "@tari-project/typescript-bindings";
|
|
26
30
|
|
|
27
31
|
export const WalletDaemonNotConnected = "WALLET_DAEMON_NOT_CONNECTED";
|
|
@@ -133,6 +137,11 @@ export class WalletDaemonTariSigner implements TariSigner {
|
|
|
133
137
|
};
|
|
134
138
|
}
|
|
135
139
|
|
|
140
|
+
public async accountsList(req: AccountsListRequest): Promise<AccountsListResponse> {
|
|
141
|
+
const resp = await this.client.accountsList(req);
|
|
142
|
+
return resp;
|
|
143
|
+
}
|
|
144
|
+
|
|
136
145
|
public async getAccount(): Promise<AccountData> {
|
|
137
146
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
138
147
|
const { account, public_key } = (await this.client.accountsGetDefault({})) as any;
|
|
@@ -158,6 +167,15 @@ export class WalletDaemonTariSigner implements TariSigner {
|
|
|
158
167
|
};
|
|
159
168
|
}
|
|
160
169
|
|
|
170
|
+
public async getAccountByAddress(address: string): Promise<AccountGetResponse> {
|
|
171
|
+
const resp = await this.client.accountsGet({
|
|
172
|
+
name_or_address: {
|
|
173
|
+
ComponentAddress: address,
|
|
174
|
+
},
|
|
175
|
+
});
|
|
176
|
+
return resp;
|
|
177
|
+
}
|
|
178
|
+
|
|
161
179
|
public async getAccountBalances(componentAddress: string): Promise<unknown> {
|
|
162
180
|
return await this.client.accountsGetBalances({ account: { ComponentAddress: componentAddress }, refresh: true });
|
|
163
181
|
}
|
|
@@ -255,4 +273,9 @@ export class WalletDaemonTariSigner implements TariSigner {
|
|
|
255
273
|
public async getNftsList(req: ListAccountNftRequest): Promise<ListAccountNftResponse> {
|
|
256
274
|
return await this.client.nftsList(req);
|
|
257
275
|
}
|
|
276
|
+
|
|
277
|
+
public async getWalletInfo(): Promise<WalletGetInfoResponse> {
|
|
278
|
+
const resp = await this.client.walletGetInfo();
|
|
279
|
+
return resp;
|
|
280
|
+
}
|
|
258
281
|
}
|
|
@@ -15,12 +15,16 @@ import {
|
|
|
15
15
|
SubmitTransactionResponse,
|
|
16
16
|
} from "@tari-project/tarijs-types";
|
|
17
17
|
import {
|
|
18
|
+
AccountGetResponse,
|
|
19
|
+
AccountsListRequest,
|
|
20
|
+
AccountsListResponse,
|
|
18
21
|
ConfidentialViewVaultBalanceRequest,
|
|
19
22
|
KeyBranch,
|
|
20
23
|
ListAccountNftRequest,
|
|
21
24
|
ListAccountNftResponse,
|
|
22
25
|
substateIdToString,
|
|
23
26
|
TransactionSubmitRequest,
|
|
27
|
+
WalletGetInfoResponse,
|
|
24
28
|
} from "@tari-project/typescript-bindings";
|
|
25
29
|
import { TariPermission } from "@tari-project/tari-permissions";
|
|
26
30
|
|
|
@@ -39,6 +43,7 @@ const walletConnectParams = {
|
|
|
39
43
|
"tari_createFreeTestCoins",
|
|
40
44
|
"tari_listSubstates",
|
|
41
45
|
"tari_getNftsList",
|
|
46
|
+
"tari_getWalletInfo",
|
|
42
47
|
],
|
|
43
48
|
chains: ["tari:devnet"],
|
|
44
49
|
events: [],
|
|
@@ -154,6 +159,11 @@ export class WalletConnectTariSigner implements TariSigner {
|
|
|
154
159
|
return this.wcSession !== null;
|
|
155
160
|
}
|
|
156
161
|
|
|
162
|
+
async accountsList(req: AccountsListRequest): Promise<AccountsListResponse> {
|
|
163
|
+
const res = await this.sendRequest("tari_accountsList", req);
|
|
164
|
+
return res as AccountsListResponse;
|
|
165
|
+
}
|
|
166
|
+
|
|
157
167
|
async getAccount(): Promise<AccountData> {
|
|
158
168
|
const { account, public_key } = await this.sendRequest("tari_getDefaultAccount", {});
|
|
159
169
|
const { balances } = await this.sendRequest("tari_getAccountBalances", {
|
|
@@ -177,6 +187,15 @@ export class WalletConnectTariSigner implements TariSigner {
|
|
|
177
187
|
};
|
|
178
188
|
}
|
|
179
189
|
|
|
190
|
+
async getAccountByAddress(address: string): Promise<AccountGetResponse> {
|
|
191
|
+
const res = await this.sendRequest("tari_getAccountByAddress", {
|
|
192
|
+
name_or_address: {
|
|
193
|
+
ComponentAddress: address,
|
|
194
|
+
},
|
|
195
|
+
});
|
|
196
|
+
return res as AccountGetResponse;
|
|
197
|
+
}
|
|
198
|
+
|
|
180
199
|
async getSubstate(substate_address: string): Promise<Substate> {
|
|
181
200
|
const method = "tari_getSubstate";
|
|
182
201
|
const params = { substate_id: substate_address };
|
|
@@ -296,4 +315,9 @@ export class WalletConnectTariSigner implements TariSigner {
|
|
|
296
315
|
const res = await this.sendRequest(method, params);
|
|
297
316
|
return res as ListAccountNftResponse;
|
|
298
317
|
}
|
|
318
|
+
|
|
319
|
+
public async getWalletInfo(): Promise<WalletGetInfoResponse> {
|
|
320
|
+
const res = await this.sendRequest("tari_getWalletInfo", {});
|
|
321
|
+
return res as WalletGetInfoResponse;
|
|
322
|
+
}
|
|
299
323
|
}
|
package/pnpm-workspace.yaml
CHANGED
|
@@ -10,7 +10,7 @@ catalog:
|
|
|
10
10
|
vitest: ^3.0.4
|
|
11
11
|
vite: ^6.1.0
|
|
12
12
|
"@types/node": ^22.13.1
|
|
13
|
-
"@tari-project/typescript-bindings": ">=1.
|
|
13
|
+
"@tari-project/typescript-bindings": ">=1.15.0"
|
|
14
14
|
"@tari-project/wallet_jrpc_client": ^1.7.2
|
|
15
15
|
"@metamask/providers": ^18.2.0
|
|
16
16
|
"@walletconnect/universal-provider": 2.21.3
|