# IdHelper
IdHelper allows to easily perform all the operations related to the commercio.network id module.
# Provided operations
- getDidDocument, returns the- DidDocumentassociated with the given- didand- wallet, or- nullif no- DidDocumentwas found.- static Future<DidDocument?> getDidDocument( String did, Wallet wallet, { http.Client? client, })1
 2
 3
 4
 5
- setDidDocument, performs a transaction setting the specified- didDocumentas being associated with the address present inside the specified- wallet. Optionally- feeand broadcasting- modeparameters can be specified.- static Future<TransactionResult> setDidDocument( DidDocument didDocument, Wallet wallet, { StdFee? fee, BroadcastingMode? mode, http.Client? client, })1
 2
 3
 4
 5
 6
 7
- setDidDocumentsList, performs a transaction setting the- didDocumentslist as being associated with the address present inside the specified- wallet. Optionally- feeand broadcasting- modeparameters can be specified.- static Future<TransactionResult> setDidDocumentsList( List<DidDocument> didDocuments, Wallet wallet, { StdFee? fee, BroadcastingMode? mode, http.Client? client, })1
 2
 3
 4
 5
 6
 7
- requestDidPowerUp, creates a new transaction to request a Did PowerUp of the given- amountfrom the- senderWalletwallet for the given- pairwiseDidaddress. Signs everything that needs to be signed with the private key contained inside the given wallet and the- privateKey. Optionally- feeand broadcasting- modeparameters can be specified.- static Future<TransactionResult> requestDidPowerUp( Wallet senderWallet, String pairwiseDid, List<StdCoin> amount, CommercioRSAPrivateKey privateKey, { StdFee? fee, BroadcastingMode? mode, })1
 2
 3
 4
 5
 6
 7
 8
- requestDidPowerUpsList, creates a new transaction from the sender- walletto request a list of Did PowerUp- requestDidPowerUpsList. Optionally- feeand broadcasting- modeparameters can be specified.- static Future<TransactionResult> requestDidPowerUpsList( List<RequestDidPowerUp> requestDidPowerUpsList, Wallet wallet, { StdFee? fee, BroadcastingMode? mode, })1
 2
 3
 4
 5
 6
# Usage examples
final networkInfo = NetworkInfo(
  bech32Hrp: 'did:com:',
  lcdUrl: 'http://localhost:1317',
);
final mnemonic = ['will', 'hard', ..., 'man'];
final wallet = Wallet.derive(mnemonic, networkInfo);
final pubKeys = [rsaVerificationPubKey, rsaSignaturePubKey];
final didDocument = DidDocumentHelper.fromWallet(
  wallet: wallet,
  pubKeys: pubKeys,
);
try {
  // Set the Did Document
  await IdHelper.setDidDocument(didDocument, wallet);
  // Send the PowerUp amount to the Tumbler
  final amount = [
    StdCoin(
      denom: 'uccc',
      amount: '10',
    )
  ];
  await TxHelper.createSignAndSendTx(
    [
      MsgSend(
        fromAddress: wallet.bech32Address,
        toAddress: tumblerAddress,
        amount: amount,
      ),
    ],
    wallet,
  );
  // Generate a pairwise wallet
  final pairwaiseWallet = Wallet.derive(
    mnemonic,
    networkInfo,
    lastDerivationPathSegment: '1',
  );
  // Generate a PowerUp request
  final requestDidPowerUp = await RequestDidPowerUpHelper.fromWallet(
    wallet: wallet,
    pairwiseDid: pairwaiseWallet.bech32Address,
    amount: amount,
    privateKey: rsaSignaturePriKey
  );
  // Send the PowerUp request
  await IdHelper.requestDidPowerUpsList(
    [requestDidPowerUp],
    wallet,
  );
} catch (error) {
  throw error;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53