moca_chains 1.6.15 copy "moca_chains: ^1.6.15" to clipboard
moca_chains: ^1.6.15 copied to clipboard

Chains package for Moca App. This library gives the developer common methods for interacting with chains.

Moca Chains #

Chains package for Moca App. This library gives the developer common methods for interacting with chains.

Features #

Chains #

  • Ethereum
  • Bitcoin
  • Dash
  • Solana
  • Binance Smart Chain
  • Litecoin
  • Maya
  • Thor
  • Arbitrum
  • Kujira
  • Cardano
  • Dogecoin
  • Avax
  • Radix

Methods #

  • createMnemonic
  • initMnemonic
  • isContractAddress
  • getBalance
  • makeTransaction
  • getFeeEstimate
  • getPrivateKeyFromMnemonic
  • validateAddress
  • getTransactions

Swaps #

  • BTC
  • ETH
  • CACAO
  • RUNE
  • KUJI
  • ARB
  • DASH
  • USDC
  • DOGE
  • USK
  • BNB
  • LTC
  • AVAX
  • XRD

Usage #

These methods apply for the different chains

import 'package:moca_chains/moca_chains.dart';

  final chain = ChainFactory('solana').build();
  final privateHex = await chain.initMnemonic('YOUR_MNEMONIC');
  final balance =
      await chain.getBalance(chain.getKeysFromPrivateHex(privateHex).address);
  print(balance);
void main() async {
  String mnemonic = "";
  Chain btc = ChainFactory("bitcoin").build();
  String btcPrivHex = await btc.initMnemonic(mnemonic);
  final address = btc.getKeysFromPrivateHex(btcPrivHex).address;
  final quote = await MayaSwaps.getQuote(GetQuoteParams(
      amount: 0.01,
      destination: address,
      fromAsset: SupportedChains.btc,
      toAsset: SupportedChains.eth));
  final privateHex =
      await ChainFactory("ethereum").build().initMnemonic(mnemonic);
  final resp = await MayaSwaps.makeSwap(
      inboundAddress: quote.inboundAddress,
      memo: quote.memo,
      privateHex: privateHex,
      amount: "0.01",
      originChain: SupportedChains.btc);
  print(resp.inboundTxHash);
  print(resp.mayaUrl);
}
2
likes
130
points
170
downloads

Publisher

unverified uploader

Weekly Downloads

Chains package for Moca App. This library gives the developer common methods for interacting with chains.

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

bech32, bitcoin_base, blake2b, blockchain_utils, convert, cosmos_sdk, cryptography, dart_jsonwebtoken, dio, flutter_bitcoin, flutter_rust_bridge, http, on_chain, pointycastle, tuple, uuid, web_socket_channel

More

Packages that depend on moca_chains

Packages that implement moca_chains