@gnolang/gnonative 1.3.1 → 1.4.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/android/libs/gnocore.aar +0 -0
- package/android/src/main/java/land/gno/gnonative/GnonativeModule.kt +11 -0
- package/build/api/GnoNativeApi.d.ts +1 -0
- package/build/api/GnoNativeApi.d.ts.map +1 -1
- package/build/api/GnoNativeApi.js +6 -1
- package/build/api/GnoNativeApi.js.map +1 -1
- package/build/api/types.d.ts +1 -0
- package/build/api/types.d.ts.map +1 -1
- package/build/api/types.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/Headers/GnoCore.h +13 -0
- package/ios/Frameworks/GnoCore.xcframework/ios-arm64_x86_64-simulator/GnoCore.framework/Headers/GnoGnonative.objc.h +93 -0
- package/ios/Frameworks/GnoCore.xcframework/ios-arm64_x86_64-simulator/GnoCore.framework/Headers/Universe.objc.h +29 -0
- package/ios/Frameworks/GnoCore.xcframework/ios-arm64_x86_64-simulator/GnoCore.framework/Headers/ref.h +35 -0
- package/ios/Frameworks/GnoCore.xcframework/ios-arm64_x86_64-simulator/GnoCore.framework/Modules/module.modulemap +8 -0
- package/ios/Frameworks/GnoCore.xcframework/ios-arm64_x86_64-simulator/GnoCore.framework/Resources/Info.plist +6 -0
- package/package.json +3 -3
- package/src/api/GnoNativeApi.ts +7 -0
- package/src/api/types.ts +1 -0
package/android/libs/gnocore.aar
CHANGED
|
Binary file
|
|
@@ -35,6 +35,17 @@ class GnonativeModule : Module() {
|
|
|
35
35
|
rootDir = context!!.filesDir
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
OnDestroy {
|
|
39
|
+
try {
|
|
40
|
+
if (bridgeGnoNative != null) {
|
|
41
|
+
bridgeGnoNative?.close()
|
|
42
|
+
bridgeGnoNative = null
|
|
43
|
+
}
|
|
44
|
+
} catch (err: Exception) {
|
|
45
|
+
Log.d("Error: OnDestroy", err.toString())
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
38
49
|
// Defines event names that the module can send to JavaScript.
|
|
39
50
|
Events("onChange")
|
|
40
51
|
|
|
@@ -36,6 +36,7 @@ export declare class GnoNativeApi implements GnoKeyApi, GoBridgeInterface {
|
|
|
36
36
|
call(packagePath: string, fnc: string, args: string[], gasFee: string, gasWanted: number, send?: string, memo?: string): Promise<AsyncIterable<CallResponse>>;
|
|
37
37
|
send(toAddress: Uint8Array, send: string, gasFee: string, gasWanted: number, memo?: string): Promise<AsyncIterable<SendResponse>>;
|
|
38
38
|
addressToBech32(address: Uint8Array): Promise<string>;
|
|
39
|
+
addressFromMnemonic(mnemonic: string): Promise<Uint8Array>;
|
|
39
40
|
addressFromBech32(bech32Address: string): Promise<Uint8Array>;
|
|
40
41
|
hello(name: string): Promise<string>;
|
|
41
42
|
helloStream(name: string): Promise<AsyncIterable<HelloStreamResponse>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GnoNativeApi.d.ts","sourceRoot":"","sources":["../../src/api/GnoNativeApi.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"GnoNativeApi.d.ts","sourceRoot":"","sources":["../../src/api/GnoNativeApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,YAAY,EAGZ,qBAAqB,EAGrB,wBAAwB,EAUxB,mBAAmB,EACnB,OAAO,EAMP,oBAAoB,EAEpB,aAAa,EAGb,qBAAqB,EAErB,YAAY,EAEZ,kBAAkB,EAElB,m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,aAAa,EAAE,MAAM;IASvC,KAAK,CAAC,IAAI,EAAE,MAAM;IAOlB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,mBAAmB,CAAC,CAAC;IAM5E,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAG3B,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAG5B,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC;IAG7B,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAGtE,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAGxE,mBAAmB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAGhD,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAG7C"}
|
|
@@ -1,4 +1,4 @@
|
|
|
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';
|
|
1
|
+
import { AddressFromBech32Request, AddressToBech32Request, AddressFromMnemonicRequest, 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
2
|
import { BridgeStatus } from './types';
|
|
3
3
|
import { GoBridge } from '../GoBridge';
|
|
4
4
|
import * as Grpc from '../grpc/client';
|
|
@@ -219,6 +219,11 @@ export class GnoNativeApi {
|
|
|
219
219
|
const response = await client.addressToBech32(new AddressToBech32Request({ address }));
|
|
220
220
|
return response.bech32Address;
|
|
221
221
|
}
|
|
222
|
+
async addressFromMnemonic(mnemonic) {
|
|
223
|
+
const client = await this.#getClient();
|
|
224
|
+
const response = await client.addressFromMnemonic(new AddressFromMnemonicRequest({ mnemonic }));
|
|
225
|
+
return response.address;
|
|
226
|
+
}
|
|
222
227
|
async addressFromBech32(bech32Address) {
|
|
223
228
|
const client = await this.#getClient();
|
|
224
229
|
const response = await client.addressFromBech32(new AddressFromBech32Request({ bech32Address }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GnoNativeApi.js","sourceRoot":"","sources":["../../src/api/GnoNativeApi.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,EAGZ,kBAAkB,EAClB,OAAO,EACP,OAAO,EACP,YAAY,EACZ,mBAAmB,EAEnB,YAAY,EAEZ,aAAa,EACb,oBAAoB,EAEpB,WAAW,EAEX,iBAAi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kBAAkB,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAC1D,CAAC;IACD,mBAAmB,CAAC,EAAU;QAC5B,OAAO,QAAQ,CAAC,mBAAmB,CAAC,EAAE,CAAC,CAAC;IAC1C,CAAC;IACD,iBAAiB,CAAC,EAAU;QAC1B,OAAO,QAAQ,CAAC,iBAAiB,CAAC,EAAE,CAAC,CAAC;IACxC,CAAC;CACF","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 KeyInfo,\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 { GnoKeyApi, BridgeStatus, Config } from './types';\nimport { GoBridge, GoBridgeInterface } from '../GoBridge';\nimport * as Grpc from '../grpc/client';\n\nexport class GnoNativeApi implements GnoKeyApi, GoBridgeInterface {\n bridgeStatus = BridgeStatus.Stopped;\n config: Config;\n clientInstance: PromiseClient<typeof GnoNativeService> | undefined;\n\n constructor(config: Config) {\n this.config = config;\n }\n\n async initClient() {\n if (this.bridgeStatus === BridgeStatus.Stopped) {\n console.log('Bridge stopped. Initializing...');\n await this.#initBridge();\n }\n\n if (this.clientInstance) {\n console.error('GoBridge already initialized.');\n return true;\n }\n\n const port = await GoBridge.getTcpPort();\n console.log('GoBridge GRPC client instance port: %s', port);\n const client = Grpc.createClient(port);\n this.clientInstance = client;\n console.log('GoBridge GRPC client instance. Done.');\n\n try {\n await this.clientInstance.setRemote(new SetRemoteRequest({ remote: this.config.remote }));\n await this.clientInstance.setChainID(\n new SetChainIDRequest({ chainId: this.config.chain_id }),\n );\n console.log('✅ GnoNative bridge initialized.');\n return true;\n } catch (error) {\n console.error(error);\n return false;\n }\n }\n\n async #initBridge() {\n if (this.bridgeStatus === BridgeStatus.Stopped) {\n console.log('Initializing bridge...');\n this.bridgeStatus = BridgeStatus.Starting;\n await GoBridge.initBridge();\n console.log('Bridge initialized.');\n this.bridgeStatus = BridgeStatus.Started;\n }\n }\n\n #getClient() {\n if (!this.clientInstance) {\n throw new Error('GoBridge client instance not initialized.');\n }\n\n return this.clientInstance;\n }\n\n async setRemote(remote: string): Promise<SetRemoteResponse> {\n const client = await this.#getClient();\n const response = await client.setRemote(new SetRemoteRequest({ remote }));\n return response;\n }\n\n async getRemote(): Promise<string> {\n const client = await this.#getClient();\n const response = await client.getRemote(new GetRemoteRequest());\n return response.remote;\n }\n\n async setChainID(chainId: string): Promise<SetChainIDResponse> {\n const client = await this.#getClient();\n const response = await client.setChainID(new SetChainIDRequest({ chainId }));\n return response;\n }\n\n async getChainID() {\n const client = await this.#getClient();\n const response = await client.getChainID(new GetChainIDRequest());\n return response.chainId;\n }\n\n async createAccount(\n nameOrBech32: string,\n mnemonic: string,\n password: string,\n ): Promise<KeyInfo | undefined> {\n const client = await this.#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 async generateRecoveryPhrase() {\n const client = await this.#getClient();\n const response = await client.generateRecoveryPhrase(new GenerateRecoveryPhraseRequest());\n return response.phrase;\n }\n\n async hasKeyByName(name: string) {\n const client = await this.#getClient();\n const response = await client.hasKeyByName(new HasKeyByNameRequest({ name }));\n return response.has;\n }\n\n async hasKeyByAddress(address: Uint8Array) {\n const client = await this.#getClient();\n const response = await client.hasKeyByAddress(new HasKeyByAddressRequest({ address }));\n return response.has;\n }\n\n async hasKeyByNameOrAddress(nameOrBech32: string) {\n const client = await this.#getClient();\n const response = await client.hasKeyByNameOrAddress(\n new HasKeyByNameOrAddressRequest({ nameOrBech32 }),\n );\n return response.has;\n }\n\n async getKeyInfoByName(name: string): Promise<KeyInfo | undefined> {\n const client = await this.#getClient();\n const response = await client.getKeyInfoByName(new GetKeyInfoByNameRequest({ name }));\n return response.key;\n }\n\n async getKeyInfoByAddress(address: Uint8Array): Promise<KeyInfo | undefined> {\n const client = await this.#getClient();\n const response = await client.getKeyInfoByAddress(new GetKeyInfoByAddressRequest({ address }));\n return response.key;\n }\n\n async getKeyInfoByNameOrAddress(nameOrBech32: string): Promise<KeyInfo | undefined> {\n const client = await this.#getClient();\n const response = await client.getKeyInfoByNameOrAddress(\n new GetKeyInfoByNameOrAddressRequest({ nameOrBech32 }),\n );\n return response.key;\n }\n\n async listKeyInfo(): Promise<KeyInfo[]> {\n const client = await this.#getClient();\n const response = await client.listKeyInfo(new ListKeyInfoRequest());\n return response.keys;\n }\n\n async selectAccount(nameOrBech32: string): Promise<SelectAccountResponse> {\n const client = await this.#getClient();\n const response = await client.selectAccount(\n new SelectAccountRequest({\n nameOrBech32,\n }),\n );\n return response;\n }\n\n async getClient(): Promise<PromiseClient<typeof GnoNativeService>> {\n if (!this.clientInstance) {\n throw new Error('GoBridge client instance not initialized.');\n }\n return this.clientInstance;\n }\n\n isInitialized(): boolean {\n return this.clientInstance !== undefined;\n }\n\n async setPassword(password: string): Promise<SetPasswordResponse> {\n const client = await this.#getClient();\n const response = await client.setPassword(new SetPasswordRequest({ password }));\n return response;\n }\n\n async getActiveAccount(): Promise<GetActiveAccountResponse> {\n const client = await this.#getClient();\n const response = await client.getActiveAccount(new GetActiveAccountRequest());\n return response;\n }\n\n async queryAccount(address: Uint8Array): Promise<QueryAccountResponse> {\n const client = await this.#getClient();\n const reponse = await client.queryAccount(new QueryAccountRequest({ address }));\n return reponse;\n }\n\n async deleteAccount(\n nameOrBech32: string,\n password: string | undefined,\n skipPassword: boolean,\n ): Promise<DeleteAccountResponse> {\n const client = await this.#getClient();\n const response = await client.deleteAccount(\n new DeleteAccountRequest({\n nameOrBech32,\n password,\n skipPassword,\n }),\n );\n return response;\n }\n\n async query(path: string, data: Uint8Array): Promise<QueryResponse> {\n const client = await this.#getClient();\n const reponse = await client.query(\n new QueryRequest({\n path,\n data,\n }),\n );\n return reponse;\n }\n\n async render(packagePath: string, args: string) {\n const client = await this.#getClient();\n const reponse = await client.render(\n new RenderRequest({\n packagePath,\n args,\n }),\n );\n return reponse.result;\n }\n\n async qEval(packagePath: string, expression: string) {\n const client = await this.#getClient();\n const reponse = await client.qEval(\n new QEvalRequest({\n packagePath,\n expression,\n }),\n );\n return reponse.result;\n }\n\n async call(\n packagePath: string,\n fnc: string,\n args: string[],\n gasFee: string,\n gasWanted: number,\n send?: string,\n memo?: string,\n ): Promise<AsyncIterable<CallResponse>> {\n const client = await this.#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 async send(\n toAddress: Uint8Array,\n send: string,\n gasFee: string,\n gasWanted: number,\n memo?: string,\n ): Promise<AsyncIterable<SendResponse>> {\n const client = await this.#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 async addressToBech32(address: Uint8Array) {\n const client = await this.#getClient();\n const response = await client.addressToBech32(new AddressToBech32Request({ address }));\n return response.bech32Address;\n }\n\n async addressFromBech32(bech32Address: string) {\n const client = await this.#getClient();\n const response = await client.addressFromBech32(\n new AddressFromBech32Request({ bech32Address }),\n );\n return response.address;\n }\n\n // // debug\n async hello(name: string) {\n const client = await this.#getClient();\n const response = await client.hello(new HelloRequest({ name }));\n return response.greeting;\n }\n\n // // debug\n async helloStream(name: string): Promise<AsyncIterable<HelloStreamResponse>> {\n const client = await this.#getClient();\n return client.helloStream(new HelloRequest({ name }));\n }\n\n // Go Bridge Interface:\n initBridge(): Promise<void> {\n return GoBridge.initBridge();\n }\n closeBridge(): Promise<void> {\n return GoBridge.closeBridge();\n }\n getTcpPort(): Promise<number> {\n return GoBridge.getTcpPort();\n }\n invokeGrpcMethod(method: string, jsonMessage: string): Promise<string> {\n return GoBridge.invokeGrpcMethod(method, jsonMessage);\n }\n createStreamClient(method: string, jsonMessage: string): Promise<string> {\n return GoBridge.createStreamClient(method, jsonMessage);\n }\n streamClientReceive(id: string): Promise<string> {\n return GoBridge.streamClientReceive(id);\n }\n closeStreamClient(id: string): Promise<void> {\n return GoBridge.closeStreamClient(id);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"GnoNativeApi.js","sourceRoot":"","sources":["../../src/api/GnoNativeApi.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,sBAAsB,EACtB,0BAA0B,EAC1B,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,EAGZ,kBAAkB,EAClB,OAAO,EACP,OAAO,EACP,YAAY,EACZ,mBAAmB,EAEnB,YAAY,EAEZ,aAAa,EACb,oBAAoB,EAEpB,WAAW,EAEX,iBAAiB,EAEjB,kBAAkB,EAEl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AU;QACR,OAAO,QAAQ,CAAC,UAAU,EAAE,CAAC;IAC/B,CAAC;IACD,gBAAgB,CAAC,MAAc,EAAE,WAAmB;QAClD,OAAO,QAAQ,CAAC,gBAAgB,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACxD,CAAC;IACD,kBAAkB,CAAC,MAAc,EAAE,WAAmB;QACpD,OAAO,QAAQ,CAAC,kBAAkB,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAC1D,CAAC;IACD,mBAAmB,CAAC,EAAU;QAC5B,OAAO,QAAQ,CAAC,mBAAmB,CAAC,EAAE,CAAC,CAAC;IAC1C,CAAC;IACD,iBAAiB,CAAC,EAAU;QAC1B,OAAO,QAAQ,CAAC,iBAAiB,CAAC,EAAE,CAAC,CAAC;IACxC,CAAC;CACF","sourcesContent":["import {\n AddressFromBech32Request,\n AddressToBech32Request,\n AddressFromMnemonicRequest,\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 KeyInfo,\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 { GnoKeyApi, BridgeStatus, Config } from './types';\nimport { GoBridge, GoBridgeInterface } from '../GoBridge';\nimport * as Grpc from '../grpc/client';\n\nexport class GnoNativeApi implements GnoKeyApi, GoBridgeInterface {\n bridgeStatus = BridgeStatus.Stopped;\n config: Config;\n clientInstance: PromiseClient<typeof GnoNativeService> | undefined;\n\n constructor(config: Config) {\n this.config = config;\n }\n\n async initClient() {\n if (this.bridgeStatus === BridgeStatus.Stopped) {\n console.log('Bridge stopped. Initializing...');\n await this.#initBridge();\n }\n\n if (this.clientInstance) {\n console.error('GoBridge already initialized.');\n return true;\n }\n\n const port = await GoBridge.getTcpPort();\n console.log('GoBridge GRPC client instance port: %s', port);\n const client = Grpc.createClient(port);\n this.clientInstance = client;\n console.log('GoBridge GRPC client instance. Done.');\n\n try {\n await this.clientInstance.setRemote(new SetRemoteRequest({ remote: this.config.remote }));\n await this.clientInstance.setChainID(\n new SetChainIDRequest({ chainId: this.config.chain_id }),\n );\n console.log('✅ GnoNative bridge initialized.');\n return true;\n } catch (error) {\n console.error(error);\n return false;\n }\n }\n\n async #initBridge() {\n if (this.bridgeStatus === BridgeStatus.Stopped) {\n console.log('Initializing bridge...');\n this.bridgeStatus = BridgeStatus.Starting;\n await GoBridge.initBridge();\n console.log('Bridge initialized.');\n this.bridgeStatus = BridgeStatus.Started;\n }\n }\n\n #getClient() {\n if (!this.clientInstance) {\n throw new Error('GoBridge client instance not initialized.');\n }\n\n return this.clientInstance;\n }\n\n async setRemote(remote: string): Promise<SetRemoteResponse> {\n const client = await this.#getClient();\n const response = await client.setRemote(new SetRemoteRequest({ remote }));\n return response;\n }\n\n async getRemote(): Promise<string> {\n const client = await this.#getClient();\n const response = await client.getRemote(new GetRemoteRequest());\n return response.remote;\n }\n\n async setChainID(chainId: string): Promise<SetChainIDResponse> {\n const client = await this.#getClient();\n const response = await client.setChainID(new SetChainIDRequest({ chainId }));\n return response;\n }\n\n async getChainID() {\n const client = await this.#getClient();\n const response = await client.getChainID(new GetChainIDRequest());\n return response.chainId;\n }\n\n async createAccount(\n nameOrBech32: string,\n mnemonic: string,\n password: string,\n ): Promise<KeyInfo | undefined> {\n const client = await this.#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 async generateRecoveryPhrase() {\n const client = await this.#getClient();\n const response = await client.generateRecoveryPhrase(new GenerateRecoveryPhraseRequest());\n return response.phrase;\n }\n\n async hasKeyByName(name: string) {\n const client = await this.#getClient();\n const response = await client.hasKeyByName(new HasKeyByNameRequest({ name }));\n return response.has;\n }\n\n async hasKeyByAddress(address: Uint8Array) {\n const client = await this.#getClient();\n const response = await client.hasKeyByAddress(new HasKeyByAddressRequest({ address }));\n return response.has;\n }\n\n async hasKeyByNameOrAddress(nameOrBech32: string) {\n const client = await this.#getClient();\n const response = await client.hasKeyByNameOrAddress(\n new HasKeyByNameOrAddressRequest({ nameOrBech32 }),\n );\n return response.has;\n }\n\n async getKeyInfoByName(name: string): Promise<KeyInfo | undefined> {\n const client = await this.#getClient();\n const response = await client.getKeyInfoByName(new GetKeyInfoByNameRequest({ name }));\n return response.key;\n }\n\n async getKeyInfoByAddress(address: Uint8Array): Promise<KeyInfo | undefined> {\n const client = await this.#getClient();\n const response = await client.getKeyInfoByAddress(new GetKeyInfoByAddressRequest({ address }));\n return response.key;\n }\n\n async getKeyInfoByNameOrAddress(nameOrBech32: string): Promise<KeyInfo | undefined> {\n const client = await this.#getClient();\n const response = await client.getKeyInfoByNameOrAddress(\n new GetKeyInfoByNameOrAddressRequest({ nameOrBech32 }),\n );\n return response.key;\n }\n\n async listKeyInfo(): Promise<KeyInfo[]> {\n const client = await this.#getClient();\n const response = await client.listKeyInfo(new ListKeyInfoRequest());\n return response.keys;\n }\n\n async selectAccount(nameOrBech32: string): Promise<SelectAccountResponse> {\n const client = await this.#getClient();\n const response = await client.selectAccount(\n new SelectAccountRequest({\n nameOrBech32,\n }),\n );\n return response;\n }\n\n async getClient(): Promise<PromiseClient<typeof GnoNativeService>> {\n if (!this.clientInstance) {\n throw new Error('GoBridge client instance not initialized.');\n }\n return this.clientInstance;\n }\n\n isInitialized(): boolean {\n return this.clientInstance !== undefined;\n }\n\n async setPassword(password: string): Promise<SetPasswordResponse> {\n const client = await this.#getClient();\n const response = await client.setPassword(new SetPasswordRequest({ password }));\n return response;\n }\n\n async getActiveAccount(): Promise<GetActiveAccountResponse> {\n const client = await this.#getClient();\n const response = await client.getActiveAccount(new GetActiveAccountRequest());\n return response;\n }\n\n async queryAccount(address: Uint8Array): Promise<QueryAccountResponse> {\n const client = await this.#getClient();\n const reponse = await client.queryAccount(new QueryAccountRequest({ address }));\n return reponse;\n }\n\n async deleteAccount(\n nameOrBech32: string,\n password: string | undefined,\n skipPassword: boolean,\n ): Promise<DeleteAccountResponse> {\n const client = await this.#getClient();\n const response = await client.deleteAccount(\n new DeleteAccountRequest({\n nameOrBech32,\n password,\n skipPassword,\n }),\n );\n return response;\n }\n\n async query(path: string, data: Uint8Array): Promise<QueryResponse> {\n const client = await this.#getClient();\n const reponse = await client.query(\n new QueryRequest({\n path,\n data,\n }),\n );\n return reponse;\n }\n\n async render(packagePath: string, args: string) {\n const client = await this.#getClient();\n const reponse = await client.render(\n new RenderRequest({\n packagePath,\n args,\n }),\n );\n return reponse.result;\n }\n\n async qEval(packagePath: string, expression: string) {\n const client = await this.#getClient();\n const reponse = await client.qEval(\n new QEvalRequest({\n packagePath,\n expression,\n }),\n );\n return reponse.result;\n }\n\n async call(\n packagePath: string,\n fnc: string,\n args: string[],\n gasFee: string,\n gasWanted: number,\n send?: string,\n memo?: string,\n ): Promise<AsyncIterable<CallResponse>> {\n const client = await this.#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 async send(\n toAddress: Uint8Array,\n send: string,\n gasFee: string,\n gasWanted: number,\n memo?: string,\n ): Promise<AsyncIterable<SendResponse>> {\n const client = await this.#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 async addressToBech32(address: Uint8Array) {\n const client = await this.#getClient();\n const response = await client.addressToBech32(new AddressToBech32Request({ address }));\n return response.bech32Address;\n }\n\n async addressFromMnemonic(mnemonic: string) {\n const client = await this.#getClient();\n const response = await client.addressFromMnemonic(new AddressFromMnemonicRequest({ mnemonic }));\n return response.address;\n }\n\n async addressFromBech32(bech32Address: string) {\n const client = await this.#getClient();\n const response = await client.addressFromBech32(\n new AddressFromBech32Request({ bech32Address }),\n );\n return response.address;\n }\n\n // // debug\n async hello(name: string) {\n const client = await this.#getClient();\n const response = await client.hello(new HelloRequest({ name }));\n return response.greeting;\n }\n\n // // debug\n async helloStream(name: string): Promise<AsyncIterable<HelloStreamResponse>> {\n const client = await this.#getClient();\n return client.helloStream(new HelloRequest({ name }));\n }\n\n // Go Bridge Interface:\n initBridge(): Promise<void> {\n return GoBridge.initBridge();\n }\n closeBridge(): Promise<void> {\n return GoBridge.closeBridge();\n }\n getTcpPort(): Promise<number> {\n return GoBridge.getTcpPort();\n }\n invokeGrpcMethod(method: string, jsonMessage: string): Promise<string> {\n return GoBridge.invokeGrpcMethod(method, jsonMessage);\n }\n createStreamClient(method: string, jsonMessage: string): Promise<string> {\n return GoBridge.createStreamClient(method, jsonMessage);\n }\n streamClientReceive(id: string): Promise<string> {\n return GoBridge.streamClientReceive(id);\n }\n closeStreamClient(id: string): Promise<void> {\n return GoBridge.closeStreamClient(id);\n }\n}\n"]}
|
package/build/api/types.d.ts
CHANGED
|
@@ -33,6 +33,7 @@ export interface GnoKeyApi {
|
|
|
33
33
|
call: (packagePath: string, fnc: string, args: string[], gasFee: string, gasWanted: number, send?: string, memo?: string) => Promise<AsyncIterable<CallResponse>>;
|
|
34
34
|
send: (toAddress: Uint8Array, send: string, gasFee: string, gasWanted: number, memo?: string) => Promise<AsyncIterable<SendResponse>>;
|
|
35
35
|
addressToBech32: (address: Uint8Array) => Promise<string>;
|
|
36
|
+
addressFromMnemonic: (mnemonic: string) => Promise<Uint8Array>;
|
|
36
37
|
addressFromBech32: (bech32Address: string) => Promise<Uint8Array>;
|
|
37
38
|
hello: (name: string) => Promise<string>;
|
|
38
39
|
helloStream: (name: string) => Promise<AsyncIterable<HelloStreamResponse>>;
|
package/build/api/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/api/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,qBAAqB,EACrB,wBAAwB,EACxB,mBAAmB,EACnB,oBAAoB,EACpB,aAAa,EACb,qBAAqB,EACrB,YAAY,EACZ,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,OAAO,EACR,MAAM,sDAAsD,CAAC;AAE9D,oBAAY,YAAY;IACtB,OAAO,IAAA;IACP,QAAQ,IAAA;IACR,OAAO,IAAA;CACR;AAED,MAAM,WAAW,MAAM;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,SAAS;IACxB,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAC1D,SAAS,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;IACjC,UAAU,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAC7D,UAAU,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;IAClC,aAAa,EAAE,CACb,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,KACb,OAA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AC,CAAC;IAC1C,eAAe,EAAE,CAAC,OAAO,EAAE,UAAU,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAC1D,mBAAmB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;IAC/D,iBAAiB,EAAE,CAAC,aAAa,EAAE,MAAM,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;IAElE,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACzC,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,aAAa,CAAC,mBAAmB,CAAC,CAAC,CAAC;CAC5E"}
|
package/build/api/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/api/types.ts"],"names":[],"mappings":"AAeA,MAAM,CAAN,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,qDAAO,CAAA;IACP,uDAAQ,CAAA;IACR,qDAAO,CAAA;AACT,CAAC,EAJW,YAAY,KAAZ,YAAY,QAIvB","sourcesContent":["import {\n CallResponse,\n DeleteAccountResponse,\n GetActiveAccountResponse,\n HelloStreamResponse,\n QueryAccountResponse,\n QueryResponse,\n SelectAccountResponse,\n SendResponse,\n SetChainIDResponse,\n SetPasswordResponse,\n SetRemoteResponse,\n KeyInfo,\n} from '@buf/gnolang_gnonative.bufbuild_es/gnonativetypes_pb';\n\nexport enum BridgeStatus {\n Stopped,\n Starting,\n Started,\n}\n\nexport interface Config {\n remote: string;\n chain_id: string;\n}\n\nexport interface GnoKeyApi {\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<KeyInfo | undefined>;\n generateRecoveryPhrase: () => Promise<string>;\n listKeyInfo: () => Promise<KeyInfo[]>;\n hasKeyByName: (name: string) => Promise<boolean>;\n hasKeyByAddress: (address: Uint8Array) => Promise<boolean>;\n hasKeyByNameOrAddress: (nameOrBech32: string) => Promise<boolean>;\n getKeyInfoByName: (name: string) => Promise<KeyInfo | undefined>;\n getKeyInfoByAddress: (address: Uint8Array) => Promise<KeyInfo | undefined>;\n getKeyInfoByNameOrAddress: (nameOrBech32: string) => Promise<KeyInfo | 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: 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 // debug\n hello: (name: string) => Promise<string>;\n helloStream: (name: string) => Promise<AsyncIterable<HelloStreamResponse>>;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/api/types.ts"],"names":[],"mappings":"AAeA,MAAM,CAAN,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,qDAAO,CAAA;IACP,uDAAQ,CAAA;IACR,qDAAO,CAAA;AACT,CAAC,EAJW,YAAY,KAAZ,YAAY,QAIvB","sourcesContent":["import {\n CallResponse,\n DeleteAccountResponse,\n GetActiveAccountResponse,\n HelloStreamResponse,\n QueryAccountResponse,\n QueryResponse,\n SelectAccountResponse,\n SendResponse,\n SetChainIDResponse,\n SetPasswordResponse,\n SetRemoteResponse,\n KeyInfo,\n} from '@buf/gnolang_gnonative.bufbuild_es/gnonativetypes_pb';\n\nexport enum BridgeStatus {\n Stopped,\n Starting,\n Started,\n}\n\nexport interface Config {\n remote: string;\n chain_id: string;\n}\n\nexport interface GnoKeyApi {\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<KeyInfo | undefined>;\n generateRecoveryPhrase: () => Promise<string>;\n listKeyInfo: () => Promise<KeyInfo[]>;\n hasKeyByName: (name: string) => Promise<boolean>;\n hasKeyByAddress: (address: Uint8Array) => Promise<boolean>;\n hasKeyByNameOrAddress: (nameOrBech32: string) => Promise<boolean>;\n getKeyInfoByName: (name: string) => Promise<KeyInfo | undefined>;\n getKeyInfoByAddress: (address: Uint8Array) => Promise<KeyInfo | undefined>;\n getKeyInfoByNameOrAddress: (nameOrBech32: string) => Promise<KeyInfo | 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: 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 addressFromMnemonic: (mnemonic: string) => Promise<Uint8Array>;\n addressFromBech32: (bech32Address: string) => Promise<Uint8Array>;\n // debug\n hello: (name: string) => Promise<string>;\n helloStream: (name: string) => Promise<AsyncIterable<HelloStreamResponse>>;\n}\n"]}
|
|
Binary file
|
|
Binary file
|
package/ios/Frameworks/GnoCore.xcframework/ios-arm64/GnoCore.framework/Versions/Current/GnoCore
CHANGED
|
Binary file
|
package/ios/Frameworks/GnoCore.xcframework/ios-arm64_x86_64-simulator/GnoCore.framework/GnoCore
ADDED
|
Binary file
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
|
@@ -0,0 +1,93 @@
|
|
|
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
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
|
@@ -0,0 +1,35 @@
|
|
|
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
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gnolang/gnonative",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.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,8 @@
|
|
|
29
29
|
"license": "MIT",
|
|
30
30
|
"homepage": "https://github.com/gnolang/gnonative#readme",
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@buf/gnolang_gnonative.bufbuild_es": "^1.
|
|
33
|
-
"@buf/gnolang_gnonative.connectrpc_es": "^1.4.0-
|
|
32
|
+
"@buf/gnolang_gnonative.bufbuild_es": "^1.10.0-20240722123703-a858ea7341d6.1",
|
|
33
|
+
"@buf/gnolang_gnonative.connectrpc_es": "^1.4.0-20240722123703-a858ea7341d6.3",
|
|
34
34
|
"@bufbuild/protobuf": "^1.8.0",
|
|
35
35
|
"@connectrpc/connect": "^1.4.0",
|
|
36
36
|
"@connectrpc/connect-web": "^1.4.0",
|
package/src/api/GnoNativeApi.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AddressFromBech32Request,
|
|
3
3
|
AddressToBech32Request,
|
|
4
|
+
AddressFromMnemonicRequest,
|
|
4
5
|
CallRequest,
|
|
5
6
|
CallResponse,
|
|
6
7
|
CreateAccountRequest,
|
|
@@ -342,6 +343,12 @@ export class GnoNativeApi implements GnoKeyApi, GoBridgeInterface {
|
|
|
342
343
|
return response.bech32Address;
|
|
343
344
|
}
|
|
344
345
|
|
|
346
|
+
async addressFromMnemonic(mnemonic: string) {
|
|
347
|
+
const client = await this.#getClient();
|
|
348
|
+
const response = await client.addressFromMnemonic(new AddressFromMnemonicRequest({ mnemonic }));
|
|
349
|
+
return response.address;
|
|
350
|
+
}
|
|
351
|
+
|
|
345
352
|
async addressFromBech32(bech32Address: string) {
|
|
346
353
|
const client = await this.#getClient();
|
|
347
354
|
const response = await client.addressFromBech32(
|
package/src/api/types.ts
CHANGED
|
@@ -71,6 +71,7 @@ export interface GnoKeyApi {
|
|
|
71
71
|
memo?: string,
|
|
72
72
|
) => Promise<AsyncIterable<SendResponse>>;
|
|
73
73
|
addressToBech32: (address: Uint8Array) => Promise<string>;
|
|
74
|
+
addressFromMnemonic: (mnemonic: string) => Promise<Uint8Array>;
|
|
74
75
|
addressFromBech32: (bech32Address: string) => Promise<Uint8Array>;
|
|
75
76
|
// debug
|
|
76
77
|
hello: (name: string) => Promise<string>;
|