Skip to content

Commit

Permalink
Merge pull request #1380 from Pylons-tech/testapp_redo
Browse files Browse the repository at this point in the history
Let's go ahead and merge testapp and the api2 preview now
  • Loading branch information
MikeSofaer committed Nov 30, 2022
2 parents 009a3a6 + 7a5716d commit 73efa1a
Show file tree
Hide file tree
Showing 185 changed files with 8,950 additions and 1,393 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ big-dipper/settings.json
debug

*.env
_build/
mytestnet/
wallet/android/app/google-services.json
mytestnet/
6 changes: 6 additions & 0 deletions dart_sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 0.1.4
Added a higher level abstraction on native methods.

## 0.1.3
Added the SDKResponse class in exports.

## 0.1.2
Made the Recipe description optional on the sdk side.

Expand Down
16 changes: 16 additions & 0 deletions dart_sdk/PREVIEW_SETUP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
## Quick setup (preview edition)

You are advised to clone an existing repository instead of trying to set up a project from scratch using this SDK. **This is a preview release**, so keep that in mind. In the near future, we'll provide an actual template project you can use and some scripts to make that quick and painless: in the mean time it's totally fine to clone testapp. You'll just need to replace a few package names to get started.

Change all occurences of testapp's package (tech.pylons.testapp_flutter) to your own in the following files:

* `android/app/src/main/AndroidManifest.xml`
* `android/app/src/profile/AndroidManifest.xml`
* `android/app/build.gradle`
* `ios/Runner/Info.plist`

(You should also go ahead and set the app names in the `AndroidManifest` and the `Info.plist` as appropriate.)

Move `android/app/src/main/kotlin/tech/pylons/testapp_flutter/MainActivity.kt` to a path corresponding to your package name.

It's also probably advisable to set the name/description in your `pubspec.yaml` to something sensible and rename the root directory of your project accordingly.
2 changes: 1 addition & 1 deletion dart_sdk/example/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.pylons.example">


<uses-permission android:name="android.permission.INTERNET" />
<queries>
<package android:name="tech.pylons.wallet" />
</queries>
Expand Down
3 changes: 2 additions & 1 deletion dart_sdk/example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'dart:developer';
import 'package:flutter/material.dart';
import 'package:pylons_sdk/pylons_sdk.dart';
import 'package:pylons_sdk/low_level.dart';
import 'package:fixnum/fixnum.dart';

void main() {
Expand Down Expand Up @@ -255,6 +255,7 @@ class _MyHomePageState extends State<MyHomePage> {
cookbookId: cookBookId,
recipeName: recipeId,
coinInputIndex: 0,
sender: "pylo1v97v5qj2kvph2d02fzxxlh44wzpfmuc63vpphj",
itemIds: [],
paymentInfo: []);

Expand Down
13 changes: 13 additions & 0 deletions dart_sdk/lib/low_level.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export 'src/core/error/exceptions.dart';
export 'src/pylons_wallet.dart';
export 'src/generated/cosmos/base/v1beta1/coin.pb.dart' show Coin;
export 'src/generated/cosmos/tx/v1beta1/tx.pb.dart';
export 'src/generated/pylons/cookbook.pb.dart';
export 'src/generated/pylons/recipe.pb.dart';
export 'src/generated/pylons/item.pb.dart';
export 'src/generated/pylons/execution.pb.dart';
export 'src/generated/pylons/trade.pb.dart';
export 'src/generated/pylons/tx.pb.dart';
export 'src/features/models/sdk_ipc_response.dart';
export 'src/features/data/models/profile.dart' show Profile;
export 'src/features/helper/dec_string.dart';
15 changes: 6 additions & 9 deletions dart_sdk/lib/pylons_sdk.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,11 @@
library pylons_sdk;

export 'src/core/error/exceptions.dart';
export 'src/features/data/models/profile.dart' show Profile;

export 'src/pylons_wallet.dart';
export 'src/generated/pylons/tx.pb.dart';
export 'src/generated/cosmos/tx/v1beta1/tx.pb.dart';
export 'src/generated/pylons/item.pb.dart';
export 'src/generated/pylons/cookbook.pb.dart';
export 'src/generated/pylons/recipe.pb.dart';
export 'src/generated/pylons/trade.pb.dart';
export 'src/types/cookbook.dart';
export 'src/types/execution.dart';
export 'src/types/item.dart';
export 'src/types/profile.dart';
export 'src/types/recipe.dart';
export 'src/features/helper/dec_string.dart';
export 'src/features/models/sdk_ipc_response.dart';
export 'src/generated/cosmos/base/v1beta1/coin.pb.dart' show Coin;
Original file line number Diff line number Diff line change
@@ -1,28 +1,24 @@
import 'dart:convert';

import 'package:pylons_sdk/src/core/constants/strings.dart';
import 'package:pylons_sdk/src/features/ipc/base/ipc_handler.dart';
import 'package:pylons_sdk/src/features/ipc/responseCompleters.dart';
import 'package:pylons_sdk/src/features/models/sdk_ipc_response.dart';
import 'package:pylons_sdk/src/generated/pylons/execution.pb.dart';

class ExecuteRecipeHandler implements IPCHandler {
@override
void handler(SDKIPCResponse<dynamic> response) {
final defaultResponse = SDKIPCResponse<Execution>(
final defaultResponse = SDKIPCResponse<String>(
success: response.success,
action: response.action,
data: Execution.create(),
data: '',
error: response.error,
errorCode: response.errorCode);
try {
if (response.success) {
defaultResponse.data = Execution.create()
..mergeFromProto3Json(jsonDecode(response.data));
defaultResponse.data = response.data;
}
} on Exception catch (_) {
defaultResponse.success = false;
defaultResponse.error = 'Execution parsing failed';
defaultResponse.error = 'TX response parsing failed';
defaultResponse.errorCode = Strings.ERR_MALFORMED_EXECUTION;
}
responseCompleters[Strings.TX_EXECUTE_RECIPE]!.complete(defaultResponse);
Expand Down
3 changes: 2 additions & 1 deletion dart_sdk/lib/src/pylons_wallet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ abstract class PylonsWallet {

static PylonsWallet get instance {
if (_instance == null) {
throw WalletInitializationNotDone('Sdk not initialized');
throw WalletInitializationNotDone('SDK not initialized');
}

return _instance!;
Expand Down Expand Up @@ -382,6 +382,7 @@ abstract class PylonsWallet {
required List<String> itemIds,
required int coinInputIndex,
required List<PaymentInfo> paymentInfo,
required String sender,
bool requestResponse});

/// Async: Creates a transaction to post a trade of the provided [Item] for a
Expand Down
Loading

0 comments on commit 73efa1a

Please sign in to comment.