@gnolang/gnonative 2.0.0 → 3.0.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.
Binary file
@@ -1,4 +1,4 @@
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';
1
+ import { BroadcastTxCommitResponse, CallResponse, DeleteAccountResponse, GetActivatedAccountResponse, HelloStreamResponse, KeyInfo, MakeTxResponse, QueryAccountResponse, QueryResponse, ActivateAccountResponse, SendResponse, SetChainIDResponse, SetPasswordResponse, SetRemoteResponse, SignTxResponse, 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';
@@ -12,6 +12,7 @@ export declare class GnoNativeApi implements GnoKeyApi, GoBridgeInterface {
12
12
  initClient(): Promise<boolean>;
13
13
  setRemote(remote: string): Promise<SetRemoteResponse>;
14
14
  getRemote(): Promise<string>;
15
+ signTx(txJson: string, address: Uint8Array, accountNumber?: bigint, sequenceNumber?: bigint): Promise<SignTxResponse>;
15
16
  setChainID(chainId: string): Promise<SetChainIDResponse>;
16
17
  getChainID(): Promise<string>;
17
18
  createAccount(nameOrBech32: string, mnemonic: string, password: string): Promise<KeyInfo | undefined>;
@@ -23,24 +24,24 @@ export declare class GnoNativeApi implements GnoKeyApi, GoBridgeInterface {
23
24
  getKeyInfoByAddress(address: Uint8Array): Promise<KeyInfo | undefined>;
24
25
  getKeyInfoByNameOrAddress(nameOrBech32: string): Promise<KeyInfo | undefined>;
25
26
  listKeyInfo(): Promise<KeyInfo[]>;
26
- selectAccount(nameOrBech32: string): Promise<SelectAccountResponse>;
27
+ makeCallTx(packagePath: string, fnc: string, args: string[], gasFee: string, gasWanted: bigint, callerAddress?: Uint8Array, send?: string, memo?: string): Promise<MakeTxResponse>;
27
28
  activateAccount(nameOrBech32: string): Promise<ActivateAccountResponse>;
28
29
  getClient(): Promise<PromiseClient<typeof GnoNativeService>>;
29
30
  isInitialized(): boolean;
30
- setPassword(password: string, address?: Uint8Array): Promise<SetPasswordResponse>;
31
+ setPassword(password: string, address: Uint8Array): Promise<SetPasswordResponse>;
31
32
  updatePassword(newPassword: string, addresses: Uint8Array[]): Promise<UpdatePasswordResponse>;
32
- getActiveAccount(): Promise<GetActiveAccountResponse>;
33
33
  getActivatedAccount(): Promise<GetActivatedAccountResponse>;
34
34
  queryAccount(address: Uint8Array): Promise<QueryAccountResponse>;
35
35
  deleteAccount(nameOrBech32: string, password: string | undefined, skipPassword: boolean): Promise<DeleteAccountResponse>;
36
36
  query(path: string, data: Uint8Array): Promise<QueryResponse>;
37
37
  render(packagePath: string, args: string): Promise<string>;
38
38
  qEval(packagePath: string, expression: string): Promise<string>;
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
+ call(packagePath: string, fnc: string, args: string[], gasFee: string, gasWanted: bigint, callerAddress: Uint8Array, send?: string, memo?: string): Promise<AsyncIterable<CallResponse>>;
40
+ send(toAddress: Uint8Array, send: string, gasFee: string, gasWanted: bigint, callerAddress: Uint8Array, memo?: string): Promise<AsyncIterable<SendResponse>>;
41
41
  addressToBech32(address: Uint8Array): Promise<string>;
42
42
  addressFromMnemonic(mnemonic: string): Promise<Uint8Array>;
43
43
  addressFromBech32(bech32Address: string): Promise<Uint8Array>;
44
+ broadcastTxCommit(signedTxJson: string): Promise<AsyncIterable<BroadcastTxCommitResponse>>;
44
45
  hello(name: string): Promise<string>;
45
46
  helloStream(name: string): Promise<AsyncIterable<HelloStreamResponse>>;
46
47
  initBridge(): Promise<void>;
@@ -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,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,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAMrD,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC;IAM5B,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAMxD,UAAU;IAMV,aAAa,CACjB,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,MAAM,EAChB,QAAQ,E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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,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, 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';
1
+ import { AddressFromBech32Request, AddressToBech32Request, AddressFromMnemonicRequest, CallRequest, CreateAccountRequest, DeleteAccountRequest, GenerateRecoveryPhraseRequest, GetActivatedAccountRequest, GetChainIDRequest, GetKeyInfoByAddressRequest, GetKeyInfoByNameOrAddressRequest, GetKeyInfoByNameRequest, GetRemoteRequest, HasKeyByAddressRequest, HasKeyByNameOrAddressRequest, HasKeyByNameRequest, HelloRequest, ListKeyInfoRequest, MsgCall, MsgSend, QEvalRequest, QueryAccountRequest, QueryRequest, RenderRequest, 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';
@@ -54,27 +54,32 @@ export class GnoNativeApi {
54
54
  return this.clientInstance;
55
55
  }
56
56
  async setRemote(remote) {
57
- const client = await this.#getClient();
58
- const response = await client.setRemote(new SetRemoteRequest({ remote }));
57
+ const client = this.#getClient();
58
+ const response = client.setRemote(new SetRemoteRequest({ remote }));
59
59
  return response;
60
60
  }
61
61
  async getRemote() {
62
- const client = await this.#getClient();
62
+ const client = this.#getClient();
63
63
  const response = await client.getRemote(new GetRemoteRequest());
64
64
  return response.remote;
65
65
  }
66
+ async signTx(txJson, address, accountNumber = BigInt(0), sequenceNumber = BigInt(0)) {
67
+ const client = this.#getClient();
68
+ const response = client.signTx({ txJson, address, accountNumber, sequenceNumber });
69
+ return response;
70
+ }
66
71
  async setChainID(chainId) {
67
- const client = await this.#getClient();
68
- const response = await client.setChainID(new SetChainIDRequest({ chainId }));
72
+ const client = this.#getClient();
73
+ const response = client.setChainID(new SetChainIDRequest({ chainId }));
69
74
  return response;
70
75
  }
71
76
  async getChainID() {
72
- const client = await this.#getClient();
77
+ const client = this.#getClient();
73
78
  const response = await client.getChainID(new GetChainIDRequest());
74
79
  return response.chainId;
75
80
  }
76
81
  async createAccount(nameOrBech32, mnemonic, password) {
77
- const client = await this.#getClient();
82
+ const client = this.#getClient();
78
83
  const reponse = await client.createAccount(new CreateAccountRequest({
79
84
  nameOrBech32,
80
85
  mnemonic,
@@ -83,55 +88,66 @@ export class GnoNativeApi {
83
88
  return reponse.key;
84
89
  }
85
90
  async generateRecoveryPhrase() {
86
- const client = await this.#getClient();
91
+ const client = this.#getClient();
87
92
  const response = await client.generateRecoveryPhrase(new GenerateRecoveryPhraseRequest());
88
93
  return response.phrase;
89
94
  }
90
95
  async hasKeyByName(name) {
91
- const client = await this.#getClient();
96
+ const client = this.#getClient();
92
97
  const response = await client.hasKeyByName(new HasKeyByNameRequest({ name }));
93
98
  return response.has;
94
99
  }
95
100
  async hasKeyByAddress(address) {
96
- const client = await this.#getClient();
101
+ const client = this.#getClient();
97
102
  const response = await client.hasKeyByAddress(new HasKeyByAddressRequest({ address }));
98
103
  return response.has;
99
104
  }
100
105
  async hasKeyByNameOrAddress(nameOrBech32) {
101
- const client = await this.#getClient();
106
+ const client = this.#getClient();
102
107
  const response = await client.hasKeyByNameOrAddress(new HasKeyByNameOrAddressRequest({ nameOrBech32 }));
103
108
  return response.has;
104
109
  }
105
110
  async getKeyInfoByName(name) {
106
- const client = await this.#getClient();
111
+ const client = this.#getClient();
107
112
  const response = await client.getKeyInfoByName(new GetKeyInfoByNameRequest({ name }));
108
113
  return response.key;
109
114
  }
110
115
  async getKeyInfoByAddress(address) {
111
- const client = await this.#getClient();
116
+ const client = this.#getClient();
112
117
  const response = await client.getKeyInfoByAddress(new GetKeyInfoByAddressRequest({ address }));
113
118
  return response.key;
114
119
  }
115
120
  async getKeyInfoByNameOrAddress(nameOrBech32) {
116
- const client = await this.#getClient();
121
+ const client = this.#getClient();
117
122
  const response = await client.getKeyInfoByNameOrAddress(new GetKeyInfoByNameOrAddressRequest({ nameOrBech32 }));
118
123
  return response.key;
119
124
  }
120
125
  async listKeyInfo() {
121
- const client = await this.#getClient();
126
+ const client = this.#getClient();
122
127
  const response = await client.listKeyInfo(new ListKeyInfoRequest());
123
128
  return response.keys;
124
129
  }
125
- async selectAccount(nameOrBech32) {
126
- const client = await this.#getClient();
127
- const response = await client.selectAccount(new SelectAccountRequest({
128
- nameOrBech32,
129
- }));
130
- return response;
130
+ async makeCallTx(packagePath, fnc, args, gasFee, gasWanted, callerAddress, send, memo) {
131
+ const client = this.#getClient();
132
+ const reponse = client.makeCallTx({
133
+ gasFee,
134
+ gasWanted,
135
+ memo,
136
+ callerAddress,
137
+ msgs: [
138
+ {
139
+ packagePath,
140
+ fnc,
141
+ args,
142
+ send,
143
+ },
144
+ ],
145
+ });
146
+ return reponse;
131
147
  }
132
148
  async activateAccount(nameOrBech32) {
133
- const client = await this.#getClient();
134
- const response = await client.activateAccount(new ActivateAccountRequest({
149
+ const client = this.#getClient();
150
+ const response = client.activateAccount(new ActivateAccountRequest({
135
151
  nameOrBech32,
136
152
  }));
137
153
  return response;
@@ -146,33 +162,28 @@ export class GnoNativeApi {
146
162
  return this.clientInstance !== undefined;
147
163
  }
148
164
  async setPassword(password, address) {
149
- const client = await this.#getClient();
150
- const response = await client.setPassword(new SetPasswordRequest({ password, address }));
165
+ const client = this.#getClient();
166
+ const response = client.setPassword(new SetPasswordRequest({ password, address }));
151
167
  return response;
152
168
  }
153
169
  async updatePassword(newPassword, addresses) {
154
- const client = await this.#getClient();
155
- const response = await client.updatePassword(new UpdatePasswordRequest({ newPassword, addresses }));
156
- return response;
157
- }
158
- async getActiveAccount() {
159
- const client = await this.#getClient();
160
- const response = await client.getActiveAccount(new GetActiveAccountRequest());
170
+ const client = this.#getClient();
171
+ const response = client.updatePassword(new UpdatePasswordRequest({ newPassword, addresses }));
161
172
  return response;
162
173
  }
163
174
  async getActivatedAccount() {
164
- const client = await this.#getClient();
165
- const response = await client.getActivatedAccount(new GetActivatedAccountRequest());
175
+ const client = this.#getClient();
176
+ const response = client.getActivatedAccount(new GetActivatedAccountRequest());
166
177
  return response;
167
178
  }
168
179
  async queryAccount(address) {
169
- const client = await this.#getClient();
170
- const reponse = await client.queryAccount(new QueryAccountRequest({ address }));
180
+ const client = this.#getClient();
181
+ const reponse = client.queryAccount(new QueryAccountRequest({ address }));
171
182
  return reponse;
172
183
  }
173
184
  async deleteAccount(nameOrBech32, password, skipPassword) {
174
- const client = await this.#getClient();
175
- const response = await client.deleteAccount(new DeleteAccountRequest({
185
+ const client = this.#getClient();
186
+ const response = client.deleteAccount(new DeleteAccountRequest({
176
187
  nameOrBech32,
177
188
  password,
178
189
  skipPassword,
@@ -180,15 +191,15 @@ export class GnoNativeApi {
180
191
  return response;
181
192
  }
182
193
  async query(path, data) {
183
- const client = await this.#getClient();
184
- const reponse = await client.query(new QueryRequest({
194
+ const client = this.#getClient();
195
+ const reponse = client.query(new QueryRequest({
185
196
  path,
186
197
  data,
187
198
  }));
188
199
  return reponse;
189
200
  }
190
201
  async render(packagePath, args) {
191
- const client = await this.#getClient();
202
+ const client = this.#getClient();
192
203
  const reponse = await client.render(new RenderRequest({
193
204
  packagePath,
194
205
  args,
@@ -196,7 +207,7 @@ export class GnoNativeApi {
196
207
  return reponse.result;
197
208
  }
198
209
  async qEval(packagePath, expression) {
199
- const client = await this.#getClient();
210
+ const client = this.#getClient();
200
211
  const reponse = await client.qEval(new QEvalRequest({
201
212
  packagePath,
202
213
  expression,
@@ -204,10 +215,10 @@ export class GnoNativeApi {
204
215
  return reponse.result;
205
216
  }
206
217
  async call(packagePath, fnc, args, gasFee, gasWanted, callerAddress, send, memo) {
207
- const client = await this.#getClient();
218
+ const client = this.#getClient();
208
219
  const reponse = client.call(new CallRequest({
209
220
  gasFee,
210
- gasWanted: BigInt(gasWanted),
221
+ gasWanted,
211
222
  memo,
212
223
  callerAddress,
213
224
  msgs: [
@@ -222,10 +233,10 @@ export class GnoNativeApi {
222
233
  return reponse;
223
234
  }
224
235
  async send(toAddress, send, gasFee, gasWanted, callerAddress, memo) {
225
- const client = await this.#getClient();
236
+ const client = this.#getClient();
226
237
  const reponse = client.send(new SendRequest({
227
238
  gasFee,
228
- gasWanted: BigInt(gasWanted),
239
+ gasWanted,
229
240
  memo,
230
241
  callerAddress,
231
242
  msgs: [
@@ -238,29 +249,34 @@ export class GnoNativeApi {
238
249
  return reponse;
239
250
  }
240
251
  async addressToBech32(address) {
241
- const client = await this.#getClient();
252
+ const client = this.#getClient();
242
253
  const response = await client.addressToBech32(new AddressToBech32Request({ address }));
243
254
  return response.bech32Address;
244
255
  }
245
256
  async addressFromMnemonic(mnemonic) {
246
- const client = await this.#getClient();
257
+ const client = this.#getClient();
247
258
  const response = await client.addressFromMnemonic(new AddressFromMnemonicRequest({ mnemonic }));
248
259
  return response.address;
249
260
  }
250
261
  async addressFromBech32(bech32Address) {
251
- const client = await this.#getClient();
262
+ const client = this.#getClient();
252
263
  const response = await client.addressFromBech32(new AddressFromBech32Request({ bech32Address }));
253
264
  return response.address;
254
265
  }
266
+ async broadcastTxCommit(signedTxJson) {
267
+ const client = this.#getClient();
268
+ const response = client.broadcastTxCommit({ signedTxJson });
269
+ return response;
270
+ }
255
271
  // // debug
256
272
  async hello(name) {
257
- const client = await this.#getClient();
273
+ const client = this.#getClient();
258
274
  const response = await client.hello(new HelloRequest({ name }));
259
275
  return response.greeting;
260
276
  }
261
277
  // // debug
262
278
  async helloStream(name) {
263
- const client = await this.#getClient();
279
+ const client = this.#getClient();
264
280
  return client.helloStream(new HelloRequest({ name }));
265
281
  }
266
282
  // Go Bridge Interface:
@@ -1 +1 @@
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,0BAA0B,EAE1B,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,oBA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O,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, addresses: Uint8Array[]): Promise<UpdatePasswordResponse> {\n const client = await this.#getClient();\n const response = await client.updatePassword(new UpdatePasswordRequest({ newPassword, addresses }));\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"]}
1
+ {"version":3,"file":"GnoNativeApi.js","sourceRoot":"","sources":["../../src/api/GnoNativeApi.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,sBAAsB,EACtB,0BAA0B,EAE1B,WAAW,EAEX,oBAAoB,EACpB,oBAAoB,EAEpB,6BAA6B,EAC7B,0BAA0B,EAE1B,iBAAiB,EACjB,0BAA0B,EAC1B,gCAAgC,EAChC,uBAAuB,EACvB,gBAAgB,EAChB,sBAAsB,EACtB,4BAA4B,EAC5B,mBAAmB,EACnB,YAAY,EAGZ,kBAAkB,EAElB,OAAO,EACP,OAAO,EACP,YAAY,EACZ,mBAAmB,EAEnB,YAAY,EAEZ,aAAa,EACb,sBAAsB,EAEtB,WAAW,EAEX,iBAAiB,EAEjB,kBAAkB,EAElB,gBAAgB,EAGhB,qBAAqB,GAEtB,MAAM,sDAAsD,CAAC;AAI9D,OAAO,EAAa,YAAY,EAAU,MAAM,SAAS,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAqB,MAAM,aAAa,CAAC;AAC1D,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAC;AAEvC,MAAM,OAAO,YAAY;IACvB,YAAY,GAAG,YAAY,CAAC,OAAO,CAAC;IACpC,MAAM,CAAS;IACf,cAAc,CAAqD;IAEnE,YAAY,MAA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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 BroadcastTxCommitResponse,\n CallRequest,\n CallResponse,\n CreateAccountRequest,\n DeleteAccountRequest,\n DeleteAccountResponse,\n GenerateRecoveryPhraseRequest,\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 MakeTxResponse,\n MsgCall,\n MsgSend,\n QEvalRequest,\n QueryAccountRequest,\n QueryAccountResponse,\n QueryRequest,\n QueryResponse,\n RenderRequest,\n ActivateAccountRequest,\n ActivateAccountResponse,\n SendRequest,\n SendResponse,\n SetChainIDRequest,\n SetChainIDResponse,\n SetPasswordRequest,\n SetPasswordResponse,\n SetRemoteRequest,\n SetRemoteResponse,\n SignTxResponse,\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 = this.#getClient();\n const response = client.setRemote(new SetRemoteRequest({ remote }));\n return response;\n }\n\n async getRemote(): Promise<string> {\n const client = this.#getClient();\n const response = await client.getRemote(new GetRemoteRequest());\n return response.remote;\n }\n\n async signTx(\n txJson: string,\n address: Uint8Array,\n accountNumber: bigint = BigInt(0),\n sequenceNumber: bigint = BigInt(0),\n ): Promise<SignTxResponse> {\n const client = this.#getClient();\n const response = client.signTx({ txJson, address, accountNumber, sequenceNumber });\n return response;\n }\n\n async setChainID(chainId: string): Promise<SetChainIDResponse> {\n const client = this.#getClient();\n const response = client.setChainID(new SetChainIDRequest({ chainId }));\n return response;\n }\n\n async getChainID() {\n const client = 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 = 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 = this.#getClient();\n const response = await client.generateRecoveryPhrase(new GenerateRecoveryPhraseRequest());\n return response.phrase;\n }\n\n async hasKeyByName(name: string) {\n const client = 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 = 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 = 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 = 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 = 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 = 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 = this.#getClient();\n const response = await client.listKeyInfo(new ListKeyInfoRequest());\n return response.keys;\n }\n\n async makeCallTx(\n packagePath: string,\n fnc: string,\n args: string[],\n gasFee: string,\n gasWanted: bigint,\n callerAddress?: Uint8Array,\n send?: string,\n memo?: string,\n ): Promise<MakeTxResponse> {\n const client = this.#getClient();\n const reponse = client.makeCallTx({\n gasFee,\n gasWanted,\n memo,\n callerAddress,\n msgs: [\n {\n packagePath,\n fnc,\n args,\n send,\n },\n ],\n });\n return reponse;\n }\n\n async activateAccount(nameOrBech32: string): Promise<ActivateAccountResponse> {\n const client = this.#getClient();\n const response = 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 = this.#getClient();\n const response = client.setPassword(new SetPasswordRequest({ password, address }));\n return response;\n }\n\n async updatePassword(\n newPassword: string,\n addresses: Uint8Array[],\n ): Promise<UpdatePasswordResponse> {\n const client = this.#getClient();\n const response = client.updatePassword(new UpdatePasswordRequest({ newPassword, addresses }));\n return response;\n }\n\n async getActivatedAccount(): Promise<GetActivatedAccountResponse> {\n const client = this.#getClient();\n const response = client.getActivatedAccount(new GetActivatedAccountRequest());\n return response;\n }\n\n async queryAccount(address: Uint8Array): Promise<QueryAccountResponse> {\n const client = this.#getClient();\n const reponse = 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 = this.#getClient();\n const response = 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 = this.#getClient();\n const reponse = 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 = 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 = 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: bigint,\n callerAddress: Uint8Array,\n send?: string,\n memo?: string,\n ): Promise<AsyncIterable<CallResponse>> {\n const client = this.#getClient();\n const reponse = client.call(\n new CallRequest({\n gasFee,\n 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: bigint,\n callerAddress: Uint8Array,\n memo?: string,\n ): Promise<AsyncIterable<SendResponse>> {\n const client = this.#getClient();\n const reponse = client.send(\n new SendRequest({\n gasFee,\n 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 = 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 = 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 = this.#getClient();\n const response = await client.addressFromBech32(\n new AddressFromBech32Request({ bech32Address }),\n );\n return response.address;\n }\n\n async broadcastTxCommit(signedTxJson: string): Promise<AsyncIterable<BroadcastTxCommitResponse>> {\n const client = this.#getClient();\n const response = client.broadcastTxCommit({ signedTxJson });\n return response;\n }\n\n // // debug\n async hello(name: string) {\n const client = 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 = 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,4 +1,4 @@
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';
1
+ import { CallResponse, DeleteAccountResponse, GetActivatedAccountResponse, HelloStreamResponse, QueryAccountResponse, QueryResponse, ActivateAccountResponse, SendResponse, SetChainIDResponse, SetPasswordResponse, SetRemoteResponse, UpdatePasswordResponse, KeyInfo, SignTxResponse, MakeTxResponse, BroadcastTxCommitResponse } from '@buf/gnolang_gnonative.bufbuild_es/gnonativetypes_pb';
2
2
  export declare enum BridgeStatus {
3
3
  Stopped = 0,
4
4
  Starting = 1,
@@ -23,22 +23,23 @@ export interface GnoKeyApi {
23
23
  getKeyInfoByName: (name: string) => Promise<KeyInfo | undefined>;
24
24
  getKeyInfoByAddress: (address: Uint8Array) => Promise<KeyInfo | undefined>;
25
25
  getKeyInfoByNameOrAddress: (nameOrBech32: string) => Promise<KeyInfo | undefined>;
26
- selectAccount: (nameOrBech32: string) => Promise<SelectAccountResponse>;
27
26
  activateAccount: (nameOrBech32: string) => Promise<ActivateAccountResponse>;
28
- setPassword: (password: string, address?: Uint8Array) => Promise<SetPasswordResponse>;
27
+ setPassword: (password: string, address: Uint8Array) => Promise<SetPasswordResponse>;
29
28
  updatePassword: (password: string, addresses: Uint8Array[]) => Promise<UpdatePasswordResponse>;
30
- getActiveAccount: () => Promise<GetActiveAccountResponse>;
31
29
  getActivatedAccount: () => Promise<GetActivatedAccountResponse>;
32
30
  queryAccount: (address: Uint8Array) => Promise<QueryAccountResponse>;
33
31
  deleteAccount: (nameOrBech32: string, password: string | undefined, skipPassword: boolean) => Promise<DeleteAccountResponse>;
34
32
  query: (path: string, data: Uint8Array) => Promise<QueryResponse>;
35
33
  render: (packagePath: string, args: string) => Promise<string>;
36
34
  qEval: (packagePath: string, expression: string) => Promise<string>;
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>>;
35
+ call: (packagePath: string, fnc: string, args: string[], gasFee: string, gasWanted: bigint, callerAddress: Uint8Array, send?: string, memo?: string) => Promise<AsyncIterable<CallResponse>>;
36
+ send: (toAddress: Uint8Array, send: string, gasFee: string, gasWanted: bigint, callerAddress: Uint8Array, memo?: string) => Promise<AsyncIterable<SendResponse>>;
39
37
  addressToBech32: (address: Uint8Array) => Promise<string>;
40
38
  addressFromMnemonic: (mnemonic: string) => Promise<Uint8Array>;
41
39
  addressFromBech32: (bech32Address: string) => Promise<Uint8Array>;
40
+ signTx(txJson: string, address: Uint8Array, accountNumber?: bigint, sequenceNumber?: bigint): Promise<SignTxResponse>;
41
+ makeCallTx(packagePath: string, fnc: string, args: string[], gasFee: string, gasWanted: bigint, callerAddress?: Uint8Array, send?: string, memo?: string): Promise<MakeTxResponse>;
42
+ broadcastTxCommit(signedTxJson: string): Promise<AsyncIterable<BroadcastTxCommitResponse>>;
42
43
  hello: (name: string) => Promise<string>;
43
44
  helloStream: (name: string) => Promise<AsyncIterable<HelloStreamResponse>>;
44
45
  }
@@ -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,2BAA2B,EAC3B,mBAAmB,EACnB,oBAAoB,EACpB,aAAa,EACb,qBAAqB,EACrB,uBAAuB,EACvB,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,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AE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC,CAAC;IAE3F,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"}
@@ -1 +1 @@
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, addresses: 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"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/api/types.ts"],"names":[],"mappings":"AAmBA,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 GetActivatedAccountResponse,\n HelloStreamResponse,\n QueryAccountResponse,\n QueryResponse,\n ActivateAccountResponse,\n SendResponse,\n SetChainIDResponse,\n SetPasswordResponse,\n SetRemoteResponse,\n UpdatePasswordResponse,\n KeyInfo,\n SignTxResponse,\n MakeTxResponse,\n BroadcastTxCommitResponse,\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 activateAccount: (nameOrBech32: string) => Promise<ActivateAccountResponse>;\n setPassword: (password: string, address: Uint8Array) => Promise<SetPasswordResponse>;\n updatePassword: (password: string, addresses: Uint8Array[]) => Promise<UpdatePasswordResponse>;\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: bigint,\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: bigint,\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 signTx(\n txJson: string,\n address: Uint8Array,\n accountNumber?: bigint,\n sequenceNumber?: bigint,\n ): Promise<SignTxResponse>;\n makeCallTx(\n packagePath: string,\n fnc: string,\n args: string[],\n gasFee: string,\n gasWanted: bigint,\n callerAddress?: Uint8Array,\n send?: string,\n memo?: string,\n ): Promise<MakeTxResponse>;\n broadcastTxCommit(signedTxJson: string): Promise<AsyncIterable<BroadcastTxCommitResponse>>;\n // debug\n hello: (name: string) => Promise<string>;\n helloStream: (name: string) => Promise<AsyncIterable<HelloStreamResponse>>;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gnolang/gnonative",
3
- "version": "2.0.0",
3
+ "version": "3.0.1",
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",
@@ -2,14 +2,13 @@ import {
2
2
  AddressFromBech32Request,
3
3
  AddressToBech32Request,
4
4
  AddressFromMnemonicRequest,
5
+ BroadcastTxCommitResponse,
5
6
  CallRequest,
6
7
  CallResponse,
7
8
  CreateAccountRequest,
8
9
  DeleteAccountRequest,
9
10
  DeleteAccountResponse,
10
11
  GenerateRecoveryPhraseRequest,
11
- GetActiveAccountRequest,
12
- GetActiveAccountResponse,
13
12
  GetActivatedAccountRequest,
14
13
  GetActivatedAccountResponse,
15
14
  GetChainIDRequest,
@@ -24,6 +23,7 @@ import {
24
23
  HelloStreamResponse,
25
24
  KeyInfo,
26
25
  ListKeyInfoRequest,
26
+ MakeTxResponse,
27
27
  MsgCall,
28
28
  MsgSend,
29
29
  QEvalRequest,
@@ -32,8 +32,6 @@ import {
32
32
  QueryRequest,
33
33
  QueryResponse,
34
34
  RenderRequest,
35
- SelectAccountRequest,
36
- SelectAccountResponse,
37
35
  ActivateAccountRequest,
38
36
  ActivateAccountResponse,
39
37
  SendRequest,
@@ -44,6 +42,7 @@ import {
44
42
  SetPasswordResponse,
45
43
  SetRemoteRequest,
46
44
  SetRemoteResponse,
45
+ SignTxResponse,
47
46
  UpdatePasswordRequest,
48
47
  UpdatePasswordResponse,
49
48
  } from '@buf/gnolang_gnonative.bufbuild_es/gnonativetypes_pb';
@@ -116,25 +115,36 @@ export class GnoNativeApi implements GnoKeyApi, GoBridgeInterface {
116
115
  }
117
116
 
118
117
  async setRemote(remote: string): Promise<SetRemoteResponse> {
119
- const client = await this.#getClient();
120
- const response = await client.setRemote(new SetRemoteRequest({ remote }));
118
+ const client = this.#getClient();
119
+ const response = client.setRemote(new SetRemoteRequest({ remote }));
121
120
  return response;
122
121
  }
123
122
 
124
123
  async getRemote(): Promise<string> {
125
- const client = await this.#getClient();
124
+ const client = this.#getClient();
126
125
  const response = await client.getRemote(new GetRemoteRequest());
127
126
  return response.remote;
128
127
  }
129
128
 
129
+ async signTx(
130
+ txJson: string,
131
+ address: Uint8Array,
132
+ accountNumber: bigint = BigInt(0),
133
+ sequenceNumber: bigint = BigInt(0),
134
+ ): Promise<SignTxResponse> {
135
+ const client = this.#getClient();
136
+ const response = client.signTx({ txJson, address, accountNumber, sequenceNumber });
137
+ return response;
138
+ }
139
+
130
140
  async setChainID(chainId: string): Promise<SetChainIDResponse> {
131
- const client = await this.#getClient();
132
- const response = await client.setChainID(new SetChainIDRequest({ chainId }));
141
+ const client = this.#getClient();
142
+ const response = client.setChainID(new SetChainIDRequest({ chainId }));
133
143
  return response;
134
144
  }
135
145
 
136
146
  async getChainID() {
137
- const client = await this.#getClient();
147
+ const client = this.#getClient();
138
148
  const response = await client.getChainID(new GetChainIDRequest());
139
149
  return response.chainId;
140
150
  }
@@ -144,7 +154,7 @@ export class GnoNativeApi implements GnoKeyApi, GoBridgeInterface {
144
154
  mnemonic: string,
145
155
  password: string,
146
156
  ): Promise<KeyInfo | undefined> {
147
- const client = await this.#getClient();
157
+ const client = this.#getClient();
148
158
  const reponse = await client.createAccount(
149
159
  new CreateAccountRequest({
150
160
  nameOrBech32,
@@ -156,25 +166,25 @@ export class GnoNativeApi implements GnoKeyApi, GoBridgeInterface {
156
166
  }
157
167
 
158
168
  async generateRecoveryPhrase() {
159
- const client = await this.#getClient();
169
+ const client = this.#getClient();
160
170
  const response = await client.generateRecoveryPhrase(new GenerateRecoveryPhraseRequest());
161
171
  return response.phrase;
162
172
  }
163
173
 
164
174
  async hasKeyByName(name: string) {
165
- const client = await this.#getClient();
175
+ const client = this.#getClient();
166
176
  const response = await client.hasKeyByName(new HasKeyByNameRequest({ name }));
167
177
  return response.has;
168
178
  }
169
179
 
170
180
  async hasKeyByAddress(address: Uint8Array) {
171
- const client = await this.#getClient();
181
+ const client = this.#getClient();
172
182
  const response = await client.hasKeyByAddress(new HasKeyByAddressRequest({ address }));
173
183
  return response.has;
174
184
  }
175
185
 
176
186
  async hasKeyByNameOrAddress(nameOrBech32: string) {
177
- const client = await this.#getClient();
187
+ const client = this.#getClient();
178
188
  const response = await client.hasKeyByNameOrAddress(
179
189
  new HasKeyByNameOrAddressRequest({ nameOrBech32 }),
180
190
  );
@@ -182,19 +192,19 @@ export class GnoNativeApi implements GnoKeyApi, GoBridgeInterface {
182
192
  }
183
193
 
184
194
  async getKeyInfoByName(name: string): Promise<KeyInfo | undefined> {
185
- const client = await this.#getClient();
195
+ const client = this.#getClient();
186
196
  const response = await client.getKeyInfoByName(new GetKeyInfoByNameRequest({ name }));
187
197
  return response.key;
188
198
  }
189
199
 
190
200
  async getKeyInfoByAddress(address: Uint8Array): Promise<KeyInfo | undefined> {
191
- const client = await this.#getClient();
201
+ const client = this.#getClient();
192
202
  const response = await client.getKeyInfoByAddress(new GetKeyInfoByAddressRequest({ address }));
193
203
  return response.key;
194
204
  }
195
205
 
196
206
  async getKeyInfoByNameOrAddress(nameOrBech32: string): Promise<KeyInfo | undefined> {
197
- const client = await this.#getClient();
207
+ const client = this.#getClient();
198
208
  const response = await client.getKeyInfoByNameOrAddress(
199
209
  new GetKeyInfoByNameOrAddressRequest({ nameOrBech32 }),
200
210
  );
@@ -202,24 +212,42 @@ export class GnoNativeApi implements GnoKeyApi, GoBridgeInterface {
202
212
  }
203
213
 
204
214
  async listKeyInfo(): Promise<KeyInfo[]> {
205
- const client = await this.#getClient();
215
+ const client = this.#getClient();
206
216
  const response = await client.listKeyInfo(new ListKeyInfoRequest());
207
217
  return response.keys;
208
218
  }
209
219
 
210
- async selectAccount(nameOrBech32: string): Promise<SelectAccountResponse> {
211
- const client = await this.#getClient();
212
- const response = await client.selectAccount(
213
- new SelectAccountRequest({
214
- nameOrBech32,
215
- }),
216
- );
217
- return response;
220
+ async makeCallTx(
221
+ packagePath: string,
222
+ fnc: string,
223
+ args: string[],
224
+ gasFee: string,
225
+ gasWanted: bigint,
226
+ callerAddress?: Uint8Array,
227
+ send?: string,
228
+ memo?: string,
229
+ ): Promise<MakeTxResponse> {
230
+ const client = this.#getClient();
231
+ const reponse = client.makeCallTx({
232
+ gasFee,
233
+ gasWanted,
234
+ memo,
235
+ callerAddress,
236
+ msgs: [
237
+ {
238
+ packagePath,
239
+ fnc,
240
+ args,
241
+ send,
242
+ },
243
+ ],
244
+ });
245
+ return reponse;
218
246
  }
219
247
 
220
248
  async activateAccount(nameOrBech32: string): Promise<ActivateAccountResponse> {
221
- const client = await this.#getClient();
222
- const response = await client.activateAccount(
249
+ const client = this.#getClient();
250
+ const response = client.activateAccount(
223
251
  new ActivateAccountRequest({
224
252
  nameOrBech32,
225
253
  }),
@@ -238,33 +266,30 @@ export class GnoNativeApi implements GnoKeyApi, GoBridgeInterface {
238
266
  return this.clientInstance !== undefined;
239
267
  }
240
268
 
241
- async setPassword(password: string, address?: Uint8Array): Promise<SetPasswordResponse> {
242
- const client = await this.#getClient();
243
- const response = await client.setPassword(new SetPasswordRequest({ password, address }));
244
- return response;
245
- }
246
-
247
- async updatePassword(newPassword: string, addresses: Uint8Array[]): Promise<UpdatePasswordResponse> {
248
- const client = await this.#getClient();
249
- const response = await client.updatePassword(new UpdatePasswordRequest({ newPassword, addresses }));
269
+ async setPassword(password: string, address: Uint8Array): Promise<SetPasswordResponse> {
270
+ const client = this.#getClient();
271
+ const response = client.setPassword(new SetPasswordRequest({ password, address }));
250
272
  return response;
251
273
  }
252
274
 
253
- async getActiveAccount(): Promise<GetActiveAccountResponse> {
254
- const client = await this.#getClient();
255
- const response = await client.getActiveAccount(new GetActiveAccountRequest());
275
+ async updatePassword(
276
+ newPassword: string,
277
+ addresses: Uint8Array[],
278
+ ): Promise<UpdatePasswordResponse> {
279
+ const client = this.#getClient();
280
+ const response = client.updatePassword(new UpdatePasswordRequest({ newPassword, addresses }));
256
281
  return response;
257
282
  }
258
283
 
259
284
  async getActivatedAccount(): Promise<GetActivatedAccountResponse> {
260
- const client = await this.#getClient();
261
- const response = await client.getActivatedAccount(new GetActivatedAccountRequest());
285
+ const client = this.#getClient();
286
+ const response = client.getActivatedAccount(new GetActivatedAccountRequest());
262
287
  return response;
263
288
  }
264
289
 
265
290
  async queryAccount(address: Uint8Array): Promise<QueryAccountResponse> {
266
- const client = await this.#getClient();
267
- const reponse = await client.queryAccount(new QueryAccountRequest({ address }));
291
+ const client = this.#getClient();
292
+ const reponse = client.queryAccount(new QueryAccountRequest({ address }));
268
293
  return reponse;
269
294
  }
270
295
 
@@ -273,8 +298,8 @@ export class GnoNativeApi implements GnoKeyApi, GoBridgeInterface {
273
298
  password: string | undefined,
274
299
  skipPassword: boolean,
275
300
  ): Promise<DeleteAccountResponse> {
276
- const client = await this.#getClient();
277
- const response = await client.deleteAccount(
301
+ const client = this.#getClient();
302
+ const response = client.deleteAccount(
278
303
  new DeleteAccountRequest({
279
304
  nameOrBech32,
280
305
  password,
@@ -285,8 +310,8 @@ export class GnoNativeApi implements GnoKeyApi, GoBridgeInterface {
285
310
  }
286
311
 
287
312
  async query(path: string, data: Uint8Array): Promise<QueryResponse> {
288
- const client = await this.#getClient();
289
- const reponse = await client.query(
313
+ const client = this.#getClient();
314
+ const reponse = client.query(
290
315
  new QueryRequest({
291
316
  path,
292
317
  data,
@@ -296,7 +321,7 @@ export class GnoNativeApi implements GnoKeyApi, GoBridgeInterface {
296
321
  }
297
322
 
298
323
  async render(packagePath: string, args: string) {
299
- const client = await this.#getClient();
324
+ const client = this.#getClient();
300
325
  const reponse = await client.render(
301
326
  new RenderRequest({
302
327
  packagePath,
@@ -307,7 +332,7 @@ export class GnoNativeApi implements GnoKeyApi, GoBridgeInterface {
307
332
  }
308
333
 
309
334
  async qEval(packagePath: string, expression: string) {
310
- const client = await this.#getClient();
335
+ const client = this.#getClient();
311
336
  const reponse = await client.qEval(
312
337
  new QEvalRequest({
313
338
  packagePath,
@@ -322,16 +347,16 @@ export class GnoNativeApi implements GnoKeyApi, GoBridgeInterface {
322
347
  fnc: string,
323
348
  args: string[],
324
349
  gasFee: string,
325
- gasWanted: number,
326
- callerAddress?: Uint8Array,
350
+ gasWanted: bigint,
351
+ callerAddress: Uint8Array,
327
352
  send?: string,
328
353
  memo?: string,
329
354
  ): Promise<AsyncIterable<CallResponse>> {
330
- const client = await this.#getClient();
355
+ const client = this.#getClient();
331
356
  const reponse = client.call(
332
357
  new CallRequest({
333
358
  gasFee,
334
- gasWanted: BigInt(gasWanted),
359
+ gasWanted,
335
360
  memo,
336
361
  callerAddress,
337
362
  msgs: [
@@ -351,15 +376,15 @@ export class GnoNativeApi implements GnoKeyApi, GoBridgeInterface {
351
376
  toAddress: Uint8Array,
352
377
  send: string,
353
378
  gasFee: string,
354
- gasWanted: number,
355
- callerAddress?: Uint8Array,
379
+ gasWanted: bigint,
380
+ callerAddress: Uint8Array,
356
381
  memo?: string,
357
382
  ): Promise<AsyncIterable<SendResponse>> {
358
- const client = await this.#getClient();
383
+ const client = this.#getClient();
359
384
  const reponse = client.send(
360
385
  new SendRequest({
361
386
  gasFee,
362
- gasWanted: BigInt(gasWanted),
387
+ gasWanted,
363
388
  memo,
364
389
  callerAddress,
365
390
  msgs: [
@@ -374,35 +399,41 @@ export class GnoNativeApi implements GnoKeyApi, GoBridgeInterface {
374
399
  }
375
400
 
376
401
  async addressToBech32(address: Uint8Array) {
377
- const client = await this.#getClient();
402
+ const client = this.#getClient();
378
403
  const response = await client.addressToBech32(new AddressToBech32Request({ address }));
379
404
  return response.bech32Address;
380
405
  }
381
406
 
382
407
  async addressFromMnemonic(mnemonic: string) {
383
- const client = await this.#getClient();
408
+ const client = this.#getClient();
384
409
  const response = await client.addressFromMnemonic(new AddressFromMnemonicRequest({ mnemonic }));
385
410
  return response.address;
386
411
  }
387
412
 
388
413
  async addressFromBech32(bech32Address: string) {
389
- const client = await this.#getClient();
414
+ const client = this.#getClient();
390
415
  const response = await client.addressFromBech32(
391
416
  new AddressFromBech32Request({ bech32Address }),
392
417
  );
393
418
  return response.address;
394
419
  }
395
420
 
421
+ async broadcastTxCommit(signedTxJson: string): Promise<AsyncIterable<BroadcastTxCommitResponse>> {
422
+ const client = this.#getClient();
423
+ const response = client.broadcastTxCommit({ signedTxJson });
424
+ return response;
425
+ }
426
+
396
427
  // // debug
397
428
  async hello(name: string) {
398
- const client = await this.#getClient();
429
+ const client = this.#getClient();
399
430
  const response = await client.hello(new HelloRequest({ name }));
400
431
  return response.greeting;
401
432
  }
402
433
 
403
434
  // // debug
404
435
  async helloStream(name: string): Promise<AsyncIterable<HelloStreamResponse>> {
405
- const client = await this.#getClient();
436
+ const client = this.#getClient();
406
437
  return client.helloStream(new HelloRequest({ name }));
407
438
  }
408
439
 
package/src/api/types.ts CHANGED
@@ -1,12 +1,10 @@
1
1
  import {
2
2
  CallResponse,
3
3
  DeleteAccountResponse,
4
- GetActiveAccountResponse,
5
4
  GetActivatedAccountResponse,
6
5
  HelloStreamResponse,
7
6
  QueryAccountResponse,
8
7
  QueryResponse,
9
- SelectAccountResponse,
10
8
  ActivateAccountResponse,
11
9
  SendResponse,
12
10
  SetChainIDResponse,
@@ -14,6 +12,9 @@ import {
14
12
  SetRemoteResponse,
15
13
  UpdatePasswordResponse,
16
14
  KeyInfo,
15
+ SignTxResponse,
16
+ MakeTxResponse,
17
+ BroadcastTxCommitResponse,
17
18
  } from '@buf/gnolang_gnonative.bufbuild_es/gnonativetypes_pb';
18
19
 
19
20
  export enum BridgeStatus {
@@ -47,11 +48,9 @@ export interface GnoKeyApi {
47
48
  getKeyInfoByName: (name: string) => Promise<KeyInfo | undefined>;
48
49
  getKeyInfoByAddress: (address: Uint8Array) => Promise<KeyInfo | undefined>;
49
50
  getKeyInfoByNameOrAddress: (nameOrBech32: string) => Promise<KeyInfo | undefined>;
50
- selectAccount: (nameOrBech32: string) => Promise<SelectAccountResponse>;
51
51
  activateAccount: (nameOrBech32: string) => Promise<ActivateAccountResponse>;
52
- setPassword: (password: string, address?: Uint8Array) => Promise<SetPasswordResponse>;
52
+ setPassword: (password: string, address: Uint8Array) => Promise<SetPasswordResponse>;
53
53
  updatePassword: (password: string, addresses: Uint8Array[]) => Promise<UpdatePasswordResponse>;
54
- getActiveAccount: () => Promise<GetActiveAccountResponse>;
55
54
  getActivatedAccount: () => Promise<GetActivatedAccountResponse>;
56
55
  queryAccount: (address: Uint8Array) => Promise<QueryAccountResponse>;
57
56
  deleteAccount: (
@@ -67,8 +66,8 @@ export interface GnoKeyApi {
67
66
  fnc: string,
68
67
  args: string[],
69
68
  gasFee: string,
70
- gasWanted: number,
71
- callerAddress?: Uint8Array,
69
+ gasWanted: bigint,
70
+ callerAddress: Uint8Array,
72
71
  send?: string,
73
72
  memo?: string,
74
73
  ) => Promise<AsyncIterable<CallResponse>>;
@@ -76,13 +75,30 @@ export interface GnoKeyApi {
76
75
  toAddress: Uint8Array,
77
76
  send: string,
78
77
  gasFee: string,
79
- gasWanted: number,
80
- callerAddress?: Uint8Array,
78
+ gasWanted: bigint,
79
+ callerAddress: Uint8Array,
81
80
  memo?: string,
82
81
  ) => Promise<AsyncIterable<SendResponse>>;
83
82
  addressToBech32: (address: Uint8Array) => Promise<string>;
84
83
  addressFromMnemonic: (mnemonic: string) => Promise<Uint8Array>;
85
84
  addressFromBech32: (bech32Address: string) => Promise<Uint8Array>;
85
+ signTx(
86
+ txJson: string,
87
+ address: Uint8Array,
88
+ accountNumber?: bigint,
89
+ sequenceNumber?: bigint,
90
+ ): Promise<SignTxResponse>;
91
+ makeCallTx(
92
+ packagePath: string,
93
+ fnc: string,
94
+ args: string[],
95
+ gasFee: string,
96
+ gasWanted: bigint,
97
+ callerAddress?: Uint8Array,
98
+ send?: string,
99
+ memo?: string,
100
+ ): Promise<MakeTxResponse>;
101
+ broadcastTxCommit(signedTxJson: string): Promise<AsyncIterable<BroadcastTxCommitResponse>>;
86
102
  // debug
87
103
  hello: (name: string) => Promise<string>;
88
104
  helloStream: (name: string) => Promise<AsyncIterable<HelloStreamResponse>>;