@gnolang/gnonative 3.0.4 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/libs/gnocore.aar +0 -0
- package/build/api/GnoNativeApi.d.ts +5 -4
- package/build/api/GnoNativeApi.d.ts.map +1 -1
- package/build/api/GnoNativeApi.js +18 -2
- package/build/api/GnoNativeApi.js.map +1 -1
- package/build/api/types.d.ts +5 -4
- package/build/api/types.d.ts.map +1 -1
- package/build/api/types.js.map +1 -1
- package/ios/Frameworks/GnoCore.xcframework/Info.plist +5 -5
- package/ios/Frameworks/GnoCore.xcframework/ios-arm64/GnoCore.framework/GnoCore +0 -0
- package/ios/Frameworks/GnoCore.xcframework/ios-arm64/GnoCore.framework/Versions/A/GnoCore +0 -0
- package/ios/Frameworks/GnoCore.xcframework/ios-arm64/GnoCore.framework/Versions/Current/GnoCore +0 -0
- package/ios/Frameworks/GnoCore.xcframework/ios-arm64_x86_64-simulator/GnoCore.framework/GnoCore +0 -0
- package/package.json +3 -3
- package/src/api/GnoNativeApi.ts +30 -5
- package/src/api/types.ts +13 -4
package/android/libs/gnocore.aar
CHANGED
|
Binary file
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BroadcastTxCommitResponse, CallResponse, DeleteAccountResponse, GetActivatedAccountResponse, HelloStreamResponse, KeyInfo, MakeTxResponse, QueryAccountResponse, QueryResponse, ActivateAccountResponse, SendResponse, SetChainIDResponse, SetPasswordResponse, SetRemoteResponse, SignTxResponse, RotatePasswordResponse } from '@buf/gnolang_gnonative.bufbuild_es/gnonativetypes_pb';
|
|
1
|
+
import { BroadcastTxCommitResponse, CallResponse, DeleteAccountResponse, GetActivatedAccountResponse, HelloStreamResponse, KeyInfo, MakeTxResponse, Coin, QueryAccountResponse, QueryResponse, ActivateAccountResponse, SendResponse, SetChainIDResponse, SetPasswordResponse, SetRemoteResponse, SignTxResponse, RotatePasswordResponse } 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,7 +24,8 @@ export declare class GnoNativeApi implements GnoKeyApi, GoBridgeInterface {
|
|
|
24
24
|
getKeyInfoByAddress(address: Uint8Array): Promise<KeyInfo | undefined>;
|
|
25
25
|
getKeyInfoByNameOrAddress(nameOrBech32: string): Promise<KeyInfo | undefined>;
|
|
26
26
|
listKeyInfo(): Promise<KeyInfo[]>;
|
|
27
|
-
makeCallTx(packagePath: string, fnc: string, args: string[], gasFee: string, gasWanted: bigint, callerAddress
|
|
27
|
+
makeCallTx(packagePath: string, fnc: string, args: string[], gasFee: string, gasWanted: bigint, callerAddress: Uint8Array, send?: Coin[], memo?: string): Promise<MakeTxResponse>;
|
|
28
|
+
makeSendTx(toAddress: Uint8Array, amount: Coin[], gasFee: string, gasWanted: bigint, callerAddress: Uint8Array, memo?: string): Promise<MakeTxResponse>;
|
|
28
29
|
activateAccount(nameOrBech32: string): Promise<ActivateAccountResponse>;
|
|
29
30
|
getClient(): Promise<PromiseClient<typeof GnoNativeService>>;
|
|
30
31
|
isInitialized(): boolean;
|
|
@@ -36,8 +37,8 @@ export declare class GnoNativeApi implements GnoKeyApi, GoBridgeInterface {
|
|
|
36
37
|
query(path: string, data: Uint8Array): Promise<QueryResponse>;
|
|
37
38
|
render(packagePath: string, args: string): Promise<string>;
|
|
38
39
|
qEval(packagePath: string, expression: string): Promise<string>;
|
|
39
|
-
call(packagePath: string, fnc: string, args: string[], gasFee: string, gasWanted: bigint, callerAddress: Uint8Array, send?:
|
|
40
|
-
send(toAddress: Uint8Array,
|
|
40
|
+
call(packagePath: string, fnc: string, args: string[], gasFee: string, gasWanted: bigint, callerAddress: Uint8Array, send?: Coin[], memo?: string): Promise<AsyncIterable<CallResponse>>;
|
|
41
|
+
send(toAddress: Uint8Array, amount: Coin[], gasFee: string, gasWanted: bigint, callerAddress: Uint8Array, memo?: string): Promise<AsyncIterable<SendResponse>>;
|
|
41
42
|
addressToBech32(address: Uint8Array): Promise<string>;
|
|
42
43
|
addressFromMnemonic(mnemonic: string): Promise<Uint8Array>;
|
|
43
44
|
addressFromBech32(bech32Address: string): Promise<Uint8Array>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GnoNativeApi.d.ts","sourceRoot":"","sources":["../../src/api/GnoNativeApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,yBAAyB,EAEzB,YAAY,EAGZ,qBAAqB,EAGrB,2BAA2B,EAU3B,mBAAmB,EACnB,OAAO,EAEP,cAAc,
|
|
1
|
+
{"version":3,"file":"GnoNativeApi.d.ts","sourceRoot":"","sources":["../../src/api/GnoNativeApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,yBAAyB,EAEzB,YAAY,EAGZ,qBAAqB,EAGrB,2BAA2B,EAU3B,mBAAmB,EACnB,OAAO,EAEP,cAAc,EAEd,IAAI,EAIJ,oBAAoB,EAEpB,aAAa,EAGb,uBAAuB,EAEvB,YAAY,EAEZ,kBAAkB,EAElB,mBAAmB,EAEnB,iBAAiB,EACjB,cAAc,EAEd,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;gBAE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client = this.#getClient();
|
|
150
|
+
const reponse = client.makeSendTx({
|
|
151
|
+
gasFee,
|
|
152
|
+
gasWanted,
|
|
153
|
+
memo,
|
|
154
|
+
callerAddress,
|
|
155
|
+
msgs: [
|
|
156
|
+
{
|
|
157
|
+
toAddress,
|
|
158
|
+
amount,
|
|
159
|
+
},
|
|
160
|
+
],
|
|
161
|
+
});
|
|
162
|
+
return reponse;
|
|
163
|
+
}
|
|
148
164
|
async activateAccount(nameOrBech32) {
|
|
149
165
|
const client = this.#getClient();
|
|
150
166
|
const response = client.activateAccount(new ActivateAccountRequest({
|
|
@@ -232,7 +248,7 @@ export class GnoNativeApi {
|
|
|
232
248
|
}));
|
|
233
249
|
return reponse;
|
|
234
250
|
}
|
|
235
|
-
async send(toAddress,
|
|
251
|
+
async send(toAddress, amount, gasFee, gasWanted, callerAddress, memo) {
|
|
236
252
|
const client = this.#getClient();
|
|
237
253
|
const reponse = client.send(new SendRequest({
|
|
238
254
|
gasFee,
|
|
@@ -242,7 +258,7 @@ export class GnoNativeApi {
|
|
|
242
258
|
msgs: [
|
|
243
259
|
new MsgSend({
|
|
244
260
|
toAddress,
|
|
245
|
-
|
|
261
|
+
amount,
|
|
246
262
|
}),
|
|
247
263
|
],
|
|
248
264
|
}));
|
|
@@ -1 +1 @@
|
|
|
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,EAE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AChC,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 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 RotatePasswordRequest,\n RotatePasswordResponse,\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 rotatePassword(\n newPassword: string,\n addresses: Uint8Array[],\n ): Promise<RotatePasswordResponse> {\n const client = this.#getClient();\n const response = client.rotatePassword(new RotatePasswordRequest({ 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
|
+
{"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,EAE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CAAC,CAAC;QAChE,OAAO,QAAQ,CAAC,QAAQ,CAAC;IAC3B,CAAC;IAED,WAAW;IACX,KAAK,CAAC,WAAW,CAAC,IAAY;QAC5B,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QACjC,OAAO,MAAM,CAAC,WAAW,CAAC,IAAI,YAAY,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IACxD,CAAC;IAED,uBAAuB;IACvB,UAAU;QACR,OAAO,QAAQ,CAAC,UAAU,EAAE,CAAC;IAC/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 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 Coin,\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 RotatePasswordRequest,\n RotatePasswordResponse,\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?: Coin[],\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 makeSendTx(\n toAddress: Uint8Array,\n amount: Coin[],\n gasFee: string,\n gasWanted: bigint,\n callerAddress: Uint8Array,\n memo?: string,\n ): Promise<MakeTxResponse> {\n const client = this.#getClient();\n const reponse = client.makeSendTx({\n gasFee,\n gasWanted,\n memo,\n callerAddress,\n msgs: [\n {\n toAddress,\n amount,\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 rotatePassword(\n newPassword: string,\n addresses: Uint8Array[],\n ): Promise<RotatePasswordResponse> {\n const client = this.#getClient();\n const response = client.rotatePassword(new RotatePasswordRequest({ 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?: Coin[],\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 amount: Coin[],\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 amount,\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"]}
|
package/build/api/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CallResponse, DeleteAccountResponse, GetActivatedAccountResponse, HelloStreamResponse, QueryAccountResponse, QueryResponse, ActivateAccountResponse, SendResponse, SetChainIDResponse, SetPasswordResponse, SetRemoteResponse, RotatePasswordResponse, KeyInfo, SignTxResponse, MakeTxResponse, BroadcastTxCommitResponse } from '@buf/gnolang_gnonative.bufbuild_es/gnonativetypes_pb';
|
|
1
|
+
import { CallResponse, DeleteAccountResponse, GetActivatedAccountResponse, HelloStreamResponse, QueryAccountResponse, QueryResponse, ActivateAccountResponse, SendResponse, SetChainIDResponse, SetPasswordResponse, SetRemoteResponse, RotatePasswordResponse, KeyInfo, SignTxResponse, MakeTxResponse, BroadcastTxCommitResponse, Coin } from '@buf/gnolang_gnonative.bufbuild_es/gnonativetypes_pb';
|
|
2
2
|
export declare enum BridgeStatus {
|
|
3
3
|
Stopped = 0,
|
|
4
4
|
Starting = 1,
|
|
@@ -32,13 +32,14 @@ export interface GnoKeyApi {
|
|
|
32
32
|
query: (path: string, data: Uint8Array) => Promise<QueryResponse>;
|
|
33
33
|
render: (packagePath: string, args: string) => Promise<string>;
|
|
34
34
|
qEval: (packagePath: string, expression: string) => Promise<string>;
|
|
35
|
-
call: (packagePath: string, fnc: string, args: string[], gasFee: string, gasWanted: bigint, callerAddress: Uint8Array, send?:
|
|
36
|
-
send: (toAddress: Uint8Array,
|
|
35
|
+
call: (packagePath: string, fnc: string, args: string[], gasFee: string, gasWanted: bigint, callerAddress: Uint8Array, send?: Coin[], memo?: string) => Promise<AsyncIterable<CallResponse>>;
|
|
36
|
+
send: (toAddress: Uint8Array, amount: Coin[], gasFee: string, gasWanted: bigint, callerAddress: Uint8Array, memo?: string) => Promise<AsyncIterable<SendResponse>>;
|
|
37
37
|
addressToBech32: (address: Uint8Array) => Promise<string>;
|
|
38
38
|
addressFromMnemonic: (mnemonic: string) => Promise<Uint8Array>;
|
|
39
39
|
addressFromBech32: (bech32Address: string) => Promise<Uint8Array>;
|
|
40
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
|
|
41
|
+
makeCallTx(packagePath: string, fnc: string, args: string[], gasFee: string, gasWanted: bigint, callerAddress: Uint8Array, send?: Coin[], memo?: string): Promise<MakeTxResponse>;
|
|
42
|
+
makeSendTx(toAddress: Uint8Array, amount: Coin[], gasFee: string, gasWanted: bigint, callerAddress: Uint8Array, memo?: string): Promise<MakeTxResponse>;
|
|
42
43
|
broadcastTxCommit(signedTxJson: string): Promise<AsyncIterable<BroadcastTxCommitResponse>>;
|
|
43
44
|
hello: (name: string) => Promise<string>;
|
|
44
45
|
helloStream: (name: string) => Promise<AsyncIterable<HelloStreamResponse>>;
|
package/build/api/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/api/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,qBAAqB,EACrB,2BAA2B,EAC3B,mBAAmB,EACnB,oBAAoB,EACpB,aAAa,EACb,uBAAuB,EACvB,YAAY,EACZ,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,sBAAsB,EACtB,OAAO,EACP,cAAc,EACd,cAAc,EACd,yBAAyB,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":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AAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE,UAAU,EACzB,IAAI,CAAC,EAAE,MAAM,GACZ,OAAO,CAAC,cAAc,CAAC,CAAC;IAC3B,iBAAiB,CAAC,YAAY,EAAE,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"}
|
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":"AAoBA,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 RotatePasswordResponse,\n KeyInfo,\n SignTxResponse,\n MakeTxResponse,\n BroadcastTxCommitResponse,\n Coin,\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 rotatePassword: (password: string, addresses: Uint8Array[]) => Promise<RotatePasswordResponse>;\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?: Coin[],\n memo?: string,\n ) => Promise<AsyncIterable<CallResponse>>;\n send: (\n toAddress: Uint8Array,\n amount: Coin[],\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?: Coin[],\n memo?: string,\n ): Promise<MakeTxResponse>;\n makeSendTx(\n toAddress: Uint8Array,\n amount: Coin[],\n gasFee: string,\n gasWanted: bigint,\n callerAddress: Uint8Array,\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"]}
|
|
@@ -8,32 +8,32 @@
|
|
|
8
8
|
<key>BinaryPath</key>
|
|
9
9
|
<string>GnoCore.framework/Versions/A/GnoCore</string>
|
|
10
10
|
<key>LibraryIdentifier</key>
|
|
11
|
-
<string>ios-
|
|
11
|
+
<string>ios-arm64_x86_64-simulator</string>
|
|
12
12
|
<key>LibraryPath</key>
|
|
13
13
|
<string>GnoCore.framework</string>
|
|
14
14
|
<key>SupportedArchitectures</key>
|
|
15
15
|
<array>
|
|
16
16
|
<string>arm64</string>
|
|
17
|
+
<string>x86_64</string>
|
|
17
18
|
</array>
|
|
18
19
|
<key>SupportedPlatform</key>
|
|
19
20
|
<string>ios</string>
|
|
21
|
+
<key>SupportedPlatformVariant</key>
|
|
22
|
+
<string>simulator</string>
|
|
20
23
|
</dict>
|
|
21
24
|
<dict>
|
|
22
25
|
<key>BinaryPath</key>
|
|
23
26
|
<string>GnoCore.framework/Versions/A/GnoCore</string>
|
|
24
27
|
<key>LibraryIdentifier</key>
|
|
25
|
-
<string>ios-
|
|
28
|
+
<string>ios-arm64</string>
|
|
26
29
|
<key>LibraryPath</key>
|
|
27
30
|
<string>GnoCore.framework</string>
|
|
28
31
|
<key>SupportedArchitectures</key>
|
|
29
32
|
<array>
|
|
30
33
|
<string>arm64</string>
|
|
31
|
-
<string>x86_64</string>
|
|
32
34
|
</array>
|
|
33
35
|
<key>SupportedPlatform</key>
|
|
34
36
|
<string>ios</string>
|
|
35
|
-
<key>SupportedPlatformVariant</key>
|
|
36
|
-
<string>simulator</string>
|
|
37
37
|
</dict>
|
|
38
38
|
</array>
|
|
39
39
|
<key>CFBundlePackageType</key>
|
|
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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gnolang/gnonative",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "Develop for Gno using your app's native language ",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"license": "MIT",
|
|
30
30
|
"homepage": "https://github.com/gnolang/gnonative#readme",
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@buf/gnolang_gnonative.bufbuild_es": "^1.8.0-
|
|
33
|
-
"@buf/gnolang_gnonative.connectrpc_es": "^1.4.0-
|
|
32
|
+
"@buf/gnolang_gnonative.bufbuild_es": "^1.8.0-20241030100906-5ceb62413f58.3",
|
|
33
|
+
"@buf/gnolang_gnonative.connectrpc_es": "^1.4.0-20241030100906-5ceb62413f58.3",
|
|
34
34
|
"@bufbuild/protobuf": "^1.8.0",
|
|
35
35
|
"@connectrpc/connect": "^1.4.0",
|
|
36
36
|
"@connectrpc/connect-web": "^1.4.0",
|
package/src/api/GnoNativeApi.ts
CHANGED
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
ListKeyInfoRequest,
|
|
26
26
|
MakeTxResponse,
|
|
27
27
|
MsgCall,
|
|
28
|
+
Coin,
|
|
28
29
|
MsgSend,
|
|
29
30
|
QEvalRequest,
|
|
30
31
|
QueryAccountRequest,
|
|
@@ -223,8 +224,8 @@ export class GnoNativeApi implements GnoKeyApi, GoBridgeInterface {
|
|
|
223
224
|
args: string[],
|
|
224
225
|
gasFee: string,
|
|
225
226
|
gasWanted: bigint,
|
|
226
|
-
callerAddress
|
|
227
|
-
send?:
|
|
227
|
+
callerAddress: Uint8Array,
|
|
228
|
+
send?: Coin[],
|
|
228
229
|
memo?: string,
|
|
229
230
|
): Promise<MakeTxResponse> {
|
|
230
231
|
const client = this.#getClient();
|
|
@@ -245,6 +246,30 @@ export class GnoNativeApi implements GnoKeyApi, GoBridgeInterface {
|
|
|
245
246
|
return reponse;
|
|
246
247
|
}
|
|
247
248
|
|
|
249
|
+
async makeSendTx(
|
|
250
|
+
toAddress: Uint8Array,
|
|
251
|
+
amount: Coin[],
|
|
252
|
+
gasFee: string,
|
|
253
|
+
gasWanted: bigint,
|
|
254
|
+
callerAddress: Uint8Array,
|
|
255
|
+
memo?: string,
|
|
256
|
+
): Promise<MakeTxResponse> {
|
|
257
|
+
const client = this.#getClient();
|
|
258
|
+
const reponse = client.makeSendTx({
|
|
259
|
+
gasFee,
|
|
260
|
+
gasWanted,
|
|
261
|
+
memo,
|
|
262
|
+
callerAddress,
|
|
263
|
+
msgs: [
|
|
264
|
+
{
|
|
265
|
+
toAddress,
|
|
266
|
+
amount,
|
|
267
|
+
},
|
|
268
|
+
],
|
|
269
|
+
});
|
|
270
|
+
return reponse;
|
|
271
|
+
}
|
|
272
|
+
|
|
248
273
|
async activateAccount(nameOrBech32: string): Promise<ActivateAccountResponse> {
|
|
249
274
|
const client = this.#getClient();
|
|
250
275
|
const response = client.activateAccount(
|
|
@@ -349,7 +374,7 @@ export class GnoNativeApi implements GnoKeyApi, GoBridgeInterface {
|
|
|
349
374
|
gasFee: string,
|
|
350
375
|
gasWanted: bigint,
|
|
351
376
|
callerAddress: Uint8Array,
|
|
352
|
-
send?:
|
|
377
|
+
send?: Coin[],
|
|
353
378
|
memo?: string,
|
|
354
379
|
): Promise<AsyncIterable<CallResponse>> {
|
|
355
380
|
const client = this.#getClient();
|
|
@@ -374,7 +399,7 @@ export class GnoNativeApi implements GnoKeyApi, GoBridgeInterface {
|
|
|
374
399
|
|
|
375
400
|
async send(
|
|
376
401
|
toAddress: Uint8Array,
|
|
377
|
-
|
|
402
|
+
amount: Coin[],
|
|
378
403
|
gasFee: string,
|
|
379
404
|
gasWanted: bigint,
|
|
380
405
|
callerAddress: Uint8Array,
|
|
@@ -390,7 +415,7 @@ export class GnoNativeApi implements GnoKeyApi, GoBridgeInterface {
|
|
|
390
415
|
msgs: [
|
|
391
416
|
new MsgSend({
|
|
392
417
|
toAddress,
|
|
393
|
-
|
|
418
|
+
amount,
|
|
394
419
|
}),
|
|
395
420
|
],
|
|
396
421
|
}),
|
package/src/api/types.ts
CHANGED
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
SignTxResponse,
|
|
16
16
|
MakeTxResponse,
|
|
17
17
|
BroadcastTxCommitResponse,
|
|
18
|
+
Coin,
|
|
18
19
|
} from '@buf/gnolang_gnonative.bufbuild_es/gnonativetypes_pb';
|
|
19
20
|
|
|
20
21
|
export enum BridgeStatus {
|
|
@@ -68,12 +69,12 @@ export interface GnoKeyApi {
|
|
|
68
69
|
gasFee: string,
|
|
69
70
|
gasWanted: bigint,
|
|
70
71
|
callerAddress: Uint8Array,
|
|
71
|
-
send?:
|
|
72
|
+
send?: Coin[],
|
|
72
73
|
memo?: string,
|
|
73
74
|
) => Promise<AsyncIterable<CallResponse>>;
|
|
74
75
|
send: (
|
|
75
76
|
toAddress: Uint8Array,
|
|
76
|
-
|
|
77
|
+
amount: Coin[],
|
|
77
78
|
gasFee: string,
|
|
78
79
|
gasWanted: bigint,
|
|
79
80
|
callerAddress: Uint8Array,
|
|
@@ -94,8 +95,16 @@ export interface GnoKeyApi {
|
|
|
94
95
|
args: string[],
|
|
95
96
|
gasFee: string,
|
|
96
97
|
gasWanted: bigint,
|
|
97
|
-
callerAddress
|
|
98
|
-
send?:
|
|
98
|
+
callerAddress: Uint8Array,
|
|
99
|
+
send?: Coin[],
|
|
100
|
+
memo?: string,
|
|
101
|
+
): Promise<MakeTxResponse>;
|
|
102
|
+
makeSendTx(
|
|
103
|
+
toAddress: Uint8Array,
|
|
104
|
+
amount: Coin[],
|
|
105
|
+
gasFee: string,
|
|
106
|
+
gasWanted: bigint,
|
|
107
|
+
callerAddress: Uint8Array,
|
|
99
108
|
memo?: string,
|
|
100
109
|
): Promise<MakeTxResponse>;
|
|
101
110
|
broadcastTxCommit(signedTxJson: string): Promise<AsyncIterable<BroadcastTxCommitResponse>>;
|