@gnolang/gnonative 4.0.0 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/Makefile +20 -3
  2. package/android/libs/gnocore-sources.jar +0 -0
  3. package/android/libs/gnocore.aar +0 -0
  4. package/android/src/main/java/land/gno/gnonative/GnonativeModule.kt +0 -13
  5. package/build/GoBridge.d.ts +0 -1
  6. package/build/GoBridge.d.ts.map +1 -1
  7. package/build/GoBridge.js +0 -3
  8. package/build/GoBridge.js.map +1 -1
  9. package/build/api/GnoNativeApi.d.ts +3 -3
  10. package/build/api/GnoNativeApi.d.ts.map +1 -1
  11. package/build/api/GnoNativeApi.js +15 -10
  12. package/build/api/GnoNativeApi.js.map +1 -1
  13. package/build/api/types.d.ts +2 -2
  14. package/build/api/types.d.ts.map +1 -1
  15. package/build/api/types.js.map +1 -1
  16. package/build/api/vendor/gnonativetypes_pb.d.ts +1513 -0
  17. package/build/api/vendor/gnonativetypes_pb.d.ts.map +1 -0
  18. package/build/api/vendor/gnonativetypes_pb.js +2506 -0
  19. package/build/api/vendor/gnonativetypes_pb.js.map +1 -0
  20. package/build/api/vendor/rpc_connect.d.ts +461 -0
  21. package/build/api/vendor/rpc_connect.d.ts.map +1 -0
  22. package/build/api/vendor/rpc_connect.js +465 -0
  23. package/build/api/vendor/rpc_connect.js.map +1 -0
  24. package/build/api/vendor/rpc_pb.d.ts +221 -0
  25. package/build/api/vendor/rpc_pb.d.ts.map +1 -0
  26. package/build/api/vendor/rpc_pb.js +277 -0
  27. package/build/api/vendor/rpc_pb.js.map +1 -0
  28. package/build/grpc/client.d.ts +1 -1
  29. package/build/grpc/client.d.ts.map +1 -1
  30. package/build/grpc/client.js +1 -1
  31. package/build/grpc/client.js.map +1 -1
  32. package/build/grpc/error.d.ts +1 -1
  33. package/build/grpc/error.d.ts.map +1 -1
  34. package/build/grpc/error.js +1 -1
  35. package/build/grpc/error.js.map +1 -1
  36. package/build/index.d.ts +2 -2
  37. package/build/index.d.ts.map +1 -1
  38. package/build/index.js +2 -2
  39. package/build/index.js.map +1 -1
  40. package/ios/Frameworks/GnoCore.xcframework/Info.plist +5 -5
  41. package/ios/Frameworks/GnoCore.xcframework/ios-arm64/GnoCore.framework/GnoCore +0 -0
  42. package/ios/Frameworks/GnoCore.xcframework/ios-arm64/GnoCore.framework/Headers/GnoGnonative.objc.h +0 -7
  43. package/ios/Frameworks/GnoCore.xcframework/ios-arm64/GnoCore.framework/Versions/A/GnoCore +0 -0
  44. package/ios/Frameworks/GnoCore.xcframework/ios-arm64/GnoCore.framework/Versions/A/Headers/GnoGnonative.objc.h +0 -7
  45. package/ios/Frameworks/GnoCore.xcframework/ios-arm64/GnoCore.framework/Versions/Current/GnoCore +0 -0
  46. package/ios/Frameworks/GnoCore.xcframework/ios-arm64/GnoCore.framework/Versions/Current/Headers/GnoGnonative.objc.h +0 -7
  47. package/ios/Frameworks/GnoCore.xcframework/ios-arm64_x86_64-simulator/GnoCore.framework/GnoCore +0 -0
  48. package/ios/Frameworks/GnoCore.xcframework/ios-arm64_x86_64-simulator/GnoCore.framework/Headers/GnoGnonative.objc.h +0 -7
  49. package/ios/GnonativeModule.swift +0 -12
  50. package/package.json +1 -3
  51. package/src/GoBridge.ts +0 -5
  52. package/src/api/GnoNativeApi.ts +31 -14
  53. package/src/api/types.ts +10 -3
  54. package/src/api/vendor/gnonativetypes_pb.ts +3074 -0
  55. package/src/api/vendor/rpc_connect.ts +467 -0
  56. package/src/api/vendor/rpc_pb.ts +321 -0
  57. package/src/grpc/client.ts +1 -1
  58. package/src/grpc/error.ts +2 -1
  59. package/src/index.ts +2 -2
  60. package/tsconfig.json +0 -1
@@ -8,32 +8,32 @@
8
8
  <key>BinaryPath</key>
9
9
  <string>GnoCore.framework/Versions/A/GnoCore</string>
10
10
  <key>LibraryIdentifier</key>
11
- <string>ios-arm64_x86_64-simulator</string>
11
+ <string>ios-arm64</string>
12
12
  <key>LibraryPath</key>
13
13
  <string>GnoCore.framework</string>
14
14
  <key>SupportedArchitectures</key>
15
15
  <array>
16
16
  <string>arm64</string>
17
- <string>x86_64</string>
18
17
  </array>
19
18
  <key>SupportedPlatform</key>
20
19
  <string>ios</string>
21
- <key>SupportedPlatformVariant</key>
22
- <string>simulator</string>
23
20
  </dict>
24
21
  <dict>
25
22
  <key>BinaryPath</key>
26
23
  <string>GnoCore.framework/Versions/A/GnoCore</string>
27
24
  <key>LibraryIdentifier</key>
28
- <string>ios-arm64</string>
25
+ <string>ios-arm64_x86_64-simulator</string>
29
26
  <key>LibraryPath</key>
30
27
  <string>GnoCore.framework</string>
31
28
  <key>SupportedArchitectures</key>
32
29
  <array>
33
30
  <string>arm64</string>
31
+ <string>x86_64</string>
34
32
  </array>
35
33
  <key>SupportedPlatform</key>
36
34
  <string>ios</string>
35
+ <key>SupportedPlatformVariant</key>
36
+ <string>simulator</string>
37
37
  </dict>
38
38
  </array>
39
39
  <key>CFBundlePackageType</key>
@@ -44,12 +44,6 @@
44
44
  - (long)getTcpPort;
45
45
  - (NSString* _Nonnull)getUDSPath;
46
46
  - (void)invokeGrpcMethodWithPromiseBlock:(id<GnoGnonativePromiseBlock> _Nullable)promise method:(NSString* _Nullable)method jsonMessage:(NSString* _Nullable)jsonMessage;
47
- /**
48
- * Start the Gnokey Mobile service and save it in gnokeyMobileService. This will be closed in Close().
49
- If the gnonative serviceServer is not started, do nothing.
50
- If gnokeyMobileService is already started, do nothing.
51
- */
52
- - (BOOL)startGnokeyMobileService:(NSError* _Nullable* _Nullable)error;
53
47
  - (void)streamClientReceiveWithPromiseBlock:(id<GnoGnonativePromiseBlock> _Nullable)promise id_:(NSString* _Nullable)id_;
54
48
  @end
55
49
 
@@ -63,7 +57,6 @@ If gnokeyMobileService is already started, do nothing.
63
57
  @property (nonatomic) NSString* _Nonnull tmpDir;
64
58
  @property (nonatomic) BOOL useTcpListener;
65
59
  @property (nonatomic) BOOL disableUdsListener;
66
- @property (nonatomic) BOOL useGnokeyMobile;
67
60
  @end
68
61
 
69
62
  FOUNDATION_EXPORT GnoGnonativeBridge* _Nullable GnoGnonativeNewBridge(GnoGnonativeBridgeConfig* _Nullable config, NSError* _Nullable* _Nullable error);
@@ -44,12 +44,6 @@
44
44
  - (long)getTcpPort;
45
45
  - (NSString* _Nonnull)getUDSPath;
46
46
  - (void)invokeGrpcMethodWithPromiseBlock:(id<GnoGnonativePromiseBlock> _Nullable)promise method:(NSString* _Nullable)method jsonMessage:(NSString* _Nullable)jsonMessage;
47
- /**
48
- * Start the Gnokey Mobile service and save it in gnokeyMobileService. This will be closed in Close().
49
- If the gnonative serviceServer is not started, do nothing.
50
- If gnokeyMobileService is already started, do nothing.
51
- */
52
- - (BOOL)startGnokeyMobileService:(NSError* _Nullable* _Nullable)error;
53
47
  - (void)streamClientReceiveWithPromiseBlock:(id<GnoGnonativePromiseBlock> _Nullable)promise id_:(NSString* _Nullable)id_;
54
48
  @end
55
49
 
@@ -63,7 +57,6 @@ If gnokeyMobileService is already started, do nothing.
63
57
  @property (nonatomic) NSString* _Nonnull tmpDir;
64
58
  @property (nonatomic) BOOL useTcpListener;
65
59
  @property (nonatomic) BOOL disableUdsListener;
66
- @property (nonatomic) BOOL useGnokeyMobile;
67
60
  @end
68
61
 
69
62
  FOUNDATION_EXPORT GnoGnonativeBridge* _Nullable GnoGnonativeNewBridge(GnoGnonativeBridgeConfig* _Nullable config, NSError* _Nullable* _Nullable error);
@@ -44,12 +44,6 @@
44
44
  - (long)getTcpPort;
45
45
  - (NSString* _Nonnull)getUDSPath;
46
46
  - (void)invokeGrpcMethodWithPromiseBlock:(id<GnoGnonativePromiseBlock> _Nullable)promise method:(NSString* _Nullable)method jsonMessage:(NSString* _Nullable)jsonMessage;
47
- /**
48
- * Start the Gnokey Mobile service and save it in gnokeyMobileService. This will be closed in Close().
49
- If the gnonative serviceServer is not started, do nothing.
50
- If gnokeyMobileService is already started, do nothing.
51
- */
52
- - (BOOL)startGnokeyMobileService:(NSError* _Nullable* _Nullable)error;
53
47
  - (void)streamClientReceiveWithPromiseBlock:(id<GnoGnonativePromiseBlock> _Nullable)promise id_:(NSString* _Nullable)id_;
54
48
  @end
55
49
 
@@ -63,7 +57,6 @@ If gnokeyMobileService is already started, do nothing.
63
57
  @property (nonatomic) NSString* _Nonnull tmpDir;
64
58
  @property (nonatomic) BOOL useTcpListener;
65
59
  @property (nonatomic) BOOL disableUdsListener;
66
- @property (nonatomic) BOOL useGnokeyMobile;
67
60
  @end
68
61
 
69
62
  FOUNDATION_EXPORT GnoGnonativeBridge* _Nullable GnoGnonativeNewBridge(GnoGnonativeBridgeConfig* _Nullable config, NSError* _Nullable* _Nullable error);
@@ -44,12 +44,6 @@
44
44
  - (long)getTcpPort;
45
45
  - (NSString* _Nonnull)getUDSPath;
46
46
  - (void)invokeGrpcMethodWithPromiseBlock:(id<GnoGnonativePromiseBlock> _Nullable)promise method:(NSString* _Nullable)method jsonMessage:(NSString* _Nullable)jsonMessage;
47
- /**
48
- * Start the Gnokey Mobile service and save it in gnokeyMobileService. This will be closed in Close().
49
- If the gnonative serviceServer is not started, do nothing.
50
- If gnokeyMobileService is already started, do nothing.
51
- */
52
- - (BOOL)startGnokeyMobileService:(NSError* _Nullable* _Nullable)error;
53
47
  - (void)streamClientReceiveWithPromiseBlock:(id<GnoGnonativePromiseBlock> _Nullable)promise id_:(NSString* _Nullable)id_;
54
48
  @end
55
49
 
@@ -63,7 +57,6 @@ If gnokeyMobileService is already started, do nothing.
63
57
  @property (nonatomic) NSString* _Nonnull tmpDir;
64
58
  @property (nonatomic) BOOL useTcpListener;
65
59
  @property (nonatomic) BOOL disableUdsListener;
66
- @property (nonatomic) BOOL useGnokeyMobile;
67
60
  @end
68
61
 
69
62
  FOUNDATION_EXPORT GnoGnonativeBridge* _Nullable GnoGnonativeNewBridge(GnoGnonativeBridgeConfig* _Nullable config, NSError* _Nullable* _Nullable error);
@@ -92,18 +92,6 @@ public class GnonativeModule: Module {
92
92
  }
93
93
  }
94
94
 
95
- AsyncFunction("startGnokeyMobileService") { (promise: Promise) in
96
- do {
97
- guard let service = self.bridge else {
98
- throw GnoError(.notStarted)
99
- }
100
- try service.startGnokeyMobileService()
101
- promise.resolve(true)
102
- } catch let error {
103
- promise.reject(error)
104
- }
105
- }
106
-
107
95
  AsyncFunction("closeBridge") { (promise: Promise) in
108
96
  do {
109
97
  guard let service = self.bridge else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gnolang/gnonative",
3
- "version": "4.0.0",
3
+ "version": "4.1.0",
4
4
  "description": "Develop for Gno using your app's native language ",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -29,8 +29,6 @@
29
29
  "license": "MIT",
30
30
  "homepage": "https://github.com/gnolang/gnonative#readme",
31
31
  "dependencies": {
32
- "@buf/gnolang_gnonative.bufbuild_es": "^1.8.0-20241030100906-5ceb62413f58.3",
33
- "@buf/gnolang_gnonative.connectrpc_es": "^1.4.0-20241030100906-5ceb62413f58.3",
34
32
  "@bufbuild/protobuf": "^1.8.0",
35
33
  "@connectrpc/connect": "^1.4.0",
36
34
  "@connectrpc/connect-web": "^1.4.0",
package/src/GoBridge.ts CHANGED
@@ -4,7 +4,6 @@ export interface GoBridgeInterface {
4
4
  initBridge(): Promise<void>;
5
5
  closeBridge(): Promise<void>;
6
6
  getTcpPort(): Promise<number>;
7
- startGnokeyMobileService(): Promise<void>;
8
7
  invokeGrpcMethod(method: string, jsonMessage: string): Promise<string>;
9
8
  createStreamClient(method: string, jsonMessage: string): Promise<string>;
10
9
  streamClientReceive(id: string): Promise<string>;
@@ -24,10 +23,6 @@ class GoBridge implements GoBridgeInterface {
24
23
  return GnonativeModule.getTcpPort();
25
24
  }
26
25
 
27
- startGnokeyMobileService(): Promise<void> {
28
- return GnonativeModule.startGnokeyMobileService();
29
- }
30
-
31
26
  invokeGrpcMethod(method: string, jsonMessage: string): Promise<string> {
32
27
  return GnonativeModule.invokeGrpcMethod(method, jsonMessage);
33
28
  }
@@ -1,3 +1,6 @@
1
+ import { PromiseClient } from '@connectrpc/connect';
2
+
3
+ import { GnoKeyApi, BridgeStatus, Config } from './types';
1
4
  import {
2
5
  AddressFromBech32Request,
3
6
  AddressToBech32Request,
@@ -46,11 +49,10 @@ import {
46
49
  SignTxResponse,
47
50
  RotatePasswordRequest,
48
51
  RotatePasswordResponse,
49
- } from '@buf/gnolang_gnonative.bufbuild_es/gnonativetypes_pb';
50
- import { GnoNativeService } from '@buf/gnolang_gnonative.connectrpc_es/rpc_connect';
51
- import { PromiseClient } from '@connectrpc/connect';
52
-
53
- import { GnoKeyApi, BridgeStatus, Config } from './types';
52
+ EstimateGasRequest,
53
+ EstimateGasResponse,
54
+ } from './vendor/gnonativetypes_pb';
55
+ import { GnoNativeService } from './vendor/rpc_connect';
54
56
  import { GoBridge, GoBridgeInterface } from '../GoBridge';
55
57
  import * as Grpc from '../grpc/client';
56
58
 
@@ -81,15 +83,11 @@ export class GnoNativeApi implements GnoKeyApi, GoBridgeInterface {
81
83
  console.log('GoBridge GRPC client instance. Done.');
82
84
 
83
85
  try {
84
- await this.clientInstance.setRemote(new SetRemoteRequest({ remote: this.config.remote }));
85
- await this.clientInstance.setChainID(
86
+ await this.clientInstance?.setRemote(new SetRemoteRequest({ remote: this.config.remote }));
87
+ await this.clientInstance?.setChainID(
86
88
  new SetChainIDRequest({ chainId: this.config.chain_id }),
87
89
  );
88
90
  console.log('✅ GnoNative bridge initialized.');
89
- if (this.config.start_gnokey_mobile_service) {
90
- await this.startGnokeyMobileService();
91
- console.log('✅ Gnokey Mobile service started.');
92
- }
93
91
  return true;
94
92
  } catch (error) {
95
93
  console.error(error);
@@ -138,6 +136,28 @@ export class GnoNativeApi implements GnoKeyApi, GoBridgeInterface {
138
136
  return response;
139
137
  }
140
138
 
139
+ async estimateGas(
140
+ txJson: string,
141
+ address: Uint8Array,
142
+ securityMargin: number,
143
+ updateTx: boolean,
144
+ accountNumber: bigint = BigInt(0),
145
+ sequenceNumber: bigint = BigInt(0),
146
+ ): Promise<EstimateGasResponse> {
147
+ const client = this.#getClient();
148
+ const response = client.estimateGas(
149
+ new EstimateGasRequest({
150
+ txJson,
151
+ address,
152
+ securityMargin,
153
+ updateTx,
154
+ accountNumber,
155
+ sequenceNumber,
156
+ }),
157
+ );
158
+ return response;
159
+ }
160
+
141
161
  async setChainID(chainId: string): Promise<SetChainIDResponse> {
142
162
  const client = this.#getClient();
143
163
  const response = client.setChainID(new SetChainIDRequest({ chainId }));
@@ -472,9 +492,6 @@ export class GnoNativeApi implements GnoKeyApi, GoBridgeInterface {
472
492
  getTcpPort(): Promise<number> {
473
493
  return GoBridge.getTcpPort();
474
494
  }
475
- startGnokeyMobileService(): Promise<void> {
476
- return GoBridge.startGnokeyMobileService();
477
- }
478
495
  invokeGrpcMethod(method: string, jsonMessage: string): Promise<string> {
479
496
  return GoBridge.invokeGrpcMethod(method, jsonMessage);
480
497
  }
package/src/api/types.ts CHANGED
@@ -13,10 +13,11 @@ import {
13
13
  RotatePasswordResponse,
14
14
  KeyInfo,
15
15
  SignTxResponse,
16
+ EstimateGasResponse,
16
17
  MakeTxResponse,
17
18
  BroadcastTxCommitResponse,
18
19
  Coin,
19
- } from '@buf/gnolang_gnonative.bufbuild_es/gnonativetypes_pb';
20
+ } from './vendor/gnonativetypes_pb';
20
21
 
21
22
  export enum BridgeStatus {
22
23
  Stopped,
@@ -27,8 +28,6 @@ export enum BridgeStatus {
27
28
  export interface Config {
28
29
  remote: string;
29
30
  chain_id: string;
30
- // If true, initBridge also starts a Gnokey Mobile service. (Only needed for the Gnokey Mobile app.)
31
- start_gnokey_mobile_service?: boolean;
32
31
  }
33
32
 
34
33
  export interface GnoKeyApi {
@@ -89,6 +88,14 @@ export interface GnoKeyApi {
89
88
  accountNumber?: bigint,
90
89
  sequenceNumber?: bigint,
91
90
  ): Promise<SignTxResponse>;
91
+ estimateGas(
92
+ txJson: string,
93
+ address: Uint8Array,
94
+ securityMargin: number,
95
+ updateTx: boolean,
96
+ accountNumber?: bigint,
97
+ sequenceNumber?: bigint,
98
+ ): Promise<EstimateGasResponse>;
92
99
  makeCallTx(
93
100
  packagePath: string,
94
101
  fnc: string,