mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-06-28 12:29:51 +00:00
litecoin mweb support (#1455)
* Fix stub creation * Generate MWEB addresses * Fix mweb address derivation * Use camel-case * Show utxos in tx list * A few fixes * Add spent processing * Update balance * Balance fixes * Update address records * Get rid of debounce hack * Get sending up to the confirmation box * Fee estimation * Stop the daemon if plugin is unloaded * Normal fee for non-mweb txns * Fix fee estimation for send all * Don't hash mweb addresses * More fee fixes * Broadcast mweb * Remove test files * One more * Confirm sent txns * Couple of fixes * Resign inputs after mweb create * Some more fixes * Update balance after sending * Correctly update address records * Update confs * [skip ci] updates * [skip ci] add dep overrides * working * small fix * merge fixes [skip ci] * merge fixes [skip ci] * [skip ci] minor fixes * silent payment fixes [skip ci] * updates [skip ci] * save [skip ci] * use mwebutxos box * [skip ci] lots of fixes, still testing * add rescan from height feature and test workflow build * install go * use sudo * correct package name * move building mweb higher for faster testing * install fixes * install later version of go * go fixes * testing * testing * testing * testing * testing * should workgit add .github/workflows/pr_test_build.yml * ??? * ??? pt.2 * should work, for real this time * fix tx history not persisting + update build_mwebd script * updates * fix some rescan and address gen issues * save [skip ci] * fix unconfirmed balance not updating when receiving * unspent coins / coin control fixes * coin control fixes * address balance and txCount fixes, try/catch electrum call * fix txCount for addresses * save [skip ci] * potential fixes * minor fix * minor fix - 2 * sync status fixes, potential fix for background state issue * workflow and script updates * updates * expirimental optimization * [skip ci] minor enhancements * workflow and script fixes * workflow minor cleanup [skip ci] * minor code cleanup & friendlier error message on failed tx's * balance when sending fix * experimental * more experiments * save * updates * coin control edge cases * remove neutrino.db if no litecoin wallets left after deleting * update translations * updates * minor fix * [skip ci] update translations + minor fixes * state fixes * configure fix * ui updates * translation fixes * [skip ci] addressbook updates * fix popup * fix popup2 * fix litecoin address book * fix ios mwebd build script * fix for building monero.com * minor fix * uncomment fix for state issues * potential mweb sync fix (ios) * remove print [skip ci] * electrum stream potential fix * fix ios build issues [skip ci] * connection reliability updates, update kotlin code to match swift code, minor electrum error handling * dep fixes * minor fix * more merge fixes * bitcoin_flutter removal fixes * [skip ci] fix always scan setting, swift updates * updates * fixes * small fix * small fix * fix * dart:convert != package:convert * change address fixes * update bitcoin_base to fix mweb address program checking * fix ios xcode project [skip ci] * updates * more fixes * more fixes * ensure we don't initialize mweb until we really have to * fix regression * improve mweb reliability * [skip ci] wip adress generation * wip * wip * [skip ci] wip * updates [skip ci] * ios fixes * fix workflows + ios fix * test old mweb version * update go version and mwebd hash * review updates pt.1 * Update cw_bitcoin/lib/litecoin_wallet.dart Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com> * remove non-litecoin address types regex [skip ci] * more minor fixes * remove duplicate [skip ci] * Update lib/store/settings_store.dart Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com> * script updates, swap params on createLitecoinWalletService * topup fix * [skip ci] wip * [skip ci] testing * [skip ci] file didn't get saved * more address generation reliability fixes * [skip ci] minor * minor code cleanup * hopefully prevents send issue * [skip ci] wip address changes * [skip ci] save * save mweb addresses, auto-restart sync process if it gets stuck [skip ci] * address generation issues mostly resolved * more performance fixes * [skip ci] * this should maybe be refactored, pt.1 * separate mweb balances, pt.2 * [skip ci] save * add translations [skip ci] * fix sending with mweb amounts * works for simple mweb-mweb case, further testing needed * found an edge case * [skip ci] make failed broadcast error message less serious * minor * capture all grpc errors and much better error handling overall * [skip ci] minor * prevent transactions with < 6 confirmations from being used + hide mweb balances if mweb is off * fix * merge fixes pt.1 [skip ci] * fix mweb tags * fix * [skip ci] fix tag spacing * fix transaction history not showing up * fix mweb crash on non-fully deleted mweb cache, sync status ETA, other connection fixes * [skip ci] minor code cleanup * [skip ci] minor code cleanup * additional cleanup * silent payments eta fixes and updates * revert sync eta changes into separate pr * [skip ci] minor * [skip ci] minor * revert sync status title * review fixes, additional cleanup * [skip ci] minor * [skip ci] minor * [skip ci] minor * trigger build * review fixes, pt.2 * check if still processing utxos before updating sync status [skip ci] * [skip ci] minor * balance fix * minor * minor * [skip ci] minor * [skip ci] fix test net btc * don't use mwebd for non-mweb tx's * [skip ci] minor cleanup * don't show all 1000+ mweb addresses on receive page * minor cleanup + additional logging --------- Co-authored-by: Hector Chu <hectorchu@gmail.com> Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com> Co-authored-by: Czarek Nakamoto <cyjan@mrcyjanek.net>
This commit is contained in:
parent
fc5878d991
commit
62e0c2a592
120 changed files with 4308 additions and 365 deletions
30
cw_mweb/.gitignore
vendored
Normal file
30
cw_mweb/.gitignore
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
# Miscellaneous
|
||||
*.class
|
||||
*.log
|
||||
*.pyc
|
||||
*.swp
|
||||
.DS_Store
|
||||
.atom/
|
||||
.buildlog/
|
||||
.history
|
||||
.svn/
|
||||
migrate_working_dir/
|
||||
|
||||
# IntelliJ related
|
||||
*.iml
|
||||
*.ipr
|
||||
*.iws
|
||||
.idea/
|
||||
|
||||
# The .vscode folder contains launch configuration and tasks you configure in
|
||||
# VS Code which you may wish to be included in version control, so this line
|
||||
# is commented out by default.
|
||||
#.vscode/
|
||||
|
||||
# Flutter/Dart/Pub related
|
||||
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
|
||||
/pubspec.lock
|
||||
**/doc/api/
|
||||
.dart_tool/
|
||||
.packages
|
||||
build/
|
36
cw_mweb/.metadata
Normal file
36
cw_mweb/.metadata
Normal file
|
@ -0,0 +1,36 @@
|
|||
# This file tracks properties of this Flutter project.
|
||||
# Used by Flutter tool to assess capabilities and perform upgrades etc.
|
||||
#
|
||||
# This file should be version controlled.
|
||||
|
||||
version:
|
||||
revision: f468f3366c26a5092eb964a230ce7892fda8f2f8
|
||||
channel: stable
|
||||
|
||||
project_type: plugin
|
||||
|
||||
# Tracks metadata for the flutter migrate command
|
||||
migration:
|
||||
platforms:
|
||||
- platform: root
|
||||
create_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8
|
||||
base_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8
|
||||
- platform: android
|
||||
create_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8
|
||||
base_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8
|
||||
- platform: ios
|
||||
create_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8
|
||||
base_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8
|
||||
- platform: macos
|
||||
create_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8
|
||||
base_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8
|
||||
|
||||
# User provided section
|
||||
|
||||
# List of Local paths (relative to this file) that should be
|
||||
# ignored by the migrate tool.
|
||||
#
|
||||
# Files that are not part of the templates will be ignored by default.
|
||||
unmanaged_files:
|
||||
- 'lib/main.dart'
|
||||
- 'ios/Runner.xcodeproj/project.pbxproj'
|
3
cw_mweb/CHANGELOG.md
Normal file
3
cw_mweb/CHANGELOG.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
## 0.0.1
|
||||
|
||||
* TODO: Describe initial release.
|
1
cw_mweb/LICENSE
Normal file
1
cw_mweb/LICENSE
Normal file
|
@ -0,0 +1 @@
|
|||
TODO: Add your license here.
|
15
cw_mweb/README.md
Normal file
15
cw_mweb/README.md
Normal file
|
@ -0,0 +1,15 @@
|
|||
# cw_mweb
|
||||
|
||||
A new Flutter plugin project.
|
||||
|
||||
## Getting Started
|
||||
|
||||
This project is a starting point for a Flutter
|
||||
[plug-in package](https://flutter.dev/developing-packages/),
|
||||
a specialized package that includes platform-specific implementation code for
|
||||
Android and/or iOS.
|
||||
|
||||
For help getting started with Flutter development, view the
|
||||
[online documentation](https://flutter.dev/docs), which offers tutorials,
|
||||
samples, guidance on mobile development, and a full API reference.
|
||||
|
4
cw_mweb/analysis_options.yaml
Normal file
4
cw_mweb/analysis_options.yaml
Normal file
|
@ -0,0 +1,4 @@
|
|||
include: package:flutter_lints/flutter.yaml
|
||||
|
||||
# Additional information about this file can be found at
|
||||
# https://dart.dev/guides/language/analysis-options
|
10
cw_mweb/android/.gitignore
vendored
Normal file
10
cw_mweb/android/.gitignore
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
*.iml
|
||||
.gradle
|
||||
/local.properties
|
||||
/.idea/workspace.xml
|
||||
/.idea/libraries
|
||||
.DS_Store
|
||||
/build
|
||||
/captures
|
||||
/libs
|
||||
.cxx
|
76
cw_mweb/android/build.gradle
Normal file
76
cw_mweb/android/build.gradle
Normal file
|
@ -0,0 +1,76 @@
|
|||
group 'com.cakewallet.mweb'
|
||||
version '1.0-SNAPSHOT'
|
||||
|
||||
buildscript {
|
||||
ext.kotlin_version = '1.7.10'
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:7.3.0'
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
|
||||
rootProject.allprojects {
|
||||
repositories {
|
||||
flatDir {
|
||||
dirs project(':cw_mweb').file('libs')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'kotlin-android'
|
||||
|
||||
android {
|
||||
compileSdkVersion 31
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
kotlinOptions {
|
||||
jvmTarget = '1.8'
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main.java.srcDirs += 'src/main/kotlin'
|
||||
test.java.srcDirs += 'src/test/kotlin'
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 16
|
||||
}
|
||||
|
||||
dependencies {
|
||||
testImplementation 'org.jetbrains.kotlin:kotlin-test'
|
||||
testImplementation 'org.mockito:mockito-core:5.0.0'
|
||||
}
|
||||
|
||||
testOptions {
|
||||
unitTests.all {
|
||||
useJUnitPlatform()
|
||||
|
||||
testLogging {
|
||||
events "passed", "skipped", "failed", "standardOut", "standardError"
|
||||
outputs.upToDateWhen {false}
|
||||
showStandardStreams = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation (name: 'mwebd', ext: 'aar')
|
||||
}
|
1
cw_mweb/android/settings.gradle
Normal file
1
cw_mweb/android/settings.gradle
Normal file
|
@ -0,0 +1 @@
|
|||
rootProject.name = 'cw_mweb'
|
3
cw_mweb/android/src/main/AndroidManifest.xml
Normal file
3
cw_mweb/android/src/main/AndroidManifest.xml
Normal file
|
@ -0,0 +1,3 @@
|
|||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.cakewallet.mweb">
|
||||
</manifest>
|
|
@ -0,0 +1,58 @@
|
|||
package com.cakewallet.mweb
|
||||
|
||||
import androidx.annotation.NonNull
|
||||
|
||||
import io.flutter.embedding.engine.plugins.FlutterPlugin
|
||||
import io.flutter.plugin.common.MethodCall
|
||||
import io.flutter.plugin.common.MethodChannel
|
||||
import io.flutter.plugin.common.MethodChannel.MethodCallHandler
|
||||
import io.flutter.plugin.common.MethodChannel.Result
|
||||
|
||||
import mwebd.Mwebd
|
||||
import mwebd.Server
|
||||
|
||||
/** CwMwebPlugin */
|
||||
class CwMwebPlugin: FlutterPlugin, MethodCallHandler {
|
||||
/// The MethodChannel that will the communication between Flutter and native Android
|
||||
///
|
||||
/// This local reference serves to register the plugin with the Flutter Engine and unregister it
|
||||
/// when the Flutter Engine is detached from the Activity
|
||||
private lateinit var channel : MethodChannel
|
||||
private var server: Server? = null
|
||||
private var port: Long? = null
|
||||
|
||||
override fun onAttachedToEngine(@NonNull flutterPluginBinding: FlutterPlugin.FlutterPluginBinding) {
|
||||
channel = MethodChannel(flutterPluginBinding.binaryMessenger, "cw_mweb")
|
||||
channel.setMethodCallHandler(this)
|
||||
}
|
||||
|
||||
override fun onMethodCall(@NonNull call: MethodCall, @NonNull result: Result) {
|
||||
if (call.method == "start") {
|
||||
server?.stop()
|
||||
val dataDir = call.argument("dataDir") ?: ""
|
||||
server = server ?: Mwebd.newServer("", dataDir, "")
|
||||
port = server?.start(0)
|
||||
result.success(port)
|
||||
} else if (call.method == "stop") {
|
||||
server?.stop()
|
||||
server = null
|
||||
port = null
|
||||
result.success(null)
|
||||
} else if (call.method == "address") {
|
||||
val scanSecret: ByteArray = call.argument<ByteArray>("scanSecret") ?: ByteArray(0)
|
||||
val spendPub: ByteArray = call.argument<ByteArray>("spendPub") ?: ByteArray(0)
|
||||
val index: Int = call.argument<Int>("index") ?: 0
|
||||
val res = Mwebd.address(scanSecret, spendPub, index)
|
||||
result.success(res)
|
||||
} else {
|
||||
result.notImplemented()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDetachedFromEngine(@NonNull binding: FlutterPlugin.FlutterPluginBinding) {
|
||||
channel.setMethodCallHandler(null)
|
||||
server?.stop()
|
||||
server = null
|
||||
port = null
|
||||
}
|
||||
}
|
38
cw_mweb/ios/.gitignore
vendored
Normal file
38
cw_mweb/ios/.gitignore
vendored
Normal file
|
@ -0,0 +1,38 @@
|
|||
.idea/
|
||||
.vagrant/
|
||||
.sconsign.dblite
|
||||
.svn/
|
||||
|
||||
.DS_Store
|
||||
*.swp
|
||||
profile
|
||||
|
||||
DerivedData/
|
||||
build/
|
||||
GeneratedPluginRegistrant.h
|
||||
GeneratedPluginRegistrant.m
|
||||
|
||||
.generated/
|
||||
|
||||
*.pbxuser
|
||||
*.mode1v3
|
||||
*.mode2v3
|
||||
*.perspectivev3
|
||||
|
||||
!default.pbxuser
|
||||
!default.mode1v3
|
||||
!default.mode2v3
|
||||
!default.perspectivev3
|
||||
|
||||
xcuserdata
|
||||
|
||||
*.moved-aside
|
||||
|
||||
*.pyc
|
||||
*sync/
|
||||
Icon?
|
||||
.tags*
|
||||
|
||||
/Flutter/Generated.xcconfig
|
||||
/Flutter/ephemeral/
|
||||
/Flutter/flutter_export_environment.sh
|
0
cw_mweb/ios/Assets/.gitkeep
Normal file
0
cw_mweb/ios/Assets/.gitkeep
Normal file
86
cw_mweb/ios/Classes/CwMwebPlugin.swift
Normal file
86
cw_mweb/ios/Classes/CwMwebPlugin.swift
Normal file
|
@ -0,0 +1,86 @@
|
|||
import Flutter
|
||||
import UIKit
|
||||
import Mwebd
|
||||
|
||||
public class CwMwebPlugin: NSObject, FlutterPlugin {
|
||||
public static func register(with registrar: FlutterPluginRegistrar) {
|
||||
let channel = FlutterMethodChannel(name: "cw_mweb", binaryMessenger: registrar.messenger())
|
||||
let instance = CwMwebPlugin()
|
||||
registrar.addMethodCallDelegate(instance, channel: channel)
|
||||
}
|
||||
|
||||
private static var server: MwebdServer?
|
||||
private static var port: Int = 0
|
||||
private static var dataDir: String?
|
||||
|
||||
public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
|
||||
switch call.method {
|
||||
case "getPlatformVersion":
|
||||
result("iOS " + UIDevice.current.systemVersion)
|
||||
break
|
||||
case "start":
|
||||
stopServer()
|
||||
let args = call.arguments as? [String: String]
|
||||
let dataDir = args?["dataDir"]
|
||||
CwMwebPlugin.dataDir = dataDir
|
||||
startServer(result: result)
|
||||
break
|
||||
case "stop":
|
||||
stopServer()
|
||||
result(nil)
|
||||
break
|
||||
case "address":
|
||||
let args = call.arguments as! [String: Any]
|
||||
let scanSecret = args["scanSecret"] as! FlutterStandardTypedData
|
||||
let spendPub = args["spendPub"] as! FlutterStandardTypedData
|
||||
let index = args["index"] as! Int32
|
||||
|
||||
let scanSecretData = scanSecret.data
|
||||
let spendPubData = spendPub.data
|
||||
result(MwebdAddress(scanSecretData, spendPubData, index))
|
||||
break
|
||||
default:
|
||||
result(FlutterMethodNotImplemented)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
private func startServer(result: @escaping FlutterResult) {
|
||||
if CwMwebPlugin.server == nil {
|
||||
var error: NSError?
|
||||
CwMwebPlugin.server = MwebdNewServer("", CwMwebPlugin.dataDir, "", &error)
|
||||
|
||||
if let server = CwMwebPlugin.server {
|
||||
do {
|
||||
print("Starting server...")
|
||||
try server.start(0, ret0_: &CwMwebPlugin.port)
|
||||
print("Server started successfully on port: \(CwMwebPlugin.port)")
|
||||
result(CwMwebPlugin.port)
|
||||
} catch let startError as NSError {
|
||||
print("Server Start Error: \(startError.localizedDescription)")
|
||||
result(FlutterError(code: "Server Start Error", message: startError.localizedDescription, details: nil))
|
||||
}
|
||||
} else if let error = error {
|
||||
print("Server Creation Error: \(error.localizedDescription)")
|
||||
result(FlutterError(code: "Server Creation Error", message: error.localizedDescription, details: nil))
|
||||
} else {
|
||||
print("Unknown Error: Failed to create server")
|
||||
result(FlutterError(code: "Unknown Error", message: "Failed to create server", details: nil))
|
||||
}
|
||||
} else {
|
||||
print("Server already running on port: \(CwMwebPlugin.port)")
|
||||
result(CwMwebPlugin.port)
|
||||
}
|
||||
}
|
||||
|
||||
private func stopServer() {
|
||||
print("Stopping server")
|
||||
CwMwebPlugin.server?.stop()
|
||||
CwMwebPlugin.server = nil
|
||||
CwMwebPlugin.port = 0
|
||||
}
|
||||
|
||||
deinit {
|
||||
stopServer()
|
||||
}
|
||||
}
|
26
cw_mweb/ios/cw_mweb.podspec
Normal file
26
cw_mweb/ios/cw_mweb.podspec
Normal file
|
@ -0,0 +1,26 @@
|
|||
#
|
||||
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html.
|
||||
# Run `pod lib lint cw_mweb.podspec` to validate before publishing.
|
||||
#
|
||||
Pod::Spec.new do |s|
|
||||
s.name = 'cw_mweb'
|
||||
s.version = '0.0.1'
|
||||
s.summary = 'A new Flutter plugin project.'
|
||||
s.description = <<-DESC
|
||||
A new Flutter plugin project.
|
||||
DESC
|
||||
s.homepage = 'http://example.com'
|
||||
s.license = { :file => '../LICENSE' }
|
||||
s.author = { 'Your Company' => 'email@example.com' }
|
||||
s.source = { :path => '.' }
|
||||
s.source_files = 'Classes/**/*'
|
||||
s.dependency 'Flutter'
|
||||
s.platform = :ios, '11.0'
|
||||
|
||||
# Flutter.framework does not contain a i386 slice.
|
||||
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' }
|
||||
s.swift_version = '5.0'
|
||||
s.ios.vendored_frameworks = 'Mwebd.xcframework'
|
||||
s.preserve_paths = 'Mwebd.xcframework/**/*'
|
||||
|
||||
end
|
133
cw_mweb/lib/cw_mweb.dart
Normal file
133
cw_mweb/lib/cw_mweb.dart
Normal file
|
@ -0,0 +1,133 @@
|
|||
import 'dart:typed_data';
|
||||
|
||||
import 'package:grpc/grpc.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'cw_mweb_platform_interface.dart';
|
||||
import 'mwebd.pbgrpc.dart';
|
||||
|
||||
class CwMweb {
|
||||
static RpcClient? _rpcClient;
|
||||
static ClientChannel? _clientChannel;
|
||||
static int? _port;
|
||||
static const TIMEOUT_DURATION = Duration(seconds: 5);
|
||||
|
||||
static Future<void> _initializeClient() async {
|
||||
await stop();
|
||||
// wait a few seconds to make sure the server is stopped
|
||||
await Future.delayed(const Duration(seconds: 5));
|
||||
|
||||
final appDir = await getApplicationSupportDirectory();
|
||||
_port = await CwMwebPlatform.instance.start(appDir.path);
|
||||
if (_port == null || _port == 0) {
|
||||
throw Exception("Failed to start server");
|
||||
}
|
||||
print("Attempting to connect to server on port: $_port");
|
||||
|
||||
// wait for the server to finish starting up before we try to connect to it:
|
||||
await Future.delayed(const Duration(seconds: 5));
|
||||
|
||||
_clientChannel = ClientChannel('127.0.0.1', port: _port!, channelShutdownHandler: () {
|
||||
print("Channel is shutting down!");
|
||||
},
|
||||
options: const ChannelOptions(
|
||||
credentials: ChannelCredentials.insecure(),
|
||||
keepAlive: ClientKeepAliveOptions(permitWithoutCalls: true),
|
||||
));
|
||||
_rpcClient = RpcClient(_clientChannel!);
|
||||
}
|
||||
|
||||
static Future<RpcClient> stub({int maxRetries = 3}) async {
|
||||
for (int i = 0; i < maxRetries; i++) {
|
||||
try {
|
||||
if (_rpcClient == null) {
|
||||
await _initializeClient();
|
||||
}
|
||||
final status = await _rpcClient!
|
||||
.status(StatusRequest(), options: CallOptions(timeout: TIMEOUT_DURATION));
|
||||
if (status.blockTime == 0) {
|
||||
throw Exception("blockTime shouldn't be 0! (this connection is likely broken)");
|
||||
}
|
||||
return _rpcClient!;
|
||||
} catch (e) {
|
||||
print("Attempt $i failed: $e");
|
||||
_rpcClient = null;
|
||||
}
|
||||
}
|
||||
throw Exception("Failed to connect after $maxRetries attempts");
|
||||
}
|
||||
|
||||
static Future<void> stop() async {
|
||||
try {
|
||||
await CwMwebPlatform.instance.stop();
|
||||
await cleanup();
|
||||
} catch (e) {
|
||||
print("Error stopping server: $e");
|
||||
}
|
||||
}
|
||||
|
||||
static Future<String?> address(Uint8List scanSecret, Uint8List spendPub, int index) async {
|
||||
try {
|
||||
return CwMwebPlatform.instance.address(scanSecret, spendPub, index);
|
||||
} catch (e) {
|
||||
print("Error getting address: $e");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
static Future<void> cleanup() async {
|
||||
await _clientChannel?.terminate();
|
||||
_rpcClient = null;
|
||||
_clientChannel = null;
|
||||
_port = null;
|
||||
}
|
||||
|
||||
// wrappers that handle the connection issues:
|
||||
static Future<SpentResponse> spent(SpentRequest request) async {
|
||||
try {
|
||||
if (_rpcClient == null) {
|
||||
await _initializeClient();
|
||||
}
|
||||
return await _rpcClient!.spent(request, options: CallOptions(timeout: TIMEOUT_DURATION));
|
||||
} catch (e) {
|
||||
print("Error getting spent: $e");
|
||||
return SpentResponse();
|
||||
}
|
||||
}
|
||||
|
||||
static Future<StatusResponse> status(StatusRequest request) async {
|
||||
try {
|
||||
if (_rpcClient == null) {
|
||||
await _initializeClient();
|
||||
}
|
||||
return await _rpcClient!.status(request, options: CallOptions(timeout: TIMEOUT_DURATION));
|
||||
} catch (e) {
|
||||
print("Error getting status: $e");
|
||||
return StatusResponse();
|
||||
}
|
||||
}
|
||||
|
||||
static Future<CreateResponse> create(CreateRequest request) async {
|
||||
try {
|
||||
if (_rpcClient == null) {
|
||||
await _initializeClient();
|
||||
}
|
||||
return await _rpcClient!.create(request, options: CallOptions(timeout: TIMEOUT_DURATION));
|
||||
} catch (e) {
|
||||
print("Error getting create: $e");
|
||||
return CreateResponse();
|
||||
}
|
||||
}
|
||||
|
||||
static Future<ResponseStream<Utxo>?> utxos(UtxosRequest request) async {
|
||||
try {
|
||||
if (_rpcClient == null) {
|
||||
await _initializeClient();
|
||||
}
|
||||
// this is a stream, so we should have an effectively infinite timeout:
|
||||
return _rpcClient!.utxos(request, options: CallOptions(timeout: const Duration(days: 1000 * 365)));
|
||||
} catch (e) {
|
||||
print("Error getting utxos: $e");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
32
cw_mweb/lib/cw_mweb_method_channel.dart
Normal file
32
cw_mweb/lib/cw_mweb_method_channel.dart
Normal file
|
@ -0,0 +1,32 @@
|
|||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
import 'cw_mweb_platform_interface.dart';
|
||||
|
||||
/// An implementation of [CwMwebPlatform] that uses method channels.
|
||||
class MethodChannelCwMweb extends CwMwebPlatform {
|
||||
/// The method channel used to interact with the native platform.
|
||||
@visibleForTesting
|
||||
final methodChannel = const MethodChannel('cw_mweb');
|
||||
|
||||
@override
|
||||
Future<int?> start(String dataDir) async {
|
||||
final result = await methodChannel.invokeMethod<int>('start', {'dataDir': dataDir});
|
||||
return result;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> stop() async {
|
||||
await methodChannel.invokeMethod<void>('stop');
|
||||
}
|
||||
|
||||
@override
|
||||
Future<String?> address(Uint8List scanSecret, Uint8List spendPub, int index) async {
|
||||
final result = await methodChannel.invokeMethod<String>('address', {
|
||||
'scanSecret': scanSecret,
|
||||
'spendPub': spendPub,
|
||||
'index': index,
|
||||
});
|
||||
return result;
|
||||
}
|
||||
}
|
39
cw_mweb/lib/cw_mweb_platform_interface.dart
Normal file
39
cw_mweb/lib/cw_mweb_platform_interface.dart
Normal file
|
@ -0,0 +1,39 @@
|
|||
import 'dart:typed_data';
|
||||
|
||||
import 'package:plugin_platform_interface/plugin_platform_interface.dart';
|
||||
|
||||
import 'cw_mweb_method_channel.dart';
|
||||
|
||||
abstract class CwMwebPlatform extends PlatformInterface {
|
||||
/// Constructs a CwMwebPlatform.
|
||||
CwMwebPlatform() : super(token: _token);
|
||||
|
||||
static final Object _token = Object();
|
||||
|
||||
static CwMwebPlatform _instance = MethodChannelCwMweb();
|
||||
|
||||
/// The default instance of [CwMwebPlatform] to use.
|
||||
///
|
||||
/// Defaults to [MethodChannelCwMweb].
|
||||
static CwMwebPlatform get instance => _instance;
|
||||
|
||||
/// Platform-specific implementations should set this with their own
|
||||
/// platform-specific class that extends [CwMwebPlatform] when
|
||||
/// they register themselves.
|
||||
static set instance(CwMwebPlatform instance) {
|
||||
PlatformInterface.verifyToken(instance, _token);
|
||||
_instance = instance;
|
||||
}
|
||||
|
||||
Future<int?> start(String dataDir) {
|
||||
throw UnimplementedError('start() has not been implemented.');
|
||||
}
|
||||
|
||||
Future<void> stop() {
|
||||
throw UnimplementedError('stop() has not been implemented.');
|
||||
}
|
||||
|
||||
Future<String?> address(Uint8List scanSecret, Uint8List spendPub, int index) {
|
||||
throw UnimplementedError('address(int) has not been implemented.');
|
||||
}
|
||||
}
|
801
cw_mweb/lib/mwebd.pb.dart
Normal file
801
cw_mweb/lib/mwebd.pb.dart
Normal file
|
@ -0,0 +1,801 @@
|
|||
//
|
||||
// Generated code. Do not modify.
|
||||
// source: mwebd.proto
|
||||
//
|
||||
// @dart = 2.12
|
||||
|
||||
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
|
||||
// ignore_for_file: constant_identifier_names, library_prefixes
|
||||
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
|
||||
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
|
||||
|
||||
import 'dart:core' as $core;
|
||||
|
||||
import 'package:fixnum/fixnum.dart' as $fixnum;
|
||||
import 'package:protobuf/protobuf.dart' as $pb;
|
||||
|
||||
class StatusRequest extends $pb.GeneratedMessage {
|
||||
factory StatusRequest() => create();
|
||||
StatusRequest._() : super();
|
||||
factory StatusRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
|
||||
factory StatusRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
|
||||
|
||||
static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'StatusRequest', createEmptyInstance: create)
|
||||
..hasRequiredFields = false
|
||||
;
|
||||
|
||||
@$core.Deprecated(
|
||||
'Using this can add significant overhead to your binary. '
|
||||
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
|
||||
'Will be removed in next major version')
|
||||
StatusRequest clone() => StatusRequest()..mergeFromMessage(this);
|
||||
@$core.Deprecated(
|
||||
'Using this can add significant overhead to your binary. '
|
||||
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
|
||||
'Will be removed in next major version')
|
||||
StatusRequest copyWith(void Function(StatusRequest) updates) => super.copyWith((message) => updates(message as StatusRequest)) as StatusRequest;
|
||||
|
||||
$pb.BuilderInfo get info_ => _i;
|
||||
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static StatusRequest create() => StatusRequest._();
|
||||
StatusRequest createEmptyInstance() => create();
|
||||
static $pb.PbList<StatusRequest> createRepeated() => $pb.PbList<StatusRequest>();
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static StatusRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<StatusRequest>(create);
|
||||
static StatusRequest? _defaultInstance;
|
||||
}
|
||||
|
||||
class StatusResponse extends $pb.GeneratedMessage {
|
||||
factory StatusResponse({
|
||||
$core.int? blockHeaderHeight,
|
||||
$core.int? mwebHeaderHeight,
|
||||
$core.int? mwebUtxosHeight,
|
||||
$core.int? blockTime,
|
||||
}) {
|
||||
final $result = create();
|
||||
if (blockHeaderHeight != null) {
|
||||
$result.blockHeaderHeight = blockHeaderHeight;
|
||||
}
|
||||
if (mwebHeaderHeight != null) {
|
||||
$result.mwebHeaderHeight = mwebHeaderHeight;
|
||||
}
|
||||
if (mwebUtxosHeight != null) {
|
||||
$result.mwebUtxosHeight = mwebUtxosHeight;
|
||||
}
|
||||
if (blockTime != null) {
|
||||
$result.blockTime = blockTime;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
StatusResponse._() : super();
|
||||
factory StatusResponse.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
|
||||
factory StatusResponse.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
|
||||
|
||||
static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'StatusResponse', createEmptyInstance: create)
|
||||
..a<$core.int>(1, _omitFieldNames ? '' : 'blockHeaderHeight', $pb.PbFieldType.O3)
|
||||
..a<$core.int>(2, _omitFieldNames ? '' : 'mwebHeaderHeight', $pb.PbFieldType.O3)
|
||||
..a<$core.int>(3, _omitFieldNames ? '' : 'mwebUtxosHeight', $pb.PbFieldType.O3)
|
||||
..a<$core.int>(4, _omitFieldNames ? '' : 'blockTime', $pb.PbFieldType.OU3)
|
||||
..hasRequiredFields = false
|
||||
;
|
||||
|
||||
@$core.Deprecated(
|
||||
'Using this can add significant overhead to your binary. '
|
||||
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
|
||||
'Will be removed in next major version')
|
||||
StatusResponse clone() => StatusResponse()..mergeFromMessage(this);
|
||||
@$core.Deprecated(
|
||||
'Using this can add significant overhead to your binary. '
|
||||
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
|
||||
'Will be removed in next major version')
|
||||
StatusResponse copyWith(void Function(StatusResponse) updates) => super.copyWith((message) => updates(message as StatusResponse)) as StatusResponse;
|
||||
|
||||
$pb.BuilderInfo get info_ => _i;
|
||||
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static StatusResponse create() => StatusResponse._();
|
||||
StatusResponse createEmptyInstance() => create();
|
||||
static $pb.PbList<StatusResponse> createRepeated() => $pb.PbList<StatusResponse>();
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static StatusResponse getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<StatusResponse>(create);
|
||||
static StatusResponse? _defaultInstance;
|
||||
|
||||
@$pb.TagNumber(1)
|
||||
$core.int get blockHeaderHeight => $_getIZ(0);
|
||||
@$pb.TagNumber(1)
|
||||
set blockHeaderHeight($core.int v) { $_setSignedInt32(0, v); }
|
||||
@$pb.TagNumber(1)
|
||||
$core.bool hasBlockHeaderHeight() => $_has(0);
|
||||
@$pb.TagNumber(1)
|
||||
void clearBlockHeaderHeight() => clearField(1);
|
||||
|
||||
@$pb.TagNumber(2)
|
||||
$core.int get mwebHeaderHeight => $_getIZ(1);
|
||||
@$pb.TagNumber(2)
|
||||
set mwebHeaderHeight($core.int v) { $_setSignedInt32(1, v); }
|
||||
@$pb.TagNumber(2)
|
||||
$core.bool hasMwebHeaderHeight() => $_has(1);
|
||||
@$pb.TagNumber(2)
|
||||
void clearMwebHeaderHeight() => clearField(2);
|
||||
|
||||
@$pb.TagNumber(3)
|
||||
$core.int get mwebUtxosHeight => $_getIZ(2);
|
||||
@$pb.TagNumber(3)
|
||||
set mwebUtxosHeight($core.int v) { $_setSignedInt32(2, v); }
|
||||
@$pb.TagNumber(3)
|
||||
$core.bool hasMwebUtxosHeight() => $_has(2);
|
||||
@$pb.TagNumber(3)
|
||||
void clearMwebUtxosHeight() => clearField(3);
|
||||
|
||||
@$pb.TagNumber(4)
|
||||
$core.int get blockTime => $_getIZ(3);
|
||||
@$pb.TagNumber(4)
|
||||
set blockTime($core.int v) { $_setUnsignedInt32(3, v); }
|
||||
@$pb.TagNumber(4)
|
||||
$core.bool hasBlockTime() => $_has(3);
|
||||
@$pb.TagNumber(4)
|
||||
void clearBlockTime() => clearField(4);
|
||||
}
|
||||
|
||||
class UtxosRequest extends $pb.GeneratedMessage {
|
||||
factory UtxosRequest({
|
||||
$core.int? fromHeight,
|
||||
$core.List<$core.int>? scanSecret,
|
||||
}) {
|
||||
final $result = create();
|
||||
if (fromHeight != null) {
|
||||
$result.fromHeight = fromHeight;
|
||||
}
|
||||
if (scanSecret != null) {
|
||||
$result.scanSecret = scanSecret;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
UtxosRequest._() : super();
|
||||
factory UtxosRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
|
||||
factory UtxosRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
|
||||
|
||||
static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'UtxosRequest', createEmptyInstance: create)
|
||||
..a<$core.int>(1, _omitFieldNames ? '' : 'fromHeight', $pb.PbFieldType.O3)
|
||||
..a<$core.List<$core.int>>(2, _omitFieldNames ? '' : 'scanSecret', $pb.PbFieldType.OY)
|
||||
..hasRequiredFields = false
|
||||
;
|
||||
|
||||
@$core.Deprecated(
|
||||
'Using this can add significant overhead to your binary. '
|
||||
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
|
||||
'Will be removed in next major version')
|
||||
UtxosRequest clone() => UtxosRequest()..mergeFromMessage(this);
|
||||
@$core.Deprecated(
|
||||
'Using this can add significant overhead to your binary. '
|
||||
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
|
||||
'Will be removed in next major version')
|
||||
UtxosRequest copyWith(void Function(UtxosRequest) updates) => super.copyWith((message) => updates(message as UtxosRequest)) as UtxosRequest;
|
||||
|
||||
$pb.BuilderInfo get info_ => _i;
|
||||
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static UtxosRequest create() => UtxosRequest._();
|
||||
UtxosRequest createEmptyInstance() => create();
|
||||
static $pb.PbList<UtxosRequest> createRepeated() => $pb.PbList<UtxosRequest>();
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static UtxosRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<UtxosRequest>(create);
|
||||
static UtxosRequest? _defaultInstance;
|
||||
|
||||
@$pb.TagNumber(1)
|
||||
$core.int get fromHeight => $_getIZ(0);
|
||||
@$pb.TagNumber(1)
|
||||
set fromHeight($core.int v) { $_setSignedInt32(0, v); }
|
||||
@$pb.TagNumber(1)
|
||||
$core.bool hasFromHeight() => $_has(0);
|
||||
@$pb.TagNumber(1)
|
||||
void clearFromHeight() => clearField(1);
|
||||
|
||||
@$pb.TagNumber(2)
|
||||
$core.List<$core.int> get scanSecret => $_getN(1);
|
||||
@$pb.TagNumber(2)
|
||||
set scanSecret($core.List<$core.int> v) { $_setBytes(1, v); }
|
||||
@$pb.TagNumber(2)
|
||||
$core.bool hasScanSecret() => $_has(1);
|
||||
@$pb.TagNumber(2)
|
||||
void clearScanSecret() => clearField(2);
|
||||
}
|
||||
|
||||
class Utxo extends $pb.GeneratedMessage {
|
||||
factory Utxo({
|
||||
$core.int? height,
|
||||
$fixnum.Int64? value,
|
||||
$core.String? address,
|
||||
$core.String? outputId,
|
||||
$core.int? blockTime,
|
||||
}) {
|
||||
final $result = create();
|
||||
if (height != null) {
|
||||
$result.height = height;
|
||||
}
|
||||
if (value != null) {
|
||||
$result.value = value;
|
||||
}
|
||||
if (address != null) {
|
||||
$result.address = address;
|
||||
}
|
||||
if (outputId != null) {
|
||||
$result.outputId = outputId;
|
||||
}
|
||||
if (blockTime != null) {
|
||||
$result.blockTime = blockTime;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
Utxo._() : super();
|
||||
factory Utxo.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
|
||||
factory Utxo.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
|
||||
|
||||
static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'Utxo', createEmptyInstance: create)
|
||||
..a<$core.int>(1, _omitFieldNames ? '' : 'height', $pb.PbFieldType.O3)
|
||||
..a<$fixnum.Int64>(2, _omitFieldNames ? '' : 'value', $pb.PbFieldType.OU6, defaultOrMaker: $fixnum.Int64.ZERO)
|
||||
..aOS(3, _omitFieldNames ? '' : 'address')
|
||||
..aOS(4, _omitFieldNames ? '' : 'outputId')
|
||||
..a<$core.int>(5, _omitFieldNames ? '' : 'blockTime', $pb.PbFieldType.OU3)
|
||||
..hasRequiredFields = false
|
||||
;
|
||||
|
||||
@$core.Deprecated(
|
||||
'Using this can add significant overhead to your binary. '
|
||||
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
|
||||
'Will be removed in next major version')
|
||||
Utxo clone() => Utxo()..mergeFromMessage(this);
|
||||
@$core.Deprecated(
|
||||
'Using this can add significant overhead to your binary. '
|
||||
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
|
||||
'Will be removed in next major version')
|
||||
Utxo copyWith(void Function(Utxo) updates) => super.copyWith((message) => updates(message as Utxo)) as Utxo;
|
||||
|
||||
$pb.BuilderInfo get info_ => _i;
|
||||
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static Utxo create() => Utxo._();
|
||||
Utxo createEmptyInstance() => create();
|
||||
static $pb.PbList<Utxo> createRepeated() => $pb.PbList<Utxo>();
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static Utxo getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<Utxo>(create);
|
||||
static Utxo? _defaultInstance;
|
||||
|
||||
@$pb.TagNumber(1)
|
||||
$core.int get height => $_getIZ(0);
|
||||
@$pb.TagNumber(1)
|
||||
set height($core.int v) { $_setSignedInt32(0, v); }
|
||||
@$pb.TagNumber(1)
|
||||
$core.bool hasHeight() => $_has(0);
|
||||
@$pb.TagNumber(1)
|
||||
void clearHeight() => clearField(1);
|
||||
|
||||
@$pb.TagNumber(2)
|
||||
$fixnum.Int64 get value => $_getI64(1);
|
||||
@$pb.TagNumber(2)
|
||||
set value($fixnum.Int64 v) { $_setInt64(1, v); }
|
||||
@$pb.TagNumber(2)
|
||||
$core.bool hasValue() => $_has(1);
|
||||
@$pb.TagNumber(2)
|
||||
void clearValue() => clearField(2);
|
||||
|
||||
@$pb.TagNumber(3)
|
||||
$core.String get address => $_getSZ(2);
|
||||
@$pb.TagNumber(3)
|
||||
set address($core.String v) { $_setString(2, v); }
|
||||
@$pb.TagNumber(3)
|
||||
$core.bool hasAddress() => $_has(2);
|
||||
@$pb.TagNumber(3)
|
||||
void clearAddress() => clearField(3);
|
||||
|
||||
@$pb.TagNumber(4)
|
||||
$core.String get outputId => $_getSZ(3);
|
||||
@$pb.TagNumber(4)
|
||||
set outputId($core.String v) { $_setString(3, v); }
|
||||
@$pb.TagNumber(4)
|
||||
$core.bool hasOutputId() => $_has(3);
|
||||
@$pb.TagNumber(4)
|
||||
void clearOutputId() => clearField(4);
|
||||
|
||||
@$pb.TagNumber(5)
|
||||
$core.int get blockTime => $_getIZ(4);
|
||||
@$pb.TagNumber(5)
|
||||
set blockTime($core.int v) { $_setUnsignedInt32(4, v); }
|
||||
@$pb.TagNumber(5)
|
||||
$core.bool hasBlockTime() => $_has(4);
|
||||
@$pb.TagNumber(5)
|
||||
void clearBlockTime() => clearField(5);
|
||||
}
|
||||
|
||||
class AddressRequest extends $pb.GeneratedMessage {
|
||||
factory AddressRequest({
|
||||
$core.int? fromIndex,
|
||||
$core.int? toIndex,
|
||||
$core.List<$core.int>? scanSecret,
|
||||
$core.List<$core.int>? spendPubkey,
|
||||
}) {
|
||||
final $result = create();
|
||||
if (fromIndex != null) {
|
||||
$result.fromIndex = fromIndex;
|
||||
}
|
||||
if (toIndex != null) {
|
||||
$result.toIndex = toIndex;
|
||||
}
|
||||
if (scanSecret != null) {
|
||||
$result.scanSecret = scanSecret;
|
||||
}
|
||||
if (spendPubkey != null) {
|
||||
$result.spendPubkey = spendPubkey;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
AddressRequest._() : super();
|
||||
factory AddressRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
|
||||
factory AddressRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
|
||||
|
||||
static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'AddressRequest', createEmptyInstance: create)
|
||||
..a<$core.int>(1, _omitFieldNames ? '' : 'fromIndex', $pb.PbFieldType.OU3)
|
||||
..a<$core.int>(2, _omitFieldNames ? '' : 'toIndex', $pb.PbFieldType.OU3)
|
||||
..a<$core.List<$core.int>>(3, _omitFieldNames ? '' : 'scanSecret', $pb.PbFieldType.OY)
|
||||
..a<$core.List<$core.int>>(4, _omitFieldNames ? '' : 'spendPubkey', $pb.PbFieldType.OY)
|
||||
..hasRequiredFields = false
|
||||
;
|
||||
|
||||
@$core.Deprecated(
|
||||
'Using this can add significant overhead to your binary. '
|
||||
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
|
||||
'Will be removed in next major version')
|
||||
AddressRequest clone() => AddressRequest()..mergeFromMessage(this);
|
||||
@$core.Deprecated(
|
||||
'Using this can add significant overhead to your binary. '
|
||||
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
|
||||
'Will be removed in next major version')
|
||||
AddressRequest copyWith(void Function(AddressRequest) updates) => super.copyWith((message) => updates(message as AddressRequest)) as AddressRequest;
|
||||
|
||||
$pb.BuilderInfo get info_ => _i;
|
||||
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static AddressRequest create() => AddressRequest._();
|
||||
AddressRequest createEmptyInstance() => create();
|
||||
static $pb.PbList<AddressRequest> createRepeated() => $pb.PbList<AddressRequest>();
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static AddressRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<AddressRequest>(create);
|
||||
static AddressRequest? _defaultInstance;
|
||||
|
||||
@$pb.TagNumber(1)
|
||||
$core.int get fromIndex => $_getIZ(0);
|
||||
@$pb.TagNumber(1)
|
||||
set fromIndex($core.int v) { $_setUnsignedInt32(0, v); }
|
||||
@$pb.TagNumber(1)
|
||||
$core.bool hasFromIndex() => $_has(0);
|
||||
@$pb.TagNumber(1)
|
||||
void clearFromIndex() => clearField(1);
|
||||
|
||||
@$pb.TagNumber(2)
|
||||
$core.int get toIndex => $_getIZ(1);
|
||||
@$pb.TagNumber(2)
|
||||
set toIndex($core.int v) { $_setUnsignedInt32(1, v); }
|
||||
@$pb.TagNumber(2)
|
||||
$core.bool hasToIndex() => $_has(1);
|
||||
@$pb.TagNumber(2)
|
||||
void clearToIndex() => clearField(2);
|
||||
|
||||
@$pb.TagNumber(3)
|
||||
$core.List<$core.int> get scanSecret => $_getN(2);
|
||||
@$pb.TagNumber(3)
|
||||
set scanSecret($core.List<$core.int> v) { $_setBytes(2, v); }
|
||||
@$pb.TagNumber(3)
|
||||
$core.bool hasScanSecret() => $_has(2);
|
||||
@$pb.TagNumber(3)
|
||||
void clearScanSecret() => clearField(3);
|
||||
|
||||
@$pb.TagNumber(4)
|
||||
$core.List<$core.int> get spendPubkey => $_getN(3);
|
||||
@$pb.TagNumber(4)
|
||||
set spendPubkey($core.List<$core.int> v) { $_setBytes(3, v); }
|
||||
@$pb.TagNumber(4)
|
||||
$core.bool hasSpendPubkey() => $_has(3);
|
||||
@$pb.TagNumber(4)
|
||||
void clearSpendPubkey() => clearField(4);
|
||||
}
|
||||
|
||||
class AddressResponse extends $pb.GeneratedMessage {
|
||||
factory AddressResponse({
|
||||
$core.Iterable<$core.String>? address,
|
||||
}) {
|
||||
final $result = create();
|
||||
if (address != null) {
|
||||
$result.address.addAll(address);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
AddressResponse._() : super();
|
||||
factory AddressResponse.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
|
||||
factory AddressResponse.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
|
||||
|
||||
static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'AddressResponse', createEmptyInstance: create)
|
||||
..pPS(1, _omitFieldNames ? '' : 'address')
|
||||
..hasRequiredFields = false
|
||||
;
|
||||
|
||||
@$core.Deprecated(
|
||||
'Using this can add significant overhead to your binary. '
|
||||
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
|
||||
'Will be removed in next major version')
|
||||
AddressResponse clone() => AddressResponse()..mergeFromMessage(this);
|
||||
@$core.Deprecated(
|
||||
'Using this can add significant overhead to your binary. '
|
||||
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
|
||||
'Will be removed in next major version')
|
||||
AddressResponse copyWith(void Function(AddressResponse) updates) => super.copyWith((message) => updates(message as AddressResponse)) as AddressResponse;
|
||||
|
||||
$pb.BuilderInfo get info_ => _i;
|
||||
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static AddressResponse create() => AddressResponse._();
|
||||
AddressResponse createEmptyInstance() => create();
|
||||
static $pb.PbList<AddressResponse> createRepeated() => $pb.PbList<AddressResponse>();
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static AddressResponse getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<AddressResponse>(create);
|
||||
static AddressResponse? _defaultInstance;
|
||||
|
||||
@$pb.TagNumber(1)
|
||||
$core.List<$core.String> get address => $_getList(0);
|
||||
}
|
||||
|
||||
class SpentRequest extends $pb.GeneratedMessage {
|
||||
factory SpentRequest({
|
||||
$core.Iterable<$core.String>? outputId,
|
||||
}) {
|
||||
final $result = create();
|
||||
if (outputId != null) {
|
||||
$result.outputId.addAll(outputId);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
SpentRequest._() : super();
|
||||
factory SpentRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
|
||||
factory SpentRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
|
||||
|
||||
static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'SpentRequest', createEmptyInstance: create)
|
||||
..pPS(1, _omitFieldNames ? '' : 'outputId')
|
||||
..hasRequiredFields = false
|
||||
;
|
||||
|
||||
@$core.Deprecated(
|
||||
'Using this can add significant overhead to your binary. '
|
||||
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
|
||||
'Will be removed in next major version')
|
||||
SpentRequest clone() => SpentRequest()..mergeFromMessage(this);
|
||||
@$core.Deprecated(
|
||||
'Using this can add significant overhead to your binary. '
|
||||
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
|
||||
'Will be removed in next major version')
|
||||
SpentRequest copyWith(void Function(SpentRequest) updates) => super.copyWith((message) => updates(message as SpentRequest)) as SpentRequest;
|
||||
|
||||
$pb.BuilderInfo get info_ => _i;
|
||||
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static SpentRequest create() => SpentRequest._();
|
||||
SpentRequest createEmptyInstance() => create();
|
||||
static $pb.PbList<SpentRequest> createRepeated() => $pb.PbList<SpentRequest>();
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static SpentRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<SpentRequest>(create);
|
||||
static SpentRequest? _defaultInstance;
|
||||
|
||||
@$pb.TagNumber(1)
|
||||
$core.List<$core.String> get outputId => $_getList(0);
|
||||
}
|
||||
|
||||
class SpentResponse extends $pb.GeneratedMessage {
|
||||
factory SpentResponse({
|
||||
$core.Iterable<$core.String>? outputId,
|
||||
}) {
|
||||
final $result = create();
|
||||
if (outputId != null) {
|
||||
$result.outputId.addAll(outputId);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
SpentResponse._() : super();
|
||||
factory SpentResponse.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
|
||||
factory SpentResponse.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
|
||||
|
||||
static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'SpentResponse', createEmptyInstance: create)
|
||||
..pPS(1, _omitFieldNames ? '' : 'outputId')
|
||||
..hasRequiredFields = false
|
||||
;
|
||||
|
||||
@$core.Deprecated(
|
||||
'Using this can add significant overhead to your binary. '
|
||||
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
|
||||
'Will be removed in next major version')
|
||||
SpentResponse clone() => SpentResponse()..mergeFromMessage(this);
|
||||
@$core.Deprecated(
|
||||
'Using this can add significant overhead to your binary. '
|
||||
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
|
||||
'Will be removed in next major version')
|
||||
SpentResponse copyWith(void Function(SpentResponse) updates) => super.copyWith((message) => updates(message as SpentResponse)) as SpentResponse;
|
||||
|
||||
$pb.BuilderInfo get info_ => _i;
|
||||
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static SpentResponse create() => SpentResponse._();
|
||||
SpentResponse createEmptyInstance() => create();
|
||||
static $pb.PbList<SpentResponse> createRepeated() => $pb.PbList<SpentResponse>();
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static SpentResponse getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<SpentResponse>(create);
|
||||
static SpentResponse? _defaultInstance;
|
||||
|
||||
@$pb.TagNumber(1)
|
||||
$core.List<$core.String> get outputId => $_getList(0);
|
||||
}
|
||||
|
||||
class CreateRequest extends $pb.GeneratedMessage {
|
||||
factory CreateRequest({
|
||||
$core.List<$core.int>? rawTx,
|
||||
$core.List<$core.int>? scanSecret,
|
||||
$core.List<$core.int>? spendSecret,
|
||||
$fixnum.Int64? feeRatePerKb,
|
||||
$core.bool? dryRun,
|
||||
}) {
|
||||
final $result = create();
|
||||
if (rawTx != null) {
|
||||
$result.rawTx = rawTx;
|
||||
}
|
||||
if (scanSecret != null) {
|
||||
$result.scanSecret = scanSecret;
|
||||
}
|
||||
if (spendSecret != null) {
|
||||
$result.spendSecret = spendSecret;
|
||||
}
|
||||
if (feeRatePerKb != null) {
|
||||
$result.feeRatePerKb = feeRatePerKb;
|
||||
}
|
||||
if (dryRun != null) {
|
||||
$result.dryRun = dryRun;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
CreateRequest._() : super();
|
||||
factory CreateRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
|
||||
factory CreateRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
|
||||
|
||||
static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'CreateRequest', createEmptyInstance: create)
|
||||
..a<$core.List<$core.int>>(1, _omitFieldNames ? '' : 'rawTx', $pb.PbFieldType.OY)
|
||||
..a<$core.List<$core.int>>(2, _omitFieldNames ? '' : 'scanSecret', $pb.PbFieldType.OY)
|
||||
..a<$core.List<$core.int>>(3, _omitFieldNames ? '' : 'spendSecret', $pb.PbFieldType.OY)
|
||||
..a<$fixnum.Int64>(4, _omitFieldNames ? '' : 'feeRatePerKb', $pb.PbFieldType.OU6, defaultOrMaker: $fixnum.Int64.ZERO)
|
||||
..aOB(5, _omitFieldNames ? '' : 'dryRun')
|
||||
..hasRequiredFields = false
|
||||
;
|
||||
|
||||
@$core.Deprecated(
|
||||
'Using this can add significant overhead to your binary. '
|
||||
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
|
||||
'Will be removed in next major version')
|
||||
CreateRequest clone() => CreateRequest()..mergeFromMessage(this);
|
||||
@$core.Deprecated(
|
||||
'Using this can add significant overhead to your binary. '
|
||||
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
|
||||
'Will be removed in next major version')
|
||||
CreateRequest copyWith(void Function(CreateRequest) updates) => super.copyWith((message) => updates(message as CreateRequest)) as CreateRequest;
|
||||
|
||||
$pb.BuilderInfo get info_ => _i;
|
||||
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static CreateRequest create() => CreateRequest._();
|
||||
CreateRequest createEmptyInstance() => create();
|
||||
static $pb.PbList<CreateRequest> createRepeated() => $pb.PbList<CreateRequest>();
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static CreateRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<CreateRequest>(create);
|
||||
static CreateRequest? _defaultInstance;
|
||||
|
||||
@$pb.TagNumber(1)
|
||||
$core.List<$core.int> get rawTx => $_getN(0);
|
||||
@$pb.TagNumber(1)
|
||||
set rawTx($core.List<$core.int> v) { $_setBytes(0, v); }
|
||||
@$pb.TagNumber(1)
|
||||
$core.bool hasRawTx() => $_has(0);
|
||||
@$pb.TagNumber(1)
|
||||
void clearRawTx() => clearField(1);
|
||||
|
||||
@$pb.TagNumber(2)
|
||||
$core.List<$core.int> get scanSecret => $_getN(1);
|
||||
@$pb.TagNumber(2)
|
||||
set scanSecret($core.List<$core.int> v) { $_setBytes(1, v); }
|
||||
@$pb.TagNumber(2)
|
||||
$core.bool hasScanSecret() => $_has(1);
|
||||
@$pb.TagNumber(2)
|
||||
void clearScanSecret() => clearField(2);
|
||||
|
||||
@$pb.TagNumber(3)
|
||||
$core.List<$core.int> get spendSecret => $_getN(2);
|
||||
@$pb.TagNumber(3)
|
||||
set spendSecret($core.List<$core.int> v) { $_setBytes(2, v); }
|
||||
@$pb.TagNumber(3)
|
||||
$core.bool hasSpendSecret() => $_has(2);
|
||||
@$pb.TagNumber(3)
|
||||
void clearSpendSecret() => clearField(3);
|
||||
|
||||
@$pb.TagNumber(4)
|
||||
$fixnum.Int64 get feeRatePerKb => $_getI64(3);
|
||||
@$pb.TagNumber(4)
|
||||
set feeRatePerKb($fixnum.Int64 v) { $_setInt64(3, v); }
|
||||
@$pb.TagNumber(4)
|
||||
$core.bool hasFeeRatePerKb() => $_has(3);
|
||||
@$pb.TagNumber(4)
|
||||
void clearFeeRatePerKb() => clearField(4);
|
||||
|
||||
@$pb.TagNumber(5)
|
||||
$core.bool get dryRun => $_getBF(4);
|
||||
@$pb.TagNumber(5)
|
||||
set dryRun($core.bool v) { $_setBool(4, v); }
|
||||
@$pb.TagNumber(5)
|
||||
$core.bool hasDryRun() => $_has(4);
|
||||
@$pb.TagNumber(5)
|
||||
void clearDryRun() => clearField(5);
|
||||
}
|
||||
|
||||
class CreateResponse extends $pb.GeneratedMessage {
|
||||
factory CreateResponse({
|
||||
$core.List<$core.int>? rawTx,
|
||||
$core.Iterable<$core.String>? outputId,
|
||||
}) {
|
||||
final $result = create();
|
||||
if (rawTx != null) {
|
||||
$result.rawTx = rawTx;
|
||||
}
|
||||
if (outputId != null) {
|
||||
$result.outputId.addAll(outputId);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
CreateResponse._() : super();
|
||||
factory CreateResponse.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
|
||||
factory CreateResponse.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
|
||||
|
||||
static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'CreateResponse', createEmptyInstance: create)
|
||||
..a<$core.List<$core.int>>(1, _omitFieldNames ? '' : 'rawTx', $pb.PbFieldType.OY)
|
||||
..pPS(2, _omitFieldNames ? '' : 'outputId')
|
||||
..hasRequiredFields = false
|
||||
;
|
||||
|
||||
@$core.Deprecated(
|
||||
'Using this can add significant overhead to your binary. '
|
||||
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
|
||||
'Will be removed in next major version')
|
||||
CreateResponse clone() => CreateResponse()..mergeFromMessage(this);
|
||||
@$core.Deprecated(
|
||||
'Using this can add significant overhead to your binary. '
|
||||
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
|
||||
'Will be removed in next major version')
|
||||
CreateResponse copyWith(void Function(CreateResponse) updates) => super.copyWith((message) => updates(message as CreateResponse)) as CreateResponse;
|
||||
|
||||
$pb.BuilderInfo get info_ => _i;
|
||||
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static CreateResponse create() => CreateResponse._();
|
||||
CreateResponse createEmptyInstance() => create();
|
||||
static $pb.PbList<CreateResponse> createRepeated() => $pb.PbList<CreateResponse>();
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static CreateResponse getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<CreateResponse>(create);
|
||||
static CreateResponse? _defaultInstance;
|
||||
|
||||
@$pb.TagNumber(1)
|
||||
$core.List<$core.int> get rawTx => $_getN(0);
|
||||
@$pb.TagNumber(1)
|
||||
set rawTx($core.List<$core.int> v) { $_setBytes(0, v); }
|
||||
@$pb.TagNumber(1)
|
||||
$core.bool hasRawTx() => $_has(0);
|
||||
@$pb.TagNumber(1)
|
||||
void clearRawTx() => clearField(1);
|
||||
|
||||
@$pb.TagNumber(2)
|
||||
$core.List<$core.String> get outputId => $_getList(1);
|
||||
}
|
||||
|
||||
class BroadcastRequest extends $pb.GeneratedMessage {
|
||||
factory BroadcastRequest({
|
||||
$core.List<$core.int>? rawTx,
|
||||
}) {
|
||||
final $result = create();
|
||||
if (rawTx != null) {
|
||||
$result.rawTx = rawTx;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
BroadcastRequest._() : super();
|
||||
factory BroadcastRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
|
||||
factory BroadcastRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
|
||||
|
||||
static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'BroadcastRequest', createEmptyInstance: create)
|
||||
..a<$core.List<$core.int>>(1, _omitFieldNames ? '' : 'rawTx', $pb.PbFieldType.OY)
|
||||
..hasRequiredFields = false
|
||||
;
|
||||
|
||||
@$core.Deprecated(
|
||||
'Using this can add significant overhead to your binary. '
|
||||
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
|
||||
'Will be removed in next major version')
|
||||
BroadcastRequest clone() => BroadcastRequest()..mergeFromMessage(this);
|
||||
@$core.Deprecated(
|
||||
'Using this can add significant overhead to your binary. '
|
||||
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
|
||||
'Will be removed in next major version')
|
||||
BroadcastRequest copyWith(void Function(BroadcastRequest) updates) => super.copyWith((message) => updates(message as BroadcastRequest)) as BroadcastRequest;
|
||||
|
||||
$pb.BuilderInfo get info_ => _i;
|
||||
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static BroadcastRequest create() => BroadcastRequest._();
|
||||
BroadcastRequest createEmptyInstance() => create();
|
||||
static $pb.PbList<BroadcastRequest> createRepeated() => $pb.PbList<BroadcastRequest>();
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static BroadcastRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<BroadcastRequest>(create);
|
||||
static BroadcastRequest? _defaultInstance;
|
||||
|
||||
@$pb.TagNumber(1)
|
||||
$core.List<$core.int> get rawTx => $_getN(0);
|
||||
@$pb.TagNumber(1)
|
||||
set rawTx($core.List<$core.int> v) { $_setBytes(0, v); }
|
||||
@$pb.TagNumber(1)
|
||||
$core.bool hasRawTx() => $_has(0);
|
||||
@$pb.TagNumber(1)
|
||||
void clearRawTx() => clearField(1);
|
||||
}
|
||||
|
||||
class BroadcastResponse extends $pb.GeneratedMessage {
|
||||
factory BroadcastResponse({
|
||||
$core.String? txid,
|
||||
}) {
|
||||
final $result = create();
|
||||
if (txid != null) {
|
||||
$result.txid = txid;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
BroadcastResponse._() : super();
|
||||
factory BroadcastResponse.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
|
||||
factory BroadcastResponse.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
|
||||
|
||||
static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'BroadcastResponse', createEmptyInstance: create)
|
||||
..aOS(1, _omitFieldNames ? '' : 'txid')
|
||||
..hasRequiredFields = false
|
||||
;
|
||||
|
||||
@$core.Deprecated(
|
||||
'Using this can add significant overhead to your binary. '
|
||||
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
|
||||
'Will be removed in next major version')
|
||||
BroadcastResponse clone() => BroadcastResponse()..mergeFromMessage(this);
|
||||
@$core.Deprecated(
|
||||
'Using this can add significant overhead to your binary. '
|
||||
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
|
||||
'Will be removed in next major version')
|
||||
BroadcastResponse copyWith(void Function(BroadcastResponse) updates) => super.copyWith((message) => updates(message as BroadcastResponse)) as BroadcastResponse;
|
||||
|
||||
$pb.BuilderInfo get info_ => _i;
|
||||
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static BroadcastResponse create() => BroadcastResponse._();
|
||||
BroadcastResponse createEmptyInstance() => create();
|
||||
static $pb.PbList<BroadcastResponse> createRepeated() => $pb.PbList<BroadcastResponse>();
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static BroadcastResponse getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<BroadcastResponse>(create);
|
||||
static BroadcastResponse? _defaultInstance;
|
||||
|
||||
@$pb.TagNumber(1)
|
||||
$core.String get txid => $_getSZ(0);
|
||||
@$pb.TagNumber(1)
|
||||
set txid($core.String v) { $_setString(0, v); }
|
||||
@$pb.TagNumber(1)
|
||||
$core.bool hasTxid() => $_has(0);
|
||||
@$pb.TagNumber(1)
|
||||
void clearTxid() => clearField(1);
|
||||
}
|
||||
|
||||
|
||||
const _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names');
|
||||
const _omitMessageNames = $core.bool.fromEnvironment('protobuf.omit_message_names');
|
159
cw_mweb/lib/mwebd.pbgrpc.dart
Normal file
159
cw_mweb/lib/mwebd.pbgrpc.dart
Normal file
|
@ -0,0 +1,159 @@
|
|||
//
|
||||
// Generated code. Do not modify.
|
||||
// source: mwebd.proto
|
||||
//
|
||||
// @dart = 2.12
|
||||
|
||||
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
|
||||
// ignore_for_file: constant_identifier_names, library_prefixes
|
||||
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
|
||||
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
|
||||
|
||||
import 'dart:async' as $async;
|
||||
import 'dart:core' as $core;
|
||||
|
||||
import 'package:grpc/service_api.dart' as $grpc;
|
||||
import 'package:protobuf/protobuf.dart' as $pb;
|
||||
|
||||
import 'mwebd.pb.dart' as $0;
|
||||
|
||||
export 'mwebd.pb.dart';
|
||||
|
||||
@$pb.GrpcServiceName('Rpc')
|
||||
class RpcClient extends $grpc.Client {
|
||||
static final _$status = $grpc.ClientMethod<$0.StatusRequest, $0.StatusResponse>(
|
||||
'/Rpc/Status',
|
||||
($0.StatusRequest value) => value.writeToBuffer(),
|
||||
($core.List<$core.int> value) => $0.StatusResponse.fromBuffer(value));
|
||||
static final _$utxos = $grpc.ClientMethod<$0.UtxosRequest, $0.Utxo>(
|
||||
'/Rpc/Utxos',
|
||||
($0.UtxosRequest value) => value.writeToBuffer(),
|
||||
($core.List<$core.int> value) => $0.Utxo.fromBuffer(value));
|
||||
static final _$addresses = $grpc.ClientMethod<$0.AddressRequest, $0.AddressResponse>(
|
||||
'/Rpc/Addresses',
|
||||
($0.AddressRequest value) => value.writeToBuffer(),
|
||||
($core.List<$core.int> value) => $0.AddressResponse.fromBuffer(value));
|
||||
static final _$spent = $grpc.ClientMethod<$0.SpentRequest, $0.SpentResponse>(
|
||||
'/Rpc/Spent',
|
||||
($0.SpentRequest value) => value.writeToBuffer(),
|
||||
($core.List<$core.int> value) => $0.SpentResponse.fromBuffer(value));
|
||||
static final _$create = $grpc.ClientMethod<$0.CreateRequest, $0.CreateResponse>(
|
||||
'/Rpc/Create',
|
||||
($0.CreateRequest value) => value.writeToBuffer(),
|
||||
($core.List<$core.int> value) => $0.CreateResponse.fromBuffer(value));
|
||||
static final _$broadcast = $grpc.ClientMethod<$0.BroadcastRequest, $0.BroadcastResponse>(
|
||||
'/Rpc/Broadcast',
|
||||
($0.BroadcastRequest value) => value.writeToBuffer(),
|
||||
($core.List<$core.int> value) => $0.BroadcastResponse.fromBuffer(value));
|
||||
|
||||
RpcClient($grpc.ClientChannel channel,
|
||||
{$grpc.CallOptions? options,
|
||||
$core.Iterable<$grpc.ClientInterceptor>? interceptors})
|
||||
: super(channel, options: options,
|
||||
interceptors: interceptors);
|
||||
|
||||
$grpc.ResponseFuture<$0.StatusResponse> status($0.StatusRequest request, {$grpc.CallOptions? options}) {
|
||||
return $createUnaryCall(_$status, request, options: options);
|
||||
}
|
||||
|
||||
$grpc.ResponseStream<$0.Utxo> utxos($0.UtxosRequest request, {$grpc.CallOptions? options}) {
|
||||
return $createStreamingCall(_$utxos, $async.Stream.fromIterable([request]), options: options);
|
||||
}
|
||||
|
||||
$grpc.ResponseFuture<$0.AddressResponse> addresses($0.AddressRequest request, {$grpc.CallOptions? options}) {
|
||||
return $createUnaryCall(_$addresses, request, options: options);
|
||||
}
|
||||
|
||||
$grpc.ResponseFuture<$0.SpentResponse> spent($0.SpentRequest request, {$grpc.CallOptions? options}) {
|
||||
return $createUnaryCall(_$spent, request, options: options);
|
||||
}
|
||||
|
||||
$grpc.ResponseFuture<$0.CreateResponse> create($0.CreateRequest request, {$grpc.CallOptions? options}) {
|
||||
return $createUnaryCall(_$create, request, options: options);
|
||||
}
|
||||
|
||||
$grpc.ResponseFuture<$0.BroadcastResponse> broadcast($0.BroadcastRequest request, {$grpc.CallOptions? options}) {
|
||||
return $createUnaryCall(_$broadcast, request, options: options);
|
||||
}
|
||||
}
|
||||
|
||||
@$pb.GrpcServiceName('Rpc')
|
||||
abstract class RpcServiceBase extends $grpc.Service {
|
||||
$core.String get $name => 'Rpc';
|
||||
|
||||
RpcServiceBase() {
|
||||
$addMethod($grpc.ServiceMethod<$0.StatusRequest, $0.StatusResponse>(
|
||||
'Status',
|
||||
status_Pre,
|
||||
false,
|
||||
false,
|
||||
($core.List<$core.int> value) => $0.StatusRequest.fromBuffer(value),
|
||||
($0.StatusResponse value) => value.writeToBuffer()));
|
||||
$addMethod($grpc.ServiceMethod<$0.UtxosRequest, $0.Utxo>(
|
||||
'Utxos',
|
||||
utxos_Pre,
|
||||
false,
|
||||
true,
|
||||
($core.List<$core.int> value) => $0.UtxosRequest.fromBuffer(value),
|
||||
($0.Utxo value) => value.writeToBuffer()));
|
||||
$addMethod($grpc.ServiceMethod<$0.AddressRequest, $0.AddressResponse>(
|
||||
'Addresses',
|
||||
addresses_Pre,
|
||||
false,
|
||||
false,
|
||||
($core.List<$core.int> value) => $0.AddressRequest.fromBuffer(value),
|
||||
($0.AddressResponse value) => value.writeToBuffer()));
|
||||
$addMethod($grpc.ServiceMethod<$0.SpentRequest, $0.SpentResponse>(
|
||||
'Spent',
|
||||
spent_Pre,
|
||||
false,
|
||||
false,
|
||||
($core.List<$core.int> value) => $0.SpentRequest.fromBuffer(value),
|
||||
($0.SpentResponse value) => value.writeToBuffer()));
|
||||
$addMethod($grpc.ServiceMethod<$0.CreateRequest, $0.CreateResponse>(
|
||||
'Create',
|
||||
create_Pre,
|
||||
false,
|
||||
false,
|
||||
($core.List<$core.int> value) => $0.CreateRequest.fromBuffer(value),
|
||||
($0.CreateResponse value) => value.writeToBuffer()));
|
||||
$addMethod($grpc.ServiceMethod<$0.BroadcastRequest, $0.BroadcastResponse>(
|
||||
'Broadcast',
|
||||
broadcast_Pre,
|
||||
false,
|
||||
false,
|
||||
($core.List<$core.int> value) => $0.BroadcastRequest.fromBuffer(value),
|
||||
($0.BroadcastResponse value) => value.writeToBuffer()));
|
||||
}
|
||||
|
||||
$async.Future<$0.StatusResponse> status_Pre($grpc.ServiceCall call, $async.Future<$0.StatusRequest> request) async {
|
||||
return status(call, await request);
|
||||
}
|
||||
|
||||
$async.Stream<$0.Utxo> utxos_Pre($grpc.ServiceCall call, $async.Future<$0.UtxosRequest> request) async* {
|
||||
yield* utxos(call, await request);
|
||||
}
|
||||
|
||||
$async.Future<$0.AddressResponse> addresses_Pre($grpc.ServiceCall call, $async.Future<$0.AddressRequest> request) async {
|
||||
return addresses(call, await request);
|
||||
}
|
||||
|
||||
$async.Future<$0.SpentResponse> spent_Pre($grpc.ServiceCall call, $async.Future<$0.SpentRequest> request) async {
|
||||
return spent(call, await request);
|
||||
}
|
||||
|
||||
$async.Future<$0.CreateResponse> create_Pre($grpc.ServiceCall call, $async.Future<$0.CreateRequest> request) async {
|
||||
return create(call, await request);
|
||||
}
|
||||
|
||||
$async.Future<$0.BroadcastResponse> broadcast_Pre($grpc.ServiceCall call, $async.Future<$0.BroadcastRequest> request) async {
|
||||
return broadcast(call, await request);
|
||||
}
|
||||
|
||||
$async.Future<$0.StatusResponse> status($grpc.ServiceCall call, $0.StatusRequest request);
|
||||
$async.Stream<$0.Utxo> utxos($grpc.ServiceCall call, $0.UtxosRequest request);
|
||||
$async.Future<$0.AddressResponse> addresses($grpc.ServiceCall call, $0.AddressRequest request);
|
||||
$async.Future<$0.SpentResponse> spent($grpc.ServiceCall call, $0.SpentRequest request);
|
||||
$async.Future<$0.CreateResponse> create($grpc.ServiceCall call, $0.CreateRequest request);
|
||||
$async.Future<$0.BroadcastResponse> broadcast($grpc.ServiceCall call, $0.BroadcastRequest request);
|
||||
}
|
19
cw_mweb/macos/Classes/CwMwebPlugin.swift
Normal file
19
cw_mweb/macos/Classes/CwMwebPlugin.swift
Normal file
|
@ -0,0 +1,19 @@
|
|||
import Cocoa
|
||||
import FlutterMacOS
|
||||
|
||||
public class CwMwebPlugin: NSObject, FlutterPlugin {
|
||||
public static func register(with registrar: FlutterPluginRegistrar) {
|
||||
let channel = FlutterMethodChannel(name: "cw_mweb", binaryMessenger: registrar.messenger)
|
||||
let instance = CwMwebPlugin()
|
||||
registrar.addMethodCallDelegate(instance, channel: channel)
|
||||
}
|
||||
|
||||
public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
|
||||
switch call.method {
|
||||
case "getPlatformVersion":
|
||||
result("macOS " + ProcessInfo.processInfo.operatingSystemVersionString)
|
||||
default:
|
||||
result(FlutterMethodNotImplemented)
|
||||
}
|
||||
}
|
||||
}
|
23
cw_mweb/macos/cw_mweb.podspec
Normal file
23
cw_mweb/macos/cw_mweb.podspec
Normal file
|
@ -0,0 +1,23 @@
|
|||
#
|
||||
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html.
|
||||
# Run `pod lib lint cw_mweb.podspec` to validate before publishing.
|
||||
#
|
||||
Pod::Spec.new do |s|
|
||||
s.name = 'cw_mweb'
|
||||
s.version = '0.0.1'
|
||||
s.summary = 'A new Flutter plugin project.'
|
||||
s.description = <<-DESC
|
||||
A new Flutter plugin project.
|
||||
DESC
|
||||
s.homepage = 'http://example.com'
|
||||
s.license = { :file => '../LICENSE' }
|
||||
s.author = { 'Your Company' => 'email@example.com' }
|
||||
|
||||
s.source = { :path => '.' }
|
||||
s.source_files = 'Classes/**/*'
|
||||
s.dependency 'FlutterMacOS'
|
||||
|
||||
s.platform = :osx, '10.11'
|
||||
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' }
|
||||
s.swift_version = '5.0'
|
||||
end
|
76
cw_mweb/pubspec.yaml
Normal file
76
cw_mweb/pubspec.yaml
Normal file
|
@ -0,0 +1,76 @@
|
|||
name: cw_mweb
|
||||
description: A new Flutter plugin project.
|
||||
version: 0.0.1
|
||||
homepage:
|
||||
|
||||
environment:
|
||||
sdk: '>=3.0.6 <4.0.0'
|
||||
flutter: ">=3.3.0"
|
||||
|
||||
dependencies:
|
||||
flutter:
|
||||
sdk: flutter
|
||||
grpc: ^3.2.4
|
||||
path_provider: ^2.1.2
|
||||
plugin_platform_interface: ^2.0.2
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
flutter_lints: ^2.0.0
|
||||
|
||||
# For information on the generic Dart part of this file, see the
|
||||
# following page: https://dart.dev/tools/pub/pubspec
|
||||
|
||||
# The following section is specific to Flutter packages.
|
||||
flutter:
|
||||
# This section identifies this Flutter project as a plugin project.
|
||||
# The 'pluginClass' specifies the class (in Java, Kotlin, Swift, Objective-C, etc.)
|
||||
# which should be registered in the plugin registry. This is required for
|
||||
# using method channels.
|
||||
# The Android 'package' specifies package in which the registered class is.
|
||||
# This is required for using method channels on Android.
|
||||
# The 'ffiPlugin' specifies that native code should be built and bundled.
|
||||
# This is required for using `dart:ffi`.
|
||||
# All these are used by the tooling to maintain consistency when
|
||||
# adding or updating assets for this project.
|
||||
plugin:
|
||||
platforms:
|
||||
android:
|
||||
package: com.cakewallet.mweb
|
||||
pluginClass: CwMwebPlugin
|
||||
ios:
|
||||
pluginClass: CwMwebPlugin
|
||||
macos:
|
||||
pluginClass: CwMwebPlugin
|
||||
|
||||
# To add assets to your plugin package, add an assets section, like this:
|
||||
# assets:
|
||||
# - images/a_dot_burr.jpeg
|
||||
# - images/a_dot_ham.jpeg
|
||||
#
|
||||
# For details regarding assets in packages, see
|
||||
# https://flutter.dev/assets-and-images/#from-packages
|
||||
#
|
||||
# An image asset can refer to one or more resolution-specific "variants", see
|
||||
# https://flutter.dev/assets-and-images/#resolution-aware
|
||||
|
||||
# To add custom fonts to your plugin package, add a fonts section here,
|
||||
# in this "flutter" section. Each entry in this list should have a
|
||||
# "family" key with the font family name, and a "fonts" key with a
|
||||
# list giving the asset and other descriptors for the font. For
|
||||
# example:
|
||||
# fonts:
|
||||
# - family: Schyler
|
||||
# fonts:
|
||||
# - asset: fonts/Schyler-Regular.ttf
|
||||
# - asset: fonts/Schyler-Italic.ttf
|
||||
# style: italic
|
||||
# - family: Trajan Pro
|
||||
# fonts:
|
||||
# - asset: fonts/TrajanPro.ttf
|
||||
# - asset: fonts/TrajanPro_Bold.ttf
|
||||
# weight: 700
|
||||
#
|
||||
# For details regarding fonts in packages, see
|
||||
# https://flutter.dev/custom-fonts/#from-packages
|
Loading…
Add table
Add a link
Reference in a new issue