# Request Did PowerUp Helper

Request Did PowerUp Helper allows to easily create a Did PowerUp request.

# Provided Operations

  1. Creates a RequestDidPowerUpHelper from the given wallet, pairwiseDid, amount and privateKey.
suspend fun fromWallet(
    wallet: Wallet,
    pairwiseDid: Did,
    amount: List<StdCoin>,
    privateKey: RSAPrivateKey
): RequestDidPowerUp
1
2
3
4
5
6

# Usage examples

    val info = NetworkInfo(
        bech32Hrp = "did:com:", 
        lcdUrl = "http://localhost:1317"
    )

    val userMnemonic = listOf(
        "will",
        "hard",
        "topic",
        "spray",
        "beyond",
        "ostrich",
        "moral",
        "morning",
        "gas",
        "loyal",
        "couch",
        "horn",
        "boss",
        "across",
        "age",
        "post",
        "october",
        "blur",
        "piece",
        "wheel",
        "film",
        "notable",
        "word",
        "man"
    )
    val wallet = Wallet.derive(mnemonic = userMnemonic, networkInfo = info)
    val pairwiseWallet = Wallet.derive(mnemonic = userMnemonic, networkInfo = info, lastDerivationPathSegment = 1)
    val amount = StdCoin(denom = "ucommercio", amount = "100")

    val privateKeyPem = 
    """
    -----BEGIN PRIVATE KEY-----
    MIIEvQ...
    -----END PRIVATE KEY-----
    """

    val privateKeyPem = RSAKeyParser.parseRSAPrivateKeyFromPem(privateKeyPem)
    try {
        RequestDidPowerUpHelper.fromWallet(
            wallet = wallet,
            pairwiseDid = Did(pairwiseWallet.bech32Address),
            privateKey = privateKeyPem,
            amount = listOf(amount)
        )
    } catch (e: Exception){
        throw e
    }
1
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