@firmachain/firma-js 0.2.23 → 0.2.27

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 (156) hide show
  1. package/README.md +19 -13
  2. package/package.json +5 -4
  3. package/dist/index.d.ts +0 -4
  4. package/dist/index.js +0 -16
  5. package/dist/sdk/FirmaBankService.d.ts +0 -15
  6. package/dist/sdk/FirmaBankService.js +0 -211
  7. package/dist/sdk/FirmaChainService.d.ts +0 -8
  8. package/dist/sdk/FirmaChainService.js +0 -86
  9. package/dist/sdk/FirmaConfig.d.ts +0 -18
  10. package/dist/sdk/FirmaConfig.js +0 -63
  11. package/dist/sdk/FirmaContractService.d.ts +0 -31
  12. package/dist/sdk/FirmaContractService.js +0 -413
  13. package/dist/sdk/FirmaDistributionService.d.ts +0 -31
  14. package/dist/sdk/FirmaDistributionService.js +0 -524
  15. package/dist/sdk/FirmaFeeGrantService.d.ts +0 -21
  16. package/dist/sdk/FirmaFeeGrantService.js +0 -341
  17. package/dist/sdk/FirmaGovService.d.ts +0 -35
  18. package/dist/sdk/FirmaGovService.js +0 -775
  19. package/dist/sdk/FirmaIpfsService.d.ts +0 -12
  20. package/dist/sdk/FirmaIpfsService.js +0 -185
  21. package/dist/sdk/FirmaMobileSDK.d.ts +0 -27
  22. package/dist/sdk/FirmaMobileSDK.js +0 -45
  23. package/dist/sdk/FirmaNftService.d.ts +0 -31
  24. package/dist/sdk/FirmaNftService.js +0 -372
  25. package/dist/sdk/FirmaSDK.d.ts +0 -29
  26. package/dist/sdk/FirmaSDK.js +0 -48
  27. package/dist/sdk/FirmaSlashingService.d.ts +0 -9
  28. package/dist/sdk/FirmaSlashingService.js +0 -105
  29. package/dist/sdk/FirmaStakingService.d.ts +0 -34
  30. package/dist/sdk/FirmaStakingService.js +0 -604
  31. package/dist/sdk/FirmaTokenService.d.ts +0 -26
  32. package/dist/sdk/FirmaTokenService.js +0 -416
  33. package/dist/sdk/FirmaUtil.d.ts +0 -35
  34. package/dist/sdk/FirmaUtil.js +0 -226
  35. package/dist/sdk/FirmaWalletService.d.ts +0 -36
  36. package/dist/sdk/FirmaWalletService.js +0 -309
  37. package/dist/sdk/firmachain/amino/addresses.d.ts +0 -5
  38. package/dist/sdk/firmachain/amino/addresses.js +0 -46
  39. package/dist/sdk/firmachain/amino/aminomsgs.d.ts +0 -281
  40. package/dist/sdk/firmachain/amino/aminomsgs.js +0 -77
  41. package/dist/sdk/firmachain/amino/aminotypes.d.ts +0 -22
  42. package/dist/sdk/firmachain/amino/aminotypes.js +0 -521
  43. package/dist/sdk/firmachain/amino/coins.d.ts +0 -30
  44. package/dist/sdk/firmachain/amino/coins.js +0 -69
  45. package/dist/sdk/firmachain/amino/encoding.d.ts +0 -24
  46. package/dist/sdk/firmachain/amino/encoding.js +0 -234
  47. package/dist/sdk/firmachain/amino/multisig.d.ts +0 -10
  48. package/dist/sdk/firmachain/amino/multisig.js +0 -42
  49. package/dist/sdk/firmachain/amino/paths.d.ts +0 -6
  50. package/dist/sdk/firmachain/amino/paths.js +0 -18
  51. package/dist/sdk/firmachain/amino/pubkeys.d.ts +0 -47
  52. package/dist/sdk/firmachain/amino/pubkeys.js +0 -29
  53. package/dist/sdk/firmachain/amino/secp256k1hdwallet.d.ts +0 -94
  54. package/dist/sdk/firmachain/amino/secp256k1hdwallet.js +0 -437
  55. package/dist/sdk/firmachain/amino/secp256k1wallet.d.ts +0 -23
  56. package/dist/sdk/firmachain/amino/secp256k1wallet.js +0 -141
  57. package/dist/sdk/firmachain/amino/signature.d.ts +0 -16
  58. package/dist/sdk/firmachain/amino/signature.js +0 -36
  59. package/dist/sdk/firmachain/amino/signdoc.d.ts +0 -26
  60. package/dist/sdk/firmachain/amino/signdoc.js +0 -42
  61. package/dist/sdk/firmachain/amino/signer.d.ts +0 -33
  62. package/dist/sdk/firmachain/amino/signer.js +0 -2
  63. package/dist/sdk/firmachain/amino/stdtx.d.ts +0 -15
  64. package/dist/sdk/firmachain/amino/stdtx.js +0 -17
  65. package/dist/sdk/firmachain/amino/wallet.d.ts +0 -32
  66. package/dist/sdk/firmachain/amino/wallet.js +0 -132
  67. package/dist/sdk/firmachain/bank/BankQueryClient.d.ts +0 -12
  68. package/dist/sdk/firmachain/bank/BankQueryClient.js +0 -116
  69. package/dist/sdk/firmachain/bank/BankTxClient.d.ts +0 -17
  70. package/dist/sdk/firmachain/bank/BankTxClient.js +0 -40
  71. package/dist/sdk/firmachain/bank/index.d.ts +0 -3
  72. package/dist/sdk/firmachain/bank/index.js +0 -15
  73. package/dist/sdk/firmachain/common/ITxClient.d.ts +0 -15
  74. package/dist/sdk/firmachain/common/ITxClient.js +0 -102
  75. package/dist/sdk/firmachain/common/LedgerSigningStargateClient.d.ts +0 -27
  76. package/dist/sdk/firmachain/common/LedgerSigningStargateClient.js +0 -165
  77. package/dist/sdk/firmachain/common/LedgerWallet.d.ts +0 -14
  78. package/dist/sdk/firmachain/common/LedgerWallet.js +0 -147
  79. package/dist/sdk/firmachain/common/QueryCommon.d.ts +0 -4
  80. package/dist/sdk/firmachain/common/QueryCommon.js +0 -2
  81. package/dist/sdk/firmachain/common/TendermintQueryClient.d.ts +0 -42
  82. package/dist/sdk/firmachain/common/TendermintQueryClient.js +0 -108
  83. package/dist/sdk/firmachain/common/TxCommon.d.ts +0 -87
  84. package/dist/sdk/firmachain/common/TxCommon.js +0 -18
  85. package/dist/sdk/firmachain/common/accounts.d.ts +0 -16
  86. package/dist/sdk/firmachain/common/accounts.js +0 -64
  87. package/dist/sdk/firmachain/common/index.d.ts +0 -2
  88. package/dist/sdk/firmachain/common/index.js +0 -14
  89. package/dist/sdk/firmachain/common/signing.d.ts +0 -10
  90. package/dist/sdk/firmachain/common/signing.js +0 -75
  91. package/dist/sdk/firmachain/common/signingstargateclient.d.ts +0 -37
  92. package/dist/sdk/firmachain/common/signingstargateclient.js +0 -298
  93. package/dist/sdk/firmachain/common/stargateclient.d.ts +0 -46
  94. package/dist/sdk/firmachain/common/stargateclient.js +0 -211
  95. package/dist/sdk/firmachain/contract/ContractQueryClient.d.ts +0 -32
  96. package/dist/sdk/firmachain/contract/ContractQueryClient.js +0 -156
  97. package/dist/sdk/firmachain/contract/ContractTxClient.d.ts +0 -17
  98. package/dist/sdk/firmachain/contract/ContractTxClient.js +0 -40
  99. package/dist/sdk/firmachain/contract/ContractTxTypes.d.ts +0 -69
  100. package/dist/sdk/firmachain/contract/ContractTxTypes.js +0 -483
  101. package/dist/sdk/firmachain/contract/index.d.ts +0 -3
  102. package/dist/sdk/firmachain/contract/index.js +0 -15
  103. package/dist/sdk/firmachain/distribution/DistributionQueryClient.d.ts +0 -18
  104. package/dist/sdk/firmachain/distribution/DistributionQueryClient.js +0 -167
  105. package/dist/sdk/firmachain/distribution/DistributionTxClient.d.ts +0 -27
  106. package/dist/sdk/firmachain/distribution/DistributionTxClient.js +0 -48
  107. package/dist/sdk/firmachain/distribution/index.d.ts +0 -3
  108. package/dist/sdk/firmachain/distribution/index.js +0 -15
  109. package/dist/sdk/firmachain/feegrant/FeeGrantQueryClient.d.ts +0 -17
  110. package/dist/sdk/firmachain/feegrant/FeeGrantQueryClient.js +0 -86
  111. package/dist/sdk/firmachain/feegrant/FeeGrantTxClient.d.ts +0 -17
  112. package/dist/sdk/firmachain/feegrant/FeeGrantTxClient.js +0 -40
  113. package/dist/sdk/firmachain/feegrant/FeeGrantTxTypes.d.ts +0 -76
  114. package/dist/sdk/firmachain/feegrant/FeeGrantTxTypes.js +0 -194
  115. package/dist/sdk/firmachain/feegrant/index.d.ts +0 -2
  116. package/dist/sdk/firmachain/feegrant/index.js +0 -15
  117. package/dist/sdk/firmachain/google/protobuf/any.d.ts +0 -128
  118. package/dist/sdk/firmachain/google/protobuf/any.js +0 -106
  119. package/dist/sdk/firmachain/google/protobuf/descriptor.d.ts +0 -996
  120. package/dist/sdk/firmachain/google/protobuf/descriptor.js +0 -5329
  121. package/dist/sdk/firmachain/google/protobuf/duration.d.ts +0 -91
  122. package/dist/sdk/firmachain/google/protobuf/duration.js +0 -107
  123. package/dist/sdk/firmachain/google/protobuf/timestamp.d.ts +0 -109
  124. package/dist/sdk/firmachain/google/protobuf/timestamp.js +0 -107
  125. package/dist/sdk/firmachain/gov/GovQueryClient.d.ts +0 -61
  126. package/dist/sdk/firmachain/gov/GovQueryClient.js +0 -152
  127. package/dist/sdk/firmachain/gov/GovTxClient.d.ts +0 -22
  128. package/dist/sdk/firmachain/gov/GovTxClient.js +0 -44
  129. package/dist/sdk/firmachain/gov/index.d.ts +0 -3
  130. package/dist/sdk/firmachain/gov/index.js +0 -15
  131. package/dist/sdk/firmachain/nft/NftQueryClient.d.ts +0 -20
  132. package/dist/sdk/firmachain/nft/NftQueryClient.js +0 -125
  133. package/dist/sdk/firmachain/nft/NftTxClient.d.ts +0 -22
  134. package/dist/sdk/firmachain/nft/NftTxClient.js +0 -44
  135. package/dist/sdk/firmachain/nft/NftTxTypes.d.ts +0 -86
  136. package/dist/sdk/firmachain/nft/NftTxTypes.js +0 -424
  137. package/dist/sdk/firmachain/nft/index.d.ts +0 -3
  138. package/dist/sdk/firmachain/nft/index.js +0 -15
  139. package/dist/sdk/firmachain/slashing/SlashingQueryClient.d.ts +0 -22
  140. package/dist/sdk/firmachain/slashing/SlashingQueryClient.js +0 -101
  141. package/dist/sdk/firmachain/slashing/index.d.ts +0 -2
  142. package/dist/sdk/firmachain/slashing/index.js +0 -14
  143. package/dist/sdk/firmachain/staking/StakingQueryClient.d.ts +0 -93
  144. package/dist/sdk/firmachain/staking/StakingQueryClient.js +0 -223
  145. package/dist/sdk/firmachain/staking/StakingTxClient.d.ts +0 -32
  146. package/dist/sdk/firmachain/staking/StakingTxClient.js +0 -52
  147. package/dist/sdk/firmachain/staking/index.d.ts +0 -3
  148. package/dist/sdk/firmachain/staking/index.js +0 -15
  149. package/dist/sdk/firmachain/token/TokenQueryClient.d.ts +0 -24
  150. package/dist/sdk/firmachain/token/TokenQueryClient.js +0 -106
  151. package/dist/sdk/firmachain/token/TokenTxClient.d.ts +0 -27
  152. package/dist/sdk/firmachain/token/TokenTxClient.js +0 -48
  153. package/dist/sdk/firmachain/token/TokenTxTypes.d.ts +0 -116
  154. package/dist/sdk/firmachain/token/TokenTxTypes.js +0 -685
  155. package/dist/sdk/firmachain/token/index.d.ts +0 -3
  156. package/dist/sdk/firmachain/token/index.js +0 -15
@@ -1,77 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isAminoMsgTransfer = exports.isAminoMsgUndelegate = exports.isAminoMsgBeginRedelegate = exports.isAminoMsgDelegate = exports.isAminoMsgEditValidator = exports.isAminoMsgCreateValidator = exports.isAminoMsgUnjail = exports.isAminoMsgDeposit = exports.isAminoMsgVote = exports.isAminoMsgSubmitProposal = exports.isAminoMsgSubmitEvidence = exports.isAminoMsgFundCommunityPool = exports.isAminoMsgWithdrawValidatorCommission = exports.isAminoMsgWithdrawDelegatorReward = exports.isAminoMsgSetWithdrawAddress = exports.isAminoMsgVerifyInvariant = exports.isAminoMsgMultiSend = exports.isAminoMsgSend = void 0;
4
- function isAminoMsgSend(msg) {
5
- return msg.type === "cosmos-sdk/MsgSend";
6
- }
7
- exports.isAminoMsgSend = isAminoMsgSend;
8
- function isAminoMsgMultiSend(msg) {
9
- return msg.type === "cosmos-sdk/MsgMultiSend";
10
- }
11
- exports.isAminoMsgMultiSend = isAminoMsgMultiSend;
12
- function isAminoMsgVerifyInvariant(msg) {
13
- return msg.type === "cosmos-sdk/MsgVerifyInvariant";
14
- }
15
- exports.isAminoMsgVerifyInvariant = isAminoMsgVerifyInvariant;
16
- function isAminoMsgSetWithdrawAddress(msg) {
17
- // NOTE: Type string and names diverge here!
18
- return msg.type === "cosmos-sdk/MsgModifyWithdrawAddress";
19
- }
20
- exports.isAminoMsgSetWithdrawAddress = isAminoMsgSetWithdrawAddress;
21
- function isAminoMsgWithdrawDelegatorReward(msg) {
22
- // NOTE: Type string and names diverge here!
23
- return msg.type === "cosmos-sdk/MsgWithdrawDelegationReward";
24
- }
25
- exports.isAminoMsgWithdrawDelegatorReward = isAminoMsgWithdrawDelegatorReward;
26
- function isAminoMsgWithdrawValidatorCommission(msg) {
27
- return msg.type === "cosmos-sdk/MsgWithdrawValidatorCommission";
28
- }
29
- exports.isAminoMsgWithdrawValidatorCommission = isAminoMsgWithdrawValidatorCommission;
30
- function isAminoMsgFundCommunityPool(msg) {
31
- return msg.type === "cosmos-sdk/MsgFundCommunityPool";
32
- }
33
- exports.isAminoMsgFundCommunityPool = isAminoMsgFundCommunityPool;
34
- function isAminoMsgSubmitEvidence(msg) {
35
- return msg.type === "cosmos-sdk/MsgSubmitEvidence";
36
- }
37
- exports.isAminoMsgSubmitEvidence = isAminoMsgSubmitEvidence;
38
- function isAminoMsgSubmitProposal(msg) {
39
- return msg.type === "cosmos-sdk/MsgSubmitProposal";
40
- }
41
- exports.isAminoMsgSubmitProposal = isAminoMsgSubmitProposal;
42
- function isAminoMsgVote(msg) {
43
- return msg.type === "cosmos-sdk/MsgVote";
44
- }
45
- exports.isAminoMsgVote = isAminoMsgVote;
46
- function isAminoMsgDeposit(msg) {
47
- return msg.type === "cosmos-sdk/MsgDeposit";
48
- }
49
- exports.isAminoMsgDeposit = isAminoMsgDeposit;
50
- function isAminoMsgUnjail(msg) {
51
- return msg.type === "cosmos-sdk/MsgUnjail";
52
- }
53
- exports.isAminoMsgUnjail = isAminoMsgUnjail;
54
- function isAminoMsgCreateValidator(msg) {
55
- return msg.type === "cosmos-sdk/MsgCreateValidator";
56
- }
57
- exports.isAminoMsgCreateValidator = isAminoMsgCreateValidator;
58
- function isAminoMsgEditValidator(msg) {
59
- return msg.type === "cosmos-sdk/MsgEditValidator";
60
- }
61
- exports.isAminoMsgEditValidator = isAminoMsgEditValidator;
62
- function isAminoMsgDelegate(msg) {
63
- return msg.type === "cosmos-sdk/MsgDelegate";
64
- }
65
- exports.isAminoMsgDelegate = isAminoMsgDelegate;
66
- function isAminoMsgBeginRedelegate(msg) {
67
- return msg.type === "cosmos-sdk/MsgBeginRedelegate";
68
- }
69
- exports.isAminoMsgBeginRedelegate = isAminoMsgBeginRedelegate;
70
- function isAminoMsgUndelegate(msg) {
71
- return msg.type === "cosmos-sdk/MsgUndelegate";
72
- }
73
- exports.isAminoMsgUndelegate = isAminoMsgUndelegate;
74
- function isAminoMsgTransfer(msg) {
75
- return msg.type === "cosmos-sdk/MsgTransfer";
76
- }
77
- exports.isAminoMsgTransfer = isAminoMsgTransfer;
@@ -1,22 +0,0 @@
1
- import { AminoMsg } from "./signdoc";
2
- import { EncodeObject } from "@cosmjs/proto-signing";
3
- export interface AminoConverter {
4
- readonly aminoType: string;
5
- readonly toAmino: (value: any) => any;
6
- readonly fromAmino: (value: any) => any;
7
- }
8
- interface AminoTypesOptions {
9
- readonly additions?: Record<string, AminoConverter>;
10
- readonly prefix?: string;
11
- }
12
- /**
13
- * A map from Stargate message types as used in the messages's `Any` type
14
- * to Amino types.
15
- */
16
- export declare class AminoTypes {
17
- private readonly register;
18
- constructor({ additions, prefix }?: AminoTypesOptions);
19
- toAmino({ typeUrl, value }: EncodeObject): AminoMsg;
20
- fromAmino({ type, value }: AminoMsg): EncodeObject;
21
- }
22
- export {};
@@ -1,521 +0,0 @@
1
- "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- var __read = (this && this.__read) || function (o, n) {
14
- var m = typeof Symbol === "function" && o[Symbol.iterator];
15
- if (!m) return o;
16
- var i = m.call(o), r, ar = [], e;
17
- try {
18
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
19
- }
20
- catch (error) { e = { error: error }; }
21
- finally {
22
- try {
23
- if (r && !r.done && (m = i["return"])) m.call(i);
24
- }
25
- finally { if (e) throw e.error; }
26
- }
27
- return ar;
28
- };
29
- var __spreadArray = (this && this.__spreadArray) || function (to, from) {
30
- for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
31
- to[j] = from[i];
32
- return to;
33
- };
34
- var __importDefault = (this && this.__importDefault) || function (mod) {
35
- return (mod && mod.__esModule) ? mod : { "default": mod };
36
- };
37
- Object.defineProperty(exports, "__esModule", { value: true });
38
- exports.AminoTypes = void 0;
39
- var encoding_1 = require("@cosmjs/encoding");
40
- var utils_1 = require("@cosmjs/utils");
41
- var gov_1 = require("cosmjs-types/cosmos/gov/v1beta1/gov");
42
- var any_1 = require("cosmjs-types/google/protobuf/any");
43
- var long_1 = __importDefault(require("long"));
44
- var encoding_2 = require("./encoding");
45
- function omitDefault(input) {
46
- if (typeof input === "string") {
47
- return input === "" ? undefined : input;
48
- }
49
- if (typeof input === "number") {
50
- return input === 0 ? undefined : input;
51
- }
52
- if (long_1.default.isLong(input)) {
53
- return input.isZero() ? undefined : input;
54
- }
55
- throw new Error("Got unsupported type '" + typeof input + "'");
56
- }
57
- function createDefaultTypes(prefix) {
58
- return {
59
- // bank
60
- "/cosmos.bank.v1beta1.MsgSend": {
61
- aminoType: "cosmos-sdk/MsgSend",
62
- toAmino: function (_a) {
63
- var fromAddress = _a.fromAddress, toAddress = _a.toAddress, amount = _a.amount;
64
- return ({
65
- from_address: fromAddress,
66
- to_address: toAddress,
67
- amount: __spreadArray([], __read(amount)),
68
- });
69
- },
70
- fromAmino: function (_a) {
71
- var from_address = _a.from_address, to_address = _a.to_address, amount = _a.amount;
72
- return ({
73
- fromAddress: from_address,
74
- toAddress: to_address,
75
- amount: __spreadArray([], __read(amount)),
76
- });
77
- },
78
- },
79
- "/cosmos.bank.v1beta1.MsgMultiSend": {
80
- aminoType: "cosmos-sdk/MsgMultiSend",
81
- toAmino: function (_a) {
82
- var inputs = _a.inputs, outputs = _a.outputs;
83
- return ({
84
- inputs: inputs.map(function (input) { return ({
85
- address: input.address,
86
- coins: __spreadArray([], __read(input.coins)),
87
- }); }),
88
- outputs: outputs.map(function (output) { return ({
89
- address: output.address,
90
- coins: __spreadArray([], __read(output.coins)),
91
- }); }),
92
- });
93
- },
94
- fromAmino: function (_a) {
95
- var inputs = _a.inputs, outputs = _a.outputs;
96
- return ({
97
- inputs: inputs.map(function (input) { return ({
98
- address: input.address,
99
- coins: __spreadArray([], __read(input.coins)),
100
- }); }),
101
- outputs: outputs.map(function (output) { return ({
102
- address: output.address,
103
- coins: __spreadArray([], __read(output.coins)),
104
- }); }),
105
- });
106
- },
107
- },
108
- // distribution
109
- "/cosmos.distribution.v1beta1.MsgFundCommunityPool": {
110
- aminoType: "cosmos-sdk/MsgFundCommunityPool",
111
- toAmino: function (_a) {
112
- var amount = _a.amount, depositor = _a.depositor;
113
- return ({
114
- amount: __spreadArray([], __read(amount)),
115
- depositor: depositor,
116
- });
117
- },
118
- fromAmino: function (_a) {
119
- var amount = _a.amount, depositor = _a.depositor;
120
- return ({
121
- amount: __spreadArray([], __read(amount)),
122
- depositor: depositor,
123
- });
124
- },
125
- },
126
- "/cosmos.distribution.v1beta1.MsgSetWithdrawAddress": {
127
- aminoType: "cosmos-sdk/MsgModifyWithdrawAddress",
128
- toAmino: function (_a) {
129
- var delegatorAddress = _a.delegatorAddress, withdrawAddress = _a.withdrawAddress;
130
- return ({
131
- delegator_address: delegatorAddress,
132
- withdraw_address: withdrawAddress,
133
- });
134
- },
135
- fromAmino: function (_a) {
136
- var delegator_address = _a.delegator_address, withdraw_address = _a.withdraw_address;
137
- return ({
138
- delegatorAddress: delegator_address,
139
- withdrawAddress: withdraw_address,
140
- });
141
- },
142
- },
143
- "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward": {
144
- aminoType: "cosmos-sdk/MsgWithdrawDelegationReward",
145
- toAmino: function (_a) {
146
- var delegatorAddress = _a.delegatorAddress, validatorAddress = _a.validatorAddress;
147
- return ({
148
- delegator_address: delegatorAddress,
149
- validator_address: validatorAddress,
150
- });
151
- },
152
- fromAmino: function (_a) {
153
- var delegator_address = _a.delegator_address, validator_address = _a.validator_address;
154
- return ({
155
- delegatorAddress: delegator_address,
156
- validatorAddress: validator_address,
157
- });
158
- },
159
- },
160
- "/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission": {
161
- aminoType: "cosmos-sdk/MsgWithdrawValidatorCommission",
162
- toAmino: function (_a) {
163
- var validatorAddress = _a.validatorAddress;
164
- return ({
165
- validator_address: validatorAddress,
166
- });
167
- },
168
- fromAmino: function (_a) {
169
- var validator_address = _a.validator_address;
170
- return ({
171
- validatorAddress: validator_address,
172
- });
173
- },
174
- },
175
- // gov
176
- "/cosmos.gov.v1beta1.MsgDeposit": {
177
- aminoType: "cosmos-sdk/MsgDeposit",
178
- toAmino: function (_a) {
179
- var amount = _a.amount, depositor = _a.depositor, proposalId = _a.proposalId;
180
- return {
181
- amount: amount,
182
- depositor: depositor,
183
- proposal_id: proposalId.toString(),
184
- };
185
- },
186
- fromAmino: function (_a) {
187
- var amount = _a.amount, depositor = _a.depositor, proposal_id = _a.proposal_id;
188
- return {
189
- amount: Array.from(amount),
190
- depositor: depositor,
191
- proposalId: long_1.default.fromString(proposal_id),
192
- };
193
- },
194
- },
195
- "/cosmos.gov.v1beta1.MsgVote": {
196
- aminoType: "cosmos-sdk/MsgVote",
197
- toAmino: function (_a) {
198
- var option = _a.option, proposalId = _a.proposalId, voter = _a.voter;
199
- return {
200
- option: option,
201
- proposal_id: proposalId.toString(),
202
- voter: voter,
203
- };
204
- },
205
- fromAmino: function (_a) {
206
- var option = _a.option, proposal_id = _a.proposal_id, voter = _a.voter;
207
- return {
208
- option: gov_1.voteOptionFromJSON(option),
209
- proposalId: long_1.default.fromString(proposal_id),
210
- voter: voter,
211
- };
212
- },
213
- },
214
- "/cosmos.gov.v1beta1.MsgSubmitProposal": {
215
- aminoType: "cosmos-sdk/MsgSubmitProposal",
216
- toAmino: function (_a) {
217
- var initialDeposit = _a.initialDeposit, proposer = _a.proposer, content = _a.content;
218
- utils_1.assertDefinedAndNotNull(content);
219
- var proposal;
220
- switch (content.typeUrl) {
221
- case "/cosmos.gov.v1beta1.TextProposal": {
222
- var textProposal = gov_1.TextProposal.decode(content.value);
223
- proposal = {
224
- type: "cosmos-sdk/TextProposal",
225
- value: {
226
- description: textProposal.description,
227
- title: textProposal.title,
228
- },
229
- };
230
- break;
231
- }
232
- default:
233
- throw new Error("Unsupported proposal type: '" + content.typeUrl + "'");
234
- }
235
- return {
236
- initial_deposit: initialDeposit,
237
- proposer: proposer,
238
- content: proposal,
239
- };
240
- },
241
- fromAmino: function (_a) {
242
- var initial_deposit = _a.initial_deposit, proposer = _a.proposer, content = _a.content;
243
- var any_content;
244
- switch (content.type) {
245
- case "cosmos-sdk/TextProposal": {
246
- var value = content.value;
247
- utils_1.assert(utils_1.isNonNullObject(value));
248
- var _b = value, title = _b.title, description = _b.description;
249
- utils_1.assert(typeof title === "string");
250
- utils_1.assert(typeof description === "string");
251
- any_content = any_1.Any.fromPartial({
252
- typeUrl: "/cosmos.gov.v1beta1.TextProposal",
253
- value: gov_1.TextProposal.encode(gov_1.TextProposal.fromPartial({
254
- title: title,
255
- description: description,
256
- })).finish(),
257
- });
258
- break;
259
- }
260
- default:
261
- throw new Error("Unsupported proposal type: '" + content.type + "'");
262
- }
263
- return {
264
- initialDeposit: Array.from(initial_deposit),
265
- proposer: proposer,
266
- content: any_content,
267
- };
268
- },
269
- },
270
- // staking
271
- "/cosmos.staking.v1beta1.MsgBeginRedelegate": {
272
- aminoType: "cosmos-sdk/MsgBeginRedelegate",
273
- toAmino: function (_a) {
274
- var delegatorAddress = _a.delegatorAddress, validatorSrcAddress = _a.validatorSrcAddress, validatorDstAddress = _a.validatorDstAddress, amount = _a.amount;
275
- utils_1.assertDefinedAndNotNull(amount, "missing amount");
276
- return {
277
- delegator_address: delegatorAddress,
278
- validator_src_address: validatorSrcAddress,
279
- validator_dst_address: validatorDstAddress,
280
- amount: amount,
281
- };
282
- },
283
- fromAmino: function (_a) {
284
- var delegator_address = _a.delegator_address, validator_src_address = _a.validator_src_address, validator_dst_address = _a.validator_dst_address, amount = _a.amount;
285
- return ({
286
- delegatorAddress: delegator_address,
287
- validatorSrcAddress: validator_src_address,
288
- validatorDstAddress: validator_dst_address,
289
- amount: amount,
290
- });
291
- },
292
- },
293
- "/cosmos.staking.v1beta1.MsgCreateValidator": {
294
- aminoType: "cosmos-sdk/MsgCreateValidator",
295
- toAmino: function (_a) {
296
- var description = _a.description, commission = _a.commission, minSelfDelegation = _a.minSelfDelegation, delegatorAddress = _a.delegatorAddress, validatorAddress = _a.validatorAddress, pubkey = _a.pubkey, value = _a.value;
297
- utils_1.assertDefinedAndNotNull(description, "missing description");
298
- utils_1.assertDefinedAndNotNull(commission, "missing commission");
299
- utils_1.assertDefinedAndNotNull(pubkey, "missing pubkey");
300
- utils_1.assertDefinedAndNotNull(value, "missing value");
301
- return {
302
- description: {
303
- moniker: description.moniker,
304
- identity: description.identity,
305
- website: description.website,
306
- security_contact: description.securityContact,
307
- details: description.details,
308
- },
309
- commission: {
310
- rate: commission.rate,
311
- max_rate: commission.maxRate,
312
- max_change_rate: commission.maxChangeRate,
313
- },
314
- min_self_delegation: minSelfDelegation,
315
- delegator_address: delegatorAddress,
316
- validator_address: validatorAddress,
317
- pubkey: encoding_2.encodeBech32Pubkey({
318
- type: "tendermint/PubKeySecp256k1",
319
- value: encoding_1.toBase64(pubkey.value),
320
- }, prefix),
321
- value: value,
322
- };
323
- },
324
- fromAmino: function (_a) {
325
- var description = _a.description, commission = _a.commission, min_self_delegation = _a.min_self_delegation, delegator_address = _a.delegator_address, validator_address = _a.validator_address, pubkey = _a.pubkey, value = _a.value;
326
- var decodedPubkey = encoding_2.decodeBech32Pubkey(pubkey);
327
- if (decodedPubkey.type !== "tendermint/PubKeySecp256k1") {
328
- throw new Error("Only Secp256k1 public keys are supported");
329
- }
330
- return {
331
- description: {
332
- moniker: description.moniker,
333
- identity: description.identity,
334
- website: description.website,
335
- securityContact: description.security_contact,
336
- details: description.details,
337
- },
338
- commission: {
339
- rate: commission.rate,
340
- maxRate: commission.max_rate,
341
- maxChangeRate: commission.max_change_rate,
342
- },
343
- minSelfDelegation: min_self_delegation,
344
- delegatorAddress: delegator_address,
345
- validatorAddress: validator_address,
346
- pubkey: {
347
- typeUrl: "/cosmos.crypto.secp256k1.PubKey",
348
- value: encoding_1.fromBase64(decodedPubkey.value),
349
- },
350
- value: value,
351
- };
352
- },
353
- },
354
- "/cosmos.staking.v1beta1.MsgDelegate": {
355
- aminoType: "cosmos-sdk/MsgDelegate",
356
- toAmino: function (_a) {
357
- var delegatorAddress = _a.delegatorAddress, validatorAddress = _a.validatorAddress, amount = _a.amount;
358
- utils_1.assertDefinedAndNotNull(amount, "missing amount");
359
- return {
360
- delegator_address: delegatorAddress,
361
- validator_address: validatorAddress,
362
- amount: amount,
363
- };
364
- },
365
- fromAmino: function (_a) {
366
- var delegator_address = _a.delegator_address, validator_address = _a.validator_address, amount = _a.amount;
367
- return ({
368
- delegatorAddress: delegator_address,
369
- validatorAddress: validator_address,
370
- amount: amount,
371
- });
372
- },
373
- },
374
- "/cosmos.staking.v1beta1.MsgEditValidator": {
375
- aminoType: "cosmos-sdk/MsgEditValidator",
376
- toAmino: function (_a) {
377
- var description = _a.description, commissionRate = _a.commissionRate, minSelfDelegation = _a.minSelfDelegation, validatorAddress = _a.validatorAddress;
378
- utils_1.assertDefinedAndNotNull(description, "missing description");
379
- return {
380
- description: {
381
- moniker: description.moniker,
382
- identity: description.identity,
383
- website: description.website,
384
- security_contact: description.securityContact,
385
- details: description.details,
386
- },
387
- commission_rate: commissionRate,
388
- min_self_delegation: minSelfDelegation,
389
- validator_address: validatorAddress,
390
- };
391
- },
392
- fromAmino: function (_a) {
393
- var description = _a.description, commission_rate = _a.commission_rate, min_self_delegation = _a.min_self_delegation, validator_address = _a.validator_address;
394
- return ({
395
- description: {
396
- moniker: description.moniker,
397
- identity: description.identity,
398
- website: description.website,
399
- securityContact: description.security_contact,
400
- details: description.details,
401
- },
402
- commissionRate: commission_rate,
403
- minSelfDelegation: min_self_delegation,
404
- validatorAddress: validator_address,
405
- });
406
- },
407
- },
408
- "/cosmos.staking.v1beta1.MsgUndelegate": {
409
- aminoType: "cosmos-sdk/MsgUndelegate",
410
- toAmino: function (_a) {
411
- var delegatorAddress = _a.delegatorAddress, validatorAddress = _a.validatorAddress, amount = _a.amount;
412
- utils_1.assertDefinedAndNotNull(amount, "missing amount");
413
- return {
414
- delegator_address: delegatorAddress,
415
- validator_address: validatorAddress,
416
- amount: amount,
417
- };
418
- },
419
- fromAmino: function (_a) {
420
- var delegator_address = _a.delegator_address, validator_address = _a.validator_address, amount = _a.amount;
421
- return ({
422
- delegatorAddress: delegator_address,
423
- validatorAddress: validator_address,
424
- amount: amount,
425
- });
426
- },
427
- },
428
- // ibc
429
- "/ibc.applications.transfer.v1.MsgTransfer": {
430
- aminoType: "cosmos-sdk/MsgTransfer",
431
- toAmino: function (_a) {
432
- var _b, _c, _d;
433
- var sourcePort = _a.sourcePort, sourceChannel = _a.sourceChannel, token = _a.token, sender = _a.sender, receiver = _a.receiver, timeoutHeight = _a.timeoutHeight, timeoutTimestamp = _a.timeoutTimestamp;
434
- return ({
435
- source_port: sourcePort,
436
- source_channel: sourceChannel,
437
- token: token,
438
- sender: sender,
439
- receiver: receiver,
440
- timeout_height: timeoutHeight
441
- ? {
442
- revision_height: (_b = omitDefault(timeoutHeight.revisionHeight)) === null || _b === void 0 ? void 0 : _b.toString(),
443
- revision_number: (_c = omitDefault(timeoutHeight.revisionNumber)) === null || _c === void 0 ? void 0 : _c.toString(),
444
- }
445
- : {},
446
- timeout_timestamp: (_d = omitDefault(timeoutTimestamp)) === null || _d === void 0 ? void 0 : _d.toString(),
447
- });
448
- },
449
- fromAmino: function (_a) {
450
- var source_port = _a.source_port, source_channel = _a.source_channel, token = _a.token, sender = _a.sender, receiver = _a.receiver, timeout_height = _a.timeout_height, timeout_timestamp = _a.timeout_timestamp;
451
- return ({
452
- sourcePort: source_port,
453
- sourceChannel: source_channel,
454
- token: token,
455
- sender: sender,
456
- receiver: receiver,
457
- timeoutHeight: timeout_height
458
- ? {
459
- revisionHeight: long_1.default.fromString(timeout_height.revision_height || "0", true),
460
- revisionNumber: long_1.default.fromString(timeout_height.revision_number || "0", true),
461
- }
462
- : undefined,
463
- timeoutTimestamp: long_1.default.fromString(timeout_timestamp || "0", true),
464
- });
465
- },
466
- },
467
- };
468
- }
469
- /**
470
- * A map from Stargate message types as used in the messages's `Any` type
471
- * to Amino types.
472
- */
473
- var AminoTypes = /** @class */ (function () {
474
- function AminoTypes(_a) {
475
- var _b = _a === void 0 ? {} : _a, _c = _b.additions, additions = _c === void 0 ? {} : _c, _d = _b.prefix, prefix = _d === void 0 ? "cosmos" : _d;
476
- var additionalAminoTypes = Object.values(additions);
477
- var filteredDefaultTypes = Object.entries(createDefaultTypes(prefix)).reduce(function (acc, _a) {
478
- var _b;
479
- var _c = __read(_a, 2), key = _c[0], value = _c[1];
480
- return additionalAminoTypes.find(function (_a) {
481
- var aminoType = _a.aminoType;
482
- return value.aminoType === aminoType;
483
- })
484
- ? acc
485
- : __assign(__assign({}, acc), (_b = {}, _b[key] = value, _b));
486
- }, {});
487
- this.register = __assign(__assign({}, filteredDefaultTypes), additions);
488
- }
489
- AminoTypes.prototype.toAmino = function (_a) {
490
- var typeUrl = _a.typeUrl, value = _a.value;
491
- var converter = this.register[typeUrl];
492
- if (!converter) {
493
- throw new Error("Type URL does not exist in the Amino message type register. " +
494
- "If you need support for this message type, you can pass in additional entries to the AminoTypes constructor. " +
495
- "If you think this message type should be included by default, please open an issue at https://github.com/cosmos/cosmjs/issues.");
496
- }
497
- return {
498
- type: converter.aminoType,
499
- value: converter.toAmino(value),
500
- };
501
- };
502
- AminoTypes.prototype.fromAmino = function (_a) {
503
- var type = _a.type, value = _a.value;
504
- var result = Object.entries(this.register).find(function (_a) {
505
- var _b = __read(_a, 2), _typeUrl = _b[0], aminoType = _b[1].aminoType;
506
- return aminoType === type;
507
- });
508
- if (!result) {
509
- throw new Error("Type does not exist in the Amino message type register. " +
510
- "If you need support for this message type, you can pass in additional entries to the AminoTypes constructor. " +
511
- "If you think this message type should be included by default, please open an issue at https://github.com/cosmos/cosmjs/issues.");
512
- }
513
- var _b = __read(result, 2), typeUrl = _b[0], converter = _b[1];
514
- return {
515
- typeUrl: typeUrl,
516
- value: converter.fromAmino(value),
517
- };
518
- };
519
- return AminoTypes;
520
- }());
521
- exports.AminoTypes = AminoTypes;
@@ -1,30 +0,0 @@
1
- export interface Coin {
2
- readonly denom: string;
3
- readonly amount: string;
4
- }
5
- /**
6
- * Creates a coin.
7
- *
8
- * If your values do not exceed the safe integer range of JS numbers (53 bit),
9
- * you can use the number type here. This is the case for all typical Cosmos SDK
10
- * chains that use the default 6 decimals.
11
- *
12
- * In case you need to supportr larger values, use unsigned integer strings instead.
13
- */
14
- export declare function coin(amount: number | string, denom: string): Coin;
15
- /**
16
- * Creates a list of coins with one element.
17
- */
18
- export declare function coins(amount: number | string, denom: string): Coin[];
19
- /**
20
- * Takes a coins list like "819966000ucosm,700000000ustake" and parses it.
21
- *
22
- * A Stargate-ready variant of this function is available via:
23
- *
24
- * ```
25
- * import { parseCoins } from "@cosmjs/proto-signing";
26
- * // or
27
- * import { parseCoins } from "@cosmjs/stargate";
28
- * ```
29
- */
30
- export declare function parseCoins(input: string): Coin[];