Skip to content
Dart implementation of Sacco, our cryptographic library that allows easy creation, signing and sending of Cosmos Network transactions
Dart
Branch: master
Clone or download
Latest commit 409f164 Dec 6, 2019

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.img Updated the README Sep 5, 2019
example
lib added .g. file Dec 6, 2019
test Run dartfmt Nov 11, 2019
test_resources
.gitignore removed .g. ignoring from gitignore Dec 6, 2019
.travis.yml
CHANGELOG.md added json ser/deser to transaction result Dec 6, 2019
LICENSE Initial commit Aug 26, 2019
README.md Update README.md Nov 28, 2019
pubspec.lock added json ser/deser to transaction result Dec 6, 2019
pubspec.yaml trying to fix warning Dec 6, 2019

README.md

Pub Travis (.org)

Sacco.dart is a pure Dart package that allows you to easily perform some operations related to the Cosmos.network ecosystem. This includes:

  1. Creating an HD Wallet.
  2. Creating a transaction.
  3. Signing a transaction.
  4. Broadcasting a transaction.

Being it in pure Dart means that you can use it inside your Dart Web projects as well as Flutter ones.

You can find the latest release of sacco.dart on pub.

Usage

Creating a wallet

final derivationPath = "m/44'/118'/0'/0/0";
final networkInfo = NetworkInfo(id: "", bech32Hrp: "cosmos", lcdUrl: "");

final mnemonicString = "final random flame cinnamon grunt hazard easily mutual resist pond solution define knife female tongue crime atom jaguar alert library best forum lesson rigid";
final mnemonic = mnemonicString.split(" ");
final wallet = Wallet.derive(mnemonic, derivationPath, networkInfo);

Creating a transaction

final message = StdMsg(
  type: "cosmos-sdk/MsgSend",
  value: {
    "from_address": "cosmos1huydeevpz37sd9snkgul6070mstupukw00xkw9",
    "to_address": "cosmos12lla7fg3hjd2zj6uvf4pqj7atx273klc487c5k",
    "amount": [
      {"denom": "uatom", "amount": "100"}
    ]
  },
);

final stdTx = TxBuilder.buildStdTx(stdMsgs: [message]);

Signing a transaction

final signedStdTx = TxSigner.signStdTx(wallet: wallet, stdTx: stdTx);

Sending a transaction

try {
  final hash = await TxSender.broadcastStdTx(wallet: wallet, stdTx: signedStdTx);
  print("Tx send successfully. Hash: $hash");
} catch (error) {
  print("Error while sending the tx: $error");
}
You can’t perform that action at this time.