@gnolang/gnonative 1.7.2 → 1.8.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.
- package/android/libs/gnocore.aar +0 -0
- package/build/api/GnoNativeApi.d.ts +7 -5
- package/build/api/GnoNativeApi.d.ts.map +1 -1
- package/build/api/GnoNativeApi.js +21 -7
- package/build/api/GnoNativeApi.js.map +1 -1
- package/build/api/types.d.ts +7 -5
- 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/package.json +1 -1
- package/src/api/GnoNativeApi.ts +28 -4
- package/src/api/types.ts +8 -2
package/android/libs/gnocore.aar
CHANGED
|
Binary file
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CallResponse, DeleteAccountResponse, GetActiveAccountResponse, HelloStreamResponse, KeyInfo, QueryAccountResponse, QueryResponse, SelectAccountResponse, SendResponse, SetChainIDResponse, SetPasswordResponse, SetRemoteResponse, UpdatePasswordResponse } from '@buf/gnolang_gnonative.bufbuild_es/gnonativetypes_pb';
|
|
1
|
+
import { CallResponse, DeleteAccountResponse, GetActiveAccountResponse, GetActivatedAccountResponse, HelloStreamResponse, KeyInfo, QueryAccountResponse, QueryResponse, SelectAccountResponse, ActivateAccountResponse, SendResponse, SetChainIDResponse, SetPasswordResponse, SetRemoteResponse, UpdatePasswordResponse } from '@buf/gnolang_gnonative.bufbuild_es/gnonativetypes_pb';
|
|
2
2
|
import { GnoNativeService } from '@buf/gnolang_gnonative.connectrpc_es/rpc_connect';
|
|
3
3
|
import { PromiseClient } from '@connectrpc/connect';
|
|
4
4
|
import { GnoKeyApi, BridgeStatus, Config } from './types';
|
|
@@ -24,18 +24,20 @@ export declare class GnoNativeApi implements GnoKeyApi, GoBridgeInterface {
|
|
|
24
24
|
getKeyInfoByNameOrAddress(nameOrBech32: string): Promise<KeyInfo | undefined>;
|
|
25
25
|
listKeyInfo(): Promise<KeyInfo[]>;
|
|
26
26
|
selectAccount(nameOrBech32: string): Promise<SelectAccountResponse>;
|
|
27
|
+
activateAccount(nameOrBech32: string): Promise<ActivateAccountResponse>;
|
|
27
28
|
getClient(): Promise<PromiseClient<typeof GnoNativeService>>;
|
|
28
29
|
isInitialized(): boolean;
|
|
29
|
-
setPassword(password: string): Promise<SetPasswordResponse>;
|
|
30
|
-
updatePassword(newPassword: string): Promise<UpdatePasswordResponse>;
|
|
30
|
+
setPassword(password: string, address?: Uint8Array): Promise<SetPasswordResponse>;
|
|
31
|
+
updatePassword(newPassword: string, address?: Uint8Array): Promise<UpdatePasswordResponse>;
|
|
31
32
|
getActiveAccount(): Promise<GetActiveAccountResponse>;
|
|
33
|
+
getActivatedAccount(): Promise<GetActivatedAccountResponse>;
|
|
32
34
|
queryAccount(address: Uint8Array): Promise<QueryAccountResponse>;
|
|
33
35
|
deleteAccount(nameOrBech32: string, password: string | undefined, skipPassword: boolean): Promise<DeleteAccountResponse>;
|
|
34
36
|
query(path: string, data: Uint8Array): Promise<QueryResponse>;
|
|
35
37
|
render(packagePath: string, args: string): Promise<string>;
|
|
36
38
|
qEval(packagePath: string, expression: string): Promise<string>;
|
|
37
|
-
call(packagePath: string, fnc: string, args: string[], gasFee: string, gasWanted: number, send?: string, memo?: string): Promise<AsyncIterable<CallResponse>>;
|
|
38
|
-
send(toAddress: Uint8Array, send: string, gasFee: string, gasWanted: number, memo?: string): Promise<AsyncIterable<SendResponse>>;
|
|
39
|
+
call(packagePath: string, fnc: string, args: string[], gasFee: string, gasWanted: number, callerAddress?: Uint8Array, send?: string, memo?: string): Promise<AsyncIterable<CallResponse>>;
|
|
40
|
+
send(toAddress: Uint8Array, send: string, gasFee: string, gasWanted: number, callerAddress?: Uint8Array, memo?: string): Promise<AsyncIterable<SendResponse>>;
|
|
39
41
|
addressToBech32(address: Uint8Array): Promise<string>;
|
|
40
42
|
addressFromMnemonic(mnemonic: string): Promise<Uint8Array>;
|
|
41
43
|
addressFromBech32(bech32Address: string): Promise<Uint8Array>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GnoNativeApi.d.ts","sourceRoot":"","sources":["../../src/api/GnoNativeApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,YAAY,EAGZ,qBAAqB,EAGrB,wBAAwB,
|
|
1
|
+
{"version":3,"file":"GnoNativeApi.d.ts","sourceRoot":"","sources":["../../src/api/GnoNativeApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,YAAY,EAGZ,qBAAqB,EAGrB,wBAAwB,EAExB,2BAA2B,EAU3B,mBAAmB,EACnB,OAAO,EAMP,oBAAoB,EAEpB,aAAa,EAGb,qBAAqB,EAErB,uBAAuB,EAEvB,YAAY,EAEZ,kBAAkB,EAElB,mBAAmB,EAEnB,iBAAiB,EAEjB,sBAAsB,EACvB,MAAM,sDAAsD,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,kDAAkD,CAAC;AACpF,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,EAAY,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAG1D,qBAAa,YAAa,YAAW,SAAS,EAAE,iBAAiB;;IAC/D,YAAY,eAAwB;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,aAAa,CAAC,OAAO,gBAAgB,CAAC,GAAG,SAAS,CAAC;gBAEvD,MAAM,EAAE,MAAM;IAIpB,UAAU;IAoDV,SAAS,CAAC,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WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAG5B,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC;IAG7B,wBAAwB,IAAI,OAAO,CAAC,IAAI,CAAC;IAGzC,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, 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, UpdatePasswordRequest, } from '@buf/gnolang_gnonative.bufbuild_es/gnonativetypes_pb';
|
|
1
|
+
import { AddressFromBech32Request, AddressToBech32Request, AddressFromMnemonicRequest, CallRequest, CreateAccountRequest, DeleteAccountRequest, GenerateRecoveryPhraseRequest, GetActiveAccountRequest, GetActivatedAccountRequest, GetChainIDRequest, GetKeyInfoByAddressRequest, GetKeyInfoByNameOrAddressRequest, GetKeyInfoByNameRequest, GetRemoteRequest, HasKeyByAddressRequest, HasKeyByNameOrAddressRequest, HasKeyByNameRequest, HelloRequest, ListKeyInfoRequest, MsgCall, MsgSend, QEvalRequest, QueryAccountRequest, QueryRequest, RenderRequest, SelectAccountRequest, ActivateAccountRequest, SendRequest, SetChainIDRequest, SetPasswordRequest, SetRemoteRequest, UpdatePasswordRequest, } 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';
|
|
@@ -129,6 +129,13 @@ export class GnoNativeApi {
|
|
|
129
129
|
}));
|
|
130
130
|
return response;
|
|
131
131
|
}
|
|
132
|
+
async activateAccount(nameOrBech32) {
|
|
133
|
+
const client = await this.#getClient();
|
|
134
|
+
const response = await client.activateAccount(new ActivateAccountRequest({
|
|
135
|
+
nameOrBech32,
|
|
136
|
+
}));
|
|
137
|
+
return response;
|
|
138
|
+
}
|
|
132
139
|
async getClient() {
|
|
133
140
|
if (!this.clientInstance) {
|
|
134
141
|
throw new Error('GoBridge client instance not initialized.');
|
|
@@ -138,14 +145,14 @@ export class GnoNativeApi {
|
|
|
138
145
|
isInitialized() {
|
|
139
146
|
return this.clientInstance !== undefined;
|
|
140
147
|
}
|
|
141
|
-
async setPassword(password) {
|
|
148
|
+
async setPassword(password, address) {
|
|
142
149
|
const client = await this.#getClient();
|
|
143
|
-
const response = await client.setPassword(new SetPasswordRequest({ password }));
|
|
150
|
+
const response = await client.setPassword(new SetPasswordRequest({ password, address }));
|
|
144
151
|
return response;
|
|
145
152
|
}
|
|
146
|
-
async updatePassword(newPassword) {
|
|
153
|
+
async updatePassword(newPassword, address) {
|
|
147
154
|
const client = await this.#getClient();
|
|
148
|
-
const response = await client.updatePassword(new UpdatePasswordRequest({ newPassword }));
|
|
155
|
+
const response = await client.updatePassword(new UpdatePasswordRequest({ newPassword, address }));
|
|
149
156
|
return response;
|
|
150
157
|
}
|
|
151
158
|
async getActiveAccount() {
|
|
@@ -153,6 +160,11 @@ export class GnoNativeApi {
|
|
|
153
160
|
const response = await client.getActiveAccount(new GetActiveAccountRequest());
|
|
154
161
|
return response;
|
|
155
162
|
}
|
|
163
|
+
async getActivatedAccount() {
|
|
164
|
+
const client = await this.#getClient();
|
|
165
|
+
const response = await client.getActivatedAccount(new GetActivatedAccountRequest());
|
|
166
|
+
return response;
|
|
167
|
+
}
|
|
156
168
|
async queryAccount(address) {
|
|
157
169
|
const client = await this.#getClient();
|
|
158
170
|
const reponse = await client.queryAccount(new QueryAccountRequest({ address }));
|
|
@@ -191,12 +203,13 @@ export class GnoNativeApi {
|
|
|
191
203
|
}));
|
|
192
204
|
return reponse.result;
|
|
193
205
|
}
|
|
194
|
-
async call(packagePath, fnc, args, gasFee, gasWanted, send, memo) {
|
|
206
|
+
async call(packagePath, fnc, args, gasFee, gasWanted, callerAddress, send, memo) {
|
|
195
207
|
const client = await this.#getClient();
|
|
196
208
|
const reponse = client.call(new CallRequest({
|
|
197
209
|
gasFee,
|
|
198
210
|
gasWanted: BigInt(gasWanted),
|
|
199
211
|
memo,
|
|
212
|
+
callerAddress,
|
|
200
213
|
msgs: [
|
|
201
214
|
new MsgCall({
|
|
202
215
|
packagePath,
|
|
@@ -208,12 +221,13 @@ export class GnoNativeApi {
|
|
|
208
221
|
}));
|
|
209
222
|
return reponse;
|
|
210
223
|
}
|
|
211
|
-
async send(toAddress, send, gasFee, gasWanted, memo) {
|
|
224
|
+
async send(toAddress, send, gasFee, gasWanted, callerAddress, memo) {
|
|
212
225
|
const client = await this.#getClient();
|
|
213
226
|
const reponse = client.send(new SendRequest({
|
|
214
227
|
gasFee,
|
|
215
228
|
gasWanted: BigInt(gasWanted),
|
|
216
229
|
memo,
|
|
230
|
+
callerAddress,
|
|
217
231
|
msgs: [
|
|
218
232
|
new MsgSend({
|
|
219
233
|
toAddress,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GnoNativeApi.js","sourceRoot":"","sources":["../../src/api/GnoNativeApi.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,w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AQ,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 UpdatePasswordRequest,\n UpdatePasswordResponse,\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 if (this.config.start_gnokey_mobile_service) {\n await this.startGnokeyMobileService();\n console.log('✅ Gnokey Mobile service started.');\n }\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 updatePassword(newPassword: string): Promise<UpdatePasswordResponse> {\n const client = await this.#getClient();\n const response = await client.updatePassword(new UpdatePasswordRequest({ newPassword }));\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 startGnokeyMobileService(): Promise<void> {\n return GoBridge.startGnokeyMobileService();\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,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/B,CAAC;IACD,WAAW;QACT,OAAO,QAAQ,CAAC,WAAW,EAAE,CAAC;IAChC,CAAC;IACD,UAAU;QACR,OAAO,QAAQ,CAAC,UAAU,EAAE,CAAC;IAC/B,CAAC;IACD,wBAAwB;QACtB,OAAO,QAAQ,CAAC,wBAAwB,EAAE,CAAC;IAC7C,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 GetActivatedAccountRequest,\n GetActivatedAccountResponse,\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 ActivateAccountRequest,\n ActivateAccountResponse,\n SendRequest,\n SendResponse,\n SetChainIDRequest,\n SetChainIDResponse,\n SetPasswordRequest,\n SetPasswordResponse,\n SetRemoteRequest,\n SetRemoteResponse,\n UpdatePasswordRequest,\n UpdatePasswordResponse,\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 if (this.config.start_gnokey_mobile_service) {\n await this.startGnokeyMobileService();\n console.log('✅ Gnokey Mobile service started.');\n }\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 activateAccount(nameOrBech32: string): Promise<ActivateAccountResponse> {\n const client = await this.#getClient();\n const response = await client.activateAccount(\n new ActivateAccountRequest({\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, address?: Uint8Array): Promise<SetPasswordResponse> {\n const client = await this.#getClient();\n const response = await client.setPassword(new SetPasswordRequest({ password, address }));\n return response;\n }\n\n async updatePassword(newPassword: string, address?: Uint8Array): Promise<UpdatePasswordResponse> {\n const client = await this.#getClient();\n const response = await client.updatePassword(new UpdatePasswordRequest({ newPassword, address }));\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 getActivatedAccount(): Promise<GetActivatedAccountResponse> {\n const client = await this.#getClient();\n const response = await client.getActivatedAccount(new GetActivatedAccountRequest());\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 callerAddress?: Uint8Array,\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 callerAddress,\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 callerAddress?: Uint8Array,\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 callerAddress,\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 startGnokeyMobileService(): Promise<void> {\n return GoBridge.startGnokeyMobileService();\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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CallResponse, DeleteAccountResponse, GetActiveAccountResponse, HelloStreamResponse, QueryAccountResponse, QueryResponse, SelectAccountResponse, SendResponse, SetChainIDResponse, SetPasswordResponse, SetRemoteResponse, UpdatePasswordResponse, KeyInfo } from '@buf/gnolang_gnonative.bufbuild_es/gnonativetypes_pb';
|
|
1
|
+
import { CallResponse, DeleteAccountResponse, GetActiveAccountResponse, GetActivatedAccountResponse, HelloStreamResponse, QueryAccountResponse, QueryResponse, SelectAccountResponse, ActivateAccountResponse, SendResponse, SetChainIDResponse, SetPasswordResponse, SetRemoteResponse, UpdatePasswordResponse, KeyInfo } from '@buf/gnolang_gnonative.bufbuild_es/gnonativetypes_pb';
|
|
2
2
|
export declare enum BridgeStatus {
|
|
3
3
|
Stopped = 0,
|
|
4
4
|
Starting = 1,
|
|
@@ -24,16 +24,18 @@ export interface GnoKeyApi {
|
|
|
24
24
|
getKeyInfoByAddress: (address: Uint8Array) => Promise<KeyInfo | undefined>;
|
|
25
25
|
getKeyInfoByNameOrAddress: (nameOrBech32: string) => Promise<KeyInfo | undefined>;
|
|
26
26
|
selectAccount: (nameOrBech32: string) => Promise<SelectAccountResponse>;
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
activateAccount: (nameOrBech32: string) => Promise<ActivateAccountResponse>;
|
|
28
|
+
setPassword: (password: string, address?: Uint8Array) => Promise<SetPasswordResponse>;
|
|
29
|
+
updatePassword: (password: string, address?: Uint8Array) => Promise<UpdatePasswordResponse>;
|
|
29
30
|
getActiveAccount: () => Promise<GetActiveAccountResponse>;
|
|
31
|
+
getActivatedAccount: () => Promise<GetActivatedAccountResponse>;
|
|
30
32
|
queryAccount: (address: Uint8Array) => Promise<QueryAccountResponse>;
|
|
31
33
|
deleteAccount: (nameOrBech32: string, password: string | undefined, skipPassword: boolean) => Promise<DeleteAccountResponse>;
|
|
32
34
|
query: (path: string, data: Uint8Array) => Promise<QueryResponse>;
|
|
33
35
|
render: (packagePath: string, args: string) => Promise<string>;
|
|
34
36
|
qEval: (packagePath: string, expression: string) => Promise<string>;
|
|
35
|
-
call: (packagePath: string, fnc: string, args: string[], gasFee: string, gasWanted: number, send?: string, memo?: string) => Promise<AsyncIterable<CallResponse>>;
|
|
36
|
-
send: (toAddress: Uint8Array, send: string, gasFee: string, gasWanted: number, memo?: string) => Promise<AsyncIterable<SendResponse>>;
|
|
37
|
+
call: (packagePath: string, fnc: string, args: string[], gasFee: string, gasWanted: number, callerAddress?: Uint8Array, send?: string, memo?: string) => Promise<AsyncIterable<CallResponse>>;
|
|
38
|
+
send: (toAddress: Uint8Array, send: string, gasFee: string, gasWanted: number, callerAddress?: Uint8Array, memo?: string) => Promise<AsyncIterable<SendResponse>>;
|
|
37
39
|
addressToBech32: (address: Uint8Array) => Promise<string>;
|
|
38
40
|
addressFromMnemonic: (mnemonic: string) => Promise<Uint8Array>;
|
|
39
41
|
addressFromBech32: (bech32Address: string) => Promise<Uint8Array>;
|
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,sBAAsB,EACtB,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;IAEjB,2BAA2B,CAAC,EAAE,OAAO,CAAC;CACvC;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,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC,CAAC;IAClC,sBAAsB,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;IAC9C,WAAW,EAAE,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;IACtC,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAA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CAAC,EAAE,MAAM,KACV,OAAO,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC,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":"
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/api/types.ts"],"names":[],"mappings":"AAkBA,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 GetActivatedAccountResponse,\n HelloStreamResponse,\n QueryAccountResponse,\n QueryResponse,\n SelectAccountResponse,\n ActivateAccountResponse,\n SendResponse,\n SetChainIDResponse,\n SetPasswordResponse,\n SetRemoteResponse,\n UpdatePasswordResponse,\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 // If true, initBridge also starts a Gnokey Mobile service. (Only needed for the Gnokey Mobile app.)\n start_gnokey_mobile_service?: boolean;\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 activateAccount: (nameOrBech32: string) => Promise<ActivateAccountResponse>;\n setPassword: (password: string, address?: Uint8Array) => Promise<SetPasswordResponse>;\n updatePassword: (password: string, address?: Uint8Array) => Promise<UpdatePasswordResponse>;\n getActiveAccount: () => Promise<GetActiveAccountResponse>;\n getActivatedAccount: () => Promise<GetActivatedAccountResponse>;\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 callerAddress?: Uint8Array,\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 callerAddress?: Uint8Array,\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
CHANGED
|
Binary file
|
package/package.json
CHANGED
package/src/api/GnoNativeApi.ts
CHANGED
|
@@ -10,6 +10,8 @@ import {
|
|
|
10
10
|
GenerateRecoveryPhraseRequest,
|
|
11
11
|
GetActiveAccountRequest,
|
|
12
12
|
GetActiveAccountResponse,
|
|
13
|
+
GetActivatedAccountRequest,
|
|
14
|
+
GetActivatedAccountResponse,
|
|
13
15
|
GetChainIDRequest,
|
|
14
16
|
GetKeyInfoByAddressRequest,
|
|
15
17
|
GetKeyInfoByNameOrAddressRequest,
|
|
@@ -32,6 +34,8 @@ import {
|
|
|
32
34
|
RenderRequest,
|
|
33
35
|
SelectAccountRequest,
|
|
34
36
|
SelectAccountResponse,
|
|
37
|
+
ActivateAccountRequest,
|
|
38
|
+
ActivateAccountResponse,
|
|
35
39
|
SendRequest,
|
|
36
40
|
SendResponse,
|
|
37
41
|
SetChainIDRequest,
|
|
@@ -213,6 +217,16 @@ export class GnoNativeApi implements GnoKeyApi, GoBridgeInterface {
|
|
|
213
217
|
return response;
|
|
214
218
|
}
|
|
215
219
|
|
|
220
|
+
async activateAccount(nameOrBech32: string): Promise<ActivateAccountResponse> {
|
|
221
|
+
const client = await this.#getClient();
|
|
222
|
+
const response = await client.activateAccount(
|
|
223
|
+
new ActivateAccountRequest({
|
|
224
|
+
nameOrBech32,
|
|
225
|
+
}),
|
|
226
|
+
);
|
|
227
|
+
return response;
|
|
228
|
+
}
|
|
229
|
+
|
|
216
230
|
async getClient(): Promise<PromiseClient<typeof GnoNativeService>> {
|
|
217
231
|
if (!this.clientInstance) {
|
|
218
232
|
throw new Error('GoBridge client instance not initialized.');
|
|
@@ -224,15 +238,15 @@ export class GnoNativeApi implements GnoKeyApi, GoBridgeInterface {
|
|
|
224
238
|
return this.clientInstance !== undefined;
|
|
225
239
|
}
|
|
226
240
|
|
|
227
|
-
async setPassword(password: string): Promise<SetPasswordResponse> {
|
|
241
|
+
async setPassword(password: string, address?: Uint8Array): Promise<SetPasswordResponse> {
|
|
228
242
|
const client = await this.#getClient();
|
|
229
|
-
const response = await client.setPassword(new SetPasswordRequest({ password }));
|
|
243
|
+
const response = await client.setPassword(new SetPasswordRequest({ password, address }));
|
|
230
244
|
return response;
|
|
231
245
|
}
|
|
232
246
|
|
|
233
|
-
async updatePassword(newPassword: string): Promise<UpdatePasswordResponse> {
|
|
247
|
+
async updatePassword(newPassword: string, address?: Uint8Array): Promise<UpdatePasswordResponse> {
|
|
234
248
|
const client = await this.#getClient();
|
|
235
|
-
const response = await client.updatePassword(new UpdatePasswordRequest({ newPassword }));
|
|
249
|
+
const response = await client.updatePassword(new UpdatePasswordRequest({ newPassword, address }));
|
|
236
250
|
return response;
|
|
237
251
|
}
|
|
238
252
|
|
|
@@ -242,6 +256,12 @@ export class GnoNativeApi implements GnoKeyApi, GoBridgeInterface {
|
|
|
242
256
|
return response;
|
|
243
257
|
}
|
|
244
258
|
|
|
259
|
+
async getActivatedAccount(): Promise<GetActivatedAccountResponse> {
|
|
260
|
+
const client = await this.#getClient();
|
|
261
|
+
const response = await client.getActivatedAccount(new GetActivatedAccountRequest());
|
|
262
|
+
return response;
|
|
263
|
+
}
|
|
264
|
+
|
|
245
265
|
async queryAccount(address: Uint8Array): Promise<QueryAccountResponse> {
|
|
246
266
|
const client = await this.#getClient();
|
|
247
267
|
const reponse = await client.queryAccount(new QueryAccountRequest({ address }));
|
|
@@ -303,6 +323,7 @@ export class GnoNativeApi implements GnoKeyApi, GoBridgeInterface {
|
|
|
303
323
|
args: string[],
|
|
304
324
|
gasFee: string,
|
|
305
325
|
gasWanted: number,
|
|
326
|
+
callerAddress?: Uint8Array,
|
|
306
327
|
send?: string,
|
|
307
328
|
memo?: string,
|
|
308
329
|
): Promise<AsyncIterable<CallResponse>> {
|
|
@@ -312,6 +333,7 @@ export class GnoNativeApi implements GnoKeyApi, GoBridgeInterface {
|
|
|
312
333
|
gasFee,
|
|
313
334
|
gasWanted: BigInt(gasWanted),
|
|
314
335
|
memo,
|
|
336
|
+
callerAddress,
|
|
315
337
|
msgs: [
|
|
316
338
|
new MsgCall({
|
|
317
339
|
packagePath,
|
|
@@ -330,6 +352,7 @@ export class GnoNativeApi implements GnoKeyApi, GoBridgeInterface {
|
|
|
330
352
|
send: string,
|
|
331
353
|
gasFee: string,
|
|
332
354
|
gasWanted: number,
|
|
355
|
+
callerAddress?: Uint8Array,
|
|
333
356
|
memo?: string,
|
|
334
357
|
): Promise<AsyncIterable<SendResponse>> {
|
|
335
358
|
const client = await this.#getClient();
|
|
@@ -338,6 +361,7 @@ export class GnoNativeApi implements GnoKeyApi, GoBridgeInterface {
|
|
|
338
361
|
gasFee,
|
|
339
362
|
gasWanted: BigInt(gasWanted),
|
|
340
363
|
memo,
|
|
364
|
+
callerAddress,
|
|
341
365
|
msgs: [
|
|
342
366
|
new MsgSend({
|
|
343
367
|
toAddress,
|
package/src/api/types.ts
CHANGED
|
@@ -2,10 +2,12 @@ import {
|
|
|
2
2
|
CallResponse,
|
|
3
3
|
DeleteAccountResponse,
|
|
4
4
|
GetActiveAccountResponse,
|
|
5
|
+
GetActivatedAccountResponse,
|
|
5
6
|
HelloStreamResponse,
|
|
6
7
|
QueryAccountResponse,
|
|
7
8
|
QueryResponse,
|
|
8
9
|
SelectAccountResponse,
|
|
10
|
+
ActivateAccountResponse,
|
|
9
11
|
SendResponse,
|
|
10
12
|
SetChainIDResponse,
|
|
11
13
|
SetPasswordResponse,
|
|
@@ -46,9 +48,11 @@ export interface GnoKeyApi {
|
|
|
46
48
|
getKeyInfoByAddress: (address: Uint8Array) => Promise<KeyInfo | undefined>;
|
|
47
49
|
getKeyInfoByNameOrAddress: (nameOrBech32: string) => Promise<KeyInfo | undefined>;
|
|
48
50
|
selectAccount: (nameOrBech32: string) => Promise<SelectAccountResponse>;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
+
activateAccount: (nameOrBech32: string) => Promise<ActivateAccountResponse>;
|
|
52
|
+
setPassword: (password: string, address?: Uint8Array) => Promise<SetPasswordResponse>;
|
|
53
|
+
updatePassword: (password: string, address?: Uint8Array) => Promise<UpdatePasswordResponse>;
|
|
51
54
|
getActiveAccount: () => Promise<GetActiveAccountResponse>;
|
|
55
|
+
getActivatedAccount: () => Promise<GetActivatedAccountResponse>;
|
|
52
56
|
queryAccount: (address: Uint8Array) => Promise<QueryAccountResponse>;
|
|
53
57
|
deleteAccount: (
|
|
54
58
|
nameOrBech32: string,
|
|
@@ -64,6 +68,7 @@ export interface GnoKeyApi {
|
|
|
64
68
|
args: string[],
|
|
65
69
|
gasFee: string,
|
|
66
70
|
gasWanted: number,
|
|
71
|
+
callerAddress?: Uint8Array,
|
|
67
72
|
send?: string,
|
|
68
73
|
memo?: string,
|
|
69
74
|
) => Promise<AsyncIterable<CallResponse>>;
|
|
@@ -72,6 +77,7 @@ export interface GnoKeyApi {
|
|
|
72
77
|
send: string,
|
|
73
78
|
gasFee: string,
|
|
74
79
|
gasWanted: number,
|
|
80
|
+
callerAddress?: Uint8Array,
|
|
75
81
|
memo?: string,
|
|
76
82
|
) => Promise<AsyncIterable<SendResponse>>;
|
|
77
83
|
addressToBech32: (address: Uint8Array) => Promise<string>;
|