@firmachain/firma-js 0.2.38 → 0.2.41

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/dist/index.d.ts CHANGED
@@ -2,3 +2,15 @@ export * from './sdk/FirmaSDK';
2
2
  export * from './sdk/FirmaMobileSDK';
3
3
  export * from './sdk/FirmaConfig';
4
4
  export * from './sdk/FirmaUtil';
5
+ export * from './sdk/firmachain/authz';
6
+ export * from './sdk/firmachain/bank';
7
+ export * from './sdk/firmachain/contract';
8
+ export * from './sdk/firmachain/cosmwasm';
9
+ export * from './sdk/firmachain/distribution';
10
+ export * from './sdk/firmachain/gov';
11
+ export * from './sdk/firmachain/ibc';
12
+ export * from './sdk/firmachain/slashing';
13
+ export * from './sdk/firmachain/staking';
14
+ export * from './sdk/firmachain/token';
15
+ export * from './sdk/firmachain/nft';
16
+ export * from './sdk/firmachain/feegrant';
package/dist/index.js CHANGED
@@ -18,3 +18,15 @@ __exportStar(require("./sdk/FirmaSDK"), exports);
18
18
  __exportStar(require("./sdk/FirmaMobileSDK"), exports);
19
19
  __exportStar(require("./sdk/FirmaConfig"), exports);
20
20
  __exportStar(require("./sdk/FirmaUtil"), exports);
21
+ __exportStar(require("./sdk/firmachain/authz"), exports);
22
+ __exportStar(require("./sdk/firmachain/bank"), exports);
23
+ __exportStar(require("./sdk/firmachain/contract"), exports);
24
+ __exportStar(require("./sdk/firmachain/cosmwasm"), exports);
25
+ __exportStar(require("./sdk/firmachain/distribution"), exports);
26
+ __exportStar(require("./sdk/firmachain/gov"), exports);
27
+ __exportStar(require("./sdk/firmachain/ibc"), exports);
28
+ __exportStar(require("./sdk/firmachain/slashing"), exports);
29
+ __exportStar(require("./sdk/firmachain/staking"), exports);
30
+ __exportStar(require("./sdk/firmachain/token"), exports);
31
+ __exportStar(require("./sdk/firmachain/nft"), exports);
32
+ __exportStar(require("./sdk/firmachain/feegrant"), exports);
@@ -1,12 +1,10 @@
1
1
  import { FirmaConfig } from "./FirmaConfig";
2
2
  export declare class IpfsService {
3
3
  private readonly config;
4
- private ipfsNodeClient;
5
- private readonly protocol;
6
4
  constructor(config: FirmaConfig);
5
+ private getBasePostUrl;
7
6
  addJson(jsonData: string): Promise<string>;
8
7
  addBuffer(buffer: ArrayBuffer): Promise<string>;
9
8
  addFile(fileUrl: string): Promise<string>;
10
- getFile(hash: string): Promise<string>;
11
9
  getURLFromHash(hash: string): string;
12
10
  }
@@ -35,49 +35,40 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
35
35
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
36
  }
37
37
  };
38
- var __asyncValues = (this && this.__asyncValues) || function (o) {
39
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
40
- var m = o[Symbol.asyncIterator], i;
41
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
42
- function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
43
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
44
- };
45
38
  var __importDefault = (this && this.__importDefault) || function (mod) {
46
39
  return (mod && mod.__esModule) ? mod : { "default": mod };
47
40
  };
48
41
  Object.defineProperty(exports, "__esModule", { value: true });
49
42
  exports.IpfsService = void 0;
50
- var ipfs_http_client_1 = require("ipfs-http-client");
51
43
  var fs_1 = __importDefault(require("fs"));
52
44
  var FirmaUtil_1 = require("./FirmaUtil");
45
+ var axios_1 = __importDefault(require("axios"));
53
46
  var IpfsService = /** @class */ (function () {
54
47
  function IpfsService(config) {
55
48
  this.config = config;
56
- if (config.ipfsNodeAddress.includes("https://")) {
57
- this.protocol = "https";
58
- }
59
- else if (config.ipfsNodeAddress.includes("http://")) {
60
- this.protocol = "http";
61
- }
62
- else {
63
- this.protocol = "https";
64
- }
65
- var address = config.ipfsNodeAddress;
66
- address = address.replace("https://", "");
67
- address = address.replace("http://", "");
68
- this.ipfsNodeClient = (0, ipfs_http_client_1.create)({ host: address, port: config.ipfsNodePort, protocol: this.protocol });
69
49
  }
50
+ IpfsService.prototype.getBasePostUrl = function () {
51
+ return this.config.ipfsNodeAddress + ":" + this.config.ipfsNodePort + "/api/v0/add";
52
+ };
70
53
  IpfsService.prototype.addJson = function (jsonData) {
71
54
  return __awaiter(this, void 0, void 0, function () {
72
- var result, error_1;
55
+ var FormData_1, bodyData, response, error_1;
73
56
  return __generator(this, function (_a) {
74
57
  switch (_a.label) {
75
58
  case 0:
76
59
  _a.trys.push([0, 2, , 3]);
77
- return [4 /*yield*/, this.ipfsNodeClient.add(jsonData)];
60
+ FormData_1 = require('form-data');
61
+ bodyData = new FormData_1();
62
+ bodyData.append('json', jsonData);
63
+ return [4 /*yield*/, axios_1.default.request({
64
+ url: this.getBasePostUrl(),
65
+ method: 'POST',
66
+ headers: bodyData.getHeaders(),
67
+ data: bodyData
68
+ })];
78
69
  case 1:
79
- result = _a.sent();
80
- return [2 /*return*/, result.cid.toString()];
70
+ response = _a.sent();
71
+ return [2 /*return*/, response.data.Hash];
81
72
  case 2:
82
73
  error_1 = _a.sent();
83
74
  FirmaUtil_1.FirmaUtil.printLog(error_1);
@@ -89,15 +80,23 @@ var IpfsService = /** @class */ (function () {
89
80
  };
90
81
  IpfsService.prototype.addBuffer = function (buffer) {
91
82
  return __awaiter(this, void 0, void 0, function () {
92
- var result, error_2;
83
+ var FormData_2, bodyData, response, error_2;
93
84
  return __generator(this, function (_a) {
94
85
  switch (_a.label) {
95
86
  case 0:
96
87
  _a.trys.push([0, 2, , 3]);
97
- return [4 /*yield*/, this.ipfsNodeClient.add(buffer)];
88
+ FormData_2 = require('form-data');
89
+ bodyData = new FormData_2();
90
+ bodyData.append('buffer', Buffer.from(buffer));
91
+ return [4 /*yield*/, axios_1.default.request({
92
+ url: this.getBasePostUrl(),
93
+ method: 'POST',
94
+ headers: bodyData.getHeaders(),
95
+ data: bodyData
96
+ })];
98
97
  case 1:
99
- result = _a.sent();
100
- return [2 /*return*/, result.cid.toString()];
98
+ response = _a.sent();
99
+ return [2 /*return*/, response.data.Hash];
101
100
  case 2:
102
101
  error_2 = _a.sent();
103
102
  FirmaUtil_1.FirmaUtil.printLog(error_2);
@@ -109,16 +108,24 @@ var IpfsService = /** @class */ (function () {
109
108
  };
110
109
  IpfsService.prototype.addFile = function (fileUrl) {
111
110
  return __awaiter(this, void 0, void 0, function () {
112
- var data, result, error_3;
111
+ var FormData_3, bodyData, fileBuffer, response, error_3;
113
112
  return __generator(this, function (_a) {
114
113
  switch (_a.label) {
115
114
  case 0:
116
115
  _a.trys.push([0, 2, , 3]);
117
- data = fs_1.default.readFileSync(fileUrl);
118
- return [4 /*yield*/, this.ipfsNodeClient.add(data)];
116
+ FormData_3 = require('form-data');
117
+ bodyData = new FormData_3();
118
+ fileBuffer = fs_1.default.readFileSync(fileUrl);
119
+ bodyData.append('file', fileBuffer);
120
+ return [4 /*yield*/, axios_1.default.request({
121
+ url: this.getBasePostUrl(),
122
+ method: 'POST',
123
+ headers: bodyData.getHeaders(),
124
+ data: bodyData
125
+ })];
119
126
  case 1:
120
- result = _a.sent();
121
- return [2 /*return*/, result.cid.toString()];
127
+ response = _a.sent();
128
+ return [2 /*return*/, response.data.Hash];
122
129
  case 2:
123
130
  error_3 = _a.sent();
124
131
  FirmaUtil_1.FirmaUtil.printLog(error_3);
@@ -128,55 +135,6 @@ var IpfsService = /** @class */ (function () {
128
135
  });
129
136
  });
130
137
  };
131
- IpfsService.prototype.getFile = function (hash) {
132
- var e_1, _a;
133
- return __awaiter(this, void 0, void 0, function () {
134
- var stream, data, stream_1, stream_1_1, chunk, e_1_1, error_4;
135
- return __generator(this, function (_b) {
136
- switch (_b.label) {
137
- case 0:
138
- _b.trys.push([0, 13, , 14]);
139
- stream = this.ipfsNodeClient.get(hash);
140
- data = "";
141
- _b.label = 1;
142
- case 1:
143
- _b.trys.push([1, 6, 7, 12]);
144
- stream_1 = __asyncValues(stream);
145
- _b.label = 2;
146
- case 2: return [4 /*yield*/, stream_1.next()];
147
- case 3:
148
- if (!(stream_1_1 = _b.sent(), !stream_1_1.done)) return [3 /*break*/, 5];
149
- chunk = stream_1_1.value;
150
- data += chunk.toString();
151
- _b.label = 4;
152
- case 4: return [3 /*break*/, 2];
153
- case 5: return [3 /*break*/, 12];
154
- case 6:
155
- e_1_1 = _b.sent();
156
- e_1 = { error: e_1_1 };
157
- return [3 /*break*/, 12];
158
- case 7:
159
- _b.trys.push([7, , 10, 11]);
160
- if (!(stream_1_1 && !stream_1_1.done && (_a = stream_1.return))) return [3 /*break*/, 9];
161
- return [4 /*yield*/, _a.call(stream_1)];
162
- case 8:
163
- _b.sent();
164
- _b.label = 9;
165
- case 9: return [3 /*break*/, 11];
166
- case 10:
167
- if (e_1) throw e_1.error;
168
- return [7 /*endfinally*/];
169
- case 11: return [7 /*endfinally*/];
170
- case 12: return [2 /*return*/, data];
171
- case 13:
172
- error_4 = _b.sent();
173
- FirmaUtil_1.FirmaUtil.printLog(error_4);
174
- throw error_4;
175
- case 14: return [2 /*return*/];
176
- }
177
- });
178
- });
179
- };
180
138
  IpfsService.prototype.getURLFromHash = function (hash) {
181
139
  return this.config.ipfsWebApiAddress + "/ipfs/" + hash;
182
140
  };
@@ -40,10 +40,10 @@ export declare class FirmaUtil {
40
40
  private static recoverSigningAddress;
41
41
  private static verifySignature;
42
42
  static verifyDirectSignature(address: string, signature: string, signDoc: SignDoc): Promise<boolean>;
43
- static parseSignDocValues(signDocString: any): any;
44
- static stringifySignDocValues(signDoc: any): any;
45
- static makeSignDoc(signerAddress: string, messages: readonly EncodeObject[], txMisc?: TxMisc): Promise<SignDoc>;
46
- static makeSignDocWithStringify(signerAddress: string, messages: readonly EncodeObject[], txMisc?: TxMisc): Promise<SignDoc>;
43
+ static parseSignDocValues(signDocString: string): any;
44
+ static stringifySignDocValues(signDoc: any): string;
45
+ static makeSignDoc(signerAddress: string, pubkey: string, messages: readonly EncodeObject[], txMisc?: TxMisc): Promise<SignDoc>;
46
+ static makeSignDocWithStringify(signerAddress: string, pubkey: string, messages: readonly EncodeObject[], txMisc?: TxMisc): Promise<string>;
47
47
  static getAnyData(registry: Registry, message: EncodeObject): Any;
48
48
  static getCommonTxClient(aliceWallet: FirmaWalletService): CommonTxClient;
49
49
  }
@@ -375,12 +375,13 @@ var FirmaUtil = /** @class */ (function () {
375
375
  };
376
376
  ;
377
377
  FirmaUtil.parseSignDocValues = function (signDocString) {
378
- return __assign(__assign({}, signDocString), { bodyBytes: (0, encoding_2.fromHex)(signDocString.bodyBytes), authInfoBytes: (0, encoding_2.fromHex)(signDocString.authInfoBytes), accountNumber: new long_1.default(signDocString.accountNumber) });
378
+ var signDoc = JSON.parse(signDocString);
379
+ return __assign(__assign({}, signDoc), { bodyBytes: (0, encoding_2.fromHex)(signDoc.bodyBytes), authInfoBytes: (0, encoding_2.fromHex)(signDoc.authInfoBytes), accountNumber: new long_1.default(signDoc.accountNumber) });
379
380
  };
380
381
  FirmaUtil.stringifySignDocValues = function (signDoc) {
381
- return __assign(__assign({}, signDoc), { bodyBytes: (0, encoding_2.toHex)(signDoc.bodyBytes), authInfoBytes: (0, encoding_2.toHex)(signDoc.authInfoBytes), accountNumber: signDoc.accountNumber.toString(16) });
382
+ return JSON.stringify(__assign(__assign({}, signDoc), { bodyBytes: (0, encoding_2.toHex)(signDoc.bodyBytes), authInfoBytes: (0, encoding_2.toHex)(signDoc.authInfoBytes), accountNumber: signDoc.accountNumber.toString(16) }));
382
383
  };
383
- FirmaUtil.makeSignDoc = function (signerAddress, messages, txMisc) {
384
+ FirmaUtil.makeSignDoc = function (signerAddress, pubkey, messages, txMisc) {
384
385
  if (txMisc === void 0) { txMisc = exports.DefaultTxMisc; }
385
386
  return __awaiter(this, void 0, void 0, function () {
386
387
  var result, chainID, serverUrl, registry;
@@ -391,19 +392,19 @@ var FirmaUtil = /** @class */ (function () {
391
392
  chainID = FirmaUtil.config.chainID;
392
393
  serverUrl = FirmaUtil.config.rpcAddress;
393
394
  registry = CommonTxClient_1.CommonTxClient.getRegistry();
394
- return [4 /*yield*/, signingstargateclient_1.SigningStargateClient.makeSignDocForSend(signerAddress, messages, result.fee, result.memo, serverUrl, chainID, registry)];
395
+ return [4 /*yield*/, signingstargateclient_1.SigningStargateClient.makeSignDocForSend(signerAddress, pubkey, messages, result.fee, result.memo, serverUrl, chainID, registry)];
395
396
  case 1: return [2 /*return*/, _a.sent()];
396
397
  }
397
398
  });
398
399
  });
399
400
  };
400
- FirmaUtil.makeSignDocWithStringify = function (signerAddress, messages, txMisc) {
401
+ FirmaUtil.makeSignDocWithStringify = function (signerAddress, pubkey, messages, txMisc) {
401
402
  if (txMisc === void 0) { txMisc = exports.DefaultTxMisc; }
402
403
  return __awaiter(this, void 0, void 0, function () {
403
404
  var signDoc, stringSignDoc;
404
405
  return __generator(this, function (_a) {
405
406
  switch (_a.label) {
406
- case 0: return [4 /*yield*/, this.makeSignDoc(signerAddress, messages, txMisc)];
407
+ case 0: return [4 /*yield*/, this.makeSignDoc(signerAddress, pubkey, messages, txMisc)];
407
408
  case 1:
408
409
  signDoc = _a.sent();
409
410
  stringSignDoc = this.stringifySignDocValues(signDoc);
@@ -22,6 +22,7 @@ export declare class FirmaWalletService {
22
22
  isLedger(): boolean;
23
23
  initFromLedger(ledger: LedgerWalletInterface): Promise<FirmaWalletService>;
24
24
  signLedger(messages: EncodeObject[], option: SignAndBroadcastOptions, registry: Registry): Promise<TxRaw>;
25
+ getPubKey(): Promise<string>;
25
26
  getAddress(): Promise<string>;
26
27
  constructor(config: FirmaConfig);
27
28
  private static getHdPath;
@@ -98,9 +98,33 @@ var FirmaWalletService = /** @class */ (function () {
98
98
  });
99
99
  });
100
100
  };
101
+ FirmaWalletService.prototype.getPubKey = function () {
102
+ return __awaiter(this, void 0, void 0, function () {
103
+ var _a, _b, accounts, error_1;
104
+ return __generator(this, function (_c) {
105
+ switch (_c.label) {
106
+ case 0:
107
+ _c.trys.push([0, 4, , 5]);
108
+ if (!(this.ledger != null)) return [3 /*break*/, 2];
109
+ _b = (_a = FirmaUtil_1.FirmaUtil).arrayBufferToBase64;
110
+ return [4 /*yield*/, this.ledger.getPublicKey()];
111
+ case 1: return [2 /*return*/, _b.apply(_a, [_c.sent()])];
112
+ case 2: return [4 /*yield*/, this.wallet.getAccounts()];
113
+ case 3:
114
+ accounts = _c.sent();
115
+ return [2 /*return*/, FirmaUtil_1.FirmaUtil.arrayBufferToBase64(accounts[0].pubkey)];
116
+ case 4:
117
+ error_1 = _c.sent();
118
+ FirmaUtil_1.FirmaUtil.printLog(error_1);
119
+ throw error_1;
120
+ case 5: return [2 /*return*/];
121
+ }
122
+ });
123
+ });
124
+ };
101
125
  FirmaWalletService.prototype.getAddress = function () {
102
126
  return __awaiter(this, void 0, void 0, function () {
103
- var accounts, error_1;
127
+ var accounts, error_2;
104
128
  return __generator(this, function (_a) {
105
129
  switch (_a.label) {
106
130
  case 0:
@@ -113,9 +137,9 @@ var FirmaWalletService = /** @class */ (function () {
113
137
  accounts = _a.sent();
114
138
  return [2 /*return*/, accounts[0].address];
115
139
  case 4:
116
- error_1 = _a.sent();
117
- FirmaUtil_1.FirmaUtil.printLog(error_1);
118
- throw error_1;
140
+ error_2 = _a.sent();
141
+ FirmaUtil_1.FirmaUtil.printLog(error_2);
142
+ throw error_2;
119
143
  case 5: return [2 /*return*/];
120
144
  }
121
145
  });
@@ -133,7 +157,7 @@ var FirmaWalletService = /** @class */ (function () {
133
157
  FirmaWalletService.prototype.initFromMnemonic = function (mnemonic, accountIndex) {
134
158
  if (accountIndex === void 0) { accountIndex = 0; }
135
159
  return __awaiter(this, void 0, void 0, function () {
136
- var privateKey, error_2;
160
+ var privateKey, error_3;
137
161
  return __generator(this, function (_a) {
138
162
  switch (_a.label) {
139
163
  case 0:
@@ -148,9 +172,9 @@ var FirmaWalletService = /** @class */ (function () {
148
172
  _a.sent();
149
173
  return [2 /*return*/, { success: true }];
150
174
  case 3:
151
- error_2 = _a.sent();
152
- FirmaUtil_1.FirmaUtil.printLog(error_2);
153
- throw error_2;
175
+ error_3 = _a.sent();
176
+ FirmaUtil_1.FirmaUtil.printLog(error_3);
177
+ throw error_3;
154
178
  case 4: return [2 /*return*/];
155
179
  }
156
180
  });
@@ -158,7 +182,7 @@ var FirmaWalletService = /** @class */ (function () {
158
182
  };
159
183
  FirmaWalletService.prototype.getPrivateKeyInternal = function (mnemonic, accountIndex) {
160
184
  return __awaiter(this, void 0, void 0, function () {
161
- var mnemonicChecked, seed, hdpath, privkey, privateKey, error_3;
185
+ var mnemonicChecked, seed, hdpath, privkey, privateKey, error_4;
162
186
  return __generator(this, function (_a) {
163
187
  switch (_a.label) {
164
188
  case 0:
@@ -172,9 +196,9 @@ var FirmaWalletService = /** @class */ (function () {
172
196
  privateKey = "0x".concat(Buffer.from(privkey).toString("hex"));
173
197
  return [2 /*return*/, privateKey];
174
198
  case 2:
175
- error_3 = _a.sent();
176
- FirmaUtil_1.FirmaUtil.printLog(error_3);
177
- throw error_3;
199
+ error_4 = _a.sent();
200
+ FirmaUtil_1.FirmaUtil.printLog(error_4);
201
+ throw error_4;
178
202
  case 3: return [2 /*return*/];
179
203
  }
180
204
  });
@@ -182,7 +206,7 @@ var FirmaWalletService = /** @class */ (function () {
182
206
  };
183
207
  FirmaWalletService.prototype.initFromPrivateKey = function (privateKey) {
184
208
  return __awaiter(this, void 0, void 0, function () {
185
- var tempPrivateKey, _a, _b, error_4;
209
+ var tempPrivateKey, _a, _b, error_5;
186
210
  return __generator(this, function (_c) {
187
211
  switch (_c.label) {
188
212
  case 0:
@@ -199,9 +223,9 @@ var FirmaWalletService = /** @class */ (function () {
199
223
  this.privateKey = privateKey;
200
224
  return [3 /*break*/, 4];
201
225
  case 3:
202
- error_4 = _c.sent();
203
- FirmaUtil_1.FirmaUtil.printLog(error_4);
204
- throw error_4;
226
+ error_5 = _c.sent();
227
+ FirmaUtil_1.FirmaUtil.printLog(error_5);
228
+ throw error_5;
205
229
  case 4: return [2 /*return*/];
206
230
  }
207
231
  });
@@ -228,7 +252,7 @@ var FirmaWalletService = /** @class */ (function () {
228
252
  };
229
253
  FirmaWalletService.prototype.newWallet = function () {
230
254
  return __awaiter(this, void 0, void 0, function () {
231
- var mnemonic, wallet, error_5;
255
+ var mnemonic, wallet, error_6;
232
256
  return __generator(this, function (_a) {
233
257
  switch (_a.label) {
234
258
  case 0:
@@ -241,9 +265,9 @@ var FirmaWalletService = /** @class */ (function () {
241
265
  wallet = _a.sent();
242
266
  return [2 /*return*/, wallet];
243
267
  case 3:
244
- error_5 = _a.sent();
245
- FirmaUtil_1.FirmaUtil.printLog(error_5);
246
- throw error_5;
268
+ error_6 = _a.sent();
269
+ FirmaUtil_1.FirmaUtil.printLog(error_6);
270
+ throw error_6;
247
271
  case 4: return [2 /*return*/];
248
272
  }
249
273
  });
@@ -252,7 +276,7 @@ var FirmaWalletService = /** @class */ (function () {
252
276
  FirmaWalletService.prototype.fromMnemonic = function (mnemonic, accountIndex) {
253
277
  if (accountIndex === void 0) { accountIndex = 0; }
254
278
  return __awaiter(this, void 0, void 0, function () {
255
- var wallet, error_6;
279
+ var wallet, error_7;
256
280
  return __generator(this, function (_a) {
257
281
  switch (_a.label) {
258
282
  case 0:
@@ -263,9 +287,9 @@ var FirmaWalletService = /** @class */ (function () {
263
287
  _a.sent();
264
288
  return [2 /*return*/, wallet];
265
289
  case 2:
266
- error_6 = _a.sent();
267
- FirmaUtil_1.FirmaUtil.printLog(error_6);
268
- throw error_6;
290
+ error_7 = _a.sent();
291
+ FirmaUtil_1.FirmaUtil.printLog(error_7);
292
+ throw error_7;
269
293
  case 3: return [2 /*return*/];
270
294
  }
271
295
  });
@@ -273,7 +297,7 @@ var FirmaWalletService = /** @class */ (function () {
273
297
  };
274
298
  FirmaWalletService.prototype.fromPrivateKey = function (privateKey) {
275
299
  return __awaiter(this, void 0, void 0, function () {
276
- var wallet, error_7;
300
+ var wallet, error_8;
277
301
  return __generator(this, function (_a) {
278
302
  switch (_a.label) {
279
303
  case 0:
@@ -284,9 +308,9 @@ var FirmaWalletService = /** @class */ (function () {
284
308
  _a.sent();
285
309
  return [2 /*return*/, wallet];
286
310
  case 2:
287
- error_7 = _a.sent();
288
- FirmaUtil_1.FirmaUtil.printLog(error_7);
289
- throw error_7;
311
+ error_8 = _a.sent();
312
+ FirmaUtil_1.FirmaUtil.printLog(error_8);
313
+ throw error_8;
290
314
  case 3: return [2 /*return*/];
291
315
  }
292
316
  });
@@ -294,7 +318,7 @@ var FirmaWalletService = /** @class */ (function () {
294
318
  };
295
319
  FirmaWalletService.prototype.generateMnemonic = function () {
296
320
  return __awaiter(this, void 0, void 0, function () {
297
- var wallet, error_8;
321
+ var wallet, error_9;
298
322
  return __generator(this, function (_a) {
299
323
  switch (_a.label) {
300
324
  case 0:
@@ -304,9 +328,9 @@ var FirmaWalletService = /** @class */ (function () {
304
328
  wallet = _a.sent();
305
329
  return [2 /*return*/, wallet.mnemonic];
306
330
  case 2:
307
- error_8 = _a.sent();
308
- FirmaUtil_1.FirmaUtil.printLog(error_8);
309
- throw error_8;
331
+ error_9 = _a.sent();
332
+ FirmaUtil_1.FirmaUtil.printLog(error_9);
333
+ throw error_9;
310
334
  case 3: return [2 /*return*/];
311
335
  }
312
336
  });
@@ -1,3 +1,4 @@
1
1
  export * from './AuthzTxClient';
2
+ export * from './AuthzTxTypes';
2
3
  export * from './AuthzQueryClient';
3
4
  export * from '../common';
@@ -15,5 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./AuthzTxClient"), exports);
18
+ __exportStar(require("./AuthzTxTypes"), exports);
18
19
  __exportStar(require("./AuthzQueryClient"), exports);
19
20
  __exportStar(require("../common"), exports);
@@ -26,7 +26,7 @@ export declare class SigningStargateClient extends StargateClient {
26
26
  static connectWithSigner(endpoint: string, signer: OfflineDirectSigner | undefined, registry: Registry): Promise<SigningStargateClient>;
27
27
  protected constructor(tmClient: Tendermint34Client | undefined, signer: OfflineDirectSigner | undefined, registry: Registry);
28
28
  signAndBroadcast(signerAddress: string, messages: readonly EncodeObject[], fee: StdFee, memo?: string): Promise<BroadcastTxResponse>;
29
- static makeSignDocForSend(signerAddress: string, messages: readonly EncodeObject[], fee: StdFee, memo: string, serverUrl: string, chainId: string, registry: Registry): Promise<SignDoc>;
29
+ static makeSignDocForSend(signerAddress: string, pubkeyStr: string, messages: readonly EncodeObject[], fee: StdFee, memo: string, serverUrl: string, chainId: string, registry: Registry): Promise<SignDoc>;
30
30
  sign(signerAddress: string, messages: readonly EncodeObject[], fee: StdFee, memo: string, explicitSignerData?: SignerData): Promise<TxRaw>;
31
31
  getChainId(): Promise<string>;
32
32
  /**
@@ -134,7 +134,7 @@ var SigningStargateClient = /** @class */ (function (_super) {
134
134
  });
135
135
  });
136
136
  };
137
- SigningStargateClient.makeSignDocForSend = function (signerAddress, messages, fee, memo, serverUrl, chainId, registry) {
137
+ SigningStargateClient.makeSignDocForSend = function (signerAddress, pubkeyStr, messages, fee, memo, serverUrl, chainId, registry) {
138
138
  return __awaiter(this, void 0, void 0, function () {
139
139
  var _a, accountNumber, sequence, account, rawSecp256k1Pubkey, pubkey, txBodyEncodeObject, txBodyBytes, gasLimit, authInfoBytes;
140
140
  return __generator(this, function (_b) {
@@ -149,7 +149,7 @@ var SigningStargateClient = /** @class */ (function (_super) {
149
149
  account = _b.sent();
150
150
  if (account == null)
151
151
  throw new Error("Failed to retrieve account from signer");
152
- rawSecp256k1Pubkey = (0, encoding_1.fromBase64)(account.pubkey.value);
152
+ rawSecp256k1Pubkey = (0, encoding_1.fromBase64)(pubkeyStr);
153
153
  pubkey = (0, proto_signing_1.encodePubkey)((0, encoding_3.encodeSecp256k1Pubkey)(rawSecp256k1Pubkey));
154
154
  txBodyEncodeObject = {
155
155
  typeUrl: "/cosmos.tx.v1beta1.TxBody",
@@ -2,17 +2,17 @@ import { Registry, EncodeObject } from "@cosmjs/proto-signing";
2
2
  import { MsgGrantAllowance, MsgRevokeAllowance } from "./FeeGrantTxTypes";
3
3
  import { ITxClient } from "../common/ITxClient";
4
4
  import { FirmaWalletService } from "../../FirmaWalletService";
5
- export interface MsgGrantAllowanceEncodeObject extends EncodeObject {
5
+ export interface MsgFeeGrantAllowanceEncodeObject extends EncodeObject {
6
6
  readonly typeUrl: "/cosmos.feegrant.v1beta1.MsgGrantAllowance";
7
7
  readonly value: Partial<MsgGrantAllowance>;
8
8
  }
9
- export interface MsgRevokeAllowanceEncodeObject extends EncodeObject {
9
+ export interface MsgFeeGrantRevokeAllowanceEncodeObject extends EncodeObject {
10
10
  readonly typeUrl: "/cosmos.feegrant.v1beta1.MsgRevokeAllowance";
11
11
  readonly value: Partial<MsgRevokeAllowance>;
12
12
  }
13
13
  export declare class FeeGrantTxClient extends ITxClient {
14
14
  constructor(wallet: FirmaWalletService, serverUrl: string);
15
15
  static getRegistry(): Registry;
16
- static msgGrantAllowance(data: MsgGrantAllowance): MsgGrantAllowanceEncodeObject;
17
- static msgRevokeAllowance(data: MsgRevokeAllowance): MsgRevokeAllowanceEncodeObject;
16
+ static msgGrantAllowance(data: MsgGrantAllowance): MsgFeeGrantAllowanceEncodeObject;
17
+ static msgRevokeAllowance(data: MsgRevokeAllowance): MsgFeeGrantRevokeAllowanceEncodeObject;
18
18
  }
@@ -1,2 +1,3 @@
1
1
  export * from './FeeGrantTxClient';
2
+ export * from './FeeGrantQueryClient';
2
3
  export * from '../common';
@@ -15,5 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./FeeGrantTxClient"), exports);
18
- //export * from './BankQueryClient';
18
+ __exportStar(require("./FeeGrantQueryClient"), exports);
19
19
  __exportStar(require("../common"), exports);
@@ -2,22 +2,22 @@ import { Registry, EncodeObject } from "@cosmjs/proto-signing";
2
2
  import { MsgTransfer, MsgMint, MsgBurn } from "./NftTxTypes";
3
3
  import { ITxClient } from "../common/ITxClient";
4
4
  import { FirmaWalletService } from "../../FirmaWalletService";
5
- export interface MsgTransferEncodeObject extends EncodeObject {
5
+ export interface MsgNftTransferEncodeObject extends EncodeObject {
6
6
  readonly typeUrl: "/firmachain.firmachain.nft.MsgTransfer";
7
7
  readonly value: Partial<MsgTransfer>;
8
8
  }
9
- export interface MsgMintEncodeObject extends EncodeObject {
9
+ export interface MsgNftMintEncodeObject extends EncodeObject {
10
10
  readonly typeUrl: "/firmachain.firmachain.nft.MsgMint";
11
11
  readonly value: Partial<MsgMint>;
12
12
  }
13
- export interface MsgBurnEncodeObject extends EncodeObject {
13
+ export interface MsgNftBurnEncodeObject extends EncodeObject {
14
14
  readonly typeUrl: "/firmachain.firmachain.nft.MsgBurn";
15
15
  readonly value: Partial<MsgBurn>;
16
16
  }
17
17
  export declare class NftTxClient extends ITxClient {
18
18
  constructor(wallet: FirmaWalletService, serverUrl: string);
19
19
  static getRegistry(): Registry;
20
- static msgTransfer(data: MsgTransfer): MsgTransferEncodeObject;
21
- static msgMint(data: MsgMint): MsgMintEncodeObject;
22
- static msgBurn(data: MsgBurn): MsgBurnEncodeObject;
20
+ static msgTransfer(data: MsgTransfer): MsgNftTransferEncodeObject;
21
+ static msgMint(data: MsgMint): MsgNftMintEncodeObject;
22
+ static msgBurn(data: MsgBurn): MsgNftBurnEncodeObject;
23
23
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firmachain/firma-js",
3
- "version": "0.2.38",
3
+ "version": "0.2.41",
4
4
  "description": "The Official FirmaChain Javascript SDK written in Typescript",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -36,15 +36,11 @@
36
36
  "@cosmjs/math": "^0.26.0",
37
37
  "@cosmjs/proto-signing": "^0.25.6",
38
38
  "@cosmjs/tendermint-rpc": "^0.26.0",
39
- "@nftstorage/ipfs-cluster": "^5.0.1",
40
39
  "@types/pako": "^2.0.0",
41
- "axios": "^0.21.4",
40
+ "axios": "^0.27.2",
42
41
  "cosmjs-types": "^0.2.0",
43
42
  "crypto-js": "^4.1.1",
44
- "ipfs-cluster-api": "^0.0.9",
45
- "ipfs-http-client": "^52.0.5",
46
- "is-stream": "^3.0.0",
47
- "node-ipfs-cluster-api": "^0.0.1",
43
+ "form-data": "^4.0.0",
48
44
  "pako": "^2.0.2",
49
45
  "protobufjs": "^6.10.2",
50
46
  "readline-sync": "^1.4.10"