@gnolang/gnonative 1.2.2 → 1.3.1

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 (62) hide show
  1. package/README.md +6 -6
  2. package/android/libs/gnocore.aar +0 -0
  3. package/build/api/GnoNativeApi.d.ts +50 -0
  4. package/build/api/GnoNativeApi.d.ts.map +1 -0
  5. package/build/api/GnoNativeApi.js +261 -0
  6. package/build/api/GnoNativeApi.js.map +1 -0
  7. package/build/api/index.d.ts +3 -0
  8. package/build/api/index.d.ts.map +1 -0
  9. package/build/api/index.js +3 -0
  10. package/build/api/index.js.map +1 -0
  11. package/build/{hooks/use-gno.d.ts → api/types.d.ts} +18 -13
  12. package/build/api/types.d.ts.map +1 -0
  13. package/build/api/types.js +7 -0
  14. package/build/api/types.js.map +1 -0
  15. package/build/index.d.ts +1 -1
  16. package/build/index.d.ts.map +1 -1
  17. package/build/index.js +1 -1
  18. package/build/index.js.map +1 -1
  19. package/build/provider/gnonative-provider.d.ts +4 -35
  20. package/build/provider/gnonative-provider.d.ts.map +1 -1
  21. package/build/provider/gnonative-provider.js +5 -249
  22. package/build/provider/gnonative-provider.js.map +1 -1
  23. package/ios/Frameworks/GnoCore.xcframework/Info.plist +5 -5
  24. package/ios/Frameworks/GnoCore.xcframework/ios-arm64/GnoCore.framework/GnoCore +0 -0
  25. package/ios/Frameworks/GnoCore.xcframework/ios-arm64/GnoCore.framework/Versions/A/GnoCore +0 -0
  26. package/ios/Frameworks/GnoCore.xcframework/ios-arm64/GnoCore.framework/Versions/Current/GnoCore +0 -0
  27. package/package.json +1 -1
  28. package/src/api/GnoNativeApi.ts +388 -0
  29. package/src/api/index.ts +2 -0
  30. package/src/api/types.ts +78 -0
  31. package/src/index.ts +2 -1
  32. package/src/provider/gnonative-provider.tsx +8 -428
  33. package/build/hooks/types.d.ts +0 -17
  34. package/build/hooks/types.d.ts.map +0 -1
  35. package/build/hooks/types.js +0 -2
  36. package/build/hooks/types.js.map +0 -1
  37. package/build/hooks/use-gno.d.ts.map +0 -1
  38. package/build/hooks/use-gno.js +0 -256
  39. package/build/hooks/use-gno.js.map +0 -1
  40. package/ios/Frameworks/GnoCore.xcframework/ios-arm64_x86_64-simulator/GnoCore.framework/GnoCore +0 -0
  41. package/ios/Frameworks/GnoCore.xcframework/ios-arm64_x86_64-simulator/GnoCore.framework/Headers/GnoCore.h +0 -13
  42. package/ios/Frameworks/GnoCore.xcframework/ios-arm64_x86_64-simulator/GnoCore.framework/Headers/GnoGnonative.objc.h +0 -93
  43. package/ios/Frameworks/GnoCore.xcframework/ios-arm64_x86_64-simulator/GnoCore.framework/Headers/Universe.objc.h +0 -29
  44. package/ios/Frameworks/GnoCore.xcframework/ios-arm64_x86_64-simulator/GnoCore.framework/Headers/ref.h +0 -35
  45. package/ios/Frameworks/GnoCore.xcframework/ios-arm64_x86_64-simulator/GnoCore.framework/Modules/module.modulemap +0 -8
  46. package/ios/Frameworks/GnoCore.xcframework/ios-arm64_x86_64-simulator/GnoCore.framework/Resources/Info.plist +0 -6
  47. package/ios/Frameworks/GnoCore.xcframework/ios-arm64_x86_64-simulator/GnoCore.framework/Versions/A/GnoCore +0 -0
  48. package/ios/Frameworks/GnoCore.xcframework/ios-arm64_x86_64-simulator/GnoCore.framework/Versions/A/Headers/GnoCore.h +0 -13
  49. package/ios/Frameworks/GnoCore.xcframework/ios-arm64_x86_64-simulator/GnoCore.framework/Versions/A/Headers/GnoGnonative.objc.h +0 -93
  50. package/ios/Frameworks/GnoCore.xcframework/ios-arm64_x86_64-simulator/GnoCore.framework/Versions/A/Headers/Universe.objc.h +0 -29
  51. package/ios/Frameworks/GnoCore.xcframework/ios-arm64_x86_64-simulator/GnoCore.framework/Versions/A/Headers/ref.h +0 -35
  52. package/ios/Frameworks/GnoCore.xcframework/ios-arm64_x86_64-simulator/GnoCore.framework/Versions/A/Modules/module.modulemap +0 -8
  53. package/ios/Frameworks/GnoCore.xcframework/ios-arm64_x86_64-simulator/GnoCore.framework/Versions/A/Resources/Info.plist +0 -6
  54. package/ios/Frameworks/GnoCore.xcframework/ios-arm64_x86_64-simulator/GnoCore.framework/Versions/Current/GnoCore +0 -0
  55. package/ios/Frameworks/GnoCore.xcframework/ios-arm64_x86_64-simulator/GnoCore.framework/Versions/Current/Headers/GnoCore.h +0 -13
  56. package/ios/Frameworks/GnoCore.xcframework/ios-arm64_x86_64-simulator/GnoCore.framework/Versions/Current/Headers/GnoGnonative.objc.h +0 -93
  57. package/ios/Frameworks/GnoCore.xcframework/ios-arm64_x86_64-simulator/GnoCore.framework/Versions/Current/Headers/Universe.objc.h +0 -29
  58. package/ios/Frameworks/GnoCore.xcframework/ios-arm64_x86_64-simulator/GnoCore.framework/Versions/Current/Headers/ref.h +0 -35
  59. package/ios/Frameworks/GnoCore.xcframework/ios-arm64_x86_64-simulator/GnoCore.framework/Versions/Current/Modules/module.modulemap +0 -8
  60. package/ios/Frameworks/GnoCore.xcframework/ios-arm64_x86_64-simulator/GnoCore.framework/Versions/Current/Resources/Info.plist +0 -6
  61. package/src/hooks/types.ts +0 -19
  62. package/src/hooks/use-gno.ts +0 -431
@@ -1,256 +0,0 @@
1
- import { AddressFromBech32Request, AddressToBech32Request, CallRequest, CreateAccountRequest, DeleteAccountRequest, GenerateRecoveryPhraseRequest, GetActiveAccountRequest, GetChainIDRequest, GetKeyInfoByAddressRequest, GetKeyInfoByNameOrAddressRequest, GetKeyInfoByNameRequest, GetRemoteRequest, HasKeyByAddressRequest, HasKeyByNameOrAddressRequest, HasKeyByNameRequest, HelloRequest, ListKeyInfoRequest, MsgCall, MsgSend, QEvalRequest, QueryAccountRequest, QueryRequest, RenderRequest, SelectAccountRequest, SendRequest, SetChainIDRequest, SetPasswordRequest, SetRemoteRequest, } from '@buf/gnolang_gnonative.bufbuild_es/gnonativetypes_pb';
2
- import { GoBridge } from '../GoBridge';
3
- import * as Grpc from '../grpc/client';
4
- var Status;
5
- (function (Status) {
6
- Status[Status["Stopped"] = 0] = "Stopped";
7
- Status[Status["Starting"] = 1] = "Starting";
8
- Status[Status["Started"] = 2] = "Started";
9
- })(Status || (Status = {}));
10
- let clientInstance = undefined;
11
- let bridgeStatus = Status.Stopped;
12
- export const useGno = () => {
13
- const getClient = async () => {
14
- if (bridgeStatus === Status.Stopped) {
15
- await initBridge();
16
- }
17
- if (clientInstance)
18
- return clientInstance;
19
- console.log('Creating GRPC client instance...');
20
- const port = await GoBridge.getTcpPort();
21
- clientInstance = Grpc.createClient(port);
22
- console.log('Creating GRPC client instance... done.');
23
- // Set the initial configuration where it's different from the default.
24
- await clientInstance.setRemote(new SetRemoteRequest({ remote: 'gno.land:26657' }));
25
- await clientInstance.setChainID(new SetChainIDRequest({ chainId: 'portal-loop' }));
26
- return clientInstance;
27
- };
28
- const closeBridge = async () => {
29
- if (bridgeStatus !== Status.Stopped) {
30
- console.log('Closing bridge...');
31
- await GoBridge.closeBridge();
32
- console.log('Bridge closed.');
33
- bridgeStatus = Status.Stopped;
34
- clientInstance = undefined;
35
- }
36
- };
37
- const initBridge = async () => {
38
- if (bridgeStatus === Status.Stopped) {
39
- console.log('Initializing bridge...');
40
- bridgeStatus = Status.Starting;
41
- await GoBridge.initBridge();
42
- console.log('Bridge initialized.');
43
- bridgeStatus = Status.Started;
44
- }
45
- };
46
- const setRemote = async (remote) => {
47
- const client = await getClient();
48
- const response = await client.setRemote(new SetRemoteRequest({ remote }));
49
- return response;
50
- };
51
- const getRemote = async () => {
52
- const client = await getClient();
53
- const response = await client.getRemote(new GetRemoteRequest());
54
- return response.remote;
55
- };
56
- const setChainID = async (chainId) => {
57
- const client = await getClient();
58
- const response = await client.setChainID(new SetChainIDRequest({ chainId }));
59
- return response;
60
- };
61
- const getChainID = async () => {
62
- const client = await getClient();
63
- const response = await client.getChainID(new GetChainIDRequest());
64
- return response.chainId;
65
- };
66
- const createAccount = async (nameOrBech32, mnemonic, password) => {
67
- const client = await getClient();
68
- const reponse = await client.createAccount(new CreateAccountRequest({
69
- nameOrBech32,
70
- mnemonic,
71
- password,
72
- }));
73
- return reponse.key;
74
- };
75
- const generateRecoveryPhrase = async () => {
76
- const client = await getClient();
77
- const response = await client.generateRecoveryPhrase(new GenerateRecoveryPhraseRequest());
78
- return response.phrase;
79
- };
80
- const hasKeyByName = async (name) => {
81
- const client = await getClient();
82
- const response = await client.hasKeyByName(new HasKeyByNameRequest({ name }));
83
- return response.has;
84
- };
85
- const hasKeyByAddress = async (address) => {
86
- const client = await getClient();
87
- const response = await client.hasKeyByAddress(new HasKeyByAddressRequest({ address }));
88
- return response.has;
89
- };
90
- const hasKeyByNameOrAddress = async (nameOrBech32) => {
91
- const client = await getClient();
92
- const response = await client.hasKeyByNameOrAddress(new HasKeyByNameOrAddressRequest({ nameOrBech32 }));
93
- return response.has;
94
- };
95
- const getKeyInfoByName = async (name) => {
96
- const client = await getClient();
97
- const response = await client.getKeyInfoByName(new GetKeyInfoByNameRequest({ name }));
98
- return response.key;
99
- };
100
- const getKeyInfoByAddress = async (address) => {
101
- const client = await getClient();
102
- const response = await client.getKeyInfoByAddress(new GetKeyInfoByAddressRequest({ address }));
103
- return response.key;
104
- };
105
- const getKeyInfoByNameOrAddress = async (nameOrBech32) => {
106
- const client = await getClient();
107
- const response = await client.getKeyInfoByNameOrAddress(new GetKeyInfoByNameOrAddressRequest({ nameOrBech32 }));
108
- return response.key;
109
- };
110
- const listKeyInfo = async () => {
111
- const client = await getClient();
112
- const response = await client.listKeyInfo(new ListKeyInfoRequest());
113
- return response.keys;
114
- };
115
- const selectAccount = async (nameOrBech32) => {
116
- const client = await getClient();
117
- const response = await client.selectAccount(new SelectAccountRequest({
118
- nameOrBech32,
119
- }));
120
- return response;
121
- };
122
- const setPassword = async (password) => {
123
- const client = await getClient();
124
- const response = await client.setPassword(new SetPasswordRequest({ password }));
125
- return response;
126
- };
127
- const getActiveAccount = async () => {
128
- const client = await getClient();
129
- const response = await client.getActiveAccount(new GetActiveAccountRequest());
130
- return response;
131
- };
132
- const queryAccount = async (address) => {
133
- const client = await getClient();
134
- const reponse = await client.queryAccount(new QueryAccountRequest({ address }));
135
- return reponse;
136
- };
137
- const deleteAccount = async (nameOrBech32, password, skipPassword) => {
138
- const client = await getClient();
139
- const response = await client.deleteAccount(new DeleteAccountRequest({
140
- nameOrBech32,
141
- password,
142
- skipPassword,
143
- }));
144
- return response;
145
- };
146
- const query = async (path, data) => {
147
- const client = await getClient();
148
- const reponse = await client.query(new QueryRequest({
149
- path,
150
- data,
151
- }));
152
- return reponse;
153
- };
154
- const render = async (packagePath, args) => {
155
- const client = await getClient();
156
- const reponse = await client.render(new RenderRequest({
157
- packagePath,
158
- args,
159
- }));
160
- return reponse.result;
161
- };
162
- const qEval = async (packagePath, expression) => {
163
- const client = await getClient();
164
- const reponse = await client.qEval(new QEvalRequest({
165
- packagePath,
166
- expression,
167
- }));
168
- return reponse.result;
169
- };
170
- const call = async (packagePath, fnc, args, gasFee, gasWanted, send, memo) => {
171
- const client = await getClient();
172
- const reponse = client.call(new CallRequest({
173
- gasFee,
174
- gasWanted: BigInt(gasWanted),
175
- memo,
176
- msgs: [
177
- new MsgCall({
178
- packagePath,
179
- fnc,
180
- args,
181
- send,
182
- }),
183
- ],
184
- }));
185
- return reponse;
186
- };
187
- const send = async (toAddress, send, gasFee, gasWanted, memo) => {
188
- const client = await getClient();
189
- const reponse = client.send(new SendRequest({
190
- gasFee,
191
- gasWanted: BigInt(gasWanted),
192
- memo,
193
- msgs: [
194
- new MsgSend({
195
- toAddress,
196
- send,
197
- }),
198
- ],
199
- }));
200
- return reponse;
201
- };
202
- const addressToBech32 = async (address) => {
203
- const client = await getClient();
204
- const response = await client.addressToBech32(new AddressToBech32Request({ address }));
205
- return response.bech32Address;
206
- };
207
- const addressFromBech32 = async (bech32Address) => {
208
- const client = await getClient();
209
- const response = await client.addressFromBech32(new AddressFromBech32Request({ bech32Address }));
210
- return response.address;
211
- };
212
- // debug
213
- const hello = async (name) => {
214
- const client = await getClient();
215
- const response = await client.hello(new HelloRequest({ name }));
216
- return response.greeting;
217
- };
218
- // debug
219
- const helloStream = async (name) => {
220
- const client = await getClient();
221
- return client.helloStream(new HelloRequest({ name }));
222
- };
223
- return {
224
- initBridge,
225
- closeBridge,
226
- setRemote,
227
- getRemote,
228
- setChainID,
229
- getChainID,
230
- createAccount,
231
- generateRecoveryPhrase,
232
- listKeyInfo,
233
- hasKeyByName,
234
- hasKeyByAddress,
235
- hasKeyByNameOrAddress,
236
- getKeyInfoByName,
237
- getKeyInfoByAddress,
238
- getKeyInfoByNameOrAddress,
239
- selectAccount,
240
- setPassword,
241
- getActiveAccount,
242
- queryAccount,
243
- deleteAccount,
244
- query,
245
- render,
246
- qEval,
247
- call,
248
- send,
249
- addressToBech32,
250
- addressFromBech32,
251
- // debug
252
- hello,
253
- helloStream,
254
- };
255
- };
256
- //# sourceMappingURL=use-gno.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-gno.js","sourceRoot":"","sources":["../../src/hooks/use-gno.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,sBAAsB,EACtB,WAAW,EAEX,oBAAoB,EACpB,oBAAoB,EAEpB,6BAA6B,EAC7B,uBAAuB,EAEvB,iBAAiB,EACjB,0BAA0B,EAC1B,gCAAgC,EAChC,uBAAuB,EACvB,gBAAgB,EAChB,sBAAsB,EACtB,4BAA4B,EAC5B,mBAAmB,EACnB,YAAY,EAEZ,kBAAkB,EAClB,OAAO,EACP,OAAO,EACP,YAAY,EACZ,mBAAmB,EAEnB,YAAY,EAEZ,aAAa,EACb,oBAAoB,EAEpB,WAAW,EAEX,iBAAiB,EAEjB,kBAAkB,EAElB,gBAAgB,GAEjB,MAAM,sDAAsD,CAAC;AAK9D,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAC;AAyDvC,IAAK,MAIJ;AAJD,WAAK,MAAM;IACT,yCAAO,CAAA;IACP,2CAAQ,CAAA;IACR,y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K,GAAG,KAAK,EAAE,IAAY,EAAE,EAAE;QACnC,MAAM,MAAM,GAAG,MAAM,SAAS,EAAE,CAAC;QACjC,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,IAAI,YAAY,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QAChE,OAAO,QAAQ,CAAC,QAAQ,CAAC;IAC3B,CAAC,CAAC;IAEF,QAAQ;IACR,MAAM,WAAW,GAAG,KAAK,EAAE,IAAY,EAAE,EAAE;QACzC,MAAM,MAAM,GAAG,MAAM,SAAS,EAAE,CAAC;QACjC,OAAO,MAAM,CAAC,WAAW,CAAC,IAAI,YAAY,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IACxD,CAAC,CAAC;IAEF,OAAO;QACL,UAAU;QACV,WAAW;QACX,SAAS;QACT,SAAS;QACT,UAAU;QACV,UAAU;QACV,aAAa;QACb,sBAAsB;QACtB,WAAW;QACX,YAAY;QACZ,eAAe;QACf,qBAAqB;QACrB,gBAAgB;QAChB,mBAAmB;QACnB,yBAAyB;QACzB,aAAa;QACb,WAAW;QACX,gBAAgB;QAChB,YAAY;QACZ,aAAa;QACb,KAAK;QACL,MAAM;QACN,KAAK;QACL,IAAI;QACJ,IAAI;QACJ,eAAe;QACf,iBAAiB;QACjB,QAAQ;QACR,KAAK;QACL,WAAW;KACZ,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import {\n AddressFromBech32Request,\n AddressToBech32Request,\n CallRequest,\n CallResponse,\n CreateAccountRequest,\n DeleteAccountRequest,\n DeleteAccountResponse,\n GenerateRecoveryPhraseRequest,\n GetActiveAccountRequest,\n GetActiveAccountResponse,\n GetChainIDRequest,\n GetKeyInfoByAddressRequest,\n GetKeyInfoByNameOrAddressRequest,\n GetKeyInfoByNameRequest,\n GetRemoteRequest,\n HasKeyByAddressRequest,\n HasKeyByNameOrAddressRequest,\n HasKeyByNameRequest,\n HelloRequest,\n HelloStreamResponse,\n ListKeyInfoRequest,\n MsgCall,\n MsgSend,\n QEvalRequest,\n QueryAccountRequest,\n QueryAccountResponse,\n QueryRequest,\n QueryResponse,\n RenderRequest,\n SelectAccountRequest,\n SelectAccountResponse,\n SendRequest,\n SendResponse,\n SetChainIDRequest,\n SetChainIDResponse,\n SetPasswordRequest,\n SetPasswordResponse,\n SetRemoteRequest,\n SetRemoteResponse,\n} from '@buf/gnolang_gnonative.bufbuild_es/gnonativetypes_pb';\nimport { GnoNativeService } from '@buf/gnolang_gnonative.connectrpc_es/rpc_connect';\nimport { PromiseClient } from '@connectrpc/connect';\n\nimport { GnoAccount } from './types';\nimport { GoBridge } from '../GoBridge';\nimport * as Grpc from '../grpc/client';\n\nexport interface GnoResponse {\n setRemote: (remote: string) => Promise<SetRemoteResponse>;\n getRemote: () => Promise<string>;\n setChainID: (chainId: string) => Promise<SetChainIDResponse>;\n getChainID: () => Promise<string>;\n createAccount: (\n nameOrBech32: string,\n mnemonic: string,\n password: string,\n ) => Promise<GnoAccount | undefined>;\n generateRecoveryPhrase: () => Promise<string>;\n listKeyInfo: () => Promise<GnoAccount[]>;\n hasKeyByName: (name: string) => Promise<boolean>;\n hasKeyByAddress: (address: Uint8Array) => Promise<boolean>;\n hasKeyByNameOrAddress: (nameOrBech32: string) => Promise<boolean>;\n getKeyInfoByName: (name: string) => Promise<GnoAccount | undefined>;\n getKeyInfoByAddress: (address: Uint8Array) => Promise<GnoAccount | undefined>;\n getKeyInfoByNameOrAddress: (nameOrBech32: string) => Promise<GnoAccount | undefined>;\n selectAccount: (nameOrBech32: string) => Promise<SelectAccountResponse>;\n setPassword: (password: string) => Promise<SetPasswordResponse>;\n getActiveAccount: () => Promise<GetActiveAccountResponse>;\n queryAccount: (address: Uint8Array) => Promise<QueryAccountResponse>;\n deleteAccount: (\n nameOrBech32: string,\n password: string | undefined,\n skipPassword: boolean,\n ) => Promise<DeleteAccountResponse>;\n query: (path: string, data: Uint8Array) => Promise<QueryResponse>;\n render: (packagePath: string, args: string) => Promise<string>;\n qEval: (packagePath: string, expression: string) => Promise<string>;\n call: (\n packagePath: string,\n fnc: string,\n args: Array<string>,\n gasFee: string,\n gasWanted: number,\n send?: string,\n memo?: string,\n ) => Promise<AsyncIterable<CallResponse>>;\n send: (\n toAddress: Uint8Array,\n send: string,\n gasFee: string,\n gasWanted: number,\n memo?: string,\n ) => Promise<AsyncIterable<SendResponse>>;\n addressToBech32: (address: Uint8Array) => Promise<string>;\n addressFromBech32: (bech32Address: string) => Promise<Uint8Array>;\n closeBridge: () => Promise<void>;\n initBridge: () => Promise<void>;\n // debug\n hello: (name: string) => Promise<string>;\n helloStream: (name: string) => Promise<AsyncIterable<HelloStreamResponse>>;\n}\n\nenum Status {\n Stopped,\n Starting,\n Started,\n}\n\nlet clientInstance: PromiseClient<typeof GnoNativeService> | undefined = undefined;\nlet bridgeStatus: Status = Status.Stopped;\n\nexport const useGno = (): GnoResponse => {\n const getClient = async () => {\n if (bridgeStatus === Status.Stopped) {\n await initBridge();\n }\n\n if (clientInstance) return clientInstance;\n\n console.log('Creating GRPC client instance...');\n\n const port = await GoBridge.getTcpPort();\n clientInstance = Grpc.createClient(port);\n\n console.log('Creating GRPC client instance... done.');\n\n // Set the initial configuration where it's different from the default.\n await clientInstance.setRemote(new SetRemoteRequest({ remote: 'gno.land:26657' }));\n await clientInstance.setChainID(new SetChainIDRequest({ chainId: 'portal-loop' }));\n\n return clientInstance;\n };\n\n const closeBridge = async () => {\n if (bridgeStatus !== Status.Stopped) {\n console.log('Closing bridge...');\n await GoBridge.closeBridge();\n console.log('Bridge closed.');\n bridgeStatus = Status.Stopped;\n clientInstance = undefined;\n }\n };\n\n const initBridge = async () => {\n if (bridgeStatus === Status.Stopped) {\n console.log('Initializing bridge...');\n bridgeStatus = Status.Starting;\n await GoBridge.initBridge();\n console.log('Bridge initialized.');\n bridgeStatus = Status.Started;\n }\n };\n\n const setRemote = async (remote: string) => {\n const client = await getClient();\n const response = await client.setRemote(new SetRemoteRequest({ remote }));\n return response;\n };\n\n const getRemote = async () => {\n const client = await getClient();\n const response = await client.getRemote(new GetRemoteRequest());\n return response.remote;\n };\n\n const setChainID = async (chainId: string) => {\n const client = await getClient();\n const response = await client.setChainID(new SetChainIDRequest({ chainId }));\n return response;\n };\n\n const getChainID = async () => {\n const client = await getClient();\n const response = await client.getChainID(new GetChainIDRequest());\n return response.chainId;\n };\n\n const createAccount = async (nameOrBech32: string, mnemonic: string, password: string) => {\n const client = await getClient();\n const reponse = await client.createAccount(\n new CreateAccountRequest({\n nameOrBech32,\n mnemonic,\n password,\n }),\n );\n return reponse.key;\n };\n\n const generateRecoveryPhrase = async () => {\n const client = await getClient();\n const response = await client.generateRecoveryPhrase(new GenerateRecoveryPhraseRequest());\n return response.phrase;\n };\n\n const hasKeyByName = async (name: string) => {\n const client = await getClient();\n const response = await client.hasKeyByName(new HasKeyByNameRequest({ name }));\n return response.has;\n };\n\n const hasKeyByAddress = async (address: Uint8Array) => {\n const client = await getClient();\n const response = await client.hasKeyByAddress(new HasKeyByAddressRequest({ address }));\n return response.has;\n };\n\n const hasKeyByNameOrAddress = async (nameOrBech32: string) => {\n const client = await getClient();\n const response = await client.hasKeyByNameOrAddress(\n new HasKeyByNameOrAddressRequest({ nameOrBech32 }),\n );\n return response.has;\n };\n\n const getKeyInfoByName = async (name: string) => {\n const client = await getClient();\n const response = await client.getKeyInfoByName(new GetKeyInfoByNameRequest({ name }));\n return response.key;\n };\n\n const getKeyInfoByAddress = async (address: Uint8Array) => {\n const client = await getClient();\n const response = await client.getKeyInfoByAddress(new GetKeyInfoByAddressRequest({ address }));\n return response.key;\n };\n\n const getKeyInfoByNameOrAddress = async (nameOrBech32: string) => {\n const client = await getClient();\n const response = await client.getKeyInfoByNameOrAddress(\n new GetKeyInfoByNameOrAddressRequest({ nameOrBech32 }),\n );\n return response.key;\n };\n\n const listKeyInfo = async () => {\n const client = await getClient();\n const response = await client.listKeyInfo(new ListKeyInfoRequest());\n return response.keys;\n };\n\n const selectAccount = async (nameOrBech32: string) => {\n const client = await getClient();\n const response = await client.selectAccount(\n new SelectAccountRequest({\n nameOrBech32,\n }),\n );\n return response;\n };\n\n const setPassword = async (password: string) => {\n const client = await getClient();\n const response = await client.setPassword(new SetPasswordRequest({ password }));\n return response;\n };\n\n const getActiveAccount = async () => {\n const client = await getClient();\n const response = await client.getActiveAccount(new GetActiveAccountRequest());\n return response;\n };\n\n const queryAccount = async (address: Uint8Array) => {\n const client = await getClient();\n const reponse = await client.queryAccount(new QueryAccountRequest({ address }));\n return reponse;\n };\n\n const deleteAccount = async (\n nameOrBech32: string,\n password: string | undefined,\n skipPassword: boolean,\n ) => {\n const client = await getClient();\n const response = await client.deleteAccount(\n new DeleteAccountRequest({\n nameOrBech32,\n password,\n skipPassword,\n }),\n );\n return response;\n };\n\n const query = async (path: string, data: Uint8Array) => {\n const client = await getClient();\n const reponse = await client.query(\n new QueryRequest({\n path,\n data,\n }),\n );\n return reponse;\n };\n\n const render = async (packagePath: string, args: string) => {\n const client = await getClient();\n const reponse = await client.render(\n new RenderRequest({\n packagePath,\n args,\n }),\n );\n return reponse.result;\n };\n\n const qEval = async (packagePath: string, expression: string) => {\n const client = await getClient();\n const reponse = await client.qEval(\n new QEvalRequest({\n packagePath,\n expression,\n }),\n );\n return reponse.result;\n };\n\n const call = async (\n packagePath: string,\n fnc: string,\n args: Array<string>,\n gasFee: string,\n gasWanted: number,\n send?: string,\n memo?: string,\n ) => {\n const client = await getClient();\n const reponse = client.call(\n new CallRequest({\n gasFee,\n gasWanted: BigInt(gasWanted),\n memo,\n msgs: [\n new MsgCall({\n packagePath,\n fnc,\n args,\n send,\n }),\n ],\n }),\n );\n return reponse;\n };\n\n const send = async (\n toAddress: Uint8Array,\n send: string,\n gasFee: string,\n gasWanted: number,\n memo?: string,\n ) => {\n const client = await getClient();\n const reponse = client.send(\n new SendRequest({\n gasFee,\n gasWanted: BigInt(gasWanted),\n memo,\n msgs: [\n new MsgSend({\n toAddress,\n send,\n }),\n ],\n }),\n );\n return reponse;\n };\n\n const addressToBech32 = async (address: Uint8Array) => {\n const client = await getClient();\n const response = await client.addressToBech32(new AddressToBech32Request({ address }));\n return response.bech32Address;\n };\n\n const addressFromBech32 = async (bech32Address: string) => {\n const client = await getClient();\n const response = await client.addressFromBech32(\n new AddressFromBech32Request({ bech32Address }),\n );\n return response.address;\n };\n\n // debug\n const hello = async (name: string) => {\n const client = await getClient();\n const response = await client.hello(new HelloRequest({ name }));\n return response.greeting;\n };\n\n // debug\n const helloStream = async (name: string) => {\n const client = await getClient();\n return client.helloStream(new HelloRequest({ name }));\n };\n\n return {\n initBridge,\n closeBridge,\n setRemote,\n getRemote,\n setChainID,\n getChainID,\n createAccount,\n generateRecoveryPhrase,\n listKeyInfo,\n hasKeyByName,\n hasKeyByAddress,\n hasKeyByNameOrAddress,\n getKeyInfoByName,\n getKeyInfoByAddress,\n getKeyInfoByNameOrAddress,\n selectAccount,\n setPassword,\n getActiveAccount,\n queryAccount,\n deleteAccount,\n query,\n render,\n qEval,\n call,\n send,\n addressToBech32,\n addressFromBech32,\n // debug\n hello,\n helloStream,\n };\n};\n"]}
@@ -1,13 +0,0 @@
1
-
2
- // Objective-C API for talking to the following Go packages
3
- //
4
- // github.com/gnolang/gnonative/framework/service
5
- //
6
- // File is generated by gomobile bind. Do not edit.
7
- #ifndef __GnoCore_FRAMEWORK_H__
8
- #define __GnoCore_FRAMEWORK_H__
9
-
10
- #include "GnoGnonative.objc.h"
11
- #include "Universe.objc.h"
12
-
13
- #endif
@@ -1,93 +0,0 @@
1
- // Objective-C API for talking to github.com/gnolang/gnonative/framework/service Go package.
2
- // gobind -lang=objc -prefix="Gno" github.com/gnolang/gnonative/framework/service
3
- //
4
- // File is generated by gobind. Do not edit.
5
-
6
- #ifndef __GnoGnonative_H__
7
- #define __GnoGnonative_H__
8
-
9
- @import Foundation;
10
- #include "ref.h"
11
- #include "Universe.objc.h"
12
-
13
-
14
- @class GnoGnonativeBridge;
15
- @class GnoGnonativeBridgeConfig;
16
- @protocol GnoGnonativePromiseBlock;
17
- @class GnoGnonativePromiseBlock;
18
- @protocol GnoGnonativeServiceClient;
19
- @class GnoGnonativeServiceClient;
20
-
21
- @protocol GnoGnonativePromiseBlock <NSObject>
22
- - (void)callReject:(NSError* _Nullable)error;
23
- - (void)callResolve:(NSString* _Nullable)reply;
24
- @end
25
-
26
- @protocol GnoGnonativeServiceClient <NSObject>
27
- - (void)closeStreamClientWithPromiseBlock:(id<GnoGnonativePromiseBlock> _Nullable)promise id_:(NSString* _Nullable)id_;
28
- - (void)createStreamClientWithPromiseBlock:(id<GnoGnonativePromiseBlock> _Nullable)promise method:(NSString* _Nullable)method jsonMessage:(NSString* _Nullable)jsonMessage;
29
- - (void)invokeGrpcMethodWithPromiseBlock:(id<GnoGnonativePromiseBlock> _Nullable)promise method:(NSString* _Nullable)method jsonMessage:(NSString* _Nullable)jsonMessage;
30
- - (void)streamClientReceiveWithPromiseBlock:(id<GnoGnonativePromiseBlock> _Nullable)promise id_:(NSString* _Nullable)id_;
31
- @end
32
-
33
- @interface GnoGnonativeBridge : NSObject <goSeqRefInterface, GnoGnonativeServiceClient> {
34
- }
35
- @property(strong, readonly) _Nonnull id _ref;
36
-
37
- - (nonnull instancetype)initWithRef:(_Nonnull id)ref;
38
- - (nullable instancetype)init:(GnoGnonativeBridgeConfig* _Nullable)config;
39
- @property (nonatomic) id<GnoGnonativeServiceClient> _Nullable serviceClient;
40
- - (BOOL)close:(NSError* _Nullable* _Nullable)error;
41
- - (void)closeStreamClientWithPromiseBlock:(id<GnoGnonativePromiseBlock> _Nullable)promise id_:(NSString* _Nullable)id_;
42
- - (void)createStreamClientWithPromiseBlock:(id<GnoGnonativePromiseBlock> _Nullable)promise method:(NSString* _Nullable)method jsonMessage:(NSString* _Nullable)jsonMessage;
43
- - (NSString* _Nonnull)getTcpAddr;
44
- - (long)getTcpPort;
45
- - (NSString* _Nonnull)getUDSPath;
46
- - (void)invokeGrpcMethodWithPromiseBlock:(id<GnoGnonativePromiseBlock> _Nullable)promise method:(NSString* _Nullable)method jsonMessage:(NSString* _Nullable)jsonMessage;
47
- - (void)streamClientReceiveWithPromiseBlock:(id<GnoGnonativePromiseBlock> _Nullable)promise id_:(NSString* _Nullable)id_;
48
- @end
49
-
50
- @interface GnoGnonativeBridgeConfig : NSObject <goSeqRefInterface> {
51
- }
52
- @property(strong, readonly) _Nonnull id _ref;
53
-
54
- - (nonnull instancetype)initWithRef:(_Nonnull id)ref;
55
- - (nullable instancetype)init;
56
- @property (nonatomic) NSString* _Nonnull rootDir;
57
- @property (nonatomic) NSString* _Nonnull tmpDir;
58
- @property (nonatomic) BOOL useTcpListener;
59
- @property (nonatomic) BOOL disableUdsListener;
60
- @end
61
-
62
- FOUNDATION_EXPORT GnoGnonativeBridge* _Nullable GnoGnonativeNewBridge(GnoGnonativeBridgeConfig* _Nullable config, NSError* _Nullable* _Nullable error);
63
-
64
- FOUNDATION_EXPORT GnoGnonativeBridgeConfig* _Nullable GnoGnonativeNewBridgeConfig(void);
65
-
66
- // skipped function NewServiceClient with unsupported parameter or return types
67
-
68
-
69
- @class GnoGnonativePromiseBlock;
70
-
71
- @class GnoGnonativeServiceClient;
72
-
73
- @interface GnoGnonativePromiseBlock : NSObject <goSeqRefInterface, GnoGnonativePromiseBlock> {
74
- }
75
- @property(strong, readonly) _Nonnull id _ref;
76
-
77
- - (nonnull instancetype)initWithRef:(_Nonnull id)ref;
78
- - (void)callReject:(NSError* _Nullable)error;
79
- - (void)callResolve:(NSString* _Nullable)reply;
80
- @end
81
-
82
- @interface GnoGnonativeServiceClient : NSObject <goSeqRefInterface, GnoGnonativeServiceClient> {
83
- }
84
- @property(strong, readonly) _Nonnull id _ref;
85
-
86
- - (nonnull instancetype)initWithRef:(_Nonnull id)ref;
87
- - (void)closeStreamClientWithPromiseBlock:(id<GnoGnonativePromiseBlock> _Nullable)promise id_:(NSString* _Nullable)id_;
88
- - (void)createStreamClientWithPromiseBlock:(id<GnoGnonativePromiseBlock> _Nullable)promise method:(NSString* _Nullable)method jsonMessage:(NSString* _Nullable)jsonMessage;
89
- - (void)invokeGrpcMethodWithPromiseBlock:(id<GnoGnonativePromiseBlock> _Nullable)promise method:(NSString* _Nullable)method jsonMessage:(NSString* _Nullable)jsonMessage;
90
- - (void)streamClientReceiveWithPromiseBlock:(id<GnoGnonativePromiseBlock> _Nullable)promise id_:(NSString* _Nullable)id_;
91
- @end
92
-
93
- #endif
@@ -1,29 +0,0 @@
1
- // Objective-C API for talking to Go package.
2
- // gobind -lang=objc -prefix="Gno"
3
- //
4
- // File is generated by gobind. Do not edit.
5
-
6
- #ifndef __Universe_H__
7
- #define __Universe_H__
8
-
9
- @import Foundation;
10
- #include "ref.h"
11
-
12
- @protocol Universeerror;
13
- @class Universeerror;
14
-
15
- @protocol Universeerror <NSObject>
16
- - (NSString* _Nonnull)error;
17
- @end
18
-
19
- @class Universeerror;
20
-
21
- @interface Universeerror : NSError <goSeqRefInterface, Universeerror> {
22
- }
23
- @property(strong, readonly) _Nonnull id _ref;
24
-
25
- - (nonnull instancetype)initWithRef:(_Nonnull id)ref;
26
- - (NSString* _Nonnull)error;
27
- @end
28
-
29
- #endif
@@ -1,35 +0,0 @@
1
- // Copyright 2015 The Go Authors. All rights reserved.
2
- // Use of this source code is governed by a BSD-style
3
- // license that can be found in the LICENSE file.
4
-
5
- #ifndef __GO_REF_HDR__
6
- #define __GO_REF_HDR__
7
-
8
- #include <Foundation/Foundation.h>
9
-
10
- // GoSeqRef is an object tagged with an integer for passing back and
11
- // forth across the language boundary. A GoSeqRef may represent either
12
- // an instance of a Go object, or an Objective-C object passed to Go.
13
- // The explicit allocation of a GoSeqRef is used to pin a Go object
14
- // when it is passed to Objective-C. The Go seq package maintains a
15
- // reference to the Go object in a map keyed by the refnum along with
16
- // a reference count. When the reference count reaches zero, the Go
17
- // seq package will clear the corresponding entry in the map.
18
- @interface GoSeqRef : NSObject {
19
- }
20
- @property(readonly) int32_t refnum;
21
- @property(strong) id obj; // NULL when representing a Go object.
22
-
23
- // new GoSeqRef object to proxy a Go object. The refnum must be
24
- // provided from Go side.
25
- - (instancetype)initWithRefnum:(int32_t)refnum obj:(id)obj;
26
-
27
- - (int32_t)incNum;
28
-
29
- @end
30
-
31
- @protocol goSeqRefInterface
32
- -(GoSeqRef*) _ref;
33
- @end
34
-
35
- #endif
@@ -1,8 +0,0 @@
1
- framework module "GnoCore" {
2
- header "ref.h"
3
- header "GnoGnonative.objc.h"
4
- header "Universe.objc.h"
5
- header "GnoCore.h"
6
-
7
- export *
8
- }
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
- <plist version="1.0">
4
- <dict>
5
- </dict>
6
- </plist>
@@ -1,13 +0,0 @@
1
-
2
- // Objective-C API for talking to the following Go packages
3
- //
4
- // github.com/gnolang/gnonative/framework/service
5
- //
6
- // File is generated by gomobile bind. Do not edit.
7
- #ifndef __GnoCore_FRAMEWORK_H__
8
- #define __GnoCore_FRAMEWORK_H__
9
-
10
- #include "GnoGnonative.objc.h"
11
- #include "Universe.objc.h"
12
-
13
- #endif
@@ -1,93 +0,0 @@
1
- // Objective-C API for talking to github.com/gnolang/gnonative/framework/service Go package.
2
- // gobind -lang=objc -prefix="Gno" github.com/gnolang/gnonative/framework/service
3
- //
4
- // File is generated by gobind. Do not edit.
5
-
6
- #ifndef __GnoGnonative_H__
7
- #define __GnoGnonative_H__
8
-
9
- @import Foundation;
10
- #include "ref.h"
11
- #include "Universe.objc.h"
12
-
13
-
14
- @class GnoGnonativeBridge;
15
- @class GnoGnonativeBridgeConfig;
16
- @protocol GnoGnonativePromiseBlock;
17
- @class GnoGnonativePromiseBlock;
18
- @protocol GnoGnonativeServiceClient;
19
- @class GnoGnonativeServiceClient;
20
-
21
- @protocol GnoGnonativePromiseBlock <NSObject>
22
- - (void)callReject:(NSError* _Nullable)error;
23
- - (void)callResolve:(NSString* _Nullable)reply;
24
- @end
25
-
26
- @protocol GnoGnonativeServiceClient <NSObject>
27
- - (void)closeStreamClientWithPromiseBlock:(id<GnoGnonativePromiseBlock> _Nullable)promise id_:(NSString* _Nullable)id_;
28
- - (void)createStreamClientWithPromiseBlock:(id<GnoGnonativePromiseBlock> _Nullable)promise method:(NSString* _Nullable)method jsonMessage:(NSString* _Nullable)jsonMessage;
29
- - (void)invokeGrpcMethodWithPromiseBlock:(id<GnoGnonativePromiseBlock> _Nullable)promise method:(NSString* _Nullable)method jsonMessage:(NSString* _Nullable)jsonMessage;
30
- - (void)streamClientReceiveWithPromiseBlock:(id<GnoGnonativePromiseBlock> _Nullable)promise id_:(NSString* _Nullable)id_;
31
- @end
32
-
33
- @interface GnoGnonativeBridge : NSObject <goSeqRefInterface, GnoGnonativeServiceClient> {
34
- }
35
- @property(strong, readonly) _Nonnull id _ref;
36
-
37
- - (nonnull instancetype)initWithRef:(_Nonnull id)ref;
38
- - (nullable instancetype)init:(GnoGnonativeBridgeConfig* _Nullable)config;
39
- @property (nonatomic) id<GnoGnonativeServiceClient> _Nullable serviceClient;
40
- - (BOOL)close:(NSError* _Nullable* _Nullable)error;
41
- - (void)closeStreamClientWithPromiseBlock:(id<GnoGnonativePromiseBlock> _Nullable)promise id_:(NSString* _Nullable)id_;
42
- - (void)createStreamClientWithPromiseBlock:(id<GnoGnonativePromiseBlock> _Nullable)promise method:(NSString* _Nullable)method jsonMessage:(NSString* _Nullable)jsonMessage;
43
- - (NSString* _Nonnull)getTcpAddr;
44
- - (long)getTcpPort;
45
- - (NSString* _Nonnull)getUDSPath;
46
- - (void)invokeGrpcMethodWithPromiseBlock:(id<GnoGnonativePromiseBlock> _Nullable)promise method:(NSString* _Nullable)method jsonMessage:(NSString* _Nullable)jsonMessage;
47
- - (void)streamClientReceiveWithPromiseBlock:(id<GnoGnonativePromiseBlock> _Nullable)promise id_:(NSString* _Nullable)id_;
48
- @end
49
-
50
- @interface GnoGnonativeBridgeConfig : NSObject <goSeqRefInterface> {
51
- }
52
- @property(strong, readonly) _Nonnull id _ref;
53
-
54
- - (nonnull instancetype)initWithRef:(_Nonnull id)ref;
55
- - (nullable instancetype)init;
56
- @property (nonatomic) NSString* _Nonnull rootDir;
57
- @property (nonatomic) NSString* _Nonnull tmpDir;
58
- @property (nonatomic) BOOL useTcpListener;
59
- @property (nonatomic) BOOL disableUdsListener;
60
- @end
61
-
62
- FOUNDATION_EXPORT GnoGnonativeBridge* _Nullable GnoGnonativeNewBridge(GnoGnonativeBridgeConfig* _Nullable config, NSError* _Nullable* _Nullable error);
63
-
64
- FOUNDATION_EXPORT GnoGnonativeBridgeConfig* _Nullable GnoGnonativeNewBridgeConfig(void);
65
-
66
- // skipped function NewServiceClient with unsupported parameter or return types
67
-
68
-
69
- @class GnoGnonativePromiseBlock;
70
-
71
- @class GnoGnonativeServiceClient;
72
-
73
- @interface GnoGnonativePromiseBlock : NSObject <goSeqRefInterface, GnoGnonativePromiseBlock> {
74
- }
75
- @property(strong, readonly) _Nonnull id _ref;
76
-
77
- - (nonnull instancetype)initWithRef:(_Nonnull id)ref;
78
- - (void)callReject:(NSError* _Nullable)error;
79
- - (void)callResolve:(NSString* _Nullable)reply;
80
- @end
81
-
82
- @interface GnoGnonativeServiceClient : NSObject <goSeqRefInterface, GnoGnonativeServiceClient> {
83
- }
84
- @property(strong, readonly) _Nonnull id _ref;
85
-
86
- - (nonnull instancetype)initWithRef:(_Nonnull id)ref;
87
- - (void)closeStreamClientWithPromiseBlock:(id<GnoGnonativePromiseBlock> _Nullable)promise id_:(NSString* _Nullable)id_;
88
- - (void)createStreamClientWithPromiseBlock:(id<GnoGnonativePromiseBlock> _Nullable)promise method:(NSString* _Nullable)method jsonMessage:(NSString* _Nullable)jsonMessage;
89
- - (void)invokeGrpcMethodWithPromiseBlock:(id<GnoGnonativePromiseBlock> _Nullable)promise method:(NSString* _Nullable)method jsonMessage:(NSString* _Nullable)jsonMessage;
90
- - (void)streamClientReceiveWithPromiseBlock:(id<GnoGnonativePromiseBlock> _Nullable)promise id_:(NSString* _Nullable)id_;
91
- @end
92
-
93
- #endif
@@ -1,29 +0,0 @@
1
- // Objective-C API for talking to Go package.
2
- // gobind -lang=objc -prefix="Gno"
3
- //
4
- // File is generated by gobind. Do not edit.
5
-
6
- #ifndef __Universe_H__
7
- #define __Universe_H__
8
-
9
- @import Foundation;
10
- #include "ref.h"
11
-
12
- @protocol Universeerror;
13
- @class Universeerror;
14
-
15
- @protocol Universeerror <NSObject>
16
- - (NSString* _Nonnull)error;
17
- @end
18
-
19
- @class Universeerror;
20
-
21
- @interface Universeerror : NSError <goSeqRefInterface, Universeerror> {
22
- }
23
- @property(strong, readonly) _Nonnull id _ref;
24
-
25
- - (nonnull instancetype)initWithRef:(_Nonnull id)ref;
26
- - (NSString* _Nonnull)error;
27
- @end
28
-
29
- #endif