# Mint helper

Mint helper allows to easily perform all the operations related to the commercio.network mint module.

# Provided operations

  1. Opens a new CDP depositing the given commercioTokenAmount
static Future<TransactionResult> openCdp(
  int commercioTokenAmount,
  Wallet wallet,
) 
1
2
3
4
  1. Closes the CDP having the given timestamp.
static Future<TransactionResult> closeCdp(
  String timestamp,
  Wallet wallet,
) 
1
2
3
4

# Usage examples

You can reach the examples code here

import 'package:commerciosdk/export.dart';
import 'commons.dart';

void main() async {
  final info = NetworkInfo(
    bech32Hrp: "did:com:",
    lcdUrl: "http://localhost:1317",
  );

  final userMnemonic = [
    "will",
    "hard",
    "topic",
    "spray",
    "beyond",
    "ostrich",
    "moral",
    "morning",
    "gas",
    "loyal",
    "couch",
    "horn",
    "boss",
    "across",
    "age",
    "post",
    "october",
    "blur",
    "piece",
    "wheel",
    "film",
    "notable",
    "word",
    "man"
  ];

  final userWallet = Wallet.derive(userMnemonic, info);

  // --- Open CDP
  final response = await MintHelper.openCdp(100000, userWallet);
  checkResponse(response);

  // --- Close CDP
  final response = await MintHelper.closeCdp(757, userWallet);
  checkResponse(response);
}
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