패키지, 저장소 및 앱 카테고리 검색

패키지 상세v1.0.0-beta.15

flutterchain

블록체인 시스템과의 통신을 위한 다중 체인 라이브러리. WalletCore 기반.

AndroidiOSWeb
30일 다운로드
192
좋아요
23
Pub 점수
110

패키지 설치

flutter pub add flutterchain

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

Flutterchain은 Flutter 애플리케이션에서 블록체인 시스템과의 원활한 통신을 가능하게 하는 다중 체인 라이브러리입니다. WalletCore 기반으로 구축되어 여러 블록체인 간 상호 운용성을 지원하며, 월렛 관리, 거래 서명, 블록체인 상호작용을 위한 개발자용 통합 인터페이스를 제공합니다. 이 라이브러리는 Android, iOS, Web 플랫폼에 최적화되어 있어 크로스플랫폼 Web3 앱에 이상적입니다. 강력한 보안 기능과 블록체인 프로토콜에 대한 저수준 접근을 통해 Flutterchain은 모바일 및 웹 앱에 암호 기능을 쉽게 통합할 수 있도록 합니다.

사용 사례

  • 크로스 플랫폼 암호화 지갑 구축
  • Flutter 앱에서 블록체인 거래 활성화
  • 다중 체인 지원 통합
  • 탈중앙화 금융(DeFi) 애플리케이션 개발
  • NFT 마켓플레이스 만들기
  • QR 또는 링크를 통한 지갑 연결 지원

주요 기능

  • 다중 체인 호환성
  • WalletCore 기반 아키텍처
  • Android, iOS 및 웹 지원
  • 안전한 거래 서명
  • 저수준 블록체인 프로토콜 접근
  • 크로스 플랫폼 일관성

적합한 대상

  • 웹3 앱 개발자
  • 암호화 지갑 제작자
  • DeFi 플랫폼 빌더
  • NFT 애플리케이션 팀
  • 블록체인 통합업체

고려 사항

  • 블록체인 기초에 대한 이해가 필요합니다
  • WalletCore의 안정성에 의존
  • 사용자 정의 체인을 위해 추가 설정이 필요할 수 있습니다
  • 기본 사용법 외에 문서가 제한적
  • 비 웹3 프로젝트에는 적합하지 않습니다

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

About FlutterChain

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.

Installing

  1. Add This code to the index.html For Web project
<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>
  1. Set Android: minSdkVersion >= 19, compileSdk >= 34, AGP version >= 7.3.0 in the android/app/build.gradle file and add to the AndroidManifest.xml usesCleartextTraffic param and Internet permission:
  <manifest> ...
    <application> ...
      android:usesCleartextTraffic="true"
    </application>
    <uses-permission android:name="android.permission.INTERNET"/>
  </manifest>
  1. Initialize the flutterchain library after WidgetsFlutterBinding.ensureInitialized() in the main function.
void main() {
  WidgetsFlutterBinding.ensureInitialized();
  initFlutterChainLib();
  ...
  runApp(MyApp());
}

How to use

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();

Important Notes and Tips

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.

Running Examples

Instructions for running the included examples.

  1. Navigate to the example directory: cd example
  2. Run flutter run to launch the example app on your preferred device.
  3. Explore the example app to see how to use the library in your own project.

Contributing

Instructions for contributing to this library:

  1. Fork this repository
  2. Create a new branch: git checkout -b my-new-branch
  3. Make changes and commit them: git commit -m "My message"
  4. Push to the remote branch: git push origin my-new-branch
  5. Create a pull request

List any dependencies or prerequisites needed before getting started with editing this library:

  • Node JS
  • Flutter
  • Installed Android Studio and Android SDK (For Android dev)
  • Installed Xcode (For IOS, Mac OS dev)

Instructions for building the library from source code:

  1. Clone this repository: git clone https://github.com/vlmoon99/flutterchain
  2. Navigate to the project root directory: cd flutterchain
  3. Run bash build.sh for building flutterchain lib

카테고리

의존성

의존성 목록 10 개

소스 저장소

이 패키지를 사용하는 프로젝트

아직 데이터가 없습니다.