Add mwebd

This commit is contained in:
Hector Chu 2024-04-21 00:20:52 +01:00
parent 376632e22d
commit 9e9ff7095e
31 changed files with 1569 additions and 0 deletions

View file

@ -1,3 +1,4 @@
import 'dart:async';
import 'package:bitcoin_base/bitcoin_base.dart';
import 'package:cw_bitcoin/bitcoin_mnemonic.dart';
import 'package:cw_bitcoin/bitcoin_transaction_priority.dart';
@ -14,6 +15,8 @@ import 'package:cw_bitcoin/electrum_wallet.dart';
import 'package:cw_bitcoin/bitcoin_address_record.dart';
import 'package:cw_bitcoin/electrum_balance.dart';
import 'package:cw_bitcoin/litecoin_network.dart';
import 'package:cw_mweb/cw_mweb.dart';
import 'package:cw_mweb/mwebd.pb.dart';
import 'package:bitcoin_flutter/bitcoin_flutter.dart' as bitcoin;
part 'litecoin_wallet.g.dart';
@ -103,6 +106,18 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
);
}
@action
@override
Future<void> startSync() async {
super.startSync();
final stub = CwMweb.stub();
Timer.periodic(
const Duration(seconds: 1), (timer) async {
final resp = await stub.status(StatusRequest());
print(resp.blockHeaderHeight);
});
}
@override
int feeRate(TransactionPriority priority) {
if (priority is LitecoinTransactionPriority) {

View file

@ -1,4 +1,5 @@
import 'dart:io';
import 'package:path_provider/path_provider.dart';
import 'package:cw_core/unspent_coins_info.dart';
import 'package:hive/hive.dart';
import 'package:cw_bitcoin/bitcoin_mnemonic.dart';
@ -10,6 +11,7 @@ import 'package:cw_core/pathForWallet.dart';
import 'package:cw_core/wallet_type.dart';
import 'package:cw_core/wallet_info.dart';
import 'package:cw_core/wallet_base.dart';
import 'package:cw_mweb/cw_mweb.dart';
import 'package:collection/collection.dart';
class LitecoinWalletService extends WalletService<
@ -26,6 +28,8 @@ class LitecoinWalletService extends WalletService<
@override
Future<LitecoinWallet> create(BitcoinNewWalletCredentials credentials, {bool? isTestnet}) async {
final appDir = await getApplicationSupportDirectory();
await CwMweb.start(appDir.path);
final wallet = await LitecoinWalletBase.create(
mnemonic: await generateMnemonic(),
password: credentials.password!,
@ -43,6 +47,8 @@ class LitecoinWalletService extends WalletService<
@override
Future<LitecoinWallet> openWallet(String name, String password) async {
final appDir = await getApplicationSupportDirectory();
await CwMweb.start(appDir.path);
final walletInfo = walletInfoSource.values.firstWhereOrNull(
(info) => info.id == WalletBase.idFor(name, getType()))!;

View file

@ -17,6 +17,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "4.7.0"
archive:
dependency: transitive
description:
name: archive
sha256: "22600aa1e926be775fa5fe7e6894e7fb3df9efda8891c73f70fb3262399a432d"
url: "https://pub.dev"
source: hosted
version: "3.4.10"
args:
dependency: transitive
description:
@ -252,6 +260,13 @@ packages:
relative: true
source: path
version: "0.0.1"
cw_mweb:
dependency: "direct main"
description:
path: "../cw_mweb"
relative: true
source: path
version: "0.0.1"
dart_style:
dependency: transitive
description:
@ -334,6 +349,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.2"
googleapis_auth:
dependency: transitive
description:
name: googleapis_auth
sha256: af7c3a3edf9d0de2e1e0a77e994fae0a581c525fa7012af4fa0d4a52ed9484da
url: "https://pub.dev"
source: hosted
version: "1.4.1"
graphs:
dependency: transitive
description:
@ -342,6 +365,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.3.1"
grpc:
dependency: "direct main"
description:
name: grpc
sha256: e93ee3bce45c134bf44e9728119102358c7cd69de7832d9a874e2e74eb8cab40
url: "https://pub.dev"
source: hosted
version: "3.2.4"
hex:
dependency: transitive
description:
@ -374,6 +405,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.1.0"
http2:
dependency: transitive
description:
name: http2
sha256: "9ced024a160b77aba8fb8674e38f70875e321d319e6f303ec18e87bd5a4b0c1d"
url: "https://pub.dev"
source: hosted
version: "2.3.0"
http_multi_server:
dependency: transitive
description:
@ -582,6 +621,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.5.1"
protobuf:
dependency: transitive
description:
name: protobuf
sha256: "68645b24e0716782e58948f8467fd42a880f255096a821f9e7d0ec625b00c84d"
url: "https://pub.dev"
source: hosted
version: "3.1.0"
provider:
dependency: transitive
description:

View file

@ -35,6 +35,9 @@ dependencies:
url: https://github.com/cake-tech/bitcoin_base.git
ref: cake-update-v2
blockchain_utils: ^2.1.1
cw_mweb:
path: ../cw_mweb
grpc: ^3.2.4
dev_dependencies:
flutter_test:

31
cw_mweb/.gitignore vendored Normal file
View file

@ -0,0 +1,31 @@
# 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/
libs/

36
cw_mweb/.metadata Normal file
View 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
View file

@ -0,0 +1,3 @@
## 0.0.1
* TODO: Describe initial release.

1
cw_mweb/LICENSE Normal file
View file

@ -0,0 +1 @@
TODO: Add your license here.

15
cw_mweb/README.md Normal file
View 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.

View 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

9
cw_mweb/android/.gitignore vendored Normal file
View file

@ -0,0 +1,9 @@
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
.cxx

View 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')
}

View file

@ -0,0 +1 @@
rootProject.name = 'cw_mweb'

View file

@ -0,0 +1,3 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.cakewallet.mweb">
</manifest>

View file

@ -0,0 +1,43 @@
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
/** 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 started = false
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") {
if (started) return
val dataDir = call.argument("dataDir") ?: ""
val server = Mwebd.newServer("mainnet", dataDir, "")
server.start(12345, true)
started = true
result.success(true)
} else {
result.notImplemented()
}
}
override fun onDetachedFromEngine(@NonNull binding: FlutterPlugin.FlutterPluginBinding) {
channel.setMethodCallHandler(null)
}
}

View file

@ -0,0 +1,27 @@
package com.cakewallet.mweb
import io.flutter.plugin.common.MethodCall
import io.flutter.plugin.common.MethodChannel
import kotlin.test.Test
import org.mockito.Mockito
/*
* This demonstrates a simple unit test of the Kotlin portion of this plugin's implementation.
*
* Once you have built the plugin's example app, you can run these tests from the command
* line by running `./gradlew testDebugUnitTest` in the `example/android/` directory, or
* you can run them directly from IDEs that support JUnit such as Android Studio.
*/
internal class CwMwebPluginTest {
@Test
fun onMethodCall_getPlatformVersion_returnsExpectedValue() {
val plugin = CwMwebPlugin()
val call = MethodCall("getPlatformVersion", null)
val mockResult: MethodChannel.Result = Mockito.mock(MethodChannel.Result::class.java)
plugin.onMethodCall(call, mockResult)
Mockito.verify(mockResult).success("Android " + android.os.Build.VERSION.RELEASE)
}
}

38
cw_mweb/ios/.gitignore vendored Normal file
View 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

View file

View file

@ -0,0 +1,19 @@
import Flutter
import UIKit
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("iOS " + UIDevice.current.systemVersion)
default:
result(FlutterMethodNotImplemented)
}
}
}

View 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 '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'
end

17
cw_mweb/lib/cw_mweb.dart Normal file
View file

@ -0,0 +1,17 @@
import 'package:grpc/grpc.dart';
import 'cw_mweb_platform_interface.dart';
import 'mwebd.pbgrpc.dart';
class CwMweb {
static Future<bool?> start(String dataDir) {
return CwMwebPlatform.instance.start(dataDir);
}
static stub() {
final channel = ClientChannel('127.0.0.1',
port: 12345,
options: const ChannelOptions(
credentials: ChannelCredentials.insecure()));
return RpcClient(channel);
}
}

View file

@ -0,0 +1,17 @@
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<bool?> start(String dataDir) async {
final result = await methodChannel.invokeMethod<bool>('start', {'dataDir': dataDir});
return result;
}
}

View file

@ -0,0 +1,29 @@
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<bool?> start(String dataDir) {
throw UnimplementedError('start() has not been implemented.');
}
}

773
cw_mweb/lib/mwebd.pb.dart Normal file
View file

@ -0,0 +1,773 @@
//
// 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,
}) {
final $result = create();
if (blockHeaderHeight != null) {
$result.blockHeaderHeight = blockHeaderHeight;
}
if (mwebHeaderHeight != null) {
$result.mwebHeaderHeight = mwebHeaderHeight;
}
if (mwebUtxosHeight != null) {
$result.mwebUtxosHeight = mwebUtxosHeight;
}
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)
..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);
}
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,
}) {
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;
}
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')
..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);
}
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');

View 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);
}

View 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)
}
}
}

View 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

74
cw_mweb/pubspec.yaml Normal file
View file

@ -0,0 +1,74 @@
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
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

View file

@ -0,0 +1,27 @@
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:cw_mweb/cw_mweb_method_channel.dart';
void main() {
TestWidgetsFlutterBinding.ensureInitialized();
MethodChannelCwMweb platform = MethodChannelCwMweb();
const MethodChannel channel = MethodChannel('cw_mweb');
setUp(() {
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger.setMockMethodCallHandler(
channel,
(MethodCall methodCall) async {
return '42';
},
);
});
tearDown(() {
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger.setMockMethodCallHandler(channel, null);
});
test('getPlatformVersion', () async {
expect(await platform.getPlatformVersion(), '42');
});
}

View file

@ -0,0 +1,29 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:cw_mweb/cw_mweb.dart';
import 'package:cw_mweb/cw_mweb_platform_interface.dart';
import 'package:cw_mweb/cw_mweb_method_channel.dart';
import 'package:plugin_platform_interface/plugin_platform_interface.dart';
class MockCwMwebPlatform
with MockPlatformInterfaceMixin
implements CwMwebPlatform {
@override
Future<String?> getPlatformVersion() => Future.value('42');
}
void main() {
final CwMwebPlatform initialPlatform = CwMwebPlatform.instance;
test('$MethodChannelCwMweb is the default instance', () {
expect(initialPlatform, isInstanceOf<MethodChannelCwMweb>());
});
test('getPlatformVersion', () async {
CwMweb cwMwebPlugin = CwMweb();
MockCwMwebPlatform fakePlatform = MockCwMwebPlatform();
CwMwebPlatform.instance = fakePlatform;
expect(await cwMwebPlugin.getPlatformVersion(), '42');
});
}

View file

@ -7,6 +7,7 @@ import Foundation
import connectivity_plus
import cw_monero
import cw_mweb
import device_info_plus
import devicelocale
import flutter_inappwebview_macos
@ -23,6 +24,7 @@ import wakelock_plus
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
ConnectivityPlugin.register(with: registry.registrar(forPlugin: "ConnectivityPlugin"))
CwMoneroPlugin.register(with: registry.registrar(forPlugin: "CwMoneroPlugin"))
CwMwebPlugin.register(with: registry.registrar(forPlugin: "CwMwebPlugin"))
DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin"))
DevicelocalePlugin.register(with: registry.registrar(forPlugin: "DevicelocalePlugin"))
InAppWebViewFlutterPlugin.register(with: registry.registrar(forPlugin: "InAppWebViewFlutterPlugin"))