diff --git a/gen.sum b/gen.sum index c59e6f5c..d4061cec 100644 --- a/gen.sum +++ b/gen.sum @@ -1,6 +1,6 @@ ceb2922aa6e25cc4b9256163c5a31443770af3a6 Makefile 3f8e7619fa38e476bb3d35923f6c2676cfe8809b buf.gen.yaml -8e0d611d49279bc49aa043c5f518326b50dfd76c service/gnomobiletypes/gnomobiletypes.go -50596a8d996f91253ef714fe24b618f05a6f179a service/gnomobiletypes/package.go -cc43128277f99518087578f22e7e56a3de0c0f1f service/rpc/gnomobiletypes.proto -5cf0c76d7a484f82c7c56834983dba63286916f7 service/rpc/rpc.proto +781263c443b6ffebe091128855ce2a8b594fd8ea service/gnomobiletypes/gnomobiletypes.go +c4488aa6a301b2865856719295d704c77ff45512 service/gnomobiletypes/package.go +646d974f3a99753ed94a3d8ba4affb2a0267d3f2 service/rpc/gnomobiletypes.proto +7b283a24b6c14a7e8907d5b82c95f6ffec4b0332 service/rpc/rpc.proto diff --git a/gnoboard/App.tsx b/gnoboard/App.tsx index 5ab2ec8d..e70d6033 100644 --- a/gnoboard/App.tsx +++ b/gnoboard/App.tsx @@ -1,5 +1,10 @@ -import CustomRouter from '@gno/router/custom-router'; -import 'fast-text-encoding'; +import CustomRouter from "@gno/router/custom-router"; +import "react-native-polyfill-globals/auto"; + +// Polyfill async.Iterator. For some reason, the Babel presets and plugins are not doing the trick. +// Code from here: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-3.html#caveats +(Symbol as any).asyncIterator = Symbol.asyncIterator || + Symbol.for("Symbol.asyncIterator"); function App() { return ; diff --git a/gnoboard/android/app/src/debug/java/land/gno/gnoboard/ReactNativeFlipper.java b/gnoboard/android/app/src/debug/java/land/gno/gnoboard/ReactNativeFlipper.java index 6e0fcbdb..b5871db5 100644 --- a/gnoboard/android/app/src/debug/java/land/gno/gnoboard/ReactNativeFlipper.java +++ b/gnoboard/android/app/src/debug/java/land/gno/gnoboard/ReactNativeFlipper.java @@ -38,15 +38,16 @@ public static void initializeFlipper(Context context, ReactInstanceManager react client.addPlugin(new SharedPreferencesFlipperPlugin(context)); client.addPlugin(CrashReporterPlugin.getInstance()); - NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin(); - NetworkingModule.setCustomClientBuilder( - new NetworkingModule.CustomClientBuilder() { - @Override - public void apply(OkHttpClient.Builder builder) { - builder.addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin)); - } - }); - client.addPlugin(networkFlipperPlugin); + // Need to comment this code to allow gRPC streams to work: https://github.com/react-native-community/fetch/issues/13#issuecomment-1703097655 +// NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin(); +// NetworkingModule.setCustomClientBuilder( +// new NetworkingModule.CustomClientBuilder() { +// @Override +// public void apply(OkHttpClient.Builder builder) { +// builder.addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin)); +// } +// }); +// client.addPlugin(networkFlipperPlugin); client.start(); // Fresco Plugin needs to ensure that ImagePipelineFactory is initialized diff --git a/gnoboard/android/app/src/main/java/land/gno/gnomobile/v1/GnomobileServiceGrpc.java b/gnoboard/android/app/src/main/java/land/gno/gnomobile/v1/GnomobileServiceGrpc.java index 51cba662..8d4675cb 100644 --- a/gnoboard/android/app/src/main/java/land/gno/gnomobile/v1/GnomobileServiceGrpc.java +++ b/gnoboard/android/app/src/main/java/land/gno/gnomobile/v1/GnomobileServiceGrpc.java @@ -528,6 +528,36 @@ land.gno.gnomobile.v1.Gnomobiletypes.HelloResponse> getHelloMethod() { return getHelloMethod; } + private static volatile io.grpc.MethodDescriptor getHelloStreamMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "HelloStream", + requestType = land.gno.gnomobile.v1.Gnomobiletypes.HelloStreamRequest.class, + responseType = land.gno.gnomobile.v1.Gnomobiletypes.HelloStreamResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING) + public static io.grpc.MethodDescriptor getHelloStreamMethod() { + io.grpc.MethodDescriptor getHelloStreamMethod; + if ((getHelloStreamMethod = GnomobileServiceGrpc.getHelloStreamMethod) == null) { + synchronized (GnomobileServiceGrpc.class) { + if ((getHelloStreamMethod = GnomobileServiceGrpc.getHelloStreamMethod) == null) { + GnomobileServiceGrpc.getHelloStreamMethod = getHelloStreamMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "HelloStream")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller( + land.gno.gnomobile.v1.Gnomobiletypes.HelloStreamRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller( + land.gno.gnomobile.v1.Gnomobiletypes.HelloStreamResponse.getDefaultInstance())) + .build(); + } + } + } + return getHelloStreamMethod; + } + /** * Creates a new async stub that supports all call types for the service */ @@ -669,7 +699,8 @@ default void getActiveAccount(land.gno.gnomobile.v1.Gnomobiletypes.GetActiveAcco /** *
-     * QueryAccount retrieves account information from the blockchain for a given address.
+     * QueryAccount retrieves account information from the blockchain for a given
+     * address.
      * 
*/ default void queryAccount(land.gno.gnomobile.v1.Gnomobiletypes.QueryAccountRequest request, @@ -679,9 +710,9 @@ default void queryAccount(land.gno.gnomobile.v1.Gnomobiletypes.QueryAccountReque /** *
-     * DeleteAccount deletes the account with the given name, using the password to
-     * ensure access. However, if skip_password is true, then ignore the password.
-     * If the account doesn't exist, then return ErrCryptoKeyNotFound.
+     * DeleteAccount deletes the account with the given name, using the password
+     * to ensure access. However, if skip_password is true, then ignore the
+     * password. If the account doesn't exist, then return ErrCryptoKeyNotFound.
      * If the password is wrong, then return ErrDecryptionFailed.
      * 
*/ @@ -702,9 +733,10 @@ default void query(land.gno.gnomobile.v1.Gnomobiletypes.QueryRequest request, /** *
-     * Render calls the Render function for package_path with optional args. The package path
-     * should include the prefix like "gno.land/". This is similar to using a browser URL
-     * <testnet>/<pkgPath>:<args> where <pkgPath> doesn't have the prefix like "gno.land/".
+     * Render calls the Render function for package_path with optional args. The
+     * package path should include the prefix like "gno.land/". This is similar to
+     * using a browser URL <testnet>/<pkgPath>:<args> where <pkgPath> doesn't have
+     * the prefix like "gno.land/".
      * 
*/ default void render(land.gno.gnomobile.v1.Gnomobiletypes.RenderRequest request, @@ -714,9 +746,10 @@ default void render(land.gno.gnomobile.v1.Gnomobiletypes.RenderRequest request, /** *
-     * QEval evaluates the given expression with the realm code at package_path. The package path
-     * should include the prefix like "gno.land/". The expression is usually a function call like
-     * "GetBoardIDFromName(\"testboard\")". The return value is a typed expression like
+     * QEval evaluates the given expression with the realm code at package_path.
+     * The package path should include the prefix like "gno.land/". The expression
+     * is usually a function call like "GetBoardIDFromName(\"testboard\")". The
+     * return value is a typed expression like
      * "(1 gno.land/r/demo/boards.BoardID)\n(true bool)".
      * 
*/ @@ -764,6 +797,16 @@ default void hello(land.gno.gnomobile.v1.Gnomobiletypes.HelloRequest request, io.grpc.stub.StreamObserver responseObserver) { io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getHelloMethod(), responseObserver); } + + /** + *
+     * HelloStream is for debug purposes
+     * 
+ */ + default void helloStream(land.gno.gnomobile.v1.Gnomobiletypes.HelloStreamRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getHelloStreamMethod(), responseObserver); + } } /** @@ -897,7 +940,8 @@ public void getActiveAccount(land.gno.gnomobile.v1.Gnomobiletypes.GetActiveAccou /** *
-     * QueryAccount retrieves account information from the blockchain for a given address.
+     * QueryAccount retrieves account information from the blockchain for a given
+     * address.
      * 
*/ public void queryAccount(land.gno.gnomobile.v1.Gnomobiletypes.QueryAccountRequest request, @@ -908,9 +952,9 @@ public void queryAccount(land.gno.gnomobile.v1.Gnomobiletypes.QueryAccountReques /** *
-     * DeleteAccount deletes the account with the given name, using the password to
-     * ensure access. However, if skip_password is true, then ignore the password.
-     * If the account doesn't exist, then return ErrCryptoKeyNotFound.
+     * DeleteAccount deletes the account with the given name, using the password
+     * to ensure access. However, if skip_password is true, then ignore the
+     * password. If the account doesn't exist, then return ErrCryptoKeyNotFound.
      * If the password is wrong, then return ErrDecryptionFailed.
      * 
*/ @@ -933,9 +977,10 @@ public void query(land.gno.gnomobile.v1.Gnomobiletypes.QueryRequest request, /** *
-     * Render calls the Render function for package_path with optional args. The package path
-     * should include the prefix like "gno.land/". This is similar to using a browser URL
-     * <testnet>/<pkgPath>:<args> where <pkgPath> doesn't have the prefix like "gno.land/".
+     * Render calls the Render function for package_path with optional args. The
+     * package path should include the prefix like "gno.land/". This is similar to
+     * using a browser URL <testnet>/<pkgPath>:<args> where <pkgPath> doesn't have
+     * the prefix like "gno.land/".
      * 
*/ public void render(land.gno.gnomobile.v1.Gnomobiletypes.RenderRequest request, @@ -946,9 +991,10 @@ public void render(land.gno.gnomobile.v1.Gnomobiletypes.RenderRequest request, /** *
-     * QEval evaluates the given expression with the realm code at package_path. The package path
-     * should include the prefix like "gno.land/". The expression is usually a function call like
-     * "GetBoardIDFromName(\"testboard\")". The return value is a typed expression like
+     * QEval evaluates the given expression with the realm code at package_path.
+     * The package path should include the prefix like "gno.land/". The expression
+     * is usually a function call like "GetBoardIDFromName(\"testboard\")". The
+     * return value is a typed expression like
      * "(1 gno.land/r/demo/boards.BoardID)\n(true bool)".
      * 
*/ @@ -1001,6 +1047,17 @@ public void hello(land.gno.gnomobile.v1.Gnomobiletypes.HelloRequest request, io.grpc.stub.ClientCalls.asyncUnaryCall( getChannel().newCall(getHelloMethod(), getCallOptions()), request, responseObserver); } + + /** + *
+     * HelloStream is for debug purposes
+     * 
+ */ + public void helloStream(land.gno.gnomobile.v1.Gnomobiletypes.HelloStreamRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncServerStreamingCall( + getChannel().newCall(getHelloStreamMethod(), getCallOptions()), request, responseObserver); + } } /** @@ -1112,7 +1169,8 @@ public land.gno.gnomobile.v1.Gnomobiletypes.GetActiveAccountResponse getActiveAc /** *
-     * QueryAccount retrieves account information from the blockchain for a given address.
+     * QueryAccount retrieves account information from the blockchain for a given
+     * address.
      * 
*/ public land.gno.gnomobile.v1.Gnomobiletypes.QueryAccountResponse queryAccount(land.gno.gnomobile.v1.Gnomobiletypes.QueryAccountRequest request) { @@ -1122,9 +1180,9 @@ public land.gno.gnomobile.v1.Gnomobiletypes.QueryAccountResponse queryAccount(la /** *
-     * DeleteAccount deletes the account with the given name, using the password to
-     * ensure access. However, if skip_password is true, then ignore the password.
-     * If the account doesn't exist, then return ErrCryptoKeyNotFound.
+     * DeleteAccount deletes the account with the given name, using the password
+     * to ensure access. However, if skip_password is true, then ignore the
+     * password. If the account doesn't exist, then return ErrCryptoKeyNotFound.
      * If the password is wrong, then return ErrDecryptionFailed.
      * 
*/ @@ -1145,9 +1203,10 @@ public land.gno.gnomobile.v1.Gnomobiletypes.QueryResponse query(land.gno.gnomobi /** *
-     * Render calls the Render function for package_path with optional args. The package path
-     * should include the prefix like "gno.land/". This is similar to using a browser URL
-     * <testnet>/<pkgPath>:<args> where <pkgPath> doesn't have the prefix like "gno.land/".
+     * Render calls the Render function for package_path with optional args. The
+     * package path should include the prefix like "gno.land/". This is similar to
+     * using a browser URL <testnet>/<pkgPath>:<args> where <pkgPath> doesn't have
+     * the prefix like "gno.land/".
      * 
*/ public land.gno.gnomobile.v1.Gnomobiletypes.RenderResponse render(land.gno.gnomobile.v1.Gnomobiletypes.RenderRequest request) { @@ -1157,9 +1216,10 @@ public land.gno.gnomobile.v1.Gnomobiletypes.RenderResponse render(land.gno.gnomo /** *
-     * QEval evaluates the given expression with the realm code at package_path. The package path
-     * should include the prefix like "gno.land/". The expression is usually a function call like
-     * "GetBoardIDFromName(\"testboard\")". The return value is a typed expression like
+     * QEval evaluates the given expression with the realm code at package_path.
+     * The package path should include the prefix like "gno.land/". The expression
+     * is usually a function call like "GetBoardIDFromName(\"testboard\")". The
+     * return value is a typed expression like
      * "(1 gno.land/r/demo/boards.BoardID)\n(true bool)".
      * 
*/ @@ -1207,6 +1267,17 @@ public land.gno.gnomobile.v1.Gnomobiletypes.HelloResponse hello(land.gno.gnomobi return io.grpc.stub.ClientCalls.blockingUnaryCall( getChannel(), getHelloMethod(), getCallOptions(), request); } + + /** + *
+     * HelloStream is for debug purposes
+     * 
+ */ + public java.util.Iterator helloStream( + land.gno.gnomobile.v1.Gnomobiletypes.HelloStreamRequest request) { + return io.grpc.stub.ClientCalls.blockingServerStreamingCall( + getChannel(), getHelloStreamMethod(), getCallOptions(), request); + } } /** @@ -1326,7 +1397,8 @@ public com.google.common.util.concurrent.ListenableFuture - * QueryAccount retrieves account information from the blockchain for a given address. + * QueryAccount retrieves account information from the blockchain for a given + * address. * */ public com.google.common.util.concurrent.ListenableFuture queryAccount( @@ -1337,9 +1409,9 @@ public com.google.common.util.concurrent.ListenableFuture - * DeleteAccount deletes the account with the given name, using the password to - * ensure access. However, if skip_password is true, then ignore the password. - * If the account doesn't exist, then return ErrCryptoKeyNotFound. + * DeleteAccount deletes the account with the given name, using the password + * to ensure access. However, if skip_password is true, then ignore the + * password. If the account doesn't exist, then return ErrCryptoKeyNotFound. * If the password is wrong, then return ErrDecryptionFailed. * */ @@ -1362,9 +1434,10 @@ public com.google.common.util.concurrent.ListenableFuture - * Render calls the Render function for package_path with optional args. The package path - * should include the prefix like "gno.land/". This is similar to using a browser URL - * <testnet>/<pkgPath>:<args> where <pkgPath> doesn't have the prefix like "gno.land/". + * Render calls the Render function for package_path with optional args. The + * package path should include the prefix like "gno.land/". This is similar to + * using a browser URL <testnet>/<pkgPath>:<args> where <pkgPath> doesn't have + * the prefix like "gno.land/". * */ public com.google.common.util.concurrent.ListenableFuture render( @@ -1375,9 +1448,10 @@ public com.google.common.util.concurrent.ListenableFuture - * QEval evaluates the given expression with the realm code at package_path. The package path - * should include the prefix like "gno.land/". The expression is usually a function call like - * "GetBoardIDFromName(\"testboard\")". The return value is a typed expression like + * QEval evaluates the given expression with the realm code at package_path. + * The package path should include the prefix like "gno.land/". The expression + * is usually a function call like "GetBoardIDFromName(\"testboard\")". The + * return value is a typed expression like * "(1 gno.land/r/demo/boards.BoardID)\n(true bool)". * */ @@ -1449,6 +1523,7 @@ public com.google.common.util.concurrent.ListenableFuture implements io.grpc.stub.ServerCalls.UnaryMethod, @@ -1535,6 +1610,10 @@ public void invoke(Req request, io.grpc.stub.StreamObserver responseObserv serviceImpl.hello((land.gno.gnomobile.v1.Gnomobiletypes.HelloRequest) request, (io.grpc.stub.StreamObserver) responseObserver); break; + case METHODID_HELLO_STREAM: + serviceImpl.helloStream((land.gno.gnomobile.v1.Gnomobiletypes.HelloStreamRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; default: throw new AssertionError(); } @@ -1672,6 +1751,13 @@ public static final io.grpc.ServerServiceDefinition bindService(AsyncService ser land.gno.gnomobile.v1.Gnomobiletypes.HelloRequest, land.gno.gnomobile.v1.Gnomobiletypes.HelloResponse>( service, METHODID_HELLO))) + .addMethod( + getHelloStreamMethod(), + io.grpc.stub.ServerCalls.asyncServerStreamingCall( + new MethodHandlers< + land.gno.gnomobile.v1.Gnomobiletypes.HelloStreamRequest, + land.gno.gnomobile.v1.Gnomobiletypes.HelloStreamResponse>( + service, METHODID_HELLO_STREAM))) .build(); } @@ -1701,6 +1787,7 @@ public static io.grpc.ServiceDescriptor getServiceDescriptor() { .addMethod(getAddressToBech32Method()) .addMethod(getAddressFromBech32Method()) .addMethod(getHelloMethod()) + .addMethod(getHelloStreamMethod()) .build(); } } diff --git a/gnoboard/android/app/src/main/java/land/gno/gnomobile/v1/Gnomobiletypes.java b/gnoboard/android/app/src/main/java/land/gno/gnomobile/v1/Gnomobiletypes.java index c5312c20..59d93565 100644 --- a/gnoboard/android/app/src/main/java/land/gno/gnomobile/v1/Gnomobiletypes.java +++ b/gnoboard/android/app/src/main/java/land/gno/gnomobile/v1/Gnomobiletypes.java @@ -12779,6 +12779,594 @@ public static com.google.protobuf.Parser parser() { } } + public interface HelloStreamRequestOrBuilder extends + // @@protoc_insertion_point(interface_extends:land.gno.gnomobile.v1.HelloStreamRequest) + com.google.protobuf.MessageLiteOrBuilder { + + /** + * string name = 1 [json_name = "name"]; + * @return The name. + */ + java.lang.String getName(); + /** + * string name = 1 [json_name = "name"]; + * @return The bytes for name. + */ + com.google.protobuf.ByteString + getNameBytes(); + } + /** + * Protobuf type {@code land.gno.gnomobile.v1.HelloStreamRequest} + */ + public static final class HelloStreamRequest extends + com.google.protobuf.GeneratedMessageLite< + HelloStreamRequest, HelloStreamRequest.Builder> implements + // @@protoc_insertion_point(message_implements:land.gno.gnomobile.v1.HelloStreamRequest) + HelloStreamRequestOrBuilder { + private HelloStreamRequest() { + name_ = ""; + } + public static final int NAME_FIELD_NUMBER = 1; + private java.lang.String name_; + /** + * string name = 1 [json_name = "name"]; + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + return name_; + } + /** + * string name = 1 [json_name = "name"]; + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getNameBytes() { + return com.google.protobuf.ByteString.copyFromUtf8(name_); + } + /** + * string name = 1 [json_name = "name"]; + * @param value The name to set. + */ + private void setName( + java.lang.String value) { + java.lang.Class valueClass = value.getClass(); + + name_ = value; + } + /** + * string name = 1 [json_name = "name"]; + */ + private void clearName() { + + name_ = getDefaultInstance().getName(); + } + /** + * string name = 1 [json_name = "name"]; + * @param value The bytes for name to set. + */ + private void setNameBytes( + com.google.protobuf.ByteString value) { + checkByteStringIsUtf8(value); + name_ = value.toStringUtf8(); + + } + + public static land.gno.gnomobile.v1.Gnomobiletypes.HelloStreamRequest parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static land.gno.gnomobile.v1.Gnomobiletypes.HelloStreamRequest parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static land.gno.gnomobile.v1.Gnomobiletypes.HelloStreamRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static land.gno.gnomobile.v1.Gnomobiletypes.HelloStreamRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static land.gno.gnomobile.v1.Gnomobiletypes.HelloStreamRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static land.gno.gnomobile.v1.Gnomobiletypes.HelloStreamRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static land.gno.gnomobile.v1.Gnomobiletypes.HelloStreamRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input); + } + public static land.gno.gnomobile.v1.Gnomobiletypes.HelloStreamRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input, extensionRegistry); + } + + public static land.gno.gnomobile.v1.Gnomobiletypes.HelloStreamRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return parseDelimitedFrom(DEFAULT_INSTANCE, input); + } + + public static land.gno.gnomobile.v1.Gnomobiletypes.HelloStreamRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return parseDelimitedFrom(DEFAULT_INSTANCE, input, extensionRegistry); + } + public static land.gno.gnomobile.v1.Gnomobiletypes.HelloStreamRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input); + } + public static land.gno.gnomobile.v1.Gnomobiletypes.HelloStreamRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input, extensionRegistry); + } + + public static Builder newBuilder() { + return (Builder) DEFAULT_INSTANCE.createBuilder(); + } + public static Builder newBuilder(land.gno.gnomobile.v1.Gnomobiletypes.HelloStreamRequest prototype) { + return DEFAULT_INSTANCE.createBuilder(prototype); + } + + /** + * Protobuf type {@code land.gno.gnomobile.v1.HelloStreamRequest} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageLite.Builder< + land.gno.gnomobile.v1.Gnomobiletypes.HelloStreamRequest, Builder> implements + // @@protoc_insertion_point(builder_implements:land.gno.gnomobile.v1.HelloStreamRequest) + land.gno.gnomobile.v1.Gnomobiletypes.HelloStreamRequestOrBuilder { + // Construct using land.gno.gnomobile.v1.Gnomobiletypes.HelloStreamRequest.newBuilder() + private Builder() { + super(DEFAULT_INSTANCE); + } + + + /** + * string name = 1 [json_name = "name"]; + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + return instance.getName(); + } + /** + * string name = 1 [json_name = "name"]; + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getNameBytes() { + return instance.getNameBytes(); + } + /** + * string name = 1 [json_name = "name"]; + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName( + java.lang.String value) { + copyOnWrite(); + instance.setName(value); + return this; + } + /** + * string name = 1 [json_name = "name"]; + * @return This builder for chaining. + */ + public Builder clearName() { + copyOnWrite(); + instance.clearName(); + return this; + } + /** + * string name = 1 [json_name = "name"]; + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes( + com.google.protobuf.ByteString value) { + copyOnWrite(); + instance.setNameBytes(value); + return this; + } + + // @@protoc_insertion_point(builder_scope:land.gno.gnomobile.v1.HelloStreamRequest) + } + @java.lang.Override + @java.lang.SuppressWarnings({"unchecked", "fallthrough"}) + protected final java.lang.Object dynamicMethod( + com.google.protobuf.GeneratedMessageLite.MethodToInvoke method, + java.lang.Object arg0, java.lang.Object arg1) { + switch (method) { + case NEW_MUTABLE_INSTANCE: { + return new land.gno.gnomobile.v1.Gnomobiletypes.HelloStreamRequest(); + } + case NEW_BUILDER: { + return new Builder(); + } + case BUILD_MESSAGE_INFO: { + java.lang.Object[] objects = new java.lang.Object[] { + "name_", + }; + java.lang.String info = + "\u0000\u0001\u0000\u0000\u0001\u0001\u0001\u0000\u0000\u0000\u0001\u0208"; + return newMessageInfo(DEFAULT_INSTANCE, info, objects); + } + // fall through + case GET_DEFAULT_INSTANCE: { + return DEFAULT_INSTANCE; + } + case GET_PARSER: { + com.google.protobuf.Parser parser = PARSER; + if (parser == null) { + synchronized (land.gno.gnomobile.v1.Gnomobiletypes.HelloStreamRequest.class) { + parser = PARSER; + if (parser == null) { + parser = + new DefaultInstanceBasedParser( + DEFAULT_INSTANCE); + PARSER = parser; + } + } + } + return parser; + } + case GET_MEMOIZED_IS_INITIALIZED: { + return (byte) 1; + } + case SET_MEMOIZED_IS_INITIALIZED: { + return null; + } + } + throw new UnsupportedOperationException(); + } + + + // @@protoc_insertion_point(class_scope:land.gno.gnomobile.v1.HelloStreamRequest) + private static final land.gno.gnomobile.v1.Gnomobiletypes.HelloStreamRequest DEFAULT_INSTANCE; + static { + HelloStreamRequest defaultInstance = new HelloStreamRequest(); + // New instances are implicitly immutable so no need to make + // immutable. + DEFAULT_INSTANCE = defaultInstance; + com.google.protobuf.GeneratedMessageLite.registerDefaultInstance( + HelloStreamRequest.class, defaultInstance); + } + + public static land.gno.gnomobile.v1.Gnomobiletypes.HelloStreamRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static volatile com.google.protobuf.Parser PARSER; + + public static com.google.protobuf.Parser parser() { + return DEFAULT_INSTANCE.getParserForType(); + } + } + + public interface HelloStreamResponseOrBuilder extends + // @@protoc_insertion_point(interface_extends:land.gno.gnomobile.v1.HelloStreamResponse) + com.google.protobuf.MessageLiteOrBuilder { + + /** + * string greeting = 1 [json_name = "greeting"]; + * @return The greeting. + */ + java.lang.String getGreeting(); + /** + * string greeting = 1 [json_name = "greeting"]; + * @return The bytes for greeting. + */ + com.google.protobuf.ByteString + getGreetingBytes(); + } + /** + * Protobuf type {@code land.gno.gnomobile.v1.HelloStreamResponse} + */ + public static final class HelloStreamResponse extends + com.google.protobuf.GeneratedMessageLite< + HelloStreamResponse, HelloStreamResponse.Builder> implements + // @@protoc_insertion_point(message_implements:land.gno.gnomobile.v1.HelloStreamResponse) + HelloStreamResponseOrBuilder { + private HelloStreamResponse() { + greeting_ = ""; + } + public static final int GREETING_FIELD_NUMBER = 1; + private java.lang.String greeting_; + /** + * string greeting = 1 [json_name = "greeting"]; + * @return The greeting. + */ + @java.lang.Override + public java.lang.String getGreeting() { + return greeting_; + } + /** + * string greeting = 1 [json_name = "greeting"]; + * @return The bytes for greeting. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getGreetingBytes() { + return com.google.protobuf.ByteString.copyFromUtf8(greeting_); + } + /** + * string greeting = 1 [json_name = "greeting"]; + * @param value The greeting to set. + */ + private void setGreeting( + java.lang.String value) { + java.lang.Class valueClass = value.getClass(); + + greeting_ = value; + } + /** + * string greeting = 1 [json_name = "greeting"]; + */ + private void clearGreeting() { + + greeting_ = getDefaultInstance().getGreeting(); + } + /** + * string greeting = 1 [json_name = "greeting"]; + * @param value The bytes for greeting to set. + */ + private void setGreetingBytes( + com.google.protobuf.ByteString value) { + checkByteStringIsUtf8(value); + greeting_ = value.toStringUtf8(); + + } + + public static land.gno.gnomobile.v1.Gnomobiletypes.HelloStreamResponse parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static land.gno.gnomobile.v1.Gnomobiletypes.HelloStreamResponse parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static land.gno.gnomobile.v1.Gnomobiletypes.HelloStreamResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static land.gno.gnomobile.v1.Gnomobiletypes.HelloStreamResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static land.gno.gnomobile.v1.Gnomobiletypes.HelloStreamResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static land.gno.gnomobile.v1.Gnomobiletypes.HelloStreamResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static land.gno.gnomobile.v1.Gnomobiletypes.HelloStreamResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input); + } + public static land.gno.gnomobile.v1.Gnomobiletypes.HelloStreamResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input, extensionRegistry); + } + + public static land.gno.gnomobile.v1.Gnomobiletypes.HelloStreamResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return parseDelimitedFrom(DEFAULT_INSTANCE, input); + } + + public static land.gno.gnomobile.v1.Gnomobiletypes.HelloStreamResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return parseDelimitedFrom(DEFAULT_INSTANCE, input, extensionRegistry); + } + public static land.gno.gnomobile.v1.Gnomobiletypes.HelloStreamResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input); + } + public static land.gno.gnomobile.v1.Gnomobiletypes.HelloStreamResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input, extensionRegistry); + } + + public static Builder newBuilder() { + return (Builder) DEFAULT_INSTANCE.createBuilder(); + } + public static Builder newBuilder(land.gno.gnomobile.v1.Gnomobiletypes.HelloStreamResponse prototype) { + return DEFAULT_INSTANCE.createBuilder(prototype); + } + + /** + * Protobuf type {@code land.gno.gnomobile.v1.HelloStreamResponse} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageLite.Builder< + land.gno.gnomobile.v1.Gnomobiletypes.HelloStreamResponse, Builder> implements + // @@protoc_insertion_point(builder_implements:land.gno.gnomobile.v1.HelloStreamResponse) + land.gno.gnomobile.v1.Gnomobiletypes.HelloStreamResponseOrBuilder { + // Construct using land.gno.gnomobile.v1.Gnomobiletypes.HelloStreamResponse.newBuilder() + private Builder() { + super(DEFAULT_INSTANCE); + } + + + /** + * string greeting = 1 [json_name = "greeting"]; + * @return The greeting. + */ + @java.lang.Override + public java.lang.String getGreeting() { + return instance.getGreeting(); + } + /** + * string greeting = 1 [json_name = "greeting"]; + * @return The bytes for greeting. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getGreetingBytes() { + return instance.getGreetingBytes(); + } + /** + * string greeting = 1 [json_name = "greeting"]; + * @param value The greeting to set. + * @return This builder for chaining. + */ + public Builder setGreeting( + java.lang.String value) { + copyOnWrite(); + instance.setGreeting(value); + return this; + } + /** + * string greeting = 1 [json_name = "greeting"]; + * @return This builder for chaining. + */ + public Builder clearGreeting() { + copyOnWrite(); + instance.clearGreeting(); + return this; + } + /** + * string greeting = 1 [json_name = "greeting"]; + * @param value The bytes for greeting to set. + * @return This builder for chaining. + */ + public Builder setGreetingBytes( + com.google.protobuf.ByteString value) { + copyOnWrite(); + instance.setGreetingBytes(value); + return this; + } + + // @@protoc_insertion_point(builder_scope:land.gno.gnomobile.v1.HelloStreamResponse) + } + @java.lang.Override + @java.lang.SuppressWarnings({"unchecked", "fallthrough"}) + protected final java.lang.Object dynamicMethod( + com.google.protobuf.GeneratedMessageLite.MethodToInvoke method, + java.lang.Object arg0, java.lang.Object arg1) { + switch (method) { + case NEW_MUTABLE_INSTANCE: { + return new land.gno.gnomobile.v1.Gnomobiletypes.HelloStreamResponse(); + } + case NEW_BUILDER: { + return new Builder(); + } + case BUILD_MESSAGE_INFO: { + java.lang.Object[] objects = new java.lang.Object[] { + "greeting_", + }; + java.lang.String info = + "\u0000\u0001\u0000\u0000\u0001\u0001\u0001\u0000\u0000\u0000\u0001\u0208"; + return newMessageInfo(DEFAULT_INSTANCE, info, objects); + } + // fall through + case GET_DEFAULT_INSTANCE: { + return DEFAULT_INSTANCE; + } + case GET_PARSER: { + com.google.protobuf.Parser parser = PARSER; + if (parser == null) { + synchronized (land.gno.gnomobile.v1.Gnomobiletypes.HelloStreamResponse.class) { + parser = PARSER; + if (parser == null) { + parser = + new DefaultInstanceBasedParser( + DEFAULT_INSTANCE); + PARSER = parser; + } + } + } + return parser; + } + case GET_MEMOIZED_IS_INITIALIZED: { + return (byte) 1; + } + case SET_MEMOIZED_IS_INITIALIZED: { + return null; + } + } + throw new UnsupportedOperationException(); + } + + + // @@protoc_insertion_point(class_scope:land.gno.gnomobile.v1.HelloStreamResponse) + private static final land.gno.gnomobile.v1.Gnomobiletypes.HelloStreamResponse DEFAULT_INSTANCE; + static { + HelloStreamResponse defaultInstance = new HelloStreamResponse(); + // New instances are implicitly immutable so no need to make + // immutable. + DEFAULT_INSTANCE = defaultInstance; + com.google.protobuf.GeneratedMessageLite.registerDefaultInstance( + HelloStreamResponse.class, defaultInstance); + } + + public static land.gno.gnomobile.v1.Gnomobiletypes.HelloStreamResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static volatile com.google.protobuf.Parser PARSER; + + public static com.google.protobuf.Parser parser() { + return DEFAULT_INSTANCE.getParserForType(); + } + } + static { } diff --git a/gnoboard/ios/Podfile.lock b/gnoboard/ios/Podfile.lock index c751d866..d8bca3cd 100644 --- a/gnoboard/ios/Podfile.lock +++ b/gnoboard/ios/Podfile.lock @@ -357,6 +357,8 @@ PODS: - React-jsinspector (0.72.5) - React-logger (0.72.5): - glog + - react-native-get-random-values (1.9.0): + - React-Core - react-native-safe-area-context (4.7.2): - React-Core - react-native-slider (4.4.3): @@ -647,6 +649,7 @@ DEPENDENCIES: - React-jsiexecutor (from `../node_modules/react-native/ReactCommon/jsiexecutor`) - React-jsinspector (from `../node_modules/react-native/ReactCommon/jsinspector`) - React-logger (from `../node_modules/react-native/ReactCommon/logger`) + - react-native-get-random-values (from `../node_modules/react-native-get-random-values`) - react-native-safe-area-context (from `../node_modules/react-native-safe-area-context`) - "react-native-slider (from `../node_modules/@react-native-community/slider`)" - React-NativeModulesApple (from `../node_modules/react-native/ReactCommon/react/nativemodule/core/platform/ios`) @@ -763,6 +766,8 @@ EXTERNAL SOURCES: :path: "../node_modules/react-native/ReactCommon/jsinspector" React-logger: :path: "../node_modules/react-native/ReactCommon/logger" + react-native-get-random-values: + :path: "../node_modules/react-native-get-random-values" react-native-safe-area-context: :path: "../node_modules/react-native-safe-area-context" react-native-slider: @@ -855,6 +860,7 @@ SPEC CHECKSUMS: React-jsiexecutor: ff70a72027dea5cc7d71cfcc6fad7f599f63987a React-jsinspector: aef73cbd43b70675f572214d10fa438c89bf11ba React-logger: 2e4aee3e11b3ec4fa6cfd8004610bbb3b8d6cca4 + react-native-get-random-values: dee677497c6a740b71e5612e8dbd83e7539ed5bb react-native-safe-area-context: 7aa8e6d9d0f3100a820efb1a98af68aa747f9284 react-native-slider: 1cdd6ba29675df21f30544253bf7351d3c2d68c4 React-NativeModulesApple: 54adc761c7a6fa5f183ca62ad0cb94f4f1cdce4a diff --git a/gnoboard/ios/Sources/rpc/gnomobiletypes.pb.swift b/gnoboard/ios/Sources/rpc/gnomobiletypes.pb.swift index 8e51cc48..d847e97b 100644 --- a/gnoboard/ios/Sources/rpc/gnomobiletypes.pb.swift +++ b/gnoboard/ios/Sources/rpc/gnomobiletypes.pb.swift @@ -549,6 +549,30 @@ public struct Land_Gno_Gnomobile_V1_HelloResponse { public init() {} } +public struct Land_Gno_Gnomobile_V1_HelloStreamRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + public var name: String = String() + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} +} + +public struct Land_Gno_Gnomobile_V1_HelloStreamResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + public var greeting: String = String() + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} +} + #if swift(>=5.5) && canImport(_Concurrency) extension Land_Gno_Gnomobile_V1_SetRemoteRequest: @unchecked Sendable {} extension Land_Gno_Gnomobile_V1_SetRemoteResponse: @unchecked Sendable {} @@ -587,6 +611,8 @@ extension Land_Gno_Gnomobile_V1_AddressFromBech32Request: @unchecked Sendable {} extension Land_Gno_Gnomobile_V1_AddressFromBech32Response: @unchecked Sendable {} extension Land_Gno_Gnomobile_V1_HelloRequest: @unchecked Sendable {} extension Land_Gno_Gnomobile_V1_HelloResponse: @unchecked Sendable {} +extension Land_Gno_Gnomobile_V1_HelloStreamRequest: @unchecked Sendable {} +extension Land_Gno_Gnomobile_V1_HelloStreamResponse: @unchecked Sendable {} #endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. @@ -1845,3 +1871,67 @@ extension Land_Gno_Gnomobile_V1_HelloResponse: SwiftProtobuf.Message, SwiftProto return true } } + +extension Land_Gno_Gnomobile_V1_HelloStreamRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".HelloStreamRequest" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "name"), + ] + + public mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularStringField(value: &self.name) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if !self.name.isEmpty { + try visitor.visitSingularStringField(value: self.name, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Land_Gno_Gnomobile_V1_HelloStreamRequest, rhs: Land_Gno_Gnomobile_V1_HelloStreamRequest) -> Bool { + if lhs.name != rhs.name {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Land_Gno_Gnomobile_V1_HelloStreamResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".HelloStreamResponse" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "greeting"), + ] + + public mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularStringField(value: &self.greeting) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if !self.greeting.isEmpty { + try visitor.visitSingularStringField(value: self.greeting, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Land_Gno_Gnomobile_V1_HelloStreamResponse, rhs: Land_Gno_Gnomobile_V1_HelloStreamResponse) -> Bool { + if lhs.greeting != rhs.greeting {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} diff --git a/gnoboard/ios/Sources/rpc/rpc.grpc.swift b/gnoboard/ios/Sources/rpc/rpc.grpc.swift index b8611186..b0d5e13c 100644 --- a/gnoboard/ios/Sources/rpc/rpc.grpc.swift +++ b/gnoboard/ios/Sources/rpc/rpc.grpc.swift @@ -102,6 +102,12 @@ internal protocol Land_Gno_Gnomobile_V1_GnomobileServiceClientProtocol: GRPCClie _ request: Land_Gno_Gnomobile_V1_HelloRequest, callOptions: CallOptions? ) -> UnaryCall + + func helloStream( + _ request: Land_Gno_Gnomobile_V1_HelloStreamRequest, + callOptions: CallOptions?, + handler: @escaping (Land_Gno_Gnomobile_V1_HelloStreamResponse) -> Void + ) -> ServerStreamingCall } extension Land_Gno_Gnomobile_V1_GnomobileServiceClientProtocol { @@ -261,7 +267,8 @@ extension Land_Gno_Gnomobile_V1_GnomobileServiceClientProtocol { ) } - /// QueryAccount retrieves account information from the blockchain for a given address. + /// QueryAccount retrieves account information from the blockchain for a given + /// address. /// /// - Parameters: /// - request: Request to send to QueryAccount. @@ -279,9 +286,9 @@ extension Land_Gno_Gnomobile_V1_GnomobileServiceClientProtocol { ) } - /// DeleteAccount deletes the account with the given name, using the password to - /// ensure access. However, if skip_password is true, then ignore the password. - /// If the account doesn't exist, then return ErrCryptoKeyNotFound. + /// DeleteAccount deletes the account with the given name, using the password + /// to ensure access. However, if skip_password is true, then ignore the + /// password. If the account doesn't exist, then return ErrCryptoKeyNotFound. /// If the password is wrong, then return ErrDecryptionFailed. /// /// - Parameters: @@ -318,9 +325,10 @@ extension Land_Gno_Gnomobile_V1_GnomobileServiceClientProtocol { ) } - /// Render calls the Render function for package_path with optional args. The package path - /// should include the prefix like "gno.land/". This is similar to using a browser URL - /// /: where doesn't have the prefix like "gno.land/". + /// Render calls the Render function for package_path with optional args. The + /// package path should include the prefix like "gno.land/". This is similar to + /// using a browser URL /: where doesn't have + /// the prefix like "gno.land/". /// /// - Parameters: /// - request: Request to send to Render. @@ -338,9 +346,10 @@ extension Land_Gno_Gnomobile_V1_GnomobileServiceClientProtocol { ) } - /// QEval evaluates the given expression with the realm code at package_path. The package path - /// should include the prefix like "gno.land/". The expression is usually a function call like - /// "GetBoardIDFromName(\"testboard\")". The return value is a typed expression like + /// QEval evaluates the given expression with the realm code at package_path. + /// The package path should include the prefix like "gno.land/". The expression + /// is usually a function call like "GetBoardIDFromName(\"testboard\")". The + /// return value is a typed expression like /// "(1 gno.land/r/demo/boards.BoardID)\n(true bool)". /// /// - Parameters: @@ -430,6 +439,27 @@ extension Land_Gno_Gnomobile_V1_GnomobileServiceClientProtocol { interceptors: self.interceptors?.makeHelloInterceptors() ?? [] ) } + + /// HelloStream is for debug purposes + /// + /// - Parameters: + /// - request: Request to send to HelloStream. + /// - callOptions: Call options. + /// - handler: A closure called when each response is received from the server. + /// - Returns: A `ServerStreamingCall` with futures for the metadata and status. + internal func helloStream( + _ request: Land_Gno_Gnomobile_V1_HelloStreamRequest, + callOptions: CallOptions? = nil, + handler: @escaping (Land_Gno_Gnomobile_V1_HelloStreamResponse) -> Void + ) -> ServerStreamingCall { + return self.makeServerStreamingCall( + path: Land_Gno_Gnomobile_V1_GnomobileServiceClientMetadata.Methods.helloStream.path, + request: request, + callOptions: callOptions ?? self.defaultCallOptions, + interceptors: self.interceptors?.makeHelloStreamInterceptors() ?? [], + handler: handler + ) + } } @available(*, deprecated) @@ -579,6 +609,11 @@ internal protocol Land_Gno_Gnomobile_V1_GnomobileServiceAsyncClientProtocol: GRP _ request: Land_Gno_Gnomobile_V1_HelloRequest, callOptions: CallOptions? ) -> GRPCAsyncUnaryCall + + func makeHelloStreamCall( + _ request: Land_Gno_Gnomobile_V1_HelloStreamRequest, + callOptions: CallOptions? + ) -> GRPCAsyncServerStreamingCall } @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) @@ -794,6 +829,18 @@ extension Land_Gno_Gnomobile_V1_GnomobileServiceAsyncClientProtocol { interceptors: self.interceptors?.makeHelloInterceptors() ?? [] ) } + + internal func makeHelloStreamCall( + _ request: Land_Gno_Gnomobile_V1_HelloStreamRequest, + callOptions: CallOptions? = nil + ) -> GRPCAsyncServerStreamingCall { + return self.makeAsyncServerStreamingCall( + path: Land_Gno_Gnomobile_V1_GnomobileServiceClientMetadata.Methods.helloStream.path, + request: request, + callOptions: callOptions ?? self.defaultCallOptions, + interceptors: self.interceptors?.makeHelloStreamInterceptors() ?? [] + ) + } } @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) @@ -1001,6 +1048,18 @@ extension Land_Gno_Gnomobile_V1_GnomobileServiceAsyncClientProtocol { interceptors: self.interceptors?.makeHelloInterceptors() ?? [] ) } + + internal func helloStream( + _ request: Land_Gno_Gnomobile_V1_HelloStreamRequest, + callOptions: CallOptions? = nil + ) -> GRPCAsyncResponseStream { + return self.performAsyncServerStreamingCall( + path: Land_Gno_Gnomobile_V1_GnomobileServiceClientMetadata.Methods.helloStream.path, + request: request, + callOptions: callOptions ?? self.defaultCallOptions, + interceptors: self.interceptors?.makeHelloStreamInterceptors() ?? [] + ) + } } @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) @@ -1072,6 +1131,9 @@ internal protocol Land_Gno_Gnomobile_V1_GnomobileServiceClientInterceptorFactory /// - Returns: Interceptors to use when invoking 'hello'. func makeHelloInterceptors() -> [ClientInterceptor] + + /// - Returns: Interceptors to use when invoking 'helloStream'. + func makeHelloStreamInterceptors() -> [ClientInterceptor] } internal enum Land_Gno_Gnomobile_V1_GnomobileServiceClientMetadata { @@ -1096,6 +1158,7 @@ internal enum Land_Gno_Gnomobile_V1_GnomobileServiceClientMetadata { Land_Gno_Gnomobile_V1_GnomobileServiceClientMetadata.Methods.addressToBech32, Land_Gno_Gnomobile_V1_GnomobileServiceClientMetadata.Methods.addressFromBech32, Land_Gno_Gnomobile_V1_GnomobileServiceClientMetadata.Methods.hello, + Land_Gno_Gnomobile_V1_GnomobileServiceClientMetadata.Methods.helloStream, ] ) @@ -1201,6 +1264,12 @@ internal enum Land_Gno_Gnomobile_V1_GnomobileServiceClientMetadata { path: "/land.gno.gnomobile.v1.GnomobileService/Hello", type: GRPCCallType.unary ) + + internal static let helloStream = GRPCMethodDescriptor( + name: "HelloStream", + path: "/land.gno.gnomobile.v1.GnomobileService/HelloStream", + type: GRPCCallType.serverStreaming + ) } } diff --git a/gnoboard/ios/gnoboard.xcodeproj/project.pbxproj b/gnoboard/ios/gnoboard.xcodeproj/project.pbxproj index c43a2072..e2cc4227 100644 --- a/gnoboard/ios/gnoboard.xcodeproj/project.pbxproj +++ b/gnoboard/ios/gnoboard.xcodeproj/project.pbxproj @@ -376,6 +376,7 @@ "${BUILT_PRODUCTS_DIR}/gRPC-Swift/GRPC.framework", "${BUILT_PRODUCTS_DIR}/glog/glog.framework", "${BUILT_PRODUCTS_DIR}/libevent/libevent.framework", + "${BUILT_PRODUCTS_DIR}/react-native-get-random-values/react_native_get_random_values.framework", "${BUILT_PRODUCTS_DIR}/react-native-safe-area-context/react_native_safe_area_context.framework", "${BUILT_PRODUCTS_DIR}/react-native-slider/react_native_slider.framework", "${PODS_XCFRAMEWORKS_BUILD_DIR}/hermes-engine/Pre-built/hermes.framework/hermes", @@ -443,6 +444,7 @@ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GRPC.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/glog.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/libevent.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/react_native_get_random_values.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/react_native_safe_area_context.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/react_native_slider.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/hermes.framework", @@ -668,7 +670,11 @@ ONLY_ACTIVE_ARCH = YES; OTHER_CFLAGS = "$(inherited)"; OTHER_CPLUSPLUSFLAGS = "$(inherited)"; - OTHER_LDFLAGS = "$(inherited) "; + OTHER_LDFLAGS = ( + "$(inherited)", + " ", + "-Wl -ld_classic ", + ); REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native"; SDKROOT = iphoneos; }; @@ -739,6 +745,7 @@ OTHER_LDFLAGS = ( "$(inherited)", " ", + "-Wl -ld_classic ", ); REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native"; SDKROOT = iphoneos; diff --git a/gnoboard/package.json b/gnoboard/package.json index 26a893f7..95c0b87d 100644 --- a/gnoboard/package.json +++ b/gnoboard/package.json @@ -20,17 +20,23 @@ "@react-navigation/bottom-tabs": "^6.5.8", "@react-navigation/native": "^6.1.7", "@react-navigation/native-stack": "^6.9.13", + "base-64": "^1.0.0", "buffer": "^6.0.3", "expo": "~49.0.7", "expo-splash-screen": "~0.20.5", "expo-status-bar": "~1.6.0", - "fast-text-encoding": "^1.0.6", "react": "18.2.0", "react-native": "0.72.5", + "react-native-fetch-api": "^3.0.0", + "react-native-get-random-values": "^1.9.0", + "react-native-polyfill-globals": "^3.1.0", "react-native-safe-area-context": "^4.7.2", "react-native-screens": "~3.22.0", "react-native-svg": "13.9.0", - "styled-components": "6.0.7" + "react-native-url-polyfill": "^2.0.0", + "styled-components": "^6.0.8", + "text-encoding": "^0.7.0", + "web-streams-polyfill": "^3.2.1" }, "devDependencies": { "@babel/core": "^7.20.0", diff --git a/gnoboard/src/api/gnomobiletypes_pb.d.ts b/gnoboard/src/api/gnomobiletypes_pb.d.ts index 080b4f7a..b12a980c 100644 --- a/gnoboard/src/api/gnomobiletypes_pb.d.ts +++ b/gnoboard/src/api/gnomobiletypes_pb.d.ts @@ -1008,3 +1008,51 @@ export declare class HelloResponse extends Message { static equals(a: HelloResponse | PlainMessage | undefined, b: HelloResponse | PlainMessage | undefined): boolean; } +/** + * @generated from message land.gno.gnomobile.v1.HelloStreamRequest + */ +export declare class HelloStreamRequest extends Message { + /** + * @generated from field: string name = 1; + */ + name: string; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "land.gno.gnomobile.v1.HelloStreamRequest"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): HelloStreamRequest; + + static fromJson(jsonValue: JsonValue, options?: Partial): HelloStreamRequest; + + static fromJsonString(jsonString: string, options?: Partial): HelloStreamRequest; + + static equals(a: HelloStreamRequest | PlainMessage | undefined, b: HelloStreamRequest | PlainMessage | undefined): boolean; +} + +/** + * @generated from message land.gno.gnomobile.v1.HelloStreamResponse + */ +export declare class HelloStreamResponse extends Message { + /** + * @generated from field: string greeting = 1; + */ + greeting: string; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "land.gno.gnomobile.v1.HelloStreamResponse"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): HelloStreamResponse; + + static fromJson(jsonValue: JsonValue, options?: Partial): HelloStreamResponse; + + static fromJsonString(jsonString: string, options?: Partial): HelloStreamResponse; + + static equals(a: HelloStreamResponse | PlainMessage | undefined, b: HelloStreamResponse | PlainMessage | undefined): boolean; +} + diff --git a/gnoboard/src/api/gnomobiletypes_pb.js b/gnoboard/src/api/gnomobiletypes_pb.js index fb363b4c..3f072c95 100644 --- a/gnoboard/src/api/gnomobiletypes_pb.js +++ b/gnoboard/src/api/gnomobiletypes_pb.js @@ -390,3 +390,23 @@ export const HelloResponse = proto3.makeMessageType( ], ); +/** + * @generated from message land.gno.gnomobile.v1.HelloStreamRequest + */ +export const HelloStreamRequest = proto3.makeMessageType( + "land.gno.gnomobile.v1.HelloStreamRequest", + () => [ + { no: 1, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ], +); + +/** + * @generated from message land.gno.gnomobile.v1.HelloStreamResponse + */ +export const HelloStreamResponse = proto3.makeMessageType( + "land.gno.gnomobile.v1.HelloStreamResponse", + () => [ + { no: 1, name: "greeting", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ], +); + diff --git a/gnoboard/src/api/rpc_connect.d.ts b/gnoboard/src/api/rpc_connect.d.ts index 14d51b0b..a312a123 100644 --- a/gnoboard/src/api/rpc_connect.d.ts +++ b/gnoboard/src/api/rpc_connect.d.ts @@ -3,7 +3,7 @@ /* eslint-disable */ // @ts-nocheck -import { AddressFromBech32Request, AddressFromBech32Response, AddressToBech32Request, AddressToBech32Response, CallRequest, CallResponse, CreateAccountRequest, CreateAccountResponse, DeleteAccountRequest, DeleteAccountResponse, GenerateRecoveryPhraseRequest, GenerateRecoveryPhraseResponse, GetActiveAccountRequest, GetActiveAccountResponse, HelloRequest, HelloResponse, ListKeyInfoRequest, ListKeyInfoResponse, QEvalRequest, QEvalResponse, QueryAccountRequest, QueryAccountResponse, QueryRequest, QueryResponse, RenderRequest, RenderResponse, SelectAccountRequest, SelectAccountResponse, SetChainIDRequest, SetChainIDResponse, SetPasswordRequest, SetPasswordResponse, SetRemoteRequest, SetRemoteResponse } from "./gnomobiletypes_pb.js"; +import { AddressFromBech32Request, AddressFromBech32Response, AddressToBech32Request, AddressToBech32Response, CallRequest, CallResponse, CreateAccountRequest, CreateAccountResponse, DeleteAccountRequest, DeleteAccountResponse, GenerateRecoveryPhraseRequest, GenerateRecoveryPhraseResponse, GetActiveAccountRequest, GetActiveAccountResponse, HelloRequest, HelloResponse, HelloStreamRequest, HelloStreamResponse, ListKeyInfoRequest, ListKeyInfoResponse, QEvalRequest, QEvalResponse, QueryAccountRequest, QueryAccountResponse, QueryRequest, QueryResponse, RenderRequest, RenderResponse, SelectAccountRequest, SelectAccountResponse, SetChainIDRequest, SetChainIDResponse, SetPasswordRequest, SetPasswordResponse, SetRemoteRequest, SetRemoteResponse } from "./gnomobiletypes_pb.js"; import { MethodKind } from "@bufbuild/protobuf"; /** @@ -111,7 +111,8 @@ export declare const GnomobileService: { readonly kind: MethodKind.Unary, }, /** - * QueryAccount retrieves account information from the blockchain for a given address. + * QueryAccount retrieves account information from the blockchain for a given + * address. * * @generated from rpc land.gno.gnomobile.v1.GnomobileService.QueryAccount */ @@ -122,9 +123,9 @@ export declare const GnomobileService: { readonly kind: MethodKind.Unary, }, /** - * DeleteAccount deletes the account with the given name, using the password to - * ensure access. However, if skip_password is true, then ignore the password. - * If the account doesn't exist, then return ErrCryptoKeyNotFound. + * DeleteAccount deletes the account with the given name, using the password + * to ensure access. However, if skip_password is true, then ignore the + * password. If the account doesn't exist, then return ErrCryptoKeyNotFound. * If the password is wrong, then return ErrDecryptionFailed. * * @generated from rpc land.gno.gnomobile.v1.GnomobileService.DeleteAccount @@ -147,9 +148,10 @@ export declare const GnomobileService: { readonly kind: MethodKind.Unary, }, /** - * Render calls the Render function for package_path with optional args. The package path - * should include the prefix like "gno.land/". This is similar to using a browser URL - * /: where doesn't have the prefix like "gno.land/". + * Render calls the Render function for package_path with optional args. The + * package path should include the prefix like "gno.land/". This is similar to + * using a browser URL /: where doesn't have + * the prefix like "gno.land/". * * @generated from rpc land.gno.gnomobile.v1.GnomobileService.Render */ @@ -160,9 +162,10 @@ export declare const GnomobileService: { readonly kind: MethodKind.Unary, }, /** - * QEval evaluates the given expression with the realm code at package_path. The package path - * should include the prefix like "gno.land/". The expression is usually a function call like - * "GetBoardIDFromName(\"testboard\")". The return value is a typed expression like + * QEval evaluates the given expression with the realm code at package_path. + * The package path should include the prefix like "gno.land/". The expression + * is usually a function call like "GetBoardIDFromName(\"testboard\")". The + * return value is a typed expression like * "(1 gno.land/r/demo/boards.BoardID)\n(true bool)". * * @generated from rpc land.gno.gnomobile.v1.GnomobileService.QEval @@ -217,6 +220,17 @@ export declare const GnomobileService: { readonly O: typeof HelloResponse, readonly kind: MethodKind.Unary, }, + /** + * HelloStream is for debug purposes + * + * @generated from rpc land.gno.gnomobile.v1.GnomobileService.HelloStream + */ + readonly helloStream: { + readonly name: "HelloStream", + readonly I: typeof HelloStreamRequest, + readonly O: typeof HelloStreamResponse, + readonly kind: MethodKind.ServerStreaming, + }, } }; diff --git a/gnoboard/src/api/rpc_connect.js b/gnoboard/src/api/rpc_connect.js index ae6779fa..3ebba191 100644 --- a/gnoboard/src/api/rpc_connect.js +++ b/gnoboard/src/api/rpc_connect.js @@ -3,7 +3,7 @@ /* eslint-disable */ // @ts-nocheck -import { AddressFromBech32Request, AddressFromBech32Response, AddressToBech32Request, AddressToBech32Response, CallRequest, CallResponse, CreateAccountRequest, CreateAccountResponse, DeleteAccountRequest, DeleteAccountResponse, GenerateRecoveryPhraseRequest, GenerateRecoveryPhraseResponse, GetActiveAccountRequest, GetActiveAccountResponse, HelloRequest, HelloResponse, ListKeyInfoRequest, ListKeyInfoResponse, QEvalRequest, QEvalResponse, QueryAccountRequest, QueryAccountResponse, QueryRequest, QueryResponse, RenderRequest, RenderResponse, SelectAccountRequest, SelectAccountResponse, SetChainIDRequest, SetChainIDResponse, SetPasswordRequest, SetPasswordResponse, SetRemoteRequest, SetRemoteResponse } from "./gnomobiletypes_pb.js"; +import { AddressFromBech32Request, AddressFromBech32Response, AddressToBech32Request, AddressToBech32Response, CallRequest, CallResponse, CreateAccountRequest, CreateAccountResponse, DeleteAccountRequest, DeleteAccountResponse, GenerateRecoveryPhraseRequest, GenerateRecoveryPhraseResponse, GetActiveAccountRequest, GetActiveAccountResponse, HelloRequest, HelloResponse, HelloStreamRequest, HelloStreamResponse, ListKeyInfoRequest, ListKeyInfoResponse, QEvalRequest, QEvalResponse, QueryAccountRequest, QueryAccountResponse, QueryRequest, QueryResponse, RenderRequest, RenderResponse, SelectAccountRequest, SelectAccountResponse, SetChainIDRequest, SetChainIDResponse, SetPasswordRequest, SetPasswordResponse, SetRemoteRequest, SetRemoteResponse } from "./gnomobiletypes_pb.js"; import { MethodKind } from "@bufbuild/protobuf"; /** @@ -111,7 +111,8 @@ export const GnomobileService = { kind: MethodKind.Unary, }, /** - * QueryAccount retrieves account information from the blockchain for a given address. + * QueryAccount retrieves account information from the blockchain for a given + * address. * * @generated from rpc land.gno.gnomobile.v1.GnomobileService.QueryAccount */ @@ -122,9 +123,9 @@ export const GnomobileService = { kind: MethodKind.Unary, }, /** - * DeleteAccount deletes the account with the given name, using the password to - * ensure access. However, if skip_password is true, then ignore the password. - * If the account doesn't exist, then return ErrCryptoKeyNotFound. + * DeleteAccount deletes the account with the given name, using the password + * to ensure access. However, if skip_password is true, then ignore the + * password. If the account doesn't exist, then return ErrCryptoKeyNotFound. * If the password is wrong, then return ErrDecryptionFailed. * * @generated from rpc land.gno.gnomobile.v1.GnomobileService.DeleteAccount @@ -147,9 +148,10 @@ export const GnomobileService = { kind: MethodKind.Unary, }, /** - * Render calls the Render function for package_path with optional args. The package path - * should include the prefix like "gno.land/". This is similar to using a browser URL - * /: where doesn't have the prefix like "gno.land/". + * Render calls the Render function for package_path with optional args. The + * package path should include the prefix like "gno.land/". This is similar to + * using a browser URL /: where doesn't have + * the prefix like "gno.land/". * * @generated from rpc land.gno.gnomobile.v1.GnomobileService.Render */ @@ -160,9 +162,10 @@ export const GnomobileService = { kind: MethodKind.Unary, }, /** - * QEval evaluates the given expression with the realm code at package_path. The package path - * should include the prefix like "gno.land/". The expression is usually a function call like - * "GetBoardIDFromName(\"testboard\")". The return value is a typed expression like + * QEval evaluates the given expression with the realm code at package_path. + * The package path should include the prefix like "gno.land/". The expression + * is usually a function call like "GetBoardIDFromName(\"testboard\")". The + * return value is a typed expression like * "(1 gno.land/r/demo/boards.BoardID)\n(true bool)". * * @generated from rpc land.gno.gnomobile.v1.GnomobileService.QEval @@ -217,6 +220,17 @@ export const GnomobileService = { O: HelloResponse, kind: MethodKind.Unary, }, + /** + * HelloStream is for debug purposes + * + * @generated from rpc land.gno.gnomobile.v1.GnomobileService.HelloStream + */ + helloStream: { + name: "HelloStream", + I: HelloStreamRequest, + O: HelloStreamResponse, + kind: MethodKind.ServerStreaming, + }, } }; diff --git a/gnoboard/src/grpc/client.ts b/gnoboard/src/grpc/client.ts index 0b4b1749..ff823ff5 100644 --- a/gnoboard/src/grpc/client.ts +++ b/gnoboard/src/grpc/client.ts @@ -4,7 +4,6 @@ import { GnomobileService } from '@gno/api/rpc_connect'; // Create a GnomobileService client export function createClient(port: number) { - console.log('createClient', port) return createPromiseClient( GnomobileService, createXHRGrpcWebTransport({ diff --git a/gnoboard/src/grpc/transport.ts b/gnoboard/src/grpc/transport.ts index eaa103ca..204f6cf4 100644 --- a/gnoboard/src/grpc/transport.ts +++ b/gnoboard/src/grpc/transport.ts @@ -1,32 +1,27 @@ -import { Message } from "@bufbuild/protobuf"; - -import type { - AnyMessage, - MethodInfo, - PartialMessage, - ServiceType, -} from "@bufbuild/protobuf"; - -import type { UnaryRequest } from "@connectrpc/connect"; -import { Code, ConnectError } from "@connectrpc/connect"; -import type { Transport, UnaryResponse } from "@connectrpc/connect"; +import type { AnyMessage, MethodInfo, PartialMessage, ServiceType } from '@bufbuild/protobuf'; + +import type { StreamResponse, Transport, UnaryRequest, UnaryResponse } from '@connectrpc/connect'; import { createClientMethodSerializers, + createEnvelopeReadableStream, createMethodUrl, encodeEnvelope, + runStreamingCall, runUnaryCall, -} from "@connectrpc/connect/protocol"; +} from '@connectrpc/connect/protocol'; +import { endStreamFlag, endStreamFromJson, requestHeader, validateResponse } from '@connectrpc/connect/protocol-connect'; import { - requestHeader, + requestHeader as webRequestHeader, trailerFlag, trailerParse, - validateResponse, + validateResponse as webValidateResponse, validateTrailer, -} from "@connectrpc/connect/protocol-grpc-web"; -import { GrpcWebTransportOptions } from "@connectrpc/connect-web"; +} from '@connectrpc/connect/protocol-grpc-web'; +import { GrpcWebTransportOptions } from '@connectrpc/connect-web'; +import { Message, MethodKind } from '@bufbuild/protobuf'; class AbortError extends Error { - name = "AbortError"; + name = 'AbortError'; } interface FetchXHRResponse { @@ -40,7 +35,7 @@ function parseHeaders(allHeaders: string): Headers { .trim() .split(/[\r\n]+/) .reduce((memo, header) => { - const [key, value] = header.split(": "); + const [key, value] = header.split(': '); memo.append(key, value); return memo; }, new Headers()); @@ -66,15 +61,10 @@ function extractDataChunks(initialData: Uint8Array) { return dataChunks; } -export function createXHRGrpcWebTransport( - options: GrpcWebTransportOptions, -): Transport { +export function createXHRGrpcWebTransport(options: GrpcWebTransportOptions): Transport { const useBinaryFormat = options.useBinaryFormat ?? true; return { - async unary< - I extends Message = AnyMessage, - O extends Message = AnyMessage, - >( + async unary = AnyMessage, O extends Message = AnyMessage>( service: ServiceType, method: MethodInfo, signal: AbortSignal | undefined, @@ -82,12 +72,7 @@ export function createXHRGrpcWebTransport( header: Headers, message: PartialMessage, ): Promise> { - const { serialize, parse } = createClientMethodSerializers( - method, - useBinaryFormat, - options.jsonOptions, - options.binaryOptions, - ); + const { serialize, parse } = createClientMethodSerializers(method, useBinaryFormat, options.jsonOptions, options.binaryOptions); return await runUnaryCall({ signal, @@ -98,10 +83,10 @@ export function createXHRGrpcWebTransport( method, url: createMethodUrl(options.baseUrl, service, method), init: { - method: "POST", - mode: "cors", + method: 'POST', + mode: 'cors', }, - header: requestHeader(useBinaryFormat, timeoutMs, header), + header: webRequestHeader(useBinaryFormat, timeoutMs, header), message, }, next: async (req: UnaryRequest): Promise> => { @@ -109,19 +94,19 @@ export function createXHRGrpcWebTransport( return new Promise((resolve, reject) => { const xhr = new XMLHttpRequest(); - xhr.open(req.init.method ?? "POST", req.url); + xhr.open(req.init.method ?? 'POST', req.url); function onAbort() { xhr.abort(); } - req.signal.addEventListener("abort", onAbort); + req.signal.addEventListener('abort', onAbort); - xhr.addEventListener("abort", () => { - reject(new AbortError("Request aborted")); + xhr.addEventListener('abort', () => { + reject(new AbortError('Request aborted')); }); - xhr.addEventListener("load", () => { + xhr.addEventListener('load', () => { resolve({ status: xhr.status, headers: parseHeaders(xhr.getAllResponseHeaders()), @@ -129,26 +114,24 @@ export function createXHRGrpcWebTransport( }); }); - xhr.addEventListener("error", () => { - reject(new Error("Network Error")); + xhr.addEventListener('error', () => { + reject(new Error('Network Error')); }); - xhr.addEventListener("loadend", () => { - req.signal.removeEventListener("abort", onAbort); + xhr.addEventListener('loadend', () => { + req.signal.removeEventListener('abort', onAbort); }); - xhr.responseType = "arraybuffer"; + xhr.responseType = 'arraybuffer'; - req.header.forEach((value: string, key: string) => - xhr.setRequestHeader(key, value) - ); + req.header.forEach((value: string, key: string) => xhr.setRequestHeader(key, value)); xhr.send(encodeEnvelope(0, serialize(req.message))); }); } const response = await fetchXHR(); - validateResponse(response.status, response.headers); + webValidateResponse(response.status, response.headers); const chunks = extractDataChunks(response.body); @@ -158,7 +141,7 @@ export function createXHRGrpcWebTransport( chunks.forEach(({ flags, data }) => { if (flags === trailerFlag) { if (trailer !== undefined) { - throw "extra trailer"; + throw 'extra trailer'; } // Unary responses require exactly one response message, but in @@ -169,23 +152,23 @@ export function createXHRGrpcWebTransport( } if (message !== undefined) { - throw "extra message"; + throw 'extra message'; } message = parse(data); }); if (trailer === undefined) { - throw "missing trailer"; + throw 'missing trailer'; } validateTrailer(trailer); if (message === undefined) { - throw "missing message"; + throw 'missing message'; } - return > { + return >{ stream: false, header: response.headers, message, @@ -194,12 +177,112 @@ export function createXHRGrpcWebTransport( }, }); }, - stream( - ..._args: unknown[] - ) { - return Promise.reject( - new ConnectError("streaming is not implemented", Code.Unimplemented), - ); + + async stream = AnyMessage, O extends Message = AnyMessage>( + service: ServiceType, + method: MethodInfo, + signal: AbortSignal | undefined, + timeoutMs: number | undefined, + header: HeadersInit | undefined, + input: AsyncIterable>, + ): Promise> { + const { serialize, parse } = createClientMethodSerializers(method, useBinaryFormat, options.jsonOptions, options.binaryOptions); + + async function* parseResponseBody(body: ReadableStream, trailerTarget: Headers) { + const reader = createEnvelopeReadableStream(body).getReader(); + let endStreamReceived = false; + + for (;;) { + const result = await reader.read(); + if (result.done) { + break; + } + + const { flags, data } = result.value; + if ((flags & endStreamFlag) === endStreamFlag) { + endStreamReceived = true; + + const endStream = endStreamFromJson(data); + if (endStream.error) { + throw endStream.error; + } + + endStream.metadata.forEach((value, key) => trailerTarget.set(key, value)); + continue; + } + + yield parse(data); + } + + if (!endStreamReceived) { + throw 'missing EndStreamResponse'; + } + } + + async function createRequestBody(input: AsyncIterable): Promise { + if (method.kind != MethodKind.ServerStreaming) { + throw 'The fetch API does not support streaming request bodies'; + } + + const r = await input[Symbol.asyncIterator]().next(); + if (r.done == true) { + throw 'missing request message'; + } + + return encodeEnvelope(0, serialize(r.value)); + } + + return await runStreamingCall({ + interceptors: options.interceptors, + timeoutMs, + signal, + req: { + stream: true, + service, + method, + url: createMethodUrl(options.baseUrl, service, method), + init: { + method: 'POST', + credentials: options.credentials ?? 'same-origin', + mode: 'cors', + }, + header: requestHeader(method.kind, useBinaryFormat, timeoutMs, header), + message: input, + }, + next: async (req) => { + const fetch = options.fetch ?? globalThis.fetch; + const fRes = await fetch(req.url, { + ...req.init, + headers: req.header, + signal: req.signal, + body: await createRequestBody(req.message), + reactNative: { textStreaming: true }, // allows streaming in the polyfill fetch function + }); + + validateResponse(method.kind, fRes.status, fRes.headers); + if (fRes.body === null) { + throw 'missing response body'; + } + + const trailer = new Headers(); + + // We have to implement the `*[Symbol.asyncIterator]()` of the object we give to the StreamResponse.message field. + // It seems that react-native lacks the feature. + const generator = { + async *[Symbol.asyncIterator]() { + yield* parseResponseBody(fRes.body, trailer); + }, + }; + + const res: StreamResponse = { + ...req, + header: fRes.headers, + trailer, + message: generator, + }; + return res; + }, + }); }, }; } diff --git a/gnoboard/src/hooks/use-gno.ts b/gnoboard/src/hooks/use-gno.ts index 57039690..43eeadcb 100644 --- a/gnoboard/src/hooks/use-gno.ts +++ b/gnoboard/src/hooks/use-gno.ts @@ -54,7 +54,7 @@ export const useGno = (): GnoResponse => { console.log('Creating GRPC client instance...'); const port = await GoBridge.getTcpPort(); - clientInstance = await Grpc.createClient(port); + clientInstance = Grpc.createClient(port); return clientInstance; }; diff --git a/gnoboard/yarn.lock b/gnoboard/yarn.lock index 8d56870c..4eccdd94 100644 --- a/gnoboard/yarn.lock +++ b/gnoboard/yarn.lock @@ -20,22 +20,6 @@ "@jridgewell/gen-mapping" "^0.3.0" "@jridgewell/trace-mapping" "^0.3.9" -"@babel/cli@^7.21.0": - version "7.23.0" - resolved "https://registry.yarnpkg.com/@babel/cli/-/cli-7.23.0.tgz#1d7f37c44d4117c67df46749e0c86e11a58cc64b" - integrity sha512-17E1oSkGk2IwNILM4jtfAvgjt+ohmpfBky8aLerUfYZhiPNg7ca+CRCxZn8QDxwNhV/upsc2VHBCqGFIR+iBfA== - dependencies: - "@jridgewell/trace-mapping" "^0.3.17" - commander "^4.0.1" - convert-source-map "^2.0.0" - fs-readdir-recursive "^1.1.0" - glob "^7.2.0" - make-dir "^2.1.0" - slash "^2.0.0" - optionalDependencies: - "@nicolo-ribaudo/chokidar-2" "2.1.8-no-fsevents.3" - chokidar "^3.4.0" - "@babel/code-frame@7.10.4", "@babel/code-frame@~7.10.4": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.10.4.tgz#168da1a36e90da68ae8d49c0f1b48c7c6249213a" @@ -69,7 +53,7 @@ resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.22.20.tgz#8df6e96661209623f1975d66c35ffca66f3306d0" integrity sha512-BQYjKbpXjoXwFW5jGqiizJQQT/aC7pFm9Ok1OWssonuguICi264lbgMzRp2ZMmRSlfkX6DsWDDcsrctK8Rwfiw== -"@babel/core@^7.12.10", "@babel/core@^7.21.0": +"@babel/core@^7.12.10": version "7.23.0" resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.23.0.tgz#f8259ae0e52a123eb40f552551e647b506a94d83" integrity sha512-97z/ju/Jy1rZmDxybphrBuI+jtJjFVoz7Mr9yUQVVVi+DNZE333uFQeMOqcCIy1x3WYBIbWftUSLmbNXNT7qFQ== @@ -278,7 +262,7 @@ dependencies: "@babel/types" "^7.22.5" -"@babel/helper-module-imports@^7.12.13", "@babel/helper-module-imports@^7.18.6", "@babel/helper-module-imports@^7.22.15": +"@babel/helper-module-imports@^7.12.13", "@babel/helper-module-imports@^7.22.15": version "7.22.15" resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.22.15.tgz#16146307acdc40cc00c3b2c647713076464bdbf0" integrity sha512-0pYVBnDKZO2fnSPCrgM/6WMc7eS20Fbok+0r88fp+YtWVLZrp4CkafFGIp+W0VKw4a22sgebPT99y+FDNMdP4w== @@ -486,13 +470,6 @@ "@babel/helper-skip-transparent-expression-wrappers" "^7.22.5" "@babel/plugin-transform-optional-chaining" "^7.22.5" -"@babel/plugin-external-helpers@^7.18.6": - version "7.22.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-external-helpers/-/plugin-external-helpers-7.22.5.tgz#92b0705b74756123f289388320e0e12c407fdf9a" - integrity sha512-ngnNEWxmykPk82mH4ajZT0qTztr3Je6hrMuKAslZVM8G1YZTENJSYwrIGtt6KOtznug3exmAtF4so/nPqJuA4A== - dependencies: - "@babel/helper-plugin-utils" "^7.22.5" - "@babel/plugin-proposal-async-generator-functions@^7.0.0": version "7.20.7" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.20.7.tgz#bfb7276d2d573cb67ba379984a2334e262ba5326" @@ -503,7 +480,7 @@ "@babel/helper-remap-async-to-generator" "^7.18.9" "@babel/plugin-syntax-async-generators" "^7.8.4" -"@babel/plugin-proposal-class-properties@^7.0.0", "@babel/plugin-proposal-class-properties@^7.12.1", "@babel/plugin-proposal-class-properties@^7.13.0", "@babel/plugin-proposal-class-properties@^7.18.0", "@babel/plugin-proposal-class-properties@^7.18.6": +"@babel/plugin-proposal-class-properties@^7.0.0", "@babel/plugin-proposal-class-properties@^7.12.1", "@babel/plugin-proposal-class-properties@^7.13.0", "@babel/plugin-proposal-class-properties@^7.18.0": version "7.18.6" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.18.6.tgz#b110f59741895f7ec21a6fff696ec46265c446a3" integrity sha512-cumfXOF0+nzZrrN8Rf0t7M+tF6sZc7vhQwYQck9q1/5w2OExlD+b4v4RpMJFaV1Z7WcDRgO6FqvxqxGlwo+RHQ== @@ -573,7 +550,7 @@ "@babel/helper-plugin-utils" "^7.18.6" "@babel/plugin-syntax-numeric-separator" "^7.10.4" -"@babel/plugin-proposal-object-rest-spread@^7.0.0", "@babel/plugin-proposal-object-rest-spread@^7.12.1", "@babel/plugin-proposal-object-rest-spread@^7.12.13", "@babel/plugin-proposal-object-rest-spread@^7.20.0", "@babel/plugin-proposal-object-rest-spread@^7.20.7": +"@babel/plugin-proposal-object-rest-spread@^7.0.0", "@babel/plugin-proposal-object-rest-spread@^7.12.1", "@babel/plugin-proposal-object-rest-spread@^7.12.13", "@babel/plugin-proposal-object-rest-spread@^7.20.0": version "7.20.7" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.20.7.tgz#aa662940ef425779c75534a5c41e9d936edc390a" integrity sha512-d2S98yCiLxDVmBmE8UjGcfPvNEUbA1U5q5WxaWFUGRzJSVAZqm5W6MbPct0jxnegUZ0niLeNX+IOzEs7wYg9Dg== @@ -1439,7 +1416,7 @@ "@babel/helper-create-regexp-features-plugin" "^7.22.5" "@babel/helper-plugin-utils" "^7.22.5" -"@babel/preset-env@^7.12.11", "@babel/preset-env@^7.20.2": +"@babel/preset-env@^7.12.11": version "7.22.20" resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.22.20.tgz#de9e9b57e1127ce0a2f580831717f7fb677ceedb" integrity sha512-11MY04gGC4kSzlPHRfvVkNAZhUxOvm7DCJ37hPDnUENwe06npjIRAfInEMTGSb4LZK5ZgDFkv5hw0lGebHeTyg== @@ -1629,7 +1606,7 @@ "@babel/types" "^7.4.4" esutils "^2.0.2" -"@babel/preset-react@^7.12.10", "@babel/preset-react@^7.18.6": +"@babel/preset-react@^7.12.10": version "7.22.15" resolved "https://registry.yarnpkg.com/@babel/preset-react/-/preset-react-7.22.15.tgz#9a776892b648e13cc8ca2edf5ed1264eea6b6afc" integrity sha512-Csy1IJ2uEh/PecCBXXoZGAZBeCATTuePzCSB7dLYWS0vOEj6CNpjxIhW4duWwZodBNueH7QO14WbGn8YyeuN9w== @@ -1641,7 +1618,7 @@ "@babel/plugin-transform-react-jsx-development" "^7.22.5" "@babel/plugin-transform-react-pure-annotations" "^7.22.5" -"@babel/preset-typescript@^7.12.7", "@babel/preset-typescript@^7.21.0": +"@babel/preset-typescript@^7.12.7": version "7.23.0" resolved "https://registry.yarnpkg.com/@babel/preset-typescript/-/preset-typescript-7.23.0.tgz#cc6602d13e7e5b2087c811912b87cf937a9129d9" integrity sha512-6P6VVa/NM/VlAYj5s2Aq/gdVg8FSENCg3wlZ6Qau9AcPaoF5LbN1nyGlR9DTRIw9PpxI94e+ReydsJHcjwAweg== @@ -1722,7 +1699,7 @@ "@babel/parser" "^7.22.15" "@babel/types" "^7.22.15" -"@babel/traverse@^7.13.0", "@babel/traverse@^7.21.2", "@babel/traverse@^7.23.0": +"@babel/traverse@^7.13.0", "@babel/traverse@^7.23.0": version "7.23.0" resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.23.0.tgz#18196ddfbcf4ccea324b7f6d3ada00d8c5a99c53" integrity sha512-t/QaEvyIoIkwzpiZ7aoSKK8kObQYeF7T2v+dazAYCb8SXtp58zEVkWW7zAnju8FNKNdr4ScAOEDmMItbyOmEYw== @@ -2316,11 +2293,6 @@ "@jridgewell/resolve-uri" "^3.1.0" "@jridgewell/sourcemap-codec" "^1.4.14" -"@nicolo-ribaudo/chokidar-2@2.1.8-no-fsevents.3": - version "2.1.8-no-fsevents.3" - resolved "https://registry.yarnpkg.com/@nicolo-ribaudo/chokidar-2/-/chokidar-2-2.1.8-no-fsevents.3.tgz#323d72dd25103d0c4fbdce89dadf574a787b1f9b" - integrity sha512-s88O1aVtXftvp5bCPB7WnmXc5IwOZZ7YPuwNPt+GtOOXpPvad1LfbmjYv+qII7zP6RU2QGnqve27dnLycEnyEQ== - "@nodelib/fs.scandir@2.1.5": version "2.1.5" resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5" @@ -4176,6 +4148,11 @@ balanced-match@^1.0.0: resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== +base-64@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/base-64/-/base-64-1.0.0.tgz#09d0f2084e32a3fd08c2475b973788eee6ae8f4a" + integrity sha512-kwDPIFCGx0NZHog36dj+tHiwP4QMzsZ3AgMViUBKI0+V5n4U0ufTCUMhnQ04diaRI8EX/QcPfql7zlhZ7j4zgg== + base64-js@^1.0.2, base64-js@^1.1.2, base64-js@^1.2.3, base64-js@^1.3.1, base64-js@^1.5.1: version "1.5.1" resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a" @@ -4494,7 +4471,7 @@ buffer@^4.3.0: ieee754 "^1.1.4" isarray "^1.0.0" -buffer@^5.5.0: +buffer@^5.4.3, buffer@^5.5.0: version "5.7.1" resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.7.1.tgz#ba62e7c13133053582197160851a8f648e99eed0" integrity sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ== @@ -4700,7 +4677,7 @@ chokidar@^2.1.8: optionalDependencies: fsevents "^1.2.7" -chokidar@^3.4.0, chokidar@^3.4.1, chokidar@^3.4.2, chokidar@^3.5.1: +chokidar@^3.4.1, chokidar@^3.4.2, chokidar@^3.5.1: version "3.5.3" resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.5.3.tgz#1cf37c8707b932bd1af1ae22c0432e2acd1903bd" integrity sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw== @@ -4919,7 +4896,7 @@ commander@^2.20.0: resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== -commander@^4.0.0, commander@^4.0.1: +commander@^4.0.0: version "4.1.1" resolved "https://registry.yarnpkg.com/commander/-/commander-4.1.1.tgz#9fd602bd936294e9e9ef46a3f4d6964044b18068" integrity sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA== @@ -6347,6 +6324,11 @@ extglob@^2.0.4: snapdragon "^0.8.1" to-regex "^3.0.1" +fast-base64-decode@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/fast-base64-decode/-/fast-base64-decode-1.0.0.tgz#b434a0dd7d92b12b43f26819300d2dafb83ee418" + integrity sha512-qwaScUgUGBYeDNRnbc/KyllVU88Jk1pRHPStuF/lO7B0/RTRLj7U0lkdTAutlBblY08rwZDff6tNU9cjv6j//Q== + fast-deep-equal@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz#7b05218ddf9667bf7f370bf7fdb2cb15fdd0aa49" @@ -6383,11 +6365,6 @@ fast-levenshtein@^2.0.6: resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" integrity sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw== -fast-text-encoding@^1.0.6: - version "1.0.6" - resolved "https://registry.yarnpkg.com/fast-text-encoding/-/fast-text-encoding-1.0.6.tgz#0aa25f7f638222e3396d72bf936afcf1d42d6867" - integrity sha512-VhXlQgj9ioXCqGstD37E/HBeqEGV/qOD/kmbVG8h5xKBYvM1L3lR1Zn4555cQ8GkYbJa8aJSipLPndE1k6zK2w== - fast-xml-parser@^4.0.12: version "4.2.7" resolved "https://registry.yarnpkg.com/fast-xml-parser/-/fast-xml-parser-4.2.7.tgz#871f2ca299dc4334b29f8da3658c164e68395167" @@ -6730,11 +6707,6 @@ fs-monkey@^1.0.4: resolved "https://registry.yarnpkg.com/fs-monkey/-/fs-monkey-1.0.5.tgz#fe450175f0db0d7ea758102e1d84096acb925788" integrity sha512-8uMbBjrhzW76TYgEV27Y5E//W2f/lTFmx78P2w19FZSxarhI/798APGQyuGCwmkNxgwGRhrLfvWyLBvNtuOmew== -fs-readdir-recursive@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/fs-readdir-recursive/-/fs-readdir-recursive-1.1.0.tgz#e32fc030a2ccee44a6b5371308da54be0b397d27" - integrity sha512-GNanXlVr2pf02+sPN40XN8HG+ePaNcvM0q5mZBd668Obwb0yD5GiUbZOFgwn8kGMY6I3mdyDJzieUy3PTYyTRA== - fs-write-stream-atomic@^1.0.8: version "1.0.10" resolved "https://registry.yarnpkg.com/fs-write-stream-atomic/-/fs-write-stream-atomic-1.0.10.tgz#b47df53493ef911df75731e70a9ded0189db40c9" @@ -6910,7 +6882,7 @@ glob@^6.0.1: once "^1.3.0" path-is-absolute "^1.0.0" -glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6, glob@^7.1.7, glob@^7.2.0: +glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6, glob@^7.1.7: version "7.2.3" resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b" integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q== @@ -9491,6 +9463,11 @@ osenv@^0.1.5: os-homedir "^1.0.0" os-tmpdir "^1.0.0" +p-defer@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/p-defer/-/p-defer-3.0.0.tgz#d1dceb4ee9b2b604b1d94ffec83760175d4e6f83" + integrity sha512-ugZxsxmtTln604yeYd29EGrNhazN2lywetzpKhfmQjW/VJmhpDmWbiX+h0zL8V91R0UXkhb3KtPmyq9PZw3aYw== + p-finally@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae" @@ -9773,10 +9750,10 @@ postcss-value-parser@^4.0.2: resolved "https://registry.yarnpkg.com/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz#723c09920836ba6d3e5af019f92bc0971c02e514" integrity sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ== -postcss@^8.4.23: - version "8.4.30" - resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.30.tgz#0e0648d551a606ef2192a26da4cabafcc09c1aa7" - integrity sha512-7ZEao1g4kd68l97aWG/etQKPKq07us0ieSZ2TnFDk11i0ZfDW2AwKHYU8qv4MZKqN2fdBfg+7q0ES06UA73C1g== +postcss@^8.4.31: + version "8.4.31" + resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.31.tgz#92b451050a9f914da6755af352bdc0192508656d" + integrity sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ== dependencies: nanoid "^3.3.6" picocolors "^1.0.0" @@ -9971,7 +9948,7 @@ punycode@^1.2.4, punycode@^1.4.1: resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" integrity sha512-jmYNElW7yvO7TV33CjSmvSiE2yco3bV2czu/OzDKdMNVZQWfxCblURLhf+47syQRBntjfLdd/H0egrzIG+oaFQ== -punycode@^2.1.0: +punycode@^2.1.0, punycode@^2.1.1: version "2.3.0" resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.0.tgz#f67fa67c94da8f4d0cfff981aee4118064199b8f" integrity sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA== @@ -10127,6 +10104,20 @@ react-is@^17.0.1: resolved "https://registry.yarnpkg.com/react-is/-/react-is-17.0.2.tgz#e691d4a8e9c789365655539ab372762b0efb54f0" integrity sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w== +react-native-fetch-api@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/react-native-fetch-api/-/react-native-fetch-api-3.0.0.tgz#81e1bb6562c292521bc4eca52fe1097f4c1ebab5" + integrity sha512-g2rtqPjdroaboDKTsJCTlcmtw54E25OjyaunUP0anOZn4Fuo2IKs8BVfe02zVggA/UysbmfSnRJIqtNkAgggNA== + dependencies: + p-defer "^3.0.0" + +react-native-get-random-values@^1.9.0: + version "1.9.0" + resolved "https://registry.yarnpkg.com/react-native-get-random-values/-/react-native-get-random-values-1.9.0.tgz#6cb30511c406922e75fe73833dc1812a85bfb37e" + integrity sha512-+29IR2oxzxNVeaRwCqGZ9ABadzMI8SLTBidrIDXPOkKnm5+kEmLt34QKM4JV+d2usPErvKyS85le0OmGTHnyWQ== + dependencies: + fast-base64-decode "^1.0.0" + react-native-modal-datetime-picker@^14.0.0: version "14.0.1" resolved "https://registry.yarnpkg.com/react-native-modal-datetime-picker/-/react-native-modal-datetime-picker-14.0.1.tgz#d9c6df4ff85bf1cfbe108c756dc26dcca4cc5f2f" @@ -10141,6 +10132,11 @@ react-native-modal-selector@^2.1.1: dependencies: prop-types "^15.5.10" +react-native-polyfill-globals@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/react-native-polyfill-globals/-/react-native-polyfill-globals-3.1.0.tgz#da7f6c695cd2360096b9a233c4e711d91f1542f8" + integrity sha512-6ACmV1SjXvZP2LN6J2yK58yNACKddcvoiKLrSQdISx32IdYStfdmGXrbAfpd+TANrTlIaZ2SLoFXohNwhnqm/w== + react-native-safe-area-context@^4.7.2: version "4.7.2" resolved "https://registry.yarnpkg.com/react-native-safe-area-context/-/react-native-safe-area-context-4.7.2.tgz#1673aa99b6a9235e7faaf5a248e69795d6e54e07" @@ -10167,6 +10163,13 @@ react-native-swipe-gestures@^1.0.5: resolved "https://registry.yarnpkg.com/react-native-swipe-gestures/-/react-native-swipe-gestures-1.0.5.tgz#a172cb0f3e7478ccd681fd36b8bfbcdd098bde7c" integrity sha512-Ns7Bn9H/Tyw278+5SQx9oAblDZ7JixyzeOczcBK8dipQk2pD7Djkcfnf1nB/8RErAmMLL9iXgW0QHqiII8AhKw== +react-native-url-polyfill@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/react-native-url-polyfill/-/react-native-url-polyfill-2.0.0.tgz#db714520a2985cff1d50ab2e66279b9f91ffd589" + integrity sha512-My330Do7/DvKnEvwQc0WdcBnFPploYKp9CYlefDXzIdEaA+PAhDYllkvGeEroEzvc4Kzzj2O4yVdz8v6fjRvhA== + dependencies: + whatwg-url-without-unicode "8.0.0-3" + react-native@0.72.5: version "0.72.5" resolved "https://registry.yarnpkg.com/react-native/-/react-native-0.72.5.tgz#2c343fa6f3ead362cf07376634a33a4078864357" @@ -10869,11 +10872,6 @@ sisteransi@^1.0.5: resolved "https://registry.yarnpkg.com/sisteransi/-/sisteransi-1.0.5.tgz#134d681297756437cc05ca01370d3a7a571075ed" integrity sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg== -slash@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/slash/-/slash-2.0.0.tgz#de552851a1759df3a8f206535442f5ec4ddeab44" - integrity sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A== - slash@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" @@ -11272,27 +11270,17 @@ structured-headers@^0.4.1: resolved "https://registry.yarnpkg.com/structured-headers/-/structured-headers-0.4.1.tgz#77abd9410622c6926261c09b9d16cf10592694d1" integrity sha512-0MP/Cxx5SzeeZ10p/bZI0S6MpgD+yxAhi1BOQ34jgnMXsCq3j1t6tQnZu+KdlL7dvJTLT3g9xN8tl10TqgFMcg== -styled-components@6.0.7: - version "6.0.7" - resolved "https://registry.yarnpkg.com/styled-components/-/styled-components-6.0.7.tgz#1cf4a5e6b6181b29f941934df54af19b7ef05ab0" - integrity sha512-xIwWuiRMYR43mskVsW9MGTRjSo7ol4bcVjT595fGUp3OLBJOlOgaiKaxsHdC4a2HqWKqKnh0CmcRbk5ogyDjTg== - dependencies: - "@babel/cli" "^7.21.0" - "@babel/core" "^7.21.0" - "@babel/helper-module-imports" "^7.18.6" - "@babel/plugin-external-helpers" "^7.18.6" - "@babel/plugin-proposal-class-properties" "^7.18.6" - "@babel/plugin-proposal-object-rest-spread" "^7.20.7" - "@babel/preset-env" "^7.20.2" - "@babel/preset-react" "^7.18.6" - "@babel/preset-typescript" "^7.21.0" - "@babel/traverse" "^7.21.2" +styled-components@^6.0.8: + version "6.1.0" + resolved "https://registry.yarnpkg.com/styled-components/-/styled-components-6.1.0.tgz#228e3ab9c1ee1daa4b0a06aae30df0ed14fda274" + integrity sha512-VWNfYYBuXzuLS/QYEeoPgMErP26WL+dX9//rEh80B2mmlS1yRxRxuL5eax4m6ybYEUoHWlTy2XOU32767mlMkg== + dependencies: "@emotion/is-prop-valid" "^1.2.1" "@emotion/unitless" "^0.8.0" "@types/stylis" "^4.0.2" css-to-react-native "^3.2.0" csstype "^3.1.2" - postcss "^8.4.23" + postcss "^8.4.31" shallowequal "^1.1.0" stylis "^4.3.0" tslib "^2.5.0" @@ -11502,6 +11490,11 @@ terser@^5.15.0: commander "^2.20.0" source-map-support "~0.5.20" +text-encoding@^0.7.0: + version "0.7.0" + resolved "https://registry.yarnpkg.com/text-encoding/-/text-encoding-0.7.0.tgz#f895e836e45990624086601798ea98e8f36ee643" + integrity sha512-oJQ3f1hrOnbRLOcwKz0Liq2IcrvDeZRHXhd9RgLrsT+DjWY/nty1Hi7v3dtkaEYbPYe0mUoOfzRrMwfXXwgPUA== + text-table@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" @@ -12096,11 +12089,21 @@ wcwidth@^1.0.1: dependencies: defaults "^1.0.3" +web-streams-polyfill@^3.2.1: + version "3.2.1" + resolved "https://registry.yarnpkg.com/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz#71c2718c52b45fd49dbeee88634b3a60ceab42a6" + integrity sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q== + webidl-conversions@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" integrity sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ== +webidl-conversions@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-5.0.0.tgz#ae59c8a00b121543a2acc65c0434f57b0fc11aff" + integrity sha512-VlZwKPCkYKxQgeSbH5EyngOmRp7Ww7I9rQLERETtf5ofd9pGeswWiOtogpEO850jziPRarreGxn5QIiTqpb2wA== + webpack-sources@^1.4.0, webpack-sources@^1.4.1: version "1.4.3" resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-1.4.3.tgz#eedd8ec0b928fbf1cbfe994e22d2d890f330a933" @@ -12143,6 +12146,15 @@ whatwg-fetch@^3.0.0: resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-3.6.17.tgz#009bbbfc122b227b74ba1ff31536b3a1a0e0e212" integrity sha512-c4ghIvG6th0eudYwKZY5keb81wtFz9/WeAHAoy8+r18kcWlitUIrmGFQ2rWEl4UCKUilD3zCLHOIPheHx5ypRQ== +whatwg-url-without-unicode@8.0.0-3: + version "8.0.0-3" + resolved "https://registry.yarnpkg.com/whatwg-url-without-unicode/-/whatwg-url-without-unicode-8.0.0-3.tgz#ab6df4bf6caaa6c85a59f6e82c026151d4bb376b" + integrity sha512-HoKuzZrUlgpz35YO27XgD28uh/WJH4B0+3ttFqRo//lmq+9T/mIOJ6kqmINI9HpUpz1imRC/nR/lxKpJiv0uig== + dependencies: + buffer "^5.4.3" + punycode "^2.1.1" + webidl-conversions "^5.0.0" + whatwg-url@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d" diff --git a/service/api.go b/service/api.go index ddac8db5..83c05792 100644 --- a/service/api.go +++ b/service/api.go @@ -6,6 +6,7 @@ package service import ( "context" "errors" + "time" "connectrpc.com/connect" "github.com/gnolang/gno/tm2/pkg/crypto" @@ -290,3 +291,20 @@ func (s *gnomobileService) Hello(ctx context.Context, req *connect.Request[rpc.H Greeting: "Hello " + req.Msg.Name, }), nil } + +// HelloStream is for debug purposes +func (s *gnomobileService) HelloStream(ctx context.Context, req *connect.Request[rpc.HelloStreamRequest], stream *connect.ServerStream[rpc.HelloStreamResponse]) error { + s.logger.Debug("HelloStream called") + for i := 0; i < 4; i++ { + if err := stream.Send(&rpc.HelloStreamResponse{ + Greeting: "Hello " + req.Msg.Name, + }); err != nil { + s.logger.Error("HelloStream returned error", zap.Error(err)) + return err + } + time.Sleep(2 * time.Second) + } + + s.logger.Debug("HelloStream returned ok") + return nil +} diff --git a/service/gnomobiletypes/gnomobiletypes.go b/service/gnomobiletypes/gnomobiletypes.go index 1ae683ba..badf3c8a 100644 --- a/service/gnomobiletypes/gnomobiletypes.go +++ b/service/gnomobiletypes/gnomobiletypes.go @@ -178,3 +178,11 @@ type HelloRequest struct { type HelloResponse struct { Greeting string } + +type HelloStreamRequest struct { + Name string +} + +type HelloStreamResponse struct { + Greeting string +} diff --git a/service/gnomobiletypes/package.go b/service/gnomobiletypes/package.go index 15fc711b..86590e3c 100644 --- a/service/gnomobiletypes/package.go +++ b/service/gnomobiletypes/package.go @@ -49,4 +49,6 @@ var Package = amino.RegisterPackage(amino.NewPackage( AddressFromBech32Response{}, HelloRequest{}, HelloResponse{}, + HelloStreamRequest{}, + HelloStreamResponse{}, ).WithComments(path.Join(amino.GetCallersDirname(), "gnomobiletypes.go"))) diff --git a/service/rpc/gnomobiletypes.pb.go b/service/rpc/gnomobiletypes.pb.go index 6b6faf26..2b222e6f 100644 --- a/service/rpc/gnomobiletypes.pb.go +++ b/service/rpc/gnomobiletypes.pb.go @@ -1903,6 +1903,100 @@ func (x *HelloResponse) GetGreeting() string { return "" } +type HelloStreamRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *HelloStreamRequest) Reset() { + *x = HelloStreamRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_gnomobiletypes_proto_msgTypes[37] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HelloStreamRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HelloStreamRequest) ProtoMessage() {} + +func (x *HelloStreamRequest) ProtoReflect() protoreflect.Message { + mi := &file_gnomobiletypes_proto_msgTypes[37] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HelloStreamRequest.ProtoReflect.Descriptor instead. +func (*HelloStreamRequest) Descriptor() ([]byte, []int) { + return file_gnomobiletypes_proto_rawDescGZIP(), []int{37} +} + +func (x *HelloStreamRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type HelloStreamResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Greeting string `protobuf:"bytes,1,opt,name=greeting,proto3" json:"greeting,omitempty"` +} + +func (x *HelloStreamResponse) Reset() { + *x = HelloStreamResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_gnomobiletypes_proto_msgTypes[38] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HelloStreamResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HelloStreamResponse) ProtoMessage() {} + +func (x *HelloStreamResponse) ProtoReflect() protoreflect.Message { + mi := &file_gnomobiletypes_proto_msgTypes[38] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HelloStreamResponse.ProtoReflect.Descriptor instead. +func (*HelloStreamResponse) Descriptor() ([]byte, []int) { + return file_gnomobiletypes_proto_rawDescGZIP(), []int{38} +} + +func (x *HelloStreamResponse) GetGreeting() string { + if x != nil { + return x.Greeting + } + return "" +} + var File_gnomobiletypes_proto protoreflect.FileDescriptor var file_gnomobiletypes_proto_rawDesc = []byte{ @@ -2060,11 +2154,16 @@ var file_gnomobiletypes_proto_rawDesc = []byte{ 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x2b, 0x0a, 0x0d, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x67, 0x72, 0x65, 0x65, 0x74, 0x69, 0x6e, 0x67, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x67, 0x72, 0x65, 0x65, 0x74, 0x69, 0x6e, 0x67, 0x42, 0x2a, - 0x5a, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6e, 0x6f, - 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x67, 0x6e, 0x6f, 0x6d, 0x6f, 0x62, 0x69, 0x6c, 0x65, 0x2f, 0x73, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x67, 0x72, 0x65, 0x65, 0x74, 0x69, 0x6e, 0x67, 0x22, 0x28, + 0x0a, 0x12, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x31, 0x0a, 0x13, 0x48, 0x65, 0x6c, 0x6c, + 0x6f, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x1a, 0x0a, 0x08, 0x67, 0x72, 0x65, 0x65, 0x74, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x08, 0x67, 0x72, 0x65, 0x65, 0x74, 0x69, 0x6e, 0x67, 0x42, 0x2a, 0x5a, 0x28, 0x67, + 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6e, 0x6f, 0x6c, 0x61, 0x6e, + 0x67, 0x2f, 0x67, 0x6e, 0x6f, 0x6d, 0x6f, 0x62, 0x69, 0x6c, 0x65, 0x2f, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x2f, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -2079,7 +2178,7 @@ func file_gnomobiletypes_proto_rawDescGZIP() []byte { return file_gnomobiletypes_proto_rawDescData } -var file_gnomobiletypes_proto_msgTypes = make([]protoimpl.MessageInfo, 37) +var file_gnomobiletypes_proto_msgTypes = make([]protoimpl.MessageInfo, 39) var file_gnomobiletypes_proto_goTypes = []interface{}{ (*SetRemoteRequest)(nil), // 0: land.gno.gnomobile.v1.SetRemoteRequest (*SetRemoteResponse)(nil), // 1: land.gno.gnomobile.v1.SetRemoteResponse @@ -2118,6 +2217,8 @@ var file_gnomobiletypes_proto_goTypes = []interface{}{ (*AddressFromBech32Response)(nil), // 34: land.gno.gnomobile.v1.AddressFromBech32Response (*HelloRequest)(nil), // 35: land.gno.gnomobile.v1.HelloRequest (*HelloResponse)(nil), // 36: land.gno.gnomobile.v1.HelloResponse + (*HelloStreamRequest)(nil), // 37: land.gno.gnomobile.v1.HelloStreamRequest + (*HelloStreamResponse)(nil), // 38: land.gno.gnomobile.v1.HelloStreamResponse } var file_gnomobiletypes_proto_depIdxs = []int32{ 9, // 0: land.gno.gnomobile.v1.BaseAccount.coins:type_name -> land.gno.gnomobile.v1.Coin @@ -2583,6 +2684,30 @@ func file_gnomobiletypes_proto_init() { return nil } } + file_gnomobiletypes_proto_msgTypes[37].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HelloStreamRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_gnomobiletypes_proto_msgTypes[38].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HelloStreamResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -2590,7 +2715,7 @@ func file_gnomobiletypes_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_gnomobiletypes_proto_rawDesc, NumEnums: 0, - NumMessages: 37, + NumMessages: 39, NumExtensions: 0, NumServices: 0, }, diff --git a/service/rpc/gnomobiletypes.proto b/service/rpc/gnomobiletypes.proto index abc477fd..01ba770d 100644 --- a/service/rpc/gnomobiletypes.proto +++ b/service/rpc/gnomobiletypes.proto @@ -181,4 +181,12 @@ message HelloRequest { message HelloResponse { string greeting = 1; +} + +message HelloStreamRequest { + string name = 1; +} + +message HelloStreamResponse { + string greeting = 1; } \ No newline at end of file diff --git a/service/rpc/rpc.pb.go b/service/rpc/rpc.pb.go index 676045e0..0c8f2920 100644 --- a/service/rpc/rpc.pb.go +++ b/service/rpc/rpc.pb.go @@ -186,7 +186,7 @@ var file_rpc_proto_rawDesc = []byte{ 0x12, 0x17, 0x0a, 0x13, 0x45, 0x72, 0x72, 0x44, 0x65, 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x10, 0x6d, 0x12, 0x15, 0x0a, 0x11, 0x45, 0x72, 0x72, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x10, 0x6e, - 0x32, 0xd9, 0x0d, 0x0a, 0x10, 0x47, 0x6e, 0x6f, 0x6d, 0x6f, 0x62, 0x69, 0x6c, 0x65, 0x53, 0x65, + 0x32, 0xc1, 0x0e, 0x0a, 0x10, 0x47, 0x6e, 0x6f, 0x6d, 0x6f, 0x62, 0x69, 0x6c, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x5e, 0x0a, 0x09, 0x53, 0x65, 0x74, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x12, 0x27, 0x2e, 0x6c, 0x61, 0x6e, 0x64, 0x2e, 0x67, 0x6e, 0x6f, 0x2e, 0x67, 0x6e, 0x6f, 0x6d, 0x6f, 0x62, 0x69, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x74, 0x52, 0x65, @@ -295,11 +295,17 @@ var file_rpc_proto_rawDesc = []byte{ 0x6d, 0x6f, 0x62, 0x69, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x6c, 0x61, 0x6e, 0x64, 0x2e, 0x67, 0x6e, 0x6f, 0x2e, 0x67, 0x6e, 0x6f, 0x6d, 0x6f, 0x62, 0x69, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x48, - 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x30, 0x5a, 0x28, - 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6e, 0x6f, 0x6c, 0x61, - 0x6e, 0x67, 0x2f, 0x67, 0x6e, 0x6f, 0x6d, 0x6f, 0x62, 0x69, 0x6c, 0x65, 0x2f, 0x73, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x2f, 0x72, 0x70, 0x63, 0xa2, 0x02, 0x03, 0x52, 0x54, 0x47, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x66, 0x0a, 0x0b, + 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x29, 0x2e, 0x6c, 0x61, + 0x6e, 0x64, 0x2e, 0x67, 0x6e, 0x6f, 0x2e, 0x67, 0x6e, 0x6f, 0x6d, 0x6f, 0x62, 0x69, 0x6c, 0x65, + 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2a, 0x2e, 0x6c, 0x61, 0x6e, 0x64, 0x2e, 0x67, 0x6e, + 0x6f, 0x2e, 0x67, 0x6e, 0x6f, 0x6d, 0x6f, 0x62, 0x69, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x48, + 0x65, 0x6c, 0x6c, 0x6f, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x30, 0x01, 0x42, 0x30, 0x5a, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, + 0x6f, 0x6d, 0x2f, 0x67, 0x6e, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x67, 0x6e, 0x6f, 0x6d, 0x6f, + 0x62, 0x69, 0x6c, 0x65, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x72, 0x70, 0x63, + 0xa2, 0x02, 0x03, 0x52, 0x54, 0x47, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -336,23 +342,25 @@ var file_rpc_proto_goTypes = []interface{}{ (*AddressToBech32Request)(nil), // 16: land.gno.gnomobile.v1.AddressToBech32Request (*AddressFromBech32Request)(nil), // 17: land.gno.gnomobile.v1.AddressFromBech32Request (*HelloRequest)(nil), // 18: land.gno.gnomobile.v1.HelloRequest - (*SetRemoteResponse)(nil), // 19: land.gno.gnomobile.v1.SetRemoteResponse - (*SetChainIDResponse)(nil), // 20: land.gno.gnomobile.v1.SetChainIDResponse - (*GenerateRecoveryPhraseResponse)(nil), // 21: land.gno.gnomobile.v1.GenerateRecoveryPhraseResponse - (*ListKeyInfoResponse)(nil), // 22: land.gno.gnomobile.v1.ListKeyInfoResponse - (*CreateAccountResponse)(nil), // 23: land.gno.gnomobile.v1.CreateAccountResponse - (*SelectAccountResponse)(nil), // 24: land.gno.gnomobile.v1.SelectAccountResponse - (*SetPasswordResponse)(nil), // 25: land.gno.gnomobile.v1.SetPasswordResponse - (*GetActiveAccountResponse)(nil), // 26: land.gno.gnomobile.v1.GetActiveAccountResponse - (*QueryAccountResponse)(nil), // 27: land.gno.gnomobile.v1.QueryAccountResponse - (*DeleteAccountResponse)(nil), // 28: land.gno.gnomobile.v1.DeleteAccountResponse - (*QueryResponse)(nil), // 29: land.gno.gnomobile.v1.QueryResponse - (*RenderResponse)(nil), // 30: land.gno.gnomobile.v1.RenderResponse - (*QEvalResponse)(nil), // 31: land.gno.gnomobile.v1.QEvalResponse - (*CallResponse)(nil), // 32: land.gno.gnomobile.v1.CallResponse - (*AddressToBech32Response)(nil), // 33: land.gno.gnomobile.v1.AddressToBech32Response - (*AddressFromBech32Response)(nil), // 34: land.gno.gnomobile.v1.AddressFromBech32Response - (*HelloResponse)(nil), // 35: land.gno.gnomobile.v1.HelloResponse + (*HelloStreamRequest)(nil), // 19: land.gno.gnomobile.v1.HelloStreamRequest + (*SetRemoteResponse)(nil), // 20: land.gno.gnomobile.v1.SetRemoteResponse + (*SetChainIDResponse)(nil), // 21: land.gno.gnomobile.v1.SetChainIDResponse + (*GenerateRecoveryPhraseResponse)(nil), // 22: land.gno.gnomobile.v1.GenerateRecoveryPhraseResponse + (*ListKeyInfoResponse)(nil), // 23: land.gno.gnomobile.v1.ListKeyInfoResponse + (*CreateAccountResponse)(nil), // 24: land.gno.gnomobile.v1.CreateAccountResponse + (*SelectAccountResponse)(nil), // 25: land.gno.gnomobile.v1.SelectAccountResponse + (*SetPasswordResponse)(nil), // 26: land.gno.gnomobile.v1.SetPasswordResponse + (*GetActiveAccountResponse)(nil), // 27: land.gno.gnomobile.v1.GetActiveAccountResponse + (*QueryAccountResponse)(nil), // 28: land.gno.gnomobile.v1.QueryAccountResponse + (*DeleteAccountResponse)(nil), // 29: land.gno.gnomobile.v1.DeleteAccountResponse + (*QueryResponse)(nil), // 30: land.gno.gnomobile.v1.QueryResponse + (*RenderResponse)(nil), // 31: land.gno.gnomobile.v1.RenderResponse + (*QEvalResponse)(nil), // 32: land.gno.gnomobile.v1.QEvalResponse + (*CallResponse)(nil), // 33: land.gno.gnomobile.v1.CallResponse + (*AddressToBech32Response)(nil), // 34: land.gno.gnomobile.v1.AddressToBech32Response + (*AddressFromBech32Response)(nil), // 35: land.gno.gnomobile.v1.AddressFromBech32Response + (*HelloResponse)(nil), // 36: land.gno.gnomobile.v1.HelloResponse + (*HelloStreamResponse)(nil), // 37: land.gno.gnomobile.v1.HelloStreamResponse } var file_rpc_proto_depIdxs = []int32{ 0, // 0: land.gno.gnomobile.v1.ErrDetails.codes:type_name -> land.gno.gnomobile.v1.ErrCode @@ -373,25 +381,27 @@ var file_rpc_proto_depIdxs = []int32{ 16, // 15: land.gno.gnomobile.v1.GnomobileService.AddressToBech32:input_type -> land.gno.gnomobile.v1.AddressToBech32Request 17, // 16: land.gno.gnomobile.v1.GnomobileService.AddressFromBech32:input_type -> land.gno.gnomobile.v1.AddressFromBech32Request 18, // 17: land.gno.gnomobile.v1.GnomobileService.Hello:input_type -> land.gno.gnomobile.v1.HelloRequest - 19, // 18: land.gno.gnomobile.v1.GnomobileService.SetRemote:output_type -> land.gno.gnomobile.v1.SetRemoteResponse - 20, // 19: land.gno.gnomobile.v1.GnomobileService.SetChainID:output_type -> land.gno.gnomobile.v1.SetChainIDResponse - 21, // 20: land.gno.gnomobile.v1.GnomobileService.GenerateRecoveryPhrase:output_type -> land.gno.gnomobile.v1.GenerateRecoveryPhraseResponse - 22, // 21: land.gno.gnomobile.v1.GnomobileService.ListKeyInfo:output_type -> land.gno.gnomobile.v1.ListKeyInfoResponse - 23, // 22: land.gno.gnomobile.v1.GnomobileService.CreateAccount:output_type -> land.gno.gnomobile.v1.CreateAccountResponse - 24, // 23: land.gno.gnomobile.v1.GnomobileService.SelectAccount:output_type -> land.gno.gnomobile.v1.SelectAccountResponse - 25, // 24: land.gno.gnomobile.v1.GnomobileService.SetPassword:output_type -> land.gno.gnomobile.v1.SetPasswordResponse - 26, // 25: land.gno.gnomobile.v1.GnomobileService.GetActiveAccount:output_type -> land.gno.gnomobile.v1.GetActiveAccountResponse - 27, // 26: land.gno.gnomobile.v1.GnomobileService.QueryAccount:output_type -> land.gno.gnomobile.v1.QueryAccountResponse - 28, // 27: land.gno.gnomobile.v1.GnomobileService.DeleteAccount:output_type -> land.gno.gnomobile.v1.DeleteAccountResponse - 29, // 28: land.gno.gnomobile.v1.GnomobileService.Query:output_type -> land.gno.gnomobile.v1.QueryResponse - 30, // 29: land.gno.gnomobile.v1.GnomobileService.Render:output_type -> land.gno.gnomobile.v1.RenderResponse - 31, // 30: land.gno.gnomobile.v1.GnomobileService.QEval:output_type -> land.gno.gnomobile.v1.QEvalResponse - 32, // 31: land.gno.gnomobile.v1.GnomobileService.Call:output_type -> land.gno.gnomobile.v1.CallResponse - 33, // 32: land.gno.gnomobile.v1.GnomobileService.AddressToBech32:output_type -> land.gno.gnomobile.v1.AddressToBech32Response - 34, // 33: land.gno.gnomobile.v1.GnomobileService.AddressFromBech32:output_type -> land.gno.gnomobile.v1.AddressFromBech32Response - 35, // 34: land.gno.gnomobile.v1.GnomobileService.Hello:output_type -> land.gno.gnomobile.v1.HelloResponse - 18, // [18:35] is the sub-list for method output_type - 1, // [1:18] is the sub-list for method input_type + 19, // 18: land.gno.gnomobile.v1.GnomobileService.HelloStream:input_type -> land.gno.gnomobile.v1.HelloStreamRequest + 20, // 19: land.gno.gnomobile.v1.GnomobileService.SetRemote:output_type -> land.gno.gnomobile.v1.SetRemoteResponse + 21, // 20: land.gno.gnomobile.v1.GnomobileService.SetChainID:output_type -> land.gno.gnomobile.v1.SetChainIDResponse + 22, // 21: land.gno.gnomobile.v1.GnomobileService.GenerateRecoveryPhrase:output_type -> land.gno.gnomobile.v1.GenerateRecoveryPhraseResponse + 23, // 22: land.gno.gnomobile.v1.GnomobileService.ListKeyInfo:output_type -> land.gno.gnomobile.v1.ListKeyInfoResponse + 24, // 23: land.gno.gnomobile.v1.GnomobileService.CreateAccount:output_type -> land.gno.gnomobile.v1.CreateAccountResponse + 25, // 24: land.gno.gnomobile.v1.GnomobileService.SelectAccount:output_type -> land.gno.gnomobile.v1.SelectAccountResponse + 26, // 25: land.gno.gnomobile.v1.GnomobileService.SetPassword:output_type -> land.gno.gnomobile.v1.SetPasswordResponse + 27, // 26: land.gno.gnomobile.v1.GnomobileService.GetActiveAccount:output_type -> land.gno.gnomobile.v1.GetActiveAccountResponse + 28, // 27: land.gno.gnomobile.v1.GnomobileService.QueryAccount:output_type -> land.gno.gnomobile.v1.QueryAccountResponse + 29, // 28: land.gno.gnomobile.v1.GnomobileService.DeleteAccount:output_type -> land.gno.gnomobile.v1.DeleteAccountResponse + 30, // 29: land.gno.gnomobile.v1.GnomobileService.Query:output_type -> land.gno.gnomobile.v1.QueryResponse + 31, // 30: land.gno.gnomobile.v1.GnomobileService.Render:output_type -> land.gno.gnomobile.v1.RenderResponse + 32, // 31: land.gno.gnomobile.v1.GnomobileService.QEval:output_type -> land.gno.gnomobile.v1.QEvalResponse + 33, // 32: land.gno.gnomobile.v1.GnomobileService.Call:output_type -> land.gno.gnomobile.v1.CallResponse + 34, // 33: land.gno.gnomobile.v1.GnomobileService.AddressToBech32:output_type -> land.gno.gnomobile.v1.AddressToBech32Response + 35, // 34: land.gno.gnomobile.v1.GnomobileService.AddressFromBech32:output_type -> land.gno.gnomobile.v1.AddressFromBech32Response + 36, // 35: land.gno.gnomobile.v1.GnomobileService.Hello:output_type -> land.gno.gnomobile.v1.HelloResponse + 37, // 36: land.gno.gnomobile.v1.GnomobileService.HelloStream:output_type -> land.gno.gnomobile.v1.HelloStreamResponse + 19, // [19:37] is the sub-list for method output_type + 1, // [1:19] is the sub-list for method input_type 1, // [1:1] is the sub-list for extension type_name 1, // [1:1] is the sub-list for extension extendee 0, // [0:1] is the sub-list for field type_name diff --git a/service/rpc/rpc.proto b/service/rpc/rpc.proto index 277fa8bd..29beea7c 100644 --- a/service/rpc/rpc.proto +++ b/service/rpc/rpc.proto @@ -20,7 +20,8 @@ service GnomobileService { // Generate a recovery phrase of BIP39 mnemonic words using entropy from the // crypto library random number generator. This can be used as the mnemonic in // CreateAccount. - rpc GenerateRecoveryPhrase(GenerateRecoveryPhraseRequest) returns (GenerateRecoveryPhraseResponse); + rpc GenerateRecoveryPhrase(GenerateRecoveryPhraseRequest) + returns (GenerateRecoveryPhraseResponse); // Get the keys informations in the keybase rpc ListKeyInfo(ListKeyInfoRequest) returns (ListKeyInfoResponse); @@ -39,28 +40,32 @@ service GnomobileService { // If there is no active account, then return ErrNoActiveAccount. // (To check if there is an active account, use ListKeyInfo and check the // length of the result.) - rpc GetActiveAccount(GetActiveAccountRequest) returns (GetActiveAccountResponse); + rpc GetActiveAccount(GetActiveAccountRequest) + returns (GetActiveAccountResponse); - // QueryAccount retrieves account information from the blockchain for a given address. + // QueryAccount retrieves account information from the blockchain for a given + // address. rpc QueryAccount(QueryAccountRequest) returns (QueryAccountResponse); - // DeleteAccount deletes the account with the given name, using the password to - // ensure access. However, if skip_password is true, then ignore the password. - // If the account doesn't exist, then return ErrCryptoKeyNotFound. + // DeleteAccount deletes the account with the given name, using the password + // to ensure access. However, if skip_password is true, then ignore the + // password. If the account doesn't exist, then return ErrCryptoKeyNotFound. // If the password is wrong, then return ErrDecryptionFailed. rpc DeleteAccount(DeleteAccountRequest) returns (DeleteAccountResponse); // Make an ABCI query to the remote node. rpc Query(QueryRequest) returns (QueryResponse); - // Render calls the Render function for package_path with optional args. The package path - // should include the prefix like "gno.land/". This is similar to using a browser URL - // /: where doesn't have the prefix like "gno.land/". + // Render calls the Render function for package_path with optional args. The + // package path should include the prefix like "gno.land/". This is similar to + // using a browser URL /: where doesn't have + // the prefix like "gno.land/". rpc Render(RenderRequest) returns (RenderResponse); - // QEval evaluates the given expression with the realm code at package_path. The package path - // should include the prefix like "gno.land/". The expression is usually a function call like - // "GetBoardIDFromName(\"testboard\")". The return value is a typed expression like + // QEval evaluates the given expression with the realm code at package_path. + // The package path should include the prefix like "gno.land/". The expression + // is usually a function call like "GetBoardIDFromName(\"testboard\")". The + // return value is a typed expression like // "(1 gno.land/r/demo/boards.BoardID)\n(true bool)". rpc QEval(QEvalRequest) returns (QEvalResponse); @@ -71,10 +76,13 @@ service GnomobileService { rpc AddressToBech32(AddressToBech32Request) returns (AddressToBech32Response); // Convert a bech32 string address to a byte array address. - rpc AddressFromBech32(AddressFromBech32Request) returns (AddressFromBech32Response); + rpc AddressFromBech32(AddressFromBech32Request) + returns (AddressFromBech32Response); // Hello is for debug purposes rpc Hello(HelloRequest) returns (HelloResponse); + // HelloStream is for debug purposes + rpc HelloStream(HelloStreamRequest) returns (stream HelloStreamResponse); } // The ErrCode enum defines errors for gRPC API functions. These are converted @@ -86,7 +94,7 @@ enum ErrCode { Undefined = 0; // default value, should never be set manually - TODO = 1; // indicates that you plan to create an error later + TODO = 1; // indicates that you plan to create an error later ErrNotImplemented = 2; // indicates that a method is not implemented yet ErrInternal = 3; // indicates an unknown error (without Code), i.e. in gRPC @@ -106,9 +114,8 @@ enum ErrCode { ErrNoActiveAccount = 107; ErrRunGRPCServer = 108; ErrDecryptionFailed = 109; - ErrUnknownAddress = 110; // indicates that the address is unknown on the blockchain + ErrUnknownAddress = + 110; // indicates that the address is unknown on the blockchain } -message ErrDetails { - repeated ErrCode codes = 1; -} +message ErrDetails { repeated ErrCode codes = 1; } diff --git a/service/rpc/rpcconnect/rpc.connect.go b/service/rpc/rpcconnect/rpc.connect.go index e83bcae1..010c93c5 100644 --- a/service/rpc/rpcconnect/rpc.connect.go +++ b/service/rpc/rpcconnect/rpc.connect.go @@ -79,6 +79,9 @@ const ( GnomobileServiceAddressFromBech32Procedure = "/land.gno.gnomobile.v1.GnomobileService/AddressFromBech32" // GnomobileServiceHelloProcedure is the fully-qualified name of the GnomobileService's Hello RPC. GnomobileServiceHelloProcedure = "/land.gno.gnomobile.v1.GnomobileService/Hello" + // GnomobileServiceHelloStreamProcedure is the fully-qualified name of the GnomobileService's + // HelloStream RPC. + GnomobileServiceHelloStreamProcedure = "/land.gno.gnomobile.v1.GnomobileService/HelloStream" ) // GnomobileServiceClient is a client for the land.gno.gnomobile.v1.GnomobileService service. @@ -107,22 +110,25 @@ type GnomobileServiceClient interface { // (To check if there is an active account, use ListKeyInfo and check the // length of the result.) GetActiveAccount(context.Context, *connect.Request[rpc.GetActiveAccountRequest]) (*connect.Response[rpc.GetActiveAccountResponse], error) - // QueryAccount retrieves account information from the blockchain for a given address. + // QueryAccount retrieves account information from the blockchain for a given + // address. QueryAccount(context.Context, *connect.Request[rpc.QueryAccountRequest]) (*connect.Response[rpc.QueryAccountResponse], error) - // DeleteAccount deletes the account with the given name, using the password to - // ensure access. However, if skip_password is true, then ignore the password. - // If the account doesn't exist, then return ErrCryptoKeyNotFound. + // DeleteAccount deletes the account with the given name, using the password + // to ensure access. However, if skip_password is true, then ignore the + // password. If the account doesn't exist, then return ErrCryptoKeyNotFound. // If the password is wrong, then return ErrDecryptionFailed. DeleteAccount(context.Context, *connect.Request[rpc.DeleteAccountRequest]) (*connect.Response[rpc.DeleteAccountResponse], error) // Make an ABCI query to the remote node. Query(context.Context, *connect.Request[rpc.QueryRequest]) (*connect.Response[rpc.QueryResponse], error) - // Render calls the Render function for package_path with optional args. The package path - // should include the prefix like "gno.land/". This is similar to using a browser URL - // /: where doesn't have the prefix like "gno.land/". + // Render calls the Render function for package_path with optional args. The + // package path should include the prefix like "gno.land/". This is similar to + // using a browser URL /: where doesn't have + // the prefix like "gno.land/". Render(context.Context, *connect.Request[rpc.RenderRequest]) (*connect.Response[rpc.RenderResponse], error) - // QEval evaluates the given expression with the realm code at package_path. The package path - // should include the prefix like "gno.land/". The expression is usually a function call like - // "GetBoardIDFromName(\"testboard\")". The return value is a typed expression like + // QEval evaluates the given expression with the realm code at package_path. + // The package path should include the prefix like "gno.land/". The expression + // is usually a function call like "GetBoardIDFromName(\"testboard\")". The + // return value is a typed expression like // "(1 gno.land/r/demo/boards.BoardID)\n(true bool)". QEval(context.Context, *connect.Request[rpc.QEvalRequest]) (*connect.Response[rpc.QEvalResponse], error) // Call a specific realm function. @@ -133,6 +139,8 @@ type GnomobileServiceClient interface { AddressFromBech32(context.Context, *connect.Request[rpc.AddressFromBech32Request]) (*connect.Response[rpc.AddressFromBech32Response], error) // Hello is for debug purposes Hello(context.Context, *connect.Request[rpc.HelloRequest]) (*connect.Response[rpc.HelloResponse], error) + // HelloStream is for debug purposes + HelloStream(context.Context, *connect.Request[rpc.HelloStreamRequest]) (*connect.ServerStreamForClient[rpc.HelloStreamResponse], error) } // NewGnomobileServiceClient constructs a client for the land.gno.gnomobile.v1.GnomobileService @@ -230,6 +238,11 @@ func NewGnomobileServiceClient(httpClient connect.HTTPClient, baseURL string, op baseURL+GnomobileServiceHelloProcedure, opts..., ), + helloStream: connect.NewClient[rpc.HelloStreamRequest, rpc.HelloStreamResponse]( + httpClient, + baseURL+GnomobileServiceHelloStreamProcedure, + opts..., + ), } } @@ -252,6 +265,7 @@ type gnomobileServiceClient struct { addressToBech32 *connect.Client[rpc.AddressToBech32Request, rpc.AddressToBech32Response] addressFromBech32 *connect.Client[rpc.AddressFromBech32Request, rpc.AddressFromBech32Response] hello *connect.Client[rpc.HelloRequest, rpc.HelloResponse] + helloStream *connect.Client[rpc.HelloStreamRequest, rpc.HelloStreamResponse] } // SetRemote calls land.gno.gnomobile.v1.GnomobileService.SetRemote. @@ -339,6 +353,11 @@ func (c *gnomobileServiceClient) Hello(ctx context.Context, req *connect.Request return c.hello.CallUnary(ctx, req) } +// HelloStream calls land.gno.gnomobile.v1.GnomobileService.HelloStream. +func (c *gnomobileServiceClient) HelloStream(ctx context.Context, req *connect.Request[rpc.HelloStreamRequest]) (*connect.ServerStreamForClient[rpc.HelloStreamResponse], error) { + return c.helloStream.CallServerStream(ctx, req) +} + // GnomobileServiceHandler is an implementation of the land.gno.gnomobile.v1.GnomobileService // service. type GnomobileServiceHandler interface { @@ -366,22 +385,25 @@ type GnomobileServiceHandler interface { // (To check if there is an active account, use ListKeyInfo and check the // length of the result.) GetActiveAccount(context.Context, *connect.Request[rpc.GetActiveAccountRequest]) (*connect.Response[rpc.GetActiveAccountResponse], error) - // QueryAccount retrieves account information from the blockchain for a given address. + // QueryAccount retrieves account information from the blockchain for a given + // address. QueryAccount(context.Context, *connect.Request[rpc.QueryAccountRequest]) (*connect.Response[rpc.QueryAccountResponse], error) - // DeleteAccount deletes the account with the given name, using the password to - // ensure access. However, if skip_password is true, then ignore the password. - // If the account doesn't exist, then return ErrCryptoKeyNotFound. + // DeleteAccount deletes the account with the given name, using the password + // to ensure access. However, if skip_password is true, then ignore the + // password. If the account doesn't exist, then return ErrCryptoKeyNotFound. // If the password is wrong, then return ErrDecryptionFailed. DeleteAccount(context.Context, *connect.Request[rpc.DeleteAccountRequest]) (*connect.Response[rpc.DeleteAccountResponse], error) // Make an ABCI query to the remote node. Query(context.Context, *connect.Request[rpc.QueryRequest]) (*connect.Response[rpc.QueryResponse], error) - // Render calls the Render function for package_path with optional args. The package path - // should include the prefix like "gno.land/". This is similar to using a browser URL - // /: where doesn't have the prefix like "gno.land/". + // Render calls the Render function for package_path with optional args. The + // package path should include the prefix like "gno.land/". This is similar to + // using a browser URL /: where doesn't have + // the prefix like "gno.land/". Render(context.Context, *connect.Request[rpc.RenderRequest]) (*connect.Response[rpc.RenderResponse], error) - // QEval evaluates the given expression with the realm code at package_path. The package path - // should include the prefix like "gno.land/". The expression is usually a function call like - // "GetBoardIDFromName(\"testboard\")". The return value is a typed expression like + // QEval evaluates the given expression with the realm code at package_path. + // The package path should include the prefix like "gno.land/". The expression + // is usually a function call like "GetBoardIDFromName(\"testboard\")". The + // return value is a typed expression like // "(1 gno.land/r/demo/boards.BoardID)\n(true bool)". QEval(context.Context, *connect.Request[rpc.QEvalRequest]) (*connect.Response[rpc.QEvalResponse], error) // Call a specific realm function. @@ -392,6 +414,8 @@ type GnomobileServiceHandler interface { AddressFromBech32(context.Context, *connect.Request[rpc.AddressFromBech32Request]) (*connect.Response[rpc.AddressFromBech32Response], error) // Hello is for debug purposes Hello(context.Context, *connect.Request[rpc.HelloRequest]) (*connect.Response[rpc.HelloResponse], error) + // HelloStream is for debug purposes + HelloStream(context.Context, *connect.Request[rpc.HelloStreamRequest], *connect.ServerStream[rpc.HelloStreamResponse]) error } // NewGnomobileServiceHandler builds an HTTP handler from the service implementation. It returns the @@ -485,6 +509,11 @@ func NewGnomobileServiceHandler(svc GnomobileServiceHandler, opts ...connect.Han svc.Hello, opts..., ) + gnomobileServiceHelloStreamHandler := connect.NewServerStreamHandler( + GnomobileServiceHelloStreamProcedure, + svc.HelloStream, + opts..., + ) return "/land.gno.gnomobile.v1.GnomobileService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { switch r.URL.Path { case GnomobileServiceSetRemoteProcedure: @@ -521,6 +550,8 @@ func NewGnomobileServiceHandler(svc GnomobileServiceHandler, opts ...connect.Han gnomobileServiceAddressFromBech32Handler.ServeHTTP(w, r) case GnomobileServiceHelloProcedure: gnomobileServiceHelloHandler.ServeHTTP(w, r) + case GnomobileServiceHelloStreamProcedure: + gnomobileServiceHelloStreamHandler.ServeHTTP(w, r) default: http.NotFound(w, r) } @@ -597,3 +628,7 @@ func (UnimplementedGnomobileServiceHandler) AddressFromBech32(context.Context, * func (UnimplementedGnomobileServiceHandler) Hello(context.Context, *connect.Request[rpc.HelloRequest]) (*connect.Response[rpc.HelloResponse], error) { return nil, connect.NewError(connect.CodeUnimplemented, errors.New("land.gno.gnomobile.v1.GnomobileService.Hello is not implemented")) } + +func (UnimplementedGnomobileServiceHandler) HelloStream(context.Context, *connect.Request[rpc.HelloStreamRequest], *connect.ServerStream[rpc.HelloStreamResponse]) error { + return connect.NewError(connect.CodeUnimplemented, errors.New("land.gno.gnomobile.v1.GnomobileService.HelloStream is not implemented")) +}