flutterchain
블록체인 시스템과의 통신을 위한 다중 체인 라이브러리. WalletCore 기반.
블록체인 및 암호화 개발을 위한 통합 Flutter 라이브러리
^1.0.2^1.17.2^3.0.2^5.4.0^6.0.0^1.1.0{"sdk":"flutter"}^6.1.5^9.2.2{"sdk":"flutter"}{"git":{"url":"https://github.com/ArturLevchuk/grpc-dart"}}^0.2.0^4.8.1^2.1.8^3.1.0^0.27.7^1.1.0^2.4.8^3.0.1{"sdk":"flutter"}^6.7.1^5.4.4아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.
https://raw.githubusercontent.com/ArturLevchuk/media_storage/refs/heads/main/FlutterChainLogo.png
FlutterChain is a library that provides developers with a simple API to communicate with different blockchains. It allows developers to easily integrate popular cryptocurrencies into their web 3.0 projects without needing to have an in-depth understanding of the underlying blockchain technology. With FlutterChain, developers can easily interact with smart contracts, send transfers, and perform various transaction types. It's an easy-to-use and flexible solution for developers looking to build blockchain-based applications.
<head>
<!-- other head elements -->
<script type="application/javascript" src="flutter.js" defer></script>
<script type="application/javascript" src="/assets/packages/flutter_inappwebview_web/assets/web/web_support.js" defer></script>
<script type="module" src="/assets/packages/flutterchain/assets/crypto-lib/dist/bundle.js"></script>
<script type="application/javascript" src="/assets/packages/flutterchain/assets/crypto-lib/dist/dop_bundle.js"></script>
<link rel="modulepreload" crossorigin href="/assets/packages/flutterchain/assets/crypto-lib/dist/bundle2.js">
</head>
<body>
<script>
window.addEventListener("load", async function (ev) {
{{flutter_js}}
{{flutter_build_config}}
_flutter.loader.load({
serviceWorkerSettings: {
serviceWorkerVersion: {{flutter_service_worker_version}},
},
});
});
</script>
</body>
usesCleartextTraffic param and Internet permission: <manifest> ...
<application> ...
android:usesCleartextTraffic="true"
</application>
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>
void main() {
WidgetsFlutterBinding.ensureInitialized();
initFlutterChainLib();
...
runApp(MyApp());
}
This library provides interfaces to interact with various blockchains. You can achieve this by using an implementation of BlockChainService or BlockchainServiceWithSmartContractCallSupport for your selected blockchain. For example:
final service = NearBlockChainService.defaultInstance(); // NearBlockChainService implements BlockchainServiceWithSmartContractCallSupport
final amount = await service
.getWalletBalance(NearAccountInfoRequest(accountId: "test.near"));
The library also includes its own wallet controller (FlutterChainLibrary), allowing you to create wallets for different blockchains simultaneously, securely store them and manage, and execute standardized operations like transferring coins or interacting with smart contracts (where supported by the blockchain). It also provides access to the blockchain specific methods interface. For example:
final flutterChainLibrary = FlutterChainLibrary.defaultInstance();
final wallet = await flutterChainLibrary.createWalletWithGeneratedMnemonic(
walletName: "my wallet");
final derivationPathData =
wallet.blockchainsData?[BlockChains.near]?.first.derivationPath;
// call from FlutterChainLibrary
final response = await flutterChainLibrary.sendTransferNativeCoin(
blockchainType: BlockChains.near,
derivationPathData: derivationPathData!,
walletId: wallet.id,
toAddress: "someAddress",
transferAmount: "1000",
);
//call from blockchainService interface
final NearBlockChainService nearBlockChainService = flutterChainLibrary
.blockchainService
.blockchainServices[BlockChains.near] as NearBlockChainService;
// final NearBlockChainData blockChainData = wallet.blockchainsData![BlockChains.near]?.first as NearBlockChainData;
final NearBlockChainData blockChainData = await nearBlockChainService
.getBlockChainData(mnemonic: wallet.mnemonic) as NearBlockChainData;
final response2 = await nearBlockChainService.sendTransferNativeCoin(
NearTransferRequest(
publicKey: blockChainData.publicKey,
privateKey: blockChainData.privateKey,
toAddress: "someAddress",
transferAmount: "1000",
),
);
await flutterChainLibrary.deleteAllWallets();
FlutterChainLibrary and BlockchainServiceWithSmartContractCallSupport/BlockchainService implementations aren't singletons. Each time a new instance is created, a jsVMService (a service that handles blockchain operations behind the scenes) is also instantiated. For optimal performance, it is recommended to reuse the same instance of the blockchain service throughout your app. This can be easily managed by using dependency injection libraries like flutter_modular or get_it.
For more detailed information, refer to the documentation and tests. You'll find guidance on how to use FlutterChainLibrary or various BlockchainServices. Additionally, you can explore different use cases through the examples provided:
You can see the architecture in the draw.io file flutterchain_arch.drawio inside the library.
Instructions for running the included examples.
cd exampleflutter run to launch the example app on your preferred device.Instructions for contributing to this library:
git checkout -b my-new-branchgit commit -m "My message"git push origin my-new-branchList any dependencies or prerequisites needed before getting started with editing this library:
Instructions for building the library from source code:
git clone https://github.com/vlmoon99/flutterchaincd flutterchainbash build.sh for building flutterchain lib