@gnolang/gnonative 1.2.2 → 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/Info.plist +5 -5
- 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
|
@@ -1,133 +1,22 @@
|
|
|
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
|
-
ListKeyInfoRequest,
|
|
23
|
-
MsgCall,
|
|
24
|
-
MsgSend,
|
|
25
|
-
QEvalRequest,
|
|
26
|
-
QueryAccountRequest,
|
|
27
|
-
QueryAccountResponse,
|
|
28
|
-
QueryRequest,
|
|
29
|
-
QueryResponse,
|
|
30
|
-
RenderRequest,
|
|
31
|
-
SelectAccountRequest,
|
|
32
|
-
SelectAccountResponse,
|
|
33
|
-
SendRequest,
|
|
34
|
-
SendResponse,
|
|
35
|
-
SetChainIDRequest,
|
|
36
|
-
SetChainIDResponse,
|
|
37
|
-
SetPasswordRequest,
|
|
38
|
-
SetPasswordResponse,
|
|
39
|
-
SetRemoteRequest,
|
|
40
|
-
SetRemoteResponse,
|
|
41
|
-
} from '@buf/gnolang_gnonative.bufbuild_es/gnonativetypes_pb';
|
|
42
|
-
import { GnoNativeService } from '@buf/gnolang_gnonative.connectrpc_es/rpc_connect';
|
|
43
|
-
import { PromiseClient } from '@connectrpc/connect';
|
|
44
1
|
import { createContext, useContext, useEffect, useState } from 'react';
|
|
45
2
|
|
|
46
|
-
import {
|
|
47
|
-
import
|
|
48
|
-
import { GnoAccount } from '../hooks/types';
|
|
3
|
+
import { GnoNativeApi } from '../api';
|
|
4
|
+
import { Config } from '../api/types';
|
|
49
5
|
|
|
50
6
|
export interface GnoNativeContextProps {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
setRemote: (remote: string) => Promise<SetRemoteResponse>;
|
|
54
|
-
getRemote: () => Promise<string>;
|
|
55
|
-
setChainID: (chainId: string) => Promise<SetChainIDResponse>;
|
|
56
|
-
getChainID: () => Promise<string>;
|
|
57
|
-
createAccount: (
|
|
58
|
-
nameOrBech32: string,
|
|
59
|
-
mnemonic: string,
|
|
60
|
-
password: string,
|
|
61
|
-
) => Promise<GnoAccount | undefined>;
|
|
62
|
-
generateRecoveryPhrase: () => Promise<string>;
|
|
63
|
-
listKeyInfo: () => Promise<GnoAccount[]>;
|
|
64
|
-
hasKeyByName: (name: string) => Promise<boolean>;
|
|
65
|
-
hasKeyByAddress: (address: Uint8Array) => Promise<boolean>;
|
|
66
|
-
hasKeyByNameOrAddress: (nameOrBech32: string) => Promise<boolean>;
|
|
67
|
-
getKeyInfoByName: (name: string) => Promise<GnoAccount | undefined>;
|
|
68
|
-
getKeyInfoByAddress: (address: Uint8Array) => Promise<GnoAccount | undefined>;
|
|
69
|
-
getKeyInfoByNameOrAddress: (nameOrBech32: string) => Promise<GnoAccount | undefined>;
|
|
70
|
-
selectAccount: (nameOrBech32: string) => Promise<SelectAccountResponse>;
|
|
71
|
-
setPassword: (password: string) => Promise<SetPasswordResponse>;
|
|
72
|
-
getActiveAccount: () => Promise<GetActiveAccountResponse>;
|
|
73
|
-
queryAccount: (address: Uint8Array) => Promise<QueryAccountResponse>;
|
|
74
|
-
deleteAccount: (
|
|
75
|
-
nameOrBech32: string,
|
|
76
|
-
password: string | undefined,
|
|
77
|
-
skipPassword: boolean,
|
|
78
|
-
) => Promise<DeleteAccountResponse>;
|
|
79
|
-
query: (path: string, data: Uint8Array) => Promise<QueryResponse>;
|
|
80
|
-
render: (packagePath: string, args: string) => Promise<string>;
|
|
81
|
-
qEval: (packagePath: string, expression: string) => Promise<string>;
|
|
82
|
-
call: (
|
|
83
|
-
packagePath: string,
|
|
84
|
-
fnc: string,
|
|
85
|
-
args: string[],
|
|
86
|
-
gasFee: string,
|
|
87
|
-
gasWanted: number,
|
|
88
|
-
send?: string,
|
|
89
|
-
memo?: string,
|
|
90
|
-
) => Promise<AsyncIterable<CallResponse>>;
|
|
91
|
-
send: (
|
|
92
|
-
toAddress: Uint8Array,
|
|
93
|
-
send: string,
|
|
94
|
-
gasFee: string,
|
|
95
|
-
gasWanted: number,
|
|
96
|
-
memo?: string,
|
|
97
|
-
) => Promise<AsyncIterable<SendResponse>>;
|
|
98
|
-
addressToBech32: (address: Uint8Array) => Promise<string>;
|
|
99
|
-
addressFromBech32: (bech32Address: string) => Promise<Uint8Array>;
|
|
100
|
-
// closeBridge: () => Promise<void>;
|
|
101
|
-
// initBridge: () => Promise<void>;
|
|
102
|
-
// debug
|
|
103
|
-
hello: (name: string) => Promise<string>;
|
|
104
|
-
helloStream: (name: string) => Promise<AsyncIterable<HelloStreamResponse>>;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
interface ConfigProps {
|
|
108
|
-
remote: string;
|
|
109
|
-
chain_id: string;
|
|
7
|
+
gnonative: GnoNativeApi;
|
|
110
8
|
}
|
|
111
9
|
|
|
112
10
|
interface GnoNativeProviderProps {
|
|
113
|
-
config:
|
|
11
|
+
config: Config;
|
|
114
12
|
children: React.ReactNode;
|
|
115
13
|
}
|
|
116
14
|
|
|
117
|
-
enum BridgeStatus {
|
|
118
|
-
Stopped,
|
|
119
|
-
Starting,
|
|
120
|
-
Started,
|
|
121
|
-
}
|
|
122
|
-
|
|
123
15
|
const GnoNativeContext = createContext<GnoNativeContextProps | null>(null);
|
|
124
16
|
|
|
125
17
|
const GnoNativeProvider: React.FC<GnoNativeProviderProps> = ({ children, config }) => {
|
|
126
18
|
const [initialized, setInitialized] = useState(false);
|
|
127
|
-
const [
|
|
128
|
-
PromiseClient<typeof GnoNativeService> | undefined
|
|
129
|
-
>(undefined);
|
|
130
|
-
const [bridgeStatus, setBridgeStatus] = useState(BridgeStatus.Stopped);
|
|
19
|
+
const [api] = useState<GnoNativeApi>(new GnoNativeApi(config));
|
|
131
20
|
|
|
132
21
|
useEffect(() => {
|
|
133
22
|
(async () => {
|
|
@@ -138,32 +27,13 @@ const GnoNativeProvider: React.FC<GnoNativeProviderProps> = ({ children, config
|
|
|
138
27
|
|
|
139
28
|
async function init(config): Promise<boolean> {
|
|
140
29
|
console.log(
|
|
141
|
-
'🍄 Initializing GnoNative on remote: %s chain_id: %s',
|
|
30
|
+
'🍄 Initializing GnoNative Context on remote: %s chain_id: %s',
|
|
142
31
|
config.remote,
|
|
143
32
|
config.chain_id,
|
|
144
33
|
);
|
|
145
34
|
|
|
146
|
-
if (bridgeStatus === BridgeStatus.Stopped) {
|
|
147
|
-
console.log('Bridge stopped. Initializing...');
|
|
148
|
-
await initBridge();
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
if (clientInstance) {
|
|
152
|
-
console.error('GoBridge already initialized.');
|
|
153
|
-
return true;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
const port = await GoBridge.getTcpPort();
|
|
157
|
-
console.log('GoBridge GRPC client instance port: %s', port);
|
|
158
|
-
const client = Grpc.createClient(port);
|
|
159
|
-
setClientInstance(client);
|
|
160
|
-
console.log('GoBridge GRPC client instance. Done.');
|
|
161
|
-
|
|
162
35
|
try {
|
|
163
|
-
await
|
|
164
|
-
await client.setChainID(new SetChainIDRequest({ chainId: config.chain_id }));
|
|
165
|
-
|
|
166
|
-
console.log('✅ GnoNative bridge initialized.');
|
|
36
|
+
await api.initClient();
|
|
167
37
|
} catch (error) {
|
|
168
38
|
console.error(error);
|
|
169
39
|
return false;
|
|
@@ -172,298 +42,8 @@ const GnoNativeProvider: React.FC<GnoNativeProviderProps> = ({ children, config
|
|
|
172
42
|
return true;
|
|
173
43
|
}
|
|
174
44
|
|
|
175
|
-
const initBridge = async () => {
|
|
176
|
-
if (bridgeStatus === BridgeStatus.Stopped) {
|
|
177
|
-
console.log('Initializing bridge...');
|
|
178
|
-
setBridgeStatus(BridgeStatus.Starting);
|
|
179
|
-
await GoBridge.initBridge();
|
|
180
|
-
console.log('Bridge initialized.');
|
|
181
|
-
setBridgeStatus(BridgeStatus.Started);
|
|
182
|
-
}
|
|
183
|
-
};
|
|
184
|
-
|
|
185
|
-
const setRemote = async (remote: string) => {
|
|
186
|
-
const client = await getClient();
|
|
187
|
-
const response = await client.setRemote(new SetRemoteRequest({ remote }));
|
|
188
|
-
return response;
|
|
189
|
-
};
|
|
190
|
-
|
|
191
|
-
const getRemote = async () => {
|
|
192
|
-
const client = await getClient();
|
|
193
|
-
const response = await client.getRemote(new GetRemoteRequest());
|
|
194
|
-
return response.remote;
|
|
195
|
-
};
|
|
196
|
-
|
|
197
|
-
const setChainID = async (chainId: string) => {
|
|
198
|
-
const client = await getClient();
|
|
199
|
-
const response = await client.setChainID(new SetChainIDRequest({ chainId }));
|
|
200
|
-
return response;
|
|
201
|
-
};
|
|
202
|
-
|
|
203
|
-
const getChainID = async () => {
|
|
204
|
-
const client = await getClient();
|
|
205
|
-
const response = await client.getChainID(new GetChainIDRequest());
|
|
206
|
-
return response.chainId;
|
|
207
|
-
};
|
|
208
|
-
|
|
209
|
-
const createAccount = async (nameOrBech32: string, mnemonic: string, password: string) => {
|
|
210
|
-
const client = await getClient();
|
|
211
|
-
const reponse = await client.createAccount(
|
|
212
|
-
new CreateAccountRequest({
|
|
213
|
-
nameOrBech32,
|
|
214
|
-
mnemonic,
|
|
215
|
-
password,
|
|
216
|
-
}),
|
|
217
|
-
);
|
|
218
|
-
return reponse.key;
|
|
219
|
-
};
|
|
220
|
-
|
|
221
|
-
const generateRecoveryPhrase = async () => {
|
|
222
|
-
const client = await getClient();
|
|
223
|
-
const response = await client.generateRecoveryPhrase(new GenerateRecoveryPhraseRequest());
|
|
224
|
-
return response.phrase;
|
|
225
|
-
};
|
|
226
|
-
|
|
227
|
-
const hasKeyByName = async (name: string) => {
|
|
228
|
-
const client = await getClient();
|
|
229
|
-
const response = await client.hasKeyByName(new HasKeyByNameRequest({ name }));
|
|
230
|
-
return response.has;
|
|
231
|
-
};
|
|
232
|
-
|
|
233
|
-
const hasKeyByAddress = async (address: Uint8Array) => {
|
|
234
|
-
const client = await getClient();
|
|
235
|
-
const response = await client.hasKeyByAddress(new HasKeyByAddressRequest({ address }));
|
|
236
|
-
return response.has;
|
|
237
|
-
};
|
|
238
|
-
|
|
239
|
-
const hasKeyByNameOrAddress = async (nameOrBech32: string) => {
|
|
240
|
-
const client = await getClient();
|
|
241
|
-
const response = await client.hasKeyByNameOrAddress(
|
|
242
|
-
new HasKeyByNameOrAddressRequest({ nameOrBech32 }),
|
|
243
|
-
);
|
|
244
|
-
return response.has;
|
|
245
|
-
};
|
|
246
|
-
|
|
247
|
-
const getKeyInfoByName = async (name: string) => {
|
|
248
|
-
const client = await getClient();
|
|
249
|
-
const response = await client.getKeyInfoByName(new GetKeyInfoByNameRequest({ name }));
|
|
250
|
-
return response.key;
|
|
251
|
-
};
|
|
252
|
-
|
|
253
|
-
const getKeyInfoByAddress = async (address: Uint8Array) => {
|
|
254
|
-
const client = await getClient();
|
|
255
|
-
const response = await client.getKeyInfoByAddress(new GetKeyInfoByAddressRequest({ address }));
|
|
256
|
-
return response.key;
|
|
257
|
-
};
|
|
258
|
-
|
|
259
|
-
const getKeyInfoByNameOrAddress = async (nameOrBech32: string) => {
|
|
260
|
-
const client = await getClient();
|
|
261
|
-
const response = await client.getKeyInfoByNameOrAddress(
|
|
262
|
-
new GetKeyInfoByNameOrAddressRequest({ nameOrBech32 }),
|
|
263
|
-
);
|
|
264
|
-
return response.key;
|
|
265
|
-
};
|
|
266
|
-
|
|
267
|
-
const listKeyInfo = async () => {
|
|
268
|
-
const client = await getClient();
|
|
269
|
-
const response = await client.listKeyInfo(new ListKeyInfoRequest());
|
|
270
|
-
return response.keys;
|
|
271
|
-
};
|
|
272
|
-
|
|
273
|
-
const selectAccount = async (nameOrBech32: string) => {
|
|
274
|
-
const client = await getClient();
|
|
275
|
-
const response = await client.selectAccount(
|
|
276
|
-
new SelectAccountRequest({
|
|
277
|
-
nameOrBech32,
|
|
278
|
-
}),
|
|
279
|
-
);
|
|
280
|
-
return response;
|
|
281
|
-
};
|
|
282
|
-
|
|
283
|
-
const getClient = async () => {
|
|
284
|
-
if (!clientInstance) {
|
|
285
|
-
throw new Error('GoBridge client instance not initialized.');
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
return clientInstance;
|
|
289
|
-
};
|
|
290
|
-
|
|
291
|
-
const setPassword = async (password: string) => {
|
|
292
|
-
const client = await getClient();
|
|
293
|
-
const response = await client.setPassword(new SetPasswordRequest({ password }));
|
|
294
|
-
return response;
|
|
295
|
-
};
|
|
296
|
-
|
|
297
|
-
const getActiveAccount = async () => {
|
|
298
|
-
const client = await getClient();
|
|
299
|
-
const response = await client.getActiveAccount(new GetActiveAccountRequest());
|
|
300
|
-
return response;
|
|
301
|
-
};
|
|
302
|
-
|
|
303
|
-
const queryAccount = async (address: Uint8Array) => {
|
|
304
|
-
const client = await getClient();
|
|
305
|
-
const reponse = await client.queryAccount(new QueryAccountRequest({ address }));
|
|
306
|
-
return reponse;
|
|
307
|
-
};
|
|
308
|
-
|
|
309
|
-
const deleteAccount = async (
|
|
310
|
-
nameOrBech32: string,
|
|
311
|
-
password: string | undefined,
|
|
312
|
-
skipPassword: boolean,
|
|
313
|
-
) => {
|
|
314
|
-
const client = await getClient();
|
|
315
|
-
const response = await client.deleteAccount(
|
|
316
|
-
new DeleteAccountRequest({
|
|
317
|
-
nameOrBech32,
|
|
318
|
-
password,
|
|
319
|
-
skipPassword,
|
|
320
|
-
}),
|
|
321
|
-
);
|
|
322
|
-
return response;
|
|
323
|
-
};
|
|
324
|
-
|
|
325
|
-
const query = async (path: string, data: Uint8Array) => {
|
|
326
|
-
const client = await getClient();
|
|
327
|
-
const reponse = await client.query(
|
|
328
|
-
new QueryRequest({
|
|
329
|
-
path,
|
|
330
|
-
data,
|
|
331
|
-
}),
|
|
332
|
-
);
|
|
333
|
-
return reponse;
|
|
334
|
-
};
|
|
335
|
-
|
|
336
|
-
const render = async (packagePath: string, args: string) => {
|
|
337
|
-
const client = await getClient();
|
|
338
|
-
const reponse = await client.render(
|
|
339
|
-
new RenderRequest({
|
|
340
|
-
packagePath,
|
|
341
|
-
args,
|
|
342
|
-
}),
|
|
343
|
-
);
|
|
344
|
-
return reponse.result;
|
|
345
|
-
};
|
|
346
|
-
|
|
347
|
-
const qEval = async (packagePath: string, expression: string) => {
|
|
348
|
-
const client = await getClient();
|
|
349
|
-
const reponse = await client.qEval(
|
|
350
|
-
new QEvalRequest({
|
|
351
|
-
packagePath,
|
|
352
|
-
expression,
|
|
353
|
-
}),
|
|
354
|
-
);
|
|
355
|
-
return reponse.result;
|
|
356
|
-
};
|
|
357
|
-
|
|
358
|
-
const call = async (
|
|
359
|
-
packagePath: string,
|
|
360
|
-
fnc: string,
|
|
361
|
-
args: string[],
|
|
362
|
-
gasFee: string,
|
|
363
|
-
gasWanted: number,
|
|
364
|
-
send?: string,
|
|
365
|
-
memo?: string,
|
|
366
|
-
) => {
|
|
367
|
-
const client = await getClient();
|
|
368
|
-
const reponse = client.call(
|
|
369
|
-
new CallRequest({
|
|
370
|
-
gasFee,
|
|
371
|
-
gasWanted: BigInt(gasWanted),
|
|
372
|
-
memo,
|
|
373
|
-
msgs: [
|
|
374
|
-
new MsgCall({
|
|
375
|
-
packagePath,
|
|
376
|
-
fnc,
|
|
377
|
-
args,
|
|
378
|
-
send,
|
|
379
|
-
}),
|
|
380
|
-
],
|
|
381
|
-
}),
|
|
382
|
-
);
|
|
383
|
-
return reponse;
|
|
384
|
-
};
|
|
385
|
-
|
|
386
|
-
const send = async (
|
|
387
|
-
toAddress: Uint8Array,
|
|
388
|
-
send: string,
|
|
389
|
-
gasFee: string,
|
|
390
|
-
gasWanted: number,
|
|
391
|
-
memo?: string,
|
|
392
|
-
) => {
|
|
393
|
-
const client = await getClient();
|
|
394
|
-
const reponse = client.send(
|
|
395
|
-
new SendRequest({
|
|
396
|
-
gasFee,
|
|
397
|
-
gasWanted: BigInt(gasWanted),
|
|
398
|
-
memo,
|
|
399
|
-
msgs: [
|
|
400
|
-
new MsgSend({
|
|
401
|
-
toAddress,
|
|
402
|
-
send,
|
|
403
|
-
}),
|
|
404
|
-
],
|
|
405
|
-
}),
|
|
406
|
-
);
|
|
407
|
-
return reponse;
|
|
408
|
-
};
|
|
409
|
-
|
|
410
|
-
const addressToBech32 = async (address: Uint8Array) => {
|
|
411
|
-
const client = await getClient();
|
|
412
|
-
const response = await client.addressToBech32(new AddressToBech32Request({ address }));
|
|
413
|
-
return response.bech32Address;
|
|
414
|
-
};
|
|
415
|
-
|
|
416
|
-
const addressFromBech32 = async (bech32Address: string) => {
|
|
417
|
-
const client = await getClient();
|
|
418
|
-
const response = await client.addressFromBech32(
|
|
419
|
-
new AddressFromBech32Request({ bech32Address }),
|
|
420
|
-
);
|
|
421
|
-
return response.address;
|
|
422
|
-
};
|
|
423
|
-
|
|
424
|
-
// debug
|
|
425
|
-
const hello = async (name: string) => {
|
|
426
|
-
const client = await getClient();
|
|
427
|
-
const response = await client.hello(new HelloRequest({ name }));
|
|
428
|
-
return response.greeting;
|
|
429
|
-
};
|
|
430
|
-
|
|
431
|
-
// debug
|
|
432
|
-
const helloStream = async (name: string) => {
|
|
433
|
-
const client = await getClient();
|
|
434
|
-
return client.helloStream(new HelloRequest({ name }));
|
|
435
|
-
};
|
|
436
|
-
|
|
437
45
|
const value = {
|
|
438
|
-
|
|
439
|
-
setRemote,
|
|
440
|
-
getRemote,
|
|
441
|
-
setChainID,
|
|
442
|
-
getChainID,
|
|
443
|
-
createAccount,
|
|
444
|
-
generateRecoveryPhrase,
|
|
445
|
-
listKeyInfo,
|
|
446
|
-
hasKeyByName,
|
|
447
|
-
hasKeyByAddress,
|
|
448
|
-
hasKeyByNameOrAddress,
|
|
449
|
-
getKeyInfoByName,
|
|
450
|
-
getKeyInfoByAddress,
|
|
451
|
-
getKeyInfoByNameOrAddress,
|
|
452
|
-
selectAccount,
|
|
453
|
-
setPassword,
|
|
454
|
-
getActiveAccount,
|
|
455
|
-
queryAccount,
|
|
456
|
-
deleteAccount,
|
|
457
|
-
query,
|
|
458
|
-
render,
|
|
459
|
-
qEval,
|
|
460
|
-
call,
|
|
461
|
-
send,
|
|
462
|
-
addressToBech32,
|
|
463
|
-
addressFromBech32,
|
|
464
|
-
// debug
|
|
465
|
-
hello,
|
|
466
|
-
helloStream,
|
|
46
|
+
gnonative: api,
|
|
467
47
|
};
|
|
468
48
|
|
|
469
49
|
if (!initialized) {
|
package/build/hooks/types.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { KeyInfo } from '@buf/gnolang_gnonative.bufbuild_es/gnonativetypes_pb';
|
|
2
|
-
export type GnoConfig = {
|
|
3
|
-
Remote: string;
|
|
4
|
-
ChainID: string;
|
|
5
|
-
KeyName: string;
|
|
6
|
-
Password: string;
|
|
7
|
-
GasFee: string;
|
|
8
|
-
GasWanted: number;
|
|
9
|
-
Mnemonic: string;
|
|
10
|
-
};
|
|
11
|
-
export type NetworkMetainfo = {
|
|
12
|
-
chainId: string;
|
|
13
|
-
chainName: string;
|
|
14
|
-
gnoAddress: string;
|
|
15
|
-
};
|
|
16
|
-
export type GnoAccount = KeyInfo;
|
|
17
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/hooks/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,sDAAsD,CAAC;AAE/E,MAAM,MAAM,SAAS,GAAG;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,OAAO,CAAC"}
|
package/build/hooks/types.js
DELETED
package/build/hooks/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/hooks/types.ts"],"names":[],"mappings":"","sourcesContent":["import { KeyInfo } from '@buf/gnolang_gnonative.bufbuild_es/gnonativetypes_pb';\n\nexport type GnoConfig = {\n Remote: string;\n ChainID: string;\n KeyName: string;\n Password: string;\n GasFee: string;\n GasWanted: number;\n Mnemonic: string;\n};\n\nexport type NetworkMetainfo = {\n chainId: string;\n chainName: string;\n gnoAddress: string;\n};\n\nexport type GnoAccount = KeyInfo;\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-gno.d.ts","sourceRoot":"","sources":["../../src/hooks/use-gno.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,YAAY,EAGZ,qBAAqB,EAGrB,wBAAwB,EAUxB,mBAAmB,EAMnB,oBAAoB,EA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