# KycHelper
KycHelper
allows to easily perform all the operations related to the commercio.network kyc
module.
# Provided operations
buyMembershipsList
, buys the membership with the given memberships listbuyMemberships
and tspwallet
. Optionallyfee
and broadcastingmode
parameters can be specified.static Future<TransactionResult> buyMembershipsList( List<BuyMembership> buyMemberships, Wallet wallet, { StdFee? fee, BroadcastingMode? mode, })
1
2
3
4
5
6inviteUsersList
, invite new users with the given users listinviteUsers
andwallet
. Optionallyfee
and broadcastingmode
parameters can be specified.static Future<TransactionResult> inviteUsersList( List<InviteUser> inviteUsers, Wallet wallet, { StdFee? fee, BroadcastingMode? mode, })
1
2
3
4
5
6rewardPoolDepositsList
, deposit a list of depositsrewardPoolDeposits
into reward pool with the depositorwallet
. Optionallyfee
and broadcastingmode
parameters can be specified.static Future<TransactionResult> rewardPoolDepositsList( List<RewardPoolDeposit> rewardPoolDeposits, Wallet wallet, { StdFee? fee, BroadcastingMode? mode, })
1
2
3
4
5
6
# Usage examples
final wallet = Wallet.derive(mnemonic, networkInfo);
final government = Wallet.derive(govMnemonic, networkInfo);
try {
// Invite a user
final invite = InviteUserHelper.fromWallet(
wallet: government,
recipientDid: wallet.bech32Address,
);
await KycHelper.inviteUsersList([invite], wallet);
// Recharge the user
final amount = [
const StdCoin(denom: 'uccc', amount: '100'),
];
final msgs = [
MsgSend(
amount: amount,
fromAddress: government.bech32Address,
toAddress: wallet.bech32Address,
),
];
await TxHelper.createSignAndSendTx(
msgs,
government,
);
// Buy a membership
final membership = BuyMembershipHelper.fromWallet(
wallet: wallet,
membershipType: MembershipType.BRONZE,
tsp: government.bech32Address,
);
await KycHelper.buyMembershipsList([membership], government);
// Deposit into the reward pool
final depositAmount = [
StdCoin(
denom: 'uccc',
amount: '10',
)
];
final rewardPoolDeposit = RewardPoolDepositHelper.fromWallet(
wallet: wallet,
amount: depositAmount,
);
await KycHelper.rewardPoolDepositsList([rewardPoolDeposit], wallet);
} catch (error) {
throw error;
}
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
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