# MintHelper
MintHelper
allows to easily perform all the operations related to the commercio.network mint
module.
# Provided operations
mintCccsList
, mints the CCCs having the givenmintCccs
list as being associated with the address present inside the specifiedwallet
. Optionallyfee
and broadcastingmode
parameters can be specified.static Future<TransactionResult> mintCccsList( List<MintCcc> mintCccs, Wallet wallet, { StdFee? fee, BroadcastingMode? mode, })
1
2
3
4
5
6burnCccsList
, burns the CCCs having the givenburnCccs
list as being associated with the address present inside the specifiedwallet
. Optionallyfee
and broadcastingmode
parameters can be specified.static Future<TransactionResult> burnCccsList( List<BurnCcc> burnCccs, Wallet wallet, { StdFee? fee, BroadcastingMode? mode, })
1
2
3
4
5
6getExchangeTradePositions
, returns the list of all theExchangeTradePosition
that the specified wallet has mintedstatic Future<List<ExchangeTradePosition>> getExchangeTradePositions( Wallet wallet, )
1
2
3
# Usage examples
final wallet = Wallet.derive(mnemonic, networkInfo);
try {
// --- Mint CCC
final mintCcc = MintCccHelper.fromWallet(
wallet: wallet,
amount: [StdCoin(denom: 'uccc', amount: '10')],
id: Uuid().v4(),
);
await MintHelper.mintCccsList([mintCcc], wallet);
// --- Burn CCC
final etps = await MintHelper.getExchangeTradePositions(wallet);
List<BurnCcc> burnCccs = new List();
etps.forEach((etp) {
final burnCcc = BurnCccHelper.fromWallet(
wallet: wallet,
amount: StdCoin(
denom: etp.credits.denom,
amount: etp.credits.amount,
),
id: etp.id,
);
burnCccs.add(burnCcc);
});
await MintHelper.burnCccsList(burnCccs, 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
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