@gnolang/gnonative 1.2.1 → 1.3.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/README.md +6 -6
- package/android/libs/gnocore.aar +0 -0
- package/build/api/GnoNativeApi.d.ts +50 -0
- package/build/api/GnoNativeApi.d.ts.map +1 -0
- package/build/api/GnoNativeApi.js +261 -0
- package/build/api/GnoNativeApi.js.map +1 -0
- package/build/api/index.d.ts +3 -0
- package/build/api/index.d.ts.map +1 -0
- package/build/api/index.js +3 -0
- package/build/api/index.js.map +1 -0
- package/build/{hooks/use-gno.d.ts → api/types.d.ts} +18 -13
- package/build/api/types.d.ts.map +1 -0
- package/build/api/types.js +7 -0
- package/build/api/types.js.map +1 -0
- package/build/index.d.ts +1 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -1
- package/build/index.js.map +1 -1
- package/build/provider/gnonative-provider.d.ts +4 -35
- package/build/provider/gnonative-provider.d.ts.map +1 -1
- package/build/provider/gnonative-provider.js +5 -249
- package/build/provider/gnonative-provider.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/Versions/A/GnoCore +0 -0
- package/ios/Frameworks/GnoCore.xcframework/ios-arm64/GnoCore.framework/Versions/Current/GnoCore +0 -0
- 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/Versions/A/GnoCore +0 -0
- package/ios/Frameworks/GnoCore.xcframework/ios-arm64_x86_64-simulator/GnoCore.framework/Versions/Current/GnoCore +0 -0
- package/package.json +1 -1
- package/src/api/GnoNativeApi.ts +388 -0
- package/src/api/index.ts +2 -0
- package/src/api/types.ts +78 -0
- package/src/index.ts +2 -1
- package/src/provider/gnonative-provider.tsx +8 -428
- package/build/hooks/types.d.ts +0 -17
- package/build/hooks/types.d.ts.map +0 -1
- package/build/hooks/types.js +0 -2
- package/build/hooks/types.js.map +0 -1
- package/build/hooks/use-gno.d.ts.map +0 -1
- package/build/hooks/use-gno.js +0 -256
- package/build/hooks/use-gno.js.map +0 -1
- package/src/hooks/types.ts +0 -19
- package/src/hooks/use-gno.ts +0 -431
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AddressFromBech32Request,
|
|
3
|
+
AddressToBech32Request,
|
|
4
|
+
CallRequest,
|
|
5
|
+
CallResponse,
|
|
6
|
+
CreateAccountRequest,
|
|
7
|
+
DeleteAccountRequest,
|
|
8
|
+
DeleteAccountResponse,
|
|
9
|
+
GenerateRecoveryPhraseRequest,
|
|
10
|
+
GetActiveAccountRequest,
|
|
11
|
+
GetActiveAccountResponse,
|
|
12
|
+
GetChainIDRequest,
|
|
13
|
+
GetKeyInfoByAddressRequest,
|
|
14
|
+
GetKeyInfoByNameOrAddressRequest,
|
|
15
|
+
GetKeyInfoByNameRequest,
|
|
16
|
+
GetRemoteRequest,
|
|
17
|
+
HasKeyByAddressRequest,
|
|
18
|
+
HasKeyByNameOrAddressRequest,
|
|
19
|
+
HasKeyByNameRequest,
|
|
20
|
+
HelloRequest,
|
|
21
|
+
HelloStreamResponse,
|
|
22
|
+
KeyInfo,
|
|
23
|
+
ListKeyInfoRequest,
|
|
24
|
+
MsgCall,
|
|
25
|
+
MsgSend,
|
|
26
|
+
QEvalRequest,
|
|
27
|
+
QueryAccountRequest,
|
|
28
|
+
QueryAccountResponse,
|
|
29
|
+
QueryRequest,
|
|
30
|
+
QueryResponse,
|
|
31
|
+
RenderRequest,
|
|
32
|
+
SelectAccountRequest,
|
|
33
|
+
SelectAccountResponse,
|
|
34
|
+
SendRequest,
|
|
35
|
+
SendResponse,
|
|
36
|
+
SetChainIDRequest,
|
|
37
|
+
SetChainIDResponse,
|
|
38
|
+
SetPasswordRequest,
|
|
39
|
+
SetPasswordResponse,
|
|
40
|
+
SetRemoteRequest,
|
|
41
|
+
SetRemoteResponse,
|
|
42
|
+
} from '@buf/gnolang_gnonative.bufbuild_es/gnonativetypes_pb';
|
|
43
|
+
import { GnoNativeService } from '@buf/gnolang_gnonative.connectrpc_es/rpc_connect';
|
|
44
|
+
import { PromiseClient } from '@connectrpc/connect';
|
|
45
|
+
|
|
46
|
+
import { GnoKeyApi, BridgeStatus, Config } from './types';
|
|
47
|
+
import { GoBridge, GoBridgeInterface } from '../GoBridge';
|
|
48
|
+
import * as Grpc from '../grpc/client';
|
|
49
|
+
|
|
50
|
+
export class GnoNativeApi implements GnoKeyApi, GoBridgeInterface {
|
|
51
|
+
bridgeStatus = BridgeStatus.Stopped;
|
|
52
|
+
config: Config;
|
|
53
|
+
clientInstance: PromiseClient<typeof GnoNativeService> | undefined;
|
|
54
|
+
|
|
55
|
+
constructor(config: Config) {
|
|
56
|
+
this.config = config;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
async initClient() {
|
|
60
|
+
if (this.bridgeStatus === BridgeStatus.Stopped) {
|
|
61
|
+
console.log('Bridge stopped. Initializing...');
|
|
62
|
+
await this.#initBridge();
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (this.clientInstance) {
|
|
66
|
+
console.error('GoBridge already initialized.');
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const port = await GoBridge.getTcpPort();
|
|
71
|
+
console.log('GoBridge GRPC client instance port: %s', port);
|
|
72
|
+
const client = Grpc.createClient(port);
|
|
73
|
+
this.clientInstance = client;
|
|
74
|
+
console.log('GoBridge GRPC client instance. Done.');
|
|
75
|
+
|
|
76
|
+
try {
|
|
77
|
+
await this.clientInstance.setRemote(new SetRemoteRequest({ remote: this.config.remote }));
|
|
78
|
+
await this.clientInstance.setChainID(
|
|
79
|
+
new SetChainIDRequest({ chainId: this.config.chain_id }),
|
|
80
|
+
);
|
|
81
|
+
console.log('✅ GnoNative bridge initialized.');
|
|
82
|
+
return true;
|
|
83
|
+
} catch (error) {
|
|
84
|
+
console.error(error);
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
async #initBridge() {
|
|
90
|
+
if (this.bridgeStatus === BridgeStatus.Stopped) {
|
|
91
|
+
console.log('Initializing bridge...');
|
|
92
|
+
this.bridgeStatus = BridgeStatus.Starting;
|
|
93
|
+
await GoBridge.initBridge();
|
|
94
|
+
console.log('Bridge initialized.');
|
|
95
|
+
this.bridgeStatus = BridgeStatus.Started;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
#getClient() {
|
|
100
|
+
if (!this.clientInstance) {
|
|
101
|
+
throw new Error('GoBridge client instance not initialized.');
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return this.clientInstance;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
async setRemote(remote: string): Promise<SetRemoteResponse> {
|
|
108
|
+
const client = await this.#getClient();
|
|
109
|
+
const response = await client.setRemote(new SetRemoteRequest({ remote }));
|
|
110
|
+
return response;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
async getRemote(): Promise<string> {
|
|
114
|
+
const client = await this.#getClient();
|
|
115
|
+
const response = await client.getRemote(new GetRemoteRequest());
|
|
116
|
+
return response.remote;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
async setChainID(chainId: string): Promise<SetChainIDResponse> {
|
|
120
|
+
const client = await this.#getClient();
|
|
121
|
+
const response = await client.setChainID(new SetChainIDRequest({ chainId }));
|
|
122
|
+
return response;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
async getChainID() {
|
|
126
|
+
const client = await this.#getClient();
|
|
127
|
+
const response = await client.getChainID(new GetChainIDRequest());
|
|
128
|
+
return response.chainId;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
async createAccount(
|
|
132
|
+
nameOrBech32: string,
|
|
133
|
+
mnemonic: string,
|
|
134
|
+
password: string,
|
|
135
|
+
): Promise<KeyInfo | undefined> {
|
|
136
|
+
const client = await this.#getClient();
|
|
137
|
+
const reponse = await client.createAccount(
|
|
138
|
+
new CreateAccountRequest({
|
|
139
|
+
nameOrBech32,
|
|
140
|
+
mnemonic,
|
|
141
|
+
password,
|
|
142
|
+
}),
|
|
143
|
+
);
|
|
144
|
+
return reponse.key;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
async generateRecoveryPhrase() {
|
|
148
|
+
const client = await this.#getClient();
|
|
149
|
+
const response = await client.generateRecoveryPhrase(new GenerateRecoveryPhraseRequest());
|
|
150
|
+
return response.phrase;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
async hasKeyByName(name: string) {
|
|
154
|
+
const client = await this.#getClient();
|
|
155
|
+
const response = await client.hasKeyByName(new HasKeyByNameRequest({ name }));
|
|
156
|
+
return response.has;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
async hasKeyByAddress(address: Uint8Array) {
|
|
160
|
+
const client = await this.#getClient();
|
|
161
|
+
const response = await client.hasKeyByAddress(new HasKeyByAddressRequest({ address }));
|
|
162
|
+
return response.has;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
async hasKeyByNameOrAddress(nameOrBech32: string) {
|
|
166
|
+
const client = await this.#getClient();
|
|
167
|
+
const response = await client.hasKeyByNameOrAddress(
|
|
168
|
+
new HasKeyByNameOrAddressRequest({ nameOrBech32 }),
|
|
169
|
+
);
|
|
170
|
+
return response.has;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
async getKeyInfoByName(name: string): Promise<KeyInfo | undefined> {
|
|
174
|
+
const client = await this.#getClient();
|
|
175
|
+
const response = await client.getKeyInfoByName(new GetKeyInfoByNameRequest({ name }));
|
|
176
|
+
return response.key;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
async getKeyInfoByAddress(address: Uint8Array): Promise<KeyInfo | undefined> {
|
|
180
|
+
const client = await this.#getClient();
|
|
181
|
+
const response = await client.getKeyInfoByAddress(new GetKeyInfoByAddressRequest({ address }));
|
|
182
|
+
return response.key;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
async getKeyInfoByNameOrAddress(nameOrBech32: string): Promise<KeyInfo | undefined> {
|
|
186
|
+
const client = await this.#getClient();
|
|
187
|
+
const response = await client.getKeyInfoByNameOrAddress(
|
|
188
|
+
new GetKeyInfoByNameOrAddressRequest({ nameOrBech32 }),
|
|
189
|
+
);
|
|
190
|
+
return response.key;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
async listKeyInfo(): Promise<KeyInfo[]> {
|
|
194
|
+
const client = await this.#getClient();
|
|
195
|
+
const response = await client.listKeyInfo(new ListKeyInfoRequest());
|
|
196
|
+
return response.keys;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
async selectAccount(nameOrBech32: string): Promise<SelectAccountResponse> {
|
|
200
|
+
const client = await this.#getClient();
|
|
201
|
+
const response = await client.selectAccount(
|
|
202
|
+
new SelectAccountRequest({
|
|
203
|
+
nameOrBech32,
|
|
204
|
+
}),
|
|
205
|
+
);
|
|
206
|
+
return response;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
async getClient(): Promise<PromiseClient<typeof GnoNativeService>> {
|
|
210
|
+
if (!this.clientInstance) {
|
|
211
|
+
throw new Error('GoBridge client instance not initialized.');
|
|
212
|
+
}
|
|
213
|
+
return this.clientInstance;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
isInitialized(): boolean {
|
|
217
|
+
return this.clientInstance !== undefined;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
async setPassword(password: string): Promise<SetPasswordResponse> {
|
|
221
|
+
const client = await this.#getClient();
|
|
222
|
+
const response = await client.setPassword(new SetPasswordRequest({ password }));
|
|
223
|
+
return response;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
async getActiveAccount(): Promise<GetActiveAccountResponse> {
|
|
227
|
+
const client = await this.#getClient();
|
|
228
|
+
const response = await client.getActiveAccount(new GetActiveAccountRequest());
|
|
229
|
+
return response;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
async queryAccount(address: Uint8Array): Promise<QueryAccountResponse> {
|
|
233
|
+
const client = await this.#getClient();
|
|
234
|
+
const reponse = await client.queryAccount(new QueryAccountRequest({ address }));
|
|
235
|
+
return reponse;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
async deleteAccount(
|
|
239
|
+
nameOrBech32: string,
|
|
240
|
+
password: string | undefined,
|
|
241
|
+
skipPassword: boolean,
|
|
242
|
+
): Promise<DeleteAccountResponse> {
|
|
243
|
+
const client = await this.#getClient();
|
|
244
|
+
const response = await client.deleteAccount(
|
|
245
|
+
new DeleteAccountRequest({
|
|
246
|
+
nameOrBech32,
|
|
247
|
+
password,
|
|
248
|
+
skipPassword,
|
|
249
|
+
}),
|
|
250
|
+
);
|
|
251
|
+
return response;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
async query(path: string, data: Uint8Array): Promise<QueryResponse> {
|
|
255
|
+
const client = await this.#getClient();
|
|
256
|
+
const reponse = await client.query(
|
|
257
|
+
new QueryRequest({
|
|
258
|
+
path,
|
|
259
|
+
data,
|
|
260
|
+
}),
|
|
261
|
+
);
|
|
262
|
+
return reponse;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
async render(packagePath: string, args: string) {
|
|
266
|
+
const client = await this.#getClient();
|
|
267
|
+
const reponse = await client.render(
|
|
268
|
+
new RenderRequest({
|
|
269
|
+
packagePath,
|
|
270
|
+
args,
|
|
271
|
+
}),
|
|
272
|
+
);
|
|
273
|
+
return reponse.result;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
async qEval(packagePath: string, expression: string) {
|
|
277
|
+
const client = await this.#getClient();
|
|
278
|
+
const reponse = await client.qEval(
|
|
279
|
+
new QEvalRequest({
|
|
280
|
+
packagePath,
|
|
281
|
+
expression,
|
|
282
|
+
}),
|
|
283
|
+
);
|
|
284
|
+
return reponse.result;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
async call(
|
|
288
|
+
packagePath: string,
|
|
289
|
+
fnc: string,
|
|
290
|
+
args: string[],
|
|
291
|
+
gasFee: string,
|
|
292
|
+
gasWanted: number,
|
|
293
|
+
send?: string,
|
|
294
|
+
memo?: string,
|
|
295
|
+
): Promise<AsyncIterable<CallResponse>> {
|
|
296
|
+
const client = await this.#getClient();
|
|
297
|
+
const reponse = client.call(
|
|
298
|
+
new CallRequest({
|
|
299
|
+
gasFee,
|
|
300
|
+
gasWanted: BigInt(gasWanted),
|
|
301
|
+
memo,
|
|
302
|
+
msgs: [
|
|
303
|
+
new MsgCall({
|
|
304
|
+
packagePath,
|
|
305
|
+
fnc,
|
|
306
|
+
args,
|
|
307
|
+
send,
|
|
308
|
+
}),
|
|
309
|
+
],
|
|
310
|
+
}),
|
|
311
|
+
);
|
|
312
|
+
return reponse;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
async send(
|
|
316
|
+
toAddress: Uint8Array,
|
|
317
|
+
send: string,
|
|
318
|
+
gasFee: string,
|
|
319
|
+
gasWanted: number,
|
|
320
|
+
memo?: string,
|
|
321
|
+
): Promise<AsyncIterable<SendResponse>> {
|
|
322
|
+
const client = await this.#getClient();
|
|
323
|
+
const reponse = client.send(
|
|
324
|
+
new SendRequest({
|
|
325
|
+
gasFee,
|
|
326
|
+
gasWanted: BigInt(gasWanted),
|
|
327
|
+
memo,
|
|
328
|
+
msgs: [
|
|
329
|
+
new MsgSend({
|
|
330
|
+
toAddress,
|
|
331
|
+
send,
|
|
332
|
+
}),
|
|
333
|
+
],
|
|
334
|
+
}),
|
|
335
|
+
);
|
|
336
|
+
return reponse;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
async addressToBech32(address: Uint8Array) {
|
|
340
|
+
const client = await this.#getClient();
|
|
341
|
+
const response = await client.addressToBech32(new AddressToBech32Request({ address }));
|
|
342
|
+
return response.bech32Address;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
async addressFromBech32(bech32Address: string) {
|
|
346
|
+
const client = await this.#getClient();
|
|
347
|
+
const response = await client.addressFromBech32(
|
|
348
|
+
new AddressFromBech32Request({ bech32Address }),
|
|
349
|
+
);
|
|
350
|
+
return response.address;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
// // debug
|
|
354
|
+
async hello(name: string) {
|
|
355
|
+
const client = await this.#getClient();
|
|
356
|
+
const response = await client.hello(new HelloRequest({ name }));
|
|
357
|
+
return response.greeting;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
// // debug
|
|
361
|
+
async helloStream(name: string): Promise<AsyncIterable<HelloStreamResponse>> {
|
|
362
|
+
const client = await this.#getClient();
|
|
363
|
+
return client.helloStream(new HelloRequest({ name }));
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
// Go Bridge Interface:
|
|
367
|
+
initBridge(): Promise<void> {
|
|
368
|
+
return GoBridge.initBridge();
|
|
369
|
+
}
|
|
370
|
+
closeBridge(): Promise<void> {
|
|
371
|
+
return GoBridge.closeBridge();
|
|
372
|
+
}
|
|
373
|
+
getTcpPort(): Promise<number> {
|
|
374
|
+
return GoBridge.getTcpPort();
|
|
375
|
+
}
|
|
376
|
+
invokeGrpcMethod(method: string, jsonMessage: string): Promise<string> {
|
|
377
|
+
return GoBridge.invokeGrpcMethod(method, jsonMessage);
|
|
378
|
+
}
|
|
379
|
+
createStreamClient(method: string, jsonMessage: string): Promise<string> {
|
|
380
|
+
return GoBridge.createStreamClient(method, jsonMessage);
|
|
381
|
+
}
|
|
382
|
+
streamClientReceive(id: string): Promise<string> {
|
|
383
|
+
return GoBridge.streamClientReceive(id);
|
|
384
|
+
}
|
|
385
|
+
closeStreamClient(id: string): Promise<void> {
|
|
386
|
+
return GoBridge.closeStreamClient(id);
|
|
387
|
+
}
|
|
388
|
+
}
|
package/src/api/index.ts
ADDED
package/src/api/types.ts
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CallResponse,
|
|
3
|
+
DeleteAccountResponse,
|
|
4
|
+
GetActiveAccountResponse,
|
|
5
|
+
HelloStreamResponse,
|
|
6
|
+
QueryAccountResponse,
|
|
7
|
+
QueryResponse,
|
|
8
|
+
SelectAccountResponse,
|
|
9
|
+
SendResponse,
|
|
10
|
+
SetChainIDResponse,
|
|
11
|
+
SetPasswordResponse,
|
|
12
|
+
SetRemoteResponse,
|
|
13
|
+
KeyInfo,
|
|
14
|
+
} from '@buf/gnolang_gnonative.bufbuild_es/gnonativetypes_pb';
|
|
15
|
+
|
|
16
|
+
export enum BridgeStatus {
|
|
17
|
+
Stopped,
|
|
18
|
+
Starting,
|
|
19
|
+
Started,
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface Config {
|
|
23
|
+
remote: string;
|
|
24
|
+
chain_id: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface GnoKeyApi {
|
|
28
|
+
setRemote: (remote: string) => Promise<SetRemoteResponse>;
|
|
29
|
+
getRemote: () => Promise<string>;
|
|
30
|
+
setChainID: (chainId: string) => Promise<SetChainIDResponse>;
|
|
31
|
+
getChainID: () => Promise<string>;
|
|
32
|
+
createAccount: (
|
|
33
|
+
nameOrBech32: string,
|
|
34
|
+
mnemonic: string,
|
|
35
|
+
password: string,
|
|
36
|
+
) => Promise<KeyInfo | undefined>;
|
|
37
|
+
generateRecoveryPhrase: () => Promise<string>;
|
|
38
|
+
listKeyInfo: () => Promise<KeyInfo[]>;
|
|
39
|
+
hasKeyByName: (name: string) => Promise<boolean>;
|
|
40
|
+
hasKeyByAddress: (address: Uint8Array) => Promise<boolean>;
|
|
41
|
+
hasKeyByNameOrAddress: (nameOrBech32: string) => Promise<boolean>;
|
|
42
|
+
getKeyInfoByName: (name: string) => Promise<KeyInfo | undefined>;
|
|
43
|
+
getKeyInfoByAddress: (address: Uint8Array) => Promise<KeyInfo | undefined>;
|
|
44
|
+
getKeyInfoByNameOrAddress: (nameOrBech32: string) => Promise<KeyInfo | undefined>;
|
|
45
|
+
selectAccount: (nameOrBech32: string) => Promise<SelectAccountResponse>;
|
|
46
|
+
setPassword: (password: string) => Promise<SetPasswordResponse>;
|
|
47
|
+
getActiveAccount: () => Promise<GetActiveAccountResponse>;
|
|
48
|
+
queryAccount: (address: Uint8Array) => Promise<QueryAccountResponse>;
|
|
49
|
+
deleteAccount: (
|
|
50
|
+
nameOrBech32: string,
|
|
51
|
+
password: string | undefined,
|
|
52
|
+
skipPassword: boolean,
|
|
53
|
+
) => Promise<DeleteAccountResponse>;
|
|
54
|
+
query: (path: string, data: Uint8Array) => Promise<QueryResponse>;
|
|
55
|
+
render: (packagePath: string, args: string) => Promise<string>;
|
|
56
|
+
qEval: (packagePath: string, expression: string) => Promise<string>;
|
|
57
|
+
call: (
|
|
58
|
+
packagePath: string,
|
|
59
|
+
fnc: string,
|
|
60
|
+
args: string[],
|
|
61
|
+
gasFee: string,
|
|
62
|
+
gasWanted: number,
|
|
63
|
+
send?: string,
|
|
64
|
+
memo?: string,
|
|
65
|
+
) => Promise<AsyncIterable<CallResponse>>;
|
|
66
|
+
send: (
|
|
67
|
+
toAddress: Uint8Array,
|
|
68
|
+
send: string,
|
|
69
|
+
gasFee: string,
|
|
70
|
+
gasWanted: number,
|
|
71
|
+
memo?: string,
|
|
72
|
+
) => Promise<AsyncIterable<SendResponse>>;
|
|
73
|
+
addressToBech32: (address: Uint8Array) => Promise<string>;
|
|
74
|
+
addressFromBech32: (bech32Address: string) => Promise<Uint8Array>;
|
|
75
|
+
// debug
|
|
76
|
+
hello: (name: string) => Promise<string>;
|
|
77
|
+
helloStream: (name: string) => Promise<AsyncIterable<HelloStreamResponse>>;
|
|
78
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -16,6 +16,7 @@ export function addChangeListener(listener: (event: ChangeEventPayload) => void)
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export { ChangeEventPayload, GnonativeView, GnonativeViewProps };
|
|
19
|
-
export { useGno } from './hooks/use-gno';
|
|
20
19
|
export * from './provider/gnonative-provider';
|
|
21
20
|
export * from '@buf/gnolang_gnonative.bufbuild_es/gnonativetypes_pb';
|
|
21
|
+
|
|
22
|
+
export * from './api/GnoNativeApi';
|