@firmachain/firma-js 0.2.2 → 0.2.6

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 (59) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +153 -154
  3. package/dist/sdk/FirmaBankService.d.ts +5 -5
  4. package/dist/sdk/FirmaBankService.js +30 -30
  5. package/dist/sdk/FirmaConfig.d.ts +3 -3
  6. package/dist/sdk/FirmaContractService.d.ts +5 -5
  7. package/dist/sdk/FirmaContractService.js +19 -19
  8. package/dist/sdk/FirmaDistributionService.d.ts +13 -9
  9. package/dist/sdk/FirmaDistributionService.js +162 -78
  10. package/dist/sdk/FirmaFeeGrantService.d.ts +11 -8
  11. package/dist/sdk/FirmaFeeGrantService.js +128 -53
  12. package/dist/sdk/FirmaGovService.d.ts +28 -16
  13. package/dist/sdk/FirmaGovService.js +447 -119
  14. package/dist/sdk/FirmaIpfsService.d.ts +4 -4
  15. package/dist/sdk/FirmaIpfsService.js +14 -14
  16. package/dist/sdk/FirmaNftService.d.ts +4 -4
  17. package/dist/sdk/FirmaNftService.js +18 -20
  18. package/dist/sdk/FirmaSDK.js +2 -1
  19. package/dist/sdk/FirmaStakingService.d.ts +9 -6
  20. package/dist/sdk/FirmaStakingService.js +177 -97
  21. package/dist/sdk/FirmaUtil.d.ts +3 -2
  22. package/dist/sdk/FirmaUtil.js +16 -11
  23. package/dist/sdk/FirmaWalletService.d.ts +6 -6
  24. package/dist/sdk/FirmaWalletService.js +22 -22
  25. package/dist/sdk/firmachain/bank/BankQueryClient.d.ts +1 -1
  26. package/dist/sdk/firmachain/bank/BankQueryClient.js +4 -4
  27. package/dist/sdk/firmachain/bank/BankTxClient.d.ts +3 -4
  28. package/dist/sdk/firmachain/bank/BankTxClient.js +2 -2
  29. package/dist/sdk/firmachain/common/ITxClient.d.ts +5 -5
  30. package/dist/sdk/firmachain/common/ITxClient.js +7 -7
  31. package/dist/sdk/firmachain/common/TendermintQueryClient.d.ts +1 -1
  32. package/dist/sdk/firmachain/common/TendermintQueryClient.js +5 -4
  33. package/dist/sdk/firmachain/common/accounts.js +25 -20
  34. package/dist/sdk/firmachain/common/signingstargateclient.js +3 -3
  35. package/dist/sdk/firmachain/contract/ContractQueryClient.d.ts +2 -2
  36. package/dist/sdk/firmachain/contract/ContractQueryClient.js +17 -11
  37. package/dist/sdk/firmachain/contract/ContractTxClient.d.ts +3 -4
  38. package/dist/sdk/firmachain/contract/ContractTxClient.js +3 -3
  39. package/dist/sdk/firmachain/distribution/DistributionQueryClient.d.ts +2 -1
  40. package/dist/sdk/firmachain/distribution/DistributionQueryClient.js +33 -16
  41. package/dist/sdk/firmachain/distribution/DistributionTxClient.d.ts +5 -6
  42. package/dist/sdk/firmachain/distribution/DistributionTxClient.js +3 -3
  43. package/dist/sdk/firmachain/feegrant/FeeGrantQueryClient.d.ts +2 -2
  44. package/dist/sdk/firmachain/feegrant/FeeGrantQueryClient.js +4 -4
  45. package/dist/sdk/firmachain/feegrant/FeeGrantTxClient.d.ts +3 -4
  46. package/dist/sdk/firmachain/feegrant/FeeGrantTxClient.js +2 -2
  47. package/dist/sdk/firmachain/gov/GovQueryClient.d.ts +51 -3
  48. package/dist/sdk/firmachain/gov/GovQueryClient.js +62 -11
  49. package/dist/sdk/firmachain/gov/GovTxClient.d.ts +4 -5
  50. package/dist/sdk/firmachain/gov/GovTxClient.js +3 -3
  51. package/dist/sdk/firmachain/nft/NftQueryClient.d.ts +2 -2
  52. package/dist/sdk/firmachain/nft/NftQueryClient.js +11 -8
  53. package/dist/sdk/firmachain/nft/NftTxClient.d.ts +4 -5
  54. package/dist/sdk/firmachain/nft/NftTxClient.js +3 -3
  55. package/dist/sdk/firmachain/staking/StakingQueryClient.d.ts +3 -1
  56. package/dist/sdk/firmachain/staking/StakingQueryClient.js +48 -16
  57. package/dist/sdk/firmachain/staking/StakingTxClient.d.ts +6 -7
  58. package/dist/sdk/firmachain/staking/StakingTxClient.js +2 -2
  59. package/package.json +1 -1
@@ -1,18 +1,18 @@
1
1
  import { DirectSecp256k1Wallet } from "@cosmjs/proto-signing";
2
2
  import { FirmaConfig } from "./FirmaConfig";
3
3
  export declare class FirmaWalletService {
4
- private _config;
5
- private _mnemonic;
6
- private _privateKey;
7
- private _accountIndex;
8
- private _wallet;
4
+ private readonly config;
5
+ private mnemonic;
6
+ private privateKey;
7
+ private accountIndex;
8
+ private wallet;
9
9
  getHdPath(): string;
10
10
  getPrefix(): string;
11
11
  getRawWallet(): DirectSecp256k1Wallet;
12
12
  getPrivateKey(): string;
13
13
  getMnemonic(): string;
14
14
  getAddress(): Promise<string>;
15
- constructor(_config: FirmaConfig);
15
+ constructor(config: FirmaConfig);
16
16
  private static getHdPath;
17
17
  initFromMnemonic(mnemonic: string, accountIndex?: number): Promise<{
18
18
  success: boolean;
@@ -40,28 +40,28 @@ exports.FirmaWalletService = void 0;
40
40
  var proto_signing_1 = require("@cosmjs/proto-signing");
41
41
  var crypto_1 = require("@cosmjs/crypto");
42
42
  var FirmaUtil_1 = require("./FirmaUtil");
43
- var CryptoJS = require('crypto-js');
43
+ var CryptoJS = require("crypto-js");
44
44
  var FirmaWalletService = /** @class */ (function () {
45
- function FirmaWalletService(_config) {
46
- this._config = _config;
47
- this._mnemonic = "";
48
- this._privateKey = "";
49
- this._accountIndex = 0;
45
+ function FirmaWalletService(config) {
46
+ this.config = config;
47
+ this.mnemonic = "";
48
+ this.privateKey = "";
49
+ this.accountIndex = 0;
50
50
  }
51
51
  FirmaWalletService.prototype.getHdPath = function () {
52
- return this._config.hdPath;
52
+ return this.config.hdPath;
53
53
  };
54
54
  FirmaWalletService.prototype.getPrefix = function () {
55
- return this._config.prefix;
55
+ return this.config.prefix;
56
56
  };
57
57
  FirmaWalletService.prototype.getRawWallet = function () {
58
- return this._wallet;
58
+ return this.wallet;
59
59
  };
60
60
  FirmaWalletService.prototype.getPrivateKey = function () {
61
- return this._privateKey;
61
+ return this.privateKey;
62
62
  };
63
63
  FirmaWalletService.prototype.getMnemonic = function () {
64
- return this._mnemonic;
64
+ return this.mnemonic;
65
65
  };
66
66
  FirmaWalletService.prototype.getAddress = function () {
67
67
  return __awaiter(this, void 0, void 0, function () {
@@ -70,7 +70,7 @@ var FirmaWalletService = /** @class */ (function () {
70
70
  switch (_a.label) {
71
71
  case 0:
72
72
  _a.trys.push([0, 2, , 3]);
73
- return [4 /*yield*/, this._wallet.getAccounts()];
73
+ return [4 /*yield*/, this.wallet.getAccounts()];
74
74
  case 1:
75
75
  accounts = _a.sent();
76
76
  return [2 /*return*/, accounts[0].address];
@@ -100,9 +100,9 @@ var FirmaWalletService = /** @class */ (function () {
100
100
  switch (_a.label) {
101
101
  case 0:
102
102
  _a.trys.push([0, 3, , 4]);
103
- this._mnemonic = mnemonic;
104
- this._accountIndex = accountIndex;
105
- return [4 /*yield*/, this.getPrivateKeyInternal(this._mnemonic, this._accountIndex)];
103
+ this.mnemonic = mnemonic;
104
+ this.accountIndex = accountIndex;
105
+ return [4 /*yield*/, this.getPrivateKeyInternal(this.mnemonic, this.accountIndex)];
106
106
  case 1:
107
107
  privateKey = _a.sent();
108
108
  return [4 /*yield*/, this.initFromPrivateKey(privateKey)];
@@ -129,9 +129,9 @@ var FirmaWalletService = /** @class */ (function () {
129
129
  return [4 /*yield*/, crypto_1.Bip39.mnemonicToSeed(mnemonicChecked)];
130
130
  case 1:
131
131
  seed = _a.sent();
132
- hdpath = FirmaWalletService.getHdPath(this.getHdPath(), this._accountIndex);
132
+ hdpath = FirmaWalletService.getHdPath(this.getHdPath(), this.accountIndex);
133
133
  privkey = crypto_1.Slip10.derivePath(crypto_1.Slip10Curve.Secp256k1, seed, hdpath[0]).privkey;
134
- privateKey = "0x" + Buffer.from(privkey).toString('hex');
134
+ privateKey = "0x" + Buffer.from(privkey).toString("hex");
135
135
  return [2 /*return*/, privateKey];
136
136
  case 2:
137
137
  error_3 = _a.sent();
@@ -149,12 +149,12 @@ var FirmaWalletService = /** @class */ (function () {
149
149
  switch (_b.label) {
150
150
  case 0:
151
151
  _b.trys.push([0, 2, , 3]);
152
- tempPrivateKey = Buffer.from(privateKey.replace('0x', ''), 'hex');
152
+ tempPrivateKey = Buffer.from(privateKey.replace("0x", ""), "hex");
153
153
  _a = this;
154
154
  return [4 /*yield*/, proto_signing_1.DirectSecp256k1Wallet.fromKey(tempPrivateKey, this.getPrefix())];
155
155
  case 1:
156
- _a._wallet = _b.sent();
157
- this._privateKey = privateKey;
156
+ _a.wallet = _b.sent();
157
+ this.privateKey = privateKey;
158
158
  return [3 /*break*/, 3];
159
159
  case 2:
160
160
  error_4 = _b.sent();
@@ -215,7 +215,7 @@ var FirmaWalletService = /** @class */ (function () {
215
215
  switch (_a.label) {
216
216
  case 0:
217
217
  _a.trys.push([0, 2, , 3]);
218
- wallet = new FirmaWalletService(this._config);
218
+ wallet = new FirmaWalletService(this.config);
219
219
  return [4 /*yield*/, wallet.initFromMnemonic(mnemonic, accountIndex)];
220
220
  case 1:
221
221
  _a.sent();
@@ -236,7 +236,7 @@ var FirmaWalletService = /** @class */ (function () {
236
236
  switch (_a.label) {
237
237
  case 0:
238
238
  _a.trys.push([0, 2, , 3]);
239
- wallet = new FirmaWalletService(this._config);
239
+ wallet = new FirmaWalletService(this.config);
240
240
  return [4 /*yield*/, wallet.initFromPrivateKey(privateKey)];
241
241
  case 1:
242
242
  _a.sent();
@@ -1,5 +1,5 @@
1
1
  export declare class BankQueryClient {
2
- private _axios;
2
+ private readonly axios;
3
3
  constructor(baseUrl: string);
4
4
  querySupplyOf(denom: string): Promise<string>;
5
5
  queryBalance(address: string, denom: string): Promise<string>;
@@ -43,10 +43,10 @@ exports.BankQueryClient = void 0;
43
43
  var axios_1 = __importDefault(require("axios"));
44
44
  var BankQueryClient = /** @class */ (function () {
45
45
  function BankQueryClient(baseUrl) {
46
- this._axios = axios_1.default.create({
46
+ this.axios = axios_1.default.create({
47
47
  baseURL: baseUrl,
48
48
  headers: {
49
- Accept: 'application/json',
49
+ Accept: "application/json",
50
50
  },
51
51
  timeout: 15000,
52
52
  });
@@ -58,7 +58,7 @@ var BankQueryClient = /** @class */ (function () {
58
58
  switch (_a.label) {
59
59
  case 0:
60
60
  path = "/cosmos/bank/v1beta1/supply/" + denom;
61
- return [4 /*yield*/, this._axios.get(path)];
61
+ return [4 /*yield*/, this.axios.get(path)];
62
62
  case 1:
63
63
  result = _a.sent();
64
64
  return [2 /*return*/, result.data.amount.amount];
@@ -73,7 +73,7 @@ var BankQueryClient = /** @class */ (function () {
73
73
  switch (_a.label) {
74
74
  case 0:
75
75
  path = "/cosmos/bank/v1beta1/balances/" + address + "/" + denom;
76
- return [4 /*yield*/, this._axios.get(path)];
76
+ return [4 /*yield*/, this.axios.get(path)];
77
77
  case 1:
78
78
  result = _a.sent();
79
79
  return [2 /*return*/, result.data.balance.amount];
@@ -1,17 +1,16 @@
1
1
  import { EncodeObject, OfflineDirectSigner } from "@cosmjs/proto-signing";
2
2
  import { MsgSend, MsgMultiSend } from "cosmjs-types/cosmos/bank/v1beta1/tx";
3
3
  import { ITxClient } from "../common/ITxClient";
4
- interface MsgSendEncodeObject extends EncodeObject {
4
+ export interface MsgSendEncodeObject extends EncodeObject {
5
5
  readonly typeUrl: "/cosmos.bank.v1beta1.MsgSend";
6
6
  readonly value: Partial<MsgSend>;
7
7
  }
8
- interface MsgMultiSendEncodeObject extends EncodeObject {
8
+ export interface MsgMultiSendEncodeObject extends EncodeObject {
9
9
  readonly typeUrl: "/cosmos.bank.v1beta1.MsgMultiSend";
10
10
  readonly value: Partial<MsgMultiSend>;
11
11
  }
12
12
  export declare class BankTxClient extends ITxClient {
13
- constructor(_wallet: OfflineDirectSigner, _addr: string);
13
+ constructor(wallet: OfflineDirectSigner, address: string);
14
14
  msgSend(data: MsgSend): MsgSendEncodeObject;
15
15
  msgMultiSend(data: MsgMultiSend): MsgMultiSendEncodeObject;
16
16
  }
17
- export {};
@@ -26,8 +26,8 @@ var types = [
26
26
  var registry = new proto_signing_1.Registry(types);
27
27
  var BankTxClient = /** @class */ (function (_super) {
28
28
  __extends(BankTxClient, _super);
29
- function BankTxClient(_wallet, _addr) {
30
- return _super.call(this, _wallet, _addr, registry) || this;
29
+ function BankTxClient(wallet, address) {
30
+ return _super.call(this, wallet, address, registry) || this;
31
31
  }
32
32
  BankTxClient.prototype.msgSend = function (data) {
33
33
  return { typeUrl: "/cosmos.bank.v1beta1.MsgSend", value: data };
@@ -1,12 +1,12 @@
1
1
  import { Registry, EncodeObject, OfflineDirectSigner } from "@cosmjs/proto-signing";
2
2
  import { SignAndBroadcastOptions } from ".";
3
- import { TxRaw } from 'cosmjs-types/cosmos/tx/v1beta1/tx';
3
+ import { TxRaw } from "cosmjs-types/cosmos/tx/v1beta1/tx";
4
4
  import { BroadcastTxResponse } from "./stargateclient";
5
5
  export declare class ITxClient {
6
- private _wallet;
7
- private _addr;
8
- private _registry;
9
- constructor(_wallet: OfflineDirectSigner, _addr: string, _registry: Registry);
6
+ private readonly wallet;
7
+ private readonly serverUrl;
8
+ private readonly registry;
9
+ constructor(wallet: OfflineDirectSigner, serverUrl: string, registry: Registry);
10
10
  sign(msgs: EncodeObject[], { fee, memo }: SignAndBroadcastOptions): Promise<TxRaw>;
11
11
  broadcast(txRaw: TxRaw): Promise<BroadcastTxResponse>;
12
12
  signAndBroadcast(msgs: EncodeObject[], { fee, memo }: SignAndBroadcastOptions): Promise<BroadcastTxResponse>;
@@ -40,10 +40,10 @@ exports.ITxClient = void 0;
40
40
  var tx_1 = require("cosmjs-types/cosmos/tx/v1beta1/tx");
41
41
  var signingstargateclient_1 = require("./signingstargateclient");
42
42
  var ITxClient = /** @class */ (function () {
43
- function ITxClient(_wallet, _addr, _registry) {
44
- this._wallet = _wallet;
45
- this._addr = _addr;
46
- this._registry = _registry;
43
+ function ITxClient(wallet, serverUrl, registry) {
44
+ this.wallet = wallet;
45
+ this.serverUrl = serverUrl;
46
+ this.registry = registry;
47
47
  }
48
48
  ITxClient.prototype.sign = function (msgs, _a) {
49
49
  var fee = _a.fee, memo = _a.memo;
@@ -51,10 +51,10 @@ var ITxClient = /** @class */ (function () {
51
51
  var client, address;
52
52
  return __generator(this, function (_b) {
53
53
  switch (_b.label) {
54
- case 0: return [4 /*yield*/, signingstargateclient_1.SigningStargateClient.connectWithSigner(this._addr, this._wallet, this._registry)];
54
+ case 0: return [4 /*yield*/, signingstargateclient_1.SigningStargateClient.connectWithSigner(this.serverUrl, this.wallet, this.registry)];
55
55
  case 1:
56
56
  client = _b.sent();
57
- return [4 /*yield*/, this._wallet.getAccounts()];
57
+ return [4 /*yield*/, this.wallet.getAccounts()];
58
58
  case 2:
59
59
  address = (_b.sent())[0].address;
60
60
  return [4 /*yield*/, client.sign(address, msgs, fee, memo)];
@@ -68,7 +68,7 @@ var ITxClient = /** @class */ (function () {
68
68
  var client, txBytes;
69
69
  return __generator(this, function (_a) {
70
70
  switch (_a.label) {
71
- case 0: return [4 /*yield*/, signingstargateclient_1.SigningStargateClient.connectWithSigner(this._addr, this._wallet, this._registry)];
71
+ case 0: return [4 /*yield*/, signingstargateclient_1.SigningStargateClient.connectWithSigner(this.serverUrl, this.wallet, this.registry)];
72
72
  case 1:
73
73
  client = _a.sent();
74
74
  txBytes = tx_1.TxRaw.encode(txRaw).finish();
@@ -1,5 +1,5 @@
1
1
  export declare class TendermintQueryClient {
2
- private _axios;
2
+ private readonly axios;
3
3
  constructor(baseUrl: string);
4
4
  queryEstimateGas(hexTx: string): Promise<number>;
5
5
  }
@@ -43,10 +43,10 @@ exports.TendermintQueryClient = void 0;
43
43
  var axios_1 = __importDefault(require("axios"));
44
44
  var TendermintQueryClient = /** @class */ (function () {
45
45
  function TendermintQueryClient(baseUrl) {
46
- this._axios = axios_1.default.create({
46
+ this.axios = axios_1.default.create({
47
47
  baseURL: baseUrl,
48
48
  headers: {
49
- Accept: 'application/json',
49
+ Accept: "application/json",
50
50
  },
51
51
  timeout: 15000,
52
52
  });
@@ -58,11 +58,11 @@ var TendermintQueryClient = /** @class */ (function () {
58
58
  switch (_a.label) {
59
59
  case 0:
60
60
  path = "/abci_query?path=\"app/simulate\"";
61
- return [4 /*yield*/, this._axios.get(path, { params: { data: hexTx } })];
61
+ return [4 /*yield*/, this.axios.get(path, { params: { data: hexTx } })];
62
62
  case 1:
63
63
  result = _a.sent();
64
64
  data = result.data.result.response.value;
65
- jsonString = Buffer.from(data, "base64").toString('utf8');
65
+ jsonString = Buffer.from(data, "base64").toString("utf8");
66
66
  jsonData = JSON.parse(jsonString);
67
67
  return [2 /*return*/, Number.parseInt(jsonData.gas_info.gas_used)];
68
68
  }
@@ -72,6 +72,7 @@ var TendermintQueryClient = /** @class */ (function () {
72
72
  return TendermintQueryClient;
73
73
  }());
74
74
  exports.TendermintQueryClient = TendermintQueryClient;
75
+ // https://imperium-lcd.firmachain.org:26657/abci_query?path=%22app/simulate%22&data=0x0a9b010a8d010a1c2f636f736d6f732e62616e6b2e763162657461312e4d736753656e64126d0a2c6669726d6131747271796c65396d326e7679616663326e323566726b70776564323530347936617667667a72122c6669726d6131306e65336e77346b63666a36766a7a38346c326d33676a38767961637a66686d6135666636391a0f0a0475666374120731303030303030120974657374206d656d6f12670a510a460a1f2f636f736d6f732e63727970746f2e736563703235366b312e5075624b657912230a21027b57273b1d23a87862c6a47f214d77b6144b552498c2dff9e9368551b4e08a8c12040a02080118e60412120a0c0a047566637412043230303010c09a0c1a40ce1072ff09660c80595b7ff2fec36062ebcf8fde88947f1fa3f6cb5ff808edba04fcf584f81ce52e5ec9be6724759fb58a411a17ed2816210f4df5b811117e4c
75
76
  // 6669726d613177613375346b6e773734723539387175767a7964766361343271736d6b366a727667716e3779
76
77
  // curl 'http://0.0.0.0:26657/abci_query?path="/store/acc/key"&data=0x6669726d6131383934767470336461756d737a70397a36306564657074736a786a6667656d656a73646b3277'
77
78
  // curl 'http://0.0.0.0:26657/abci_query?path="/account/tbnb1hn8ym9xht925jkncjpf7lhjnax6z8nv2mu9wy3'
@@ -31,27 +31,32 @@ function accountFromAny(input) {
31
31
  // auth
32
32
  case "/cosmos.auth.v1beta1.BaseAccount":
33
33
  return accountFromBaseAccount(auth_1.BaseAccount.decode(value));
34
- case "/cosmos.auth.v1beta1.ModuleAccount": {
35
- var baseAccount = auth_1.ModuleAccount.decode(value).baseAccount;
36
- return accountFromBaseAccount(baseAccount);
37
- }
34
+ case "/cosmos.auth.v1beta1.ModuleAccount":
35
+ {
36
+ var baseAccount = auth_1.ModuleAccount.decode(value).baseAccount;
37
+ return accountFromBaseAccount(baseAccount);
38
+ }
38
39
  // vesting
39
- case "/cosmos.vesting.v1beta1.BaseVestingAccount": {
40
- var baseAccount = (_a = vesting_1.BaseVestingAccount.decode(value)) === null || _a === void 0 ? void 0 : _a.baseAccount;
41
- return accountFromBaseAccount(baseAccount);
42
- }
43
- case "/cosmos.vesting.v1beta1.ContinuousVestingAccount": {
44
- var baseAccount = (_c = (_b = vesting_1.ContinuousVestingAccount.decode(value)) === null || _b === void 0 ? void 0 : _b.baseVestingAccount) === null || _c === void 0 ? void 0 : _c.baseAccount;
45
- return accountFromBaseAccount(baseAccount);
46
- }
47
- case "/cosmos.vesting.v1beta1.DelayedVestingAccount": {
48
- var baseAccount = (_e = (_d = vesting_1.DelayedVestingAccount.decode(value)) === null || _d === void 0 ? void 0 : _d.baseVestingAccount) === null || _e === void 0 ? void 0 : _e.baseAccount;
49
- return accountFromBaseAccount(baseAccount);
50
- }
51
- case "/cosmos.vesting.v1beta1.PeriodicVestingAccount": {
52
- var baseAccount = (_g = (_f = vesting_1.PeriodicVestingAccount.decode(value)) === null || _f === void 0 ? void 0 : _f.baseVestingAccount) === null || _g === void 0 ? void 0 : _g.baseAccount;
53
- return accountFromBaseAccount(baseAccount);
54
- }
40
+ case "/cosmos.vesting.v1beta1.BaseVestingAccount":
41
+ {
42
+ var baseAccount = (_a = vesting_1.BaseVestingAccount.decode(value)) === null || _a === void 0 ? void 0 : _a.baseAccount;
43
+ return accountFromBaseAccount(baseAccount);
44
+ }
45
+ case "/cosmos.vesting.v1beta1.ContinuousVestingAccount":
46
+ {
47
+ var baseAccount = (_c = (_b = vesting_1.ContinuousVestingAccount.decode(value)) === null || _b === void 0 ? void 0 : _b.baseVestingAccount) === null || _c === void 0 ? void 0 : _c.baseAccount;
48
+ return accountFromBaseAccount(baseAccount);
49
+ }
50
+ case "/cosmos.vesting.v1beta1.DelayedVestingAccount":
51
+ {
52
+ var baseAccount = (_e = (_d = vesting_1.DelayedVestingAccount.decode(value)) === null || _d === void 0 ? void 0 : _d.baseVestingAccount) === null || _e === void 0 ? void 0 : _e.baseAccount;
53
+ return accountFromBaseAccount(baseAccount);
54
+ }
55
+ case "/cosmos.vesting.v1beta1.PeriodicVestingAccount":
56
+ {
57
+ var baseAccount = (_g = (_f = vesting_1.PeriodicVestingAccount.decode(value)) === null || _f === void 0 ? void 0 : _f.baseVestingAccount) === null || _g === void 0 ? void 0 : _g.baseAccount;
58
+ return accountFromBaseAccount(baseAccount);
59
+ }
55
60
  default:
56
61
  throw new Error("Unsupported type: '" + typeUrl + "'");
57
62
  }
@@ -67,12 +67,12 @@ var proto_signing_1 = require("@cosmjs/proto-signing");
67
67
  var tendermint_rpc_1 = require("@cosmjs/tendermint-rpc");
68
68
  var signing_1 = require("cosmjs-types/cosmos/tx/signing/v1beta1/signing");
69
69
  var tx_1 = require("cosmjs-types/cosmos/tx/v1beta1/tx");
70
- var long_1 = __importDefault(require("long"));
71
70
  var accounts_1 = require("./accounts");
72
71
  var stargateclient_1 = require("./stargateclient");
73
72
  var axios_1 = __importDefault(require("axios"));
74
73
  var math_1 = require("@cosmjs/math");
75
74
  var any_1 = require("../google/protobuf/any");
75
+ var long_1 = __importDefault(require("long"));
76
76
  var SigningStargateClient = /** @class */ (function (_super) {
77
77
  __extends(SigningStargateClient, _super);
78
78
  function SigningStargateClient(tmClient, signer, registry) {
@@ -173,11 +173,11 @@ var SigningStargateClient = /** @class */ (function (_super) {
173
173
  case 0:
174
174
  _a.trys.push([0, 2, , 3]);
175
175
  accAddress = this.toAccAddress(address);
176
- hexAccAddress = "0x01" + Buffer.from(accAddress).toString('hex');
176
+ hexAccAddress = "0x01" + Buffer.from(accAddress).toString("hex");
177
177
  axios = axios_1.default.create({
178
178
  baseURL: SigningStargateClient._endpoint,
179
179
  headers: {
180
- Accept: 'application/json',
180
+ Accept: "application/json",
181
181
  },
182
182
  timeout: 15000
183
183
  });
@@ -1,4 +1,4 @@
1
- import { Pagination } from '../common';
1
+ import { Pagination } from "../common";
2
2
  export interface ContractLogType {
3
3
  creator: string;
4
4
  id: string;
@@ -15,7 +15,7 @@ export interface ContractFileType {
15
15
  metaDataJsonString: string;
16
16
  }
17
17
  export declare class ContractQueryClient {
18
- private _axios;
18
+ private readonly axios;
19
19
  constructor(baseUrl: string);
20
20
  queryIsContractOwner(fileHash: string, ownerAddress: string): Promise<boolean>;
21
21
  queryContractFile(fileHash: string): Promise<ContractFileType>;
@@ -43,10 +43,10 @@ exports.ContractQueryClient = void 0;
43
43
  var axios_1 = __importDefault(require("axios"));
44
44
  var ContractQueryClient = /** @class */ (function () {
45
45
  function ContractQueryClient(baseUrl) {
46
- this._axios = axios_1.default.create({
46
+ this.axios = axios_1.default.create({
47
47
  baseURL: baseUrl,
48
48
  headers: {
49
- Accept: 'application/json',
49
+ Accept: "application/json",
50
50
  },
51
51
  timeout: 15000,
52
52
  });
@@ -58,7 +58,7 @@ var ContractQueryClient = /** @class */ (function () {
58
58
  switch (_a.label) {
59
59
  case 0:
60
60
  path = "/firmachain/firmachain/contract/isContractOwner";
61
- return [4 /*yield*/, this._axios.get(path, { params: { fileHash: fileHash, ownerAddress: ownerAddress } })];
61
+ return [4 /*yield*/, this.axios.get(path, { params: { fileHash: fileHash, ownerAddress: ownerAddress } })];
62
62
  case 1:
63
63
  result = _a.sent();
64
64
  return [2 /*return*/, result.data.result];
@@ -72,8 +72,8 @@ var ContractQueryClient = /** @class */ (function () {
72
72
  return __generator(this, function (_a) {
73
73
  switch (_a.label) {
74
74
  case 0:
75
- path = "/firmachain/firmachain/contract/contractFile" + "/" + fileHash;
76
- return [4 /*yield*/, this._axios.get(path)];
75
+ path = "/firmachain/firmachain/contract/contractFile/" + fileHash;
76
+ return [4 /*yield*/, this.axios.get(path)];
77
77
  case 1:
78
78
  result = _a.sent();
79
79
  return [2 /*return*/, result.data.ContractFile];
@@ -89,10 +89,13 @@ var ContractQueryClient = /** @class */ (function () {
89
89
  switch (_a.label) {
90
90
  case 0:
91
91
  path = "/firmachain/firmachain/contract/contractFile";
92
- return [4 /*yield*/, this._axios.get(path, { params: { "pagination.key": paginationKey } })];
92
+ return [4 /*yield*/, this.axios.get(path, { params: { "pagination.key": paginationKey } })];
93
93
  case 1:
94
94
  result = _a.sent();
95
- convertPagination = { next_key: result.data.pagination.next_key, total: Number.parseInt(result.data.pagination.total) };
95
+ convertPagination = {
96
+ next_key: result.data.pagination.next_key,
97
+ total: Number.parseInt(result.data.pagination.total)
98
+ };
96
99
  return [2 /*return*/, { dataList: result.data.ContractFile, pagination: convertPagination }];
97
100
  }
98
101
  });
@@ -104,8 +107,8 @@ var ContractQueryClient = /** @class */ (function () {
104
107
  return __generator(this, function (_a) {
105
108
  switch (_a.label) {
106
109
  case 0:
107
- path = "/firmachain/firmachain/contract/contractLog" + "/" + logId;
108
- return [4 /*yield*/, this._axios.get(path)];
110
+ path = "/firmachain/firmachain/contract/contractLog/" + logId;
111
+ return [4 /*yield*/, this.axios.get(path)];
109
112
  case 1:
110
113
  result = _a.sent();
111
114
  return [2 /*return*/, result.data.ContractLog];
@@ -121,10 +124,13 @@ var ContractQueryClient = /** @class */ (function () {
121
124
  switch (_a.label) {
122
125
  case 0:
123
126
  path = "/firmachain/firmachain/contract/contractLog";
124
- return [4 /*yield*/, this._axios.get(path, { params: { "pagination.key": paginationKey } })];
127
+ return [4 /*yield*/, this.axios.get(path, { params: { "pagination.key": paginationKey } })];
125
128
  case 1:
126
129
  result = _a.sent();
127
- convertPagination = { next_key: result.data.pagination.next_key, total: Number.parseInt(result.data.pagination.total) };
130
+ convertPagination = {
131
+ next_key: result.data.pagination.next_key,
132
+ total: Number.parseInt(result.data.pagination.total)
133
+ };
128
134
  return [2 /*return*/, { dataList: result.data.ContractLog, pagination: convertPagination }];
129
135
  }
130
136
  });
@@ -1,17 +1,16 @@
1
1
  import { EncodeObject, OfflineDirectSigner } from "@cosmjs/proto-signing";
2
2
  import { MsgCreateContractFile, MsgAddContractLog } from "./ContractTxTypes";
3
3
  import { ITxClient } from "../common/ITxClient";
4
- interface MsgAddContractLogEncodeObject extends EncodeObject {
4
+ export interface MsgAddContractLogEncodeObject extends EncodeObject {
5
5
  readonly typeUrl: "/firmachain.firmachain.contract.MsgAddContractLog";
6
6
  readonly value: Partial<MsgAddContractLog>;
7
7
  }
8
- interface MsgCreateContractFileEncodeObject extends EncodeObject {
8
+ export interface MsgCreateContractFileEncodeObject extends EncodeObject {
9
9
  readonly typeUrl: "/firmachain.firmachain.contract.MsgCreateContractFile";
10
10
  readonly value: Partial<MsgCreateContractFile>;
11
11
  }
12
12
  export declare class ContractTxClient extends ITxClient {
13
- constructor(_wallet: OfflineDirectSigner, _addr: string);
13
+ constructor(wallet: OfflineDirectSigner, serverUrl: string);
14
14
  msgAddContractLog(data: MsgAddContractLog): MsgAddContractLogEncodeObject;
15
15
  msgCreateContractFile(data: MsgCreateContractFile): MsgCreateContractFileEncodeObject;
16
16
  }
17
- export {};
@@ -21,13 +21,13 @@ var ContractTxTypes_1 = require("./ContractTxTypes");
21
21
  var ITxClient_1 = require("../common/ITxClient");
22
22
  var types = [
23
23
  ["/firmachain.firmachain.contract.MsgCreateContractFile", ContractTxTypes_1.MsgCreateContractFile],
24
- ["/firmachain.firmachain.contract.MsgAddContractLog", ContractTxTypes_1.MsgAddContractLog],
24
+ ["/firmachain.firmachain.contract.MsgAddContractLog", ContractTxTypes_1.MsgAddContractLog]
25
25
  ];
26
26
  var registry = new proto_signing_1.Registry(types);
27
27
  var ContractTxClient = /** @class */ (function (_super) {
28
28
  __extends(ContractTxClient, _super);
29
- function ContractTxClient(_wallet, _addr) {
30
- return _super.call(this, _wallet, _addr, registry) || this;
29
+ function ContractTxClient(wallet, serverUrl) {
30
+ return _super.call(this, wallet, serverUrl, registry) || this;
31
31
  }
32
32
  ContractTxClient.prototype.msgAddContractLog = function (data) {
33
33
  return { typeUrl: "/firmachain.firmachain.contract.MsgAddContractLog", value: data };
@@ -7,11 +7,12 @@ export interface TotalRewardInfo {
7
7
  total: string;
8
8
  }
9
9
  export declare class DistributionQueryClient {
10
- private _axios;
10
+ private readonly axios;
11
11
  constructor(baseUrl: string);
12
12
  queryGetRewardInfo(address: string, validatorAddress: string): Promise<string>;
13
13
  queryGetValidatorOutStandingReward(address: string): Promise<Coin[]>;
14
14
  queryGetValidatorCommission(address: string): Promise<Coin[]>;
15
15
  queryGetTotalRewardInfo(address: string): Promise<TotalRewardInfo>;
16
16
  queryGetCommunityPool(): Promise<string>;
17
+ queryGetWithdrawAddress(address: string): Promise<string>;
17
18
  }