Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add proto files for cosmos_node_client #288

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module github.com/tendermint/flutter/v2

go 1.16
go 1.16
12 changes: 6 additions & 6 deletions packages/cosmos_auth/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ packages:
name: args
url: "https://pub.dartlang.org"
source: hosted
version: "2.3.0"
version: "2.3.1"
async:
dependency: transitive
description:
Expand Down Expand Up @@ -97,7 +97,7 @@ packages:
description:
path: "packages/cosmos_lint"
ref: main
resolved-ref: "64fc9a44b76bef7a6a6cd98763048630afdc99da"
resolved-ref: "950449132af5b0b0a219a0a935e5eaf074d8eccf"
url: "https://github.com/tendermint/flutter.git"
source: git
version: "1.9.0"
Expand All @@ -106,7 +106,7 @@ packages:
description:
path: "packages/cosmos_utils"
ref: main
resolved-ref: "64fc9a44b76bef7a6a6cd98763048630afdc99da"
resolved-ref: "950449132af5b0b0a219a0a935e5eaf074d8eccf"
url: "https://github.com/tendermint/flutter.git"
source: git
version: "0.0.1"
Expand Down Expand Up @@ -163,7 +163,7 @@ packages:
name: flutter_plugin_android_lifecycle
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.5"
version: "2.0.6"
flutter_test:
dependency: "direct dev"
description: flutter
Expand Down Expand Up @@ -266,7 +266,7 @@ packages:
name: mime
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
version: "1.0.2"
mocktail:
dependency: "direct dev"
description:
Expand Down Expand Up @@ -474,7 +474,7 @@ packages:
name: webkit_inspection_protocol
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
version: "1.0.1"
yaml:
dependency: transitive
description:
Expand Down
10 changes: 10 additions & 0 deletions packages/cosmos_node_client/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
gen:
rm -rf .chain
mkdir .chain
rm -rf ./lib/proto
cd .chain && ignite s chain cosmos_node_client
cd .chain/cosmos_node_client && ignite s list post title body --yes && ignite g dart --yes
mkdir -p ./lib/proto/
mv .chain/cosmos_node_client/flutter/lib/generated/ ./lib/proto/
rm -rf .chain

22 changes: 21 additions & 1 deletion packages/cosmos_node_client/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1 +1,21 @@
include: package:cosmos_lint/analysis_options.yaml
include: package:cosmos_lint/analysis_options.yaml
analyzer:
exclude:
- build/**
- lib/proto/**
- lib/**/*.g.dart
- lib/**/*.reflectable.dart

- test/**/*.g.dart
- test/**/*.reflectable.dart

- tool/**/*.g.dart
strong-mode:
implicit-casts: false

# enable-experiment:
# - non-nullable

linter:
rules:
- camel_case_types
75 changes: 75 additions & 0 deletions packages/cosmos_node_client/lib/core/account.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/* import 'package:cosmos_node_client/cosmos_node_client.dart';
import 'package:fixnum/fixnum.dart';
import 'package:cosmos_node_client/proto/cosmos/auth/v1beta1/auth.pb.dart' as auth;

abstract class AccountI {
String get address;

Any get pubKey;

Int64 get accountNumber;

Int64 get sequence;
}

class BaseAccount extends AccountI {
final auth.BaseAccount account;

@override
String get address {
return account.address;
}

@override
Any get pubKey {
return account.pubKey;
}

@override
Int64 get accountNumber {
return account.accountNumber;
}

@override
Int64 get sequence {
return account.sequence;
}

BaseAccount(auth.BaseAccount account) : account = account;

static BaseAccount fromAny(Any any) {
final account = auth.BaseAccount.fromBuffer(any.value);
return BaseAccount(account);
}
}

class ModuleAccount implements AccountI {
final auth.ModuleAccount account;

@override
String get address {
return account.baseAccount.address;
}

@override
Any get pubKey {
return account.baseAccount.pubKey;
}

@override
Int64 get accountNumber {
return account.baseAccount.accountNumber;
}

@override
Int64 get sequence {
return account.baseAccount.sequence;
}

ModuleAccount(auth.ModuleAccount account) : account = account;

static ModuleAccount fromAny(Any any) {
final account = auth.ModuleAccount.fromBuffer(any.value);
return ModuleAccount(account);
}
} */
1 change: 1 addition & 0 deletions packages/cosmos_node_client/lib/core/export.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export 'account.dart';
2 changes: 2 additions & 0 deletions packages/cosmos_node_client/lib/cosmos_node_client.dart
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
library cosmos_node_client;

export 'core/account.dart';
Loading