@@ -39,12 +39,12 @@ const privateKey = LumUtils.generatePrivateKey();
3939
4040// Create a wallet instance based on this fresh private key
4141const wallet = await LumWalletFactory .fromPrivateKey (mnemonic );
42- console .log (` Wallet address: ${wallet .address } ` );
42+ console .log (` Wallet address: ${wallet .getAddress () } ` );
4343
4444// Create a wallet instance based on an hexadecimal private key (ex: user input - 0x is optional)
4545const hexPrivateKey = ' 0xb8e62c34928025cdd3aef6cbebc68694b5ad9209b2aff6d3891c8e61d22d3a3b' ;
4646const existingWallet = await LumWalletFactory .fromPrivateKey (LumUtils .keyFromHex (hexPrivateKey ));
47- console .log (` Existing wallet address: ${wallet .address } ` );
47+ console .log (` Existing wallet address: ${wallet .getAddress () } ` );
4848```
4949
5050#### Keystore
@@ -54,7 +54,7 @@ const privateKey = LumUtils.generatePrivateKey();
5454// Create a keystore (or consume user input)
5555const keystore = LumUtils .generateKeyStore (privateKey , ' some-password' );
5656const wallet = await LumWalletFactory .fromKeyStore (keystore , ' some-password' );
57- console .log (` Wallet address: ${wallet .address } ` );
57+ console .log (` Wallet address: ${wallet .getAddress () } ` );
5858```
5959
6060### Hardware wallets
@@ -107,7 +107,7 @@ const testnetClient = await LumClient.connect('http://node0.testnet.lum.network/
107107
108108#### Get account information
109109``` typescript
110- const account = await testnetClient .getAccount (wallet .address );
110+ const account = await testnetClient .getAccount (wallet .getAddress () );
111111if (account === null ) {
112112 console .log (' Account: not found' );
113113} else {
@@ -117,7 +117,7 @@ if (account === null) {
117117
118118#### Get account balances
119119``` typescript
120- const balances = await testnetClient .getAllBalancesUnverified (wallet .address );
120+ const balances = await testnetClient .getAllBalancesUnverified (wallet .getAddress () );
121121if (balances .length === 0 ) {
122122 console .log (' Balances: empty account' );
123123} else {
@@ -135,8 +135,8 @@ if (balances.length === 0) {
135135``` typescript
136136// The client search feature supports multiple searches and merge+sort the results
137137const transactions = await testnetClient .searchTx ([
138- LumUtils .searchTxFrom (wallet .address ),
139- LumUtils .searchTxTo (wallet .address ),
138+ LumUtils .searchTxFrom (wallet .getAddress () ),
139+ LumUtils .searchTxTo (wallet .getAddress () ),
140140]);
141141console .log (` Transactions: ${transactions .map ((tx ) => tx .hash ).join (' , ' )} ` );
142142```
@@ -145,7 +145,7 @@ console.log(`Transactions: ${transactions.map((tx) => tx.hash).join(', ')}`);
145145``` typescript
146146// Build transaction message (Send 100 LUM)
147147const sendMsg = LumMessages .BuildMsgSend (
148- wallet .address ,
148+ wallet .getAddress () ,
149149 toAddress ,
150150 [{ denom: LumConstants .LumDenom , amount: ' 100' }],
151151);
@@ -155,7 +155,7 @@ const fee = {
155155 gas: ' 100000' ,
156156};
157157// Fetch account number and sequence
158- const account = await testnetClient .getAccount (wallet .address );
158+ const account = await testnetClient .getAccount (wallet .getAddress () );
159159// Create the transaction document
160160const doc = {
161161 accountNumber: account .accountNumber ,
@@ -176,10 +176,10 @@ console.log(`Broadcast success: ${LumUtils.broadcastTxCommitSuccess(broadcastRes
176176The underlying tendermint client is directly accessible via the ` .tmClient ` property of the LumClient.
177177
178178``` typescript
179- const health = await testnetClient .tmClient .health ();
180- const status = await testnetClient .tmClient .status ();
181- const genesis = await testnetClient .tmClient .genesis ();
182- const latestBlock = await testnetClient .tmClient .block ();
179+ const health = await testnetClient .tmClient .health ();
180+ const status = await testnetClient .tmClient .status ();
181+ const genesis = await testnetClient .tmClient .genesis ();
182+ const latestBlock = await testnetClient .tmClient .block ();
183183```
184184
185185### Use all modules RPCs
@@ -189,6 +189,19 @@ The underlying query client is directly accessible via the `.queryClient` proper
189189It allows to directly query all modules endpoints such as:
190190
191191``` typescript
192- const supplies = await clt .queryClient .bank .unverified .totalSupply ();
193- // [{ denom: 'lum', amount: '1000000' }]
192+ const supplies = await clt .queryClient .bank .unverified .totalSupply ();
193+ // [{ denom: 'lum', amount: '1000000' }]
194+ ```
195+
196+ ### Message signature & verification
197+
198+ #### Sign a message
199+ ``` typescript
200+ const message = ' Lum network is an awesome decentralized protocol' ;
201+ const signedPayload = await wallet .signMessage (message );
202+ // { address, publicKey, msg, sig, version, signer }
203+ const validSig = await LumUtils .verifySignMsg (signedPayload );
204+ // true
205+ const invalidSig = await LumUtils .verifySignMsg (Object .assign (signedPayload , { msg: ' Wrong message input' }));
206+ // false
194207```
0 commit comments