moca_chains

Last updated:

0 purchases

moca_chains Image
moca_chains Images
Add to Cart

Description:

moca 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

Methods #

initMnemonic
createMnemonic
getBalance
makeTransaction
getFeeEstimate
getTransactions

Swaps #

BTC
ETH
CACAO
RUNE
KUJI
ARB
DASH

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);
copied to clipboard
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);
}
copied to clipboard

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.