# Kyc helper
Kyc helper allows to easily perform all the operations related to the commercio.network kyc
module.
# Provided operations
Sends a new transaction in order to invite the given
inviteUsers
users list andwallet
. Optionallyfee
and broadcastingmode
parameters can be specified.suspend fun inviteUsersList( inviteUsers: List<InviteUser>, wallet: Wallet, fee: StdFee? = null, mode: BroadcastingMode? = null ): TxResponse
1
2
3
4
5
6Buys the membership with the given
buyMemberships
memberships list andwallet
. Optionallyfee
and broadcastingmode
parameters can be specified.suspend fun buyMembershipsList( buyMemberships: List<BuyMembership>, wallet: Wallet, fee: StdFee? = null, mode: BroadcastingMode? = null ): TxResponse
1
2
3
4
5
6Deposit a list of the given deposits
rewardPoolDeposits
into reward pool with the depositorwallet
. Optionallyfee
and broadcastingmode
parameters can be specified.suspend fun rewardPoolDepositsList( rewardPoolDeposits: List<RewardPoolDeposit>, wallet: Wallet, fee: StdFee? = null, mode: BroadcastingMode? = null ): TxResponse
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 government = Wallet.derive(mnemonic = userMnemonic, networkInfo = info)
val newUserMnemonic = listOf(
"often",
"emerge",
"table",
"boat",
"add",
"crowd",
"obtain",
"creek",
"skill",
"flat",
"master",
"gift",
"provide",
"peasant",
"famous",
"blur",
"flight",
"lady",
"elephant",
"twenty",
"join",
"depth",
"laptop",
"arrest"
)
val newUserWallet = Wallet.derive(newUserMnemonic, info)
try {
// Invite user
val responseInviteUser = KycHelper.inviteUsersList(
wallet = government,
inviteUsers = listOf(
InviteUserHelper.fromWallet(
wallet = government, // user with membership
recipientDid = Did(newUserWallet.bech32Address) // user to invite
)
)
)
// Recharge the user
val responseSendCoin = TxHelper.createSignAndSendTx(
msgs = listOf(
MsgSend(
amount = listOf(
StdCoin(denom = "uccc", amount = "100"),
StdCoin(denom = "ucommercio", amount = "20000")
),
fromAddress = government.bech32Address,
toAddress = newUserWallet.bech32Address
)
),
wallet = government
)
// Buy a membership
val responseBuy = KycHelper.buyMembershipsList(
wallet = government,
buyMemberships = listOf(
BuyMembership(
buyerDid = newUserWallet.bech32Address,
membershipType = MembershipType.BRONZE,
tsp = government.bech32Address
)
)
)
// Deposit into the reward pool
val responseRewardPoolDeposit = rewardPoolDepositsList(
wallet = wallet,
rewardPoolDeposits = listOf(
RewardPoolDepositHelper.fromWallet(
wallet = wallet,
amount = listOf(StdCoin(denom = "ucommercio", amount = "50"))
)
)
)
} 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114