@mentaproject/client 0.1.29 → 0.1.32
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.
|
@@ -20,11 +20,17 @@ import { Account } from "./Account";
|
|
|
20
20
|
export declare class MentaClient {
|
|
21
21
|
protected params: MentaClientConfig;
|
|
22
22
|
protected _rpc?: MentaAccountClient;
|
|
23
|
+
protected _account?: Account;
|
|
23
24
|
/**
|
|
24
25
|
* The underlying RPC client used for blockchain interactions.
|
|
25
26
|
* @description This client is responsible for low-level communication with the RPC node.
|
|
26
27
|
*/
|
|
27
28
|
get rpc(): MentaAccountClient;
|
|
29
|
+
/**
|
|
30
|
+
* The account associated with the client.
|
|
31
|
+
* @description This account is used for signing transactions and interacting with the blockchain.
|
|
32
|
+
*/
|
|
33
|
+
get account(): Account;
|
|
28
34
|
/**
|
|
29
35
|
* Manager for block-related operations.
|
|
30
36
|
* @description Provides methods to query and interact with blockchain blocks.
|
|
@@ -45,7 +51,6 @@ export declare class MentaClient {
|
|
|
45
51
|
* @description Provides methods to manage and interact with blockchain accounts.
|
|
46
52
|
*/
|
|
47
53
|
accounts: AccountManager;
|
|
48
|
-
account: Account;
|
|
49
54
|
/**
|
|
50
55
|
* Subscribes to a specific client event.
|
|
51
56
|
* @template TEvent The type of the event to listen for.
|
|
@@ -26,6 +26,16 @@ export class MentaClient {
|
|
|
26
26
|
}
|
|
27
27
|
return this._rpc;
|
|
28
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* The account associated with the client.
|
|
31
|
+
* @description This account is used for signing transactions and interacting with the blockchain.
|
|
32
|
+
*/
|
|
33
|
+
get account() {
|
|
34
|
+
if (!this._account) {
|
|
35
|
+
throw new Error("Account not initialized");
|
|
36
|
+
}
|
|
37
|
+
return this._account;
|
|
38
|
+
}
|
|
29
39
|
/**
|
|
30
40
|
* Subscribes to a specific client event.
|
|
31
41
|
* @template TEvent The type of the event to listen for.
|
|
@@ -88,7 +98,6 @@ export class MentaClient {
|
|
|
88
98
|
else {
|
|
89
99
|
this.accounts = new AccountManager(this);
|
|
90
100
|
}
|
|
91
|
-
this.account = this.accounts.get(this.rpc.account.address);
|
|
92
101
|
}
|
|
93
102
|
async init() {
|
|
94
103
|
let coreClient = createClient(this.params);
|
|
@@ -100,5 +109,6 @@ export class MentaClient {
|
|
|
100
109
|
bundlerTransport: this.params.bundlerTransport,
|
|
101
110
|
publicTransport: this.params.transport,
|
|
102
111
|
});
|
|
112
|
+
this._account = this.accounts.get(this.rpc.account.address);
|
|
103
113
|
}
|
|
104
114
|
}
|
package/package.json
CHANGED
|
@@ -28,6 +28,7 @@ import { Account } from "./Account";
|
|
|
28
28
|
*/
|
|
29
29
|
export class MentaClient {
|
|
30
30
|
protected _rpc?: MentaAccountClient;
|
|
31
|
+
protected _account?: Account;
|
|
31
32
|
/**
|
|
32
33
|
* The underlying RPC client used for blockchain interactions.
|
|
33
34
|
* @description This client is responsible for low-level communication with the RPC node.
|
|
@@ -39,6 +40,17 @@ export class MentaClient {
|
|
|
39
40
|
return this._rpc;
|
|
40
41
|
}
|
|
41
42
|
|
|
43
|
+
/**
|
|
44
|
+
* The account associated with the client.
|
|
45
|
+
* @description This account is used for signing transactions and interacting with the blockchain.
|
|
46
|
+
*/
|
|
47
|
+
public get account(): Account {
|
|
48
|
+
if (!this._account) {
|
|
49
|
+
throw new Error("Account not initialized");
|
|
50
|
+
}
|
|
51
|
+
return this._account;
|
|
52
|
+
}
|
|
53
|
+
|
|
42
54
|
/**
|
|
43
55
|
* Manager for block-related operations.
|
|
44
56
|
* @description Provides methods to query and interact with blockchain blocks.
|
|
@@ -60,8 +72,6 @@ export class MentaClient {
|
|
|
60
72
|
*/
|
|
61
73
|
public accounts!: AccountManager;
|
|
62
74
|
|
|
63
|
-
public account: Account;
|
|
64
|
-
|
|
65
75
|
/**
|
|
66
76
|
* Subscribes to a specific client event.
|
|
67
77
|
* @template TEvent The type of the event to listen for.
|
|
@@ -131,8 +141,6 @@ export class MentaClient {
|
|
|
131
141
|
} else {
|
|
132
142
|
this.accounts = new AccountManager(this);
|
|
133
143
|
}
|
|
134
|
-
|
|
135
|
-
this.account = this.accounts.get(this.rpc.account.address);
|
|
136
144
|
}
|
|
137
145
|
|
|
138
146
|
async init() {
|
|
@@ -147,6 +155,8 @@ export class MentaClient {
|
|
|
147
155
|
bundlerTransport: this.params.bundlerTransport,
|
|
148
156
|
publicTransport: this.params.transport,
|
|
149
157
|
});
|
|
158
|
+
|
|
159
|
+
this._account = this.accounts.get(this.rpc.account.address);
|
|
150
160
|
}
|
|
151
161
|
|
|
152
162
|
/**
|