@gnolang/gnonative 3.0.5 → 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.
- package/Makefile +20 -3
- package/android/libs/gnocore-sources.jar +0 -0
- package/android/libs/gnocore.aar +0 -0
- package/android/src/main/java/land/gno/gnonative/GnonativeModule.kt +0 -13
- package/build/GoBridge.d.ts +0 -1
- package/build/GoBridge.d.ts.map +1 -1
- package/build/GoBridge.js +0 -3
- package/build/GoBridge.js.map +1 -1
- package/build/api/GnoNativeApi.d.ts +5 -5
- package/build/api/GnoNativeApi.d.ts.map +1 -1
- package/build/api/GnoNativeApi.js +15 -10
- package/build/api/GnoNativeApi.js.map +1 -1
- package/build/api/types.d.ts +4 -4
- package/build/api/types.d.ts.map +1 -1
- package/build/api/types.js.map +1 -1
- package/build/api/vendor/gnonativetypes_pb.d.ts +1513 -0
- package/build/api/vendor/gnonativetypes_pb.d.ts.map +1 -0
- package/build/api/vendor/gnonativetypes_pb.js +2506 -0
- package/build/api/vendor/gnonativetypes_pb.js.map +1 -0
- package/build/api/vendor/rpc_connect.d.ts +461 -0
- package/build/api/vendor/rpc_connect.d.ts.map +1 -0
- package/build/api/vendor/rpc_connect.js +465 -0
- package/build/api/vendor/rpc_connect.js.map +1 -0
- package/build/api/vendor/rpc_pb.d.ts +221 -0
- package/build/api/vendor/rpc_pb.d.ts.map +1 -0
- package/build/api/vendor/rpc_pb.js +277 -0
- package/build/api/vendor/rpc_pb.js.map +1 -0
- package/build/grpc/client.d.ts +1 -1
- package/build/grpc/client.d.ts.map +1 -1
- package/build/grpc/client.js +1 -1
- package/build/grpc/client.js.map +1 -1
- package/build/grpc/error.d.ts +1 -1
- package/build/grpc/error.d.ts.map +1 -1
- package/build/grpc/error.js +1 -1
- package/build/grpc/error.js.map +1 -1
- package/build/index.d.ts +2 -2
- package/build/index.d.ts.map +1 -1
- package/build/index.js +2 -2
- package/build/index.js.map +1 -1
- package/ios/Frameworks/GnoCore.xcframework/ios-arm64/GnoCore.framework/GnoCore +0 -0
- package/ios/Frameworks/GnoCore.xcframework/ios-arm64/GnoCore.framework/Headers/GnoGnonative.objc.h +0 -7
- package/ios/Frameworks/GnoCore.xcframework/ios-arm64/GnoCore.framework/Versions/A/GnoCore +0 -0
- package/ios/Frameworks/GnoCore.xcframework/ios-arm64/GnoCore.framework/Versions/A/Headers/GnoGnonative.objc.h +0 -7
- package/ios/Frameworks/GnoCore.xcframework/ios-arm64/GnoCore.framework/Versions/Current/GnoCore +0 -0
- package/ios/Frameworks/GnoCore.xcframework/ios-arm64/GnoCore.framework/Versions/Current/Headers/GnoGnonative.objc.h +0 -7
- package/ios/Frameworks/GnoCore.xcframework/ios-arm64_x86_64-simulator/GnoCore.framework/GnoCore +0 -0
- package/ios/Frameworks/GnoCore.xcframework/ios-arm64_x86_64-simulator/GnoCore.framework/Headers/GnoGnonative.objc.h +0 -7
- package/ios/GnonativeModule.swift +0 -12
- package/package.json +1 -3
- package/src/GoBridge.ts +0 -5
- package/src/api/GnoNativeApi.ts +33 -16
- package/src/api/types.ts +12 -5
- package/src/api/vendor/gnonativetypes_pb.ts +3074 -0
- package/src/api/vendor/rpc_connect.ts +467 -0
- package/src/api/vendor/rpc_pb.ts +321 -0
- package/src/grpc/client.ts +1 -1
- package/src/grpc/error.ts +2 -1
- package/src/index.ts +2 -2
- package/tsconfig.json +0 -1
|
Binary file
|
package/ios/Frameworks/GnoCore.xcframework/ios-arm64/GnoCore.framework/Headers/GnoGnonative.objc.h
CHANGED
|
@@ -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);
|
|
Binary file
|
|
@@ -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);
|
package/ios/Frameworks/GnoCore.xcframework/ios-arm64/GnoCore.framework/Versions/Current/GnoCore
CHANGED
|
Binary file
|
|
@@ -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);
|
package/ios/Frameworks/GnoCore.xcframework/ios-arm64_x86_64-simulator/GnoCore.framework/GnoCore
CHANGED
|
Binary file
|
|
@@ -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": "
|
|
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-20241025093116-5a2307f7af9a.3",
|
|
33
|
-
"@buf/gnolang_gnonative.connectrpc_es": "^1.4.0-20241025093116-5a2307f7af9a.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
|
}
|
package/src/api/GnoNativeApi.ts
CHANGED
|
@@ -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
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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
|
|
85
|
-
await this.clientInstance
|
|
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 }));
|
|
@@ -225,7 +245,7 @@ export class GnoNativeApi implements GnoKeyApi, GoBridgeInterface {
|
|
|
225
245
|
gasFee: string,
|
|
226
246
|
gasWanted: bigint,
|
|
227
247
|
callerAddress: Uint8Array,
|
|
228
|
-
send?:
|
|
248
|
+
send?: Coin[],
|
|
229
249
|
memo?: string,
|
|
230
250
|
): Promise<MakeTxResponse> {
|
|
231
251
|
const client = this.#getClient();
|
|
@@ -374,7 +394,7 @@ export class GnoNativeApi implements GnoKeyApi, GoBridgeInterface {
|
|
|
374
394
|
gasFee: string,
|
|
375
395
|
gasWanted: bigint,
|
|
376
396
|
callerAddress: Uint8Array,
|
|
377
|
-
send?:
|
|
397
|
+
send?: Coin[],
|
|
378
398
|
memo?: string,
|
|
379
399
|
): Promise<AsyncIterable<CallResponse>> {
|
|
380
400
|
const client = this.#getClient();
|
|
@@ -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 '
|
|
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 {
|
|
@@ -69,7 +68,7 @@ export interface GnoKeyApi {
|
|
|
69
68
|
gasFee: string,
|
|
70
69
|
gasWanted: bigint,
|
|
71
70
|
callerAddress: Uint8Array,
|
|
72
|
-
send?:
|
|
71
|
+
send?: Coin[],
|
|
73
72
|
memo?: string,
|
|
74
73
|
) => Promise<AsyncIterable<CallResponse>>;
|
|
75
74
|
send: (
|
|
@@ -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,
|
|
@@ -96,7 +103,7 @@ export interface GnoKeyApi {
|
|
|
96
103
|
gasFee: string,
|
|
97
104
|
gasWanted: bigint,
|
|
98
105
|
callerAddress: Uint8Array,
|
|
99
|
-
send?:
|
|
106
|
+
send?: Coin[],
|
|
100
107
|
memo?: string,
|
|
101
108
|
): Promise<MakeTxResponse>;
|
|
102
109
|
makeSendTx(
|