├── packages
├── flutter_fuels
│ ├── ios
│ │ ├── Frameworks
│ │ │ └── .gitkeep
│ │ ├── .gitignore
│ │ ├── Classes
│ │ │ ├── EnforceBundling.swift
│ │ │ └── flutter_fuels.c
│ │ └── flutter_fuels.podspec
│ ├── macos
│ │ ├── Frameworks
│ │ │ └── .gitkeep
│ │ ├── .gitignore
│ │ ├── Classes
│ │ │ ├── EnforceBundling.swift
│ │ │ └── flutter_fuels.c
│ │ └── flutter_fuels.podspec
│ ├── example
│ │ ├── linux
│ │ │ ├── .gitignore
│ │ │ ├── main.cc
│ │ │ ├── flutter
│ │ │ │ ├── generated_plugin_registrant.cc
│ │ │ │ ├── generated_plugin_registrant.h
│ │ │ │ ├── generated_plugins.cmake
│ │ │ │ └── CMakeLists.txt
│ │ │ ├── my_application.h
│ │ │ └── my_application.cc
│ │ ├── ios
│ │ │ ├── Runner
│ │ │ │ ├── Runner-Bridging-Header.h
│ │ │ │ ├── Assets.xcassets
│ │ │ │ │ ├── LaunchImage.imageset
│ │ │ │ │ │ ├── LaunchImage.png
│ │ │ │ │ │ ├── LaunchImage@2x.png
│ │ │ │ │ │ ├── LaunchImage@3x.png
│ │ │ │ │ │ ├── README.md
│ │ │ │ │ │ └── Contents.json
│ │ │ │ │ └── AppIcon.appiconset
│ │ │ │ │ │ ├── Icon-App-20x20@1x.png
│ │ │ │ │ │ ├── Icon-App-20x20@2x.png
│ │ │ │ │ │ ├── Icon-App-20x20@3x.png
│ │ │ │ │ │ ├── Icon-App-29x29@1x.png
│ │ │ │ │ │ ├── Icon-App-29x29@2x.png
│ │ │ │ │ │ ├── Icon-App-29x29@3x.png
│ │ │ │ │ │ ├── Icon-App-40x40@1x.png
│ │ │ │ │ │ ├── Icon-App-40x40@2x.png
│ │ │ │ │ │ ├── Icon-App-40x40@3x.png
│ │ │ │ │ │ ├── Icon-App-60x60@2x.png
│ │ │ │ │ │ ├── Icon-App-60x60@3x.png
│ │ │ │ │ │ ├── Icon-App-76x76@1x.png
│ │ │ │ │ │ ├── Icon-App-76x76@2x.png
│ │ │ │ │ │ ├── Icon-App-1024x1024@1x.png
│ │ │ │ │ │ ├── Icon-App-83.5x83.5@2x.png
│ │ │ │ │ │ └── Contents.json
│ │ │ │ ├── AppDelegate.swift
│ │ │ │ ├── Base.lproj
│ │ │ │ │ ├── Main.storyboard
│ │ │ │ │ └── LaunchScreen.storyboard
│ │ │ │ └── Info.plist
│ │ │ ├── Flutter
│ │ │ │ ├── Debug.xcconfig
│ │ │ │ ├── Release.xcconfig
│ │ │ │ └── AppFrameworkInfo.plist
│ │ │ ├── Runner.xcodeproj
│ │ │ │ ├── project.xcworkspace
│ │ │ │ │ ├── contents.xcworkspacedata
│ │ │ │ │ └── xcshareddata
│ │ │ │ │ │ ├── WorkspaceSettings.xcsettings
│ │ │ │ │ │ └── IDEWorkspaceChecks.plist
│ │ │ │ └── xcshareddata
│ │ │ │ │ └── xcschemes
│ │ │ │ │ └── Runner.xcscheme
│ │ │ ├── Runner.xcworkspace
│ │ │ │ ├── contents.xcworkspacedata
│ │ │ │ └── xcshareddata
│ │ │ │ │ ├── WorkspaceSettings.xcsettings
│ │ │ │ │ └── IDEWorkspaceChecks.plist
│ │ │ ├── Podfile.lock
│ │ │ ├── .gitignore
│ │ │ └── Podfile
│ │ ├── web
│ │ │ ├── favicon.png
│ │ │ ├── icons
│ │ │ │ ├── Icon-192.png
│ │ │ │ ├── Icon-512.png
│ │ │ │ ├── Icon-maskable-192.png
│ │ │ │ └── Icon-maskable-512.png
│ │ │ ├── manifest.json
│ │ │ └── index.html
│ │ ├── android
│ │ │ ├── gradle.properties
│ │ │ ├── app
│ │ │ │ ├── src
│ │ │ │ │ ├── main
│ │ │ │ │ │ ├── res
│ │ │ │ │ │ │ ├── mipmap-hdpi
│ │ │ │ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ │ │ ├── mipmap-mdpi
│ │ │ │ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ │ │ ├── mipmap-xhdpi
│ │ │ │ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ │ │ ├── mipmap-xxhdpi
│ │ │ │ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ │ │ ├── mipmap-xxxhdpi
│ │ │ │ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ │ │ ├── drawable
│ │ │ │ │ │ │ │ └── launch_background.xml
│ │ │ │ │ │ │ ├── drawable-v21
│ │ │ │ │ │ │ │ └── launch_background.xml
│ │ │ │ │ │ │ ├── values
│ │ │ │ │ │ │ │ └── styles.xml
│ │ │ │ │ │ │ └── values-night
│ │ │ │ │ │ │ │ └── styles.xml
│ │ │ │ │ │ ├── kotlin
│ │ │ │ │ │ │ └── com
│ │ │ │ │ │ │ │ └── fuelet
│ │ │ │ │ │ │ │ └── flutter_fuels_example
│ │ │ │ │ │ │ │ └── MainActivity.kt
│ │ │ │ │ │ └── AndroidManifest.xml
│ │ │ │ │ ├── debug
│ │ │ │ │ │ └── AndroidManifest.xml
│ │ │ │ │ └── profile
│ │ │ │ │ │ └── AndroidManifest.xml
│ │ │ │ └── build.gradle
│ │ │ ├── gradle
│ │ │ │ └── wrapper
│ │ │ │ │ └── gradle-wrapper.properties
│ │ │ ├── .gitignore
│ │ │ ├── settings.gradle
│ │ │ └── build.gradle
│ │ ├── macos
│ │ │ ├── Runner
│ │ │ │ ├── Configs
│ │ │ │ │ ├── Debug.xcconfig
│ │ │ │ │ ├── Release.xcconfig
│ │ │ │ │ ├── Warnings.xcconfig
│ │ │ │ │ └── AppInfo.xcconfig
│ │ │ │ ├── Assets.xcassets
│ │ │ │ │ └── AppIcon.appiconset
│ │ │ │ │ │ ├── app_icon_128.png
│ │ │ │ │ │ ├── app_icon_16.png
│ │ │ │ │ │ ├── app_icon_256.png
│ │ │ │ │ │ ├── app_icon_32.png
│ │ │ │ │ │ ├── app_icon_512.png
│ │ │ │ │ │ ├── app_icon_64.png
│ │ │ │ │ │ ├── app_icon_1024.png
│ │ │ │ │ │ └── Contents.json
│ │ │ │ ├── AppDelegate.swift
│ │ │ │ ├── Release.entitlements
│ │ │ │ ├── DebugProfile.entitlements
│ │ │ │ ├── MainFlutterWindow.swift
│ │ │ │ └── Info.plist
│ │ │ ├── .gitignore
│ │ │ ├── Flutter
│ │ │ │ ├── Flutter-Debug.xcconfig
│ │ │ │ ├── Flutter-Release.xcconfig
│ │ │ │ └── GeneratedPluginRegistrant.swift
│ │ │ ├── Runner.xcworkspace
│ │ │ │ ├── contents.xcworkspacedata
│ │ │ │ └── xcshareddata
│ │ │ │ │ └── IDEWorkspaceChecks.plist
│ │ │ ├── Runner.xcodeproj
│ │ │ │ ├── project.xcworkspace
│ │ │ │ │ └── xcshareddata
│ │ │ │ │ │ └── IDEWorkspaceChecks.plist
│ │ │ │ └── xcshareddata
│ │ │ │ │ └── xcschemes
│ │ │ │ │ └── Runner.xcscheme
│ │ │ └── Podfile
│ │ ├── windows
│ │ │ ├── runner
│ │ │ │ ├── resources
│ │ │ │ │ └── app_icon.ico
│ │ │ │ ├── resource.h
│ │ │ │ ├── utils.h
│ │ │ │ ├── runner.exe.manifest
│ │ │ │ ├── flutter_window.h
│ │ │ │ ├── main.cpp
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ ├── utils.cpp
│ │ │ │ ├── flutter_window.cpp
│ │ │ │ ├── Runner.rc
│ │ │ │ └── win32_window.h
│ │ │ ├── flutter
│ │ │ │ ├── generated_plugin_registrant.cc
│ │ │ │ ├── generated_plugin_registrant.h
│ │ │ │ ├── generated_plugins.cmake
│ │ │ │ └── CMakeLists.txt
│ │ │ ├── .gitignore
│ │ │ └── CMakeLists.txt
│ │ ├── pubspec.yaml
│ │ ├── README.md
│ │ ├── .gitignore
│ │ ├── .metadata
│ │ └── analysis_options.yaml
│ ├── android
│ │ ├── src
│ │ │ └── main
│ │ │ │ └── AndroidManifest.xml
│ │ ├── .gitignore
│ │ ├── settings.gradle
│ │ ├── build.gradle
│ │ └── CMakeLists.txt
│ ├── analysis_options.yaml
│ ├── lib
│ │ ├── utils
│ │ │ ├── json_utils.dart
│ │ │ ├── mnemonic_utils.dart
│ │ │ └── hex_utils.dart
│ │ ├── model
│ │ │ ├── witness.dart
│ │ │ ├── storage_slot.dart
│ │ │ ├── tx_pointer.dart
│ │ │ ├── utxo_id.dart
│ │ │ ├── transaction_cost.dart
│ │ │ ├── call_result.dart
│ │ │ ├── fuel_address.dart
│ │ │ ├── input.dart
│ │ │ ├── transaction.dart
│ │ │ └── output.dart
│ │ ├── flutter_fuels.dart
│ │ ├── fuel_utils
│ │ │ ├── platform_impl
│ │ │ │ ├── js_interop
│ │ │ │ │ └── js_fuels_utils.dart
│ │ │ │ ├── base_fuel_utils.dart
│ │ │ │ ├── stub_fuel_utils.dart
│ │ │ │ └── web_fuel_utils.dart
│ │ │ └── fuel_utils.dart
│ │ ├── js_wallet_injector.dart
│ │ ├── wallet
│ │ │ ├── platform_impl
│ │ │ │ ├── base_wallet.dart
│ │ │ │ ├── stub_wallet.dart
│ │ │ │ └── js_interop
│ │ │ │ │ └── js_fuels_wallet.dart
│ │ │ └── dart_wallet_unlocked.dart
│ │ ├── js
│ │ │ └── wallet.js.LICENSE.txt
│ │ ├── ffi
│ │ │ └── mobile_wrapper.dart
│ │ └── flutter_fuels_bindings_generated.dart
│ ├── web
│ │ ├── tsconfig.json
│ │ ├── package.json
│ │ └── webpack
│ │ │ └── webpack.config.js
│ ├── windows
│ │ ├── .gitignore
│ │ └── CMakeLists.txt
│ ├── src
│ │ ├── CMakeLists.txt
│ │ ├── flutter_fuels.c
│ │ └── flutter_fuels.h
│ ├── ffigen.yaml
│ ├── README.md
│ ├── .gitignore
│ ├── linux
│ │ └── CMakeLists.txt
│ ├── pubspec.yaml
│ ├── .metadata
│ └── test
│ │ ├── fuel_utils
│ │ └── fuel_utils_test.dart
│ │ └── model
│ │ └── fuel_address_test.dart
└── fuels
│ ├── lib
│ ├── src
│ │ └── fuels_base.dart
│ └── fuels.dart
│ ├── native
│ ├── .gitignore
│ ├── src
│ │ ├── features.rs
│ │ ├── model.rs
│ │ ├── model
│ │ │ ├── error.rs
│ │ │ ├── witness.rs
│ │ │ ├── output.rs
│ │ │ ├── input.rs
│ │ │ └── receipt.rs
│ │ ├── lib.rs
│ │ ├── features
│ │ │ ├── crypto.rs
│ │ │ └── wallet.rs
│ │ └── api.rs
│ └── Cargo.toml
│ ├── analysis_options.yaml
│ ├── .gitignore
│ ├── README.md
│ ├── pubspec.yaml
│ ├── test
│ ├── features
│ │ ├── crypto_test.dart
│ │ ├── transaction_test.dart
│ │ └── wallet_test.dart
│ └── test_utils.dart
│ └── justfile
├── rust-toolchain.toml
├── Cargo.toml
├── .fvm
└── fvm_config.json
├── pubspec.yaml
├── scripts
├── build-web.sh
├── version.sh
├── build-android.sh
└── build-apple.sh
├── .github
├── workflows
│ ├── publish-fuels-release.yml
│ ├── publish-flutter_fuels-release.yml
│ ├── publish-pub-dev-release.yml
│ ├── create-release.yml
│ ├── run_codegen.yml
│ └── publish-github-release.yml
└── actions
│ ├── extract_package_version
│ └── action.yaml
│ └── initialize
│ └── action.yaml
├── .cargo
└── config.toml
├── .gitignore
├── melos.yaml
├── README.md
└── analysis_options.yaml
/packages/flutter_fuels/ios/Frameworks/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/macos/Frameworks/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/rust-toolchain.toml:
--------------------------------------------------------------------------------
1 | [toolchain]
2 | channel = "1.90.0"
3 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/linux/.gitignore:
--------------------------------------------------------------------------------
1 | flutter/ephemeral
2 |
--------------------------------------------------------------------------------
/packages/fuels/lib/src/fuels_base.dart:
--------------------------------------------------------------------------------
1 | export 'bridge_generated.dart';
2 |
--------------------------------------------------------------------------------
/Cargo.toml:
--------------------------------------------------------------------------------
1 | [workspace]
2 | resolver = "2"
3 | members = ["packages/fuels/native"]
4 |
--------------------------------------------------------------------------------
/packages/fuels/native/.gitignore:
--------------------------------------------------------------------------------
1 | # Rust library related
2 | Cargo.lock
3 | target
4 |
--------------------------------------------------------------------------------
/.fvm/fvm_config.json:
--------------------------------------------------------------------------------
1 | {
2 | "flutterSdkVersion": "3.19.6",
3 | "flavors": {}
4 | }
5 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/macos/.gitignore:
--------------------------------------------------------------------------------
1 | Flutter/
2 | Frameworks/*
3 | !Frameworks/.gitkeep
4 |
--------------------------------------------------------------------------------
/packages/fuels/native/src/features.rs:
--------------------------------------------------------------------------------
1 | pub mod wallet;
2 | pub mod crypto;
3 | pub mod transaction;
4 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/ios/Runner/Runner-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | #import "GeneratedPluginRegistrant.h"
2 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/ios/.gitignore:
--------------------------------------------------------------------------------
1 | Flutter/
2 | Runner/
3 | Frameworks/*
4 | !Frameworks/.gitkeep
5 |
--------------------------------------------------------------------------------
/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: fuels_dart
2 |
3 | environment:
4 | sdk: '>=2.18.2 <4.0.0'
5 |
6 | dependencies:
7 | melos: ^6.2.0
8 |
--------------------------------------------------------------------------------
/packages/fuels/analysis_options.yaml:
--------------------------------------------------------------------------------
1 | include: ../../analysis_options.yaml
2 |
3 | analyzer:
4 | exclude:
5 | - '**/bridge_generated.*'
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/web/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Fuelet/fuels-dart/HEAD/packages/flutter_fuels/example/web/favicon.png
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx1536M
2 | android.useAndroidX=true
3 | android.enableJetifier=true
4 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/macos/Runner/Configs/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include "../../Flutter/Flutter-Debug.xcconfig"
2 | #include "Warnings.xcconfig"
3 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/macos/Runner/Configs/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include "../../Flutter/Flutter-Release.xcconfig"
2 | #include "Warnings.xcconfig"
3 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/web/icons/Icon-192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Fuelet/fuels-dart/HEAD/packages/flutter_fuels/example/web/icons/Icon-192.png
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/web/icons/Icon-512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Fuelet/fuels-dart/HEAD/packages/flutter_fuels/example/web/icons/Icon-512.png
--------------------------------------------------------------------------------
/packages/fuels/native/src/model.rs:
--------------------------------------------------------------------------------
1 | pub mod transaction;
2 | pub mod error;
3 | pub mod receipt;
4 | pub mod input;
5 | pub mod output;
6 | pub mod witness;
7 |
--------------------------------------------------------------------------------
/scripts/build-web.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -e
4 |
5 | npm --prefix packages/flutter_fuels/web install
6 | npm --prefix packages/flutter_fuels/web run build
7 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/macos/.gitignore:
--------------------------------------------------------------------------------
1 | # Flutter-related
2 | **/Flutter/ephemeral/
3 | **/Pods/
4 |
5 | # Xcode-related
6 | **/dgph
7 | **/xcuserdata/
8 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/ios/Flutter/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
2 | #include "Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/packages/fuels/lib/fuels.dart:
--------------------------------------------------------------------------------
1 | /// Support for doing something awesome.
2 | ///
3 | /// More dartdocs go here.
4 | library fuels;
5 |
6 | export 'src/fuels_base.dart';
7 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/ios/Flutter/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
2 | #include "Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/web/icons/Icon-maskable-192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Fuelet/fuels-dart/HEAD/packages/flutter_fuels/example/web/icons/Icon-maskable-192.png
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/web/icons/Icon-maskable-512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Fuelet/fuels-dart/HEAD/packages/flutter_fuels/example/web/icons/Icon-maskable-512.png
--------------------------------------------------------------------------------
/packages/flutter_fuels/android/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/windows/runner/resources/app_icon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Fuelet/fuels-dart/HEAD/packages/flutter_fuels/example/windows/runner/resources/app_icon.ico
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/macos/Flutter/Flutter-Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
2 | #include "ephemeral/Flutter-Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/macos/Flutter/Flutter-Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
2 | #include "ephemeral/Flutter-Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/analysis_options.yaml:
--------------------------------------------------------------------------------
1 | include: package:flutter_lints/flutter.yaml
2 |
3 | # Additional information about this file can be found at
4 | # https://dart.dev/guides/language/analysis-options
--------------------------------------------------------------------------------
/packages/fuels/native/src/model/error.rs:
--------------------------------------------------------------------------------
1 | use std::error::Error;
2 |
3 | /// Result with error which can hold any type that implements the Error trait
4 | pub type CustomResult = Result>;
5 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/lib/utils/json_utils.dart:
--------------------------------------------------------------------------------
1 | BigInt parseBigInt(String bn) {
2 | String withoutPrefix = bn.startsWith('0x') ? bn.substring(2) : bn;
3 | return BigInt.parse(withoutPrefix, radix: 16);
4 | }
5 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Fuelet/fuels-dart/HEAD/packages/flutter_fuels/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Fuelet/fuels-dart/HEAD/packages/flutter_fuels/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Fuelet/fuels-dart/HEAD/packages/flutter_fuels/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Fuelet/fuels-dart/HEAD/packages/flutter_fuels/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/packages/flutter_fuels/ios/Classes/EnforceBundling.swift:
--------------------------------------------------------------------------------
1 | public func dummyMethodToEnforceBundling() -> Int64 {
2 | return dummy_method_to_enforce_bundling()
3 | }
4 | let dummyVar = dummyMethodToEnforceBundling();
5 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/ios/Classes/flutter_fuels.c:
--------------------------------------------------------------------------------
1 | // Relative import to be able to reuse the C sources.
2 | // See the comment in ../{projectName}}.podspec for more information.
3 | #include "../../src/flutter_fuels.c"
4 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/macos/Classes/EnforceBundling.swift:
--------------------------------------------------------------------------------
1 | public func dummyMethodToEnforceBundling() -> Int64 {
2 | return dummy_method_to_enforce_bundling()
3 | }
4 | let dummyVar = dummyMethodToEnforceBundling();
5 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Fuelet/fuels-dart/HEAD/packages/flutter_fuels/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/packages/flutter_fuels/macos/Classes/flutter_fuels.c:
--------------------------------------------------------------------------------
1 | // Relative import to be able to reuse the C sources.
2 | // See the comment in ../{projectName}}.podspec for more information.
3 | #include "../../src/flutter_fuels.c"
4 |
--------------------------------------------------------------------------------
/packages/fuels/native/src/lib.rs:
--------------------------------------------------------------------------------
1 | mod bridge_generated; /* AUTO INJECTED BY flutter_rust_bridge. This line may not be accurate, and you can change it according to your needs. */
2 | mod api;
3 | mod model;
4 | mod features;
5 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Fuelet/fuels-dart/HEAD/packages/flutter_fuels/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Fuelet/fuels-dart/HEAD/packages/flutter_fuels/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Fuelet/fuels-dart/HEAD/packages/flutter_fuels/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Fuelet/fuels-dart/HEAD/packages/flutter_fuels/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Fuelet/fuels-dart/HEAD/packages/flutter_fuels/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Fuelet/fuels-dart/HEAD/packages/flutter_fuels/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Fuelet/fuels-dart/HEAD/packages/flutter_fuels/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Fuelet/fuels-dart/HEAD/packages/flutter_fuels/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Fuelet/fuels-dart/HEAD/packages/flutter_fuels/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/linux/main.cc:
--------------------------------------------------------------------------------
1 | #include "my_application.h"
2 |
3 | int main(int argc, char** argv) {
4 | g_autoptr(MyApplication) app = my_application_new();
5 | return g_application_run(G_APPLICATION(app), argc, argv);
6 | }
7 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Fuelet/fuels-dart/HEAD/packages/flutter_fuels/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Fuelet/fuels-dart/HEAD/packages/flutter_fuels/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Fuelet/fuels-dart/HEAD/packages/flutter_fuels/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Fuelet/fuels-dart/HEAD/packages/flutter_fuels/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Fuelet/fuels-dart/HEAD/packages/flutter_fuels/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Fuelet/fuels-dart/HEAD/packages/flutter_fuels/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Fuelet/fuels-dart/HEAD/packages/flutter_fuels/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Fuelet/fuels-dart/HEAD/packages/flutter_fuels/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Fuelet/fuels-dart/HEAD/packages/flutter_fuels/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Fuelet/fuels-dart/HEAD/packages/flutter_fuels/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Fuelet/fuels-dart/HEAD/packages/flutter_fuels/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Fuelet/fuels-dart/HEAD/packages/flutter_fuels/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Fuelet/fuels-dart/HEAD/packages/flutter_fuels/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Fuelet/fuels-dart/HEAD/packages/flutter_fuels/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Fuelet/fuels-dart/HEAD/packages/flutter_fuels/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Fuelet/fuels-dart/HEAD/packages/flutter_fuels/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
--------------------------------------------------------------------------------
/packages/flutter_fuels/android/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 | .cxx
10 |
11 | # Ignore Rust binaries
12 | src/main/jniLibs/
13 | *.tar.gz
14 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/macos/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/android/app/src/main/kotlin/com/fuelet/flutter_fuels_example/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.fuelet.flutter_fuels_example
2 |
3 | import io.flutter.embedding.android.FlutterActivity
4 |
5 | class MainActivity: FlutterActivity() {
6 | }
7 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/macos/Flutter/GeneratedPluginRegistrant.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | import FlutterMacOS
6 | import Foundation
7 |
8 |
9 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
10 | }
11 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/lib/model/witness.dart:
--------------------------------------------------------------------------------
1 |
2 |
3 | class Witness {
4 | final String data;
5 |
6 | const Witness({required this.data});
7 |
8 | factory Witness.fromJson(Map data) {
9 | return Witness(data: data['data']);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/linux/flutter/generated_plugin_registrant.cc:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | // clang-format off
6 |
7 | #include "generated_plugin_registrant.h"
8 |
9 |
10 | void fl_register_plugins(FlPluginRegistry* registry) {
11 | }
12 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/windows/flutter/generated_plugin_registrant.cc:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | // clang-format off
6 |
7 | #include "generated_plugin_registrant.h"
8 |
9 |
10 | void RegisterPlugins(flutter::PluginRegistry* registry) {
11 | }
12 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | zipStoreBase=GRADLE_USER_HOME
4 | zipStorePath=wrapper/dists
5 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
6 |
--------------------------------------------------------------------------------
/packages/fuels/native/src/model/witness.rs:
--------------------------------------------------------------------------------
1 | pub struct Witness {
2 | pub data: Vec,
3 | }
4 |
5 | impl From<&fuel_tx::Witness> for Witness {
6 | fn from(model: &fuel_tx::Witness) -> Self {
7 | Witness {
8 | data: model.as_vec().clone(),
9 | }
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/macos/Runner/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | import Cocoa
2 | import FlutterMacOS
3 |
4 | @NSApplicationMain
5 | class AppDelegate: FlutterAppDelegate {
6 | override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
7 | return true
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/packages/fuels/.gitignore:
--------------------------------------------------------------------------------
1 | # Files and directories created by pub.
2 | .dart_tool/
3 | .packages
4 |
5 | # Conventional directory for build outputs.
6 | build/
7 |
8 | # Omit committing pubspec.lock for library packages; see
9 | # https://dart.dev/guides/libraries/private-files#pubspeclock.
10 | pubspec.lock
11 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/lib/utils/mnemonic_utils.dart:
--------------------------------------------------------------------------------
1 | import 'package:bip39_mnemonic/bip39_mnemonic.dart';
2 |
3 | void validateMnemonicPhrase(String mnemonic) {
4 | // tries to construct mnemonic from sentence and throws exceptions
5 | // in case of any errors
6 | Mnemonic.fromSentence(mnemonic, Language.english);
7 | }
8 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/macos/Runner/Release.entitlements:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | com.apple.security.app-sandbox
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/ios/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/lib/model/storage_slot.dart:
--------------------------------------------------------------------------------
1 | class StorageSlot {
2 | final String key;
3 | final String value;
4 |
5 | const StorageSlot({required this.key, required this.value});
6 |
7 | factory StorageSlot.fromJson(Map data) {
8 | return StorageSlot(key: data['key'], value: data['value']);
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/lib/utils/hex_utils.dart:
--------------------------------------------------------------------------------
1 | String addHexPrefix(String hexString) {
2 | if (hexString.startsWith('0x')) {
3 | return hexString;
4 | }
5 | return '0x$hexString';
6 | }
7 |
8 | String removeHexPrefix(String hexString) {
9 | if (hexString.startsWith('0x')) {
10 | return hexString.substring(2);
11 | }
12 | return hexString;
13 | }
14 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/lib/model/tx_pointer.dart:
--------------------------------------------------------------------------------
1 | class TxPointer {
2 | final int blockHeight;
3 | final int txIndex;
4 |
5 | const TxPointer({required this.blockHeight, required this.txIndex});
6 |
7 | factory TxPointer.fromJson(Map data) {
8 | return TxPointer(
9 | blockHeight: data['blockHeight'], txIndex: data['txIndex']);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/web/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "strict": true,
4 | "module": "commonjs",
5 | "target": "es2015",
6 | "esModuleInterop": true,
7 | "sourceMap": true,
8 | "rootDir": "src",
9 | "outDir": "dist/js",
10 | "noEmitOnError": true,
11 | "typeRoots": [
12 | "node_modules/@types"
13 | ]
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/android/.gitignore:
--------------------------------------------------------------------------------
1 | gradle-wrapper.jar
2 | /.gradle
3 | /captures/
4 | /gradlew
5 | /gradlew.bat
6 | /local.properties
7 | GeneratedPluginRegistrant.java
8 |
9 | # Remember to never publicly share your keystore.
10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
11 | key.properties
12 | **/*.keystore
13 | **/*.jks
14 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/lib/model/utxo_id.dart:
--------------------------------------------------------------------------------
1 | class UtxoId {
2 | final String transactionId;
3 | final int outputIndex;
4 |
5 | const UtxoId({required this.transactionId, required this.outputIndex});
6 |
7 | factory UtxoId.fromJson(Map data) {
8 | return UtxoId(
9 | transactionId: data['transactionId'], outputIndex: data['outputIndex']);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/windows/.gitignore:
--------------------------------------------------------------------------------
1 | flutter/
2 |
3 | # Visual Studio user-specific files.
4 | *.suo
5 | *.user
6 | *.userosscache
7 | *.sln.docstates
8 |
9 | # Visual Studio build-related files.
10 | x64/
11 | x86/
12 |
13 | # Visual Studio cache files
14 | # files ending in .cache can be ignored
15 | *.[Cc]ache
16 | # but keep track of directories ending in .cache
17 | !*.[Cc]ache/
18 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/windows/.gitignore:
--------------------------------------------------------------------------------
1 | flutter/ephemeral/
2 |
3 | # Visual Studio user-specific files.
4 | *.suo
5 | *.user
6 | *.userosscache
7 | *.sln.docstates
8 |
9 | # Visual Studio build-related files.
10 | x64/
11 | x86/
12 |
13 | # Visual Studio cache files
14 | # files ending in .cache can be ignored
15 | *.[Cc]ache
16 | # but keep track of directories ending in .cache
17 | !*.[Cc]ache/
18 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/lib/model/transaction_cost.dart:
--------------------------------------------------------------------------------
1 | class TransactionCost {
2 | final int fee;
3 |
4 | TransactionCost({
5 | required this.fee,
6 | });
7 |
8 | factory TransactionCost.fromJson(Map data) {
9 | return TransactionCost(
10 | fee: data['fee'],
11 | );
12 | }
13 |
14 | Map toJson() => {
15 | 'fee': fee,
16 | };
17 | }
18 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/android/settings.gradle:
--------------------------------------------------------------------------------
1 | pluginManagement {
2 | repositories {
3 | google()
4 | mavenCentral()
5 | gradlePluginPortal()
6 | }
7 | }
8 | dependencyResolutionManagement {
9 | repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
10 | repositories {
11 | google()
12 | mavenCentral()
13 | }
14 | }
15 |
16 | rootProject.name = "flutter_fuels"
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md:
--------------------------------------------------------------------------------
1 | # Launch Screen Assets
2 |
3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory.
4 |
5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images.
--------------------------------------------------------------------------------
/.github/workflows/publish-fuels-release.yml:
--------------------------------------------------------------------------------
1 | name: Publish fuels package release
2 |
3 | on:
4 | push:
5 | tags:
6 | - "fuels-*"
7 |
8 | jobs:
9 | publish_github_release:
10 | uses: ./.github/workflows/publish-github-release.yml
11 |
12 | # publish_pub_dev_release:
13 | # needs: publish_github_release
14 | # uses: ./.github/workflows/publish-pub-dev-release.yml
15 | # with:
16 | # package_name: fuels
17 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/linux/flutter/generated_plugin_registrant.h:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | // clang-format off
6 |
7 | #ifndef GENERATED_PLUGIN_REGISTRANT_
8 | #define GENERATED_PLUGIN_REGISTRANT_
9 |
10 | #include
11 |
12 | // Registers Flutter plugins.
13 | void fl_register_plugins(FlPluginRegistry* registry);
14 |
15 | #endif // GENERATED_PLUGIN_REGISTRANT_
16 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/windows/flutter/generated_plugin_registrant.h:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | // clang-format off
6 |
7 | #ifndef GENERATED_PLUGIN_REGISTRANT_
8 | #define GENERATED_PLUGIN_REGISTRANT_
9 |
10 | #include
11 |
12 | // Registers Flutter plugins.
13 | void RegisterPlugins(flutter::PluginRegistry* registry);
14 |
15 | #endif // GENERATED_PLUGIN_REGISTRANT_
16 |
--------------------------------------------------------------------------------
/packages/fuels/README.md:
--------------------------------------------------------------------------------
1 | # fuels
2 |
3 | Dart SDK for Fuel.
4 |
5 | Essentially, this package is wrapper over [Rust fuels-rs SDK](https://github.com/FuelLabs/fuels-rs).
6 |
7 | For more info about SDK functionality and abilities, please check out fuels-rs SDK [documentation](https://fuellabs.github.io/fuels-rs/v0.34.0/index.html).
8 |
9 | ## Documentation
10 | Work on documentation for Dart/Flutter SDK is in progress.
11 |
12 | ## FAQ
13 | TBD
--------------------------------------------------------------------------------
/.github/actions/extract_package_version/action.yaml:
--------------------------------------------------------------------------------
1 | name: Extract package version
2 | description: Extract package version from the git tag
3 |
4 | runs:
5 | using: composite
6 | steps:
7 | - name: Extract package version from the tag
8 | shell: bash
9 | run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
10 |
11 | - name: Print the extracted version
12 | shell: bash
13 | run: echo $RELEASE_VERSION
14 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/macos/Runner/DebugProfile.entitlements:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | com.apple.security.app-sandbox
6 |
7 | com.apple.security.cs.allow-jit
8 |
9 | com.apple.security.network.server
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.github/workflows/publish-flutter_fuels-release.yml:
--------------------------------------------------------------------------------
1 | name: Publish flutter_fuels package release
2 |
3 | on:
4 | push:
5 | tags:
6 | - "flutter_fuels-*"
7 |
8 | jobs:
9 | publish_github_release:
10 | uses: ./.github/workflows/publish-github-release.yml
11 |
12 | # publish_pub_dev_release:
13 | # needs: publish_github_release
14 | # uses: ./.github/workflows/publish-pub-dev-release.yml
15 | # with:
16 | # package_name: flutter_fuels
17 |
--------------------------------------------------------------------------------
/packages/fuels/native/src/features/crypto.rs:
--------------------------------------------------------------------------------
1 | use fuel_crypto::Message;
2 | use fuels::prelude::{Signer, Wallet};
3 | use fuels_accounts::{signers::private_key::PrivateKeySigner, wallet::Unlocked};
4 |
5 | use crate::model::error::CustomResult;
6 |
7 | pub async fn sign_message(
8 | wallet: &Wallet>,
9 | message: String,
10 | ) -> CustomResult {
11 | let signature = wallet.signer().sign(Message::new(message)).await?;
12 | Ok(signature.to_string())
13 | }
14 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/android/app/src/profile/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/ios/Runner/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | import UIKit
2 | import Flutter
3 |
4 | @UIApplicationMain
5 | @objc class AppDelegate: FlutterAppDelegate {
6 | override func application(
7 | _ application: UIApplication,
8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
9 | ) -> Bool {
10 | GeneratedPluginRegistrant.register(with: self)
11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions)
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/linux/my_application.h:
--------------------------------------------------------------------------------
1 | #ifndef FLUTTER_MY_APPLICATION_H_
2 | #define FLUTTER_MY_APPLICATION_H_
3 |
4 | #include
5 |
6 | G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION,
7 | GtkApplication)
8 |
9 | /**
10 | * my_application_new:
11 | *
12 | * Creates a new Flutter-based application.
13 | *
14 | * Returns: a new #MyApplication.
15 | */
16 | MyApplication* my_application_new();
17 |
18 | #endif // FLUTTER_MY_APPLICATION_H_
19 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/lib/model/call_result.dart:
--------------------------------------------------------------------------------
1 | import 'transaction_receipt.dart';
2 |
3 | class CallResult {
4 | final List receipts;
5 |
6 | const CallResult({required this.receipts});
7 |
8 | factory CallResult.fromJson(Map data) {
9 | List receiptsJsonList = data['receipts'];
10 | return CallResult(
11 | receipts: receiptsJsonList
12 | .map((e) => TransactionReceipt.fromJson(e))
13 | .toList());
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/web/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "scripts": {
3 | "build": "webpack --config webpack/webpack.config.js"
4 | },
5 | "devDependencies": {
6 | "ts-loader": "^9.4.2",
7 | "typescript": "^5.6.2",
8 | "webpack": "^5.76.1",
9 | "webpack-cli": "^5.0.1"
10 | },
11 | "dependencies": {
12 | "browserify-sign": ">=4.2.3",
13 | "fuels": "^0.101.3",
14 | "graphql": ">=16.9.0",
15 | "node-polyfill-webpack-plugin": "^2.0.1",
16 | "semver": ">=7.6.2"
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/macos/Runner/MainFlutterWindow.swift:
--------------------------------------------------------------------------------
1 | import Cocoa
2 | import FlutterMacOS
3 |
4 | class MainFlutterWindow: NSWindow {
5 | override func awakeFromNib() {
6 | let flutterViewController = FlutterViewController.init()
7 | let windowFrame = self.frame
8 | self.contentViewController = flutterViewController
9 | self.setFrame(windowFrame, display: true)
10 |
11 | RegisterGeneratedPlugins(registry: flutterViewController)
12 |
13 | super.awakeFromNib()
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/lib/flutter_fuels.dart:
--------------------------------------------------------------------------------
1 | export 'fuel_utils/fuel_utils.dart';
2 |
3 | // model
4 | export 'model/call_result.dart';
5 | export 'model/fuel_address.dart';
6 | export 'model/input.dart';
7 | export 'model/output.dart';
8 | export 'model/storage_slot.dart';
9 | export 'model/transaction.dart';
10 | export 'model/transaction_cost.dart';
11 | export 'model/transaction_receipt.dart';
12 | export 'model/tx_pointer.dart';
13 | export 'model/utxo_id.dart';
14 | export 'model/witness.dart';
15 | export 'wallet/fuel_wallet.dart';
16 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: flutter_fuels_example
2 | description: Demonstrates how to use the flutter_fuels plugin.
3 |
4 | publish_to: 'none'
5 |
6 | version: 1.0.0+1
7 |
8 | environment:
9 | sdk: '>=2.18.6 <3.0.0'
10 |
11 | dependencies:
12 | flutter:
13 | sdk: flutter
14 |
15 | flutter_fuels:
16 | path: ../
17 |
18 | cupertino_icons: ^1.0.2
19 |
20 | dev_dependencies:
21 | flutter_test:
22 | sdk: flutter
23 |
24 | flutter_lints: ^2.0.0
25 |
26 | flutter:
27 | uses-material-design: true
28 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/lib/fuel_utils/platform_impl/js_interop/js_fuels_utils.dart:
--------------------------------------------------------------------------------
1 | @JS('flutter_fuels_utils')
2 | library js_fuels_utils;
3 |
4 | import 'package:js/js.dart';
5 |
6 | @JS('transformTxRequest')
7 | external String transformTxRequest(String transactionRequestJson);
8 |
9 | @JS('getTransactionCost')
10 | external Object getTransactionCost(
11 | String networkUrl,
12 | String transactionRequestJson,
13 | );
14 |
15 | @JS('isUserAccount')
16 | external Object isUserAccount(
17 | String networkUrl,
18 | String address,
19 | );
20 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/android/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
4 | def properties = new Properties()
5 |
6 | assert localPropertiesFile.exists()
7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
8 |
9 | def flutterSdkPath = properties.getProperty("flutter.sdk")
10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
12 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/windows/runner/resource.h:
--------------------------------------------------------------------------------
1 | //{{NO_DEPENDENCIES}}
2 | // Microsoft Visual C++ generated include file.
3 | // Used by Runner.rc
4 | //
5 | #define IDI_APP_ICON 101
6 |
7 | // Next default values for new objects
8 | //
9 | #ifdef APSTUDIO_INVOKED
10 | #ifndef APSTUDIO_READONLY_SYMBOLS
11 | #define _APS_NEXT_RESOURCE_VALUE 102
12 | #define _APS_NEXT_COMMAND_VALUE 40001
13 | #define _APS_NEXT_CONTROL_VALUE 1001
14 | #define _APS_NEXT_SYMED_VALUE 101
15 | #endif
16 | #endif
17 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/android/app/src/main/res/drawable/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/android/app/src/main/res/drawable-v21/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/lib/fuel_utils/platform_impl/base_fuel_utils.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter_fuels/model/transaction.dart';
2 | import 'package:flutter_fuels/model/transaction_cost.dart';
3 |
4 | abstract class BaseFuelUtils {
5 | Future transformTxRequest(dynamic transactionRequestHexOrJson);
6 |
7 | Future getTransactionCost(
8 | {required String networkUrl,
9 | required String transactionRequestHexOrJson});
10 |
11 | Future isUserAccount(
12 | {required String network, required String address});
13 | }
14 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "LaunchImage.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "filename" : "LaunchImage@2x.png",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "universal",
15 | "filename" : "LaunchImage@3x.png",
16 | "scale" : "3x"
17 | }
18 | ],
19 | "info" : {
20 | "version" : 1,
21 | "author" : "xcode"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/packages/fuels/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: fuels
2 | description: Dart FFI bridge to Fuel Rust SDK
3 | version: 1.38.0
4 | homepage: https://github.com/Fuelet/fuels-dart/tree/main/packages/fuels
5 |
6 | environment:
7 | sdk: '>=3.0.0 <4.0.0'
8 |
9 | dependencies:
10 | ffi: ^2.0.1
11 | flutter_rust_bridge: 1.82.6
12 | uuid: ^4.2.1 # must be compatible with flutter_rust_bridge version
13 | freezed_annotation: ^2.2.0
14 | meta: ^1.8.0
15 | collection: ^1.17.0
16 |
17 | dev_dependencies:
18 | test: ^1.24.2
19 | lints: ^2.0.0
20 | ffigen: ^8.0.0
21 | freezed: ^2.3.2
22 | build_runner: ^2.3.2
23 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/ios/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - Flutter (1.0.0)
3 | - flutter_fuels (1.0.0)
4 |
5 | DEPENDENCIES:
6 | - Flutter (from `Flutter`)
7 | - flutter_fuels (from `.symlinks/plugins/flutter_fuels/ios`)
8 |
9 | EXTERNAL SOURCES:
10 | Flutter:
11 | :path: Flutter
12 | flutter_fuels:
13 | :path: ".symlinks/plugins/flutter_fuels/ios"
14 |
15 | SPEC CHECKSUMS:
16 | Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
17 | flutter_fuels: bf6e195e7c2bc6380a11f4d41f0aa8134238b7a8
18 |
19 | PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3
20 |
21 | COCOAPODS: 1.12.1
22 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/src/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # The Flutter tooling requires that developers have CMake 3.10 or later
2 | # installed. You should not increase this version, as doing so will cause
3 | # the plugin to fail to compile for some customers of the plugin.
4 | cmake_minimum_required(VERSION 3.10)
5 |
6 | project(flutter_fuels_library VERSION 0.0.1 LANGUAGES C)
7 |
8 | add_library(flutter_fuels SHARED
9 | "flutter_fuels.c"
10 | )
11 |
12 | set_target_properties(flutter_fuels PROPERTIES
13 | PUBLIC_HEADER flutter_fuels.h
14 | OUTPUT_NAME "flutter_fuels"
15 | )
16 |
17 | target_compile_definitions(flutter_fuels PUBLIC DART_SHARED_LIB)
18 |
--------------------------------------------------------------------------------
/packages/fuels/test/features/crypto_test.dart:
--------------------------------------------------------------------------------
1 | // ignore_for_file: avoid_print
2 |
3 | import 'package:fuels/fuels.dart';
4 | import 'package:test/test.dart';
5 |
6 | import '../test_utils.dart';
7 |
8 | void main() {
9 | test('test signing a message', () async {
10 | WalletUnlocked testWallet = await importWalletWithPK(testWalletPrivateKey);
11 | final signature =
12 | await testWallet.signMessage(message: 'A random message to sign');
13 | expect(signature,
14 | '3b3e392aee0f996186847194c8097481e3741a218e61cfe68f1714dd1dbe68b6d5775baf5095dba5454c6209cdca214622ba27601a82461b849f5093ec6f103f');
15 | });
16 | }
17 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/android/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id "com.android.library"
3 | }
4 |
5 | group = "com.fuelet.flutter_fuels"
6 | version = "1.0"
7 |
8 | android {
9 | namespace = "com.fuelet.flutter_fuels"
10 | compileSdk = 35
11 | ndkVersion = "28.0.12433566"
12 |
13 | defaultConfig {
14 | minSdk = 23
15 | targetSdk = 35
16 | }
17 |
18 | compileOptions {
19 | sourceCompatibility = JavaVersion.VERSION_17
20 | targetCompatibility = JavaVersion.VERSION_17
21 | }
22 |
23 | externalNativeBuild {
24 | cmake {
25 | version "3.22.1"
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/ffigen.yaml:
--------------------------------------------------------------------------------
1 | # Run with `flutter pub run ffigen --config ffigen.yaml`.
2 | name: FlutterFuelsBindings
3 | description: |
4 | Bindings for `src/flutter_fuels.h`.
5 |
6 | Regenerate bindings with `flutter pub run ffigen --config ffigen.yaml`.
7 | output: 'lib/flutter_fuels_bindings_generated.dart'
8 | headers:
9 | entry-points:
10 | - 'src/flutter_fuels.h'
11 | include-directives:
12 | - 'src/flutter_fuels.h'
13 | preamble: |
14 | // ignore_for_file: always_specify_types
15 | // ignore_for_file: camel_case_types
16 | // ignore_for_file: non_constant_identifier_names
17 | comments:
18 | style: any
19 | length: full
20 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/README.md:
--------------------------------------------------------------------------------
1 | # flutter_fuels_example
2 |
3 | Demonstrates how to use the flutter_fuels plugin.
4 |
5 | ## Getting Started
6 |
7 | This project is a starting point for a Flutter application.
8 |
9 | A few resources to get you started if this is your first Flutter project:
10 |
11 | - [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
12 | - [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook)
13 |
14 | For help getting started with Flutter development, view the
15 | [online documentation](https://docs.flutter.dev/), which offers tutorials,
16 | samples, guidance on mobile development, and a full API reference.
17 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/macos/Runner/Configs/Warnings.xcconfig:
--------------------------------------------------------------------------------
1 | WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings
2 | GCC_WARN_UNDECLARED_SELECTOR = YES
3 | CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES
4 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE
5 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES
6 | CLANG_WARN_PRAGMA_PACK = YES
7 | CLANG_WARN_STRICT_PROTOTYPES = YES
8 | CLANG_WARN_COMMA = YES
9 | GCC_WARN_STRICT_SELECTOR_MATCH = YES
10 | CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES
11 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES
12 | GCC_WARN_SHADOW = YES
13 | CLANG_WARN_UNREACHABLE_CODE = YES
14 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/README.md:
--------------------------------------------------------------------------------
1 | # flutter_fuels
2 |
3 | Flutter SDK for Fuel.
4 |
5 | Essentially, this Flutter plugin is a wrapper over [Dart fuels SDK](https://github.com/Fuelet/fuels-dart/tree/main/packages/fuels) which is a wrapper over [Rust fuels-rs SDK](https://github.com/FuelLabs/fuels-rs).
6 |
7 | For more info about SDK functionality and abilities, please check out fuels-rs SDK [documentation](https://fuellabs.github.io/fuels-rs/v0.34.0/index.html).
8 |
9 | ## Documentation
10 | Work on documentation for Dart/Flutter SDK is in progress.
11 |
12 | ## FAQ
13 | ### What platforms are supported?
14 | Currently, SDK supports Android and iOS/macOS platforms. Work on web support is in progress.
--------------------------------------------------------------------------------
/packages/flutter_fuels/lib/js_wallet_injector.dart:
--------------------------------------------------------------------------------
1 | @JS()
2 | library fuel_wallet;
3 |
4 | import 'dart:html';
5 |
6 | import 'package:flutter_web_plugins/flutter_web_plugins.dart';
7 | import 'package:js/js.dart';
8 |
9 | class JsWalletInjector {
10 | static void registerWith(Registrar registrar) {
11 | _loadScript('assets/packages/flutter_fuels/js/wallet.js');
12 | }
13 |
14 | static void _loadScript(String path) {
15 | // Create a new script element
16 | ScriptElement script = ScriptElement();
17 | script.type = 'text/javascript';
18 | script.src = path;
19 |
20 | // Add the script element to the document's head
21 | document.head!.append(script);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/lib/wallet/platform_impl/base_wallet.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter_fuels/wallet/dart_wallet_unlocked.dart';
2 |
3 | abstract class BaseWallet {
4 | Future generateNewWallet({required String networkUrl});
5 |
6 | Future newFromMnemonic({
7 | required String networkUrl,
8 | required String mnemonic,
9 | });
10 |
11 | Future newFromMnemonicAndPath(
12 | {required String networkUrl,
13 | required String mnemonic,
14 | required String derivationPath});
15 |
16 | Future newFromPrivateKey({
17 | required String networkUrl,
18 | required String privateKey,
19 | });
20 | }
21 |
--------------------------------------------------------------------------------
/packages/fuels/native/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "fuels"
3 | version = "1.0.0"
4 | edition = "2021"
5 |
6 | [lib]
7 | crate-type = ["staticlib", "cdylib"]
8 |
9 | [build-dependencies]
10 | flutter_rust_bridge_codegen = "=1.82.6"
11 |
12 | [dependencies]
13 | fuels = "=0.75.1"
14 | fuels-accounts = "=0.75.1" # must be compatible with the fuels version
15 | fuel-crypto = { version = "0.62.0", features = ["random"] } # must be compatible with the fuels version
16 | fuel-tx = "0.62.0" # must be compatible with the fuels version
17 | tokio = { version = "1.14.0", features = ["rt-multi-thread"] }
18 | rand = { version = "0.8.4", default-features = false }
19 | flutter_rust_bridge = "=1.82.6"
20 | async-trait = "0.1.81"
21 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.log
4 | *.pyc
5 | *.swp
6 | .DS_Store
7 | .atom/
8 | .buildlog/
9 | .history
10 | .svn/
11 | migrate_working_dir/
12 |
13 | # IntelliJ related
14 | *.iml
15 | *.ipr
16 | *.iws
17 | .idea/
18 |
19 | # The .vscode folder contains launch configuration and tasks you configure in
20 | # VS Code which you may wish to be included in version control, so this line
21 | # is commented out by default.
22 | #.vscode/
23 |
24 | # Flutter/Dart/Pub related
25 | # Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
26 | /pubspec.lock
27 | **/doc/api/
28 | .dart_tool/
29 | .packages
30 | build/
31 |
32 | node_modules/
33 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/macos/Runner/Configs/AppInfo.xcconfig:
--------------------------------------------------------------------------------
1 | // Application-level settings for the Runner target.
2 | //
3 | // This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the
4 | // future. If not, the values below would default to using the project name when this becomes a
5 | // 'flutter create' template.
6 |
7 | // The application's name. By default this is also the title of the Flutter window.
8 | PRODUCT_NAME = flutter_fuels_example
9 |
10 | // The application's bundle identifier
11 | PRODUCT_BUNDLE_IDENTIFIER = com.fuelet.flutterFuelsExample
12 |
13 | // The copyright displayed in application information
14 | PRODUCT_COPYRIGHT = Copyright © 2023 com.fuelet. All rights reserved.
15 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/lib/js/wallet.js.LICENSE.txt:
--------------------------------------------------------------------------------
1 | /*!
2 | * The buffer module from node.js, for the browser.
3 | *
4 | * @author Feross Aboukhadijeh
5 | * @license MIT
6 | */
7 |
8 | /*!
9 | * The buffer module from node.js, for the browser.
10 | *
11 | * @author Feross Aboukhadijeh
12 | * @license MIT
13 | */
14 |
15 | /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */
16 |
17 | /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
18 |
19 | /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
20 |
21 | /*! safe-buffer. MIT License. Feross Aboukhadijeh */
22 |
--------------------------------------------------------------------------------
/.cargo/config.toml:
--------------------------------------------------------------------------------
1 | [target.aarch64-linux-android]
2 | # Force linker to align segments to 16 KiB pages (needed for new Android devices).
3 | rustflags = [
4 | "-Clink-arg=-Wl,-z,common-page-size=16384",
5 | "-Clink-arg=-Wl,-z,max-page-size=16384",
6 | ]
7 |
8 | [target.armv7-linux-androideabi]
9 | rustflags = [
10 | "-Clink-arg=-Wl,-z,common-page-size=16384",
11 | "-Clink-arg=-Wl,-z,max-page-size=16384",
12 | ]
13 |
14 | [target.x86_64-linux-android]
15 | rustflags = [
16 | "-Clink-arg=-Wl,-z,common-page-size=16384",
17 | "-Clink-arg=-Wl,-z,max-page-size=16384",
18 | ]
19 |
20 | [target.i686-linux-android]
21 | rustflags = [
22 | "-Clink-arg=-Wl,-z,common-page-size=16384",
23 | "-Clink-arg=-Wl,-z,max-page-size=16384",
24 | ]
25 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/ios/.gitignore:
--------------------------------------------------------------------------------
1 | **/dgph
2 | *.mode1v3
3 | *.mode2v3
4 | *.moved-aside
5 | *.pbxuser
6 | *.perspectivev3
7 | **/*sync/
8 | .sconsign.dblite
9 | .tags*
10 | **/.vagrant/
11 | **/DerivedData/
12 | Icon?
13 | **/Pods/
14 | **/.symlinks/
15 | profile
16 | xcuserdata
17 | **/.generated/
18 | Flutter/App.framework
19 | Flutter/Flutter.framework
20 | Flutter/Flutter.podspec
21 | Flutter/Generated.xcconfig
22 | Flutter/ephemeral/
23 | Flutter/app.flx
24 | Flutter/app.zip
25 | Flutter/flutter_assets/
26 | Flutter/flutter_export_environment.sh
27 | ServiceDefinitions.json
28 | Runner/GeneratedPluginRegistrant.*
29 |
30 | # Exceptions to above rules.
31 | !default.mode1v3
32 | !default.mode2v3
33 | !default.pbxuser
34 | !default.perspectivev3
35 |
--------------------------------------------------------------------------------
/.github/actions/initialize/action.yaml:
--------------------------------------------------------------------------------
1 | name: Initialize
2 | description: Common steps for initialization
3 |
4 | runs:
5 | using: composite
6 | steps:
7 | - name: Setup Flutter
8 | uses: subosito/flutter-action@v2
9 | with:
10 | flutter-version: 3.19.6
11 |
12 | - name: Setup Melos
13 | uses: bluefireteam/melos-action@v2
14 | with:
15 | melos-version: 3.1.0
16 |
17 | - name: Setup Zig
18 | uses: goto-bus-stop/setup-zig@v2
19 |
20 | - name: Install LLVM
21 | uses: KyleMayes/install-llvm-action@v1
22 | with:
23 | version: "15"
24 |
25 | - name: Setup Rust
26 | uses: dtolnay/rust-toolchain@stable
27 | with:
28 | toolchain: 1.90.0
29 | components: rustfmt
30 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | lcov.info
2 |
3 | # Miscellaneous
4 | *.class
5 | *.log
6 | *.pyc
7 | *.swp
8 | .DS_Store
9 | .atom/
10 | .buildlog/
11 | .history
12 | .svn/
13 |
14 | # IntelliJ related
15 | *.iml
16 | *.ipr
17 | *.iws
18 | .idea/
19 |
20 | # The .vscode folder contains launch configuration and tasks you configure in
21 | # VS Code which you may wish to be included in version control, so this line
22 | # is commented out by default.
23 | #.vscode/
24 |
25 | # Flutter/Dart/Pub related
26 | pubspec.lock
27 | pubspec_overrides.yaml
28 | **/doc/api/
29 | .dart_tool/
30 | .packages
31 | build/
32 | .pub-cache/
33 | .pub/
34 | .flutter-plugins
35 | .flutter-plugins-dependencies
36 |
37 | # Rust related
38 | /target/
39 | /platform-build
40 | /llvm/
41 |
42 | .fvm/flutter_sdk
43 | .fvmrc
44 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/android/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext.kotlin_version = '1.6.10'
3 | repositories {
4 | google()
5 | mavenCentral()
6 | }
7 |
8 | dependencies {
9 | classpath 'com.android.tools.build:gradle:7.1.2'
10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
11 | }
12 | }
13 |
14 | allprojects {
15 | repositories {
16 | google()
17 | mavenCentral()
18 | }
19 | }
20 |
21 | rootProject.buildDir = '../build'
22 | subprojects {
23 | project.buildDir = "${rootProject.buildDir}/${project.name}"
24 | }
25 | subprojects {
26 | project.evaluationDependsOn(':app')
27 | }
28 |
29 | tasks.register("clean", Delete) {
30 | delete rootProject.buildDir
31 | }
32 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/windows/runner/utils.h:
--------------------------------------------------------------------------------
1 | #ifndef RUNNER_UTILS_H_
2 | #define RUNNER_UTILS_H_
3 |
4 | #include
5 | #include
6 |
7 | // Creates a console for the process, and redirects stdout and stderr to
8 | // it for both the runner and the Flutter library.
9 | void CreateAndAttachConsole();
10 |
11 | // Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string
12 | // encoded in UTF-8. Returns an empty std::string on failure.
13 | std::string Utf8FromUtf16(const wchar_t* utf16_string);
14 |
15 | // Gets the command line arguments passed in as a std::vector,
16 | // encoded in UTF-8. Returns an empty std::vector on failure.
17 | std::vector GetCommandLineArguments();
18 |
19 | #endif // RUNNER_UTILS_H_
20 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/lib/fuel_utils/platform_impl/stub_fuel_utils.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter_fuels/model/transaction.dart';
2 | import 'package:flutter_fuels/model/transaction_cost.dart';
3 |
4 | import 'base_fuel_utils.dart';
5 |
6 | class FuelUtilsImpl extends BaseFuelUtils {
7 | @override
8 | Future transformTxRequest(dynamic transactionRequestHexOrJson) {
9 | throw Exception('Stub implementation');
10 | }
11 |
12 | @override
13 | Future getTransactionCost(
14 | {required String networkUrl,
15 | required String transactionRequestHexOrJson}) {
16 | throw Exception('Stub implementation');
17 | }
18 |
19 | @override
20 | Future isUserAccount(
21 | {required String network, required String address}) {
22 | throw Exception('Stub implementation');
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/.github/workflows/publish-pub-dev-release.yml:
--------------------------------------------------------------------------------
1 | name: Publish pub.dev release
2 | # See https://dart.dev/tools/pub/automated-publishing
3 |
4 | on:
5 | workflow_call:
6 | inputs:
7 | package_name:
8 | description: 'Package to publish'
9 | required: true
10 | type: string
11 |
12 | jobs:
13 | publish_pub_dev_release:
14 | runs-on: ubuntu-latest
15 |
16 | steps:
17 | - uses: actions/checkout@v4
18 | - uses: subosito/flutter-action@v2
19 | - uses: bluefireteam/melos-action@v2
20 | with:
21 | melos-version: '3.1.0'
22 | - name: Dry-run publish to pub.dev
23 | run: melos publish -y --dry-run --no-published --scope=${{ inputs.package_name }}
24 | - name: Publish to pub.dev
25 | run: melos publish -y --no-dry-run --no-published --scope=${{ inputs.package_name }}
26 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/lib/ffi/mobile_wrapper.dart:
--------------------------------------------------------------------------------
1 | import 'dart:ffi';
2 | import 'dart:io';
3 |
4 | import 'package:fuels/fuels.dart';
5 |
6 | typedef ExternalLibrary = DynamicLibrary;
7 |
8 | Fuels? _wrapper;
9 | const _base = 'fuels';
10 | const _flutterLibName = 'flutter_$_base';
11 |
12 | DynamicLibrary createLibraryImpl() {
13 | if (Platform.isIOS) {
14 | return DynamicLibrary.open('$_flutterLibName.framework/$_flutterLibName');
15 | }
16 | if (Platform.isWindows) {
17 | return DynamicLibrary.open('$_base.dll');
18 | }
19 | if (Platform.isMacOS) {
20 | return DynamicLibrary.executable();
21 | }
22 | return DynamicLibrary.open('lib$_base.so');
23 | }
24 |
25 | Fuels createWrapper(ExternalLibrary lib) {
26 | _wrapper ??= FuelsImpl(lib);
27 | return _wrapper!;
28 | }
29 |
30 | Fuels createLib() => createWrapper(createLibraryImpl());
31 |
--------------------------------------------------------------------------------
/scripts/version.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | CURR_VERSION=fuels-v`awk '/^version: /{print $2}' packages/fuels/pubspec.yaml`
4 |
5 | # iOS & macOS
6 | APPLE_HEADER="release_tag_name = '$CURR_VERSION' # generated; do not edit"
7 | sed -i.bak "1 s/.*/$APPLE_HEADER/" packages/flutter_fuels/ios/flutter_fuels.podspec
8 | sed -i.bak "1 s/.*/$APPLE_HEADER/" packages/flutter_fuels/macos/flutter_fuels.podspec
9 | rm packages/flutter_fuels/macos/*.bak packages/flutter_fuels/ios/*.bak
10 |
11 | # CMake platforms (Linux, Windows, and Android)
12 | CMAKE_HEADER="set(LibraryVersion \"$CURR_VERSION\") # generated; do not edit"
13 | for CMAKE_PLATFORM in android linux windows
14 | do
15 | sed -i.bak "1 s/.*/$CMAKE_HEADER/" packages/flutter_fuels/$CMAKE_PLATFORM/CMakeLists.txt
16 | rm packages/flutter_fuels/$CMAKE_PLATFORM/*.bak
17 | done
18 |
19 | git add packages/flutter_fuels/
20 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/web/webpack/webpack.config.js:
--------------------------------------------------------------------------------
1 | const path = require("path");
2 | const NodePolyfillPlugin = require("node-polyfill-webpack-plugin");
3 | module.exports = {
4 | mode: "production",
5 | entry: {
6 | wallet: path.resolve(__dirname, "..", "src", "fuel_wallet.ts"),
7 | },
8 | output: {
9 | path: path.join(__dirname, "../../lib/js"),
10 | filename: "[name].js",
11 | },
12 | resolve: {
13 | extensions: [".ts", ".js"],
14 | },
15 | module: {
16 | rules: [
17 | {
18 | test: /\.tsx?$/,
19 | loader: "ts-loader",
20 | exclude: /node_modules/,
21 | options: {
22 | allowTsInNodeModules: true
23 | }
24 | },
25 | ],
26 | },
27 | plugins: [new NodePolyfillPlugin()],
28 | };
29 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/linux/flutter/generated_plugins.cmake:
--------------------------------------------------------------------------------
1 | #
2 | # Generated file, do not edit.
3 | #
4 |
5 | list(APPEND FLUTTER_PLUGIN_LIST
6 | )
7 |
8 | list(APPEND FLUTTER_FFI_PLUGIN_LIST
9 | flutter_fuels
10 | )
11 |
12 | set(PLUGIN_BUNDLED_LIBRARIES)
13 |
14 | foreach(plugin ${FLUTTER_PLUGIN_LIST})
15 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin})
16 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin)
17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $)
18 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
19 | endforeach(plugin)
20 |
21 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
22 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin})
23 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
24 | endforeach(ffi_plugin)
25 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/windows/flutter/generated_plugins.cmake:
--------------------------------------------------------------------------------
1 | #
2 | # Generated file, do not edit.
3 | #
4 |
5 | list(APPEND FLUTTER_PLUGIN_LIST
6 | )
7 |
8 | list(APPEND FLUTTER_FFI_PLUGIN_LIST
9 | flutter_fuels
10 | )
11 |
12 | set(PLUGIN_BUNDLED_LIBRARIES)
13 |
14 | foreach(plugin ${FLUTTER_PLUGIN_LIST})
15 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin})
16 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin)
17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $)
18 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
19 | endforeach(plugin)
20 |
21 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
22 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin})
23 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
24 | endforeach(ffi_plugin)
25 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.log
4 | *.pyc
5 | *.swp
6 | .DS_Store
7 | .atom/
8 | .buildlog/
9 | .history
10 | .svn/
11 | migrate_working_dir/
12 |
13 | # IntelliJ related
14 | *.iml
15 | *.ipr
16 | *.iws
17 | .idea/
18 |
19 | # The .vscode folder contains launch configuration and tasks you configure in
20 | # VS Code which you may wish to be included in version control, so this line
21 | # is commented out by default.
22 | #.vscode/
23 |
24 | # Flutter/Dart/Pub related
25 | **/doc/api/
26 | **/ios/Flutter/.last_build_id
27 | .dart_tool/
28 | .flutter-plugins
29 | .flutter-plugins-dependencies
30 | .packages
31 | .pub-cache/
32 | .pub/
33 | /build/
34 |
35 | # Symbolication related
36 | app.*.symbols
37 |
38 | # Obfuscation related
39 | app.*.map.json
40 |
41 | # Android Studio will place build artifacts here
42 | /android/app/debug
43 | /android/app/profile
44 | /android/app/release
45 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/ios/Flutter/AppFrameworkInfo.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | App
9 | CFBundleIdentifier
10 | io.flutter.flutter.app
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | App
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1.0
23 | MinimumOSVersion
24 | 11.0
25 |
26 |
27 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/src/flutter_fuels.c:
--------------------------------------------------------------------------------
1 | #include "flutter_fuels.h"
2 |
3 | // A very short-lived native function.
4 | //
5 | // For very short-lived functions, it is fine to call them on the main isolate.
6 | // They will block the Dart execution while running the native function, so
7 | // only do this for native functions which are guaranteed to be short-lived.
8 | FFI_PLUGIN_EXPORT intptr_t sum(intptr_t a, intptr_t b) { return a + b; }
9 |
10 | // A longer-lived native function, which occupies the thread calling it.
11 | //
12 | // Do not call these kind of native functions in the main isolate. They will
13 | // block Dart execution. This will cause dropped frames in Flutter applications.
14 | // Instead, call these native functions on a separate isolate.
15 | FFI_PLUGIN_EXPORT intptr_t sum_long_running(intptr_t a, intptr_t b) {
16 | // Simulate work.
17 | #if _WIN32
18 | Sleep(5000);
19 | #else
20 | usleep(5000 * 1000);
21 | #endif
22 | return a + b;
23 | }
24 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/windows/runner/runner.exe.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PerMonitorV2
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/lib/wallet/platform_impl/stub_wallet.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter_fuels/wallet/dart_wallet_unlocked.dart';
2 |
3 | import 'base_wallet.dart';
4 |
5 | class FuelWalletImpl extends BaseWallet {
6 | @override
7 | Future generateNewWallet({required String networkUrl}) {
8 | throw Exception('Stub implementation');
9 | }
10 |
11 | @override
12 | Future newFromMnemonic({
13 | required String networkUrl,
14 | required String mnemonic,
15 | }) {
16 | throw Exception('Stub implementation');
17 | }
18 |
19 | @override
20 | Future newFromMnemonicAndPath(
21 | {required String networkUrl,
22 | required String mnemonic,
23 | required String derivationPath}) {
24 | throw Exception('Stub implementation');
25 | }
26 |
27 | @override
28 | Future newFromPrivateKey({
29 | required String networkUrl,
30 | required String privateKey,
31 | }) {
32 | throw Exception('Stub implementation');
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/linux/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | set(LibraryVersion "fuels-v1.38.0") # generated; do not edit
2 | # installed. You should not increase this version, as doing so will cause
3 | # the plugin to fail to compile for some customers of the plugin.
4 | cmake_minimum_required(VERSION 3.10)
5 |
6 | # Project-level configuration.
7 | set(PROJECT_NAME "flutter_fuels")
8 | project(${PROJECT_NAME} LANGUAGES CXX)
9 |
10 | # Invoke the build for native code shared with the other target platforms.
11 | # This can be changed to accomodate different builds.
12 | add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/../src" "${CMAKE_CURRENT_BINARY_DIR}/shared")
13 |
14 | # List of absolute paths to libraries that should be bundled with the plugin.
15 | # This list could contain prebuilt libraries, or libraries created by an
16 | # external build triggered from this build file.
17 | set(flutter_fuels_bundled_libraries
18 | # Defined in ../src/CMakeLists.txt.
19 | # This can be changed to accomodate different builds.
20 | $
21 | PARENT_SCOPE
22 | )
23 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/.metadata:
--------------------------------------------------------------------------------
1 | # This file tracks properties of this Flutter project.
2 | # Used by Flutter tool to assess capabilities and perform upgrades etc.
3 | #
4 | # This file should be version controlled.
5 |
6 | version:
7 | revision: 12cb4eb7a009f52b347b62ade7cb4854b926af72
8 | channel: stable
9 |
10 | project_type: app
11 |
12 | # Tracks metadata for the flutter migrate command
13 | migration:
14 | platforms:
15 | - platform: root
16 | create_revision: 12cb4eb7a009f52b347b62ade7cb4854b926af72
17 | base_revision: 12cb4eb7a009f52b347b62ade7cb4854b926af72
18 | - platform: web
19 | create_revision: 12cb4eb7a009f52b347b62ade7cb4854b926af72
20 | base_revision: 12cb4eb7a009f52b347b62ade7cb4854b926af72
21 |
22 | # User provided section
23 |
24 | # List of Local paths (relative to this file) that should be
25 | # ignored by the migrate tool.
26 | #
27 | # Files that are not part of the templates will be ignored by default.
28 | unmanaged_files:
29 | - 'lib/main.dart'
30 | - 'ios/Runner.xcodeproj/project.pbxproj'
31 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/lib/wallet/dart_wallet_unlocked.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter_fuels/model/call_result.dart';
2 |
3 | abstract class DartWalletUnlocked {
4 | String? get mnemonicPhrase;
5 |
6 | String get b256Address;
7 |
8 | String get privateKey;
9 |
10 | String get networkUrl;
11 |
12 | Future signMessage({required String message});
13 |
14 | /// Takes hex string on mobile and json tx request on web
15 | Future sendTransaction({
16 | required String transactionRequestHexOrJson,
17 | required bool returnTransactionResponse,
18 | });
19 |
20 | // TODO: move to a platform independent implementation
21 | /// Takes hex string on mobile and json tx request on web
22 | Future simulateTransaction(
23 | {required String transactionRequestHexOrJson});
24 |
25 | /// Returns hex string on mobile and json tx request on web
26 | Future<(String, String)> genTransferTransactionRequest({
27 | required String destinationB256Address,
28 | required int fractionalAmount,
29 | required String assetId,
30 | });
31 | }
32 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/web/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "example",
3 | "short_name": "example",
4 | "start_url": ".",
5 | "display": "standalone",
6 | "background_color": "#0175C2",
7 | "theme_color": "#0175C2",
8 | "description": "A new Flutter project.",
9 | "orientation": "portrait-primary",
10 | "prefer_related_applications": false,
11 | "icons": [
12 | {
13 | "src": "icons/Icon-192.png",
14 | "sizes": "192x192",
15 | "type": "image/png"
16 | },
17 | {
18 | "src": "icons/Icon-512.png",
19 | "sizes": "512x512",
20 | "type": "image/png"
21 | },
22 | {
23 | "src": "icons/Icon-maskable-192.png",
24 | "sizes": "192x192",
25 | "type": "image/png",
26 | "purpose": "maskable"
27 | },
28 | {
29 | "src": "icons/Icon-maskable-512.png",
30 | "sizes": "512x512",
31 | "type": "image/png",
32 | "purpose": "maskable"
33 | }
34 | ]
35 | }
36 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/src/flutter_fuels.h:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 |
5 | #if _WIN32
6 | #include
7 | #else
8 | #include
9 | #include
10 | #endif
11 |
12 | #if _WIN32
13 | #define FFI_PLUGIN_EXPORT __declspec(dllexport)
14 | #else
15 | #define FFI_PLUGIN_EXPORT
16 | #endif
17 |
18 | // A very short-lived native function.
19 | //
20 | // For very short-lived functions, it is fine to call them on the main isolate.
21 | // They will block the Dart execution while running the native function, so
22 | // only do this for native functions which are guaranteed to be short-lived.
23 | FFI_PLUGIN_EXPORT intptr_t sum(intptr_t a, intptr_t b);
24 |
25 | // A longer lived native function, which occupies the thread calling it.
26 | //
27 | // Do not call these kind of native functions in the main isolate. They will
28 | // block Dart execution. This will cause dropped frames in Flutter applications.
29 | // Instead, call these native functions on a separate isolate.
30 | FFI_PLUGIN_EXPORT intptr_t sum_long_running(intptr_t a, intptr_t b);
31 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/windows/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | set(LibraryVersion "fuels-v1.38.0") # generated; do not edit
2 | # installed that includes CMake 3.14 or later. You should not increase this
3 | # version, as doing so will cause the plugin to fail to compile for some
4 | # customers of the plugin.
5 | cmake_minimum_required(VERSION 3.14)
6 |
7 | # Project-level configuration.
8 | set(PROJECT_NAME "flutter_fuels")
9 | project(${PROJECT_NAME} LANGUAGES CXX)
10 |
11 | # Invoke the build for native code shared with the other target platforms.
12 | # This can be changed to accomodate different builds.
13 | add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/../src" "${CMAKE_CURRENT_BINARY_DIR}/shared")
14 |
15 | # List of absolute paths to libraries that should be bundled with the plugin.
16 | # This list could contain prebuilt libraries, or libraries created by an
17 | # external build triggered from this build file.
18 | set(flutter_fuels_bundled_libraries
19 | # Defined in ../src/CMakeLists.txt.
20 | # This can be changed to accomodate different builds.
21 | $
22 | PARENT_SCOPE
23 | )
24 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/windows/runner/flutter_window.h:
--------------------------------------------------------------------------------
1 | #ifndef RUNNER_FLUTTER_WINDOW_H_
2 | #define RUNNER_FLUTTER_WINDOW_H_
3 |
4 | #include
5 | #include
6 |
7 | #include
8 |
9 | #include "win32_window.h"
10 |
11 | // A window that does nothing but host a Flutter view.
12 | class FlutterWindow : public Win32Window {
13 | public:
14 | // Creates a new FlutterWindow hosting a Flutter view running |project|.
15 | explicit FlutterWindow(const flutter::DartProject& project);
16 | virtual ~FlutterWindow();
17 |
18 | protected:
19 | // Win32Window:
20 | bool OnCreate() override;
21 | void OnDestroy() override;
22 | LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam,
23 | LPARAM const lparam) noexcept override;
24 |
25 | private:
26 | // The project to run.
27 | flutter::DartProject project_;
28 |
29 | // The Flutter instance hosted by this window.
30 | std::unique_ptr flutter_controller_;
31 | };
32 |
33 | #endif // RUNNER_FLUTTER_WINDOW_H_
34 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/android/app/src/main/res/values-night/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: flutter_fuels
2 | description: Flutter Plugin for Fuel SDK
3 | version: 0.0.75
4 | homepage: https://github.com/Fuelet/fuels-dart/tree/main/packages/flutter_fuels
5 |
6 | environment:
7 | sdk: '>=3.0.0 <4.0.0'
8 | flutter: ">=2.11.0"
9 |
10 | dependencies:
11 | flutter:
12 | sdk: flutter
13 | flutter_web_plugins:
14 | sdk: flutter
15 | plugin_platform_interface: ^2.0.2
16 | fuels: ^1.38.0
17 | js: ^0.6.5
18 | bip39_mnemonic: ^3.0.6
19 | convert: ^3.1.1
20 | dart_bech32: ^2.0.0
21 | equatable: ^2.0.5
22 | dio: '>=5.0.0'
23 | crypto: ^3.0.3
24 | dev_dependencies:
25 | flutter_lints: ^2.0.0
26 | test: ^1.24.2
27 |
28 | flutter:
29 | assets:
30 | - packages/flutter_fuels/js/wallet.js
31 | plugin:
32 | platforms:
33 | android:
34 | ffiPlugin: true
35 | ios:
36 | ffiPlugin: true
37 | linux:
38 | ffiPlugin: true
39 | macos:
40 | ffiPlugin: true
41 | windows:
42 | ffiPlugin: true
43 | web:
44 | pluginClass: JsWalletInjector
45 | fileName: js_wallet_injector.dart
46 |
--------------------------------------------------------------------------------
/scripts/build-android.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -e
4 |
5 | # Setup
6 | BUILD_DIR=platform-build
7 | mkdir $BUILD_DIR
8 | cd $BUILD_DIR
9 |
10 | # Create the jniLibs build directory
11 | JNI_DIR=jniLibs
12 | mkdir -p $JNI_DIR
13 |
14 | # Set up cargo-ndk
15 | cargo install --version 3.5.4 cargo-ndk
16 | rustup target add \
17 | aarch64-linux-android \
18 | armv7-linux-androideabi \
19 | x86_64-linux-android \
20 | i686-linux-android
21 |
22 | # Build the android libraries in the jniLibs directory
23 | cargo ndk -o $JNI_DIR \
24 | --manifest-path ../Cargo.toml \
25 | -t armeabi-v7a \
26 | -t arm64-v8a \
27 | -t x86 \
28 | -t x86_64 \
29 | build --release
30 |
31 | # Archive the dynamic libs
32 | cd $JNI_DIR
33 | tar -czvf ../android.tar.gz *
34 | cd -
35 |
36 | # Cleanup
37 | rm -rf $JNI_DIR
38 | cd ..
39 |
40 | # Copy the binary to the needed location
41 | CURR_VERSION=fuels-v`awk '/^version: /{print $2}' packages/fuels/pubspec.yaml`
42 | cp platform-build/android.tar.gz packages/flutter_fuels/android/$CURR_VERSION.tar.gz
43 | echo "[android] Copied file!"
--------------------------------------------------------------------------------
/.github/workflows/create-release.yml:
--------------------------------------------------------------------------------
1 | name: Create Release(s)
2 |
3 | on:
4 | workflow_dispatch:
5 | inputs:
6 | version_parameters:
7 | description: 'Parameters to pass to "melos version"'
8 | required: true
9 | default: ' '
10 | type: choice
11 | options:
12 | - '--'
13 | - '--prerelease'
14 | - '--graduate'
15 |
16 | jobs:
17 | create_release:
18 | runs-on: ubuntu-latest
19 |
20 | steps:
21 | - uses: actions/checkout@v4
22 | with:
23 | token: ${{ secrets.BOT_ACCESS_TOKEN }}
24 | fetch-depth: 0
25 | - name: Setup git
26 | run: |
27 | git config user.name "Ilya Virnik"
28 | git config user.email "ilya.virnik@gmail.com"
29 | - uses: subosito/flutter-action@v2
30 | - uses: bluefireteam/melos-action@v2
31 | with:
32 | melos-version: '3.1.0'
33 |
34 | - name: Create the new version(s)
35 | run: melos version --yes ${{ inputs.version_parameters }}
36 |
37 | - name: Push created version commit
38 | run: git push
39 | - name: Push modified tags
40 | run: git push --tags
41 |
--------------------------------------------------------------------------------
/packages/fuels/justfile:
--------------------------------------------------------------------------------
1 | default: clean gen
2 |
3 | clean:
4 | rm -f native/src/bridge_generated.rs
5 | rm -f native/src/bridge_generated.io.rs
6 | rm -f native/src/bridge_generated.web.rs
7 | sed -i '/mod bridge_generated;/d' native/src/lib.rs
8 | # sed -i '' '/mod bridge_generated;/d' native/src/lib.rs # Mac
9 |
10 | gen:
11 | cargo build --manifest-path=native/Cargo.toml
12 | flutter pub get
13 | # fvm flutter pub get
14 | MAX_RETRIES=3; ATTEMPT=1; while [ $ATTEMPT -le $MAX_RETRIES ]; do \
15 | flutter_rust_bridge_codegen \
16 | --rust-input native/src/api.rs \
17 | --dart-output lib/src/bridge_generated.dart \
18 | --c-output '../flutter_fuels/ios/Classes/frb.h' \
19 | --extra-c-output-path '../flutter_fuels/macos/Classes/' \
20 | --llvm-path /opt/homebrew/opt/llvm \
21 | && break || ((ATTEMPT++)); echo 'Retrying...';\
22 | done
23 | dart run build_runner build --delete-conflicting-outputs
24 | dart format .
25 | # fvm dart run build_runner build --delete-conflicting-outputs
26 | # fvm dart format .
27 | cargo build --manifest-path=native/Cargo.toml
28 |
29 | # vim:expandtab:sw=4:ts=4
30 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/macos/Runner/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIconFile
10 |
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | $(PRODUCT_NAME)
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | $(FLUTTER_BUILD_NAME)
21 | CFBundleVersion
22 | $(FLUTTER_BUILD_NUMBER)
23 | LSMinimumSystemVersion
24 | $(MACOSX_DEPLOYMENT_TARGET)
25 | NSHumanReadableCopyright
26 | $(PRODUCT_COPYRIGHT)
27 | NSMainNibFile
28 | MainMenu
29 | NSPrincipalClass
30 | NSApplication
31 |
32 |
33 |
--------------------------------------------------------------------------------
/.github/workflows/run_codegen.yml:
--------------------------------------------------------------------------------
1 | name: Run flutter_rust_bridge codegen
2 |
3 | on: workflow_dispatch
4 |
5 | permissions:
6 | contents: write
7 |
8 | jobs:
9 | codegen:
10 | runs-on: ubuntu-latest
11 |
12 | steps:
13 | - name: Checkout the repository
14 | uses: actions/checkout@v4
15 |
16 | - uses: ./.github/actions/initialize
17 |
18 | - name: Setup Just
19 | uses: extractions/setup-just@v1
20 | with:
21 | just-version: 1.9.0
22 |
23 | - name: Install FRB
24 | run: cargo install --version 1.82.6 flutter_rust_bridge_codegen
25 |
26 | - name: Install cargo-expand
27 | run: cargo install cargo-expand
28 |
29 | - name: FRB codegen
30 | uses: nick-fields/retry@v2
31 | with:
32 | timeout_minutes: 10
33 | max_attempts: 2
34 | command: melos run frb-gen
35 |
36 | - name: Build web
37 | run: melos run build:web
38 |
39 | - name: Commit
40 | run: |
41 | git add -A
42 | git config --global user.name 'Github Actions'
43 | git config --global user.email 'actions@github.com'
44 | git commit -am "Codegen" || echo "Nothing to commit"
45 | git push || echo "Nothing to push"
46 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/lib/wallet/platform_impl/js_interop/js_fuels_wallet.dart:
--------------------------------------------------------------------------------
1 | @JS('flutter_fuels_wallet')
2 | library js_fuels_wallet;
3 |
4 | import 'package:js/js.dart';
5 |
6 | @JS('generateNewWallet')
7 | external Object generateNewWallet();
8 |
9 | @JS('newWalletFromMnemonic')
10 | external Object newWalletFromMnemonic(String mnemonic);
11 |
12 | @JS('newWalletFromMnemonicAndPath')
13 | external Object newWalletFromMnemonicAndPath(
14 | String mnemonic, String path);
15 |
16 | @JS('newWalletFromPrivateKey')
17 | external Object newWalletFromPrivateKey(String privateKey);
18 |
19 | @JS('signMessage')
20 | external Object signMessage(String networkUrl, String message);
21 |
22 | @JS('sendTransaction')
23 | external Object sendTransaction(
24 | String privateKey,
25 | String networkUrl,
26 | String transactionRequestJson,
27 | bool returnTransactionResponse,
28 | );
29 |
30 | @JS('simulateTransaction')
31 | external Object simulateTransaction(
32 | String privateKey,
33 | String networkUrl,
34 | String transactionRequestJson,
35 | );
36 |
37 | @JS('genTransferTransactionRequest')
38 | external Object genTransferTransactionRequest(
39 | String privateKey,
40 | String networkUrl,
41 | String destinationB256Address,
42 | num fractionalAmount,
43 | String assetId,
44 | );
45 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/ios/flutter_fuels.podspec:
--------------------------------------------------------------------------------
1 | release_tag_name = 'fuels-v1.38.0' # generated; do not edit
2 |
3 | # We cannot distribute the XCFramework alongside the library directly,
4 | # so we have to fetch the correct version here.
5 | framework_name = 'FlutterFuels.xcframework'
6 | remote_zip_name = "#{framework_name}.zip"
7 | url = "https://github.com/Fuelet/fuels-dart/releases/download/#{release_tag_name}/#{remote_zip_name}"
8 | local_zip_name = "#{release_tag_name}.zip"
9 | `
10 | cd Frameworks
11 | rm -rf #{framework_name}
12 |
13 | if [ ! -f #{local_zip_name} ]
14 | then
15 | curl -L #{url} -o #{local_zip_name}
16 | fi
17 |
18 | unzip #{local_zip_name}
19 | cd -
20 | `
21 |
22 | Pod::Spec.new do |spec|
23 | spec.name = 'flutter_fuels'
24 | spec.version = '1.0.0'
25 | spec.license = { :file => '../LICENSE' }
26 | spec.homepage = 'https://github.com/Fuelet/fuels-dart'
27 | spec.authors = { 'Ilya Virnik' => 'ilya.virnik@icloud.com' }
28 | spec.summary = 'iOS/macOS Flutter bindings for flutter_fuels'
29 |
30 | spec.source = { :path => '.' }
31 | spec.source_files = 'Classes/**/*'
32 | spec.public_header_files = 'Classes/**/*.h'
33 | spec.vendored_frameworks = "Frameworks/#{framework_name}"
34 |
35 | spec.ios.deployment_target = '11.0'
36 | spec.osx.deployment_target = '10.11'
37 | end
38 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/macos/flutter_fuels.podspec:
--------------------------------------------------------------------------------
1 | release_tag_name = 'fuels-v1.38.0' # generated; do not edit
2 |
3 | # We cannot distribute the XCFramework alongside the library directly,
4 | # so we have to fetch the correct version here.
5 | framework_name = 'FlutterFuels.xcframework'
6 | remote_zip_name = "#{framework_name}.zip"
7 | url = "https://github.com/Fuelet/fuels-dart/releases/download/#{release_tag_name}/#{remote_zip_name}"
8 | local_zip_name = "#{release_tag_name}.zip"
9 | `
10 | cd Frameworks
11 | rm -rf #{framework_name}
12 |
13 | if [ ! -f #{local_zip_name} ]
14 | then
15 | curl -L #{url} -o #{local_zip_name}
16 | fi
17 |
18 | unzip #{local_zip_name}
19 | cd -
20 | `
21 |
22 | Pod::Spec.new do |spec|
23 | spec.name = 'flutter_fuels'
24 | spec.version = '1.0.0'
25 | spec.license = { :file => '../LICENSE' }
26 | spec.homepage = 'https://github.com/Fuelet/fuels-dart'
27 | spec.authors = { 'Ilya Virnik' => 'ilya.virnik@icloud.com' }
28 | spec.summary = 'iOS/macOS Flutter bindings for flutter_fuels'
29 |
30 | spec.source = { :path => '.' }
31 | spec.source_files = 'Classes/**/*'
32 | spec.public_header_files = 'Classes/**/*.h'
33 | spec.vendored_frameworks = "Frameworks/#{framework_name}"
34 |
35 | spec.ios.deployment_target = '11.0'
36 | spec.osx.deployment_target = '10.11'
37 | end
38 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/android/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | set(LibraryVersion "fuels-v1.38.0") # generated; do not edit
2 |
3 | # Unlike the Windows & Linux CMakeLists.txt, this Android equivalent is just here
4 | # to download the Android binaries into src/main/jniLibs/ and does not build anything.
5 | # The binary download/extraction is difficult to do concisely in Groovy/Gradle,
6 | # at least across host platforms, so we are just reusing our Linux/Windows logic.
7 |
8 | # The Flutter tooling requires that developers have CMake 3.10 or later
9 | # installed. You should not increase this version, as doing so will cause
10 | # the plugin to fail to compile for some customers of the plugin.
11 | cmake_minimum_required(VERSION 3.10)
12 |
13 | # Download the binaries if they are not already present.
14 | set(LibRoot "${CMAKE_CURRENT_SOURCE_DIR}/src/main/jniLibs")
15 | set(ArchivePath "${CMAKE_CURRENT_SOURCE_DIR}/${LibraryVersion}.tar.gz")
16 | if(NOT EXISTS ${ArchivePath})
17 | file(DOWNLOAD
18 | "https://github.com/Fuelet/fuels-dart/releases/download/${LibraryVersion}/android.tar.gz"
19 | ${ArchivePath}
20 | TLS_VERIFY ON
21 | )
22 | endif()
23 |
24 | # Extract the binaries, overriding any already present.
25 | file(REMOVE_RECURSE ${LibRoot})
26 | file(MAKE_DIRECTORY ${LibRoot})
27 | execute_process(
28 | COMMAND ${CMAKE_COMMAND} -E tar xzf ${ArchivePath}
29 | WORKING_DIRECTORY ${LibRoot}
30 | )
31 |
--------------------------------------------------------------------------------
/packages/fuels/native/src/model/output.rs:
--------------------------------------------------------------------------------
1 | pub enum Output {
2 | OutputCoin {
3 | to: String,
4 | amount: u64,
5 | asset_id: String,
6 | },
7 | OutputContract {
8 | input_index: u16,
9 | },
10 | OutputChange {
11 | to: String,
12 | amount: u64,
13 | asset_id: String,
14 | },
15 | OutputVariable {
16 | to: String,
17 | amount: u64,
18 | asset_id: String,
19 | },
20 | OutputContractCreated {
21 | contract_id: String,
22 | },
23 | UnknownOutput,
24 | }
25 |
26 | impl From<&fuel_tx::Output> for Output {
27 | fn from(model: &fuel_tx::Output) -> Self {
28 | match model {
29 | fuel_tx::Output::Coin { to, amount, asset_id } => { Output::OutputCoin { to: to.to_string(), amount: *amount, asset_id: asset_id.to_string() } }
30 | fuel_tx::Output::Contract(contract) => { Output::OutputContract { input_index: contract.input_index } }
31 | fuel_tx::Output::Change { to, amount, asset_id } => { Output::OutputChange { to: to.to_string(), amount: *amount, asset_id: asset_id.to_string() } }
32 | fuel_tx::Output::Variable { to, amount, asset_id } => { Output::OutputVariable { to: to.to_string(), amount: *amount, asset_id: asset_id.to_string() } }
33 | fuel_tx::Output::ContractCreated { contract_id, state_root: _ } => { Output::OutputContractCreated { contract_id: contract_id.to_string() } }
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/windows/runner/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 |
5 | #include "flutter_window.h"
6 | #include "utils.h"
7 |
8 | int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
9 | _In_ wchar_t *command_line, _In_ int show_command) {
10 | // Attach to console when present (e.g., 'flutter run') or create a
11 | // new console when running with a debugger.
12 | if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) {
13 | CreateAndAttachConsole();
14 | }
15 |
16 | // Initialize COM, so that it is available for use in the library and/or
17 | // plugins.
18 | ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);
19 |
20 | flutter::DartProject project(L"data");
21 |
22 | std::vector command_line_arguments =
23 | GetCommandLineArguments();
24 |
25 | project.set_dart_entrypoint_arguments(std::move(command_line_arguments));
26 |
27 | FlutterWindow window(project);
28 | Win32Window::Point origin(10, 10);
29 | Win32Window::Size size(1280, 720);
30 | if (!window.CreateAndShow(L"flutter_fuels_example", origin, size)) {
31 | return EXIT_FAILURE;
32 | }
33 | window.SetQuitOnClose(true);
34 |
35 | ::MSG msg;
36 | while (::GetMessage(&msg, nullptr, 0, 0)) {
37 | ::TranslateMessage(&msg);
38 | ::DispatchMessage(&msg);
39 | }
40 |
41 | ::CoUninitialize();
42 | return EXIT_SUCCESS;
43 | }
44 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/macos/Podfile:
--------------------------------------------------------------------------------
1 | platform :osx, '10.11'
2 |
3 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency.
4 | ENV['COCOAPODS_DISABLE_STATS'] = 'true'
5 |
6 | project 'Runner', {
7 | 'Debug' => :debug,
8 | 'Profile' => :release,
9 | 'Release' => :release,
10 | }
11 |
12 | def flutter_root
13 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__)
14 | unless File.exist?(generated_xcode_build_settings_path)
15 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first"
16 | end
17 |
18 | File.foreach(generated_xcode_build_settings_path) do |line|
19 | matches = line.match(/FLUTTER_ROOT\=(.*)/)
20 | return matches[1].strip if matches
21 | end
22 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\""
23 | end
24 |
25 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
26 |
27 | flutter_macos_podfile_setup
28 |
29 | target 'Runner' do
30 | use_frameworks!
31 | use_modular_headers!
32 |
33 | flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__))
34 | end
35 |
36 | post_install do |installer|
37 | installer.pods_project.targets.each do |target|
38 | flutter_additional_macos_build_settings(target)
39 | end
40 | end
41 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/ios/Podfile:
--------------------------------------------------------------------------------
1 | # Uncomment this line to define a global platform for your project
2 | # platform :ios, '11.0'
3 |
4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency.
5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true'
6 |
7 | project 'Runner', {
8 | 'Debug' => :debug,
9 | 'Profile' => :release,
10 | 'Release' => :release,
11 | }
12 |
13 | def flutter_root
14 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
15 | unless File.exist?(generated_xcode_build_settings_path)
16 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
17 | end
18 |
19 | File.foreach(generated_xcode_build_settings_path) do |line|
20 | matches = line.match(/FLUTTER_ROOT\=(.*)/)
21 | return matches[1].strip if matches
22 | end
23 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
24 | end
25 |
26 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
27 |
28 | flutter_ios_podfile_setup
29 |
30 | target 'Runner' do
31 | use_frameworks!
32 | use_modular_headers!
33 |
34 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
35 | end
36 |
37 | post_install do |installer|
38 | installer.pods_project.targets.each do |target|
39 | flutter_additional_ios_build_settings(target)
40 | end
41 | end
42 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/lib/fuel_utils/platform_impl/web_fuel_utils.dart:
--------------------------------------------------------------------------------
1 | import 'dart:convert';
2 |
3 | import 'package:flutter_fuels/model/transaction.dart';
4 | import 'package:flutter_fuels/model/transaction_cost.dart';
5 | import 'package:js/js_util.dart';
6 |
7 | import 'base_fuel_utils.dart';
8 | import 'js_interop/js_fuels_utils.dart' as js_utils;
9 |
10 | class FuelUtilsImpl extends BaseFuelUtils {
11 | @override
12 | Future transformTxRequest(dynamic transactionRequestHexOrJson) {
13 | String jsTransaction =
14 | js_utils.transformTxRequest(transactionRequestHexOrJson);
15 | try {
16 | Transaction dartTransaction =
17 | Transaction.fromJson(jsonDecode(jsTransaction));
18 | return Future.value(dartTransaction);
19 | } catch (err) {
20 | return Future.error(err);
21 | }
22 | }
23 |
24 | @override
25 | Future getTransactionCost(
26 | {required String networkUrl,
27 | required String transactionRequestHexOrJson}) async {
28 | final txCostStr = await promiseToFuture(
29 | js_utils.getTransactionCost(networkUrl, transactionRequestHexOrJson));
30 | final txCostJson = jsonDecode(txCostStr);
31 | try {
32 | return TransactionCost.fromJson(txCostJson);
33 | } catch (err) {
34 | return Future.error(err);
35 | }
36 | }
37 |
38 | @override
39 | Future isUserAccount(
40 | {required String network, required String address}) {
41 | return promiseToFuture(js_utils.isUserAccount(network, address));
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/analysis_options.yaml:
--------------------------------------------------------------------------------
1 | # This file configures the analyzer, which statically analyzes Dart code to
2 | # check for errors, warnings, and lints.
3 | #
4 | # The issues identified by the analyzer are surfaced in the UI of Dart-enabled
5 | # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
6 | # invoked from the command line by running `flutter analyze`.
7 |
8 | # The following line activates a set of recommended lints for Flutter apps,
9 | # packages, and plugins designed to encourage good coding practices.
10 | include: package:flutter_lints/flutter.yaml
11 |
12 | linter:
13 | # The lint rules applied to this project can be customized in the
14 | # section below to disable rules from the `package:flutter_lints/flutter.yaml`
15 | # included above or to enable additional rules. A list of all available lints
16 | # and their documentation is published at
17 | # https://dart-lang.github.io/linter/lints/index.html.
18 | #
19 | # Instead of disabling a lint rule for the entire project in the
20 | # section below, it can also be suppressed for a single line of code
21 | # or a specific dart file by using the `// ignore: name_of_lint` and
22 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file
23 | # producing the lint.
24 | rules:
25 | # avoid_print: false # Uncomment to disable the `avoid_print` rule
26 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
27 |
28 | # Additional information about this file can be found at
29 | # https://dart.dev/guides/language/analysis-options
30 |
--------------------------------------------------------------------------------
/packages/fuels/test/features/transaction_test.dart:
--------------------------------------------------------------------------------
1 | // ignore_for_file: avoid_print
2 |
3 | import 'package:fuels/fuels.dart';
4 | import 'package:test/test.dart';
5 |
6 | import '../test_utils.dart';
7 |
8 | const _transferAmount = 1;
9 |
10 | // TODO: do not depend on external state
11 | void main() {
12 | test('test transfer tx gas estimation', () async {
13 | Provider provider = createProvider();
14 | WalletUnlocked newWallet = await createRandomWallet();
15 | WalletUnlocked testWallet = await importWalletWithPK(testWalletPrivateKey);
16 |
17 | final (requestBytes, _) = await testWallet.genTransferTxRequest(
18 | to: newWallet.b256Address, amount: _transferAmount, asset: baseAsset);
19 | final txCost =
20 | await provider.estimateTransactionCost(encodedTx: requestBytes);
21 |
22 | print(
23 | 'gasPrice: ${txCost.gasPrice}, meteredBytesSize: ${txCost.meteredBytesSize}, totalFee: ${txCost.totalFee}, scriptGas: ${txCost.scriptGas}, totalGas: ${txCost.totalGas}');
24 | expect(txCost.gasPrice > 0, true);
25 | expect(txCost.totalFee > 0, true);
26 | });
27 |
28 | test('test transfer eth request creation', () async {
29 | WalletUnlocked newWallet = await createRandomWallet();
30 | WalletUnlocked testWallet = await importWalletWithPK(testWalletPrivateKey);
31 |
32 | final (requestBytes, _) = await testWallet.genTransferTxRequest(
33 | to: newWallet.b256Address, amount: _transferAmount, asset: baseAsset);
34 | final txId = await testWallet.sendTransaction(encodedTx: requestBytes);
35 |
36 | expect(txId.isNotEmpty, true);
37 | }, skip: 'Should be run manually');
38 | }
39 |
--------------------------------------------------------------------------------
/scripts/build-apple.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -e
4 |
5 | # Setup
6 | BUILD_DIR=platform-build
7 | mkdir $BUILD_DIR
8 | cd $BUILD_DIR
9 |
10 | # Build static libs
11 | for TARGET in \
12 | aarch64-apple-ios x86_64-apple-ios aarch64-apple-ios-sim \
13 | x86_64-apple-darwin aarch64-apple-darwin
14 | do
15 | rustup target add $TARGET
16 | cargo build -r --target=$TARGET
17 | done
18 |
19 | # Create XCFramework zip
20 | FRAMEWORK="FlutterFuels.xcframework"
21 | LIBNAME=libfuels.a
22 | mkdir mac-lipo ios-sim-lipo
23 | IOS_SIM_LIPO=ios-sim-lipo/$LIBNAME
24 | MAC_LIPO=mac-lipo/$LIBNAME
25 | lipo -create -output $IOS_SIM_LIPO \
26 | ../target/aarch64-apple-ios-sim/release/$LIBNAME \
27 | ../target/x86_64-apple-ios/release/$LIBNAME
28 | lipo -create -output $MAC_LIPO \
29 | ../target/aarch64-apple-darwin/release/$LIBNAME \
30 | ../target/x86_64-apple-darwin/release/$LIBNAME
31 | xcodebuild -create-xcframework \
32 | -library $IOS_SIM_LIPO \
33 | -library $MAC_LIPO \
34 | -library ../target/aarch64-apple-ios/release/$LIBNAME \
35 | -output $FRAMEWORK
36 | zip -r $FRAMEWORK.zip $FRAMEWORK
37 |
38 | # Cleanup
39 | rm -rf ios-sim-lipo mac-lipo $FRAMEWORK
40 |
41 | cd ..
42 |
43 | # Copy the binaries to the needed location
44 | CURR_VERSION=fuels-v`awk '/^version: /{print $2}' packages/fuels/pubspec.yaml`
45 |
46 | cp platform-build/FlutterFuels.xcframework.zip packages/flutter_fuels/macos/Frameworks/$CURR_VERSION.zip
47 | echo "[macos] Copied file!"
48 |
49 | cp platform-build/FlutterFuels.xcframework.zip packages/flutter_fuels/ios/Frameworks/$CURR_VERSION.zip
50 | echo "[ios] Copied file!"
51 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "16x16",
5 | "idiom" : "mac",
6 | "filename" : "app_icon_16.png",
7 | "scale" : "1x"
8 | },
9 | {
10 | "size" : "16x16",
11 | "idiom" : "mac",
12 | "filename" : "app_icon_32.png",
13 | "scale" : "2x"
14 | },
15 | {
16 | "size" : "32x32",
17 | "idiom" : "mac",
18 | "filename" : "app_icon_32.png",
19 | "scale" : "1x"
20 | },
21 | {
22 | "size" : "32x32",
23 | "idiom" : "mac",
24 | "filename" : "app_icon_64.png",
25 | "scale" : "2x"
26 | },
27 | {
28 | "size" : "128x128",
29 | "idiom" : "mac",
30 | "filename" : "app_icon_128.png",
31 | "scale" : "1x"
32 | },
33 | {
34 | "size" : "128x128",
35 | "idiom" : "mac",
36 | "filename" : "app_icon_256.png",
37 | "scale" : "2x"
38 | },
39 | {
40 | "size" : "256x256",
41 | "idiom" : "mac",
42 | "filename" : "app_icon_256.png",
43 | "scale" : "1x"
44 | },
45 | {
46 | "size" : "256x256",
47 | "idiom" : "mac",
48 | "filename" : "app_icon_512.png",
49 | "scale" : "2x"
50 | },
51 | {
52 | "size" : "512x512",
53 | "idiom" : "mac",
54 | "filename" : "app_icon_512.png",
55 | "scale" : "1x"
56 | },
57 | {
58 | "size" : "512x512",
59 | "idiom" : "mac",
60 | "filename" : "app_icon_1024.png",
61 | "scale" : "2x"
62 | }
63 | ],
64 | "info" : {
65 | "version" : 1,
66 | "author" : "xcode"
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/packages/fuels/test/test_utils.dart:
--------------------------------------------------------------------------------
1 | import 'dart:io';
2 |
3 | import 'package:flutter_rust_bridge/flutter_rust_bridge.dart';
4 | import 'package:fuels/fuels.dart';
5 |
6 | const betaApiUrl = 'https://testnet.fuel.network';
7 | const testWalletAddress =
8 | 'fe1177573a47310756f27ef25c7229b5da8d5109a7258b297f23a6768c78cb40';
9 | const testWalletPrivateKey =
10 | 'e5e05a4ab2919dc01b97c90a48853fd4dfbd204e92e44327375702ab09bb184e';
11 | const testWalletSeedPhrase =
12 | 'sorry suit fade strike crucial theory rubber sign scrub burden enough trash';
13 |
14 | const baseAsset =
15 | '0xf8f8b6283d7fa5b672b530cbb84fcccb4ff8dc40f8176ef4544ddb1f1952ad07';
16 |
17 | String projectPath = Directory.current.parent.parent.path;
18 | var rustSdk =
19 | FuelsImpl(loadLibForFlutter('$projectPath/target/debug/libfuels.dylib'));
20 |
21 | Future createRandomWallet() {
22 | return WalletUnlocked.newRandom(bridge: rustSdk, nodeUrl: betaApiUrl);
23 | }
24 |
25 | Provider createProvider() {
26 | return Provider(bridge: rustSdk, nodeUrl: betaApiUrl);
27 | }
28 |
29 | Future importWalletWithPK(String privateKey) {
30 | return WalletUnlocked.newFromPrivateKey(
31 | bridge: rustSdk, privateKey: privateKey, nodeUrl: betaApiUrl);
32 | }
33 |
34 | Future importWalletWithMnemonics(String mnemonicPhrase) {
35 | return WalletUnlocked.newFromMnemonicPhrase(
36 | bridge: rustSdk, phrase: mnemonicPhrase, nodeUrl: betaApiUrl);
37 | }
38 |
39 | Future importWalletWithMnemonicsAndPath(
40 | String mnemonicPhrase, String path) {
41 | return WalletUnlocked.newFromMnemonicPhraseWithPath(
42 | bridge: rustSdk, phrase: mnemonicPhrase, path: path, nodeUrl: betaApiUrl);
43 | }
44 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/ios/Runner/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/.metadata:
--------------------------------------------------------------------------------
1 | # This file tracks properties of this Flutter project.
2 | # Used by Flutter tool to assess capabilities and perform upgrades etc.
3 | #
4 | # This file should be version controlled.
5 |
6 | version:
7 | revision: 135454af32477f815a7525073027a3ff9eff1bfd
8 | channel: stable
9 |
10 | project_type: plugin_ffi
11 |
12 | # Tracks metadata for the flutter migrate command
13 | migration:
14 | platforms:
15 | - platform: root
16 | create_revision: 135454af32477f815a7525073027a3ff9eff1bfd
17 | base_revision: 135454af32477f815a7525073027a3ff9eff1bfd
18 | - platform: android
19 | create_revision: 135454af32477f815a7525073027a3ff9eff1bfd
20 | base_revision: 135454af32477f815a7525073027a3ff9eff1bfd
21 | - platform: ios
22 | create_revision: 135454af32477f815a7525073027a3ff9eff1bfd
23 | base_revision: 135454af32477f815a7525073027a3ff9eff1bfd
24 | - platform: linux
25 | create_revision: 135454af32477f815a7525073027a3ff9eff1bfd
26 | base_revision: 135454af32477f815a7525073027a3ff9eff1bfd
27 | - platform: macos
28 | create_revision: 135454af32477f815a7525073027a3ff9eff1bfd
29 | base_revision: 135454af32477f815a7525073027a3ff9eff1bfd
30 | - platform: windows
31 | create_revision: 135454af32477f815a7525073027a3ff9eff1bfd
32 | base_revision: 135454af32477f815a7525073027a3ff9eff1bfd
33 | - platform: web
34 | create_revision: 135454af32477f815a7525073027a3ff9eff1bfd
35 | base_revision: 135454af32477f815a7525073027a3ff9eff1bfd
36 |
37 | # User provided section
38 |
39 | # List of Local paths (relative to this file) that should be
40 | # ignored by the migrate tool.
41 | #
42 | # Files that are not part of the templates will be ignored by default.
43 | unmanaged_files:
44 | - 'lib/main.dart'
45 | - 'ios/Runner.xcodeproj/project.pbxproj'
46 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
7 |
15 |
19 |
23 |
24 |
25 |
26 |
27 |
28 |
30 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/windows/runner/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.14)
2 | project(runner LANGUAGES CXX)
3 |
4 | # Define the application target. To change its name, change BINARY_NAME in the
5 | # top-level CMakeLists.txt, not the value here, or `flutter run` will no longer
6 | # work.
7 | #
8 | # Any new source files that you add to the application should be added here.
9 | add_executable(${BINARY_NAME} WIN32
10 | "flutter_window.cpp"
11 | "main.cpp"
12 | "utils.cpp"
13 | "win32_window.cpp"
14 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc"
15 | "Runner.rc"
16 | "runner.exe.manifest"
17 | )
18 |
19 | # Apply the standard set of build settings. This can be removed for applications
20 | # that need different build settings.
21 | apply_standard_settings(${BINARY_NAME})
22 |
23 | # Add preprocessor definitions for the build version.
24 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"")
25 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}")
26 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}")
27 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}")
28 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}")
29 |
30 | # Disable Windows macros that collide with C++ standard library functions.
31 | target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX")
32 |
33 | # Add dependency libraries and include directories. Add any application-specific
34 | # dependencies here.
35 | target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app)
36 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}")
37 |
38 | # Run the Flutter tool portions of the build. This must not be removed.
39 | add_dependencies(${BINARY_NAME} flutter_assemble)
40 |
--------------------------------------------------------------------------------
/packages/fuels/native/src/model/input.rs:
--------------------------------------------------------------------------------
1 | pub enum Input {
2 | InputCoin {
3 | owner: String,
4 | amount: u64,
5 | asset_id: String,
6 | witness_index: Option,
7 | },
8 | InputContract {
9 | contract_id: String,
10 | },
11 | InputMessage {
12 | amount: u64,
13 | sender: String,
14 | recipient: String,
15 | witness_index: Option,
16 | },
17 | UnknownInput,
18 | }
19 |
20 | impl From<&fuel_tx::Input> for Input {
21 | fn from(model: &fuel_tx::Input) -> Self {
22 | match model {
23 | fuel_tx::Input::CoinSigned(coin) => { Input::InputCoin { owner: coin.owner.to_string(), amount: coin.amount, asset_id: coin.asset_id.to_string(), witness_index: Some(coin.witness_index) } }
24 | fuel_tx::Input::CoinPredicate(coin) => { Input::InputCoin { owner: coin.owner.to_string(), amount: coin.amount, asset_id: coin.asset_id.to_string(), witness_index: None } }
25 | fuel_tx::Input::Contract(contract) => { Input::InputContract { contract_id: contract.contract_id.to_string() } }
26 | fuel_tx::Input::MessageCoinSigned(msg) => { Input::InputMessage { amount: msg.amount, sender: msg.sender.to_string(), recipient: msg.recipient.to_string(), witness_index: Some(msg.witness_index) } }
27 | fuel_tx::Input::MessageCoinPredicate(msg) => { Input::InputMessage { amount: msg.amount, sender: msg.sender.to_string(), recipient: msg.recipient.to_string(), witness_index: None } }
28 | fuel_tx::Input::MessageDataSigned(msg) => { Input::InputMessage { amount: msg.amount, sender: msg.sender.to_string(), recipient: msg.recipient.to_string(), witness_index: Some(msg.witness_index) } }
29 | fuel_tx::Input::MessageDataPredicate(msg) => { Input::InputMessage { amount: msg.amount, sender: msg.sender.to_string(), recipient: msg.recipient.to_string(), witness_index: None } }
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/ios/Runner/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleDisplayName
8 | Flutter Fuels
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | flutter_fuels_example
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | $(FLUTTER_BUILD_NAME)
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | $(FLUTTER_BUILD_NUMBER)
25 | LSRequiresIPhoneOS
26 |
27 | UILaunchStoryboardName
28 | LaunchScreen
29 | UIMainStoryboardFile
30 | Main
31 | UISupportedInterfaceOrientations
32 |
33 | UIInterfaceOrientationPortrait
34 | UIInterfaceOrientationLandscapeLeft
35 | UIInterfaceOrientationLandscapeRight
36 |
37 | UISupportedInterfaceOrientations~ipad
38 |
39 | UIInterfaceOrientationPortrait
40 | UIInterfaceOrientationPortraitUpsideDown
41 | UIInterfaceOrientationLandscapeLeft
42 | UIInterfaceOrientationLandscapeRight
43 |
44 | UIViewControllerBasedStatusBarAppearance
45 |
46 | CADisableMinimumFrameDurationOnPhone
47 |
48 | UIApplicationSupportsIndirectInputEvents
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/windows/runner/utils.cpp:
--------------------------------------------------------------------------------
1 | #include "utils.h"
2 |
3 | #include
4 | #include
5 | #include
6 | #include
7 |
8 | #include
9 |
10 | void CreateAndAttachConsole() {
11 | if (::AllocConsole()) {
12 | FILE *unused;
13 | if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
14 | _dup2(_fileno(stdout), 1);
15 | }
16 | if (freopen_s(&unused, "CONOUT$", "w", stderr)) {
17 | _dup2(_fileno(stdout), 2);
18 | }
19 | std::ios::sync_with_stdio();
20 | FlutterDesktopResyncOutputStreams();
21 | }
22 | }
23 |
24 | std::vector GetCommandLineArguments() {
25 | // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use.
26 | int argc;
27 | wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc);
28 | if (argv == nullptr) {
29 | return std::vector();
30 | }
31 |
32 | std::vector command_line_arguments;
33 |
34 | // Skip the first argument as it's the binary name.
35 | for (int i = 1; i < argc; i++) {
36 | command_line_arguments.push_back(Utf8FromUtf16(argv[i]));
37 | }
38 |
39 | ::LocalFree(argv);
40 |
41 | return command_line_arguments;
42 | }
43 |
44 | std::string Utf8FromUtf16(const wchar_t* utf16_string) {
45 | if (utf16_string == nullptr) {
46 | return std::string();
47 | }
48 | int target_length = ::WideCharToMultiByte(
49 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string,
50 | -1, nullptr, 0, nullptr, nullptr);
51 | std::string utf8_string;
52 | if (target_length == 0 || target_length > utf8_string.max_size()) {
53 | return utf8_string;
54 | }
55 | utf8_string.resize(target_length);
56 | int converted_length = ::WideCharToMultiByte(
57 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string,
58 | -1, utf8_string.data(),
59 | target_length, nullptr, nullptr);
60 | if (converted_length == 0) {
61 | return std::string();
62 | }
63 | return utf8_string;
64 | }
65 |
--------------------------------------------------------------------------------
/.github/workflows/publish-github-release.yml:
--------------------------------------------------------------------------------
1 | name: Publish Github release
2 |
3 | on: workflow_call
4 |
5 | jobs:
6 | build_apple:
7 | runs-on: macos-14
8 |
9 | steps:
10 | - name: Checkout the repository
11 | uses: actions/checkout@v4
12 |
13 | - uses: ./.github/actions/initialize
14 |
15 | - uses: ./.github/actions/extract_package_version
16 |
17 | - name: Build apple binary
18 | run: melos run build:apple
19 |
20 | - name: Uploading artifact
21 | uses: actions/upload-artifact@v4
22 | with:
23 | name: apple_binary
24 | path: platform-build/FlutterFuels.xcframework.zip
25 |
26 | build_android:
27 | runs-on: ubuntu-latest
28 |
29 | steps:
30 | - name: Checkout the repository
31 | uses: actions/checkout@v4
32 |
33 | - uses: ./.github/actions/initialize
34 |
35 | - uses: ./.github/actions/extract_package_version
36 |
37 | - name: Setup NDK
38 | uses: nttld/setup-ndk@v1
39 | with:
40 | ndk-version: r25b
41 |
42 | - name: Build android binary
43 | run: melos run build:android
44 |
45 | - name: Uploading artifact
46 | uses: actions/upload-artifact@v4
47 | with:
48 | name: android_binary
49 | path: platform-build/android.tar.gz
50 |
51 | publish_github_release:
52 | runs-on: ubuntu-latest
53 | needs: [ build_apple, build_android ]
54 | steps:
55 | - uses: actions/checkout@v4
56 |
57 | - name: Download apple binary
58 | uses: actions/download-artifact@v4
59 | with:
60 | name: apple_binary
61 | path: platform-build
62 |
63 | - name: Download android binary
64 | uses: actions/download-artifact@v4
65 | with:
66 | name: android_binary
67 | path: platform-build
68 |
69 | - name: Create GitHub release
70 | uses: softprops/action-gh-release@v1
71 | with:
72 | name: ${{env.RELEASE_VERSION}}
73 | files: platform-build/*
74 |
--------------------------------------------------------------------------------
/melos.yaml:
--------------------------------------------------------------------------------
1 | name: fuels
2 |
3 | repository: https://github.com/Fuelet/fuels-dart
4 |
5 | packages:
6 | - packages/**
7 |
8 | command:
9 | version:
10 | hooks:
11 | preCommit: bash scripts/version.sh
12 |
13 | scripts:
14 | analyze:
15 | exec: flutter analyze .
16 | description: Analyze a specific package in this project.
17 |
18 | check-format:
19 | exec: flutter format --set-exit-if-changed .
20 | description: Check the format of a specific package in this project.
21 |
22 | format:
23 | exec: flutter format .
24 | description: Format a specific package in this project.
25 |
26 | build:
27 | run: melos run build:apple && melos run build:android && melos run build:web # && melos run build:other
28 | description: Build all native libraries for the project.
29 |
30 | build:apple:
31 | run: bash scripts/build-apple.sh
32 | description: Build the XCFramework for iOS and macOS.
33 |
34 | build:android:
35 | run: bash scripts/build-android.sh
36 | description: Build the .tar.gz for Android.
37 |
38 | build:web:
39 | run: bash scripts/build-web.sh
40 | description: Build web.
41 |
42 | # build:other:
43 | # run: bash scripts/build-other.sh
44 | # description: Build the .tar.gz for all other platforms.
45 |
46 | frb-gen:
47 | run: just --justfile packages/fuels/justfile
48 | description: Generate wrapper over the native Rust code
49 |
50 | test:
51 | run: melos run test:dart --no-select && melos run test:flutter --no-select
52 | description: Run all Dart & Flutter tests in this project.
53 |
54 | test:dart:
55 | run: melos exec -c 1 --fail-fast -- "dart test test"
56 | description: Run Dart tests for a specific package in this project.
57 | select-package:
58 | flutter: false
59 | dir-exists: test
60 |
61 | test:flutter:
62 | run: melos exec -c 1 --fail-fast -- "flutter test test"
63 | description: Run Flutter tests for a specific package in this project.
64 | select-package:
65 | flutter: true
66 | dir-exists: test
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/windows/runner/flutter_window.cpp:
--------------------------------------------------------------------------------
1 | #include "flutter_window.h"
2 |
3 | #include
4 |
5 | #include "flutter/generated_plugin_registrant.h"
6 |
7 | FlutterWindow::FlutterWindow(const flutter::DartProject& project)
8 | : project_(project) {}
9 |
10 | FlutterWindow::~FlutterWindow() {}
11 |
12 | bool FlutterWindow::OnCreate() {
13 | if (!Win32Window::OnCreate()) {
14 | return false;
15 | }
16 |
17 | RECT frame = GetClientArea();
18 |
19 | // The size here must match the window dimensions to avoid unnecessary surface
20 | // creation / destruction in the startup path.
21 | flutter_controller_ = std::make_unique(
22 | frame.right - frame.left, frame.bottom - frame.top, project_);
23 | // Ensure that basic setup of the controller was successful.
24 | if (!flutter_controller_->engine() || !flutter_controller_->view()) {
25 | return false;
26 | }
27 | RegisterPlugins(flutter_controller_->engine());
28 | SetChildContent(flutter_controller_->view()->GetNativeWindow());
29 | return true;
30 | }
31 |
32 | void FlutterWindow::OnDestroy() {
33 | if (flutter_controller_) {
34 | flutter_controller_ = nullptr;
35 | }
36 |
37 | Win32Window::OnDestroy();
38 | }
39 |
40 | LRESULT
41 | FlutterWindow::MessageHandler(HWND hwnd, UINT const message,
42 | WPARAM const wparam,
43 | LPARAM const lparam) noexcept {
44 | // Give Flutter, including plugins, an opportunity to handle window messages.
45 | if (flutter_controller_) {
46 | std::optional result =
47 | flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam,
48 | lparam);
49 | if (result) {
50 | return *result;
51 | }
52 | }
53 |
54 | switch (message) {
55 | case WM_FONTCHANGE:
56 | flutter_controller_->engine()->ReloadSystemFonts();
57 | break;
58 | }
59 |
60 | return Win32Window::MessageHandler(hwnd, message, wparam, lparam);
61 | }
62 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/test/fuel_utils/fuel_utils_test.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter_fuels/flutter_fuels.dart';
2 | import 'package:test/test.dart';
3 |
4 | const String _mainnetUrl = 'https://mainnet.fuel.network';
5 | const String _testnetUrl = 'https://testnet.fuel.network';
6 |
7 | void main() {
8 | test('test asset id check', () async {
9 | final testCases = [
10 | (
11 | 'fuel1lcghw4e6gucsw4hj0me9cu3fkhdg65gf5ujck2tlywn8drrcedqq2htmt3',
12 | false,
13 | _mainnetUrl,
14 | ),
15 | (
16 | 'fuel1dn4ew2a5kn9datj34npuyz63lztjhhfw6mzw6q9vqdtgu2t9y23q3u0tdc',
17 | false,
18 | _mainnetUrl,
19 | ),
20 | (
21 | '0x3341d9F4ef079b62fED7D0797102905d5624375BC37831D3a1a0187531C5705E',
22 | false,
23 | _mainnetUrl,
24 | ),
25 | (
26 | '0x6750ae4794d00e1e1C97a4FcCaA8c8E64F9DC79D0690E0dAE64B61e4Ef6bd3F3',
27 | false,
28 | _mainnetUrl,
29 | ),
30 | (
31 | '0x6750ae4794d00e1e1C97a4FcCaA8c8E64F9DC79D0690E0dAE64B61e4Ef6bd3F3',
32 | false,
33 | _testnetUrl,
34 | ),
35 | (
36 | '0x1d5d97005e41cae2187a895fd8eab0506111e0e2f3331cd3912c15c24e3c1d82', // fuel asset id on mainnet
37 | true,
38 | _mainnetUrl,
39 | ),
40 | (
41 | '0xf8f8b6283d7fa5b672b530cbb84fcccb4ff8dc40f8176ef4544ddb1f1952ad07', // eth asset id
42 | true,
43 | _mainnetUrl,
44 | ),
45 | (
46 | '0x324d0c35a4299ef88138a656d5272c5a3a9ccde2630ae055dacaf9d13443d53b', // fuel asset id on testnet
47 | true,
48 | _testnetUrl,
49 | ),
50 | (
51 | '0xf8f8b6283d7fa5b672b530cbb84fcccb4ff8dc40f8176ef4544ddb1f1952ad07', // eth asset id
52 | true,
53 | _testnetUrl,
54 | ),
55 | ];
56 | for (final (address, isUserAccount, network) in testCases) {
57 | final isUser = await FuelUtils.isAssetId(
58 | network: network, address: FuelAddress.fromString(address));
59 | expect(isUser, isUserAccount);
60 | }
61 | });
62 | }
63 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/web/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 | example
33 |
34 |
35 |
39 |
40 |
41 |
42 |
43 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/packages/fuels/native/src/features/wallet.rs:
--------------------------------------------------------------------------------
1 | use std::str::FromStr;
2 | use std::string::String;
3 |
4 | use fuel_crypto::SecretKey;
5 | use fuel_tx::Address;
6 | use fuels::prelude::Provider;
7 | use fuels_accounts::signers::private_key::{PrivateKeySigner, generate_mnemonic_phrase};
8 |
9 | use crate::api::{WalletUnlocked};
10 | use crate::model::error::CustomResult;
11 |
12 | pub const DEFAULT_DERIVATION_PATH_PREFIX: &str = "m/44'/1179993420'";
13 |
14 | pub fn new_random(node_url: String) -> CustomResult {
15 | let mut rng = rand::thread_rng();
16 | let mnemonic_phrase = generate_mnemonic_phrase(&mut rng, 12)?;
17 | new_from_mnemonic_phrase(mnemonic_phrase, node_url)
18 | }
19 |
20 | pub fn new_from_private_key(private_key: String, node_url: String) -> CustomResult {
21 | let secret_key = SecretKey::from_str(private_key.as_str())?;
22 | Ok(WalletUnlocked {
23 | private_key: secret_key.to_string(),
24 | mnemonic_phrase: None,
25 | node_url,
26 | b256_address: get_public_address(secret_key).to_string(),
27 | })
28 | }
29 |
30 | pub fn new_from_mnemonic_phrase(phrase: String, node_url: String) -> CustomResult {
31 | let path = format!("{}/0'/0/0", DEFAULT_DERIVATION_PATH_PREFIX);
32 | new_from_mnemonic_phrase_with_path(phrase, path, node_url)
33 | }
34 |
35 | pub fn new_from_mnemonic_phrase_with_path(
36 | phrase: String,
37 | path: String,
38 | node_url: String,
39 | ) -> CustomResult {
40 | let secret_key = SecretKey::new_from_mnemonic_phrase_with_path(&phrase, &path)?;
41 | Ok(WalletUnlocked {
42 | private_key: secret_key.to_string(),
43 | mnemonic_phrase: Some(phrase),
44 | node_url,
45 | b256_address: get_public_address(secret_key).to_string(),
46 | })
47 | }
48 |
49 | fn get_public_address(private_key: SecretKey) -> Address {
50 | let signer = PrivateKeySigner::new(private_key);
51 | signer.address()
52 | }
53 |
54 | pub async fn is_user_account(provider: &Provider, address: Address) -> bool {
55 | provider
56 | .is_user_account(*address)
57 | .await
58 | .unwrap_or(false)
59 | }
60 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # fuels-dart
2 | Dart & Flutter SDK for Fuel Blockchain. Essentially, it's a wrapper over the [official Rust SDK](https://github.com/FuelLabs/fuels-rs) for mobile and [official TypeScript SDK](https://github.com/FuelLabs/fuels-ts) for web. It's implemented with the help of [flutter_rust_bridge](https://github.com/fzyzcjy/flutter_rust_bridge) library.
3 |
4 | For more information about SDK functionality and abilities, please check out fuels-rs SDK [documentation](https://fuellabs.github.io/fuels-rs/v0.34.0/index.html).
5 |
6 | The project tries to stick to the same interfaces as used in the Rust SDK wherever possible.
7 |
8 | The project structure explanation can be found in the [FRB documentation](https://cjycode.com/flutter_rust_bridge/library.html).
9 |
10 | ## Documentation
11 |
12 | Work on documentation for Dart/Flutter SDK is in progress.
13 |
14 | ## Implemented features
15 |
16 | - [x] Create wallet
17 | - [x] Get account balances
18 | - [x] Transfer tokens
19 | - [ ] Sign transactions
20 |
21 | ## Contributing
22 |
23 | [packages/fuels/native](https://github.com/Fuelet/fuels-dart/tree/main/packages/fuels/native) folder contains Rust files. [api.rs](https://github.com/Fuelet/fuels-dart/blob/main/packages/fuels/native/src/api.rs) is the main entrypoint of the Rust methods accessed from Dart.
24 |
25 | After changing any of the Rust files, you need to regenerate the wrapper. Just call:
26 |
27 | ```shell
28 | melos run frb-gen
29 | ```
30 |
31 | All commits in the main branch must follow the [Conventional Commits](https://cheatography.com/albelop/cheat-sheets/conventional-commits/) format.
32 |
33 | ## Releasing
34 |
35 | To upgrade the library version before releasing, do:
36 |
37 | ```shell
38 | melos version
39 | ```
40 |
41 | Then push the generated commit with tags:
42 |
43 | ```shell
44 | git push --follow-tags
45 | ```
46 | Ths will start Github actions tasks for creating and publishing a release on Github.
47 |
48 | In order to publish a package to https://pub.dev/, you need to wait for the CI/CD tasks from the previous step to complete.
49 | Then call the following command from the corresponding package:
50 |
51 | ```shell
52 | cd packages/[needed package]
53 | flutter pub publish
54 | ```
55 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/lib/flutter_fuels_bindings_generated.dart:
--------------------------------------------------------------------------------
1 | // ignore_for_file: always_specify_types
2 | // ignore_for_file: camel_case_types
3 | // ignore_for_file: non_constant_identifier_names
4 |
5 | // AUTO GENERATED FILE, DO NOT EDIT.
6 | //
7 | // Generated by `package:ffigen`.
8 | import 'dart:ffi' as ffi;
9 |
10 | /// Bindings for `src/flutter_fuels.h`.
11 | ///
12 | /// Regenerate bindings with `flutter pub run ffigen --config ffigen.yaml`.
13 | ///
14 | class FlutterFuelsBindings {
15 | /// Holds the symbol lookup function.
16 | final ffi.Pointer Function(String symbolName)
17 | _lookup;
18 |
19 | /// The symbols are looked up in [dynamicLibrary].
20 | FlutterFuelsBindings(ffi.DynamicLibrary dynamicLibrary)
21 | : _lookup = dynamicLibrary.lookup;
22 |
23 | /// The symbols are looked up with [lookup].
24 | FlutterFuelsBindings.fromLookup(
25 | ffi.Pointer Function(String symbolName)
26 | lookup)
27 | : _lookup = lookup;
28 |
29 | /// A very short-lived native function.
30 | ///
31 | /// For very short-lived functions, it is fine to call them on the main isolate.
32 | /// They will block the Dart execution while running the native function, so
33 | /// only do this for native functions which are guaranteed to be short-lived.
34 | int sum(
35 | int a,
36 | int b,
37 | ) {
38 | return _sum(
39 | a,
40 | b,
41 | );
42 | }
43 |
44 | late final _sumPtr =
45 | _lookup>(
46 | 'sum');
47 | late final _sum = _sumPtr.asFunction();
48 |
49 | /// A longer lived native function, which occupies the thread calling it.
50 | ///
51 | /// Do not call these kind of native functions in the main isolate. They will
52 | /// block Dart execution. This will cause dropped frames in Flutter applications.
53 | /// Instead, call these native functions on a separate isolate.
54 | int sum_long_running(
55 | int a,
56 | int b,
57 | ) {
58 | return _sum_long_running(
59 | a,
60 | b,
61 | );
62 | }
63 |
64 | late final _sum_long_runningPtr =
65 | _lookup>(
66 | 'sum_long_running');
67 | late final _sum_long_running =
68 | _sum_long_runningPtr.asFunction();
69 | }
70 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/android/app/build.gradle:
--------------------------------------------------------------------------------
1 | def localProperties = new Properties()
2 | def localPropertiesFile = rootProject.file('local.properties')
3 | if (localPropertiesFile.exists()) {
4 | localPropertiesFile.withReader('UTF-8') { reader ->
5 | localProperties.load(reader)
6 | }
7 | }
8 |
9 | def flutterRoot = localProperties.getProperty('flutter.sdk')
10 | if (flutterRoot == null) {
11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12 | }
13 |
14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
15 | if (flutterVersionCode == null) {
16 | flutterVersionCode = '1'
17 | }
18 |
19 | def flutterVersionName = localProperties.getProperty('flutter.versionName')
20 | if (flutterVersionName == null) {
21 | flutterVersionName = '1.0'
22 | }
23 |
24 | apply plugin: 'com.android.application'
25 | apply plugin: 'kotlin-android'
26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
27 |
28 | android {
29 | compileSdkVersion flutter.compileSdkVersion
30 | ndkVersion flutter.ndkVersion
31 |
32 | compileOptions {
33 | sourceCompatibility JavaVersion.VERSION_1_8
34 | targetCompatibility JavaVersion.VERSION_1_8
35 | }
36 |
37 | kotlinOptions {
38 | jvmTarget = '1.8'
39 | }
40 |
41 | sourceSets {
42 | main.java.srcDirs += 'src/main/kotlin'
43 | }
44 |
45 | defaultConfig {
46 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
47 | applicationId "com.fuelet.flutter_fuels_example"
48 | // You can update the following values to match your application needs.
49 | // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
50 | minSdkVersion flutter.minSdkVersion
51 | targetSdkVersion flutter.targetSdkVersion
52 | versionCode flutterVersionCode.toInteger()
53 | versionName flutterVersionName
54 | }
55 |
56 | buildTypes {
57 | release {
58 | // TODO: Add your own signing config for the release build.
59 | // Signing with the debug keys for now, so `flutter run --release` works.
60 | signingConfig signingConfigs.debug
61 | }
62 | }
63 | }
64 |
65 | flutter {
66 | source '../..'
67 | }
68 |
69 | dependencies {
70 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
71 | }
72 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/example/ios/Runner/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/packages/flutter_fuels/lib/model/fuel_address.dart:
--------------------------------------------------------------------------------
1 | import 'dart:convert';
2 | import 'dart:typed_data';
3 |
4 | import 'package:convert/convert.dart';
5 | import 'package:crypto/crypto.dart';
6 | import 'package:dart_bech32/dart_bech32.dart';
7 | import 'package:equatable/equatable.dart';
8 | import 'package:flutter_fuels/utils/hex_utils.dart';
9 |
10 | const _hrp = 'fuel';
11 |
12 | class FuelAddress with EquatableMixin {
13 | final String bech32Address;
14 | final String b256Address;
15 |
16 | FuelAddress({
17 | required String bech32Address,
18 | required String b256Address,
19 | }) : bech32Address = _formatBechAddress(bech32Address),
20 | b256Address = _formatB256Address(b256Address);
21 |
22 | factory FuelAddress.fromString(String s) {
23 | try {
24 | if (s.startsWith(_hrp)) {
25 | final decoded = bech32m.decode(s);
26 | return FuelAddress(
27 | bech32Address: s,
28 | b256Address: hex.encode(bech32m.fromWords(decoded.words)),
29 | );
30 | } else {
31 | final bytes = hex.decode(removeHexPrefix(s));
32 | final words = bech32m.toWords(Uint8List.fromList(bytes));
33 | return FuelAddress(
34 | bech32Address: bech32m.encode(Decoded(prefix: _hrp, words: words)),
35 | b256Address: s,
36 | );
37 | }
38 | } catch (e) {
39 | throw Exception('Invalid Fuel address $s: $e');
40 | }
41 | }
42 |
43 | @override
44 | List