@firmachain/firma-js 0.2.18 → 0.2.19

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.
@@ -2,12 +2,8 @@ import { DirectSecp256k1Wallet, Registry } from "@cosmjs/proto-signing";
2
2
  import { EncodeObject } from "@cosmjs/proto-signing";
3
3
  import { FirmaConfig } from "./FirmaConfig";
4
4
  import { SignAndBroadcastOptions } from "./firmachain/common";
5
+ import { LedgerWalletInterface } from "./firmachain/common/LedgerWallet";
5
6
  import { TxRaw } from "cosmjs-types/cosmos/tx/v1beta1/tx";
6
- export interface LedgerWalletInterface {
7
- getAddress(): Promise<string>;
8
- sign(message: string): Promise<Uint8Array>;
9
- getPublicKey(): Promise<Uint8Array>;
10
- }
11
7
  export declare class FirmaWalletService {
12
8
  private readonly config;
13
9
  private mnemonic;
@@ -5,5 +5,10 @@ export interface LedgerWalletInterface {
5
5
  getAddress(): Promise<string>;
6
6
  sign(message: string): Promise<Uint8Array>;
7
7
  getPublicKey(): Promise<Uint8Array>;
8
+ getAddressAndPublicKey(): Promise<{
9
+ address: string;
10
+ publicKey: Uint8Array;
11
+ }>;
12
+ showAddressOnDevice(): Promise<void>;
8
13
  }
9
14
  export declare function signFromLedger(ledger: LedgerWalletInterface, messages: EncodeObject[], option: SignAndBroadcastOptions, registry: Registry): Promise<TxRaw>;
@@ -100,18 +100,15 @@ function makeAuthInfoBytes(signers, feeAmount, gasLimit, granter, signMode) {
100
100
  }
101
101
  function signFromLedger(ledger, messages, option, registry) {
102
102
  return __awaiter(this, void 0, void 0, function () {
103
- var address, signerData, publicKey, pubkey, aminoTypes, msgs, chainId, accountNumber, sequence, memo, fee, signDoc, signMessage, ledgerSignature, signedTxBody, signedTxBodyEncodeObject, signedTxBodyBytes, signedGasLimit, signedAuthInfoBytes, txRaw;
104
- return __generator(this, function (_a) {
105
- switch (_a.label) {
106
- case 0: return [4 /*yield*/, ledger.getAddress()];
103
+ var _a, address, publicKey, signerData, pubkey, aminoTypes, msgs, chainId, accountNumber, sequence, memo, fee, signDoc, signMessage, ledgerSignature, signedTxBody, signedTxBodyEncodeObject, signedTxBodyBytes, signedGasLimit, signedAuthInfoBytes, txRaw;
104
+ return __generator(this, function (_b) {
105
+ switch (_b.label) {
106
+ case 0: return [4 /*yield*/, ledger.getAddressAndPublicKey()];
107
107
  case 1:
108
- address = _a.sent();
108
+ _a = _b.sent(), address = _a.address, publicKey = _a.publicKey;
109
109
  return [4 /*yield*/, FirmaUtil_1.FirmaUtil.getSignerDataForLedger(address)];
110
110
  case 2:
111
- signerData = _a.sent();
112
- return [4 /*yield*/, ledger.getPublicKey()];
113
- case 3:
114
- publicKey = _a.sent();
111
+ signerData = _b.sent();
115
112
  pubkey = proto_signing_1.encodePubkey(encoding_2.encodeSecp256k1Pubkey(publicKey));
116
113
  aminoTypes = new aminotypes_1.AminoTypes({});
117
114
  msgs = messages.map(function (msg) { return aminoTypes.toAmino(msg); });
@@ -123,8 +120,8 @@ function signFromLedger(ledger, messages, option, registry) {
123
120
  signDoc = signdoc_2.makeSignDoc(msgs, fee, chainId, memo, accountNumber, sequence);
124
121
  signMessage = signdoc_1.serializeSignDoc(signDoc);
125
122
  return [4 /*yield*/, ledger.sign(encoding_3.fromUtf8(signMessage))];
126
- case 4:
127
- ledgerSignature = _a.sent();
123
+ case 3:
124
+ ledgerSignature = _b.sent();
128
125
  ;
129
126
  signedTxBody = {
130
127
  messages: signDoc.msgs.map(function (msg) { return aminoTypes.fromAmino(msg); }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firmachain/firma-js",
3
- "version": "0.2.18",
3
+ "version": "0.2.19",
4
4
  "description": "The Official FirmaChain Javascript SDK written in Typescript",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",