@firmachain/firma-js 0.2.31 → 0.2.34

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.
Files changed (103) hide show
  1. package/dist/index.js +5 -1
  2. package/dist/sdk/FirmaAuthzService.d.ts +13 -4
  3. package/dist/sdk/FirmaAuthzService.js +29 -26
  4. package/dist/sdk/FirmaBankService.js +2 -2
  5. package/dist/sdk/FirmaContractService.js +14 -16
  6. package/dist/sdk/FirmaCosmWasmService.js +27 -29
  7. package/dist/sdk/FirmaDistributionService.js +10 -10
  8. package/dist/sdk/FirmaFeeGrantService.js +6 -6
  9. package/dist/sdk/FirmaGovService.js +26 -26
  10. package/dist/sdk/FirmaIbcService.d.ts +15 -0
  11. package/dist/sdk/FirmaIbcService.js +144 -0
  12. package/dist/sdk/FirmaIpfsService.js +1 -1
  13. package/dist/sdk/FirmaNftService.js +9 -9
  14. package/dist/sdk/FirmaSDK.d.ts +3 -1
  15. package/dist/sdk/FirmaSDK.js +4 -1
  16. package/dist/sdk/FirmaStakingService.d.ts +17 -5
  17. package/dist/sdk/FirmaStakingService.js +22 -18
  18. package/dist/sdk/FirmaTokenService.js +16 -16
  19. package/dist/sdk/FirmaUtil.d.ts +19 -1
  20. package/dist/sdk/FirmaUtil.js +198 -3
  21. package/dist/sdk/FirmaWalletService.d.ts +3 -0
  22. package/dist/sdk/FirmaWalletService.js +21 -13
  23. package/dist/sdk/firmachain/amino/addresses.js +11 -11
  24. package/dist/sdk/firmachain/amino/aminotypes.js +36 -32
  25. package/dist/sdk/firmachain/amino/encoding.js +30 -26
  26. package/dist/sdk/firmachain/amino/multisig.js +5 -5
  27. package/dist/sdk/firmachain/amino/signature.js +4 -4
  28. package/dist/sdk/firmachain/amino/signdoc.js +1 -1
  29. package/dist/sdk/firmachain/amino/signer.d.ts +1 -2
  30. package/dist/sdk/firmachain/amino/wallet.js +14 -10
  31. package/dist/sdk/firmachain/authz/AuthzQueryClient.d.ts +13 -3
  32. package/dist/sdk/firmachain/authz/AuthzQueryClient.js +42 -15
  33. package/dist/sdk/firmachain/authz/AuthzTxClient.d.ts +5 -4
  34. package/dist/sdk/firmachain/authz/AuthzTxClient.js +6 -3
  35. package/dist/sdk/firmachain/authz/index.js +5 -1
  36. package/dist/sdk/firmachain/bank/BankQueryClient.js +4 -4
  37. package/dist/sdk/firmachain/bank/BankTxClient.d.ts +4 -3
  38. package/dist/sdk/firmachain/bank/BankTxClient.js +5 -2
  39. package/dist/sdk/firmachain/bank/index.js +5 -1
  40. package/dist/sdk/firmachain/common/CommonTxClient.d.ts +7 -0
  41. package/dist/sdk/firmachain/common/CommonTxClient.js +79 -0
  42. package/dist/sdk/firmachain/common/ITxClient.d.ts +3 -3
  43. package/dist/sdk/firmachain/common/ITxClient.js +14 -8
  44. package/dist/sdk/firmachain/common/LedgerSigningStargateClient.js +2 -2
  45. package/dist/sdk/firmachain/common/LedgerWallet.js +14 -10
  46. package/dist/sdk/firmachain/common/accounts.js +2 -2
  47. package/dist/sdk/firmachain/common/index.js +5 -1
  48. package/dist/sdk/firmachain/common/signing.js +9 -5
  49. package/dist/sdk/firmachain/common/signingaminostargateclient.d.ts +50 -0
  50. package/dist/sdk/firmachain/common/signingaminostargateclient.js +267 -0
  51. package/dist/sdk/firmachain/common/signingstargateclient.d.ts +15 -8
  52. package/dist/sdk/firmachain/common/signingstargateclient.js +82 -19
  53. package/dist/sdk/firmachain/common/stargateclient.js +6 -6
  54. package/dist/sdk/firmachain/contract/ContractQueryClient.js +2 -2
  55. package/dist/sdk/firmachain/contract/ContractTxClient.d.ts +4 -3
  56. package/dist/sdk/firmachain/contract/ContractTxClient.js +5 -2
  57. package/dist/sdk/firmachain/contract/ContractTxTypes.d.ts +4 -4
  58. package/dist/sdk/firmachain/contract/index.js +5 -1
  59. package/dist/sdk/firmachain/cosmwasm/CosmWasmQueryClient.js +7 -7
  60. package/dist/sdk/firmachain/cosmwasm/CosmWasmTxClient.d.ts +8 -7
  61. package/dist/sdk/firmachain/cosmwasm/CosmWasmTxClient.js +9 -6
  62. package/dist/sdk/firmachain/cosmwasm/index.js +5 -1
  63. package/dist/sdk/firmachain/distribution/DistributionQueryClient.js +5 -5
  64. package/dist/sdk/firmachain/distribution/DistributionTxClient.d.ts +6 -5
  65. package/dist/sdk/firmachain/distribution/DistributionTxClient.js +7 -4
  66. package/dist/sdk/firmachain/distribution/index.js +5 -1
  67. package/dist/sdk/firmachain/feegrant/FeeGrantQueryClient.js +2 -2
  68. package/dist/sdk/firmachain/feegrant/FeeGrantTxClient.d.ts +4 -3
  69. package/dist/sdk/firmachain/feegrant/FeeGrantTxClient.js +5 -2
  70. package/dist/sdk/firmachain/feegrant/index.js +5 -1
  71. package/dist/sdk/firmachain/google/protobuf/any.d.ts +1 -1
  72. package/dist/sdk/firmachain/google/protobuf/descriptor.d.ts +27 -27
  73. package/dist/sdk/firmachain/google/protobuf/duration.d.ts +1 -1
  74. package/dist/sdk/firmachain/google/protobuf/timestamp.d.ts +1 -1
  75. package/dist/sdk/firmachain/gov/GovQueryClient.js +2 -2
  76. package/dist/sdk/firmachain/gov/GovTxClient.d.ts +5 -4
  77. package/dist/sdk/firmachain/gov/GovTxClient.js +6 -3
  78. package/dist/sdk/firmachain/gov/index.js +5 -1
  79. package/dist/sdk/firmachain/ibc/IbcQueryClient.d.ts +34 -0
  80. package/dist/sdk/firmachain/ibc/IbcQueryClient.js +71 -0
  81. package/dist/sdk/firmachain/ibc/IbcTxClient.d.ts +13 -0
  82. package/dist/sdk/firmachain/ibc/IbcTxClient.js +39 -0
  83. package/dist/sdk/firmachain/ibc/index.d.ts +3 -0
  84. package/dist/sdk/firmachain/ibc/index.js +19 -0
  85. package/dist/sdk/firmachain/nft/NftTxClient.d.ts +5 -4
  86. package/dist/sdk/firmachain/nft/NftTxClient.js +6 -3
  87. package/dist/sdk/firmachain/nft/NftTxTypes.d.ts +6 -6
  88. package/dist/sdk/firmachain/nft/index.js +5 -1
  89. package/dist/sdk/firmachain/slashing/index.js +5 -1
  90. package/dist/sdk/firmachain/staking/StakingQueryClient.d.ts +17 -4
  91. package/dist/sdk/firmachain/staking/StakingQueryClient.js +44 -24
  92. package/dist/sdk/firmachain/staking/StakingTxClient.d.ts +7 -6
  93. package/dist/sdk/firmachain/staking/StakingTxClient.js +8 -5
  94. package/dist/sdk/firmachain/staking/index.js +5 -1
  95. package/dist/sdk/firmachain/token/TokenTxClient.d.ts +6 -5
  96. package/dist/sdk/firmachain/token/TokenTxClient.js +7 -4
  97. package/dist/sdk/firmachain/token/TokenTxTypes.d.ts +8 -8
  98. package/dist/sdk/firmachain/token/index.js +5 -1
  99. package/package.json +2 -3
  100. package/dist/sdk/firmachain/amino/secp256k1hdwallet.d.ts +0 -94
  101. package/dist/sdk/firmachain/amino/secp256k1hdwallet.js +0 -437
  102. package/dist/sdk/firmachain/amino/secp256k1wallet.d.ts +0 -23
  103. package/dist/sdk/firmachain/amino/secp256k1wallet.js +0 -141
@@ -1,141 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (_) try {
18
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
- var __read = (this && this.__read) || function (o, n) {
39
- var m = typeof Symbol === "function" && o[Symbol.iterator];
40
- if (!m) return o;
41
- var i = m.call(o), r, ar = [], e;
42
- try {
43
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
44
- }
45
- catch (error) { e = { error: error }; }
46
- finally {
47
- try {
48
- if (r && !r.done && (m = i["return"])) m.call(i);
49
- }
50
- finally { if (e) throw e.error; }
51
- }
52
- return ar;
53
- };
54
- var __spreadArray = (this && this.__spreadArray) || function (to, from) {
55
- for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
56
- to[j] = from[i];
57
- return to;
58
- };
59
- Object.defineProperty(exports, "__esModule", { value: true });
60
- exports.Secp256k1Wallet = void 0;
61
- var crypto_1 = require("@cosmjs/crypto");
62
- var encoding_1 = require("@cosmjs/encoding");
63
- var addresses_1 = require("./addresses");
64
- var signature_1 = require("./signature");
65
- var signdoc_1 = require("./signdoc");
66
- /**
67
- * A wallet that holds a single secp256k1 keypair.
68
- *
69
- * If you want to work with BIP39 mnemonics and multiple accounts, use Secp256k1HdWallet.
70
- */
71
- var Secp256k1Wallet = /** @class */ (function () {
72
- function Secp256k1Wallet(privkey, pubkey, prefix) {
73
- this.privkey = privkey;
74
- this.pubkey = pubkey;
75
- this.prefix = prefix;
76
- }
77
- /**
78
- * Creates a Secp256k1Wallet from the given private key
79
- *
80
- * @param privkey The private key.
81
- * @param prefix The bech32 address prefix (human readable part). Defaults to "cosmos".
82
- */
83
- Secp256k1Wallet.fromKey = function (privkey, prefix) {
84
- if (prefix === void 0) { prefix = "cosmos"; }
85
- return __awaiter(this, void 0, void 0, function () {
86
- var uncompressed;
87
- return __generator(this, function (_a) {
88
- switch (_a.label) {
89
- case 0: return [4 /*yield*/, crypto_1.Secp256k1.makeKeypair(privkey)];
90
- case 1:
91
- uncompressed = (_a.sent()).pubkey;
92
- return [2 /*return*/, new Secp256k1Wallet(privkey, crypto_1.Secp256k1.compressPubkey(uncompressed), prefix)];
93
- }
94
- });
95
- });
96
- };
97
- Object.defineProperty(Secp256k1Wallet.prototype, "address", {
98
- get: function () {
99
- return encoding_1.Bech32.encode(this.prefix, addresses_1.rawSecp256k1PubkeyToRawAddress(this.pubkey));
100
- },
101
- enumerable: false,
102
- configurable: true
103
- });
104
- Secp256k1Wallet.prototype.getAccounts = function () {
105
- return __awaiter(this, void 0, void 0, function () {
106
- return __generator(this, function (_a) {
107
- return [2 /*return*/, [
108
- {
109
- algo: "secp256k1",
110
- address: this.address,
111
- pubkey: this.pubkey,
112
- },
113
- ]];
114
- });
115
- });
116
- };
117
- Secp256k1Wallet.prototype.signAmino = function (signerAddress, signDoc) {
118
- return __awaiter(this, void 0, void 0, function () {
119
- var message, signature, signatureBytes;
120
- return __generator(this, function (_a) {
121
- switch (_a.label) {
122
- case 0:
123
- if (signerAddress !== this.address) {
124
- throw new Error("Address " + signerAddress + " not found in wallet");
125
- }
126
- message = new crypto_1.Sha256(signdoc_1.serializeSignDoc(signDoc)).digest();
127
- return [4 /*yield*/, crypto_1.Secp256k1.createSignature(message, this.privkey)];
128
- case 1:
129
- signature = _a.sent();
130
- signatureBytes = new Uint8Array(__spreadArray(__spreadArray([], __read(signature.r(32))), __read(signature.s(32))));
131
- return [2 /*return*/, {
132
- signed: signDoc,
133
- signature: signature_1.encodeSecp256k1Signature(this.pubkey, signatureBytes),
134
- }];
135
- }
136
- });
137
- });
138
- };
139
- return Secp256k1Wallet;
140
- }());
141
- exports.Secp256k1Wallet = Secp256k1Wallet;